diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index 6d7ecde0c..3a08f1200 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -7697,7 +7697,7 @@ Public Class ClsVentas End Function - Public Function GetSMSIndicadores(Opcion As Integer, FechaInicio As Date, FechaFin As Date, CveUsuario 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 DataAdapter("PA_SMS_IndicadoresGet") With SqlAdapter.SelectCommand.Parameters @@ -7705,6 +7705,8 @@ Public Class ClsVentas .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio .Add("@FechaFin", SqlDbType.Date).Value = FechaFin .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveVendedor", SqlDbType.Int).Value = CveVendedor + .Add("@CveUsuarioTecnico", SqlDbType.Int).Value = CveUsuarioTecnico .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa End With Try diff --git a/Ashx/E140.ashx b/Ashx/E140.ashx index 1ad9449bc..2445fbc2c 100644 --- a/Ashx/E140.ashx +++ b/Ashx/E140.ashx @@ -132,7 +132,8 @@ Public Class E140 : Implements IHttpHandler, IRequiresSessionState Dim data As New JArray Dim dtt As New DataTable Dim ObjVentas As New ClsVentas - If ObjVentas.GetRepRemisionesSinFacturar(Now.AddYears(-2).ToShortDateString, Now.ToShortDateString, Now.ToShortDateString, CveSubProyecto, -1, -1, "-1", CveEmpresa, CveUsuarioConsulta:=100, PrimerProducto:=True) Then + Dim FechaInicio As String = Now.AddYears(-2).ToShortDateString + If ObjVentas.GetRepRemisionesSinFacturar(FechaInicio, Now.AddDays(1).ToShortDateString, Now.AddDays(1).ToShortDateString, CveSubProyecto, -1, -1, "-1", CveEmpresa, CveUsuarioConsulta:=100, PrimerProducto:=True) Then dtt = ObjVentas.DtResultados.FiltraParametros("CveVenta > 0") End If ObjVentas.Dispose() @@ -296,6 +297,7 @@ Public Class E140 : Implements IHttpHandler, IRequiresSessionState End If Else TieneError = True + MsgError = "Falta información para completar la venta." End If End If If Not TieneError Then diff --git a/Compras/Compras.aspx b/Compras/Compras.aspx index 35f1ec5fc..034b3d77b 100644 --- a/Compras/Compras.aspx +++ b/Compras/Compras.aspx @@ -1363,7 +1363,7 @@ <%--4--%> - + <%--5--%> diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index ffac55d18..6ed284990 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -17545,7 +17545,7 @@ Partial Class Compras_Compras End If If TxtDescuento.Text.ToDouble > 0 Then TrDescuento.Visible = True - If ActualizaTotales And UsuarioActual.CveEmpresa = 72 Or Not CveCompraFactura > 0 Then + If ActualizaTotales And (UsuarioActual.CveEmpresa = 72 Or Not CveCompraFactura > 0) Then TxtTotal.Text = Total.ToString.FormatoNumero() If CveCompra > 0 AndAlso CveCompraFactura = 0 Then TxtIVA.Text = IVA.ToString.FormatoNumero() diff --git a/Compras/eFacturas.aspx.vb b/Compras/eFacturas.aspx.vb index 95591bce5..58af0d5ec 100644 --- a/Compras/eFacturas.aspx.vb +++ b/Compras/eFacturas.aspx.vb @@ -1168,7 +1168,7 @@ Partial Class Compras_eFacturas 'End If Dim Funcionalidad123 As Integer = UsuarioActual.Empresa.Funcionalidad(123).ToEntero - If Funcionalidad123 > 0 Then + If Funcionalidad123 > 0 AndAlso Not e.Row.DataKey("CveFactura").ToEntero.Contiene(1223188) Then If NowADS().Day >= Funcionalidad123 Then Dim FechaLimite As Date = New Date(NowADS().Year, NowADS().Month, 1) If e.Row.DBCampo("FechaFactura").ToDate < FechaLimite Then diff --git a/Contabilidad/DiarioPagos.aspx b/Contabilidad/DiarioPagos.aspx index df56da6ec..640fd5901 100644 --- a/Contabilidad/DiarioPagos.aspx +++ b/Contabilidad/DiarioPagos.aspx @@ -1,4 +1,4 @@ -<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="DiarioPagos.aspx.vb" Inherits="Contabilidad_DiarioPagos" %> +<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="DiarioPagos.aspx.vb" Inherits="Contabilidad_DiarioPagos" ValidateRequest="false" %> <%@ Import Namespace="Extensiones" %> diff --git a/Contabilidad/RegPrePolizaS.aspx.vb b/Contabilidad/RegPrePolizaS.aspx.vb index caf9c6f53..3df41ca1e 100644 --- a/Contabilidad/RegPrePolizaS.aspx.vb +++ b/Contabilidad/RegPrePolizaS.aspx.vb @@ -1561,7 +1561,7 @@ Partial Class ContabilidadC_RegPrePolizaS DdlProveedoresE.Items.Insert(0, New ListItem(" - ", "-1")) End Sub Private Sub CargaComprasE(CveProveedor As Integer, Optional tCveCompra As Integer = -1) - If DdlConceptosContablesE.SelectedValue.ToEntero.Contiene(5, 17, 305, 308, 310, 311, 312) Then + If DdlConceptosContablesE.SelectedValue.ToEntero.Contiene(5, 6, 17, 305, 308, 310, 311, 312) Then Dim ObjCompras As New ClsCompras DdlComprasE.ClearSelection() diff --git a/Empresas/153/Formatos/Cotizacion.rdlc b/Empresas/153/Formatos/Cotizacion.rdlc index 6a5cf12c3..47c8076a7 100644 --- a/Empresas/153/Formatos/Cotizacion.rdlc +++ b/Empresas/153/Formatos/Cotizacion.rdlc @@ -1217,8 +1217,8 @@ - CAMELIA No.Ext: 619, Col: Libertad, -CP: 83130, Hermosillo,Sonora, México + SIMON BLEY No.Ext: 355, No.Int: A, Col: Olivares, +CP: 83180, Hermosillo,Sonora, México - - - - - - @@ -498,7 +519,7 @@ - +

@@ -506,10 +527,10 @@
Indicador - - - - + + + +
@@ -527,10 +548,33 @@

-
-
-
-
+
+ + +
+
Opción:
+
+ + + + + + + +
+
+ + + + +
+
+
+
+
+ + +

diff --git a/Inicio.aspx.vb b/Inicio.aspx.vb index ee937827d..89c36d9d4 100644 --- a/Inicio.aspx.vb +++ b/Inicio.aspx.vb @@ -4,7 +4,6 @@ Imports System.Web.Services Imports Newtonsoft.Json Imports ADSNetLibrary.SIGAPI.Models.CRM.Request Imports ADSNetLibrary.SIGAPI.Services.CRM -Imports ADSNetLibrary.SIGAPI.Models.CRM.Response Partial Class Inicio Inherits ClsPaginas @@ -191,8 +190,18 @@ Partial Class Inicio If UsuarioActual.TienePermisoProceso(343) Then MuestraPsProximosAVencer() If UsuarioActual.TienePermisoProceso(344) Then MuestraRSCOProximosAVencer() - If UsuarioActual.Empresa.Funcionalidad(578) = "1" AndAlso UsuarioActual.CveRol.Contiene(1577, 1639, 1573) Then - CargaKPICirugias() + If UsuarioActual.Empresa.Funcionalidad(578) = "1" AndAlso UsuarioActual.CveUsuario = 3964 Then 'AndAlso UsuarioActual.CveRol.Contiene(1577, 1639, 1573) Then + Dim Opcion As Integer = 1 + Dim CveVendedor As Integer = -1 + Dim CveUsuarioTecnico As Integer = -1 + divsms1.Visible = True + If UsuarioActual.CveRol = 1577 Then + Opcion = 1 'vendedor + CveVendedor = UsuarioActual.CveVendedor + ElseIf UsuarioActual.CveRol.Contiene(1639, 1573) Then ' rol admin. 1573 + Opcion = 2 'gerente ventas + End If + CargaKPICirugias(Opcion, CveVendedor, CveUsuarioTecnico) End If If (UsuarioActual.CveRol = 1062) Or (UsuarioActual.CveUsuario = 100) Then @@ -1613,26 +1622,18 @@ Partial Class Inicio #Region "S M S - I N D I C A D O R E S" - Private Sub CargaKPICirugias() + Private Sub CargaKPICirugias(Opcion As Integer, Optional CveVendedor As Integer = -1, Optional CveUsuarioTecnico As Integer = -1) DivIndicadores.InnerHtml = "" - Dim Opcion As Integer = 1 Dim dtIndicadores As DataTable = Nothing Dim dtRH As DataTable = Nothing Dim Gral As New ClsVentas Dim ds As DataSet = Nothing - - If UsuarioActual.CveRol = 1577 Then - Opcion = 1 'vendedor - ElseIf UsuarioActual.CveRol.Contiene(1639, 1573) Then ' rol admin. 1573 - Opcion = 2 'gerente ventas - End If - Dim FechaI As Date = Now.FirstDayOfMonth Dim FechaF As Date = Now.LastDayOfMonth - If Gral.GetSMSIndicadores(Opcion, FechaI, FechaF, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then + If Gral.GetSMSIndicadores(Opcion, FechaI, FechaF, UsuarioActual.CveUsuario, CveVendedor, CveUsuarioTecnico, UsuarioActual.CveEmpresa) Then ds = Gral.DataSetResultados End If '0-ventas totales, 1-comisiones totales, 2-medicos sin consumo, 3-top10medicos, 4-top5marcas, 5-num pacientes @@ -1640,64 +1641,70 @@ Partial Class Inicio Dim StrTexto As New StringBuilder Dim StrSource As New StringBuilder Dim ComisionVendedor, ComisionTecnico, VentasTotales As Decimal - Dim TextoKPIVendedores As String + Dim NumPacientes As Integer = 0 + Dim TextoKPIVendedores As String = "" Dim dtt As DataTable - If Opcion = 1 Then + If ds IsNot Nothing AndAlso ds.Tables.Count > 0 Then + If Opcion = 1 Then #Region "VENDEDORES" - dtt = ds.Tables(0) - If dtt IsNot Nothing Then - VentasTotales = dtt.FiltroPrimeroValor("Importe").ToDecimal - End If - dtt = ds.Tables(1) - If dtt IsNot Nothing Then - ComisionVendedor = dtt.FiltroPrimeroValor("ComisionVendedor").ToDecimal - ComisionTecnico = dtt.FiltroPrimeroValor("ComisionTecnico").ToDecimal - End If + dtt = ds.Tables(0) + If dtt IsNot Nothing Then + VentasTotales = dtt.FiltroPrimeroValor("Importe").ToDecimal + End If + dtt = ds.Tables(1) + If dtt IsNot Nothing Then + ComisionVendedor = dtt.FiltroPrimeroValor("ComisionVendedor").ToDecimal + ComisionTecnico = dtt.FiltroPrimeroValor("ComisionTecnico").ToDecimal + End If - dtt = ds.Tables(2) - 'médicos sin consumo - If dtt IsNot Nothing AndAlso dtt.Rows.Count > 0 Then + dtt = ds.Tables(2) + 'médicos sin consumo + If dtt IsNot Nothing AndAlso dtt.Rows.Count > 0 Then - For Each dr As DataRow In dtt.Rows - StrTexto.AppendFormat("['{0}'],", dr("NombreMedico")) - Next - StrTexto.Length -= 1 - StrSource.Append("{id:'dtmedsinconsumo',type:'JSON',options:{firstRowAsNames:false,columnNames:['Medico'],data:[") - StrSource.Append(StrTexto.ToString) - StrSource.Append("]}}") + For Each dr As DataRow In dtt.Rows + StrTexto.AppendFormat("['{0}'],", dr("NombreMedico")) + Next + StrTexto.Length -= 1 + StrSource.Append("{id:'dtmedsinconsumo',type:'JSON',options:{firstRowAsNames:false,columnNames:['Medico'],data:[") + StrSource.Append(StrTexto.ToString) + StrSource.Append("]}}") - End If - 'top 10 medicos - dtt = ds.Tables(3) - StrTexto.Clear() - If dtt IsNot Nothing AndAlso dtt.Rows.Count > 0 Then - For Each dr As DataRow In dtt.FiltraParametros("Importe > 0").Rows - StrTexto.AppendFormat("['{0}',{1}],", dr("Medico"), dr("Importe")) - Next - StrTexto.Length -= 1 - StrSource.Append(",{id:'dtmedtop10',type:'JSON',options:{firstRowAsNames:false,columnNames:['Medico','Importe'],data:[") - StrSource.Append(StrTexto.ToString) - StrSource.Append("]}}") - End If - 'top 5 marcas - dtt = ds.Tables(4) - StrTexto.Clear() - 'top 5 marcas - If dtt IsNot Nothing AndAlso dtt.Rows.Count > 0 Then - For Each dr As DataRow In dtt.FiltraParametros("Importe > 0").Rows - StrTexto.AppendFormat("['{0}',{1}],", dr("Marca"), dr("Importe")) - Next - StrTexto.Length -= 1 - StrSource.Append(",{id:'dttop5marcas',type:'JSON',options:{firstRowAsNames:false,columnNames:['Marca','Importe'],data:[") - StrSource.Append(StrTexto.ToString) - StrSource.Append("]}}") - End If - 'Dim TextoKPIVendedores As String = "Highcharts.setOptions({chart:{styledMode:true}});Dashboards.board('divsmsdash',{dataPool:{connectors:[{id:'micro-element',type:'JSON',options:{firstRowAsNames:false,columnNames:['Food','Vitamin A','Iron'],data:[['Beef Liver',6421,6.5],['Lamb Liver',2122,6.5],['Cod Liver Oil',1350,0.9],['Mackerel',388,1],['Tuna',214,0.6]]}}]},editMode:{enabled:true,contextMenu:{enabled:true}},components:[{type:'KPI',renderTo:'kpi-vitamin-a',value:900,valueFormat:'{value}',title:'Vitamin A',subtitle:'daily recommended dose'},{type:'KPI',renderTo:'kpi-iron',value:8,title:'Iron',valueFormat:'{value}',subtitle:'daily recommended dose'},{sync:{visibility:true,highlight:true,extremes:true},connector:{id:'micro-element',columnAssignment:[{seriesId:'Vitamin A',data:['Food','Vitamin A']}]},renderTo:'dashboard-col-0',type:'Highcharts',chartOptions:{xAxis:{type:'category',accessibility:{description:'Groceries'}},yAxis:{title:{text:'mcg'},plotLines:[{value:900,zIndex:7,dashStyle:'shortDash',label:{text:'RDA',align:'right',style:{color:'#B73C28'}}}]},credits:{enabled:false},plotOptions:{series:{marker:{radius:6}}},legend:{enabled:true,verticalAlign:'top'},chart:{animation:false,type:'column',spacing:[30,30,30,20]},title:{text:''},tooltip:{valueSuffix:' mcg',stickOnContact:true},lang:{accessibility:{chartContainerLabel:'Vitamin A in food. Highcharts Interactive Chart.'}},accessibility:{description:'The chart is displaying the Vitamin A amount in micrograms for some groceries. There is a plotLine demonstrating the daily Recommended Dietary Allowance (RDA) of 900 micrograms.',point:{valueSuffix:' mcg'}}}},{renderTo:'dashboard-col-1',sync:{visibility:true,highlight:true,extremes:true},connector:{id:'micro-element',columnAssignment:[{seriesId:'Iron',data:['Food','Iron']}]},type:'Highcharts',chartOptions:{xAxis:{type:'category',accessibility:{description:'Groceries'}},yAxis:{title:{text:'mcg'},max:8,plotLines:[{value:8,dashStyle:'shortDash',label:{text:'RDA',align:'right',style:{color:'#B73C28'}}}]},credits:{enabled:false},plotOptions:{series:{marker:{radius:6}}},title:{text:''},legend:{enabled:true,verticalAlign:'top'},chart:{animation:false,type:'column',spacing:[30,30,30,20]},tooltip:{valueSuffix:' mcg',stickOnContact:true},lang:{accessibility:{chartContainerLabel:'Iron in food. Highcharts Interactive Chart.'}},accessibility:{description:'The chart is displaying the Iron amount in micrograms for some groceries. There is a plotLine demonstrating the daily Recommended Dietary Allowance (RDA) of 8 micrograms.',point:{valueSuffix:' mcg'}}}},{renderTo:'dashboard-col-2',connector:{id:'micro-element'},type:'DataGrid',sync:{highlight:true,visibility:true},dataGridOptions:{credits:{enabled:false}}}]},true); - - TextoKPIVendedores = "Highcharts.setOptions({lang: { decimalPoint: '.', thousandsSep: ','},chart:{styledMode:true}});Dashboards.board('divsmsdash',{dataPool:{connectors:[" & StrSource.ToString & "]},editMode: { + End If + 'top 10 medicos + dtt = ds.Tables(3) + StrTexto.Clear() + If dtt IsNot Nothing AndAlso dtt.Rows.Count > 0 Then + For Each dr As DataRow In dtt.FiltraParametros("Importe > 0").Rows + StrTexto.AppendFormat("['{0}',{1}],", dr("Medico"), dr("Importe")) + Next + StrTexto.Length -= 1 + StrSource.Append(",{id:'dtmedtop10',type:'JSON',options:{firstRowAsNames:false,columnNames:['Medico','Importe'],data:[") + StrSource.Append(StrTexto.ToString) + StrSource.Append("]}}") + End If + 'top 5 marcas + dtt = ds.Tables(4) + StrTexto.Clear() + 'top 5 marcas + If dtt IsNot Nothing AndAlso dtt.Rows.Count > 0 Then + For Each dr As DataRow In dtt.FiltraParametros("Importe > 0").Rows + StrTexto.AppendFormat("['{0}',{1}],", dr("Marca"), dr("Importe")) + Next + StrTexto.Length -= 1 + StrSource.Append(",{id:'dttop5marcas',type:'JSON',options:{firstRowAsNames:false,columnNames:['Marca','Importe'],data:[") + StrSource.Append(StrTexto.ToString) + StrSource.Append("]}}") + End If + 'Dim TextoKPIVendedores As String = "Highcharts.setOptions({chart:{styledMode:true}});Dashboards.board('divsmsdash',{dataPool:{connectors:[{id:'micro-element',type:'JSON',options:{firstRowAsNames:false,columnNames:['Food','Vitamin A','Iron'],data:[['Beef Liver',6421,6.5],['Lamb Liver',2122,6.5],['Cod Liver Oil',1350,0.9],['Mackerel',388,1],['Tuna',214,0.6]]}}]},editMode:{enabled:true,contextMenu:{enabled:true}},components:[{type:'KPI',renderTo:'kpi-vitamin-a',value:900,valueFormat:'{value}',title:'Vitamin A',subtitle:'daily recommended dose'},{type:'KPI',renderTo:'kpi-iron',value:8,title:'Iron',valueFormat:'{value}',subtitle:'daily recommended dose'},{sync:{visibility:true,highlight:true,extremes:true},connector:{id:'micro-element',columnAssignment:[{seriesId:'Vitamin A',data:['Food','Vitamin A']}]},renderTo:'dashboard-col-0',type:'Highcharts',chartOptions:{xAxis:{type:'category',accessibility:{description:'Groceries'}},yAxis:{title:{text:'mcg'},plotLines:[{value:900,zIndex:7,dashStyle:'shortDash',label:{text:'RDA',align:'right',style:{color:'#B73C28'}}}]},credits:{enabled:false},plotOptions:{series:{marker:{radius:6}}},legend:{enabled:true,verticalAlign:'top'},chart:{animation:false,type:'column',spacing:[30,30,30,20]},title:{text:''},tooltip:{valueSuffix:' mcg',stickOnContact:true},lang:{accessibility:{chartContainerLabel:'Vitamin A in food. Highcharts Interactive Chart.'}},accessibility:{description:'The chart is displaying the Vitamin A amount in micrograms for some groceries. There is a plotLine demonstrating the daily Recommended Dietary Allowance (RDA) of 900 micrograms.',point:{valueSuffix:' mcg'}}}},{renderTo:'dashboard-col-1',sync:{visibility:true,highlight:true,extremes:true},connector:{id:'micro-element',columnAssignment:[{seriesId:'Iron',data:['Food','Iron']}]},type:'Highcharts',chartOptions:{xAxis:{type:'category',accessibility:{description:'Groceries'}},yAxis:{title:{text:'mcg'},max:8,plotLines:[{value:8,dashStyle:'shortDash',label:{text:'RDA',align:'right',style:{color:'#B73C28'}}}]},credits:{enabled:false},plotOptions:{series:{marker:{radius:6}}},title:{text:''},legend:{enabled:true,verticalAlign:'top'},chart:{animation:false,type:'column',spacing:[30,30,30,20]},tooltip:{valueSuffix:' mcg',stickOnContact:true},lang:{accessibility:{chartContainerLabel:'Iron in food. Highcharts Interactive Chart.'}},accessibility:{description:'The chart is displaying the Iron amount in micrograms for some groceries. There is a plotLine demonstrating the daily Recommended Dietary Allowance (RDA) of 8 micrograms.',point:{valueSuffix:' mcg'}}}},{renderTo:'dashboard-col-2',connector:{id:'micro-element'},type:'DataGrid',sync:{highlight:true,visibility:true},dataGridOptions:{credits:{enabled:false}}}]},true); + dtt = ds.Tables(5) + StrTexto.Clear() + If dtt IsNot Nothing AndAlso dtt.Rows.Count > 0 Then + NumPacientes = dtt.FiltroPrimeroValor("NumeroPacientes").ToEntero + End If + TextoKPIVendedores = "Highcharts.setOptions({lang: { decimalPoint: '.', thousandsSep: ','},chart:{styledMode:true}});Dashboards.board('divsmsdash',{dataPool:{connectors:[" & StrSource.ToString & "]},editMode: { enabled: false, contextMenu: { enabled: true } }, @@ -1757,8 +1764,8 @@ Partial Class Inicio },{ type: 'KPI', renderTo: 'kpi-iron3', - value: 18, - title: 'Personas', + value: " & NumPacientes & ", + title: 'Pacientes', valueFormat: '{value}', subtitle: '-' },{ @@ -1844,96 +1851,100 @@ Partial Class Inicio }, dataGridOptions: { caption: { - text: 'Médicos sin consumo en +30d', - rowHeight: 20, // ⬅️ Altura de cada fila en píxeles - style: { - fontSize: '8px', - fontWeight: 'bold' - } + text: 'Médicos sin consumo en +30d' },style: { maxHeight: '350px', - overflowY: 'auto' + overflowY: 'auto', + fontSize: '7pt', + fontWeight: 'normal' }, credits: { enabled: false } + , cellStyle: { + fontWeight: 'normal', + fontSize: '8px' + } } }] }, true); " #End Region - - Else + ElseIf Opcion = 2 Then #Region "GERENTE" - dtt = ds.Tables(0) - If dtt IsNot Nothing Then - VentasTotales = dtt.FiltroPrimeroValor("Importe").ToDecimal - End If - dtt = ds.Tables(1) - StrTexto.Clear() - 'ventas por mes - If dtt IsNot Nothing Then - For Each dr As DataRow In dtt.FiltraParametros("AnioAnterior > 0 or AnioActual > 0", "MesNum").Rows - StrTexto.AppendFormat("['{0}',{1}, {2}],", dr("Mes"), dr("AnioAnterior"), dr("AnioActual")) - Next - StrTexto.Length -= 1 - StrSource.Append("{id:'dtmesxmes',type:'JSON',options:{firstRowAsNames:false,columnNames:['Mes','Anterior','Actual'],data:[") - StrSource.Append(StrTexto.ToString) - StrSource.Append("]}}") - End If + dtt = ds.Tables(0) + If dtt IsNot Nothing Then + VentasTotales = dtt.FiltroPrimeroValor("Importe").ToDecimal + End If + dtt = ds.Tables(1) + StrTexto.Clear() + 'ventas por mes + If dtt IsNot Nothing Then + For Each dr As DataRow In dtt.FiltraParametros("AnioAnterior > 0 or AnioActual > 0", "MesNum").Rows + StrTexto.AppendFormat("['{0}',{1}, {2}],", dr("Mes"), dr("AnioAnterior"), dr("AnioActual")) + Next + StrTexto.Length -= 1 + StrSource.Append("{id:'dtmesxmes',type:'JSON',options:{firstRowAsNames:false,columnNames:['Mes','Anterior','Actual'],data:[") + StrSource.Append(StrTexto.ToString) + StrSource.Append("]}}") + End If - dtt = ds.Tables(2) - StrTexto.Clear() - 'médicos sin consumo - If dtt IsNot Nothing AndAlso dtt.Rows.Count > 0 Then + dtt = ds.Tables(2) + StrTexto.Clear() + 'médicos sin consumo + If dtt IsNot Nothing AndAlso dtt.Rows.Count > 0 Then - For Each dr As DataRow In dtt.Rows - StrTexto.AppendFormat("['{0}','{1}'],", dr("NombreMedico"), dr("Vendedor")) - Next - StrTexto.Length -= 1 - StrSource.Append(",{id:'dtmedsinconsumo',type:'JSON',options:{firstRowAsNames:false,columnNames:['Medico','Vendedor'],data:[") - StrSource.Append(StrTexto.ToString) - StrSource.Append("]}}") - End If - 'vendedores - dtt = ds.Tables(3) - StrTexto.Clear() - If dtt IsNot Nothing AndAlso dtt.Rows.Count > 0 Then - For Each dr As DataRow In dtt.FiltraParametros("Importe > 0").Rows - StrTexto.AppendFormat("['{0}',{1}],", dr("Vendedor"), dr("Importe")) - Next - StrTexto.Length -= 1 - StrSource.Append(",{id:'dtvendedores',type:'JSON',options:{firstRowAsNames:false,columnNames:['Vendedor','Importe'],data:[") - StrSource.Append(StrTexto.ToString) - StrSource.Append("]}}") - End If - 'top 10 medicos - dtt = ds.Tables(4) - StrTexto.Clear() - If dtt IsNot Nothing AndAlso dtt.Rows.Count > 0 Then - For Each dr As DataRow In dtt.FiltraParametros("Importe > 0").Rows - StrTexto.AppendFormat("['{0}',{1}],", dr("Medico"), dr("Importe")) - Next - StrTexto.Length -= 1 - StrSource.Append(",{id:'dtmedtop10',type:'JSON',options:{firstRowAsNames:false,columnNames:['Medico','Importe'],data:[") - StrSource.Append(StrTexto.ToString) - StrSource.Append("]}}") - End If - 'top 5 marcas - dtt = ds.Tables(5) - StrTexto.Clear() - 'top 5 marcas - If dtt IsNot Nothing AndAlso dtt.Rows.Count > 0 Then - For Each dr As DataRow In dtt.FiltraParametros("Importe > 0").Rows - StrTexto.AppendFormat("['{0}',{1}],", dr("Marca"), dr("Importe")) - Next - StrTexto.Length -= 1 - StrSource.Append(",{id:'dttop5marcas',type:'JSON',options:{firstRowAsNames:false,columnNames:['Marca','Importe'],data:[") - StrSource.Append(StrTexto.ToString) - StrSource.Append("]}}") + For Each dr As DataRow In dtt.Rows + StrTexto.AppendFormat("['{0}','{1}'],", dr("NombreMedico"), dr("Vendedor")) + Next + StrTexto.Length -= 1 + StrSource.Append(",{id:'dtmedsinconsumo',type:'JSON',options:{firstRowAsNames:false,columnNames:['Medico','Vendedor'],data:[") + StrSource.Append(StrTexto.ToString) + StrSource.Append("]}}") + End If + 'vendedores + dtt = ds.Tables(3) + StrTexto.Clear() + If dtt IsNot Nothing AndAlso dtt.Rows.Count > 0 Then + For Each dr As DataRow In dtt.FiltraParametros("Importe > 0").Rows + StrTexto.AppendFormat("['{0}',{1},'/a/a.aspx?CveI=1'],", If(dr("Vendedor").ToString.Length > 10, dr("Vendedor").ToString.Substring(0, 10), dr("Vendedor")), dr("Importe")) + Next + StrTexto.Length -= 1 + StrSource.Append(",{id:'dtvendedores',type:'JSON',options:{firstRowAsNames:false,columnNames:['Vendedor','Importe','Url'],data:[") + StrSource.Append(StrTexto.ToString) + StrSource.Append("]}}") + End If + 'top 10 medicos + dtt = ds.Tables(4) + StrTexto.Clear() + If dtt IsNot Nothing AndAlso dtt.Rows.Count > 0 Then + For Each dr As DataRow In dtt.FiltraParametros("Importe > 0").Rows + StrTexto.AppendFormat("['{0}',{1}],", dr("Medico"), dr("Importe")) + Next + StrTexto.Length -= 1 + StrSource.Append(",{id:'dtmedtop10',type:'JSON',options:{firstRowAsNames:false,columnNames:['Medico','Importe'],data:[") + StrSource.Append(StrTexto.ToString) + StrSource.Append("]}}") + End If + 'top 5 marcas + dtt = ds.Tables(5) + StrTexto.Clear() + If dtt IsNot Nothing AndAlso dtt.Rows.Count > 0 Then + For Each dr As DataRow In dtt.FiltraParametros("Importe > 0").Rows + StrTexto.AppendFormat("['{0}',{1},'https://www.google.com'],", dr("Marca"), dr("Importe")) + Next + StrTexto.Length -= 1 + StrSource.Append(",{id:'dttop5marcas',type:'JSON',options:{firstRowAsNames:false,columnNames:['Marca','Importe','Url'],data:[") + StrSource.Append(StrTexto.ToString) + StrSource.Append("]}}") - End If - 'Dim TextoKPIVendedores As String = "Highcharts.setOptions({chart:{styledMode:true}});Dashboards.board('divsmsdash',{dataPool:{connectors:[{id:'micro-element',type:'JSON',options:{firstRowAsNames:false,columnNames:['Food','Vitamin A','Iron'],data:[['Beef Liver',6421,6.5],['Lamb Liver',2122,6.5],['Cod Liver Oil',1350,0.9],['Mackerel',388,1],['Tuna',214,0.6]]}}]},editMode:{enabled:true,contextMenu:{enabled:true}},components:[{type:'KPI',renderTo:'kpi-vitamin-a',value:900,valueFormat:'{value}',title:'Vitamin A',subtitle:'daily recommended dose'},{type:'KPI',renderTo:'kpi-iron',value:8,title:'Iron',valueFormat:'{value}',subtitle:'daily recommended dose'},{sync:{visibility:true,highlight:true,extremes:true},connector:{id:'micro-element',columnAssignment:[{seriesId:'Vitamin A',data:['Food','Vitamin A']}]},renderTo:'dashboard-col-0',type:'Highcharts',chartOptions:{xAxis:{type:'category',accessibility:{description:'Groceries'}},yAxis:{title:{text:'mcg'},plotLines:[{value:900,zIndex:7,dashStyle:'shortDash',label:{text:'RDA',align:'right',style:{color:'#B73C28'}}}]},credits:{enabled:false},plotOptions:{series:{marker:{radius:6}}},legend:{enabled:true,verticalAlign:'top'},chart:{animation:false,type:'column',spacing:[30,30,30,20]},title:{text:''},tooltip:{valueSuffix:' mcg',stickOnContact:true},lang:{accessibility:{chartContainerLabel:'Vitamin A in food. Highcharts Interactive Chart.'}},accessibility:{description:'The chart is displaying the Vitamin A amount in micrograms for some groceries. There is a plotLine demonstrating the daily Recommended Dietary Allowance (RDA) of 900 micrograms.',point:{valueSuffix:' mcg'}}}},{renderTo:'dashboard-col-1',sync:{visibility:true,highlight:true,extremes:true},connector:{id:'micro-element',columnAssignment:[{seriesId:'Iron',data:['Food','Iron']}]},type:'Highcharts',chartOptions:{xAxis:{type:'category',accessibility:{description:'Groceries'}},yAxis:{title:{text:'mcg'},max:8,plotLines:[{value:8,dashStyle:'shortDash',label:{text:'RDA',align:'right',style:{color:'#B73C28'}}}]},credits:{enabled:false},plotOptions:{series:{marker:{radius:6}}},title:{text:''},legend:{enabled:true,verticalAlign:'top'},chart:{animation:false,type:'column',spacing:[30,30,30,20]},tooltip:{valueSuffix:' mcg',stickOnContact:true},lang:{accessibility:{chartContainerLabel:'Iron in food. Highcharts Interactive Chart.'}},accessibility:{description:'The chart is displaying the Iron amount in micrograms for some groceries. There is a plotLine demonstrating the daily Recommended Dietary Allowance (RDA) of 8 micrograms.',point:{valueSuffix:' mcg'}}}},{renderTo:'dashboard-col-2',connector:{id:'micro-element'},type:'DataGrid',sync:{highlight:true,visibility:true},dataGridOptions:{credits:{enabled:false}}}]},true); + End If + dtt = ds.Tables(6) + StrTexto.Clear() + If dtt IsNot Nothing AndAlso dtt.Rows.Count > 0 Then + NumPacientes = dtt.FiltroPrimeroValor("NumeroPacientes").ToEntero + End If + 'Dim TextoKPIVendedores As String = "Highcharts.setOptions({chart:{styledMode:true}});Dashboards.board('divsmsdash',{dataPool:{connectors:[{id:'micro-element',type:'JSON',options:{firstRowAsNames:false,columnNames:['Food','Vitamin A','Iron'],data:[['Beef Liver',6421,6.5],['Lamb Liver',2122,6.5],['Cod Liver Oil',1350,0.9],['Mackerel',388,1],['Tuna',214,0.6]]}}]},editMode:{enabled:true,contextMenu:{enabled:true}},components:[{type:'KPI',renderTo:'kpi-vitamin-a',value:900,valueFormat:'{value}',title:'Vitamin A',subtitle:'daily recommended dose'},{type:'KPI',renderTo:'kpi-iron',value:8,title:'Iron',valueFormat:'{value}',subtitle:'daily recommended dose'},{sync:{visibility:true,highlight:true,extremes:true},connector:{id:'micro-element',columnAssignment:[{seriesId:'Vitamin A',data:['Food','Vitamin A']}]},renderTo:'dashboard-col-0',type:'Highcharts',chartOptions:{xAxis:{type:'category',accessibility:{description:'Groceries'}},yAxis:{title:{text:'mcg'},plotLines:[{value:900,zIndex:7,dashStyle:'shortDash',label:{text:'RDA',align:'right',style:{color:'#B73C28'}}}]},credits:{enabled:false},plotOptions:{series:{marker:{radius:6}}},legend:{enabled:true,verticalAlign:'top'},chart:{animation:false,type:'column',spacing:[30,30,30,20]},title:{text:''},tooltip:{valueSuffix:' mcg',stickOnContact:true},lang:{accessibility:{chartContainerLabel:'Vitamin A in food. Highcharts Interactive Chart.'}},accessibility:{description:'The chart is displaying the Vitamin A amount in micrograms for some groceries. There is a plotLine demonstrating the daily Recommended Dietary Allowance (RDA) of 900 micrograms.',point:{valueSuffix:' mcg'}}}},{renderTo:'dashboard-col-1',sync:{visibility:true,highlight:true,extremes:true},connector:{id:'micro-element',columnAssignment:[{seriesId:'Iron',data:['Food','Iron']}]},type:'Highcharts',chartOptions:{xAxis:{type:'category',accessibility:{description:'Groceries'}},yAxis:{title:{text:'mcg'},max:8,plotLines:[{value:8,dashStyle:'shortDash',label:{text:'RDA',align:'right',style:{color:'#B73C28'}}}]},credits:{enabled:false},plotOptions:{series:{marker:{radius:6}}},title:{text:''},legend:{enabled:true,verticalAlign:'top'},chart:{animation:false,type:'column',spacing:[30,30,30,20]},tooltip:{valueSuffix:' mcg',stickOnContact:true},lang:{accessibility:{chartContainerLabel:'Iron in food. Highcharts Interactive Chart.'}},accessibility:{description:'The chart is displaying the Iron amount in micrograms for some groceries. There is a plotLine demonstrating the daily Recommended Dietary Allowance (RDA) of 8 micrograms.',point:{valueSuffix:' mcg'}}}},{renderTo:'dashboard-col-2',connector:{id:'micro-element'},type:'DataGrid',sync:{highlight:true,visibility:true},dataGridOptions:{credits:{enabled:false}}}]},true); - TextoKPIVendedores = "Highcharts.setOptions({lang: { decimalPoint: '.', thousandsSep: ','},chart:{styledMode:true}});Dashboards.board('divsmsdash',{dataPool:{connectors:[" & StrSource.ToString & "]},editMode: { + TextoKPIVendedores = "Highcharts.setOptions({lang: { decimalPoint: '.', thousandsSep: ','},chart:{styledMode:true}});Dashboards.board('divsmsdash',{dataPool:{connectors:[" & StrSource.ToString & "]},editMode: { enabled: false, contextMenu: { enabled: true } }, @@ -1979,8 +1990,8 @@ Partial Class Inicio },{ type: 'KPI', renderTo: 'kpi-iron3', - value: 18, - title: 'Personas', + value: " & NumPacientes & ", + title: 'Pacientes', valueFormat: '{value}', subtitle: '-' },{ @@ -2021,40 +2032,54 @@ Partial Class Inicio lang: { accessibility: { chartContainerLabel: '' } } } }, { - renderTo: 'dashboard-col-1', - sync: { - visibility: true, - highlight: true, - extremes: true - }, - connector: { - id: 'dttop5marcas', - columnAssignment: [{ - seriesId: 'Top 5 Marcas', - data: ['Marca', 'Importe'] - }] - }, - type: 'Highcharts', - chartOptions: { - xAxis: { - type: 'category', - accessibility: { description: 'Groceries' } + renderTo: 'dashboard-col-1', + connector: { + id: 'dttop5marcas', + columnAssignment: [{ + seriesId: 'Top 5 Marcas', + data: ['Marca', 'Importe','Url'] + }] }, - yAxis: { title: { text: '' } }, - credits: { enabled: false }, - title: { text: '' }, - legend: { enabled: true, verticalAlign: 'top' }, - chart: { - animation: false, type: 'bar', - spacing: [30, 30, 30, 20] - }, - tooltip: { valueSuffix: ' ', stickOnContact: true }, - lang: { accessibility: { - chartContainerLabel: 'Iron in food. Highcharts ' + 'Interactive Chart.' + type: 'Highcharts', + chartOptions: { + chart: { + type: 'bar', + animation: false, + spacing: [30, 30, 30, 20] + }, + title: { text: '' }, + credits: { enabled: false }, + legend: { enabled: true, verticalAlign: 'top' }, + xAxis: { + type: 'category', + accessibility: { description: 'Groceries' } + }, + yAxis: { title: { text: '' } }, + tooltip: { + valueSuffix: ' ', + stickOnContact: true + }, + plotOptions: { + series: { + cursor: 'pointer', + point: { + events: { + click: function () { + const url = this.options?.Url; + + console.log('URL del punto:', url); + if (url) { + window.open(url, '_blank'); + } else { + alert('No se encontró la URL del punto.'); + } + } + } + } + } } } - } - }, { + }, { renderTo: 'dashboard-col-3', sync: { visibility: true, @@ -2065,24 +2090,67 @@ Partial Class Inicio id: 'dtvendedores', columnAssignment: [{ seriesId: 'Vendedores', - data: ['Vendedor', 'Importe'] + data: ['Vendedor', 'Importe','Url'] }] }, type: 'Highcharts', chartOptions: { xAxis: { type: 'category', - accessibility: { description: 'Groceries' } + accessibility: { description: '' } }, yAxis: { title: { text: '' } }, credits: { enabled: false }, - title: { text: '' }, + plotOptions: { + pie: { + allowPointSelect: true, + cursor: 'pointer', + dataLabels: [{ + enabled: true, + distance: 20 + }, { + enabled: true, + distance: -40, + format: '{point.percentage:.1f}%', + style: { + fontSize: '1.2em', + textOutline: 'none', + opacity: 0.7 + }, + filter: { + operator: '>', + property: 'percentage', + value: 10 + } + }] + } + }, + title: { text: 'Vendedores' }, legend: { enabled: true, verticalAlign: 'top' }, chart: { - animation: false, type: 'bar', - spacing: [30, 30, 30, 20] + animation: false, type: 'pie' }, - tooltip: { valueSuffix: ' ', stickOnContact: true }, + tooltip: { + pointFormat: '{series.name}: {point.percentage:.1f}%
Valor: {point.y}' + }, + plotOptions: { + pie: { + allowPointSelect: true, + cursor: 'pointer', + dataLabels: { + enabled: true, + format: '{point.name}: {point.percentage:.1f} %' + }, + point: { + events: { + click: function () { + const url = this.options?.Url; + if (url) window.open(url, '_blank'); + } + } + } + } + }, lang: { accessibility: { chartContainerLabel: 'Iron in food. Highcharts ' + 'Interactive Chart.' } @@ -2140,25 +2208,311 @@ Partial Class Inicio highlight: true, visibility: true }, - dataGridOptions: { + dataGridOptions: { caption: { - text: 'Médicos sin consumo en +30d', - rowHeight: 20, // Altura de cada fila en píxeles - style: { - fontSize: '8pt', - fontWeight: 'bold' - } + text: 'Médicos sin consumo en +30d' },style: { maxHeight: '350px', - overflowY: 'auto' + overflowY: 'auto', + fontSize: '7pt', + fontWeight: 'normal' }, credits: { enabled: false } + , cellStyle: { + fontWeight: 'normal', + fontSize: '8px' + } } }] }, true); " #End Region + + ElseIf Opcion = 3 Then +#Region "ALMACEN" + Dim TotalEntregas, TotalRecoleciones, ProductosConExistencia, Ingresadas, NoUsadas As Integer + Dim EntregasDiarias As Decimal = 0 + dtt = ds.Tables(0) + If dtt IsNot Nothing Then + TotalEntregas = dtt.FiltroPrimeroValor("TotalEntregas").ToEntero + TotalRecoleciones = dtt.FiltroPrimeroValor("TotalRecoleccion").ToEntero + ProductosConExistencia = dtt.FiltroPrimeroValor("ProductosExistencias").ToEntero + Ingresadas = dtt.FiltroPrimeroValor("Ingresadas").ToEntero + NoUsadas = dtt.FiltroPrimeroValor("NoUsadas").ToEntero + EntregasDiarias = dtt.FiltroPrimeroValor("EntregasDiarias").ToDecimal + End If + + TextoKPIVendedores = "Highcharts.setOptions({lang: { decimalPoint: '.', thousandsSep: ','},chart:{styledMode:true}});Dashboards.board('divsmsdash',{dataPool:{connectors:[" & StrSource.ToString & "]},editMode: { + enabled: false, + contextMenu: { enabled: true } + }, + gui: { + layouts: [{ + rows: [{ + cells: [{ + id: 'kpi-wrapper', + layout: { + rows: [{ + cells: [{ + id: 'kpi-iron0' + }, { + id: 'kpi-iron1' + }, { + id: 'kpi-iron2' + }] + },{ + cells: [{ + id: 'kpi-iron3' + }, { + id: 'kpi-iron4' + }, { + id: 'kpi-iron5' + }] + }] + } + }] + }] + }] + }, + components: [{ + type: 'KPI', + renderTo: 'kpi-iron0', + value: " & TotalEntregas & ", + valueFormat: '{value}', + title: 'Total Entrega', + subtitle: '-' + }, { + type: 'KPI', + renderTo: 'kpi-iron1', + value: " & TotalRecoleciones & ", + title: 'Total Recolecciones', + valueFormat: '{value}', + valueStyle: { color: '#198754'}, + subtitle: '' + }, { + type: 'KPI', + renderTo: 'kpi-iron2', + value: " & ProductosConExistencia & ", + title: 'Productos con Existencia', + valueFormat: '{value}', + subtitle: '-' + },{ + type: 'KPI', + renderTo: 'kpi-iron3', + value: " & Ingresadas & ", + title: 'Ingresadas', + valueFormat: '{value}', + subtitle: '-' + },{ + type: 'KPI', + renderTo: 'kpi-iron4', + value: " & NoUsadas & ", + title: 'No usadas', + valueFormat: '{value}', + subtitle: '-' + },{ + type: 'KPI', + renderTo: 'kpi-iron5', + value: " & EntregasDiarias & ", + title: 'Prom Entrega diaria', + valueFormat: '{value:,.2f}', + subtitle: '-' + } ] + }, true); " +#End Region + ElseIf Opcion = 4 Then +#Region "TECNICO" + Dim CirugiasDiaSiguiente, Comision, NumCirugias As Integer + Dim MontoCirugias As Decimal = 0 + dtt = ds.Tables(0) + If dtt IsNot Nothing Then + CirugiasDiaSiguiente = dtt.FiltroPrimeroValor("CirugiasDiaSiguiente").ToEntero + Comision = dtt.FiltroPrimeroValor("Comision").ToEntero + NumCirugias = dtt.FiltroPrimeroValor("NumCirugias").ToEntero + MontoCirugias = dtt.FiltroPrimeroValor("MontoCirugias").ToDecimal + End If + + TextoKPIVendedores = "Highcharts.setOptions({lang: { decimalPoint: '.', thousandsSep: ','},chart:{styledMode:true}});Dashboards.board('divsmsdash',{dataPool:{connectors:[" & StrSource.ToString & "]},editMode: { + enabled: false, + contextMenu: { enabled: true } + }, + gui: { + layouts: [{ + rows: [{ + cells: [{ + id: 'kpi-wrapper', + layout: { + rows: [{ + cells: [{ + id: 'kpi-iron0' + }, { + id: 'kpi-iron1' + }] + },{ + cells: [{ + id: 'kpi-iron2' + },{ + id: 'kpi-iron3' + } ] + }] + } + }] + }] + }] + }, + components: [{ + type: 'KPI', + renderTo: 'kpi-iron0', + value: " & CirugiasDiaSiguiente & ", + valueFormat: '{value}', + title: 'Cirugías Dia Sig', + subtitle: '-' + }, { + type: 'KPI', + renderTo: 'kpi-iron1', + value: " & Comision & ", + title: '$ Comisión', + valueFormat: '{value:,.2f}', + valueStyle: { color: '#198754'}, + subtitle: '' + }, { + type: 'KPI', + renderTo: 'kpi-iron2', + value: " & NumCirugias & ", + title: '# Cirugías', + valueFormat: '{value}', + subtitle: '-' + },{ + type: 'KPI', + renderTo: 'kpi-iron3', + value: " & MontoCirugias & ", + title: '$ Cirugías', + valueFormat: '{value:,.2f}', + subtitle: '-' + } ] + }, true); " +#End Region + ElseIf Opcion = 5 Then +#Region "GERENTE TECNICO" + Dim CirugiasAsistidas As Integer + Dim MontoCirugias, TicketPromedio As Decimal + dtt = ds.Tables(0) + If dtt IsNot Nothing Then + CirugiasAsistidas = dtt.FiltroPrimeroValor("CirugiasAsistidas").ToEntero + TicketPromedio = dtt.FiltroPrimeroValor("TicketPromedio").ToDecimal + End If + 'top cirugias técnicos + dtt = ds.Tables(1) + StrTexto.Clear() + If dtt IsNot Nothing AndAlso dtt.Rows.Count > 0 Then + For Each dr As DataRow In dtt.FiltraParametros("Cantidad > 0").Rows + StrTexto.AppendFormat("['{0}',{1}],", dr("NombreTecnico"), dr("Cantidad")) + Next + StrTexto.Length -= 1 + StrSource.Append("{id:'dttecnicos',type:'JSON',options:{firstRowAsNames:false,columnNames:['NombreTecnico','Cantidad'],data:[") + StrSource.Append(StrTexto.ToString) + StrSource.Append("]}}") + End If + + TextoKPIVendedores = "Highcharts.setOptions({lang: { decimalPoint: '.', thousandsSep: ','},chart:{styledMode:true}});Dashboards.board('divsmsdash',{dataPool:{connectors:[" & StrSource.ToString & "]},editMode: { + enabled: false, + contextMenu: { enabled: true } + }, + gui: { + layouts: [{ + rows: [{ + cells: [{ + id: 'kpi-wrapper', + layout: { + rows: [{ + cells: [{ + id: 'kpi-vitamin-a' + },{ + id: 'kpi-iron3' + }] + }] + } + }] + }, { + cells: [{ + id: 'dashboard-col-3' + }] + }] + }] + }, + components: [{ + type: 'KPI', + renderTo: 'kpi-vitamin-a', + value: " & CirugiasAsistidas & ", + valueFormat: '{value}', + title: 'Cirugías Asistidas', + subtitle: '-' + },{ + type: 'KPI', + renderTo: 'kpi-iron', + value: " & TicketPromedio & ", + title: 'Ticket Promedio', + valueFormat: '{value}', + subtitle: '-' + }, { + renderTo: 'dashboard-col-3', + sync: { + visibility: true, + highlight: true, + extremes: true + }, + connector: { + id: 'dttecnicos', + columnAssignment: [{ + seriesId: 'Técnicos', + data: ['NombreTecnico', 'Cantidad'] + }] + }, + type: 'Highcharts', + chartOptions: { + xAxis: { + type: 'category', + accessibility: { description: '' } + }, + yAxis: { title: { text: '' } }, + credits: { enabled: false }, + + title: { text: 'Técnicos' }, + legend: { enabled: true, verticalAlign: 'top' }, + chart: { + animation: false, type: 'pie' + }, + tooltip: { + pointFormat: '{series.name}: {point.percentage:.1f}%
Valor: {point.y}' + }, + plotOptions: { + pie: { + allowPointSelect: true, + cursor: 'pointer', + dataLabels: { + enabled: true, + format: '{point.name}: {point.percentage:.1f} %' + }, + point: { + events: { + click: function () { + const url = this.options?.Url; + if (url) window.open(url, '_blank'); + } + } + } + } + }, + lang: { accessibility: { + chartContainerLabel: 'Iron in food. Highcharts ' + 'Interactive Chart.' + } + } + } + }] + }, true); " +#End Region + End If + RegistraScript(TextoKPIVendedores, "top10") End If - RegistraScript(TextoKPIVendedores, "top10") dtIndicadores = Nothing dtRH = Nothing @@ -2166,4 +2520,34 @@ Partial Class Inicio End Sub #End Region + + Protected Sub DdlSMSOpciones_SelectedIndexChanged(sender As Object, e As EventArgs) + If DdlSMSOpciones.SelectedValue = "1" Then + DdlSMSVendedores.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa).FiltraParametros("CveEstatus=1") + DdlSMSVendedores.DataBind() + DdlSMSVendedores.Visible = True + DdlSMSTecnico.Visible = False + CargaKPICirugias(DdlSMSOpciones.SelectedValue.ToEntero, DdlSMSVendedores.SelectedValue.ToEntero) + ElseIf DdlSMSOpciones.SelectedValue = "4" Then + DdlSMSTecnico.DataSource = GlobalDTUsuarios(-1, CveEmpresa:=UsuarioActual.CveEmpresa).FiltraParametros("CveRol = 1582") + DdlSMSTecnico.DataBind() + DdlSMSTecnico.Items.Insert(0, New ListItem("Todos", "-1")) + DdlSMSTecnico.Visible = True + DdlSMSVendedores.Visible = False + CargaKPICirugias(DdlSMSOpciones.SelectedValue.ToEntero, -1, DdlSMSTecnico.SelectedValue.ToEntero) + Else + DdlSMSVendedores.Visible = False + DdlSMSTecnico.Visible = False + CargaKPICirugias(DdlSMSOpciones.SelectedValue.ToEntero) + End If + + End Sub + + Protected Sub DdlSMSVendedores_SelectedIndexChanged(sender As Object, e As EventArgs) + CargaKPICirugias(DdlSMSOpciones.SelectedValue.ToEntero, DdlSMSVendedores.SelectedValue.ToEntero) + End Sub + + Protected Sub DdlSMSTecnico_SelectedIndexChanged(sender As Object, e As EventArgs) + CargaKPICirugias(DdlSMSOpciones.SelectedValue.ToEntero, -1, DdlSMSTecnico.SelectedValue.ToEntero) + End Sub End Class diff --git a/Inventarios/EntradasSalidas.aspx b/Inventarios/EntradasSalidas.aspx index be49d534e..42612ffdd 100644 --- a/Inventarios/EntradasSalidas.aspx +++ b/Inventarios/EntradasSalidas.aspx @@ -432,6 +432,14 @@
+
+ +
+ +
+
diff --git a/Inventarios/EntradasSalidas.aspx.vb b/Inventarios/EntradasSalidas.aspx.vb index f71e68d1d..e160dd5c8 100644 --- a/Inventarios/EntradasSalidas.aspx.vb +++ b/Inventarios/EntradasSalidas.aspx.vb @@ -921,6 +921,11 @@ Partial Class Inventarios_EntradasSalidas HplOS.NavigateUrl = $"/OS/OrdenesServicios.aspx?CveOS={DtMov.Rows(0)("CveOS")}" End If + If DtMov.Rows(0)("CveOP").ToString.ToEntero() > 0 Then + divOP.Visible = True + HplOP.Text = "1" 'DtMov.Rows(0)("OSFolio").ToString + HplOP.NavigateUrl = $"/OP/OP.aspx?CveOP={DtMov.Rows(0)("CveOP")}" + End If If (DdlAlmacen.Items.FindByValue(Mov.CveAlmacen.ToString()) Is Nothing) Then Dim dr As DataRow = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveEstatus:=-1).FiltroPrimero(String.Format("CveAlmacen = {0}", Mov.CveAlmacen)) @@ -4069,49 +4074,56 @@ Partial Class Inventarios_EntradasSalidas ErrorMovInv = True End If Else - If ObjInventario.Modulo.Contiene("TA/G1", "Recons", "API-PT/C1") Then - Contabilizable = False + If ObjInventario.Modulo.Contiene("API-Traspaso-PT-Pallet") Then + Contabilizable = True If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not MovAlmacen, DtCostos.SUMD("Total").RoundSQL, DtCostos.SUMD("Total").RoundSQL, 68, Concepto, Concepto, CveVenta:=CveVenta, CveMovimientoAlmacen:=CveMovimientoRelacionado, Contabilizable:=Contabilizable) Then ErrorMovInv = True End If Else - If ObjInventario.Modulo.Contiene("Consig") Then + If ObjInventario.Modulo.Contiene("TA/G1", "Recons", "API-PT/C1", "API-Traspaso-PT-Pallet") Then Contabilizable = False - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not MovAlmacen, DtCostos.SUMD("Total").RoundSQL, DtCostos.SUMD("Total").RoundSQL, 95, Concepto, Concepto, CveVenta:=CveVenta, CveMovimientoAlmacen:=CveMovimientoRelacionado, Contabilizable:=Contabilizable) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not MovAlmacen, DtCostos.SUMD("Total").RoundSQL, DtCostos.SUMD("Total").RoundSQL, 68, Concepto, Concepto, CveVenta:=CveVenta, CveMovimientoAlmacen:=CveMovimientoRelacionado, Contabilizable:=Contabilizable) Then ErrorMovInv = True End If Else - If ObjInventario.Modulo.Contiene("ASA/G1", "Vta/E4", "ARMPAQ1", "RE/GSC3") Then + If ObjInventario.Modulo.Contiene("Consig") Then Contabilizable = False - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not MovAlmacen, DtCostos.SUMD("Total").RoundSQL, DtCostos.SUMD("Total").RoundSQL, 68, Concepto, Concepto, CveVenta:=CveVenta, CveMovimientoAlmacen:=CveMovimientoRelacionado, Contabilizable:=Contabilizable) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not MovAlmacen, DtCostos.SUMD("Total").RoundSQL, DtCostos.SUMD("Total").RoundSQL, 95, Concepto, Concepto, CveVenta:=CveVenta, CveMovimientoAlmacen:=CveMovimientoRelacionado, Contabilizable:=Contabilizable) Then ErrorMovInv = True End If Else - If DdlConcepto.SelectedValue.Contiene("1", "6", "22", "23", "7", "16", "21", "24", "32") Then - 'genero las prepolizas manuales - Dim tCveConcepto As Integer = 95 - Dim CveCuenta As Integer - If UsuarioActual.CveEmpresa = 119 Then CveCuenta = 55519 - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not MovAlmacen, DtCostos.SUMD("Total"), DtCostos.SUMD("Total"), tCveConcepto, Concepto, Concepto, CveVenta:=CveVenta, CveClasificacion:=-1, CveMovimientoAlmacen:=CveMovimiento, CveSubProyecto:=-1, Contabilizable:=Contabilizable) Then + If ObjInventario.Modulo.Contiene("ASA/G1", "Vta/E4", "ARMPAQ1", "RE/GSC3") Then + Contabilizable = False + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not MovAlmacen, DtCostos.SUMD("Total").RoundSQL, DtCostos.SUMD("Total").RoundSQL, 68, Concepto, Concepto, CveVenta:=CveVenta, CveMovimientoAlmacen:=CveMovimientoRelacionado, Contabilizable:=Contabilizable) Then ErrorMovInv = True End If Else - - Dim tCveSubProyecto As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto", $"CveAlmacen={DdlAlmacen.SelectedValue.ToEntero}").ToEntero - Dim tCveConcepto As Integer = 69 - If ObjInventario.CveConcepto = 37 Then - tCveConcepto = 181 - End If - - For Each RowInv As DataRow In tmpCostos.Rows - ValorInventario = DtCostos.SUM("Total", $"CveClasificacion = {RowInv("CveClasificacion")}").ToString.ToDecimal.RoundSQL - - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not MovAlmacen, ValorInventario, ValorInventario, tCveConcepto, Concepto, Concepto, CveVenta:=CveVenta, CveClasificacion:=RowInv("CveClasificacion").ToString.ToEntero, CveMovimientoAlmacen:=CveMovimiento, CveSubProyecto:=tCveSubProyecto, Contabilizable:=Contabilizable) Then + If DdlConcepto.SelectedValue.Contiene("1", "6", "22", "23", "7", "16", "21", "24", "32") Then + 'genero las prepolizas manuales + Dim tCveConcepto As Integer = 95 + Dim CveCuenta As Integer + If UsuarioActual.CveEmpresa = 119 Then CveCuenta = 55519 + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not MovAlmacen, DtCostos.SUMD("Total"), DtCostos.SUMD("Total"), tCveConcepto, Concepto, Concepto, CveVenta:=CveVenta, CveClasificacion:=-1, CveMovimientoAlmacen:=CveMovimiento, CveSubProyecto:=-1, Contabilizable:=Contabilizable) Then ErrorMovInv = True - Exit For + End If + Else + + Dim tCveSubProyecto As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto", $"CveAlmacen={DdlAlmacen.SelectedValue.ToEntero}").ToEntero + Dim tCveConcepto As Integer = 69 + If ObjInventario.CveConcepto = 37 Then + tCveConcepto = 181 End If - Next + For Each RowInv As DataRow In tmpCostos.Rows + ValorInventario = DtCostos.SUM("Total", $"CveClasificacion = {RowInv("CveClasificacion")}").ToString.ToDecimal.RoundSQL + + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not MovAlmacen, ValorInventario, ValorInventario, tCveConcepto, Concepto, Concepto, CveVenta:=CveVenta, CveClasificacion:=RowInv("CveClasificacion").ToString.ToEntero, CveMovimientoAlmacen:=CveMovimiento, CveSubProyecto:=tCveSubProyecto, Contabilizable:=Contabilizable) Then + ErrorMovInv = True + Exit For + End If + + Next + End If End If End If End If diff --git a/Inventarios/PaquetesArmadoDesarmado.aspx.vb b/Inventarios/PaquetesArmadoDesarmado.aspx.vb index 30f4d5d8d..ea9f75b27 100644 --- a/Inventarios/PaquetesArmadoDesarmado.aspx.vb +++ b/Inventarios/PaquetesArmadoDesarmado.aspx.vb @@ -200,7 +200,6 @@ Partial Class Inventarios_PaquetesArmadoDesarmado Private Sub InicializaValores() CreaDtSeriesDesarmado() - 'CARGA PS PAQUETES DdlPaqueteArmado.DataSource = GlobalDTPS(UsuarioActual.CveEmpresa).FiltraParametros("CvePSPaquete > 0") DdlPaqueteArmado.DataBind() @@ -278,9 +277,9 @@ Partial Class Inventarios_PaquetesArmadoDesarmado Dim ObjProductosServicios As New ClsProductosServicios DtDatosArmado = New DataTable - Dim drP As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlPaqueteArmado.SelectedValue.ToEntero).FiltroPrimero("") + Dim drP As DataRow = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=DdlPaqueteArmado.SelectedValue.ToEntero).FiltroPrimero("") - Dim CveUMTemp As Integer = drP("CveUM").ToString.ToEntero + Dim CveUMTemp As Integer = drP("CveUnidadMedida").ToString.ToEntero If ObjProductosServicios.GetPaqueteDetalle(DdlPaqueteArmado.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, CveUMTemp, TxtCantidadArmado.Text.ToDouble, DdlAlmacenArmado.SelectedValue.ToEntero, TxtFechaArmado.Text.ToDate, CveVendedor:=CveVendedor, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente)) Then DtDatosArmado = ObjProductosServicios.DtResultados.FiltraParametros("CveTipoPS = 2").Copy Else @@ -296,7 +295,6 @@ Partial Class Inventarios_PaquetesArmadoDesarmado CveVendedor = If(RowApartadosArmado.Visible, DdlVendedorArmado.SelectedValue.ToEntero, -1) CveCliente = If(RowClienteArmado.Visible, DdlClienteArmado.SelectedValue.ToEntero, -1) - If DtDatosArmado.Rows.Count > 0 Then For Each Dr As DataRow In DtDatosArmado.Rows Dr("Cantidad") = Dr("Cantidad").ToString.ToDecimal * TxtCantidadArmado.Text.ToDecimal @@ -323,8 +321,6 @@ Partial Class Inventarios_PaquetesArmadoDesarmado End If - - If AplicaSeriePaquete Or AplicaLotePaquete Or AplicaCaducidadPaquete Then DivSeriesPaqueteArmado.Visible = True Dim Dt As New DataTable @@ -403,10 +399,9 @@ Partial Class Inventarios_PaquetesArmadoDesarmado GvSeriesPaqueteDesarmado.DataBind() BtnAgregarSerieDesarmado.Enabled = True + Dim drP As DataRow = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=DdlPaqueteDesarmado.SelectedValue.ToEntero).FiltroPrimero("") - Dim drP As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlPaqueteDesarmado.SelectedValue.ToEntero).FiltroPrimero("") - - Dim CveUMTemp As Integer = drP("CveUM").ToString.ToEntero + Dim CveUMTemp As Integer = drP("CveUnidadMedida").ToString.ToEntero CveVendedor = If(RowApartadosDesarmado.Visible, DdlVendedorDesarmado.SelectedValue.ToEntero, -1) CveCliente = If(RowClienteDesarmado.Visible, DdlClienteDesarmado.SelectedValue.ToEntero, -1) Dim FechaFin As String = TxtFechaDesarmado.Text.ToDateTime.ToString("yyyy/MM/dd 23:59") @@ -506,7 +501,6 @@ Partial Class Inventarios_PaquetesArmadoDesarmado Alert("No hay ningun registro para generar el movimiento. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) Exit Sub End If - Guardar(1) End Sub @@ -568,7 +562,6 @@ Partial Class Inventarios_PaquetesArmadoDesarmado Alert("Es necesario ingresas todos las fechas de caducidad de los componentes.", TipoMensaje.MsgAdvertencia) Exit Sub End If - End If Else @@ -580,23 +573,17 @@ Partial Class Inventarios_PaquetesArmadoDesarmado End If If gvr.DataKey("AplicaCaducidad") = "True" Then - If gvr.FCTextBox("TxtCaducidad").Text.ToDate <= MinFecha Then Alert("Es necesario ingresas todos las fechas de caducidad de los componentes.", TipoMensaje.MsgAdvertencia) Exit Sub End If - End If End If - - - Next Case 2 ' DESARMADO For Each gvr As GridViewRow In GvDatosDesarmado.Rows If gvr.DataKey("AplicaSerie") = "True" Then - 'If gvr.DataKey("AplicaSerie") = "True" Then ' 'If gvr.DataKey("Cantidad").ToEntero <> DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", gvr.DataKey("Consec"))).Rows.Count Then ' ' Alert("Es necesario ingresas todas las series de los componentes.", TipoMensaje.MsgAdvertencia) @@ -619,15 +606,11 @@ Partial Class Inventarios_PaquetesArmadoDesarmado End If If gvr.DataKey("AplicaCaducidad") = "True" Then - If gvr.FCTextBox("TxtCaducidad").Text.ToDate <= MinFecha Then Alert("Es necesario ingresas todos las fechas de caducidad de los componentes.", TipoMensaje.MsgAdvertencia) Exit Sub End If - End If - - Next End Select @@ -683,26 +666,20 @@ Partial Class Inventarios_PaquetesArmadoDesarmado For Each GvRow As GridViewRow In GvDatosArmado.Rows - FechaCaducidad = If(CBool(GvRow.DataKey("AplicaCaducidad")) AndAlso GvRow.FCTextBox("TxtCaducidad").ToString().ToDate > MinFecha, GvRow.FCTextBox("TxtCaducidad").Text.ToDate, MinFecha) + FechaCaducidad = If(CBool(GvRow.DataKey("AplicaCaducidad")) AndAlso GvRow.FCTextBox("TxtCaducidad").Text.ToDate > MinFecha, GvRow.FCTextBox("TxtCaducidad").Text.ToDate, MinFecha) Lote = If(CBool(GvRow.DataKey("AplicaLote")), GvRow.FCTextBox("TxtLote").Text.Trim, "-1") - If UsuarioActual.Empresa.Funcionalidad(578).ToEntero = 1 Then - - Dim DdlCaducidadProducto As DropDownList = GvRow.FCDropDownList("DdlCaducidadProducto") - Dim ArrayCaducidad As String() = DdlCaducidadProducto.SelectedValue.Split("|"c) + If UsuarioActual.Empresa.Funcionalidad(578) = "1" Then + Dim ArrayCaducidad As String() = GvRow.FCDropDownList("DdlCaducidadProducto").SelectedValue.Split("|"c) Lote = ArrayCaducidad(0) FechaCaducidad = ArrayCaducidad(1).ToDate - End If Dim Existencia As Decimal = ObjInventarioVal.GetExistenciasPS(GvRow.DataKey("CvePS").ToEntero, GvRow.DataKey("CveUM").ToEntero, UsuarioActual.CveEmpresa, CveAlmacen:=DdlAlmacenArmado.SelectedValue.ToEntero(), FechaMovto:=TxtFechaArmado.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), Serie:="-1", Lote:=Lote, FechaCaducidad:=FechaCaducidad) - If GvRow.DataKey("Cantidad").ToDecimal > Existencia Then TieneErrorExistencia = True - TextoError.AppendFormat(" - {0} Existencia: {1:#,##0.##}
", GvRow.DataKey("CodigoPS"), Existencia) - End If ''If Dr("CantidadGV").ToString().ToDecimal > 0 Then @@ -758,16 +735,10 @@ Partial Class Inventarios_PaquetesArmadoDesarmado RegistraScript("playsonidito('142608__autistic-lucario__error.wav')") Exit Sub End If - End If - - - - Dim ObjInventario As New ClsInventarios Dim ObjConta As New ClsContabilidad(ObjInventario.IniciaTransacSQL()) - Dim TieneError As Boolean = False Dim MensajeError As String = "" @@ -801,13 +772,10 @@ Partial Class Inventarios_PaquetesArmadoDesarmado Dim Lote As String = If(Gvr.FCTextBox("TxtLote").Text = "", "-1", Gvr.FCTextBox("TxtLote").Text) Dim FechaCaducidad As String = If(Gvr.FCTextBox("TxtCaducidad").Text = "", "-1", Gvr.FCTextBox("TxtCaducidad").Text) - If UsuarioActual.Empresa.Funcionalidad(578).ToEntero = 1 Then - - Dim DdlCaducidadProducto As DropDownList = Gvr.FCDropDownList("DdlCaducidadProducto") - Dim ArrayCaducidad As String() = DdlCaducidadProducto.SelectedValue.Split("|"c) + If UsuarioActual.Empresa.Funcionalidad(578) = "1" Then + Dim ArrayCaducidad As String() = Gvr.FCDropDownList("DdlCaducidadProducto").SelectedValue.Split("|"c) Lote = ArrayCaducidad(0) FechaCaducidad = ArrayCaducidad(1) - End If Dim CveSeccionAlmacen As Integer = Gvr.FCDropDownList("DdlSeccionAlmacen").SelectedValue.ToEntero() @@ -826,11 +794,7 @@ Partial Class Inventarios_PaquetesArmadoDesarmado Exit For End If Next - - If TieneError Then - Exit For - End If - + If TieneError Then Exit For Else If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, Gvr.DataKey("Cantidad").ToString.ToDecimal, Gvr.DataKey("CveUM").ToString.ToEntero, Gvr.DataKey("CvePS").ToString.ToEntero, 0, -1, CveSeccionAlmacen:=CveSeccionAlmacen, Lote:=Lote, @@ -860,16 +824,15 @@ Partial Class Inventarios_PaquetesArmadoDesarmado PUTemp = PUTemp / TxtCantidadArmado.Text.ToDecimal Dim CvePSTemp = CvePaqueteArmado Dim CveSeccionAlmacen As Integer = -1 - Dim Drp As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePaqueteArmado).FiltroPrimero("") + Dim Drp As DataRow = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=CvePaqueteArmado).FiltroPrimero("") - Dim CveUMTemp As Integer = Drp("CveUM").ToString.ToEntero + Dim CveUMTemp As Integer = Drp("CveUnidadMedida").ToString.ToEntero Dim AplicaSeccion As Boolean = CBool(Drp("AplicaSeccion")) If AplicaSeccion Then CveSeccionAlmacen = GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, CveAlmacenArmado, CvePaqueteArmado).FiltroPrimeroValor("CveSeccionAlmacen").ToEntero End If - - If AplicaSeriePaquete Then + If AplicaSeriePaquete Or AplicaLotePaquete Or AplicaCaducidadPaquete Then Dim ContadorPaquete = 1 Dim DtSeriesComponentes As New DataTable For Each Gvr As GridViewRow In GvSeriesPaqueteArmado.Rows @@ -900,7 +863,6 @@ Partial Class Inventarios_PaquetesArmadoDesarmado Next End If Next - ContadorPaquete = ContadorPaquete + 1 Next Else @@ -934,7 +896,7 @@ Partial Class Inventarios_PaquetesArmadoDesarmado Dim CvePSTemp As Integer = CvePaqueteDesarmado Dim CveSeccionAlmacen As Integer = -1 - Dim Drp As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePaqueteDesarmado).FiltroPrimero("") + Dim Drp As DataRow = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=CvePaqueteDesarmado).FiltroPrimero("") Dim CveUMTemp As Integer = Drp("CveUM").ToString.ToEntero 'Dim AplicaSeccion As Boolean = CBool(Drp("AplicaSeccion")) @@ -1070,9 +1032,9 @@ Partial Class Inventarios_PaquetesArmadoDesarmado If Not TieneError Then Dim Msg As New StringBuilder - Msg.AppendFormat("
El Movimiento de salida se registro con el Folio: {1}", CveMovimientoSalida, FolioSalida) + Msg.AppendFormat("
El Movimiento de salida se registro con el Folio: {1}", CveMovimientoSalida, FolioSalida) Msg.AppendFormat("
Imprimir Movimiento ", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimientoSalida))) - Msg.AppendFormat("


