private void btnSave_Click(object sender, EventArgs e) { PurRemainBL objPur = new PurRemainBL() { CompanyID = Convert.ToInt32(txtComID.Text), Date = Convert.ToDateTime(txtDate.Text), ReturnCash = Convert.ToDecimal(txtReturnCash.Text) }; objPur.Save(); PurchaseLedgerBL objLedger = new PurchaseLedgerBL(); if (string.IsNullOrEmpty(txtDescription.Text)) { objLedger.PRemainID = Convert.ToInt32(txtRemainID.Text); objLedger.CompanyID = Convert.ToInt32(txtComID.Text); objLedger.Credit = 0; objLedger.Debit = Convert.ToDecimal(txtReturnCash.Text); objLedger.Date = Convert.ToDateTime(txtDate.Text); objLedger.Balance = Convert.ToDecimal(txtNewBalance.Text); objLedger.Description = "Credit"; } else { objLedger.PRemainID = Convert.ToInt32(txtRemainID.Text); objLedger.CompanyID = Convert.ToInt32(txtComID.Text); objLedger.Credit = 0; objLedger.Debit = Convert.ToDecimal(txtReturnCash.Text); objLedger.Date = Convert.ToDateTime(txtDate.Text); objLedger.Balance = Convert.ToDecimal(txtNewBalance.Text); objLedger.Description = txtDescription.Text; } objLedger.save(); (new PurchaseLedgerBL()).UpdateBalance(objLedger.Balance, objLedger.CompanyID); MessageBox.Show("Payment Paid " + txtReturnCash.Text); PurRemainIDReport objrpt = new PurRemainIDReport(); objrpt.SetParameterValue("@RemainID", txtRemainID.Text); rptViewer objView = new rptViewer(); objView.crptViewer.ReportSource = objrpt; objView.WindowState = FormWindowState.Normal; objView.ShowDialog(); ClearGroup(); }
private void btnSave_Click(object sender, EventArgs e) { PurchaseReturnBL objUpdate = new PurchaseReturnBL(); { for (int i = 0; i < dgvReturnItem.Rows.Count; i++) { objUpdate.ProductID = Convert.ToInt32(dgvReturnItem.Rows[i].Cells[1].Value.ToString()); objUpdate.Quantity = Convert.ToInt32(dgvReturnItem.Rows[i].Cells[5].Value.ToString()); objUpdate.ProdUpdate(); } } PurchaseReturnBL objCtn = new PurchaseReturnBL(); { for (int i = 0; i < dgvReturnItem.Rows.Count; i++) { objCtn.ProductID = Convert.ToInt32(dgvReturnItem.Rows[i].Cells[1].Value.ToString()); objCtn.Ctn = Convert.ToDecimal(dgvReturnItem.Rows[i].Cells[4].Value.ToString()); objCtn.CtnUpdate(); } } PurchaseReturnBL objDetail = new PurchaseReturnBL(); { for (int i = 0; i < dgvReturnItem.Rows.Count; i++) { objDetail.PReturnID = Convert.ToInt32(txtReturnID.Text); objDetail.ProductID = Convert.ToInt32(dgvReturnItem.Rows[i].Cells[1].Value.ToString()); objDetail.TP = Convert.ToDecimal(dgvReturnItem.Rows[i].Cells[3].Value.ToString()); objDetail.Ctn = Convert.ToDecimal(dgvReturnItem.Rows[i].Cells[4].Value.ToString()); objDetail.Quantity = Convert.ToInt32(dgvReturnItem.Rows[i].Cells[5].Value.ToString()); objDetail.Amount = Convert.ToDecimal(dgvReturnItem.Rows[i].Cells[6].Value.ToString()); objDetail.SaveDetail(); } } if (txtBalance.Text != "0.00") { PurRemainBL objPurc = new PurRemainBL() { CompanyID = Convert.ToInt32(txtComID.Text), ReturnCash = Convert.ToDecimal(txtBalance.Text), Date = Convert.ToDateTime(txtReturnDate.Text), PReturnID = Convert.ToInt32(txtReturnID.Text) }; objPurc.Save(); } PurchaseReturnBL objMas = new PurchaseReturnBL() { PInvoice = Convert.ToInt32(txtInvoiceID.Text), CompanyID = Convert.ToInt32(txtComID.Text), Discount = Convert.ToDecimal(txtBillDiscount.Text), ReturnDate = DateTime.Parse(txtReturnDate.Text), TotalAmount = Convert.ToDecimal(txtGrandTotal.Text), ReturnCash = Convert.ToDecimal(txtReturnCash.Text), DuePayment = Convert.ToDecimal(txtBalance.Text), furDiscount = Convert.ToDecimal(txtfurDiscount.Text), GrandTotal = Convert.ToDecimal(txtGrandTotal.Text) }; objMas.SaveMaster(); PurchaseLedgerBL objLedger = new PurchaseLedgerBL(); objLedger.PReturnID = Convert.ToInt32(txtReturnID.Text); objLedger.CompanyID = Convert.ToInt32(txtComID.Text); objLedger.Credit = 0; objLedger.Debit = Convert.ToDecimal(txtBalance.Text); objLedger.Date = Convert.ToDateTime(txtReturnDate.Text); objLedger.Balance = Convert.ToDecimal(txtNewBalance.Text); objLedger.Description = "Credit"; objLedger.save(); (new PurchaseLedgerBL()).UpdateBalance(objLedger.Balance, objLedger.CompanyID); ClearForm(); btnNew.Enabled = true; // DesignClear(this); }