private void Reporte_Cargar(int id_zonaV, string id_vendedorV)
        {
            int    anho;
            int    id_zona;
            string id_vendedor;

            List <gsPresupuesto_ZonaResult> lstPrespuesto;

            try
            {
                ReporteVentaWCFClient objReporteVenta = new ReporteVentaWCFClient();

                DateTime fechaInicio = new DateTime(dpFecInicio.SelectedDate.Value.Year, dpFecInicio.SelectedDate.Value.Month, 1);
                DateTime fechaFinal  = new DateTime(dpFecFinal.SelectedDate.Value.Year, dpFecFinal.SelectedDate.Value.Month, 1).AddMonths(1).AddDays(-1);

                id_zona     = id_zonaV;
                id_vendedor = id_vendedorV;

                lstPrespuesto = objReporteVenta.Presupuesto_Zona(((Usuario_LoginResult)Session["Usuario"]).idEmpresa, ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, fechaInicio, fechaFinal, id_zona, id_vendedor).ToList();

                grdPresupuesto.DataSource = lstPrespuesto;
                grdPresupuesto.DataBind();

                lblMensaje.Text     = "Se han encontrado " + lstPrespuesto.Count.ToString() + " registro.";
                lblMensaje.CssClass = "mensajeExito";

                ViewState["lstPrespuesto"] = JsonHelper.JsonSerializer(lstPrespuesto);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #2
0
        private void Vendedor_Listar()
        {
            ReporteVentaWCFClient objReporteVentaWCF          = new ReporteVentaWCFClient();
            List <ReporteVentas_EstadoResultadosResult> Lista = new List <ReporteVentas_EstadoResultadosResult>();
            string nombre_zona = "";

            try {
                nombre_zona = cboZona.SelectedItem.Text;

                DateTime fechaInicio = new DateTime(dpFecInicio.SelectedDate.Value.Year, dpFecInicio.SelectedDate.Value.Month, 1);
                DateTime fechaFinal  = dpFecFinal.SelectedDate.Value.AddMonths(1);
                fechaFinal = (new DateTime(fechaFinal.Year, fechaFinal.Month, 1)).AddDays(-1);
                Lista      = objReporteVentaWCF.ReporteVentas_Resultados(
                    ((Usuario_LoginResult)Session["Usuario"]).idEmpresa, ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, fechaInicio, fechaFinal, nombre_zona, null).ToList();



                ViewState["ListaReporte"] = JsonHelper.JsonSerializer(Lista);

                gsReporteVentas_Familia.DataSource = Lista;
                gsReporteVentas_Familia.DataBind();

                lblReporte.Value = "1";
            }
            catch (Exception ex) {
                throw ex;
            }
        }
예제 #3
0
        private void ReporteVenta_Cliente(int mes, int year, int id_zona, string id_sectorista)
        {
            ReporteVentaWCFClient objReporteVentaWCF = new ReporteVentaWCFClient();

            try
            {
                int periodo;
                periodo = year * 100 + mes;


                CobranzasWCFClient objCobranzasWCF = new CobranzasWCFClient();
                List <gsReporteCobranzas_Poryectadas_ClienteResult> Lista;

                Lista = objCobranzasWCF.Reporte_CobranzasProyectadasCliente(((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).idEmpresa,
                                                                            ((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).codigoUsuario,
                                                                            mes, year, periodo, id_zona, id_sectorista).ToList();

                Lista = Lista.FindAll(x => x.ImportePendiente > 0).ToList();
                Lista = Lista.OrderByDescending(x => x.Avance).ToList();

                ViewState["lstReporte"] = JsonHelper.JsonSerializer(Lista);

                grdCliente.DataSource = Lista;
                grdCliente.DataBind();
                //lblTitulo.Text = "Reporte " + fechaInico.Year.ToString() + "-" + fechaInico.Month.ToString() + " de " + rv.Vendedor;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        private void Vendedor_Listar()
        {
            ReporteVentaWCFClient            objReporteVentaWCF = new ReporteVentaWCFClient();
            List <ReporteVentas_ItemsResult> Lista = new List <ReporteVentas_ItemsResult>();

            try {
                DateTime fechaInicio = new DateTime(dpFecInicio.SelectedDate.Value.Year, dpFecInicio.SelectedDate.Value.Month, 1);
                DateTime fechaFinal  = dpFecFinal.SelectedDate.Value.AddMonths(1);
                fechaFinal = (new DateTime(fechaFinal.Year, fechaFinal.Month, 1)).AddDays(-1);
                Lista      = objReporteVentaWCF.ReporteVentas_Items(((Usuario_LoginResult)Session["Usuario"]).idEmpresa, ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, fechaInicio, fechaFinal, 0, null).ToList();

                ViewState["ListaReporteItem"] = JsonHelper.JsonSerializer(Lista);

                if (rbContraer.Checked == true)
                {
                    gsReporteVentas_Item.RowGroupsDefaultExpanded = false;
                }
                else
                {
                    gsReporteVentas_Item.RowGroupsDefaultExpanded = true;
                }

                gsReporteVentas_Item.DataSource = Lista;
                gsReporteVentas_Item.DataBind();

                lblReporte.Value = "1";
            }
            catch (Exception ex) {
                throw ex;
            }
        }
        private void ReporteVenta_Listar()
        {
            ReporteVentaWCFClient             objReporteVentaWCF = new ReporteVentaWCFClient();
            List <gsPronostico_vs_RealResult> lst;

            try
            {
                DateTime fechaInicio = dpPeriodoInicio.SelectedDate.Value;
                DateTime fechaFinal  = new DateTime(dpPeriodoFinal.SelectedDate.Value.Year, dpPeriodoFinal.SelectedDate.Value.Month, 1).AddMonths(1).AddDays(-1);

                int    id_zona     = int.Parse(cboZona.SelectedValue);
                string id_vendedor = "";

                lst = objReporteVentaWCF.gsPronostico_vs_Real(((Usuario_LoginResult)Session["Usuario"]).idEmpresa, ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, fechaInicio, fechaFinal, id_zona, id_vendedor).ToList();

                //grdComparativo.DataSource = lst;
                //grdComparativo.DataBind();

                grdComparativoPivot.DataSource = lst;
                grdComparativoPivot.DataBind();

                //ViewState["fechaInicio"] = firstDayOfMonth.ToString("dd/MM/yyyy");
                ViewState["lstPlaneamiento"] = JsonHelper.JsonSerializer(lst);

                lblMensaje.Text     = "Se han encontrado " + lst.Count.ToString() + " registro.";
                lblMensaje.CssClass = "mensajeExito";
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #6
0
        private void ReporteVenta_Cliente(int mes, int anho)
        {
            ReporteVentaWCFClient objReporteVentaWCF = new ReporteVentaWCFClient();

            try
            {
                string EstadoCliente = null;
                EstadoCliente = cboEstadoCredito.SelectedItem.Text;
                if (EstadoCliente == "TODOS")
                {
                    EstadoCliente = null;
                }
                DateTime fechaInicio = new DateTime(anho, mes, 1);
                DateTime fechaFinal  = fechaInicio.AddMonths(1).AddDays(-1);

                grdCliente.DataSource = objReporteVentaWCF.DocVenta_ReporteVenta_Cliente(((Usuario_LoginResult)Session["Usuario"]).idEmpresa,
                                                                                         ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, null, fechaInicio, fechaFinal, EstadoCliente);
                grdCliente.DataBind();
                //lblTitulo.Text = "Reporte " + fechaInico.Year.ToString() + "-" + fechaInico.Month.ToString() + " de " + rv.Vendedor;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        protected void btnBuscarUsuario_Click(object sender, EventArgs e)
        {
            if (Session["Usuario"] == null)
            {
                ScriptManager.RegisterStartupScript(Page, this.GetType(), "mykey", "CancelEdit();", true);
            }

            ReporteVentaWCFClient       objReporte = new ReporteVentaWCFClient();
            UsuarioReporte_ListarResult objUsuario = new UsuarioReporte_ListarResult();

            try
            {
                objUsuario = objReporte.UsuarioReporte_Listar(int.Parse(cboEmpresa.SelectedValue), ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, 0, acbUsuario.Text.Split('-')[0]).Single();

                hfIdUsuario.Value = objUsuario.idUsuario.ToString();

                txtNroDocumento.Text = objUsuario.NroDocumento;
                txtNombre.Text       = objUsuario.NombreUsuario;

                btnGuardar.Enabled = true;

                Reporte_Cargar(cboEmpresa.SelectedValue.ToString(), objUsuario.idUsuario);
            }
            catch (Exception ex)
            {
                lblMensaje.Text     = ex.Message;
                lblMensaje.CssClass = "mensajeError";
            }
        }
        private void ReporteVenta_Listar()
        {
            ReporteVentaWCFClient objReporteVentaWCF = new ReporteVentaWCFClient();
            List <gsDocVenta_ReporteVenta_VendedorV2Result> lst;

            try
            {
                DateTime firstDayOfMonth = new DateTime(rmyReporte.SelectedDate.Value.Year, rmyReporte.SelectedDate.Value.Month, 1);
                DateTime lastDayOfMonth  = firstDayOfMonth.AddMonths(1).AddDays(-1);

                lst = objReporteVentaWCF.DocVenta_ReporteVenta_VendedorZona(((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).idEmpresa,
                                                                            ((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).codigoUsuario, null, firstDayOfMonth, lastDayOfMonth).ToList();


                grdDocVenta.DataSource = lst;
                grdDocVenta.DataBind();



                lblTitulo.Text = "Reporte de ventas (" + rmyReporte.SelectedDate.Value.Year.ToString() + "-" + rmyReporte.SelectedDate.Value.Month.ToString() + ")";

                ViewState["lstDocVenta"] = JsonHelper.JsonSerializer(lst);
                ViewState["fechaInicio"] = firstDayOfMonth.ToString("dd/MM/yyyy");
                ViewState["fechaFinal"]  = lastDayOfMonth.ToString("dd/MM/yyyy");
                ViewState["lstReporte"]  = JsonHelper.JsonSerializer(lst);

                this.grdDocVenta.ClientSettings.Scrolling.FrozenColumnsCount = 2;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static AutoCompleteBoxData Agenda_UsuarioBuscar(object context)
        {
            string idempresa;
            string idCargo;

            AutoCompleteBoxData res = new AutoCompleteBoxData();
            string searchString     = ((Dictionary <string, object>)context)["Text"].ToString();

            if (!string.IsNullOrEmpty(searchString) && searchString.Length >= 4)
            {
                ReporteVentaWCFClient objReporte = new ReporteVentaWCFClient();

                idempresa = HttpContext.Current.Session["idempresa"].ToString();



                List <UsuarioReporte_ListarResult> lst = objReporte.UsuarioReporte_Listar(int.Parse(idempresa),
                                                                                          ((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).codigoUsuario, 0, searchString).ToList();
                List <AutoCompleteBoxItemData> result = new List <AutoCompleteBoxItemData>();

                foreach (UsuarioReporte_ListarResult usuario in lst)
                {
                    if (result.FindAll(x => x.Text == usuario.NroDocumento + "-" + usuario.NombreUsuario).Count == 0)
                    {
                        AutoCompleteBoxItemData childNode = new AutoCompleteBoxItemData();
                        childNode.Text  = usuario.NroDocumento + "-" + usuario.NombreUsuario;
                        childNode.Value = usuario.idUsuario.ToString();

                        result.Add(childNode);
                    }
                }
                res.Items = result.ToArray();
            }
            return(res);
        }
예제 #10
0
        private void Producto_Cargar()
        {
            ReporteVentaWCFClient objReporteVentaWCF = new ReporteVentaWCFClient();
            string ID_Agenda = null;

            try
            {
                if (!string.IsNullOrEmpty(acbCliente.Text))
                {
                    ID_Agenda = acbCliente.Text.Split('-')[0];
                }

                List <gsDocVenta_ConsultarVentaProductoResult> lst = objReporteVentaWCF.DocVenta_ConsultarVentaProducto(((Usuario_LoginResult)Session["Usuario"]).idEmpresa,
                                                                                                                        ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, ID_Agenda, dpFechaInicio.SelectedDate.Value, dpFechaFinal.SelectedDate.Value).ToList();

                grdProducto.DataSource = lst;
                grdProducto.DataBind();

                ViewState["fechaInicio"]  = dpFechaInicio.SelectedDate.Value.ToString("dd/MM/yyyy");
                ViewState["lstProductos"] = JsonHelper.JsonSerializer(lst);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #11
0
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            if (Session["Usuario"] == null)
            {
                ScriptManager.RegisterStartupScript(Page, this.GetType(), "mykey", "CancelEdit();", true);
            }


            ReporteVentaWCFClient objReporteVenta = new ReporteVentaWCFClient();

            int idEmpresa = 0;
            int idPermiso = int.Parse(ViewState["ID"].ToString());
            int Mensaje   = idPermiso;

            try
            {
                idEmpresa = int.Parse(cboEmpresa.SelectedValue);


                objReporteVenta.Zona_Registrar(idEmpresa, ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, idPermiso,
                                               int.Parse(cboZonas.SelectedValue), int.Parse(cboEstado.SelectedValue));

                ScriptManager.RegisterStartupScript(Page, this.GetType(), "mykey", "CloseAndRebindZona(" + Mensaje + ");", true);
            }
            catch (Exception ex)
            {
                lblMensaje.Text     = "ERROR: " + ex.Message;
                lblMensaje.CssClass = "mensajeError";
            }
        }
        private void Producto_Cargar()
        {
            ReporteVentaWCFClient objReporteVentaWCF = new ReporteVentaWCFClient();
            string ID_Agenda = null;

            try {
                DateTime firstDayOfMonth = new DateTime(dpPeriodoInicio.SelectedDate.Value.Year, dpPeriodoInicio.SelectedDate.Value.Month, 1);
                DateTime lastDayOfMonth  = new DateTime(dpPeriodoFinal.SelectedDate.Value.Year, dpPeriodoFinal.SelectedDate.Value.Month, 1).AddMonths(1).AddDays(-1);

                if (!string.IsNullOrEmpty(acbCliente.Text))
                {
                    ID_Agenda = acbCliente.Text.Split('-')[0];
                }

                List <gsDocVenta_ConsultarVentaMarcaResult> lst = objReporteVentaWCF.DocVenta_ConsultarVentaMarca(((Usuario_LoginResult)Session["Usuario"]).idEmpresa,
                                                                                                                  ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, ID_Agenda, firstDayOfMonth, lastDayOfMonth).ToList();

                grdProducto.DataSource = lst;
                grdProducto.DataBind();

                ViewState["fechaInicio"]  = firstDayOfMonth.ToString("dd/MM/yyyy");
                ViewState["lstProductos"] = JsonHelper.JsonSerializer(lst);
            }
            catch (Exception ex) {
                throw ex;
            }
        }
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            if (Session["Usuario"] == null)
            {
                ScriptManager.RegisterStartupScript(Page, this.GetType(), "mykey", "CancelEdit();", true);
            }

            ReporteVentaWCFClient objReporteVenta = new ReporteVentaWCFClient();

            int    idUsuario     = 0;
            int    idEmpresa     = 0;
            int    idPermiso     = 0;
            int    idReporte     = 0;
            int    ActivoPermiso = 0;
            string imagen        = "Defoult.jpg";

            try
            {
                idUsuario = int.Parse(hfIdUsuario.Value.ToString());
                //idReporte = int.Parse(cboReporte.SelectedValue.ToString());
                ActivoPermiso = int.Parse(cboEstado.SelectedValue.ToString());

                idPermiso = objReporteVenta.PermisosReportes_Registrar(idEmpresa, ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, idUsuario, idReporte, ActivoPermiso);

                int ActivoZona = 0;
                int idZona     = 0;

                if (idPermiso > 0)
                {
                    foreach (RadListBoxItem item in ltbZonas.Items)
                    {
                        idZona = int.Parse(item.Value.ToString());
                        if (item.Checked == true)
                        {
                            ActivoZona = 1;
                        }
                        else
                        {
                            ActivoZona = 0;
                        }

                        objReporteVenta.Zona_Registrar(idEmpresa, ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, idPermiso, idZona, ActivoZona);
                    }
                }

                ScriptManager.RegisterStartupScript(Page, this.GetType(), "mykey", "CloseAndRebindZona(" + idPermiso + ");", true);
            }
            catch (Exception ex)
            {
                lblMensaje.Text     = "ERROR: " + ex.Message;
                lblMensaje.CssClass = "mensajeError";
            }
        }
예제 #14
0
        protected void grdVendedor_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (Session["Usuario"] == null)
            {
                Response.Redirect("~/Security/frmCerrar.aspx");
            }

            ReporteVentaWCFClient objReporteVentaWCF = new ReporteVentaWCFClient();
            int count = 0;

            rhcProdVendedor.PlotArea.Series[0].Items.Clear();
            rhcProdVendedor.PlotArea.Series[1].Items.Clear();
            rhcProdVendedor.PlotArea.XAxis.Items.Clear();
            try
            {
                DateTime primerDia = new DateTime(((DateTime)ViewState["periodo"]).Year, ((DateTime)ViewState["periodo"]).Month, 1);

                List <gsDocVenta_ReporteVenta_MarcaProducto_InatecResult> lstProducto = objReporteVentaWCF.DocVenta_ReporteVenta_MarcaProductoInatec(((Usuario_LoginResult)Session["Usuario"]).idEmpresa,
                                                                                                                                                     ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, int.Parse(grdVendedor.SelectedItems[0].Cells[10].Text.ToString()), int.Parse(grdVendedor.SelectedItems[0].Cells[11].Text.ToString()),
                                                                                                                                                     null, primerDia, primerDia.AddMonths(1).AddDays(-1)).ToList();

                foreach (gsDocVenta_ReporteVenta_MarcaProducto_InatecResult producto in lstProducto)
                {
                    if (producto.Descripcion.Length > 30)
                    {
                        rhcProdVendedor.PlotArea.XAxis.Items.Add(producto.Descripcion.Substring(0, 30).Replace("'", string.Empty));
                    }
                    else
                    {
                        rhcProdVendedor.PlotArea.XAxis.Items.Add(producto.Descripcion.Replace("'", string.Empty));
                    }

                    SeriesItem item = new SeriesItem();

                    item        = new SeriesItem();
                    item.Name   = producto.Descripcion.Replace("'", string.Empty);
                    item.YValue = Math.Round((decimal)producto.ValorVenta / 1000, 2);
                    this.rhcProdVendedor.PlotArea.Series[0].Items.Add(item);

                    item        = new SeriesItem();
                    item.Name   = producto.Descripcion.Replace("'", string.Empty);
                    item.YValue = Math.Round((decimal)producto.ValorPlanificado / 1000, 2);
                    this.rhcProdVendedor.PlotArea.Series[1].Items.Add(item);
                    count++;
                }
            }
            catch (Exception ex)
            {
                lblMensaje.Text     = ex.Message;
                lblMensaje.CssClass = "mensajeError";
            }
        }
예제 #15
0
        private void Zona_Cargar(string NroDocumento)
        {
            ReporteVentaWCFClient objPersonalWCF = new ReporteVentaWCFClient();

            try
            {
                List <Zonas_ReportesResult> lstPersonal = objPersonalWCF.Zonas_Listar(int.Parse(cboEmpresa.SelectedValue), ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, 0).ToList();
                cboZonas.DataSource = lstPersonal;
                cboZonas.DataBind();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        private void Reporte_Cargar(string IdEmpresa, int idUsuario)
        {
            ReporteVentaWCFClient objReporteVenta = new ReporteVentaWCFClient();

            try
            {
                //cboReporte.DataSource = objReporteVenta.ReportesIntranet_Lista(idUsuario);
                //cboReporte.DataBind();
                //cboReporte.Items.Insert(0, new RadComboBoxItem("SELECCIONAR", "0"));
                //cboReporte.SelectedIndex = 0;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        private void ZonasReporte_Cargar(int idEmpresa)
        {
            ReporteVentaWCFClient objReporte = new ReporteVentaWCFClient();

            try
            {
                List <Zonas_ReportesResult> lst = objReporte.Zonas_Listar(idEmpresa, ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, 0).ToList();

                ltbZonas.DataSource = lst;
                ltbZonas.DataBind();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #18
0
        private void ReporteMarca_Cargar()
        {
            ReporteVentaWCFClient objReporteVentaWCF = new ReporteVentaWCFClient();

            try {
                DateTime primerDia = new DateTime(rmpPeriodo.SelectedDate.Value.Year, rmpPeriodo.SelectedDate.Value.Month, 1);

                grdProducto.DataSource = objReporteVentaWCF.DocVenta_ReporteVenta_Marca(((Usuario_LoginResult)Session["Usuario"]).idEmpresa,
                                                                                        ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, null, primerDia, primerDia.AddMonths(1).AddDays(-1));
                grdProducto.DataBind();

                ViewState["periodo"] = rmpPeriodo.SelectedDate.Value;
            }
            catch (Exception ex) {
                throw ex;
            }
        }
        private void Reporte_Cargar(int idUsuario)
        {
            ReporteVentaWCFClient objVentas = new ReporteVentaWCFClient();

            try
            {
                cboReporte.DataSource = objVentas.ReportesIntranet_Lista(idUsuario);
                cboReporte.DataBind();
                cboReporte.Items.Insert(0, new RadComboBoxItem("SELECCIONAR", "0"));
                cboReporte.SelectedIndex = 0;
            }
            catch (Exception ex)
            {
                lblMensaje.Text     = ex.Message;
                lblMensaje.CssClass = "mensajeError";
            }
        }
        public List <gsReporteVentaPresupuesto_ProductoResult> ListarPresupuesto(int id_zona)
        {
            string stringPeriodo;
            int    yearAnterior;
            int    mesInicial, mesFinal, mesDefoult;
            int    yearActual, yearDefoult;
            ReporteVentaWCFClient objProyectadoWCF = new ReporteVentaWCFClient();
            List <gsReporteVentaPresupuesto_ProductoResult> lstPronostico    = new List <gsReporteVentaPresupuesto_ProductoResult>();
            gsReporteVentaPresupuesto_ProductoResult        lstPronosticoMes = new gsReporteVentaPresupuesto_ProductoResult();

            try
            {
                yearActual = rmyReporte0.SelectedDate.Value.Year;
                mesInicial = rmyReporte0.SelectedDate.Value.Month;

                yearAnterior = yearActual - 1;

                mesDefoult  = mesInicial;
                yearDefoult = yearActual;

                for (int i = 0; i < 12; i++)
                {
                    if (mesDefoult > 12)
                    {
                        mesDefoult    = 1;
                        yearDefoult   = yearDefoult + 1;
                        stringPeriodo = yearDefoult + "_" + mesDefoult;
                    }
                    else
                    {
                        stringPeriodo = yearDefoult + "_" + mesDefoult;
                    }

                    lstPronosticoMes = objProyectadoWCF.gsReporte_PronosticoVentas(((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).idEmpresa, ((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).codigoUsuario, yearDefoult, mesDefoult, id_zona).ToList()[0];
                    lstPronostico.Add(lstPronosticoMes);

                    mesDefoult = mesDefoult + 1;
                }
            }
            catch (Exception ex)
            {
                lblMensaje.Text     = ex.Message;
                lblMensaje.CssClass = "MensajeError";
            }
            return(lstPronostico);
        }
        private void Personal_Listar(int idEmpresa, int idUsario, string codigoEmpresa, string codigoCargo, string descripcion, int reporte)
        {
            ReporteVentaWCFClient objReporteVenta = new ReporteVentaWCFClient();

            try
            {
                List <PermisosUsuarios_ListarResult> lstPersonal = objReporteVenta.PermisosUsuarios_ListarResult(idEmpresa, idUsario, descripcion, reporte).ToList();
                grdPersonal.DataSource = lstPersonal;
                grdPersonal.DataBind();
                lblPersonalDS.Text = "1";

                ViewState["lstPersonal"] = JsonHelper.JsonSerializer(lstPersonal);
            }
            catch (Exception ex)
            {
                lblMensaje.Text     = ex.Message;
                lblMensaje.CssClass = "mensajeError";
            }
        }
        private void ZonaPersonal_Detalle(int idPermiso)
        {
            ReporteVentaWCFClient objVentas = new ReporteVentaWCFClient();

            List <ZonasPermisos_ListarResult> lstdetalle;

            try
            {
                lstdetalle          = objVentas.ZonaPersonal_Listar(int.Parse(cboEmpresa.SelectedValue), ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, idPermiso).ToList();
                grdZonas.DataSource = lstdetalle;
                grdZonas.DataBind();
                lblZonaDS.Text = "1";
                ViewState["lstDetalleZona"] = JsonHelper.JsonSerializer(lstdetalle);
            }
            catch (Exception ex)
            {
                lblMensaje.Text     = "ERROR: " + ex.Message;
                lblMensaje.CssClass = "mensajeError";
            }
        }
        private void Reporte_Cargar(string IdEmpresa, int idUsuario)
        {
            ReporteVentaWCFClient objReporteVenta      = new ReporteVentaWCFClient();
            List <ReportesIntranet_ListarResult> lista = new List <ReportesIntranet_ListarResult>();

            try
            {
                lista = objReporteVenta.ReportesIntranet_Lista(idUsuario).ToList().FindAll(x => x.NombreReporte.Contains("Cobranza"));

                cboReporte.DataSource = lista;
                cboReporte.DataBind();
                cboReporte.Items.Insert(0, new RadComboBoxItem("SELECCIONAR", "0"));
                cboReporte.SelectedIndex = 1;

                cboReporte.Enabled = false;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        private void Reporte_Cargar(int idUsuario)
        {
            ReporteVentaWCFClient objVentas            = new ReporteVentaWCFClient();
            List <ReportesIntranet_ListarResult> lista = new List <ReportesIntranet_ListarResult>();

            try
            {
                lista = objVentas.ReportesIntranet_Lista(idUsuario).ToList().FindAll(x => x.NombreReporte.Contains("Cobranza"));

                cboReporte.DataSource = lista;
                cboReporte.DataBind();
                cboReporte.Items.Insert(0, new RadComboBoxItem("SELECCIONAR", "0"));
                cboReporte.SelectedIndex = 1;

                cboReporte.Enabled = false;
            }
            catch (Exception ex)
            {
                lblMensaje.Text     = ex.Message;
                lblMensaje.CssClass = "mensajeError";
            }
        }
        private void ZonasReporte_CargarxUsuario(int idEmpresa, int idUsuario, int idReporte)
        {
            ReporteVentaWCFClient objReporte = new ReporteVentaWCFClient();

            try
            {
                ltbZonas.ClearChecked();

                List <ZonasReporte_ListarResult> lst = objReporte.ZonasReporte_Listar(idEmpresa, ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, idUsuario, idReporte).ToList();

                foreach (RadListBoxItem item in ltbZonas.Items)
                {
                    if (lst.FindAll(x => x.ID_Zona.ToString() == item.Value).Count > 0)
                    {
                        item.Checked = true;
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #26
0
        private void Vendedor_Listar()
        {
            ReporteVentaWCFClient objReporteVentaWCF            = new ReporteVentaWCFClient();
            List <gsDocVenta_ReporteVenta_VendedorResult> Lista = new List <gsDocVenta_ReporteVenta_VendedorResult>();

            try {
                DateTime fechaInicio = new DateTime(dpFecInicio.SelectedDate.Value.Year, dpFecInicio.SelectedDate.Value.Month, 1);
                DateTime fechaFinal  = dpFecFinal.SelectedDate.Value.AddMonths(1);
                fechaFinal = (new DateTime(fechaFinal.Year, fechaFinal.Month, 1)).AddDays(-1);
                Lista      = objReporteVentaWCF.DocVenta_ReporteVenta_Vendedor(((Usuario_LoginResult)Session["Usuario"]).idEmpresa, ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, null, fechaInicio, fechaFinal).ToList();

                ViewState["ListaMenus"] = JsonHelper.JsonSerializer(Lista);


                grdVendedor.DataSource = Lista;
                grdVendedor.DataBind();

                lblReporte.Value = "1";
            }
            catch (Exception ex) {
                throw ex;
            }
        }
예제 #27
0
        private void Vendedor_Listar()
        {
            ReporteVentaWCFClient objReporteVentaWCF = new ReporteVentaWCFClient();

            try
            {
                DateTime fechaInicio = new DateTime(dpFecInicio.SelectedDate.Value.Year, dpFecInicio.SelectedDate.Value.Month, 1);
                DateTime fechaFinal  = dpFecFinal.SelectedDate.Value.AddMonths(1);
                fechaFinal = (new DateTime(fechaFinal.Year, fechaFinal.Month, 1)).AddDays(-1);
                string idVendedor    = null;
                string EstadoCliente = null;

                EstadoCliente = cboEstadoCredito.SelectedItem.Text;

                if (EstadoCliente == "TODOS")
                {
                    EstadoCliente = null;
                }

                if (!string.IsNullOrEmpty(acbVendedor.Text))
                {
                    idVendedor = acbVendedor.Text.Split('-')[0].Trim();
                }

                List <gsDocVenta_ReporteVenta_ClienteResult> lstVendedor = objReporteVentaWCF.DocVenta_ReporteVenta_Cliente(((Usuario_LoginResult)Session["Usuario"]).idEmpresa,
                                                                                                                            ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, idVendedor, fechaInicio, fechaFinal, EstadoCliente).ToList();

                grdCliente.DataSource = lstVendedor;
                grdCliente.DataBind();

                ViewState["lstVendedor"] = JsonHelper.JsonSerializer(lstVendedor);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #28
0
        private void Zona_Cargar()
        {
            try
            {
                ReporteVentaWCFClient objReporteVentaWCF = new ReporteVentaWCFClient();

                List <Listar_Zona_BIResult> lista = new List <Listar_Zona_BIResult>();

                DateTime fechaInicio = new DateTime(dpFecInicio.SelectedDate.Value.Year, dpFecInicio.SelectedDate.Value.Month, 1);
                DateTime fechaFinal  = dpFecFinal.SelectedDate.Value.AddMonths(1);
                fechaFinal = (new DateTime(fechaFinal.Year, fechaFinal.Month, 1)).AddDays(-1);

                lista = objReporteVentaWCF.Listar_Zona_BI(
                    ((Usuario_LoginResult)Session["Usuario"]).idEmpresa, ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, fechaInicio, fechaFinal, "Lima").ToList();



                var lstSect = from x in lista
                              select new
                {
                    DisplayField = x.Nombre_Zona
                                   //DisplayField = String.Format("{0} {1} {2} {3}", x.Placa, x.Modelo, x.Marca, x.Agenda)
                };

                cboZona.DataSource     = lstSect;
                cboZona.DataTextField  = "DisplayField";
                cboZona.DataValueField = "DisplayField";
                cboZona.DataBind();

                cboZona.SelectedIndex = 0;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #29
0
        private void Vendedor_Listar()
        {
            ReporteVentaWCFClient objReporteVentaWCF = new ReporteVentaWCFClient();

            try
            {
                DateTime fechaInicio = new DateTime(dpFecInicio.SelectedDate.Value.Year, dpFecInicio.SelectedDate.Value.Month, 1);
                DateTime fechaFinal  = dpFecFinal.SelectedDate.Value.AddMonths(1);
                fechaFinal = (new DateTime(fechaFinal.Year, fechaFinal.Month, 1)).AddDays(-1);
                string idVendedor = null;
                if (!string.IsNullOrEmpty(acbVendedor.Text))
                {
                    idVendedor = acbVendedor.Text.Split('-')[0].Trim();
                }

                grdProducto.DataSource = objReporteVentaWCF.DocVenta_ReporteVenta_Marca(((Usuario_LoginResult)Session["Usuario"]).idEmpresa,
                                                                                        ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, idVendedor, fechaInicio, fechaFinal);
                grdProducto.DataBind();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #30
0
        private void ReporteVenta_Cliente(string ID_Vendedor, DateTime fechaInico, DateTime fechaFinal)
        {
            ReporteVentaWCFClient objReporteVentaWCF = new ReporteVentaWCFClient();

            rhcParticipacion.PlotArea.Series[0].Items.Clear();
            try
            {
                #region Venta de productos
                List <gsDocVenta_ReporteVenta_ProductoResult> lstProductos = objReporteVentaWCF.DocVenta_ReporteVenta_Producto(((Usuario_LoginResult)Session["Usuario"]).idEmpresa,
                                                                                                                               ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, ID_Vendedor, fechaInico, fechaFinal).ToList();

                grdProducto.DataSource = lstProductos;
                grdProducto.DataBind();

                ViewState["lstProductos"] = JsonHelper.JsonSerializer(lstProductos);
                #endregion

                #region Venta al 80% y 20%
                List <gsDocVenta_ReporteVenta_ClienteResult> lst = objReporteVentaWCF.DocVenta_ReporteVenta_Cliente(((Usuario_LoginResult)Session["Usuario"]).idEmpresa,
                                                                                                                    ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, ID_Vendedor, fechaInico, fechaFinal, null).ToList().OrderByDescending(x => x.ValorVenta).ToList();

                decimal sum = (decimal)lst.Sum(i => i.ValorVenta);
                //decimal sumPlanif = (decimal)lst.Sum(i => i.ValorPlanificado);
                decimal acumulado = 0;
                bool    paso80    = false;

                foreach (var cliente in lst)
                {
                    SeriesItem item = new SeriesItem();
                    if (sum > 0)
                    {
                        if (((int)((cliente.ValorVenta / sum) * 100)) > 0)
                        {
                            item.YValue = ((int)((cliente.ValorVenta / sum) * 100));
                            item.Name   = string.Format("{0}<br/>Valor Venta:${1}K<br/>Presupuesto:${2}K<br/>Avance:{3}%<br/>Participación:{4}%",
                                                        cliente.ID_Cliente + " - " + cliente.Cliente.Replace("'", string.Empty),
                                                        Math.Round((decimal)cliente.ValorVenta / 1000, 2),
                                                        Math.Round((decimal)cliente.ValorPlanificado / 1000, 2),
                                                        cliente.Avance,
                                                        item.YValue);
                            rhcParticipacion.PlotArea.Series[0].Items.Add(item);
                        }
                    }

                    if (cliente.ValorVenta > 0)
                    {
                        acumulado = acumulado + (decimal)cliente.ValorVenta;
                        if (!paso80)
                        {
                            if (cliente.Cliente.Length > 30)
                            {
                                rhcCliente80.PlotArea.XAxis.Items.Add(cliente.Cliente.Substring(0, 30).Replace("'", string.Empty));
                            }
                            else
                            {
                                rhcCliente80.PlotArea.XAxis.Items.Add(cliente.Cliente.Replace("'", string.Empty));
                            }

                            item        = new SeriesItem();
                            item.Name   = cliente.Cliente.Replace("'", string.Empty);
                            item.YValue = Math.Round((decimal)cliente.ValorVenta / 1000, 2);
                            this.rhcCliente80.PlotArea.Series[0].Items.Add(item);

                            item        = new SeriesItem();
                            item.Name   = cliente.Cliente.Replace("'", string.Empty);
                            item.YValue = Math.Round((decimal)cliente.ValorPlanificado / 1000, 2);
                            this.rhcCliente80.PlotArea.Series[1].Items.Add(item);
                        }
                        else
                        {
                            if (cliente.Cliente.Length > 30)
                            {
                                rhcCliente20.PlotArea.XAxis.Items.Add(cliente.Cliente.Substring(0, 30).Replace("'", string.Empty));
                            }
                            else
                            {
                                rhcCliente20.PlotArea.XAxis.Items.Add(cliente.Cliente.Replace("'", string.Empty));
                            }

                            item        = new SeriesItem();
                            item.Name   = cliente.Cliente.Replace("'", string.Empty);
                            item.YValue = Math.Round((decimal)cliente.ValorVenta / 1000, 2);
                            this.rhcCliente20.PlotArea.Series[0].Items.Add(item);

                            item        = new SeriesItem();
                            item.Name   = cliente.Cliente.Replace("'", string.Empty);
                            item.YValue = Math.Round((decimal)cliente.ValorPlanificado / 1000, 2);
                            this.rhcCliente20.PlotArea.Series[1].Items.Add(item);
                        }

                        if (acumulado / sum * 100 >= 80)
                        {
                            paso80 = true;
                        }
                    }
                }
                #endregion

                #region Datos principales
                //Datos principales de la venta
                gsDocVenta_ReporteVenta_VendedorResult rv = objReporteVentaWCF.DocVenta_ReporteVenta_Vendedor(((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).idEmpresa,
                                                                                                              ((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).codigoUsuario, ID_Vendedor, fechaInico, fechaFinal).ToList().Single();
                rrgAvance.Pointer.Value = rv.Avance;
                lblPronostico.Text      = string.Format("${0}", Math.Round((decimal)rv.ValorPlanificado, 0).ToString("#,#", CultureInfo.InvariantCulture));
                lblValorVenta.Text      = string.Format("${0}", Math.Round((decimal)rv.ValorVenta, 0).ToString("#,#", CultureInfo.InvariantCulture));
                lblDiferencia.Text      = string.Format("${0}", Math.Round((decimal)rv.Diferencia, 0).ToString("#,#", CultureInfo.InvariantCulture));
                lblAvance.Text          = "Avance: " + Math.Round((decimal)rv.Avance, 0).ToString() + "%";
                lblCantTotal.Text       = lst.Count.ToString();
                lblCantVenta.Text       = lst.FindAll(x => x.ValorVenta > 0).Count.ToString();
                lblCantNoVenta.Text     = lst.FindAll(x => x.ValorVenta <= 0).Count.ToString();
                #endregion

                #region Cliente sin venta
                grdCliente.DataSource = lst.FindAll(x => x.ValorVenta <= 0).OrderByDescending(x => x.ValorPlanificado);
                grdCliente.DataBind();
                #endregion

                #region Venta diaria
                List <gsDocVenta_ReporteVenta_FechaResult> lstFecha = objReporteVentaWCF.DocVenta_ReporteVenta_Fecha(((Usuario_LoginResult)Session["Usuario"]).idEmpresa,
                                                                                                                     ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, ID_Vendedor, fechaInico, fechaFinal).ToList();

                acumulado = 0;
                for (DateTime day = fechaInico; DateTime.Compare(day, fechaFinal) <= 0; day = day.AddDays(1))
                {
                    AxisItem xitem = new AxisItem();
                    xitem.LabelText = day.ToString("dd/MM/yyyy");
                    rhcDiario.PlotArea.XAxis.Items.Add(xitem);

                    gsDocVenta_ReporteVenta_FechaResult objVFecha = lstFecha.Find(x => x.Fecha == day);
                    SeriesItem serie1 = new SeriesItem();
                    if (objVFecha != null)
                    {
                        acumulado     = acumulado + (decimal)objVFecha.ValorVenta;
                        serie1.YValue = Math.Round((decimal)objVFecha.ValorVenta / 1000, 2);
                    }
                    else
                    {
                        serie1.YValue = 0;
                    }

                    rhcDiario.PlotArea.Series[0].Items.Add(serie1);
                    SeriesItem serie2 = new SeriesItem();
                    serie2.YValue = Math.Round(acumulado / (decimal)rv.ValorPlanificado * 100, 0);
                    rhcDiario.PlotArea.Series[1].Items.Add(serie2);
                }
                //rhcDiario.PlotArea.Series[1].AxisName = "AdditionalAxis";
                #endregion

                lblTitulo.Text = "Reporte " + fechaInico.Year.ToString() + "-" + fechaInico.Month.ToString() + " de " + rv.Vendedor;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }