예제 #1
0
    protected void Txtdocno_TextChanged(object sender, EventArgs e)
    {
        string    DocNost = Txtdocno.Text.Trim();
        int       DocNo2  = Convert.ToInt32(DocNost);
        int       strFY2  = Convert.ToInt32(strFY);
        DataTable dt1     = new DataTable();

        dt1 = JVDetail.GetJV(DocNo2, strFY2).Tables[2];

        if (dt1.Rows.Count != 0)
        {
            //TxtCmpycode.Text = "";
            //TxtBookcode.Text = "";
            //LblBookName.Text = "";
            //Txtdocno.Text = "";
            TxtdocDate.Text    = Convert.ToString(JVDetail.GetJV(DocNo2, strFY2).Tables[0].Rows[0]["JVDocDate"]);
            LblJVMasterID.Text = Convert.ToString(JVDetail.GetJV(DocNo2, strFY2).Tables[0].Rows[0]["JVMasterID"]);

            GrdJV.DataSource = JVDetail.GetJV(DocNo2, strFY2).Tables[2];
            GrdJV.DataBind();
        }
        else
        {
            MessageBox("Invalid Document No.");
            //TxtdocDate.Text = DateTime.Now.ToString("dd/MM/yyyy");
            //GrdJV.DataSource = JVDetail.GetJV(DocNo2, strFY2).Tables[2];
            //GrdJV.DataBind();
        }
    }
예제 #2
0
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     if (Session["UserName"] != null)
     {
         try
         {
             JVMaster objjdel = new JVMaster();
             int      docno1  = Convert.ToInt32(Txtdocno.Text.Trim());
             int      JVMID1  = Convert.ToInt32(LblJVMasterID.Text.Trim());
             objjdel.JVMasterID = JVMID1;
             objjdel.JVDocNo    = docno1;
             objjdel.UpdatedBy  = Session["UserName"].ToString();
             objjdel.strFY      = Convert.ToInt32(strFY);
             objjdel.DeleteJV();
             MessageBox("Record Deleted Successfully " + (Txtdocno.Text));
             //MessageBox("Record saved successfully");
             GrdJV.DataBind();
             btnDelete.Visible = false;
             Txtdocno.Text     = "";
             Txtdocno.Focus();
         }
         catch
         {
         }
     }
 }
예제 #3
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        docdate = TxtdocDate.Text.Split('/')[2] + "/" + TxtdocDate.Text.Split('/')[1] + "/" + TxtdocDate.Text.Split('/')[0];
        ddt     = Convert.ToDateTime(docdate);

        flag1 = 0;
        getTotalCD();
        if (flag1 == 1)
        {
            if (Session["UserName"] != null)
            {
                try
                {
                    JVMaster objjvm = new JVMaster();
                    int      docno1 = Convert.ToInt32(Txtdocno.Text.Trim());
                    //  objcmpy.CompanyID = Convert.ToInt32(LblCmpID.Text);

                    //objjvm.JVMasterID = Convert.ToInt32(LblJVMasterID.Text.Trim());

                    JVMID1 = LblJVMasterID.Text.Trim();
                    //if (((LblJVMasterID.Text)== "" )||((LblJVMasterID.Text) != "0" ))
                    //{
                    //    objjvm.JVMasterID = 0;
                    //}
                    //else
                    //{
                    //    objjvm.JVMasterID = Convert.ToInt32(JVMID1);
                    //}
                    objjvm.JVMasterID  = Convert.ToInt32(JVMID1);
                    objjvm.CompanyCode = TxtCmpycode.Text.Trim();
                    objjvm.BookCode    = TxtBookcode.Text.Trim();
                    objjvm.JVDocDate   = ddt;
                    objjvm.JVDocNo     = docno1;
                    objjvm.Isactive    = Convert.ToBoolean(true);
                    //objjvm.CreatedBy = Session["UserName"].ToString();
                    objjvm.UpdatedBy = Session["UserName"].ToString();
                    objjvm.strFY     = Convert.ToInt32(strFY);
                    objjvm.Save(out DocNo, out JVMID);
                    //Txtdocno.Text = Convert.ToString(DocNo);
                    SaveJVDetails();
                    MessageBox(Constants.save + "\\r\\n Document No: " + (Txtdocno.Text));
                    loder("Last saved Document no. : " + Txtdocno.Text);
                    Txtdocno.Text         = "";
                    LblJVMasterID.Text    = "";
                    TxtdocDate.Text       = DateTime.Now.ToString("dd/MM/yyyy");
                    Session["tempJVData"] = null;
                    btnSave.Visible       = false;
                    GrdJV.DataBind();
                }
                catch
                {
                }
            }
        }
        else
        {
        }
    }
