Ejemplo n.º 1
0
        protected void GetInvoiceDetails()
        {
            #region  getHeaderDetails
            query = "Select A.[DOCUMENT_NO],CONVERT(VARCHAR(11),A.[DOCUMENT_DATE] ,106) as [DOCUMENT_DATE], A.PURCH_INDENTNO, CONVERT(VARCHAR(11),A.[PURCH_INDENTDATE],106) AS PURCH_INDENTDATE, " +
                    "A.MATERIAL_VALUE, A.PURCH_RECIEPTNO, A.TRANSPORTER_CODE,A.VEHICAL_NO, A.VEHICAL_TYPE, A.[SALE_INVOICENO] AS INVOICENO, " +
                    " CONVERT(VARCHAR(11), A.[SALE_INVOICEDATE],106) AS INVOICEDATE from [ax].[ACXPURCHINVRECIEPTHEADER] A where A.[SITE_Code]='" + Session["SiteCode"].ToString() + "' " +
                    "and A.[DATAAREAID]='" + Session["DATAAREAID"].ToString() + "' and A.PURCH_RECIEPTNO='" + drpRecieptNo.SelectedItem.Text + "' ";

            dt = new DataTable();
            dt = obj.GetData(query);
            if (dt.Rows.Count > 0)
            {
                txtReceiptDate.Text = dt.Rows[0]["DOCUMENT_DATE"].ToString();
                txtInvoiceDate.Text = dt.Rows[0]["INVOICEDATE"].ToString();
                // decimal materialValue = Convert.ToDecimal(dt.Rows[0]["MATERIAL_VALUE"].ToString());
                txtReceiptValue.Text = "0.00";
            }

            #endregion

            #region  Product Details
            query = "exec ACX_GET_NONSALABLEINVOICEDETAIL '" + Session["SiteCode"].ToString() + "','" + Session["DATAAREAID"].ToString() + "','" + drpRecieptNo.SelectedItem.Text + "',0";
            dt    = new DataTable();
            dt    = obj.GetData(query);
            if (dt.Rows.Count > 0)
            {
                DDLMaterialCode.DataSource     = dt;
                DDLMaterialCode.DataTextField  = "PRODUCTDESC";
                DDLMaterialCode.DataValueField = "PRODUCT_CODE";
                DDLMaterialCode.DataBind();
                DDLMaterialCode.Items.Insert(0, new ListItem("--Select--", "0"));
            }
            #endregion
        }
Ejemplo n.º 2
0
 protected void GetProduct()
 {
     #region  Product Details
     dt = (DataTable)Session["MarketVRSDetails"];
     if (dt != null)
     {
         DDLMaterialCode.DataSource     = dt;
         DDLMaterialCode.DataTextField  = "PRODUCT_NAME";
         DDLMaterialCode.DataValueField = "PRODUCTCODE";
         DDLMaterialCode.DataBind();
         DDLMaterialCode.Items.Insert(0, new ListItem("--Select--", "0"));
     }
     #endregion
 }
        protected void GetProduct()
        {
            #region  Product Details
            string bucode;
            if (ddlBusinessUnit.SelectedIndex == 0)
            {
                bucode = "";
            }
            else
            {
                bucode = ddlBusinessUnit.SelectedValue;
            }
            dt = new DataTable();
            if (rdoColdRoomDistruction.Checked == true)
            {
                query = "exec ACX_GETDISTRUCTIONPRODUCTDETAILS '" + Session["SiteCode"].ToString() + "',0,'" + bucode + "'";
                dt    = obj.GetData(query);
            }
            else if (rdoMarketReturnDistruction.Checked == true)
            {
                // query = "exec ACX_GETDISTRUCTIONPRODUCTDETAILS '" + Session["SiteCode"].ToString() + "',1";

                dt = (DataTable)Session["MarketDistructionDetails"];
                if (dt != null)
                {
                    var Value = dt.Select("Cust_Group ='" + ddlCustomerGroup.Text.Trim() + "' AND CUSTOMER_CODE ='" + ddlCustomer.Text.Trim() + "'");
                    dt = Value.CopyToDataTable();

                    var       distValue = dt.DefaultView.ToTable(true, "PRODUCT_NAME", "PRODUCTCODE");
                    DataTable dtCust    = new DataTable();
                    dtCust = (DataTable)distValue;
                    dt     = dtCust;
                }
            }


            if (dt != null)
            {
                DDLMaterialCode.DataSource     = dt;
                DDLMaterialCode.DataTextField  = "PRODUCT_NAME";
                DDLMaterialCode.DataValueField = "PRODUCTCODE";
                DDLMaterialCode.DataBind();
                DDLMaterialCode.Items.Insert(0, new ListItem("--Select--", "0"));
            }
            #endregion
        }
