public void LoadEj(TableButtonData bData) { Transaction trans = new Transaction(bData.Trans_no); trans.Pos_no = bData.Pos_no; trans.Organization_no = PosSettings.Default.Organization; trans.Store_no = PosSettings.Default.Store; trans.Load(); if (trans.State == (int)Transaction.Status.SUSPEND) { // was this a suspended transaction? PosContext.Instance.CurrentEj = Ej.GetSuspendedEj(trans); if (PosContext.Instance.CurrentEj.EjArrayList.Count > 0) { // finally make sure there are records PosContext.Instance.TableName = trans.Table_name; trans.State = (int)Transaction.Status.IN_PROGRESS; foreach (Object obj in PosContext.Instance.CurrentEj.EjArrayList) { EjLine line = (EjLine)obj; PosContext.Instance.Receipt.Update(line); } // context ().homeGuis (); // context ().eventStack ().setEvent (new FirstItem (context ())); //this.States().Clear(); // PosEventStack.Instance.NextEvent(); } } }
private bool LoadEj(int transNo) { //PrintJobQueue.Instance.Clear(); Transaction trans = new Transaction(transNo); trans.Organization_no = PosSettings.Default.Organization; trans.Store_no = PosSettings.Default.Store; trans.Pos_no = PosSettings.Default.Station; // trans.State = (int)Transaction.Status.SUSPEND; trans.Load(); if (trans.Trans_no != 0) { // was this a suspended transaction? PosContext.Instance.CurrentEj = Ej.GetSuspendedEj(trans); PosContext.Instance.TransactionType = trans.Trans_type; PosContext.Instance.TableName = trans.Table_name; if (PosContext.Instance.CurrentEj.EjArrayList.Count > 0) { // finally make sure there are records PosContext.Instance.TableName = trans.Table_name; PosContext.Instance.TrxNo = trans.Trans_no; trans.State = (int)Transaction.Status.IN_PROGRESS; foreach (Object obj in PosContext.Instance.CurrentEj.EjArrayList) { EjLine line = (EjLine)obj; if (line is EjPromotion) { EjPromotion ejPromo = line as EjPromotion; if (ejPromo.LineType == (int)EjPromotionTypes.WHOLE_ORDER) { PosContext.Instance.SaleMode = ejPromo.Promotion; } } PosContext.Instance.Receipt.Update(line); } } if (trans.Customer_tax_id.Length > 0) { EclipsePos.Data.Customer cus = new EclipsePos.Data.Customer(); cus.Organization_no = PosSettings.Default.Organization; cus.Tax_id = trans.Customer_tax_id; cus.LoadByTaxID(); EjCustomer ejCus = new EjCustomer(cus); PosContext.Instance.Receipt.Update(ejCus); PosContext.Instance.EjCustomer = ejCus; } return(true); } else { return(false); } }
private void VoidEj(Ej ej) { if (PosContext.Instance.Training) { return; } foreach (Object obj in ej.EjArrayList) { EjLine ejLine = (EjLine)obj; int voidState = (int)Transaction.Status.VOIDED; // if (ejLine.State != (int)EjLineStates..IN_PROGRESS) continue; switch (ejLine.LineType) { case (int)EjLineType.TRANS_HEADER: EjHeader ejHeader = (EjHeader)ejLine; if (!ejHeader.UpdateState(voidState)) { MessageBox.Show("Error :- Unable to complete UpdateState-Ej"); } break; case (int)EjLineType.ITEM: case (int)EjLineType.PROMOTION: case (int)EjLineType.BANK: case (int)EjLineType.TENDER: case (int)EjLineType.CHECK_TENDER: case (int)EjLineType.CC_TENDER: case (int)EjLineType.GIFT_CERT_TENDER: case (int)EjLineType.DEBIT_TENDER: case (int)EjLineType.ALT_CURRENCY_TENDER: case (int)EjLineType.COUPON: case (int)EjLineType.ACCOUNT: case (int)EjLineType.TAX: case (int)EjLineType.SURCHARGE: // ejLine..UpdateTotals(); break; case (int)EjLineType.TOTAL: break; default: break; } } }
public void Worker() { Transaction trans = new Transaction(this.trxno); trans.Pos_no = this.posno; trans.Organization_no = this.organization; trans.Store_no = this.storeno; trans.Load(); Ej ej = Ej.GetSuspendedEj(trans); ReceiptPrint rp = new ReceiptPrint(ej); rp.PrintEj(); }
public ItemList(EjItem ejItem, Ej ej) { _count = 0; foreach (Object obj in ej.EjArrayList) { EjLine ejLine = obj as EjLine; if ((ejLine is EjItem) && ejLine.Equals(ejItem)) { if (nextitem) { break; } nextitem = true; this.Add(ejLine); continue; // Get the next ejLine } // Ignore other EjItems in the array list if (!nextitem) { continue; } if (ejLine is EjPromotion) { this.Add(ejLine); } if (ejLine is EjTax) { this.Add(ejLine); } } }
public override void Engage(int keyValue) { //Check if employee role is authorized to this event if (!PosContext.Instance.Employee.RolesEventNames.Contains("Recall")) { PosError posError = new PosError(PosErrorCode.INSUFFICIENT_USER_AUTHORITY); posError.Engage(0); return; } switch (this.States().PeekState()) { case RECALL: // Tried to recall in a middle of a dialog if (PosContext.Instance.CurrentEj != null && PosContext.Instance.CurrentEj.SeqNo > 0) { PosEventStack.Instance.PushEvent(new PosError(PosErrorCode.ERROR_EVENT)); PosEventStack.Instance.NextEvent(); return; } PosEventStack.Instance.LoadDialog("RecallEj"); this.PopState(); this.PushState(RecallEj.ENTER_TRANS_NO); PosEventStack.Instance.NextEvent(); break; case ENTER_TRANS_NO: PosContext.Instance.ClearInput(); this.PromptText = PosContext.Instance.Parameters.getParam("PromptTransNo"); PosContext.Instance.Operprompt.Update(this); this.PopState(); this.PushState(GET_TRANS_NO); break; case ENTER_POS_NO: PosContext.Instance.ClearInput(); this.PromptText = PosContext.Instance.Parameters.getParam("PromptPosNo"); PosContext.Instance.Operprompt.Update(this); this.PopState(); this.PushState(GET_POS_NO); break; case GET_TRANS_NO: this.trxno = PosContext.Instance.Input(); PosContext.Instance.ClearInput(); PosContext.Instance.Operprompt.Clear(); this.PopState(); PosEventStack.Instance.NextEvent(); break; case GET_POS_NO: this.PosNo = PosContext.Instance.Input(); PosContext.Instance.ClearInput(); this.PopState(); PosContext.Instance.Operprompt.Clear(); PosEventStack.Instance.NextEvent(); break; case COMPLETE_RECALL: PosContext.Instance.ClearInput(); trans = new Transaction(this.trxno); trans.Pos_no = this.PosNo; trans.Organization_no = PosSettings.Default.Organization; trans.Store_no = PosContext.Instance.RetailStore.Retail_store_no; trans.Load(); // if (trans.State == (int)Transaction.Status.SUSPEND) // { // was this a suspended transaction? PosContext.Instance.CurrentEj = Ej.GetSuspendedEj(trans); if (PosContext.Instance.CurrentEj.EjArrayList.Count > 0) { // finally make sure there are records if (trans.State == (int)Transaction.Status.SUSPEND) { trans.State = (int)Transaction.Status.IN_PROGRESS; } foreach (Object obj in PosContext.Instance.CurrentEj.EjArrayList) { EjLine line = (EjLine)obj; PosContext.Instance.Receipt.Update(line); } this.States().Clear(); } // } PosContext.Instance.TrxNo = this.TrxNo; /* ES01-26/11/08 */ this.PromptText = PosContext.Instance.Parameters.getParam("RegOpen"); PosContext.Instance.Operprompt.Update(this); PosContext.Instance.Receipt.Update(this); if (trans.Customer_tax_id.Length > 0) { EclipsePos.Data.Customer cus = new EclipsePos.Data.Customer(); cus.Organization_no = PosSettings.Default.Organization; cus.Tax_id = trans.Customer_tax_id; cus.LoadByTaxID(); EjCustomer ejCus = new EjCustomer(cus); PosContext.Instance.Receipt.Update(ejCus); PosContext.Instance.EjCustomer = ejCus; } this.States().Clear(); PosEventStack.Instance.ClearPending(); //Clear transaction if complete if (trans.State == (int)Transaction.Status.COMPLETE) { PosEventStack.Instance.PushEvent(new FinishTransaction()); } break; } }
public override void Engage(int keyValue) { //Check if employee role is authorized to this event if (!PosContext.Instance.Employee.RolesEventNames.Contains("MergeOrder")) { PosError posError = new PosError(PosErrorCode.INSUFFICIENT_USER_AUTHORITY); posError.Engage(0); return; } //Merger to current order if (PosContext.Instance.CurrentEj == null || PosContext.Instance.CurrentEj.SeqNo == 0) { PosError posError = new PosError(PosErrorCode.ERROR_EVENT); posError.Engage(0); return; } switch (this.States().PeekState()) { case MERGE: PosContext.Instance.CurrentPosDisplay.LoadOpenOrdersList(); this.PopState(); this.PushState(ENTER_TRANS_NO); PosEventStack.Instance.NextEvent(); break; case ENTER_TRANS_NO: PosContext.Instance.ClearInput(); this.PromptText = PosContext.Instance.Parameters.getParam("PromptTransNo"); PosContext.Instance.Operprompt.Update(this); this.PopState(); this.PushState(GET_TRANS_NO); break; case GET_TRANS_NO: this.trxno = PosContext.Instance.Input(); PosContext.Instance.ClearInput(); PosContext.Instance.Operprompt.Clear(); this.PopState(); this.PushState(COMPLETE_MERGE); PosEventStack.Instance.NextEvent(); break; case COMPLETE_MERGE: PosContext.Instance.ClearInput(); trans = new Transaction(this.trxno); trans.Pos_no = PosSettings.Default.Station; trans.Organization_no = PosSettings.Default.Organization; trans.Store_no = PosSettings.Default.Store; trans.Load(); if (trans.State == (int)Transaction.Status.SUSPEND) { // was this a suspended transaction? Ej ejFrom = Ej.GetSuspendedEj(trans); if (ejFrom.EjArrayList.Count > 0) { // finally make sure there are records // trans.State = (int)Transaction.Status.IN_PROGRESS; foreach (Object obj in ejFrom.EjArrayList) { EjLine line = (EjLine)obj; ProcessEjLine(line); } // context ().homeGuis (); // context ().eventStack ().setEvent (new FirstItem (context ())); this.States().Clear(); // PosEventStack.Instance.NextEvent(); } // ejFrom.Complete((int)Transaction.Status.VOIDED); this.VoidEj(ejFrom); } if (trans.Customer_tax_id.Length > 0) { EclipsePos.Data.Customer cus = new EclipsePos.Data.Customer(); cus.Organization_no = PosSettings.Default.Organization; cus.Tax_id = trans.Customer_tax_id; cus.LoadByTaxID(); EjCustomer ejCus = new EjCustomer(cus); PosContext.Instance.Receipt.Update(ejCus); PosContext.Instance.EjCustomer = ejCus; } this.States().Clear(); // PosEventStack.Instance.ClearPending(); PosContext.Instance.HomeGUI(); PosEventStack.Instance.NextEvent(); break; } }
public override void Engage(int keyValue) { //Check if employee role is authorized to this event if (!PosContext.Instance.Employee.RolesEventNames.Contains("Recall")) { PosError posError = new PosError(PosErrorCode.INSUFFICIENT_USER_AUTHORITY); posError.Engage(0); return; } try { if (PosContext.Instance.CurrentEj.SeqNo > 0) { PosError posError = new PosError(PosErrorCode.RECALL_FAILLED); posError.Engage(0); return; } } catch (Exception ex) { } PosContext.Instance.ClearInput(); trans = new Transaction(this.trxno); trans.Pos_no = this.PosNo; trans.Organization_no = PosSettings.Default.Organization; trans.Store_no = PosContext.Instance.RetailStore.Retail_store_no; trans.Load(); PosContext.Instance.CurrentEj = Ej.GetSuspendedEj(trans); if (PosContext.Instance.CurrentEj.EjArrayList.Count > 0) { // finally make sure there are records foreach (Object obj in PosContext.Instance.CurrentEj.EjArrayList) { EjLine line = (EjLine)obj; PosContext.Instance.Receipt.Update(line); } this.States().Clear(); } PosContext.Instance.TrxNo = this.TrxNo; /* ES01-26/11/08 */ this.PromptText = PosContext.Instance.Parameters.getParam("RegOpen"); //PosContext.Instance.Operprompt.Update(this); PosContext.Instance.Receipt.Update(this); if (trans.Customer_tax_id.Length > 0) { EclipsePos.Data.Customer cus = new EclipsePos.Data.Customer(); cus.Organization_no = PosSettings.Default.Organization; cus.Tax_id = trans.Customer_tax_id; cus.LoadByTaxID(); EjCustomer ejCus = new EjCustomer(cus); PosContext.Instance.Receipt.Update(ejCus); PosContext.Instance.EjCustomer = ejCus; } this.States().Clear(); PosEventStack.Instance.ClearPending(); //Clear transaction if complete if ((trans.State == (int)Transaction.Status.COMPLETE) || (trans.State == (int)Transaction.Status.VOIDED)) { PosEventStack.Instance.PushEvent(new FinishTransaction()); } }
public void Apply() { applied = false; int applyCount = 0; totalDiscount = 0; double itemAmount = item.Amount; if (itemAmount < 0.0) { itemAmount *= -1.0; } Ej ej = PosContext.Instance.CurrentEj; foreach (Object obj in ej.EjArrayList) { EjLine ejLine = (EjLine)obj; if (ejLine.State != (int)EjLineStates.IN_PROGRESS) { continue; } switch (ejLine.LineType) { case (int)EjLineType.ITEM: TransItem transItem = ejLine.DataRecord() as TransItem; if (item.SKU.Equals(transItem.Sku)) { applyCount = applyCount + (int)transItem.Quantity; } break; case (int)EjLineType.PROMOTION: EjPromotion ejPromotion = ejLine as EjPromotion; if (this.item.SKU.Equals(ejPromotion.SKU)) { applyCount = applyCount - (int)ejPromotion.Quantity; } break; default: break; } } //Remaining Qty to apply the promotion if (applyCount >= promotion.PromotionVal1) { //Actual price double promoPrice = promotion.PromotionDval1 / promotion.PromotionVal1; // Discount for on double discount = item.Amount - promoPrice; //caluclate N this.promoQty = applyCount - (int)applyCount % promotion.PromotionVal1; totalDiscount = PosContext.Instance.PosMath.Mult(this.promoQty, discount); // totalDiscount = PosContext.Instance.PosMath.Negate(totalDiscount); this.applied = true; } }
public ReceiptPrint(Ej ejToPrint) { this.ej = ejToPrint; }