This commit is contained in:
2024-11-22 14:16:14 -07:00
4 changed files with 223 additions and 70 deletions

View File

@@ -1704,15 +1704,12 @@ Partial Class Compras_eFacturas
Hilo.Start()
Else
Dim PDfDestino As String = $"{UsuarioActual.Empresa.Ruta}\Compras\{FF.EmisorRFC}\{FF.CveFactura}.PDF"
If File.Exists(PDfDestino) Then
File.Delete(PDfDestino)
End If
Try
If File.Exists(RutaPDF) Then
If File.Exists(PDfDestino) Then
File.Delete(PDfDestino)
End If
File.Move(RutaPDF, PDfDestino)
Catch ex As Exception
End Try
End If
End If
End If

View File

@@ -11,7 +11,15 @@
<i class="fa fa-file-excel-o"></i> Exportar por <asp:Label runat="server" ID="LblAccionesSubProyecto" ></asp:Label>
</a>
<div style="display:none">
<asp:Button runat="server" ID="BtnImprimirPorsubProyecto" OnClick="BtnImprimirPorsubProyecto_Click" ClientIDMode="Static" />
<asp:UpdatePanel runat="server">
<ContentTemplate>
<asp:Button runat="server" ID="BtnImprimirPorsubProyecto" OnClick="BtnImprimirPorsubProyecto_Click" ClientIDMode="Static" />
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="BtnImprimirPorsubProyecto" />
</Triggers>
</asp:UpdatePanel>
</div>
</li>
<li>
@@ -231,7 +239,7 @@
function BtnImprimirPoSubProyecto_Click() {
setTimeout(checkFileStatus, 5000);
//setTimeout(checkFileStatus, 5000);
$('#BtnImprimirPorsubProyecto').click();
//checkFileStatus();
@@ -239,46 +247,46 @@
}
function callMyStaticFunction() {
$.ajax({
type: "POST",
url: "MyPage.aspx/MyStaticFunction",
data: JSON.stringify({ parameter: "TuParametro" }),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
alert("Resultado: " + response.d);
},
error: function (xhr, status, error) {
console.error("Error: " + error);
}
});
}
//function callMyStaticFunction() {
// $.ajax({
// type: "POST",
// url: "MyPage.aspx/MyStaticFunction",
// data: JSON.stringify({ parameter: "TuParametro" }),
// contentType: "application/json; charset=utf-8",
// dataType: "json",
// success: function (response) {
// alert("Resultado: " + response.d);
// },
// error: function (xhr, status, error) {
// console.error("Error: " + error);
// }
// });
//}
function checkFileStatus() {
//$.ajax({
// url: 'RepBalanzaComprobacion.aspx',
// success: function (response) {
// setTimeout(checkFileStatus, 20000);
// }
//});
//function checkFileStatus() {
// //$.ajax({
// // url: 'RepBalanzaComprobacion.aspx',
// // success: function (response) {
// // setTimeout(checkFileStatus, 20000);
// // }
// //});
$.ajax({
type: "POST",
url: 'RepBalanzaComprobacion.aspx',
data: JSON.stringify({ parameter: "TuParametro" }),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
//alert("Resultado: " + response.d);
setTimeout(checkFileStatus, 20000);
},
error: function (xhr, status, error) {
console.error("Error: " + error);
}
});
}
// $.ajax({
// type: "POST",
// url: 'RepBalanzaComprobacion.aspx',
// data: JSON.stringify({ parameter: "TuParametro" }),
// contentType: "application/json; charset=utf-8",
// dataType: "json",
// success: function (response) {
// //alert("Resultado: " + response.d);
// setTimeout(checkFileStatus, 20000);
// },
// error: function (xhr, status, error) {
// console.error("Error: " + error);
// }
// });
//}
</script>

View File

@@ -127,6 +127,47 @@
<!-- END REGIONAL STATS PORTLET-->
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="container">
<asp:GridView ID="GvVentaReal" runat="server" AutoGenerateColumns="False" EmptyDataText="No se encontró ningun dato"
CssClass="table table-striped table-advance table-hover Widthall" OnRowDataBound="GvDatos_RowDataBound"
data-sort="true" Width="100%" GridLines="None">
<Columns>
<asp:BoundField DataField="Agrupador" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField DataField="PromTotalAno1" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="PromTotalAno2" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="PromTotalAno3" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="PromTotalAno3Presupuesto" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="PromTotalEneAno1" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="PromTotalFebAno1" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="PromTotalMarAno1" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="PromTotalAbrAno1" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="PromTotalMayAno1" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="PromTotalJunAno1" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="PromTotalJulAno1" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="PromTotalAgoAno1" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="PromTotalSepAno1" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="PromTotalOctAno1" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="PromTotalNovAno1" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="PromTotalDicAno1" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="PromTotalEneAno2" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="PromTotalFebAno2" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="PromTotalMarAno2" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="PromTotalAbrAno2" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="PromTotalMayAno2" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="PromTotalJunAno2" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="PromTotalJulAno2" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="PromTotalAgoAno2" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="PromTotalSepAno2" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="PromTotalOctAno2" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="PromTotalNovAno2" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="PromTotalDicAno2" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
</Columns>
</asp:GridView>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<asp:GridView ID="GvVentasClasificacion" runat="server" AutoGenerateColumns="False" EmptyDataText="No se encontró ningun dato"