El Movimiento de entrada se registro con el Folio: {1}", CveMovimientoEntrada, FolioEntrada) + Msg.AppendFormat("

El Movimiento de entrada se registro con el Folio: {1}", CveMovimientoEntrada, FolioEntrada) Msg.AppendFormat("
Imprimir Movimiento ", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimientoEntrada))) Alert(Msg.ToString, TipoMensaje.MsgInformacion) ObjInventario.Commit() @@ -1659,8 +1621,8 @@ Partial Class Inventarios_PaquetesArmadoDesarmado End If Dim AplicaCaducidad = False - If GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSSerieLote).FiltraParametros("").Rows(0) IsNot Nothing Then - AplicaCaducidad = If(GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSSerieLote).FiltraParametros("").Rows(0)("AplicaCaducidad").ToString = "True", True, False) + If GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=CvePSSerieLote).FiltraParametros("").Rows(0) IsNot Nothing Then + AplicaCaducidad = If(GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=CvePSSerieLote).FiltraParametros("").Rows(0)("AplicaCaducidad").ToString = "True", True, False) End If Row("ConsecId") = CveConsecSerieLote @@ -1754,7 +1716,7 @@ Partial Class Inventarios_PaquetesArmadoDesarmado 'VERIFICA EXISTENCIAS Dim ObjInventarios As New ClsInventarios - Dim CveUMTemp = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePaqueteDesarmado).FiltroPrimeroValor("CveUM").ToEntero + Dim CveUMTemp = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=CvePaqueteDesarmado).FiltroPrimeroValor("CveUM").ToEntero Dim Existencia = ObjInventarios.GetExistenciasPS(CvePaqueteDesarmado, CveUMTemp, UsuarioActual.CveEmpresa, CveAlmacenDesarmado, FechaMovto:=TxtFechaDesarmado.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), Serie:=Serie, CveVendedor:=CveVendedor, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), Lote:=Lote, FechaCaducidad:=FechaCaducidad) diff --git a/OP/OP.aspx b/OP/OP.aspx index 4547e62b8..4bb7a8c47 100644 --- a/OP/OP.aspx +++ b/OP/OP.aspx @@ -505,7 +505,7 @@ @@ -591,7 +591,7 @@ CssClass="table table-striped table-hover" GridLines="None" Width="100%"> - + @@ -842,7 +842,7 @@
Materia Prima
- diff --git a/OP/OP.aspx.vb b/OP/OP.aspx.vb index a106b2781..d53c63686 100644 --- a/OP/OP.aspx.vb +++ b/OP/OP.aspx.vb @@ -41,15 +41,7 @@ Partial Class OP_OP Private Property DtMO As DataTable Get - If ViewState("DtMO") Is Nothing Then - DtMO = New DataTable() - DtMO.Columns.Add("CvePS", GetType(Integer)) ' Producto asociado - DtMO.Columns.Add("CvePuesto", GetType(Integer)) - DtMO.Columns.Add("Puesto", GetType(String)) - DtMO.Columns.Add("CostoHora", GetType(Decimal)) - DtMO.Columns.Add("Total", GetType(Decimal)) - End If - Return CType(ViewState("DtMO"), DataTable) + Return DirectCast(ViewState("DtMO"), DataTable) End Get Set(value As DataTable) ViewState("DtMO") = value @@ -58,16 +50,7 @@ Partial Class OP_OP Private Property DtCI As DataTable Get - If ViewState("DtCI") Is Nothing Then - DtCI = New DataTable() - DtCI.Columns.Add("CvePS", GetType(Integer)) ' Producto asociado - DtCI.Columns.Add("CvePSMateriaPrima", GetType(Integer)) - DtCI.Columns.Add("productoMateriaPrima", GetType(String)) - DtCI.Columns.Add("Cantidad", GetType(Decimal)) - DtCI.Columns.Add("PU", GetType(Decimal)) - DtCI.Columns.Add("Total", GetType(Decimal)) - End If - Return CType(ViewState("DtCI"), DataTable) + Return DirectCast(ViewState("DtCI"), DataTable) End Get Set(value As DataTable) ViewState("DtCI") = value @@ -87,7 +70,7 @@ Partial Class OP_OP Get If ViewState("DtMPAgregados") Is Nothing Then DtMPAgregados = New DataTable() - DtMPAgregados.Columns.Add("Clave", GetType(Integer)) + DtMPAgregados.Columns.Add("CvePS", GetType(Integer)) DtMPAgregados.Columns.Add("PSCodigo", GetType(String)) DtMPAgregados.Columns.Add("CveUM", GetType(Integer)) DtMPAgregados.Columns.Add("UnidadMedida", GetType(String)) @@ -129,7 +112,7 @@ Partial Class OP_OP Private Sub CreaPS() DtPS = New DataTable() DtPS.Columns.Add("Tipo", GetType(String)) ' Producto, MP, MO, CI - DtPS.Columns.Add("Clave", GetType(Integer)) + DtPS.Columns.Add("CvePS", GetType(Integer)) DtPS.Columns.Add("PSCodigo", GetType(String)) DtPS.Columns.Add("UnidadMedida", GetType(String)) DtPS.Columns.Add("Cantidad", GetType(Decimal)) @@ -139,7 +122,7 @@ Partial Class OP_OP DtMP = New DataTable() DtMP.Columns.Add("Tipo", GetType(String)) ' Producto, MP, MO, CI - DtMP.Columns.Add("Clave", GetType(Integer)) + DtMP.Columns.Add("CvePS", GetType(Integer)) DtMP.Columns.Add("CvePSMateriaPrima", GetType(Integer)) DtMP.Columns.Add("CveUM", GetType(Integer)) DtMP.Columns.Add("CveUMMateriaPrima", GetType(Integer)) @@ -152,7 +135,7 @@ Partial Class OP_OP DtMO = New DataTable() DtMO.Columns.Add("Tipo", GetType(String)) ' Producto, MP, MO, CI - DtMO.Columns.Add("Clave", GetType(Integer)) + DtMO.Columns.Add("CvePS", GetType(Integer)) DtMO.Columns.Add("CveUM", GetType(Integer)) DtMO.Columns.Add("CvePuesto", GetType(Integer)) DtMO.Columns.Add("Puesto", GetType(String)) @@ -163,10 +146,12 @@ Partial Class OP_OP DtCI = New DataTable() DtCI.Columns.Add("Tipo", GetType(String)) ' Producto, MP, MO, CI - DtCI.Columns.Add("Clave", GetType(Integer)) + DtCI.Columns.Add("CvePS", GetType(Integer)) DtCI.Columns.Add("productoMateriaPrima", GetType(String)) + DtCI.Columns.Add("CvePSProducto", GetType(Integer)) DtCI.Columns.Add("Cantidad", GetType(Decimal)) - DtCI.Columns.Add("PU", GetType(Decimal)) + 'DtCI.Columns.Add("Costo", GetType(Decimal)) + DtCI.Columns.Add("ImporteCostoIndirecto", GetType(Decimal)) DtCI.Columns.Add("Total", GetType(Decimal)) @@ -262,7 +247,7 @@ Partial Class OP_OP For Each rowProducto As DataRow In ObjOP.DtResultados.Rows Dim newRow As DataRow = DtPS.NewRow() newRow("Tipo") = "Producto" - newRow("Clave") = rowProducto("CvePS").ToString.ToEntero + newRow("CvePS") = rowProducto("CvePS").ToString.ToEntero newRow("PSCodigo") = rowProducto("Producto").ToString newRow("UnidadMedida") = rowProducto("UnidadMedida").ToString @@ -277,9 +262,9 @@ Partial Class OP_OP For Each rowMP As DataRow In ObjOP.DtResultados.Rows Dim newRow As DataRow = DtMP.NewRow() newRow("Tipo") = "MP" - newRow("Clave") = rowMP("CvePS").ToString.ToEntero + newRow("CvePS") = rowMP("CvePS").ToString.ToEntero newRow("PSCodigo") = rowMP("Producto").ToString - newRow("CvePSMateriaPrima") = rowMP("CvePS").ToString.ToEntero + newRow("CvePSMateriaPrima") = rowMP("CvePSMateriaPrima").ToString.ToEntero newRow("CveUMMateriaPrima") = rowMP("CveUM").ToString.ToEntero newRow("UnidadMedida") = rowMP("UnidadMedida").ToString newRow("Cantidad") = rowMP("Cantidad").ToString.ToDecimal @@ -294,8 +279,11 @@ Partial Class OP_OP For Each rowMO As DataRow In ObjOP.DtResultados.Rows Dim newRow As DataRow = DtMO.NewRow() newRow("Tipo") = "MO" + newRow("CvePS") = rowMO("CvePS").ToString().ToEntero() newRow("Puesto") = rowMO("Puesto").ToString newRow("Cantidad") = rowMO("Cantidad").ToString.ToDecimal + newRow("CostoHora") = rowMO("precioHora").ToString.ToDecimal() + newRow("Total") = rowMO("Cantidad").ToString().ToDecimal() * rowMO("precioHora").ToString().ToDecimal() DtMO.Rows.Add(newRow) Next End If @@ -306,8 +294,12 @@ Partial Class OP_OP For Each rowCI As DataRow In ObjOP.DtResultados.Rows Dim newRow As DataRow = DtCI.NewRow() newRow("Tipo") = "CI" + newRow("CvePS") = rowCI("CvePS").ToString().ToEntero() + newRow("CvePSProducto") = rowCI("CvePSProducto").ToString().ToEntero() + 'newRow("CvePSMateriaPrima") = rowCI("CvePSMateriaPrima").ToString().ToEntero() newRow("productoMateriaPrima") = rowCI("producto").ToString - newRow("Costo") = rowCI("Costo").ToString.ToDecimal + newRow("ImporteCostoIndirecto") = rowCI("ImporteCostoIndirecto").ToString.ToDecimal() + newRow("Total") = rowCI("ImporteCostoIndirecto") DtCI.Rows.Add(newRow) Next @@ -353,7 +345,7 @@ Partial Class OP_OP Dim DrPS As DataRow = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") newRow("Tipo") = "Producto" - newRow("Clave") = CvePS + newRow("CvePS") = CvePS newRow("PSCodigo") = DrPS("PSCodigo") newRow("UnidadMedida") = DrPS("UnidadMedida") newRow("Cantidad") = 1 @@ -371,14 +363,14 @@ Partial Class OP_OP For Each drMP As DataRow In ObjMP.DtResultados.Rows Dim rowMP As DataRow = DtMP.NewRow() rowMP("Tipo") = "MP" - rowMP("Clave") = CvePS - rowMP("CvePSMateriaPrima") = CvePS + rowMP("CvePS") = CvePS + rowMP("CvePSMateriaPrima") = drMP("CvePSMateriaPrima").ToString().ToEntero() rowMP("CveUM") = CveUM - rowMP("CveUMMateriaPrima") = CveUM 'drMP("CveUMMateriaPrima").ToString().ToEntero() + rowMP("CveUMMateriaPrima") = drMP("CveUMMateriaPrima").ToString().ToEntero() rowMP("PSCodigo") = drMP("productoMateriaPrima").ToString() rowMP("UnidadMedida") = drMP("UnidadMedidaMateriaPrima").ToString() rowMP("Cantidad") = drMP("Cantidad").ToString().ToDecimal() - 'rowMP("CvePSProducto") = CvePS + rowMP("Surtido") = 0 DtMP.Rows.Add(rowMP) Next @@ -390,7 +382,7 @@ Partial Class OP_OP For Each drMO As DataRow In ObjMO.DtResultados.Rows Dim rowMO As DataRow = DtMO.NewRow() rowMO("Tipo") = "MO" - rowMO("Clave") = CvePS + rowMO("CvePS") = CvePS rowMO("Puesto") = drMO("Puesto").ToString() rowMO("Cantidad") = drMO("Cantidad").ToString().ToDecimal() rowMO("CostoHora") = drMO("precioHora").ToString.ToDecimal() @@ -406,12 +398,12 @@ Partial Class OP_OP For Each drCI As DataRow In ObjCI.DtResultados.Rows Dim rowCI As DataRow = DtCI.NewRow() rowCI("Tipo") = "CI" - rowCI("Clave") = CvePS + rowCI("CvePS") = CvePS + rowCI("CvePSProducto") = drCI("CvePSProducto").ToString() 'rowCI("CvePSMateriaPrima") = drCI("CvePSMateriaPrima").ToString().ToEntero() rowCI("productoMateriaPrima") = drCI("productoMateriaPrima").ToString() - rowCI("Cantidad") = drCI("Cantidad").ToString().ToDecimal() - rowCI("PU") = drCI("ImporteCostoIndirecto").ToString().ToDecimal() - rowCI("Total") = rowCI("Cantidad").ToString().ToDecimal() * rowCI("PU").ToString().ToDecimal() + rowCI("ImporteCostoIndirecto") = drCI("ImporteCostoIndirecto").ToString().ToDecimal() + rowCI("Total") = rowCI("ImporteCostoIndirecto") DtCI.Rows.Add(rowCI) Next End If @@ -429,7 +421,7 @@ Partial Class OP_OP Dim btnEliminar As LinkButton = DirectCast(sender, LinkButton) Dim CveProducto As Integer = btnEliminar.CommandArgument.ToEntero() - Dim filasProducto As DataRow() = DtPS.Select($"Clave = {CveProducto}") + Dim filasProducto As DataRow() = DtPS.Select($"CvePS = {CveProducto}") If filasProducto.Length > 0 Then DtPS.Rows.Remove(filasProducto(0)) EliminarDatosRelacionados(CveProducto) @@ -440,19 +432,19 @@ Partial Class OP_OP Private Sub EliminarDatosRelacionados(CveProducto As Integer) ' Materia Prima - Dim filasMP As DataRow() = DtMP.Select($"Clave = {CveProducto}") + Dim filasMP As DataRow() = DtMP.Select($"CvePS = {CveProducto}") For Each fila As DataRow In filasMP DtMP.Rows.Remove(fila) Next ' Mano de Obra - Dim filasMO As DataRow() = DtMO.Select($"Clave = {CveProducto}") + Dim filasMO As DataRow() = DtMO.Select($"CvePS = {CveProducto}") For Each fila As DataRow In filasMO DtMO.Rows.Remove(fila) Next ' Costos Indirectos - Dim filasCI As DataRow() = DtCI.Select($"Clave = {CveProducto}") + Dim filasCI As DataRow() = DtCI.Select($"CvePS = {CveProducto}") For Each fila As DataRow In filasCI DtCI.Rows.Remove(fila) Next @@ -791,7 +783,7 @@ Partial Class OP_OP Alert("Orden creada con Folio: " & FolioGenerado, TipoMensaje.MsgInformacion) End If Else ' Modo EDICIÓN - Dim CvePS As Integer = DtPS.Rows(0)("Clave").ToString.ToEntero() + Dim CvePS As Integer = DtPS.Rows(0)("CvePS").ToString.ToEntero() Dim Cantidad As Integer = DtPS.Rows(0)("Cantidad").ToString.ToEntero() BtnFinalizarOP.Visible = True If Not clsOP.UpdateOP( @@ -832,7 +824,7 @@ Partial Class OP_OP For Each row As DataRow In dt.Rows Dim producto As XmlElement = xmlDoc.CreateElement("Producto") - producto.InnerXml = $"{row("Clave")}{row("Cantidad")}{row("CveUM")}" + producto.InnerXml = $"{row("CvePS")}{row("Cantidad")}{row("CveUM")}" xmlDoc.DocumentElement.AppendChild(producto) Next @@ -1004,7 +996,7 @@ Partial Class OP_OP Try 'Salida de MP - CveMovimientoSalida = ObjInventario.AddMovimiento(DdlAlmacenOrigenSalidaMP.SelectedValue.ToEntero(), TipoMovimientoSalida, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:="Finalización OP #" & LblFolio.Text, Modulo:="OP/FinalizarOPSalida") + CveMovimientoSalida = ObjInventario.AddMovimiento(DdlAlmacenOrigenSalidaMP.SelectedValue.ToEntero(), TipoMovimientoSalida, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:="Finalización OP #" & LblFolio.Text, Modulo:="OP/FinalizarOPSalida", CveOP:=CveOP) FolioEntrada = ObjInventario.Folio Dim DtMPAlmacen As DataTable = Nothing If CveMovimientoSalida > 0 Then @@ -1014,6 +1006,7 @@ Partial Class OP_OP Dim CveUM As Integer = rowMP("CveUMMateriaPrima").ToString.ToEntero Dim Cantidad As Decimal = rowMP("Cantidad").ToString.ToDecimal + ' Registrar detalle If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, Cantidad, CveUM, CvePS, 0) Then ErrorMovInv = True @@ -1031,35 +1024,44 @@ Partial Class OP_OP ' 1. Recorrer cada Producto Terminado en la OP For Each rowProducto As DataRow In DtPS.Select("Tipo = 'Producto'") - Dim CvePSProducto As Integer = rowProducto("Clave").ToString.ToEntero() + Dim CvePSProducto As Integer = rowProducto("CvePS").ToString.ToEntero() Dim CantidadProducto As Decimal = rowProducto("Cantidad").ToString.ToDecimal() + Dim MPProducto As Decimal = 0 + Dim MOProducto As Decimal = 0 + Dim CIProducto As Decimal = 0 ' 2. Calcular Costo de Materias Primas por Producto - For Each rowMP As DataRow In DtMP.Select($"Clave = {CvePSProducto}") + For Each rowMP As DataRow In DtMP.FiltraParametros($"CvePS = {CvePSProducto}").Rows Dim CvePSMP As Integer = rowMP("CvePSMateriaPrima").ToString.ToEntero() Dim CveUMMP As Integer = rowMP("CveUMMateriaPrima").ToString.ToEntero() - Dim PU As Decimal = DtMPAlmacen.FiltroPrimeroValor("PU", $"CvePS = {CvePSMP} AND CveUM = {CveUMMP}").ToDecimal() - TotalMPProducto += rowMP("Cantidad").ToString().ToDecimal() * PU + Dim PU As Decimal = DtMPAlmacen.FiltroPrimeroValor("PU", $"CvePS = {CvePSMP}").ToDecimal() + MPProducto += rowMP("Cantidad").ToString().ToDecimal() * PU Next ' 3. Calcular Mano de Obra por Producto - For Each rowMO As DataRow In DtMO.Select($"Clave = {CvePSProducto}") - TotalMOProducto += rowMO("Total").ToString.ToDecimal() + For Each rowMO As DataRow In DtMO.FiltraParametros($"CvePS = {CvePSProducto}").Rows + MOProducto += rowMO("Total").ToString.ToDecimal() Next ' 4. Calcular Costos Indirectos por Producto - For Each rowCI As DataRow In DtCI.Select($"Clave = {CvePSProducto}") - TotalCIProducto += rowCI("Total").ToString.ToDecimal() + For Each rowCI As DataRow In DtCI.FiltraParametros($"CvePSProducto = {CvePSProducto}").Rows + CIProducto += rowCI("Total").ToString.ToDecimal() Next ' 5. Determinar las devoluciones del Producto - Dim TotalDevPT As Decimal = GvMPUtilizada.Rows.Cast(Of GridViewRow)().Where($"datakey.cvepspt = {CvePSProducto}").Sum(Function(row) DirectCast(row.FindControl("TxtDevolucionMP"), TextBox).Text.ToDecimal()) + Dim TotalDevPT As Decimal = GvMPUtilizada.Rows.Cast(Of GridViewRow)().Where(Function(row) GvMPUtilizada.DataKeys(row.RowIndex).Values(0).ToString().ToEntero() = CvePSProducto).Sum(Function(row) DirectCast(row.FindControl("TxtDevolucionMP"), TextBox).Text.ToDecimal()) ' 6. Sumar Total por Producto (MP + MO + CI) - Dim TotalProducto As Decimal = TotalMPProducto + TotalMOProducto + TotalCIProducto - TotalDevPT + Dim TotalProducto As Decimal = MPProducto + MOProducto + CIProducto - TotalDevPT rowProducto("Costo") = TotalProducto + + TotalMPProducto += MPProducto + TotalMOProducto += MOProducto + TotalCIProducto += CIProducto Next + DtPS.AcceptChanges() + ' 2. PROCESAR DEVOLUCIONES SI EXISTEN If Not ErrorMovInv Then Dim TotalDevoluciones As Decimal = GvMPUtilizada.Rows.Cast(Of GridViewRow)().Sum(Function(row) DirectCast(row.FindControl("TxtDevolucionMP"), TextBox).Text.ToDecimal()) @@ -1070,7 +1072,7 @@ Partial Class OP_OP Exit Sub End If - CveMovimientoDev = ObjInventario.AddMovimiento(DdlAlmacenDevolucion.SelectedValue.ToEntero(), TipoMovimientoDev, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=$"Devolución OP #{LblFolio.Text}", Modulo:="OP/Devoluciones", CveMovimientoRelacionado:=CveMovimientoSalida) + CveMovimientoDev = ObjInventario.AddMovimiento(DdlAlmacenDevolucion.SelectedValue.ToEntero(), TipoMovimientoDev, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=$"Devolución OP #{LblFolio.Text}", Modulo:="OP/Devoluciones", CveMovimientoRelacionado:=CveMovimientoSalida, CveOP:=CveOP) If CveMovimientoDev > 0 Then For Each row As GridViewRow In GvMPUtilizada.Rows @@ -1101,16 +1103,17 @@ Partial Class OP_OP 'ENTRADA DE PRODUCTO TERMINADO If Not ErrorMovInv Then - CveMovimientoEntrada = ObjInventario.AddMovimiento(DdlAlmacenTerminado.SelectedValue.ToEntero(), CveConceptoEntrada, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:="Finalización OP #" & LblFolio.Text, Modulo:="OP/FinalizarOPEntrada", CveMovimientoRelacionado:=CveMovimientoSalida) + CveMovimientoEntrada = ObjInventario.AddMovimiento(DdlAlmacenTerminado.SelectedValue.ToEntero(), CveConceptoEntrada, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:="Finalización OP #" & LblFolio.Text, Modulo:="OP/FinalizarOPEntrada", CveMovimientoRelacionado:=CveMovimientoSalida, CveOP:=CveOP) End If If CveMovimientoEntrada > 0 AndAlso Not ErrorMovInv Then - Dim CostoPTAjustado As Decimal = TotalCostoMP - CostoDevoluciones - Dim CantidadPT As Decimal = DtPS.AsEnumerable().Sum(Function(r) r.Field(Of Decimal)("Cantidad")) - Dim PU_PT As Decimal = If(CantidadPT > 0, CostoPTAjustado / CantidadPT, 0) + Dim CostoTotalProduccion As Decimal = TotalMPProducto + TotalMOProducto + TotalCIProducto + Dim CostoPTAjustado As Decimal = CostoTotalProduccion - CostoDevoluciones + 'Dim CantidadPT As Decimal = DtPS.AsEnumerable().Sum(Function(r) r.Field(Of Decimal)("Cantidad")) + 'Dim PU_PT As Decimal = If(CantidadPT > 0, CostoPTAjustado / CantidadPT, 0) For Each rowPT As DataRow In DtPS.Select("Tipo = 'Producto'") - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, rowPT("Cantidad").ToString.ToDecimal(), rowPT("CveUM").ToString.ToEntero(), rowPT("Clave").ToString.ToEntero(), rowPT("Costo").ToString.ToDecimal()) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, rowPT("Cantidad").ToString.ToDecimal(), rowPT("CveUM").ToString.ToEntero(), rowPT("CvePS").ToString.ToEntero(), rowPT("Costo").ToString.ToDecimal()) Then ErrorMovInv = True : TextoError = "x" : Exit For End If Next @@ -1129,15 +1132,15 @@ Partial Class OP_OP ErrorMovInv = True End If 'dev MP - If Not ErrorMovInv AndAlso CostoDevoluciones <> 0 AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, CostoDevoluciones, CostoDevoluciones, 95, "", $"OP #{LblFolio.Text}", CveMovimientoAlmacen:=CveMovimientoDev) Then + If Not ErrorMovInv AndAlso CostoDevoluciones <> 0 AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, CostoDevoluciones, CostoDevoluciones, 68, "Devoluciones PT OP #" & LblFolio.Text, "Devoluciones PT OP #" & LblFolio.Text, CveMovimientoAlmacen:=CveMovimientoDev) Then ErrorMovInv = True End If 'costo indirecto - If Not ErrorMovInv AndAlso TotalCIProducto <> 0 AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, TotalCIProducto, TotalCIProducto, 95, "Producción PT OP #" & LblFolio.Text, "Producción PT OP #" & LblFolio.Text) Then + If Not ErrorMovInv AndAlso TotalCIProducto <> 0 AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, TotalCIProducto, TotalCIProducto, 95, "Costo Indirecto PT OP #" & LblFolio.Text, "Costo Indirecto PT OP #" & LblFolio.Text) Then ErrorMovInv = True End If 'mano de obra - If Not ErrorMovInv AndAlso TotalCIProducto <> 0 AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, TotalMOProducto, TotalCIProducto, 95, "Producción PT OP #" & LblFolio.Text, "Producción PT OP #" & LblFolio.Text) Then + If Not ErrorMovInv AndAlso TotalCIProducto <> 0 AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, TotalMOProducto, TotalMOProducto, 95, "Mano de Obra PT OP #" & LblFolio.Text, "Mano de Obra PT OP #" & LblFolio.Text) Then ErrorMovInv = True End If End If diff --git a/Sistemas/UsuarioDetalle.aspx.vb b/Sistemas/UsuarioDetalle.aspx.vb index 46a4906b3..3113d2ecc 100644 --- a/Sistemas/UsuarioDetalle.aspx.vb +++ b/Sistemas/UsuarioDetalle.aspx.vb @@ -1382,13 +1382,14 @@ Partial Class Sistemas_UsuarioDetalle ' End If 'RECARGA GLOBAL ESTATUS - GlobalDTOCEstatusUsuarios(tCveEmpresa) = Nothing - - 'If ObjOC.GetEstatusUsuarios(-1, -1, -1, -1, -1) Then Application("GlobalDTOCEstatusUsuarios") = ObjOC.DtResultados Else Application("GlobalDTOCEstatusUsuarios") = Nothing - - - 'RECARGA GLOBAL ALMACEN - 'If ObjUsuarios.GetAlmacen(-1, UsuarioActual.CveEmpresa) Then Application("GlobalDTAlmacenUsuarios") = ObjUsuarios.DtResultados Else Application("GlobalDTAlmacenUsuarios") = Nothing + GlobalDTOCEstatus(tCveEmpresa) = Nothing + GlobalDTOCEstatusUsuarios(tCveEmpresa) = Nothing + + 'If ObjOC.GetEstatusUsuarios(-1, -1, -1, -1, -1) Then Application("GlobalDTOCEstatusUsuarios") = ObjOC.DtResultados Else Application("GlobalDTOCEstatusUsuarios") = Nothing + + + 'RECARGA GLOBAL ALMACEN + 'If ObjUsuarios.GetAlmacen(-1, UsuarioActual.CveEmpresa) Then Application("GlobalDTAlmacenUsuarios") = ObjUsuarios.DtResultados Else Application("GlobalDTAlmacenUsuarios") = Nothing GlobalDTAlmacenUsuarios(-1, tCveEmpresa) = Nothing 'RECARGA GLOBAL EMPRESAS USUARIOS diff --git a/Ventas/ActualizarPrecios.aspx.vb b/Ventas/ActualizarPrecios.aspx.vb index a09d59cb4..3aaa0ed3a 100644 --- a/Ventas/ActualizarPrecios.aspx.vb +++ b/Ventas/ActualizarPrecios.aspx.vb @@ -315,6 +315,14 @@ Partial Class Ventas_ActualizarPrecios GvMultiple.DataBind() End If + 'sms, ocultar las últimos 2 columnas, solo mostrar la columna de precio + If UsuarioActual.Empresa.Funcionalidad(578) = "1" Then + If Not UsuarioActual.TienePermisoProceso(201) Then 'puede ver importes de inventario + GvMultiple.Columns(GvMultiple.Columns.Count - 1).Visible = False + GvMultiple.Columns(GvMultiple.Columns.Count - 2).Visible = False + End If + End If + UpDescargar.Update() UpDatos.Update() UPPrecioLista.Update() @@ -998,7 +1006,6 @@ Partial Class Ventas_ActualizarPrecios Dim TxtId As String = "TxtPrecio_" + (colIndex - 1).ToString() If indiceColumna <= DtPreciosMultiple.Columns.Count - 1 Then - Dim CvePrecioLista As Integer = GvMultiple.HeaderRow.FCLabel(LtlId).Attributes().Item("cvepreciolista").ToEntero() Dim Precio As Decimal = GvRow.FCTextBox(TxtId).Text.ToDecimal() TieneError = Not ObjPS.UpdatePSPreciosLista(Precio, CvePrecioLista, 0, CvePS, UsuarioActual.CveUsuario, NowADS(), True) @@ -1009,30 +1016,23 @@ Partial Class Ventas_ActualizarPrecios Dim splitValues As String() = text.Split("|"c) If splitValues.Length > 1 Then - Dim PrecioLista As String = splitValues(1) - Dim DrPS = DtPS.FiltroPrimero($"CvePS = {CvePS}") If DrPS IsNot Nothing Then TieneError = ActualizarPreciosFranquicia(ObjPS, DrPS("Codigo").ToString(), Precio, 0, PrecioLista, UpdatePrecioMinimo:=False) Else TieneError = True End If - End If - Else Exit For End If - If TieneError Then Exit For End If End If - Next End If - Next Catch ex As Exception OnError("Ocurrió un error al actualizar precios", ex)