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); } }
public void SetDataSource() { customer = new EclipsePos.Data.Customer(); customer.Organization_no = PosSettings.Default.Organization; customer.Customer_search_key = "%"; customerDataSet = customer.LoadBySearchKey(); this.DataContext = customerDataSet.Tables[0].DefaultView; }
public bool CustomerIsValid() { EclipsePos.Data.Customer cus = new EclipsePos.Data.Customer(); cus.Organization_no = PosSettings.Default.Organization; cus.Tax_id = this.customer_tax_id; cus.LoadByTaxID(); if (cus.Customer_first_name != null && cus.Customer_first_name.Trim().Length > 0) { this.customerDataRec = cus; return(true); } else { return(false); } }
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 EjReceiveOnAccount(EclipsePos.Data.Customer cusData) : this() { this.customerDataRec = cusData; }
public override void Engage(int keyValue) { switch (this.States().PeekState()) { case PROMPT_AMOUNT: this.PopState(); this.PromptText = PosContext.Instance.Parameters.getParam("PromptAmount"); PosContext.Instance.Operprompt.Update(this); PosContext.Instance.ClearInput(); this.States().PushState(GET_AMOUNT); break; case PROMPT_CUSTOMER: this.PopState(); this.PromptText = PosContext.Instance.Parameters.getParam("PromptCustomer"); PosContext.Instance.Operprompt.Update(this); PosContext.Instance.ClearInput(); this.States().PushState(GET_CUSTOMER); PosContext.Instance.CurrentPosDisplay.LoadCustomerSearch(); break; case GET_AMOUNT: this.States().PopState(); this.tenderAmount = PosContext.Instance.Input() / 100; PosContext.Instance.ClearInput(); this.States().PushState(PROMPT_CUSTOMER); PosEventStack.Instance.NextEvent(); break; case GET_CUSTOMER: // this.PopState(); customer_tax_id = PosContext.Instance.InputLine; if (this.CustomerIsValid()) { this.PopState(); } else { // get out of this transaction and prompt error. PosContext.Instance.ClearInput(); PosEventStack.Instance.ClearPending(); PosError error = new PosError(PosErrorCode.INVALID_CUSTOMER_NO); this.PromptText = ""; //PosContext.Instance.Parameters.getParam("InvalidCustomer"); PosEventStack.Instance.PushEvent(error); // PosContext.Instance.Operprompt.Update(this); PosEventStack.Instance.NextEvent(); return; } EclipsePos.Data.Customer cus = new EclipsePos.Data.Customer(); cus.Organization_no = PosSettings.Default.Organization; cus.Tax_id = this.customer_tax_id; cus.LoadByTaxID(); Transaction trans = new Transaction(PosContext.Instance.TrxNo); trans.Organization_no = PosSettings.Default.Organization; trans.Store_no = PosSettings.Default.Store; trans.Pos_no = PosSettings.Default.Station; trans.Trans_no = PosContext.Instance.TrxNo; trans.Load(); trans.Customer_tax_id = cus.Tax_id; trans.UpdateCustomer(); PosContext.Instance.EjCustomer = new EjCustomer(cus); PosContext.Instance.CurrentEj.EjAdd(this); PosContext.Instance.Receipt.Update(this); PosContext.Instance.Operprompt.Update(this); PosEventStack.Instance.NextEvent(); break; default: 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 override void Engage(int keyValue) { if (PosContext.Instance.EjCustomer == null) { PosContext.Instance.ClearInput(); PosEventStack.Instance.ClearPending(); PosError error = new PosError(PosErrorCode.SELECT_CUSTOMER); this.PromptText = PosContext.Instance.Parameters.getParam("SELECT_CUSTOMER"); PosEventStack.Instance.PushEvent(error); PosEventStack.Instance.NextEvent(); return; } if (PosContext.Instance.InputLine.Length > 0) { debtAmount = Math.Round(double.Parse(PosContext.Instance.InputLine) / 100.00, 2); } else { debtAmount = PosContext.Instance.CurrentEj.EjBalance(); } PosContext.Instance.ClearInput(); EclipsePos.Data.Customer cus = PosContext.Instance.EjCustomer.DataRecord() as EclipsePos.Data.Customer; // Check max debt limit if (cus.Current_debt + debtAmount > cus.Max_debt) { PosContext.Instance.ClearInput(); PosEventStack.Instance.ClearPending(); PosError error = new PosError(PosErrorCode.INSUFFICIENT_CREDIT_LIMIT); this.PromptText = PosContext.Instance.Parameters.getParam("Insufficient_credit_limit"); PosEventStack.Instance.PushEvent(error); PosEventStack.Instance.NextEvent(); return; } // this completes the transaction this.transTender = new TransTender(); transTender.Amount = debtAmount; transTender.Trans_no = PosContext.Instance.TrxNo; transTender.Organization_no = PosSettings.Default.Organization; transTender.Store_no = PosSettings.Default.Store; transTender.Seq_no = PosContext.Instance.CurrentEj.SeqNo; transTender.Tender_desc = PosContext.Instance.Parameters.getParam("DebtTender"); transTender.Change_amount = 0; transTender.Change_desc = ""; transTender.Tendertype = (int)TransTender.TenderTypes.CREDIT_ON_ACC; transTender.Data_capture = ""; transTender.Locale_language = ""; transTender.Locale_country = ""; transTender.State = (int)EjLineStates.IN_PROGRESS; PosContext.Instance.CurrentEj.EjAdd(this); transTender.Seq_no = PosContext.Instance.CurrentEj.SeqNo; // if not training mode if (!PosContext.Instance.Training) { transTender.Add(); this.priviousDebt = cus.Current_debt; cus.Current_debt += debtAmount; this.currentDebt = cus.Current_debt; this.maxDebt = cus.Max_debt; cus.UpdateCurrentDebt(); } if (PosContext.Instance.CurrentEj.EjBalance() <= transTender.Amount) { this.tenderComplete = true; } else { this.tenderComplete = false; } PosContext.Instance.Receipt.Update(this); PosContext.Instance.Operprompt.Update(this); // finish up and resume the dialog this.States().Clear(); PosContext.Instance.HomeGUI(); PosEventStack.Instance.NextEvent(); }
public EjCustomer(EclipsePos.Data.Customer cusData) : this() { this.customerDataRec = cusData; }