예제 #1
0
        protected void DDLProductDesc_SelectedIndexChanged(object sender, EventArgs e)
        {
            //===========Fill Product Group and Product Sub Cat========
            DataTable dt    = new DataTable();
            string    query = "select Product_Group,PRODUCT_SUBCATEGORY  from ax.INVENTTABLE where ItemId='" + DDLProductDesc.SelectedValue.ToString() + "' order by Product_Name";

            dt = baseObj.GetData(query);
            if (dt.Rows.Count > 0)
            {
                DDLProductGroup.Text = dt.Rows[0]["PRODUCT_GROUP"].ToString();
                ProductSubCategory();
                //=============For Product Sub Cat======
                DDLProdSubCategory.Text = dt.Rows[0]["PRODUCT_SUBCATEGORY"].ToString();

                CreamBell_DMS_WebApps.App_Code.Global obj = new CreamBell_DMS_WebApps.App_Code.Global();
                string queryStock = " Select isnull(SUM(INVTS.TRANSQTY),0) AS STOCK From AX.ACXINVENTTRANS INVTS INNER JOIN AX.INVENTTABLE INV  ON INV.ITEMID= INVTS.PRODUCTCODE " +
                                    " WHERE INVTS.DATAAREAID='" + Session["DATAAREAID"] + "' AND INVTS.SiteCode='" + Session["SiteCode"] + "' " +
                                    " AND INVTS.TRANSLOCATION='" + DDLWarehouseFrom.SelectedValue.Trim().ToString() + "' " +
                                    " AND INVTS.PRODUCTCODE ='" + DDLProductDesc.SelectedValue.ToString() + "'";

                object stockValue = obj.GetScalarValue(queryStock);
                if (stockValue != null)
                {
                    txtstock.Text = Convert.ToDecimal(stockValue.ToString()).ToString("0.00");
                }
            }
        }
예제 #2
0
        protected void DDLProductGroup_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                CreamBell_DMS_WebApps.App_Code.Global obj = new CreamBell_DMS_WebApps.App_Code.Global();

                if (DDLProductGroupNew.Text == "ALL")
                {
                    DDLSubCategoryNew.Items.Clear();
                    DDLProductNew.Items.Clear();
                }
                else
                {
                    string strQuery = " Select distinct  replace(replace(PRODUCT_SUBCATEGORY, char(9), ''), char(13) + char(10), '')  as SUBCATEGORY from  " +
                                      " ax.INVENTTABLE where replace(replace(PRODUCT_GROUP, char(9), ''), char(13) + char(10), '') = '" + DDLProductGroupNew.SelectedItem.Text.ToString() + "' ";


                    DDLSubCategoryNew.Items.Clear();
                    DDLSubCategoryNew.Items.Clear();
                    DDLSubCategoryNew.Items.Add("-Select-");
                    obj.BindToDropDownp(DDLSubCategoryNew, strQuery, "SUBCATEGORY", "SUBCATEGORY");
                }
            }
            catch (Exception ex)
            {
                ErrorSignal.FromCurrentContext().Raise(ex);
            }
        }
예제 #3
0
        private void ExcelDownloadGSTR2()
        {
            try
            {
                CreamBell_DMS_WebApps.App_Code.Global obj = new CreamBell_DMS_WebApps.App_Code.Global();
                SqlConnection  conn = new SqlConnection(obj.GetConnectionString());
                SqlCommand     cmd  = new SqlCommand();
                DataTable      dtDataByfilter;
                SqlDataAdapter ad;
                DataSet        dsDataByfilter = new DataSet();
                string         query          = string.Empty;
                conn.Open();
                cmd.Connection     = conn;
                cmd.CommandTimeout = 3600;
                cmd.CommandType    = CommandType.StoredProcedure;

                #region Generating Data For GSTR1_B2B
                cmd.CommandText = "USP_GSTR2_B2B";
                cmd.Parameters.Clear();
                cmd.Parameters.AddWithValue("@SITEID", Session["SiteCode"].ToString());
                cmd.Parameters.AddWithValue("@FROMMONTH", Convert.ToDateTime(txtFromDate.Text));
                cmd.Parameters.AddWithValue("@TOMONTH", Convert.ToDateTime(txtToDate.Text));
                dtDataByfilter = new DataTable("B2B");
                ad             = new SqlDataAdapter(cmd);
                ad.Fill(dtDataByfilter);
                dsDataByfilter.Tables.Add(dtDataByfilter);
                #endregion


                #region Generating Data For GSTR1_CDNR
                cmd.CommandText = "USP_GSTR2_CDNR";
                cmd.Parameters.Clear();
                cmd.Parameters.AddWithValue("@SITEID", Session["SiteCode"].ToString());
                cmd.Parameters.AddWithValue("@FROMMONTH", Convert.ToDateTime(txtFromDate.Text));
                cmd.Parameters.AddWithValue("@TOMONTH", Convert.ToDateTime(txtToDate.Text));
                dtDataByfilter = new DataTable("CDNR");
                ad             = new SqlDataAdapter(cmd);
                ad.Fill(dtDataByfilter);
                dsDataByfilter.Tables.Add(dtDataByfilter);
                #endregion

                #region Generating Data For GSTR1_B2B
                cmd.CommandText = "USP_GSTR2_HSN";
                cmd.Parameters.Clear();
                cmd.Parameters.AddWithValue("@SITEID", Session["SiteCode"].ToString());
                cmd.Parameters.AddWithValue("@FROMMONTH", Convert.ToDateTime(txtFromDate.Text));
                cmd.Parameters.AddWithValue("@TOMONTH", Convert.ToDateTime(txtToDate.Text));
                dtDataByfilter = new DataTable("hsnsum");
                ad             = new SqlDataAdapter(cmd);
                ad.Fill(dtDataByfilter);
                dsDataByfilter.Tables.Add(dtDataByfilter);
                #endregion

                ExcelCreationGSTR2(dsDataByfilter);
            }
            catch (Exception ex)
            {
                ErrorSignal.FromCurrentContext().Raise(ex);
            }
        }
