Esempio n. 1
0
 public SaleOrder(string id, DefaultSale defaultSale1)
 {
     InitializeComponent();
     loadpage();
     binddata(id);
     //saleOfOrder = saleOfOrder1 as SaleOfOrder;
     defaultSale = defaultSale1 as DefaultSale;
 }
Esempio n. 2
0
        //public ChargesHead(DefaultPurchase purchase, string p)
        //{
        //    // TODO: Complete member initialization
        //    InitializeComponent();
        //    this.purchase = purchase;
        //    this.p = p;
        //    pageLoad();
        //}

        public ChargesHead(DefaultSale defaultSale, string p)
        {
            InitializeComponent();
            // TODO: Complete member initialization
            this.defaultSale = defaultSale;
            this.p           = p;
            pageLoad();
        }
Esempio n. 3
0
 public ChargesPnl(TextBox txtcharamt, DefaultSale defaultSale, string[] strfinalarray)
 {
     // TODO: Complete member initialization
     InitializeComponent();
     this.txtcharamt    = txtcharamt;
     this.defaultSale   = defaultSale;
     this.strfinalarray = strfinalarray;
 }
Esempio n. 4
0
        public SaletypeEntry(DefaultSale defaultSale)
        {
            InitializeComponent();
            bindgroup();
            bindtaxtype();

            this.defaultSale = defaultSale;
            label11.Visible  = false;
        }
Esempio n. 5
0
 public Batch(string[] strfinalarray, DefaultSale defaultSale, string activecontroal)
 {
     InitializeComponent();
     // TODO: Complete member initialization
     this.strfinalarray = strfinalarray;
     this.mdefaultSale  = defaultSale;
     pvc = activecontroal;
     a   = 1;
 }
Esempio n. 6
0
 public SaleOrder(string p, DefaultSale defaultSale, string[] strfinalarray)
 {
     // TODO: Complete member initialization
     InitializeComponent();
     loadpage();
     this.p             = p;
     this.defaultSale   = defaultSale;
     this.strfinalarray = strfinalarray;
     binddata(p);
 }
Esempio n. 7
0
        public void setform()
        {
            this.Close();
            String           str = LVFO.Items[LVFO.FocusedItem.Index].SubItems[1].Text;
            DataTable        dt1 = conn.getdataset("select * from FormFormat where isactive=1 and type='" + strfinalarray[0] + "' and setdefault=1");
            DefaultSale      bd  = new DefaultSale(this, master, LVFO.Items[LVFO.FocusedItem.Index].SubItems[3].Text);
            DefaultSaleOrder bd1 = new DefaultSaleOrder(this, master, LVFO.Items[LVFO.FocusedItem.Index].SubItems[3].Text);
            SalePurchaseOrderSimpleformate bd2 = new SalePurchaseOrderSimpleformate(this, master, LVFO.Items[LVFO.FocusedItem.Index].SubItems[3].Text);
            Stockinout bd3 = new Stockinout(this, master, LVFO.Items[LVFO.FocusedItem.Index].SubItems[3].Text);

            //  Sale p = new Sale(this, master, tabControl);

            string[] a = new string[LVFO.CheckedItems.Count];
            string[] b = new string[LVFO.CheckedItems.Count];
            string[] c = new string[LVFO.CheckedItems.Count];
            for (int i = 0, j = 0; i < LVFO.Items.Count; i++)
            {
                //if (LVFO.Items[i].Checked == true)
                //{
                if (Convert.ToBoolean(LVFO.Items[i].Checked) == true)
                {
                    lvid     = LVFO.Items[i].SubItems[8].Text;
                    lvid1    = LVFO.Items[i].SubItems[1].Text;
                    type     = LVFO.Items[i].SubItems[3].Text;
                    clientid = Convert.ToInt32(LVFO.Items[i].SubItems[7].Text);
                    a[j]     = lvid;
                    b[j]     = type;
                    c[j]     = lvid1;
                    j++;
                }
            }
            if (dt1.Rows[0]["formname"].ToString() == bd.Text)
            {
                defaultSale.getdata(a, a, clientid, b, c);
                //   master.AddNewTab(bd);
            }
            else if (dt1.Rows[0]["formname"].ToString() == bd1.Text)
            {
                defaultSaleOrder.getdata(a, a, clientid, b, c);
            }
            else if (dt1.Rows[0]["formname"].ToString() == bd2.Text)
            {
                salePurchaseOrderSimpleformate.getdata(a, a, clientid, b, c);
            }
            else if (dt1.Rows[0]["formname"].ToString() == bd3.Text)
            {
                stockinout.getdata(a, a, clientid, b, c);
            }
            //else if (dt1.Rows[0]["formname"].ToString() == p.Text)
            //{
            //  //  p.updatemode(str, LVFO.Items[LVFO.FocusedItem.Index].SubItems[1].Text, 1);
            // //   master.AddNewTab(p);
            //}
        }
