public override void UpdateTotals() { //return null; if (PosContext.Instance.Training) { return; } EclipsePos.Data.Total total = new EclipsePos.Data.Total(); total.AddToTotal( PosSettings.Default.Organization, PosContext.Instance.RetailStore.Retail_store_no, PosSettings.Default.Station, EclipsePos.Data.TotalName.DAILY_BASE, TotalType.DEBIT, this.Amount); if (transTender.Change_amount > 0) { // subtract cash back from drawer EclipsePos.Data.Total total2 = new EclipsePos.Data.Total(); total2.AddToTotal( PosSettings.Default.Organization, PosContext.Instance.RetailStore.Retail_store_no, PosSettings.Default.Station, EclipsePos.Data.TotalName.DAILY_BASE, TotalType.CASH_IN_DRAWER, PosContext.Instance.PosMath.Mult(transTender.Change_amount, -1.0) ); } int count = PosContext.Instance.CurrentEj.SalesPerson.Count; PosContext.Instance.CurrentEj.SalesPerson.ForEach(delegate(EjSalesPerson ejSalesPerson) { TransSalesPerson transSalesPerson = (TransSalesPerson)ejSalesPerson.DataRecord(); string employee_id = transSalesPerson.Employee_no; EclipsePos.Data.PosEmployeeTotal empTotal = new EclipsePos.Data.PosEmployeeTotal(); empTotal.AddToEmployeeTotalAndCount( PosSettings.Default.Organization, PosContext.Instance.RetailStore.Retail_store_no, PosSettings.Default.Station, employee_id, 0, EclipsePos.Data.TotalName.DAILY_BASE, TotalType.DEBIT, 1, Amount / count ); }); transTender.State = (int)EjLineStates.PAID; transTender.UpdateState(); }
public EjSalesPerson(TransSalesPerson parm) { // this.transText = pTransText; this.LineType = (int)EjLineType.SALES_PERSON; this.transSalesPerson = parm; this.emp = new Employee(); this.emp.Organization_no = parm.Organization_no; this.emp.Employee_no = parm.Employee_no; this.emp.LoadByEmployeeNo(); this.desc = emp.FName; }
public override void UpdateTotals() { //return null; if (PosContext.Instance.Training) { return; } EclipsePos.Data.Total total1 = new EclipsePos.Data.Total(); total1.AddToTotal( PosSettings.Default.Organization, PosContext.Instance.RetailStore.Retail_store_no, PosSettings.Default.Station, EclipsePos.Data.TotalName.DAILY_BASE, TotalType.CASH_SALES, Amount - Change); EclipsePos.Data.Total total2 = new EclipsePos.Data.Total(); total2.AddToTotal( PosSettings.Default.Organization, PosContext.Instance.RetailStore.Retail_store_no, PosSettings.Default.Station, EclipsePos.Data.TotalName.DAILY_BASE, TotalType.CASH_IN_DRAWER, Amount - Change); int count = PosContext.Instance.CurrentEj.SalesPerson.Count; PosContext.Instance.CurrentEj.SalesPerson.ForEach(delegate(EjSalesPerson ejSalesPerson) { TransSalesPerson transSalesPerson = (TransSalesPerson)ejSalesPerson.DataRecord(); string employee_id = transSalesPerson.Employee_no; EclipsePos.Data.PosEmployeeTotal empTotal = new EclipsePos.Data.PosEmployeeTotal(); empTotal.AddToEmployeeTotalAndCount( PosSettings.Default.Organization, PosContext.Instance.RetailStore.Retail_store_no, PosSettings.Default.Station, employee_id, 0, EclipsePos.Data.TotalName.DAILY_BASE, TotalType.CASH_IN_DRAWER, 1, (Amount - Change) / count ); }); this.transTender.State = (int)EjLineStates.PAID; this.transTender.UpdateState(); }
public override void Engage(int keyValue) { if (PosContext.Instance.Parameters.getParam("PromptForEmployee") == "FALSE") { this.States().Clear(); PosEventStack.Instance.NextEvent(); return; } switch (this.States().PeekState()) { case ENTER_SALES_PERSON: // If previously entered salesman exists // if (PosContext.Instance.CurrentEj.SalesPerson.Count > 0) // { // this.States().Clear(); // PosEventStack.Instance.NextEvent(); // return; // } this.PromptText = PosContext.Instance.Parameters.getParam("EnterSalesPersonNo"); PosContext.Instance.Operprompt.Update(this); PosContext.Instance.ClearInput(); this.States().PopState(); this.States().PushState(GET_SALES_PERSON); //Try to load employee details try { PosContext.Instance.CurrentPosDisplay.LoadEmployeeView(); } catch { } break; case GET_SALES_PERSON: this.PopState(); string salesPerson = PosContext.Instance.InputLine; if ((PosContext.Instance.CurrentEj.SalesPerson.Count > 0) && (string.IsNullOrEmpty(salesPerson.Trim()))) { this.States().Clear(); PosContext.Instance.ClearInput(); PosEventStack.Instance.NextEvent(); return; } emp = new Employee(); emp.Organization_no = PosSettings.Default.Organization; emp.Employee_no = salesPerson; emp.LoadByEmployeeNo(); if (string.IsNullOrEmpty(emp.FName)) { // get out of this transaction and prompt error. PosContext.Instance.ClearInput(); PosEventStack.Instance.ClearPending(); PosError error = new PosError(PosErrorCode.INVALID_EMPLOYEE_NO); this.PromptText = PosContext.Instance.Parameters.getParam("InvalidEmployeeNumber"); PosEventStack.Instance.PushEvent(error); PosContext.Instance.Operprompt.Update(this); PosContext.Instance.ClearInput(); this.States().PushState(GET_SALES_PERSON); PosEventStack.Instance.NextEvent(); return; } PosContext.Instance.ClearInput(); this.States().PopState(); this.States().PushState(SET_SALES_PERSON_JOURNAL); PosEventStack.Instance.NextEvent(); break; case SET_SALES_PERSON_JOURNAL: this.PopState(); transSalesPerson = new TransSalesPerson(); transSalesPerson.Trans_no = PosContext.Instance.TrxNo; transSalesPerson.Organization_no = PosSettings.Default.Organization; transSalesPerson.Pos_no = PosSettings.Default.Station; transSalesPerson.Store_no = PosSettings.Default.Store; transSalesPerson.Employee_no = emp.Employee_no; transSalesPerson.Add(); PosContext.Instance.CurrentEj.EjAdd(this); this.States().Clear(); this.promptText = ""; PosContext.Instance.Operprompt.Update(this); PosContext.Instance.Receipt.Update(this); PosContext.Instance.ClearInput(); // this.States().PushState(ENTER_SALES_PERSON); this.States().Clear(); PosEventStack.Instance.NextEvent(); break; default: 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); }
public override void UpdateTotals() { if (PosContext.Instance.Training) { return; } if (this.Amount != 0.0) { /* * EclipsePos.Data.Total total = new EclipsePos.Data.Total(); * total.AddToTotal( * PosContext.Instance.RetailStore.Retail_store_no, * PosSettings.Default.Station, * TotalType.CASH, * transBank.Amount); * * * * switch ((TotalType)transBank.Pay_type) * { * * case TotalType.PAID_IN: * case TotalType.PAID_OUT: * case TotalType.PICK_UP: * case TotalType.LOAN: * * EclipsePos.Data.Total total2 = new EclipsePos.Data.Total(); * total2.Total_id = PosContext.Instance.RetailStore.Retail_store_no; * total2.Pos_total_id = PosSettings.Default.Station; * total2.Total_type = (int)TotalType.CASH_IN_DRAWER; * total2.Total_count = 0; * total2.Total_amount = transBank.Amount; * total2.Add(); * * break; * default: * break; * } */ //return null; EclipsePos.Data.Total total1 = new EclipsePos.Data.Total(); total1.AddToTotal( PosSettings.Default.Organization, PosSettings.Default.Store, PosSettings.Default.Station, EclipsePos.Data.TotalName.DAILY_BASE, (TotalType)transBank.Pay_type, transBank.Amount); EclipsePos.Data.Total total2 = new EclipsePos.Data.Total(); total2.AddToTotal( PosSettings.Default.Organization, PosSettings.Default.Store, PosSettings.Default.Station, EclipsePos.Data.TotalName.DAILY_BASE, TotalType.CASH_IN_DRAWER, transBank.Amount); int count = PosContext.Instance.CurrentEj.SalesPerson.Count; PosContext.Instance.CurrentEj.SalesPerson.ForEach(delegate(EjSalesPerson ejSalesPerson) { TransSalesPerson transSalesPerson = (TransSalesPerson)ejSalesPerson.DataRecord(); //PosContext.Instance.CurrentEj.SalesPerson.DataRecord(); string employee_id = transSalesPerson.Employee_no; EclipsePos.Data.PosEmployeeTotal empTotal = new EclipsePos.Data.PosEmployeeTotal(); empTotal.AddToEmployeeTotalAndCount( PosSettings.Default.Organization, PosContext.Instance.RetailStore.Retail_store_no, PosSettings.Default.Station, employee_id, 0, EclipsePos.Data.TotalName.DAILY_BASE, (TotalType)transBank.Pay_type, 1, (Amount - Change) / count ); }); } }
public override void Engage(int keyValue) { if (PosContext.Instance.CurrentEj.SalesPerson.Count == 0) { this.States().Clear(); PosContext.Instance.ClearInput(); PosError posError = new PosError(PosErrorCode.INVALID_FUNCTION_KEY); posError.Engage(0); return; } switch (this.States().PeekState()) { case ENTER_SALES_PERSON: this.PromptText = PosContext.Instance.Parameters.getParam("EnterSalesPersonNo"); PosContext.Instance.Operprompt.Update(this); PosContext.Instance.ClearInput(); this.States().PopState(); this.States().PushState(GET_SALES_PERSON); break; case GET_SALES_PERSON: this.PopState(); this.employee_no = PosContext.Instance.InputLine; Employee emp = new Employee(); emp.Organization_no = PosSettings.Default.Organization; emp.Employee_no = this.employee_no; emp.LoadByEmployeeNo(); if (string.IsNullOrEmpty(emp.FName)) { // get out of this transaction and prompt error. PosContext.Instance.ClearInput(); PosEventStack.Instance.ClearPending(); PosError error = new PosError(PosErrorCode.INVALID_EMPLOYEE_NO); this.PromptText = PosContext.Instance.Parameters.getParam("InvalidEmployeeNumber"); PosEventStack.Instance.PushEvent(error); PosContext.Instance.Operprompt.Update(this); PosContext.Instance.ClearInput(); this.States().PushState(GET_SALES_PERSON); PosEventStack.Instance.NextEvent(); return; } PosContext.Instance.ClearInput(); this.States().PopState(); this.States().PushState(DELETE_SALES_PERSON); PosEventStack.Instance.NextEvent(); break; case DELETE_SALES_PERSON: this.PopState(); PosContext.Instance.CurrentEj.SalesPerson.ForEach(delegate(EjSalesPerson ejSalesP){ TransSalesPerson transSalesPerson = (TransSalesPerson)ejSalesP.DataRecord(); if (transSalesPerson.Employee_no == this.employee_no) { this.ejSalesPerson = ejSalesP; } }); // foreach (EjSalesPerson ejPerson in PosContext.Instance.CurrentEj.SalesPerson) // { // MessageBox.Show(ejPerson.Employee.Employee_no); // if (ejPerson.Employee.Employee_no == this.employee_no) // { // this.ejSalesPerson = ejPerson; // } // } if (this.ejSalesPerson != null) { PosContext.Instance.CurrentEj.SalesPerson.Remove(this.ejSalesPerson); this.ejSalesPerson.DeleteEj(); PosContext.Instance.Receipt.Update(this); } this.States().Clear(); PosEventStack.Instance.NextEvent(); break; default: break; } }