void InitCategories() { wrProducts.Server2Client spc = new wrProducts.Server2Client(); wrProducts.wsProducts prd = new wrProducts.wsProducts(); spc = prd.GetCategories(); lueCAT.Properties.DataSource = spc.dataTable; lueCAT.Properties.DisplayMember = "CategoryName"; lueCAT.Properties.ValueMember = "ID"; }
void InitProducts() { wrProducts.Server2Client spc = new wrProducts.Server2Client(); wrProducts.wsProducts prd = new wrProducts.wsProducts(); spc = prd.GetProducts(); luePNM.Properties.DataSource = spc.dataTable; luePNM.Properties.DisplayMember = "ProductName"; luePNM.Properties.ValueMember = "ID"; }
void InitProducts(int CategoryID) { sc = new wrProducts.Server2Client(); prd = new wrProducts.wsProducts(); sc = prd.GetProductByCategory(CategoryID); luePRD.Properties.DataSource = sc.dataTable; luePRD.Properties.DisplayMember = "ProductName"; luePRD.Properties.ValueMember = "ID"; }
private void lueCAT_EditValueChanged(object sender, EventArgs e) { int CID = Convert.ToInt32(lueCAT.EditValue); sc = new wrProducts.Server2Client(); prd = new wrProducts.wsProducts(); sc = prd.GetProductByCategory(CID); grd.DataSource = sc.dataTable; }
public frmDeleteProduct() { InitializeComponent(); sc = new wrProducts.Server2Client(); prd = new wrProducts.wsProducts(); sc = prd.GetCategories(); lueCAT.Properties.DataSource = sc.dataTable; lueCAT.Properties.DisplayMember = "CategoryName"; lueCAT.Properties.ValueMember = "ID"; }
void InitCategories() { wrProducts.Server2Client s2c = new wrProducts.Server2Client(); wrProducts.wsProducts cat = new wrProducts.wsProducts(); s2c = cat.GetCategories(); lueCAT1.Properties.DataSource = s2c.dataTable; lueCAT1.Properties.DisplayMember = "CategoryName"; lueCAT1.Properties.ValueMember = "ID"; lueCAT2.Properties.DataSource = s2c.dataTable; lueCAT2.Properties.DisplayMember = "CategoryName"; lueCAT2.Properties.ValueMember = "ID"; }
private void bPCATS_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { wrProducts.Server2Client sc = new wrProducts.Server2Client(); wrProducts.wsProducts pd = new wrProducts.wsProducts(); sc = pd.ProductListByCategorySimplified(); rptProductByCat rpt = new rptProductByCat() { DataSource = sc.dataTable }; GroupField grp = new GroupField("CategoryName"); rpt.groupHeader.GroupFields.Add(grp); rpt.lbCAT.DataBindings.Add("Text", null, "CategoryName"); rpt.lbPNM.DataBindings.Add("Text", null, "ProductName"); rpt.lbBVL.DataBindings.Add("Text", null, "BuyingValue", "{0:C2}"); rpt.lbSVL.DataBindings.Add("Text", null, "SellingValue", "{0:C2}"); rpt.lbQTY.DataBindings.Add("Text", null, "SumOfQuantity"); rpt.lbBCD.Text = ""; //rpt.lbSBVL.DataBindings.Add("Text", null, "BuyingValue", "{0:C2}"); //rpt.lbSSVL.DataBindings.Add("Text", null, "SellingValue", "{0:C2}"); //rpt.lbSQTY.DataBindings.Add("Text", null, "Quantity"); //rpt.lbGBVL.DataBindings.Add("Text", null, "BuyingValue", "{0:C2}"); //rpt.lbGSVL.DataBindings.Add("Text", null, "SellingValue", "{0:C2}"); //rpt.lbGQTY.DataBindings.Add("Text", null, "Quantity"); //sbvl.FormatString = "{0:C2}"; //ssvl.FormatString = "{0:C2}"; //gbvl.FormatString = "{0:C2}"; //gsvl.FormatString = "{0:C2}"; //sbvl.Running = SummaryRunning.Group; //ssvl.Running = SummaryRunning.Group; //sqty.Running = SummaryRunning.Group; //gbvl.Running = SummaryRunning.Report; //gsvl.Running = SummaryRunning.Report; //gqty.Running = SummaryRunning.Report; //rpt.lbSBVL.Summary = sbvl; //rpt.lbSSVL.Summary = ssvl; //rpt.lbSQTY.Summary = sqty; //rpt.lbGBVL.Summary = gbvl; //rpt.lbGSVL.Summary = gsvl; //rpt.lbGQTY.Summary = gqty; dv.PrintingSystem = rpt.PrintingSystem; rpt.CreateDocument(true); }
private void lueCAT1_EditValueChanged(object sender, EventArgs e) { if (lueCAT1.EditValue != null) { int cid = Convert.ToInt32(lueCAT1.EditValue); wrProducts.Server2Client s2c = new wrProducts.Server2Client(); wrProducts.wsProducts prd = new wrProducts.wsProducts(); s2c = prd.GetProductByCategory(cid); luePNM1.Properties.DataSource = s2c.dataTable; luePNM1.Properties.DisplayMember = "ProductName"; luePNM1.Properties.ValueMember = "ID"; } }
private void luePNM1_EditValueChanged(object sender, EventArgs e) { if (luePNM1.EditValue != null) { int pid = Convert.ToInt32(luePNM1.EditValue); wrProducts.Server2Client s2c = new wrProducts.Server2Client(); wrProducts.wsProducts prd = new wrProducts.wsProducts(); wrProducts.Product p = new wrProducts.Product(); p = prd.GetProductByID(pid); txtBVL1.EditValue = p.BuyingValue; txtSVL1.EditValue = p.SellingValue; txtQTY1.EditValue = 1; } }
private void lueCAT_EditValueChanged(object sender, EventArgs e) { if (slueCAT.RowCount <= 0) { return; } int CAT = Convert.ToInt32(lueCAT.EditValue); sc = new wrProducts.Server2Client(); prd = new wrProducts.wsProducts(); sc = prd.GetProductByCategory(CAT); luePNM.Properties.DataSource = sc.dataTable; luePNM.Properties.DisplayMember = "ProductName"; luePNM.Properties.ValueMember = "ProductName"; }
private void bEdit_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { CID = Convert.ToInt32(grv.GetFocusedRowCellValue(colCID)); dp.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; IsEdit = true; wrProducts.Category c = new wrProducts.Category(); wrProducts.wsProducts prd = new wrProducts.wsProducts(); c = prd.GetCategory(CID); txtCNM.Text = c.CategoryName; txtCNM.Focus(); }
public frmRowEdit(int RowHandle, int CatID, string PNM, double BVL, double SVL, int QTY, string BCD) { InitializeComponent(); wrProducts.Server2Client sc = new wrProducts.Server2Client(); wrProducts.wsProducts cat = new wrProducts.wsProducts(); sc = cat.GetCategories(); lueCAT.Properties.DataSource = sc.dataTable; lueCAT.Properties.DisplayMember = "CategoryName"; lueCAT.Properties.ValueMember = "ID"; lueCAT.EditValue = CatID; txtPNM.EditValue = PNM; txtBVL.EditValue = BVL; txtSVL.EditValue = SVL; txtQTY.EditValue = QTY; txtBCD.EditValue = BCD; }
private void lueCAT_EditValueChanged(object sender, EventArgs e) { if (lueCAT.EditValue == null) { InitProducts(); } else { int CID = Convert.ToInt32(lueCAT.EditValue); wrProducts.Server2Client spc = new wrProducts.Server2Client(); wrProducts.wsProducts prd = new wrProducts.wsProducts(); spc = prd.GetProductByCategory(CID); luePNM.Properties.DataSource = spc.dataTable; luePNM.Properties.DisplayMember = "ProductName"; luePNM.Properties.ValueMember = "ID"; } }
private void txtBCD_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { wrProducts.Server2Client spc = new wrProducts.Server2Client(); wrProducts.wsProducts prd = new wrProducts.wsProducts(); wrProducts.Product p = new wrProducts.Product(); p = prd.GetProductByBarCode(txtBCD.Text); if (p.Quantity < 1) { lblInfo.Text = "Product not available!"; txtBCD.Text = ""; txtBCD.Focus(); return; } if (p.Message == null) { DataRow r = dt.NewRow(); r["ProductID"] = p.ProductID; r["ProductName"] = p.ProductName; r["BarCode"] = p.BarCode; r["BuyingValue"] = p.BuyingValue; r["SellingValue"] = p.SellingValue; r["Quantity"] = 1; r["Amount"] = 1 * p.SellingValue; dt.Rows.Add(r); grd.DataSource = dt; grd.Refresh(); double TotalAmount = Convert.ToDouble(colAMT.SummaryText); txtAMT.Text = TotalAmount.ToString(); txtPAM.Text = TotalAmount.ToString(); txtBCD.Text = ""; txtBCD.Focus(); } else { lblInfo.Text = p.Message; } } }
private void luePNM_EditValueChanged(object sender, EventArgs e) { if (luePNM.EditValue == null) { Clear(); } else { int PID = Convert.ToInt32(luePNM.EditValue); wrProducts.Server2Client spc = new wrProducts.Server2Client(); wrProducts.wsProducts prd = new wrProducts.wsProducts(); wrProducts.Product p = new wrProducts.Product(); p = prd.GetProductByID(PID); BuyingValue = p.BuyingValue; txtSVL.EditValue = p.SellingValue; txtQTY.Properties.MaxValue = p.Quantity; BarCode = p.BarCode; } }
private void btnSave_Click(object sender, EventArgs e) { if (grv.RowCount <= 0) { XtraMessageBox.Show("Please add some product first!"); return; } sc = new wrProducts.Server2Client(); prd = new wrProducts.wsProducts(); for (int i = 0; i <= grv.RowCount - 1; i++) { wrProducts.Product p = new wrProducts.Product(); p.CategoryID = Convert.ToInt32(grv.GetRowCellValue(i, colCAT)); p.ProductName = grv.GetRowCellValue(i, colPNM).ToString(); p.BuyingValue = Convert.ToDouble(grv.GetRowCellValue(i, colBVL)); p.SellingValue = Convert.ToDouble(grv.GetRowCellValue(i, colSVL)); p.Quantity = Convert.ToInt32(grv.GetRowCellValue(i, colQTY)); p.BarCode = grv.GetRowCellValue(i, colBCD).ToString(); sc = prd.AddProduct(p); if (sc.Message != null) { XtraMessageBox.Show(sc.Message); return; } } XtraMessageBox.Show("Product(s) added successfully!"); grd.DataSource = null; grd.Refresh(); lueCAT.EditValue = null; txtPNM.EditValue = null; txtBVL.EditValue = 0; txtSVL.EditValue = 0; txtQTY.EditValue = 1; txtBCD.EditValue = null; lueCAT.Focus(); }
private void luePRD_EditValueChanged(object sender, EventArgs e) { if (luePRD.EditValue != null) { int pid = Convert.ToInt32(luePRD.EditValue); wrProducts.Product p = new wrProducts.Product(); prd = new wrProducts.wsProducts(); p = prd.GetProductByID(pid); lueCAT2.EditValue = lueCAT.EditValue; txtPNM.Text = p.ProductName; txtBVL.EditValue = p.BuyingValue; txtSVL.EditValue = p.SellingValue; txtQTY.EditValue = p.Quantity; txtBCD.EditValue = p.BarCode; } }
private void LoadData() { sc = new wrProducts.Server2Client(); prd = new wrProducts.wsProducts(); sc = prd.GetProductCategories(); grd.DataSource = sc.dataTable; if (grv.RowCount <= 0) { bEdit.Enabled = false; bDel.Enabled = false; } else { bEdit.Enabled = true; bDel.Enabled = true; } }
private void btnSave_Click(object sender, EventArgs e) { sc = new wrProducts.Server2Client(); prd = new wrProducts.wsProducts(); wrProducts.Category c = new wrProducts.Category(); c.CategoryID = CID; c.CategoryName = txtCNM.Text.ToUpper(); if (!IsEdit) { sc = prd.AddCategory(c); if (sc.Message == null) { XtraMessageBox.Show("New Category added successfully!"); } else { XtraMessageBox.Show(sc.Message); } txtCNM.Text = ""; txtCNM.Focus(); } else { sc = prd.UpdateCategory(c); if (sc.Message == null) { XtraMessageBox.Show("Category updated successfully!"); } else { XtraMessageBox.Show(sc.Message); } dp.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; } LoadData(); }
private void bPSUPX_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { wrProducts.Server2Client sc = new wrProducts.Server2Client(); wrProducts.wsProducts pd = new wrProducts.wsProducts(); sc = pd.ProductListBySupplierExtended(); rptProductBySup rpt = new rptProductBySup() { DataSource = sc.dataTable }; GroupField grp = new GroupField("SupplierName"); rpt.groupHeader.GroupFields.Add(grp); rpt.lbSUP.DataBindings.Add("Text", null, "SupplierName"); rpt.lbPNM.DataBindings.Add("Text", null, "ProductName"); rpt.lbBVL.DataBindings.Add("Text", null, "BuyingValue", "{0:C2}"); rpt.lbSVL.DataBindings.Add("Text", null, "SellingValue", "{0:C2}"); rpt.lbQTY.DataBindings.Add("Text", null, "Quantity"); rpt.lbBCD.DataBindings.Add("Text", null, "BarCode"); dv.PrintingSystem = rpt.PrintingSystem; rpt.CreateDocument(true); }
private void btnSell_Click(object sender, EventArgs e) { if (lueCNM.EditValue == null) { XtraMessageBox.Show("Please select Customer!"); return; } if (grv.RowCount <= 0) { XtraMessageBox.Show("Please add some product to sell"); return; } wrSales.Sale s = new wrSales.Sale(); s.InvoiceNo = txtINV.Text; s.SaleDate = dtpSDT.DateTime; s.CustomerID = Convert.ToInt32(lueCNM.EditValue); s.Amount = Convert.ToDouble(txtAMT.EditValue); s.Discount = Convert.ToDouble(txtDSC.EditValue); s.Payment = Convert.ToDouble(txtPAM.EditValue); s.Balance = Convert.ToDouble(txtBAL.EditValue); sc = new wrSales.Server2Client(); sls = new wrSales.wsSales(); sc = sls.AddSale(s); if (sc.Message != null) { XtraMessageBox.Show(sc.Message); return; } wrCustomers.Server2Client scc = new wrCustomers.Server2Client(); wrCustomers.wsCustomers cus = new wrCustomers.wsCustomers(); wrCustomers.CustomerAccount ca = new wrCustomers.CustomerAccount(); ca.CustomerID = Convert.ToInt32(lueCNM.EditValue); ca.TransDate = s.SaleDate; ca.Description = s.InvoiceNo; if (s.Balance == 0) { ca.Debit = s.Payment; ca.Credit = s.Payment; } else { ca.Debit = s.Amount - s.Discount; ca.Credit = s.Payment; } ca.Balance = CustomerBalance + s.Balance; scc = cus.addTrans(ca); if (scc.Message != null) { XtraMessageBox.Show(scc.Message); return; } for (int i = 0; i <= grv.RowCount - 1; i++) { wrProducts.Server2Client spc = new wrProducts.Server2Client(); wrProducts.wsProducts prd = new wrProducts.wsProducts(); wrSales.SaleDetail sd = new wrSales.SaleDetail(); sd.InvoiceNo = txtINV.Text; sd.ProductID = Convert.ToInt32(grv.GetRowCellValue(i, colPID)); sd.Quantity = Convert.ToInt32(grv.GetRowCellValue(i, colQTY)); sd.BuyingValue = Convert.ToDouble(grv.GetRowCellValue(i, colBVL)); sd.SellingValue = Convert.ToDouble(grv.GetRowCellValue(i, colSVL)); sd.Amount = sd.Quantity * sd.SellingValue; sc = new wrSales.Server2Client(); sc = sls.AddSaleDetails(sd); spc = prd.updateQuantity(sd.ProductID, sd.Quantity, "-"); } if (XtraMessageBox.Show("Do you want to print receipt?", "Print Receipt", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { sc = new wrSales.Server2Client(); sls = new wrSales.wsSales(); sc = sls.getSoldProductsByInvoiceNo(txtINV.Text); rptCashMemo rpt = new rptCashMemo() { DataSource = sc.dataTable }; rpt.lblCNM.Text = cc.CustomerName; rpt.lblADR.Text = cc.Address; rpt.lblPHN.Text = cc.Phone; rpt.lblINV.Text = txtINV.Text; rpt.lblSDT.Text = dtpSDT.DateTime.ToShortDateString(); rpt.lblPNM.DataBindings.Add("Text", null, "ProductName"); rpt.lbSNO.DataBindings.Add("Text", null, "BarCode"); rpt.lblQTY.DataBindings.Add("Text", null, "Quantity"); rpt.lblPRC.DataBindings.Add("Text", null, "SellingValue", "{0:c}"); rpt.lblAMT.DataBindings.Add("Text", null, "Amount", "{0:c}"); if (s.Discount > 0) { rpt.xrLabel8.Visible = true; rpt.lblDSC.Text = "(-) " + s.Discount.ToString("c2"); } else { rpt.xrLabel8.Visible = false; rpt.lblDSC.Text = ""; } rpt.lblTTL.Text = (s.Amount - s.Discount).ToString("c2"); rpt.lblAMW.Text = "Rupees " + Utils.NumbersToWords(Convert.ToInt32(s.Amount - s.Discount)) + " only"; rpt.ShowPreviewDialog(); } grd.DataSource = null; dt = new DataTable(); InitDataTable(); InitInvoiceNo(); lueCAT.EditValue = null; luePNM.EditValue = null; lueCAT.Properties.DataSource = null; luePNM.Properties.DataSource = null; InitCategories(); InitProducts(); Reset(); }
private void btnOK_Click(object sender, EventArgs e) { sc = new wrPurchases.Server2Client(); pur = new wrPurchases.wsPurchases(); wrPurchases.Purchase prc = new wrPurchases.Purchase(); //Products prd = new Products(); prc.InvoiceNo = txtINV.Text; prc.PurchaseDate = dtpPDT.DateTime; prc.SupplierID = Convert.ToInt32(lueSUP.EditValue); prc.Amount = Convert.ToDouble(txtAMT.EditValue); prc.Payment = Convert.ToDouble(txtPAM.EditValue); prc.Balance = Convert.ToDouble(txtBAL.EditValue); sc = pur.addPurchase(prc); if (sc.Message != null) { XtraMessageBox.Show(sc.Message); return; } sup = new wrSuppliers.wsSuppliers(); wrSuppliers.Server2Client s2c = new wrSuppliers.Server2Client(); wrSuppliers.SupplierAccount s = new wrSuppliers.SupplierAccount(); s.SupplierID = Convert.ToInt32(lueSUP.EditValue); s.TransDate = dtpPDT.DateTime; s.Description = txtINV.Text; s.Debit = Convert.ToDouble(txtAMT.EditValue); s.Credit = Convert.ToDouble(txtPAM.EditValue); s.Balance = SupplierBalance + Convert.ToDouble(txtBAL.Text); s2c = sup.addTrans(s); if (sc.Message != null) { XtraMessageBox.Show(sc.Message); return; } Guid g; for (int i = 0; i <= grv.RowCount - 1; i++) { int cid = Convert.ToInt32(grv.GetRowCellValue(i, colCID)); string pnm = grv.GetRowCellValue(i, colPNM).ToString(); double bvl = Convert.ToDouble(grv.GetRowCellValue(i, colBVL)); double svl = Convert.ToDouble(grv.GetRowCellValue(i, colSVL)); int qty = Convert.ToInt32(grv.GetRowCellValue(i, colQTY)); double amt = Convert.ToDouble(grv.GetRowCellValue(i, colAMT)); string bcd = grv.GetRowCellValue(i, colBCD).ToString(); wrPurchases.PurchaseDetail pdt = new wrPurchases.PurchaseDetail(); pdt.InvoiceNo = txtINV.Text; g = Guid.NewGuid(); pdt.ProductCode = g.ToString(); pdt.BuyingValue = bvl; pdt.SellingValue = svl; pdt.Quantity = qty; pdt.Amount = amt; sc = pur.addPurchaseDetails(pdt); if (sc.Message != null) { XtraMessageBox.Show(sc.Message); return; } wrProducts.wsProducts prd = new wrProducts.wsProducts(); wrProducts.Product p = new wrProducts.Product(); wrProducts.Server2Client spc = new wrProducts.Server2Client(); p.CategoryID = cid; p.SupplierID = Convert.ToInt32(lueSUP.EditValue); p.ProductCode = g.ToString(); p.ProductName = pnm; p.BuyingValue = bvl; p.SellingValue = svl; p.SupplierID = Convert.ToInt32(lueSUP.EditValue); p.Quantity = qty; p.BarCode = bcd; spc = prd.AddProduct(p); if (sc.Message != null) { XtraMessageBox.Show(sc.Message); return; } } XtraMessageBox.Show("Product(s) purchased successfully!"); InitInvoice(); dtpPDT.DateTime = DateTime.Now.Date; dt = new DataTable(); InitDataTable(); InitSuppliers(); InitCategories(); grd.DataSource = null; }