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 PurchaseReturn(PurchaseReturnList purchaseReturnList) { InitializeComponent(); this.purchaseReturnList = purchaseReturnList; }