private void btnPrint_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(txtCustomerName.Text)) { MessageBox.Show("Please Enter The Customer Name"); } if (string.IsNullOrWhiteSpace(txtCash.Text)) { MessageBox.Show("Please Enter The Paid Amount"); txtCash.Text = Convert.ToString(0); } if (string.IsNullOrWhiteSpace(txtDiscount.Text)) { txtDiscount.Text = Convert.ToString(0); } else { print_information pi = new print_information(); pi.customer_name = txtCustomerName.Text; pi.information = txtCustomerInformation.Text; pi.total_amount = Convert.ToDecimal(txtCustomerTotal.Text) - Convert.ToDecimal(txtDiscount.Text); pi.paid_amount = Convert.ToDecimal(txtCash.Text); pi.due_amount = Convert.ToDecimal(txtDue.Text); //pi.due_amount = Convert.ToDecimal(txtCustomerTotal.Text) - Convert.ToDecimal(txtCash.Text); pi.date = dateTimePicker.Value; db.print_informations.InsertOnSubmit(pi); db.SubmitChanges(); var result = (from t in db.print_informations orderby t.id descending select t.id).First(); labeltemp.Text = comboBox.Text; if (labeltemp.Text == "Chandpur Electric Co.") { lblSI.Text = "A-Z Electric & Electronics Market, 135, Nawabpur Road, Dhaka-1100"; } if (labeltemp.Text == "M. R. TRADERS") { lblSI.Text = "Mohon Electric Market,135, Nawabpur Road, Dhaka-1100"; } using (frmPrint frm = new frmPrint(receiptBindingSource.DataSource as List <Receipt>, string.Format("{0}", total), string.Format("{0}", txtCash.Text), string.Format("{0:0.00}", Convert.ToDouble(txtDue.Text)), DateTime.Now.ToString("dd/MM/yyyy"), this.txtCustomerName.Text, this.txtCustomerInformation.Text, result.ToString(), this.labeltemp.Text, this.lblSI.Text, string.Format("{0}", txtDiscount.Text))) { frm.ShowDialog(); } } }
partial void Updateprint_information(print_information instance);
partial void Deleteprint_information(print_information instance);
partial void Insertprint_information(print_information instance);