예제 #4
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        docdate = TxtdocDate.Text.Split('/')[2] + "/" + TxtdocDate.Text.Split('/')[1] + "/" + TxtdocDate.Text.Split('/')[0];
        ddt     = Convert.ToDateTime(docdate);
        flag1   = 0;
        getTotalCD();
        if (flag1 == 1)
        // if ((TDbt > 0) && (TCdt > 0 ) && (TDbt == TCdt))
        {
            if (Session["UserName"] != null)
            {
                try
                {
                    JVMaster objjvm = new JVMaster();

                    //  objcmpy.CompanyID = Convert.ToInt32(LblCmpID.Text);

                    //objjvm.JVMasterID = Convert.ToInt32(LblJVMasterID.Text.Trim());
                    objjvm.JVMasterID  = 0;
                    objjvm.CompanyCode = TxtCmpycode.Text.Trim();
                    objjvm.BookCode    = TxtBookcode.Text.Trim();
                    objjvm.JVDocDate   = ddt;
                    objjvm.JVDocNo     = 0;
                    objjvm.Isactive    = true;
                    objjvm.CreatedBy   = Session["UserName"].ToString();
                    objjvm.strFY       = Convert.ToInt32(strFY);
                    objjvm.Save(out DocNo, out JVMID);
                    Txtdocno.Text = Convert.ToString(DocNo);
                    SaveJVDetails(JVMID);
                    MessageBox(Constants.save + "\\r\\n Document No: " + (Txtdocno.Text));
                    loder("Last saved Document no. : " + Txtdocno.Text);
                    Txtdocno.Text         = "";
                    TxtdocDate.Text       = DateTime.Now.ToString("dd/MM/yyyy");
                    Session["tempJVData"] = null;
                    btnSave.Visible       = false;
                    GrdJV.DataBind();
                }
                catch
                {
                }
            }
        }
        else
        {
            //if (TDbt > TCdt)
            //{

            //    MessageBox("Debit Amount is Greater than Credit Amount");
            //}
            //if (TDbt < TCdt)
            //{

            //    MessageBox("Credit Amount is Greater than Debit Amount");
            //}
        }
    }
예제 #5
0
    protected void Txtdocno_TextChanged(object sender, EventArgs e)
    {
        txtAccode.Text    = "";
        Txtdebitamt.Text  = "";
        Txtcreditamt.Text = "";

        string DocNost = Txtdocno.Text.Trim();
        int    DocNo2  = Convert.ToInt32(DocNost);
        int    strFY2  = Convert.ToInt32(strFY);

        DataTable dt1 = new DataTable();

        dt1 = JVDetail.GetJV(DocNo2, strFY2).Tables[2];
        DataTable dt11 = new DataTable();

        dt11 = JVDetail.GetJV(DocNo2, strFY2).Tables[0];
        if (dt11.Rows.Count != 0)
        {
            if (dt1.Rows.Count != 0)
            {
                //TxtCmpycode.Text = "";
                //TxtBookcode.Text = "";
                //LblBookName.Text = "";
                //Txtdocno.Text = "";
                TxtdocDate.Text    = Convert.ToString(JVDetail.GetJV(DocNo2, strFY2).Tables[0].Rows[0]["JVDocDate"]);
                LblJVMasterID.Text = Convert.ToString(JVDetail.GetJV(DocNo2, strFY2).Tables[0].Rows[0]["JVMasterID"]);

                GrdJV.DataSource = JVDetail.GetJV(DocNo2, strFY2).Tables[2];
                GrdJV.DataBind();
                btnSave.Visible       = true;
                Session["tempJVData"] = dt1;
            }

            if (dt1.Rows.Count == 0)
            {
                TxtdocDate.Text    = Convert.ToString(JVDetail.GetJV(DocNo2, strFY2).Tables[0].Rows[0]["JVDocDate"]);
                LblJVMasterID.Text = Convert.ToString(JVDetail.GetJV(DocNo2, strFY2).Tables[0].Rows[0]["JVMasterID"]);

                GrdJV.DataBind();
                btnSave.Visible = false;
            }
        }
        else
        {
            MessageBox("Invalid Document No.");
            TxtdocDate.Text = DateTime.Now.ToString("dd/MM/yyyy");
            btnSave.Visible = false;
            //GrdJV.DataSource = JVDetail.GetJV(DocNo2, strFY2).Tables[2];
            GrdJV.DataBind();
        }
    }
