Exemplo n.º 1
0
 protected void btngetreport_Click(object sender, EventArgs e)
 {
     try
     {
         if (Rdboutward.SelectedValue == "Outward")
         {
             DataTable dt = OutwardDetail.Get_OutwardDetails(txtoutwardno1.Text.ToString().Trim(), "Outward", "G", Convert.ToInt32(strFY), Convert.ToDateTime("2011/2/2"), Convert.ToDateTime("2012/3/3")).Tables[0];
             GrdOD.DataSource = dt;
             GrdOD.DataBind();
         }//[Idv_Chetana_Get_OutwardDetails]
         else
         if (Rdboutward.SelectedValue == "Invoice")
         {
             DataTable dt = OutwardDetail.Get_OutwardDetails(txtoutwardno1.Text.ToString().Trim(), "ss", "I", Convert.ToInt32(strFY), Convert.ToDateTime("2011/2/2"), Convert.ToDateTime("2012/3/3")).Tables[0];
             GrdOD.DataSource = dt;
             GrdOD.DataBind();
         }
         else
         {
             DataTable dt = OutwardDetail.Get_OutwardDetails(txtoutwardno1.Text.ToString().Trim(), "ss", "D", Convert.ToInt32(strFY), Convert.ToDateTime("2011/2/2"), Convert.ToDateTime("2012/3/3")).Tables[0];
             GrdOD.DataSource = dt;
             GrdOD.DataBind();
         }
     }
     catch { }
 }
Exemplo n.º 2
0
 protected void btnadd_Click(object sender, EventArgs e)
 {
     try
     {
         if (RdbtnSelect.SelectedValue == "Invoice")
         {
             flag  = "I";
             TFlag = 'I';
             DataTable dt1 = new DataTable();
             dt1 = OutwardDetail.GetCustN_Invoice(Convert.ToDecimal(Txtno.Text.Trim()), Convert.ToInt32(strFY)).Tables[0];
             if (dt1.Rows.Count != 0)
             {
                 lblCustName.Text = Convert.ToString(dt1.Rows[0]["CustName"]);
                 lblArea.Text     = Convert.ToString(dt1.Rows[0]["AreaName"]);
                 Adddata();
             }
             else
             {
                 btnSave.Visible = false;
                 message("Records Not Available");
                 Txtno.Focus();
             }
         }
         if (RdbtnSelect.SelectedValue == "Document")
         {
             flag  = "D";
             TFlag = 'D';
             DataTable dt2 = new DataTable();
             try
             {
                 dt2 = OutwardDetail.GetCustN_Doc(Convert.ToInt32(Txtno.Text.Trim()), Convert.ToInt32(strFY)).Tables[0];
                 if (dt2.Rows.Count != 0)
                 {
                     lblCustName.Text = Convert.ToString(dt2.Rows[0]["CustName"]);
                     lblArea.Text     = Convert.ToString(dt2.Rows[0]["AreaName"]);
                     Adddata();
                     //btngetRec.Focus();
                 }
                 else
                 {
                     btnSave.Visible = false;
                     message("Records Not Available");
                     Txtno.Focus();
                 }
             }
             catch { message("Plase Enter Correct DC Number"); }
         }
     }
     catch
     {
     }
 }
Exemplo n.º 3
0
    public void BindOutWard()
    {
        if (Request.QueryString["d"] != null && Request.QueryString["sd"] != null)
        {
            DataTable dt = OutwardDetail.Get_OutwardDetails(Request.QueryString["d"].ToString().Trim(), Request.QueryString["sd"].ToString().Trim(), Request.QueryString["IOD"].ToString().Trim()
                                                            , Convert.ToInt32(Request.QueryString["FY"].ToString().Trim())).Tables[0];

            DataView dv = new DataView(dt);


            ReportDocument rd = new ReportDocument();
            rd.Load(Server.MapPath("../Report/OutWardReport.rpt"));
            rd.Database.Tables[0].SetDataSource(dv);

            Printoutward.ReportSource = rd;
        }
    }
