private void bunifuFlatButton4_Click(object sender, EventArgs e) { dgvCart.DataSource = SelectProductClass.InitializeDGV(); initialize(); #region Enable Controls btnSelectCustomer.Enabled = true; gboxItemDetails.Enabled = true; dgvCart.Enabled = true; dgvItem.Enabled = true; dgvCustomer.Enabled = true; #endregion #region ORDER-NO bool isAlreadyExist = true; try { while (isAlreadyExist) { string orderNo = GenerateOrderNo(); isAlreadyExist = CheckOrderExistance(orderNo); txtInvID.Text = orderNo; } } catch (Exception ex) { MessageBox.Show( @"Error while generating Order No. Pease check below details for reference. Details: " + ex.Message, @"Generate Order No", MessageBoxButtons.OK, MessageBoxIcon.Error); } #endregion }
private void btnGet_Click(object sender, EventArgs e) { if (txtOrderNo.Text.Trim() == string.Empty) { MessageBox.Show("Please put valid order no and try again.", "Missing Order No", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } DataSet returnDs = SelectProductClass.SelectItemsForReturn(txtOrderNo.Text); dgvProducts.DataSource = returnDs.Tables[0].DefaultView; if (returnDs.Tables[0].Rows.Count > 0) { DataSet returnOrderDs = SelectProductClass.SelectOrderForReturn(txtOrderNo.Text); lblInvDate.Text = returnOrderDs.Tables[0].Rows[0][0].ToString(); lblTotalToPay.Text = returnOrderDs.Tables[0].Rows[0][2].ToString(); lblDiscount.Text = returnOrderDs.Tables[0].Rows[0][4].ToString(); lblTotalPayment.Text = returnOrderDs.Tables[0].Rows[0][5].ToString(); lblPaymentDue.Text = returnOrderDs.Tables[0].Rows[0][6].ToString(); } else { MessageBox.Show("No record found against order no " + txtOrderNo.Text + ".", "not found", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }
private void btnRemoveAll_Click(object sender, EventArgs e) { if (dgvCart.Rows.Count > 0) { dgvCart.DataSource = SelectProductClass.InitializeDGV(); } }
private void metroButton1_Click_1(object sender, EventArgs e) { DataTable sourceForCart = SelectProductClass.SelectedItem(txtItemID.Text, txtItemName.Text, Convert.ToInt32(txtConvertedQty.Text), Convert.ToDecimal(txtUnitPrice.Text), Convert.ToDecimal(txtTotalAmt.Text), Convert.ToDecimal(txtPurchasePrice.Text), Convert.ToDecimal(txtUnitPrice.Text), Convert.ToInt32(cboMeasurement.SelectedValue.ToString())); dgvCart.DataSource = sourceForCart; }
private void ReceiptDocument_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { Font HeaderFont = new Font("Courier New", 20, FontStyle.Regular); Font font = new Font("Courier New", 8, FontStyle.Regular); int item = 10; int qty = item + 110; int price = qty + 50; int amount = price + 50; int yPos = 270; string dash = "================================="; e.Graphics.DrawString(dash, font, Brushes.Black, new Point(10, 250)); e.Graphics.DrawString(dash, font, Brushes.Black, new Point(10, 230)); //Image img = Resources.accounts; //e.Graphics.DrawImage(img, 400, 2, img.Width, img.Height); DataSet ds = SelectProductClass.Select(); string name = ds.Tables[0].Rows[0]["Name"].ToString(); e.Graphics.DrawString(name, HeaderFont, Brushes.Black, new Point(10, 50)); e.Graphics.DrawString("Date: " + DateTime.Now, font, Brushes.Black, new Point(10, 200)); e.Graphics.DrawString("Client Name " + lblCustname.Text, font, Brushes.Black, new Point(10, 220)); e.Graphics.DrawString("ITEM ", font, Brushes.Black, new Point(item, 240)); e.Graphics.DrawString("QTY ", font, Brushes.Black, new Point(qty, 240)); e.Graphics.DrawString("PRICE ", font, Brushes.Black, new Point(price, 240)); e.Graphics.DrawString("AMOUNT ", font, Brushes.Black, new Point(amount, 240)); //foreach(var i in dgv.Rows) //{ // e.Graphics.DrawString(i., new Font("Arial", 12, FontStyle.Regular), Brushes.Black, new Point(350, 240)); //} for (int i = 0; i < dgv.Rows.Count; i++) { e.Graphics.DrawString(dgv.Rows[i].Cells[1].Value.ToString(), font, Brushes.Black, new Point(item, yPos)); e.Graphics.DrawString(dgv.Rows[i].Cells[2].Value.ToString(), font, Brushes.Black, new Point(qty, yPos)); e.Graphics.DrawString(dgv.Rows[i].Cells[3].Value.ToString(), font, Brushes.Black, new Point(price, yPos)); e.Graphics.DrawString(dgv.Rows[i].Cells[4].Value.ToString(), font, Brushes.Black, new Point(amount, yPos)); yPos += 20; } e.Graphics.DrawString(dash, font, Brushes.Black, new Point(item, yPos + 10)); e.Graphics.DrawString("Total Items: " + lblItems.Text, font, Brushes.Black, new Point(item, yPos + 20)); e.Graphics.DrawString("Total Amount: " + lblAmt.Text, font, Brushes.Black, new Point(item, yPos + 40)); e.Graphics.DrawString("Total To Pay: " + lblToPay.Text, font, Brushes.Black, new Point(item, yPos + 60)); }
private void initialize() { #region ORDER-NO bool isAlreadyExist = true; try { while (isAlreadyExist) { string orderNo = GenerateOrderNo(); isAlreadyExist = CheckOrderExistance(orderNo); txtInvID.Text = orderNo; } } catch (Exception ex) { MessageBox.Show( @"Error while generating Order No. Pease check below details for reference. Details: " + ex.Message, @"Generate Order No", MessageBoxButtons.OK, MessageBoxIcon.Error); } #endregion //initialize the grid(empty) dgvCart.DataSource = SelectProductClass.InitializeDGV(); //load stock available //PopulateStockGrid(); //load default customer txtCustID.Text = Properties.Settings.Default["WalkingCustomerID"].ToString(); txtCustName.Text = @"WALK IN CUSTOMER"; //set default date txtInvDate.Text = DateTime.Now.Date.ToShortDateString(); //populate search by category combobox DataSet d = CategoryClass.Select(); cboSearchCat.DataSource = d.Tables[0].DefaultView; cboSearchCat.DisplayMember = "Name"; cboSearchCat.ValueMember = "CatID"; //POPULATE UNITS cboMeasurement.DataSource = ProductClass.PopulateMeasurementDropDown().Tables[0].DefaultView; cboMeasurement.DisplayMember = "Name"; cboMeasurement.ValueMember = "MeasurementID"; btnLoadAll.PerformClick(); }
private void btnFetchOrder_Click(object sender, EventArgs e) { DataSet returnDs = SelectProductClass.SelectItemsForReturn(txtOrderNo.Text); dgv.DataSource = returnDs.Tables[0].DefaultView; DataSet returnOrderDs = SelectProductClass.SelectOrderForReturn(txtOrderNo.Text); //GRAND TOTAL, TOTAL TO PAY //txtGrandTotal.Text = returnOrderDs.Tables[0].Rows[0][2].ToString(); lblTotalToPay.Text = returnOrderDs.Tables[0].Rows[0][2].ToString(); //DISCOUNT txtDiscount.Text = returnOrderDs.Tables[0].Rows[0][4].ToString(); //TOTAL PAYMENT txtTotalPayment.Text = returnOrderDs.Tables[0].Rows[0][5].ToString(); //PAYMENT DUE txtPaymentDue.Text = returnOrderDs.Tables[0].Rows[0][6].ToString(); }
private void button1_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(ModifyProductClass.OrderNo)) { } else { MessageBox.Show("Product Refund"); txtInvID.Text = ModifyProductClass.OrderNo; txtCustID.Text = ModifyProductClass.CustomerID.ToString(); txtCustName.Text = ModifyProductClass.CustomerName; DataSet returnDs = SelectProductClass.SelectItemsForReturn(ModifyProductClass.OrderNo); dgvCart.DataSource = returnDs.Tables[0].DefaultView; DataSet returnOrderDs = SelectProductClass.SelectOrderForReturn(ModifyProductClass.OrderNo); //TRANSACTION DATE txtInvDate.Text = returnOrderDs.Tables[0].Rows[0][0].ToString(); //GRAND TOTAL, TOTAL TO PAY //txtGrandTotal.Text = returnOrderDs.Tables[0].Rows[0][2].ToString(); lblTotalToPay.Text = returnOrderDs.Tables[0].Rows[0][2].ToString(); //DISCOUNT txtDiscount.Text = returnOrderDs.Tables[0].Rows[0][4].ToString(); //TOTAL PAYMENT txtTotalPayment.Text = returnOrderDs.Tables[0].Rows[0][5].ToString(); //PAYMENT DUE txtPaymentDue.Text = returnOrderDs.Tables[0].Rows[0][6].ToString(); MessageBox.Show("Finished OK"); } }
private void bunifuFlatButton2_Click(object sender, EventArgs e) { ProcessTransaction(); dgv.DataSource = SelectProductClass.InitializeDGV(); button1.PerformClick(); }
private void frSale_Load(object sender, EventArgs e) { dgv.DataSource = SelectProductClass.InitializeDGV(); lblCustname.Text = "WALKING CUSTOMER"; lblCustID.Text = Properties.Settings.Default["WalkingCustomerID"].ToString(); }
private void PrintDocument_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { #region RECEIPT var headerFont = new Font("Arial", 20, FontStyle.Regular); var subHeaderFont = new Font("Courier New", 16, FontStyle.Regular); var font = new Font("Courier New", 8, FontStyle.Regular); int itemID = 10; int item = 100; int qty = item + 400; int price = qty + 100; int amount = price + 100; int yPos = 270; //InvoiceType = "Sale Invoice"; string dash = "=============================================================================================================="; string SingleDash = "------------------------------------------------------------------------------------------------------------------"; e.Graphics.DrawString(dash, font, Brushes.Black, new Point(10, 250)); e.Graphics.DrawString(dash, font, Brushes.Black, new Point(10, 230)); e.Graphics.DrawString(SingleDash, font, Brushes.Black, new Point(itemID, 110)); //Image img = Resources.accounts; //e.Graphics.DrawImage(img, 400, 2, img.Width, img.Height); //SELECT ACCOUNT INFO DataSet ds = SelectProductClass.Select(); string name = ds.Tables[0].Rows[0]["Name"].ToString(); string slogan = ds.Tables[0].Rows[0]["Slogan"].ToString(); string address = ds.Tables[0].Rows[0]["Address"].ToString(); string contact = ds.Tables[0].Rows[0]["Contact"].ToString(); e.Graphics.DrawString("Invoice Type: " + InvoiceType, font, Brushes.Black, new Point(10, 170)); //shop name, slogan, address, contact e.Graphics.DrawString(name, headerFont, Brushes.Black, new Point(240, 20)); e.Graphics.DrawString(slogan, subHeaderFont, Brushes.Black, new Point(200, 50)); e.Graphics.DrawString(address, subHeaderFont, Brushes.Black, new Point(180, 70)); e.Graphics.DrawString(contact, subHeaderFont, Brushes.Black, new Point(260, 90)); e.Graphics.DrawString("Customer Name: " + txtCustName.Text, font, Brushes.Black, new Point(10, 130)); e.Graphics.DrawString("Order No: " + txtInvID.Text, font, Brushes.Black, new Point(10, 150)); e.Graphics.DrawString("Date: " + DateTime.Now, font, Brushes.Black, new Point(600, 150)); e.Graphics.DrawString("PRODUCT ID ", font, Brushes.Black, new Point(itemID, 240)); e.Graphics.DrawString("ITEM ", font, Brushes.Black, new Point(item, 240)); e.Graphics.DrawString("QTY ", font, Brushes.Black, new Point(qty, 240)); e.Graphics.DrawString("PRICE ", font, Brushes.Black, new Point(price, 240)); e.Graphics.DrawString("AMOUNT ", font, Brushes.Black, new Point(amount, 240)); for (int i = 0; i < dgvCart.Rows.Count; i++) { e.Graphics.DrawString(dgvCart.Rows[i].Cells["ProductID"].Value.ToString(), font, Brushes.Black, new Point(itemID, yPos)); e.Graphics.DrawString(dgvCart.Rows[i].Cells["NAME"].Value.ToString(), font, Brushes.Black, new Point(item, yPos)); e.Graphics.DrawString(dgvCart.Rows[i].Cells["QUANTITY"].Value.ToString(), font, Brushes.Black, new Point(qty, yPos)); e.Graphics.DrawString(dgvCart.Rows[i].Cells["PRICE"].Value.ToString(), font, Brushes.Black, new Point(price, yPos)); e.Graphics.DrawString(dgvCart.Rows[i].Cells["AMOUNT"].Value.ToString(), font, Brushes.Black, new Point(amount, yPos)); yPos += 20; } e.Graphics.DrawString(SingleDash, font, Brushes.Black, new Point(itemID, yPos + 10)); e.Graphics.DrawString(SingleDash, font, Brushes.Black, new Point(itemID, yPos + 30)); //e.Graphics.DrawString(dash, font, Brushes.Black, new Point(item, yPos + 10)); e.Graphics.DrawString("Total", font, Brushes.Black, new Point(item, yPos + 20)); // e.Graphics.DrawString(txtTotalItems.Text, font, Brushes.Black, new Point(qty, yPos + 20)); e.Graphics.DrawString(txtGrandTotal.Text, font, Brushes.Black, new Point(amount, yPos + 20)); e.Graphics.DrawString("Invoice Total (RS): " + txtGrandTotal.Text, font, Brushes.Black, new Point(qty, yPos + 50)); //e.Graphics.DrawString("Total To Pay: " + lblTotalToPay.Text, font, Brushes.Black, new Point(item, yPos + 60)); // e.Graphics.DrawString("Discount: " + txtDiscount.Text, font, Brushes.Black, new Point(item, yPos + 80)); e.Graphics.DrawString("Total Payment (RS): " + txtTotalPayment.Text, font, Brushes.Black, new Point(qty, yPos + 70)); e.Graphics.DrawString("Payment Due (RS): " + txtPaymentDue.Text, font, Brushes.Black, new Point(qty, yPos + 90)); e.Graphics.DrawString(SingleDash, font, Brushes.Black, new Point(itemID, yPos + 100)); e.Graphics.DrawString("Software by Developer Studio: 923366536339", font, Brushes.Black, new Point(itemID, yPos + 110)); }