private void btnprint_Click(object sender, EventArgs e) { try { DialogResult dr1 = MessageBox.Show("Do you want to Print FinishedGoods?", "FinishedGoods", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr1 == DialogResult.Yes) { prn.execute("delete from printing"); string status; status = "FINISHED GOODS"; for (int i = 0; i < lvprolist.Items.Count; i++) { DataTable dt1 = conn.getdataset("select * from company WHERE isactive=1 and CompanyID='" + Master.companyId + "' "); string qry = "INSERT INTO Printing(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18)VALUES"; qry += "('" + dt1.Rows[0]["CompanyName"].ToString() + "','" + dt1.Rows[0]["SubName"].ToString() + "','" + dt1.Rows[0]["Address"].ToString() + "','" + dt1.Rows[0]["Address2"].ToString() + "','" + dt1.Rows[0]["City"].ToString() + "','" + dt1.Rows[0]["State"].ToString() + "','" + dt1.Rows[0]["Country"].ToString() + "','" + dt1.Rows[0]["Phone"].ToString() + "','" + dt1.Rows[0]["Mobile"].ToString() + "','" + dt1.Rows[0]["Email"].ToString() + "','" + dt1.Rows[0]["CSTNo"].ToString() + "','" + status + "','" + lvprolist.Items[i].SubItems[0].Text + "','" + lvprolist.Items[i].SubItems[1].Text + "','" + lvprolist.Items[i].SubItems[2].Text + "','" + lvprolist.Items[i].SubItems[3].Text + "','" + lvprolist.Items[i].SubItems[4].Text + "','" + dt1.Rows[0]["WebSite"].ToString() + "')"; prn.execute(qry); } string reportName = "FinishedGoodsList"; Print popup = new Print(reportName); popup.ShowDialog(); popup.Dispose(); } } catch { } }
private void btnprint_Click(object sender, EventArgs e) { try { DialogResult dr1 = MessageBox.Show("Do you want to Print Production?", "Production", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr1 == DialogResult.Yes) { prn.execute("delete from printing"); string status; status = "PRODUCTION REGISTER FROM " + DTPFrom.Text + " TO " + DTPTo.Text; for (int i = 0; i < lvproduction.Items.Count; i++) { DataTable dt1 = conn.getdataset("select * from company WHERE isactive=1 and CompanyID='" + Master.companyId + "' "); // dt = conn.getdataset("select processdescription from tblproductionmaster where isactive=1 and processid='" + lvproduction.Items[i].SubItems[12].Text + "' order by date asc"); // processdescription = dt.Rows[0]["processdescription"].ToString(); string qry = "INSERT INTO Printing(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22,T23,T24,T25,T26)VALUES"; qry += "('" + dt1.Rows[0]["CompanyName"].ToString() + "','" + dt1.Rows[0]["SubName"].ToString() + "','" + dt1.Rows[0]["Address"].ToString() + "','" + dt1.Rows[0]["Address2"].ToString() + "','" + dt1.Rows[0]["City"].ToString() + "','" + dt1.Rows[0]["State"].ToString() + "','" + dt1.Rows[0]["Country"].ToString() + "','" + dt1.Rows[0]["Phone"].ToString() + "','" + dt1.Rows[0]["Mobile"].ToString() + "','" + dt1.Rows[0]["Email"].ToString() + "','" + dt1.Rows[0]["CSTNo"].ToString() + "','" + status + "','" + lvproduction.Items[i].SubItems[0].Text + "','" + lvproduction.Items[i].SubItems[1].Text + "','" + lvproduction.Items[i].SubItems[2].Text + "','" + lvproduction.Items[i].SubItems[3].Text + "','" + lvproduction.Items[i].SubItems[4].Text + "','" + lvproduction.Items[i].SubItems[5].Text + "','" + lvproduction.Items[i].SubItems[6].Text + "','" + lvproduction.Items[i].SubItems[7].Text + "','" + lvproduction.Items[i].SubItems[8].Text + "','" + lvproduction.Items[i].SubItems[9].Text + "','" + lvproduction.Items[i].SubItems[10].Text + "','" + lvproduction.Items[i].SubItems[11].Text + "','" + lvproduction.Items[i].SubItems[12].Text + "','" + dt1.Rows[0]["WebSite"].ToString() + "')"; prn.execute(qry); } string reportName = "ProductionRegister"; Print popup = new Print(reportName); popup.ShowDialog(); popup.Dispose(); } } catch { } }
private void btnprint_Click(object sender, EventArgs e) { try { prn.execute("delete from printing"); string status; status = "BANK ENTERY REGISTER FROM " + DTPFrom.Text + " TO " + DTPTo.Text; string[] a = new string[LVDayBook.CheckedItems.Count]; string[] b = new string[LVDayBook.CheckedItems.Count]; string[] c = new string[LVDayBook.CheckedItems.Count]; string[] d = new string[LVDayBook.CheckedItems.Count]; for (int i = 0; i < LVDayBook.Items.Count; i++) { if (Convert.ToBoolean(LVDayBook.Items[i].Checked) == true) { amount = +amount + Convert.ToDouble(LVDayBook.Items[i].SubItems[8].Text); exp1 = +exp1 + Convert.ToDouble(LVDayBook.Items[i].SubItems[9].Text); net = +net + Convert.ToDouble(LVDayBook.Items[i].SubItems[10].Text); DataTable dt1 = conn.getdataset("select * from company WHERE isactive=1 and CompanyID='" + Master.companyId + "' "); string qry = "INSERT INTO Printing(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22)VALUES"; qry += "('" + dt1.Rows[0]["CompanyName"].ToString() + "','" + dt1.Rows[0]["SubName"].ToString() + "','" + dt1.Rows[0]["Address"].ToString() + "','" + dt1.Rows[0]["Address2"].ToString() + "','" + dt1.Rows[0]["City"].ToString() + "','" + dt1.Rows[0]["State"].ToString() + "','" + dt1.Rows[0]["Country"].ToString() + "','" + dt1.Rows[0]["Phone"].ToString() + "','" + dt1.Rows[0]["Mobile"].ToString() + "','" + dt1.Rows[0]["Email"].ToString() + "','" + dt1.Rows[0]["CSTNo"].ToString() + "','" + status + "','" + LVDayBook.Items[i].SubItems[1].Text + "','" + LVDayBook.Items[i].SubItems[2].Text + "','" + LVDayBook.Items[i].SubItems[3].Text + "','" + LVDayBook.Items[i].SubItems[4].Text + "','" + LVDayBook.Items[i].SubItems[5].Text + "','" + LVDayBook.Items[i].SubItems[6].Text + "','" + LVDayBook.Items[i].SubItems[7].Text + "','" + LVDayBook.Items[i].SubItems[8].Text + "','" + LVDayBook.Items[i].SubItems[9].Text + "','" + LVDayBook.Items[i].SubItems[10].Text + "')"; prn.execute(qry); } } string update = "UPDATE [Printing] SET [T23]='" + amount.ToString("N2") + "',[T24]='" + exp1.ToString("N2") + "',[T25]='" + net.ToString("N2") + "'"; prn.execute(update); Print popup = new Print("BankEnteryReport"); popup.ShowDialog(); popup.Dispose(); } catch { } }
public void print() { try { prn.execute("delete from printing"); DataTable dt1 = conn.getdataset("select * from company WHERE isactive=1 and CompanyID='" + Master.companyId + "' "); for (int i = 0; i < LVledger.Items.Count; i++) { if (Convert.ToBoolean(LVledger.Items[i].Checked) == true) { // string str = LVledger.Items[LVledger.FocusedItem.Index].SubItems[6].Text; Double sa = Convert.ToDouble(LVledger.Items[i].SubItems[6].Text); int s = Convert.ToInt32(sa); for (int j = 0; j < s; j++) { string qry = "INSERT INTO Printing(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15)VALUES"; qry += "('" + LVledger.Items[i].SubItems[1].Text + "','" + LVledger.Items[i].SubItems[2].Text + "','" + LVledger.Items[i].SubItems[3].Text + "','" + LVledger.Items[i].SubItems[4].Text + "','" + LVledger.Items[i].SubItems[5].Text + "','" + LVledger.Items[i].SubItems[6].Text + "','" + LVledger.Items[i].SubItems[7].Text + "','" + LVledger.Items[i].SubItems[8].Text + "','" + LVledger.Items[i].SubItems[9].Text + "','*" + LVledger.Items[i].SubItems[10].Text + "*','" + LVledger.Items[i].SubItems[11].Text + "','" + LVledger.Items[i].SubItems[12].Text + "','" + dt1.Rows[0][1].ToString() + "','" + dt1.Rows[0][2].ToString() + "','" + LVledger.Items[i].SubItems[10].Text + "')"; prn.execute(qry); } } } } catch { } }
private void btnprint_Click(object sender, EventArgs e) { Printing prn = new Printing(); Connection conn = new Connection(); try { DataTable dt1 = conn.getdataset("select * from company WHERE isactive=1 and CompanyID='" + Master.companyId + "' "); prn.execute("delete from printing"); int j = 1; int ClientCount = 0; for (int i = 0; i < LVclient.Items.Count; i++) { if (Convert.ToBoolean(LVclient.Items[i].Checked) == true) { string AccountName = "", PrintName = "", Group = "", Opbal = "", DrCr = "", Address = "", City = "", State = "", Phone = "", Mobile = "", Email = "", GstNo = "", AadharNo = ""; AccountName = LVclient.Items[i].SubItems[2].Text; PrintName = LVclient.Items[i].SubItems[3].Text; Group = LVclient.Items[i].SubItems[4].Text; Opbal = LVclient.Items[i].SubItems[5].Text; DrCr = LVclient.Items[i].SubItems[6].Text; Address = LVclient.Items[i].SubItems[7].Text; City = LVclient.Items[i].SubItems[8].Text; State = LVclient.Items[i].SubItems[9].Text; Phone = LVclient.Items[i].SubItems[10].Text; Mobile = LVclient.Items[i].SubItems[11].Text; Email = LVclient.Items[i].SubItems[12].Text; GstNo = LVclient.Items[i].SubItems[13].Text; AadharNo = LVclient.Items[i].SubItems[14].Text; string qry = "INSERT INTO Printing(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22,T23,T24,T25,T26,T27,T28)VALUES"; qry += "('" + j++ + "','" + dt1.Rows[0][0].ToString() + "','" + dt1.Rows[0][1].ToString() + "','" + dt1.Rows[0][2].ToString() + "','" + dt1.Rows[0][3].ToString() + "','" + dt1.Rows[0][4].ToString() + "','" + dt1.Rows[0][5].ToString() + "','" + dt1.Rows[0][6].ToString() + "','" + dt1.Rows[0][7].ToString() + "','" + dt1.Rows[0][8].ToString() + "','" + dt1.Rows[0][9].ToString() + "','" + dt1.Rows[0][10].ToString() + "','" + dt1.Rows[0][11].ToString() + "','" + dt1.Rows[0][12].ToString() + "','" + dt1.Rows[0][13].ToString() + "','" + AccountName + "','" + PrintName + "','" + Group + "','" + Opbal + "','" + DrCr + "','" + Address + "','" + City + "','" + State + "','" + Phone + "','" + Mobile + "','" + Email + "','" + GstNo + "','" + AadharNo + "')"; prn.execute(qry); ClientCount++; } if (ClientCount == 0) { MessageBox.Show("Please Check Atlist One Account Name For Printing."); return; } } Print popup = new Print("AccountReport"); popup.ShowDialog(); popup.Dispose(); } catch (Exception excp) { } }
private void btnprint_Click(object sender, EventArgs e) { Printing prndata = new Printing(); if (grdstock.Rows.Count > 0) { DialogResult dr1 = MessageBox.Show("Do you want to Print Stock Report?", "Stock Report", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr1 == DialogResult.Yes) { DataTable dt = new DataTable(); DataTable dt1 = cs.getdataset("select * from company WHERE isactive=1"); dt = (DataTable)grdstock.DataSource; prndata.execute("delete from printing"); int j = 1; for (int i = 0; i < dt.Rows.Count; i++) { string Opstock = "", ClosingStock = "", Purchase = "", Sale = "", PurchaseReturn = "", SaleReturn = "", total = "", possale = "", production = ""; string ItemName = "", company = "", Itemcode = ""; Itemcode = dt.Rows[i][0].ToString(); ItemName = dt.Rows[i][1].ToString(); company = dt.Rows[i][2].ToString(); Opstock = dt.Rows[i][3].ToString(); Purchase = dt.Rows[i][4].ToString(); Sale = dt.Rows[i][5].ToString(); possale = dt.Rows[i][6].ToString(); SaleReturn = dt.Rows[i][7].ToString(); PurchaseReturn = dt.Rows[i][8].ToString(); production = dt.Rows[i][9].ToString(); ClosingStock = dt.Rows[i][10].ToString(); total = dt.Rows[i][11].ToString(); string qry = "INSERT INTO Printing(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22,T23,T24,T25,T26,T27,T28,T29,T30,T31,T32,T33,T34,T35,T36)VALUES"; qry += "('" + j++ + "','" + dt1.Rows[0][0].ToString() + "','" + dt1.Rows[0][1].ToString() + "','" + dt1.Rows[0][2].ToString() + "','" + dt1.Rows[0][3].ToString() + "','" + dt1.Rows[0][4].ToString() + "','" + dt1.Rows[0][5].ToString() + "','" + dt1.Rows[0][6].ToString() + "','" + dt1.Rows[0][7].ToString() + "','" + dt1.Rows[0][8].ToString() + "','" + dt1.Rows[0][9].ToString() + "','" + dt1.Rows[0][10].ToString() + "','" + dt1.Rows[0][11].ToString() + "','" + dt1.Rows[0][12].ToString() + "','" + dt1.Rows[0][13].ToString() + "','" + ItemName + "','" + company + "','" + Opstock + "','" + Purchase + "','" + Sale + "','" + SaleReturn + "','" + PurchaseReturn + "','" + ClosingStock + "','" + total + "','" + txt1.Text + "','" + txt2.Text + "','" + txt3.Text + "','" + txt4.Text + "','" + txt5.Text + "','" + txt6.Text + "','" + txt7.Text + "','" + txt8.Text + "','" + possale + "','" + production + "','" + txt9.Text + "','" + Itemcode + "')"; prndata.execute(qry); } string reportName = "StockEvaluation"; // string reportName = "Sale"; Print popup = new Print(reportName); popup.ShowDialog(); popup.Dispose(); } } else { MessageBox.Show("No Records For Print.."); } }
private void btngenrpt_Click(object sender, EventArgs e) { { try { DialogResult dr = MessageBox.Show("Do you want to Generate Report?", "Bill", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { cmd3 = new SqlCommand("select * from company WHERE isactive=1", con); sda3 = new SqlDataAdapter(cmd3); DataTable dt1 = new DataTable(); sda3.Fill(dt1); cmd = new SqlCommand("select BillId, BillDate,Terms,count, totalqty, totalbasic, totaltax, totalnet,billno from billposmaster where isactive=1 and BillDate>='" + Convert.ToDateTime(DTPFrom.Text).ToString("MM-dd-yyyy") + "' and BillDate<='" + Convert.ToDateTime(DTPTo.Text).ToString("MM-dd-yyyy") + "' order by BillId", con); sda = new SqlDataAdapter(cmd); DataTable dt2 = new DataTable(); sda.Fill(dt2); con.Open(); prn.execute("delete from printing"); for (int i = 0; i < dt2.Rows.Count; i++) { string qry = "INSERT INTO Printing([T1],[T2],[T3],[T4],[T5],[T6],[T7],[T8],[T9],[T10],[T11],[T12],[T13],[T14],[T15],[T16],[T17],[T18],[T19],[T20],[T21],[T22],[T23],[T24],[T25],[T26],[T27],[T28])VALUES"; qry += "('" + dt2.Rows[i][0].ToString() + "','" + dt2.Rows[i][1].ToString() + "','" + dt2.Rows[i][2].ToString() + "','" + dt2.Rows[i][3].ToString() + "','" + dt2.Rows[i][4].ToString() + "','" + dt2.Rows[i][5].ToString() + "','" + dt2.Rows[i][6].ToString() + "','" + dt2.Rows[i][7].ToString() + "','" + dt1.Rows[0][0].ToString() + "','" + dt1.Rows[0][1].ToString() + "','" + dt1.Rows[0][2].ToString() + "','" + dt1.Rows[0][3].ToString() + "','" + dt1.Rows[0][4].ToString() + "','" + dt1.Rows[0][5].ToString() + "','" + dt1.Rows[0][6].ToString() + "','" + dt1.Rows[0][7].ToString() + "','" + dt1.Rows[0][8].ToString() + "','" + dt1.Rows[0][9].ToString() + "','" + dt1.Rows[0][10].ToString() + "','" + dt1.Rows[0][11].ToString() + "','" + dt1.Rows[0][12].ToString() + "','" + dt1.Rows[0][13].ToString() + "','" + txtbillamt.Text + "','" + txtvat.Text + "','" + txtnetamt.Text + "','" + DTPFrom.Text + "','" + DTPTo.Text + "','" + dt2.Rows[i][8].ToString() + "')"; prn.execute(qry); } string reportName = "Pos List"; Print popup = new Print(reportName); popup.ShowDialog(); popup.Dispose(); } else { MessageBox.Show("Please select another date if you want to generate another Report."); } } catch (Exception ex) { MessageBox.Show("Error:" + ex.Message); } finally { con.Close(); } } }
private void btnprint_Click(object sender, EventArgs e) { try { DialogResult dr1 = MessageBox.Show("Do you want to Print Production Planning?", "Production", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr1 == DialogResult.Yes) { prn.execute("delete from printing"); string status, status1, status2; status = "PRODUCTION PLANNING REPORT"; status1 = "ITEMS TO PRODUCE"; status2 = "REQUIREMENT ANALYSIS"; string itemname = "", process = "", qtytopro = "", unit = "", itemsreq = "", qtyreq = "", qtyavai = "", defi = "", unit1 = ""; for (int i = 0; i < lvmainitem.Items.Count; i++) { itemname += Environment.NewLine + lvmainitem.Items[i].SubItems[0].Text; process += Environment.NewLine + lvmainitem.Items[i].SubItems[1].Text; qtytopro += Environment.NewLine + lvmainitem.Items[i].SubItems[2].Text; unit += Environment.NewLine + lvmainitem.Items[i].SubItems[3].Text; } for (int i = 0; i < lvaltitem.Items.Count; i++) { itemsreq += Environment.NewLine + lvaltitem.Items[i].SubItems[0].Text; qtyreq += Environment.NewLine + lvaltitem.Items[i].SubItems[1].Text; qtyavai += Environment.NewLine + lvaltitem.Items[i].SubItems[2].Text; defi += Environment.NewLine + lvaltitem.Items[i].SubItems[3].Text; unit1 += Environment.NewLine + lvaltitem.Items[i].SubItems[4].Text; } DataTable dt1 = conn.getdataset("select * from company WHERE isactive=1 and CompanyID='" + Master.companyId + "' "); string qry = "INSERT INTO Printing(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22,T23,T24,T25)VALUES"; qry += "('" + dt1.Rows[0]["CompanyName"].ToString() + "','" + dt1.Rows[0]["SubName"].ToString() + "','" + dt1.Rows[0]["Address"].ToString() + "','" + dt1.Rows[0]["Address2"].ToString() + "','" + dt1.Rows[0]["City"].ToString() + "','" + dt1.Rows[0]["State"].ToString() + "','" + dt1.Rows[0]["Country"].ToString() + "','" + dt1.Rows[0]["Phone"].ToString() + "','" + dt1.Rows[0]["Mobile"].ToString() + "','" + dt1.Rows[0]["Email"].ToString() + "','" + dt1.Rows[0]["CSTNo"].ToString() + "','" + dt1.Rows[0]["Website"].ToString() + "','" + status + "','" + status1 + "','" + status2 + "','" + itemname + "','" + process + "','" + qtytopro + "','" + unit + "','" + itemsreq + "','" + qtyreq + "','" + qtyavai + "','" + defi + "','" + unit1 + "','" + dt1.Rows[0]["WebSite"].ToString() + "')"; prn.execute(qry); string reportName = "ProductionPlanning"; Print popup = new Print(reportName); popup.ShowDialog(); popup.Dispose(); } } catch { } }
private void btnprint_Click(object sender, EventArgs e) { DialogResult dr1 = MessageBox.Show("Do you want to Print ?", "Print", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr1 == DialogResult.Yes) { prn.execute("delete from printing"); string status; int j = 1; status = "Call Management From" + DTPFrom.Text; for (int i = 0; i < LVcall.Items.Count; i++) { if (cmbstatus.Text == "Complain Received") { DataTable dt1 = conn.getdataset("select * from company WHERE isactive=1 and CompanyID='" + Master.companyId + "' "); string qry = "INSERT INTO Printing(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22,T23,T24)VALUES"; qry += "('" + dt1.Rows[0]["CompanyName"].ToString() + "','" + dt1.Rows[0]["SubName"].ToString() + "','" + dt1.Rows[0]["Address"].ToString() + "','" + dt1.Rows[0]["Address2"].ToString() + "','" + dt1.Rows[0]["City"].ToString() + "','" + dt1.Rows[0]["State"].ToString() + "','" + dt1.Rows[0]["Country"].ToString() + "','" + dt1.Rows[0]["Phone"].ToString() + "','" + dt1.Rows[0]["Mobile"].ToString() + "','" + dt1.Rows[0]["Email"].ToString() + "','" + dt1.Rows[0]["CSTNo"].ToString() + "','" + status + "','" + LVcall.Items[i].SubItems[0].Text + "','" + LVcall.Items[i].SubItems[1].Text + "','" + LVcall.Items[i].SubItems[2].Text + "','" + LVcall.Items[i].SubItems[3].Text + "','" + LVcall.Items[i].SubItems[4].Text + "','" + LVcall.Items[i].SubItems[5].Text + "','" + LVcall.Items[i].SubItems[6].Text + "','" + DTPFrom.Text + "','" + DTPTo.Text + "','" + cmbstatus.Text + "','" + dt1.Rows[0]["Website"].ToString() + "','" + j++ + "')"; prn.execute(qry); } else if (cmbstatus.Text == "Send To Company") { DataTable dt1 = conn.getdataset("select * from company WHERE isactive=1 and CompanyID='" + Master.companyId + "' "); string qry = "INSERT INTO Printing(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22,T23,T24,T25)VALUES"; qry += "('" + dt1.Rows[0]["CompanyName"].ToString() + "','" + dt1.Rows[0]["SubName"].ToString() + "','" + dt1.Rows[0]["Address"].ToString() + "','" + dt1.Rows[0]["Address2"].ToString() + "','" + dt1.Rows[0]["City"].ToString() + "','" + dt1.Rows[0]["State"].ToString() + "','" + dt1.Rows[0]["Country"].ToString() + "','" + dt1.Rows[0]["Phone"].ToString() + "','" + dt1.Rows[0]["Mobile"].ToString() + "','" + dt1.Rows[0]["Email"].ToString() + "','" + dt1.Rows[0]["CSTNo"].ToString() + "','" + status + "','" + LVcall.Items[i].SubItems[0].Text + "','" + LVcall.Items[i].SubItems[1].Text + "','" + LVcall.Items[i].SubItems[2].Text + "','" + LVcall.Items[i].SubItems[3].Text + "','" + LVcall.Items[i].SubItems[4].Text + "','" + LVcall.Items[i].SubItems[5].Text + "','" + LVcall.Items[i].SubItems[6].Text + "','" + LVcall.Items[i].SubItems[7].Text + "','" + DTPFrom.Text + "','" + DTPTo.Text + "','" + cmbstatus.Text + "','" + dt1.Rows[0]["Website"].ToString() + "','" + j++ + "')"; prn.execute(qry); } else if (cmbstatus.Text == "Product Received From Company") { DataTable dt1 = conn.getdataset("select * from company WHERE isactive=1 and CompanyID='" + Master.companyId + "' "); string qry = "INSERT INTO Printing(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22,T23,T24,T25)VALUES"; qry += "('" + dt1.Rows[0]["CompanyName"].ToString() + "','" + dt1.Rows[0]["SubName"].ToString() + "','" + dt1.Rows[0]["Address"].ToString() + "','" + dt1.Rows[0]["Address2"].ToString() + "','" + dt1.Rows[0]["City"].ToString() + "','" + dt1.Rows[0]["State"].ToString() + "','" + dt1.Rows[0]["Country"].ToString() + "','" + dt1.Rows[0]["Phone"].ToString() + "','" + dt1.Rows[0]["Mobile"].ToString() + "','" + dt1.Rows[0]["Email"].ToString() + "','" + dt1.Rows[0]["CSTNo"].ToString() + "','" + status + "','" + LVcall.Items[i].SubItems[0].Text + "','" + LVcall.Items[i].SubItems[1].Text + "','" + LVcall.Items[i].SubItems[2].Text + "','" + LVcall.Items[i].SubItems[3].Text + "','" + LVcall.Items[i].SubItems[4].Text + "','" + LVcall.Items[i].SubItems[5].Text + "','" + LVcall.Items[i].SubItems[6].Text + "','" + LVcall.Items[i].SubItems[7].Text + "','" + DTPFrom.Text + "','" + DTPTo.Text + "','" + cmbstatus.Text + "','" + dt1.Rows[0]["Website"].ToString() + "','" + j++ + "')"; prn.execute(qry); } else { DataTable dt1 = conn.getdataset("select * from company WHERE isactive=1 and CompanyID='" + Master.companyId + "' "); string qry = "INSERT INTO Printing(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22,T23,T24,T25)VALUES"; qry += "('" + dt1.Rows[0]["CompanyName"].ToString() + "','" + dt1.Rows[0]["SubName"].ToString() + "','" + dt1.Rows[0]["Address"].ToString() + "','" + dt1.Rows[0]["Address2"].ToString() + "','" + dt1.Rows[0]["City"].ToString() + "','" + dt1.Rows[0]["State"].ToString() + "','" + dt1.Rows[0]["Country"].ToString() + "','" + dt1.Rows[0]["Phone"].ToString() + "','" + dt1.Rows[0]["Mobile"].ToString() + "','" + dt1.Rows[0]["Email"].ToString() + "','" + dt1.Rows[0]["CSTNo"].ToString() + "','" + status + "','" + LVcall.Items[i].SubItems[0].Text + "','" + LVcall.Items[i].SubItems[1].Text + "','" + LVcall.Items[i].SubItems[2].Text + "','" + LVcall.Items[i].SubItems[3].Text + "','" + LVcall.Items[i].SubItems[4].Text + "','" + LVcall.Items[i].SubItems[5].Text + "','" + LVcall.Items[i].SubItems[6].Text + "','" + LVcall.Items[i].SubItems[7].Text + "','" + DTPFrom.Text + "','" + DTPTo.Text + "','" + cmbstatus.Text + "','" + dt1.Rows[0]["Website"].ToString() + "','" + j++ + "')"; prn.execute(qry); } } } }
private void btnlabel_Click(object sender, EventArgs e) { Printing prn = new Printing(); Connection conn = new Connection(); try { DataTable dt1 = conn.getdataset("select * from company WHERE isactive=1 and CompanyID='" + Master.companyId + "' "); prn.execute("delete from printing"); int j = 1; if (LVclient.SelectedItems.Count > 0) { string AccountName = "", PrintName = "", Group = "", Opbal = "", DrCr = "", Address = "", City = "", State = "", Phone = "", Mobile = "", Email = "", GstNo = "", AadharNo = ""; AccountName = LVclient.SelectedItems[0].SubItems[2].Text; PrintName = LVclient.SelectedItems[0].SubItems[3].Text; Group = LVclient.SelectedItems[0].SubItems[4].Text; Opbal = LVclient.SelectedItems[0].SubItems[5].Text; DrCr = LVclient.SelectedItems[0].SubItems[6].Text; Address = LVclient.SelectedItems[0].SubItems[7].Text; City = LVclient.SelectedItems[0].SubItems[8].Text; State = LVclient.SelectedItems[0].SubItems[9].Text; Phone = LVclient.SelectedItems[0].SubItems[10].Text; Mobile = LVclient.SelectedItems[0].SubItems[11].Text; Email = LVclient.SelectedItems[0].SubItems[12].Text; GstNo = LVclient.SelectedItems[0].SubItems[13].Text; AadharNo = LVclient.SelectedItems[0].SubItems[14].Text; string qry = "INSERT INTO Printing(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22,T23,T24,T25,T26,T27,T28)VALUES"; qry += "('" + j++ + "','" + dt1.Rows[0][0].ToString() + "','" + dt1.Rows[0][1].ToString() + "','" + dt1.Rows[0][2].ToString() + "','" + dt1.Rows[0][3].ToString() + "','" + dt1.Rows[0][4].ToString() + "','" + dt1.Rows[0][5].ToString() + "','" + dt1.Rows[0][6].ToString() + "','" + dt1.Rows[0][7].ToString() + "','" + dt1.Rows[0][8].ToString() + "','" + dt1.Rows[0][9].ToString() + "','" + dt1.Rows[0][10].ToString() + "','" + dt1.Rows[0][11].ToString() + "','" + dt1.Rows[0][12].ToString() + "','" + dt1.Rows[0][13].ToString() + "','" + AccountName + "','" + PrintName + "','" + Group + "','" + Opbal + "','" + DrCr + "','" + Address + "','" + City + "','" + State + "','" + Phone + "','" + Mobile + "','" + Email + "','" + GstNo + "','" + AadharNo + "')"; prn.execute(qry); Print popup = new Print("AccountLabel"); popup.ShowDialog(); popup.Dispose(); } else { MessageBox.Show("Select Account First"); } } catch (Exception excp) { } }
private void btnCalculator_Click(object sender, EventArgs e) { try { Printing prndata = new Printing(); if (LVcs.Items.Count > 0) { prndata.execute("delete from printing"); DataTable dt1 = conn.getdataset("select * from company WHERE isactive=1"); int j = 1; for (int i = 0; i < LVcs.Items.Count; i++) { string Customername = "", opstock = "", Address = "", City = "", State = "", StateCode = "", PhNo = "", MobileNo = "", Email = "", Gstno = "", FromDateToDate = ""; Customername = LVcs.Items[i].SubItems[0].Text; opstock = LVcs.Items[i].SubItems[1].Text; Address = LVcs.Items[i].SubItems[2].Text; City = LVcs.Items[i].SubItems[3].Text; State = LVcs.Items[i].SubItems[4].Text; StateCode = LVcs.Items[i].SubItems[5].Text; PhNo = LVcs.Items[i].SubItems[6].Text; MobileNo = LVcs.Items[i].SubItems[7].Text; Email = LVcs.Items[i].SubItems[8].Text; Gstno = LVcs.Items[i].SubItems[9].Text; FromDateToDate = cmbcors.Text + " List "; string qry = "INSERT INTO Printing(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22,T23)VALUES"; qry += "('" + j++ + "','" + dt1.Rows[0]["SubName"].ToString() + "','" + dt1.Rows[0]["Address"].ToString() + "','" + dt1.Rows[0]["Address2"].ToString() + "','" + dt1.Rows[0]["City"].ToString() + "','" + dt1.Rows[0]["State"].ToString() + "','" + dt1.Rows[0]["Country"].ToString() + "','" + dt1.Rows[0]["Phone"].ToString() + "','" + dt1.Rows[0]["Mobile"].ToString() + "','" + dt1.Rows[0]["Email"].ToString() + "','" + dt1.Rows[0]["Website"].ToString() + "','" + FromDateToDate + "','" + dt1.Rows[0]["CSTNO"].ToString() + "','" + Customername + "','" + opstock + "','" + Address + "','" + City + "','" + State + "','" + StateCode + "','" + PhNo + "','" + MobileNo + "','" + Email + "','" + Gstno + "')"; prndata.execute(qry); } Print popup = new Print("CustomerSupplier"); popup.ShowDialog(); popup.Dispose(); } else { MessageBox.Show("No Records For Printing.."); } } catch (Exception excp) { } }
private void btngenrpt_Click(object sender, EventArgs e) { DialogResult dr1 = MessageBox.Show("Do you want to Print ItemWiseStock?", "ItemWiseStock", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr1 == DialogResult.Yes) { if (LVledger.Items.Count > 0) { prn.execute("delete from printing"); DataTable dt1 = conn.getdataset("select * from company WHERE isactive=1"); string client = conn.ExecuteScalar("select customertype from clientmaster where isactive=1 and clientID='" + cmbagentname.SelectedValue + "'"); for (int i = 0; i < LVledger.Items.Count; i++) { string Qty = "", ItemName = "", ItemFormat = "", serialno = ""; ItemName = LVledger.Items[i].SubItems[0].Text; Qty = LVledger.Items[i].SubItems[1].Text; string agenttype = ""; for (int j = 0; j < lvagenttype.Items.Count; j++) { if (Convert.ToBoolean(lvagenttype.Items[j].Checked) == true) { agenttype += lvagenttype.Items[j].SubItems[2].Text + ","; } } ItemFormat = "ITEM WISE SALE FROM " + DTPFrom.Text + " TO " + DTPTo.Text; serialno = Convert.ToInt32(i + 1).ToString(); string qry = "INSERT INTO Printing(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17)VALUES"; qry += "('" + ItemName + "','" + Qty + "','" + dt1.Rows[0][1].ToString() + "','" + dt1.Rows[0][3].ToString() + "','" + dt1.Rows[0][4].ToString() + "','" + dt1.Rows[0][5].ToString() + "','" + dt1.Rows[0][6].ToString() + "','" + dt1.Rows[0][7].ToString() + "','" + dt1.Rows[0][8].ToString() + "','" + dt1.Rows[0][9].ToString() + "','" + dt1.Rows[0][10].ToString() + "','" + ItemFormat + "','" + txttotalqty.Text + "','" + serialno + "','" + cmbagentname.Text + "','" + client + "','" + agenttype + "')"; prn.execute(qry); } string reportName = "ItemWiseSale"; Print popup = new Print(reportName); popup.ShowDialog(); popup.Dispose(); } else { MessageBox.Show("No Records For Print ItemWiseStock", "ItemWiseStock", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
private void btnCalculator_Click(object sender, EventArgs e) { try { Printing prndata = new Printing(); if (lvqp.Items.Count > 0) { prndata.execute("delete from printing"); DataTable dt1 = conn.getdataset("select * from company WHERE isactive=1"); int j = 1; for (int i = 0; i < lvqp.Items.Count; i++) { string date = "", Reciptno = "", PaymentMode = "", AccountName = "", Remarks = "", TotalAmount = "", FromDateToDate = ""; date = lvqp.Items[i].SubItems[0].Text; Reciptno = lvqp.Items[i].SubItems[1].Text; PaymentMode = lvqp.Items[i].SubItems[2].Text; AccountName = lvqp.Items[i].SubItems[3].Text; Remarks = lvqp.Items[i].SubItems[4].Text; TotalAmount = lvqp.Items[i].SubItems[5].Text; // batch = lvqp.Items[i].SubItems[6].Text; // Qty = lvqp.Items[i].SubItems[7].Text; // AltQty = lvqp.Items[i].SubItems[8].Text; FromDateToDate = "QUICK PAYMENT REGISTER FROM " + DTPFrom.Text + " TO " + DTPTo.Text; string qry = "INSERT INTO Printing(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18)VALUES"; qry += "('" + dt1.Rows[0]["SubName"].ToString() + "','" + dt1.Rows[0]["Address"].ToString() + "','" + dt1.Rows[0]["Address2"].ToString() + "','" + dt1.Rows[0]["City"].ToString() + "','" + dt1.Rows[0]["State"].ToString() + "','" + dt1.Rows[0]["Country"].ToString() + "','" + dt1.Rows[0]["Phone"].ToString() + "','" + dt1.Rows[0]["Mobile"].ToString() + "','" + dt1.Rows[0]["Email"].ToString() + "','" + dt1.Rows[0]["Website"].ToString() + "','" + FromDateToDate + "','" + dt1.Rows[0]["CSTNO"].ToString() + "','" + date + "','" + Reciptno + "','" + PaymentMode + "','" + AccountName + "','" + Remarks + "','" + TotalAmount + "')"; prndata.execute(qry); } Print popup = new Print("QuickPaymentRegister"); popup.ShowDialog(); popup.Dispose(); } else { MessageBox.Show("No Records For Printing.."); } } catch (Exception excp) { } }
private void btngenrpt_Click(object sender, EventArgs e) { try { prn.execute("delete from printing"); string status; status = "Commission Report Of " + cmbagentname.Text + " From " + DTPFrom.Text + " To " + DTPTo.Text; for (int i = 0; i < LVagent.Items.Count; i++) { DataTable dt1 = conn.getdataset("select * from company WHERE isactive=1 and CompanyID='" + Master.companyId + "' "); string qry = "INSERT INTO Printing(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21)VALUES"; qry += "('" + dt1.Rows[0]["CompanyName"].ToString() + "','" + dt1.Rows[0]["SubName"].ToString() + "','" + dt1.Rows[0]["Address"].ToString() + "','" + dt1.Rows[0]["Address2"].ToString() + "','" + dt1.Rows[0]["City"].ToString() + "','" + dt1.Rows[0]["State"].ToString() + "','" + dt1.Rows[0]["Country"].ToString() + "','" + dt1.Rows[0]["Phone"].ToString() + "','" + dt1.Rows[0]["Mobile"].ToString() + "','" + dt1.Rows[0]["Email"].ToString() + "','" + dt1.Rows[0]["CSTNo"].ToString() + "','" + status + "','" + LVagent.Items[i].SubItems[0].Text + "','" + LVagent.Items[i].SubItems[1].Text + "','" + LVagent.Items[i].SubItems[2].Text + "','" + LVagent.Items[i].SubItems[3].Text + "','" + LVagent.Items[i].SubItems[4].Text + "','" + txtopbalance.Text + "','" + txtsales.Text + "','" + txtrecript.Text + "','" + txtcommamt.Text + "')"; prn.execute(qry); } Print popup = new Print("AgentReport"); popup.ShowDialog(); popup.Dispose(); } catch { } }
private void btnprint_Click(object sender, EventArgs e) { try { prn.execute("delete from printing"); string status; status = "DAY BOOK FROM " + DTPFrom.Text; for (int i = 0; i < LVDayBook.Items.Count; i++) { DataTable dt1 = conn.getdataset("select * from company WHERE isactive=1 and CompanyID='" + Master.companyId + "' "); string qry = "INSERT INTO Printing(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20)VALUES"; qry += "('" + dt1.Rows[0]["CompanyName"].ToString() + "','" + dt1.Rows[0]["SubName"].ToString() + "','" + dt1.Rows[0]["Address"].ToString() + "','" + dt1.Rows[0]["Address2"].ToString() + "','" + dt1.Rows[0]["City"].ToString() + "','" + dt1.Rows[0]["State"].ToString() + "','" + dt1.Rows[0]["Country"].ToString() + "','" + dt1.Rows[0]["Phone"].ToString() + "','" + dt1.Rows[0]["Mobile"].ToString() + "','" + dt1.Rows[0]["Email"].ToString() + "','" + dt1.Rows[0]["CSTNo"].ToString() + "','" + status + "','" + txttotaldr.Text + "','" + txttotalcr.Text + "','" + LVDayBook.Items[i].SubItems[0].Text + "','" + LVDayBook.Items[i].SubItems[1].Text + "','" + LVDayBook.Items[i].SubItems[2].Text + "','" + LVDayBook.Items[i].SubItems[3].Text + "','" + LVDayBook.Items[i].SubItems[4].Text + "','" + LVDayBook.Items[i].SubItems[5].Text + "')"; prn.execute(qry); } Print popup = new Print("CreditReport"); popup.ShowDialog(); popup.Dispose(); } catch { } }
private void btnPrint_Click(object sender, EventArgs e) { DataTable dt = (DataTable)grdData.DataSource; try { Printing prndata = new Printing(); if (dt.Rows.Count > 0) { prndata.execute("delete from printing"); DataTable dt1 = cs.getdataset("select * from company WHERE isactive=1"); int j = 1; for (int i = 0; i < dt.Rows.Count; i++) { string Billdate = "", billno = "", AccountName = "", ProductName = "", Batch = "", Rate = ""; Billdate = dt.Rows[i]["Bill_Date"].ToString(); billno = dt.Rows[i]["billno"].ToString(); AccountName = dt.Rows[i]["AccountName"].ToString(); ProductName = dt.Rows[i]["Productname"].ToString(); Batch = dt.Rows[i]["batch"].ToString(); Rate = dt.Rows[i]["Rate"].ToString(); string qry = "INSERT INTO Printing(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22,T23,T24)VALUES"; qry += "('" + j++ + "','" + dt1.Rows[0][0].ToString() + "','" + dt1.Rows[0][1].ToString() + "','" + dt1.Rows[0][2].ToString() + "','" + dt1.Rows[0][3].ToString() + "','" + dt1.Rows[0][4].ToString() + "','" + dt1.Rows[0][5].ToString() + "','" + dt1.Rows[0][6].ToString() + "','" + dt1.Rows[0][7].ToString() + "','" + dt1.Rows[0][8].ToString() + "','" + dt1.Rows[0][9].ToString() + "','" + dt1.Rows[0][10].ToString() + "','" + dt1.Rows[0][11].ToString() + "','" + dt1.Rows[0][12].ToString() + "','" + dt1.Rows[0][13].ToString() + "','" + Billdate + "','" + billno + "','" + AccountName + "','" + ProductName + "','" + Batch + "','" + Rate + "','" + txtTotalRate.Text + "','" + txtTotalQty.Text + "','" + txtTotalAmount.Text + "')"; prndata.execute(qry); } Print popup = new Print("SalePurchaseDetailsReport"); popup.ShowDialog(); popup.Dispose(); } else { MessageBox.Show("No Records For Printing.."); } } catch (Exception excp) { } }
private void btnprint_Click(object sender, EventArgs e) { try { Printing prndata = new Printing(); if (LVclient.Items.Count > 0) { prndata.execute("delete from printing"); DataTable dt1 = con1.getdataset("select * from company WHERE isactive=1"); int j = 1; for (int i = 0; i < LVclient.Items.Count; i++) { string itemname = "", CompanyName = "", GroupName = "", Unit = "", SalePrice = "", MRP = "", PurchasePrice = ""; itemname = LVclient.Items[i].SubItems[1].Text; CompanyName = LVclient.Items[i].SubItems[2].Text; GroupName = LVclient.Items[i].SubItems[3].Text; Unit = LVclient.Items[i].SubItems[4].Text; SalePrice = LVclient.Items[i].SubItems[5].Text; MRP = LVclient.Items[i].SubItems[6].Text; PurchasePrice = LVclient.Items[i].SubItems[7].Text; string qry = "INSERT INTO Printing(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22)VALUES"; qry += "('" + j++ + "','" + dt1.Rows[0][0].ToString() + "','" + dt1.Rows[0][1].ToString() + "','" + dt1.Rows[0][2].ToString() + "','" + dt1.Rows[0][3].ToString() + "','" + dt1.Rows[0][4].ToString() + "','" + dt1.Rows[0][5].ToString() + "','" + dt1.Rows[0][6].ToString() + "','" + dt1.Rows[0][7].ToString() + "','" + dt1.Rows[0][8].ToString() + "','" + dt1.Rows[0][9].ToString() + "','" + dt1.Rows[0][10].ToString() + "','" + dt1.Rows[0][11].ToString() + "','" + dt1.Rows[0][12].ToString() + "','" + dt1.Rows[0][13].ToString() + "','" + itemname + "','" + CompanyName + "','" + GroupName + "','" + Unit + "','" + SalePrice + "','" + MRP + "','" + PurchasePrice + "')"; prndata.execute(qry); } Print popup = new Print("ItemReport"); popup.ShowDialog(); popup.Dispose(); } else { MessageBox.Show("No Records For Printing.."); } } catch (Exception excp) { } }
private void btngenrpt_Click(object sender, EventArgs e) { DialogResult dr1 = MessageBox.Show("Do you want to Print ItemWiseStock?", "ItemWiseStock", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr1 == DialogResult.Yes) { if (LVledger.Items.Count > 0) { prn.execute("delete from printing"); DataTable dt1 = conn.getdataset("select * from company WHERE isactive=1"); for (int i = 0; i < LVledger.Items.Count; i++) { string date = "", Name = "", Price = "", QtyIN = "", QtyOut = "", balance = "", ItemName = "", ItemFormat = ""; date = LVledger.Items[i].SubItems[0].Text; Name = LVledger.Items[i].SubItems[3].Text; Price = LVledger.Items[i].SubItems[4].Text; QtyIN = LVledger.Items[i].SubItems[5].Text; QtyOut = LVledger.Items[i].SubItems[6].Text; balance = LVledger.Items[i].SubItems[7].Text; ItemName = cmbaccname.Text; ItemFormat = "ITEM WISE STOCK OF " + ItemName + " FROM " + DTPFrom.Text + " TO " + DTPTo.Text; string qry = "INSERT INTO Printing(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19)VALUES"; qry += "('" + date + "','" + Name + "','" + Price + "','" + QtyIN + "','" + QtyOut + "','" + balance + "','" + dt1.Rows[0][1].ToString() + "','" + dt1.Rows[0][3].ToString() + "','" + dt1.Rows[0][4].ToString() + "','" + dt1.Rows[0][5].ToString() + "','" + dt1.Rows[0][6].ToString() + "','" + dt1.Rows[0][7].ToString() + "','" + dt1.Rows[0][8].ToString() + "','" + dt1.Rows[0][9].ToString() + "','" + dt1.Rows[0][10].ToString() + "','" + ItemFormat + "','" + txttotcredit.Text + "','" + txttotdebit.Text + "','" + txtbalance.Text + "')"; prn.execute(qry); } string reportName = "ItemWiseStock"; Print popup = new Print(reportName); popup.ShowDialog(); popup.Dispose(); } else { MessageBox.Show("No Records For Print ItemWiseStock", "ItemWiseStock", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
private void btnprint_Click(object sender, EventArgs e) { try { prn.execute("delete from printing"); string status; status = "CLOSING TRIAL BALANCE AS ON " + DTPFrom.Text; string[] a = new string[LVclient.CheckedItems.Count]; string[] b = new string[LVclient.CheckedItems.Count]; string[] c = new string[LVclient.CheckedItems.Count]; string[] d = new string[LVclient.CheckedItems.Count]; for (int i = 0; i < LVclient.Items.Count; i++) { string Account = LVclient.Items[i].SubItems[0].Text; string balance = LVclient.Items[i].SubItems[1].Text; string balance1 = LVclient.Items[i].SubItems[2].Text; //String withoutLast = balance.Substring(0, (balance.Length - 3)); // totalnet = +totalnet + Convert.ToDouble(withoutLast); // Double d1t = Convert.ToDouble(txtnetamt.Text) + totalnet; DataTable dt1 = conn.getdataset("select * from company WHERE isactive=1 and CompanyID='" + Master.companyId + "' "); string qry = "INSERT INTO Printing(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17)VALUES"; qry += "('" + Account + "','" + balance + "','" + dt1.Rows[0]["CompanyName"].ToString() + "','" + dt1.Rows[0]["SubName"].ToString() + "','" + dt1.Rows[0]["Address"].ToString() + "','" + dt1.Rows[0]["Address2"].ToString() + "','" + dt1.Rows[0]["City"].ToString() + "','" + dt1.Rows[0]["State"].ToString() + "','" + dt1.Rows[0]["Country"].ToString() + "','" + dt1.Rows[0]["Phone"].ToString() + "','" + dt1.Rows[0]["Mobile"].ToString() + "','" + dt1.Rows[0]["Email"].ToString() + "','" + dt1.Rows[0]["CSTNo"].ToString() + "','" + status + "','" + txttotaldr.Text + "','" + txttotalcr.Text + "','" + balance1 + "')"; prn.execute(qry); } // string update = "UPDATE [Printing] SET [T17]='" + totalnet + "'"; //prn.execute(update); //totalnet = 0; Print popup = new Print("Trialbalance"); popup.ShowDialog(); popup.Dispose(); } catch { } }
private void btnsearch_Click(object sender, EventArgs e) { try { DialogResult dr1 = MessageBox.Show("Do you want to Print?", "POS", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr1 == DialogResult.Yes) { if (LVbill.Items.Count > 0) { prn.execute("delete from printing"); DataTable dt1 = sql.getdataset("select * from company WHERE isactive=1"); // string date = "", type = "", Account = "", drAmount = "", crAmount="",balance=""; for (int i = 0; i < LVbill.Items.Count; i++) { string a = "", b = "", c = "", d = "", s = "", f = "", g = "", h = "", q = "", j = "", k = ""; a = LVbill.Items[i].SubItems[0].Text; b = LVbill.Items[i].SubItems[1].Text; c = LVbill.Items[i].SubItems[2].Text; d = LVbill.Items[i].SubItems[3].Text; s = LVbill.Items[i].SubItems[4].Text; f = LVbill.Items[i].SubItems[5].Text; g = LVbill.Items[i].SubItems[6].Text; h = LVbill.Items[i].SubItems[7].Text; q = LVbill.Items[i].SubItems[8].Text; j = LVbill.Items[i].SubItems[9].Text; k = LVbill.Items[i].SubItems[10].Text; if (f == "" || f == null) { f = "0"; } if (g == "" || g == null) { g = "0"; } if (h == "" || h == null) { h = "0"; } if (q == "" || q == null) { q = "0"; } if (j == "" || j == null) { j = "0"; } if (k == "" || k == null) { k = "0"; } qty = qty + Convert.ToDouble(f); tbill = tbill + Convert.ToDouble(g); tcash = tcash + Convert.ToDouble(h); tother = tother + Convert.ToDouble(q); tnet = tnet + Convert.ToDouble(j); tchanges = tchanges + Convert.ToDouble(k); string qry = "INSERT INTO Printing(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22,T23,T24,T25,T26,T27,T28,T29,T30,T31,T32,T33)VALUES"; qry += "('" + dt1.Rows[0][0].ToString() + "','" + dt1.Rows[0][1].ToString() + "','" + dt1.Rows[0][2].ToString() + "','" + dt1.Rows[0][3].ToString() + "','" + dt1.Rows[0][4].ToString() + "','" + dt1.Rows[0][5].ToString() + "','" + dt1.Rows[0][6].ToString() + "','" + dt1.Rows[0][7].ToString() + "','" + dt1.Rows[0][8].ToString() + "','" + dt1.Rows[0][9].ToString() + "','" + dt1.Rows[0][10].ToString() + "','" + dt1.Rows[0][11].ToString() + "','" + dt1.Rows[0][12].ToString() + "','" + dt1.Rows[0][13].ToString() + "','" + DTPFrom.Text + "','" + DTPTo.Text + "','" + a + "','" + b + "','" + c + "','" + d + "','" + s + "','" + f + "','" + g + "','" + h + "','" + q + "','" + j + "','" + k + "','" + qty + "','" + tbill + "','" + tcash + "','" + tother + "','" + tnet + "','" + tchanges + "')"; prn.execute(qry); } string update = "UPDATE [Printing] SET [T28]='" + qty + "',[T29]='" + tbill + "',[T30]='" + tcash + "',[T31]='" + tother + "',[T32]='" + tnet + "',[T33]='" + tchanges + "'"; prn.execute(update); string reportName = "Pos List"; Print popup = new Print(reportName); popup.ShowDialog(); popup.Dispose(); qty = 0; tbill = 0; tcash = 0; tother = 0; tnet = 0; tchanges = 0; } } } catch { } }
private void button1_Click(object sender, EventArgs e) { prn.execute("delete from printing"); #region add table columns name string qry = "INSERT INTO Printing("; for (int j = 0; j < maindt.Columns.Count; j++) { if (j < 100) { if (j == 0) { qry += "T" + (j + 1); } else { qry += "," + "T" + (j + 1); } } else if (j == 0) { qry += "P" + (j + 1); } else { qry += "," + "P" + (j + 1); } } qry += ")VALUES("; string[] columnNames = maindt.Columns.Cast <DataColumn>() .Select(x => x.ColumnName) .ToArray(); for (int k = 0; k < columnNames.Length; k++) { if (k == 0) { qry += "'" + columnNames[k] + "'"; } else { qry += ",'" + columnNames[k] + "'"; } } qry += ")"; prn.execute(qry); #endregion #region add table data for (int i = 0; i < maindt.Rows.Count; i++) { qry = "INSERT INTO Printing("; for (int j = 0; j < maindt.Columns.Count; j++) { if (j < 100) { if (j == 0) { qry += "T" + (j + 1); } else { qry += "," + "T" + (j + 1); } } else if (j == 0) { qry += "P" + (j + 1); } else { qry += "," + "P" + (j + 1); } } qry += ")VALUES("; for (int j = 0; j < maindt.Columns.Count; j++) { if (j == 0) { qry += "'" + maindt.Rows[i][j].ToString() + "'"; } else { qry += ",'" + maindt.Rows[i][j].ToString() + "'"; } } qry += ")"; prn.execute(qry); } #endregion Print popup = new Print("ItemWiseSaleOrder"); popup.ShowDialog(); popup.Dispose(); }
private void btnsubmit() { try { //if (cmbCustName.Text == "") //{ // MessageBox.Show("Select Party Name"); // cmbCustName.Focus(); //} //else if (cmbPurchaseType.Text == "") //{ // MessageBox.Show("Select Sale type"); // cmbPurchaseType.Focus(); //} //else if (LVFO.Items.Count == 0) //{ // MessageBox.Show("Please Enter atleast one item to generate sale return"); // txtItemName.Focus(); //} //else //{ DataTable dtpid = new DataTable(); getcon(); if (con.State == ConnectionState.Open) { con.Close(); } con.Open(); DialogResult dr = MessageBox.Show("Do you want to Generate Bill?", "Bill", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { if (cmbPurchaseType.Text == "" || cmbCustName.Text == "" || cmbTerms.Text == "") { MessageBox.Show("Please fill all the information."); if (cmbTerms.Text == "") { cmbTerms.Focus(); } else if (cmbCustName.Text == "") { cmbCustName.Focus(); } else if (cmbPurchaseType.Text == "") { cmbPurchaseType.Focus(); } } else { if (btnPayment.Text == "Update") { SqlCommand cmd2 = new SqlCommand("Update billproductmaster set isactive='0' where Bill_No='" + txtVchNo.Text + "' and BillType='PR'", con); cmd2.ExecuteNonQuery(); for (int i = 0; i < LVFO.Items.Count; i++) { dtpid = conn.getdataset("Select Productid from productmaster where product_name='" + LVFO.Items[i].SubItems[0].Text.Replace(",", "") + "'"); SqlCommand cmd1 = new SqlCommand("INSERT INTO [BillProductMaster]([Bill_No],[Bill_Run_Date],[ProductName],[Pqty],[Bags],[Rate],[Per],[Amount],[DiscountPer],[Discountamt],[Tax],[Addtax],[Total],[isactive],[BillType],[productid])VALUES('" + txtVchNo.Text + "','" + Convert.ToDateTime(TxtBillDate.Text).ToString("dd/MMM/yyyy") + "','" + LVFO.Items[i].SubItems[0].Text + "','" + LVFO.Items[i].SubItems[1].Text + "','" + LVFO.Items[i].SubItems[2].Text + "','" + LVFO.Items[i].SubItems[3].Text + "','" + LVFO.Items[i].SubItems[4].Text + "','" + LVFO.Items[i].SubItems[5].Text + "','" + LVFO.Items[i].SubItems[6].Text.Replace(",", "") + "','" + LVFO.Items[i].SubItems[7].Text + "','" + LVFO.Items[i].SubItems[8].Text.Replace(",", "") + "','" + LVFO.Items[i].SubItems[9].Text.Replace(",", "") + "','" + LVFO.Items[i].SubItems[10].Text.Replace(",", "") + "',1,'PR','" + dtpid.Rows[0][0].ToString() + "')", con); cmd1.ExecuteNonQuery(); } SqlCommand cmd = new SqlCommand("UPDATE [BillMaster] SET [Bill_No] = '" + txtVchNo.Text + "',[Bill_Date] = '" + Convert.ToDateTime(TxtBillDate.Text).ToString("dd/MMM/yyyy") + "',[Terms] = '" + cmbTerms.Text + "',[ClientID] = '" + cmbCustName.SelectedValue + "',[SaleType] = '" + cmbPurchaseType.SelectedValue + "',[Count] = " + lbltotcount.Text + ",[TotalQty] = " + lbltotpqty.Text + ",[TotalBasic] = " + lblbasictot.Text + ",[TotalTax] =" + lbltaxtot.Text + " ,[TotalAddTax] =" + txtaddtax.Text + " ,[TotalDiscount] =" + lbltotaldiscount.Text + " ,[TotalNet] = " + Math.Round(Convert.ToDouble(TxtBillTotal.Text), 2).ToString("########.00") + ",[isactive]=1,[DispatchDetails]='" + txtdispatch.Text + "',[Remarks]='" + txtremarks.Text + "',[billtype]='PR',[CompanyId]=" + Master.companyId + " where Bill_No='" + txtVchNo.Text + "' and [billtype]='PR' and [CompanyId]=" + Master.companyId + "", con); cmd.ExecuteNonQuery(); conn.execute("UPDATE [Ledger] SET [Date1]='" + Convert.ToDateTime(TxtBillDate.Text).ToString("dd/MMM/yyyy") + "',[TranType] = 'PurchaseReturn',[AccountID] = '" + cmbCustName.SelectedValue + "',[AccountName]='" + cmbCustName.Text + "' ,[Amount] = '" + Math.Round(Convert.ToDouble(TxtBillTotal.Text), 2).ToString("########.00") + "',[DC] = 'D',[CompanyId]=" + Master.companyId + " where [VoucherID]= '" + txtVchNo.Text + "' and [TranType] = 'PurchaseReturn' and CompanyId=" + Master.companyId + ""); ChangeNumbersToWords sh = new ChangeNumbersToWords(); String s1 = Math.Round(Convert.ToDouble(TxtBillTotal.Text), 2).ToString("########.00"); string[] words = s1.Split('.'); string str = sh.changeToWords(words[0]); string str1 = sh.changeToWords(words[1]); if (str1 == " " || str1 == null || words[1] == "00") { str1 = "Zero "; } String inword = "In words: " + str + "and " + str1 + "Paise Only"; //Phrase inwrd = new Phrase(inword, _font2); DataTable client = conn.getdataset("select * from clientmaster where isactive=1 and clientID='" + cmbCustName.SelectedValue + "'"); DataTable dt1 = conn.getdataset("select * from company WHERE isactive=1"); prn.execute("delete from printing"); int j = 1; for (int i = 0; i < LVFO.Items.Count; i++) { try { string qry = "INSERT INTO Printing(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22,T23,T24,T25,T26,T27,T28,T29,T30,T31,T32,T33,T34,T35,T36,T37,T38,T39,T40,T41,T42,T43,T44,T45,T46,T47,T48,T49,T50,T51,T52,T53,T54,T55,T56,T57,T58,T59,T60,T61,T62,T63,T64,T65,T66,T67,T68,T69,T70,T71,T72,T73,T74,T75,T76,T77,T78,T79,T80)VALUES"; qry += "('" + j++ + "','" + TxtBillNo.Text + "','" + TxtBillDate.Text + "','" + cmbTerms.Text + "','0','" + cmbCustName.Text + "','0','" + cmbPurchaseType.Text + "','" + LVFO.Items[i].SubItems[0].Text + "','" + LVFO.Items[i].SubItems[1].Text + "','" + LVFO.Items[i].SubItems[2].Text + "','" + LVFO.Items[i].SubItems[3].Text + "','" + LVFO.Items[i].SubItems[4].Text + "','" + LVFO.Items[i].SubItems[5].Text + "','" + LVFO.Items[i].SubItems[6].Text + "','" + LVFO.Items[i].SubItems[7].Text + "','" + LVFO.Items[i].SubItems[8].Text + "','" + LVFO.Items[i].SubItems[9].Text + "','" + LVFO.Items[i].SubItems[10].Text + "','" + LVFO.Items[i].SubItems[11].Text + "','" + LVFO.Items[i].SubItems[12].Text + "','" + LVFO.Items[i].SubItems[13].Text + "','" + LVFO.Items[i].SubItems[14].Text + "','" + lbltotcount.Text + "','" + lbltotpqty.Text + "','0','0','" + lblbasictot.Text + "','0','0','0','0','0','0','0','0','" + TxtBillTotal.Text + "','" + dt1.Rows[0][0].ToString() + "','" + dt1.Rows[0][1].ToString() + "','" + dt1.Rows[0][2].ToString() + "','" + dt1.Rows[0][3].ToString() + "','" + dt1.Rows[0][4].ToString() + "','" + dt1.Rows[0][5].ToString() + "','" + dt1.Rows[0][6].ToString() + "','" + dt1.Rows[0][7].ToString() + "','" + dt1.Rows[0][8].ToString() + "','" + dt1.Rows[0][9].ToString() + "','" + dt1.Rows[0][10].ToString() + "','" + dt1.Rows[0][11].ToString() + "','" + dt1.Rows[0][12].ToString() + "','" + dt1.Rows[0][13].ToString() + "','" + inword + "','0','0','0','0','0','" + txtremarks.Text + "','0','0','0','0','0','0','0','0','" + client.Rows[0][0].ToString() + "','" + client.Rows[0][1].ToString() + "','" + client.Rows[0][2].ToString() + "','" + client.Rows[0][3].ToString() + "','" + client.Rows[0][4].ToString() + "','" + client.Rows[0][5].ToString() + "','" + client.Rows[0][6].ToString() + "','" + client.Rows[0][7].ToString() + "','" + client.Rows[0][8].ToString() + "','" + client.Rows[0][9].ToString() + "','" + client.Rows[0][10].ToString() + "','" + client.Rows[0][11].ToString() + "','" + client.Rows[0][12].ToString() + "','" + client.Rows[0][13].ToString() + "')"; prn.execute(qry); } catch { } } Print popup = new Print("Purchase Return"); popup.ShowDialog(); popup.Dispose(); clearitem(); clearall(); LVFO.Items.Clear(); MessageBox.Show("Data Updated Successfully."); btnPayment.Text = "Save"; this.Hide(); } else { getsr(); for (int i = 0; i < LVFO.Items.Count; i++) { dtpid = conn.getdataset("Select Productid from productmaster where product_name='" + LVFO.Items[i].SubItems[0].Text.Replace(",", "") + "'"); SqlCommand cmd1 = new SqlCommand("INSERT INTO [BillProductMaster]([Bill_No],[Bill_Run_Date],[ProductName],[Pqty],[Bags],[Rate],[Per],[Amount],[DiscountPer],[Discountamt],[Tax],[Addtax],[Total],[isactive],[BillType],[productid])VALUES('" + txtVchNo.Text + "','" + Convert.ToDateTime(TxtBillDate.Text).ToString("dd/MMM/yyyy") + "','" + LVFO.Items[i].SubItems[0].Text + "','" + LVFO.Items[i].SubItems[1].Text + "','" + LVFO.Items[i].SubItems[2].Text + "','" + LVFO.Items[i].SubItems[3].Text + "','" + LVFO.Items[i].SubItems[4].Text + "','" + LVFO.Items[i].SubItems[5].Text + "','" + LVFO.Items[i].SubItems[6].Text.Replace(",", "") + "','" + LVFO.Items[i].SubItems[7].Text + "','" + LVFO.Items[i].SubItems[8].Text.Replace(",", "") + "','" + LVFO.Items[i].SubItems[9].Text.Replace(",", "") + "','" + LVFO.Items[i].SubItems[10].Text.Replace(",", "") + "',1,'PR','" + dtpid.Rows[0][0].ToString() + "')", con); //SqlCommand cmd1 = new SqlCommand("INSERT INTO [BillProductMaster]([VchNo],[BillNo],[BillRunDate],[ProductName],[Qty],[Free],[Rate],[Per],[BasicAmount],[DiscountPer],[Discount],[Vat],[AddVat],[Total],[isactive],[BillType])VALUES('" + txtVchNo.Text + "','"+TxtBillNo.Text+"','" + Convert.ToDateTime(TxtBillDate.Text).ToString("dd/MMM/yyyy") + "','" + LVFO.Items[i].SubItems[0].Text + "','" + LVFO.Items[i].SubItems[1].Text + "','" + LVFO.Items[i].SubItems[2].Text + "','" + LVFO.Items[i].SubItems[3].Text + "','" + LVFO.Items[i].SubItems[4].Text + "','" + LVFO.Items[i].SubItems[5].Text + "','" + LVFO.Items[i].SubItems[6].Text.Replace(",", "") + "','" + LVFO.Items[i].SubItems[7].Text + "','" + LVFO.Items[i].SubItems[8].Text.Replace(",", "") + "','" + LVFO.Items[i].SubItems[9].Text.Replace(",", "") + "','" + LVFO.Items[i].SubItems[10].Text.Replace(",", "") + "',1,'PR')", con); cmd1.ExecuteNonQuery(); } SqlCommand cmd = new SqlCommand("INSERT INTO [BillMaster]([Bill_No],[Bill_Date],[Terms],[ClientID],[SaleType],[Count],[TotalQty],[TotalBasic],[TotalTax],[TotalAddTax],[TotalDiscount],[TotalNet],[isactive],[DispatchDetails],[Remarks],[BillType],[CompanyId])VALUES('" + txtVchNo.Text + "','" + Convert.ToDateTime(TxtBillDate.Text).ToString("dd/MMM/yyyy") + "','" + cmbTerms.Text + "','" + cmbCustName.SelectedValue + "','" + cmbPurchaseType.SelectedValue + "'," + lbltotcount.Text + "," + lbltotpqty.Text + "," + lblbasictot.Text + "," + lbltaxtot.Text + "," + txtaddtax.Text + "," + lbltotaldiscount.Text + "," + Math.Round(Convert.ToDouble(TxtBillTotal.Text), 2).ToString("########.00") + ",1,'" + txtdispatch.Text + "','" + txtremarks.Text + "','PR'," + Master.companyId + ")", con); cmd.ExecuteNonQuery(); conn.execute("INSERT INTO [Ledger]([VoucherID],[Date1],[TranType],[AccountID],[AccountName],[Amount],[DC],[CompanyId],[isActive]) values ('" + txtVchNo.Text + "','" + Convert.ToDateTime(TxtBillDate.Text).ToString("dd/MMM/yyyy") + "','PurchaseReturn','" + cmbCustName.SelectedValue + "','" + cmbCustName.Text + "','" + TxtBillTotal.Text + "','D'," + Master.companyId + ",1)"); ChangeNumbersToWords sh = new ChangeNumbersToWords(); String s1 = Math.Round(Convert.ToDouble(TxtBillTotal.Text), 2).ToString("########.00"); string[] words = s1.Split('.'); string str = sh.changeToWords(words[0]); string str1 = sh.changeToWords(words[1]); if (str1 == " " || str1 == null || words[1] == "00") { str1 = "Zero "; } String inword = "In words: " + str + "and " + str1 + "Paise Only"; DataTable client = conn.getdataset("select * from clientmaster where isactive=1 and clientID='" + cmbCustName.SelectedValue + "'"); DataTable dt1 = conn.getdataset("select * from company WHERE isactive=1"); prn.execute("delete from printing"); int j = 1; for (int i = 0; i < LVFO.Items.Count; i++) { try { string qry = "INSERT INTO Printing(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22,T23,T24,T25,T26,T27,T28,T29,T30,T31,T32,T33,T34,T35,T36,T37,T38,T39,T40,T41,T42,T43,T44,T45,T46,T47,T48,T49,T50,T51,T52,T53,T54,T55,T56,T57,T58,T59,T60,T61,T62,T63,T64,T65,T66,T67,T68,T69,T70,T71,T72,T73,T74,T75,T76,T77,T78,T79,T80)VALUES"; qry += "('" + j++ + "','" + TxtBillNo.Text + "','" + TxtBillDate.Text + "','" + cmbTerms.Text + "','0','" + cmbCustName.Text + "','0','" + cmbPurchaseType.Text + "','" + LVFO.Items[i].SubItems[0].Text + "','" + LVFO.Items[i].SubItems[1].Text + "','" + LVFO.Items[i].SubItems[2].Text + "','" + LVFO.Items[i].SubItems[3].Text + "','" + LVFO.Items[i].SubItems[4].Text + "','" + LVFO.Items[i].SubItems[5].Text + "','" + LVFO.Items[i].SubItems[6].Text + "','" + LVFO.Items[i].SubItems[7].Text + "','" + LVFO.Items[i].SubItems[8].Text + "','" + LVFO.Items[i].SubItems[9].Text + "','" + LVFO.Items[i].SubItems[10].Text + "','" + LVFO.Items[i].SubItems[11].Text + "','" + LVFO.Items[i].SubItems[12].Text + "','" + LVFO.Items[i].SubItems[13].Text + "','" + LVFO.Items[i].SubItems[14].Text + "','" + lbltotcount.Text + "','" + lbltotpqty.Text + "','0','0','" + lblbasictot.Text + "','0','0','0','0','0','0','0','0','" + TxtBillTotal.Text + "','" + dt1.Rows[0][0].ToString() + "','" + dt1.Rows[0][1].ToString() + "','" + dt1.Rows[0][2].ToString() + "','" + dt1.Rows[0][3].ToString() + "','" + dt1.Rows[0][4].ToString() + "','" + dt1.Rows[0][5].ToString() + "','" + dt1.Rows[0][6].ToString() + "','" + dt1.Rows[0][7].ToString() + "','" + dt1.Rows[0][8].ToString() + "','" + dt1.Rows[0][9].ToString() + "','" + dt1.Rows[0][10].ToString() + "','" + dt1.Rows[0][11].ToString() + "','" + dt1.Rows[0][12].ToString() + "','" + dt1.Rows[0][13].ToString() + "','" + inword + "','0','0','0','0','0','" + txtremarks.Text + "','0','0','0','0','0','0','0','0','" + client.Rows[0][0].ToString() + "','" + client.Rows[0][1].ToString() + "','" + client.Rows[0][2].ToString() + "','" + client.Rows[0][3].ToString() + "','" + client.Rows[0][4].ToString() + "','" + client.Rows[0][5].ToString() + "','" + client.Rows[0][6].ToString() + "','" + client.Rows[0][7].ToString() + "','" + client.Rows[0][8].ToString() + "','" + client.Rows[0][9].ToString() + "','" + client.Rows[0][10].ToString() + "','" + client.Rows[0][11].ToString() + "','" + client.Rows[0][12].ToString() + "','" + client.Rows[0][13].ToString() + "')"; prn.execute(qry); } catch { } } Print popup = new Print("Purchase Return"); popup.ShowDialog(); popup.Dispose(); clearitem(); clearall(); LVFO.Items.Clear(); this.Hide(); } } } else { MessageBox.Show("please fill all information"); } } catch (Exception ex) { MessageBox.Show("Error:" + ex.Message); } finally { con.Close(); } }
private void btngenrpt_Click(object sender, EventArgs e) { try { DialogResult dr = MessageBox.Show("Do you want to Generate Report?", "ItemList", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { //cmd2 = new SqlCommand("select ItemName,sum(Qty) as totalqty, Rate, sum(qty)*rate as TotalSale from BillProductMaster group by itemname, rate order by totalqty desc", con); //sda2 = new SqlDataAdapter(cmd2); //DataTable dt2 = new DataTable(); //sda2.Fill(dt2); cmd3 = new SqlCommand("select * from company WHERE isactive=1", con); sda3 = new SqlDataAdapter(cmd3); DataTable dt1 = new DataTable(); sda3.Fill(dt1); cmd = new SqlCommand("select ItemName,sum(Qty) as totalqty, Rate, sum(qty)*rate as TotalSale from BillPOSProductMaster where isactive=1 and BillRunDate>='" + Convert.ToDateTime(DTPFrom.Text).ToString(Master.dateformate) + "' and BillRunDate<='" + Convert.ToDateTime(DTPTo.Text).ToString(Master.dateformate) + "' group by itemname, rate order by totalqty desc", con); sda = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); sda.Fill(dt); con.Open(); // cmd1 = new SqlCommand("delete from printing", con); // cmd1.ExecuteNonQuery(); prn.execute("delete from printing"); //for (int i = 0; i < dt2.Rows.Count; i++) //{ // string qry = "INSERT INTO [dbo].[Printing]([T1],[T2],[T3],[T4],[T5])VALUES"; // qry += "('" + DateTime.Now.ToShortDateString() + "','" + dt2.Rows[i][0].ToString() + "','" + dt2.Rows[i][1].ToString() + "','" + dt2.Rows[i][2].ToString() + "','" + dt2.Rows[i][3].ToString() + "')"; // cmd = new SqlCommand(qry, con); // cmd.ExecuteNonQuery(); //} int j = 1; for (int i = 0; i < dt.Rows.Count; i++) { string qry = "INSERT INTO Printing(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22)VALUES"; qry += "('" + dt.Rows[i][0].ToString() + "','" + DateTime.Now.ToShortDateString() + "','" + dt.Rows[i][1].ToString() + "','" + dt.Rows[i][2].ToString() + "','" + dt.Rows[i][3].ToString() + "','" + dt1.Rows[0][0].ToString() + "','" + dt1.Rows[0][1].ToString() + "','" + dt1.Rows[0][2].ToString() + "','" + dt1.Rows[0][3].ToString() + "','" + dt1.Rows[0][4].ToString() + "','" + dt1.Rows[0][5].ToString() + "','" + dt1.Rows[0][6].ToString() + "','" + dt1.Rows[0][7].ToString() + "','" + dt1.Rows[0][8].ToString() + "','" + dt1.Rows[0][9].ToString() + "','" + dt1.Rows[0][10].ToString() + "','" + dt1.Rows[0][11].ToString() + "','" + dt1.Rows[0][12].ToString() + "','" + dt1.Rows[0][13].ToString() + "','" + DTPFrom.Text + "','" + DTPTo.Text + "','" + j++ + "')"; prn.execute(qry); // cmd = new SqlCommand(qry, con); // cmd.ExecuteNonQuery(); } string reportName = "Pos Item List"; Print popup = new Print(reportName); popup.ShowDialog(); popup.Dispose(); con.Close(); // POSItemListPrintReport frm = new POSItemListPrintReport(); // frm.StartPosition = FormStartPosition.CenterScreen; // frm.Show(); } else { MessageBox.Show("Please select another date if you want to generate another Report."); } } catch (Exception ex) { MessageBox.Show("Error:", ex.Message); } finally { con.Close(); } }
public void bindgrid() { try { dt3 = con.getdataset("select a, u, d, v, p, mId, uId, cId from UserRights where mId=5 and uId='" + UserLogin.id + "' and cId= " + Master.companyId + " and isActive=1"); if (dt3.Rows.Count > 0) { if (Convert.ToBoolean(dt3.Rows[0][0]) == false) { btnnew.Visible = false; } if (Convert.ToBoolean(dt3.Rows[0][1]) == false) { LVDayBook.Enabled = false; LVDayBook.GridLines = true; LVDayBook.BackColor = System.Drawing.Color.LightYellow; } if (Convert.ToBoolean(dt3.Rows[0][4]) == false) { btngenrpt.Visible = false; } } LVDayBook.Items.Clear(); dt = con.getdataset("select b.OrderNo,convert(varchar(11), b.OrderDate, 113)as OrderDate, c.printname,c.address,b.totalbasic,b.totaltax,b.TotalDiscount,b.totalnet from PurchaseOrderMaster b inner join clientmaster c on c.clientid=b.clientid where b.isactive=1 and b.CompanyId=" + Master.companyId + " and b.OrderDate>='" + Convert.ToDateTime(DTPFrom.Text).ToString("MM-dd-yyyy") + "' and b.OrderDate<='" + Convert.ToDateTime(DTPTo.Text).AddDays(1).ToString("MM-dd-yyyy") + "' order by b.VchNo"); //dt = con.getdataset("select b.OrderNo, b.OrderDate, c.subname,c.address from PurchaseOrderMaster b inner join Company c on c.CompanyId=b.CompanyId where b.isactive=1 and b.CompanyId=" + Master.companyId + " and b.OrderDate>='" + Convert.ToDateTime(DTPFrom.Text).ToString("MM-dd-yyyy") + "' and b.OrderDate<='" + Convert.ToDateTime(DTPTo.Text).ToString("MM-dd-yyyy") + "' order by b.VchNo"); bill = 0; total = 0; vat = 0; net = 0; if (dt.Rows.Count > 0) { for (int i = 0; i <= dt.Rows.Count - 1; i++) { LVDayBook.Items.Add(dt.Rows[i].ItemArray[0].ToString()); LVDayBook.Items[i].SubItems.Add(dt.Rows[i].ItemArray[1].ToString()); LVDayBook.Items[i].SubItems.Add(dt.Rows[i].ItemArray[2].ToString()); LVDayBook.Items[i].SubItems.Add(dt.Rows[i].ItemArray[3].ToString()); //LVDayBook.Items[i].SubItems.Add(dt.Rows[i].ItemArray[4].ToString()); //LVDayBook.Items[i].SubItems.Add(dt.Rows[i].ItemArray[5].ToString()); //LVDayBook.Items[i].SubItems.Add(dt.Rows[i].ItemArray[6].ToString()); //LVDayBook.Items[i].SubItems.Add(dt.Rows[i].ItemArray[7].ToString()); bill++; DateTime d = Convert.ToDateTime(dt.Rows[i][1].ToString()); if (d == DateTime.Now.Date) { btnnew.Visible = false; } //total = total + Convert.ToDouble(dt.Rows[i][4].ToString()); //vat = vat + Convert.ToDouble(dt.Rows[i][5].ToString()); //net = net + Convert.ToDouble(dt.Rows[i][7].ToString()); } TxtInvoice.Text = bill.ToString(); txtbillamt.Text = total.ToString("N2"); txtvat.Text = vat.ToString("N2"); txtnetamt.Text = net.ToString("N2"); DataTable dt4 = new DataTable(); dt4 = con.getdataset("select * from Company where CompanyID='" + Master.companyId + "' and isActive=1"); prn.execute("delete from printing"); if (dt4.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { string qry = "INSERT INTO [Printing]([T1],[T2],[T3],[T4],[T5],[T6],[T7],[T8],[T9],[T10],[T11],[T12])VALUES"; qry += "('" + dt.Rows[i][0].ToString() + "','" + dt.Rows[i][1].ToString() + "','" + dt.Rows[i][2].ToString() + "','" + dt.Rows[i][3].ToString() + "','0','0','0','0','" + dt4.Rows[0]["CompanyName"].ToString() + "','" + dt4.Rows[0]["Address"].ToString() + "'," + dt4.Rows[0]["Phone"].ToString() + ",'" + dt4.Rows[0]["VATNo"].ToString() + "')"; //cmd3 = new SqlCommand(qry, con); //cmd3.ExecuteNonQuery(); prn.execute(qry); } } } } catch (Exception ex) { MessageBox.Show("Error:" + ex.Message); } finally { } }