예제 #4
0
        protected void BtnGetProductDetails_Click(object sender, EventArgs e)
        {
            if (txtProductCode.Text != string.Empty)
            {
                CreamBell_DMS_WebApps.App_Code.Global obj = new CreamBell_DMS_WebApps.App_Code.Global();

                string queryFillProductDetails = "Select ITEMID +'-(' + PRODUCT_NAME+')' as PRODUCT_NAME, ITEMID,PRODUCT_GROUP, PRODUCT_SUBCATEGORY " +
                                                 "from ax.INVENTTABLE where replace(replace(ITEMID, char(9), ''), char(13) + char(10), '')= '" + txtProductCode.Text.Trim().ToString() + "'";
                DataTable dtProductDetails = obj.GetData(queryFillProductDetails);
                if (dtProductDetails.Rows.Count > 0 && dtProductDetails.Rows.Count == 1)
                {
                    DDLProductGroup.Items.Clear();
                    DDLProdSubCategory.Items.Clear();
                    DDLProductDesc.Items.Clear();

                    DDLProductGroup.Items.Add(dtProductDetails.Rows[0]["PRODUCT_GROUP"].ToString());
                    DDLProductGroup.SelectedItem.Text = dtProductDetails.Rows[0]["PRODUCT_GROUP"].ToString();

                    DDLProdSubCategory.Items.Add(dtProductDetails.Rows[0]["PRODUCT_SUBCATEGORY"].ToString());
                    DDLProdSubCategory.SelectedItem.Text = dtProductDetails.Rows[0]["PRODUCT_SUBCATEGORY"].ToString();

                    DDLProductDesc.Items.Add(dtProductDetails.Rows[0]["PRODUCT_NAME"].ToString());
                    DDLProductDesc.SelectedItem.Text = dtProductDetails.Rows[0]["PRODUCT_NAME"].ToString();


                    DDLProductGroup.Enabled    = false;
                    DDLProdSubCategory.Enabled = false;
                    DDLProductDesc.Enabled     = false;
                    DDLReason.Focus();
                }
                if (dtProductDetails.Rows.Count > 1)
                {
                    DDLProductGroup.Items.Clear();
                    DDLProdSubCategory.Items.Clear();
                    DDLProductDesc.Items.Clear();
                    string message = "alert('Product Code Issue: We Have Duplicate Records for this Product Code !');";
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alert", message, true);

                    //this.Page.ClientScript.RegisterStartupScript(GetType(), "Alert", " alert('Product Code Issue: We Have Duplicate Records for this Product Code !');", true);
                }
                if (dtProductDetails.Rows.Count == 0)
                {
                    DDLProductGroup.Items.Clear();
                    DDLProdSubCategory.Items.Clear();
                    DDLProductDesc.Items.Clear();
                    string message = "alert('Product Code Issue: No Such Produt Code Exist !');";
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alert", message, true);

                    //this.Page.ClientScript.RegisterStartupScript(GetType(), "Alert", " alert('Product Code Issue: No Such Produt Code Exist !');", true);
                }
            }
            else
            {
                txtProductCode.Focus();
                string message = "alert('Please Provide Product Code Here !');";
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alert", message, true);

                //this.Page.ClientScript.RegisterStartupScript(GetType(), "Alert", " alert('Please Provide Product Code Here !');", true);
            }
        }
        private void BindGrid()
        {
            string sitecode1;

            try
            {
                sitecode1 = Session["SiteCode"].ToString();

                DataTable dt = new DataTable();
                CreamBell_DMS_WebApps.App_Code.Global obj = new CreamBell_DMS_WebApps.App_Code.Global();
                conn = obj.GetConnection();

                adp1 = new SqlDataAdapter("EXEC ACX_USP_INDENTVSINVOICE '" + txtFromDate.Text + "','" + txtToDate.Text + "','" + txtIndentNo.Text + "','" + Session["LOGINTYPE"].ToString() + "','" + Session["USERID"].ToString() + "'", conn);
                adp1.Fill(dt);

                GridView1.DataSource = dt;
                GridView1.DataBind();
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                    conn.Dispose();
                }
            }
            catch (Exception ex)
            {
                ErrorSignal.FromCurrentContext().Raise(ex);
            }
        }
        protected void lnkbtn_Click(object sender, EventArgs e)
        {
            try
            {
                CreamBell_DMS_WebApps.App_Code.Global obj = new CreamBell_DMS_WebApps.App_Code.Global();
                conn = obj.GetConnection();

                GridViewRow gvrow  = (GridViewRow)(((LinkButton)sender)).NamingContainer;
                LinkButton  lnk    = sender as LinkButton;
                string      Siteid = ((HiddenField)gvrow.FindControl("hndSiteid")).Value.ToString();
                adp1 = new SqlDataAdapter("EXEC USP_SERVICEINVOICELINEDETAIL '" + lnk.Text + "','" + Siteid.ToString() + "'", conn);
                ds1.Clear();
                adp1.Fill(ds1, "dtl");

                if (ds1.Tables["dtl"].Rows.Count != 0)
                {
                    GridView2.DataSource = ds1;
                    GridView2.DataBind();
                }
            }
            catch (Exception ex)
            {
                ErrorSignal.FromCurrentContext().Raise(ex);
            }
            finally
            {
                conn.Close();
                conn.Dispose();
            }
        }
예제 #7
0
        protected void DDLCustGroup_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                CreamBell_DMS_WebApps.App_Code.Global obj = new CreamBell_DMS_WebApps.App_Code.Global();

                if (DDLCustGroupNew.Text == "ALL")
                {
                    string queryALLCustomer = " Select CUSTOMER_CODE, CUSTOMER_NAME from ax.acxcustmaster where  SITE_CODE='" + Session["SiteCode"].ToString() +
                                              "' and DATAAREAID='" + Session["DATAAREAID"].ToString() + "'and BLOCKED = 0";

                    DDLCustomersNew.Items.Clear();
                    //DDLCustomers.Items.Add("-Select-");
                    //obj.BindToDropDown(DDLCustomers, queryALLCustomer, "CUSTOMER_NAME", "CUSTOMER_CODE");
                }
                else
                {
                    string queryCustomer = " Select CUSTOMER_CODE, CUSTOMER_NAME from ax.acxcustmaster where CUST_GROUP='" + DDLCustGroupNew.SelectedValue.ToString() + "' " +
                                           " and SITE_CODE='" + Session["SiteCode"].ToString() + "' and DATAAREAID='" + Session["DATAAREAID"].ToString() + "'and BLOCKED = 0";

                    DDLCustomersNew.Items.Clear();
                    DDLCustomersNew.Items.Add("-Select-");
                    obj.BindToDropDownp(DDLCustomersNew, queryCustomer, "CUSTOMER_NAME", "CUSTOMER_CODE");
                }
            }
            catch (Exception ex)
            {
                ErrorSignal.FromCurrentContext().Raise(ex);
            }
        }
예제 #8
0
        protected void DDLCustGroup_SelectedIndexChanged(object sender, EventArgs e)
        {
            CreamBell_DMS_WebApps.App_Code.Global obj = new CreamBell_DMS_WebApps.App_Code.Global();

            if (DDLCustGroupNew.Text == "ALL")
            {
                string queryALLCustomer = " Select CUSTOMER_CODE, CUSTOMER_NAME from ax.acxcustmaster where  SITE_CODE='" + Session["SiteCode"].ToString() +
                                          "' and DATAAREAID='" + Session["DATAAREAID"].ToString() + "'" +
                                          " UNION " +
                                          "SELECT SUBDISTRIBUTOR AS Customer_Code, SUBDISTRIBUTOR + '-' + NAME AS CUSTOMER_NAME  from ax.ACX_SDLINKING where OTHER_SITE='" + Session["SiteCode"].ToString() +
                                          "' and DATAAREAID='" + Session["DATAAREAID"].ToString() + "'";

                DDLCustomersNew.Items.Clear();
                DDLCustomersNew.Items.Add("-Select-");
                obj.BindToDropDownp(DDLCustomersNew, queryALLCustomer, "CUSTOMER_NAME", "CUSTOMER_CODE");
            }
            else
            {
                string queryCustomer = " Select CUSTOMER_CODE, CUSTOMER_NAME from ax.acxcustmaster where CUST_GROUP='" + DDLCustGroupNew.SelectedValue.ToString() + "' " +
                                       " and SITE_CODE='" + Session["SiteCode"].ToString() + "' and DATAAREAID='" + Session["DATAAREAID"].ToString() + "'" +
                                       " UNION " +
                                       "SELECT SUBDISTRIBUTOR AS Customer_Code, SUBDISTRIBUTOR + '-' + NAME AS CUSTOMER_NAME  from ax.ACX_SDLINKING where CUSTGROUP='" + DDLCustGroupNew.SelectedValue.ToString() + "' " +
                                       " and OTHER_SITE='" + Session["SiteCode"].ToString() + "' and DATAAREAID='" + Session["DATAAREAID"].ToString() + "'";

                DDLCustomersNew.Items.Clear();
                DDLCustomersNew.Items.Add("-Select-");
                obj.BindToDropDownp(DDLCustomersNew, queryCustomer, "CUSTOMER_NAME", "CUSTOMER_CODE");
            }
        }
