示例#1
0
    protected void GrdCustviewMDC_RowEditing(object sender, GridViewEditEventArgs e)
    {
        string CustCode = ((Label)GrdCustviewMDC.Rows[e.NewEditIndex].FindControl("lblCustCodeMDC")).Text;
        //string DC = ((Label)GrdCustview.Rows[e.NewEditIndex].FindControl("lblDC1")).Text;

        DataTable dt3 = new DataTable();

        dt3 = DCReturnBook.GetCustAddress(CustCode, "RtdBkCustlist").Tables[0];

        if (dt3.Rows.Count > 0)
        {
            lblCustName.Text    = dt3.Rows[0]["CustName"].ToString();
            lblCustAddress.Text = dt3.Rows[0]["Address"].ToString();
        }

        Grd3.DataSource = DCReturnBook.Get_DC_ReturnBook(CustCode, "DCrtbk").Tables[1];
        Grd3.DataBind();

        PnlCustDetails.Visible  = true;
        Pnl3.Visible            = true;
        Pnl4CustDetails.Visible = false;
        Pnl4.Visible            = false;
        Pnl5CustDetails.Visible = false;
        Pnl5.Visible            = false;
        Pnlview.Visible         = false;
        PnlBkdetails.Visible    = false;
        Pnl4view.Visible        = false;
        Pnl4Bkdetails.Visible   = false;
    }
示例#2
0
    protected void Grd5_RowEditing(object sender, GridViewEditEventArgs e)
    {
        try
        {
            int    rtqty5    = Convert.ToInt32(((Label)Grd5.Rows[e.NewEditIndex].FindControl("lbl5rtqty")).Text);
            string BookCode5 = ((Label)Grd5.Rows[e.NewEditIndex].FindControl("lbl5bkcode")).Text;
            string CustCode5 = ((Label)Grd5.Rows[e.NewEditIndex].FindControl("lbl5custcode")).Text;

            GrdView.DataSource = DCReturnBook.Get_DC_ReturnBkview(CustCode5, BookCode5);
            GrdView.DataBind();
            if (rtqty5 != 0)
            {
                Pnl5CustDetails.Visible = true;
                Pnl5.Visible            = true;
                PnlBkdetails.Visible    = true;
                Pnlview.Visible         = true;
                lbbkcode1.Text          = ((Label)Grd5.Rows[e.NewEditIndex].FindControl("lbl5bkcode")).Text;
                lbName1.Text            = ((Label)Grd5.Rows[e.NewEditIndex].FindControl("lbl5Name")).Text;
            }
            else
            {
                Pnl5CustDetails.Visible = true;
                Pnl5.Visible            = true;
                PnlBkdetails.Visible    = false;
                Pnlview.Visible         = false;
            }
        }
        catch
        {
        }
    }
示例#3
0
    protected void Grd4_RowEditing(object sender, GridViewEditEventArgs e)
    {
        try
        {
            int    rtqty4    = Convert.ToInt32(((Label)Grd4.Rows[e.NewEditIndex].FindControl("lbl4rtqty")).Text);
            string BookCode2 = ((Label)Grd4.Rows[e.NewEditIndex].FindControl("lbl4bkcode")).Text;
            string CustCode2 = ((Label)Grd4.Rows[e.NewEditIndex].FindControl("lbl4custcode")).Text;

            Grd4View.DataSource = DCReturnBook.Get_DC_ReturnBkview(CustCode2, BookCode2);
            Grd4View.DataBind();
            if (rtqty4 != 0)
            {
                Pnl4CustDetails.Visible = true;
                Pnl4.Visible            = true;
                Pnl4Bkdetails.Visible   = true;
                Pnl4view.Visible        = true;
                lb4bkcode.Text          = ((Label)Grd4.Rows[e.NewEditIndex].FindControl("lbl4bkcode")).Text;
                lb4Name.Text            = ((Label)Grd4.Rows[e.NewEditIndex].FindControl("lbl4Name")).Text;
            }
            else
            {
                Pnl4CustDetails.Visible = true;
                Pnl4.Visible            = true;
                Pnl4Bkdetails.Visible   = false;
                Pnl4view.Visible        = false;
            }
        }
        catch
        {
        }
    }
