E172 Rep Indicador Resumen: + Totales en Portlets, Promedio precio VxP, Fila totales Comp Productores y + info en grafica de pastel
This commit is contained in:
@@ -19,25 +19,27 @@
|
||||
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: 400px;
|
||||
}
|
||||
.portlet-total {
|
||||
float:right!important;
|
||||
display:inline-block!important;
|
||||
}
|
||||
.abbr {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display:block!important;
|
||||
}
|
||||
</style>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="E" runat="Server">
|
||||
@@ -96,12 +98,6 @@
|
||||
</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">
|
||||
@@ -111,15 +107,15 @@
|
||||
<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>
|
||||
<span id="PLVxP" runat="server" class="caption-subject bold uppercase">Ventas por Productos</span>
|
||||
</div>
|
||||
<div class="tools">
|
||||
<a href="javascript:;" class="collapse"></a>
|
||||
</div>
|
||||
<div class="caption font-green portlet-total">
|
||||
<span id="PLVxPTot" class="caption-subject bold uppercase" runat="server" />
|
||||
<a href="javascript:;" class="collapse"></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-body formnombottom">
|
||||
<asp:GridView ID="GvVxP" runat="server" GridLines="None"
|
||||
@@ -129,7 +125,13 @@
|
||||
<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:c}" DataField="SubTotal" ItemStyle-CssClass="margenbound" HeaderText="SubTotal" />
|
||||
|
||||
<%--TODO: Esto se puede meter en el stored procedured, pero me da cosa moverle :S--%>
|
||||
<asp:TemplateField ItemStyle-CssClass="margenbound" HeaderText="P. Promedio">
|
||||
<ItemTemplate>
|
||||
<%--TODO: Esto puede tronar si el valor es DBNull --%>
|
||||
<%# If(Convert.ToDecimal(Eval("Cantidad")) = 0, 0.ToString("C"), (Convert.ToDecimal(Eval("SubTotal")) / Convert.ToInt32(Eval("Cantidad"))).ToString("C")) %>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
</div>
|
||||
@@ -143,11 +145,7 @@
|
||||
<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>
|
||||
<span id="PLGraficaVxP" runat="server" class="caption-subject bold uppercase">Ventas por Productos - Gráfica </span>
|
||||
</div>
|
||||
<div class="tools">
|
||||
<a href="javascript:;" class="collapse"></a>
|
||||
@@ -168,20 +166,20 @@
|
||||
<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 Productores</span>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<div class="btn-group">
|
||||
</div>
|
||||
<span id="PLCompProductores" runat="server" class="caption-subject bold uppercase">Compras Productores</span>
|
||||
</div>
|
||||
<div class="tools">
|
||||
<a href="javascript:;" class="collapse"></a>
|
||||
</div>
|
||||
<div class="caption font-green portlet-total">
|
||||
<span id="PLCompProductoresTot" class="caption-subject bold uppercase" runat="server" />
|
||||
<a href="javascript:;" class="collapse"></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-body formnombottom">
|
||||
<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"
|
||||
AutoGenerateColumns="False" AllowPaging="False" ShowFooter="False">
|
||||
AutoGenerateColumns="False" AllowPaging="False" ShowFooter="True">
|
||||
<Columns>
|
||||
<asp:BoundField DataField="RazonSocial" HeaderText="Proveedor" />
|
||||
<asp:BoundField DataFormatString="{0:n}" DataField="Cantidad" ItemStyle-CssClass="margenbound" HeaderText="Cantidad(kg)" />
|
||||
@@ -190,6 +188,7 @@
|
||||
<asp:BoundField DataFormatString="{0:c}" DataField="Saldo" ItemStyle-CssClass="margenbound" HeaderText="Saldo" />
|
||||
<asp:BoundField DataFormatString="{0:c}" DataField="Abonado" ItemStyle-CssClass="margenbound" HeaderText="Abonado" />
|
||||
</Columns>
|
||||
<FooterStyle CssClass="Totales"/>
|
||||
</asp:GridView>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
@@ -202,11 +201,7 @@
|
||||
<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 Productores - Gráfica por Cantidad(Kg) </span>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<div class="btn-group">
|
||||
</div>
|
||||
<span id="PLGraficaCompProductores" runat="server" class="caption-subject bold uppercase">Compras Productores - Gráfica por Cantidad(Kg) </span>
|
||||
</div>
|
||||
<div class="tools">
|
||||
<a href="javascript:;" class="collapse"></a>
|
||||
@@ -227,15 +222,15 @@
|
||||
<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">Gastos </span>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<div class="btn-group">
|
||||
</div>
|
||||
<span id="PLGastos" runat="server" class="caption-subject bold uppercase">Gastos </span>
|
||||
</div>
|
||||
<div class="tools">
|
||||
<a href="javascript:;" class="collapse"></a>
|
||||
</div>
|
||||
<div class="caption font-green portlet-total">
|
||||
<span id="PLGastosTot" class="caption-subject bold uppercase" runat="server" />
|
||||
<a href="javascript:;" class="collapse"></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-body formnombottom">
|
||||
<asp:GridView ID="GvCompAcreed" runat="server" GridLines="None"
|
||||
@@ -258,11 +253,7 @@
|
||||
<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 clasificación - Gráfica </span>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<div class="btn-group">
|
||||
</div>
|
||||
<span id="PLGraficaGastos" runat="server" class="caption-subject bold uppercase">Compras por clasificación - Gráfica </span>
|
||||
</div>
|
||||
<div class="tools">
|
||||
<a href="javascript:;" class="collapse"></a>
|
||||
@@ -283,15 +274,15 @@
|
||||
<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</span>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<div class="btn-group">
|
||||
</div>
|
||||
<span id="PLCxC" runat="server" class="caption-subject bold uppercase">Cuentas por cobrar</span>
|
||||
</div>
|
||||
<div class="tools">
|
||||
<a href="javascript:;" class="collapse"></a>
|
||||
</div>
|
||||
<div class="caption font-green portlet-total">
|
||||
<span id="PLCxCTot" class="caption-subject bold uppercase" runat="server" />
|
||||
<a href="javascript:;" class="collapse"></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-body formnombottom">
|
||||
<asp:GridView ID="GvCxC" runat="server" GridLines="None"
|
||||
@@ -314,11 +305,7 @@
|
||||
<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 - Gráfica Saldo VS Recuperado</span>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<div class="btn-group">
|
||||
</div>
|
||||
<span id="PLGraficaCxC" runat="server" class="caption-subject bold uppercase">Cuentas por cobrar - Gráfica Saldo VS Recuperado</span>
|
||||
</div>
|
||||
<div class="tools">
|
||||
<a href="javascript:;" class="collapse"></a>
|
||||
@@ -330,30 +317,6 @@
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<asp:UpdatePanel ID="UPGraficaCxCRec" 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="Span10" runat="server" class="caption-subject bold uppercase">Cuentas por cobrar - Gráfica Recuperado</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_cxcrec"></div>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
@@ -363,15 +326,15 @@
|
||||
<div class="portlet-title">
|
||||
<div class="caption font-green">
|
||||
<i class="icon-pin font-green"></i>
|
||||
<span id="Span11" runat="server" class="caption-subject bold uppercase">Cuentas por Pagar productores</span>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<div class="btn-group">
|
||||
</div>
|
||||
<span id="PLCxP192" runat="server" class="caption-subject bold uppercase">Cuentas por Pagar productores</span>
|
||||
</div>
|
||||
<div class="tools">
|
||||
<a href="javascript:;" class="collapse"></a>
|
||||
</div>
|
||||
<div class="caption font-green portlet-total">
|
||||
<span id="PLCxP192Tot" class="caption-subject bold uppercase" runat="server" />
|
||||
<a href="javascript:;" class="collapse"></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-body formnombottom">
|
||||
<asp:GridView ID="GvCxP192" runat="server" GridLines="None"
|
||||
@@ -393,11 +356,7 @@
|
||||
<div class="portlet-title">
|
||||
<div class="caption font-green">
|
||||
<i class="icon-pin font-green"></i>
|
||||
<span id="Span12" runat="server" class="caption-subject bold uppercase">Cuentas por Pagar productores - Gráfica </span>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<div class="btn-group">
|
||||
</div>
|
||||
<span id="PLGraficaCxP192" runat="server" class="caption-subject bold uppercase">Cuentas por Pagar productores - Gráfica </span>
|
||||
</div>
|
||||
<div class="tools">
|
||||
<a href="javascript:;" class="collapse"></a>
|
||||
@@ -418,15 +377,15 @@
|
||||
<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 no productores</span>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<div class="btn-group">
|
||||
</div>
|
||||
<span id="PLCxP" runat="server" class="caption-subject bold uppercase">Cuentas por Pagar no productores</span>
|
||||
</div>
|
||||
<div class="tools">
|
||||
<a href="javascript:;" class="collapse"></a>
|
||||
</div>
|
||||
<div class="caption font-green portlet-total">
|
||||
<span id="PLCxPTot" class="caption-subject bold uppercase" runat="server" />
|
||||
<a href="javascript:;" class="collapse"></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-body formnombottom">
|
||||
<asp:GridView ID="GvCxP" runat="server" GridLines="None"
|
||||
@@ -448,11 +407,7 @@
|
||||
<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 no productores - Gráfica </span>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<div class="btn-group">
|
||||
</div>
|
||||
<span id="PLGraficaCxP" runat="server" class="caption-subject bold uppercase">Cuentas por Pagar no productores - Gráfica </span>
|
||||
</div>
|
||||
<div class="tools">
|
||||
<a href="javascript:;" class="collapse"></a>
|
||||
@@ -507,7 +462,17 @@
|
||||
align: 'left'
|
||||
},
|
||||
legend: {
|
||||
enabled: false
|
||||
enabled: false,
|
||||
// esto es para la grafica de pie
|
||||
layout: 'vertical',
|
||||
align: 'right',
|
||||
width: 220,
|
||||
verticalAlign: 'middle',
|
||||
borderWidth: 0,
|
||||
useHTML: true,
|
||||
labelFormatter: function () {
|
||||
return '<div style="width:190px"><span class="abbr">' + this.name + '</br>' + '</span><span style="float:left">' + this.y.toLocaleString() + this.unit + '</span><span style="float:right">' + '$' + this.y2.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 }) + '</span></div>';
|
||||
},
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category'
|
||||
@@ -547,6 +512,10 @@
|
||||
// },
|
||||
// //footerFormat: '{point.key}'
|
||||
//},
|
||||
tooltip: {
|
||||
//valuePrefix: '$',
|
||||
valueSuffix: " " + '{point.unit}'
|
||||
},
|
||||
plotOptions: {
|
||||
series: {
|
||||
animation: true,
|
||||
@@ -577,9 +546,14 @@
|
||||
}
|
||||
},
|
||||
pie: {
|
||||
allowPointSelect: true,
|
||||
cursor: 'pointer',
|
||||
dataLabels: {
|
||||
enabled: true
|
||||
}
|
||||
enabled: true,
|
||||
distance: -30,
|
||||
format: '{point.percentage:.1f} %'
|
||||
},
|
||||
showInLegend: true
|
||||
}
|
||||
},
|
||||
series: [
|
||||
@@ -594,11 +568,11 @@
|
||||
//AmCharts.makeChart("chartdiv_vxp", { ...chartconfig, type: "serial", dataProvider: json["VxP"] }); // Ventas x Producto
|
||||
|
||||
$('#' + "chartdiv_vxp").highcharts({ ...chartconfig, series: [{ ...chartconfig.series[0], data: customAccessor(json["VxP"]) }] })
|
||||
$('#' + "chartdiv_compproductores").highcharts({ ...chartconfig, series: [{ ...chartconfig.series[0], type: 'pie', data: customAccessor(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_cxp192").highcharts({ ...chartconfig, series: [{ ...chartconfig.series[0], data: customAccessor(json["CxP192"]) }] })
|
||||
$('#' + "chartdiv_cxp").highcharts({ ...chartconfig, series: [{ ...chartconfig.series[0], data: customAccessor(json["CxP"]) }] })
|
||||
$('#' + "chartdiv_cxc").highcharts({ ...chartconfig, series: [{ ...chartconfig.series[0], data: customAccessor(json["CxC"]) }, { 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) {
|
||||
const newData = [];
|
||||
@@ -609,10 +583,18 @@
|
||||
newData.push([point.Texto, point.Valor, point.Unidad]);
|
||||
}
|
||||
});
|
||||
//newData.sort(function (a, b) {
|
||||
// return a[0] > b[0] ? 1 : -1;
|
||||
//});
|
||||
//console.log(JSON.stringify(newData))
|
||||
return newData;
|
||||
}
|
||||
|
||||
function customAccessorPie(data) {
|
||||
const newData = [];
|
||||
data.forEach(function (point, index) {
|
||||
if (point.Texto == "Otros") {
|
||||
newData.push({ name: point.Texto, y: point.Cantidad, y2: point.Importe, unit: point.UnidadC, unit2:point.UnidadI, color: '#000000' });
|
||||
} else {
|
||||
newData.push([point.Texto, point.Cantidad, point.Importe, point.UnidadC, point.UnidadI]);
|
||||
}
|
||||
});
|
||||
return newData;
|
||||
}
|
||||
|
||||
|
||||
@@ -83,38 +83,51 @@ Partial Class General_RepIndicadorResumen
|
||||
GvCxC.HeaderRow.Cells(2).Text = "<a href=""/Ventas/RepRecuperacion.aspx"" target=""_blank"">Recuperado</a>"
|
||||
End If
|
||||
|
||||
'Mostrar gráficos 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
|
||||
UPGraficaVxP.Visible = True
|
||||
PLVxPTot.InnerHtml = "<span style=""font-weight:800"">" + "Cantidad: " + "</span>" + String.Format("{0:n} Kg", CType(GvVxP.DataSource, DataTable).SUM("Cantidad", "Orden IS NOT NULL")) _
|
||||
+ "<span style=""font-weight:800; margin-left:1em"">" + "Total: " + "</span>" + String.Format("{0:c} MXN", CType(GvVxP.DataSource, DataTable).SUM("SubTotalMN", "Orden IS NOT NULL"))
|
||||
Else
|
||||
UPGraficaVxP.Visible = False
|
||||
PLVxPTot.InnerHtml = Nothing
|
||||
End If
|
||||
If GvCompProductores.Rows.Count > 0 Then
|
||||
UPGraficaCompProductores.Visible = True
|
||||
PLCompProductoresTot.InnerHtml = "<span style=""font-weight:800"">" + "Cantidad: " + "</span>" + String.Format("{0:n} Kg", CType(GvCompProductores.DataSource, DataTable).SUM("Cantidad", ""))
|
||||
Else
|
||||
UPGraficaCompProductores.Visible = False
|
||||
PLCompProductoresTot.InnerHtml = Nothing
|
||||
End If
|
||||
If GvCompAcreed.Rows.Count > 0 Then
|
||||
UPGraficaCompAcreed.Visible = True
|
||||
PLGastosTot.InnerHtml = "<span style=""font-weight:800"">" + "Importe: " + "</span>" + String.Format("{0:c} MXN", CType(GvCompAcreed.DataSource, DataTable).SUM("SubTotalMN", "CveClasificacion IS NOT NULL"))
|
||||
Else
|
||||
UPGraficaCompAcreed.Visible = False
|
||||
PLGastosTot.InnerHtml = Nothing
|
||||
End If
|
||||
If GvCxC.Rows.Count > 0 Then
|
||||
UPGraficaCxC.Visible = True
|
||||
'UPGraficaCxCRec.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"))
|
||||
Dim Recuper As Double = CType(GvCxC.DataSource, DataTable).SUM("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", CType(GvCxC.DataSource, DataTable).SUM("RecuperadoMN", "CveCliente IS NOT NULL"))
|
||||
Else
|
||||
UPGraficaCxC.Visible = False
|
||||
'UPGraficaCxCRec.Visible = False
|
||||
PLCxCTot.InnerHtml = Nothing
|
||||
End If
|
||||
If GvCxP192.Rows.Count > 0 Then
|
||||
UPGraficaCxP192.Visible = True
|
||||
PLCxP192Tot.InnerHtml = "<span style=""font-weight:800"">" + "Saldo: " + "</span>" + String.Format("{0:c} MXN", CType(GvCxP192.DataSource, DataTable).SUM("SaldoMN", "CveProveedor IS NOT NULL"))
|
||||
Else
|
||||
UPGraficaCxP192.Visible = False
|
||||
PLCxP192Tot.InnerHtml = Nothing
|
||||
End If
|
||||
If GvCxP.Rows.Count > 0 Then
|
||||
UPGraficaCxP.Visible = True
|
||||
PLCxPTot.InnerHtml = "<span style=""font-weight:800"">" + "Saldo: " + "</span>" + String.Format("{0:c} MXN", CType(GvCxP.DataSource, DataTable).SUM("SaldoMN", "CveProveedor IS NOT NULL"))
|
||||
Else
|
||||
UPGraficaCxP.Visible = False
|
||||
PLCxPTot.InnerHtml = Nothing
|
||||
End If
|
||||
|
||||
'Si no había datos en ninguna tabla no cargar función de gráficos
|
||||
@@ -149,6 +162,32 @@ Partial Class General_RepIndicadorResumen
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
Dim CompProductoresTotales As Decimal() = New Decimal(5 - 1) {}
|
||||
Protected Sub GvCompProductores_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvCompProductores.RowDataBound
|
||||
'Esto tambien se podría meter en el Stored Procedure
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
CompProductoresTotales(0) += Convert.ToDecimal(IfNull(DataBinder.Eval(e.Row.DataItem, "Cantidad"), 0))
|
||||
CompProductoresTotales(1) += Convert.ToDecimal(IfNull(DataBinder.Eval(e.Row.DataItem, "SubTotal"), 0))
|
||||
CompProductoresTotales(2) += Convert.ToDecimal(IfNull(DataBinder.Eval(e.Row.DataItem, "PUPromedioKG"), 0))
|
||||
CompProductoresTotales(3) += Convert.ToDecimal(IfNull(DataBinder.Eval(e.Row.DataItem, "Saldo"), 0))
|
||||
CompProductoresTotales(4) += Convert.ToDecimal(IfNull(DataBinder.Eval(e.Row.DataItem, "Abonado"), 0))
|
||||
ElseIf e.Row.RowType = DataControlRowType.Footer Then
|
||||
'Movemos el pie a la primera fila de la tabla
|
||||
Dim footerRow As GridViewRow = e.Row
|
||||
GvCompProductores.Controls(0).Controls.Remove(footerRow)
|
||||
GvCompProductores.Controls(0).Controls.AddAt(1, footerRow)
|
||||
'Ahora se registran los datos
|
||||
e.Row.Cells(0).Text = "Totales"
|
||||
e.Row.Cells(1).Text = CompProductoresTotales(0).ToString("N")
|
||||
e.Row.Cells(2).Text = CompProductoresTotales(1).ToString("C")
|
||||
e.Row.Cells(3).Text = (CompProductoresTotales(2) / GvCompProductores.Rows.Count).ToString("C") 'Promedio
|
||||
e.Row.Cells(4).Text = CompProductoresTotales(3).ToString("C")
|
||||
e.Row.Cells(5).Text = CompProductoresTotales(4).ToString("C")
|
||||
For i As Integer = 1 To e.Row.Cells.Count - 1
|
||||
e.Row.Cells(i).CssClass = "margenbound"
|
||||
Next
|
||||
End If
|
||||
End Sub
|
||||
Protected Sub GvComprasAcreed_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvCompAcreed.RowDataBound
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
If e.Row.DBCampo("CveClasificacion") = "" Then
|
||||
@@ -230,32 +269,40 @@ Partial Class General_RepIndicadorResumen
|
||||
'Dim group_resto_vxp = From e In resto_vxp Group e By e.Texto Into gpo = Group
|
||||
'Dim group_resto_vxp = resto_vxp.GroupBy(Function(e) New With {Key e.Texto, Key e.Valor, Key e.Color, Key e.Unidad}).ToList()
|
||||
|
||||
'Compras ProveedorClasificacion=192
|
||||
'Compras Productores ProveedorClasificacion=192
|
||||
DtCompProductores.Reset()
|
||||
DtCompProductores.Columns.Add("Texto")
|
||||
DtCompProductores.Columns.Add("Valor")
|
||||
DtCompProductores.Columns.Add("Unidad")
|
||||
DtCompProductores.Columns.Add("Cantidad")
|
||||
DtCompProductores.Columns.Add("Importe")
|
||||
DtCompProductores.Columns.Add("UnidadC")
|
||||
DtCompProductores.Columns.Add("UnidadI")
|
||||
For Each Dr As DataRow In GvCompProductores.DataSource.Rows
|
||||
Dim Row = DtCompProductores.NewRow()
|
||||
Row("Texto") = Dr("RazonSocial").ToString
|
||||
Row("Valor") = Dr("Cantidad").ToString.FormatoNumero
|
||||
Row("Unidad") = "Kg"
|
||||
Row("Cantidad") = Dr("Cantidad").ToString.FormatoNumero
|
||||
Row("Importe") = Dr("SubTotal").ToString.FormatoNumero
|
||||
Row("UnidadC") = "Kg"
|
||||
Row("UnidadI") = "MXN"
|
||||
DtCompProductores.Rows.Add(Row)
|
||||
Next
|
||||
Dim comp_productores = From s In DtCompProductores.AsEnumerable() Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()}
|
||||
Dim comp_productores = From s In DtCompProductores.AsEnumerable() Select New With {.Texto = s("Texto").ToString(), .Cantidad = s("Cantidad").ToString().ToDouble(), .Importe = s("Importe").ToString().ToDouble(), .UnidadC = s("UnidadC").ToString(), .UnidadI = s("UnidadI").ToString()}
|
||||
Dim group_comp_productores = comp_productores.GroupBy(Function(x) x.Texto).[Select](Function(g) New With {
|
||||
.Texto = g.Key,
|
||||
.Valor = Math.Round(g.Sum(Function(x) x.Valor), 2),
|
||||
.Unidad = "MXN"
|
||||
.Cantidad = Math.Round(g.Sum(Function(x) x.Cantidad), 2),
|
||||
.Importe = Math.Round(g.Sum(Function(x) x.Importe), 2),
|
||||
.UnidadC = "Kg",
|
||||
.UnidadI = "MXN"
|
||||
}).ToDataTable
|
||||
Dim top_comp_productores = From s In group_comp_productores.AsEnumerable().Take(10) Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()}
|
||||
Dim resto_comp_productores = From s In group_comp_productores.AsEnumerable().Skip(10) Select New With {.Texto = "Otros", .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()}
|
||||
Dim top_comp_productores = From s In group_comp_productores.AsEnumerable().Take(10) Select New With {.Texto = s("Texto").ToString(), .Cantidad = s("Cantidad").ToString().ToDouble(), .Importe = s("Importe").ToString().ToDouble(), .UnidadC = s("UnidadC").ToString(), .UnidadI = s("UnidadI").ToString()}
|
||||
Dim resto_comp_productores = From s In group_comp_productores.AsEnumerable().Skip(10) Select New With {.Texto = "Otros", .Cantidad = s("Cantidad").ToString().ToDouble(), .Importe = s("Importe").ToString().ToDouble(), .UnidadC = s("UnidadC").ToString(), .UnidadI = s("UnidadI").ToString()}
|
||||
Dim group_resto_comp_productores = resto_comp_productores.GroupBy(Function(x) x.Texto).[Select](Function(g) New With {
|
||||
.Texto = "Otros",
|
||||
.Valor = Math.Round(g.Sum(Function(x) x.Valor), 2),
|
||||
.Unidad = "MXN"
|
||||
.Cantidad = Math.Round(g.Sum(Function(x) x.Cantidad), 2),
|
||||
.Importe = Math.Round(g.Sum(Function(x) x.Importe), 2),
|
||||
.UnidadC = "Kg",
|
||||
.UnidadI = "MXN"
|
||||
})
|
||||
Dim query_comp_productores = top_comp_productores.Union(group_resto_comp_productores).OrderByDescending(Function(x) x.Valor)
|
||||
Dim query_comp_productores = top_comp_productores.Union(group_resto_comp_productores).OrderByDescending(Function(x) x.Cantidad)
|
||||
|
||||
'Compras TipoProveedor=1 Acreedores (Gastos)
|
||||
DtCompAcreed.Reset()
|
||||
@@ -403,6 +450,7 @@ Partial Class General_RepIndicadorResumen
|
||||
})
|
||||
Dim query_cxp = top_cxp.Union(group_resto_cxp).OrderByDescending(Function(x) x.Valor)
|
||||
|
||||
|
||||
'Serializar datos agrupándolos por su respectivo DataTable, todos en un solo JSON
|
||||
Dim json As String = Newtonsoft.Json.JsonConvert.SerializeObject(New With {.VxP = query_vxp, .CompProductores = query_comp_productores, .CompAcreed = query_comp_acreed, .CxC = query_cxc, .CxCR = query_cxcr, .CxP192 = query_cxp192, .CxP = query_cxp})
|
||||
'Alert(json)
|
||||
|
||||
Reference in New Issue
Block a user