コード例 #1
0
        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName.Equals("Delete"))
            {
                try
                {
                    LinkButton LB = (LinkButton)e.CommandSource;
                    GridViewRow GVRow = (GridViewRow)LB.Parent.Parent;
                    GridView GV = (GridView)sender;
                    string PCVid = GV.DataKeys[GVRow.RowIndex]["Id_Petty_Cash_Voucher"].ToString();
                    HiddenField1.Value = PCVid.ToString();

                    var PCB = new core_petty_cash_book();
                    PCB.UpdateMethod(@"UPDATE `core_petty_cash_payment_voucher`
                                        SET
                                        `Is_Active` = 1,
                                        `Edited_Date` = now()
                                        WHERE `Id_Petty_Cash_Voucher` = '" + Convert.ToInt32(HiddenField1.Value) + @"';");
                    ScriptManager.RegisterStartupScript(this, GetType(), "delete", "showAlert('success');", true);
                }
                catch (Exception ex)
                {
                    Exception E = ex;
                }

                //loadGrid();
            }
        }
コード例 #2
0
        private void loadPCBDDL()
        {
            core_petty_cash_book objPCB = new core_petty_cash_book();
            DataSet ds = objPCB.SelectMethod(@"SELECT PCB.Id_Petty_Cash_Book,PCB.Petty_Cash_Book_Name,PCB.Petty_Cash_Book_Code FROM core_petty_cash_book AS PCB WHERE PCB.Is_Active='0';", "core_petty_cash_book");
            DataRow dr = ds.Tables["core_petty_cash_book"].NewRow();
            dr[0] = "0";
            dr[1] = "Select";
            dr[2] = "Select";
            ds.Tables["core_petty_cash_book"].Rows.InsertAt(dr, 0);

            ddlPCBName.DataSource = ds.Tables["core_petty_cash_book"];
            ddlPCBName.DataValueField = "Id_Petty_Cash_Book";
            ddlPCBName.DataTextField = "Petty_Cash_Book_Name";
            ddlPCBName.DataBind();

            ddlPCBCode.DataSource = ds.Tables["core_petty_cash_book"];
            ddlPCBCode.DataValueField = "Id_Petty_Cash_Book";
            ddlPCBCode.DataTextField = "Petty_Cash_Book_Code";
            ddlPCBCode.DataBind();
        }
