Exemple #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            DebitNoteModel objdebit = new DebitNoteModel();

            if (tbxVchNumber.Text.Trim() == "")
            {
                MessageBox.Show("Voucher Number Can Not Be Blank!");
                return;
            }

            objdebit.Voucher_Number    = Convert.ToInt32(tbxVchNumber.Text.Trim());
            objdebit.DN_Date           = Convert.ToDateTime(dtDate.Text);
            objdebit.Voucher_Series    = tbxVoucherSeries.Text.Trim();
            objdebit.Type              = cbxType.SelectedItem.ToString();
            objdebit.PDC_Date          = Convert.ToDateTime(dtPDC.Text);
            objdebit.LongNarration     = tbxLongNarratin.Text.Trim() == null ? string.Empty : tbxLongNarratin.Text.Trim();
            objdebit.TotalCreditAmount = Convert.ToDecimal(colCredit.SummaryItem.SummaryValue);
            objdebit.TotalDebitAmount  = Convert.ToDecimal(colDebit.SummaryItem.SummaryValue);
            //Debite Details
            AccountModel objDebit;

            List <AccountModel> lstDebitNotes = new List <AccountModel>();

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

                objDebit           = new AccountModel();
                objDebit.DC        = row["DC"].ToString();
                objDebit.Account   = row["Account"].ToString();
                objDebit.LedgerId  = objAccBL.GetLedgerIdByAccountName(row["Account"].ToString());
                objDebit.Debit     = row["Debit"].ToString().Length > 0 ? Convert.ToDecimal(row["Debit"].ToString()) : 0;
                objDebit.Credit    = row["Credit"].ToString().Length > 0 ?  Convert.ToDecimal(row["Credit"].ToString()):0;
                objDebit.Narration = row["Narration"].ToString() == null?string.Empty: row["Narration"].ToString();

                lstDebitNotes.Add(objDebit);
            }

            objdebit.DebitAccountModel = lstDebitNotes;

            bool isSuccess = objDNbl.SaveDebitNote(objdebit);

            if (isSuccess)
            {
                MessageBox.Show("Saved Successfully!");
                DNId = 0;
                ClearControls();
            }
        }
Exemple #2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            JournalVoucherModel objJVmodel = new JournalVoucherModel();

            if (tbxVchNo.Text.Trim() == "")
            {
                MessageBox.Show("Voucher Number Can Not Be Blank!");
                return;
            }
            objJVmodel.Voucher_Series = tbxVoucherSeries.Text.Trim();
            objJVmodel.JV_Date        = Convert.ToDateTime(dtDate.Text);
            objJVmodel.Type           = tbxType.Text.Trim() == null?string.Empty:tbxType.Text.Trim();
            objJVmodel.Voucher_Number = Convert.ToInt32(tbxVchNo.Text.Trim());
            objJVmodel.PDCDate        = Convert.ToDateTime(dtPDCDate.Text);
            objJVmodel.LongNarration  = tbxLongNarration.Text.Trim() == null ? string.Empty : tbxLongNarration.Text.Trim();
            objJVmodel.TotalCreditAmt = Convert.ToDecimal(colCredit.SummaryItem.SummaryValue);
            objJVmodel.TotalDebitAmt  = Convert.ToDecimal(colDebit.SummaryItem.SummaryValue);

            //Journal details
            AccountModel        objacc;
            List <AccountModel> lstAccounts = new List <AccountModel>();

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

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

            objJVmodel.JournalAccountModel = lstAccounts;

            bool isSuccess = objJVbal.SaveJournalVoucher(objJVmodel);

            if (isSuccess)
            {
                MessageBox.Show("Saved Successfully!");
                ClearFormValues();
            }
        }
