Mostrar saldo general (cxc - cxp) en el reporte indicado resumen

This commit is contained in:
2023-04-25 10:37:33 -07:00
parent b505561795
commit 5ab7a859e3
2 changed files with 535 additions and 510 deletions

View File

@@ -19,26 +19,31 @@
background-color: #95A5A6; background-color: #95A5A6;
color: white; color: white;
} }
.table-scrollable { .table-scrollable {
margin-top: 0px !important; margin-top: 0px !important;
margin-bottom: 0px !important; margin-bottom: 0px !important;
} }
.margenbound { .margenbound {
margin-left: 15px; margin-left: 15px;
text-align: right; text-align: right;
} }
div[id^=chartdiv] { div[id^=chartdiv] {
width: 100%; width: 100%;
height: 400px; height: 400px;
} }
.portlet-total { .portlet-total {
float:right!important; float: right !important;
display:inline-block!important; display: inline-block !important;
} }
.abbr { .abbr {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
display:block!important; display: block !important;
} }
</style> </style>
</asp:Content> </asp:Content>
@@ -53,6 +58,7 @@
<div class="portlet-title portlet-filterT smalltitle" style="min-height: 49px; position: relative;"> <div class="portlet-title portlet-filterT smalltitle" style="min-height: 49px; position: relative;">
<div class="tools"> <div class="tools">
<asp:Button ID="btnConsultar" CssClass="btn btn-primary" runat="server" ValidationGroup="GrpConsultar" Text="Consultar" /></td> <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> <a href="javascript:;" data-idchekbox="<%= chkexpand.ClientID%>" class=" <%= IIf(chkexpand.Checked = True, "collapse", "expand")%>"></a>
<asp:CheckBox ID="chkexpand" CssClass="hidden" runat="server" /> <asp:CheckBox ID="chkexpand" CssClass="hidden" runat="server" />
</div> </div>
@@ -180,7 +186,7 @@
<asp:GridView ID="GvCompProductores" runat="server" GridLines="None" <asp:GridView ID="GvCompProductores" runat="server" GridLines="None"
CssClass="table table-striped table-advance table-hover ScrollAD Widthall " ShowHeader="True" EmptyDataText="No se encontraron resultados." ShowHeaderWhenEmpty="true" CssClass="table table-striped table-advance table-hover ScrollAD Widthall " ShowHeader="True" EmptyDataText="No se encontraron resultados." ShowHeaderWhenEmpty="true"
AutoGenerateColumns="False" AllowPaging="False"> AutoGenerateColumns="False" AllowPaging="False">
<Columns> <Columns>
<asp:BoundField DataField="GPO" HeaderText="Prod/Serv" /> <asp:BoundField DataField="GPO" HeaderText="Prod/Serv" />
<asp:BoundField DataFormatString="{0:n}" DataField="Cantidad" ItemStyle-CssClass="margenbound" HeaderText="Cantidad(kg)" /> <asp:BoundField DataFormatString="{0:n}" DataField="Cantidad" ItemStyle-CssClass="margenbound" HeaderText="Cantidad(kg)" />
<asp:BoundField DataFormatString="{0:c}" DataField="SubTotal" ItemStyle-CssClass="margenbound" HeaderText="Importe" /> <asp:BoundField DataFormatString="{0:c}" DataField="SubTotal" ItemStyle-CssClass="margenbound" HeaderText="Importe" />
@@ -423,6 +429,20 @@
</div> </div>
</ContentTemplate> </ContentTemplate>
</asp:UpdatePanel> </asp:UpdatePanel>
<asp:UpdatePanel ID="UpSaldoTotal" runat="server" class="portlet light xspadding bordered " align="center" style="" UpdateMode="Conditional">
<ContentTemplate>
<div class="portlet-title" style="border-bottom: none!important; margin-top: 5px">
<div class="caption font-green">
<i class="icon-pin font-green"></i>
<span id="Span1" runat="server" class="caption-subject bold uppercase">Saldo acumulado general (CxC - CxP)</span>
</div>
<div class="caption font-green portlet-total">
<span id="LblSaldoTotal" class="caption-subject bold uppercase" runat="server" />
<a href="javascript:;" class="collapse"></a>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div> </div>
</div> </div>
@@ -430,7 +450,7 @@
<div class="col-md-6"> <div class="col-md-6">
<asp:UpdatePanel ID="UPSaldoCxP" runat="server" class="portlet light xspadding bordered " align="center" style="" UpdateMode="Conditional" Visible="false"> <asp:UpdatePanel ID="UPSaldoCxP" runat="server" class="portlet light xspadding bordered " align="center" style="" UpdateMode="Conditional" Visible="false">
<ContentTemplate> <ContentTemplate>
<div class="portlet-title" style="border-bottom:none!important; margin-top: 5px"> <div class="portlet-title" style="border-bottom: none!important; margin-top: 5px">
<div class="caption font-green"> <div class="caption font-green">
<i class="icon-pin font-green"></i> <i class="icon-pin font-green"></i>
<span id="PLSaldoCxP" runat="server" class="caption-subject bold uppercase">Saldo acumulado de Cuentas por Pagar</span> <span id="PLSaldoCxP" runat="server" class="caption-subject bold uppercase">Saldo acumulado de Cuentas por Pagar</span>
@@ -516,14 +536,14 @@
return Highcharts.numberFormat(this.total, 2, null, ','); return Highcharts.numberFormat(this.total, 2, null, ',');
} }
}, },
// labels: { // labels: {
// style: { // style: {
// color: 'red' // color: 'red'
// }, // },
// formatter: function () { // formatter: function () {
// return Highcharts.numberFormat(this.value, null, null, ','); // return Highcharts.numberFormat(this.value, null, null, ',');
// } // }
// } // }
}, },
//tooltip: { //tooltip: {
// formatter: function (tooltip) { // formatter: function (tooltip) {
@@ -557,15 +577,15 @@
type: 'bar', type: 'bar',
dataLabels: { dataLabels: {
enabled: false, enabled: false,
// format: '${y}' // format: '${y}'
// formatter: function () { // formatter: function () {
// var defaultlabel = Highcharts.getOptions().plotOptions[this.point.series.type].dataLabels.formatter.call(this); // var defaultlabel = Highcharts.getOptions().plotOptions[this.point.series.type].dataLabels.formatter.call(this);
// var isCurrency = /^(\d|-)?(\d|,)*\.?\d*$/.test(defaultlabel); // var isCurrency = /^(\d|-)?(\d|,)*\.?\d*$/.test(defaultlabel);
// return isCurrency ? "$" + defaultlabel : defaultlabel; // return isCurrency ? "$" + defaultlabel : defaultlabel;
// } // }
// formatter: function () { // formatter: function () {
// return this.total; // return this.total;
// }, // },
}, },
animation: { animation: {
duration: 750 duration: 750
@@ -595,34 +615,34 @@
$('#' + "chartdiv_vxp").highcharts({ ...chartconfig, series: [{ ...chartconfig.series[0], data: customAccessor(json["VxP"]) }] }) $('#' + "chartdiv_vxp").highcharts({ ...chartconfig, series: [{ ...chartconfig.series[0], data: customAccessor(json["VxP"]) }] })
$('#' + "chartdiv_compproductores").highcharts({ ...chartconfig, chart: {}, legend: { ...chartconfig.legend, enabled: true }, series: [{ ...chartconfig.series[0], keys: ['name', 'y', 'y2', 'unit', 'unit2'], type: 'pie', data: customAccessorPie(json["CompProductores"]) }] }) $('#' + "chartdiv_compproductores").highcharts({ ...chartconfig, chart: {}, legend: { ...chartconfig.legend, enabled: true }, series: [{ ...chartconfig.series[0], keys: ['name', 'y', 'y2', 'unit', 'unit2'], type: 'pie', data: customAccessorPie(json["CompProductores"]) }] })
$('#' + "chartdiv_compacreed").highcharts({ ...chartconfig, series: [{ ...chartconfig.series[0], data: customAccessor(json["CompAcreed"]) }] }) $('#' + "chartdiv_compacreed").highcharts({ ...chartconfig, series: [{ ...chartconfig.series[0], data: customAccessor(json["CompAcreed"]) }] })
$('#' + "chartdiv_cxp192").highcharts({ ...chartconfig, series: [{ ...chartconfig.series[0], data: customAccessor(json["CxP192"]) }] }) $('#' + "chartdiv_cxp192").highcharts({ ...chartconfig, series: [{ ...chartconfig.series[0], data: customAccessor(json["CxP192"]) }] })
$('#' + "chartdiv_cxp").highcharts({ ...chartconfig, series: [{ ...chartconfig.series[0], data: customAccessor(json["CxP"]) }] }) $('#' + "chartdiv_cxp").highcharts({ ...chartconfig, series: [{ ...chartconfig.series[0], data: customAccessor(json["CxP"]) }] })
$('#' + "chartdiv_cxc").highcharts({ ...chartconfig, series: [{ ...chartconfig.series[0], data: customAccessor(json["CxC"]) }, { ...chartconfig.series[0], type: 'line', data: customAccessor(json["CxCR"]) }] }) $('#' + "chartdiv_cxc").highcharts({ ...chartconfig, series: [{ ...chartconfig.series[0], data: customAccessor(json["CxC"]) }, { ...chartconfig.series[0], type: 'line', data: customAccessor(json["CxCR"]) }] })
function customAccessor(data) { function customAccessor(data) {
const newData = []; const newData = [];
data.forEach(function (point, index) { data.forEach(function (point, index) {
if (point.Texto == "Otros") { if (point.Texto == "Otros") {
newData.push({name:point.Texto, y:point.Valor, unit:point.Unidad, color:'#000000'}); newData.push({name:point.Texto, y:point.Valor, unit:point.Unidad, color:'#000000'});
} else { } else {
newData.push([point.Texto, point.Valor, point.Unidad]); newData.push([point.Texto, point.Valor, point.Unidad]);
} }
}); });
return newData; return newData;
} }
function customAccessorPie(data) { function customAccessorPie(data) {
const newData = []; const newData = [];
data.forEach(function (point, index) { data.forEach(function (point, index) {
if (point.Texto == "Otros") { if (point.Texto == "Otros") {
newData.push({ name: point.Texto, y: point.Cantidad, y2: point.Importe, unit: point.UnidadC, unit2:point.UnidadI, color: '#000000' }); newData.push({ name: point.Texto, y: point.Cantidad, y2: point.Importe, unit: point.UnidadC, unit2:point.UnidadI, color: '#000000' });
} else { } else {
newData.push([point.Texto, point.Cantidad, point.Importe, point.UnidadC, point.UnidadI]); newData.push([point.Texto, point.Cantidad, point.Importe, point.UnidadC, point.UnidadI]);
} }
}); });
return newData; return newData;
} }
} }
</script> </script>

