E172 RepIndicadorResumen distinguir CxP segun si el Proveedor es productor o no

Modificaciones a BD:
- Se actualizó PA_Comp_GetRepPS agregando dos parámetros: @CveTipoProveedor, @CveProveedorClasificacion
This commit is contained in:
MLopez
2022-11-26 12:54:32 -07:00
parent 05ee0da0a3
commit 5806a9696e
3 changed files with 120 additions and 7 deletions

View File

@@ -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

View File

@@ -159,6 +159,62 @@
</div>
</div>
<div class="row">
<div class="col-md-6">
<asp:UpdatePanel ID="UPTablaCxP192" runat="server" class="portlet light xspadding bordered " align="left" UpdateMode="Conditional">
<ContentTemplate>
<div class="portlet-title">
<div class="caption font-green">
<i class="icon-pin font-green"></i>
<span id="Span8" runat="server" class="caption-subject bold uppercase">Compras por Productos - Proveedor Productor</span>
</div>
<div class="actions">
<div class="btn-group">
</div>
</div>
<div class="tools">
<a href="javascript:;" class="collapse"></a>
</div>
</div>
<div class="portlet-body formnombottom">
<asp:GridView ID="GvCxP192" runat="server" GridLines="None"
CssClass="table table-striped table-advance table-hover ScrollAD " ShowHeader="True" EmptyDataText="No se encontraron resultados." ShowHeaderWhenEmpty="true"
AutoGenerateColumns="False" AllowPaging="False" ShowFooter="False">
<Columns>
<asp:BoundField DataField="Gpo" HeaderText="Prod/Serv" ItemStyle-Width="300px" />
<asp:BoundField DataFormatString="{0:n}" DataField="Cantidad" ItemStyle-CssClass="margenbound" HeaderText="Cantidad" />
<asp:BoundField DataFormatString="{0:n}" DataField="SubTotal" ItemStyle-CssClass="margenbound" HeaderText="SubTotal" />
</Columns>
</asp:GridView>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<div class="col-md-6">
<asp:UpdatePanel ID="UPGraficaCxP192" runat="server" class="portlet light xspadding bordered " align="center" style="" UpdateMode="Conditional" Visible="false">
<ContentTemplate>
<div class="portlet-title">
<div class="caption font-green">
<i class="icon-pin font-green"></i>
<span id="Span9" runat="server" class="caption-subject bold uppercase">Compras por Productos - Proveedor Productor - Gráfica </span>
</div>
<div class="actions">
<div class="btn-group">
</div>
</div>
<div class="tools">
<a href="javascript:;" class="collapse"></a>
</div>
</div>
<div class="portlet-body formnombottom">
<div id="chartdiv_cxp192"></div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
<div class="row">
<div class="col-md-6">
<asp:UpdatePanel ID="UPTablaCxP" runat="server" class="portlet light xspadding bordered " align="left" UpdateMode="Conditional">
@@ -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

View File

@@ -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")