Exemple #3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            ContraVoucherModel objcontra = new ContraVoucherModel();

            if (tbxVoucherNo.Text.Trim() == "")
            {
                MessageBox.Show("Voucher Number Can Not Be Blank!");
                return;
            }
            objcontra.Voucher_Series    = tbxVoucherSeries.SelectedItem.ToString();
            objcontra.Voucher_Number    = Convert.ToInt64(tbxVoucherNo.Text.Trim());
            objcontra.CV_Date           = Convert.ToDateTime(dtDate.Text.Trim());
            objcontra.PDCDate           = Convert.ToDateTime(dtPdc.Text.Trim());
            objcontra.Type              = cbxType.SelectedItem.ToString();
            objcontra.LongNarration     = tbxLongNarration.Text.Trim();
            objcontra.TotalCreditAmount = Convert.ToDecimal(colCredit.SummaryItem.SummaryValue);
            objcontra.TotalDebitAmount  = Convert.ToDecimal(colDebit.SummaryItem.SummaryValue);
            //Contra Account Details
            AccountModel        objacc;
            List <AccountModel> lstAccounts = new List <AccountModel>();

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

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

            objcontra.ContraAccountModel = lstAccounts;

            bool isSuccess = objconBL.SaveContraVoucher(objcontra);

            if (isSuccess)
            {
                MessageBox.Show("Saved Successfully!");
                ClearFormValues();
            }
        }
Exemple #4
0
        //Get The Sale Ledger Id Under Sale Type Name
        public long GetSaleLedgerId(string TypeName)
        {
            long   id = 0;
            string AccName;

            try
            {
                string Query = "SELECT * FROM `saletypemaster` WHERE `SalesType`='" + TypeName + "'";
                System.Data.IDataReader dr = _dbHelper.ExecuteDataReader(Query, _dbHelper.GetConnObject());
                while (dr.Read())
                {
                    AccName = dr["LedgerAccountBox"].ToString();
                    id      = objAccBL.GetLedgerIdByAccountName(AccName);
                }
            }
            catch (Exception ex)
            {
            }
            return(id);
        }
Exemple #5
0
        //Get LedgerId By BillSundary
        public long GetBSLedgerId(string BSName)
        {
            long   id = 0;
            string AccName;

            try
            {
                string Query = "SELECT * FROM `billsundarymaster` WHERE `Name`='" + BSName + "'";
                System.Data.IDataReader dr = _dbHelper.ExecuteDataReader(Query, _dbHelper.GetConnObject());
                while (dr.Read())
                {
                    AccName = dr["SaleAccounttoHeadPost"].ToString();
                    id      = objAccBL.GetLedgerIdByAccountName(AccName);
                }
            }
            catch (Exception ex)
            {
            }
            return(id);
        }