コード例 #3
0
 private void RetrievePCBDetails()
 {
     core_petty_cash_book pcbObj = new core_petty_cash_book();
     core_petty_cash_book_Objects ObjPCB = new core_petty_cash_book_Objects();
     DataSet ds = pcbObj.SelectMethod(@"SELECT
     PCB.Id_Petty_Cash_Book,
     PCB.Petty_Cash_Book_Name,
     PCB.Petty_Cash_Book_Code,
     PCB.Petty_Cash_Book_Max_Amount,
     PCB.Available_Balance_Amount,
     PCB.Petty_Cash_Book_Remark,
     PCB.Created_Date,
     PCB.Created_User,
     PCB.Edited_Date,
     PCB.Edited_User,
     PCB.Is_Active
     FROM core_petty_cash_book as PCB WHERE PCB.Is_Active='0';", "core_petty_cash_book");
     GridView1.DataSource = ds.Tables["core_petty_cash_book"];
     GridView1.DataBind();
 }
コード例 #4
0
        private void InsertPCBDetails()
        {
            if (cmdSubmit.CommandName.ToLower() == "SAVE".ToLower())
            {

                core_petty_cash_book pcbObj = new core_petty_cash_book();
                core_petty_cash_book_Objects ObjPCB = new core_petty_cash_book_Objects();
                ObjPCB.Petty_Cash_Book_Name = PCB_Name.Text;
                ObjPCB.Petty_Cash_Book_Code = PCB_Code.Text;
                ObjPCB.Petty_Cash_Book_Max_Amount = Convert.ToDouble(PCB_Max_Amount.Text);
                ObjPCB.Available_Balance_Amount = Convert.ToDouble(hfAvailableBalance.Value);
                ObjPCB.Petty_Cash_Book_Remark = PCB_Remark.Text;
                ObjPCB.Created_Date = DateTime.Today;

                //ObjPCB.Created_Date = Convert.ToDateTime(DateTime.Now.Date.ToString("yyyy-MM-dd"));
                //txtTrDate.Text = string.Format("{0:yyyy-MM-dd}", Convert.ToDateTime(DateTime.Now.Date));

                pcbObj.Insert(ObjPCB);
                //ScriptManager.RegisterStartupScript(this, GetType(), "AlertSweet", "alertSweet1();", true);
                ScriptManager.RegisterStartupScript(this, GetType(), "insert", "showAlert('success');", true);
            }
            if (cmdSubmit.CommandName.ToLower() == "UPDATE".ToLower())
            {
                if (!((HiddenField1.Value) == null || (HiddenField1.Value) == ""))
                {
                    //ScriptManager.RegisterStartupScript(this, GetType(), "updateConfirm", "alertSweet1();", true);
                    var sc = new core_petty_cash_book();//System.Net.WebUtility.HtmlEncode()
                    sc.UpdateMethod(@"UPDATE `core_petty_cash_book`
                                        SET
                                        `Petty_Cash_Book_Name` = '" + PCB_Name.Text.Trim().Replace("'", "''") + @"',
                                        `Petty_Cash_Book_Code` = '" + PCB_Code.Text.Trim().Replace("'", "''") + @"',
                                        `Petty_Cash_Book_Max_Amount` = '" + Convert.ToDouble(PCB_Max_Amount.Text) + @"',
                                        `Available_Balance_Amount` = '" + Convert.ToDouble(PCB_Available_Balance_Amount.Text) + @"',
                                        `Petty_Cash_Book_Remark` = '" + PCB_Remark.Text.Trim().Replace("'", "''") + @"',
                                        `Edited_Date` = now()
                                        WHERE `Id_Petty_Cash_Book` = '" + Convert.ToInt32(HiddenField1.Value) + @"';
                                        ");
                    //ScriptManager.RegisterStartupScript(this, GetType(), "AlertSweet", "alertSweet4();", true);
                    ScriptManager.RegisterStartupScript(this, GetType(), "update", "showAlert('success');", true);
                    cmdSubmit.CommandName = "SAVE";
                    cmdSubmit.Text = "Save";
                }
            }
            ClearFeilds();
            RetrievePCBDetails();
        }
コード例 #5
0
 private void loadPCBAvailableBalance()
 {
     core_petty_cash_book pcbObj = new core_petty_cash_book();
     DataSet ds = pcbObj.SelectMethod(@"SELECT
     pcb.Id_Petty_Cash_Book,
     pcb.Petty_Cash_Book_Name,
     pcb.Petty_Cash_Book_Code,
     pcb.Available_Balance_Amount
     FROM core_petty_cash_book AS pcb
     WHERE pcb.Is_Active='0' AND pcb.Id_Petty_Cash_Book='"+ddlPCBName.SelectedValue+"' OR pcb.Id_Petty_Cash_book='"+ddlPCBCode.SelectedValue+"';","core_petty_cash_book");
     if (ds.Tables["core_petty_cash_book"] != null && ds.Tables["core_petty_cash_book"].Rows.Count > 0)
         PCBAvailableBalance.Text = ds.Tables["core_petty_cash_book"].Rows[0]["Available_Balance_Amount"].ToString();
     else
         PCBAvailableBalance.Text="0.00";
 }
コード例 #6
0
        private void insertPCVDetails()
        {
            int payment_Type;
            if (selectedPost.Selected == true)
            {
                payment_Type = 0;
            }
            else if (selectedPre.Selected == true)
            {
                payment_Type = 1;
            }
            else
               {
                payment_Type = 2;
                MessageBox.Show("Error! Please Select a Payment Type");

            }

            if (cmdSubmit.CommandName.ToLower() == "SAVE".ToLower())
            {
                core_petty_cash_payment_voucher pcvObj = new core_petty_cash_payment_voucher();
                core_petty_cash_payment_voucher_Objects objPCV = new core_petty_cash_payment_voucher_Objects();

                objPCV.Id_Petty_Cash_Voucher = Convert.ToInt32(PCV_Id.Text);
                objPCV.Id_Petty_Cash_Book=Convert.ToInt32(ddlPCBName.SelectedValue);
                objPCV.Id_Petty_Cash_Category = Convert.ToInt32(ddlPCCName.SelectedValue);

                double result;
                if(double.TryParse(PCBAvailableBalance.Text,out result))
                    objPCV.Available_Balance_Amount = Convert.ToDouble(PCBAvailableBalance.Text);

                objPCV.Business_Purpose=businessPurpose.Text;
                objPCV.Cash_Out_Amount=Convert.ToDouble(cashOutAmount.Text);
                objPCV.Received_By=receivedBy.Text;

                objPCV.Petty_Cash_Voucher_Remark=PCV_Remark.Text;
                objPCV.Created_Date=DateTime.Now;
                objPCV.Edited_Date = DateTime.Now;
                objPCV.Post_Payment= payment_Type;
                pcvObj.Insert(objPCV);

            }
            if (cmdSubmit.CommandName.ToLower() == "SAVE".ToLower())
            {
                 double availableBalance;
                 double cashoutamount;
                 availableBalance = 0.00;
                 cashoutamount = 0.00;
                 availableBalance =Convert.ToDouble(PCBAvailableBalance.Text);
                 cashoutamount = Convert.ToDouble(cashOutAmount.Text.Trim());
                 double newAmount = Convert.ToDouble(availableBalance - cashoutamount);

                core_petty_cash_book pcbObj = new core_petty_cash_book();
                pcbObj.UpdateMethod(@"UPDATE `core_petty_cash_book`
                                        SET
                                        `Available_Balance_Amount` = '" + newAmount + @"'
                                        WHERE `Id_Petty_Cash_Book` = '" + Convert.ToInt32(ddlPCBName.SelectedValue) + @"';");
            }
            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(ddlPCBName.SelectedValue);
                objLE.Id_Petty_Cash_Category = Convert.ToInt32(ddlPCCName.SelectedValue);
                objLE.Id_Ledger_Account = Convert.ToInt32(hfIDLedgerAccount.Value);
                objLE.Id_Petty_Cash_Voucher = Convert.ToInt32(PCV_Id.Text);
                objLE.Business_Purpose = businessPurpose.Text;

                //double x = Convert.ToDouble(hfIDLedgerAccountBCF.Value);
                //////
                double x = Convert.ToDouble(PCBAvailableBalance.Text);
                //////
                double y = Convert.ToDouble(cashOutAmount.Text);
                objLE.Debit_Amount = Convert.ToDouble(cashOutAmount.Text);
                objLE.Balance_Carried_Forward = (x-y);
                //double z = (x + y);

                objLE.Created_Date = DateTime.Now;
                objLE.Post_Payment = payment_Type;
                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) + @"';");
            }

            ScriptManager.RegisterStartupScript(this, GetType(), "insert", "showAlert('success');", true);
            //this.clearFields();
            //loadGrid();
            //Response.Redirect("PettyCashVoucher.aspx", false);
        }
コード例 #7
0
        //protected void reimburseAmount_TextChanged(object sender, EventArgs e)
        //{
        //    hfReimburseAmount.Value = reimburseAmount.Text.Trim();
        //    if (!((hfReimburseAmount.Value) == null || (hfReimburseAmount.Value) == ""))
        //    {
        //        double availableBalance = 0.00;
        //        double reimbursedAmount = 0.00;
        //        double amountToBeReimbursed = 0.00;
        //        availableBalance = Convert.ToDouble(PCBAvailableBalance.Text.Trim());
        //        reimbursedAmount = Convert.ToDouble(hfReimburseAmount.Value);
        //        amountToBeReimbursed = Convert.ToDouble(AmountToBeReimbursed.Text.Trim());
        //        if (amountToBeReimbursed >= reimbursedAmount)
        //            bcf.Text = (availableBalance + reimbursedAmount).ToString();
        //        //else
        //        //    Message.Text = "You can not Reimburse an amount which will result exceed the Float amount";
        //        //has to get the Msgbox.dll
        //    }
        //    else
        //        bcf.Text = "";
        //}
        protected void cmdSubmit_Click(object sender, EventArgs e)
        {
            hfReimburseAmount.Value = reimburseAmount.Text.Trim();
            if (!((hfReimburseAmount.Value) == null || (hfReimburseAmount.Value) == ""))
            {
                double reimbursedAmount = 0.00;
                double amountToBeReimbursed = 0.00;
                double balanceCarriedForward = 0.00;
                reimbursedAmount = Convert.ToDouble(hfReimburseAmount.Value);
                amountToBeReimbursed = Convert.ToDouble(AmountToBeReimbursed.Text.Trim());
                balanceCarriedForward = Convert.ToDouble(PCBAvailableBalance.Text.Trim()) + reimbursedAmount;
                hfBCF.Value=balanceCarriedForward.ToString();
                if (Page.IsPostBack)
                {
                    //insertPCRDetails();
                    if (cmdSubmit.CommandName.ToLower() == "SAVE".ToLower())
                    {
                        core_petty_cash_reimbursement pcrObj = new core_petty_cash_reimbursement();
                        core_petty_cash_reimbursement_Objects objPCR = new core_petty_cash_reimbursement_Objects();

                        objPCR.Id_Petty_Cash_Book = Convert.ToInt32(ddlPCBName.SelectedValue);
                        objPCR.Amount_ThatShouldBe_Reimbursed = Convert.ToDouble(AmountToBeReimbursed.Text.Trim());
                        objPCR.Reimbursement_Amount = Convert.ToDouble(reimburseAmount.Text.Trim());
                        objPCR.Balance_Carried_Forward = Convert.ToDouble(hfBCF.Value);
                        objPCR.Petty_Cash_Reimbursement_Remark = PCR_Remark.Text.Trim();
                        objPCR.Created_Date = DateTime.Now;
                        pcrObj.Insert(objPCR);
                        ScriptManager.RegisterStartupScript(this, GetType(), "insert", "showAlert('success');", true);
                    }
                    /////// added code below
                    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(ddlPCBName.SelectedValue);
                        objLE.Id_Petty_Cash_Category = 42;
                        objLE.Id_Ledger_Account = 6;
                        //objLE.Id_Petty_Cash_Voucher = 0;
                        objLE.Business_Purpose = "Reimbursement";

                        //double x = Convert.ToDouble(hfIDLedgerAccountBCF.Value);
                        //double y = Convert.ToDouble(cashOutAmount.Text);
                        objLE.Credit_Amount = Convert.ToDouble(reimburseAmount.Text.Trim());
                        objLE.Balance_Carried_Forward = Convert.ToDouble(hfBCF.Value);
                        //double z = (x + y);

                        objLE.Created_Date = DateTime.Now;
                        //objLE.Post_Payment = payment_Type;
                        leObj.Insert(objLE);
                    }
                    //////////
                    /*if (cmdSubmit.CommandName.ToLower() == "SAVE".ToLower())
                    {
                        core_petty_cash_payment_voucher pcvObj = new core_petty_cash_payment_voucher();
                        core_petty_cash_payment_voucher_Objects objPCV = new core_petty_cash_payment_voucher_Objects();

                        //objPCV.Id_Petty_Cash_Voucher = Convert.ToInt32(PCV_Id.Text);
                        objPCV.Id_Petty_Cash_Book = Convert.ToInt32(ddlPCBName.SelectedValue);
                        objPCV.Id_Petty_Cash_Category = 42;

                        double result;
                        if (double.TryParse(PCBAvailableBalance.Text, out result))
                            objPCV.Available_Balance_Amount = Convert.ToDouble(PCBAvailableBalance.Text);

                        objPCV.Business_Purpose = "Reimbursement";
                        //objPCV.Cash_Out_Amount = Convert.ToDouble(cashOutAmount.Text);
                        objPCV.Received_By = "Shan";

                        //objPCV.Petty_Cash_Voucher_Remark = PCV_Remark.Text;
                        objPCV.Created_Date = DateTime.Now;
                        objPCV.Edited_Date = DateTime.Now;
                        //objPCV.Post_Payment = payment_Type;
                        objPCV.Is_Active = 1;
                        pcvObj.Insert(objPCV);

                    }*/
                    //////////
                    /////// added code ends

                    //updatePCBTable();
                    core_petty_cash_book pcbObj = new core_petty_cash_book();
                    pcbObj.UpdateMethod(@"UPDATE `core_petty_cash_book` SET `Available_Balance_Amount` = '" + Convert.ToDouble(hfBCF.Value) + @"' WHERE `Id_Petty_Cash_Book` = '" + Convert.ToInt32(ddlPCBName.SelectedValue) + @"' AND `Is_Active` = '0';");
                    clearFields();
                    Response.Redirect("PettyCashReimbursement.aspx", false);
                }

            }
            else
            {
                //Message.Text
            }
            clearFields();
            loadGrid();
        }
