private void btnEmployeeBillSave_Click(object sender, EventArgs e) { try { salesOperation.InsertAllEmployeeSales(employeeSalesToSendInDB); // printDocumentEmployeeBill.Print(); MessageBox.Show("saved"); using (frmprint frm = new frmprint(receiptBindingSource.DataSource as List <Receipt>, string.Format("RS {0}", employeeBillTotal), string.Format("NILL"), string.Format("NILL" + " --" + lblSelectedName.Text + " --"), DateTime.Now.ToString())) { frm.ShowDialog(); } do { foreach (DataGridViewRow row in dataGridViewEmployeeBill.Rows) { try { dataGridViewEmployeeBill.Rows.Remove(row); } catch (Exception) { } } } while (dataGridViewEmployeeBill.Rows.Count > 0); employeeBillTotal = 0; txtTotalEmployeeBill.Text = "0 RS"; } catch (Exception) { throw; } }
private void btnPrint_Click(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(txtCash.Text)) { salesOperation.InsertAllCustomerSales(customerSalesToSendInDB); using (frmprint frm = new frmprint(receiptBindingSource.DataSource as List <Receipt>, string.Format("RS {0}", total), string.Format("RS {0}", txtCash.Text), string.Format("RS {0}", Convert.ToInt32(txtCash.Text) - total), DateTime.Now.ToString())) { frm.ShowDialog(); } do { foreach (DataGridViewRow row in dataGridView.Rows) { try { dataGridView.Rows.Remove(row); } catch (Exception) { } } } while (dataGridView.Rows.Count > 0); total = 0; txtTotal.Text = "0 RS"; } else { MessageBox.Show("enter cash"); } }