Ejemplo n.º 4
0
        private bool ValidateLineItemAdd()
        {
            bool b = true;

            if (DDLMaterialCode.Text == string.Empty || DDLMaterialCode.Text == "--Select--")
            {
                string message = "alert('Select Product First !');";
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alert", message, true);
                DDLMaterialCode.Focus();
                b = false;
                return(b);
            }
            if (txtValue.Text == string.Empty)
            {
                txtValue.Text = "0";
            }
            if (txtBoxQty.Text == string.Empty || txtBoxQty.Text == "0")
            {
                b = false;
                string message = "alert('Qty cannot be left blank !');";
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alert", message, true);
                txtBoxQty.Focus();
                return(b);
            }
            if (txtPcsQty.Text == string.Empty)
            {
                txtPcsQty.Text = "0";
            }
            if (txtBatch.Text == string.Empty)
            {
                string message = "alert('Please Provide Batch No !');";
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alert", message, true);
                txtBatch.Focus();
                b = false;
                return(b);
            }
            if (txtMDF.Text == string.Empty)
            {
                string message = "alert('Please Provide MDF !');";
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alert", message, true);
                txtMDF.Focus();
                b = false;
                return(b);
            }
            foreach (GridViewRow grv in gvDetails.Rows)
            {
                DataTable dt = new DataTable();
                if (Session["ProductDetails"] != null)
                {
                    dt = (DataTable)Session["ProductDetails"];
                    if (dt.Rows.Count > 0)
                    {
                        string sqty = Convert.ToString(dt.Compute("Sum(QtyBox)", "ProductCode ='" + DDLMaterialCode.SelectedItem.Value + "'"));
                        if (sqty == "")
                        {
                            sqty = "0";
                        }
                        decimal sumQty = Convert.ToDecimal(sqty) + Convert.ToDecimal(txtBoxQty.Text);
                        if (sumQty > Convert.ToDecimal(txtStockQty.Text))
                        {
                            string message = "alert('Distruction Qty cannot be more than quantity available to move.!!');";
                            ScriptManager.RegisterStartupScript(this, typeof(Page), "Validation", message, true);
                            b = false;
                            return(b);
                        }
                    }
                }
            }
            if (Convert.ToDecimal(txtValue.Text) <= 0)
            {
                string message = "alert('Claim value should be more than zero.!!');";
                ScriptManager.RegisterStartupScript(this, typeof(Page), "Validation", message, true);
                b = false;
                return(b);
            }
            return(b);
        }
Ejemplo n.º 5
0
        private bool ValidateLineItemAdd()
        {
            bool b = true;

            if (DDLMaterialCode.Text == string.Empty || DDLMaterialCode.Text == "--Select--")
            {
                string message = "alert('Select Product First !');";
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alert", message, true);
                DDLMaterialCode.Focus();
                b = false;
                return(b);
            }
            if (txtBatch.Text == string.Empty)
            {
                string message = "alert('Please Provide Batch No !');";
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alert", message, true);
                txtBatch.Focus();
                b = false;
                return(b);
            }
            if (txtMDF.Text == string.Empty)
            {
                string message = "alert('Please Provide MDF !');";
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alert", message, true);
                txtMDF.Focus();
                b = false;
                return(b);
            }
            decimal totalBox = Convert.ToDecimal(txtBoxQty.Text) + (Convert.ToDecimal(txtPcsQty.Text) / Convert.ToDecimal(txtPackSize.Text));

            if (totalBox == 0)
            {
                b = false;
                string message = "alert('Qty cannot be left blank !');";
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alert", message, true);
                txtBoxQty.Focus();
                return(b);
            }
            if (txtPcsQty.Text == string.Empty)
            {
                txtPcsQty.Text = "0";
            }
            if (txtPackSize.Text == "" || txtPackSize.Text == "0")
            {
                txtPackSize.Text = "1";
            }
            if (Convert.ToDecimal(txtBoxQty.Text) < 0)
            {
                b = false;
                string message = "alert('Distruction qty box cannot be less than zero!');";
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alert", message, true);
                txtBoxQty.Focus();
                return(b);
            }
            if (Convert.ToDecimal(txtPcsQty.Text) < 0)
            {
                b = false;
                string message = "alert('Distruction qty pcs cannot be less than zero!');";
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alert", message, true);
                txtPcsQty.Focus();
                return(b);
            }
            if (txtMDF.Text == string.Empty)
            {
                txtMDF.Text = System.DateTime.Today.ToString("dd-MMM-yyyy");
            }
            if (Convert.ToDecimal(txtActualClaim.Text) <= 0)
            {
                string message = "alert('Claim amount should be more than zero.!!');";
                ScriptManager.RegisterStartupScript(this, typeof(Page), "Validation", message, true);
                b = false;
                return(b);
            }
            ////=====Same product cant add-===================
            //foreach (GridViewRow grv in gvDetails.Rows)
            //{
            //    string product = grv.Cells[1].Text;
            //    if (DDLMaterialCode.SelectedItem.Value == product)
            //    {
            //        string message = "alert('" + DDLMaterialCode.SelectedItem.Text + " is already exists in the list .Please Select Another Product !!');";
            //        ScriptManager.RegisterStartupScript(this, typeof(Page), "Validation", message, true);
            //        b = false;
            //        return b;
            //    }
            //}
            return(b);
        }