Ejemplo n.º 1
0
        private void btndelete_Click(object sender, EventArgs e)
        {
            DialogResult dr = MessageBox.Show("Do you want to Delete Bill?", "Bill", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (dr == DialogResult.Yes)
            {
                getcon();
                if (con.State == ConnectionState.Open)
                {
                    con.Close();
                }
                con.Open();
                //SqlCommand cmd = new SqlCommand("update PurchaseOrderMaster set isactive=0  where VchNo='" + txtVchNo.Text + "' and CompanyId=" + compid + "", con);
                //cmd.ExecuteNonQuery();
                string     qry = "update PurchaseOrderMaster set isactive=0  where VchNo='" + txtVchNo.Text + "' and CompanyId=" + compid + "";
                SqlCommand cmd = new SqlCommand(qry, con);
                LogGenerator.Info(qry);
                cmd.ExecuteNonQuery();
                lcon.execute("Insert into sync values('" + qry.Replace("'", "\"") + "')");
                SqlCommand cmd2 = new SqlCommand("update PurchaseOrderProductMaster set isactive=0 where VchNo='" + txtVchNo.Text + "'and CompanyId=" + compid, con);
                cmd2.ExecuteNonQuery();
                string qry1 = "update PurchaseOrderProductMaster set isactive=0 where VchNo='" + txtVchNo.Text + "' and CompanyId=" + compid + "";
                lcon.execute("Insert into sync values('" + qry1.Replace("'", "\"") + "')");
                LogGenerator.Info(qry1);
                clearall();
                clearitem();
                LVFO.Clear();
                this.Close();
                DateWisePurchaseReport frm = new DateWisePurchaseReport();
                frm.MdiParent     = this.MdiParent;
                frm.StartPosition = FormStartPosition.CenterScreen;
                frm.Show();
            }
            else
            {
                if (cmbPurchaseType.Text == "" || cmbCustName.Text == "" || cmbTerms.Text == "")
                {
                    MessageBox.Show("Please fill all the information.");
                    if (cmbPurchaseType.Text == "")
                    {
                        cmbPurchaseType.Focus();
                    }
                    else if (cmbCustName.Text == "")
                    {
                        cmbCustName.Focus();
                    }
                    else if (cmbTerms.Text == "")
                    {
                        cmbTerms.Focus();
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void btndelete_Click(object sender, EventArgs e)
        {
            DialogResult dr = MessageBox.Show("Do you want to Delete Purchase Return?", "Bill", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (dr == DialogResult.Yes)
            {
                getcon();
                if (con.State == ConnectionState.Open)
                {
                    con.Close();
                }
                con.Open();
                SqlCommand cmd = new SqlCommand("update billmaster set isactive=0  where Bill_No='" + txtVchNo.Text + "' and billtype='PR' and CompanyId=" + Master.companyId + "", con);
                cmd.ExecuteNonQuery();

                SqlCommand cmd2 = new SqlCommand("update billproductmaster set isactive=0 where Bill_No='" + txtVchNo.Text + "' and BillType='PR'", con);
                cmd2.ExecuteNonQuery();

                SqlCommand cmd1 = new SqlCommand("update Ledger set isactive=0 where VoucherId='" + txtVchNo.Text + "' and TranType='PurchaseReturn' and CompanyId=" + Master.companyId + "", con);
                cmd2.ExecuteNonQuery();
                clearall();
                clearitem();
                LVFO.Clear();
                this.Close();
                PurchaseReturnList frm = new PurchaseReturnList();
                frm.MdiParent     = this.MdiParent;
                frm.StartPosition = FormStartPosition.CenterScreen;
                frm.Show();
            }
            else
            {
                if (cmbPurchaseType.Text == "" || cmbCustName.Text == "" || cmbTerms.Text == "")
                {
                    MessageBox.Show("Please fill all the information.");
                    if (cmbPurchaseType.Text == "")
                    {
                        cmbPurchaseType.Focus();
                    }
                    else if (cmbCustName.Text == "")
                    {
                        cmbCustName.Focus();
                    }
                    else if (cmbTerms.Text == "")
                    {
                        cmbTerms.Focus();
                    }
                }
            }
        }
        public void binddata(string id)
        {
            ListViewItem li;

            LVFO.Items.Clear();
            dtcn = conn.getdataset("select * from ProductPriceMaster where isactive=1 and ProductID='" + id + "'");
            DataTable dtclient = new DataTable();

            if (dtcn != null && dtcn.Rows.Count > 0)
            {
                for (int i = 0; i < dtcn.Rows.Count; i++)
                {
                    li = LVFO.Items.Add(dtcn.Rows[i]["BatchNo"].ToString());
                    li.SubItems.Add(dtcn.Rows[i]["Barcode"].ToString());
                    li.SubItems.Add(dtcn.Rows[i]["SalePrice"].ToString());
                    li.SubItems.Add(dtcn.Rows[i]["MRP"].ToString());
                }
            }
            LVFO.Focus();
            LVFO.Items[0].Selected = true;
        }