示例#1
0
    public void  BindGvBookDetail()
    {
        DataSet ds = new DataSet();

        ds = PettyCashEntry.Get_All_PettyCashDetals(val, val2);
        DataView dv = new DataView(ds.Tables[0]);

        // PettyCashEntry.Get_All_PettyCashDetals(FromDate, Todate);
        //DataView dv = new DataView(dt);

        gvAllPettyCash.DataSource = dv;
        gvAllPettyCash.DataBind();

        gvAllPettyCash.Visible = true;
    }
示例#2
0
    public void Bind()
    {
        string  FromVoc = txtFromorec.Text.Trim();
        string  ToVoc   = txttorec.Text.Trim();
        DataSet ds      = new DataSet();

        ds = PettyCashEntry.GetVoucher_Payment(FromVoc, ToVoc);
        if (ds.Tables[0].Rows.Count != 0)
        {
            gvPayment.DataSource = ds;
            gvPayment.DataBind();
            gvPayment.Visible = true;
            btnsave.Visible   = true;
        }
        else
        {
            message("NO Record Found");
            gvPayment.Visible = false;
            btnsave.Visible   = false;
        }
    }
    public void BindAllPetty()
    {
        string FromDate = txtFrom.Text.Split('/')[1] + "/" + txtFrom.Text.Split('/')[0] + "/" + txtFrom.Text.Split('/')[2];
        //FromDate = Convert.ToString(date);

        string Todate = txtTo.Text.Split('/')[1] + "/" + txtTo.Text.Split('/')[0] + "/" + txtTo.Text.Split('/')[2];
        //Todate = Convert.ToString(Todate2);

        DataSet ds = new DataSet();

        ds = PettyCashEntry.Get_All_PettyCashDetals(FromDate, Todate);
        if (ds.Tables[0].Rows.Count != 0)
        {
            gvAllPettyCash.DataSource = ds;
            gvAllPettyCash.DataBind();
            gvAllPettyCash.Visible = true;
        }
        else
        {
            message("Record not found");
        }
    }
示例#4
0
    protected void btnsave_Click(object sender, EventArgs e)
    {
        try
        {
            foreach (GridViewRow gv in gvPayment.Rows)
            {
                TextBox        txtBankName = (TextBox)gv.FindControl("txtBankName");
                PettyCashEntry petty       = new PettyCashEntry();
                petty.EmpId = Convert.ToInt32(((Label)gv.FindControl("lblEmpId")).Text);
                //petty.UpdatedBy = Session["UserUpdate"].ToString();
                petty.VoucherNo    = ((Label)gv.FindControl("lblVoucherNo")).Text;
                petty.PaymentRemar = ((TextBox)gv.FindControl("txtRemark")).Text;
                string BankCode1 = txtBankName.Text.ToString().Split(':')[0].Trim();
                ////modification////////
                DataTable dt = new DataTable();
                dt = DCMaster.Get_Name(BankCode1, "Bank").Tables[0];
                if (dt.Rows.Count != 0)
                {
                    petty.BankCode = BankCode1;
                    petty.ChequeNo = ((TextBox)gv.FindControl("txtCheque")).Text;
                }
                else
                {
                    txtBankName.Text = string.Empty;
                }
                //////end//////
                if ((((TextBox)gv.FindControl("txtPaymentDate")).Text) == "")
                {
                    petty.PaidAmount = Convert.ToDecimal("0");
                    petty.IsPaid     = Convert.ToBoolean(false);
                }

                else
                {
                    string   strVoucherdate      = ((TextBox)gv.FindControl("lblVoucherdate")).Text;
                    string[] strVoucherdateArray = strVoucherdate.Split('/');
                    strVoucherdate = strVoucherdateArray[1].ToString() + '/' + strVoucherdateArray[0].ToString() + '/' + strVoucherdateArray[2].ToString();

                    string   strPaymentdate      = ((TextBox)gv.FindControl("txtPaymentDate")).Text;
                    string[] strPaymentdateArray = strPaymentdate.Split('/');
                    strPaymentdate = strPaymentdateArray[1].ToString() + '/'
                                     + strPaymentdateArray[0].ToString() + '/' + strPaymentdateArray[2].ToString();
                    DateTime Voucherdate = Convert.ToDateTime(strVoucherdate);
                    DateTime Paymentdate = Convert.ToDateTime(strPaymentdate);
                    if (Voucherdate <= Paymentdate)
                    {
                        petty.IsPaid      = Convert.ToBoolean(true);
                        petty.PaidAmount  = Convert.ToDecimal(((TextBox)gv.FindControl("txtPaidAmount")).Text);
                        petty.PaymentDate = ((TextBox)gv.FindControl("txtPaymentDate")).Text;
                        // petty.GivenFrom = ((DropDownList)gv.FindControl("ddlGivenFrom")).SelectedItem.Text;
                        string ddlSelsct = ((DropDownList)gv.FindControl("ddlGivenFrom")).SelectedItem.Text;
                        if (ddlSelsct.ToLower() == "select")
                        {
                        }
                        else
                        {
                            petty.GivenFrom = ((DropDownList)gv.FindControl("ddlGivenFrom")).SelectedItem.Text;
                            petty.update();
                            Bind();
                            message("Record Saved Successfully");
                        }
                    }
                    else
                    {
                        message("Payment Date should greater than Voucher Date");
                    }
                }
            }
        }
        catch
        {
        }
    }