示例#4
0
    protected void DDLCustomer_SelectedIndexChanged(object sender, EventArgs e)
    {
        BindGrd3();
        if (Grd3.Rows.Count > 0)
        {
            Grd3.Focus();
            Pnl3.Visible    = true;
            Pnlview.Visible = false;
            DataTable dt = new DataTable();
            dt = DCReturnBook.GetCustAddress((DDLCustomer.SelectedValue), "RtdBkCustlist").Tables[0];

            if (dt.Rows.Count > 0)
            {
                lblCustName.Text    = dt.Rows[0]["CustName"].ToString();
                lblCustAddress.Text = dt.Rows[0]["Address"].ToString();
            }
        }
        else
        {
            PnlCustDetails.Visible = false;
            Pnl3.Visible           = false;
            Pnlview.Visible        = false;
            if (DDLCustomer.SelectedIndex == 0)
            {
            }
            else
            {
                MessageBox("Record Not Available");
            }
        }
    }
示例#5
0
 protected void Grd3_RowEditing(object sender, GridViewEditEventArgs e)
 {
     try
     {
         int    rtqty    = Convert.ToInt32(((Label)Grd3.Rows[e.NewEditIndex].FindControl("lbl1rtqty")).Text);
         string BookCode = ((Label)Grd3.Rows[e.NewEditIndex].FindControl("lbl1bkcode")).Text;
         GrdView.DataSource = DCReturnBook.Get_DC_ReturnBkview((DDLCustomer.SelectedValue), BookCode);
         GrdView.DataBind();
         if (rtqty != 0)
         {
             PnlCustDetails.Visible = true;
             Pnl3.Visible           = true;
             PnlBkdetails.Visible   = true;
             Pnlview.Visible        = true;
             lbbkcode1.Text         = ((Label)Grd3.Rows[e.NewEditIndex].FindControl("lbl1bkcode")).Text;
             lbName1.Text           = ((Label)Grd3.Rows[e.NewEditIndex].FindControl("lbl1Name")).Text;
         }
         else
         {
             PnlCustDetails.Visible = true;
             Pnl3.Visible           = true;
             PnlBkdetails.Visible   = false;
             Pnlview.Visible        = false;
         }
     }
     catch
     {
     }
 }
示例#6
0
    protected void Grdcustview_RowEditing(object sender, GridViewEditEventArgs e)
    {
        try
        {
            string CustCode = ((Label)GrdCustview.Rows[e.NewEditIndex].FindControl("lblCustCode1")).Text;
            string DC       = ((Label)GrdCustview.Rows[e.NewEditIndex].FindControl("lblDC1")).Text;

            if (DC == "Y")
            {
                DataTable dt5 = new DataTable();
                dt5 = DCReturnBook.GetCustAddress(CustCode, "RtdBkCustlist").Tables[0];

                if (dt5.Rows.Count > 0)
                {
                    lbl5CustName.Text    = dt5.Rows[0]["CustName"].ToString();
                    lbl5CustAddress.Text = dt5.Rows[0]["Address"].ToString();
                }
                Grd5.DataSource = CreditNote.Get_DC_CNBook(Convert.ToInt32(strFY), CustCode, "DCRTDBookAll").Tables[0];
                Grd5.DataBind();

                PnlCustview.Visible     = false;
                Pnl5CustDetails.Visible = true;
                Pnl5.Visible            = true;
                Pnl4CustDetails.Visible = false;
                Pnl4.Visible            = false;
            }
            else
            if (DC == "N")
            {
                DataTable dt4 = new DataTable();
                dt4 = DCReturnBook.GetCustAddress(CustCode, "RtdBkCustlist").Tables[0];

                if (dt4.Rows.Count > 0)
                {
                    lbl4CustName.Text    = dt4.Rows[0]["CustName"].ToString();
                    lbl4CustAddress.Text = dt4.Rows[0]["Address"].ToString();
                }

                Grd4.DataSource = CreditNote.Get_DC_CNBook(Convert.ToInt32(strFY), CustCode, "DCRTDBook").Tables[0];
                Grd4.DataBind();

                PnlCustview.Visible     = false;
                Pnl5CustDetails.Visible = false;
                Pnl5.Visible            = false;
                Pnl4CustDetails.Visible = true;
                Pnl4.Visible            = true;
            }
        }
        catch
        {
        }
    }
