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() Hilo.Start()
Else Else
Dim PDfDestino As String = $"{UsuarioActual.Empresa.Ruta}\Compras\{FF.EmisorRFC}\{FF.CveFactura}.PDF" Dim PDfDestino As String = $"{UsuarioActual.Empresa.Ruta}\Compras\{FF.EmisorRFC}\{FF.CveFactura}.PDF"
If File.Exists(PDfDestino) Then If File.Exists(RutaPDF) Then
File.Delete(PDfDestino) If File.Exists(PDfDestino) Then
End If File.Delete(PDfDestino)
Try End If
File.Move(RutaPDF, PDfDestino) File.Move(RutaPDF, PDfDestino)
Catch ex As Exception End If
End Try
End If 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> <i class="fa fa-file-excel-o"></i> Exportar por <asp:Label runat="server" ID="LblAccionesSubProyecto" ></asp:Label>
</a> </a>
<div style="display:none"> <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> </div>
</li> </li>
<li> <li>
@@ -231,7 +239,7 @@
function BtnImprimirPoSubProyecto_Click() { function BtnImprimirPoSubProyecto_Click() {
setTimeout(checkFileStatus, 5000); //setTimeout(checkFileStatus, 5000);
$('#BtnImprimirPorsubProyecto').click(); $('#BtnImprimirPorsubProyecto').click();
//checkFileStatus(); //checkFileStatus();
@@ -239,46 +247,46 @@
} }
function callMyStaticFunction() { //function callMyStaticFunction() {
$.ajax({ // $.ajax({
type: "POST", // type: "POST",
url: "MyPage.aspx/MyStaticFunction", // url: "MyPage.aspx/MyStaticFunction",
data: JSON.stringify({ parameter: "TuParametro" }), // data: JSON.stringify({ parameter: "TuParametro" }),
contentType: "application/json; charset=utf-8", // contentType: "application/json; charset=utf-8",
dataType: "json", // dataType: "json",
success: function (response) { // success: function (response) {
alert("Resultado: " + response.d); // alert("Resultado: " + response.d);
}, // },
error: function (xhr, status, error) { // error: function (xhr, status, error) {
console.error("Error: " + error); // console.error("Error: " + error);
} // }
}); // });
} //}
function checkFileStatus() { //function checkFileStatus() {
//$.ajax({ // //$.ajax({
// url: 'RepBalanzaComprobacion.aspx', // // url: 'RepBalanzaComprobacion.aspx',
// success: function (response) { // // success: function (response) {
// setTimeout(checkFileStatus, 20000); // // setTimeout(checkFileStatus, 20000);
// } // // }
//}); // //});
$.ajax({ // $.ajax({
type: "POST", // type: "POST",
url: 'RepBalanzaComprobacion.aspx', // url: 'RepBalanzaComprobacion.aspx',
data: JSON.stringify({ parameter: "TuParametro" }), // data: JSON.stringify({ parameter: "TuParametro" }),
contentType: "application/json; charset=utf-8", // contentType: "application/json; charset=utf-8",
dataType: "json", // dataType: "json",
success: function (response) { // success: function (response) {
//alert("Resultado: " + response.d); // //alert("Resultado: " + response.d);
setTimeout(checkFileStatus, 20000); // setTimeout(checkFileStatus, 20000);
}, // },
error: function (xhr, status, error) { // error: function (xhr, status, error) {
console.error("Error: " + error); // console.error("Error: " + error);
} // }
}); // });
} //}
</script> </script>

View File