예제 #9
0
        protected void BtnSearch_Click(object sender, EventArgs e)
        {
            bool b = ValidateSearch();

            if (b == true)
            {
                CreamBell_DMS_WebApps.App_Code.Global obj = new CreamBell_DMS_WebApps.App_Code.Global();

                try
                {
                    string        query = "ACX_USP_OpenSaleOrder";
                    List <string> ilist = new List <string>();
                    List <string> item  = new List <string>();
                    DataTable     dt    = new DataTable();

                    if (ddlSiteId.SelectedItem.Text == "")
                    {
                        ilist.Add("@Site_Code"); item.Add(Session["SiteCode"].ToString());
                    }
                    else
                    {
                        ilist.Add("@Site_Code"); item.Add(ddlSiteId.SelectedItem.Value.ToString());
                    }
                    ilist.Add("@DATAAREAID"); item.Add(Session["DATAAREAID"].ToString());
                    ilist.Add("@StartDate"); item.Add(txtFromDate.Text);
                    ilist.Add("@EndDate"); item.Add(txtToDate.Text);

                    dt = obj.GetData_New(query, CommandType.StoredProcedure, ilist, item);

                    //string FromDate = txtFromDate.Text;
                    //string ToDate = txtToDate.Text;

                    if (dt.Rows.Count > 0)
                    {
                        gvDetails.DataSource = dt;
                        gvDetails.DataBind();
                        LblMessage.Text   = "Total Records : " + dt.Rows.Count.ToString();
                        gvDetails.Visible = true;
                        Session["OpenSO"] = dt;
                    }
                    else
                    {
                        LblMessage.Text      = string.Empty;
                        gvDetails.DataSource = dt;
                        gvDetails.DataBind();

                        //this.Page.ClientScript.RegisterStartupScript(GetType(), "Alert", " alert('No Data Exits Between This Date Range !');", true);
                        LblMessage.Text    = "No Data Exits Between This Date Range ! !";
                        LblMessage.Visible = true;
                        uppanel.Update();
                    }
                }
                catch (Exception ex)
                {
                    LblMessage.Text = ex.Message.ToString();
                    ErrorSignal.FromCurrentContext().Raise(ex);
                }
            }
        }
예제 #10
0
        protected void DDLWarehouseFrom_SelectedIndexChanged(object sender, EventArgs e)
        {
            CreamBell_DMS_WebApps.App_Code.Global obj = new CreamBell_DMS_WebApps.App_Code.Global();
            string query2 = "SELECT INVENTLOCATIONID,NAME FROM AX.inventlocation WHERE INVENTSITEID='" + Session["SiteCode"].ToString() + "' and INVENTLOCATIONID <> '" + DDLWarehouseFrom.SelectedValue + "'";

            DDLWarehouseTo.Items.Clear();
            DDLWarehouseTo.Items.Add("-Select-");
            obj.BindToDropDown(DDLWarehouseTo, query2, "NAME", "INVENTLOCATIONID");
        }
        public static List <string> GetProductDescription(string prefixText)
        {
            List <string> customers = new List <string>();

            CreamBell_DMS_WebApps.App_Code.Global obj = new CreamBell_DMS_WebApps.App_Code.Global();

            SqlConnection conn = obj.GetConnection();

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    //  CreamBell_DMS_WebApps.frmInvoicePrepration f1 = new CreamBell_DMS_WebApps.frmInvoicePrepration();

                    if (ddl1.SelectedItem.Text == "SO No")
                    {
                        cmd.CommandText = "select Top 20 SO_No as Code from [ax].[ACXSALESHEADER] where " +
                                          "replace(replace(SO_No, char(9), ''), char(13) + char(10), '') Like @Code+'%' and SiteId = '" + siteid + "'";
                    }
                    if (ddl1.SelectedItem.Text == "Load Sheet No")
                    {
                        cmd.CommandText = "Select distinct Top 20 LOADSHEET_NO  as Code from ax.ACXSALEINVOICEHEADER where " +
                                          "  replace(replace(LOADSHEET_NO, char(9), ''), char(13) + char(10), '') Like @Code+'%' and SiteId = '" + siteid + "'";
                    }
                    if (ddl1.SelectedItem.Text == "Customer Name")
                    {
                        cmd.CommandText = "select Top 20 CUSTOMER_CODE +'_'+ CUSTOMER_NAME as Code from ax.Acxcustmaster where " +
                                          "replace(replace(CUSTOMER_NAME, char(9), ''), char(13) + char(10), '') Like @Code +'%' " +
                                          "  or replace(replace(CUSTOMER_CODE, char(9), ''), char(13) + char(10), '') Like @Code+'%'  and Site_Code ='" + siteid + "'";
                    }


                    cmd.Parameters.AddWithValue("@Code", prefixText);
                    cmd.Connection = conn;
                    if (conn.State.ToString() == "Closed")
                    {
                        conn.Open();
                    }

                    using (SqlDataReader sdr = cmd.ExecuteReader())
                    {
                        while (sdr.Read())
                        {
                            customers.Add(sdr["Code"].ToString());
                        }
                    }
                    conn.Close();
                    return(customers);
                }
            }
            catch (Exception ex)
            {
                ErrorSignal.FromCurrentContext().Raise(ex);
                string str = ex.Message; return(customers);
            }
        }
예제 #12
0
        private void FillReturnReasonType()
        {
            CreamBell_DMS_WebApps.App_Code.Global obj = new CreamBell_DMS_WebApps.App_Code.Global();

            string strQuery = "Select distinct DAMAGEREASON_CODE,DAMAGEREASON_CODE + '-(' + DAMAGEREASON_NAME +')' as RETURNREASON  from [ax].[ACXDAMAGEREASON]";

            DDLReason.Items.Clear();
            DDLReason.Items.Add("-Select-");
            obj.BindToDropDown(DDLReason, strQuery, "RETURNREASON", "DAMAGEREASON_CODE");
        }
예제 #13
0
        private void BindFilters()
        {
            CreamBell_DMS_WebApps.App_Code.Global obj = new CreamBell_DMS_WebApps.App_Code.Global();

            string queryCustomerGroup = " Select CUSTGROUP_CODE, CUSTGROUP_NAME, CUSTGROUP_CODE+'-'+ CUSTGROUP_NAME as CUSTGROUP from [ax].[ACXCUSTGROUPMASTER] where DATAAREAID='" + Session["DATAAREAID"].ToString() + "' and BLOCKED<>1 ";

            DDLCustGroupNew.Items.Clear();
            DDLCustGroupNew.Items.Add("ALL");
            obj.BindToDropDownp(DDLCustGroupNew, queryCustomerGroup, "CUSTGROUP", "CUSTGROUP_CODE");
        }
예제 #14
0
        protected void BtnShowReport_Click(object sender, EventArgs e)
        {
            CreamBell_DMS_WebApps.App_Code.Global obj = new CreamBell_DMS_WebApps.App_Code.Global();
            DataTable dt = new DataTable();
            bool      b  = ValidateInput();

            if (b == true)
            {
                try
                {
                    string FromDate = txtFromDate.Text;
                    string ToDate   = txtToDate.Text;

                    //  string query = "ACX_USP_SaleRegisterReport";
                    //  List<string> ilist = new List<string>();
                    //  List<string> item = new List<string>();
                    //ilist.Add("@Site_Code");
                    //if (ddlSiteId.SelectedIndex != -1)
                    //{
                    //    if (ddlSiteId.SelectedItem.Text != "Select...")
                    //    {
                    //        item.Add(ddlSiteId.SelectedItem.Value);
                    //    }
                    //    else
                    //    {
                    //        item.Add("0");
                    //    }
                    //}
                    //else
                    //{
                    //    item.Add("0");
                    //}

                    //ilist.Add("@DATAAREAID"); item.Add(Session["DATAAREAID"].ToString());
                    //ilist.Add("@StartDate"); item.Add(txtFromDate.Text);
                    //ilist.Add("@EndDate"); item.Add(txtToDate.Text);

                    //dt = obj.GetData_New(query, CommandType.StoredProcedure, ilist, item);

                    //if (dt.Rows.Count > 0)
                    //{
                    // LoadDataInReportViewerDetail(dt);
                    ShowReportSummary();
                    //  }
                }
                catch (Exception ex)
                {
                    LblMessage.Text = ex.Message.ToString();
                    ErrorSignal.FromCurrentContext().Raise(ex);
                }
            }
        }