Esempio n. 8
0
        //public SaletypeEntry(Sale sale)
        //{
        //    InitializeComponent();
        //    bindgroup();
        //    bindtaxtype();
        //    purchaseid = 1;
        //    this.sale = sale;
        //    label11.Visible = false;
        //}

        public SaletypeEntry(DefaultSale defaultSale, Master master, TabControl tabControl, string activecontroal)
        {
            // TODO: Complete member initialization
            InitializeComponent();
            this.defaultSale = defaultSale;
            this.master      = master;
            this.tabControl  = tabControl;
            bindgroup();
            bindtaxtype();
            label11.Visible = false;
            pvc             = activecontroal;
        }
Esempio n. 9
0
 public PurchaseTypeEntry(DefaultSale defaultSale, Master master, TabControl tabControl, string activecontroal)
 {
     // TODO: Complete member initialization
     InitializeComponent();
     bindgroup();
     bindtaxtype();
     purchaseid       = 1;
     this.defaultSale = defaultSale;
     this.master      = master;
     this.tabControl  = tabControl;
     pvc = activecontroal;
 }
Esempio n. 10
0
 public ChargesHead(DefaultSale defaultSale, string p, Master master, TabControl tabControl, string activecontroal)
 {
     // TODO: Complete member initialization
     InitializeComponent();
     this.defaultSale = defaultSale;
     this.p           = p;
     this.master      = master;
     this.tabControl  = tabControl;
     pageLoad();
     pvc         = activecontroal;
     flagforbind = 1;
     bindchargeshead();
 }
Esempio n. 11
0
        public void setformstockout()
        {
            //this.Enabled = false;
            string[] strfinalarray = new string[lvstockout.Items.Count];
            if (lvstockout.Items[lvstockout.FocusedItem.Index].SubItems[1].Text == "S")
            {
                strfinalarray = new string[5] {
                    "S", "D", "Sale", "S", ""
                };
            }
            else if (lvstockout.Items[lvstockout.FocusedItem.Index].SubItems[1].Text == "P")
            {
                strfinalarray = new string[5] {
                    "P", "C", "Purchase", "P", ""
                };
            }
            else if (lvstockout.Items[lvstockout.FocusedItem.Index].SubItems[1].Text == "SC")
            {
                strfinalarray = new string[5] {
                    "SC", "D", "Sale Challan", "SC", ""
                };
            }
            else if (lvstockout.Items[lvstockout.FocusedItem.Index].SubItems[1].Text == "PR")
            {
                strfinalarray = new string[5] {
                    "PR", "D", "PurchaseReturn", "PR", ""
                };
            }
            String           str = lvstockout.Items[lvstockout.FocusedItem.Index].SubItems[2].Text;
            DataTable        dt1 = conn.getdataset("select * from FormFormat where isactive=1 and type='" + strfinalarray[0] + "' and setdefault=1");
            DefaultSale      bd  = new DefaultSale(this, master, tabControl, strfinalarray);
            DefaultSaleOrder bd1 = new DefaultSaleOrder(this, master, tabControl, strfinalarray);

            //  Sale p = new Sale(this, master, tabControl);
            if (dt1.Rows[0]["formname"].ToString() == bd.Text)
            {
                bd.updatemode(str, lvstockout.Items[lvstockout.FocusedItem.Index].SubItems[2].Text, Convert.ToInt32(lvstockout.Items[lvstockout.FocusedItem.Index].SubItems[10].Text), strfinalarray);
                master.AddNewTab(bd);
            }
            else if (dt1.Rows[0]["formname"].ToString() == bd1.Text)
            {
                bd1.updatemode(str, lvstockout.Items[lvstockout.FocusedItem.Index].SubItems[2].Text, Convert.ToInt32(lvstockout.Items[lvstockout.FocusedItem.Index].SubItems[10].Text), strfinalarray);
                master.AddNewTab(bd1);
            }
        }