Exemple #6
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            PaymentVoucherModel objPayment = new PaymentVoucherModel();

            if (tbxVchNumber.Text.Trim() == "")
            {
                MessageBox.Show("Voucher Number Can Not Be Blank!");
                return;
            }
            objPayment.Voucher_Series = tbxVoucherSeries.Text.Trim();
            objPayment.Voucher_Number = Convert.ToInt32(tbxVchNumber.Text.Trim());
            objPayment.Pay_Date       = Convert.ToDateTime(dtDate.Text);
            objPayment.Type           = tbxType.Text.Trim() == null ? string.Empty : tbxType.Text.Trim();
            objPayment.PDCDate        = Convert.ToDateTime(dtPDCDate.Text);
            objPayment.LongNarration  = tbxLongNarration.Text.Trim() == null?string.Empty:tbxLongNarration.Text.Trim();
            objPayment.PaymentModeId  = objAccBL.GetLedgerIdByAccountName(cbxPayMode.Text.Trim() == null ? string.Empty : cbxPayMode.Text.Trim());
            if (objPayment.PaymentModeId == 0)
            {
                objPayment.TotalDebitAmt  = Convert.ToDecimal(colDebit.SummaryItem.SummaryValue);
                objPayment.TotalCreditAmt = Convert.ToDecimal(colCredit.SummaryItem.SummaryValue);
            }
            else
            {
                objPayment.TotalCreditAmt = Convert.ToDecimal(colAmount.SummaryItem.SummaryValue);
            }

            //Payment details
            AccountModel        objacc;
            List <AccountModel> lstAccounts = new List <AccountModel>();

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

                objacc          = new AccountModel();
                objacc.DC       = row["DC"].ToString();
                objacc.Account  = row["Account"].ToString();
                objacc.LedgerId = objAccBL.GetLedgerIdByAccountName(row["Account"].ToString());
                if (objPayment.PaymentModeId == 0)
                {
                    objacc.Debit  = Convert.ToDecimal(row["Debit"].ToString() == string.Empty ? "0.00" : row["Debit"].ToString());
                    objacc.Credit = Convert.ToDecimal(row["Credit"].ToString() == string.Empty ? "0.00" : row["Credit"].ToString());
                }
                else
                {
                    objacc.Debit = Convert.ToDecimal(row["Amount"].ToString() == string.Empty ? "0.00" : row["Amount"].ToString());
                }
                objacc.Narration = row["Narration"].ToString() == null?string.Empty: row["Narration"].ToString();
                lstAccounts.Add(objacc);
            }
            objPayment.PaymentAccountModel = lstAccounts;
            //Ledger Posting
            if (objPayment.PaymentModeId != 0)
            {
                //Single Entery Ledger Debit Posting
                LedgerPostingModel        objLedger;
                List <LedgerPostingModel> lstLedgerDebit = new List <LedgerPostingModel>();

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

                    objLedger               = new LedgerPostingModel();
                    objLedger.LedgerId      = objAccBL.GetLedgerIdByAccountName(row["Account"].ToString());
                    objLedger.Date          = Convert.ToDateTime(dtDate.Text.Trim());
                    objLedger.Debit         = Convert.ToDecimal(row["Amount"].ToString() == string.Empty ? "0.00" : row["Amount"].ToString());
                    objLedger.Credit        = 0;
                    objLedger.VoucherNo     = tbxVchNumber.Text.Trim();
                    objLedger.VoucherTypeId = 1;
                    objLedger.ChequeNo      = string.Empty;
                    objLedger.ChequeDate    = DateTime.Now;
                    objLedger.Extra1        = string.Empty;
                    objLedger.Extra2        = string.Empty;
                    objLedger.DetailsId     = 0;
                    objLedger.YearId        = 1;
                    lstLedgerDebit.Add(objLedger);
                }
                objPayment.PaymentLPDebit = lstLedgerDebit;
                //Single Entery Ledger Credit Posting
                LedgerPostingModel        objLedgerCredit;
                List <LedgerPostingModel> lstLedgerCredit = new List <LedgerPostingModel>();

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

                    objLedgerCredit               = new LedgerPostingModel();
                    objLedgerCredit.LedgerId      = objPayment.PaymentModeId;
                    objLedgerCredit.Date          = Convert.ToDateTime(dtDate.Text.Trim());
                    objLedgerCredit.Credit        = Convert.ToDecimal(row["Amount"].ToString() == string.Empty ? "0.00" : row["Amount"].ToString());
                    objLedgerCredit.Debit         = 0;
                    objLedgerCredit.VoucherNo     = tbxVchNumber.Text.Trim();
                    objLedgerCredit.VoucherTypeId = 1;
                    objLedgerCredit.ChequeNo      = string.Empty;
                    objLedgerCredit.ChequeDate    = DateTime.Now;
                    objLedgerCredit.Extra1        = string.Empty;
                    objLedgerCredit.Extra2        = string.Empty;
                    objLedgerCredit.DetailsId     = 0;
                    objLedgerCredit.DetailsId     = 1;
                    lstLedgerCredit.Add(objLedgerCredit);
                }
                objPayment.PaymentLPCredit = lstLedgerCredit;
            }
            else
            {
            }



            bool isSuccess = objpaybl.SavePaymentVoucher(objPayment);

            if (isSuccess)
            {
                MessageBox.Show("Saved Successfully!");
                Payid = 0;
                //ClearFormValues();
            }
        }
