Cambios en Dashboard Opcion 4
This commit is contained in:
@@ -399,15 +399,43 @@ Public Class ClsGenerales
|
|||||||
|
|
||||||
Try
|
Try
|
||||||
SqlAdapter.Fill(DSet)
|
SqlAdapter.Fill(DSet)
|
||||||
DSet.Tables(0).TableName = "Indicadores"
|
If DSet.Tables.Count > 0 Then
|
||||||
DSet.Tables(1).TableName = "DetalleDia"
|
Select Case Opcion
|
||||||
DSet.Tables(2).TableName = "DetalleAnualesMes"
|
Case 1 ' Cuentas por Cobrar
|
||||||
DSet.Tables(3).TableName = "VentasPorVendedor"
|
DSet.Tables(0).TableName = "Indicadores"
|
||||||
DSet.Tables(4).TableName = "VentasPorClasificacion"
|
If DSet.Tables.Count > 1 Then DSet.Tables(1).TableName = "DetalleDia"
|
||||||
DSet.Tables(5).TableName = "VentasPorMarca"
|
If DSet.Tables.Count > 2 Then DSet.Tables(2).TableName = "DetalleAnualesMes"
|
||||||
DSet.Tables(6).TableName = "VentasPorPS"
|
If DSet.Tables.Count > 3 Then DSet.Tables(3).TableName = "VentasPorVendedor"
|
||||||
DSet.Tables(7).TableName = "VentasPorCliente"
|
If DSet.Tables.Count > 4 Then DSet.Tables(4).TableName = "VentasPorClasificacion"
|
||||||
DSet.Tables(8).TableName = "VentasPorProveedor"
|
If DSet.Tables.Count > 5 Then DSet.Tables(5).TableName = "VentasPorMarca"
|
||||||
|
If DSet.Tables.Count > 6 Then DSet.Tables(6).TableName = "VentasPorPS"
|
||||||
|
If DSet.Tables.Count > 7 Then DSet.Tables(7).TableName = "VentasPorCliente"
|
||||||
|
If DSet.Tables.Count > 8 Then DSet.Tables(8).TableName = "VentasPorProveedor"
|
||||||
|
|
||||||
|
Case 2 ' Recuperación
|
||||||
|
DSet.Tables(0).TableName = "CarteraPorSubproyecto"
|
||||||
|
If DSet.Tables.Count > 1 Then DSet.Tables(1).TableName = "CarteraPorVendedor"
|
||||||
|
If DSet.Tables.Count > 2 Then DSet.Tables(2).TableName = "RecuperacionPorSubproyecto"
|
||||||
|
If DSet.Tables.Count > 3 Then DSet.Tables(3).TableName = "RecuperacionPorVendedor"
|
||||||
|
If DSet.Tables.Count > 4 Then DSet.Tables(4).TableName = "RecuperacionPorCliente"
|
||||||
|
If DSet.Tables.Count > 5 Then DSet.Tables(5).TableName = "CxCMensual"
|
||||||
|
|
||||||
|
|
||||||
|
Case 3 'Compras
|
||||||
|
If DSet.Tables.Count > 1 Then DSet.Tables(1).TableName = "ComprasPorClasificación"
|
||||||
|
If DSet.Tables.Count > 2 Then DSet.Tables(2).TableName = "ComprasPorMarca"
|
||||||
|
If DSet.Tables.Count > 3 Then DSet.Tables(3).TableName = "ComprasPorPS"
|
||||||
|
If DSet.Tables.Count > 4 Then DSet.Tables(4).TableName = "ComprasPorProveedor"
|
||||||
|
|
||||||
|
Case 4 'Cuentas Por Pagar
|
||||||
|
DSet.Tables(0).TableName = "CxPPorSubproyecto"
|
||||||
|
If DSet.Tables.Count > 1 Then DSet.Tables(1).TableName = "CxPPorProveedor"
|
||||||
|
If DSet.Tables.Count > 2 Then DSet.Tables(2).TableName = "PagosPorSubproyecto"
|
||||||
|
If DSet.Tables.Count > 3 Then DSet.Tables(3).TableName = "PagosPorProveedor"
|
||||||
|
If DSet.Tables.Count > 4 Then DSet.Tables(4).TableName = "CxPMensual"
|
||||||
|
End Select
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
' Manejo de errores
|
' Manejo de errores
|
||||||
|
|||||||
@@ -7728,7 +7728,7 @@ Public Class ClsVentas
|
|||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
|
||||||
Public Function GetSMSIndicadores(Opcion As Integer, FechaInicio As Date, FechaFin As Date, CveUsuario As Integer, CveVendedor As Integer, CveGerenteVendedor As Integer, CveUsuarioTecnico As Integer, CveEmpresa As Integer) As Boolean
|
Public Function GetSMSIndicadores(Opcion As Integer, FechaInicio As Date, FechaFin As Date, CveUsuario As Integer, CveVendedor As Integer, CveUsuarioTecnico As Integer, CveEmpresa As Integer) As Boolean
|
||||||
Dim Retorno As Boolean = False
|
Dim Retorno As Boolean = False
|
||||||
DataAdapter("PA_SMS_IndicadoresGet")
|
DataAdapter("PA_SMS_IndicadoresGet")
|
||||||
With SqlAdapter.SelectCommand.Parameters
|
With SqlAdapter.SelectCommand.Parameters
|
||||||
@@ -7737,7 +7737,6 @@ Public Class ClsVentas
|
|||||||
.Add("@FechaFin", SqlDbType.Date).Value = FechaFin
|
.Add("@FechaFin", SqlDbType.Date).Value = FechaFin
|
||||||
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
|
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
|
||||||
.Add("@CveVendedor", SqlDbType.Int).Value = CveVendedor
|
.Add("@CveVendedor", SqlDbType.Int).Value = CveVendedor
|
||||||
.Add("@CveGerenteVendedor", SqlDbType.Int).Value = CveGerenteVendedor
|
|
||||||
.Add("@CveUsuarioTecnico", SqlDbType.Int).Value = CveUsuarioTecnico
|
.Add("@CveUsuarioTecnico", SqlDbType.Int).Value = CveUsuarioTecnico
|
||||||
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||||
End With
|
End With
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -25,8 +25,7 @@ Partial Class General_Dashboard
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub BindDropdown()
|
Private Sub BindDropdown()
|
||||||
' Actualmente las opciones están definidas en el markup
|
|
||||||
' Aquí podrías cargar dinámicamente si lo deseas en el futuro
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Overrides Sub VerifyRenderingInServerForm(control As Control)
|
Public Overrides Sub VerifyRenderingInServerForm(control As Control)
|
||||||
@@ -49,7 +48,7 @@ Partial Class General_Dashboard
|
|||||||
|
|
||||||
Select Case opcion
|
Select Case opcion
|
||||||
Case 1 ' Ingresos
|
Case 1 ' Ingresos
|
||||||
ProcesarDatosIndicadores(ds.Tables("Indicadores"))
|
IndicadoresIngresos(ds.Tables("Indicadores"))
|
||||||
CargarResumenSucursales(ds.Tables("DetalleDia"))
|
CargarResumenSucursales(ds.Tables("DetalleDia"))
|
||||||
CargarVentasMensuales(ds.Tables("DetalleAnualesMes"))
|
CargarVentasMensuales(ds.Tables("DetalleAnualesMes"))
|
||||||
|
|
||||||
@@ -63,79 +62,88 @@ Partial Class General_Dashboard
|
|||||||
|
|
||||||
|
|
||||||
Case 2 ' Recuperación
|
Case 2 ' Recuperación
|
||||||
' TODO: Implementar carga de indicadores, gráficas y grids para Recuperación
|
IndicadoresRecuperacionCxc(ds.Tables("CarteraPorSubproyecto"), ds.Tables("RecuperacionPorSubproyecto"))
|
||||||
|
|
||||||
|
CargarCarteraPorSucursal(ds.Tables("CarteraPorSubproyecto"))
|
||||||
|
CargarCarteraPorVendedor(ds.Tables("CarteraPorVendedor"))
|
||||||
|
CargarRecuperacionPorSucursal(ds.Tables("RecuperacionPorSubproyecto"))
|
||||||
|
CargarRecuperacionPorCliente(ds.Tables("RecuperacionPorCliente"))
|
||||||
|
CargarCxCMensual(ds.Tables("CxCMensual"))
|
||||||
|
|
||||||
Case 3 ' Compras
|
Case 3 ' Compras
|
||||||
' TODO: Implementar carga para Compras
|
CargarComprasPorClasificacion(ds.Tables("ComprasPorClasificación"))
|
||||||
|
CargarComprasPorMarca(ds.Tables("ComprasPorMarca"))
|
||||||
|
CargarComprasPorPS(ds.Tables("ComprasPorPS"))
|
||||||
|
CargarComprasPorProveedor(ds.Tables("ComprasPorProveedor"))
|
||||||
|
|
||||||
Case 4 ' Gasto
|
Case 4 ' Cuentas por Pagar
|
||||||
' TODO: Implementar carga para Gasto
|
IndicadoresCxP(ds.Tables("CxPPorSubproyecto"), ds.Tables("PagosPorSubproyecto"))
|
||||||
|
|
||||||
Case 5 ' Cuentas por Pagar
|
' Cargar GridViews
|
||||||
' TODO: Implementar carga para CxP
|
CargarCxPPorSucursal(ds.Tables("CxPPorSubproyecto"))
|
||||||
|
CargarCxPPorProveedor(ds.Tables("CxPPorProveedor"))
|
||||||
|
CargarPagosPorSucursal(ds.Tables("PagosPorSubproyecto"))
|
||||||
|
CargarPagosPorProveedor(ds.Tables("PagosPorProveedor"))
|
||||||
|
CargarCxPMensual(ds.Tables("CxPMensual"))
|
||||||
|
|
||||||
Case 6 ' Inventario
|
Case 5 ' Inventario
|
||||||
' TODO: Implementar carga para Inventario
|
' TODO: Implementar carga para Inventario
|
||||||
|
|
||||||
Case 7 ' Utilidad
|
Case 6 ' Utilidad
|
||||||
' TODO: Implementar carga para Utilidad
|
' TODO: Implementar carga para Utilidad
|
||||||
|
|
||||||
Case 8 ' Impuestos
|
Case 7 ' Impuestos
|
||||||
' TODO: Implementar carga para Impuestos
|
' TODO: Implementar carga para Impuestos
|
||||||
|
|
||||||
Case 9 ' CRM
|
Case 8 ' CRM
|
||||||
' TODO: Implementar carga para CRM
|
' TODO: Implementar carga para CRM
|
||||||
|
|
||||||
Case 10 ' RH
|
Case 9 ' RH
|
||||||
' TODO: Implementar carga para RH
|
' TODO: Implementar carga para RH
|
||||||
|
|
||||||
Case 11 ' AF
|
Case 10 ' AF
|
||||||
' TODO: Implementar carga para AF
|
' TODO: Implementar carga para AF
|
||||||
End Select
|
End Select
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Protected Sub LnkExportarPDF_Click(sender As Object, e As EventArgs) Handles LnkExportarPDF.Click
|
Protected Sub LnkExportarPDF_Click(sender As Object, e As EventArgs) Handles LnkExportarPDF.Click
|
||||||
DivIndicadoresLeft.InnerHtml &= DivIndicadoresRight.InnerHtml
|
DivIndicadoresIngresosLeft.InnerHtml &= DivIndicadoresIngresosRight.InnerHtml
|
||||||
DivIndicadoresRight.InnerHtml = String.Empty
|
DivIndicadoresIngresosRight.InnerHtml = String.Empty
|
||||||
pnlDashboard.GenerarReportePDF("Reporte Resumen de Indicadores")
|
pnlDashboard.GenerarReportePDF("Reporte Resumen de Indicadores")
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
|
Private Sub IndicadoresIngresos(dt As DataTable)
|
||||||
Private Sub CargarIndicadores(dt As DataTable)
|
|
||||||
If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then
|
|
||||||
ProcesarDatosIndicadores(dt)
|
|
||||||
End If
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Private Sub ProcesarDatosIndicadores(dt As DataTable)
|
|
||||||
If dt Is Nothing OrElse dt.Rows.Count = 0 Then
|
If dt Is Nothing OrElse dt.Rows.Count = 0 Then
|
||||||
Return
|
Return
|
||||||
End If
|
End If
|
||||||
Dim dr As DataRow = dt.Rows(0)
|
Dim dr As DataRow = dt.Rows(0)
|
||||||
|
|
||||||
' Indicador Año
|
DivIndicadoresIngresosLeft.InnerHtml = String.Empty
|
||||||
MuestraIndicador(DivIndicadoresLeft, "blue", "fa fa-calendar", "Año Actual", dr("AcumAño").ToString.FormatoNumero(0), "#", "Acumulado",
|
DivIndicadoresIngresosRight.InnerHtml = String.Empty
|
||||||
|
|
||||||
|
' Indicador Año
|
||||||
|
MuestraIndicador(DivIndicadoresIngresosLeft, "blue", "fa fa-calendar", "Año Actual", dr("AcumAño").ToString.FormatoNumero(0), "#", "Acumulado",
|
||||||
dr("AcumAñoPromedio").ToString.FormatoNumero(0), "#", "Ticket Promedio",
|
dr("AcumAñoPromedio").ToString.FormatoNumero(0), "#", "Ticket Promedio",
|
||||||
dr("AcumAñoContado").ToString.FormatoNumero(0), "#", "Contado",
|
dr("AcumAñoContado").ToString.FormatoNumero(0), "#", "Contado",
|
||||||
dr("AcumAñoCredito").ToString.FormatoNumero(0), "#", "Crédito")
|
dr("AcumAñoCredito").ToString.FormatoNumero(0), "#", "Crédito")
|
||||||
|
|
||||||
' Indicador Mes
|
' Indicador Mes
|
||||||
MuestraIndicador(DivIndicadoresLeft, "green", "fa fa-calendar-check-o", "Mes Actual",
|
MuestraIndicador(DivIndicadoresIngresosLeft, "green", "fa fa-calendar-check-o", "Mes Actual",
|
||||||
dr("AcumMes").ToString.FormatoNumero(0), "#", "Acumulado",
|
dr("AcumMes").ToString.FormatoNumero(0), "#", "Acumulado",
|
||||||
dr("AcumMesPromedio").ToString.FormatoNumero(0), "#", "Ticket Promedio",
|
dr("AcumMesPromedio").ToString.FormatoNumero(0), "#", "Ticket Promedio",
|
||||||
dr("AcumMesContado").ToString.FormatoNumero(0), "#", "Contado",
|
dr("AcumMesContado").ToString.FormatoNumero(0), "#", "Contado",
|
||||||
dr("AcumMesCredito").ToString.FormatoNumero(0), "#", "Crédito")
|
dr("AcumMesCredito").ToString.FormatoNumero(0), "#", "Crédito")
|
||||||
|
|
||||||
' Indicador Semana
|
' Indicador Semana
|
||||||
MuestraIndicador(DivIndicadoresRight, "purple", "fa fa-calendar-minus-o", "Semana Actual",
|
MuestraIndicador(DivIndicadoresIngresosRight, "purple", "fa fa-calendar-minus-o", "Semana Actual",
|
||||||
dr("AcumSemana").ToString.FormatoNumero(0), "#", "Acumulado",
|
dr("AcumSemana").ToString.FormatoNumero(0), "#", "Acumulado",
|
||||||
dr("AcumSemanaPromedio").ToString.FormatoNumero(0), "#", "Ticket Promedio",
|
dr("AcumSemanaPromedio").ToString.FormatoNumero(0), "#", "Ticket Promedio",
|
||||||
dr("AcumSemanaContado").ToString.FormatoNumero(0), "#", "Contado",
|
dr("AcumSemanaContado").ToString.FormatoNumero(0), "#", "Contado",
|
||||||
dr("AcumSemanaCredito").ToString.FormatoNumero(0), "#", "Crédito")
|
dr("AcumSemanaCredito").ToString.FormatoNumero(0), "#", "Crédito")
|
||||||
|
|
||||||
|
|
||||||
MuestraIndicador(DivIndicadoresRight, "red", "fa fa-sun-o", "Hoy",
|
MuestraIndicador(DivIndicadoresIngresosRight, "red", "fa fa-sun-o", "Hoy",
|
||||||
"0".FormatoNumero(0), "#", "Acumulado",
|
"0".FormatoNumero(0), "#", "Acumulado",
|
||||||
"0".FormatoNumero(0), "#", "Ticket Promedio",
|
"0".FormatoNumero(0), "#", "Ticket Promedio",
|
||||||
"0".FormatoNumero(0), "#", "Contado",
|
"0".FormatoNumero(0), "#", "Contado",
|
||||||
@@ -143,6 +151,133 @@ Partial Class General_Dashboard
|
|||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Private Sub IndicadoresRecuperacionCxc(dtCartera As DataTable, dtRecuperacion As DataTable)
|
||||||
|
If dtCartera Is Nothing OrElse dtCartera.Rows.Count = 0 Then Return
|
||||||
|
If dtRecuperacion Is Nothing OrElse dtRecuperacion.Rows.Count = 0 Then Return
|
||||||
|
|
||||||
|
' Calcular totales para Cartera Vencida
|
||||||
|
Dim totalVencido As Decimal = 0
|
||||||
|
Dim totalPorVencer As Decimal = 0
|
||||||
|
Dim totalCxC As Decimal = 0
|
||||||
|
Dim maxRotacion As Decimal = 0
|
||||||
|
|
||||||
|
For Each row As DataRow In dtCartera.Rows
|
||||||
|
totalVencido += If(IsDBNull(row("Vencido")), 0D, row("Vencido")).ToString.ToDecimal()
|
||||||
|
totalPorVencer += If(IsDBNull(row("Por Vencer")), 0D, row("Por Vencer")).ToString.ToDecimal()
|
||||||
|
If dtCartera.Columns.Contains("RotacionCartera") AndAlso Not IsDBNull(row("RotacionCartera")) Then
|
||||||
|
Dim rotacion = Convert.ToDecimal(row("RotacionCartera"))
|
||||||
|
If rotacion > maxRotacion Then maxRotacion = rotacion
|
||||||
|
End If
|
||||||
|
|
||||||
|
Next
|
||||||
|
|
||||||
|
totalCxC = totalVencido + totalPorVencer
|
||||||
|
|
||||||
|
' Calcular total para Recuperación
|
||||||
|
Dim totalRecuperado As Decimal = 0
|
||||||
|
For Each row As DataRow In dtRecuperacion.Rows
|
||||||
|
totalRecuperado += If(IsDBNull(row("Recuperado")), 0D, row("Recuperado")).ToString.ToDecimal()
|
||||||
|
Next
|
||||||
|
|
||||||
|
DivIndicadoresRecuperacionLeft.InnerHtml = ""
|
||||||
|
DivIndicadoresRecuperacionRight.InnerHtml = ""
|
||||||
|
|
||||||
|
' Indicador Cartera Vencida
|
||||||
|
MuestraIndicador(DivIndicadoresRecuperacionLeft, "blue", "fa fa-calendar", "Cartera Vencida",
|
||||||
|
totalCxC.ToString.FormatoNumero(0), "#", "CxC",
|
||||||
|
totalVencido.ToString.FormatoNumero(0), "#", "Vencido",
|
||||||
|
totalPorVencer.ToString.FormatoNumero(0), "#", "Por Vencer")
|
||||||
|
|
||||||
|
'Indicador KPI Recuperación
|
||||||
|
MuestraIndicadorKPI(DivIndicadoresRecuperacionLeft, "purple", "fa fa-usd",
|
||||||
|
"Recuperación",
|
||||||
|
totalRecuperado.ToString.FormatoNumero(0),
|
||||||
|
"#",
|
||||||
|
"Recuperación")
|
||||||
|
|
||||||
|
Dim factorRecuperacion As Decimal = 0
|
||||||
|
If totalCxC > 0 Then
|
||||||
|
factorRecuperacion = (totalRecuperado / totalCxC)
|
||||||
|
End If
|
||||||
|
|
||||||
|
MuestraIndicadorKPI(DivIndicadoresRecuperacionRight, "green", "fa fa-fa-percent",
|
||||||
|
"Factor Recuperación",
|
||||||
|
factorRecuperacion.ToString("N2") & "%",
|
||||||
|
"#",
|
||||||
|
"Porcentaje de cartera recuperada")
|
||||||
|
|
||||||
|
MuestraIndicadorKPI(DivIndicadoresRecuperacionRight, "red", "fa fa-refresh",
|
||||||
|
"Rotación Cartera",
|
||||||
|
maxRotacion.ToString("N1"),
|
||||||
|
"#",
|
||||||
|
"Máxima rotación de cartera entre sucursales")
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub IndicadoresCxP(dtCxP As DataTable, dtPagos As DataTable)
|
||||||
|
If dtCxP Is Nothing OrElse dtCxP.Rows.Count = 0 Then Return
|
||||||
|
If dtPagos Is Nothing OrElse dtPagos.Rows.Count = 0 Then Return
|
||||||
|
|
||||||
|
' Calcular totales para CxP
|
||||||
|
Dim totalVencido As Decimal = 0
|
||||||
|
Dim totalPorVencer As Decimal = 0
|
||||||
|
Dim totalCxP As Decimal = 0
|
||||||
|
Dim maxRotacion As Decimal = 0
|
||||||
|
|
||||||
|
For Each row As DataRow In dtCxP.Rows
|
||||||
|
totalVencido += Convert.ToDecimal(If(IsDBNull(row("Vencido")), 0D, row("Vencido")))
|
||||||
|
totalPorVencer += Convert.ToDecimal(If(IsDBNull(row("Por Vencer")), 0D, row("Por Vencer")))
|
||||||
|
|
||||||
|
' Obtener rotación máxima
|
||||||
|
If dtCxP.Columns.Contains("RotacionCartera") AndAlso Not IsDBNull(row("RotacionCartera")) Then
|
||||||
|
Dim rotacion = Convert.ToDecimal(row("RotacionCartera"))
|
||||||
|
If rotacion > maxRotacion Then maxRotacion = rotacion
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
totalCxP = totalVencido + totalPorVencer
|
||||||
|
|
||||||
|
' Calcular total pagado
|
||||||
|
Dim totalPagado As Decimal = 0
|
||||||
|
For Each row As DataRow In dtPagos.Rows
|
||||||
|
totalPagado += Convert.ToDecimal(If(IsDBNull(row("Recuperado")), 0D, row("Recuperado")))
|
||||||
|
Next
|
||||||
|
|
||||||
|
DivIndicadoresCxPLeft.InnerHtml = ""
|
||||||
|
DivIndicadoresRecuperacionRight.InnerHtml = ""
|
||||||
|
|
||||||
|
' Indicador CxP
|
||||||
|
MuestraIndicador(DivIndicadoresCxPLeft, "blue", "fa fa-calendar", "Cuentas por Pagar",
|
||||||
|
totalCxP.ToString.FormatoNumero(0), "#", "Total CxP",
|
||||||
|
totalVencido.ToString.FormatoNumero(0), "#", "Vencido",
|
||||||
|
totalPorVencer.ToString.FormatoNumero(0), "#", "Por Vencer")
|
||||||
|
|
||||||
|
' KPI Pagado
|
||||||
|
MuestraIndicadorKPI(DivIndicadoresCxPLeft, "purple", "fa fa-usd",
|
||||||
|
"Total Pagado",
|
||||||
|
totalPagado.ToString.FormatoNumero(0),
|
||||||
|
"#",
|
||||||
|
"Total pagado a proveedores")
|
||||||
|
|
||||||
|
' KPI Factor CxP vs Pagado
|
||||||
|
Dim factorPago As Decimal = 0
|
||||||
|
If totalCxP > 0 Then
|
||||||
|
factorPago = (totalPagado / totalCxP) * 100
|
||||||
|
End If
|
||||||
|
|
||||||
|
MuestraIndicadorKPI(DivIndicadoresCxPRight, "green", "fa fa-percent",
|
||||||
|
"Factor Pago",
|
||||||
|
factorPago.ToString("N2") & "%",
|
||||||
|
"#",
|
||||||
|
"Porcentaje de CxP pagado")
|
||||||
|
|
||||||
|
' KPI Rotación de Cartera
|
||||||
|
MuestraIndicadorKPI(DivIndicadoresCxPRight, "red", "fa fa-refresh",
|
||||||
|
"Rotación CxP",
|
||||||
|
maxRotacion.ToString("N1") & " días",
|
||||||
|
"#",
|
||||||
|
"Máxima rotación de CxP entre sucursales")
|
||||||
|
End Sub
|
||||||
|
|
||||||
Private Sub CargarVentasMensuales(dt As DataTable)
|
Private Sub CargarVentasMensuales(dt As DataTable)
|
||||||
If dt Is Nothing OrElse dt.Rows.Count = 0 Then
|
If dt Is Nothing OrElse dt.Rows.Count = 0 Then
|
||||||
Return
|
Return
|
||||||
@@ -480,7 +615,420 @@ Partial Class General_Dashboard
|
|||||||
gvVentasPorProveedor.DataBind()
|
gvVentasPorProveedor.DataBind()
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Private Sub CargarCarteraPorSucursal(dt As DataTable)
|
||||||
|
If dt Is Nothing OrElse dt.Rows.Count = 0 Then
|
||||||
|
Return
|
||||||
|
End If
|
||||||
|
|
||||||
|
' Crear DataTable con estructura necesaria
|
||||||
|
Dim dtGrid = New DataTable()
|
||||||
|
dtGrid.Columns.Add("Sucursal", GetType(String))
|
||||||
|
dtGrid.Columns.Add("TotalCxC", GetType(Decimal))
|
||||||
|
dtGrid.Columns.Add("Vencido", GetType(Decimal))
|
||||||
|
dtGrid.Columns.Add("PorVencer", GetType(Decimal))
|
||||||
|
|
||||||
|
For Each row As DataRow In dt.Rows
|
||||||
|
Dim vencido = (If(IsDBNull(row("Vencido")), 0D, row("Vencido"))).ToString.ToDecimal()
|
||||||
|
Dim porVencer = (If(IsDBNull(row("Por Vencer")), 0D, row("Por Vencer"))).ToString.ToDecimal()
|
||||||
|
Dim totalCxC = vencido + porVencer
|
||||||
|
|
||||||
|
dtGrid.Rows.Add(
|
||||||
|
row("Sucursal").ToString(),
|
||||||
|
totalCxC,
|
||||||
|
vencido,
|
||||||
|
porVencer
|
||||||
|
)
|
||||||
|
Next
|
||||||
|
|
||||||
|
gvCarteraPorSucursal.DataSource = dtGrid
|
||||||
|
gvCarteraPorSucursal.DataBind()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub CargarCarteraPorVendedor(dt As DataTable)
|
||||||
|
If dt Is Nothing OrElse dt.Rows.Count = 0 Then
|
||||||
|
Return
|
||||||
|
End If
|
||||||
|
|
||||||
|
' Crear DataTable con estructura necesaria
|
||||||
|
Dim dtGrid = New DataTable()
|
||||||
|
dtGrid.Columns.Add("Vendedor", GetType(String))
|
||||||
|
dtGrid.Columns.Add("TotalCxC", GetType(Decimal))
|
||||||
|
dtGrid.Columns.Add("Vencido", GetType(Decimal))
|
||||||
|
dtGrid.Columns.Add("PorVencer", GetType(Decimal))
|
||||||
|
|
||||||
|
For Each row As DataRow In dt.Rows
|
||||||
|
Dim vencido = Convert.ToDecimal(If(IsDBNull(row("Vencido")), 0D, row("Vencido")))
|
||||||
|
Dim porVencer = Convert.ToDecimal(If(IsDBNull(row("Por Vencer")), 0D, row("Por Vencer")))
|
||||||
|
Dim totalCxC = vencido + porVencer
|
||||||
|
|
||||||
|
dtGrid.Rows.Add(
|
||||||
|
row("Vendedor").ToString(),
|
||||||
|
totalCxC,
|
||||||
|
vencido,
|
||||||
|
porVencer
|
||||||
|
)
|
||||||
|
Next
|
||||||
|
|
||||||
|
gvCarteraPorVendedor.DataSource = dtGrid
|
||||||
|
gvCarteraPorVendedor.DataBind()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub CargarCxCMensual(dt As DataTable)
|
||||||
|
If dt Is Nothing OrElse dt.Rows.Count = 0 Then
|
||||||
|
Return
|
||||||
|
End If
|
||||||
|
|
||||||
|
' Lista de meses en español
|
||||||
|
Dim mesesOrdenados As New List(Of String) From {
|
||||||
|
"Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio",
|
||||||
|
"Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"
|
||||||
|
}
|
||||||
|
|
||||||
|
' Obtener años distintos de forma segura
|
||||||
|
Dim años As New List(Of Integer)
|
||||||
|
For Each row As DataRow In dt.Rows
|
||||||
|
If Not IsDBNull(row("Año")) Then
|
||||||
|
Dim añoValue As String = row("Año").ToString()
|
||||||
|
Dim añoInt As Integer
|
||||||
|
If Integer.TryParse(añoValue, añoInt) Then
|
||||||
|
If Not años.Contains(añoInt) Then
|
||||||
|
años.Add(añoInt)
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
años = años.OrderBy(Function(y) y).ToList()
|
||||||
|
|
||||||
|
Dim seriesData As New List(Of Dictionary(Of String, Object))
|
||||||
|
|
||||||
|
For Each año In años
|
||||||
|
' Filtrar datos para este año
|
||||||
|
Dim añoData = dt.AsEnumerable() _
|
||||||
|
.Where(Function(r) Not IsDBNull(r("Año")) AndAlso
|
||||||
|
Integer.TryParse(r("Año").ToString(), Nothing) AndAlso
|
||||||
|
Convert.ToInt32(r("Año")) = año) _
|
||||||
|
.FirstOrDefault()
|
||||||
|
|
||||||
|
If añoData IsNot Nothing Then
|
||||||
|
Dim dataPoints As New List(Of Object())
|
||||||
|
|
||||||
|
' Obtener valores para cada mes
|
||||||
|
For i = 0 To mesesOrdenados.Count - 1
|
||||||
|
Dim mes = mesesOrdenados(i)
|
||||||
|
If dt.Columns.Contains(mes) Then
|
||||||
|
Dim valor As Decimal = 0D
|
||||||
|
If Not IsDBNull(añoData(mes)) Then
|
||||||
|
' Conversión segura a decimal
|
||||||
|
Decimal.TryParse(añoData(mes).ToString(), valor)
|
||||||
|
End If
|
||||||
|
dataPoints.Add({i, valor})
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
|
||||||
|
seriesData.Add(New Dictionary(Of String, Object) From {
|
||||||
|
{"name", año.ToString},
|
||||||
|
{"data", dataPoints},
|
||||||
|
{"color", GetColorForYear(años.IndexOf(año))}
|
||||||
|
})
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
|
||||||
|
' Configuración de la gráfica (igual que la de ventas)
|
||||||
|
Dim chartOptions = New With {
|
||||||
|
.chart = New With {.type = "line"},
|
||||||
|
.title = New With {.text = "CxC Mensual"},
|
||||||
|
.xAxis = New With {
|
||||||
|
.type = "category",
|
||||||
|
.categories = mesesOrdenados,
|
||||||
|
.title = New With {.text = "Mes"}
|
||||||
|
},
|
||||||
|
.yAxis = New With {
|
||||||
|
.title = New With {.text = "Monto CxC (MXN)"},
|
||||||
|
.labels = New With {.format = "${value:,.0f}"}
|
||||||
|
},
|
||||||
|
.tooltip = New With {
|
||||||
|
.headerFormat = "<b>{series.name}</b><br/>",
|
||||||
|
.pointFormat = "Mes: <b>{point.category}</b><br/>CxC: <b>${point.y:,.2f} MXN</b>"
|
||||||
|
},
|
||||||
|
.plotOptions = New With {
|
||||||
|
.line = New With {
|
||||||
|
.dataLabels = New With {.enabled = False},
|
||||||
|
.enableMouseTracking = True
|
||||||
|
}
|
||||||
|
},
|
||||||
|
.series = seriesData
|
||||||
|
}
|
||||||
|
|
||||||
|
Dim script = $"
|
||||||
|
Highcharts.chart('divCxCMensual', {JsonConvert.SerializeObject(chartOptions)});
|
||||||
|
"
|
||||||
|
ScriptManager.RegisterStartupScript(Me, Me.GetType(), "graficaCxC", script, True)
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub CargarRecuperacionPorSucursal(dt As DataTable)
|
||||||
|
If dt Is Nothing OrElse dt.Rows.Count = 0 Then
|
||||||
|
Return
|
||||||
|
End If
|
||||||
|
|
||||||
|
' Renombrar columna para mejor presentación
|
||||||
|
If dt.Columns.Contains("P. Días recuperodo vencidos") Then
|
||||||
|
dt.Columns("P. Días recuperodo vencidos").ColumnName = "PromedioDiasRecuperacion"
|
||||||
|
End If
|
||||||
|
|
||||||
|
gvRecuperacionPorSucursal.DataSource = dt
|
||||||
|
gvRecuperacionPorSucursal.DataBind()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub CargarRecuperacionPorCliente(dt As DataTable)
|
||||||
|
If dt Is Nothing OrElse dt.Rows.Count = 0 Then
|
||||||
|
Return
|
||||||
|
End If
|
||||||
|
|
||||||
|
' Crear DataTable con estructura necesaria
|
||||||
|
Dim dtGrid = New DataTable()
|
||||||
|
dtGrid.Columns.Add("Cliente", GetType(String))
|
||||||
|
dtGrid.Columns.Add("Recuperado", GetType(Decimal))
|
||||||
|
dtGrid.Columns.Add("PromedioDiasRecuperacion", GetType(Decimal))
|
||||||
|
|
||||||
|
For Each row As DataRow In dt.Rows
|
||||||
|
dtGrid.Rows.Add(
|
||||||
|
row("Nombre").ToString(), ' Asegurar que la columna se llama "Nombre"
|
||||||
|
Convert.ToDecimal(If(IsDBNull(row("Recuperado")), 0D, row("Recuperado"))),
|
||||||
|
Convert.ToDecimal(If(IsDBNull(row("P. Días recuperodo vencidos")), 0D, row("P. Días recuperodo vencidos")))
|
||||||
|
)
|
||||||
|
Next
|
||||||
|
|
||||||
|
gvRecuperacionPorCliente.DataSource = dtGrid
|
||||||
|
gvRecuperacionPorCliente.DataBind()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub CargarComprasPorClasificacion(dt As DataTable)
|
||||||
|
If dt Is Nothing OrElse dt.Rows.Count = 0 Then
|
||||||
|
Return
|
||||||
|
End If
|
||||||
|
|
||||||
|
gvComprasPorClasificacion.DataSource = dt
|
||||||
|
gvComprasPorClasificacion.DataBind()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub CargarComprasPorMarca(dt As DataTable)
|
||||||
|
If dt Is Nothing OrElse dt.Rows.Count = 0 Then
|
||||||
|
Return
|
||||||
|
End If
|
||||||
|
|
||||||
|
gvComprasPorMarca.DataSource = dt
|
||||||
|
gvComprasPorMarca.DataBind()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub CargarComprasPorPS(dt As DataTable)
|
||||||
|
If dt Is Nothing OrElse dt.Rows.Count = 0 Then
|
||||||
|
Return
|
||||||
|
End If
|
||||||
|
|
||||||
|
gvComprasPorPS.DataSource = dt
|
||||||
|
gvComprasPorPS.DataBind()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub CargarComprasPorProveedor(dt As DataTable)
|
||||||
|
If dt Is Nothing OrElse dt.Rows.Count = 0 Then
|
||||||
|
Return
|
||||||
|
End If
|
||||||
|
|
||||||
|
gvComprasPorProveedor.DataSource = dt
|
||||||
|
gvComprasPorProveedor.DataBind()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
' Métodos para cargar los GridViews
|
||||||
|
Private Sub CargarCxPPorSucursal(dt As DataTable)
|
||||||
|
If dt Is Nothing OrElse dt.Rows.Count = 0 Then Return
|
||||||
|
|
||||||
|
' Crear un nuevo DataTable con las columnas necesarias
|
||||||
|
Dim dtGrid = New DataTable()
|
||||||
|
dtGrid.Columns.Add("Sucursal", GetType(String))
|
||||||
|
dtGrid.Columns.Add("Vencido", GetType(Decimal))
|
||||||
|
dtGrid.Columns.Add("PorVencer", GetType(Decimal))
|
||||||
|
dtGrid.Columns.Add("Total", GetType(Decimal)) ' Columna Total requerida
|
||||||
|
|
||||||
|
' Copiar datos y calcular Total
|
||||||
|
For Each row As DataRow In dt.Rows
|
||||||
|
Dim vencido = Convert.ToDecimal(If(IsDBNull(row("Vencido")), 0D, row("Vencido")))
|
||||||
|
Dim porVencer = Convert.ToDecimal(If(IsDBNull(row("Por Vencer")) OrElse Not dt.Columns.Contains("Por Vencer"), 0D, row("Por Vencer")))
|
||||||
|
Dim total = vencido + porVencer
|
||||||
|
|
||||||
|
dtGrid.Rows.Add(
|
||||||
|
row("Sucursal").ToString(),
|
||||||
|
vencido,
|
||||||
|
porVencer,
|
||||||
|
total
|
||||||
|
)
|
||||||
|
Next
|
||||||
|
|
||||||
|
gvCxPPorSucursal.DataSource = dtGrid
|
||||||
|
gvCxPPorSucursal.DataBind()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub CargarCxPPorProveedor(dt As DataTable)
|
||||||
|
If dt Is Nothing OrElse dt.Rows.Count = 0 Then Return
|
||||||
|
|
||||||
|
' Crear un nuevo DataTable con las columnas necesarias
|
||||||
|
Dim dtGrid = New DataTable()
|
||||||
|
dtGrid.Columns.Add("RazonSocial", GetType(String))
|
||||||
|
dtGrid.Columns.Add("Vencido", GetType(Decimal))
|
||||||
|
dtGrid.Columns.Add("PorVencer", GetType(Decimal))
|
||||||
|
dtGrid.Columns.Add("Total", GetType(Decimal)) ' Columna Total requerida
|
||||||
|
|
||||||
|
' Copiar datos y calcular Total
|
||||||
|
For Each row As DataRow In dt.Rows
|
||||||
|
Dim vencido = Convert.ToDecimal(If(IsDBNull(row("Vencido")), 0D, row("Vencido")))
|
||||||
|
Dim porVencer = Convert.ToDecimal(If(IsDBNull(row("Por Vencer")) OrElse Not dt.Columns.Contains("Por Vencer"), 0D, row("Por Vencer")))
|
||||||
|
Dim total = vencido + porVencer
|
||||||
|
|
||||||
|
dtGrid.Rows.Add(
|
||||||
|
row("RazonSocial").ToString(),
|
||||||
|
vencido,
|
||||||
|
porVencer,
|
||||||
|
total
|
||||||
|
)
|
||||||
|
Next
|
||||||
|
|
||||||
|
gvCxPPorProveedor.DataSource = dtGrid
|
||||||
|
gvCxPPorProveedor.DataBind()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub CargarPagosPorSucursal(dt As DataTable)
|
||||||
|
If dt Is Nothing OrElse dt.Rows.Count = 0 Then Return
|
||||||
|
|
||||||
|
' Crear nuevo DataTable con nombres de columnas consistentes
|
||||||
|
Dim dtGrid = New DataTable()
|
||||||
|
dtGrid.Columns.Add("Sucursal", GetType(String))
|
||||||
|
dtGrid.Columns.Add("Recuperado", GetType(Decimal))
|
||||||
|
dtGrid.Columns.Add("PromedioDias", GetType(Decimal))
|
||||||
|
|
||||||
|
For Each row As DataRow In dt.Rows
|
||||||
|
dtGrid.Rows.Add(
|
||||||
|
row("Sucursal").ToString(),
|
||||||
|
Convert.ToDecimal(If(IsDBNull(row("Recuperado")), 0D, row("Recuperado"))),
|
||||||
|
Convert.ToDecimal(If(IsDBNull(row("P. Días recuperodo vencidos")), 0D, row("P. Días recuperodo vencidos")))
|
||||||
|
)
|
||||||
|
Next
|
||||||
|
|
||||||
|
gvPagosPorSucursal.DataSource = dtGrid
|
||||||
|
gvPagosPorSucursal.DataBind()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub CargarPagosPorProveedor(dt As DataTable)
|
||||||
|
If dt Is Nothing OrElse dt.Rows.Count = 0 Then Return
|
||||||
|
|
||||||
|
' Crear nuevo DataTable con nombres de columnas consistentes
|
||||||
|
Dim dtGrid = New DataTable()
|
||||||
|
dtGrid.Columns.Add("RazonSocial", GetType(String))
|
||||||
|
dtGrid.Columns.Add("Recuperado", GetType(Decimal))
|
||||||
|
dtGrid.Columns.Add("PromedioDias", GetType(Decimal))
|
||||||
|
|
||||||
|
For Each row As DataRow In dt.Rows
|
||||||
|
dtGrid.Rows.Add(
|
||||||
|
row("RazonSocial").ToString(),
|
||||||
|
Convert.ToDecimal(If(IsDBNull(row("Recuperado")), 0D, row("Recuperado"))),
|
||||||
|
Convert.ToDecimal(If(IsDBNull(row("P. Días recuperodo vencidos")), 0D, row("P. Días recuperodo vencidos")))
|
||||||
|
)
|
||||||
|
Next
|
||||||
|
|
||||||
|
gvPagosPorProveedor.DataSource = dtGrid
|
||||||
|
gvPagosPorProveedor.DataBind()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub CargarCxPMensual(dt As DataTable)
|
||||||
|
If dt Is Nothing OrElse dt.Rows.Count = 0 Then
|
||||||
|
Return
|
||||||
|
End If
|
||||||
|
|
||||||
|
' Lista de meses en español
|
||||||
|
Dim mesesOrdenados As New List(Of String) From {
|
||||||
|
"Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio",
|
||||||
|
"Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"
|
||||||
|
}
|
||||||
|
|
||||||
|
' Obtener años distintos de forma segura
|
||||||
|
Dim años As New List(Of Integer)
|
||||||
|
For Each row As DataRow In dt.Rows
|
||||||
|
If Not IsDBNull(row("Año")) Then
|
||||||
|
Dim añoValue As String = row("Año").ToString()
|
||||||
|
Dim añoInt As Integer
|
||||||
|
If Integer.TryParse(añoValue, añoInt) Then
|
||||||
|
If Not años.Contains(añoInt) Then
|
||||||
|
años.Add(añoInt)
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
años = años.OrderBy(Function(y) y).ToList()
|
||||||
|
|
||||||
|
Dim seriesData As New List(Of Dictionary(Of String, Object))
|
||||||
|
|
||||||
|
For Each año In años
|
||||||
|
' Filtrar datos para este año
|
||||||
|
Dim añoData = dt.AsEnumerable() _
|
||||||
|
.Where(Function(r) Not IsDBNull(r("Año")) AndAlso
|
||||||
|
Integer.TryParse(r("Año").ToString(), Nothing) AndAlso
|
||||||
|
Convert.ToInt32(r("Año")) = año) _
|
||||||
|
.FirstOrDefault()
|
||||||
|
|
||||||
|
If añoData IsNot Nothing Then
|
||||||
|
Dim dataPoints As New List(Of Object())
|
||||||
|
|
||||||
|
' Obtener valores para cada mes
|
||||||
|
For i = 0 To mesesOrdenados.Count - 1
|
||||||
|
Dim mes = mesesOrdenados(i)
|
||||||
|
If dt.Columns.Contains(mes) Then
|
||||||
|
Dim valor As Decimal = 0D
|
||||||
|
If Not IsDBNull(añoData(mes)) Then
|
||||||
|
' Conversión segura a decimal
|
||||||
|
Decimal.TryParse(añoData(mes).ToString(), valor)
|
||||||
|
End If
|
||||||
|
' Usar el índice del mes (0-11) como posición X
|
||||||
|
dataPoints.Add({i, valor})
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
|
||||||
|
seriesData.Add(New Dictionary(Of String, Object) From {
|
||||||
|
{"name", año.ToString},
|
||||||
|
{"data", dataPoints},
|
||||||
|
{"color", GetColorForYear(años.IndexOf(año))}
|
||||||
|
})
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
|
||||||
|
' Configuración de la gráfica (mismo estilo que CxC)
|
||||||
|
Dim chartOptions = New With {
|
||||||
|
.chart = New With {.type = "line"},
|
||||||
|
.title = New With {.text = "Evolución de Cuentas por Pagar (CxP) Mensual"},
|
||||||
|
.xAxis = New With {
|
||||||
|
.type = "category",
|
||||||
|
.categories = mesesOrdenados,
|
||||||
|
.title = New With {.text = "Mes"}
|
||||||
|
},
|
||||||
|
.yAxis = New With {
|
||||||
|
.title = New With {.text = "Monto CxP (MXN)"},
|
||||||
|
.labels = New With {.format = "${value:,.0f}"}
|
||||||
|
},
|
||||||
|
.tooltip = New With {
|
||||||
|
.headerFormat = "<b>{series.name}</b><br/>",
|
||||||
|
.pointFormat = "Mes: <b>{point.category}</b><br/>CxP: <b>${point.y:,.2f} MXN</b>"
|
||||||
|
},
|
||||||
|
.plotOptions = New With {
|
||||||
|
.line = New With {
|
||||||
|
.dataLabels = New With {.enabled = False},
|
||||||
|
.enableMouseTracking = True
|
||||||
|
}
|
||||||
|
},
|
||||||
|
.series = seriesData
|
||||||
|
}
|
||||||
|
|
||||||
|
Dim script = $"
|
||||||
|
Highcharts.chart('divCxPMensual', {JsonConvert.SerializeObject(chartOptions)});
|
||||||
|
"
|
||||||
|
ScriptManager.RegisterStartupScript(Me, Me.GetType(), "graficaCxP", script, True)
|
||||||
|
End Sub
|
||||||
|
|
||||||
Private Function ObtenerMesesOrdenados() As List(Of String)
|
Private Function ObtenerMesesOrdenados() As List(Of String)
|
||||||
Return CultureInfo.CurrentCulture.DateTimeFormat.MonthNames _
|
Return CultureInfo.CurrentCulture.DateTimeFormat.MonthNames _
|
||||||
@@ -536,4 +1084,38 @@ Partial Class General_Dashboard
|
|||||||
DIV.InnerHtml = htmldiv.ToString
|
DIV.InnerHtml = htmldiv.ToString
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
' Método para mostrar el KPI (Agrégalo en tu clase)
|
||||||
|
Private Sub MuestraIndicadorKPI(DIV As HtmlGenericControl, Color As String, Icono As String, Titulo As String, Valor As String, CL1 As String, Tooltip As String)
|
||||||
|
Dim htmldiv As New StringBuilder
|
||||||
|
|
||||||
|
|
||||||
|
' Estructura del contenedor principal
|
||||||
|
htmldiv.AppendFormat(
|
||||||
|
"{0}<div class='col-lg-6 col-md-4 col-sm-6 col-xs-12'>" &
|
||||||
|
"<div class='dashboard-stat {1}' style='position: relative; height: 147px;'>" & ' Contenedor relativo
|
||||||
|
"<div class='visual'><i class='{2}'></i></div>",
|
||||||
|
DIV.InnerHtml, Color, Icono
|
||||||
|
)
|
||||||
|
|
||||||
|
' Contenido principal
|
||||||
|
htmldiv.Append("<div class='details'>")
|
||||||
|
htmldiv.AppendFormat(
|
||||||
|
"<div class='kpi-titulo'><i class= 'fa fa-refresh fa-spin tooltips' data-original-title='{0}'></i> {1}</div>",
|
||||||
|
Tooltip, Titulo
|
||||||
|
)
|
||||||
|
htmldiv.AppendFormat("<div class='kpi-valor'>{0}</div>", Valor)
|
||||||
|
htmldiv.Append("</div>")
|
||||||
|
|
||||||
|
|
||||||
|
htmldiv.AppendFormat(
|
||||||
|
"<a class='more' href='{0}' style='position: absolute; bottom: 1px; right: 1px;'>" &
|
||||||
|
"Ver Más<span style='margin-left: 307px;'></span><i class='m-icon-swapright m-icon-white'></i></a>",
|
||||||
|
CL1
|
||||||
|
)
|
||||||
|
|
||||||
|
htmldiv.Append("</div></div>") ' Cierre de dashboard-stat y col
|
||||||
|
|
||||||
|
DIV.InnerHtml = htmldiv.ToString
|
||||||
|
End Sub
|
||||||
|
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
@@ -1665,7 +1665,7 @@ Partial Class Inicio
|
|||||||
Dim FechaI As Date = txtFechaInicioSMS.Text.ToDate ' Now.FirstDayOfMonth
|
Dim FechaI As Date = txtFechaInicioSMS.Text.ToDate ' Now.FirstDayOfMonth
|
||||||
Dim FechaF As Date = txtFechaFinSMS.Text.ToDate 'Now.LastDayOfMonth
|
Dim FechaF As Date = txtFechaFinSMS.Text.ToDate 'Now.LastDayOfMonth
|
||||||
|
|
||||||
If Gral.GetSMSIndicadores(Opcion, FechaI, FechaF, UsuarioActual.CveUsuario, CveVendedor, CveGerenteVendedor, CveUsuarioTecnico, UsuarioActual.CveEmpresa) Then
|
If Gral.GetSMSIndicadores(Opcion, FechaI, FechaF, UsuarioActual.CveUsuario, CveVendedor, CveUsuarioTecnico, UsuarioActual.CveEmpresa) Then
|
||||||
ds = Gral.DataSetResultados
|
ds = Gral.DataSetResultados
|
||||||
End If
|
End If
|
||||||
'0-ventas totales, 1-comisiones totales, 2-medicos sin consumo, 3-top10medicos, 4-top5marcas, 5-num pacientes
|
'0-ventas totales, 1-comisiones totales, 2-medicos sin consumo, 3-top10medicos, 4-top5marcas, 5-num pacientes
|
||||||
|
|||||||
56
OP/OP.aspx
56
OP/OP.aspx
@@ -310,18 +310,16 @@
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
/* Alinear celda y contenido a la derecha */
|
/* Alinear celda y contenido a la derecha */
|
||||||
.celda-derecha {
|
.celda-derecha {
|
||||||
text-align: right !important;
|
text-align: right !important;
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
||||||
.txt-merma {
|
|
||||||
/* Ancho reducido al 50% */
|
|
||||||
margin-left: 30px !important; /* Mueve el TextBox a la derecha dentro de la celda */
|
|
||||||
display: block !important; /* Permite que margin-left:auto funcione */
|
|
||||||
/* Alinea el texto interno a la derecha */
|
|
||||||
}
|
|
||||||
|
|
||||||
|
.txt-merma {
|
||||||
|
/* Ancho reducido al 50% */
|
||||||
|
margin-left: 30px !important; /* Mueve el TextBox a la derecha dentro de la celda */
|
||||||
|
display: block !important; /* Permite que margin-left:auto funcione */
|
||||||
|
/* Alinea el texto interno a la derecha */
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
</asp:Content>
|
</asp:Content>
|
||||||
@@ -368,12 +366,12 @@
|
|||||||
<div class="input-group input-sm input-small date date-picker" style="height: 30px;" data-date-format="dd/mm/yyyy">
|
<div class="input-group input-sm input-small date date-picker" style="height: 30px;" data-date-format="dd/mm/yyyy">
|
||||||
<asp:TextBox ID="Txtfecha" runat="server"
|
<asp:TextBox ID="Txtfecha" runat="server"
|
||||||
CssClass="form-control"
|
CssClass="form-control"
|
||||||
style="margin-top: -6px;"
|
Style="margin-top: -6px;"
|
||||||
Width="100%"
|
Width="100%"
|
||||||
CausesValidation="true"
|
CausesValidation="true"
|
||||||
MaxLength="10"></asp:TextBox>
|
MaxLength="10"></asp:TextBox>
|
||||||
<span class="input-group-btn">
|
<span class="input-group-btn">
|
||||||
<asp:LinkButton ID="imgCalendarioF" class="btn default " style="margin-top: -11px; height: 29px;" Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
|
<asp:LinkButton ID="imgCalendarioF" class="btn default " Style="margin-top: -11px; height: 29px;" Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<ajax:MaskedEditExtender ID="MEEFechaF" runat="server" TargetControlID="Txtfecha" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
|
<ajax:MaskedEditExtender ID="MEEFechaF" runat="server" TargetControlID="Txtfecha" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
|
||||||
@@ -471,13 +469,13 @@
|
|||||||
<div class="portlet-body">
|
<div class="portlet-body">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div id="PanelProducto" runat="server">
|
<div id="PanelProducto" runat="server">
|
||||||
<asp:label ID="LblProducto" class="col-md-1" runat="server" style="max-width: 70px;" Text="Producto"></asp:label>
|
<asp:Label ID="LblProducto" class="col-md-1" runat="server" Style="max-width: 70px;" Text="Producto"></asp:Label>
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<ADS:Dropdownlost ID="DdlPS" runat="server" Width="100%" CssStyle="width: 100%;"
|
<ADS:Dropdownlost ID="DdlPS" runat="server" Width="100%" CssStyle="width: 100%;"
|
||||||
CssClass="select2me"
|
CssClass="select2me"
|
||||||
CssClassDdl="form-control" DataTextField="PSCodigo"
|
CssClassDdl="form-control" DataTextField="PSCodigo"
|
||||||
DataValueField="CvePS" Enabled="false" />
|
DataValueField="CvePS" Enabled="false" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4 d-flex align-items-center" style="gap: 10px;">
|
<div class="col-md-4 d-flex align-items-center" style="gap: 10px;">
|
||||||
<asp:LinkButton ID="BtnAgregarProducto" runat="server"
|
<asp:LinkButton ID="BtnAgregarProducto" runat="server"
|
||||||
@@ -852,13 +850,13 @@
|
|||||||
<asp:TextBox ID="TxtCantidadPT" runat="server"
|
<asp:TextBox ID="TxtCantidadPT" runat="server"
|
||||||
Text='<%# Bind("Cantidad") %>'
|
Text='<%# Bind("Cantidad") %>'
|
||||||
CssClass="form-control"
|
CssClass="form-control"
|
||||||
style="text-align: right;"
|
Style="text-align: right;"
|
||||||
TextMode="Number"
|
TextMode="Number"
|
||||||
min="0"
|
min="0"
|
||||||
step="1"
|
step="1"
|
||||||
data-original='<%# Eval("Cantidad") %>'
|
data-original='<%# Eval("Cantidad") %>'
|
||||||
onchange="validarCantidad(this)"
|
onchange="validarCantidad(this)"
|
||||||
ItemStyle-HorizontalAlign="Right"/>
|
ItemStyle-HorizontalAlign="Right" />
|
||||||
</ItemTemplate>
|
</ItemTemplate>
|
||||||
</asp:TemplateField>
|
</asp:TemplateField>
|
||||||
</Columns>
|
</Columns>
|
||||||
@@ -872,18 +870,17 @@
|
|||||||
CssClass="table table-striped table-hover" GridLines="None" Width="100%">
|
CssClass="table table-striped table-hover" GridLines="None" Width="100%">
|
||||||
<Columns>
|
<Columns>
|
||||||
<asp:BoundField DataField="PSCodigo" HeaderText="Producto" />
|
<asp:BoundField DataField="PSCodigo" HeaderText="Producto" />
|
||||||
<asp:BoundField DataField="Cantidad" HeaderText="Cantidad" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right"/>
|
<asp:BoundField DataField="Cantidad" HeaderText="Cantidad" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||||
<asp:TemplateField HeaderText="Devolución">
|
<asp:TemplateField HeaderText="Devolución">
|
||||||
<ItemTemplate>
|
<ItemTemplate>
|
||||||
<asp:TextBox ID="TxtDevolucionMP" runat="server"
|
<asp:TextBox ID="TxtDevolucionMP" runat="server"
|
||||||
Text="0"
|
Text="0"
|
||||||
style="width: 50%; text-align: right; margin-left: 38px; display: block;"
|
Style="width: 50%; text-align: right; margin-left: 38px; display: block;"
|
||||||
TextMode="Number"
|
TextMode="Number"
|
||||||
min="0"
|
min="0"
|
||||||
step="1"
|
step="1"
|
||||||
data-original='<%# Eval("Cantidad") %>'
|
data-original='<%# Eval("Cantidad") %>'
|
||||||
onchange="validarCantidad(this)"
|
onchange="validarCantidad(this)" />
|
||||||
/>
|
|
||||||
</ItemTemplate>
|
</ItemTemplate>
|
||||||
|
|
||||||
</asp:TemplateField>
|
</asp:TemplateField>
|
||||||
@@ -947,15 +944,14 @@
|
|||||||
<ItemTemplate>
|
<ItemTemplate>
|
||||||
<asp:TextBox ID="TxtMerma" runat="server" Text="0"
|
<asp:TextBox ID="TxtMerma" runat="server" Text="0"
|
||||||
CssClass="txt-merma" TextMode="Number" step="0.01" min="0"
|
CssClass="txt-merma" TextMode="Number" step="0.01" min="0"
|
||||||
style="width: 50%; text-align: right;"
|
Style="width: 50%; text-align: right;"
|
||||||
onchange="calcularDevolucion(this);"
|
onchange="calcularDevolucion(this);"
|
||||||
data-original='<%# Eval("Cantidad")%>'
|
data-original='<%# Eval("Cantidad")%>' />
|
||||||
/>
|
|
||||||
</ItemTemplate>
|
</ItemTemplate>
|
||||||
</asp:TemplateField>
|
</asp:TemplateField>
|
||||||
<asp:TemplateField HeaderText="Devolución" ItemStyle-CssClass="celda-derecha">
|
<asp:TemplateField HeaderText="Devolución" ItemStyle-CssClass="celda-derecha">
|
||||||
<ItemTemplate>
|
<ItemTemplate>
|
||||||
<asp:Label ID="LblDevolucion" runat="server" Text='<%# Eval("Cantidad", "{0:N2}") %>' CssClass="devolucion-label" style="text-align: right;"/>
|
<asp:Label ID="LblDevolucion" runat="server" Text='<%# Eval("Cantidad", "{0:N2}") %>' CssClass="devolucion-label" Style="text-align: right;" />
|
||||||
<asp:HiddenField ID="HfDevolucion" runat="server" Value='<%# Eval("Cantidad", "{0:N2}") %>' />
|
<asp:HiddenField ID="HfDevolucion" runat="server" Value='<%# Eval("Cantidad", "{0:N2}") %>' />
|
||||||
</ItemTemplate>
|
</ItemTemplate>
|
||||||
</asp:TemplateField>
|
</asp:TemplateField>
|
||||||
|
|||||||
@@ -125,6 +125,7 @@ Partial Class OP_OP
|
|||||||
BtnCancelarOP.Visible = (CveOP > 0 AndAlso TipoEstatus <> 3 AndAlso TipoEstatus <> 4)
|
BtnCancelarOP.Visible = (CveOP > 0 AndAlso TipoEstatus <> 3 AndAlso TipoEstatus <> 4)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
#Region "Metodos"
|
||||||
Private Sub CreaPS()
|
Private Sub CreaPS()
|
||||||
DtPS = New DataTable()
|
DtPS = New DataTable()
|
||||||
DtPS.Columns.Add("Tipo", GetType(String)) ' Producto, MP, MO, CI
|
DtPS.Columns.Add("Tipo", GetType(String)) ' Producto, MP, MO, CI
|
||||||
@@ -247,7 +248,9 @@ Partial Class OP_OP
|
|||||||
UpBtns.Update()
|
UpBtns.Update()
|
||||||
UpModalCancelar.Update()
|
UpModalCancelar.Update()
|
||||||
End Sub
|
End Sub
|
||||||
|
#End Region
|
||||||
|
|
||||||
|
#Region "Cargar"
|
||||||
Private Sub CargaDatos()
|
Private Sub CargaDatos()
|
||||||
If CveOP > 0 Then
|
If CveOP > 0 Then
|
||||||
Dim ObjOP As New ClsOP()
|
Dim ObjOP As New ClsOP()
|
||||||
@@ -367,7 +370,9 @@ Partial Class OP_OP
|
|||||||
DdlPS.ddl.Items.Insert(0, New ListItem("Seleccione el Producto", "-1"))
|
DdlPS.ddl.Items.Insert(0, New ListItem("Seleccione el Producto", "-1"))
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
#End Region
|
||||||
|
|
||||||
|
#Region "Producto"
|
||||||
Protected Sub BtnAgregarProducto_Click(sender As Object, e As EventArgs) Handles BtnAgregarProducto.Click
|
Protected Sub BtnAgregarProducto_Click(sender As Object, e As EventArgs) Handles BtnAgregarProducto.Click
|
||||||
If DdlPS.SelectedValue = "-1" Then Exit Sub
|
If DdlPS.SelectedValue = "-1" Then Exit Sub
|
||||||
|
|
||||||
@@ -480,33 +485,16 @@ Partial Class OP_OP
|
|||||||
Next
|
Next
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
Protected Sub GvProductos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvProductos.RowDataBound
|
Protected Sub GvProductos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvProductos.RowDataBound
|
||||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||||
Dim btnEliminar As LinkButton = DirectCast(e.Row.FindControl("BtnEliminar"), LinkButton)
|
Dim btnEliminar As LinkButton = DirectCast(e.Row.FindControl("BtnEliminar"), LinkButton)
|
||||||
btnEliminar.Visible = (TipoEstatus <> 3)
|
btnEliminar.Visible = (TipoEstatus <> 3)
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
#End Region
|
||||||
|
|
||||||
Protected Sub LnkSolicitarMP_Click(sender As Object, e As EventArgs)
|
#Region "Simular MP"
|
||||||
' Cargar almacenes
|
|
||||||
DdlAlmacenOrigenMP.DataSource = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltraParametros("CveTipoAlmacen = 1")
|
|
||||||
DdlAlmacenOrigenMP.DataBind()
|
|
||||||
DdlAlmacenDestinoMP.DataSource = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltraParametros("CveTipoAlmacen = 28")
|
|
||||||
DdlAlmacenDestinoMP.DataBind()
|
|
||||||
|
|
||||||
GvMPAgregados.DataKeyNames = New String() {"CvePSMateriaPrima", "CveUMMateriaPrima"}
|
|
||||||
|
|
||||||
' Filtrar MP no surtida
|
|
||||||
Dim DtMPFaltante As DataTable = DtMP.FiltraParametros("Surtido = 0").Copy()
|
|
||||||
GvMPAgregados.DataSource = DtMPFaltante
|
|
||||||
GvMPAgregados.DataBind()
|
|
||||||
|
|
||||||
|
|
||||||
' Mostrar modal
|
|
||||||
RegistraScript("$('#DVModalSolicitarMP').modal('show');")
|
|
||||||
UpModalMP.Update()
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Protected Sub BtnSimularMP_Click(sender As Object, e As EventArgs)
|
Protected Sub BtnSimularMP_Click(sender As Object, e As EventArgs)
|
||||||
If CveOP <> -1 Then Exit Sub
|
If CveOP <> -1 Then Exit Sub
|
||||||
If DdlPS.SelectedValue = "-1" Then Exit Sub
|
If DdlPS.SelectedValue = "-1" Then Exit Sub
|
||||||
@@ -664,7 +652,28 @@ Partial Class OP_OP
|
|||||||
|
|
||||||
Return ObjOP.DtResultados.Copy()
|
Return ObjOP.DtResultados.Copy()
|
||||||
End Function
|
End Function
|
||||||
|
#End Region
|
||||||
|
|
||||||
|
#Region "Solicitar MP"
|
||||||
|
Protected Sub LnkSolicitarMP_Click(sender As Object, e As EventArgs)
|
||||||
|
' Cargar almacenes
|
||||||
|
DdlAlmacenOrigenMP.DataSource = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltraParametros("CveTipoAlmacen = 1")
|
||||||
|
DdlAlmacenOrigenMP.DataBind()
|
||||||
|
DdlAlmacenDestinoMP.DataSource = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltraParametros("CveTipoAlmacen = 28")
|
||||||
|
DdlAlmacenDestinoMP.DataBind()
|
||||||
|
|
||||||
|
GvMPAgregados.DataKeyNames = New String() {"CvePSMateriaPrima", "CveUMMateriaPrima"}
|
||||||
|
|
||||||
|
' Filtrar MP no surtida
|
||||||
|
Dim DtMPFaltante As DataTable = DtMP.FiltraParametros("Surtido = 0").Copy()
|
||||||
|
GvMPAgregados.DataSource = DtMPFaltante
|
||||||
|
GvMPAgregados.DataBind()
|
||||||
|
|
||||||
|
|
||||||
|
' Mostrar modal
|
||||||
|
RegistraScript("$('#DVModalSolicitarMP').modal('show');")
|
||||||
|
UpModalMP.Update()
|
||||||
|
End Sub
|
||||||
Protected Sub BtnGuardarSolicitudMP_Click(sender As Object, e As EventArgs)
|
Protected Sub BtnGuardarSolicitudMP_Click(sender As Object, e As EventArgs)
|
||||||
|
|
||||||
Dim CveTraspasoSolicitud As Integer = -1
|
Dim CveTraspasoSolicitud As Integer = -1
|
||||||
@@ -772,6 +781,9 @@ Partial Class OP_OP
|
|||||||
ObjInventario.Dispose()
|
ObjInventario.Dispose()
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
#End Region
|
||||||
|
|
||||||
|
#Region "Guardar OP"
|
||||||
|
|
||||||
Protected Sub BtnGuardarOP_Click(sender As Object, e As EventArgs)
|
Protected Sub BtnGuardarOP_Click(sender As Object, e As EventArgs)
|
||||||
' Validaciones básicas
|
' Validaciones básicas
|
||||||
@@ -930,6 +942,8 @@ Partial Class OP_OP
|
|||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
#End Region
|
||||||
|
|
||||||
#Region "Cancelar"
|
#Region "Cancelar"
|
||||||
Protected Sub BtnCancelarOP_Click(sender As Object, e As EventArgs)
|
Protected Sub BtnCancelarOP_Click(sender As Object, e As EventArgs)
|
||||||
' Cargar almacenes
|
' Cargar almacenes
|
||||||
|
|||||||
Reference in New Issue
Block a user