private void materialButton3_Click(object sender, EventArgs e) { betterlistview1.Items.Clear(); Grosstotal_txt.Clear(); Discount_txt.Clear(); tax_txt.Clear(); nettotal_txt.Clear(); paid_txt.Clear(); due_txt.Clear(); qty_fltb.Clear(); return_fltb.Clear(); comboBox_item.SelectedIndex = -1; comboBox_customer.SelectedIndex = -1; floattb_wholesalerate.Clear(); retailrate_fltb.Clear(); stock_qty.Clear(); }
private void materialButton_SavenPrint_Click(object sender, EventArgs e) { if (due_txt.decVal > 0 && comboBox_customer.SelectedItem == null) { notificationMAnager1.show("Please select customer for dueable amount.", 3000); return; } if (betterlistview1.Items.Count == 0) { notificationMAnager1.show("please select your items and enter quantity.", 2000); return; } bill savebill = new bill() { paid = paid_txt.decVal, due = due_txt.decVal, grosstotal = Grosstotal_txt.decVal, discount = Discount_txt.decVal, tax = tax_txt.decVal, dates = Dashboard.Instance.nepaliCalender1.engdate, total = nettotal_txt.decVal, day = Dashboard.Instance.nepaliCalender1.DATESTAMP, returns = return_fltb.decVal, checkreturnbills = true, created_at = DateTime.Now, updated_at = DateTime.Now }; if (checkBox1.Checked == true) { if (comboBox_customer.SelectedItem != null) { var selcustomer = (customer)comboBox_customer.SelectedItem; savebill.customer_id = selcustomer.id; if (Convert.ToDecimal(due_txt.Text) > 0) { var cus = db.customers.Find(selcustomer.id); cus.due += Convert.ToDecimal(due_txt.Text); db.Entry(cus).State = System.Data.Entity.EntityState.Modified; } } else { notificationMAnager1.show("please select old customer or add a new customer ", 2000); return; } } else { if (due_txt.decVal > 0 && comboBox_customer.SelectedItem == null) { notificationMAnager1.show("Please select customer for dueable amount.", 3000); return; } } db.bills.Add(savebill); db.SaveChanges(); foreach (var item in betterlistview1.Items.Cast <Bills_form.Viwer>().ToList()) { item.save(savebill.id); } var printer = new Bills_form.BillPrinter(); printer.print(savebill); betterlistview1.Items.Clear(); Grosstotal_txt.Clear(); Discount_txt.Clear(); tax_txt.Clear(); nettotal_txt.Clear(); paid_txt.Clear(); due_txt.Clear(); qty_fltb.Clear(); return_fltb.Clear(); comboBox_item.SelectedIndex = -1; comboBox_customer.SelectedIndex = -1; comboBox_barcode.SelectedIndex = -1; floattb_wholesalerate.Clear(); retailrate_fltb.Clear(); stock_qty.Clear(); }