Exemple #7
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            TransSalesModel objSaleVch = new TransSalesModel();

            if (tbxVoucherNumber.Text.Trim() == "")
            {
                MessageBox.Show("Voucher Number Can Not Be Blank!");
                return;
            }
            objSaleVch.VoucherType      = tbxVoucherType.Text.Trim();
            objSaleVch.SaleDate         = Convert.ToDateTime(dtDate.Text);
            objSaleVch.Terms            = cbxTerms.SelectedItem.ToString();
            objSaleVch.VoucherNumber    = Convert.ToInt64(tbxVoucherNumber.Text.Trim() == string.Empty ? "0" : tbxVoucherNumber.Text.Trim());
            objSaleVch.BillNo           = Convert.ToInt64(tbxBillNo.Text.Trim() == string.Empty ? "0" : tbxBillNo.Text.Trim());
            objSaleVch.LedgerId         = objAccBL.GetLedgerIdByAccountName(tbxParty.Text.Trim());
            objSaleVch.SalesType        = tbxSaleType.Text.Trim() == null?string.Empty:tbxSaleType.Text.Trim();
            objSaleVch.MatCentre        = tbxMatcenter.Text.Trim() == null?string.Empty: tbxMatcenter.Text.Trim();
            objSaleVch.PriceList        = cbxPriceList.Text.Trim() == null?string.Empty: cbxPriceList.Text.Trim();
            objSaleVch.Narration        = tbxNarration.Text.Trim() == null?string.Empty :tbxNarration.Text.Trim();
            objSaleVch.TotalAmount      = Convert.ToDecimal(Amount.SummaryItem.SummaryValue);
            objSaleVch.TotalFree        = Convert.ToDecimal(colFree.SummaryItem.SummaryValue);
            objSaleVch.TotalBasicAmount = Convert.ToDecimal(colBasicAmt.SummaryItem.SummaryValue);
            objSaleVch.TotalDisAmount   = Convert.ToDecimal(colDisAmt.SummaryItem.SummaryValue);
            objSaleVch.TotalTaxAmount   = Convert.ToDecimal(colTaxAmont.SummaryItem.SummaryValue);
            objSaleVch.TotalQty         = Convert.ToDecimal(Qty.SummaryItem.SummaryValue);
            objSaleVch.BSTotalAmount    = Convert.ToDecimal(BSAmount.SummaryItem.SummaryValue);

            //Items Details
            Item_VoucherModel        objSaleItem;
            List <Item_VoucherModel> lstSaleItems = new List <Item_VoucherModel>();

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

                objSaleItem                    = new Item_VoucherModel();
                objSaleItem.ITM_Id             = objIMBL.GetItemIdByItemName(row["Item"].ToString() == null?string.Empty: row["Item"].ToString());
                objSaleItem.LedgerId           = objAccBL.GetLedgerIdByAccountName(row["Particulars"].ToString() == null ? string.Empty : row["Particulars"].ToString());
                objSaleItem.Qty                = Convert.ToDecimal(row["Qty"].ToString() == string.Empty?"0.00": row["Qty"]);
                objSaleItem.Unit               = row["Unit"].ToString() == null ? string.Empty : row["Unit"].ToString();
                objSaleItem.Per                = row["Per"].ToString() == null ? string.Empty : row["Per"].ToString();
                objSaleItem.Price              = Convert.ToDecimal(row["Price"].ToString() == string.Empty ? "0.00" : row["Price"].ToString());
                objSaleItem.Batch              = row["Batch"].ToString() == null ? string.Empty : row["Batch"].ToString();
                objSaleItem.Free               = Convert.ToDecimal(row["Free"].ToString() == string.Empty ? "0.00" : row["Free"].ToString());
                objSaleItem.BasicAmt           = Convert.ToDecimal(row["BasicAmt"].ToString() == string.Empty ? "0.00" : row["BasicAmt"].ToString());
                objSaleItem.DiscountPercentage = Convert.ToDecimal(row["DiscountPercentage"].ToString() == string.Empty ? "0.00" : row["DiscountPercentage"].ToString());
                objSaleItem.DiscountAmount     = Convert.ToDecimal(row["DiscountAmount"].ToString() == string.Empty ? "0.00" : row["DiscountAmount"].ToString());
                objSaleItem.TaxAmount          = Convert.ToDecimal(row["TaxAmount"].ToString() == string.Empty ? "0.00" : row["TaxAmount"].ToString());
                objSaleItem.Amount             = Convert.ToDecimal(row["Amount"].ToString() == string.Empty?"0.00":row["Amount"].ToString());
                if (objSaleVch.Trans_Sales_Id != 0)
                {
                    objSaleItem.Item_ID  = Convert.ToInt64(row["Item_ID"].ToString() == string.Empty ? "0" : row["Item_ID"].ToString());
                    objSaleItem.ParentId = Convert.ToInt64(row["ParentId"].ToString() == string.Empty ? "0" : row["ParentId"].ToString());
                }
                lstSaleItems.Add(objSaleItem);
            }

            objSaleVch.SalesItem_Voucher = lstSaleItems;
            //Bill Sundry Details
            BillSundry_VoucherModel        objSaleBS;
            List <BillSundry_VoucherModel> lstSaleBS = new List <BillSundry_VoucherModel>();

            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());

                lstSaleBS.Add(objSaleBS);
            }
            objSaleVch.SalesBillSundry_Voucher = lstSaleBS;

            bool isSuccess = objSVBL.SaveSalesVoucher(objSaleVch);

            if (isSuccess)
            {
                ledgerPostingAdd();
                MessageBox.Show("Saved Successfully!");
                SalesId = 0;
                //ClearControls();
            }
        }