예제 #15
0
        private void ShowReport()
        {
            CreamBell_DMS_WebApps.App_Code.Global obj = new CreamBell_DMS_WebApps.App_Code.Global();

            string    FilterQuery   = string.Empty;
            DataTable dtSetHeader   = null;
            DataTable dtSetData     = null;
            string    CustomerGroup = string.Empty;
            string    Customer      = string.Empty;
            string    BU            = string.Empty;

            if (DDLCustGroupNew.SelectedIndex > 0)
            {
                CustomerGroup = DDLCustGroupNew.SelectedValue.ToString();
            }
            else
            {
                CustomerGroup = "";
            }
            if (DDLCustomersNew.SelectedIndex > 0)
            {
                Customer = DDLCustomersNew.SelectedValue.ToString();
            }
            else
            {
                Customer = "";
            }
            if (DDLBusinessUnitNew.SelectedIndex >= 1)
            {
                BU = DDLBusinessUnitNew.SelectedItem.Value.ToString();
            }
            else
            {
                BU = "";
            }
            try
            {
                string query = "Select NAME from ax.inventsite where SITEID IN (" + ucRoleFilters.GetCommaSepartedSiteId() + ") ";
                dtSetHeader = new DataTable();
                dtSetHeader = obj.GetData(query);
                FilterQuery = "EXEC SP_SALEREGISTERINVOICEWISE '" + ucRoleFilters.GetCommaSepartedSiteId() + "','" + Convert.ToDateTime(txtFromDate.Text).ToString("yyyy-MM-dd") + "','" + Convert.ToDateTime(txtToDate.Text).ToString("yyyy-MM-dd") + "','" + CustomerGroup + "','" + Customer + "','" + BU + "'";
                dtSetData   = new DataTable();
                dtSetData   = obj.GetData(FilterQuery);

                LoadDataInReportViewer(dtSetHeader, dtSetData);
            }
            catch (Exception ex)
            {
                LblMessage.Text = ex.Message.ToString();
                ErrorSignal.FromCurrentContext().Raise(ex);
            }
        }
예제 #16
0
        private DataTable fillSiteCode()
        {
            DataTable dt = new DataTable();

            try
            {
                CreamBell_DMS_WebApps.App_Code.Global obj = new CreamBell_DMS_WebApps.App_Code.Global();
                string strQuery = "Select Distinct SITEID as Code,NAME from [ax].[INVENTSITE] where SITEID IN (" + ucRoleFilters.GetCommaSepartedSiteId() + ") ";
                dt = obj.GetData(strQuery);
            }
            catch (Exception ex) { ErrorSignal.FromCurrentContext().Raise(ex); }
            return(dt);
        }
예제 #17
0
        private DataTable fillStateCode()
        {
            DataTable dt = new DataTable();

            try
            {
                CreamBell_DMS_WebApps.App_Code.Global obj = new CreamBell_DMS_WebApps.App_Code.Global();
                string strQuery = "Select distinct I.StateCode as Code,LS.Name from [ax].[INVENTSITE] I left join [ax].[LOGISTICSADDRESSSTATE] LS on LS.STATEID = I.STATECODE where I.SiteId IN (" + ucRoleFilters.GetCommaSepartedSiteId() + ") ";
                dt = obj.GetData(strQuery);
            }
            catch (Exception ex) { ErrorSignal.FromCurrentContext().Raise(ex); }
            return(dt);
        }
예제 #18
0
        private bool ValidateStockTransferSave()                    // Validates all required values for Saving the Data to Database INVENTRANS//
        {
            bool _value = false;

            if (gridStockTransferItems.Rows.Count <= 0 && Session["ItemTable"] == null)
            {
                _value = false;
                this.LblMessage.Text = "►  Please Add Stock Transfer Product !";

                //ScriptManager.RegisterStartupScript(this, this.GetType(), "Alert", " alert('Please Add Items for Adjustment Entry !');", true);
            }
            else
            {
                string SqlQuery = " SELECT DISTINCT SITECODE,PRODUCTCODE,ISNULL(SUM(TRANSQTY),0) TRANSQTY FROM AX.ACXINVENTTRANS IT WHERE SITECODE='" + Session["SiteCode"].ToString() + "'" +
                                  " AND TRANSLOCATION='" + DDLWarehouseFrom.SelectedValue.ToString() + "' GROUP BY SITECODE,PRODUCTCODE HAVING ISNULL(SUM(TRANSQTY),0)>0 ";
                CreamBell_DMS_WebApps.App_Code.Global obj = new CreamBell_DMS_WebApps.App_Code.Global();
                DataTable dtPrdStock = obj.GetData(SqlQuery);
                DataRow[] drrow;

                for (int i = 0; i < gridStockTransferItems.Rows.Count; i++)
                {
                    string   productNameCode = gridStockTransferItems.Rows[i].Cells[3].Text;
                    string[] str             = productNameCode.Split('-');
                    string   ProductCode     = str[0].ToString();
                    drrow = dtPrdStock.Select("PRODUCTCODE='" + ProductCode + "'");
                    if (drrow.Length == 0)
                    {
                        _value = false;
                        this.LblMessage.Text = "►  " + productNameCode + " stock not available. Please remove !";
                        return(_value);
                    }
                    else
                    {
                        decimal TransQty = Convert.ToDecimal(gridStockTransferItems.Rows[i].Cells[6].Text);
                        decimal stockqty = Convert.ToDecimal(drrow[0]["TRANSQTY"]);

                        if (stockqty < TransQty)
                        {
                            _value = false;
                            this.LblMessage.Text = "►  " + productNameCode + " stock not available. Please remove !";
                            return(_value);
                        }
                    }
                }
                _value = true;
            }
            return(_value);
        }
예제 #19
0
        private bool ValidateStock(string ProductCode, decimal MoveQty)
        {
            bool stock = true;

            CreamBell_DMS_WebApps.App_Code.Global obj = new CreamBell_DMS_WebApps.App_Code.Global();

            string queryStock = " Select isnull(SUM(INVTS.TRANSQTY),0) AS STOCK From AX.ACXINVENTTRANS INVTS INNER JOIN AX.INVENTTABLE INV  ON INV.ITEMID= INVTS.PRODUCTCODE " +
                                " WHERE INVTS.DATAAREAID='" + Session["DATAAREAID"] + "' AND INVTS.SiteCode='" + Session["SiteCode"] + "' " +
                                " AND INVTS.TRANSLOCATION='" + DDLWarehouseFrom.SelectedValue.Trim().ToString() + "' " +
                                " AND INVTS.PRODUCTCODE ='" + ProductCode + "'";

            object stockValue = obj.GetScalarValue(queryStock);

            if (stockValue != null)
            {
                decimal AvailableStock = Math.Round(Convert.ToDecimal(stockValue.ToString()), 2);
                if (MoveQty <= AvailableStock)
                {
                    if (MoveQty + AvailableStock < 0)
                    {
                        stock = false;
                        //ScriptManager.RegisterStartupScript(this, this.GetType(), "Alert", " alert('Stock Negative Issue : Final Stock cannot be in negative figure. !');", true);
                        LblMessage.Text = "Stock Negative Issue : Final Stock cannot be in negative figure. !";
                    }
                    else
                    {
                        stock = true;
                    }
                }
                else
                {
                    stock = false;
                    //ScriptManager.RegisterStartupScript(this, this.GetType(), "Alert", " alert('Stock Issue : Entered Value cannot be more than the available Stock !');", true);
                    LblMessage.Text = "Stock Issue : Entered Value cannot be more than the available Stock !";
                }
                //if (AdjusmentValue <= AvailableStock)
                //{
                //    stock = true;
                //}
                //else
                //{
                //    stock = false;
                //    ScriptManager.RegisterStartupScript(this, this.GetType(), "Alert", " alert('Stock Issue : Entered Value cannot be more than the available Stock !');", true);
                //}
            }
            return(stock);
        }
