//        private void insertLedgerEntry()
 //        {
 //            if (cmdSubmit.CommandName.ToLower() == "SAVE".ToLower())
 //            {
 //                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) + @"';");
 //            }
 //        }
 private void loadGrid()
 {
     core_petty_cash_settlement pcvsObj = new core_petty_cash_settlement();
     DataSet ds = pcvsObj.SelectMethod(@"SELECT
     pcvs.Id_Petty_Cash_Settlement,
     pcvs.Id_Petty_Cash_Voucher,
     pcvs.Id_Petty_Cash_Book,
     pcb.Petty_Cash_Book_Name,
     pcb.Petty_Cash_Book_Code,
     pcvs.Id_Petty_Cash_Category,
     pcc.Petty_Cash_Category_Name,
     pcc.Petty_Cash_Category_Code,
     pcvs.Cash_Out_Amount,
     pcvs.Cash_In_Amount,
     pcvs.Net_Cash_Out_Amount,
     pcvs.Petty_Cash_Voucher_Remark,
     pcvs.Created_Date,
     pcvs.Created_User,
     pcvs.Edited_Date,
     pcvs.Edited_User
     FROM core_petty_cash_settlement AS pcvs
     INNER JOIN core_petty_cash_book AS pcb ON pcvs.Id_Petty_Cash_Book=pcb.Id_Petty_Cash_Book
     INNER JOIN core_petty_cash_category AS pcc ON pcvs.Id_Petty_Cash_Category=pcc.Id_Petty_Cash_Category
     WHERE pcvs.Is_Active='0';", "core_petty_cash_settlement");
     if (ds.Tables["core_petty_cash_settlement"] != null)
     {
         pcvsGrid.DataSource = ds.Tables["core_petty_cash_settlement"];
         pcvsGrid.DataBind();
     }
     else
     {
         pcvsGrid.DataSource = new int[] { };
         pcvsGrid.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();
        }