private void loadDDL()
 {
     core_ledger_account laObj = new core_ledger_account();
     DataSet ds = laObj.SelectMethod(@"SELECT LA.Id_Ledger_Account,LA.Ledger_Account_Name FROM core_ledger_account AS LA WHERE LA.Is_Active='0';", "core_ledger_account");
     DataRow dr = ds.Tables["core_ledger_account"].NewRow();
     dr[0] = "0";
     dr[1] = "Select";
     ds.Tables["core_ledger_account"].Rows.InsertAt(dr, 0);
     ddlLAName.DataSource = ds.Tables["core_ledger_account"];
     ddlLAName.DataValueField = "Id_Ledger_Account";
     ddlLAName.DataTextField = "Ledger_Account_Name";
     ddlLAName.DataBind();
 }
        private void insertUpdatedVoucherDetails()
        {
            if (cmdSubmit.CommandName.ToLower() == "SAVE".ToLower())
            {
                core_petty_cash_settlement pcvsObj = new core_petty_cash_settlement();
                core_petty_cash_settlement_Objects objPCVS = new core_petty_cash_settlement_Objects();
                objPCVS.Id_Petty_Cash_Voucher = Convert.ToInt32(idPrePV.Text);
                //objPCVS.Id_Petty_Cash_Book = Convert.ToInt32(ddlPCBName.Text);
                objPCVS.Id_Petty_Cash_Book = Convert.ToInt32(hfPCBID.Value);
                //objPCVS.Id_Petty_Cash_Category = Convert.ToInt32(ddlPCCName.Text);
                objPCVS.Id_Petty_Cash_Category = Convert.ToInt32(hfPCCID.Value);
                objPCVS.Cash_Out_Amount = Convert.ToDouble(cashOutAmount.Text);
                objPCVS.Cash_In_Amount = Convert.ToDouble(cashInAmount.Text);
                objPCVS.Net_Cash_Out_Amount = Convert.ToDouble(hfnetcashOutAmount.Value);
                objPCVS.Petty_Cash_Voucher_Remark = PCV_Remark.Text;
                objPCVS.Created_Date = DateTime.Now;
                pcvsObj.Insert(objPCVS);

                //Inserting Ledger Entry & Updating Ledger Account BCF
                core_ledger_entry leObj = new core_ledger_entry();
                core_ledger_entry_Objects objLE = new core_ledger_entry_Objects();

                objLE.Id_Petty_Cash_Book = Convert.ToInt32(hfPCBID.Value);
                objLE.Id_Petty_Cash_Category = Convert.ToInt32(hfPCCID.Value);
                objLE.Id_Ledger_Account = Convert.ToInt32(hfIDLedgerAccount.Value);
                objLE.Id_Petty_Cash_Voucher = Convert.ToInt32(idPrePV.Text);

                double x = Convert.ToDouble(hfIDLedgerAccountBCF.Value);
                double y = Convert.ToDouble(cashInAmount.Text);
                objLE.Credit_Amount = Convert.ToDouble(cashInAmount.Text);
                objLE.Balance_Carried_Forward = (x - y);
                double z = (x - y);

                objLE.Created_Date = DateTime.Now;
                objLE.Post_Payment = 1;
                leObj.Insert(objLE);

                core_ledger_account laObj = new core_ledger_account();
                laObj.UpdateMethod(@"UPDATE `core_ledger_account`
                                        SET
                                        `Balance_Carried_Forward` = '" + z + @"'
                                        WHERE `Id_Ledger_Account` = '" + Convert.ToInt32(hfIDLedgerAccount.Value) + @"';");
            }

            clearFields();
            loadGrid();
        }