コード例 #8
0
 private void loadMaxAmount()
 {
     core_petty_cash_book pcbObj = new core_petty_cash_book();
     DataSet ds = pcbObj.SelectMethod(@"SELECT
     pcb.Id_Petty_Cash_Book,
     pcb.Petty_Cash_Book_Max_Amount
     FROM core_petty_cash_book AS pcb
     WHERE pcb.Is_Active='0' AND pcb.Id_Petty_Cash_Book='" + ddlPCBName.SelectedValue + "' OR pcb.Id_Petty_Cash_book='" + ddlPCBCode.SelectedValue + "';", "core_petty_cash_book");
     if (ds.Tables["core_petty_cash_book"] != null && ds.Tables["core_petty_cash_book"].Rows.Count > 0)
         PCBMaxAmount.Text = ds.Tables["core_petty_cash_book"].Rows[0]["Petty_Cash_Book_Max_Amount"].ToString();
     else
     {
         PCBMaxAmount.Text = "";
         //AmountToBeReimbursed.Text = "0.00";
     }
 }
コード例 #9
0
 private void updatePCBTable()
 {
     if (!((hfPCBID.Value) == null || (hfPCBID.Value) == ""))
     {
         core_petty_cash_book pcbObj = new core_petty_cash_book();
         pcbObj.UpdateMethod(@"UPDATE `core_petty_cash_book` SET `Available_Balance_Amount` = '" + Convert.ToDouble(hfUpdatedAV.Value) + @"' WHERE `Id_Petty_Cash_Book` = '" + Convert.ToInt32(hfPCBID.Value) + @"';");
     }
 }