/* * Create a tax record and add it to the EJ. * A tax record is created for each item, summaries * are implemented in the print objects. */ public override void Engage(int keyValue) { transTax = new TransTax(); transTax.Trans_no = PosContext.Instance.TrxNo; transTax.Organization_no = PosSettings.Default.Organization; transTax.Store_no = PosSettings.Default.Store; transTax.Pos_no = PosSettings.Default.Station; transTax.SeqNo = PosContext.Instance.CurrentEj.SeqNo; transTax.Line_no = PosContext.Instance.CurrentEj.LineNo; transTax.TaxId = taxRecord.Tax_id; transTax.TaxDesc = taxRecord.ShortDesc; transTax.Rate = taxRecord.Rate; transTax.State = (int)EjLineStates.IN_PROGRESS; if (this.item != null) { ApplyTax(); } if (this.ejSurcharge != null) { ApplyTaxSurcharge(); } //If not training mode if (!PosContext.Instance.Training) { transTax.Add(); } PosContext.Instance.CurrentEj.EjAdd(this); }
private void ProcessEjLine(EjLine ejLine) { switch (ejLine.LineType) { case (int)EjLineType.TRANS_HEADER: break; case (int)EjLineType.ITEM: EjItem ejItemFrom = ejLine as EjItem; TransItem transItem = new TransItem(); transItem.Trans_no = PosContext.Instance.TrxNo; transItem.Organization_no = PosSettings.Default.Organization; transItem.Store_no = PosSettings.Default.Store; transItem.Pos_no = PosSettings.Default.Station; transItem.Sku_link = " "; transItem.Sku = ejItemFrom.TransItem.Sku; transItem.Item_desc = ejItemFrom.TransItem.Item_desc; transItem.Quantity = ejItemFrom.TransItem.Quantity; transItem.Amount = ejItemFrom.TransItem.Amount; transItem.Ext_amount = ejItemFrom.TransItem.Ext_amount; transItem.Tax_exempt = ejItemFrom.TransItem.Tax_exempt; transItem.Tax_incl = ejItemFrom.TransItem.Tax_incl; transItem.State = (int)EjLineStates.IN_PROGRESS; transItem.Reason_code = (int)EjItemReasonCodes.NORMAL_ITEM; EjItem ejItem = new EjItem(transItem); PosContext.Instance.CurrentEjItem = ejItem; PosContext.Instance.CurrentEj.EjAdd(ejItem); transItem.Seq_no = PosContext.Instance.CurrentEj.SeqNo; transItem.Line_no = PosContext.Instance.CurrentEj.LineNo; // if not traning mode if (!PosContext.Instance.Training) { transItem.Add(); } PosContext.Instance.Receipt.Update(ejItem); break; case (int)EjLineType.PROMOTION: EjPromotion fromPromotion = ejLine as EjPromotion; TransPromotion transPromotion = new TransPromotion(); transPromotion.Trans_no = PosContext.Instance.TrxNo; transPromotion.Organization_no = PosSettings.Default.Organization; transPromotion.Store_no = PosSettings.Default.Store; transPromotion.Pos_no = PosSettings.Default.Station; transPromotion.PromotionNo = fromPromotion.Promotion.PromotionNo; transPromotion.PromotionAmount = fromPromotion.Amount; transPromotion.PromotionQuantity = fromPromotion.Quantity; //PosContext.Instance.Quantity; transPromotion.ReasonCode = 0; transPromotion.PromotionData = " "; transPromotion.PromotionDesc = fromPromotion.Desc; transPromotion.State = (int)EjLineStates.IN_PROGRESS; EjPromotion ejPromotion = new EjPromotion(transPromotion); PosContext.Instance.CurrentEj.EjAdd(ejPromotion); transPromotion.Seq_no = PosContext.Instance.CurrentEj.SeqNo; transPromotion.Line_no = PosContext.Instance.CurrentEj.LineNo; // if not training mode if (!PosContext.Instance.Training) { transPromotion.Add(); } PosContext.Instance.Receipt.Update(ejPromotion); break; case (int)EjLineType.TAX: EjTax fromTax = ejLine as EjTax; TransTax fromTransTax = (TransTax)fromTax.DataRecord(); TransTax transTax = new TransTax(); transTax.Trans_no = PosContext.Instance.TrxNo; transTax.Organization_no = PosSettings.Default.Organization; transTax.Store_no = PosSettings.Default.Store; transTax.Pos_no = PosSettings.Default.Station; transTax.SeqNo = PosContext.Instance.CurrentEj.SeqNo; transTax.Line_no = PosContext.Instance.CurrentEj.LineNo; transTax.TaxId = fromTransTax.TaxId; transTax.TaxDesc = fromTransTax.TaxDesc; transTax.Rate = fromTransTax.Rate; transTax.State = (int)EjLineStates.IN_PROGRESS; transTax.TaxAmount = fromTransTax.TaxAmount; transTax.TaxableAmount = fromTransTax.TaxableAmount; //If not training mode if (!PosContext.Instance.Training) { transTax.Add(); } EjTax ejTax = new EjTax(transTax); PosContext.Instance.CurrentEj.EjAdd(ejTax); break; case (int)EjLineType.TENDER: break; case (int)EjLineType.BANK: // Update( (EjBank)pEvent ); break; case (int)EjLineType.ACCOUNT: break; case (int)EjLineType.ALT_CURRENCY_TENDER: break; case (int)EjLineType.CHECK_TENDER: break; case (int)EjLineType.DEBIT_TENDER: break; case (int)EjLineType.CC_TENDER: break; case (int)EjLineType.COUPON: // Update ((EjCoupon) pEvent ); break; case (int)EjLineType.FREE_TEXT: break; case (int)EjLineType.SURCHARGE: break; default: // Log.warning ("Unhandled ej type in Receipt " + line.toString ()); break; } }