Example #1
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            CreditNoteModel objcredit = new CreditNoteModel();

            if (tbxVoucherNumber.Text.Trim() == "")
            {
                MessageBox.Show("Voucher Number Can Not Be Blank!");
                return;
            }
            objcredit.Voucher_Series = tbxVoucherSeries.Text.Trim() == null ? string.Empty : tbxVoucherSeries.Text.Trim();
            objcredit.Voucher_Number = Convert.ToInt32(tbxVoucherNumber.Text.Trim());
            objcredit.CN_Date        = Convert.ToDateTime(dtDate.Text);
            objcredit.Type           = tbxType.Text.Trim();
            objcredit.PDCDate        = Convert.ToDateTime(dtPDCDate.Text);
            objcredit.Narration      = tbxLogNarration.Text.Trim();

            objcredit.TotalCreditAmt = Convert.ToDecimal(colCredit.SummaryItem.SummaryValue);
            objcredit.TotalDebitAmt  = Convert.ToDecimal(colDebit.SummaryItem.SummaryValue);

            //Credit Note Account details
            AccountModel        objacc;
            List <AccountModel> lstAccounts = new List <AccountModel>();

            for (int i = 0; i < gdvCredit.DataRowCount; i++)
            {
                DataRow row = gdvCredit.GetDataRow(i);

                objacc           = new AccountModel();
                objacc.DC        = row["DC"].ToString();
                objacc.Account   = row["Account"].ToString() == null ? string.Empty : row["Account"].ToString();
                objacc.LedgerId  = objAccBL.GetLedgerIdByAccountName(row["Account"].ToString() == null ? string.Empty : row["Account"].ToString());
                objacc.Debit     = row["Debit"].ToString().Length > 0 ? Convert.ToDecimal(row["Debit"].ToString()) : 0;
                objacc.Credit    = row["Credit"].ToString().Length > 0 ? Convert.ToDecimal(row["Credit"].ToString()) : 0;
                objacc.Narration = row["Narration"].ToString() == null ? string.Empty : row["Narration"].ToString();
                objacc.AC_Id     = row["AC_Id"].ToString().Length > 0 ? Convert.ToInt32(row["AC_Id"].ToString()) : 0;
                objacc.ParentId  = row["ParentId"].ToString().Length > 0 ? Convert.ToInt32(row["ParentId"].ToString()) : 0;
                lstAccounts.Add(objacc);
            }

            objcredit.CreditAccountModel = lstAccounts;
            objcredit.CN_Id = CNId;

            bool isSuccess = objBl.UpdateCreditNote(objcredit);

            if (isSuccess)
            {
                MessageBox.Show("Update Successfully!");
                CNId = 0;
                ClearControls();
                Transaction.List.CreditNotesList frmList = new Transaction.List.CreditNotesList();
                frmList.StartPosition = FormStartPosition.CenterScreen;

                frmList.ShowDialog();

                FillCreditNote();
            }
        }
Example #2
0
        private void btnList_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            Transaction.List.CreditNotesList frmList = new Transaction.List.CreditNotesList();
            frmList.StartPosition = FormStartPosition.CenterScreen;

            frmList.ShowDialog();

            FillCreditNote();
        }
Example #3
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            bool isDelete = objBl.DeleteCreditNote(CNId);

            if (isDelete)
            {
                MessageBox.Show("Delete Successfully!");
                CNId = 0;
                ClearControls();
                Transaction.List.CreditNotesList frmList = new Transaction.List.CreditNotesList();
                frmList.StartPosition = FormStartPosition.CenterScreen;

                frmList.ShowDialog();

                FillCreditNote();
            }
        }