示例#7
0
    protected void lblEdit_Click(object sender, ImageClickEventArgs e)
    {
        try
        {
            string BookCode = ((Label)((ImageButton)(sender)).Parent.FindControl("lblbkcode")).Text;
            // BindGrdviewRD()
            // string bookcode1 = ((Label)e.Row.FindControl("lblbkcode")).Trim;
            GrdRD.DataSource = DCReturnBook.Get_DC_RateByBook(CustCode, BookCode).Tables[0];
            GrdRD.DataBind();

            modalPopupForRD.Show();

            // modalPopupForRD.Show();
        }
        catch
        {
        }
    }
示例#8
0
    protected void Grd2_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            Label lblbkcode2 = (Label)e.Row.FindControl("lblbkcode");

            DataSet      ds   = DCReturnBook.Get_DC_RateByBook(CustCode, lblbkcode2.Text);
            DropDownList DDLR = (DropDownList)e.Row.FindControl("DDLR");
            DDLR.DataSource = ds.Tables[1];
            DDLR.DataBind();

            DropDownList DDLD = (DropDownList)e.Row.FindControl("DDLD");
            DDLD.DataSource = ds.Tables[2];
            DDLD.DataBind();

            // DDLR.DataBind();
            //GetRateByBook_DCReturnBook
        }
        if (e.Row.RowType == DataControlRowType.Footer)
        {
            ViewState["data"] = null;
        }
    }