예제 #20
0
        private void BindFilters()
        {
            CreamBell_DMS_WebApps.App_Code.Global obj = new CreamBell_DMS_WebApps.App_Code.Global();

            string queryCustomerGroup = " Select CUSTGROUP_CODE, CUSTGROUP_NAME, CUSTGROUP_CODE+'-'+ CUSTGROUP_NAME as CUSTGROUP from [ax].[ACXCUSTGROUPMASTER] where DATAAREAID='" + Session["DATAAREAID"].ToString() + "' and BLOCKED<>1 ";

            DDLCustGroupNew.Items.Clear();
            DDLCustGroupNew.Items.Add("ALL");
            obj.BindToDropDownp(DDLCustGroupNew, queryCustomerGroup, "CUSTGROUP", "CUSTGROUP_CODE");

            string query = "select bm.bu_code,bu_desc from ax.acxsitebumapping sbp join ax.ACXBUMASTER bm on bm.bu_code = sbp.BU_CODE where SITEID = '" + Convert.ToString(Session["SiteCode"]) + "'";

            DDLBusinessUnitNew.Items.Clear();
            DDLBusinessUnitNew.Items.Add("All...");
            obj.BindToDropDownp(DDLBusinessUnitNew, query, "bu_desc", "bu_code");
            DDLCustGroup_SelectedIndexChanged(null, null);
        }
        private void ShowReportSummary()
        {
            CreamBell_DMS_WebApps.App_Code.Global obj = new CreamBell_DMS_WebApps.App_Code.Global();
            DataTable  dtSetData = null;
            SqlCommand cmd       = new SqlCommand();

            cmd.CommandTimeout = 0;

            try
            {
                string query = "Select Top 1 NAME from ax.inventsite where SITEID='" + Session["SiteCode"].ToString() + "'";
                object obj1  = obj.GetScalarValue(query);

                string sqlstr = @"Select I.Siteid,I.Name,I.StateCode,from_Date,To_Date,TC.Name as Cat,TS.Name as Subcat,Target_Description,Actual_Incentive,
                                    Case when Claim_Type = '0' then 'Sale' else 'Purchase' end as ClaimType 
                                    from [ax].[ACXCLAIMMASTER] CM 
                                    left join 
                                    [ax].[ACXTARGETCATEGORY] TC on CM.Claim_Category = TC.CATEGORY
                                    left join 
                                    [ax].[ACXTARGETSUBCATEGORY] TS on CM.CLAIM_SUBCATEGORY = TS.Subcategory
                                    left join 
                                    [ax].[INVENTSITE] I on CM.SITE_CODE = I.Siteid
                                    where CM.from_Date  >= " +
                                " '" + Convert.ToDateTime(txtFromDate.Text) + "' and CM.TO_DATE <= '" + Convert.ToDateTime(txtToDate.Text) + "'  ";
                //  "  ";

                if (ddlSiteId.SelectedIndex != -1)
                {
                    if (ddlSiteId.SelectedItem.Text != "Select...")
                    {
                        sqlstr += "and CM.SITE_CODE = '" + ddlSiteId.SelectedItem.Value + "'  ";
                    }
                }

                dtSetData = new DataTable();
                dtSetData = obj.GetData(sqlstr);

                LoadDataInReportViewerDetail(dtSetData);
            }
            catch (Exception ex)
            {
                LblMessage.Text = ex.Message.ToString();
                ErrorSignal.FromCurrentContext().Raise(ex);
            }
        }
예제 #22
0
        private void BindFilters()
        {
            try
            {
                CreamBell_DMS_WebApps.App_Code.Global obj = new CreamBell_DMS_WebApps.App_Code.Global();

                string queryCustomerGroup = " Select CUSTGROUP_CODE, CUSTGROUP_NAME, CUSTGROUP_CODE+'-'+ CUSTGROUP_NAME as CUSTGROUP from [ax].[ACXCUSTGROUPMASTER] where DATAAREAID='" + Session["DATAAREAID"].ToString() + "' and BLOCKED<>1 ";
                DDLCustGroupNew.Items.Clear();
                DDLCustGroupNew.Items.Add("ALL");
                obj.BindToDropDownp(DDLCustGroupNew, queryCustomerGroup, "CUSTGROUP", "CUSTGROUP_CODE");

                string queryProductGroup = "Select distinct PRODUCT_GROUP from ax.INVENTTABLE";
                DDLProductGroupNew.Items.Clear();
                DDLProductGroupNew.Items.Add("ALL");
                obj.BindToDropDownp(DDLProductGroupNew, queryProductGroup, "PRODUCT_GROUP", "PRODUCT_GROUP");
            }
            catch (Exception ex)
            {
                ErrorSignal.FromCurrentContext().Raise(ex);
            }
        }
        private void GridDetail()
        {
            string sitecode1;

            try
            {
                sitecode1 = Session["SiteCode"].ToString();
                CreamBell_DMS_WebApps.App_Code.Global obj = new CreamBell_DMS_WebApps.App_Code.Global();
                conn = obj.GetConnection();
                string str = "Select A.PURCH_RETURNNO as INVOICE_NO , A.PURCH_RETURNDATE as INVOIC_DATE, A.Purch_recieptno as SO_NO,case when CONVERT(VARCHAR(10),PURCH_RECIEPTDATE , 103)= '01/01/1900' then '' else CONVERT(VARCHAR(10),PURCH_RECIEPTDATE , 103) end  AS SO_DATE, ('[' +A.SITE_CODE +']' + ' ' + B.NAME) as CUSTOMER , A.Return_docvalue as INVOICE_VALUE" +
                             " from ax.[ACXPURCHRETURNHEADER]  A  INNER JOIN ax.inventsite B   ON A.SITE_CODE=B.SITEID" +
                             " where  A.SITE_CODE= '" + sitecode1 + "' and PURCH_RETURNDATE>=DateAdd(Day,-1,getdate()) and PURCH_RETURNDATE<=getdate() order by A.PURCH_RETURNDATE desc,A.PURCH_RETURNNO desc";
                adp1 = new SqlDataAdapter("Select A.PURCH_RETURNNO as INVOICE_NO , A.PURCH_RETURNDATE as INVOIC_DATE, A.Purch_recieptno as SO_NO,case when CONVERT(VARCHAR(10),PURCH_RECIEPTDATE , 103)= '01/01/1900' then '' else CONVERT(VARCHAR(10),PURCH_RECIEPTDATE , 103) end  AS SO_DATE, ('[' +A.SITE_CODE +']' + ' ' + B.NAME) as CUSTOMER , A.Return_docvalue as INVOICE_VALUE" +
                                          " from ax.[ACXPURCHRETURNHEADER]  A  INNER JOIN ax.inventsite B   ON A.SITE_CODE=B.SITEID" +
                                          " where  A.SITE_CODE= '" + sitecode1 + "' and PURCH_RETURNDATE>=DateAdd(Day,-1,getdate()) and PURCH_RETURNDATE<=getdate() order by A.PURCH_RETURNDATE desc,A.PURCH_RETURNNO desc", conn);

                ds2.Clear();
                adp1.Fill(ds2, "dtl");

                if (ds2.Tables["dtl"].Rows.Count != 0)
                {
                    for (int i = 0; i < ds2.Tables["dtl"].Rows.Count; i++)
                    {
                        GridView1.DataSource = ds2.Tables["dtl"];
                        GridView1.DataBind();
                    }
                }

                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                    conn.Dispose();
                }
            }
            catch (Exception ex)
            {
                ErrorSignal.FromCurrentContext().Raise(ex);
            }
        }
