예제 #1
0
 protected void AspxRowDeleting(object sender, ASPxDataDeletingEventArgs e)
 {
     try
     {
         var receptionDetailTemp = Convert.ToInt32(e.Keys["RECEPTION_DETAIL_TEMP"]);
         _wscalled.DeleteDetail(receptionDetailTemp, Session["connectionString"].ToString());
         e.Cancel = true;
         GridReception.CancelEdit();
         var pResult  = "";
         var dsDetail = _wscalled.GetIncomeDetailForIncomeHeader((int)Session["Header"], Session["connectionString"].ToString(), ref pResult);
         if (pResult == "")
         {
             GridReception.DataSource = dsDetail;
             GridReception.DataBind();
         }
         else
         {
             ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('" + pResult + "');", true);
         }
         pcConfirm.ShowOnPageLoad = false;
     }
     catch (Exception ex)
     {
         ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: " + ex.Message + "');", true);
     }
 }
예제 #2
0
        protected void GridSap_RowDeleting(object sender, ASPxDataDeletingEventArgs e)
        {
            try
            {
                var erpDoc = e.Values["ERP_DOC"].ToString();
                //BORRAR DEL DATASET

                var oldDs = (DataSet)Session["SAP_RECEPTION_DATA"];
                oldDs.Tables[0].Delete("ERP_DOC = '" + erpDoc + "'");
                oldDs.Tables[0].AcceptChanges();

                if (oldDs.Tables[0].Rows.Count == 0)
                {
                    Session["SAP_RECEPTION_TYPE"] = null;
                }

                Session["SAP_RECEPTION_DATA"] = oldDs;
                e.Cancel = true;
                GridReception.CancelEdit();

                GridReception.DataSource = Session["SAP_RECEPTION_DATA"];
                GridReception.DataBind();
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: " + ex.Message + "');", true);
            }
        }
예제 #3
0
        private void ClearFields(bool clearCbType)
        {
            CbType.ReadOnly               = false;
            GrLookProvider.ReadOnly       = false;
            Session["SAP_RECEPTION_TYPE"] = null;
            Session["SAP_RECEPTION_DATA"] = null;
            GridSap.DataSource            = null;
            GridSap.DataBind();
            Session["INGRESO_HEADER"] = "false";
            TxtReference.Text         = "";
            SpinSap.Text    = "";
            GrLookUser.Text = "";
            GrLookSku.Text  = "";
            SpinSku.Number  = 0; GridReception.DataSource = null;
            GridReception.DataBind();
            GrLookSku.Text                     = "";
            SpinSku.Number                     = 0;
            Session["dsReception"]             = null;
            GrLookSku.Visible                  = true;
            SpinSku.Visible                    = true;
            ASPxLabel6.Visible                 = true;
            ASPxLabel8.Visible                 = true;
            SpinSap.ReadOnly                   = false;
            GridReception.Columns["#"].Visible = true;
            LblErpReferences.Text              = string.Empty;
            LblErpReferences.ClientVisible     = false;
            MemoComments.Text                  = string.Empty;
            GrLookProvider.Text                = "";
            GrLookProvider.ReadOnly            = false;

            if (clearCbType)
            {
                CbType.Text = "";
                ASPxPageControl1.TabPages.FindByName("ERP").Enabled = true;
            }
        }