@@ -127,6 +127,47 @@
<!-- END REGIONAL STATS PORTLET--> <!-- END REGIONAL STATS PORTLET-->
</div> </div>
</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="row">
<div class="col-md-6"> <div class="col-md-6">
<asp:GridView ID="GvVentasClasificacion" runat="server" AutoGenerateColumns="False" EmptyDataText="No se encontró ningun dato" <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 Set
End Property 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 Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then If Not IsPostBack Then
CargaCombos() CargaCombos()
@@ -69,6 +78,7 @@ Partial Class Ventas_DashboardVentas
DtVentas = DsDatos.Tables(1) DtVentas = DsDatos.Tables(1)
DtVentasClasificacionxMes = DsDatos.Tables(2) DtVentasClasificacionxMes = DsDatos.Tables(2)
DtVentasGrafica = DsDatos.Tables(3) DtVentasGrafica = DsDatos.Tables(3)
DtVentasReal = DsDatos.Tables(4)
DtVentasClasificacion.Columns.Add("PorcentajeVenta", GetType(Decimal)) DtVentasClasificacion.Columns.Add("PorcentajeVenta", GetType(Decimal))
DtVentasClasificacion.Columns.Add("Ano2xAno1", 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("CumplimientaRealVSPPTO", GetType(Decimal))
DtVentas.Columns.Add("Ano3xPPTO", 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 AcumuladoAno1 As Decimal = 0
Dim AcumuladoAno2 As Decimal = 0 Dim AcumuladoAno2 As Decimal = 0
Dim AcumuladoAno3 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")) Row("PorcentajeVenta") = If(DtVentasClasificacion.SUMD("TotalAno2") = 0, 0, Row("TotalAno2").ToString().ToDecimal() / DtVentasClasificacion.SUMD("TotalAno2"))
Next 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 GvVentasClasificacion.DataSource = DtVentasClasificacion
GvVentas.DataSource = DtVentas GvVentas.DataSource = DtVentas
GvVentasClasificacionxMes.DataSource = DtVentasClasificacionxMes GvVentasClasificacionxMes.DataSource = DtVentasClasificacionxMes
GvVentasAcumulado.DataSource = DtVentas GvVentasAcumulado.DataSource = DtVentas
GvVentaReal.DataSource = DtVentasReal
End If End If
End If End If
ObjVentas.Dispose() ObjVentas.Dispose()
@@ -179,38 +214,110 @@ Partial Class Ventas_DashboardVentas
GvVentasAcumulado.Columns(2).HeaderText = $"{Now.Year} VS {Now.Year - 1}" GvVentasAcumulado.Columns(2).HeaderText = $"{Now.Year} VS {Now.Year - 1}"
GvVentasAcumulado.Columns(3).HeaderText = $"{Now.Year} VS PPTO" 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() GvVentasClasificacion.DataBind()
GvVentas.DataBind() GvVentas.DataBind()
GvVentasClasificacionxMes.DataBind() GvVentasClasificacionxMes.DataBind()
GvVentasAcumulado.DataBind() GvVentasAcumulado.DataBind()
GvVentaReal.DataBind()
CargaGraficaNEW(DtVentasGrafica) CargaGraficaNEW(DtVentasGrafica)
'Dim Ano3 = DateTime.Now.Year.ToString() End Sub
'Dim Ano2 = (DateTime.Now.Year - 1).ToString()
'Dim Ano1 = (DateTime.Now.Year - 2).ToString()
'Dim Dt As New DataTable() Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvVentaReal.RowDataBound
'Dt.Columns.Add("Mes") If e.Row.RowType = DataControlRowType.DataRow Then
'Dt.Columns.Add(DateTime.Now.Year.ToString()) If e.Row.RowIndex = 0 Then
'Dt.Columns.Add((DateTime.Now.Year - 1).ToString()) e.Row.Cells(1).Text = ""
'Dt.Columns.Add((DateTime.Now.Year - 2).ToString()) e.Row.Cells(2).Text = ""
'Dt.Columns.Add("Presupuesto") e.Row.Cells(3).Text = ""
e.Row.Cells(5).Text = ""
'For Each Dr As DataRow In DtVentas.Rows e.Row.Cells(6).Text = ""
' Dim Row As DataRow = Dt.NewRow() e.Row.Cells(7).Text = ""
' Row("Mes") = Dr("Mes").ToString() e.Row.Cells(8).Text = ""
' Row(DateTime.Now.Year.ToString()) = Dr("TotalAno3").ToString().FormatoNumero e.Row.Cells(9).Text = ""
' Row((DateTime.Now.Year - 1).ToString()) = Dr("TotalAno2").ToString().FormatoNumero e.Row.Cells(10).Text = ""
' Row((DateTime.Now.Year - 2).ToString()) = Dr("TotalAno1").ToString().FormatoNumero e.Row.Cells(11).Text = ""
' Row("Presupuesto") = Dr("TotalAno3Presupuesto").ToString().FormatoNumero e.Row.Cells(12).Text = ""
' Dt.Rows.Add(Row) e.Row.Cells(13).Text = ""
'Next e.Row.Cells(14).Text = ""
e.Row.Cells(15).Text = ""
'Dim json As String = Newtonsoft.Json.JsonConvert.SerializeObject(Dt) e.Row.Cells(16).Text = ""
'RegistraScript($"CargaGrafica({json});console.log({json})", "22")
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 End Sub
Private Sub CargaGraficaNEW(ByVal D_T_Datos As DataTable) Private Sub CargaGraficaNEW(ByVal D_T_Datos As DataTable)