示例#9
0
    protected void btn_Save_Click(object sender, EventArgs e)
    {
        btn_Save.Enabled = false;
        cndate           = txtCNDate.Text.Split('/')[2] + "/" + txtCNDate.Text.Split('/')[1] + "/" + txtCNDate.Text.Split('/')[0];
        cndt             = Convert.ToDateTime(cndate);

        CNNo = 0;
        bool flag = false;

        CustCode = txtcustomer.Text.ToString().Split(':')[0].Trim();
        int GCN;
        int SCN;

        if (Txtgcn.Text.Trim() == "")
        {
            Txtgcn.Text = "0";
        }
        if (Txtscn.Text.Trim() == "")
        {
            Txtscn.Text = "0";
        }

        GCN = Convert.ToInt32(Txtgcn.Text.Trim());
        SCN = Convert.ToInt32(Txtscn.Text.Trim());


        if (Session["UserName"] != null)
        {
            DCReturnBook _obdcrtbk1 = new DCReturnBook();
            CreditNote   _obcn1     = new CreditNote();
            LedgerCN     _oblcn1    = new LedgerCN();
            CNNo         = Convert.ToInt32(CreditNote.GetCNNo(Convert.ToInt32(strFY)));
            lblCNNo.Text = CreditNote.GetCNNo(Convert.ToInt32(strFY));

            try
            {
                if (grdBookDetails.Rows.Count == 0)
                {
                    MessageBox("Kindly fill Book details");
                }
                else
                {
                    //Response.Write("HERE");
                    foreach (GridViewRow Row in grdBookDetails.Rows)
                    {
                        string RQty = ((TextBox)Row.FindControl("txtretquty")).Text.Trim();
                        // string DfQty = ((TextBox)Row.FindControl("txtdefquty")).Text.Trim();
                        string CrQty = ((TextBox)Row.FindControl("txtquty")).Text.Trim();

                        _obdcrtbk1.DCReturnBkID = 0;
                        _obdcrtbk1.CustCode     = CustCode;
                        _obdcrtbk1.BookCode     = (((Label)Row.FindControl("lblBookCode")).Text.Trim());
                        _obdcrtbk1.ReturnQty    = Convert.ToInt32(RQty);
                        // _obdcrtbk1.DefectQty = Convert.ToInt32(DfQty);
                        _obdcrtbk1.DefectQty = 0;
                        _obdcrtbk1.Comment   = ((TextBox)Row.FindControl("txtcmmt")).Text.Trim();
                        _obdcrtbk1.CreatedBy = Session["UserName"].ToString();
                        _obdcrtbk1.Flag      = "Manual";

                        _obcn1.AutoID       = 0;
                        _obcn1.CNNo         = CNNo;
                        _obcn1.CustCode     = CustCode;
                        _obcn1.BookCode     = (((Label)Row.FindControl("lblBookCode")).Text.Trim());
                        _obcn1.Rate         = Convert.ToDecimal(((TextBox)Row.FindControl("txtrate")).Text.Trim());
                        _obcn1.Discount     = Convert.ToDecimal(((TextBox)Row.FindControl("txtDiscount")).Text.Trim());
                        _obcn1.ReturnQty    = Convert.ToInt32(CrQty);
                        _obcn1.DefectQty    = 0;
                        _obcn1.TotReturnQty = Convert.ToInt32(RQty);
                        _obcn1.Flag         = "Manual";
                        _obcn1.Comment      = ((TextBox)Row.FindControl("txtcmmt")).Text.Trim();
                        _obcn1.IsActive     = true;
                        _obcn1.GCN          = GCN;
                        _obcn1.SCN          = SCN;
                        _obcn1.CreatedBy    = Session["UserName"].ToString();
                        _obcn1.strFY        = Convert.ToInt32(strFY);
                        _oblcn1.CNNo        = CNNo;
                        _oblcn1.strFY       = Convert.ToInt32(strFY);
                        _oblcn1.CNDate      = cndt;
                        _obcn1.CNDate       = cndt;

                        _obcn1.TransportName = lbltransporter.Text.ToString();
                        _obcn1.LrNo          = txtlrno.Text.ToString();
                        _obcn1.Remark1       = "";
                        _obcn1.Remark2       = "";
                        _obcn1.Remark3       = "";
                        _obcn1.Remark4       = "";
                        _obcn1.Remark5       = "";
                        _obdcrtbk1.Save_DC_ReturnBook();
                        // Response.Write("Save_DC_ReturnBook");
                        _obcn1.Save_CN(Convert.ToInt32(strFY));
                        // Response.Write("Save_CN");
                        flag = true;
                    }
                }
                if (flag)
                {
                    _oblcn1.Ledger_CN();
                    // Response.Write("Ledger_CN");
                    //MessageBox(Constants.save);
                    MessageBox(Constants.save + "\\r\\n CreditNote No: " + CNNo);
                    Bindgrdcn();
                    //Session["tempDCData"].;
                    Session["tempDCData"] = null;
                    // grdBookDetails.DataSource = Session["tempDCData"];
                    grdBookDetails.DataBind();
                    quantity = 0;
                    tamount  = 0;
                    ClearFields();

                    DataTable dt1 = new DataTable();
                    dt1 = DCReturnBook.GetCustAddress(CustCode, "CNCustlist").Tables[0];
                    if (dt1.Rows.Count > 0)
                    {
                        lblCustName1.Text   = dt1.Rows[0]["CustName"].ToString();
                        lblCustAddress.Text = dt1.Rows[0]["Address"].ToString();
                    }
                    PnlAddBook.Visible = false;
                    btn_Save.Visible   = false;
                    PnlPrint.Visible   = true;
                    btnPrint.Visible   = true;
                }
            }
            //catch(Exception ex)
            //{
            //    Response.Write(ex.Message.ToString());
            //    Response.End();
            //}
            catch (Exception ex)
            {
                txtcustomer.Text = ex.Message.ToString();
            }
        }
    }
