Rep finanazas

This commit is contained in:
rakcsle
2023-08-09 08:26:12 -07:00
parent 9045d861dc
commit 084dc1602b
4 changed files with 366 additions and 195 deletions

View File

@@ -3,6 +3,19 @@
<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
<link rel="stylesheet" href="https://www.amcharts.com/lib/3/plugins/export/export.css" type="text/css" media="all" />
<style>
#chartdiv {
width: 100%;
height: 500px;
}
.fa.fa-bar-chart {
width: 16px;
height: 14px;
}
</style>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HB" runat="Server">
@@ -52,13 +65,13 @@
<label class="col-md-1" runat="server" id="LiEjercicioLbl">Ejercicio Inicio: </label>
<div class="col-md-2 " runat="server" id="LiEjercicioDdl">
<asp:DropDownList ID="DdlEjercicio" runat="server" CssClass="select2me" DataTextField="Ejercicio" DataValueField="Ejercicio" Width="130px" AutoPostBack="true" >
<asp:DropDownList ID="DdlEjercicio" runat="server" CssClass="select2me" DataTextField="Ejercicio" DataValueField="Ejercicio" Width="130px" AutoPostBack="true" OnSelectedIndexChanged="DdlEjercicio_SelectedIndexChanged" >
</asp:DropDownList>
</div>
<label class="col-md-1" runat="server" id="LiEjercicioLbl2" visible="True">Ejercicio Fin: </label>
<div class="col-md-2" runat="server" id="LiEjercicioDdl2" visible="True">
<asp:DropDownList ID="DdlEjercicio2" runat="server" CssClass="select2me" DataTextField="Ejercicio" DataValueField="Ejercicio" Width="130px" AutoPostBack="true" >
<asp:DropDownList ID="DdlEjercicio2" runat="server" CssClass="select2me" DataTextField="Ejercicio" DataValueField="Ejercicio" Width="130px" AutoPostBack="true" OnSelectedIndexChanged="DdlEjercicio2_SelectedIndexChanged" >
</asp:DropDownList>
</div>
@@ -433,13 +446,23 @@
EmptyDataText="No se encontraron registros"
CssClass="table table-striped table-hover Widthall ScrollAD mysmallbtn" data-sort="true"
Style="text-align: center;" GridLines="None">
<Columns>
<%-- <asp:TemplateField ItemStyle-HorizontalAlign="Left" HeaderStyle-Width="40px">
<HeaderTemplate>Codigo</HeaderTemplate>
<Columns>
<asp:TemplateField>
<HeaderTemplate>
<%--<asp:HyperLink ID="Hypgrafica" runat="server" CssClass="Texto Hypgrafica gral" NavigateUrl="javascript:void(0);" onclick="return cargaGraficaBarras2();"><i class="fa fa-bar-chart" aria-hidden="true"></i></asp:HyperLink>--%>
</HeaderTemplate>
<ItemTemplate>
<asp:Label CssClass="truncate" ID="LblCodigo" runat="server" Text='<%# Eval("Codigo") %>'></asp:Label>
<div style="white-space: nowrap">
<asp:HyperLink ID="Hypgrafica" Visible="false" runat="server" CssClass="Texto Hypgrafica" NavigateUrl="javascript:void(0);" onclick="return HandlerGraf(this, event);"><i class="fa fa-bar-chart" aria-hidden="true"></i></asp:HyperLink>
<asp:CheckBox ID="chkgraf" CssClass="chkgraf" runat="server" Visible="false" />
<asp:HyperLink ID="hpl2" runat="server" CssClass="Texto Hypgrafica" NavigateUrl="javascript:void(0);" >
<i class="fa fa-bar-chart" aria-hidden="true"></i></asp:HyperLink>
</div>
</ItemTemplate>
</asp:TemplateField>--%>
</asp:TemplateField>
<asp:TemplateField ItemStyle-HorizontalAlign="Left" ControlStyle-Width="300px">
<HeaderTemplate>Ratio</HeaderTemplate>
@@ -584,11 +607,7 @@
</asp:UpdatePanel>
<div id="DivModalGrafica" class="modal ADS fade" role="dialog">
<div id="DivModalGrafica" class="modal ADS fade" role="dialog">
<asp:UpdatePanel class="modal-dialog modal-lg" runat="server" ID="UPModalProd" UpdateMode="Conditional">
<ContentTemplate>
<div class="modal-content">
@@ -599,7 +618,7 @@
</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="row" style="display:none">
<div class="col-md-2"></div>
<label class="col-md-1 truncate">Grafica:</label>
<div class="col-md-2">
@@ -610,7 +629,8 @@
</div>
</div>
<br />
<div id="chartdiv"></div>
<div id="chartdiv" style="display:none"></div>
<div runat="server" id="chartdiv2"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal">Cerrar</button>
@@ -620,44 +640,12 @@
</asp:UpdatePanel>
</div>
<div id="DivModalGraficaGral" class="modal ADS fade" role="dialog">
<asp:UpdatePanel class="modal-dialog modal-lg" style="width: 1300px" runat="server" ID="UpdatePanel1" UpdateMode="Conditional">
<ContentTemplate>
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">
<asp:Label CssClass="LblTituloGraficaGral" runat="server" ClientIDMode="Static" Text="">Análisis de estados de resultados</asp:Label>
</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-1"></div>
<label class="col-md-2 truncate" style="display: inline-block; padding-top: 8px; font-weight: bold;">Seleccione el tipo de gráfica:</label>
<div class="col-md-4">
<asp:RadioButtonList ID="rdblistgrafica" CssClass="rdblistgrafica" runat="server" RepeatDirection="Horizontal">
<asp:ListItem Selected="True" Text="Barras" Value="1"></asp:ListItem>
<asp:ListItem Text="Lineas" Value="2"></asp:ListItem>
</asp:RadioButtonList>
</div>
</div>
<div class="row">
<div class="col-md-3">
<div id="grafInfo"></div>
</div>
<div class="col-md-9">
<div id="chartdivgral"></div>
</div>
</div>
<br />
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal">Cerrar</button>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server">
@@ -680,7 +668,7 @@
} else {
CargaGraficaPastel();
}
$('.LblTituloGrafica').text($(obj).parent().text());
$('.LblTituloGrafica').text($(obj).closest('tr').text().trim());
}
function CargaGraficaBarras() {
let data = cdatos;
@@ -698,7 +686,7 @@
"colorField": "Color",
"fillAlphas": 1,
"lineAlpha": 0.1,
"type": "column",
"type": "line",
"valueField": "Valor"
}],
"depth3D": 20,
@@ -718,7 +706,6 @@
}
});
}
function CargaGraficaPastel() {
let data = cdatos;
var chart = AmCharts.makeChart("chartdiv", {
@@ -747,137 +734,50 @@
CargaGraficaPastel();
}
});
$(".rdblistgrafica:not(.clicked) input").change(cargaGraficaBarras2);
$('.rdblistgrafica').addClass('clicked')
$('.DdlGrafica').removeClass('DdlGrafica')
initamgrafica();
}
let objetos;
let Colores = ["#FF0F00", "#FF6600", "#F8FF01", "#04D215", "#2A0CD0", "#8A0CCF", "#CD0D74", "#754DEB", "#DDDDDD", "#999999", "#000000"];
function graficarshow() {
$('.btngraficarborrar').remove();
$('#C_Tab_header').append('<a onclick="cargaGraficaBarras2();" class="btn btn-success btngraficarborrar" style="float:right;"><i class="fa fa-bar-chart" aria-hidden="true"></i> Graficar</a>');
$('#C_Tab_body').addClass('showgrph');
}
function cargaGraficaBarras2(Titulo) {
$('.LblTituloGraficaGral').text(Titulo);
cargaGraficaBarras2();
}
function cargaGraficaBarras2() {
//Hypgrafica
$("#DivModalGraficaGral").modal();
let infogral = $('#grafInfo');
infogral.find('>*').remove();
$("#DivModalGrafica").modal();
$('.LblTituloGrafica').text('grafica');
let items = []
let data;
let icolor = 0;
let tipografica = $('.rdblistgrafica input:checked').val();
$('.ajax__tab_panel:visible .chkgraf input:checked').each(function () {
data = $(this).closest('tr').find('.Hypgrafica').data('values')
let name = $(this).closest('td').text().trim()
items.push({ id: icolor, data: data, name: name, Color: Colores[icolor], tipografica })
gettitlegraf(infogral, icolor, Colores[icolor], name, tipografica);
icolor = icolor + 1;
if (icolor >= Colores.length) { icolor = 0; }
});
objetos = items;
$(".chkonchange input").each(function () {
let _this = $(this)
_this.change(function () {
let _this = $(this)
let id = Number(_this.data('id'))
objetos[id].tipografica = _this.is(':checked') ? 1 : 2;
ShowGraf2();
})
});
$(function () {
$('.chkonchange').tooltip()
});
ShowGraf2();
}
function gettitlegraf(infogral, id, Color, name, tipografica) {
let strtipografica = '<span class="chksino chkonchange" data-html="true" data-original-title="<div style=\'white-space:nowrap;\'>\'B\' Barras / \'L\' Lineas </div>" ><input id="chk' + id + '" ' + (tipografica == 1 ? 'checked="checked"' : '"') + ' data-id="' + id + '" type="checkbox" name="nchk' + id + '"><label for="chk' + id + '"> </label></span>';
let contenedor = $("<div class='row'></div>");
let divcolspan = $("<div class='col-md-1'></div>");
let divcolor = $('<div class="col-md-1"><div style="width:20px;height:10px;background-color:' + Color + ';"></div> </div>');
let divtexto = $("<div class='col-md-6'>" + name + "</div>");
let divtipografica = $("<div class='col-md-4'>" + strtipografica + "</div>");
infogral.append(contenedor);
/*contenedor.append(divcolspan);*/ contenedor.append(divcolor); contenedor.append(divtexto); contenedor.append(divtipografica);
}
function ShowGraf2() {
let items = objetos;
let series = [];
$('.chkgraf input:checked').each(function () {
data = $(this).closest('tr').find('.Hypgrafica').data('values')
let name = $(this).closest('tr').text().trim()
items.push({ data: data, name: name })
});
if (items) {
data = items[0].data;
series.push((
(items[0].tipografica == 1) ?
{
"balloonText": "[[title]]: <b>[[value]]</b> [[Moneda]]",
"colorField": "Color",
"fillAlphas": 1,
"lineAlpha": 0.1,
"type": "column",
"title": items[0].name,
"valueField": 'Valor'
} :
{
"balloonText": "[[title]]: <b>[[value]]</b> [[Moneda]]",
"colorField": "Color",
"bullet": "round",
"dashLength": 3,
"colorField": "color",
"type": "line",
"title": items[0].name,
"valueField": "Valor"
}
));
for (var i = 0; i < data.length; i++) {
data[i]['Color'] = items[0].Color
}
series.push({
"balloonText": "[[title]]: <b>[[value]]</b> [[Moneda]]",
"colorField": "Color",
"fillAlphas": 1,
"lineAlpha": 0.1,
"type": "column",
"title": items[0].name,
"valueField": 'Valor'
})
for (var indexcol = 1; indexcol < items.length; indexcol++) {
let cdatos = items[indexcol].data;
let valueField = 'Valor' + indexcol;
let colorField = 'Color' + indexcol;
let tipografica = "column";
for (var i = 0; i < cdatos.length; i++) {
data[i][valueField] = cdatos[i].Valor
data[i][colorField] = items[indexcol].Color
}
series.push((
(items[indexcol].tipografica == 1) ?
{
"balloonText": "[[title]]: <b>[[value]]</b> [[Moneda]]",
"colorField": colorField,
"fillAlphas": 1,
"lineAlpha": 0.1,
"type": "column",
"title": items[indexcol].name,
"valueField": valueField
} :
{
"balloonText": "[[title]]: <b>[[value]]</b> [[Moneda]]",
"colorField": colorField,
"bullet": "round",
"dashLength": 3,
"colorField": "color",
"type": "line",
"title": items[indexcol].name,
"valueField": valueField
}
));
series.push({
"balloonText": "[[title]]: <b>[[value]]</b> [[Moneda]]",
"colorField": "Color",
"fillAlphas": 1,
"lineAlpha": 0.1,
"type": "column",
"title": items[indexcol].name,
"valueField": valueField
})
}
var chart = AmCharts.makeChart("chartdivgral", {
var chart = AmCharts.makeChart("chartdiv", {
"type": "serial",
"theme": "light",
"dataProvider": data,
@@ -960,4 +860,171 @@
}
</script>
<script>
function LimpiaCeros() {
let Divisor = 1;
$('.ceros').each(function (i, obj) {
if ($(this).html() == '0.00' || $(this).html() == '0.00%') {
$(this).html('-');
}
if (!($(this).html() == '-' || $(this).html() == '' || ~$(this).html().indexOf("%"))) {
if (Divisor > 1) {
$(this).attr('data-toggle', 'tooltip');
$(this).attr('data-container', 'body');
$(this).attr('title', $(this).html());
}
$(this).html(FormatoNumeroIPP(ToDouble($(this).html()) / Divisor, ((Divisor == 1) ? 2 : 0)));
}
if (ToDouble($(this).html()) < 0) {
$(this).css("color", "red");
}
});
}
function FormatoNumeroIPP(Importe, Decimales) {
if (typeof Decimales === 'undefined') { Decimales = 2; }
if (isNaN(parseInt(Importe))) return "NaN";
var tmpNum = Importe;
tmpNum = tmpNum.toFixed(Decimales).replace(/./g, function (c, i, a) {
return i && c !== "." && !((a.length - i) % 3) ? ',' + c : c;
});
return tmpNum;
}
function pageLoad(sender, e) {
$(document).ready(function () {
$('[data-toggle="tooltip"]').tooltip();
});
}
function graficahighchartsFinan(idcontainer, titulo, subtitulo, ytitulo, datos, Yinterval, labelpoint, media, datospie1, datospie2, Tittulo2) {
$('#LblTituloGrafica').text(Tittulo2)
$(document).ready(function () {
$(".chartcheckboxes").remove();
});
var Monedas = '';
if (datospie1.length > 0) {
Monedas = 'Monedas';
}
var numerodatos = 0;
$("<div class='chartcheckboxes' ><span></span></div>").insertAfter("#" + idcontainer);
if (datos.length > 0) {
var numerodatos = datos.length - 1;
//var media = (datos.reduce(function (a, b) { return a + b; })) / (numerodatos + 1);
for (var i = numerodatos; i >= 0; i--) {
$("<input type='checkbox' id='" + idcontainer + i + "' class='overrydecheckbox' value='" + i + "' onchange=\" changedatagrafica2('" + idcontainer + "');\" /><label for='" + idcontainer + i + "'>" + datos[i][0].substring(0, 3) + "</label>").insertAfter("#" + idcontainer + " + div span");
}
}
$("#" + idcontainer).data('serie', datos);
var margintop = 80;
var dataset = [{
type: 'area',
lineColor: '#9ACAE6',
color: '#F1F7FD',
fillColor: '#F1F7FD',
lineWidth: 3,
marker: {
lineWidth: 2,
lineColor: '#9ACAE6',
fillColor: '#9ACAE6'
},
pointInterval: 1,
name: ' ',
data: datos
}, {
type: 'line',
lineWidth: 2,
lineColor: '#999',
marker: {
enabled: false
},
name: ' ',
data: [media, media]
}];
$('#' + idcontainer).highcharts({
chart: {
type: 'area', spacingTop: margintop
},
title: {
text: titulo
},
subtitle: {
text: subtitulo
},
xAxis: {
type: "category"
},
yAxis: {
title: {
text: ytitulo
},
labels: {
formatter: function () {
return this.value / Yinterval;
}
}
},
tooltip: {
shared: true,
valueSuffix: labelpoint
},
plotOptions: {
area: {
color: '#FBC5C5',
fillColor: '#FBC5C5',
stacking: 'normal',
lineColor: '#F89F9F',
lineWidth: 0,
marker: {
radius: 5,
lineWidth: 2,
lineColor: '#FFF',
fillColor: '#F89F9F'
}
},
line: {
pointInterval: numerodatos,
lineColor: '#999999',
marker: {
enabled: false,
symbol: 'circle',
radius: 2,
states: {
hover: {
enabled: true
}
}
}
}
},
series: dataset,
navigation: {
buttonOptions: {
y: -80
}
}
});
}
</script>
</asp:Content>