View File

@@ -74,7 +74,8 @@ Partial Class General_RepIndicadorResumen
GvCxC.HeaderRow.Cells(2).Text = "<a href=""/Ventas/RepRecuperacion.aspx"" target=""_blank"">Recuperado</a>" GvCxC.HeaderRow.Cells(2).Text = "<a href=""/Ventas/RepRecuperacion.aspx"" target=""_blank"">Recuperado</a>"
End If End If
Dim SaldoConjCxP = 0 Dim SaldoConjCxP As Decimal = 0D
Dim SaldoCxC As Decimal = 0D
'Mostrar gráficos y totales en portlets solo si hay datos en su respectiva tabla 'Mostrar gráficos y totales en portlets solo si hay datos en su respectiva tabla
If GvVxP.Rows.Count > 0 Then If GvVxP.Rows.Count > 0 Then
@@ -101,8 +102,10 @@ Partial Class General_RepIndicadorResumen
End If End If
If GvCxC.Rows.Count > 0 Then If GvCxC.Rows.Count > 0 Then
UPGraficaCxC.Visible = True UPGraficaCxC.Visible = True
PLCxCTot.InnerHtml = "<span style=""font-weight:800"">" + "Saldo: " + "</span>" + String.Format("{0:c} MXN", CType(GvCxC.DataSource, DataTable).SUM("SaldoMN", "CveCliente IS NOT NULL")) SaldoCxC = CType(GvCxC.DataSource, DataTable).SUMD("SaldoMN", "CveCliente IS NOT NULL")
Dim Recuper As Double = CType(GvCxC.DataSource, DataTable).SUM("RecuperadoMN", "CveCliente IS NOT NULL")
PLCxCTot.InnerHtml = "<span style=""font-weight:800"">" + "Saldo: " + "</span>" + String.Format("{0:c} MXN", SaldoCxC)
Dim Recuper As Double = CType(GvCxC.DataSource, DataTable).SUMD("RecuperadoMN", "CveCliente IS NOT NULL")
If (Recuper > 0) Then PLCxCTot.InnerHtml += "<span style="" font-weight:800; margin-left:1em"">" + "Rec: " + "</span>" + String.Format("{0:c} MXN", Recuper) If (Recuper > 0) Then PLCxCTot.InnerHtml += "<span style="" font-weight:800; margin-left:1em"">" + "Rec: " + "</span>" + String.Format("{0:c} MXN", Recuper)
Else Else
UPGraficaCxC.Visible = False UPGraficaCxC.Visible = False
@@ -110,7 +113,7 @@ Partial Class General_RepIndicadorResumen
End If End If
If GvCxP192.Rows.Count > 0 Then If GvCxP192.Rows.Count > 0 Then
UPGraficaCxP192.Visible = True UPGraficaCxP192.Visible = True
Dim SaldoCxP192 = CType(GvCxP192.DataSource, DataTable).SUM("SaldoMN", "CveProveedor IS NOT NULL") Dim SaldoCxP192 = CType(GvCxP192.DataSource, DataTable).SUMD("SaldoMN", "CveProveedor IS NOT NULL")
SaldoConjCxP += SaldoCxP192 SaldoConjCxP += SaldoCxP192
PLCxP192Tot.InnerHtml = "<span style=""font-weight:800"">" + "Saldo: " + "</span>" + String.Format("{0:c} MXN", SaldoCxP192) PLCxP192Tot.InnerHtml = "<span style=""font-weight:800"">" + "Saldo: " + "</span>" + String.Format("{0:c} MXN", SaldoCxP192)
Else Else
@@ -119,7 +122,7 @@ Partial Class General_RepIndicadorResumen
End If End If
If GvCxP.Rows.Count > 0 Then If GvCxP.Rows.Count > 0 Then
UPGraficaCxP.Visible = True UPGraficaCxP.Visible = True
Dim SaldoCxP = CType(GvCxP.DataSource, DataTable).SUM("SaldoMN", "CveProveedor IS NOT NULL") Dim SaldoCxP = CType(GvCxP.DataSource, DataTable).SUMD("SaldoMN", "CveProveedor IS NOT NULL")
SaldoConjCxP += SaldoCxP SaldoConjCxP += SaldoCxP
PLCxPTot.InnerHtml = "<span style=""font-weight:800"">" + "Saldo: " + "</span>" + String.Format("{0:c} MXN", SaldoCxP) PLCxPTot.InnerHtml = "<span style=""font-weight:800"">" + "Saldo: " + "</span>" + String.Format("{0:c} MXN", SaldoCxP)
Else Else
@@ -135,6 +138,8 @@ Partial Class General_RepIndicadorResumen
PLSaldoCxPTot.InnerHtml = Nothing PLSaldoCxPTot.InnerHtml = Nothing
End If End If
LblSaldoTotal.InnerHtml = String.Format("{0:C} MXN", (SaldoCxC - SaldoConjCxP))
'Si no había datos en ninguna tabla no cargar función de gráficos 'Si no había datos en ninguna tabla no cargar función de gráficos
If GvVxP.Rows.Count = 0 _ If GvVxP.Rows.Count = 0 _
AndAlso GvCompProductores.Rows.Count = 0 _ AndAlso GvCompProductores.Rows.Count = 0 _