Beispiel #1
0
 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)
     {
     }
 }