Exemplo n.º 4
0
    protected void GrdOD_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        OutwardDetail objodd = new OutwardDetail();

        OutDetailID = Convert.ToInt32(((Label)GrdOD.Rows[e.RowIndex].FindControl("lbldetailid")).Text);

        try
        {
            if (OutDetailID != 0)
            {
                objodd.OdDAutoId    = OutDetailID;
                objodd.IsActive     = false;
                objodd.InvoiceNo    = ((Label)GrdOD.Rows[e.RowIndex].FindControl("LblInvoiceNo")).Text.Trim();
                objodd.CustomerName = ((Label)GrdOD.Rows[e.RowIndex].FindControl("LblCustN")).Text.Trim();
                objodd.CustArea     = ((Label)GrdOD.Rows[e.RowIndex].FindControl("LblArea")).Text.Trim();
                objodd.FY           = Convert.ToInt32(strFY);
                objodd.Save();
            }
            DataTable dt3 = new DataTable();
            dt3 = (DataTable)Session["tempODData"];
            dt3.Rows[e.RowIndex].Delete();
            GrdOD.DataSource = dt3;
            GrdOD.DataBind();
            Session["tempODData"] = dt3;

            if (dt3.Rows.Count == 0)
            {
                btnSave.Visible = false;
            }
            else
            {
                btnSave.Visible = true;
            }
        }
        catch { }
    }
Exemplo n.º 5
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        ODdate = txtOutwardDate.Text.Split('/')[2] + "/" + txtOutwardDate.Text.Split('/')[1] + "/" + txtOutwardDate.Text.Split('/')[0];
        ddt    = Convert.ToDateTime(ODdate);

        if (Session["UserName"] != null)
        {
            if (flag != "")
            {
                try
                {
                    OutwardMaster objodm = new OutwardMaster();
                    OutwardDetail objodd = new OutwardDetail();

                    objodm.OdMAutoId   = 0;
                    objodm.OutWardDate = ddt;
                    objodm.IsActive    = true;
                    objodm.CreatedBy   = Session["UserName"].ToString();
                    objodm.FY          = Convert.ToInt32(strFY);
                    objodm.HandOverTo  = TxtEmp.Text.Trim();
                    objodm.Remarks     = TxtRemark.Text.Trim();
                    objodm.Save(out DocNo, out OdMID);
                    //Txtdocno.Text = Convert.ToString(DocNo);

                    foreach (GridViewRow Row in GrdOD.Rows)
                    {
                        objodd.OdDAutoId = 0;
                        objodd.OdMAutoId = OdMID;

                        objodd.InvoiceOrDC  = ((Label)Row.FindControl("LblFlag")).Text.Trim();
                        objodd.InvoiceNo    = ((Label)Row.FindControl("LblInvoiceNo")).Text.Trim();
                        objodd.CustomerName = ((Label)Row.FindControl("LblCustN")).Text.Trim();
                        objodd.CustArea     = ((Label)Row.FindControl("LblArea")).Text.Trim();
                        objodd.IsActive     = true;
                        objodd.FY           = Convert.ToInt32(strFY);
                        //if (RdbtnSelect.SelectedValue == "Invoice")
                        //{
                        //    TFlag = 'I';
                        //    objodd.InvoiceNo = (Txtno.Text.Trim());
                        //}
                        //if (RdbtnSelect.SelectedValue == "Document")
                        //{
                        //    TFlag = 'D';
                        //    objodd.InvoiceNo = (Txtno.Text.Trim());
                        //}
                        objodd.Save();
                    }
                    MessageBox(Constants.save + "\\r\\n Document No: " + DocNo);
                    //MessageBox(Constants.save);

                    //loder("Last saved Document no. : " + Txtdocno.Text);
                    TxtEmp.Text           = "";
                    Txtno.Text            = "";
                    txtOutwardDate.Text   = DateTime.Now.ToString("dd/MM/yyyy");
                    Session["tempODData"] = null;
                    btnSave.Visible       = false;
                    GrdOD.DataBind();
                }
                catch
                {
                }
            }
        }
    }