Exemple #8
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            objbsmod.Name             = tbxName.Text;
            objbsmod.Alias            = tbxAlias.Text == null ? string.Empty : tbxAlias.Text.Trim();
            objbsmod.PrintName        = tbxPrintName.Text == null ? string.Empty : tbxPrintName.Text.Trim();
            objbsmod.BillSundryType   = cbxBillsundrytype.SelectedItem.ToString();
            objbsmod.BillSundryNature = cbxBillsundrynature.SelectedItem.ToString();
            objbsmod.DefaultValue     = Convert.ToDecimal(tbxdefaultvalue.Text == string.Empty ? "0.00" : tbxdefaultvalue.Text);
            objbsmod.subtotalheading  = cbxSubtotalheading.SelectedItem.ToString();

            objbsmod.AffectstheCostofGoodsinSale            = Convert.ToBoolean(cbxAffectsthecostofgoodsinsale.Text.ToString() == "Y" ? true : false);
            objbsmod.AffectstheCostofGoodsinPurchase        = Convert.ToBoolean(cbxaffectsthecostofgoodsinpurchase.Text.ToString() == "Y" ? true : false);
            objbsmod.AffectstheCostofGoodsinMaterialIssue   = Convert.ToBoolean(cbxAffecsthecostofgoodsinMaterialissue.Text.ToString() == "Y" ? true : false);
            objbsmod.AffectstheCostofGoodsinMaterialReceipt = Convert.ToBoolean(cbxAffectsthecostofgoodsinmaterialreceipt.Text.ToString() == "Y" ? true : false);
            objbsmod.AffectstheCostofGoodsinStockTransfer   = Convert.ToBoolean(cbxAffectsthecostofgoodsinstockTransfer.Text.ToString() == "Y" ? true : false);

            //Accounting In Sales
            objbsmod.SaleAffectsAccounting      = Convert.ToBoolean(cbxSaleaffectsAcc.Text.ToString() == "Y" ? true : false);
            objbsmod.SaleAdjustInSaleAmount     = Convert.ToBoolean(cbxSaleAdjustsaleamount.Text.ToString() == "Y" ? true : false);
            objbsmod.SaleSpecifyAccountHere     = cbxSaleAccountLedgerSpecify.SelectedItem.ToString();
            objbsmod.SaleAccounttoHeadPost      = objAccBl.GetLedgerIdByAccountName(cbxSaleAccHeadpost.SelectedItem.ToString()).ToString();
            objbsmod.SaleAdjustInPartyAmount    = Convert.ToBoolean(cbxSaleAdjustinpartyAmount.Text.ToString() == "Y" ? true : false);
            objbsmod.SalePartSpecifyAccountHere = cbxPartysaleAccountLedgerSpecify.Text.ToString();
            objbsmod.SaleAccounttoHeadPostParty = objAccBl.GetLedgerIdByAccountName(cbxSaleAccHeadpostParty.SelectedItem.ToString()).ToString();
            if (objbsmod.SaleAdjustInSaleAmount)
            {
                objbsmod.SalePostOverandAbove = cbxSalePostoverandAbove.SelectedItem.ToString() == "Y" ? true : false;
            }


            //Accounting In Purchase
            objbsmod.PurcAffectsAccounting      = Convert.ToBoolean(cbxPurcAftAccount.Text.ToString() == "Y" ? true : false);
            objbsmod.PurcAdjustInPurcAmount     = Convert.ToBoolean(cbxPurcPurchaseAmount.Text.ToString() == "Y" ? true : false);
            objbsmod.PurcSpecifyAccountHere     = cbxPurcAccountLedgerSpecify.SelectedItem.ToString();
            objbsmod.PurcAccounttoHeadPost      = cbxPurcHeadPost.SelectedItem.ToString();
            objbsmod.PurcAdjustInPartyAmount    = Convert.ToBoolean(cbxPurcPartyAmount.Text.ToString() == "Y" ? true : false);
            objbsmod.PurcParySpecifyAccountHere = cbxPartyPurcAccountLedgerSpecify.SelectedItem.ToString();
            objbsmod.PurcAccounttoHeadPostParty = cbxPurcAccountHeadPostParty.Text.ToString();
            if (objbsmod.PurcAdjustInPurcAmount)
            {
                objbsmod.PurcPostOverandAbove = cbxPurcPostOverAbove.SelectedItem.ToString() == "Y" ? true : false;
            }

            objbsmod.typeMaterialIssue   = false;
            objbsmod.typeMaterialReceipt = false;
            objbsmod.StockTransfer       = false;
            if (rbnMaterial.SelectedIndex == 0)
            {
                objbsmod.typeMaterialIssue = true;
            }
            if (rbnMaterial.SelectedIndex == 1)
            {
                objbsmod.typeMaterialReceipt = true;
            }
            if (rbnMaterial.SelectedIndex == 2)
            {
                objbsmod.StockTransfer = true;
            }

            objbsmod.AffectAccounting           = Convert.ToBoolean(cbxAffectAccounting.Text.ToString() == "Y" ? true : false);
            objbsmod.OtherSide                  = cbxotherside.SelectedItem == null ? string.Empty : cbxotherside.SelectedItem.ToString();
            objbsmod.Accountheadtopost          = cbxAccountHeadPost.Text.Trim();
            objbsmod.AdjustinMC                 = cbxAdjustinmc.SelectedItem.ToString().Equals("Y") ? true : false;
            objbsmod.AdjustSpecifyAccountLedger = cbxAccountAdjustinParty.SelectedItem.ToString();
            objbsmod.AccountheadtopostParty     = cbxAccountPost.SelectedItem.ToString() == null ? string.Empty : cbxAccountPost.SelectedItem.ToString();
            objbsmod.postoverandabove           = Convert.ToBoolean(cbxPostoverabove.Text.ToString() == "Y" ? true : false);
            //Amount Of Bill Sundary
            objbsmod.typeAbsoluteAmount = false;
            objbsmod.typePercentage     = false;
            objbsmod.typePerMainQty     = false;
            objbsmod.PerAltQty          = false;
            if (rbnAmtBillsundary.SelectedIndex == 0)
            {
                objbsmod.typeAbsoluteAmount = true;
            }
            if (rbnAmtBillsundary.SelectedIndex == 1)
            {
                objbsmod.typePercentage = true;
            }
            if (rbnAmtBillsundary.SelectedIndex == 2)
            {
                objbsmod.typePerMainQty = true;
            }
            if (rbnAmtBillsundary.SelectedIndex == 3)
            {
                objbsmod.PerAltQty = true;
            }
            objbsmod.typeNetBillAmount            = false;
            objbsmod.tyeItemsBasicAmt             = false;
            objbsmod.typeTotalMRPofItems          = false;
            objbsmod.typeTaxableAmount            = false;
            objbsmod.typePreviousBillSundryAmount = false;
            objbsmod.typeOtherBillsundry          = false;
            if (rbnbillsOf.SelectedIndex == 0)
            {
                objbsmod.typeNetBillAmount = true;
            }
            if (rbnbillsOf.SelectedIndex == 1)
            {
                objbsmod.tyeItemsBasicAmt = true;
            }
            if (rbnbillsOf.SelectedIndex == 2)
            {
                objbsmod.typeTotalMRPofItems = true;
            }
            if (rbnbillsOf.SelectedIndex == 3)
            {
                objbsmod.typeTaxableAmount = true;
            }
            if (rbnbillsOf.SelectedIndex == 4)
            {
                objbsmod.typePreviousBillSundryAmount = true;
            }
            if (rbnbillsOf.SelectedIndex == 5)
            {
                objbsmod.typeOtherBillsundry = true;
            }
            objbsmod.Percentoff                    = Convert.ToDecimal(tbxPersentage.Text.ToString());
            objbsmod.SelectiveCalculation          = Convert.ToBoolean(cbxselectivecalculation.SelectedItem.ToString() == "Y" ? true : false);
            objbsmod.IncludeFreeQty                = Convert.ToBoolean(chkIncludefreequantity.Checked ? true : false);
            objbsmod.NoOfBillSundry                = Convert.ToInt32(tbxNofbillsundrys.Text == null ? "0" : tbxNofbillsundrys.Text.Trim());
            objbsmod.ConsolidateBillSundriesAmount = Convert.ToBoolean(cbxConsoilatedbillsundariesamt.SelectedItem.ToString() == "Y" ? true : false);
            objbsmod.BillSundaryName               = cbxBillSundary.Text.Trim();
            objbsmod.BSAmt   = false;
            objbsmod.BSAppOn = false;
            if (rbnBillsundaryCal.SelectedIndex == 0)
            {
                objbsmod.BSAmt = true;
            }
            if (rbnBillsundaryCal.SelectedIndex == 1)
            {
                objbsmod.BSAppOn = true;
            }
            objbsmod.roundoffBillsundry = Convert.ToBoolean(cbxRoundoffBillsundryamount.SelectedItem.ToString() == "Y" ? true : false);
            if (objbsmod.roundoffBillsundry)
            {
                objbsmod.RoundoffValues = cbxRoundofValues.SelectedItem.ToString();
            }
            bool isSuccess = objbsBL.SaveBSM(objbsmod);

            if (isSuccess)
            {
                MessageBox.Show("Saved Successfully!");
                tbxName.Focus();
                cbxBillSundary.Properties.Items.Clear();
                List <BillSundryMasterModel> lstBillSundary = objbsBL.GetAllBillSundry();
                foreach (BillSundryMasterModel objBill in lstBillSundary)
                {
                    cbxBillSundary.Properties.Items.Add(objBill.Name);
                }
            }
        }
Exemple #9
0
        private void btnSave_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() == string.Empty?string.Empty:tbxLongNarration.Text.Trim();
            objRecipt.LedgerId       = objAccBL.GetLedgerIdByAccountName(cbxPayMode.Text.Trim() == null ? string.Empty : cbxPayMode.Text.Trim());
            if (objRecipt.LedgerId == 0)
            {
                if (Convert.ToDecimal(colCredit.SummaryItem.SummaryValue) != Convert.ToDecimal(colDebit.SummaryItem.SummaryValue))
                {
                    gdvReceipt.Focus();
                    return;
                }
                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.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;

            bool isSuccess = objRecBL.SaveRecieptVoucher(objRecipt);

            if (isSuccess)
            {
                MessageBox.Show("Saved Successfully!");
                Recpt_Id = 0;
                //ClearFormValues();
            }
        }