예제 #24
0
        public static List <string> GetProductDescription(string prefixText)
        {
            CreamBell_DMS_WebApps.App_Code.Global obj = new CreamBell_DMS_WebApps.App_Code.Global();
            string query = "Select ITEMID +'-(' + PRODUCT_NAME+')' as PRODUCT_NAME, ITEMID,PRODUCT_GROUP, PRODUCT_SUBCATEGORY from ax.INVENTTABLE where " +
                           "replace(replace(ITEMID, char(9), ''), char(13) + char(10), '') Like @ProductCode+'%'";

            SqlConnection conn = obj.GetConnection();
            SqlCommand    cmd  = new SqlCommand(query, conn);

            cmd.Parameters.AddWithValue("@ProductCode", prefixText);
            SqlDataAdapter da = new SqlDataAdapter(cmd);
            DataTable      dt = new DataTable();

            da.Fill(dt);
            List <string> ProductDetails = new List <string>();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                ProductDetails.Add(dt.Rows[i]["ITEMID"].ToString());
            }
            return(ProductDetails);
        }
        private void GridDetail()
        {
            string sitecode1;

            try
            {
                sitecode1 = Session["SiteCode"].ToString();
                CreamBell_DMS_WebApps.App_Code.Global obj = new CreamBell_DMS_WebApps.App_Code.Global();
                conn = obj.GetConnection();
                string FromDate = Convert.ToDateTime(txtFromDate.Text).ToString("dd-MMM-yyyy");
                string ToDate   = Convert.ToDateTime(txtToDate.Text).ToString("dd-MMM-yyyy");
                string query    = "EXEC USP_SERVICEINVOICEDETAIL '" + sitecode1 + "','" + FromDate + "','" + ToDate + "'";
                adp1 = new SqlDataAdapter(query, conn);
                ds2.Clear();
                adp1.Fill(ds2, "dtl");

                if (ds2.Tables["dtl"].Rows.Count != 0)
                {
                    for (int i = 0; i < ds2.Tables["dtl"].Rows.Count; i++)
                    {
                        GridView1.DataSource = ds2.Tables["dtl"];
                        GridView1.DataBind();
                    }
                }

                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                    conn.Dispose();
                }
            }
            catch (Exception ex)
            {
                ErrorSignal.FromCurrentContext().Raise(ex);
            }
        }
예제 #26
0
        protected void DDLSubCategory_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                CreamBell_DMS_WebApps.App_Code.Global obj = new CreamBell_DMS_WebApps.App_Code.Global();
                if (DDLSubCategoryNew.Text == "-Select-")
                {
                    DDLProductNew.Items.Clear();
                }
                else
                {
                    string strQuery = " Select ITEMID +'-(' + PRODUCT_NAME+')' as PRODUCT_NAME,PRODUCT_NAME as PRODDESCP, ITEMID,PRODUCT_GROUP, PRODUCT_SUBCATEGORY from ax.INVENTTABLE where " +
                                      " replace(replace(PRODUCT_SUBCATEGORY, char(9), ''), char(13) + char(10), '') = '" + DDLSubCategoryNew.SelectedItem.Text.ToString() + "' ";

                    DDLProductNew.Items.Clear();
                    DDLProductNew.Items.Add("-Select-");
                    obj.BindToDropDownp(DDLProductNew, strQuery, "PRODUCT_NAME", "PRODDESCP");
                }
            }
            catch (Exception ex)
            {
                ErrorSignal.FromCurrentContext().Raise(ex);
            }
        }
        protected void lnkbtn_Click(object sender, EventArgs e)
        {
            try
            {
                CreamBell_DMS_WebApps.App_Code.Global obj = new CreamBell_DMS_WebApps.App_Code.Global();
                conn = obj.GetConnection();

                GridViewRow gvrow = (GridViewRow)(((LinkButton)sender)).NamingContainer;
                LinkButton  lnk   = sender as LinkButton;

                //adp1 = new SqlDataAdapter("select a.CUSTOMER_CODE,a.INVOICE_NO,a.LINE_NO,a.PRODUCT_CODE,a.AMOUNT,a.BOX,a.CRATES,a.LTR,a.QUANTITY," +
                //                        " a.MRP,a.RATE,a.UOM,a.TAX_CODE,a.TAX_AMOUNT,a.DISC_AMOUNT,a.SEC_DISC_AMOUNT,b.product_group,b.product_name" +
                //                         " from ax.ACXSALEINVOICELINE a, ax.ACXProductMaster b " +
                //                          " where a.INVOICE_NO = '" + lnk.Text + "' and a.product_code = b.product_code ", conn);

                adp1 = new SqlDataAdapter("select a.CUSTOMER_CODE,a.INVOICE_NO,a.LINE_NO,a.PRODUCT_CODE,a.AMOUNT,a.BOX,a.CRATES,a.LTR,a.QUANTITY," +
                                          " a.MRP,a.RATE,a.UOM,a.TAX_CODE,a.TAX_AMOUNT,a.DISC_AMOUNT,a.SEC_DISC_AMOUNT,b.product_group,b.product_name,BOXQTY,PCSQty,BOXPCS " +
                                          " from ax.ACXSALEINVOICELINE a, ax.InventTable b " +
                                          " where a.INVOICE_NO = '" + lnk.Text + "' and  a.product_code = b.ItemId and a.SiteID='" + Session["SiteCode"].ToString() + "' ", conn);

                ds1.Clear();
                adp1.Fill(ds1, "dtl");

                if (ds1.Tables["dtl"].Rows.Count != 0)
                {
                    GridView2.DataSource = ds1;
                    GridView2.DataBind();
                }
            }
            catch (Exception ex) { ErrorSignal.FromCurrentContext().Raise(ex); }
            finally
            {
                conn.Close();
                conn.Dispose();
            }
        }
예제 #28
0
        private void ShowReportSummary()
        {
            CreamBell_DMS_WebApps.App_Code.Global obj = new CreamBell_DMS_WebApps.App_Code.Global();
            DataTable dtSetData = null;

            try
            {
                //string query = "Select Top 1 NAME from ax.inventsite where SITEID='" + Session["SiteCode"].ToString() + "'";
//                object obj1 = obj.GetScalarValue(query);

//                string sqlstr = @"Select  IH.INVOIC_DATE,Case when IH.TranType = 1 then 'SV' when IH.TranType = 2 then 'PS'  end as TransType,
//                                   IH.INVOICE_NO,C.Customer_Name,IH.Customer_Code, CASE IH.TRANTYPE WHEN 1 THEN IL.BOX WHEN 2 THEN -IL.BOX END BOX,
//                                    CASE IH.TRANTYPE WHEN 1 THEN IL.LTR WHEN 2 THEN -IL.LTR END LTR,CASE IH.TRANTYPE WHEN 1 THEN IL.LINEAMOUNT WHEN 2 THEN -IL.LINEAMOUNT END LINEAMOUNT,
//                                    CASE IH.TRANTYPE WHEN 1 THEN IL.DISC_AMOUNT WHEN 2 THEN -IL.DISC_AMOUNT END DISC_AMOUNT,
//                                    CASE IH.TRANTYPE WHEN 1 THEN IL.TAX_AMOUNT WHEN 2 THEN -IL.TAX_AMOUNT END TAX_AMOUNT,
//                                    CASE IH.TRANTYPE WHEN 1 THEN IL.ADDTAX_AMOUNT WHEN 2 THEN -IL.ADDTAX_AMOUNT END ADDTAX_AMOUNT,
//                                    '' as Surcharge ,  CASE IH.TRANTYPE WHEN 1 THEN IL.AMOUNT WHEN 2 THEN -IL.AMOUNT END AMOUNT , '' as FOCAMOUNT , '' as SchemeAmount,*
//                                   from [ax].[ACXSALEINVOICEHEADER] IH
//                                   Left Join [ax].[ACXSALEINVOICELINE] IL on IH.SITEID = IL.SITEID and IL.INVOICE_NO = IH.INVOICE_NO
//                                   left join [ax].[ACXCUSTMASTER] C on IH.Customer_Code = C.CUSTOMER_CODE
//                                   and IL.DATAAREAID = IH.DATAAREAID
//                                   where  IH.INVOIC_DATE  >= " +
//                                   " '" + Convert.ToDateTime(txtFromDate.Text).ToString("yyyy-MM-dd") + "' and IH.INVOIC_DATE <= '" + Convert.ToDateTime(txtToDate.Text).ToString("yyyy-MM-dd") + "'  ";



//                if (ddlSiteId.SelectedIndex != -1)
//                {
//                    if (ddlSiteId.SelectedItem.Text != "Select...")
//                    {
//                        sqlstr += "and IH.SITEID = '" + ddlSiteId.SelectedItem.Value + "'  ";
//                    }
//                }
//                sqlstr += " Order by IH.INVOIC_DATE ";



                dtSetData = new DataTable();

                string        query = "ACX_SALEREGISTER_DATEWISE";
                List <string> ilist = new List <string>();
                List <string> item = new List <string>();
                string        StateCode, SiteCode;
                SiteCode = "";

                if (ddlSiteId.SelectedIndex >= 0)
                {
                    if (ddlSiteId.SelectedItem.Text != "All...")
                    {
                        SiteCode = ddlSiteId.SelectedItem.Value;
                    }
                }
                ilist.Add("@SITEID"); item.Add(SiteCode);

                StateCode = "";
                if (ddlState.SelectedIndex > 0)
                {
                    StateCode = ddlState.SelectedItem.Value;
                }
                ilist.Add("@STATE"); item.Add(StateCode);
                ilist.Add("@FROMDATE"); item.Add(txtFromDate.Text);
                ilist.Add("@TODATE"); item.Add(txtToDate.Text);
                ilist.Add("@BUCODE");
                if (DDLBusinessUnit.SelectedIndex >= 1)
                {
                    item.Add(DDLBusinessUnit.SelectedItem.Value.ToString());
                }
                else
                {
                    item.Add("");
                }
                dtSetData = obj.GetData_New(query, CommandType.StoredProcedure, ilist, item);
                //dtSetData = obj.GetData(sqlstr);
                LoadDataInReportViewerDetail(dtSetData);
            }
            catch (Exception ex)
            {
                LblMessage.Text = ex.Message.ToString();
                ErrorSignal.FromCurrentContext().Raise(ex);
            }
        }