예제 #4
0
 protected void ASPxGridView_selecionChanged(object sender, EventArgs e)
 {
     try
     {
         float  expected;
         int    key;
         string sku;
         var    data    = GridReception.GetSelectedFieldValues("EXPECTED");
         var    datas   = GridReception.GetSelectedFieldValues("CODE_SKU");
         var    dataKey = GridReception.GetSelectedFieldValues("RECEPTION_DETAIL_TEMP");
         try
         {
             key                 = Convert.ToInt32(dataKey[0]);
             sku                 = Convert.ToString(datas[0]);
             expected            = Convert.ToInt32(data[0]);
             Session["EXPECTED"] = expected;
             Session["CODE_SKU"] = sku;
             Session["RECEPTION_DETAIL_TEMP"] = key;
             SpinSku.Number         = Convert.ToInt32(expected);
             GrLookSku.Value        = Convert.ToString(sku);
             Session["UPDATE_TEMP"] = "true";
         }
         catch (Exception)
         {
             sku                    = Convert.ToString(Session["CODE_SKU"]);
             expected               = Convert.ToInt32(Session["EXPECTED"]);
             SpinSku.Number         = Convert.ToInt32(expected);
             GrLookSku.Value        = Convert.ToString(sku);
             Session["UPDATE_TEMP"] = "true";
         }
     }
     catch (Exception ex)
     {
         ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: " + ex.Message + "');", true);
     }
 }
예제 #5
0
        protected void ASPxMenu2_ItemClick(object source, MenuItemEventArgs e)
        {
            switch (e.Item.Name)
            {
            case "btnSAP":
                try
                {
                    var ds = (DataSet)Session["SAP_RECEPTION_DATA"];
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        SpinSap.ReadOnly     = true;
                        CbType.SelectedIndex = 0;

                        if (Session["SAP_RECEPTION_TYPE"].ToString().Equals("IT"))
                        {
                            GetClassificationReception();
                            CbType.Value            = "RTR";
                            CbType.ReadOnly         = true;
                            GrLookProvider.ReadOnly = true;
                        }

                        LlenarListaPorTipo(ds.Tables[0].Rows[0]["PROVIDER_NAME"].ToString());
                        GrLookProvider.Text       = ds.Tables[0].Rows[0]["PROVIDER_NAME"].ToString();
                        Session["INGRESO_HEADER"] = "TRUE";
                        _cs = Session["connectionString"].ToString();
                        _wscalled.InsertIncomeTemp(Convert.ToString(CbType.Value), Convert.ToString(GrLookProvider.Value), Convert.ToString(GrLookUser.Text), TxtReference.Text, SpinSap.Text, Session["USER"].ToString(), Session["connectionString"].ToString(), DateAssignedDate.Date, Convert.ToInt32(CbPriority.Value));
                        //datos del HEADER
                        var dsNumber = _wscalled.GetNumberHeader(Session["connectionString"].ToString());
                        Session["Header"] = Convert.ToInt32(dsNumber.Tables[0].Rows[0]["RECEPTION_HEADER"]);

                        var erpReferences = string.Empty;
                        var comments      = string.Empty;
                        var erpDocs       = ds.Tables[0].DefaultView.ToTable(true, "ERP_DOC");
                        for (var i = 0; erpDocs.Rows.Count > i; i++)
                        {
                            erpReferences = erpReferences + ds.Tables[0].DefaultView.ToTable(true, "ERP_DOC").Rows[i]["ERP_DOC"] + ",";
                            var erpDoc  = erpDocs.Rows[i]["ERP_DOC"];
                            var comment = ds.Tables[0].Select(" ERP_DOC = '" + erpDoc + "'")[0]["COMMENTS"];
                            comments += erpDoc + ": " + comment + Environment.NewLine;
                        }
                        TxtReference.Text              = erpReferences.Substring(0, erpReferences.Length - 1);
                        LblErpReferences.Text          = "Referencias: " + erpReferences.Substring(0, erpReferences.Length - 1);
                        LblErpReferences.ClientVisible = true;
                        MemoComments.Text              = comments;
                        //MemoComments.Text = comments.Substring(0, comments.Length - 1);
                        //INSERTAR EN TABLA TEMPORAL
                        for (var i = 0; ds.Tables[0].Rows.Count > i; i++)
                        {
                            _wscalled.InsertIncomeDetail(Convert.ToInt32(dsNumber.Tables[0].Rows[0]["RECEPTION_HEADER"]), ds.Tables[0].Rows[i]["SKU"].ToString(), Convert.ToDecimal(ds.Tables[0].Rows[i]["QTY"]), Session["connectionString"].ToString(), ds.Tables[0].Rows[i]["SKU_DESCRIPTION"].ToString());
                        }


                        //ASPxPageControl1.ActiveTabIndex = 0;
                        //OBTENER EL DETALLE ACTUALIZADO
                        var pResult  = "";
                        var dsDetail = _wscalled.GetIncomeDetailForIncomeHeader((int)Session["Header"], Session["connectionString"].ToString(), ref pResult);
                        if (pResult == "")
                        {
                            //LLENAR EL GRID
                            GridReception.DataSource = dsDetail;
                            GridReception.DataBind();

                            SpinSku.Number         = 0;
                            Session["dsReception"] = dsDetail;
                        }
                        else
                        {
                            ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('" + pResult + "');", true);
                        }
                        ASPxPageControl1.ActiveTabPage = ASPxPageControl1.TabPages.FindByName("Manual");
                        //TxtErp.Text = "";
                        GrLookSku.Visible                  = false;
                        SpinSku.Visible                    = false;
                        ASPxLabel6.Visible                 = false;
                        ASPxLabel8.Visible                 = false;
                        GrLookProvider.ReadOnly            = true;
                        GridReception.Columns["#"].Visible = false;
                    }
                }
                catch (Exception ex)
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('No hay datos en la referencia');", true);
                }
                break;

            case "btnExcel":
                ASPxGridViewExporter1.WriteXlsxToResponse();
                break;

            case "btnReport":
                ReportView();
                ASPxPopupControl2.ShowOnPageLoad = true;
                break;
            }
        }
