Beispiel #1
0
 protected void rbtbookset_CheckedChanged(object sender, EventArgs e)
 {
     txtMRCode.Visible      = false;
     lblmrcode.Visible      = false;
     lblbookset.Visible     = true;
     txtMRCode.Text         = "";
     SalesmanLedger.Visible = false;
     DDLSelectSet.Visible   = true;
     DDLSelectSet.Focus();
 }
    protected void txtbankdet_TextChanged(object sender, EventArgs e)
    {
        string BankCode = txtbankdet.Text.ToString().Split(':')[0].Trim();


        DataTable dt = new DataTable();

        dt = DCMaster.Get_Name(BankCode, "Bank").Tables[0];
        if (dt.Rows.Count != 0)
        {
            txtbankdet.Text  = BankCode;
            lblbankname.Text = Convert.ToString(dt.Rows[0]["BankName"]);
            DDLSelectSet.Focus();
        }


        else
        {
            lblbankname.Text = "No such Bank code";
            txtbankdet.Focus();
            txtbankdet.Text = "";
        }
    }
    protected void btngetset_Click(object sender, EventArgs e)
    {
        if (ViewState["srate"].ToString() == "")
        {
            MessageBox("Kindly select Employee");
            //txtsalemanCode.Focus();
            ViewState["srate"] = "";
        }
        else
        {
            setStateGridview();
            Qty = Convert.ToString(txtsetqty.Text.Trim());
            if (Qty == "" || Qty == "0")
            {
                Qty  = "1";
                rqty = "1";
            }
            if (txtsetqty.Text != "")
            {
                rqty = Convert.ToString(txtsetqty.Text);
                Qty  = Convert.ToString(txtsetqty.Text);
            }
            if (txtGCN.Text != "")
            {
                grdBookDetails.Columns[7].Visible = true;
                grdBookDetails.Columns[8].Visible = true;
                // grdBookDetails.Columns[10].Visible = false;
            }
            else
            {
                grdBookDetails.Columns[7].Visible = false;
                grdBookDetails.Columns[8].Visible = false;
                //  grdBookDetails.Columns[10].Visible = true;
            }
            if (DDLSelectSet.SelectedValue == "0")
            {
                loder("Kindly select bookset");
                DDLSelectSet.Focus();
            }
            else
            {
                try
                {
                    DataTable bookdescription = new DataTable();
                    bookdescription = BookSetDetails.GetDescription_Of_bookset((Convert.ToInt32(DDLSelectSet.SelectedItem.Value)), "Specimen").Tables[0];
                    Description     = bookdescription.Rows[0]["Description"].ToString();


                    DataTable dt1 = new DataTable();
                    if (Session["tempBookData"] != null)
                    {
                        Session["tempBookData"] = fillTempBookData("", "set");
                        dt1 = (DataTable)Session["tempBookData"];
                    }
                    else
                    {
                        Session["tempBookData"] = fillTempBookData("", "set");
                        dt1 = (DataTable)Session["tempBookData"];
                    }
                    foreach (GridViewRow row in grdBookDetails.Rows)
                    {
                        ((Label)row.FindControl("lblavailable")).Visible = false;
                    }
                    grdBookDetails.DataSource = dt1;
                    grdBookDetails.DataBind();
                    loder(DDLSelectSet.SelectedItem.Text + "(bookset) added successfully");
                    string jv1 = "clearBookset()";
                    ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "as", jv1, true);
                }
                catch
                {
                }
            }
        }
    }
    protected void btngetset_Click(object sender, EventArgs e)
    {
        //Validate Bookset
        if (DDLSelectSet.SelectedValue != "0")
        {
            Qty = Convert.ToString(txtsetqty.Text.Trim());
            if (Qty != "" && Qty != "0")
            {
                DataTable dt = Other_Z.OtherBAL.GetValidate_Speciman(Convert.ToInt32(DDLSelectSet.SelectedItem.Value), Qty, txtsalemanCode.Text.Trim(), Convert.ToInt32(strFY), "", "").Tables[0];

                if (dt.Rows.Count > 0)
                {
                    if (Convert.ToInt32(dt.Rows[0][0]) >= 0)
                    {
                    }
                    else
                    {
                        //MessageBox("Out of Limit Book Set " + DDLSelectSet.SelectedItem);
                        MessageBox("Out of Limit Book Set" + DDLSelectSet.SelectedItem + "  " + " Total Limit(" + dt.Rows[0][1] + ")" + "  " + " Remaining Limit(" + dt.Rows[0][2] + ")");
                        txtsetqty.Text = "";
                        txtsetqty.Focus();
                        return;
                    }
                }
                else
                {
                    MessageBox("Please Set BookSet Limit " + DDLSelectSet.SelectedItem);
                    txtsetqty.Text = "";
                    txtsetqty.Focus();
                    return;
                }
            }
            else
            {
                MessageBox("Please Enter Quntity");
                txtsetqty.Focus();
                return;
            }
        }
        else
        {
            MessageBox("Please Select Book Set");
            DDLSelectSet.Focus();
            return;
        }

        if (ViewState["srate"].ToString() == "")
        {
            MessageBox("Kindly select Employee");
            txtsalemanCode.Focus();
            ViewState["srate"] = "";
        }
        else
        {
            setStateGridview();
            Qty = Convert.ToString(txtsetqty.Text.Trim());
            if (Qty == "" || Qty == "0")
            {
                Qty  = "1";
                rqty = "1";
            }
            if (txtsetqty.Text != "")
            {
                rqty = Convert.ToString(txtsetqty.Text);
                Qty  = Convert.ToString(txtsetqty.Text);
            }
            if (txtdoc.Text != "")
            {
                grdBookDetails.Columns[7].Visible = true;
                grdBookDetails.Columns[8].Visible = true;
                // grdBookDetails.Columns[10].Visible = false;
            }
            else
            {
                grdBookDetails.Columns[7].Visible = false;
                grdBookDetails.Columns[8].Visible = false;
                //  grdBookDetails.Columns[10].Visible = true;
            }
            if (DDLSelectSet.SelectedValue == "0")
            {
                loder("Kindly select bookset");
                DDLSelectSet.Focus();
            }
            else
            {
                try
                {
                    DataTable bookdescription = new DataTable();
                    bookdescription = BookSetDetails.GetDescription_Of_bookset((Convert.ToInt32(DDLSelectSet.SelectedItem.Value)), "Specimen").Tables[0];
                    Description     = bookdescription.Rows[0]["Description"].ToString();


                    DataTable dt1 = new DataTable();
                    if (Session["tempBookData"] != null)
                    {
                        Session["tempBookData"] = fillTempBookData("", "set");
                        dt1 = (DataTable)Session["tempBookData"];
                    }
                    else
                    {
                        Session["tempBookData"] = fillTempBookData("", "set");
                        dt1 = (DataTable)Session["tempBookData"];
                    }
                    foreach (GridViewRow row in grdBookDetails.Rows)
                    {
                        ((Label)row.FindControl("lblavailable")).Visible = false;
                    }
                    grdBookDetails.DataSource = dt1;
                    grdBookDetails.DataBind();
                    loder(DDLSelectSet.SelectedItem.Text + "(bookset) added successfully");
                    string jv1 = "clearBookset()";
                    ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "as", jv1, true);
                }
                catch
                {
                }
            }
        }
    }
    protected void btngetset_Click(object sender, EventArgs e)
    {
        if (srate == "")
        {
            MessageBox("Kindly select Customer");
            txtcustomer.Focus();
        }
        else
        {
            if (txtDeliverydte.Text != "")
            {
                //if (Convert.ToDateTime(Convert.ToDateTime(txtDeliverydte.Text).ToShortDateString()) < Convert.ToDateTime(DateTime.Now.ToShortDateString()))
                //{
                setStateGridview();
                AddRate();
                Qty  = Convert.ToString(txtsetqty.Text.Trim());
                rqty = Convert.ToString(txtbookqty.Text.Trim());
                string date = txtDeliverydte.Text.Split('/')[1] + "/" + txtDeliverydte.Text.Split('/')[0] + "/" + txtDeliverydte.Text.Split('/')[2];

                Delidate = Convert.ToDateTime(date);

                if (Qty == "" || Qty == "0")
                {
                    Qty  = "1";
                    rqty = "1";
                }
                if (txtsetqty.Text != "")
                {
                    rqty = Convert.ToString(txtsetqty.Text.Trim());
                    Qty  = Convert.ToString(txtsetqty.Text.Trim());
                }
                if (txtdoc.Text != "")
                {
                    grdBookDetails.Columns[5].Visible = true;
                    grdBookDetails.Columns[4].Visible = true;
                    // grdBookDetails.Columns[10].Visible = false;
                }
                else
                {
                    grdBookDetails.Columns[5].Visible = false;
                    grdBookDetails.Columns[4].Visible = false;
                    //  grdBookDetails.Columns[10].Visible = true;
                }
                if (DDLSelectSet.SelectedValue == "0")
                {
                    loder("Kindly select bookset");
                    DDLSelectSet.Focus();
                }
                else
                {
                    try
                    {
                        DataTable dt1 = new DataTable();
                        if (Session["tempDCData"] != null)
                        {
                            Session["tempDCData"] = fillTempBookData("", "set");
                            dt1 = (DataTable)Session["tempDCData"];
                        }
                        else
                        {
                            Session["tempDCData"] = fillTempBookData("", "set");
                            dt1 = (DataTable)Session["tempDCData"];
                        }
                        foreach (GridViewRow row in grdBookDetails.Rows)
                        {
                            ((Label)row.FindControl("lblavailable")).Visible = false;
                        }
                        grdBookDetails.DataSource = dt1;
                        grdBookDetails.DataBind();
                        loder(DDLSelectSet.SelectedItem.Text + "(bookset) added successfully");
                        string jv1 = "clearBookset()";
                        ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "as", jv1, true);
                        DDLSelectSet.Focus();
                    }
                    catch
                    {
                    }
                }
                //}
                //else {
                //    MessageBox("Delivery date should be more than todays date");
                //    txtDeliverydte.Focus();
                //}
            }
            else
            {
                MessageBox("Select delivery date");
                txtDeliverydte.Focus();
            }
        }
    }