protected void btnAprobar_Click(object sender, EventArgs e)
        {
            if (Session["Usuario"] == null)
            {
                Response.Redirect("~/Security/frmCerrar.aspx");
            }

            try
            {
                strId_Vendedor   = Request.QueryString["Id_Vendedor"];
                strMes           = Request.QueryString["Mes"];
                strAnno          = Request.QueryString["Anno"];
                objPlanificacion = new PlanificacionWCFClient();
                objPlanificacion.Registrar_MetaPresupuestoPromotor(
                    ((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).idEmpresa,
                    ((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).codigoUsuario, Convert.ToInt32(strAnno), Convert.ToInt32(strMes), strId_Vendedor, string.Empty, string.Empty, 0, true
                    );
                rwmPre.RadAlert("Se aprobó correctamente el presupuesto.", 400, null, "Mensaje de Informacion", null);
                btnagregar.Enabled = false;
                btnAprobar.Enabled = false;
                lblestado.Text     = "Aprobado";
            }
            catch (Exception ex)
            {
                lblMensaje.Text     = ex.Message;
                lblMensaje.CssClass = "mensajeError";
            }
        }
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            if (Session["Usuario"] == null)
            {
                ScriptManager.RegisterStartupScript(Page, this.GetType(), "mykey", "CancelEdit();", true);
            }

            PlanificacionWCFClient objPlanificacionWCF = new PlanificacionWCFClient();
            int idModulo = 0;

            try
            {
                if (Request.QueryString["objMantModulos"] != "")
                {
                    idModulo = (int)ViewState["id_Modulo"];
                }

                GS_GetAllModulosResult objModulo = JsonHelper.JsonDeserialize <GS_GetAllModulosResult>(Request.QueryString["objMantModulos"]);

                var idEmpresa     = ((Usuario_LoginResult)Session["Usuario"]).idEmpresa;
                var codigoUsuario = ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario;
                int estadoModulo  = Convert.ToInt32(cboEstado.SelectedValue);

                objPlanificacionWCF.Modulos_Actualizar(idEmpresa, codigoUsuario, objModulo.id_Modulo, objModulo.Detalle, objModulo.id_Agenda, estadoModulo, codigoUsuario.ToString());
                lblMensaje.Text     = "Registro se modificó correctamente";
                lblMensaje.CssClass = "mensajeExito";
            }
            catch (Exception ex)
            {
                lblMensaje.Text     = "ERROR: " + ex.Message;
                lblMensaje.CssClass = "mensajeError";
            }
        }
Пример #3
0
        protected void btnGuardarUp_OnClick(object sender, EventArgs e)
        {
            try
            {
                var idEmpresa     = ((Usuario_LoginResult)Session["Usuario"]).idEmpresa;
                var codigoUsuario = ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario;
                PlanificacionWCFClient objPlanificacionWCF = new PlanificacionWCFClient();

                GS_GetPlanificacionDetalleByIdPlanResult objCierreContable = JsonHelper.JsonDeserialize <GS_GetPlanificacionDetalleByIdPlanResult>(Request.QueryString["objCierrePeriodo"]);

                string   id_Agenda   = ddlAgenda.SelectedValue;
                string   detalle     = txtDetalle.Text.Trim();
                string   observacion = txtObservacion.Text.Trim();
                DateTime fechaCierre = dpUpdate.SelectedDate.Value;
                objPlanificacionWCF.PlanificacionHistorial_Insertar(idEmpresa, codigoUsuario, objCierreContable.id_Detalle, objCierreContable.id_Modulo, id_Agenda, detalle,
                                                                    observacion, fechaCierre, codigoUsuario.ToString());

                objPlanificacionWCF.PlanificacionDetalle_Actualizar(idEmpresa, codigoUsuario, objCierreContable.id_Detalle, detalle,
                                                                    observacion, fechaCierre, codigoUsuario.ToString());


                ScriptManager.RegisterStartupScript(Page, this.GetType(), "mykey", "CloseAndRebind();", true);
            }
            catch (Exception ex)
            {
                lblMensaje.Text     = "ERROR: " + ex.Message;
                lblMensaje.CssClass = "mensajeError";
            }
        }
        private void CargarPresupuestoPromotor()
        {
            strId_Vendedor   = Request.QueryString["Id_Vendedor"];
            strMes           = Request.QueryString["Mes"];
            strAnno          = Request.QueryString["Anno"];
            objPlanificacion = new PlanificacionWCFClient();
            _lstPrePromotor  = objPlanificacion.Obtener_MetaPresupuestoPromotor(
                ((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).idEmpresa,
                ((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).codigoUsuario, Convert.ToInt32(strAnno), Convert.ToInt32(strMes), strId_Vendedor).ToList();
            Session["lstpromotor"] = JsonHelper.JsonSerializer(_lstPrePromotor);

            rpgResumenZona.DataSource = _lstPrePromotor;
            rpgResumenZona.DataBind();

            if (_lstPrePromotor.Where(x => x.Aprobado == true).Any())
            {
                btnagregar.Enabled = false;
                btnAprobar.Enabled = false;
                lblestado.Text     = "Aprobado";
            }
            else
            {
                lblestado.Text = "Nuevo";
            }
        }
        protected void gvwProductos_ItemCommand(object sender, GridCommandEventArgs e)
        {
            try
            {
                string id;
                string Aprobado = string.Empty;



                string[] commandArgs = e.CommandArgument.ToString().Split(new char[] { ',' });
                id       = commandArgs[0].ToString();
                Aprobado = commandArgs[1].ToString();



                if (e.CommandName == "EliminarProm")
                {
                    if (!Convert.ToBoolean(Aprobado))
                    {
                        strId_Vendedor = Request.QueryString["Id_Vendedor"];
                        strMes         = Request.QueryString["Mes"];
                        strAnno        = Request.QueryString["Anno"];

                        objPlanificacion = new PlanificacionWCFClient();
                        objPlanificacion.Eliminar_MetaPresupuestoPromotor(
                            ((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).idEmpresa,
                            ((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).codigoUsuario,
                            Convert.ToInt32(strAnno), Convert.ToInt32(strMes), strId_Vendedor, Convert.ToInt32(id)
                            );
                        //ScriptManager.RegisterStartupScript(Page, this.GetType(), "mykey", "ClearText();", true);
                        CargarPresupuesto();

                        List <USP_SEL_MetaPresupuestoPendienteResult> lst = new List <USP_SEL_MetaPresupuestoPendienteResult>();
                        strId_Vendedor = Request.QueryString["Id_Vendedor"];
                        strMes         = Request.QueryString["Mes"];
                        strAnno        = Request.QueryString["Anno"];
                        lst            = objPlanificacion.Obtener_PresupuestoPendiente(
                            ((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).idEmpresa,
                            ((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).codigoUsuario,
                            Convert.ToInt32(strAnno),
                            Convert.ToInt32(strMes),
                            strId_Vendedor).ToList();

                        lblDiferencia.Text = (Convert.ToDouble(lst.Sum(x => x.Total)) - Convert.ToDouble(_lstpresupuestoProm.Sum(x => x.Total))).ToString();
                    }
                    else
                    {
                        rwmPre.RadAlert("El presupuesto pro promotor esta aprobado, imposible realizar cambios.", 400, null, "Mensaje de error", null);
                        return;
                    }
                }
            }
            catch (Exception ex)
            {
                lblMensaje.Text     = ex.Message;
                lblMensaje.CssClass = "mensajeError";
            }
        }
        private void AgregarMontoPromotor()
        {
            objPlanificacion = new PlanificacionWCFClient();
            //List<USP_Sel_MetaPresupuestoPromotorResult> lstprom = new List<USP_Sel_MetaPresupuestoPromotorResult>();
            List <USP_SEL_MetaPresupuestoPendienteResult> lstpendiente = new List <USP_SEL_MetaPresupuestoPendienteResult>();

            _lstpresupuestoProm = JsonHelper.JsonDeserialize <List <USP_Sel_MetaPresupuestoPromotorResult> >((string)Session["PresupuestoPromotor"]);

            strId_Vendedor = Request.QueryString["Id_Vendedor"];
            strMes         = Request.QueryString["Mes"];
            strAnno        = Request.QueryString["Anno"];
            lstpendiente   = objPlanificacion.Obtener_PresupuestoPendiente(
                ((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).idEmpresa,
                ((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).codigoUsuario,
                Convert.ToInt32(strAnno),
                Convert.ToInt32(strMes),
                strId_Vendedor).ToList();

            double TotalPromotor  = Math.Round(Convert.ToDouble(_lstpresupuestoProm.Sum(x => x.Total)), 2);
            double TotalPendiente = Math.Round(Convert.ToDouble(lstpendiente.Sum(x => x.Total)), 2);


            if (TotalPendiente < (TotalPromotor) + Convert.ToDouble(txtmonto.Text))
            {
                rwmPre.RadAlert("El monto total asignado a los promotores es superior al monto total del presupuesto", 400, null, "Validación de Información", null);
            }
            else if (_lstpresupuestoProm.Where(x => x.Id_Cliente == cbcliente.SelectedValue.ToString() && x.Id_Promotor == cbpromotor.SelectedValue.ToString()).Count() >= 1)
            {
                rwmPre.RadAlert("El promotor seleccionado ya tiene registrado un presupuesto al cliente seleccionado", 400, null, "Validación de Información", null);
            }
            else
            {
                lblDiferencia.Text = Math.Round(TotalPendiente - ((TotalPromotor) + Convert.ToDouble(txtmonto.Text)), 2).ToString();
                //_lstpresupuestoProm.Add(new USP_Sel_MetaPresupuestoPromotorResult
                //{
                //    Id=0,
                //    Anno=Convert.ToInt32(strAnno),
                //    Mes=Convert.ToInt32(strMes),
                //    Id_Vendedor=strId_Vendedor,
                //    Id_Cliente=cbcliente.SelectedValue.ToString(),
                //    NombreCliente=cbcliente.Text.Trim(),
                //    Id_Promotor=cbpromotor.SelectedValue.ToString(),
                //    NombrePromotor=cbpromotor.Text.Trim(),
                //    Aprobado=false,
                //    Total=Convert.ToDecimal(txtmonto.Text)
                //});

                objPlanificacion.Registrar_MetaPresupuestoPromotor(
                    ((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).idEmpresa,
                    ((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).codigoUsuario,
                    Convert.ToInt32(strAnno), Convert.ToInt32(strMes), strId_Vendedor, cbcliente.SelectedValue.ToString(), cbpromotor.SelectedValue.ToString(), Convert.ToDecimal(txtmonto.Text), false);
            }
        }
Пример #7
0
        private void CargarBusquedaPresupuesto(DateTime fechai, DateTime fechaf, string vendedor)
        {
            objPlanificacion = new PlanificacionWCFClient();
            _lstbusquedaPre  = objPlanificacion.Obtener_MetaPresupuesto(
                ((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).idEmpresa,
                ((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).codigoUsuario, fechai, fechaf, vendedor
                ).ToList();

            Session["lstBusquedaPre"] = JsonHelper.JsonSerializer(_lstbusquedaPre);
            gvwSeguimiento.DataSource = _lstbusquedaPre;
            gvwSeguimiento.DataBind();
        }
Пример #8
0
 private void AprobarPresupuesto()
 {
     objPlanificacion = new PlanificacionWCFClient();
     objPlanificacion.Aprobar_MetaPresupuesto(
         ((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).idEmpresa,
         ((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).codigoUsuario,
         rmyPre.SelectedDate.Value.Year,
         rmyPre.SelectedDate.Value.Month,
         txt_idvendedor.Value.ToString(), true, Dns.GetHostName()
         );
     CargarPresupuesto(rmyPre.SelectedDate.Value.Year,
                       rmyPre.SelectedDate.Value.Month,
                       txt_idvendedor.Value.ToString());
 }
Пример #9
0
        private void CargarResumen()
        {
            _lstresumen      = new List <USP_SEL_VENTA_POR_VENDEDOR2>();
            objPlanificacion = new PlanificacionWCFClient();
            _lstresumen      = objPlanificacion.Obtener_PresupuestoResumen(
                ((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).idEmpresa,
                ((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).codigoUsuario,
                Convert.ToDateTime(rmyPre.SelectedDate), DateTime.Now).ToList();

            Session["lstPresupuestoResumen"] = JsonHelper.JsonSerializer(_lstresumen);
            rpgResumenZona.DataSource        = _lstresumen;
            rpgResumenZona.DataBind();

            lblTitulo.Text = "Resumen de Presupuestos Confirmados " + RetornaMes(rmyPre.SelectedDate.Value.Month) + " " + rmyPre.SelectedDate.Value.Year.ToString();
        }
        private List <GS_GetPlanificacionDetalleByIdPlanResult> CierreContableByPlan_Cargar(int idEmpresa, int codigoUsuario, string idPlanificacion)
        {
            PlanificacionWCFClient objCierreByPlanWCF = new PlanificacionWCFClient();

            try
            {
                List <GS_GetPlanificacionDetalleByIdPlanResult> lstCierreByPlan = objCierreByPlanWCF.GetPlanificacionDetalleByIdPlan(idEmpresa, codigoUsuario, idPlanificacion).ToList();

                ViewState["lstCierreByPlan"] = JsonHelper.JsonSerializer(lstCierreByPlan);
                return(lstCierreByPlan);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        private void CargarPromotores()
        {
            objPlanificacion = new PlanificacionWCFClient();
            string id_vendedor = Request.QueryString["Id_Vendedor"];
            List <USP_Sel_PromotoresxVendedorResult> lst = new List <USP_Sel_PromotoresxVendedorResult>();

            lst = objPlanificacion.Obtener_PromotoresxVendedor(
                ((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).idEmpresa,
                ((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).codigoUsuario,
                id_vendedor
                ).ToList();

            cbpromotor.DataSource     = lst;
            cbpromotor.DataTextField  = "NombrePromotor";
            cbpromotor.DataValueField = "Id_Promotor";
            cbpromotor.DataBind();
        }
Пример #12
0
        private void AgregarItemPresupuesto()
        {
            objPlanificacion = new PlanificacionWCFClient();
            _lstdetalle      = new List <USP_Sel_MetaPresupuestoDetResult>();


            USP_Sel_MetaPresupuestoDetResult edetalle = new USP_Sel_MetaPresupuestoDetResult();

            if (Session["lstdetalle"] != null)
            {
                _lstdetalle = JsonHelper.JsonDeserialize <List <USP_Sel_MetaPresupuestoDetResult> >((string)Session["lstdetalle"]);
            }
            edetalle.Id = 0;

            edetalle.Anno        = rmyPre.SelectedDate.Value.Year;
            edetalle.Mes         = rmyPre.SelectedDate.Value.Month;
            edetalle.Id_Vendedor = txt_idvendedor.Value.ToString();
            edetalle.Id_Cliente  = acbCliente.Entries[0].Text.Split('-')[0];
            edetalle.TipoCliente = objPlanificacion.Obtener_TipoCliente(
                ((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).idEmpresa,
                ((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).codigoUsuario, edetalle.Id_Cliente).Propiedad.ToString();
            edetalle.Cliente        = acbCliente.Entries[0].Text.Split('-')[1];
            edetalle.CodigoProducto = string.Empty;
            edetalle.Id_G5          = Convert.ToInt32(abcProducto.Entries[0].Text.Split('-')[0]);
            edetalle.Kardex         = 0;
            edetalle.NombreKardex   = abcProducto.Entries[0].Text.Split('-')[1];
            edetalle.Cantidad       = Convert.ToDecimal(txtCantidad2.Text == string.Empty ? "0" : txtCantidad2.Text);
            edetalle.NombreG5       = abcProducto.Entries[0].Text.Split('-')[1];
            edetalle.Precio         = Convert.ToDecimal(txtprecio2.Text == string.Empty ? "0" : txtprecio2.Text);
            edetalle.Total          = Convert.ToDecimal(Math.Round((Convert.ToDecimal(edetalle.Cantidad) * Convert.ToDecimal(edetalle.Precio)), 3));

            if (_lstdetalle.Where(x => x.Id_Cliente == edetalle.Id_Cliente && x.Id_G5 == edetalle.Id_G5).ToList().Any())
            {
                rwmPre.RadAlert("El codigo de producto para el cliente " + edetalle.Cliente + " ya fue ingresado", 400, null, "Mensaje de error", null);
                return;
            }
            _lstdetalle.Add(edetalle);
            rmyPre.Enabled      = false;
            gvwItems.DataSource = _lstdetalle;
            gvwItems.DataBind();
            Session["lstdetalle"] = JsonHelper.JsonSerializer(_lstdetalle);
            txtCantidad2.Text     = "0";
            txtprecio2.Text       = "0";
            ScriptManager.RegisterStartupScript(Page, this.GetType(), "mykey", "StringText();", true);
        }
Пример #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["Usuario"] == null)
            {
                ScriptManager.RegisterStartupScript(Page, this.GetType(), "mykey", "CancelEdit();", true);
            }

            try
            {
                if (!Page.IsPostBack)
                {
                    LoginWCF.LoginWCFClient objLoginWCF = new LoginWCF.LoginWCFClient();
                    objLoginWCF.AuditoriaMenu_Registrar(System.Web.HttpContext.Current.Request.Url.AbsolutePath, Environment.MachineName,
                                                        ((Usuario_LoginResult)System.Web.HttpContext.Current.Session["Usuario"]).idUsuario);

                    if (string.IsNullOrEmpty(Request.QueryString["objCierreContable"]))
                    {
                        Title = "Modificar Cierre";
                        string obj = Request.QueryString["objCierrePeriodo"];
                        GS_GetPlanificacionDetalleByIdPlanResult objCierreContable = JsonHelper.JsonDeserialize <GS_GetPlanificacionDetalleByIdPlanResult>(Request.QueryString["objCierrePeriodo"]);
                        ViewState["idPlanificacion"] = objCierreContable.idPlanificacion;
                        //CargarGridEdit();
                        lblMensaje.Text     = "Listo para modificar Cierre Contable";
                        lblMensaje.CssClass = "mensajeExito";
                        Label1.Text         = objCierreContable.Modulo;
                        txtDetalle.Text     = objCierreContable.Detalle;

                        var idEmpresa     = ((Usuario_LoginResult)Session["Usuario"]).idEmpresa;
                        var codigoUsuario = ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario;
                        PlanificacionWCFClient objPlanificacionWCF = new PlanificacionWCFClient();
                        var lstSource = objPlanificacionWCF.GetAgendaLista(idEmpresa, codigoUsuario);
                        ddlAgenda.DataTextField  = "AgendaNombre";
                        ddlAgenda.DataValueField = "id_Agenda";
                        ddlAgenda.DataSource     = lstSource;
                        ddlAgenda.SelectedValue  = objCierreContable.Responsable;
                        ddlAgenda.DataBind();
                    }
                }
            }
            catch (Exception ex)
            {
                lblMensaje.Text     = "ERROR: " + ex.Message;
                lblMensaje.CssClass = "mensajeError";
            }
        }
        private void CargarPresupuestoPendiente()
        {
            objPlanificacion = new PlanificacionWCFClient();
            strId_Vendedor   = Request.QueryString["Id_Vendedor"];
            strMes           = Request.QueryString["Mes"];
            strAnno          = Request.QueryString["Anno"];

            _lstPrePendiente = objPlanificacion.Obtener_PresupuestoPendiente(
                ((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).idEmpresa,
                ((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).codigoUsuario, Convert.ToInt32(strAnno), Convert.ToInt32(strMes), strId_Vendedor).ToList();

            txtzona.Text             = _lstPrePendiente.Select(x => x.Zona).First().ToUpper();
            txtjefezona.Text         = _lstPrePendiente.Select(x => x.Vendedor).First().ToUpper();
            txtperiodo.Text          = (RetornaMes(Convert.ToInt32(strMes)) + " - " + strAnno).ToUpper();
            Session["lstpendientes"] = JsonHelper.JsonSerializer(_lstPrePendiente);
            gvwProductos.DataSource  = _lstPrePendiente;
            gvwProductos.DataBind();
        }
        public List <GS_GetPlanDetalleToInsertResult> CargarGridInsert()
        {
            List <GS_GetPlanDetalleToInsertResult> lstCierreByPlan;
            PlanificacionWCFClient objCierreByPlanWCF = new PlanificacionWCFClient();

            try
            {
                var idEmpresa     = ((Usuario_LoginResult)Session["Usuario"]).idEmpresa;
                var codigoUsuario = ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario;

                lstCierreByPlan = objCierreByPlanWCF.GetPlanDetalleToInsert(idEmpresa, codigoUsuario).ToList();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(lstCierreByPlan);
        }
        private void Cargar_Grid()
        {
            List <GS_GetAllModulosResult> lstModulos;

            try
            {
                PlanificacionWCFClient objPlanificacionWCF = new PlanificacionWCFClient();

                lstModulos = objPlanificacionWCF.Perfil_Listar(((Usuario_LoginResult)Session["Usuario"]).idEmpresa, ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario).ToList();

                grdMantModulos.DataSource = lstModulos;
                grdMantModulos.DataBind();

                ViewState["lstModulos"] = JsonHelper.JsonSerializer(lstModulos);
            }
            catch (Exception)
            {
                throw;
            }
        }
        public List <GS_GetPlanDetalleToEditResult> CargarGridEdit()
        {
            List <GS_GetPlanDetalleToEditResult> lstCierreByPlan;
            PlanificacionWCFClient objCierreByPlanWCF = new PlanificacionWCFClient();

            try
            {
                var idEmpresa       = ((Usuario_LoginResult)Session["Usuario"]).idEmpresa;
                var codigoUsuario   = ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario;
                var idPlanificacion = ViewState["idPlanificacion"].ToString();

                lstCierreByPlan = objCierreByPlanWCF.GetPlanDetalleToEdit(idEmpresa, codigoUsuario, idPlanificacion).ToList();
                HttpContext.Current.Session["lstCierreByPlan"] = lstCierreByPlan;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(lstCierreByPlan);
        }
        private void CierreContable_Cargar(int idEmpresa, int codigoUsuario, string periodo)
        {
            PlanificacionWCFClient objPlanificacionWCF = new PlanificacionWCFClient();

            try
            {
                List <GS_GetPlanificacionByPeriodoResult> lstCierrePeriodo = objPlanificacionWCF.GetPlanificacionByPeriodo(idEmpresa, codigoUsuario, periodo).ToList();
                grdCierrePorPeriodo.DataSource = lstCierrePeriodo;
                grdCierrePorPeriodo.DataBind();

                ViewState["lstCierrePeriodo"] = JsonHelper.JsonSerializer(lstCierrePeriodo);
                ViewState["idEmpresa"]        = idEmpresa;
                ViewState["codigoUsuario"]    = codigoUsuario;
            }
            catch (Exception ex)
            {
                lblMensaje.Text     = ex.Message;
                lblMensaje.CssClass = "mensajeError";
            }
        }
        private void CierreContableByPlan_Cargar(int idEmpresa, int codigoUsuario, string idPlanificacion)
        {
            PlanificacionWCFClient objCierreByPlanWCF = new PlanificacionWCFClient();

            try
            {
                List <GS_GetPlanificacionDetalleByIdPlanResult> lstCierreByPlan = objCierreByPlanWCF.GetPlanificacionDetalleByIdPlan(idEmpresa, codigoUsuario, idPlanificacion).ToList();
                grdCierreContable.DataSource = lstCierreByPlan;
                grdCierreContable.DataBind();

                ViewState["lstCierreByPlan"] = JsonHelper.JsonSerializer(lstCierreByPlan);
                ViewState["idEmpresa"]       = idEmpresa;
                ViewState["codigoUsuario"]   = codigoUsuario;
            }
            catch (Exception ex)
            {
                lblMensaje.Text     = ex.Message;
                lblMensaje.CssClass = "mensajeError";
            }
        }
Пример #20
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["Usuario"] == null)
            {
                ScriptManager.RegisterStartupScript(Page, this.GetType(), "mykey", "CancelEdit();", true);
            }

            try
            {
                if (!Page.IsPostBack)
                {
                    if (!string.IsNullOrEmpty(Request.QueryString["objHistorial"]))
                    {
                        LoginWCF.LoginWCFClient objLoginWCF = new LoginWCF.LoginWCFClient();
                        objLoginWCF.AuditoriaMenu_Registrar(System.Web.HttpContext.Current.Request.Url.AbsolutePath, Environment.MachineName,
                                                            ((Usuario_LoginResult)System.Web.HttpContext.Current.Session["Usuario"]).idUsuario);

                        Title = "Historial";
                        string obj = Request.QueryString["objHistorial"];
                        GS_GetPlanificacionDetalleByIdPlanResult objCierreContable = JsonHelper.JsonDeserialize <GS_GetPlanificacionDetalleByIdPlanResult>(Request.QueryString["objHistorial"]);
                        ViewState["idPlanificacion"] = objCierreContable.idPlanificacion;
                        //CargarGridEdit();

                        Label1.Text = objCierreContable.Modulo;


                        var idEmpresa     = ((Usuario_LoginResult)Session["Usuario"]).idEmpresa;
                        var codigoUsuario = ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario;
                        PlanificacionWCFClient objPlanificacionWCF = new PlanificacionWCFClient();
                        var lstSource = objPlanificacionWCF.GetHistorialCambios(idEmpresa, codigoUsuario, objCierreContable.id_Detalle);
                        grdHistorial.DataSource = lstSource;
                        grdHistorial.DataBind();
                    }
                }
            }
            catch (Exception ex)
            {
                //lblMensaje.Text = "ERROR: " + ex.Message;
                //lblMensaje.CssClass = "mensajeError";
            }
        }
Пример #21
0
        private void CargarPresupuesto(int anno, int mes, string id_vendedor)
        {
            USP_Sel_MetaPresupuestoCabResult eCab = new USP_Sel_MetaPresupuestoCabResult();

            _lstdetalle = new List <USP_Sel_MetaPresupuestoDetResult>();
            USP_Sel_MetaPresupuestoDetResult[] lstdet = null;

            objPlanificacion = new PlanificacionWCFClient();
            objPlanificacion.Obtener_MetaPresupuestoCabDet(
                ((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).idEmpresa,
                ((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).codigoUsuario, anno, mes, id_vendedor, ref eCab, ref lstdet);
            _lstdetalle = lstdet.ToList();
            CargarVendedorZona();
            rmyPre.SelectedDate = new DateTime(eCab.Anno, eCab.Mes, 1);
            lblestado.Text      = eCab.Aprobado == true ? "Aprobado" : "Registrado";

            rmyPre.Enabled     = eCab.Aprobado == true ? false : ((_lstdetalle.Any()) ? false : true);
            btnguardar.Enabled = eCab.Aprobado == true ? false : true;
            btnagregar.Enabled = eCab.Aprobado == true ? false : true;

            gvwItems.DataSource = _lstdetalle;
            gvwItems.DataBind();
            Session["lstdetalle"] = JsonHelper.JsonSerializer(_lstdetalle);
        }
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            if (Session["Usuario"] == null)
            {
                ScriptManager.RegisterStartupScript(Page, this.GetType(), "mykey", "CancelEdit();", true);
            }

            PlanificacionWCFClient objCierreByPlanWCF = new PlanificacionWCFClient();
            int idPlanificacion = 0;

            try
            {
                //if (Request.QueryString["objCierreContable"] != "")
                //    idPlanificacion = (int)ViewState["idPlanificacion"];

                if (VerificaInsertOrUpdate())
                {
                    List <GS_GetPlanDetalleToInsertResult> lstCierreByPlan =
                        (List <GS_GetPlanDetalleToInsertResult>)HttpContext.Current.Session["lstCierreByPlan"];
                    var periodo      = dpPeriodo.SelectedDate.Value.Month.ToString("D2") + "/" + dpPeriodo.SelectedDate.Value.Year;
                    var fechaInicial = lstCierreByPlan.Min(x => x.FechaCierre);
                    var fechaFinal   = lstCierreByPlan.Max(x => x.FechaCierre);

                    var idEmpresa     = ((Usuario_LoginResult)Session["Usuario"]).idEmpresa;
                    var codigoUsuario = ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario;
                    var nroDocumento  = ((Usuario_LoginResult)Session["Usuario"]).nroDocumento;

                    idPlanificacion = objCierreByPlanWCF.PlanificacionCabecera_Insertar(idEmpresa, codigoUsuario, periodo, fechaInicial.Value, fechaFinal.Value, nroDocumento);

                    var lstToDb = lstCierreByPlan.Where(x => x.idPlanificacion == 0 && x.FechaCierre.HasValue);

                    if (lstCierreByPlan.Exists(x => !x.FechaCierre.HasValue))
                    {
                        rwmCierre.RadAlert("No se ha ingresado una fecha", 500, 100, "Validación de fechas", "");
                    }

                    foreach (var item in lstToDb)
                    {
                        objCierreByPlanWCF.PlanificacionDetalle_Insertar(idEmpresa, codigoUsuario, item.id_Modulo,
                                                                         idPlanificacion, item.FechaCierre.Value, item.Detalle, item.Observacion, item.Estado,
                                                                         codigoUsuario.ToString());
                    }
                }

                else

                {
                    List <GS_GetPlanDetalleToEditResult> lstCierreByPlan =
                        (List <GS_GetPlanDetalleToEditResult>)HttpContext.Current.Session["lstCierreByPlan"];

                    var periodo      = dpPeriodo.SelectedDate.Value.Month.ToString("D2") + "/" + dpPeriodo.SelectedDate.Value.Year;
                    var fechaInicial = lstCierreByPlan.Min(x => x.FechaCierre);
                    var fechaFinal   = lstCierreByPlan.Max(x => x.FechaCierre);

                    var idEmpresa     = ((Usuario_LoginResult)Session["Usuario"]).idEmpresa;
                    var codigoUsuario = ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario;
                    var nroDocumento  = ((Usuario_LoginResult)Session["Usuario"]).nroDocumento;

                    idPlanificacion = Convert.ToInt32(ViewState["idPlanificacion"].ToString());

                    objCierreByPlanWCF.PlanificacionCabecera_Update(idEmpresa, codigoUsuario, idPlanificacion, fechaInicial.Value, fechaFinal.Value, nroDocumento);

                    var lstToDb = lstCierreByPlan.Where(x => x.idPlanificacion == 0 && x.FechaCierre.HasValue);
                    if (lstCierreByPlan.Exists(x => !x.FechaCierre.HasValue))
                    {
                        rwmCierre.RadAlert("No se ha ingresado una fecha", 500, 100, "Validación de fechas", "");
                    }

                    foreach (var item in lstToDb)
                    {
                        objCierreByPlanWCF.PlanificacionDetalle_Insertar(idEmpresa, codigoUsuario, item.id_Modulo,
                                                                         idPlanificacion, item.FechaCierre.Value, item.Detalle, item.Observacion, item.Estado.Value,
                                                                         codigoUsuario.ToString());
                    }
                }
                ScriptManager.RegisterStartupScript(Page, this.GetType(), "mykey", "CloseAndRebind();", true);
            }
            catch (Exception ex)
            {
                lblMensaje.Text     = "ERROR: " + ex.Message;
                lblMensaje.CssClass = "mensajeError";
            }
        }