protected void idPrePV_TextChanged(object sender, EventArgs e)
        {
            //if (!IsCallback)
            //{
            //hfVoucherID.Value = idPrePV.Text.Trim();
            core_petty_cash_payment_voucher pcvObj = new core_petty_cash_payment_voucher();
            DataSet ds = pcvObj.SelectMethod(@"SELECT
            pcv.Id_Petty_Cash_Voucher,
            pcv.Id_Petty_Cash_Book,
            pcb.Petty_Cash_Book_Name,
            pcb.Petty_Cash_Book_Code,
            pcb.Available_Balance_Amount,
            pcv.Id_Petty_Cash_Category,
            pcc.Petty_Cash_Category_Name,
            pcc.Petty_Cash_Category_Code,
            pcc.Id_Ledger_Account,
            la.Balance_Carried_Forward,
            pcv.Cash_Out_Amount,
            pcv.Business_Purpose,
            pcv.Received_By,
            pcv.Petty_Cash_Voucher_Remark,
            pcv.Post_Payment,
            pcv.Created_Date,
            pcv.Created_User,
            pcv.Edited_Date,
            pcv.Edited_User
            FROM core_petty_cash_payment_voucher AS pcv
            INNER JOIN core_petty_cash_book AS pcb ON pcv.Id_Petty_Cash_Book=pcb.Id_Petty_Cash_Book
            INNER JOIN core_petty_cash_category AS pcc ON pcv.Id_Petty_Cash_Category=pcc.Id_Petty_Cash_Category
            INNER JOIN core_ledger_account AS la ON pcc.Id_Ledger_Account=la.Id_Ledger_Account
            WHERE pcv.Id_Petty_Cash_Voucher='" + Convert.ToInt32(hfVoucherID.Value) + @"' AND pcv.Is_Active='0' AND pcv.Post_Payment='1';", "core_petty_cash_payment_voucher");
            try
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    hfPCBID.Value = ds.Tables[0].Rows[0]["Id_Petty_Cash_Book"].ToString();
                    ddlPCBName.Text = ds.Tables[0].Rows[0]["Petty_Cash_Book_Name"].ToString();
                    ddlPCBCode.Text = ds.Tables[0].Rows[0]["Petty_Cash_Book_Code"].ToString();
                    PCBAvailableBalance.Text = ds.Tables[0].Rows[0]["Available_Balance_Amount"].ToString();
                    hfPCCID.Value = ds.Tables[0].Rows[0]["Id_Petty_Cash_Category"].ToString();
                    ddlPCCName.Text = ds.Tables[0].Rows[0]["Petty_Cash_Category_Name"].ToString();
                    ddlPCCCode.Text = ds.Tables[0].Rows[0]["Petty_Cash_Category_Code"].ToString();

                    hfIDLedgerAccount.Value = ds.Tables[0].Rows[0]["Id_Ledger_Account"].ToString();
                    hfIDLedgerAccountBCF.Value = ds.Tables[0].Rows[0]["Balance_Carried_Forward"].ToString();

                    cashOutAmount.Text = ds.Tables[0].Rows[0]["Cash_Out_Amount"].ToString();
                    receivedBy.Text = ds.Tables[0].Rows[0]["Received_By"].ToString();
                    businessPurpose.Text = ds.Tables[0].Rows[0]["Business_Purpose"].ToString();
                    PCV_Remark.Text = ds.Tables[0].Rows[0]["Petty_Cash_Voucher_Remark"].ToString();
                }
                else
                {
                    ddlPCBName.Text = "";
                    ddlPCBCode.Text = "";
                    PCBAvailableBalance.Text = "";
                    ddlPCCName.Text = "";
                    ddlPCCCode.Text = "";
                    cashOutAmount.Text = "";
                    receivedBy.Text = "";
                    cashInAmount.Text = "";
                    netcashOutAmount.Text = "";
                    businessPurpose.Text = "";
                    PCV_Remark.Text = "";
                }
            }
            catch (Exception)
            {

                throw;
            }
        }
 private void loadNextPCVid()
 {
     core_petty_cash_payment_voucher pcvObj = new core_petty_cash_payment_voucher();
     DataSet ds = pcvObj.SelectMethod(@"SELECT
     COUNT(pcv.Id_Petty_Cash_Voucher) AS count
     FROM core_petty_cash_payment_voucher AS pcv;", "core_petty_cash_payment_voucher");
     string count = ds.Tables[0].Rows[0]["count"].ToString();
     int x=(Convert.ToInt32(count)+1);
     //PCV_Id.Text = x.ToString().PadLeft(4, '0');
     PCV_Id.Text = x.ToString();
 }
        protected void searchID_Click(object sender, EventArgs e)
        {
            hfVoucherID.Value = idPrePV.Text.Trim();
                core_petty_cash_payment_voucher pcvObj = new core_petty_cash_payment_voucher();
                DataSet ds = pcvObj.SelectMethod(@"SELECT
            pcv.Id_Petty_Cash_Voucher,
            pcv.Id_Petty_Cash_Book,
            pcb.Petty_Cash_Book_Name,
            pcb.Petty_Cash_Book_Code,
            pcb.Available_Balance_Amount,
            pcv.Id_Petty_Cash_Category,
            pcc.Petty_Cash_Category_Name,
            pcc.Petty_Cash_Category_Code,
            pcc.Id_Ledger_Account,
            la.Balance_Carried_Forward,
            pcv.Cash_Out_Amount,
            pcv.Business_Purpose,
            pcv.Received_By,
            pcv.Petty_Cash_Voucher_Remark,
            pcv.Post_Payment,
            pcv.Created_Date,
            pcv.Created_User,
            pcv.Edited_Date,
            pcv.Edited_User
            FROM core_petty_cash_payment_voucher AS pcv
            INNER JOIN core_petty_cash_book AS pcb ON pcv.Id_Petty_Cash_Book=pcb.Id_Petty_Cash_Book
            INNER JOIN core_petty_cash_category AS pcc ON pcv.Id_Petty_Cash_Category=pcc.Id_Petty_Cash_Category
            INNER JOIN core_ledger_account AS la ON pcc.Id_Ledger_Account=la.Id_Ledger_Account
            WHERE pcv.Id_Petty_Cash_Voucher='" + Convert.ToInt32(hfVoucherID.Value) + @"' AND pcv.Is_Active='0' AND pcv.Post_Payment='1';", "core_petty_cash_payment_voucher");

            if (ds.Tables[0].Rows.Count == 0)
            {
                if (IsPostBack)
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "AlertSweet", "alertSweet();", true);
                    ddlPCBName.Text = "";
                    ddlPCBCode.Text = "";
                    PCBAvailableBalance.Text = "";
                    ddlPCCName.Text = "";
                    ddlPCCCode.Text = "";
                    cashOutAmount.Text = "";
                    receivedBy.Text = "";
                    cashInAmount.Text = "";
                    netcashOutAmount.Text = "";
                    businessPurpose.Text = "";
                    PCV_Remark.Text = "";
                }

            }
            else
            {
                try
                {
                    hfPCBID.Value = ds.Tables[0].Rows[0]["Id_Petty_Cash_Book"].ToString();
                    ddlPCBName.Text = ds.Tables[0].Rows[0]["Petty_Cash_Book_Name"].ToString();
                    ddlPCBCode.Text = ds.Tables[0].Rows[0]["Petty_Cash_Book_Code"].ToString();
                    PCBAvailableBalance.Text = ds.Tables[0].Rows[0]["Available_Balance_Amount"].ToString();
                    hfPCCID.Value = ds.Tables[0].Rows[0]["Id_Petty_Cash_Category"].ToString();
                    ddlPCCName.Text = ds.Tables[0].Rows[0]["Petty_Cash_Category_Name"].ToString();
                    ddlPCCCode.Text = ds.Tables[0].Rows[0]["Petty_Cash_Category_Code"].ToString();

                    hfIDLedgerAccount.Value = ds.Tables[0].Rows[0]["Id_Ledger_Account"].ToString();
                    hfIDLedgerAccountBCF.Value = ds.Tables[0].Rows[0]["Balance_Carried_Forward"].ToString();

                    cashOutAmount.Text = ds.Tables[0].Rows[0]["Cash_Out_Amount"].ToString();
                    receivedBy.Text = ds.Tables[0].Rows[0]["Received_By"].ToString();
                    businessPurpose.Text = ds.Tables[0].Rows[0]["Business_Purpose"].ToString();
                    PCV_Remark.Text = ds.Tables[0].Rows[0]["Petty_Cash_Voucher_Remark"].ToString();

                }
                catch
                {

                }
            }
        }