예제 #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!ValidarConexionYUsuarioLogueado(sender))
            {
                return;
            }
            try
            {
                if (Session["SAP_RECEPTION_DATA"] != null)
                {
                    GridSap.DataSource = Session["SAP_RECEPTION_DATA"];
                    GridSap.DataBind();
                }

                //Validacion de insercion de datos HEADER en tabla temporal
                if (Request["__EVENTARGUMENT"] == "KeyPress")
                {
                    _cs = Session["connectionString"].ToString();
                    _wscalled.InsertIncomeTemp(Convert.ToString(CbType.Value), Convert.ToString(GrLookProvider.Value), Convert.ToString(GrLookUser.Text), TxtReference.Text, SpinSap.Text, Session["USER"].ToString(), Session["connectionString"].ToString(), DateAssignedDate.Date, Convert.ToInt32(CbPriority.Value));
                    Session["INGRESO_HEADER"] = "TRUE";
                }

                //Validacion de insercion de datos en Detail en tabla Temporal
                if (Request["__EVENTARGUMENT"] == "KeyPressSpE")
                {
                    if ((string)Session["UPDATE_TEMP"] == "true")
                    {
                        _wscalled.UpdateDetail((int)Session["RECEPTION_DETAIL_TEMP"], Convert.ToString(GrLookSku.Value), Convert.ToString(GrLookSku.Text), Convert.ToInt32(SpinSku.Number), Session["connectionString"].ToString());
                        Session["UPDATE_TEMP"] = "false";

                        Session["EXPECTED"] = Convert.ToInt32(SpinSku.Number);
                        var pResult  = "";
                        var dsDetail = _wscalled.GetIncomeDetailForIncomeHeader((int)Session["Header"], Session["connectionString"].ToString(), ref pResult);
                        if (pResult == "")
                        {
                            GridReception.DataSource = dsDetail;
                            GridReception.DataBind();
                            Session["dsReception"] = dsDetail;
                        }
                        else
                        {
                            ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('" + pResult + "');", true);
                        }
                    }

                    else if ((string)Session["INGRESO_HEADER"] == "TRUE")
                    {
                        var dsNumber = _wscalled.GetNumberHeader(Session["connectionString"].ToString());
                        Session["Header"] = Convert.ToInt32(dsNumber.Tables[0].Rows[0]["RECEPTION_HEADER"]);
                        _wscalled.InsertIncomeDetail(Convert.ToInt32(dsNumber.Tables[0].Rows[0]["RECEPTION_HEADER"]), Convert.ToString(GrLookSku.Value), Convert.ToDecimal(SpinSku.Number), Session["connectionString"].ToString(), GrLookSku.Text);
                        var pResult  = "";
                        var dsDetail = _wscalled.GetIncomeDetailForIncomeHeader((int)Session["Header"], Session["connectionString"].ToString(), ref pResult);
                        if (pResult == "")
                        {
                            GridReception.DataSource = dsDetail;
                            GridReception.DataBind();
                            SpinSku.Number         = 0;
                            Session["dsReception"] = dsDetail;
                        }
                        else
                        {
                            ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('" + pResult + "');", true);
                        }
                    }
                    else
                    {
                        //?Actualizar o insertar en base a la variable de sesion que lo indica
                        if ((string)Session["UPDATE_TEMP"] == "true")
                        {
                            _wscalled.UpdateDetail((int)Session["RECEPTION_DETAIL_TEMP"], Convert.ToString(GrLookSku.Value), Convert.ToString(GrLookSku.Text), Convert.ToInt32(SpinSku.Number), Session["connectionString"].ToString());
                            Session["UPDATE_TEMP"] = "false";

                            Session["EXPECTED"] = Convert.ToInt32(SpinSku.Number);
                            var pResult  = "";
                            var dsDetail = _wscalled.GetIncomeDetailForIncomeHeader((int)Session["Header"], Session["connectionString"].ToString(), ref pResult);
                            if (pResult == "")
                            {
                                GridReception.DataSource = dsDetail;
                                GridReception.DataBind();
                                Session["dsReception"] = dsDetail;
                            }
                            else
                            {
                                ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('" + pResult + "');", true);
                            }
                        }
                        else
                        {
                            _wscalled.InsertIncomeTemp(Convert.ToString(CbType.Value), Convert.ToString(GrLookProvider.Value), Convert.ToString(GrLookUser.Text), TxtReference.Text, SpinSap.Text, Session["USER"].ToString(), Session["connectionString"].ToString(), DateAssignedDate.Date, Convert.ToInt32(CbPriority.Value));
                            Session["INGRESO_HEADER"] = "TRUE";

                            var dsNumber = _wscalled.GetNumberHeader(Session["connectionString"].ToString());
                            Session["Header"] = Convert.ToInt32(dsNumber.Tables[0].Rows[0]["RECEPTION_HEADER"]);
                            _wscalled.InsertIncomeDetail(Convert.ToInt32(dsNumber.Tables[0].Rows[0]["RECEPTION_HEADER"]), Convert.ToString(GrLookSku.Value), Convert.ToDecimal(SpinSku.Number), Session["connectionString"].ToString(), GrLookSku.Text);
                            var pResult  = "";
                            var dsDetail = _wscalled.GetIncomeDetailForIncomeHeader((int)Session["Header"], Session["connectionString"].ToString(), ref pResult);
                            if (pResult == "")
                            {
                                GridReception.DataSource = dsDetail;
                                GridReception.DataBind();
                                SpinSku.Number         = 0;
                                Session["dsReception"] = dsDetail;
                            }
                            else
                            {
                                ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('" + pResult + "');", true);
                            }
                        }
                    }
                }
                _cs = (string)Session["connectionString"];
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: " + ex.Message + "');", true);
            }
            if (!Page.IsPostBack)
            {
                try
                {
                    Session["SAP_RECEPTION_TYPE"]   = null;
                    Session["LIST_DOC_ERP_PICKING"] = null;
                    Session["SAP_RECEPTION_DATA"]   = null;
                    GridSap.DataSource = null;
                    GridSap.DataBind();
                    DateAssignedDate.Date     = DateTime.Today;
                    Session["INGRESO_HEADER"] = "false";
                    Session["SaveReception"]  = "false";
                    Session["dsReception"]    = null;
                    //
                    LlenarListaDocErp();
                    //Carga de Tipos de clasificacion Recepcion
                    GetClassificationReception();
                    //Carga de Proveedores
                    GetProvider("");
                    //Carga de Operadores
                    GetOperator();
                    //Carga de SKU
                    if (Session["SKU"] != null)
                    {
                        var ds = (DataSet)Session["SKU"];
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            GrLookSku.DataSource = ds;
                            GrLookSku.DataBind();
                            Session["SKU"] = ds;
                        }
                    }
                    else
                    {
                        GetSku();
                    }
                }
                catch (Exception ex)
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: " + ex.Message + "');", true);
                }
            }
            try
            {
                if (Session["LIST_DOC_ERP_PICKING"] != null)
                {
                    UiListaPedidosErp.DataSource = Session["LIST_DOC_ERP_PICKING"];
                    UiListaPedidosErp.DataBind();
                }

                GetSkuIngrid();
                GrLookUser.DataSource = Session["OPERATOR"];
                GrLookUser.DataBind();
                GrLookProvider.DataSource = Session["PROVIDER"];
                GrLookProvider.DataBind();
                GrLookSku.DataSource = Session["SKU"];
                GrLookSku.DataBind();
                GridReception.DataSource = Session["dsReception"];
                GridReception.DataBind();
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: " + ex.Message + "');", true);
            }

            ReportView();
        }