Esempio n. 12
0
 private void btnplace_Click(object sender, EventArgs e)
 {
     try
     {
         string[] strfinalarray = new string[5] {
             "P", "C", "Purchase", "P", ""
         };
         DataTable   dt1 = conn.getdataset("select * from FormFormat where isactive=1 and type='" + strfinalarray[0] + "' and setdefault=1");
         DefaultSale bd  = new DefaultSale(master, tabControl, strfinalarray);
         if (dt1.Rows[0]["formname"].ToString() == bd.Text)
         {
             master.AddNewTab(bd);
         }
     }
     catch
     {
     }
 }
        public void open()
        {
            if (LVledger.Items[LVledger.FocusedItem.Index].SubItems[1].Text == "Sale")
            {
                string[] strfinalarray = new string[5] {
                    "S", "D", "Sale", "", ""
                };
                string billno = LVledger.Items[LVledger.FocusedItem.Index].SubItems[2].Text.Remove(0, 9);

                String      str = LVledger.Items[LVledger.FocusedItem.Index].SubItems[0].Text;
                DataTable   dt1 = conn.getdataset("select * from FormFormat where isactive=1 and type='" + strfinalarray[0] + "' and setdefault=1");
                DefaultSale bd  = new DefaultSale(this, master, tabControl, strfinalarray);
                //   Sale p = new Sale(this, master, tabControl);
                if (dt1.Rows[0]["formname"].ToString() == bd.Text)
                {
                    bd.updatemode(str, billno, 1, strfinalarray);
                    //bd.MdiParent = this.MdiParent;
                    //bd.StartPosition = FormStartPosition.CenterScreen;
                    //bd.Show();
                    master.AddNewTab(bd);
                }
                //else if (dt1.Rows[0]["formname"].ToString() == p.Text)
                //{
                //    p.updatemode(str, mouseclickid.Rows[LVledger.FocusedItem.Index][1].ToString(), 1);
                //    //p.MdiParent = this.MdiParent;
                //    //p.StartPosition = FormStartPosition.CenterScreen;
                //    //p.Show();
                //    master.AddNewTab(p);
                //}



                bd.Show();
            }
            else if (LVledger.Items[LVledger.FocusedItem.Index].SubItems[1].Text == "Sale Return")
            {
                string[] strfinalarray = new string[5] {
                    "SR", "C", "Sale Return", "SR", ""
                };
                string billno = LVledger.Items[LVledger.FocusedItem.Index].SubItems[2].Text.Remove(0, 9);

                String      str = LVledger.Items[LVledger.FocusedItem.Index].SubItems[0].Text;
                DataTable   dt1 = conn.getdataset("select * from FormFormat where isactive=1 and type='" + strfinalarray[0] + "' and setdefault=1");
                DefaultSale bd  = new DefaultSale(this, master, tabControl, strfinalarray);
                //    Sale p = new Sale(this, master, tabControl);
                if (dt1.Rows[0]["formname"].ToString() == bd.Text)
                {
                    bd.updatemode(str, billno, 1, strfinalarray);
                    //bd.MdiParent = this.MdiParent;
                    //bd.StartPosition = FormStartPosition.CenterScreen;
                    //bd.Show();
                    master.AddNewTab(bd);
                }
                //else if (dt1.Rows[0]["formname"].ToString() == p.Text)
                //{
                //    p.updatemode(str, mouseclickid.Rows[LVledger.FocusedItem.Index][1].ToString(), 1);
                //    //p.MdiParent = this.MdiParent;
                //    //p.StartPosition = FormStartPosition.CenterScreen;
                //    //p.Show();
                //    master.AddNewTab(p);
                //}



                //  bd.Show();
            }
            else if (LVledger.Items[LVledger.FocusedItem.Index].SubItems[1].Text == "Purchase")
            {
                string[] strfinalarray = new string[5] {
                    "P", "C", "Purchase", "", ""
                };
                string    billno = LVledger.Items[LVledger.FocusedItem.Index].SubItems[2].Text.Remove(0, 9);
                String    str    = LVledger.Items[LVledger.FocusedItem.Index].SubItems[0].Text;
                DataTable dt1    = conn.getdataset("select * from FormFormat where isactive=1 and type='" + strfinalarray[0] + "' and setdefault=1");
                //DefaultPurchase frm = new DefaultPurchase(this);
                DefaultSale bd = new DefaultSale(this, master, tabControl, strfinalarray);
                //   Purchase p = new Purchase(this, master, tabControl);
                if (dt1.Rows[0]["formname"].ToString() == bd.Text)
                {
                    bd.updatemode(str, billno, 1, strfinalarray);
                    //bd.MdiParent = this.MdiParent;
                    //bd.StartPosition = FormStartPosition.CenterScreen;
                    //bd.Show();
                    master.AddNewTab(bd);
                }
                //else if (dt1.Rows[0]["formname"].ToString() == p.Text)
                //{
                //    p.updatemode(str, mouseclickid.Rows[LVledger.FocusedItem.Index][1].ToString(), 1);
                //    //p.MdiParent = this.MdiParent;
                //    //p.StartPosition = FormStartPosition.CenterScreen;
                //    //p.Show();
                //    master.AddNewTab(p);
                //}

                //    DefaultPurchase bd = new DefaultPurchase(this);

                //  bd.Show();
            }
            else if (LVledger.Items[LVledger.FocusedItem.Index].SubItems[1].Text == "Purchase Return")
            {
                string[] strfinalarray = new string[5] {
                    "PR", "D", "Purchase Return", "PR", ""
                };
                string    billno = LVledger.Items[LVledger.FocusedItem.Index].SubItems[2].Text.Remove(0, 9);
                String    str    = LVledger.Items[LVledger.FocusedItem.Index].SubItems[0].Text;
                DataTable dt1    = conn.getdataset("select * from FormFormat where isactive=1 and type='" + strfinalarray[0] + "' and setdefault=1");
                //DefaultPurchase frm = new DefaultPurchase(this);
                DefaultSale bd = new DefaultSale(this, master, tabControl, strfinalarray);
                //Purchase p = new Purchase(this, master, tabControl);
                if (dt1.Rows[0]["formname"].ToString() == bd.Text)
                {
                    bd.updatemode(str, billno, 1, strfinalarray);
                    //bd.MdiParent = this.MdiParent;
                    //bd.StartPosition = FormStartPosition.CenterScreen;
                    //bd.Show();
                    master.AddNewTab(bd);
                }
                //else if (dt1.Rows[0]["formname"].ToString() == p.Text)
                //{
                //    p.updatemode(str, mouseclickid.Rows[LVledger.FocusedItem.Index][1].ToString(), 1);
                //    //p.MdiParent = this.MdiParent;
                //    //p.StartPosition = FormStartPosition.CenterScreen;
                //    //p.Show();
                //    master.AddNewTab(p);
                //}
            }
            else if (LVledger.Items[LVledger.FocusedItem.Index].SubItems[1].Text == "Rect")
            {
                String str = LVledger.Items[LVledger.FocusedItem.Index].SubItems[2].Text;

                QReceipt bd = new QReceipt();
                bd.updatemode(str, mouseclickid.Rows[LVledger.FocusedItem.Index][1].ToString(), 1, LVledger.Items[LVledger.FocusedItem.Index].SubItems[0].Text);
                bd.Show();
            }
            else if (LVledger.Items[LVledger.FocusedItem.Index].SubItems[1].Text == "Pmnt")
            {
                String str = LVledger.Items[LVledger.FocusedItem.Index].SubItems[2].Text;

                QPayment bd = new QPayment();
                bd.updatemode(str, mouseclickid.Rows[LVledger.FocusedItem.Index][1].ToString(), 1, LVledger.Items[LVledger.FocusedItem.Index].SubItems[0].Text);
                bd.Show();
            }
        }
 private void BtnViewReport_Click(object sender, EventArgs e)
 {
     try
     {
         // strfinalarray = new string[LVDayBook.CheckedItems.Count];
         for (int i = 0; i < LVDayBook.Items.Count; i++)
         {
             if (Convert.ToBoolean(LVDayBook.Items[i].Checked) == true)
             {
                 if (LVDayBook.Items[i].SubItems[1].Text == "Sale")
                 {
                     rewritedata = "True";
                     string[] strfinalarray = new string[5] {
                         "S", "D", "Sale", "S", ""
                     };
                     DataTable dt = conn.getdataset("select b.billno, b.bill_date, b.po_no, c.accountname,b.refno,b.totalcharges,b.totalbasic,sum(b.totaltax + isnull(bc.sgst,0)+isnull(bc.cgst,0)+isnull(bc.igst,0)) as totaltax,b.totalnet,c.GstNo,b.cgatamt,b.sgstamt,b.ClientID from billmaster b left join Billchargesmaster bc on bc.billno=b.billno and bc.isactive=1 inner join clientmaster c on c.clientid=b.clientid  where c.isactive=1 and b.isactive=1 and b.BillType='" + strfinalarray[0] + "' and b.Bill_Date>='" + Convert.ToDateTime(DTPFrom.Text).ToString(Master.dateformate) + "' and b.Bill_Date<='" + Convert.ToDateTime(DTPTo.Text).ToString(Master.dateformate) + "'group by b.billno, b.bill_date, b.po_no, c.accountname,b.refno,b.totalcharges,b.totalbasic,b.totalnet,c.GstNo,b.cgatamt,b.sgstamt,b.clientID order by b.bill_date asc");
                     for (int j = 0; j < dt.Rows.Count; j++)
                     {
                         try
                         {
                             String      str = dt.Rows[j]["billno"].ToString();
                             DataTable   dt1 = conn.getdataset("select * from FormFormat where isactive=1 and type='" + strfinalarray[0] + "' and setdefault=1");
                             DefaultSale bd  = new DefaultSale(master, tabControl, strfinalarray);
                             //  Sale p = new Sale(this, master, tabControl);
                             if (dt1.Rows[0]["formname"].ToString() == bd.Text)
                             {
                                 bd.updatemode(str, dt.Rows[j]["billno"].ToString(), Convert.ToInt32(dt.Rows[j]["ClientID"].ToString()), strfinalarray);
                                 master.AddNewTab(bd);
                                 bd.BtnPayment_Click(sender, e);
                                 master.RemoveCurrentTab();
                             }
                         }
                         catch
                         {
                         }
                         finally
                         {
                         }
                     }
                 }
                 else if (LVDayBook.Items[i].SubItems[1].Text == "Sale Return")
                 {
                     rewritedata = "True";
                     string[] strfinalarray = new string[5] {
                         "SR", "C", "SaleReturn", "SR", ""
                     };
                     DataTable dt = conn.getdataset("select b.billno, b.bill_date, b.po_no, c.accountname,b.refno,b.totalcharges,b.totalbasic,sum(b.totaltax + isnull(bc.sgst,0)+isnull(bc.cgst,0)+isnull(bc.igst,0)) as totaltax,b.totalnet,c.GstNo,b.cgatamt,b.sgstamt from billmaster b left join Billchargesmaster bc on bc.billno=b.billno and bc.isactive=1 inner join clientmaster c on c.clientid=b.clientid  where c.isactive=1 and b.isactive=1 and b.BillType='" + strfinalarray[0] + "' and b.Bill_Date>='" + Convert.ToDateTime(DTPFrom.Text).ToString(Master.dateformate) + "' and b.Bill_Date<='" + Convert.ToDateTime(DTPTo.Text).ToString(Master.dateformate) + "'group by b.billno, b.bill_date, b.po_no, c.accountname,b.refno,b.totalcharges,b.totalbasic,b.totalnet,c.GstNo,b.cgatamt,b.sgstamt order by b.bill_date asc");
                     for (int j = 0; j < dt.Rows.Count; j++)
                     {
                         try
                         {
                             String      str = dt.Rows[j]["billno"].ToString();
                             DataTable   dt1 = conn.getdataset("select * from FormFormat where isactive=1 and type='" + strfinalarray[0] + "' and setdefault=1");
                             DefaultSale bd  = new DefaultSale(master, tabControl, strfinalarray);
                             //  Sale p = new Sale(this, master, tabControl);
                             if (dt1.Rows[0]["formname"].ToString() == bd.Text)
                             {
                                 bd.updatemode(str, dt.Rows[j]["billno"].ToString(), 1, strfinalarray);
                                 master.AddNewTab(bd);
                                 bd.BtnPayment_Click(sender, e);
                                 master.RemoveCurrentTab();
                             }
                         }
                         catch
                         {
                         }
                         finally
                         {
                         }
                     }
                 }
                 else if (LVDayBook.Items[i].SubItems[1].Text == "Sale Order")
                 {
                     rewritedata = "True";
                     string[] strfinalarray = new string[5] {
                         "SO", "D", "Sale Order", "SO", ""
                     };
                     DataTable dt = conn.getdataset("select b.billno, b.bill_date, b.po_no, c.accountname,b.refno,b.totalcharges,b.totalbasic,sum(b.totaltax + isnull(bc.sgst,0)+isnull(bc.cgst,0)+isnull(bc.igst,0)) as totaltax,b.totalnet,c.GstNo,b.cgatamt,b.sgstamt from SaleOrderMaster b left join SaleOrderchargesmaster bc on bc.billno=b.billno and bc.isactive=1 inner join clientmaster c on c.clientid=b.clientid  where c.isactive=1 and b.isactive=1 and b.BillType='" + strfinalarray[0] + "' and b.Bill_Date>='" + Convert.ToDateTime(DTPFrom.Text).ToString(Master.dateformate) + "' and b.Bill_Date<='" + Convert.ToDateTime(DTPTo.Text).ToString(Master.dateformate) + "'group by b.billno, b.bill_date, b.po_no, c.accountname,b.refno,b.totalcharges,b.totalbasic,b.totalnet,c.GstNo,b.cgatamt,b.sgstamt order by b.bill_date asc");
                     for (int j = 0; j < dt.Rows.Count; j++)
                     {
                         try
                         {
                             String           str = dt.Rows[j]["billno"].ToString();
                             DataTable        dt1 = conn.getdataset("select * from FormFormat where isactive=1 and type='" + strfinalarray[0] + "' and setdefault=1");
                             DefaultSaleOrder bd  = new DefaultSaleOrder(master, tabControl, strfinalarray);
                             //  Sale p = new Sale(this, master, tabControl);
                             if (dt1.Rows[0]["formname"].ToString() == bd.Text)
                             {
                                 bd.updatemode(str, dt.Rows[j]["billno"].ToString(), 1, strfinalarray);
                                 master.AddNewTab(bd);
                                 bd.BtnPayment_Click(sender, e);
                                 master.RemoveCurrentTab();
                             }
                         }
                         catch
                         {
                         }
                         finally
                         {
                         }
                     }
                 }
                 else if (LVDayBook.Items[i].SubItems[1].Text == "Sale Challan")
                 {
                     rewritedata = "True";
                     string[] strfinalarray = new string[5] {
                         "SC", "D", "Sale Challan", "SC", ""
                     };
                     DataTable dt = conn.getdataset("select b.billno, b.bill_date, b.po_no, c.accountname,b.refno,b.totalcharges,b.totalbasic,sum(b.totaltax + isnull(bc.sgst,0)+isnull(bc.cgst,0)+isnull(bc.igst,0)) as totaltax,b.totalnet,c.GstNo,b.cgatamt,b.sgstamt from SaleOrderMaster b left join SaleOrderchargesmaster bc on bc.billno=b.billno and bc.isactive=1 inner join clientmaster c on c.clientid=b.clientid  where c.isactive=1 and b.isactive=1 and b.BillType='" + strfinalarray[0] + "' and b.Bill_Date>='" + Convert.ToDateTime(DTPFrom.Text).ToString(Master.dateformate) + "' and b.Bill_Date<='" + Convert.ToDateTime(DTPTo.Text).ToString(Master.dateformate) + "'group by b.billno, b.bill_date, b.po_no, c.accountname,b.refno,b.totalcharges,b.totalbasic,b.totalnet,c.GstNo,b.cgatamt,b.sgstamt order by b.bill_date asc");
                     for (int j = 0; j < dt.Rows.Count; j++)
                     {
                         try
                         {
                             String           str = dt.Rows[j]["billno"].ToString();
                             DataTable        dt1 = conn.getdataset("select * from FormFormat where isactive=1 and type='" + strfinalarray[0] + "' and setdefault=1");
                             DefaultSaleOrder bd  = new DefaultSaleOrder(master, tabControl, strfinalarray);
                             //  Sale p = new Sale(this, master, tabControl);
                             if (dt1.Rows[0]["formname"].ToString() == bd.Text)
                             {
                                 bd.updatemode(str, dt.Rows[j]["billno"].ToString(), 1, strfinalarray);
                                 master.AddNewTab(bd);
                                 bd.BtnPayment_Click(sender, e);
                                 master.RemoveCurrentTab();
                             }
                         }
                         catch
                         {
                         }
                         finally
                         {
                         }
                     }
                 }
                 else if (LVDayBook.Items[i].SubItems[1].Text == "Purchase")
                 {
                     rewritedata = "True";
                     string[] strfinalarray = new string[5] {
                         "P", "C", "Purchase", "P", ""
                     };
                     DataTable dt = conn.getdataset("select b.billno, b.bill_date, b.po_no, c.accountname,b.refno,b.totalcharges,b.totalbasic,sum(b.totaltax + isnull(bc.sgst,0)+isnull(bc.cgst,0)+isnull(bc.igst,0)) as totaltax,b.totalnet,c.GstNo,b.cgatamt,b.sgstamt,b.clientID from billmaster b left join Billchargesmaster bc on bc.billno=b.billno and bc.isactive=1 inner join clientmaster c on c.clientid=b.clientid  where c.isactive=1 and b.isactive=1 and b.BillType='" + strfinalarray[0] + "' and b.Bill_Date>='" + Convert.ToDateTime(DTPFrom.Text).ToString(Master.dateformate) + "' and b.Bill_Date<='" + Convert.ToDateTime(DTPTo.Text).ToString(Master.dateformate) + "'group by b.billno, b.bill_date, b.po_no, c.accountname,b.refno,b.totalcharges,b.totalbasic,b.totalnet,c.GstNo,b.cgatamt,b.sgstamt,b.clientID order by b.bill_date asc");
                     for (int j = 0; j < dt.Rows.Count; j++)
                     {
                         try
                         {
                             String      str = dt.Rows[j]["billno"].ToString();
                             DataTable   dt1 = conn.getdataset("select * from FormFormat where isactive=1 and type='" + strfinalarray[0] + "' and setdefault=1");
                             DefaultSale bd  = new DefaultSale(master, tabControl, strfinalarray);
                             //  Sale p = new Sale(this, master, tabControl);
                             if (dt1.Rows[0]["formname"].ToString() == bd.Text)
                             {
                                 bd.updatemode(str, dt.Rows[j]["billno"].ToString(), Convert.ToInt32(dt.Rows[j]["ClientID"].ToString()), strfinalarray);
                                 master.AddNewTab(bd);
                                 bd.BtnPayment_Click(sender, e);
                                 master.RemoveCurrentTab();
                             }
                         }
                         catch
                         {
                         }
                         finally
                         {
                         }
                     }
                 }
                 else if (LVDayBook.Items[i].SubItems[1].Text == "Purchase Return")
                 {
                     rewritedata = "True";
                     string[] strfinalarray = new string[5] {
                         "PR", "D", "PurchaseReturn", "PR", ""
                     };
                     DataTable dt = conn.getdataset("select b.billno, b.bill_date, b.po_no, c.accountname,b.refno,b.totalcharges,b.totalbasic,sum(b.totaltax + isnull(bc.sgst,0)+isnull(bc.cgst,0)+isnull(bc.igst,0)) as totaltax,b.totalnet,c.GstNo,b.cgatamt,b.sgstamt from billmaster b left join Billchargesmaster bc on bc.billno=b.billno and bc.isactive=1 inner join clientmaster c on c.clientid=b.clientid  where c.isactive=1 and b.isactive=1 and b.BillType='" + strfinalarray[0] + "' and b.Bill_Date>='" + Convert.ToDateTime(DTPFrom.Text).ToString(Master.dateformate) + "' and b.Bill_Date<='" + Convert.ToDateTime(DTPTo.Text).ToString(Master.dateformate) + "'group by b.billno, b.bill_date, b.po_no, c.accountname,b.refno,b.totalcharges,b.totalbasic,b.totalnet,c.GstNo,b.cgatamt,b.sgstamt order by b.bill_date asc");
                     for (int j = 0; j < dt.Rows.Count; j++)
                     {
                         try
                         {
                             String      str = dt.Rows[j]["billno"].ToString();
                             DataTable   dt1 = conn.getdataset("select * from FormFormat where isactive=1 and type='" + strfinalarray[0] + "' and setdefault=1");
                             DefaultSale bd  = new DefaultSale(master, tabControl, strfinalarray);
                             //  Sale p = new Sale(this, master, tabControl);
                             if (dt1.Rows[0]["formname"].ToString() == bd.Text)
                             {
                                 bd.updatemode(str, dt.Rows[j]["billno"].ToString(), 1, strfinalarray);
                                 master.AddNewTab(bd);
                                 bd.BtnPayment_Click(sender, e);
                                 master.RemoveCurrentTab();
                             }
                         }
                         catch
                         {
                         }
                         finally
                         {
                         }
                     }
                 }
                 else if (LVDayBook.Items[i].SubItems[1].Text == "Purchase Order")
                 {
                     rewritedata = "True";
                     string[] strfinalarray = new string[5] {
                         "PO", "C", "Purchase Order", "PO", ""
                     };
                     DataTable dt = conn.getdataset("select b.billno, b.bill_date, b.po_no, c.accountname,b.refno,b.totalcharges,b.totalbasic,sum(b.totaltax + isnull(bc.sgst,0)+isnull(bc.cgst,0)+isnull(bc.igst,0)) as totaltax,b.totalnet,c.GstNo,b.cgatamt,b.sgstamt from SaleOrderMaster b left join SaleOrderchargesmaster bc on bc.billno=b.billno and bc.isactive=1 inner join clientmaster c on c.clientid=b.clientid  where c.isactive=1 and b.isactive=1 and b.BillType='" + strfinalarray[0] + "' and b.Bill_Date>='" + Convert.ToDateTime(DTPFrom.Text).ToString(Master.dateformate) + "' and b.Bill_Date<='" + Convert.ToDateTime(DTPTo.Text).ToString(Master.dateformate) + "'group by b.billno, b.bill_date, b.po_no, c.accountname,b.refno,b.totalcharges,b.totalbasic,b.totalnet,c.GstNo,b.cgatamt,b.sgstamt order by b.bill_date asc");
                     for (int j = 0; j < dt.Rows.Count; j++)
                     {
                         try
                         {
                             String           str = dt.Rows[j]["billno"].ToString();
                             DataTable        dt1 = conn.getdataset("select * from FormFormat where isactive=1 and type='" + strfinalarray[0] + "' and setdefault=1");
                             DefaultSaleOrder bd  = new DefaultSaleOrder(master, tabControl, strfinalarray);
                             //  Sale p = new Sale(this, master, tabControl);
                             if (dt1.Rows[0]["formname"].ToString() == bd.Text)
                             {
                                 bd.updatemode(str, dt.Rows[j]["billno"].ToString(), 1, strfinalarray);
                                 master.AddNewTab(bd);
                                 bd.BtnPayment_Click(sender, e);
                                 master.RemoveCurrentTab();
                             }
                         }
                         catch
                         {
                         }
                         finally
                         {
                         }
                     }
                 }
                 else if (LVDayBook.Items[i].SubItems[1].Text == "Purchase Challan")
                 {
                     rewritedata = "True";
                     string[] strfinalarray = new string[5] {
                         "PC", "C", "Purchase Challan", "PC", ""
                     };
                     DataTable dt = conn.getdataset("select b.billno, b.bill_date, b.po_no, c.accountname,b.refno,b.totalcharges,b.totalbasic,sum(b.totaltax + isnull(bc.sgst,0)+isnull(bc.cgst,0)+isnull(bc.igst,0)) as totaltax,b.totalnet,c.GstNo,b.cgatamt,b.sgstamt from SaleOrderMaster b left join SaleOrderchargesmaster bc on bc.billno=b.billno and bc.isactive=1 inner join clientmaster c on c.clientid=b.clientid  where c.isactive=1 and b.isactive=1 and b.BillType='" + strfinalarray[0] + "' and b.Bill_Date>='" + Convert.ToDateTime(DTPFrom.Text).ToString(Master.dateformate) + "' and b.Bill_Date<='" + Convert.ToDateTime(DTPTo.Text).ToString(Master.dateformate) + "'group by b.billno, b.bill_date, b.po_no, c.accountname,b.refno,b.totalcharges,b.totalbasic,b.totalnet,c.GstNo,b.cgatamt,b.sgstamt order by b.bill_date asc");
                     for (int j = 0; j < dt.Rows.Count; j++)
                     {
                         try
                         {
                             String           str = dt.Rows[j]["billno"].ToString();
                             DataTable        dt1 = conn.getdataset("select * from FormFormat where isactive=1 and type='" + strfinalarray[0] + "' and setdefault=1");
                             DefaultSaleOrder bd  = new DefaultSaleOrder(master, tabControl, strfinalarray);
                             //  Sale p = new Sale(this, master, tabControl);
                             if (dt1.Rows[0]["formname"].ToString() == bd.Text)
                             {
                                 bd.updatemode(str, dt.Rows[j]["billno"].ToString(), 1, strfinalarray);
                                 master.AddNewTab(bd);
                                 bd.BtnPayment_Click(sender, e);
                                 master.RemoveCurrentTab();
                             }
                         }
                         catch
                         {
                         }
                         finally
                         {
                         }
                     }
                 }
             }
         }
     }
     catch
     {
     }
 }