public override void SaveState(EjLineStates state) { transItem.State = (int)state; transItem.UpdateState(); }
private void VoidCurrentItem() { ItemList itemList = new ItemList(PosContext.Instance.CurrentEjItem, PosContext.Instance.CurrentEj); for (int i = 0; i < itemList.Count; i++) { Object obj = itemList[i]; EjLine ejLine = (EjLine)obj; switch (ejLine.LineType) { case (int)EjLineType.ITEM: TransItem transItem = (TransItem)ejLine.DataRecord(); if (transItem.State != (int)EjLineStates.VOID_ITEM) { // already voided? transItem.State = (int)EjLineStates.VOID_ITEM; transItem.UpdateState(); PosContext.Instance.Receipt.Update((EjItem)ejLine); } break; case (int)EjLineType.ITEM_LINK: // TransItemLink itemLink = (TransItemLink) line.dataRecord (); // itemLink.setAmount (0.0); break; case (int)EjLineType.PROMOTION: TransPromotion itemPromo = (TransPromotion)ejLine.DataRecord(); if (itemPromo.State != (int)EjLineStates.VOID_ITEM) { // already voided? itemPromo.State = (int)EjLineStates.VOID_ITEM; itemPromo.UpdateState(); PosContext.Instance.Receipt.Update((EjPromotion)ejLine); } // itemPromo.PromotionAmount = 0; break; case (int)EjLineType.TAX: TransTax itemTax = ejLine.DataRecord() as TransTax; itemTax.State = (int)EjLineStates.VOID_ITEM; itemTax.UpdateState(); /// itemTax.TaxAmount = 0.0; // itemTax.TaxableAmount = 0.0; // ejLine.ExtAmount = 0; // ejLine.TaxAmount = 0; // ejLine.Amount = 0; PosContext.Instance.Receipt.Update((EjTax)ejLine); break; case (int)EjLineType.SURCHARGE: TransItem transSurcharge = (TransItem)ejLine.DataRecord(); if (transSurcharge.State != (int)EjLineStates.VOID_ITEM) { // already voided? transSurcharge.State = (int)EjLineStates.VOID_ITEM; transSurcharge.UpdateState(); PosContext.Instance.Receipt.Update((EjSurcharge)ejLine); } break; } } }
public static Ej GetSuspendedEj(Transaction trans) { Ej transRecords = new Ej(); transRecords.LineNo = 0; transRecords.SeqNo = 0; //Do not load if not suspended if (trans.State == (int)Transaction.Status.SUSPEND) { trans.State = (int)(Transaction.Status.IN_PROGRESS); trans.UpdateState(); } //Create a header EjHeader ejHeader = new EjHeader(trans); transRecords.EjAddReload(ejHeader); //Get items TransItem item = new TransItem(); item.Trans_no = trans.Trans_no; item.Organization_no = trans.Organization_no; item.Store_no = trans.Store_no; item.Pos_no = trans.Pos_no; DataSet data = item.LoadByTransno(); DataTable dt = data.Tables[0]; foreach (DataRow dr in dt.Rows) { TransItem transItem = new TransItem(dr); if (transItem.State == (int)EjLineStates.PRICE_OVERRIDE) { continue; } if (transItem.State == (int)EjLineStates.VOID_ITEM) { continue; } if (transItem.State == (int)EjLineStates.VOID_SALE) { continue; } if (transItem.Line_no > transRecords.LineNo) { transRecords.LineNo = transItem.Line_no; } if (transItem.Seq_no > transRecords.SeqNo) { transRecords.SeqNo = transItem.Seq_no; } if (transItem.State == (int)EjLineStates.SUSPEND) { transItem.State = (int)EjLineStates.IN_PROGRESS; transItem.UpdateState(); } if (transItem.Reason_code == (int)EjItemReasonCodes.NORMAL_ITEM) { EjItem ejItem = new EjItem(transItem); transRecords.EjAddReload(ejItem); } if (transItem.Reason_code == (int)EjItemReasonCodes.SURCHARGE) { EjSurcharge ejSurcharge = new EjSurcharge(transItem); transRecords.EjAddReload(ejSurcharge); } } //Get promotions try { TransPromotion promo = new TransPromotion(); promo.Trans_no = trans.Trans_no; promo.Organization_no = trans.Organization_no; promo.Store_no = trans.Store_no; promo.Pos_no = trans.Pos_no; DataSet data1 = promo.LoadAllByTransId(); DataTable dt1 = data1.Tables[0]; foreach (DataRow dr1 in dt1.Rows) { TransPromotion transPromotion = new TransPromotion(dr1); if (transPromotion.Line_no > transRecords.LineNo) { transRecords.LineNo = transPromotion.Line_no; } if (transPromotion.Seq_no > transRecords.SeqNo) { transRecords.SeqNo = transPromotion.Seq_no; } if (transPromotion.State != (int)EjLineStates.VOID_ITEM) { transPromotion.State = (int)EjLineStates.IN_PROGRESS; transPromotion.UpdateState(); } EjPromotion ejPromotion = new EjPromotion(transPromotion); transRecords.EjAddReload(ejPromotion); } } catch { } //Get Tax try { TransTax ttax = new TransTax(); ttax.Trans_no = trans.Trans_no; ttax.Organization_no = trans.Organization_no; ttax.Store_no = trans.Store_no; ttax.Pos_no = trans.Pos_no; DataSet data2 = ttax.LoadByTransid(); DataTable dt2 = data2.Tables[0]; foreach (DataRow dr2 in dt2.Rows) { TransTax transTax = new TransTax(dr2); EjTax ejTax = new EjTax(transTax); transRecords.EjAddReload(ejTax); if (transTax.Line_no > transRecords.LineNo) { transRecords.LineNo = transTax.Line_no; } } } catch { } //Get Free Text try { TransText ttext = new TransText(); ttext.Trans_no = trans.Trans_no; ttext.Organization_no = trans.Organization_no; ttext.Store_no = trans.Store_no; ttext.Pos_no = trans.Pos_no; DataSet data3 = ttext.LoadByTransNo(); DataTable dt3 = data3.Tables[0]; foreach (DataRow dr3 in dt3.Rows) { if (ttext.Line_no > transRecords.LineNo) { transRecords.LineNo = ttext.Line_no; } if (ttext.Seq_no > transRecords.SeqNo) { transRecords.SeqNo = ttext.Seq_no; } TransText transText = new TransText(dr3); EjFreeText ejText = new EjFreeText(transText); transRecords.EjAddReload(ejText); } } catch { } try { //Get Sales person TransSalesPerson salesPerson = new TransSalesPerson(); salesPerson.Organization_no = trans.Organization_no; salesPerson.Trans_no = trans.Trans_no; salesPerson.Store_no = trans.Store_no; salesPerson.Pos_no = trans.Pos_no; DataSet dataSalP = salesPerson.LoadByTransNo(); DataTable dtSalP = dataSalP.Tables[0]; foreach (DataRow drSalP in dtSalP.Rows) { TransSalesPerson transSp = new TransSalesPerson(drSalP); EjSalesPerson ejSalP = new EjSalesPerson(transSp); transRecords.EjAddReload(ejSalP); } } catch { } //Get Bank EJ try { //Get Sales person TransBank transBank = new TransBank(); transBank.Organization_no = trans.Organization_no; transBank.Pos_no = trans.Pos_no; transBank.Store_no = trans.Store_no; transBank.Trans_no = trans.Trans_no; DataSet dataTBank = transBank.LoadByTransid(); DataTable dtTBank = dataTBank.Tables[0]; foreach (DataRow drTBank in dtTBank.Rows) { TransBank tb = new TransBank(drTBank); EjBank ejBank = new EjBank(tb); transRecords.EjAddReload(ejBank); } } catch { } //Get Payments made try { TransTender tender = new TransTender(); tender.Trans_no = trans.Trans_no; tender.Organization_no = trans.Organization_no; tender.Store_no = trans.Store_no; tender.Pos_no = trans.Pos_no; DataSet data1 = tender.LoadByTransid(); DataTable dt1 = data1.Tables[0]; foreach (DataRow dr1 in dt1.Rows) { TransTender transTender = new TransTender(dr1); EjTender ejTender = new EjTender(transTender); transRecords.EjAddReload(ejTender); } } catch { } transRecords.EjArrayList.Sort(new Ej()); return(transRecords); }
private void VoidLine(int lineNumber) { ArrayList ejList = PosContext.Instance.CurrentEj.EjArrayList; foreach (object obj in ejList) { EjLine ejLine = obj as EjLine; if (ejLine.LineNo != lineNumber) { continue; } switch (ejLine.LineType) { case (int)EjLineType.ITEM: TransItem transItem = (TransItem)ejLine.DataRecord(); if (transItem.State != (int)EjLineStates.VOID_ITEM) { // already voided? transItem.State = (int)EjLineStates.VOID_ITEM; transItem.UpdateState(); PosContext.Instance.Receipt.Update((EjItem)ejLine); } break; case (int)EjLineType.ITEM_LINK: // TransItemLink itemLink = (TransItemLink) line.dataRecord (); // itemLink.setAmount (0.0); break; case (int)EjLineType.PROMOTION: TransPromotion itemPromo = (TransPromotion)ejLine.DataRecord(); if (itemPromo.State != (int)EjLineStates.VOID_ITEM) { // already voided? itemPromo.State = (int)EjLineStates.VOID_ITEM; itemPromo.UpdateState(); if (itemPromo.PromotionType == (int)EjPromotionTypes.WHOLE_ORDER) { PosContext.Instance.SaleMode = null; } PosContext.Instance.Receipt.Update((EjPromotion)ejLine); } // itemPromo.PromotionAmount = 0; break; case (int)EjLineType.TAX: TransTax itemTax = ejLine.DataRecord() as TransTax; itemTax.State = (int)EjLineStates.VOID_ITEM; itemTax.UpdateState(); /// itemTax.TaxAmount = 0.0; // itemTax.TaxableAmount = 0.0; // ejLine.ExtAmount = 0; // ejLine.TaxAmount = 0; // ejLine.Amount = 0; PosContext.Instance.Receipt.Update((EjTax)ejLine); break; case (int)EjLineType.SURCHARGE: TransItem transSurcharge = (TransItem)ejLine.DataRecord(); if (transSurcharge.State != (int)EjLineStates.VOID_ITEM) { // already voided? transSurcharge.State = (int)EjLineStates.VOID_ITEM; transSurcharge.UpdateState(); PosContext.Instance.Receipt.Update((EjSurcharge)ejLine); } break; } } }