protected void GrdViewChequedate_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        Cheque_CashDetails cq = new Cheque_CashDetails();

        cq.CQ_ID         = Convert.ToInt32(((Label)GrdViewChequedate.Rows[e.RowIndex].FindControl("lblcqid")).Text);
        cq.EmpID         = ((Label)GrdViewChequedate.Rows[e.RowIndex].FindControl("lblEmpId")).Text;
        cq.CustId        = ((Label)GrdViewChequedate.Rows[e.RowIndex].FindControl("lblcustid")).Text;
        cq.Deposite_Type = ((Label)GrdViewChequedate.Rows[e.RowIndex].FindControl("lbldepositType")).Text;
        cq.CreatedBy     = ((Label)GrdViewChequedate.Rows[e.RowIndex].FindControl("lblcreatedby")).Text;
        cq.ChequeDate    = ((Label)GrdViewChequedate.Rows[e.RowIndex].FindControl("lblChequeDate")).Text;
        cq.Payee_Bank    = ((Label)GrdViewChequedate.Rows[e.RowIndex].FindControl("lblPayee_Bank")).Text;
        cq.ReciptNo      = Convert.ToInt32(((Label)GrdViewChequedate.Rows[e.RowIndex].FindControl("lblrec")).Text);
        cq.ChequeNo      = ((Label)GrdViewChequedate.Rows[e.RowIndex].FindControl("lblChequeNo")).Text;
        cq.Amount        = Convert.ToDecimal(((Label)GrdViewChequedate.Rows[e.RowIndex].FindControl("lblAmount")).Text);
        cq.IsCancel      = Convert.ToBoolean(true);
        cq.CancelDate    = System.DateTime.Now;
        cq.Save();
        message("Record Deleted successfully");
        bindData();
    }
Exemple #2
0
    protected void btn_Save_Click(object sender, EventArgs e)

    {
        if (Session["UserName"] != null)
        {
            Cheque_CashDetails che = new Cheque_CashDetails();
            if (lblID.Text == "")
            {
                lblID.Text = "0";
            }
            che.CQ_ID = Convert.ToInt32(lblID.Text);

            che.EmpID    = txtEMcode.Text.Trim();
            che.ChequeNo = txtCheck.Text.Trim();
            //string txtChequeDate= Convert.ToDateTime(txtChequeDate.Text.Split('/')[1] + "/" + txtChequeDate.Text.Split('/')[0] + "/" + txtChequeDate.Text.Split('/')[2]);
            if (txtChequeDate.Text == "")
            {
                ChequeDate1 = "";
            }
            else
            {
                ChequeDate1 = txtChequeDate.Text.Split('/')[1] + "/" + txtChequeDate.Text.Split('/')[0] + "/" + txtChequeDate.Text.Split('/')[2];
            }
            che.ChequeDate = ChequeDate1;


            che.CustId     = txtcustomerid.Text.Trim();
            che.ReciptNo   = Convert.ToInt32(txtReciptNo.Text.Trim());
            che.Payee_Bank = txtBankName.Text.Trim();
            //che.Deposited_By = txtDeposit.Text.Trim();

            che.Amount        = Convert.ToDecimal(txtAmount.Text.Trim());
            che.CreatedBy     = Session["UserName"].ToString();
            che.Description   = txtRemark.Text.Trim();
            che.FinancialYear = Convert.ToInt32(strFY);
            if (Cheque.Items[0].Selected)
            {
                pnlCust.Visible = true;

                che.Deposite_Type = Cheque.SelectedValue;
            }
            else
            {
                pnlCust.Visible = true;

                che.Deposite_Type = Cheque.SelectedValue;
            }
            if (lblID.Text == "0")
            {
                che.Save(1, out IDNo);
            }
            else
            {
                che.Update();
            }

            lblId3.Text = Convert.ToString("CQ ID :" + (IDNo));
            message("Record Saved Successfully");
            if (lblID.Text == "0")
            {
                lblId3.Visible = true;
            }
            else
            {
                lblId3.Visible = false;
            }
            pnlCust.Visible    = true;
            lblempname.Text    = "";
            txtEMcode.Text     = "";
            txtCheck.Text      = "";
            txtChequeDate.Text = "";
            txtcustomerid.Text = "";
            txtReciptNo.Text   = "";
            //txtDeposit.Text = "";
            txtAmount.Text   = "";
            txtBankName.Text = "";
            lblshow.Text     = "";
            lblCustName.Text = "";
            //lblbank.Text = "";
            txtRemark.Text = "";
        }
        else
        {
            Response.Redirect("LoginUserDetails.aspx");
        }
    }
