From 471a607e0cf9b795da7bab2c6980311465bd5ac1 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Wed, 23 Apr 2025 18:50:16 -0700 Subject: [PATCH 1/2] --CveCorte a generar venta --- Ventas/PVCobranza.aspx.vb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Ventas/PVCobranza.aspx.vb b/Ventas/PVCobranza.aspx.vb index d1958d9ca..f4754e316 100644 --- a/Ventas/PVCobranza.aspx.vb +++ b/Ventas/PVCobranza.aspx.vb @@ -747,7 +747,7 @@ Partial Class Ventas_PVCobranza CveVentaRemision = HdnCveVenta.Value.ToEntero - respFactura = GenerarFactura(CveVendedor, VentaActual, ObjVentas2, ObjClientes, ObservacionesAlmacen, VentaContado, PlazoCobranza, Observaciones, PedidoContrato, OrdenCompra) + respFactura = GenerarFactura(tCveCorte, CveVendedor, VentaActual, ObjVentas2, ObjClientes, ObservacionesAlmacen, VentaContado, PlazoCobranza, Observaciones, PedidoContrato, OrdenCompra) If respFactura Is Nothing Then MsgError = "Ocurrió un error al generar la factura" @@ -1281,7 +1281,7 @@ Partial Class Ventas_PVCobranza UpL.Update() End Sub - Private Function GenerarFactura(CveVendedor As Integer, ByRef VentaRemision As Venta, ByRef ObjVentas As ClsVentas, ByRef ObjClientes As ClsClientes, ObservacionesAlmacen As String, VentaConta As Boolean, PlazoCobranza As Integer, Observaciones As String, PedidoContrato As String, OrdenCompra As String) As Modelos.Factura.MMensajeFactura + Private Function GenerarFactura(CveCorte As Integer, CveVendedor As Integer, ByRef VentaRemision As Venta, ByRef ObjVentas As ClsVentas, ByRef ObjClientes As ClsClientes, ObservacionesAlmacen As String, VentaConta As Boolean, PlazoCobranza As Integer, Observaciones As String, PedidoContrato As String, OrdenCompra As String) As Modelos.Factura.MMensajeFactura Dim Retorno As Modelos.Factura.MMensajeFactura = Nothing Dim SbAlert As New StringBuilder() Dim SBAmortizaciones As New StringBuilder @@ -1466,6 +1466,8 @@ Partial Class Ventas_PVCobranza End If End If + ObjFactura.CveCorte = CveCorte + Retorno = ObjFactura.EmitirFactura(False, Transac:=ObjVentas.IniciaTransacSQL(), Modulo:="Cobranza/GuardarVenta", MostrarURL:=True) Retorno.Factura = ObjFactura From e807bda536db4f8efad7d10662d09fb779e492d6 Mon Sep 17 00:00:00 2001 From: Luis Quijada Date: Wed, 23 Apr 2025 19:07:27 -0700 Subject: [PATCH 2/2] Dashboard Indicadores --- App_Code/ClsGenerales.vb | 28 +++++++++-- App_Code/ClsPaginas.vb | 1 + General/Dashboard.aspx | 55 +++++++++++++++++++++ General/Dashboard.aspx.vb | 101 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 182 insertions(+), 3 deletions(-) create mode 100644 General/Dashboard.aspx create mode 100644 General/Dashboard.aspx.vb diff --git a/App_Code/ClsGenerales.vb b/App_Code/ClsGenerales.vb index 4e0ef922e..7b7617049 100644 --- a/App_Code/ClsGenerales.vb +++ b/App_Code/ClsGenerales.vb @@ -384,10 +384,32 @@ Public Class ClsGenerales End Try Return ds - End Function - + End Function + + Public Function GetDashboardData(CveEmpresa As Integer) As DataSet + Dim ds As New DataSet + DataAdapter("PA_Gral_DashboardsGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@Opcion", SqlDbType.Int).Value = 1 + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@FechaInicio", SqlDbType.Date).Value = Date.Now.AddYears(-1) + .Add("@FechaFin", SqlDbType.Date).Value = Date.Now + End With + + Try + SqlAdapter.Fill(ds) + ds.Tables(0).TableName = "Indicadores" + ds.Tables(1).TableName = "DetalleDia" + Return ds + Catch ex As Exception + ' Manejo de errores + Return Nothing + End Try + End Function + + #End Region - + #Region " D I A S I N H A B I L E S " Public Function DiasInhabiles_Add(CveEmpresa As Integer, CveUsuario As Integer, DiaInhabil As String, Descripcion As String, Estatus As Integer, FechaInhabil As Date) As Boolean Dim Retorno As Boolean = False diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 65b176d49..93f586fc0 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -10555,6 +10555,7 @@ Public Class ClsPaginas PaginaDict.Add("/General/CatMedidaEquivalencia.aspx".ToUpper(), 773) PaginaDict.Add("/General/RepIndicadorResumen.aspx".ToUpper(), 110) PaginaDict.Add("/General/SaldosMenores.aspx".ToUpper(), -1) + PaginaDict.Add("/General/Dashboard.aspx".ToUpper(), 17) #End Region #Region "GPS" PaginaDict.Add("/GPS/RepTemperatura.aspx".ToUpper(), 681) diff --git a/General/Dashboard.aspx b/General/Dashboard.aspx new file mode 100644 index 000000000..95553bddd --- /dev/null +++ b/General/Dashboard.aspx @@ -0,0 +1,55 @@ +<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="Dashboard.aspx.vb" Inherits="General_Dashboard" %> + + + + + + + + + + + + + + + + + +
+ +
+
+
+
+ + + + diff --git a/General/Dashboard.aspx.vb b/General/Dashboard.aspx.vb new file mode 100644 index 000000000..7384cc14f --- /dev/null +++ b/General/Dashboard.aspx.vb @@ -0,0 +1,101 @@ + +Imports System.Data +Imports Extensiones +Imports System.Web.Services +Imports Newtonsoft.Json +Imports ADSNetLibrary.SIGAPI.Models.CRM.Request +Imports ADSNetLibrary.SIGAPI.Services.CRM + +Partial Class General_Dashboard + Inherits ClsPaginas + + Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load + If Not IsPostBack Then + CargarIndicadores() + End If + End Sub + + Private Sub CargarIndicadores() + Dim Gral As New ClsGenerales + Dim ds As DataSet = Gral.GetDashboardData(UsuarioActual.CveEmpresa) + + If ds IsNot Nothing AndAlso ds.Tables.Count > 0 Then + ProcesarDatosIndicadores(ds.Tables(0)) + End If + End Sub + + Private Sub ProcesarDatosIndicadores(dt As DataTable) + If dt.Rows.Count > 0 Then + Dim dr As DataRow = dt.Rows(0) + + ' Indicador Año + MuestraIndicador(DivIndicadores, "blue", "fa fa-calendar", "Año Actual", dr("AcumAño").ToString.FormatoNumero(0), "#", "Acumulado", + dr("AcumAñoPromedio").ToString.FormatoNumero(0), "#", "Promedio", + dr("AcumAñoContado").ToString.FormatoNumero(0), "#", "Contado", + dr("AcumAñoCredito").ToString.FormatoNumero(0), "#", "Crédito") + + ' Indicador Mes + MuestraIndicador(DivIndicadores, "green", "fa fa-calendar-check-o", "Mes Actual", + dr("AcumMes").ToString.FormatoNumero(0), "#", "Acumulado", + dr("AcumMesPromedio").ToString.FormatoNumero(0), "#", "Promedio", + dr("AcumMesContado").ToString.FormatoNumero(0), "#", "Contado", + dr("AcumMesCredito").ToString.FormatoNumero(0), "#", "Crédito") + + ' Indicador Semana + MuestraIndicador(DivIndicadores, "purple", "fa fa-calendar-minus-o", "Semana Actual", + dr("AcumSemana").ToString.FormatoNumero(0), "#", "Acumulado", + dr("AcumSemanaPromedio").ToString.FormatoNumero(0), "#", "Promedio", + dr("AcumSemanaContado").ToString.FormatoNumero(0), "#", "Contado", + dr("AcumSemanaCredito").ToString.FormatoNumero(0), "#", "Crédito") + + + MuestraIndicador(DivIndicadores, "red", "fa fa-sun-o", "Hoy", + "0".FormatoNumero(0), "#", "Acumulado", + "0".FormatoNumero(0), "#", "Promedio", + "0".FormatoNumero(0), "#", "Contado", + "0".FormatoNumero(0), "#", "Crédito") + End If + End Sub + + Private Sub MuestraIndicador(DIV As HtmlGenericControl, Color As String, Icono As String, Titulo As String, Comentario As String, Link As String, TitleComentario As String) + Dim htmldiv As New StringBuilder + htmldiv.AppendFormat("{0}
", DIV.InnerHtml, Color, Icono) + htmldiv.AppendFormat("
{0}
Ver Más
", Link) + DIV.InnerHtml = htmldiv.ToString + End Sub + Private Sub MuestraIndicador(DIV As HtmlGenericControl, Color As String, Icono As String, Titulo As String, C1 As String, CL1 As String, CT1 As String, C2 As String, CL2 As String, CT2 As String) + Dim htmldiv As New StringBuilder + htmldiv.AppendFormat("{0}
", DIV.InnerHtml, Color, Icono) + htmldiv.AppendFormat("
{0}
", Titulo) + htmldiv.AppendFormat("", CT1, C1) + htmldiv.AppendFormat("", CT2, C2) + htmldiv.Append("
Ver Más ") + htmldiv.AppendFormat("
") + DIV.InnerHtml = htmldiv.ToString + End Sub + Private Sub MuestraIndicador(DIV As HtmlGenericControl, Color As String, Icono As String, Titulo As String, C1 As String, CL1 As String, CT1 As String, C2 As String, CL2 As String, CT2 As String, C3 As String, CL3 As String, CT3 As String) + Dim htmldiv As New StringBuilder + htmldiv.AppendFormat("{0}
", DIV.InnerHtml, Color, Icono) + htmldiv.AppendFormat("
{0}
", Titulo) + htmldiv.AppendFormat("", CT1, C1) + htmldiv.AppendFormat("", CT2, C2) + htmldiv.AppendFormat("", CT3, C3) + htmldiv.Append("
Ver Más ") + htmldiv.AppendFormat("
") + DIV.InnerHtml = htmldiv.ToString + End Sub + Private Sub MuestraIndicador(DIV As HtmlGenericControl, Color As String, Icono As String, Titulo As String, C1 As String, CL1 As String, CT1 As String, C2 As String, CL2 As String, CT2 As String, C3 As String, CL3 As String, CT3 As String, C4 As String, CL4 As String, CT4 As String) + Dim htmldiv As New StringBuilder + htmldiv.AppendFormat("{0}
", DIV.InnerHtml, Color, Icono) + htmldiv.AppendFormat("
{0}
", Titulo, CT1, C1) + htmldiv.AppendFormat("", CT2, C2) + htmldiv.AppendFormat("", CT3, C3) + htmldiv.AppendFormat("", CT4, C4) + htmldiv.AppendFormat("
Ver Más
", CL1) + DIV.InnerHtml = htmldiv.ToString + End Sub + +End Class