From 45f0c6c22a114783df5fa57a782a9f9871db93d2 Mon Sep 17 00:00:00 2001 From: MLopez Date: Sat, 26 Nov 2022 10:36:24 -0700 Subject: [PATCH 1/3] Fix Graficas Rep Ventas --- Ventas/RepVentasResumen.aspx.vb | 13 +- vwd.webinfo | 590 -------------------------------- 2 files changed, 4 insertions(+), 599 deletions(-) delete mode 100644 vwd.webinfo diff --git a/Ventas/RepVentasResumen.aspx.vb b/Ventas/RepVentasResumen.aspx.vb index 87e2f0f68..13b684f15 100644 --- a/Ventas/RepVentasResumen.aspx.vb +++ b/Ventas/RepVentasResumen.aspx.vb @@ -73,8 +73,6 @@ Partial Class Ventas_RepVentasResumen CargaCombos() CargaDatos() - GraficaPastel() - GraficaBarras() End If End Sub @@ -142,19 +140,16 @@ Partial Class Ventas_RepVentasResumen Datos = Nothing End If + ObjVentas.Dispose() + ObjMovtos.Dispose() GvVxP.DataBind() GvVxC.DataBind() GvPxC.DataBind() GvCxC.DataBind() - ObjVentas.Dispose() - ObjMovtos.Dispose() - - GvVxP.Dispose() - GvVxC.Dispose() - GvPxC.Dispose() - GvCxC.Dispose() + GraficaPastel() + GraficaBarras() End Sub Protected Sub GvVxP_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvVxP.RowDataBound diff --git a/vwd.webinfo b/vwd.webinfo deleted file mode 100644 index d54ddc206..000000000 --- a/vwd.webinfo +++ /dev/null @@ -1,590 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file From 05ee0da0a3a4100412343c9a12806d078270742f Mon Sep 17 00:00:00 2001 From: MLopez Date: Sat, 26 Nov 2022 10:44:54 -0700 Subject: [PATCH 2/3] =?UTF-8?q?E172=20Nuevo=20M=C3=B3dulo:=20Rep=20Indicad?= =?UTF-8?q?or=20Resumen=20Incluye:=20=20=20-=20Reporte=20de=20Ventas=20x?= =?UTF-8?q?=20producto=20=20=20-=20Reporte=20de=20Compras=20x=20producto?= =?UTF-8?q?=20=20=20-=20Cuentas=20por=20cobrar=20agrupado=20por=20cliente?= =?UTF-8?q?=20=20=20-=20Cuentas=20por=20pagar=20agrupado=20por=20proveedor?= =?UTF-8?q?=20Modificaciones=20a=20BD=20(SIG=5FResp=5FMLR)=20-=20Se=20regi?= =?UTF-8?q?str=C3=B3=20CveModulo=20110=20-=20PA=5FComp=5FRepCxP=20se=20le?= =?UTF-8?q?=20agreg=C3=B3=20un=20par=C3=A1metro=20que=20faltaba:=20@CvePro?= =?UTF-8?q?yecto?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App_Code/ClsPaginas.vb | 1 + General/RepIndicadorResumen.aspx | 423 +++++++++++++++++++++++++++ General/RepIndicadorResumen.aspx.vb | 432 ++++++++++++++++++++++++++++ 3 files changed, 856 insertions(+) create mode 100644 General/RepIndicadorResumen.aspx create mode 100644 General/RepIndicadorResumen.aspx.vb diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 794311cff..42189afb9 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -4989,6 +4989,7 @@ Public Class ClsPaginas PaginaDict.Add("/General/CatMedidas.aspx".ToUpper(), 712) PaginaDict.Add("/General/CatSatListado69B.aspx".ToUpper, 1038) PaginaDict.Add("/General/CatMedidaEquivalencia.aspx".ToUpper(), 773) + PaginaDict.Add("/General/RepIndicadorResumen.aspx".ToUpper(), 110) #End Region diff --git a/General/RepIndicadorResumen.aspx b/General/RepIndicadorResumen.aspx new file mode 100644 index 000000000..4ed1ed6ac --- /dev/null +++ b/General/RepIndicadorResumen.aspx @@ -0,0 +1,423 @@ +<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="RepIndicadorResumen.aspx.vb" Inherits="General_RepIndicadorResumen" %> + + + <%--
  • + Exportar +
  • +
  • + Imprimir +
  • --%> +
    + + + + + + + Reporte de Resumen de Indicadores + + + + <%--Tabla con los campos para filtrar--%> + + +
    +
    +
    + + "> + +
    +
    +
    + +
    Fecha Inicio
    +
    +
    + + + + +
    + + +
    + +
    Fecha Fin
    +
    +
    + + + + +
    + + +
    + +
    SubProyecto
    +
    + + +
    + +
    + +
    +
    +
    > +
    +
    + + + + + + +
    +
    + + +
    +
    + + Ventas por Productos +
    +
    +
    +
    +
    +
    + +
    +
    +
    + + + + + + + +
    +
    +
    +
    + +
    + + +
    +
    + + Ventas por Productos - Gráfica +
    +
    +
    +
    +
    +
    + +
    +
    +
    +
    +
    +
    +
    +
    +
    + +
    +
    + + +
    +
    + + Compras por Productos +
    +
    +
    +
    +
    +
    + +
    +
    +
    + + + + + + + +
    +
    +
    +
    + +
    + + +
    +
    + + Compras por Productos - Gráfica +
    +
    +
    +
    +
    +
    + +
    +
    +
    +
    +
    +
    +
    +
    +
    + +
    +
    + + +
    +
    + + Cuentas por cobrar por Cliente +
    +
    +
    +
    +
    +
    + +
    +
    +
    + + + + + + +
    +
    +
    +
    + +
    + + +
    +
    + + Cuentas por cobrar por Cliente - Gráfica +
    +
    +
    +
    +
    +
    + +
    +
    +
    +
    +
    +
    +
    +
    +
    + +
    +
    + + +
    +
    + + Cuentas por pagar por Proveedor +
    +
    +
    +
    +
    +
    + +
    +
    +
    + + + + + + +
    +
    +
    +
    + +
    + + +
    +
    + + Cuentas por pagar por Proveedor - Gráfica +
    +
    +
    +
    +
    +
    + +
    +
    +
    +
    +
    +
    +
    +
    +
    + +
    + + + + +
    + +
    +
    + +
    + + + + + + + + + + + diff --git a/General/RepIndicadorResumen.aspx.vb b/General/RepIndicadorResumen.aspx.vb new file mode 100644 index 000000000..548df5c57 --- /dev/null +++ b/General/RepIndicadorResumen.aspx.vb @@ -0,0 +1,432 @@ +Imports System.Data +Imports Extensiones +Imports Microsoft.Reporting.WebForms + +Partial Class General_RepIndicadorResumen + Inherits ClsPaginas +#Region "propiedades" + + Private Property VxP As DataTable + Get + + If ViewState("VxP") Is Nothing Then + Return New DataTable + Else + Return DirectCast(ViewState("VxP"), DataTable) + End If + + End Get + Set(value As DataTable) + ViewState("VxP") = value + End Set + End Property + Private Property CxP As DataTable + Get + + If ViewState("CxP") Is Nothing Then + Return New DataTable + Else + Return DirectCast(ViewState("CxP"), DataTable) + End If + + End Get + Set(value As DataTable) + ViewState("CxP") = value + End Set + End Property + + Private Property CCxC As DataTable + Get + + If ViewState("CCxC") Is Nothing Then + Return New DataTable + Else + Return DirectCast(ViewState("CCxC"), DataTable) + End If + + End Get + Set(value As DataTable) + ViewState("CCxC") = value + End Set + End Property + Private Property CPxP As DataTable + Get + + If ViewState("CPxP") Is Nothing Then + Return New DataTable + Else + Return DirectCast(ViewState("CPxP"), DataTable) + End If + + End Get + Set(value As DataTable) + ViewState("CPxP") = value + End Set + End Property + + Private Property DtColor As DataTable + Get + + If ViewState("DtColor") Is Nothing Then + Return New DataTable + Else + Return DirectCast(ViewState("DtColor"), DataTable) + End If + + End Get + Set(value As DataTable) + ViewState("DtColor") = value + End Set + End Property + +#End Region + + Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load + If Not IsPostBack Then + CargaCombos() + CargaDatos() + End If + End Sub + + + Private Sub CargaCombos() + + 'Carga SubProyectos + DdlSubProyecto.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1) + DdlSubProyecto.DataBind() + DdlSubProyecto.Items.Insert(0, New ListItem("Todos", "-1")) + + TxtFechaI.Text = $"01/{Now.Month}/{Now.Year}" + TxtFechaF.Text = Now.ToString("dd/MM/yyyy") + + CreaDataTableColor() + End Sub + + + Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles btnConsultar.Click + CargaDatos() + End Sub + + + Private Sub CargaDatos() + + Dim ObjVentas As New ClsVentas + Dim ObjCompras As New ClsCompras + Dim ObjMovtos As New ClsMovimientos() + + If ObjVentas.GetRepProductosServicios(-1, DdlSubProyecto.SelectedValue.ToEntero, -1, -1, -1, TxtFechaI.Text.Trim(), TxtFechaF.Text.Trim(), MinFecha, MaxFecha, -1, + -1, -1, -1, -1, "-1", UsuarioActual.CveEmpresa, 5, CveUsuarioConsulta:=UsuarioActual.CveUsuario, TipoCambio:=1) Then + VxP = ObjVentas.DtResultados + GvVxP.DataSource = VxP + Else + GvVxP.DataSource = Nothing + VxP = Nothing + End If + + If ObjCompras.GetRepProductosServicios(-1, DdlSubProyecto.SelectedValue.ToEntero, -1, -1, -1, TxtFechaI.Text.Trim(), TxtFechaF.Text.Trim(), -1, -1, -1, + UsuarioActual.CveEmpresa, 5, -1, -1, "-1", "-1", -1, TipoCambio:=1, CveUsuarioConsulta:=UsuarioActual.CveUsuario) Then + CxP = ObjCompras.DtResultados + GvCxP.DataSource = CxP + Else + GvCxP.DataSource = Nothing + CxP = Nothing + End If + + Dim FechaCorte As String = $"31/12/{Now.Year}" + + If ObjMovtos.GetCxC(TxtFechaI.Text, TxtFechaF.Text, -1, DdlSubProyecto.SelectedValue.ToEntero, -1, -1, -1, "-1", UsuarioActual.CveEmpresa, 5, -1, 1, -1, + "-1", "-1", "-1", FechaCorte:=FechaCorte.ToDate, CveUsuarioConsulta:=UsuarioActual.CveUsuario) Then + + CCxC = ObjMovtos.DtResultados + GvCCxC.DataSource = CCxC + Else + GvCCxC.DataSource = Nothing + CCxC = Nothing + End If + + If ObjMovtos.GetCxP(TxtFechaI.Text, TxtFechaF.Text, -1, DdlSubProyecto.SelectedValue.ToEntero, -1, -1, -1, "-1", UsuarioActual.CveEmpresa, 5, -1, 1, -1, + "-1", "-1", "-1", FechaCorte:=FechaCorte.ToDate, CveUsuarioConsulta:=UsuarioActual.CveUsuario) Then + + CPxP = ObjMovtos.DtResultados + GvCPxP.DataSource = CPxP + Else + GvCPxP.DataSource = Nothing + CPxP = Nothing + End If + + ObjVentas.Dispose() + ObjCompras.Dispose() + ObjMovtos.Dispose() + + GvVxP.DataBind() + GvCxP.DataBind() + GvCCxC.DataBind() + GvCPxP.DataBind() + + ' Mostrar gráficos solo si hay datos en su respectiva tabla + If GvVxP.Rows.Count > 0 Then + UPGraficaVxP.Visible = True + Else + UPGraficaVxP.Visible = False + End If + If GvCxP.Rows.Count > 0 Then + UPGraficaCxP.Visible = True + Else + UPGraficaCxP.Visible = False + End If + If GvCCxC.Rows.Count > 0 Then + UPGraficaCCxC.Visible = True + Else + UPGraficaCCxC.Visible = False + End If + If GvCPxP.Rows.Count > 0 Then + UPGraficaCPxP.Visible = True + Else + UPGraficaCPxP.Visible = False + End If + + ' Si no había datos en ninguna tabla no cargar función de gráficos + If (GvVxP.Rows.Count = 0 AndAlso GvCxP.Rows.Count = 0 AndAlso GvCCxC.Rows.Count = 0 AndAlso GvCPxP.Rows.Count = 0) Then Exit Sub + GraficasPastel() + 'GraficasBarras() + End Sub + Protected Sub GvVxP_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvVxP.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + If e.Row.DBCampo("Orden") = "" Then + e.Row.CssClass = "Totales" + End If + End If + End Sub + Protected Sub GvCxP_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvCxP.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + If e.Row.DBCampo("Orden") = "" Then + e.Row.CssClass = "Totales" + End If + End If + End Sub + Protected Sub GvCCxC_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvCCxC.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + If e.Row.DBCampo("Orden") = "" Then + e.Row.CssClass = "Totales" + End If + End If + End Sub + Protected Sub GvCPxP_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvCPxP.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + If e.Row.DBCampo("Orden") = "" Then + e.Row.CssClass = "Totales" + End If + End If + End Sub + Private Sub CreaDataTableColor() + DtColor = New DataTable + DtColor.Columns.Add("Color") + Dim RowColor As DataRow = Nothing + RowColor = DtColor.NewRow() + RowColor("Color") = "#FF0F00" + DtColor.Rows.Add(RowColor) + RowColor = Nothing + RowColor = DtColor.NewRow() + RowColor("Color") = "#FF6600" + DtColor.Rows.Add(RowColor) + RowColor = Nothing + RowColor = DtColor.NewRow() + RowColor("Color") = "#FF9E01" + DtColor.Rows.Add(RowColor) + RowColor = Nothing + RowColor = DtColor.NewRow() + RowColor("Color") = "#FCD202" + DtColor.Rows.Add(RowColor) + RowColor = Nothing + RowColor = DtColor.NewRow() + RowColor("Color") = "#F8FF01" + DtColor.Rows.Add(RowColor) + RowColor = Nothing + RowColor = DtColor.NewRow() + RowColor("Color") = "#B0DE09" + DtColor.Rows.Add(RowColor) + RowColor = Nothing + RowColor = DtColor.NewRow() + RowColor("Color") = "#04D215" + DtColor.Rows.Add(RowColor) + RowColor = Nothing + RowColor = DtColor.NewRow() + RowColor("Color") = "#0D8ECF" + DtColor.Rows.Add(RowColor) + RowColor = Nothing + RowColor = DtColor.NewRow() + RowColor("Color") = "#0D52D1" + DtColor.Rows.Add(RowColor) + RowColor = Nothing + RowColor = DtColor.NewRow() + RowColor("Color") = "#2A0CD0" + DtColor.Rows.Add(RowColor) + RowColor = Nothing + RowColor = DtColor.NewRow() + RowColor("Color") = "#8A0CCF" + DtColor.Rows.Add(RowColor) + RowColor = Nothing + RowColor = DtColor.NewRow() + RowColor("Color") = "#CD0D74" + DtColor.Rows.Add(RowColor) + RowColor = Nothing + RowColor = DtColor.NewRow() + RowColor("Color") = "#754DEB" + DtColor.Rows.Add(RowColor) + RowColor = Nothing + RowColor = DtColor.NewRow() + RowColor("Color") = "#DDDDDD" + DtColor.Rows.Add(RowColor) + RowColor = Nothing + RowColor = DtColor.NewRow() + RowColor("Color") = "#999999" + DtColor.Rows.Add(RowColor) + RowColor = Nothing + RowColor = DtColor.NewRow() + RowColor("Color") = "#333333" + DtColor.Rows.Add(RowColor) + RowColor = Nothing + RowColor = DtColor.NewRow() + RowColor("Color") = "#000000" + DtColor.Rows.Add(RowColor) + End Sub + + Private Sub GraficasPastel() + + Dim DtVxP, DtCxP, DtCCxC, DtCPxP As New DataTable + Dim RowColorIndex As Integer = 0 + + 'Ventas x Producto + DtVxP.Reset() + DtVxP.Columns.Add("Texto") + DtVxP.Columns.Add("Valor") + DtVxP.Columns.Add("Color") + DtVxP.Columns.Add("Moneda") + RowColorIndex = 0 + For Each Dr As DataRow In VxP.Rows + If Not Dr("Orden").ToString = "" Then + Dim Row As DataRow = Nothing + Row = DtVxP.NewRow() + Row("Texto") = $"{Dr("GPO").ToString} {GlobalDTMonedas().FiltraParametros($"CveMoneda = {Dr("CveMoneda").ToString}").Rows(0)("Abreviatura").ToString}" + Row("Valor") = Dr("SubTotal").ToString.FormatoNumero + Row("Color") = DtColor.Rows(RowColorIndex)("Color").ToString + Row("Moneda") = Dr("Moneda").ToString + DtVxP.Rows.Add(Row) + RowColorIndex += 1 + If RowColorIndex = 17 Then + RowColorIndex = 0 + End If + End If + Next + Dim query_vxp = From s In DtVxP.AsEnumerable() Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Color = s("Color").ToString(), .Moneda = s("Moneda").ToString()} + + 'Compras x Producto + DtCxP.Reset() + DtCxP.Columns.Add("Texto") + DtCxP.Columns.Add("Valor") + DtCxP.Columns.Add("Color") + DtCxP.Columns.Add("Moneda") + RowColorIndex = 0 + For Each Dr As DataRow In CxP.Rows + If Not Dr("Orden").ToString = "" Then + Dim Row As DataRow = Nothing + Row = DtCxP.NewRow() + Row("Texto") = $"{Dr("GPO").ToString} {GlobalDTMonedas().FiltraParametros($"CveMoneda = {Dr("CveMoneda").ToString}").Rows(0)("Abreviatura").ToString}" + Row("Valor") = Dr("SubTotal").ToString.FormatoNumero + Row("Color") = DtColor.Rows(RowColorIndex)("Color").ToString + Row("Moneda") = Dr("Moneda").ToString + DtCxP.Rows.Add(Row) + RowColorIndex += 1 + If RowColorIndex = 17 Then + RowColorIndex = 0 + End If + End If + Next + Dim query_cxp = From s In DtCxP.AsEnumerable() Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Color = s("Color").ToString(), .Moneda = s("Moneda").ToString()} + + 'Alert(Newtonsoft.Json.JsonConvert.SerializeObject(CCxC.Rows)) + + 'Cuentas por cobrar x Cliente + DtCCxC.Reset() + DtCCxC.Columns.Add("Texto") + DtCCxC.Columns.Add("Valor") + DtCCxC.Columns.Add("Color") + DtCCxC.Columns.Add("Moneda") + RowColorIndex = 0 + For Each Dr As DataRow In CCxC.Rows + If Not Dr("Orden").ToString = "" Then + Dim Row As DataRow = Nothing + Row = DtCCxC.NewRow() + Row("Texto") = $"{Dr("GPO").ToString} {GlobalDTMonedas().FiltraParametros($"CveMoneda = {Dr("CveMoneda").ToString}").Rows(0)("Abreviatura").ToString}" + Row("Valor") = Dr("Saldo").ToString.FormatoNumero + Row("Color") = DtColor.Rows(RowColorIndex)("Color").ToString + Row("Moneda") = Dr("Moneda").ToString + DtCCxC.Rows.Add(Row) + RowColorIndex += 1 + If RowColorIndex = 17 Then + RowColorIndex = 0 + End If + End If + Next + Dim query_ccxc = From s In DtCCxC.AsEnumerable() Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Color = s("Color").ToString(), .Moneda = s("Moneda").ToString()} + + 'Cuentas por pagar x Proveedor + DtCPxP.Reset() + DtCPxP.Columns.Add("Texto") + DtCPxP.Columns.Add("Valor") + DtCPxP.Columns.Add("Color") + DtCPxP.Columns.Add("Moneda") + RowColorIndex = 0 + For Each Dr As DataRow In CPxP.Rows + If Not Dr("Orden").ToString = "" Then + Dim Row As DataRow = Nothing + Row = DtCPxP.NewRow() + Row("Texto") = $"{Dr("GPO").ToString} {GlobalDTMonedas().FiltraParametros($"CveMoneda = {Dr("CveMoneda").ToString}").Rows(0)("Abreviatura").ToString}" + Row("Valor") = Dr("Saldo").ToString.FormatoNumero + Row("Color") = DtColor.Rows(RowColorIndex)("Color").ToString + Row("Moneda") = Dr("Moneda").ToString + DtCPxP.Rows.Add(Row) + RowColorIndex += 1 + If RowColorIndex = 17 Then + RowColorIndex = 0 + End If + End If + Next + Dim query_cpxp = From s In DtCPxP.AsEnumerable() Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Color = s("Color").ToString(), .Moneda = s("Moneda").ToString()} + + 'Serializar datos agrupándolos en su respectivo DataTable, todos en un solo JSON + Dim json As String = Newtonsoft.Json.JsonConvert.SerializeObject(New With {.VxP = query_vxp, .CxP = query_cxp, .CCxC = query_ccxc, .CPxP = query_cpxp}) + 'Dim json As String = Newtonsoft.Json.JsonConvert.SerializeObject(New With {.VxP = query_vxp, .CCxC = New String() {}}) + 'Alert(json) + RegistraScript($"CargaGraficasPastel({json})", "22") + UPPMov.Update() + End Sub + Private Sub GraficasBarras() + 'Dim Dt As New DataTable() + 'Dt.Columns.Add("Texto") + 'Dt.Columns.Add("Valor") + 'Dt.Columns.Add("Color") + 'Dt.Columns.Add("Moneda") + 'Dim RowColorIndex As Integer = 0 + 'For Each Dr As DataRow In VxC.Rows + ' If Not Dr("Orden").ToString = "" Then + ' Dim Row As DataRow = Nothing + ' Row = Dt.NewRow() + ' Row("Texto") = $"{Dr("GPO").ToString} {GlobalDTMonedas().FiltraParametros($"CveMoneda = {Dr("CveMoneda").ToString}").Rows(0)("Abreviatura").ToString}" + ' Row("Valor") = Dr("SubTotal").ToString.FormatoNumero + ' Row("Color") = DtColor.Rows(RowColorIndex)("Color").ToString + ' Row("Moneda") = Dr("Moneda").ToString + ' Dt.Rows.Add(Row) + ' RowColorIndex += 1 + ' If RowColorIndex = 17 Then + ' RowColorIndex = 0 + ' End If + ' End If + 'Next + + 'Dim query = From s In Dt.AsEnumerable() Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Color = s("Color").ToString(), .Moneda = s("Moneda").ToString()} + 'Dim json As String = Newtonsoft.Json.JsonConvert.SerializeObject(query) + 'RegistraScript($"CargaGraficasBarras({json})", "22") + 'UPPMov.Update() + End Sub +End Class From 5806a9696e88b7d3c88429d16b370ff2c0e9413b Mon Sep 17 00:00:00 2001 From: MLopez Date: Sat, 26 Nov 2022 12:54:32 -0700 Subject: [PATCH 3/3] =?UTF-8?q?E172=20RepIndicadorResumen=20distinguir=20C?= =?UTF-8?q?xP=20segun=20si=20el=20Proveedor=20es=20productor=20o=20no=20Mo?= =?UTF-8?q?dificaciones=20a=20BD:=20-=20Se=20actualiz=C3=B3=20PA=5FComp=5F?= =?UTF-8?q?GetRepPS=20agregando=20dos=20par=C3=A1metros:=20@CveTipoProveed?= =?UTF-8?q?or,=20@CveProveedorClasificacion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App_Code/ClsCompras.vb | 5 ++- General/RepIndicadorResumen.aspx | 59 ++++++++++++++++++++++++++- General/RepIndicadorResumen.aspx.vb | 63 ++++++++++++++++++++++++++--- 3 files changed, 120 insertions(+), 7 deletions(-) diff --git a/App_Code/ClsCompras.vb b/App_Code/ClsCompras.vb index 4ca46507c..5d751b497 100644 --- a/App_Code/ClsCompras.vb +++ b/App_Code/ClsCompras.vb @@ -904,7 +904,8 @@ Public Class ClsCompras Public Function GetRepProductosServicios(CveProyecto As Integer, CveSubProyecto As String, CveCategoria As String, CveClasificacion As Integer, CvePS As Integer, FechaI As Date, FechaF As Date, CveProveedor As Integer, CveUsuario As Integer, CveEstatus As Integer, CveEmpresa As Integer, Gpo As Integer, CveFamilia As Integer, CveSubFamilia As Integer, CveTipoActivoFijo As String, CveSubTipoActivoFijo As String, CveActivoFijo As Integer, TipoCambio As Integer, Optional TCEspecifico As Double = -1, Optional TipoGasto As String = "-1", - Optional CveUsuarioConsulta As Integer = -1, Optional TipoDocto As String = "-1", Optional Deducible As Integer = -1, Optional CveCultivo As String = "-1") As Boolean + Optional CveUsuarioConsulta As Integer = -1, Optional TipoDocto As String = "-1", Optional Deducible As Integer = -1, Optional CveCultivo As String = "-1", + Optional CveTipoProveedor As Integer = -1, Optional CveProveedorClasificacion As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Comp_GetRepPS") @@ -934,6 +935,8 @@ Public Class ClsCompras .Add("@TipoDocto", SqlDbType.VarChar).Value = TipoDocto .Add("@Deducible", SqlDbType.Int).Value = Deducible .Add("@CveCultivo", SqlDbType.VarChar).Value = CveCultivo + .Add("@CveTipoProveedor", SqlDbType.VarChar).Value = CveTipoProveedor + .Add("@CveProveedorClasificacion", SqlDbType.VarChar).Value = CveProveedorClasificacion End With diff --git a/General/RepIndicadorResumen.aspx b/General/RepIndicadorResumen.aspx index 4ed1ed6ac..150701480 100644 --- a/General/RepIndicadorResumen.aspx +++ b/General/RepIndicadorResumen.aspx @@ -159,6 +159,62 @@ +
    +
    + + +
    +
    + + Compras por Productos - Proveedor Productor +
    +
    +
    +
    +
    +
    + +
    +
    +
    + + + + + + + +
    +
    +
    +
    + +
    + + +
    +
    + + Compras por Productos - Proveedor Productor - Gráfica +
    +
    +
    +
    +
    +
    + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    @@ -375,7 +431,8 @@ // }); AmCharts.makeChart("chartdiv_vxp", { ...chartconfig, dataProvider: json["VxP"] }); // Ventas x Producto - AmCharts.makeChart("chartdiv_cxp", { ...chartconfig, dataProvider: json["CxP"] }); // Compras x Producto + AmCharts.makeChart("chartdiv_cxp", { ...chartconfig, dataProvider: json["CxP"] }); // Compras x Producto TipoProveedor 1 + AmCharts.makeChart("chartdiv_cxp192", { ...chartconfig, dataProvider: json["CxP192"] }); // Compras x Producto ProveedorClasificacion 192 AmCharts.makeChart("chartdiv_ccxc", { ...chartconfig, dataProvider: json["CCxC"] }); // Cuentas por Cobrar x Cliente AmCharts.makeChart("chartdiv_cpxp", { ...chartconfig, dataProvider: json["CPxP"] }); // Cuentas por Pagar x Proveedor diff --git a/General/RepIndicadorResumen.aspx.vb b/General/RepIndicadorResumen.aspx.vb index 548df5c57..64dd89557 100644 --- a/General/RepIndicadorResumen.aspx.vb +++ b/General/RepIndicadorResumen.aspx.vb @@ -34,6 +34,20 @@ Partial Class General_RepIndicadorResumen ViewState("CxP") = value End Set End Property + Private Property CxP192 As DataTable + Get + + If ViewState("CxP192") Is Nothing Then + Return New DataTable + Else + Return DirectCast(ViewState("CxP192"), DataTable) + End If + + End Get + Set(value As DataTable) + ViewState("CxP192") = value + End Set + End Property Private Property CCxC As DataTable Get @@ -124,7 +138,16 @@ Partial Class General_RepIndicadorResumen End If If ObjCompras.GetRepProductosServicios(-1, DdlSubProyecto.SelectedValue.ToEntero, -1, -1, -1, TxtFechaI.Text.Trim(), TxtFechaF.Text.Trim(), -1, -1, -1, - UsuarioActual.CveEmpresa, 5, -1, -1, "-1", "-1", -1, TipoCambio:=1, CveUsuarioConsulta:=UsuarioActual.CveUsuario) Then + UsuarioActual.CveEmpresa, 5, -1, -1, "-1", "-1", -1, TipoCambio:=1, CveUsuarioConsulta:=UsuarioActual.CveUsuario, CveProveedorClasificacion:=192) Then + CxP192 = ObjCompras.DtResultados + GvCxP192.DataSource = CxP192 + Else + GvCxP192.DataSource = Nothing + CxP192 = Nothing + End If + + If ObjCompras.GetRepProductosServicios(-1, DdlSubProyecto.SelectedValue.ToEntero, -1, -1, -1, TxtFechaI.Text.Trim(), TxtFechaF.Text.Trim(), -1, -1, -1, + UsuarioActual.CveEmpresa, 5, -1, -1, "-1", "-1", -1, TipoCambio:=1, CveUsuarioConsulta:=UsuarioActual.CveUsuario, CveTipoProveedor:=1) Then CxP = ObjCompras.DtResultados GvCxP.DataSource = CxP Else @@ -159,6 +182,7 @@ Partial Class General_RepIndicadorResumen ObjMovtos.Dispose() GvVxP.DataBind() + GvCxP192.DataBind() GvCxP.DataBind() GvCCxC.DataBind() GvCPxP.DataBind() @@ -174,6 +198,11 @@ Partial Class General_RepIndicadorResumen Else UPGraficaCxP.Visible = False End If + If GvCxP192.Rows.Count > 0 Then + UPGraficaCxP192.Visible = True + Else + UPGraficaCxP192.Visible = False + End If If GvCCxC.Rows.Count > 0 Then UPGraficaCCxC.Visible = True Else @@ -186,7 +215,7 @@ Partial Class General_RepIndicadorResumen End If ' Si no había datos en ninguna tabla no cargar función de gráficos - If (GvVxP.Rows.Count = 0 AndAlso GvCxP.Rows.Count = 0 AndAlso GvCCxC.Rows.Count = 0 AndAlso GvCPxP.Rows.Count = 0) Then Exit Sub + If (GvVxP.Rows.Count = 0 AndAlso GvCxP.Rows.Count = 0 AndAlso GvCxP192.Rows.Count = 0 AndAlso GvCCxC.Rows.Count = 0 AndAlso GvCPxP.Rows.Count = 0) Then Exit Sub GraficasPastel() 'GraficasBarras() End Sub @@ -293,7 +322,7 @@ Partial Class General_RepIndicadorResumen Private Sub GraficasPastel() - Dim DtVxP, DtCxP, DtCCxC, DtCPxP As New DataTable + Dim DtVxP, DtCxP, DtCxP192, DtCCxC, DtCPxP As New DataTable Dim RowColorIndex As Integer = 0 'Ventas x Producto @@ -320,7 +349,7 @@ Partial Class General_RepIndicadorResumen Next Dim query_vxp = From s In DtVxP.AsEnumerable() Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Color = s("Color").ToString(), .Moneda = s("Moneda").ToString()} - 'Compras x Producto + 'Compras x Producto TipoProveedor=1 DtCxP.Reset() DtCxP.Columns.Add("Texto") DtCxP.Columns.Add("Valor") @@ -344,6 +373,30 @@ Partial Class General_RepIndicadorResumen Next Dim query_cxp = From s In DtCxP.AsEnumerable() Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Color = s("Color").ToString(), .Moneda = s("Moneda").ToString()} + 'Compras x Producto ProveedorClasificacion=192 + DtCxP192.Reset() + DtCxP192.Columns.Add("Texto") + DtCxP192.Columns.Add("Valor") + DtCxP192.Columns.Add("Color") + DtCxP192.Columns.Add("Moneda") + RowColorIndex = 0 + For Each Dr As DataRow In CxP192.Rows + If Not Dr("Orden").ToString = "" Then + Dim Row As DataRow = Nothing + Row = DtCxP192.NewRow() + Row("Texto") = $"{Dr("GPO").ToString} {GlobalDTMonedas().FiltraParametros($"CveMoneda = {Dr("CveMoneda").ToString}").Rows(0)("Abreviatura").ToString}" + Row("Valor") = Dr("SubTotal").ToString.FormatoNumero + Row("Color") = DtColor.Rows(RowColorIndex)("Color").ToString + Row("Moneda") = Dr("Moneda").ToString + DtCxP192.Rows.Add(Row) + RowColorIndex += 1 + If RowColorIndex = 17 Then + RowColorIndex = 0 + End If + End If + Next + Dim query_cxp192 = From s In DtCxP192.AsEnumerable() Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Color = s("Color").ToString(), .Moneda = s("Moneda").ToString()} + 'Alert(Newtonsoft.Json.JsonConvert.SerializeObject(CCxC.Rows)) 'Cuentas por cobrar x Cliente @@ -395,7 +448,7 @@ Partial Class General_RepIndicadorResumen Dim query_cpxp = From s In DtCPxP.AsEnumerable() Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Color = s("Color").ToString(), .Moneda = s("Moneda").ToString()} 'Serializar datos agrupándolos en su respectivo DataTable, todos en un solo JSON - Dim json As String = Newtonsoft.Json.JsonConvert.SerializeObject(New With {.VxP = query_vxp, .CxP = query_cxp, .CCxC = query_ccxc, .CPxP = query_cpxp}) + Dim json As String = Newtonsoft.Json.JsonConvert.SerializeObject(New With {.VxP = query_vxp, .CxP = query_cxp, .CxP192 = query_cxp192, .CCxC = query_ccxc, .CPxP = query_cpxp}) 'Dim json As String = Newtonsoft.Json.JsonConvert.SerializeObject(New With {.VxP = query_vxp, .CCxC = New String() {}}) 'Alert(json) RegistraScript($"CargaGraficasPastel({json})", "22")