Exemple #3
0
    protected void lblupdate_Click(object sender, EventArgs e)
    {
        try
        {
            Button  lnkUpdate      = (Button)sender;
            TextBox txtRemark      = (TextBox)lnkUpdate.Parent.FindControl("txtRemark");
            TextBox txtDepositDate = (TextBox)lnkUpdate.Parent.FindControl("txtDepositDate");
            TextBox txtBankName    = (TextBox)lnkUpdate.Parent.FindControl("txtBankName");

            foreach (GridViewRow gv in GrdViewChequedate.Rows)
            {
                if (Convert.ToInt32(lblCid.Text.ToString()) == Convert.ToInt32(((Label)gv.FindControl("lblcqid")).Text))
                {
                    if (txtDepositDate.Text != "" && txtBankName.Text != "")
                    {
                        //ddate = Convert.ToDateTime(txtDepositDate.Text.ToString());
                        DateTime ddate;
                        string   date = txtDepositDate.Text.Split('/')[1] + "/" + txtDepositDate.Text.Split('/')[0] + "/" + txtDepositDate.Text.Split('/')[2];
                        ddate = Convert.ToDateTime(date);
                        DateTime Cdate;

                        Cdate = Convert.ToDateTime((((Label)gv.FindControl("lblChequeDate")).Text).ToString());
                        if (ddate < Cdate)
                        {
                            MessageBox("Cheque date should be greater than deposited date ");
                        }
                        else
                        {
                            Cheque_CashDetails chk = new Cheque_CashDetails();
                            chk.CQ_ID = Convert.ToInt32(((Label)gv.FindControl("lblcqid")).Text);
                            //chk.EmpID = (((Label)gv.FindControl("lblEmpId")).Text);
                            //chk.CustId = (((Label)gv.FindControl("lblcustid")).Text);
                            chk.EmpID    = (((Label)gv.FindControl("lblEmpCode1")).Text);
                            chk.CustId   = (((Label)gv.FindControl("lblCustCode1")).Text);
                            chk.ReciptNo = Convert.ToInt32(((Label)gv.FindControl("lblrec")).Text);
                            //  lblReceiptNo123.Text =
                            chk.Deposite_Type = (((Label)gv.FindControl("lbldepositType")).Text);
                            chk.ChequeDate    = (((Label)gv.FindControl("lblChequeDate")).Text);
                            chk.ChequeNo      = (((Label)gv.FindControl("lblChequeNo")).Text);
                            chk.Amount        = Convert.ToDecimal(((Label)gv.FindControl("lblAmount")).Text);
                            chk.CreatedBy     = ((Label)gv.FindControl("lblcreatedby")).Text;
                            //chk.BankCode = ((Label)lnkUpdate.Parent.FindControl("lblBankCode")).Text;
                            chk.Payee_Bank = ((Label)gv.FindControl("lblPayee_Bank")).Text;
                            ///////////ledger entry/////////
                            Ledgerdetails ldpay = new Ledgerdetails();
                            ldpay.Amount  = Convert.ToDecimal(((Label)gv.FindControl("lblAmount")).Text);
                            ldpay.CustId  = ((Label)gv.FindControl("lblcustid")).Text;
                            ldpay.OtherId = ((Label)gv.FindControl("lblcqid")).Text;
                            ldpay.FY      = Convert.ToInt32(strFY);
                            //////////end/////////////
                            foreach (GridViewRow gv1 in gvLegder.Rows)
                            {
                                if ((((CheckBox)gv1.FindControl("chkclose")).Checked) == true)
                                {
                                    //    ///////////Payment pending ///////////
                                    //  ReceivedAmt = ReceivedAmt +  Convert.ToDecimal(((TextBox)gv1.FindControl("txtreceivable")).Text);
                                    //Convert.ToDecimal(ReceivedAmt);

                                    //}

                                    // ReceivedAmt = Convert.ToDecimal(((TextBox)gv1.FindControl("txtreceivable")).Text);

                                    /////////////Reused code////////////
                                    // Ledgerdetails ldpay = new Ledgerdetails();
                                    //ldpay.Amount = Convert.ToDecimal(((Label)gv.FindControl("lblAmount")).Text);
                                    // ldpay.CustId = ((Label)gv.FindControl("lblcustid")).Text;
                                    // ldpay.OtherId = ((Label)gv.FindControl("lblcqid")).Text;
                                    // ldpay.update();
                                    ///////////end////////////////
                                    Receivable = Convert.ToDecimal(((TextBox)gv1.FindControl("txtreceivable")).Text);


                                    LedgerPaymentdetails ld = new LedgerPaymentdetails();

                                    ld.Autoid        = Convert.ToInt32("0");
                                    ld.CQ_ID         = Convert.ToInt32(lblCid.Text.Trim());
                                    ld.InvoiceNo     = Convert.ToDecimal(((Label)gv1.FindControl("lblotherId")).Text);
                                    ld.debitAmount   = Convert.ToDecimal(((Label)gv1.FindControl("lblDebitAmount")).Text);
                                    ld.ReceiptAmount = Convert.ToDecimal(((TextBox)gv1.FindControl("txtreceivable")).Text);
                                    ld.ReceiptNo     = Convert.ToInt32(((Label)gv.FindControl("lblrec")).Text);

                                    if (Receivable > 0)
                                    {
                                        ld.save();
                                    }
                                }

                                //  message("Record Saved Successfully");
                                // Response.Redirect(Request.RawUrl.Replace("/Website/", "").ToString());
                            }
                            //chk.BankID = Convert.ToInt32(((Label)lnkUpdate.Parent.FindControl("lblBankID")).Text);
                            if (txtDepositDate.Text == "")
                            {
                                ChequeDate2 = "";
                            }
                            else
                            {
                                ChequeDate2     = txtDepositDate.Text.Split('/')[0] + "/" + txtDepositDate.Text.Split('/')[1] + "/" + txtDepositDate.Text.Split('/')[2];
                                chk.DepositDate = ChequeDate2;
                                if (((Label)gv.FindControl("lblChequeNo")).Text == "")
                                {
                                    string    BankCode = txtBankName.Text.ToString().Split(':')[0].Trim();
                                    DataTable dt       = new DataTable();
                                    dt = DCMaster.Get_Name(BankCode, "Bank").Tables[0];
                                    if (dt.Rows.Count != 0)
                                    {
                                        txtBankName.Text = BankCode;
                                        //lblbank.Text = Convert.ToString(dt.Rows[0]["BankName"]);
                                        chk.BankCode      = txtBankName.Text.ToString().Split(':')[0].Trim();
                                        chk.Description   = txtRemark.Text.Trim().ToString();
                                        chk.ISactive      = true;
                                        chk.FinancialYear = Convert.ToInt32(strFY);
                                        chk.Save(1);
                                        ldpay.update(1);

                                        // ld.save();
                                        message("Record Saved Successfully");
                                        bindData();
                                        pnlothertext.Visible = true;
                                        check = "save";
                                        Response.Redirect(Request.RawUrl.Replace("/Website/", "").ToString());
                                    }
                                    else
                                    {
                                        chk.BankCode = txtBankName.Text.ToString().Split(':')[0].Trim();

                                        chk.Description   = txtRemark.Text.Trim().ToString();
                                        chk.ISactive      = true;
                                        chk.FinancialYear = Convert.ToInt32(strFY);
                                        chk.Save(1);
                                        ldpay.update(1);

                                        // ld.save();
                                        message("Record Saved Successfully");
                                        bindData();
                                        check = "save";
                                        pnlothertext.Visible = true;
                                        Response.Redirect(Request.RawUrl.Replace("/Website/", "").ToString());
                                    }
                                }
                                else
                                {
                                    string BankCode = txtBankName.Text.ToString().Split(':')[0].Trim();

                                    DataTable dt = new DataTable();
                                    dt = DCMaster.Get_Name(BankCode, "Bank").Tables[0];
                                    if (dt.Rows.Count != 0)
                                    {
                                        txtBankName.Text = BankCode;
                                        //lblbank.Text = Convert.ToString(dt.Rows[0]["BankName"]);
                                        chk.BankCode      = txtBankName.Text.ToString().Split(':')[0].Trim();
                                        chk.Description   = txtRemark.Text.Trim().ToString();
                                        chk.ISactive      = true;
                                        chk.FinancialYear = Convert.ToInt32(strFY);
                                        chk.Save(1);
                                        ldpay.update(1);


                                        //  ld.save();
                                        message("Record Saved Successfully");
                                        bindData();
                                        check = "save";
                                        pnlothertext.Visible = true;
                                        Response.Redirect(Request.RawUrl.Replace("/Website/", "").ToString());
                                    }


                                    else
                                    {
                                        message("No such Bank code");
                                        txtBankName.Focus();
                                        txtBankName.Text = "";
                                    }
                                }
                            }


                            // }
                        }
                    }

                    else
                    {
                        message("Kindly enter BankName,Date details");
                    }
                }
            }
        }


        catch
        {
        }
    }