예제 #7
0
        protected void AspxMenu1_ItemClick(object source, MenuItemEventArgs e)
        {
            try
            {
                switch (e.Item.Name)
                {
                case "btnInsert":
                    //?Actualizar o insertar en base a la variable de sesion que lo indica
                    if ((string)Session["UPDATE_TEMP"] == "true")
                    {
                        _wscalled.UpdateDetail((int)Session["RECEPTION_DETAIL_TEMP"], Convert.ToString(GrLookSku.Value), Convert.ToString(GrLookSku.Text), Convert.ToInt32(SpinSku.Number), Session["connectionString"].ToString());
                        Session["UPDATE_TEMP"] = "false";

                        Session["EXPECTED"] = Convert.ToInt32(SpinSku.Number);
                        var pResult  = "";
                        var dsDetail = _wscalled.GetIncomeDetailForIncomeHeader((int)Session["Header"], Session["connectionString"].ToString(), ref pResult);
                        if (pResult == "")
                        {
                            GridReception.DataSource = dsDetail;
                            GridReception.DataBind();
                        }
                        else
                        {
                            ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('" + pResult + "');", true);
                        }
                    }
                    else
                    {
                        ASPxPopupControl1.ShowOnPageLoad = true;
                    }

                    break;

                case "btnNew":
                    try
                    {
                        if ((string)Session["SaveReception"] == "false")
                        {
                            ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Es necesario almacenar la Recepcion');", true);
                        }
                        else
                        {
                            Session["INGRESO_HEADER"] = "false";
                            TxtReference.Text         = "";
                            SpinSap.Text             = "";
                            CbType.Text              = "";
                            GrLookProvider.Text      = "";
                            GrLookUser.Text          = "";
                            GrLookSku.Text           = "";
                            SpinSku.Number           = 0;
                            GridReception.DataSource = null;
                            GridReception.DataBind();
                            GrLookSku.Text                 = "";
                            SpinSku.Number                 = 0;
                            LblErpReferences.Text          = string.Empty;
                            LblErpReferences.ClientVisible = false;
                        }
                    }
                    catch (Exception)
                    {
                        ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('No se ha realizado la Operacion Correctamente');", true);
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: " + ex.Message + "');", true);
            }
        }