private void btnReceiptList_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e) { Transaction.List.ReceiptVouchersList frmList = new Transaction.List.ReceiptVouchersList(); frmList.StartPosition = FormStartPosition.CenterScreen; frmList.ShowDialog(); FillRecieptVoucherInfo(); }
private void btnUpdate_Click(object sender, EventArgs e) { RecieptVoucherModel objRecipt = new RecieptVoucherModel(); if (tbxVchNumber.Text.Trim() == "") { MessageBox.Show("Voucher Number Can Not Be Blank!"); return; } objRecipt.Voucher_Series = tbxVoucherSeries.Text.Trim(); objRecipt.Voucher_Number = Convert.ToInt32(tbxVchNumber.Text.Trim()); objRecipt.RV_Date = Convert.ToDateTime(dtDate.Text); objRecipt.Type = tbxType.Text.Trim(); objRecipt.PDCDate = Convert.ToDateTime(dtPDCDate.Text); objRecipt.LongNarration = tbxLongNarration.Text.Trim() == null ? string.Empty : tbxLongNarration.Text.Trim(); if (objRecipt.LedgerId == 0) { objRecipt.TotalDebitAmt = Convert.ToDecimal(colDebit.SummaryItem.SummaryValue); objRecipt.TotalCreditAmt = Convert.ToDecimal(colCredit.SummaryItem.SummaryValue); } else { objRecipt.TotalDebitAmt = Convert.ToDecimal(colCredit.SummaryItem.SummaryValue); } //Receipt Account Details AccountModel objacc; List <AccountModel> lstAccounts = new List <AccountModel>(); for (int i = 0; i < gdvReceipt.DataRowCount; i++) { DataRow row = gdvReceipt.GetDataRow(i); objacc = new AccountModel(); objacc.ParentId = Convert.ToInt32(row["ParentId"].ToString() == string.Empty?"0": row["ParentId"]); objacc.AC_Id = Convert.ToInt32(row["Ac_Id"].ToString() == string.Empty ? "0" : row["Ac_Id"]); objacc.DC = row["DC"].ToString(); objacc.Account = row["Account"].ToString(); objacc.LedgerId = objAccBL.GetLedgerIdByAccountName(row["Account"].ToString()); if (objRecipt.LedgerId == 0) { objacc.Debit = Convert.ToDecimal(row["Debit"].ToString() == string.Empty ? "0.00" : row["Debit"]); objacc.Credit = Convert.ToDecimal(row["Credit"].ToString() == string.Empty ? "0.00" : row["Credit"]); } else { objacc.Credit = Convert.ToDecimal(row["Credit"].ToString() == string.Empty ? "0.00" : row["Credit"]); } objacc.Narration = row["Narration"].ToString() == string.Empty ?string.Empty : row["Narration"].ToString(); lstAccounts.Add(objacc); } objRecipt.RecieptAccountModel = lstAccounts; objRecipt.RV_Id = Recpt_Id; bool isSuccess = objRecBL.UpdateRecieptVoucher(objRecipt); if (isSuccess) { MessageBox.Show("Update Successfully!"); Recpt_Id = 0; ClearFormValues(); Transaction.List.ReceiptVouchersList frmList = new Transaction.List.ReceiptVouchersList(); frmList.StartPosition = FormStartPosition.CenterScreen; frmList.ShowDialog(); FillRecieptVoucherInfo(); } }