View File

@@ -43,6 +43,15 @@ Partial Class Ventas_DashboardVentas
End Set
End Property
Private Property DtVentasReal As DataTable
Get
Return CType(ViewState("DtVentasReal"), DataTable)
End Get
Set(value As DataTable)
ViewState("DtVentasReal") = value
End Set
End Property
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
CargaCombos()
@@ -69,6 +78,7 @@ Partial Class Ventas_DashboardVentas
DtVentas = DsDatos.Tables(1)
DtVentasClasificacionxMes = DsDatos.Tables(2)
DtVentasGrafica = DsDatos.Tables(3)
DtVentasReal = DsDatos.Tables(4)
DtVentasClasificacion.Columns.Add("PorcentajeVenta", GetType(Decimal))
DtVentasClasificacion.Columns.Add("Ano2xAno1", GetType(Decimal))
@@ -79,6 +89,17 @@ Partial Class Ventas_DashboardVentas
DtVentas.Columns.Add("CumplimientaRealVSPPTO", GetType(Decimal))
DtVentas.Columns.Add("Ano3xPPTO", GetType(Decimal))
DtVentasReal.Columns.Add("Agrupador", GetType(String))
Dim sourceRow = DtVentasReal.Rows(0)
Dim desRow = DtVentasReal.NewRow()
desRow.ItemArray = CType(sourceRow.ItemArray.Clone(), Object())
DtVentasReal.Rows.Add(desRow)
Dim desRow2 = DtVentasReal.NewRow()
desRow2.ItemArray = CType(sourceRow.ItemArray.Clone(), Object())
DtVentasReal.Rows.Add(desRow2)
Dim AcumuladoAno1 As Decimal = 0
Dim AcumuladoAno2 As Decimal = 0
Dim AcumuladoAno3 As Decimal = 0
@@ -105,10 +126,24 @@ Partial Class Ventas_DashboardVentas
Row("PorcentajeVenta") = If(DtVentasClasificacion.SUMD("TotalAno2") = 0, 0, Row("TotalAno2").ToString().ToDecimal() / DtVentasClasificacion.SUMD("TotalAno2"))
Next
Dim index As Integer = 0
For Each Row As DataRow In DtVentasReal.Rows
Select Case index
Case 0
Row("Agrupador") = "Presupuesto 2024"
Case 1
Row("Agrupador") = "Promedio Venta Real"
Case 2
Row("Agrupador") = "Ventas Real"
End Select
index += 1
Next
GvVentasClasificacion.DataSource = DtVentasClasificacion
GvVentas.DataSource = DtVentas
GvVentasClasificacionxMes.DataSource = DtVentasClasificacionxMes
GvVentasAcumulado.DataSource = DtVentas
GvVentaReal.DataSource = DtVentasReal
End If
End If
ObjVentas.Dispose()
@@ -179,38 +214,110 @@ Partial Class Ventas_DashboardVentas
GvVentasAcumulado.Columns(2).HeaderText = $"{Now.Year} VS {Now.Year - 1}"
GvVentasAcumulado.Columns(3).HeaderText = $"{Now.Year} VS PPTO"
GvVentaReal.Columns(1).HeaderText = $"Prom-{Now.Year - 2}"
GvVentaReal.Columns(2).HeaderText = $"Prom-{Now.Year - 1}"
GvVentaReal.Columns(3).HeaderText = $"Prom-{Now.Year}"
GvVentaReal.Columns(4).HeaderText = $"Prom PPTO-{Now.Year}"
GvVentaReal.Columns(5).HeaderText = $"Ene-{Now.Year - 1}"
GvVentaReal.Columns(6).HeaderText = $"Feb"
GvVentaReal.Columns(7).HeaderText = $"Mar"
GvVentaReal.Columns(8).HeaderText = $"Abr"
GvVentaReal.Columns(9).HeaderText = $"May"
GvVentaReal.Columns(10).HeaderText = $"Jun"
GvVentaReal.Columns(11).HeaderText = $"Jul"
GvVentaReal.Columns(12).HeaderText = $"Ago"
GvVentaReal.Columns(13).HeaderText = $"Sep"
GvVentaReal.Columns(14).HeaderText = $"Oct"
GvVentaReal.Columns(15).HeaderText = $"Nov"
GvVentaReal.Columns(16).HeaderText = $"Dic"
GvVentaReal.Columns(17).HeaderText = $"Ene-{Now.Year}"
GvVentaReal.Columns(18).HeaderText = $"Feb"
GvVentaReal.Columns(19).HeaderText = $"Mar"
GvVentaReal.Columns(20).HeaderText = $"Abr"
GvVentaReal.Columns(21).HeaderText = $"May"
GvVentaReal.Columns(22).HeaderText = $"Jun"
GvVentaReal.Columns(23).HeaderText = $"Jul"
GvVentaReal.Columns(24).HeaderText = $"Ago"
GvVentaReal.Columns(25).HeaderText = $"Sep"
GvVentaReal.Columns(26).HeaderText = $"Oct"
GvVentaReal.Columns(27).HeaderText = $"Nov"
GvVentaReal.Columns(28).HeaderText = $"Dic"
GvVentasClasificacion.DataBind()
GvVentas.DataBind()
GvVentasClasificacionxMes.DataBind()
GvVentasAcumulado.DataBind()
GvVentaReal.DataBind()
CargaGraficaNEW(DtVentasGrafica)
'Dim Ano3 = DateTime.Now.Year.ToString()
'Dim Ano2 = (DateTime.Now.Year - 1).ToString()
'Dim Ano1 = (DateTime.Now.Year - 2).ToString()
End Sub
'Dim Dt As New DataTable()
'Dt.Columns.Add("Mes")
'Dt.Columns.Add(DateTime.Now.Year.ToString())
'Dt.Columns.Add((DateTime.Now.Year - 1).ToString())
'Dt.Columns.Add((DateTime.Now.Year - 2).ToString())
'Dt.Columns.Add("Presupuesto")
'For Each Dr As DataRow In DtVentas.Rows
' Dim Row As DataRow = Dt.NewRow()
' Row("Mes") = Dr("Mes").ToString()
' Row(DateTime.Now.Year.ToString()) = Dr("TotalAno3").ToString().FormatoNumero
' Row((DateTime.Now.Year - 1).ToString()) = Dr("TotalAno2").ToString().FormatoNumero
' Row((DateTime.Now.Year - 2).ToString()) = Dr("TotalAno1").ToString().FormatoNumero
' Row("Presupuesto") = Dr("TotalAno3Presupuesto").ToString().FormatoNumero
' Dt.Rows.Add(Row)
'Next
'Dim json As String = Newtonsoft.Json.JsonConvert.SerializeObject(Dt)
'RegistraScript($"CargaGrafica({json});console.log({json})", "22")
Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvVentaReal.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.RowIndex = 0 Then
e.Row.Cells(1).Text = ""
e.Row.Cells(2).Text = ""
e.Row.Cells(3).Text = ""
e.Row.Cells(5).Text = ""
e.Row.Cells(6).Text = ""
e.Row.Cells(7).Text = ""
e.Row.Cells(8).Text = ""
e.Row.Cells(9).Text = ""
e.Row.Cells(10).Text = ""
e.Row.Cells(11).Text = ""
e.Row.Cells(12).Text = ""
e.Row.Cells(13).Text = ""
e.Row.Cells(14).Text = ""
e.Row.Cells(15).Text = ""
e.Row.Cells(16).Text = ""
ElseIf e.Row.RowIndex = 1 Then
e.Row.Cells(4).Text = ""
e.Row.Cells(5).Text = ""
e.Row.Cells(6).Text = ""
e.Row.Cells(7).Text = ""
e.Row.Cells(8).Text = ""
e.Row.Cells(9).Text = ""
e.Row.Cells(10).Text = ""
e.Row.Cells(11).Text = ""
e.Row.Cells(12).Text = ""
e.Row.Cells(13).Text = ""
e.Row.Cells(14).Text = ""
e.Row.Cells(15).Text = ""
e.Row.Cells(16).Text = ""
e.Row.Cells(17).Text = ""
e.Row.Cells(18).Text = ""
e.Row.Cells(19).Text = ""
e.Row.Cells(20).Text = ""
e.Row.Cells(21).Text = ""
e.Row.Cells(22).Text = ""
e.Row.Cells(23).Text = ""
e.Row.Cells(24).Text = ""
e.Row.Cells(25).Text = ""
e.Row.Cells(26).Text = ""
e.Row.Cells(27).Text = ""
e.Row.Cells(28).Text = ""
ElseIf e.Row.RowIndex = 2 Then
e.Row.Cells(1).Text = ""
e.Row.Cells(2).Text = ""
e.Row.Cells(3).Text = ""
e.Row.Cells(4).Text = ""
e.Row.Cells(17).Text = ""
e.Row.Cells(18).Text = ""
e.Row.Cells(19).Text = ""
e.Row.Cells(20).Text = ""
e.Row.Cells(21).Text = ""
e.Row.Cells(22).Text = ""
e.Row.Cells(23).Text = ""
e.Row.Cells(24).Text = ""
e.Row.Cells(25).Text = ""
e.Row.Cells(26).Text = ""
e.Row.Cells(27).Text = ""
e.Row.Cells(28).Text = ""
End If
End If
End Sub
Private Sub CargaGraficaNEW(ByVal D_T_Datos As DataTable)