?? sale2.c
字號:
#ifdef VER_RSNT /* Support the restautant function */
byte waiterno;
#endif /* End VER_RSNT */
for(i = 0; i < SndTnsBf_Len; i ++)
{
ID = BakTnsBf[i].ID & 0x1F;
amount = BakTnsBf[i].price;
switch(ID)
{
case TS_DEPT: /* Update the department report */
Idx = BakTnsBf[i].nth;
dept[Idx].amount += amount;
dept[Idx].PTD_amount += amount;
break;
case TS_PLU: /* Update the PLU report */
Idx = BakTnsBf[i].nth;
plu[Idx].amount += amount;
#ifdef PLU_PTD_RPT
plu[Idx].PTD_amount += amount;
#endif
plink = plu[Idx].plink;
dept[plink-1].amount += amount;
dept[plink-1].PTD_amount += amount;
break;
}
}
for(i = 0; i < TnsBf_Len; i ++)
{
peridxtmp = (transbuff[i].ID)>>5;
ID = (transbuff[i].ID)&0x1F;
switch(ID)
{
case TS_DEPT: /* Department normal operation */
case TS_VD_DEPT: /* Department VOID operation */
case TS_RM_DEPT: /* Department RETURN operation */
case TS_RF_ITEM_DEPT: /* Department Refund after item operation */
case TS_PER_ITEM_DEPT: /* Department Percent after item operation */
#ifdef AUTO_PER /* Support the department auto percent function */
case TS_AUTO_PER_DEPT: /* Department Auto Percent operation */
#endif /* End AUTO_PER */
Idx = transbuff[i].nth;
if((ID == TS_DEPT) || (ID == TS_RM_DEPT) || (ID == TS_RF_ITEM_DEPT))
amount = Sale_Mul(transbuff[i].price, sysflag->sysdots, transbuff[i].quantity, 3, (transbuff[i].flag)>>4, sysflag->sysdots);
else
amount = transbuff[i].price;
if((ID == TS_DEPT) || (ID == TS_RM_DEPT))
/* Only the normal operation and RETURN operation need update the quantity */
{
if(ID == TS_DEPT) /* For the quantity is always positive */
{
dept[Idx].quantity += transbuff[i].quantity;
dept[Idx].PTD_quantity += transbuff[i].quantity;
}
else
{
dept[Idx].quantity -= transbuff[i].quantity;
dept[Idx].PTD_quantity -= transbuff[i].quantity;
}
}
// dept[Idx].amount += amount;
// dept[Idx].PTD_amount += amount;
if(ID == TS_DEPT)
{
}
else if(ID == TS_VD_DEPT) /* Update the VOID operation report */
{
report.VDcount++;
PTD_report.VDcount++;
report.VDamount += amount; /* Negative */
PTD_report.VDamount += amount;
}
else if(ID == TS_RM_DEPT) /* Update the Return operation report */
{
report.RMquantity += transbuff[i].quantity;
PTD_report.RMquantity += transbuff[i].quantity;
report.RMamount += amount; /* Negative */
PTD_report.RMamount += amount;
}
else if(ID == TS_RF_ITEM_DEPT) /* Update the Refund after item report */
{
report.RF_Item_Qty += transbuff[i].quantity;
PTD_report.RF_Item_Qty += transbuff[i].quantity;
report.RF_Item_amount += amount; /* Negative */
PTD_report.RF_Item_amount += amount;
}
else if(ID == TS_PER_ITEM_DEPT) /* Update the Percent after item report */
{
report.Per_Item_Cnt[peridxtmp] ++;
PTD_report.Per_Item_Cnt[peridxtmp] ++;
report.Per_Item_Amt[peridxtmp] += amount; /* Signed */
PTD_report.Per_Item_Amt[peridxtmp] += amount;
}
#ifdef AUTO_PER /* Support the department auto percent function */
else if(ID == TS_AUTO_PER_DEPT)
{
}
#endif /* End AUTO_PER */
break;
#ifdef REST_PLU_FUNC
#ifdef STOCK /* Support the PLU stock function */
case TS_PLU_GIFT: /* PLU normal operation */
case TS_RM_PLU_GIFT:
Idx = transbuff[i].nth;
if(sysflag->PLU_Stock_Flag == 1)
{
plu[Idx].inventory -= transbuff[i].quantity;
}
break;
#endif /* End STOCK */
case TS_MENU_REAR:
Idx = transbuff[i].nth;
Menu_Table[Idx].quantity+=transbuff[i].quantity;
Menu_Table[Idx].PTD_quantity+=transbuff[i].quantity;
Menu_Table[Idx].count++;
Menu_Table[Idx].PTD_count++;
Menu_Table[Idx].amount+=transbuff[i].price;
Menu_Table[Idx].PTD_amount+=transbuff[i].price;
Set_Rpt_Flag(RPT_MENU_DAILY);
Set_Rpt_Flag(RPT_MENU_PTD);
break;
case TS_PLU_DESC:
case TS_MENU_HEAD:
break;
#endif
case TS_PLU: /* PLU normal operation */
case TS_VD_PLU: /* PLU VOID operation */
case TS_RM_PLU: /* PLU RETURN operation */
case TS_RF_ITEM_PLU: /* PLU Refund after item operation */
case TS_PER_ITEM_PLU: /* PLU Percent after item operation */
#ifdef AUTO_PER /* Support the department auto percent function */
case TS_AUTO_PER_PLU: /* PLU Auto Percent operation */
#endif /* End AUTO_PER */
Idx = transbuff[i].nth;
if((ID == TS_PLU) || (ID == TS_RM_PLU) || (ID == TS_RF_ITEM_PLU))
amount = Sale_Mul(transbuff[i].price, sysflag->sysdots, transbuff[i].quantity, 3, (transbuff[i].flag)>>4, sysflag->sysdots);
else
amount = transbuff[i].price;
if((ID == TS_PLU) || (ID == TS_RM_PLU))
/* Only the normal operation and RETURN operation need update the quantity */
{
if(ID == TS_PLU)
{
plu[Idx].quantity += transbuff[i].quantity;
#ifdef PLU_PTD_RPT
plu[Idx].PTD_quantity += transbuff[i].quantity;
#endif
}
else // ID == TS_RM_PLU
{
plu[Idx].quantity -= transbuff[i].quantity;
#ifdef PLU_PTD_RPT
plu[Idx].PTD_quantity -= transbuff[i].quantity;
#endif
}
#ifdef STOCK /* Support the PLU stock function */
if(sysflag->PLU_Stock_Flag == 1)
{
if(ID == TS_PLU) /* For the quantity is always positive */
plu[Idx].inventory -= transbuff[i].quantity;
else // ID == TS_RM_PLU
plu[Idx].inventory += transbuff[i].quantity;
}
#endif /* End STOCK */
}
// plu[Idx].amount += amount;
// #ifdef PLU_PTD_RPT
// plu[Idx].PTD_amount += amount;
// #endif
plink = plu[Idx].plink;
if((ID == TS_PLU) || (ID == TS_RM_PLU))
/* Only the normal operation and RETURN operation need update the quantity */
{
if(ID == TS_PLU) /* For the quantity is always positive */
{
dept[plink - 1].quantity += transbuff[i].quantity;
dept[plink - 1].PTD_quantity += transbuff[i].quantity;
}
else // ID == TS_RM_PLU
{
dept[plink - 1].quantity -= transbuff[i].quantity;
dept[plink - 1].PTD_quantity -= transbuff[i].quantity;
}
}
// dept[plink - 1].amount += amount;
// dept[plink - 1].PTD_amount += amount;
if(ID == TS_PLU)
{
}
else if(ID == TS_VD_PLU) /* Update the VOID operation report */
{
report.VDcount++;
PTD_report.VDcount++;
report.VDamount += amount; /* Negative */
PTD_report.VDamount += amount;
}
else if(ID == TS_RM_PLU) /* Update the Return Merchandise report */
{
report.RMquantity += transbuff[i].quantity;
PTD_report.RMquantity += transbuff[i].quantity;
report.RMamount += amount; /* Negative */
PTD_report.RMamount += amount;
}
else if(ID == TS_RF_ITEM_PLU) /* Update the Refund after item report */
{
report.RF_Item_Qty += transbuff[i].quantity;
PTD_report.RF_Item_Qty += transbuff[i].quantity;
report.RF_Item_amount += amount; /* Negative */
PTD_report.RF_Item_amount += amount;
}
else if(ID == TS_PER_ITEM_PLU) /* Update the Percent after item report */
{
report.Per_Item_Cnt[peridxtmp] ++;
PTD_report.Per_Item_Cnt[peridxtmp] ++;
report.Per_Item_Amt[peridxtmp] += amount; /* Signed */
PTD_report.Per_Item_Amt[peridxtmp] += amount;
}
#ifdef AUTO_PER /* Support the department auto percent function */
else if(ID == TS_AUTO_PER_PLU)
{
}
#endif /* End AUTO_PER */
break;
case TS_RF_SUBT: /* Refund after sub total operation */
amount = Sale_Mul(transbuff[i].price, sysflag->sysdots, transbuff[i].quantity, 3, (transbuff[i].flag)>>4, sysflag->sysdots);
report.RF_SubTtl_Qty += transbuff[i].quantity;
PTD_report.RF_SubTtl_Qty += transbuff[i].quantity;
report.RF_SubTtl_amount += amount; /* Negative */
PTD_report.RF_SubTtl_amount += amount;
break;
case TS_PER_SUBT: /* Percent after sub total operation */
amount = transbuff[i].price;
report.Per_SubTtl_Cnt[peridxtmp] ++;
PTD_report.Per_SubTtl_Cnt[peridxtmp] ++;
report.Per_SubTtl_Amt[peridxtmp] += amount; /* Signed */
PTD_report.Per_SubTtl_Amt[peridxtmp] += amount;
break;
case TS_EC: /* Error correct operation */
amount = labs(transbuff[i].price); /* Get the absolute value */
report.ECcount ++;
PTD_report.ECcount ++;
report.ECamount += amount; /* Positive */
PTD_report.ECamount += amount;
break;
}
}
report.NetNum ++;
PTD_report.NetNum ++;
report.NetAmt += tmpvars.netamt;
PTD_report.NetAmt += tmpvars.netamt;
if(sysflag->Tax_System) /* Tax mode */
{
report.NetSale += (tmpvars.netamt - tmpvars.TVATAmt[0] - tmpvars.TVATAmt[1]);
PTD_report.NetSale += (tmpvars.netamt - tmpvars.TVATAmt[0] - tmpvars.TVATAmt[1]);
}
else /* VAT mode */
{
report.NetSale += (tmpvars.netamt - tmpvars.TVATAmt[0] - tmpvars.TVATAmt[1]
- tmpvars.TVATAmt[2] - tmpvars.TVATAmt[3]);
PTD_report.NetSale += (tmpvars.netamt - tmpvars.TVATAmt[0] - tmpvars.TVATAmt[1]
- tmpvars.TVATAmt[2] - tmpvars.TVATAmt[3]);
}
if(sysflag->Tax_System)
{
for(i = 0; i < MAX_TAX_NUM; i ++)
{
report.TVATAble[i] += tmpvars.saleAmt_TVAT[i];
PTD_report.TVATAble[i] += tmpvars.saleAmt_TVAT[i];
report.TVATAmt[i] += tmpvars.TVATAmt[i];
PTD_report.TVATAmt[i] += tmpvars.TVATAmt[i];
}
}
else
{
for(i = 0; i < MAX_VAT_NUM; i ++)
{
report.TVATAble[i] += tmpvars.saleAmt_TVAT[i];
PTD_report.TVATAble[i] += tmpvars.saleAmt_TVAT[i];
report.TVATAmt[i] += tmpvars.TVATAmt[i];
PTD_report.TVATAmt[i] += tmpvars.TVATAmt[i];
}
}
report.GrandTotal += tmpvars.netamt;
PTD_report.GrandTotal += tmpvars.netamt;
DL_Add(&report.NRGT, tmpvars.netamt, sysflag->sysdots);
DL_Add(&PTD_report.NRGT, tmpvars.netamt, sysflag->sysdots);
Set_Rpt_Flag(RPT_FULL_DAILY);
Set_Rpt_Flag(RPT_FULL_PTD);
Set_Rpt_Flag(RPT_NRGT);
#ifdef VER_RSNT /* Support the restaurant function */
if((work_mode == RSNT) && (currtable != NUL_VLU))
{
table[currtable - 1].count ++;
table[currtable - 1].amount += tmpvars.netamt;
Set_Rpt_Flag(RPT_TABLE);
waiterno = table[currtable - 1].waiterno;
if(waiterno != NUL_VLU)
{
waiter[waiterno - 1].count ++;
waiter[waiterno - 1].amount += tmpvars.netamt;
Set_Rpt_Flag(RPT_WAITER);
}
}
#endif /* End VER_RNST */
}
/*-------------------------------------------------------------*
* Update the hour report
*-------------------------------------------------------------*/
void Update_Hour_Rpt(void)
{
byte hour;
hour = GetHour();
if(CurrMode == REGISTER)
{
Hour_Rept[hour].count ++;
Hour_Rept[hour].amount += NetAmtBak;
Set_Rpt_Flag(RPT_HOURLY);
}
}
/*-------------------------------------------------------------*
* Update the clerk report.
*-------------------------------------------------------------*/
void Update_Clerk_Rpt(void)
{
if(sysflag->clerk_mode)
{
if(CurrMode == REGISTER)
{
clerk[currclerk-1].count ++;
clerk[currclerk-1].PTD_count ++;
clerk[currclerk-1].amount += NetAmtBak;
clerk[currclerk-1].PTD_amount +=NetAmtBak;
Set_Rpt_Flag(RPT_CLERK_DAILY);
Set_Rpt_Flag(RPT_CLERK_PTD);
}
}
}
#ifdef STOCK /* Support the stock function */
/*----------------------------------------------------------------------*
Prompt to the user the stock is empty.
*----------------------------------------------------------------------*/
void Prompt_Stock_Empty(void)
{
char cnt;
cnt = 2;
Clr_Dsp_Data();
Delay(50);
for(; cnt > 0; cnt --)
{
VFDDisplay(Disp_Sale_PLU_Stock_0, NOTCLEARD, LEFT);
Delay(300);
Clr_Dsp_Data();
Delay(200);
}
Clr_Key_Buff(); /* Clear the key buffer */
}
#endif /* End STOCK */
/* Check the transaction buffer */
byte Chk_Buff_Full(void)
{
if(TnsBf_Len >= (Max_TnsBf_Len-1)) /* Save one byte for reserved, such as auto percent and so on */
{
errorType(ERR_FULL_ITEM);
return(NG);
}
return (OK);
}
/* The sale mode tax exempt key function */
void Do_STAXEMP(void)
{
byte i;
if((CurrMode != REGISTER) && (CurrMode != TRAINING))
{errorType(ERR_KEY_ILLEGAL);numcnt=0;return;}
if(sysflag->Tax_System == 0){errorType(ERR_KEY_ILLEGAL);numcnt=0;return;}
if((!NewTrans) && (numcnt == 0)) /* When the Trans is not start and input no digit, clear the display */
{
Clr_Dsp_Data();
RightDisp(0,sysflag->sysdots);
}
for(i = 0; i < MAX_TAX_NUM; i++)
{
if(shift_flag[i])
{
shift_flag[i] = 0;
Do_Shift(i);
}
}
// if(shift1_flag){shift1_flag = 0;Do_Shift1();} /* Clear the tax shift1 flag */
// if(shift2_flag){shift2_flag = 0;Do_Shift2();} /* Clear the tax shift2 flag */
// if(shift3_flag){shift3_flag = 0;Do_Shift3();} /* Clear the tax shift2 flag */
Tax_Emp_Flag = !Tax_Emp_Flag;
Do_TaxEmp();
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -