private void SimpleButton1Click(object sender, EventArgs e) { if (gridView1.FocusedRowHandle >= 0) { var bl = new BLSales(); var dr = gridView1.GetFocusedDataRow(); var sinv = dr["SINVNO"].ToString(); if (dr["SALESTYPE"].ToString() == "I") { // bl.DoPrint(sinv); bl.DoInsurancePrint(sinv); } else { var tname = textEdit3.EditValue == null ? "" : textEdit3.EditValue.ToString(); if (Utils.PrintSlipPrinter==1) { bl.DoSlipPrint(sinv); } else { bl.DoPrint(sinv, tname); } } } }
private void CustomerPayment_Load(object sender, EventArgs e) { //lookupcustomer.Properties.DataSource cUSTOMERBindingSource.DataSource = ClsGetData.GetCustomerList(); cUSTOMERBindingSource.Filter = " CUSTOMERTYPE <> 1 "; dateEdit1.EditValue = DateTime.Now; shiftcode = new BLSales().GetShiftCode(); }
private void AdditemsToList(object sender, GetDataRowEventArgs e) { DataRow d = e.SelectedRow; var dr = ds.NewRow(); dr[0] = d["ITEMNAME"]; dr[1] =d["ITEMNO"]; if (dateEdit1.EditValue == null || dateEdit2.EditValue == null) return; dr[2] = new BLSales().GetTotalSalesQty(d["ITEMNO"].ToString(), dateEdit1.DateTime, dateEdit2.DateTime); ds.Rows.Add(dr); }
private void AddLineItem() { DataRow current = null; if (txtbarcode.EditValue != null) { var blf = new BlItemMaster().FindItemByBarCode(txtbarcode.EditValue.ToString()); if (blf.Rows.Count == 0) { XtraMessageBox.Show("Item master not found", "POS", MessageBoxButtons.OK, MessageBoxIcon.Information); txtbarcode.SelectAll(); return; } foreach (DataRow dr in blf.Rows) { current = dr; } } else { return; } txtbarcode.EditValue = string.Empty; var bl = new BLSales(); // var aQty = bl.GetStockByItemno(current["ITEMNO"].ToString()); textEdit2.Text = current["ITEMNAME"].ToString(); //if (aQty > 0) //{ var dt = bl.GetStock(current["ITEMNO"].ToString()); foreach (DataRow dr in dt.Rows) { DataRow newRow = dtn.NewRow(); newRow["QTY"] = dr[0]; newRow["SPRICE"] = dr[1]; newRow["CPRICE"] = dr[2]; newRow["ITEMNO"] = current["ITEMNO"]; newRow["BARCODE"] = current["BARCODE"]; newRow["COMPANY"] = Utils.Company; dtn.Rows.Add(newRow); // } // CheckForMultiStock(current["ITEMNO"].ToString(), current["ITEMNAME"].ToString()); } }
void GetCustomerDetails() { var ds = new BLSales().GetSupCustUnPaidInvoices(lookupcustomer.EditValue.ToString()); if(ds.Rows.Count > 0) { var bal = ds.Compute("SUM(balance)",""); txtoutstanding.EditValue = bal; ledgers1.Merge(ds); } else { XtraMessageBox.Show("Data Not found", "POS", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
bool LoadHoldedInvoices() { Listinvno.Clear(); var dt = new BLSales().GetHoldInvno(); if (dt.Rows.Count > 1) { // var dr = dt.Select("HOLDNO = 0"); foreach (DataRow dataRow in dt.Rows) { Listinvno.Add(dataRow[0].ToString()); } if (Listinvno[0] == txtinvoiceno.Text) DoView(Listinvno[1]); else DoView(Listinvno[0]); lblcustomeronhold.Visible = true; return false; } if (dt.Rows.Count == 1) { foreach (DataRow dr in dt.Rows) { DoView(dr[0].ToString()); } lblcustomeronhold.Visible = false; return false; } return true; }
void KeyF9() { gridView1.PostEditor(); gridView1.UpdateCurrentRow(); int ctyp = 0; if (lookupcustomer.EditValue != null) { ctyp = int.Parse(lookupcustomer.GetColumnValue("CUSTOMERTYPE").ToString()); } var frm = new CashCollected(); frm.iscredit = ctyp == 2; frm.ShowDialog(); if (!frm.issucess) return; var _paytype = frm.paytype1; try { if (decimal.Parse(txtnetamt.EditValue.ToString()) != 0 || decimal.Parse(txtreturnamt.EditValue.ToString())!= 0) { var f = new AmtCollection(); var dt = new BLSales().GetSalesInvMain(txtinvoiceno.Text, false, false); DsInventory.SALESMAINRow dr = null; sALESINVDETAILBindingSource.EndEdit(); f.Salesinvdetail = dsInventory1.SALESINVDETAIL; if (dt.Rows.Count == 0) { dr = (DsInventory.SALESMAINRow)dt.NewRow(); } else { dr = (DsInventory.SALESMAINRow)dt.Rows[0]; } dr.SINVNO = txtinvoiceno.Text; dr.CUSTOMERID = lookupcustomer.EditValue == null ? null : lookupcustomer.EditValue.ToString(); dr.CUSTNAME = lookupcustomer.EditValue == null ? "Cash" : lookupcustomer.Text; dr.SALESTYPE = "A"; if (ctyp == 1) { dr.SALESTYPE = "I"; dr.CUSTOMERFIXDISC = int.Parse(cmbclass.GetColumnValue("COMPDISC").ToString()); dr.CARDID = txtfileno.EditValue == null? 0: int.Parse(txtfileno.EditValue.ToString()); dr.CARDNO = txtvisitno.EditValue == null?0: int.Parse(txtvisitno.EditValue.ToString()); } if (ctyp == 2) { dr.SALESTYPE = "C"; f.iscredit = true; } dr.SDISC = txtdiscount.EditValue == null ? 0 : decimal.Parse(txtdiscount.EditValue.ToString()); dr.TOTALAMT = subtotal.EditValue == null ? 0 : decimal.Parse(subtotal.EditValue.ToString()); dr.ROUNDOFF = 0; dr.NETAMT = decimal.Parse(txtnetamt.EditValue.ToString()); dr.RECDAMT = 0; dr.SALESMAN = lookupcashier.EditValue == null ? 0 : int.Parse(lookupcashier.EditValue.ToString()); dr.DOCTOR = _doctorid; dr.COMPANY = VIRETAILDAL.COMMON.Utils.Company; dr.COMPNAME = Environment.MachineName; dr.SHITFCODE = new BLSales().GetShiftCode(); dr.ISSALE = true; if (cutomerpayment.EditValue != null) dr.CARDDISC = int.Parse(cutomerpayment.EditValue.ToString()); if (txtrounding.EditValue != null) dr.ROUNDOFF = decimal.Parse(txtrounding.EditValue.ToString()) ; else dr.ROUNDOFF = 0; if (txtreturnamt.EditValue != null) dr.RETURNAMT = decimal.Parse(txtreturnamt.EditValue.ToString()); if (cmbclass.EditValue != null) dr.GRADE = cmbclass.Text; if (txtavailble.EditValue != null) dr.AVAILBLEAMT = decimal.Parse(txtavailble.EditValue.ToString()); dr.TRANDATE = DateTime.Now; if (cmbclass.EditValue != null) { f.NetAmount = decimal.Parse(txtnetamt.EditValue.ToString()) * (decimal.Parse(cutomerpayment.EditValue.ToString())/100); } else { f.NetAmount = decimal.Parse(txtnetamt.EditValue.ToString()); } f.RecdAmount = f.NetAmount; f.SalesmainRow = dr; f.Paytype = _paytype; f.ShowDialog(); if (f._issucess) { var bls = new BLSales(); bls.GetNonSaleInv(); lookupcustomer.EditValue = null; if (bls.SalesmainRow != null) { txtinvoiceno.Text = bls.SalesmainRow[0].ToString(); dsInventory1.SALESINVDETAIL.Clear(); dsInventory1.Merge(bls.Salesinvdetail); foreach (DsInventory.SALESINVDETAILRow drs in dsInventory1.SALESINVDETAIL.Rows) { if (!drs.IsEXPDATENull()) drs["EXPDATE1"] = drs.EXPDATE.ToString("MM-yy"); } UpdateTotal(); } else { DoNew(); } KeyF8(false); LoadSessionUsers(); } } } catch (Exception op) { XtraMessageBox.Show(op.ToString(), "POS", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
void KeyF7() { _validateoff = true; var f = new PrepCharges(); f.ShowDialog(); if(f.charge == 0) return; var tot = f.charge; if (prepcnt == 0) { gridView1.AddNewRow(); gridView1.SetRowCellValue(gridView1.FocusedRowHandle, "SINVNO", txtinvoiceno.Text); gridView1.SetRowCellValue(gridView1.FocusedRowHandle, "ITEMNO", ""); gridView1.SetRowCellValue(gridView1.FocusedRowHandle, "BARCODE", ""); gridView1.SetRowCellValue(gridView1.FocusedRowHandle, "ITEMNAME", "Preparation charages"); gridView1.SetRowCellValue(gridView1.FocusedRowHandle, "STOCK", 0); gridView1.SetRowCellValue(gridView1.FocusedRowHandle, "QTY", 1); gridView1.SetRowCellValue(gridView1.FocusedRowHandle, "INVRATE", tot); gridView1.SetRowCellValue(gridView1.FocusedRowHandle, "SPRICE", 0); gridView1.SetRowCellValue(gridView1.FocusedRowHandle, "CPRICE", 0); gridView1.SetRowCellValue(gridView1.FocusedRowHandle, "ISRETURN", _isreturn); gridView1.SetRowCellValue(gridView1.FocusedRowHandle, "STOCKID", 0); gridView1.SetRowCellValue(gridView1.FocusedRowHandle, "DISCONSALE", _DISCONSALE); gridView1.SetRowCellValue(gridView1.FocusedRowHandle, "EXPDATE", null); gridView1.SetRowCellValue(gridView1.FocusedRowHandle, "BONUS", 0); gridView1.SetRowCellValue(gridView1.FocusedRowHandle, "DOCTORID", _doctorid); gridView1.SetRowCellValue(gridView1.FocusedRowHandle, "EXTDISC", 0); gridView1.SetRowCellValue(gridView1.FocusedRowHandle, "LINETOTAL", tot); gridView1.UpdateCurrentRow(); var bl = new BusinessLogic.BLSales().UpdateDetails(dsInventory1.SALESINVDETAIL); } _validateoff = false; UpdateTotal(); }
void KeyF6() { KeyF8(false); lblmutilpleprice.Visible = false; if (lblcustomeronhold.Visible == false) { if (sALESINVDETAILBindingSource.Count > 0) { new BLSales().DoHold(txtinvoiceno.Text, 1); var bl = new BLSales(); bl.GetNonSaleInv(); if (bl.SalesmainRow != null) { txtinvoiceno.Text= bl.SalesmainRow[0].ToString(); dsInventory1.SALESINVDETAIL.Clear(); dsInventory1.Merge(bl.Salesinvdetail); foreach (DsInventory.SALESINVDETAILRow dr in dsInventory1.SALESINVDETAIL.Rows) { if (!dr.IsEXPDATENull()) dr["EXPDATE1"] = dr.EXPDATE.ToString("MM-yy"); } UpdateTotal(); } else { DoNew(); } two.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; lblcustomeronhold.Visible = true; } } else if (lblcustomeronhold.Visible && sALESINVDETAILBindingSource.Count == 0) { LoadHoldedInvoices(); } else if (lblcustomeronhold.Visible && sALESINVDETAILBindingSource.Count > 0) { new BLSales().DoHold(txtinvoiceno.Text, 1); LoadHoldedInvoices(); } //{ // XtraMessageBox.Show("You can't hold more than one customer \r\n please finish the sales and call on hold invoice ", // "POS", MessageBoxButtons.OK, MessageBoxIcon.Information); // //LoadHoldedInvoices(); //} }
private void CheckForMultiStock(string itemno, string itemname) { var bl = new BLSales(); var drstock = new BLSales().GetStockItem(itemno, "S"); var dprice = bl.GetDisctinctSprices(drstock); gridControl1.DataSource = drstock; }
private void simpleButton2_Click(object sender, EventArgs e) { _issucess = true; DoTaKePayment(true); try { var bl = new BLSales(); if (Utils.DefaultPrinterRow["ISDEFAULT"].ToString() == bool.TrueString) { bl.DoSlipPrint(SalesmainRow.SINVNO); } else { bl.DoPrint(SalesmainRow.SINVNO); } } catch (Exception ex) { } }
void DoClear() { var bls = new BLSales(); var str = bls.DeleteSalesInvDetail(txtinvoiceno.Text); if(str!="1") { XtraMessageBox.Show(str, "POS", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { dsInventory1.SALESINVDETAIL.Clear(); gridControl1.ResetBindings(); } lblmutilpleprice.Visible = false; }
void AddMultipleItems(DsInventory.STOCKMASTERDataTable ds, string itemname, bool isblankrow = false) { _validateoff = true; var dt = dsInventory1.SALESINVDETAIL; foreach (DsInventory.STOCKMASTERRow d in ds.Rows) { var newrow = (DsInventory.SALESINVDETAILRow) dt.NewRow(); if (!d.IsDQNTYNull()) if (d.DQNTY > 0) { var tot = Math.Round((d.DQNTY * d.SPRICE), 2); newrow.ITEMNAME = itemname; newrow.STOCKID = d.STOCKID; newrow.ITEMNO= d.ITEMNO; newrow.SINVNO = txtinvoiceno.Text; newrow.BARCODE = d.BARCODE; var aQty = new BLSales().GetAvailableQty(d["ITEMNO"].ToString()); newrow.STOCK = aQty; newrow.ASTOCK = d.SQTY; newrow.INVRATE= d.SPRICE; newrow.SPRICE= d.SPRICE; newrow.CPRICE= d.CPRICE; newrow.ISRETURN= _isreturn; if (!_isreturn) newrow.DISCONSALE = _DISCONSALE; if (!d.IsEXPDATENull()) { newrow.EXPDATE = d.EXPDATE; newrow.EXPDATE1= d.EXPDATE.ToString("MM-yy"); } else { newrow["EXPDATE"] = DBNull.Value ; newrow.EXPDATE1 = string.Empty; } newrow.BONUS= 0; newrow.LINETOTAL = tot; if(!d.IsDISCNull()) { if(d.DISC > 0) { newrow.LINETOTAL = tot - (tot * d.DISC) / 100; } } newrow.DOCTORID = _doctorid; newrow.EXTDISC = 0; if (_isreturn) newrow.QTY = -d.DQNTY; else { newrow.QTY = d.DQNTY; } dt.Rows.Add(newrow); } if (!isblankrow) { if (!_isreturn) new BLSales().UpdateQty(d.STOCKID, -d.DQNTY); else if (_isreturn) { if(d.STOCKID > 0) { new BLSales().UpdateQty(d.STOCKID, d.DQNTY); } } } var bl = new BLSales().UpdateDetails(dsInventory1.SALESINVDETAIL); } sALESINVDETAILBindingSource.EndEdit(); if (_isreturn) { gridControl1.Focus(); gridView1.FocusedColumn = colINVRATE; colDISC.OptionsColumn.ReadOnly = false; colDISC.OptionsColumn.AllowEdit = true; gridView1.ShowEditor(); } else { colDISC.OptionsColumn.AllowEdit = false; } _validateoff = false; }
void DoDeleteRow(DataRow dr) { var ret = new BLSales().DoSalesItemDelete((DsInventory.SALESINVDETAILRow)dr); if (ret != "1") { XtraMessageBox.Show(ret, "POS", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { gridView1.DeleteRow(gridView1.FocusedRowHandle); var bl = new BLSales().UpdateDetails(dsInventory1.SALESINVDETAIL); } UpdateTotal(); }
void DoSave() { var bl = new BLSales(); var ret = bl.DoSave(txtinvoiceno.Text, false,lookupcashier.EditValue==null?0:int.Parse(lookupcashier.EditValue.ToString()), _doctorid); if(ret!="1") { XtraMessageBox.Show(ret, "POS", MessageBoxButtons.OK, MessageBoxIcon.Error); Close(); } }
void CreateNegativeNewRow(DataRow dr,int qty,bool showstock) { var dt = new DsInventory().STOCKMASTER; var dStockmasterRow = (DsInventory.STOCKMASTERRow) dt.NewRow(); dStockmasterRow.ITEMNO = dr["ITEMNO"].ToString(); dStockmasterRow.BARCODE = dr["BARCODE"].ToString(); dStockmasterRow.SPRICE =decimal.Parse(dr["SPRICE"].ToString()); dStockmasterRow.CPRICE = decimal.Parse(dr["CPRICE"].ToString()); dStockmasterRow.DQNTY = qty; new BusinessLogic.BLSales().AddNewItemwithNegativeQty(dStockmasterRow); var dnewstock = new BusinessLogic.BLSales().GetStockItem(dStockmasterRow.ITEMNO, "S"); foreach (DataRow drs in dnewstock.Rows) { drs["DQNTY"] = qty; } AddMultipleItems(dnewstock,dr["ITEMNAME"].ToString(),true); onePing(); }
private void gridView1_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e) { gridView1.PostEditor(); var bl = new BusinessLogic.BLSales(); var dr = gridView1.GetDataRow(gridView1.FocusedRowHandle); int oldvalue = 0; int newval1 = 0; if (dr == null) return; if (_validateoff) return; if (e.Column.FieldName.ToUpper() == "QTY" || e.Column.FieldName.ToUpper() == "INVRATE" || e.Column.FieldName.ToUpper() == "EXPDATE1") { if (e.Column.FieldName.ToUpper() == "QTY" && dr["ISRETURN"].ToString() == bool.FalseString) { if (int.Parse(dr["STOCKID"].ToString()) == 0) return; if (((GridView) sender).ActiveEditor != null) oldvalue = ((GridView) sender).ActiveEditor.EditValue == null ? oldvalue : int.Parse(((GridView) sender).ActiveEditor.OldEditValue.ToString()); if (string.IsNullOrEmpty(dr["QTY"].ToString())) dr["QTY"] = oldvalue; if (((GridView) sender).ActiveEditor != null) newval1 = ((GridView) sender).ActiveEditor.EditValue == null ? oldvalue : int.Parse(((GridView) sender).ActiveEditor.EditValue.ToString()); if (int.Parse(dr["QTY"].ToString()) < 0) dr["QTY"] = -1 * int.Parse(dr["QTY"].ToString()); var tot = Math.Round(int.Parse(dr["QTY"].ToString()) * decimal.Parse(dr["INVRATE"].ToString()), 2); var linestock = int.Parse(dr["ASTOCK"].ToString()); var totalstock = int.Parse(dr["STOCK"].ToString()); if(totalstock < 0) { gridView1.SetRowCellValue(gridView1.FocusedRowHandle, "LINETOTAL", tot); if (oldvalue != newval1) { var qt = oldvalue - newval1; UpdateCurrentRow(dr["TID"].ToString(), newval1, oldvalue); } } else if (newval1 <= linestock) { gridView1.SetRowCellValue(gridView1.FocusedRowHandle, "LINETOTAL", tot); if (oldvalue != newval1) { var qt = oldvalue - newval1; new BLSales().UpdateQty(int.Parse(dr["STOCKID"].ToString()), qt); } } else if (newval1 > linestock) { bool showstockwindow = false; var itm = dr["itemname"].ToString(); string noti = ""; if(NotifyItems!=null) noti = NotifyItems.Find(item => item == itm); if (noti!=null) { showstockwindow = true; } else { NotifyItems.Add(itm); } _validateoff = true; UpdateCurrentRow(dr["TID"].ToString(), linestock, oldvalue); if (newval1 - totalstock > 0) { LoadMultiLineItems(dr["itemno"].ToString(), itm, totalstock - linestock); CreateNegativeNewRow(dr, newval1 - totalstock,showstockwindow); } _validateoff = false; } } if (e.Column.FieldName.ToUpper() == "QTY" && dr["ISRETURN"].ToString() == bool.TrueString) { if (string.IsNullOrEmpty(dr["QTY"].ToString())) dr["QTY"] = -1; else { dr["QTY"] = int.Parse(dr["QTY"].ToString()); } if (int.Parse(dr["QTY"].ToString()) > 0) dr["QTY"] = -1*int.Parse(dr["QTY"].ToString()); if (string.IsNullOrEmpty(dr["INVRATE"].ToString())) dr["INVRATE"] = 0; var tot = Math.Round(int.Parse(dr["QTY"].ToString())*decimal.Parse(dr["INVRATE"].ToString()), 2); if (!string.IsNullOrEmpty(dr["DISC"].ToString())) { if (decimal.Parse(dr["DISC"].ToString()) > 0) tot = tot - tot * decimal.Parse(dr["DISC"].ToString()) / 100; } gridView1.SetRowCellValue(gridView1.FocusedRowHandle, "LINETOTAL", tot); } if (e.Column.FieldName == "INVRATE" && dr["ISRETURN"].ToString() == bool.TrueString) { if (string.IsNullOrEmpty(dr["INVRATE"].ToString())) dr["INVRATE"] = 0; if (string.IsNullOrEmpty(dr["QTY"].ToString())) dr["QTY"] = -1; else { dr["QTY"] = int.Parse(dr["QTY"].ToString()); } if (int.Parse(dr["QTY"].ToString()) > 0) dr["QTY"] = -1*int.Parse(dr["QTY"].ToString()); //purdiscout var tot = Math.Round(int.Parse(dr["QTY"].ToString())*decimal.Parse(dr["INVRATE"].ToString()), 2); if (!string.IsNullOrEmpty(dr["DISC"].ToString())) { if (decimal.Parse(dr["DISC"].ToString()) > 0) tot = tot - tot * decimal.Parse(dr["DISC"].ToString()) / 100; } gridView1.SetRowCellValue(gridView1.FocusedRowHandle, "LINETOTAL", tot); } if (e.Column.FieldName == "EXPDATE1" && dr["ISRETURN"].ToString() == bool.TrueString) { if (!Functions.CheckDate(dr["EXPDATE1"].ToString())) { dr["EXPDATE1"]= null; } else { var split = dr["EXPDATE1"].ToString().Split(new[] { '-' }); var dtn = Functions.CreateFirstDayOfMonth(int.Parse(split[1]), int.Parse(split[0])); gridView1.SetRowCellValue(gridView1.FocusedRowHandle, "EXPDATE", dtn); } } if (e.Column.FieldName == "DISC" && dr["ISRETURN"].ToString() == bool.TrueString) { var tot = Math.Round(int.Parse(dr["QTY"].ToString()) * decimal.Parse(dr["INVRATE"].ToString()), 2); if (!string.IsNullOrEmpty(dr["DISC"].ToString())) { if(decimal.Parse(dr["DISC"].ToString()) > 0) tot = tot - tot * decimal.Parse(dr["DISC"].ToString()) / 100; } gridView1.SetRowCellValue(gridView1.FocusedRowHandle, "LINETOTAL", tot); } } gridView1.UpdateCurrentRow(); if (bl.UpdateDetails(dsInventory1.SALESINVDETAIL) != "1") { XtraMessageBox.Show("Some problem in updating the data", "POS", MessageBoxButtons.OK, MessageBoxIcon.Warning); } UpdateTotal(); }
private void RetailSales_Load(object sender, EventArgs e) { if (VIRETAILDAL.COMMON.Utils.Userid==0) { var f = new Login(); f.ShowDialog(); if(!f.LoginSucess) Close(); } this.InvokeEx((lv => LoadDataSets())); barcomp1.Caption = VIRETAILDAL.COMMON.Utils.Company; if (ClsGetData.GetDailyClosing().Rows.Count == 0) { var frm = new InitialCash(); frm.ShowDialog(); } gridControl1.Invalidate(); _validateoff =false; repositoryItemTextEdit4.Mask.EditMask = "\\d+"; repositoryItemTextEdit4.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.RegEx; txtfileno.Properties.Mask.EditMask = "\\d+"; txtfileno.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.RegEx; txtvisitno.Properties.Mask.EditMask = "\\d+"; txtvisitno.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.RegEx; NotifyItems = new List<string>(); // dsMaster1.Merge(COMMON.ClsGetData.GetItemMastList()); LoadSessionUsers(); if (LoadHoldedInvoices()) { var bl = new BLSales(); bl.GetNonSaleInv(); if (bl.SalesmainRow != null) { txtinvoiceno.Text = bl.SalesmainRow[0].ToString(); dsInventory1.SALESINVDETAIL.Clear(); dsInventory1.Merge(bl.Salesinvdetail); foreach (DsInventory.SALESINVDETAILRow dr in dsInventory1.SALESINVDETAIL.Rows) { if (!dr.IsEXPDATENull()) dr["EXPDATE1"] = dr.EXPDATE.ToString("MM-yy"); } UpdateTotal(); } else { txtinvoiceno.Text = new BLSales().GetInvoiceNo(); DoSave(); } } }
void DoView(string invno) { txtinvoiceno.Text= invno; var bl = new BusinessLogic.BLSales(); bl.GetSalesInvDetail(invno); dsInventory1.Clear(); dsInventory1.Merge(bl.Salesinvdetail); foreach(DsInventory.SALESINVDETAILRow dr in dsInventory1.SALESINVDETAIL.Rows) { if (!dr.IsEXPDATENull()) dr["EXPDATE1"] = dr.EXPDATE.ToString("MM-yy"); } bl.DoUnHold(invno); UpdateTotal(); }
private void simpleButton5_Click(object sender, EventArgs e) { if (gridView1.FocusedRowHandle >= 0) { var bl = new BLSales(); var dr = gridView1.GetFocusedDataRow(); var sinv = dr["SINVNO"].ToString(); if (dr["SALESTYPE"].ToString() == "I") { bl.DoUCAFPrint(sinv,checkBox1.Checked); } } }
void LoadSessionUsers() { lookupcashier.EditValue = VIRETAILDAL.COMMON.Utils.Userid; int _doctorid = new BLSales().GetDoctorLogin(); var d = dsMaster1.USERINFO.FindByUSERID(_doctorid); if (d != null) { if (lookupcashier.EditValue == null) lookupcashier.EditValue = int.Parse(d["USERID"].ToString()); staticdoctor.Text = d["FULLNAME"].ToString() ; } }
bool validateform() { bool retval = false; if (decimal.Parse(txtcashtrans.EditValue.ToString()) < 0) { XtraMessageBox.Show("Please check the transfer amount", "POS", MessageBoxButtons.OK, MessageBoxIcon.Information); return true; } if(decimal.Parse(txtcashdiff.EditValue.ToString()) < 0) { XtraMessageBox.Show("Please check the cash diffrence amount", "POS", MessageBoxButtons.OK, MessageBoxIcon.Information); return true; } if (decimal.Parse(txtclosing.EditValue.ToString()) < 0) { XtraMessageBox.Show("Please check the closing amount", "POS", MessageBoxButtons.OK, MessageBoxIcon.Information); return true; } if(dateEdit1.DateTime > DateTime.Now) { XtraMessageBox.Show("Please check the closing date", "POS", MessageBoxButtons.OK, MessageBoxIcon.Information); return true; } //check hold sales invoices.... var dt = new BLSales().GetHoldInvno(); if (dt.Rows.Count > 1) { XtraMessageBox.Show("Holded invoices found , please complete the sale and proceed", "POS", MessageBoxButtons.OK, MessageBoxIcon.Information); return true; } return retval; }
private void ShiftCode_Load(object sender, EventArgs e) { var bl = new BLSales(); labelControl1.Text = "Current Shift = " + bl.GetShiftCode(); }
void DoTaKePayment(bool isprintinv=false) { simpleButton1.Enabled = false; try { if (txtcard1.EditValue != null) { if (decimal.Parse(txtcard1.EditValue.ToString()) > 0) SalesmainRow.CREDICARDTNO = txtcard1.Text; } else { SalesmainRow.CREDICARDTNO = ""; } var cashamt = txtcash.EditValue == null ? 0: decimal.Parse(txtcash.EditValue.ToString()) - decimal.Parse(txtbal.EditValue.ToString()); var creditamt = txtaccount.EditValue == null ? 0 : decimal.Parse(txtaccount.EditValue.ToString()); var spancard = txtspan.EditValue == null ? 0 : decimal.Parse(txtspan.EditValue.ToString()); var creditcardamt = txtcredit.EditValue == null ? 0 : decimal.Parse(txtcredit.EditValue.ToString()); //var roundingamt = txtrounding.EditValue == null ? 0 : decimal.Parse(txtrounding.EditValue.ToString()); SalesmainRow.CASHAMOUNT = cashamt; SalesmainRow.CARDAMOUNT = creditcardamt + spancard; SalesmainRow.CREDITAMT = creditamt; //SalesmainRow.ROUNDOFF = roundingamt; SalesmainRow.RECDAMT = cashamt; SalesmainRow.CREDICARDTYPE = paytype1; SalesmainRow.ISSALE = true; SalesmainRow.POSTED = true; SalesmainRow.HOLDDEFAULT = false; SalesmainRow.HOLDNO = 0; //dr.CUSTOMERID = lookupcustomer.EditValue == null ? null : lookupcustomer.EditValue.ToString(); //dr.CUSTNAME = lookupcustomer.EditValue == null ? "Cash" : lookupcustomer.SelectedText; if (NetAmount == cashamt) { SalesmainRow.INVAMTTYPE = 1; // SalesmainRow.SALESTYPE = "A"; } else if (NetAmount == creditamt) { SalesmainRow.INVAMTTYPE = 2; SalesmainRow.CARDNO = 0; } else if (NetAmount == spancard) SalesmainRow.INVAMTTYPE = 3; else if (NetAmount == creditcardamt) SalesmainRow.INVAMTTYPE = 3; else if (NetAmount < 0) { SalesmainRow.INVAMTTYPE = 4; } else { SalesmainRow.INVAMTTYPE = 5; } if (txtcard1.EditValue != null) { SalesmainRow.CREDICARDTNO = txtcard1.Text; } //// if (cashamt > 0) { AddRow(cashamt, 1); } if (cashamt < 0) { AddRow(cashamt, 1); } if (creditcardamt > 0) { AddRow(creditcardamt, 2); } if (creditcardamt < 0) { AddRow(creditcardamt, 2); } if (spancard > 0) { AddRow(spancard, 2); } if (spancard < 0) { AddRow(spancard, 2); } if (creditamt > 0) { AddRow(creditamt, 3); } if (creditamt < 0) { AddRow(creditamt, 3); } if (SalesmainRow.SALESTYPE == "I") { /* oLD cal var companydisc = (SalesmainRow.NETAMT) * (Convert.ToDecimal(SalesmainRow.CARDDISC) / 100); var companydisc = (SalesmainRow.NETAMT) * (SalesmainRow.CUSTOMERFIXDISC / 100); var amt = companydisc - companydisc * (Convert.ToDecimal(SalesmainRow.CARDDISC) / 100); */ //var act = (SalesmainRow.NETAMT) * (Convert.ToDecimal(SalesmainRow.CARDDISC) / 100); //var netamt = (SalesmainRow.NETAMT) * (SalesmainRow.CUSTOMERFIXDISC / 100); var companydisc = (SalesmainRow.NETAMT)*(SalesmainRow.CUSTOMERFIXDISC/100);// var amt = companydisc - companydisc * (Convert.ToDecimal(SalesmainRow.CARDDISC) / 100); // var amt = SalesmainRow.NETAMT - (act + netamt); /* New cal var compdisc = SalesmainRow.NETAMT * (Convert.ToDecimal(SalesmainRow.CUSTOMERFIXDISC) / 100);*/ var customerdisc = (SalesmainRow.NETAMT - companydisc)* (Convert.ToDecimal(SalesmainRow.CARDDISC)/100); var amt1 = SalesmainRow.NETAMT - companydisc - customerdisc; AddRow(amt1, 3); creditamt = amt1; } // RETURN if (cashamt < 0) { AddRow(-1*(SalesmainRow.TOTALAMT + SalesmainRow.RETURNAMT), 5); } if (SalesmainRow.RETURNAMT < 0) { AddRow(-1*SalesmainRow.RETURNAMT, 6); } // non calu if (SalesmainRow.SDISC > 0) { if (_isRedim) { AddRow(SalesmainRow.SDISC, 7); } else { AddRow(SalesmainRow.SDISC, 7); } } if (SalesmainRow.ROUNDOFF != 0) { AddRow(SalesmainRow.ROUNDOFF, 8); } //Assign Cost value new BLSales().UpdateCostprice(ref Salesinvdetail); var profit = new BLSales().CaluculateProfitValue(Salesinvdetail); if (NetAmount > 0) { AddRow(profit, 9); // AddRow((profit / NetAmount *100), 10); } SalesmainRow.TRANDATE = DateTime.Now; SalesmainRow.CREDITAMT = creditamt; // SalesmainRow.ROUNDOFF = roundingamt; SalesmainRow.HOLDNO = 0; SalesmainRow.HOLDDEFAULT = false; var bl = new BLSales { Salesinvdetail = Salesinvdetail, SalesmainRow = SalesmainRow, SalesAmount = dt }; var ret = bl.DoSave(); if (ret == "1") { if (_isRedim) { bl.UpdatePointsDetails(SalesmainRow.CUSTOMERID,SalesmainRow.SDISC * 100,SalesmainRow.COMPANY,SalesmainRow.TRANDATE,SalesmainRow.SINVNO,SalesmainRow.SDISC); } _issucess = true; panel2.Visible = false; btnok.Focus(); if (Utils.DefaultPrinterRow["ISDEFAULT"].ToString() == bool.TrueString) bl.DoSlipPrint(SalesmainRow.SINVNO); } else { _issucess = false; XtraMessageBox.Show(ret, "POS", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { XtraMessageBox.Show(ex.ToString(), "POS", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
void AddLineItem() { DataRow current = null; if (txtbarcode.EditValue != null) { var blf = new BlItemMaster().FindItemByBarCode(txtbarcode.EditValue.ToString()); if (blf.Rows.Count == 0) { XtraMessageBox.Show("Item master not found", "POS", MessageBoxButtons.OK, MessageBoxIcon.Information); txtbarcode.SelectAll(); return; } foreach (DataRow dr in blf.Rows) { current = dr; } } else { return; } _DISCONSALE = false; _discount = 0m; var SPRICE = 0m; var CPRICE = 0m; var purdiscout = 0m; if (!string.IsNullOrEmpty(current["DISCOUNT"].ToString())) purdiscout = decimal.Parse(current["DISCOUNT"].ToString()); if (!string.IsNullOrEmpty(current["SPRICE"].ToString())) SPRICE = decimal.Parse(current["SPRICE"].ToString()); if (!string.IsNullOrEmpty(current["CPRICE"].ToString())) { CPRICE = decimal.Parse(current["CPRICE"].ToString()); } txtbarcode.EditValue = string.Empty; if (_isreturn) { DoReturn(current); return; } var bl = new BLSales(); var aQty = bl.GetAvailableQty(current["ITEMNO"].ToString()); if(aQty > 0) { CheckForMultiStock(current["ITEMNO"].ToString(),current["ITEMNAME"].ToString()); } else { var dStockmasterRow = (DsInventory.STOCKMASTERRow)dsInventory1.STOCKMASTER.NewRow(); dStockmasterRow.ITEMNO = current["ITEMNO"].ToString(); dStockmasterRow.BARCODE = current["BARCODE"].ToString(); dStockmasterRow.DQNTY = 1; dStockmasterRow.CPRICE = CPRICE; dStockmasterRow.QTY = 0; if (SPRICE == 0) { SPRICE = new BLSales().GetSalesPriceByItemno(current["ITEMNO"].ToString()); } var f = LoadQtyMoreForm(current["ITEMNO"].ToString(), current["ITEMNAME"].ToString(), aQty, 1, 0, 1, SPRICE, true, true, dStockmasterRow, purdiscout); if (f.iscontinue == 1) { //GetStockItemBySprice var dnewstock = new BLSales().GetStockItem(current["ITEMNO"].ToString(), "S"); if(f.salesprice !=SPRICE) { dnewstock = new BLSales().GetStockItemBySprice(current["ITEMNO"].ToString(),f.salesprice); } foreach(DsInventory.STOCKMASTERRow dr in dnewstock.Rows) { dr.DQNTY = f.enterqty; } // var topRows = dnewstock.AsEnumerable().OrderBy(o => o.Field<int>("STOCKID")).Take(1).ToList().CopyToDataTable(); string itemno = current["ITEMNO"].ToString(); var t = NotifyItems.Find(match => match == itemno); if(t!=null) NotifyItems.Add(itemno); AddMultipleItems(dnewstock, current["ITEMNAME"].ToString(), f.isBlankStock); } } UpdateTotal(); txtbarcode.EditValue = String.Empty; //} }
void DoCloseSale() { if (!validateform()) { var bl = new BlDailySales(); var sprice = new BLReports().GetSumSprice(); var cprice = new BLReports().GetSumCprice(); int ret = 0; var f = new RptDailySalesReport {ClosingDifference = decimal.Parse(txtcashdiff.EditValue.ToString())}; f.LoadDailyReport(); f.watermark = "Closed"; //if ((DateTime.Now.TimeOfDay > new TimeSpan(0, 1, 0)) && (DateTime.Now.TimeOfDay <= new TimeSpan(2, 50, 0))) //{ // f.aMonth = dateEdit1.DateTime.AddDays(-1).ToShortTimeString(); //} //else //{ f.aMonth = dateEdit1.DateTime.ToShortDateString(); // } // f.Show(); f.CreateReport(); f.Hide(); simpleButton1.Enabled = false; var dtc = dateEdit1.DateTime; if (bl.DoSave(1, "Opening Cash", decimal.Parse(txtclosing.EditValue.ToString()), dtc) != 0) { var blP = new BLSales(); blP.UpdateShitCode(1.ToString()); if (bl.DoSave(2, "Opening Sprice", sprice, dtc) != 0) if (bl.DoSave(3, "Opening Cprice", cprice, dtc) != 0) if (decimal.Parse(txtcashtrans.EditValue.ToString()) > 0) bl.DoSave(4, "Transfer Amt", decimal.Parse(txtcashtrans.EditValue.ToString()), dtc); if (decimal.Parse(txtcashdiff.EditValue.ToString()) > 0) bl.DoSave(5, "Difference Amt", decimal.Parse(txtcashdiff.EditValue.ToString()), dtc); bl.DoSave(6, "Last Opening", decimal.Parse(txtlastclosing.EditValue.ToString()), dtc); new VIRETAILDAL.Masters.DailyClosing().CloseDailySales(dtc); } } else { simpleButton1.Enabled = true; } }
void LoadGrid() { var bl = new BLSales(); gridControl1.DataSource = bl.GetSalesDeletedItems(dateEdit1.DateTime.Date, dateEdit2.DateTime.Date); }
bool CheckForMultiStock(string itemno,string itemname) { var bl = new BLSales(); var drstock = new BLSales().GetStockItem(itemno, "S"); var dprice = bl.GetDisctinctSprices(drstock); int cnt = dprice.Count(); var stk = new DsInventory.STOCKMASTERDataTable(); // var topRows = drstock.AsEnumerable().OrderBy(o => o.Field<int>("STOCKID")).Take(1).ToList().CopyToDataTable(); DataTable topRows = drstock.Rows.Cast<DataRow>().Take(1).CopyToDataTable(); // object[] topRows = drstock.Select( * ", "EXPDATE ASC "); DataRow dr = stk.NewRow(); foreach (DataRow drs in topRows.Rows) { drs["DQNTY"] = 1; dr.ItemArray = drs.ItemArray; } stk.Rows.Add(dr); AddMultipleItems(stk, itemname); if (cnt > 1) { onePing(); lblmutilpleprice.Visible = true; gridControl2.DataSource = drstock; } return cnt > 0; }
private void ShiftCode_FormClosed(object sender, FormClosedEventArgs e) { var bl = new BLSales(); if(!string.IsNullOrWhiteSpace(SCode)) bl.UpdateShitCode(SCode); }
void LoadMultiLineItems(string itemno,string itemname, int aQty) { var bl = new BLSales(); var drstock = new BLSales().GetStockItem(itemno, "S"); AddMultipleItems(bl.GetQtyRows(drstock, aQty), itemname); }