From 5806a9696e88b7d3c88429d16b370ff2c0e9413b Mon Sep 17 00:00:00 2001 From: MLopez Date: Sat, 26 Nov 2022 12:54:32 -0700 Subject: [PATCH] =?UTF-8?q?E172=20RepIndicadorResumen=20distinguir=20CxP?= =?UTF-8?q?=20segun=20si=20el=20Proveedor=20es=20productor=20o=20no=20Modi?= =?UTF-8?q?ficaciones=20a=20BD:=20-=20Se=20actualiz=C3=B3=20PA=5FComp=5FGe?= =?UTF-8?q?tRepPS=20agregando=20dos=20par=C3=A1metros:=20@CveTipoProveedor?= =?UTF-8?q?,=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")