예제 #1
0
        public void ledgerPostingAdd()
        {
            eSunSpeedDomain.LedgerPostingModel infoLedgerPosting = new eSunSpeedDomain.LedgerPostingModel();
            BillSundry_VoucherModel            objSaleBS;

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

                objSaleBS       = new BillSundry_VoucherModel();
                objSaleBS.BS_Id = objBSBL.GetBSIdByBSName(row["BillSundry"].ToString() == null ? string.Empty : row["BillSundry"].ToString());
                //objSaleBS.Percentage = Convert.ToDecimal(row["Percentage"].ToString() == string.Empty ? "0.00" : row["Percentage"].ToString());
                //objSaleBS.Extra = row["Extra"].ToString() == null ? string.Empty : row["Extra"].ToString();
                //objSaleBS.Amount = Convert.ToDecimal(row["Amount"].ToString() == string.Empty ? "0.00" : row["Amount"].ToString());
                BillSundryMasterModel objbs = objBSBL.GetAllBillSundryByName(row["BillSundry"].ToString() == null ? string.Empty : row["BillSundry"].ToString());
                if (objbs.SaleAdjustInSaleAmount == true && objbs.SaleAdjustInPartyAmount == true)
                {
                    //Party Debit Posting
                    infoLedgerPosting.VoucherTypeId = 1;
                    infoLedgerPosting.LedgerId      = Convert.ToDecimal(objAccBL.GetLedgerIdByAccountName(tbxParty.Text.Trim() == null ? string.Empty : tbxParty.Text.Trim()));
                    infoLedgerPosting.Debit         = Convert.ToDecimal((Convert.ToDecimal(colTaxAmont.SummaryItem.SummaryValue) + Convert.ToDecimal(Amount.SummaryItem.SummaryValue)) - (Convert.ToDecimal(BSAmount.SummaryItem.SummaryValue)));
                    infoLedgerPosting.Credit        = 0;
                    infoLedgerPosting.Date          = Convert.ToDateTime(dtDate.Text.ToString());
                    infoLedgerPosting.VoucherNo     = tbxVoucherNumber.Text.Trim();
                    infoLedgerPosting.InvoiceNo     = string.Empty;
                    infoLedgerPosting.YearId        = 1;
                    infoLedgerPosting.DetailsId     = 0;
                    infoLedgerPosting.ChequeNo      = string.Empty;
                    infoLedgerPosting.ChequeDate    = DateTime.Now;
                    infoLedgerPosting.Extra1        = string.Empty;
                    infoLedgerPosting.Extra2        = string.Empty;
                    objLPBL.LedgerPostingAdd(infoLedgerPosting);

                    //Sale Credit Posting
                    infoLedgerPosting.Debit         = 0;
                    infoLedgerPosting.Credit        = Convert.ToDecimal(Convert.ToDecimal(Amount.SummaryItem.SummaryValue) - Convert.ToDecimal(BSAmount.SummaryItem.SummaryValue));
                    infoLedgerPosting.Date          = Convert.ToDateTime(dtDate.Text.ToString());
                    infoLedgerPosting.VoucherTypeId = 1;
                    infoLedgerPosting.VoucherNo     = tbxVoucherNumber.Text.Trim();
                    infoLedgerPosting.InvoiceNo     = string.Empty;
                    infoLedgerPosting.LedgerId      = objStBL.GetSaleLedgerId(tbxSaleType.Text.Trim());
                    infoLedgerPosting.YearId        = 1;
                    infoLedgerPosting.DetailsId     = 0;
                    infoLedgerPosting.ChequeNo      = string.Empty;
                    infoLedgerPosting.ChequeDate    = DateTime.Now;
                    infoLedgerPosting.Extra1        = string.Empty;
                    infoLedgerPosting.Extra2        = string.Empty;
                    objLPBL.LedgerPostingAdd(infoLedgerPosting);
                    //Tax Credit Posting
                    infoLedgerPosting.Debit         = 0;
                    infoLedgerPosting.Credit        = Convert.ToDecimal(colTaxAmont.SummaryItem.SummaryValue);
                    infoLedgerPosting.Date          = Convert.ToDateTime(dtDate.Text.ToString());
                    infoLedgerPosting.VoucherTypeId = 1;
                    infoLedgerPosting.VoucherNo     = tbxVoucherNumber.Text.Trim();
                    infoLedgerPosting.InvoiceNo     = string.Empty;
                    infoLedgerPosting.LedgerId      = objStBL.GetTaxLedgerId(tbxSaleType.Text.Trim());
                    infoLedgerPosting.YearId        = 1;
                    infoLedgerPosting.DetailsId     = 0;
                    infoLedgerPosting.ChequeNo      = string.Empty;
                    infoLedgerPosting.ChequeDate    = DateTime.Now;
                    infoLedgerPosting.Extra1        = string.Empty;
                    infoLedgerPosting.Extra2        = string.Empty;
                    objLPBL.LedgerPostingAdd(infoLedgerPosting);

                    ////Discount Debit Posting
                    //infoLedgerPosting.Debit = Convert.ToDecimal(BSAmount.SummaryItem.SummaryValue);
                    //infoLedgerPosting.Credit = 0;
                    //infoLedgerPosting.Date = Convert.ToDateTime(dtDate.Text.ToString());
                    //infoLedgerPosting.VoucherTypeId = 1;
                    //infoLedgerPosting.VoucherNo = tbxVoucherNumber.Text.Trim();
                    //infoLedgerPosting.InvoiceNo = string.Empty;
                    //infoLedgerPosting.LedgerId = objBSBL.GetBSLedgerId(tbxSaleType.Text.Trim());
                    //infoLedgerPosting.YearId = 1;
                    //infoLedgerPosting.DetailsId = 0;
                    //infoLedgerPosting.ChequeNo = string.Empty;
                    //infoLedgerPosting.ChequeDate = DateTime.Now;
                    //infoLedgerPosting.Extra1 = string.Empty;
                    //infoLedgerPosting.Extra2 = string.Empty;
                    //objLPBL.LedgerPostingAdd(infoLedgerPosting);
                }
            }
        }