예제 #29
0
        private void ShowReport()
        {
            CreamBell_DMS_WebApps.App_Code.Global obj = new CreamBell_DMS_WebApps.App_Code.Global();

            string    FilterQuery = string.Empty;
            DataTable dtSetHeader = null;
            DataTable dtSetData   = null;

            try
            {
                var siteCodes = ucRoleFilters.GetCommaSepartedSiteId();

                string query = " Select NAME from ax.inventsite where siteid IN (" + siteCodes + ")";
                //string query = " Select NAME from ax.inventsite where siteid='" + Session["SiteCode"].ToString() + "'";
                dtSetHeader = new DataTable();
                dtSetHeader = obj.GetData(query);
                dtSetHeader.Columns.Add("FromDate");
                dtSetHeader.Columns.Add("ToDate");
                dtSetHeader.Rows.Add(query);
                dtSetHeader.Rows[0]["FromDate"] = txtFromDate.Text;
                dtSetHeader.Rows[0]["ToDate"]   = txtToDate.Text;

                string CustomerGroup   = string.Empty;
                string Customer        = string.Empty;
                string ProductGroup    = string.Empty;
                string ProdSubCategory = string.Empty;
                string Product         = string.Empty;
                if (DDLCustGroupNew.SelectedIndex > 0)
                {
                    CustomerGroup = DDLCustGroupNew.SelectedValue.ToString();
                }
                else
                {
                    CustomerGroup = "";
                }
                if (DDLCustomersNew.SelectedIndex > 0)
                {
                    Customer = DDLCustomersNew.SelectedValue.ToString();
                }
                else
                {
                    Customer = "";
                }
                if (DDLProductGroupNew.SelectedIndex > 0)
                {
                    ProductGroup = DDLProductGroupNew.SelectedValue.ToString();
                }
                else
                {
                    ProductGroup = "";
                }
                if (DDLSubCategoryNew.SelectedIndex > 0)
                {
                    ProdSubCategory = DDLSubCategoryNew.SelectedValue.ToString();
                }
                else
                {
                    ProdSubCategory = "";
                }
                if (DDLProductNew.SelectedIndex > 0)
                {
                    Product = DDLProductNew.SelectedValue.ToString();
                }
                else
                {
                    Product = "";
                }
                //FilterQuery = "EXEC SP_SALEREGISTER '" + Session["SiteCode"].ToString() + "','" + Convert.ToDateTime(txtFromDate.Text).ToString("yyyy-MM-dd") + "','" + Convert.ToDateTime(txtToDate.Text).ToString("yyyy-MM-dd") + "','" + CustomerGroup + "','" + Customer + "','" + ProductGroup + "','" + ProdSubCategory + "','" + Product + "'";
                FilterQuery = "EXEC SP_SALEREGISTER '" + siteCodes + "','" + Convert.ToDateTime(txtFromDate.Text).ToString("yyyy-MM-dd") + "','" + Convert.ToDateTime(txtToDate.Text).ToString("yyyy-MM-dd") + "','" + CustomerGroup + "','" + Customer + "','" + ProductGroup + "','" + ProdSubCategory + "','" + Product + "'";
                dtSetData   = new DataTable();
                dtSetData   = obj.GetData(FilterQuery);

                LoadDataInReportViewer(dtSetHeader, dtSetData);

                //#region Filter By Both Customer and Product Wise
                //FilterQuery = "EXEC SP_SALEREGISTER '" + Session["SiteCode"].ToString() + "','" + Convert.ToDateTime(txtFromDate.Text) + "','" + Convert.ToDateTime(txtToDate.Text) + "'";

                //if (DDLCustGroup.Text == "ALL" && DDLProductGroup.Text == "ALL")
                //{

                //    dtSetData = new DataTable();
                //    dtSetData = obj.GetData(FilterQuery);

                //}

                //if (DDLCustGroup.Text != "ALL" && DDLCustomers.Text == "-Select-" && DDLProductGroup.Text == "ALL")
                //{
                //    FilterQuery = "EXEC SP_SALEREGISTER '" + Session["SiteCode"].ToString() + "','" + Convert.ToDateTime(txtFromDate.Text) + "','" + Convert.ToDateTime(txtToDate.Text) + "','" + DDLCustGroup.SelectedValue + "'";

                //    dtSetData = new DataTable();
                //    dtSetData = obj.GetData(FilterQuery);
                //}

                //if (DDLCustGroup.Text != "ALL" && DDLCustomers.Text != "-Select-" && DDLProductGroup.Text == "ALL")
                //{
                //    FilterQuery = "EXEC SP_SALEREGISTER '" + Session["SiteCode"].ToString() + "','" + Convert.ToDateTime(txtFromDate.Text) + "','" + Convert.ToDateTime(txtToDate.Text) + "','" + DDLCustGroup.SelectedValue + "','" + DDLCustomers.SelectedValue + "'";

                //    dtSetData = new DataTable();
                //    dtSetData = obj.GetData(FilterQuery);
                //}

                //if (DDLCustGroup.Text != "ALL" && DDLCustomers.Text == "-Select-" && DDLProductGroup.Text != "ALL" && DDLSubCategory.Text != "-Select-" && DDLProduct.Text != "-Select")
                //{
                //    FilterQuery = "EXEC SP_SALEREGISTER '" + Session["SiteCode"].ToString() + "','" + Convert.ToDateTime(txtFromDate.Text) + "','" + Convert.ToDateTime(txtToDate.Text) + "','" + DDLCustGroup.SelectedValue + "',@productgroup='" + DDLProductGroup.SelectedValue + "',@subcategory='" + DDLSubCategory.SelectedValue + "',@productname='" + DDLProduct.SelectedValue + "'";

                //    dtSetData = new DataTable();
                //    dtSetData = obj.GetData(FilterQuery);
                //}

                //else if (DDLCustGroup.Text != "ALL" && DDLCustomers.Text == "-Select-" && DDLProductGroup.Text != "ALL" && DDLSubCategory.Text != "-Select-")
                //{
                //    FilterQuery = "EXEC SP_SALEREGISTER '" + Session["SiteCode"].ToString() + "','" + Convert.ToDateTime(txtFromDate.Text) + "','" + Convert.ToDateTime(txtToDate.Text) + "','" + DDLCustGroup.SelectedValue + "',@productgroup='" + DDLProductGroup.SelectedValue + "',@subcategory='" + DDLSubCategory.SelectedValue + "'";

                //    dtSetData = new DataTable();
                //    dtSetData = obj.GetData(FilterQuery);
                //}

                //else if (DDLCustGroup.Text != "ALL" && DDLCustomers.Text == "-Select-" && DDLProductGroup.Text != "ALL")
                //{
                //    FilterQuery = "EXEC SP_SALEREGISTER '" + Session["SiteCode"].ToString() + "','" + Convert.ToDateTime(txtFromDate.Text) + "','" + Convert.ToDateTime(txtToDate.Text) + "','" + DDLCustGroup.SelectedValue + "',@productgroup='" + DDLProductGroup.SelectedValue + "'";

                //    dtSetData = new DataTable();
                //    dtSetData = obj.GetData(FilterQuery);
                //}



                //else if (DDLCustGroup.Text != "ALL" && DDLCustomers.Text != "-Select-" && DDLProductGroup.Text != "ALL")
                //{
                //    FilterQuery = "EXEC SP_SALEREGISTER '" + Session["SiteCode"].ToString() + "','" + Convert.ToDateTime(txtFromDate.Text) + "','" + Convert.ToDateTime(txtToDate.Text) + "','" + DDLCustGroup.SelectedValue + "','" + DDLCustomers.SelectedValue + "','" + DDLProductGroup.SelectedValue + "'";

                //    dtSetData = new DataTable();
                //    dtSetData = obj.GetData(FilterQuery);
                //}

                //if (DDLCustGroup.Text != "ALL" && DDLCustomers.Text != "-Select-" && DDLProductGroup.Text != "ALL" && DDLSubCategory.Text != "-Select-")
                //{
                //    FilterQuery = "EXEC SP_SALEREGISTER '" + Session["SiteCode"].ToString() + "','" + Convert.ToDateTime(txtFromDate.Text) + "','" + Convert.ToDateTime(txtToDate.Text) + "'";

                //    dtSetData = new DataTable();
                //    dtSetData = obj.GetData(FilterQuery);
                //}

                //if (DDLCustGroup.Text != "ALL" && DDLCustomers.Text != "-Select-" && DDLProductGroup.Text != "ALL" && DDLSubCategory.Text != "-Select-" && DDLProduct.Text != "-Select")
                //{
                //    FilterQuery = "EXEC SP_SALEREGISTER '" + Session["SiteCode"].ToString() + "','" + Convert.ToDateTime(txtFromDate.Text) + "','" + Convert.ToDateTime(txtToDate.Text) + "'";

                //    dtSetData = new DataTable();
                //    dtSetData = obj.GetData(FilterQuery);
                //}

                //if (DDLCustGroup.Text == "ALL" && DDLProductGroup.Text != "ALL" && DDLSubCategory.Text == "-Select-")
                //{
                //    FilterQuery = "EXEC SP_SALEREGISTER '" + Session["SiteCode"].ToString() + "','" + Convert.ToDateTime(txtFromDate.Text) + "','" + Convert.ToDateTime(txtToDate.Text) + "'";

                //    dtSetData = new DataTable();
                //    dtSetData = obj.GetData(FilterQuery);
                //}

                //if (DDLCustGroup.Text == "ALL" && DDLProductGroup.Text != "ALL" && DDLSubCategory.Text != "-Select-" && DDLProduct.Text == "-Select-")
                //{
                //    FilterQuery = "EXEC SP_SALEREGISTER '" + Session["SiteCode"].ToString() + "','" + Convert.ToDateTime(txtFromDate.Text) + "','" + Convert.ToDateTime(txtToDate.Text) + "'";

                //    dtSetData = new DataTable();
                //    dtSetData = obj.GetData(FilterQuery);
                //}

                //if (DDLCustGroup.Text == "ALL" && DDLProductGroup.Text != "ALL" && DDLSubCategory.Text != "-Select-" && DDLProduct.Text != "-Select-")
                //{
                //    FilterQuery = "EXEC SP_SALEREGISTER '" + Session["SiteCode"].ToString() + "','" + Convert.ToDateTime(txtFromDate.Text) + "','" + Convert.ToDateTime(txtToDate.Text) + "'";

                //    dtSetData = new DataTable();
                //    dtSetData = obj.GetData(FilterQuery);
                //}

                //#endregion
            }
            catch (Exception ex)
            {
                LblMessage.Text = ex.Message.ToString();

                ErrorSignal.FromCurrentContext().Raise(ex);
            }
        }
