This commit is contained in:
2022-11-26 13:49:28 -07:00
6 changed files with 974 additions and 600 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

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

View File

@@ -0,0 +1,480 @@
<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="RepIndicadorResumen.aspx.vb" Inherits="General_RepIndicadorResumen" %>
<asp:Content ID="Content1" ContentPlaceHolderID="H" runat="Server">
<%-- <li>
<asp:LinkButton ID="LnkExportar" runat="server"><i class="fa fa-ad-excel"></i> Exportar</asp:LinkButton>
</li>
<li>
<asp:LinkButton ID="LnkImprimir" runat="server"><i class="fa fa-print"></i> Imprimir</asp:LinkButton>
</li>--%>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="Css" runat="Server">
<style>
.dataTables_scrollHead {
background-color: #95A5A6;
color: white;
}
.table-scrollable {
margin-top: 0px !important;
margin-bottom: 0px !important;
}
.margenbound {
margin-left: 15px;
text-align: right;
}
.amChartsAttribution {
margin-top: -2px;
margin-bottom: 8px;
visibility: hidden;
}
div[id^=chartdiv] {
width: 100%;
height: 500px;
}
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="E" runat="Server">
Reporte de Resumen de Indicadores
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="C" runat="Server">
<%--Tabla con los campos para filtrar--%>
<asp:UpdatePanel runat="server">
<ContentTemplate>
<div class="portlet solid grey-cascade portlet-filter" style="">
<div class="portlet-title portlet-filterT smalltitle" style="min-height: 49px; position: relative;">
<div class="tools">
<asp:Button ID="btnConsultar" CssClass="btn btn-primary" runat="server" ValidationGroup="GrpConsultar" Text="Consultar" /></td>
<a href="javascript:;" data-idchekbox="<%= chkexpand.ClientID%>" class=" <%= IIf(chkexpand.Checked = True, "collapse", "expand")%>"></a>
<asp:CheckBox ID="chkexpand" CssClass="hidden" runat="server" />
</div>
<div class="titlefiltros caption magindate">
<div class="row">
<div class="col-md-1 truncate" style="text-align: right!important">Fecha Inicio</div>
<div class="col-md-1">
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 95px !important; padding: 0px;">
<asp:TextBox Style="width: 80px !important;" ID="TxtFechaI" runat="server" CssClass="form-control" CausesValidation="true" MaxLength="10"></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="ImgFechaI" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
</div>
<ajax:MaskedEditExtender ID="MEEFechaI" runat="server" TargetControlID="TxtFechaI" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="CEFechaI" TargetControlID="TxtFechaI" PopupButtonID="ImgFechaI" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
</div>
<div class="col-md-1 truncate" style="text-align: right!important">Fecha Fin</div>
<div class="col-md-1 ">
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 95px !important; padding: 0px;">
<asp:TextBox Style="width: 80px !important;" ID="TxtFechaF" runat="server" CssClass="form-control" CausesValidation="true" MaxLength="10"></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="ImgFechaF" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
</div>
<ajax:MaskedEditExtender ID="MEEFechaF" runat="server" TargetControlID="TxtFechaF" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="CalendarExtender1" TargetControlID="TxtFechaF" PopupButtonID="ImgFechaF" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
</div>
<div class="col-md-1 truncate" style="text-align: right!important; margin-left: 20px">SubProyecto</div>
<div class="col-md-1">
<asp:DropDownList ID="DdlSubProyecto" CssClass="form-control input-sm select2me" runat="server" Width="150px" DataTextField="SubProyecto" DataValueField="CveSubProyecto">
</asp:DropDownList>
</div>
</div>
</div>
</div>
<div class="portlet-body magindate" <%= IIf(chkexpand.Checked = True, "", "style=""display:none;""")%>>
</div>
</div>
<div class="row">
<div class="col-md-6"></div>
<div class="col-md-6 amChartsAttribution">
<a href="http://www.amcharts.com/" class="amChartsLegend" id="amChartsAttribution">JS charts by amCharts</a>
</div>
</div>
<asp:UpdatePanel ID="UPPMov" runat="server" RenderMode="Inline" UpdateMode="Conditional">
<ContentTemplate>
<div class="row">
<div class="col-md-6">
<asp:UpdatePanel ID="UPTablaVxP" 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="SpObs" runat="server" class="caption-subject bold uppercase">Ventas por Productos </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="GvVxP" 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="UPGraficaVxP" 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="Span4" runat="server" class="caption-subject bold uppercase">Ventas por Productos - 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_vxp"></div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</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">
<ContentTemplate>
<div class="portlet-title">
<div class="caption font-green">
<i class="icon-pin font-green"></i>
<span id="Span1" runat="server" class="caption-subject bold uppercase">Compras por Productos </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="GvCxP" 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="UPGraficaCxP" 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="Span2" runat="server" class="caption-subject bold uppercase">Compras por Productos - 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_cxp"></div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
<div class="row">
<div class="col-md-6">
<asp:UpdatePanel ID="UPTablaCCxC" runat="server" class="portlet light xspadding bordered " align="left" style="" UpdateMode="Conditional">
<ContentTemplate>
<div class="portlet-title">
<div class="caption font-green">
<i class="icon-pin font-green"></i>
<span id="Span3" runat="server" class="caption-subject bold uppercase">Cuentas por cobrar por Cliente </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="GvCCxC" 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="Cliente" />
<asp:BoundField DataFormatString="{0:n}" DataField="Saldo" ItemStyle-CssClass="margenbound" HeaderText="Saldo" />
</Columns>
</asp:GridView>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<div class="col-md-6">
<asp:UpdatePanel ID="UPGraficaCCxC" 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="Span5" runat="server" class="caption-subject bold uppercase">Cuentas por cobrar por Cliente - 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_ccxc"></div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
<div class="row">
<div class="col-md-6">
<asp:UpdatePanel ID="UPTablaCPxP" runat="server" class="portlet light xspadding bordered " align="left" style="" UpdateMode="Conditional">
<ContentTemplate>
<div class="portlet-title">
<div class="caption font-green">
<i class="icon-pin font-green"></i>
<span id="Span6" runat="server" class="caption-subject bold uppercase">Cuentas por pagar por Proveedor </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="GvCPxP" 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="Cliente" />
<asp:BoundField DataFormatString="{0:n}" DataField="Saldo" ItemStyle-CssClass="margenbound" HeaderText="Saldo" />
</Columns>
</asp:GridView>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<div class="col-md-6">
<asp:UpdatePanel ID="UPGraficaCPxP" 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="Span7" runat="server" class="caption-subject bold uppercase">Cuentas por pagar por Proveedor - 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_cpxp"></div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnConsultar" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server">
<script src="https://www.amcharts.com/lib/3/amcharts.js"></script>
<script src="https://www.amcharts.com/lib/3/serial.js"></script>
<script src="https://www.amcharts.com/lib/3/pie.js"></script>
<script src="https://www.amcharts.com/lib/3/plugins/export/export.min.js"></script>
<link rel="stylesheet" href="https://www.amcharts.com/lib/3/plugins/export/export.css" type="text/css" media="all" />
<script src="https://www.amcharts.com/lib/3/themes/light.js"></script>
<script>
function CargaGraficasPastel(json) {
// Configuración genérica para todas las gráficas
const chartconfig = {
"hideCredits": true,
"type": "pie",
"theme": "light",
"dataProvider": [], // se sobrescribe con la sección indicada del JSON en makeChart
"valueField": "Valor",
"titleField": "Texto",
//"legend": {
// "valueLabels": {
// "text": "{value.value}"
// }
//},
"outlineAlpha": 0.4,
"depth3D": 0,
"balloonText": "[[title]]<br><span style='font-size:14px'><b>[[value]]</b> ([[percents]]% [[Moneda]])</span>",
"angle": 0,
"export": {
"enabled": true
}
}
// document.querySelectorAll('div[id^=chartdiv]').forEach((chartdiv) => {
// AmCharts.makeChart(chartdiv, chartconfig);
// });
AmCharts.makeChart("chartdiv_vxp", { ...chartconfig, dataProvider: json["VxP"] }); // Ventas 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
document.getElementById('amChartsAttribution').style.visibility = 'visible';
}
/*
function CargaGraficasBarras(json) {
var chart = AmCharts.makeChart("chartdiv2", {
"type": "serial",
"theme": "light",
"dataProvider": json,
"startDuration": 2,
"valueAxes": [{
"position": "left",
"title": "Ventas"
}],
"graphs": [{
"balloonText": "[[category]]: <b>[[value]]</b> [[Moneda]]",
"colorField": "Color",
"fillAlphas": 1,
"lineAlpha": 0.1,
"type": "column",
"valueField": "Valor"
}],
"depth3D": 20,
"angle": 30,
"chartCursor": {
"categoryBalloonEnabled": false,
"cursorAlpha": 0,
"zoomable": false
},
"categoryField": "Texto",
"categoryAxis": {
"gridPosition": "start",
"labelRotation": 90
},
"export": {
"enabled": true
}
});
}*/
</script>
</asp:Content>

View File

@@ -0,0 +1,485 @@
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 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
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, 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
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()
GvCxP192.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 GvCxP192.Rows.Count > 0 Then
UPGraficaCxP192.Visible = True
Else
UPGraficaCxP192.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 GvCxP192.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, DtCxP192, 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 TipoProveedor=1
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()}
'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
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, .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")
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

View File

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

View File

@@ -1,590 +0,0 @@
<?xml version="1.0"?>
<!--
Visual Studio global web project settings.
-->
<VisualWebDeveloper>
<StartupServices>
<Service ID="{C0C07587-41A7-46C8-8FBD-3F9C8EBE2DDC}"/>
</StartupServices>
</VisualWebDeveloper>