示例#10
0
    protected void btn_Save_Click(object sender, EventArgs e)
    {
        cndate = txtCNDate.Text.Split('/')[2] + "/" + txtCNDate.Text.Split('/')[1] + "/" + txtCNDate.Text.Split('/')[0];
        cndt   = Convert.ToDateTime(cndate);

        int r1    = grdBookDetails.Rows.Count;
        int cntr1 = 0;

        if (Session["UserName"] != null)
        {
            CNNo = Convert.ToInt32(txtCnno.Text.Trim());

            CreditNote _obedtcn = new CreditNote();
            LedgerCN   _obedtld = new LedgerCN();

            try
            {
                foreach (GridViewRow Row in grdBookDetails.Rows)
                {
                    CheckBox chkBxSelect = (CheckBox)Row.FindControl("chkBxSelect");

                    if (chkBxSelect != null)
                    {
                        if (chkBxSelect.Checked == true)
                        {
                            // bool chkbx = ((CheckBox)Row.FindControl("chkBxSelect")).;

                            string RQty = (((TextBox)Row.FindControl("txtretquty")).Text.Trim());
                            //string DfQty = ((TextBox)Row.FindControl("txtdefquty")).Text;
                            string CrQty = (((TextBox)Row.FindControl("txtquty")).Text.Trim());
                            string AtID  = (((Label)Row.FindControl("lblDAutoID")).Text.Trim());

                            _obedtcn.AutoID = Convert.ToInt32(AtID);
                            _obedtcn.CNNo   = CNNo;
                            //_obedtcn.CustCode = (DDLCustomer.SelectedValue);
                            _obedtcn.CustCode     = CustCode; //txtcustomer.Text.Trim().ToString();
                            _obedtcn.BookCode     = (((Label)Row.FindControl("lblBookCode")).Text.Trim());
                            _obedtcn.Rate         = Convert.ToDecimal(((TextBox)Row.FindControl("txtrate")).Text.Trim());
                            _obedtcn.Discount     = Convert.ToDecimal(((TextBox)Row.FindControl("txtDiscount")).Text.Trim());
                            _obedtcn.ReturnQty    = Convert.ToInt32(CrQty);
                            _obedtcn.Comment      = (((TextBox)Row.FindControl("txtcmmt")).Text.Trim());
                            _obedtcn.IsActive     = true;
                            _obedtcn.UpdatedBy    = Session["UserName"].ToString();
                            _obedtcn.Flag         = (((Label)Row.FindControl("lblflag")).Text.Trim());
                            _obedtcn.TotReturnQty = Convert.ToInt32(RQty);
                            _obedtcn.DefectQty    = 0;
                            _obedtcn.IsDeleted    = false;
                            _obedtcn.strFY        = Convert.ToInt32(strFY);
                            _obedtcn.CNDate       = cndt;
                            _obedtld.CNDate       = cndt;
                            if (txtGCN.Text != "")
                            {
                                _obedtcn.GCN = Convert.ToInt32(txtGCN.Text);
                            }
                            else
                            {
                                _obedtcn.GCN = 0;
                            }
                            if (txtSCN.Text != "")
                            {
                                _obedtcn.SCN = Convert.ToInt32(txtSCN.Text);
                            }
                            else
                            {
                                _obedtcn.SCN = 0;
                            }
                            _obedtcn.LrNo          = txtlRNO.Text.Trim().ToString();
                            _obedtcn.TransportName = lbltransporter.Text.Trim().ToString();
                            _obedtcn.Update_CN(Convert.ToInt32(strFY));
                            cntr1 = cntr1 + 1;
                        }
                    }
                }
                //_obedtcn.AutoID = Convert.ToInt32(AtID);
                //_obedtcn.CNNo = CNNo;
                //_obedtcn.CustCode = (DDLCustomer.SelectedValue);
                //_obedtcn.BookCode = ((Label)grdBookDetails.Rows[e.NewEditIndex].FindControl("lblBookCode")).Text;
                //_obedtcn.Rate = Convert.ToDecimal(((TextBox)grdBookDetails.Rows[e.NewEditIndex].FindControl("txtrate")).Text.Trim());
                //_obedtcn.Discount = Convert.ToDecimal(((TextBox)grdBookDetails.Rows[e.NewEditIndex].FindControl("txtDiscount")).Text.Trim());
                //_obedtcn.ReturnQty = Convert.ToInt32(CrQty);
                //_obedtcn.Comment = ((TextBox)grdBookDetails.Rows[e.NewEditIndex].FindControl("txtcmmt")).Text;
                //_obedtcn.IsActive = true;
                //_obedtcn.UpdatedBy = Session["UserName"].ToString();
                //_obedtcn.Flag = ((Label)grdBookDetails.Rows[e.NewEditIndex].FindControl("lblflag")).Text;
                //_obedtcn.TotReturnQty = Convert.ToInt32(RQty);
                //_obedtcn.DefectQty = 0;
                //_obedtcn.IsDeleted = false;

                //_obedtcn.Update_CN();

                if (cntr1 == 0)
                {
                    MessageBox("Select Record To Update");
                }
                if (cntr1 > 0)
                {
                    _obedtld.CNNo   = CNNo;
                    _obedtld.strFY  = Convert.ToInt32(Convert.ToInt32(strFY));
                    _obedtld.CNDate = cndt;
                    if (ISExcise.Checked == true)
                    {
                        _obedtld.IsExciseApplicable = "1";
                    }
                    else
                    {
                        _obedtld.IsExciseApplicable = "0";
                    }
                    _obedtld.Ledger_CN("ExiseApply");

                    MessageBox("Record Updated Successfully");
                    CustCode         = null;
                    txtcustomer.Text = "";
                    lblCustName.Text = "";
                    Bindgrdcn();

                    quantity = 0;
                    tamount  = 0;

                    DataTable dt1 = new DataTable();
                    dt1 = DCReturnBook.GetCustAddress(cust, "CNCustlist").Tables[0];
                    if (dt1.Rows.Count > 0)
                    {
                        lblCNNo.Text        = (txtCnno.Text.Trim());
                        lblCustName1.Text   = dt1.Rows[0]["CustName"].ToString();
                        lblCustAddress.Text = dt1.Rows[0]["Address"].ToString();
                    }
                    PnlAddbk.Visible = false;
                    btn_Save.Visible = false;
                    PnlPrint.Visible = true;
                    btnPrint.Visible = true;
                }
            }
            catch
            {
            }
            btnPrint.Focus();
        }
    }