예제 #6
0
    protected void GrdJV_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        DataTable dt2 = new DataTable();

        dt2 = (DataTable)Session["tempJVData"];
        dt2.Rows[e.RowIndex].Delete();
        GrdJV.DataSource = dt2;
        GrdJV.DataBind();
        Session["tempJVData"] = dt2;

        if (dt2.Rows.Count == 0)
        {
            btnSave.Visible = false;
        }
    }
예제 #7
0
    protected void GrdJV_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        DataTable dt2 = new DataTable();

        dt2 = (DataTable)Session["tempJVData"];
        JVDetail objjvd1 = new JVDetail();

        int jvdid = Convert.ToInt32(((Label)GrdJV.Rows[e.RowIndex].FindControl("LblJVDID")).Text.Trim());

        if (jvdid != 0)
        {
            objjvd1.Flag      = "JVDetail";
            objjvd1.ID        = jvdid;
            objjvd1.Isactive  = Convert.ToBoolean(false);
            objjvd1.IsDeleted = Convert.ToBoolean(true);
            objjvd1.deleteJVRec();
        }
        else
        {
        }

        //dt2.Rows[e.RowIndex].Delete();
        //GrdJV.DataSource = dt2;
        //GrdJV.DataBind();
        //Session["tempJVData"] = dt2;

        dt2.Rows[e.RowIndex].Delete();
        DataView dv = new DataView(dt2);

        dv.RowFilter     = "JVDetailID is not null";
        GrdJV.DataSource = dv;
        GrdJV.DataBind();

        Session["tempJVData"] = dv.ToTable();

        dt2 = (DataTable)Session["tempJVData"];
        if (dt2.Rows.Count == 0)
        {
            btnSave.Visible = false;
        }
    }
예제 #8
0
    protected void btnaddEntry_Click(object sender, EventArgs e)
    {
        //if (Txtdebitamt.Text == "" &&  Txtcreditamt.Text == "")
        //{
        //    MessageBox("Enter Debit or Credit Amount");
        //}
        //else
        //{
        if (Txtdebitamt.Text == "")
        {
            Txtdebitamt.Text = "0";
        }
        if (Txtcreditamt.Text == "")
        {
            Txtcreditamt.Text = "0";
        }
        decimal da = Convert.ToDecimal(Txtdebitamt.Text.Trim());
        decimal ca = Convert.ToDecimal(Txtcreditamt.Text.Trim());

        try
        {
            if (da > 0 & ca > 0)
            {
                MessageBox(" Enter Only Debit Amount or Credit Amount");
            }
            if ((da == 0 & ca == 0) || (Txtdebitamt.Text == "" && Txtcreditamt.Text == ""))
            {
                MessageBox(" Enter Debit Amount or Credit Amount");
            }
            if ((da > 0 & ca == 0) || (da == 0 & ca > 0))
            {
                TJVDetailID = "0";
                TJVMasterID = "0";

                TAccountCode = txtAccode.Text.Trim();
                TAccountName = lblaccname.Text.Trim();
                TReportCode  = txtreportcode.Text.Trim();
                TDebit       = Txtdebitamt.Text.Trim();
                TCredit      = Txtcreditamt.Text.Trim();
                TComment     = TxtComment.Text.Trim();

                DataTable dt1 = new DataTable();
                if (Session["tempJVData"] != null)
                {
                    Session["tempJVData"] = fillTempJVData();
                    dt1 = (DataTable)Session["tempJVData"];
                }
                else
                {
                    Session["tempJVData"] = fillTempJVData();
                    dt1 = (DataTable)Session["tempJVData"];
                }
                GrdJV.DataSource = dt1;
                GrdJV.DataBind();
                // TxtdocDate.Text = DateTime.Now.ToString("dd/MM/yyyy");

                txtAccode.Text     = "";
                lblaccname.Text    = "";
                txtreportcode.Text = "";
                lblacname.Text     = "";
                Txtdebitamt.Text   = "";
                Txtcreditamt.Text  = "";


                txtAccode.Focus();
            }
        }
        catch
        {
        }
        //}
    }