private void button6_Click(object sender, EventArgs e) { frmReportCrystal frmCrystal = new frmReportCrystal(); Form2 frmPrint = new Form2(); frmPrint.Show(); frmCrystal.Show(); }
private void btnReprint_Click(object sender, EventArgs e) { frmReportCrystal frmprint = new frmReportCrystal(); SQLCON.da = new MySqlDataAdapter("Select * from v_invoice where invoiceNo ='" + txtInvoiceNo.Text + "'", SQLCON.cnn); //DataTable dt = new DataTable(); SQLCON.dsa.Clear(); SQLCON.da.Fill(SQLCON.dsa, "rptInvoice"); // name of ttx File SQLCON.reportName = "cryInvoice"; // report name frmprint.Show(); }
private void saveInvoice_Print() { try { SQLCON.openConn(); if (txtRecieveDollar.Text != "" && txtRecieveDollar.Text == "") { MessageBox.Show("Can't Sale Products when not Recieve money yet !", "Recieve Money Requied"); return; } //when cash reciev is Dollar if (txtRecieveDollar.Text != "" && txtRecieveReil.Text == "") { SQLCON.cmd = new MySqlCommand("Insert Into tbl_invoice(invoiceNo,saleBy,saleDate,totalDollar,totalRiel,cash_D_R_all,cashRecieveDollar,cashReturnDollar,cashReturnRiel)" + " Values (@invoiceNo,'Sopheak',sysdate(),ROUND(@totalDollar,2),ROUND(@totalRiel,2),@cash_D_R_all,@cashRecieveDollar,@cashReturnDollar,@cashReturnRiel)", SQLCON.cnn); SQLCON.cmd.Parameters.AddWithValue("@invoiceNo", txtInvoiceNo.Text); SQLCON.cmd.Parameters.AddWithValue("@totalDollar", txtGrandTotalDollar.Text); SQLCON.cmd.Parameters.AddWithValue("@totalRiel", txtGrandTotalRiel.Text); SQLCON.cmd.Parameters.AddWithValue("@cash_D_R_all", 0); SQLCON.cmd.Parameters.AddWithValue("@cashRecieveDollar", txtRecieveDollar.Text); SQLCON.cmd.Parameters.AddWithValue("@cashReturnDollar", txtCashReturnDollar.Text); SQLCON.cmd.Parameters.AddWithValue("@cashReturnRiel", txtCashReturnRiel.Text); //SQLCON.cmd.Parameters.AddWithValue("@cash", txt.Text); } else if (txtRecieveReil.Text != "" && txtRecieveDollar.Text == "") { // When cash reciev is Riel SQLCON.cmd = new MySqlCommand("Insert Into tbl_invoice (invoiceNo,saleBy,saleDate,totalDollar,totalRiel,cash_D_R_all,cashRecieveRiel,cashReturnRiel)" + " Values (@invoiceNo,'Sopheak', sysdate(),@totalRiel,@cashRecieveRiel,@cash_D_R_all)", SQLCON.cnn); SQLCON.cmd.Parameters.AddWithValue("@totalDollar", txtGrandTotalDollar.Text); SQLCON.cmd.Parameters.AddWithValue("@totalRiel", txtGrandTotalRiel.Text); SQLCON.cmd.Parameters.AddWithValue("@cashRecieveRiel", txtRecieveReil.Text); SQLCON.cmd.Parameters.AddWithValue("@cash_D_R_all", 1); } //SQLCON.cmd = new MySqlCommand("Insert Into tbl_invoice (invoiceNo,saleBy,saleDate,totalDollar,totalRiel,cash_D_R_all,cashRecieveDollar,cashRecieveRiel,cashReturnDollar,isPay)" + // " Values (@invoiceNo,'Sopheak', sysdate(),@totalDollar,@cashRecieveDollar,@cash_D_R_all)", SQLCON.cnn); //SQLCON.cmd.Parameters.AddWithValue("@invoiceNo", txtInvoiceNo.Text); //SQLCON.cmd.ExecuteNonQuery(); int p = SQLCON.cmd.ExecuteNonQuery(); if (p > 0) { SQLCON.cmd = new MySqlCommand("Select * from v_invoice where invoiceNo=@invoiceNoPrintINvoice", SQLCON.cnn); SQLCON.cmd.Parameters.AddWithValue("@invoiceNoPrintINvoice", txtInvoiceNo.Text); SQLCON.da = new MySqlDataAdapter(SQLCON.cmd); //DataTable dt = new DataTable(); SQLCON.dsa.Clear(); SQLCON.da.Fill(SQLCON.dsa, "rptInvoice"); // rpt is the name of ttx File SQLCON.reportName = "cryInvoice"; // report name frmReportCrystal frmprint = new frmReportCrystal(); frmprint.ShowDialog(); btnNewSale.PerformClick(); foreach (Control t in pProductCash.Controls) { if (t is TextBox) { t.Text = ""; } } } // SQLCON.cnn.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); return; } }