示例#11
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        cndate = txtCNDate.Text.Split('/')[2] + "/" + txtCNDate.Text.Split('/')[1] + "/" + txtCNDate.Text.Split('/')[0];
        cndt   = Convert.ToDateTime(cndate);

        bool flag  = false;
        int  flag1 = 0;
        int  flag2 = 0;

        CNNo = 0;
        int GCN;
        int SCN;

        if (Txtgcn.Text.Trim() == "")
        {
            Txtgcn.Text = "0";
        }
        if (Txtscn.Text.Trim() == "")
        {
            Txtscn.Text = "0";
        }

        GCN = Convert.ToInt32(Txtgcn.Text.Trim());
        SCN = Convert.ToInt32(Txtscn.Text.Trim());
        if (Session["UserName"] != null)
        {
            DCReturnBook _obdcrtbk = new DCReturnBook();
            CreditNote   _obcn     = new CreditNote();
            LedgerCN     _oblcn    = new LedgerCN();
            try
            {
                foreach (GridViewRow Row in Grd2.Rows)
                {
                    string RQty = ((TextBox)Row.FindControl("txtreturn")).Text.Trim();
                    int    qty  = (Convert.ToInt32(RQty));
                    string cmt  = ((TextBox)Row.FindControl("txtcmmt")).Text.Trim();

                    if (qty > 0)
                    {
                        flag1 = flag1 + 1;
                        if (cmt != "")
                        {
                            flag2 = flag2 + 1;
                        }
                        else
                        {
                        }
                    }
                }

                if (flag1 == 0)
                {
                    MessageBox("Please Enter Return Quantity");
                    Panel2.Visible = true;
                }
                if (flag1 > flag2)
                {
                    MessageBox("Please Enter Comment For Respective Quantity");
                    Panel2.Visible = true;
                }

                if (flag1 == flag2)
                {
                    CNNo         = Convert.ToInt32(CreditNote.GetCNNo(Convert.ToInt32(strFY)));
                    lblCNNo.Text = CreditNote.GetCNNo(Convert.ToInt32(strFY));
                    foreach (GridViewRow Row in Grd2.Rows)
                    {
                        _obdcrtbk.DCReturnBkID = 0;
                        _obdcrtbk.CustCode     = CustCode;
                        _obdcrtbk.BookCode     = (((Label)Row.FindControl("lblbkcode")).Text.Trim());
                        string RQty  = ((TextBox)Row.FindControl("txtreturn")).Text.Trim();
                        int    rqty1 = Convert.ToInt32(RQty);
                        _obdcrtbk.ReturnQty = Convert.ToInt32(RQty);
                        string cmt = ((TextBox)Row.FindControl("txtcmmt")).Text.Trim();
                        _obdcrtbk.Comment   = ((TextBox)Row.FindControl("txtcmmt")).Text.Trim();
                        _obdcrtbk.CreatedBy = Session["UserName"].ToString();
                        _obdcrtbk.Flag      = "DC";
                        string dqty = ((TextBox)Row.FindControl("txtDefect")).Text.Trim();
                        // _obdcrtbk.DefectQty = Convert.ToInt32(dqty);
                        _obdcrtbk.DefectQty = 0;
                        _obdcrtbk.strFY     = Convert.ToInt32(strFY);

                        if (RdbtnYN.SelectedValue == "1")
                        {
                            _obcn.AutoID   = 0;
                            _obcn.CNNo     = CNNo;
                            _obcn.CustCode = CustCode;
                            _obcn.BookCode = (((Label)Row.FindControl("lblbkcode")).Text.Trim());
                            _obcn.Rate     = Convert.ToDecimal(((DropDownList)Row.FindControl("DDLR")).SelectedValue);
                            _obcn.Discount = Convert.ToDecimal(((DropDownList)Row.FindControl("DDLD")).SelectedValue);

                            string CNqty = ((TextBox)Row.FindControl("txtCN")).Text.Trim();
                            _obcn.ReturnQty    = Convert.ToInt32(CNqty);
                            _obcn.DefectQty    = 0;
                            _obcn.TotReturnQty = Convert.ToInt32(RQty);
                            _obcn.Comment      = ((TextBox)Row.FindControl("txtcmmt")).Text.Trim();
                            _obcn.IsActive     = true;
                            _obcn.GCN          = GCN;
                            _obcn.SCN          = SCN;
                            _obcn.CreatedBy    = Session["UserName"].ToString();
                            _obcn.Flag         = "DC";
                            _obcn.strFY        = Convert.ToInt32(strFY);
                            _obcn.CNDate       = cndt;

                            _obcn.TransportName = lbltransporter.Text.ToString();
                            _obcn.LrNo          = txtlrno.Text.ToString();
                            _obcn.Remark1       = "";
                            _obcn.Remark2       = "";
                            _obcn.Remark3       = "";
                            _obcn.Remark4       = "";
                            _obcn.Remark5       = "";
                        }
                        else
                        {
                        }

                        if (rqty1 > 0 && cmt != "")
                        {
                            _obdcrtbk.Save_DC_ReturnBook(Convert.ToInt32(strFY));

                            if (RdbtnYN.SelectedValue == "1")
                            {
                                _oblcn.CNNo   = CNNo;
                                _oblcn.strFY  = Convert.ToInt32(strFY);
                                _oblcn.CNDate = cndt;
                                _obcn.Save_CN(Convert.ToInt32(strFY));
                            }
                            else
                            {
                            }
                            flag = true;

                            //bind grid to display printdata
                            Bindgrdcn();
                        }
                        else
                        {
                        }
                    }
                }

                if (flag)
                {
                    try
                    {
                        if (RdbtnYN.SelectedValue == "1")
                        {
                            _oblcn.Ledger_CN();
                            MessageBox(Constants.save + "\\r\\n CreditNote No: " + CNNo);
                            //BindGrd2();
                            PnlPrint.Visible    = true;
                            btnPrint.Visible    = true;
                            btnaddBooks.Visible = false;
                            txtcustomer.Enabled = true;
                        }
                        else
                        if (RdbtnYN.SelectedValue == "0")
                        {
                            MessageBox(Constants.save);
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox("Error : " + ex.Message.ToString());
                        clearall();
                        Txtgcn.Focus();
                    }
                    Panel2.Visible = false;
                    // RdbtnYN.SelectedIndex = 0;
                    // txtcustomer.Text = "";
                    //lblCustName.Text = "";
                }
            }
            catch (Exception ex)
            {
                MessageBox("Error : " + ex.Message.ToString());
            }
        }
    }
示例#12
0
    //protected void btnview_Click(object sender, EventArgs e)
    //{
    //    BindGrd3();
    //    if (Grd3.Rows.Count > 0)
    //    {
    //        Grd3.Focus();
    //        Panel3.Visible = true;
    //        Panelview.Visible = false;
    //    }
    //    else
    //    {
    //        MessageBox("Record Not Available");
    //    }
    //}

    #region Binddata method
    public void BindGrd3()
    {
        Grd3.DataSource = DCReturnBook.Get_DC_ReturnBook((DDLCustomer.SelectedValue), "DCrtbk").Tables[1];
        Grd3.DataBind();
    }