Exemplo n.º 6
0
    protected void btnadd_Click(object sender, EventArgs e)
    {
        btnForceAdd.Visible = false;
        try
        {
            if (RdbtnSelect.SelectedValue == "Invoice")
            {
                flag  = "I";
                TFlag = 'I';
                DataTable dt1 = new DataTable();
                dt1 = OutwardDetail.GetCustN_Invoice(Convert.ToDecimal(Txtno.Text.Trim()), Convert.ToInt32(strFY)).Tables[0];
                if (dt1.Rows.Count > 0)
                {
                    if (dt1.Rows[0]["Exist"].ToString().Trim() == "no")
                    {
                        lblCustName.Text = Convert.ToString(dt1.Rows[0]["CustName"]);
                        lblArea.Text     = Convert.ToString(dt1.Rows[0]["AreaName"]);
                        Adddata(Txtno.Text.Trim());
                        Txtno.Focus();
                    }
                    else
                    {
                        message("Invoice No has already been added to OUT Ward Entry. Document No for the same is "
                                + dt1.Rows[0]["RefOut"]);
                        Txtno.Focus();
                    }
                }
                else
                {
                    btnSave.Visible = false;
                    message("Records Not Available");
                    Txtno.Focus();
                }
            }
            if (RdbtnSelect.SelectedValue == "Document")
            {
                flag  = "D";
                TFlag = 'D';
                DataTable dt2 = new DataTable();
                try
                {
                    dt2 = OutwardDetail.GetCustN_Doc(Convert.ToInt32(Txtno.Text.Trim()), Convert.ToInt32(strFY)).Tables[0];
                    if (dt2.Rows.Count > 0)
                    {
                        if (dt2.Rows[0]["Exist"].ToString().Trim() == "no")
                        {
                            lblCustName.Text = Convert.ToString(dt2.Rows[0]["CustName"]);
                            lblArea.Text     = Convert.ToString(dt2.Rows[0]["AreaName"]);
                            Adddata(Txtno.Text.Trim());
                            Txtno.Focus();
                        }   //btngetRec.Focus();
                        else
                        {
                            message("DC No has already been added to OUT Ward Entry. New Document No can be "
                                    + dt2.Rows[0]["NewDCNo"] + " ");
                            lblCustName.Text       = Convert.ToString(dt2.Rows[0]["CustName"]);
                            lblArea.Text           = Convert.ToString(dt2.Rows[0]["AreaName"]);
                            lblSelectedDoc.Text    = dt2.Rows[0]["NewDCNo"].ToString();
                            btnForceAdd.Visible    = true;
                            lblMsg.Visible         = true;
                            lblSelectedDoc.Visible = true;
                            btnForceAdd.Focus();
                        }
                    }
                    else
                    {
                        btnSave.Visible = false;
                        message("Records Not Available");
                        Txtno.Focus();
                    }
                }
                catch (Exception ex) { message("Plase Enter Correct DC Number "); }
            }
            // TNo = Convert.ToDecimal(Txtno.Text.Trim());
            // TCustName = lblCustName.Text.Trim();
            // TAreaName = lblArea.Text.Trim();

            // DataTable dt = new DataTable();
            // if (Session["tempODData"] != null)
            // {
            //     Session["tempODData"] = fillTempODData();
            //     dt = (DataTable)Session["tempODData"];
            // }
            // else
            // {
            //     Session["tempODData"] = fillTempODData();
            //     dt = (DataTable)Session["tempODData"];
            // }
            // GrdOD.DataSource = dt;
            // GrdOD.DataBind();
            //// txtOutwardDate.Text = DateTime.Now.ToString("dd/MM/yyyy");

            // Txtno.Text = "";
            // lblCustName.Text = "";
            // lblArea.Text = "";
            // RdbtnSelect.Focus();
        }
        catch (Exception ex) { message("Plase Enter Correct DC Number " + ex.Message.ToString()); }
    }