예제 #30
0
        //private void ExportToExcelNew()
        //{
        //    Response.Clear();
        //    Response.Buffer = true;
        //    Response.ClearContent();
        //    Response.ClearHeaders();
        //    Response.Charset = "";
        //    string FileName = "OpenSalesOrder" + DateTime.Now + ".xls";
        //    StringWriter strwritter = new StringWriter();
        //    HtmlTextWriter htmltextwrtter = new HtmlTextWriter(strwritter);
        //    Response.Cache.SetCacheability(HttpCacheability.NoCache);
        //    Response.ContentType = "application/vnd.ms-excel";
        //    Response.AddHeader("Content-Disposition", "attachment;filename=" + FileName);
        //    gvDetails.GridLines = GridLines.Both;
        //    gvDetails.HeaderStyle.Font.Bold = true;
        //    gvDetails.RenderControl(htmltextwrtter);
        //    {
        //        Response.Write("<table><tr><td><b>From Date:  " + txtFromDate.Text + "</b></td><td></td> <td><b>To Date: " + txtToDate.Text + "</b></td></tr></table>");
        //    }
        //    Response.Write(strwritter.ToString());
        //    Response.End();
        //}

        private void ExportToExcelNew()
        {
            bool b = ValidateSearch();

            if (b == true)
            {
                CreamBell_DMS_WebApps.App_Code.Global obj = new CreamBell_DMS_WebApps.App_Code.Global();

                try
                {
                    string        query = "ACX_USP_OpenSaleOrder";
                    List <string> ilist = new List <string>();
                    List <string> item  = new List <string>();
                    DataTable     dt    = new DataTable();

                    if (ddlSiteId.SelectedItem.Text == "")
                    {
                        ilist.Add("@Site_Code"); item.Add(Session["SiteCode"].ToString());
                    }
                    else
                    {
                        ilist.Add("@Site_Code"); item.Add(ddlSiteId.SelectedItem.Value.ToString());
                    }
                    ilist.Add("@DATAAREAID"); item.Add(Session["DATAAREAID"].ToString());
                    ilist.Add("@StartDate"); item.Add(txtFromDate.Text);
                    ilist.Add("@EndDate"); item.Add(txtToDate.Text);

                    dt = obj.GetData_New(query, CommandType.StoredProcedure, ilist, item);

                    //string FromDate = txtFromDate.Text;
                    //string ToDate = txtToDate.Text;

                    if (dt.Rows.Count > 0)
                    {
                        GridView gv = new GridView();
                        gv.DataSource = dt;
                        gv.DataBind();
                        string         FileName       = "OpenSalesOrder" + DateTime.Now + ".xls";
                        StringWriter   strwritter     = new StringWriter();
                        HtmlTextWriter htmltextwrtter = new HtmlTextWriter(strwritter);
                        Response.Cache.SetCacheability(HttpCacheability.NoCache);
                        Response.ContentType = "application/vnd.ms-excel";
                        Response.AddHeader("Content-Disposition", "attachment;filename=" + FileName);
                        LblMessage.Text          = "Total Records : " + dt.Rows.Count.ToString();
                        gv.GridLines             = GridLines.Both;
                        gv.HeaderStyle.Font.Bold = true;
                        gv.RenderControl(htmltextwrtter);
                        {
                            Response.Write("<table><tr><td><b>From Date:  " + txtFromDate.Text + "</b></td><td></td> <td><b>To Date: " + txtToDate.Text + "</b></td></tr></table>");
                        }
                        Response.Write(strwritter.ToString());
                        Response.End();
                    }
                    else
                    {
                        LblMessage.Text = string.Empty;

                        //this.Page.ClientScript.RegisterStartupScript(GetType(), "Alert", " alert('No Data Exits Between This Date Range !');", true);
                        LblMessage.Text    = "No Data Exits Between This Date Range ! !";
                        LblMessage.Visible = true;
                        uppanel.Update();
                    }
                }
                catch (Exception ex)
                {
                    LblMessage.Text = ex.Message.ToString();
                    ErrorSignal.FromCurrentContext().Raise(ex);
                }
            }
        }