From 816622b06b44467df117a97baf74d3660b21e765 Mon Sep 17 00:00:00 2001 From: rakcsle Date: Wed, 27 Nov 2024 16:13:41 -0700 Subject: [PATCH 1/3] VYA Viajes --- App_Code/ClsPaginas.vb | 4 +- App_Code/ClsTransportes.vb | 6 +- Compras/Compras.aspx.vb | 8 +- Compras/PopUpVerFactura.aspx.vb | 52 + Inventarios/TrasladoSolicitud.aspx | 68 +- Inventarios/TrasladoSolicitud.aspx.vb | 72 +- Transportes/Boletos.aspx | 24 +- Transportes/Boletos.aspx.vb | 80 +- Transportes/RepContratoDetalle.aspx | 480 ++++++---- Transportes/RepContratoDetalle.aspx.vb | 217 ++++- Transportes/RepContratos.aspx | 1 + Transportes/RepViajes.aspx | 14 +- Transportes/RepViajes.aspx.vb | 85 +- Ventas/ActualizarPrecios.aspx.vb | 3 +- Ventas/BKActualizarPrecios.aspx.BK | 896 ++++++++++++++++++ Ventas/BKActualizarPrecios.aspx.vb.BK | 1201 ++++++++++++++++++++++++ 16 files changed, 2855 insertions(+), 356 deletions(-) create mode 100644 Ventas/BKActualizarPrecios.aspx.BK create mode 100644 Ventas/BKActualizarPrecios.aspx.vb.BK diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index b5c868fcb..c4a63945c 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -7680,8 +7680,8 @@ Public Class ClsPaginas If Not RutaReporte.ToUpper().StartsWith(bdir.ToUpper()) Then RutaReporte = String.Format("{0}{1}", bdir, RutaReporte) End If - Dim urlHost As String = "http://sig.adssistemas.mx:7998/" - 'Dim urlHost As String = "http://localhost:2202/" + 'Dim urlHost As String = "http://sig.adssistemas.mx:7998/" + Dim urlHost As String = "http://localhost:2202/" If EsProduccion Then urlHost = "http://192.200.113.178:6599/" End If diff --git a/App_Code/ClsTransportes.vb b/App_Code/ClsTransportes.vb index cdf3f7d73..11e65e7bc 100644 --- a/App_Code/ClsTransportes.vb +++ b/App_Code/ClsTransportes.vb @@ -190,7 +190,9 @@ Public Class ClsTransportes Return Retorno End Function - Public Function UpdateViajesPasajeros(CveViajePasajero As Integer, Optional CveViaje As Integer = -1, Optional CveVendedor As Integer = -1, Optional Importe As Decimal = -1, Optional Asiento As Integer = -1, Optional Nombre As String = "", Optional Visa As String = "", Optional Celular As String = "", Optional Observacion As String = "", Optional Estatus As Boolean = True, Optional CveUsuario As Integer = -1, Optional Sexo As Boolean = True) As Boolean + Public Function UpdateViajesPasajeros(CveViajePasajero As Integer, Optional CveViaje As Integer = -1, Optional CveVendedor As Integer = -1, Optional Importe As Decimal = -1, Optional Asiento As Integer = -1, Optional Nombre As String = "", + Optional Visa As String = "", Optional Celular As String = "", Optional Observacion As String = "", Optional Estatus As Boolean = True, Optional CveUsuario As Integer = -1, Optional Sexo As Boolean = True, + Optional FechaNacimiento As Date = MinFecha) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Trans_ViajesPasajerosUpdate") @@ -207,6 +209,8 @@ Public Class ClsTransportes .Add("@Estatus", SqlDbType.Bit).Value = Estatus .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario .Add("@Sexo", SqlDbType.Bit).Value = Sexo + .Add("@FechaNacimiento", SqlDbType.Date).Value = FechaNacimiento + End With Try diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 6dd1247d9..06c455a78 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -9478,6 +9478,10 @@ Partial Class Compras_Compras Private Function validaFechaNumeroReembolso() As Boolean + If UsuarioActual.CveEmpresa <> 119 Then + Return True + End If + Dim respuesta As Boolean = True Dim CvePersonalVal As Integer = -1 Dim CveCajaChicaVal As Integer = -1 @@ -9521,9 +9525,9 @@ Partial Class Compras_Compras respuesta = False 'La fecha de la compra esta por fuera de lo permitido mes actual o mes anterior If FechaCompra.Month > MesReembolsoInt Then - Alert($"La fecha de la compra que se quiere registrar esta adelantada al mes de la comprobación (Fecha comprobación {FechaReembolso.ToString("dd/MM/yyyy")}).", TipoMensaje.MsgAdvertencia) + Alert($"La fecha de la compra que se quiere registrar esta adelantada al mes de la comprobación (Reembolso {TxtRembolsoNumero.Text} ,Fecha comprobación {FechaReembolso.ToString("dd/MM/yyyy")}).", TipoMensaje.MsgAdvertencia) Else - Alert($"La fecha de la compra que se quiere registrar es anterior al mes permitido por la comprobación (Fecha comprobación {FechaReembolso.ToString("dd/MM/yyyy")}).", TipoMensaje.MsgAdvertencia) + Alert($"La fecha de la compra que se quiere registrar es anterior al mes permitido por la comprobación (Reembolso {TxtRembolsoNumero.Text}, Fecha comprobación {FechaReembolso.ToString("dd/MM/yyyy")}).", TipoMensaje.MsgAdvertencia) End If End If diff --git a/Compras/PopUpVerFactura.aspx.vb b/Compras/PopUpVerFactura.aspx.vb index c32a12610..31b9be8c5 100644 --- a/Compras/PopUpVerFactura.aspx.vb +++ b/Compras/PopUpVerFactura.aspx.vb @@ -1551,6 +1551,16 @@ Partial Class PopUpVerFactura End If End If + + 'Boleto + If UrlParametros("OP").ToString = "BOLETO" Then + 'CveViajePasajero + Dim CVEVIAJEPASAJERO As Integer = UrlParametros("CVEVIAJEPASAJERO").ToString.ToEntero + If CVEVIAJEPASAJERO > 0 Then + ImprimeBoletoViale(CVEVIAJEPASAJERO) + End If + End If + End Sub Private Function Parametros(Cadena As String) As Hashtable @@ -6502,6 +6512,48 @@ Partial Class PopUpVerFactura #End Region +#Region "IMPRESION BOLETOS " + + Public Sub ImprimeBoletoViale(CveViajePasajero As Integer) + + If Not CveViajePasajero > 0 Then Exit Sub + + Dim ObjTransportes As New ClsTransportes + Dim DtViajePAsajero As New DataTable + If ObjTransportes.GetViajesPasajeros(-1, CveViajePasajero) Then + DtViajePAsajero = ObjTransportes.DtResultados + End If + ObjTransportes.Dispose() + + If DtViajePAsajero Is Nothing Or (DtViajePAsajero IsNot Nothing AndAlso DtViajePAsajero.Rows.Count = 0) Then + Exit Sub + End If + + + Dim Fecha As Date = DtViajePAsajero.Rows(0)("FechaIng").ToString.ToDate + Dim Importe As Decimal = DtViajePAsajero.Rows(0)("Importe").ToString.ToDecimal + + Dim params As New List(Of ReportParameter) From { + New ReportParameter("Ruta", DtViajePAsajero.Rows(0)("SubProyecto").ToString), + New ReportParameter("Origen", DtViajePAsajero.Rows(0)("Partida").ToString), + New ReportParameter("Destino", DtViajePAsajero.Rows(0)("Destino").ToString), + New ReportParameter("FechaSalida", Fecha.ToShortDateString()), + New ReportParameter("HoraSalida", Fecha.ToString("HH:mm")), + New ReportParameter("Nombre", DtViajePAsajero.Rows(0)("Nombre").ToString), + New ReportParameter("Visa", DtViajePAsajero.Rows(0)("Visa").ToString), + New ReportParameter("Celular", DtViajePAsajero.Rows(0)("Celular").ToString), + New ReportParameter("Importe", Math.Round(Importe, 2).ToString), + New ReportParameter("TipoBoleto", "Tipo Boleto"), + New ReportParameter("Agencia", "Agencia"), + New ReportParameter("TelefonoAgencia", "TelefonoAgencia"), + New ReportParameter("Asiento", DtViajePAsajero.Rows(0)("Asiento").ToString) + } + + ImprimirPDFStimul($"{UsuarioActual.Empresa.Ruta}Formatos\Boleto.mrt", New DataTable, params, NombreArchivo:="Boleto") + + End Sub + +#End Region Private Function GeneraCodigoQR(CodigoBarras As String, Alto As Integer, Largo As Integer, Margen As Integer, Formato As String, Optional PureBacode As Boolean = False) As Byte() diff --git a/Inventarios/TrasladoSolicitud.aspx b/Inventarios/TrasladoSolicitud.aspx index 1d551f1c3..de1de47b9 100644 --- a/Inventarios/TrasladoSolicitud.aspx +++ b/Inventarios/TrasladoSolicitud.aspx @@ -3,6 +3,30 @@ + Reporte de solicitudes de traspaso @@ -192,7 +216,7 @@
- +
@@ -338,6 +362,48 @@ } } } + + + + $('.DdlPS').on("select2:open", function (e) { $('.select2-container.select2-container--default .select2-dropdown .select2anothertable').remove(); }); + $("body").on("mouseenter", ".select2-container.select2-container--default.select2-container--open .select2-dropdown li", function (event) { + var $this = $(this); + var ind = $this.index(); + $(".select2-container.select2-container--default.select2-container--open .select2-dropdown .select2anothertable tr.active").removeClass('active'); + $(".select2-container.select2-container--default.select2-container--open .select2-dropdown .select2anothertable tr:nth-child(" + (ind + 2) + ")").addClass('active'); + //log($this); + }); + var scrollfuncion = function () { + var stop = this.scrollTop; + $(".select2-container.select2-container--default.select2-container--open .select2-dropdown .select2anothertable").scrollTop(stop); + } + + function CargaExistenciaAlmacenes(data, params) { + var div = $('
'); + $('.select2-container.select2-container--default.select2-container--open .select2-dropdown .select2anothertable').remove(); + $('.select2-container.select2-container--default.select2-container--open .select2-dropdown').prepend(div); + var table = $('
'); div.append(table); + var tbody = $(''); table.append(tbody); + $(".select2-container--default .select2-results>.select2-results__options").off("scroll", scrollfuncion); + $(".select2-container--default .select2-results>.select2-results__options").scroll(scrollfuncion); + var indexd = 0; + data.forEach(function (item) { + if (indexd == 0) { + var tr = $(''); tbody.append(tr); + var td; + for (var key in item) { + if (!(key == "text" || key == "id")) { td = $('' + key + ''); tr.append(td); } + } + } + var tr = $(''); tbody.append(tr); + + var td; + for (var key in item) { + if (!(key == "text" || key == "id")) { td = $(' 0) ? 'style = "font-weight:bold;"' : '') + '>' + item[key] + ''); tr.append(td); } + } + indexd += 1; + }); + } diff --git a/Inventarios/TrasladoSolicitud.aspx.vb b/Inventarios/TrasladoSolicitud.aspx.vb index 3c77c4262..9d284a14f 100644 --- a/Inventarios/TrasladoSolicitud.aspx.vb +++ b/Inventarios/TrasladoSolicitud.aspx.vb @@ -69,7 +69,8 @@ Partial Class Inventarios_TrasladoSolicitud Private Sub InicializaValores() CreaDTTemporal() CargaAlmacenes() - CargaPS() + 'CargaPS() + CargaFuncionalidad105() 'CargaClientes() ' CargaUnidadMedida() @@ -92,25 +93,70 @@ Partial Class Inventarios_TrasladoSolicitud End Sub +#Region " FUNCIONALIDAD 105-141 " + Private Sub CargaFuncionalidad105() + Dim EsWS As Boolean = If(UsuarioActual.Empresa.Funcionalidad(105) = "1" Or UsuarioActual.Empresa.Funcionalidad(141) = "1", True, False) - Private Sub CargaPS() - DdlProductoServicio.setEsWebService(UsuarioActual.Empresa.Funcionalidad(105) = "1") + DdlProductoServicio.setEsWebService(EsWS) + + If DdlProductoServicio.UsaWebService Then + 'If isWithFamily() Then + ' DdlP2.ddlWS.Attributes.Add("data-idSubFamilia", DdlClasificacion.ClientID) + 'Else + ' DdlP2.ddlWS.Attributes.Add("data-cveclasificacion", DdlClasificacion.SelectedValue) + 'End If + DdlProductoServicio.IncluyeTodos = False + DdlProductoServicio.ddlWS.Attributes.Add("data-pagina", "inv/traspaso") + + If UsuarioActual.Empresa.Funcionalidad(141) = "1" Or True Then + DdlProductoServicio.ddlWS.Attributes.Add("Data-onresult", "CargaExistenciaAlmacenes") + 'CargaSucursal() + 'DdlSubProyecto.AutoPostBack = True + End If + DdlProductoServicio.Attributes.Add("Data-usoclasificacion", "-1") + Else + CargaPS(-1, DdlProductoServicio) + 'DdlP2.ddl.Items.Add(New ListItem("Seleccione", "-1")) + 'DdlP2.ddl.Items.Add(New ListItem("*** Actualizar listado de Productos o Servicios ***", "-2")) + End If + End Sub + + Private Sub CargaPS(CveClasificacion As Integer, Objeto As ADServerControl.Dropdownlost) If UsuarioActual.Empresa.Funcionalidad(105) = "1" Then - DdlProductoServicio.ddlWS.Attributes.Add("data-cveclasificacion", "-1") - DdlProductoServicio.SelectedText = "" - DdlProductoServicio.SelectedValue = "-1" + Objeto.ddlWS.Attributes.Add("data-cveclasificacion", CveClasificacion.ToString) + ' Objeto.ddlWS.Attributes.Add("data-pagina", "oc/oc") + Objeto.SelectedText = "" + Objeto.SelectedValue = "-1" Else - DdlProductoServicio.ddl.Items.Clear() - DdlProductoServicio.ddl.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CveClasificacion:=-1) - DdlProductoServicio.ddl.DataBind() - DdlProductoServicio.ddl.Items.Insert(0, New ListItem("Seleccione el Producto", "-1")) + Objeto.ddl.Items.Clear() + Objeto.ddl.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacion).FiltraParametros("", "PSCodigo") + Objeto.ddl.DataBind() + 'Objeto.Items.Insert(0, New ListItem("*** Actualizar listado de Productos o Servicios ***", "-2")) + Objeto.ddl.Items.Insert(0, New ListItem("Seleccione el Producto", "-1")) End If - 'DdlProductoServicio.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa) - 'DdlProductoServicio.DataBind() - 'DdlProductoServicio.Items.Insert(0, New ListItem("Seleccione", "-1")) End Sub +#End Region + + 'Private Sub CargaPS() + ' DdlProductoServicio.setEsWebService(UsuarioActual.Empresa.Funcionalidad(105) = "1") + + ' If UsuarioActual.Empresa.Funcionalidad(105) = "1" Then + ' DdlProductoServicio.ddlWS.Attributes.Add("data-cveclasificacion", "-1") + ' DdlProductoServicio.SelectedText = "" + ' DdlProductoServicio.SelectedValue = "-1" + ' Else + ' DdlProductoServicio.ddl.Items.Clear() + ' DdlProductoServicio.ddl.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CveClasificacion:=-1) + ' DdlProductoServicio.ddl.DataBind() + ' DdlProductoServicio.ddl.Items.Insert(0, New ListItem("Seleccione el Producto", "-1")) + ' End If + ' 'DdlProductoServicio.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa) + ' 'DdlProductoServicio.DataBind() + ' 'DdlProductoServicio.Items.Insert(0, New ListItem("Seleccione", "-1")) + 'End Sub + Private Sub CargaCombos() DdlAlmacenOrigenFiltro.DataSource = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltraParametros("CveTipoAlmacen = 1") 'GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1).FiltraParametros("CveTipoAlmacen <> 9") DdlAlmacenOrigenFiltro.DataBind() diff --git a/Transportes/Boletos.aspx b/Transportes/Boletos.aspx index d3a9f9080..c7720bf91 100644 --- a/Transportes/Boletos.aspx +++ b/Transportes/Boletos.aspx @@ -272,8 +272,28 @@

- +
+
+
+ +
+
+ + +
+
+ <%-- + + + + + +
+ +
--%> +
+ +
diff --git a/Transportes/Boletos.aspx.vb b/Transportes/Boletos.aspx.vb index 04954c40c..8fe42f08a 100644 --- a/Transportes/Boletos.aspx.vb +++ b/Transportes/Boletos.aspx.vb @@ -4,6 +4,7 @@ Imports System.Data Imports ADSNetLibrary.Helpers Imports Extensiones Imports Extensiones.ModExtensiones + Partial Class Boletos Inherits ClsPaginas #Region "Propiedades" @@ -77,9 +78,7 @@ Partial Class Boletos If Not IsPostBack Then - If UsuarioActual.CveRol = 1583 Then - EsAgencia = True - End If + If Request.QueryString("CveViaje") Is Nothing And UsuarioActual.CveVendedor <> Nothing And UsuarioActual.CveVendedor <> -1 Then Response.Redirect("/Transportes/RepViajes.aspx") @@ -92,8 +91,24 @@ Partial Class Boletos Alert("Viaje no definido") End If + Permisos() + End If End Sub + Private Sub Permisos() + + If UsuarioActual.CveRol = 1583 Then + EsAgencia = True + If UsuarioActual.CveVendedor <= 0 Then + Alert("El usuario no tiene Vendedor Asignado", TipoMensaje.MsgAdvertencia) + End If + End If + + If UsuarioActual.TienePermisoProceso(400) Then + TxtImporte.Enabled = True + End If + + End Sub Private Sub CargaDatos() Dim ObjContratos As New ClsContratos Dim ObjViaje As New ClsTransportes @@ -180,30 +195,33 @@ Partial Class Boletos Dim CveSubProyecto As Integer = Contrato.Rows(0)("CveSubProyecto").ToString.ToEntero If ObjDestinos.GetDestinosTarifas(CveSubProyecto, DdlPartida.SelectedValue.ToEntero, DdlDestino.SelectedValue.ToEntero) Then - Dim fechaHoy As Date = Date.Today - Dim fechaNacimiento As Date = TxtFechaNacimiento.Text.ToDate - Dim edad As Integer - ' Calcular la diferencia en años entre la fecha actual y la fecha de nacimiento - edad = CInt(DateDiff(DateInterval.Year, fechaNacimiento, fechaHoy)) - If edad <= 4 Or edad >= 60 Then - ImporteR = ObjDestinos.DtResultados.FiltroPrimeroValor("Importe").ToDecimal.RoundSQL - 20 + Dim edad As Integer = CInt(DateDiff(DateInterval.Year, TxtFechaNacimiento.Text.ToDate, Date.Today)) + Dim Mes As Integer = TxtFecha.Text.ToDate.Month + + If Mes.Contiene(11, 12) Then 'Tarifas de meses Noviembre y Diciembre + ImporteR = If(Mes = 11, ObjDestinos.DtResultados.FiltroPrimeroValor("ImporteNov").ToDecimal.RoundSQL, ObjDestinos.DtResultados.FiltroPrimeroValor("ImporteDic").ToDecimal.RoundSQL) Else ImporteR = ObjDestinos.DtResultados.FiltroPrimeroValor("Importe").ToDecimal.RoundSQL - End If + + ImporteR = If(edad <= 4 Or edad >= 60, ImporteR - 20, ImporteR) + End If If ImporteR > 0 Then ViewState("Importe") = ImporteR - LbCostos.Text = $"El precio de su boleto es ${ImporteR.FormatoNumero}" + LbCostos.Text = $"El precio de su boleto es:" LbCostos.Visible = True + TxtImporte.Text = ImporteR.FormatoNumero + TxtImporte.Visible = True BtnAgregarPasajero.Visible = True LbAviso.Visible = True Else ViewState("Importe") = 0 BtnAgregarPasajero.Visible = False LbCostos.Visible = False + TxtImporte.Visible = False Alert("No se encontro una tarifa para estos destinos", TipoMensaje.MsgAdvertencia) End If @@ -249,6 +267,7 @@ Partial Class Boletos End If dr("CveViajePasajero") = CveViajePasajero + 'dr("Numero") = dr("Importe").ToString Next @@ -305,7 +324,9 @@ Partial Class Boletos ObjTransporte.Commit() ObjTransporte.Dispose() - SbAlert.Append("El boleto se genero correctamente.") + SbAlert.Append("El boleto se genero correctamente.
") + + GeneraLinksDescargaBoleto(SbAlert) DtPasajeros.Clear() GvB.DataSource = DtPasajeros @@ -321,7 +342,8 @@ Partial Class Boletos CargaDatos() End If - Alert(SbAlert.ToString(), If(TieneError, TipoMensaje.MsgError, TipoMensaje.MsgInformacion), ShowCloseButton:=False) + Alert(SbAlert.ToString(), If(TieneError, TipoMensaje.MsgError, TipoMensaje.MsgInformacion), ShowCloseButton:=False, JSBtnAceptar:="window.location.reload();") + End Try LbAviso.Visible = False @@ -331,6 +353,20 @@ Partial Class Boletos UpPanel.Update() End Sub + + Private Sub GeneraLinksDescargaBoleto(ByRef SB As StringBuilder) + + For Each dRow As DataRow In DtPasajeros.Rows + Dim CveViajePasajero As Integer = dRow("CveViajePasajero").ToString.ToEntero + + If CveViajePasajero > 0 Then + Dim Liga As String = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=BOLETO&CVEVIAJEPASAJERO={0}", CveViajePasajero.ToString))) + SB.Append($" Boleto: {dRow("Nombre").ToString}
") + End If + Next + + End Sub + Protected Sub DdlPartida_SelectedIndexChanged(sender As Object, e As EventArgs) DdlDestino.DataSource = DtDestinos.FiltraParametros($"CveDestinoOrigen = {DdlPartida.SelectedValue}") DdlDestino.DataBind() @@ -358,6 +394,13 @@ Partial Class Boletos End Sub Protected Sub AgregarPasajero(sender As Object, e As EventArgs) + If EsAgencia Then + If UsuarioActual.CveVendedor <= 0 Then + Alert("El usuario no tiene Vendedor Asignado", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + End If + If AsientoSeleccionado = "" Then Alert("No se ha seleccionado el asiento.") Exit Sub @@ -372,7 +415,7 @@ Partial Class Boletos Dr1("Destino") = DdlDestino.SelectedItem Dr1("CveDestinoOrigen") = DdlPartida.SelectedValue.ToEntero Dr1("CveDestinoFinal") = DdlDestino.SelectedValue.ToEntero - Dr1("Importe") = Me.Importe + Dr1("Importe") = TxtImporte.Text.ToDecimal 'Me.Importe Dr1("Asiento") = AsientoSeleccionado.Replace("A", "") Dr1("Nombre") = TxtNombre.Text.Trim 'Dr1("INE") = TxtINE.Text.Trim @@ -415,11 +458,11 @@ Partial Class Boletos Private Function CrearRemision(ByRef objTrans As ClsTransportes) As Modelos.Factura.MMensajeFactura Dim Retorno As New Modelos.Factura.MMensajeFactura - Dim CveCliente As Integer = 1154164 + Dim CveCliente As Integer = 1172306 ' 1154164 Dim CveMoneda As Integer = 2 Dim CveSubProyecto As Integer = -1 - Dim CvePSBoleto As Integer = 912720 + Dim CvePSBoleto As Integer = 907706 '912720 If EsProduccion Then CvePSBoleto = 986337 @@ -501,4 +544,7 @@ Partial Class Boletos Return Retorno End Function + + + End Class diff --git a/Transportes/RepContratoDetalle.aspx b/Transportes/RepContratoDetalle.aspx index 04151d1a5..907b28858 100644 --- a/Transportes/RepContratoDetalle.aspx +++ b/Transportes/RepContratoDetalle.aspx @@ -11,6 +11,17 @@
  • Imprimir Contrato
  • + + +
  • + Manifiesto +
  • +
    + + + +
    +
    @@ -111,7 +122,9 @@ <%-- Información General --%> +
    + <%-- Datos del Contrato --%>
    @@ -494,220 +507,274 @@
    - <%-- Bitácora --%> -
    -
    -
    + <%-- Bitácora --%> - <%--
    - Bitácora -
    +
    + + -
    -
    -
    - - -
    --%> -
    - <%----%> - Bitacora -
    -
    -
    -
    - Agendar
    - - - <%----%> +
    +
    +
    +
    +
    + Bitacora +
    +
    +
    +
    + Agendar
    + + + + +
    +
    + +
    +
    + + + + + + Fecha + + + + + + Fecha Agenda + + + + + + Usuario + + + + + + Descripción + + + + + + Archivo + + + + + + + + + + + + + +
    +
    +
    +
    + +
    +
    +
    +
    +
    + + Historial de Modificación +
    +
    +
    +
    +
    +
    +
    + + + + Fecha + + + + + + + + + + + +
    +
    +
    +
    + + + + + + + + + + + + +
    +
    + +
    +
    +
    + + +
    +
    +
    + + +
    + Vendedor: + +
    +
    + + + +
    + + +
    +
    +
    +
    -
    - - - - - - Fecha - - - - - - Fecha Agenda - - - - - - Usuario - - - - - - Descripción - - - - - - Archivo - - - - - - - - - - - - - +
    + +
    + + " style="display: inline-block; margin-right: -20px; width: 150px;" /> + " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> + +
    + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <%-- --%> + + + + +
    -
    -
    - - -
    -
    -
    -
    -
    - - Historial de Modificación -
    -
    -
    -
    -
    -
    -
    - - - - Fecha - - - - - - - - - - - -
    -
    -
    -
    -
    -
    + + + + + - <%-- Pre init --%> - <%-- - - - --%> - <%-- Boletos --%> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + <%-- Modal Editar Boleto --%> +
    - +
    @@ -821,6 +888,16 @@
    +
    + +
    + + +
    +
    +
    @@ -1145,8 +1222,7 @@
    diff --git a/Transportes/RepContratoDetalle.aspx.vb b/Transportes/RepContratoDetalle.aspx.vb index 64c21f6b6..57bf1dc1a 100644 --- a/Transportes/RepContratoDetalle.aspx.vb +++ b/Transportes/RepContratoDetalle.aspx.vb @@ -1,11 +1,12 @@ Option Explicit On Option Strict On +Imports System.Activities.Statements Imports System.Data Imports System.Data.SqlClient Imports System.IO Imports Extensiones Imports Microsoft.Reporting.WebForms -Imports Modelos + Partial Class RepContratoDetalle @@ -231,6 +232,18 @@ Partial Class RepContratoDetalle End Property + Private Property DTViajesPasajeros As DataTable + Get + If ViewState("DTViajesPasajeros") Is Nothing Then + ViewState("DTViajesPasajeros") = New DataTable + End If + Return CType(ViewState("DTViajesPasajeros"), DataTable) + End Get + Set(value As DataTable) + ViewState("DTViajesPasajeros") = value + End Set + End Property + #End Region @@ -297,9 +310,34 @@ Partial Class RepContratoDetalle DdlSubProyecto.Items.Insert(0, New ListItem("Seleccione uno", "-1")) + DdlVendedor.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa) + DdlVendedor.DataBind() + DdlVendedor.Items.Insert(0, New ListItem("Todos", "-1")) + + For i As Integer = DdlVendedor.Items.Count - 1 To 0 Step -1 + If DdlVendedor.Items(i).Text = "Sin Asignar" Then + DdlVendedor.Items.RemoveAt(i) + End If + Next + + If EsAgencia Then + DdlVendedor.SelectedValueExist(UsuarioActual.CveVendedor) + DdlVendedor.Enabled = False + End If + + End Sub Private Sub CargaDatos() + + CargaDatosContrato() + CargaDatosViajes() 'Información General + + + + End Sub + + Private Sub CargaDatosContrato() Dim ObjContratos As New ClsContratos If ObjContratos.GetContratos(CveContrato, UsuarioActual.CveEmpresa) Then Contrato = ObjContratos.DtResultados @@ -322,7 +360,7 @@ Partial Class RepContratoDetalle TxtFechaSalida.Text = Contrato.Rows(0)("FechaInicial").ToString.ToDate.ToString("dd/MM/yyyy HH:mm:ss") TxtFechaRegreso.Text = Contrato.Rows(0)("FechaFinal").ToString.ToDate.ToString("dd/MM/yyyy HH:mm:ss") TxtCantidadPasajeros.Text = Contrato.Rows(0)("CantidadPasajeros").ToString - DdlTipoAF.SelectedValue = If(Contrato.Rows(0)("CveTipoAF") Is Nothing, "", Contrato.Rows(0)("CveTipoAF").ToString) + DdlTipoAF.SelectedValueExist(If(Contrato.Rows(0)("CveTipoAF") Is Nothing, "", Contrato.Rows(0)("CveTipoAF").ToString)) TxtImporte.Text = Math.Round(Importe, 2).ToString TxtAnticipo.Text = Math.Round(Anticipo, 2).ToString CveContratoEstatus = Contrato.Rows(0)("CveContratosEstatus").ToString.ToEntero @@ -367,17 +405,7 @@ Partial Class RepContratoDetalle A1.Visible = True End If - 'Boletos Vendidos - If Contrato.Rows(0)("CveContratoTipo").ToString() = "35" Then - TabBoletos.Visible = True - Dim ObjTransportes As New ClsTransportes - If ObjTransportes.GetViajesPasajeros(CveContrato) Then - GvViajesPasajeros.DataSource = ObjTransportes.DtResultados - BusquedaSeleccionada(ObjTransportes.DtResultados) - End If - ObjTransportes.Dispose() - GvViajesPasajeros.DataBind() - End If + ''Bitácora 'Dim ObjEventoBitacora As New ClsOIEventos 'If ObjEventoBitacora.GetEventos(-1, -1, -1, "-1", "-1", -1, -1, -1, -1, -1, -1, "-1", -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveContrato:=CveContrato) Then @@ -393,10 +421,38 @@ Partial Class RepContratoDetalle End If ObjContratos.Dispose() UpTabContainer.Update() - End Sub -#End Region + Private Sub CargaDatosViajes() + 'Boletos Vendidos + DTViajesPasajeros = New DataTable + If CveContratoTipo = 35 Then + TabBoletos.Visible = True + Dim ObjTransportes As New ClsTransportes + If ObjTransportes.GetViajesPasajeros(CveContrato) Then + + If DdlVendedor.SelectedValue.ToEntero > 0 Then + DTViajesPasajeros = ObjTransportes.DtResultados.FiltraParametros($" CveVendedor = {DdlVendedor.SelectedValue.ToEntero} ") + Else + DTViajesPasajeros = ObjTransportes.DtResultados + End If + + GvViajesPasajeros.DataSource = DTViajesPasajeros + BusquedaSeleccionada(DTViajesPasajeros) + + End If + ObjTransportes.Dispose() + GvViajesPasajeros.DataBind() + End If + UpPasajeros.Update() + UpTabContainer.Update() + End Sub + + +#End Region + Protected Sub DdlUsuarioFiltroBoletos_SelectedIndexChanged(sender As Object, e As EventArgs) + CargaDatosViajes() + End Sub #Region "Bitacora" Protected Sub GVEventoBitacora_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvEB.RowDataBound @@ -715,7 +771,7 @@ Partial Class RepContratoDetalle For Each dRow As DataRow In DTPrePoliza.Rows - If Not ObjConta.UpdatePrePolizasDetalle(dRow("CvePrePolizaDetalle").ToString.ToEntero, dRow("Concepto").ToString, dRow("CveSubProyecto").ToString.ToEntero, -1, Boolean.Parse(dRow("TipoMovto").ToString), ImporteMN:=(TotalNew * TC), Importe:=TotalNew, TipoCambio:=TC) Then + If Not ObjConta.UpdatePrePolizasDetalle(dRow("CvePrePolizaDetalle").ToString.ToEntero, dRow("Concepto").ToString, dRow("CveSubProyecto").ToString.ToEntero, -1, Boolean.Parse(dRow("TipoMovto").ToString), ImporteMN:=TotalNew, Importe:=TotalNew, TipoCambio:=TC) Then OcurrioError = True Exit For End If @@ -848,7 +904,7 @@ Partial Class RepContratoDetalle Try ObjTransportes.IniciaTransacSQL() - If ObjTransportes.UpdateViajesPasajeros(CveViajePasajero, DdlRuta.SelectedValue.ToEntero, UsuarioActual.CveVendedor, LbImporte.Text.ToDecimal, TxtAsiento.Text.ToEntero, TxtNombre.Text, TxtVisa.Text, TxtCelular.Text, TxtObservacion.Text, CBool(TxtEstatus.Text), UsuarioActual.CveUsuario, CBool(RblSexo.SelectedValue)) Then + If ObjTransportes.UpdateViajesPasajeros(CveViajePasajero, DdlRuta.SelectedValue.ToEntero, UsuarioActual.CveVendedor, LbImporte.Text.ToDecimal, TxtAsiento.Text.ToEntero, TxtNombre.Text, TxtVisa.Text, TxtCelular.Text, TxtObservacion.Text, CBool(TxtEstatus.Text), UsuarioActual.CveUsuario, CBool(RblSexo.SelectedValue), FechaNacimiento:=TxtFechaNacimiento.Text.ToDate) Then ObjTransportes.Commit() End If Catch ex As ArgumentException @@ -863,6 +919,7 @@ Partial Class RepContratoDetalle End Try CargaDatos() + RegistraScript(String.Format("$('#{0}').modal('hide');", "ModalEditar")) End Sub Protected Sub OnChangeRuta(sender As Object, e As EventArgs) @@ -901,53 +958,39 @@ Partial Class RepContratoDetalle ViajeActual = dt End Sub - Protected Sub ImprimirBoleto(sender As Object, e As EventArgs) - Dim dtResult As New DataTable() - Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) - Dim Fecha As Date = GvRow.DataKey("FechaIng").ToDate - Dim Importe As Decimal = GvRow.DataKey("Importe").ToDecimal - - Dim params As New List(Of ReportParameter) From { - New ReportParameter("Ruta", SubProyecto), - New ReportParameter("Origen", GvRow.DataKey("Partida")), - New ReportParameter("Destino", GvRow.DataKey("Destino")), - New ReportParameter("FechaSalida", Fecha.ToShortDateString()), - New ReportParameter("HoraSalida", Fecha.ToString("HH:mm")), - New ReportParameter("Nombre", GvRow.DataKey("Nombre")), - New ReportParameter("Visa", GvRow.DataKey("Visa")), - New ReportParameter("Celular", GvRow.DataKey("Celular")), - New ReportParameter("Importe", Math.Round(Importe, 2).ToString), - New ReportParameter("TipoBoleto", "Tipo Boleto"), - New ReportParameter("Agencia", "Agencia"), - New ReportParameter("TelefonoAgencia", "TelefonoAgencia"), - New ReportParameter("Asiento", GvRow.DataKey("Asiento")) - } - - ImprimirPDFStimul($"{UsuarioActual.Empresa.Ruta}Formatos\Boleto.mrt", dtResult, params, NombreArchivo:="Boleto") - - End Sub Protected Sub GvViajesPasajeros_RowDataBound(sender As Object, e As GridViewRowEventArgs) + If e.Row.RowType = DataControlRowType.DataRow Then If EsAgencia Then e.Row.FCLinkButton("BtnCancelar").Visible = False + e.Row.FCLinkButton("BtnReAgendar").Visible = False End If + Dim Liga As String = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=BOLETO&CVEVIAJEPASAJERO={0}", e.Row.DataKey("CveViajePasajero")))) + e.Row.FCLiteral("LtlImprimir").Text = $"" - ScriptManager.GetCurrent(Me).RegisterPostBackControl(e.Row.FCLinkButton("BtnImprimir")) + 'ScriptManager.GetCurrent(Me).RegisterPostBackControl(e.Row.FCLinkButton("BtnImprimir")) End If + + If e.Row.RowType = DataControlRowType.Footer Then + e.Row.FCLiteral("LtlImportePie").Text = DTViajesPasajeros.SUM("Importe").ToString("###,###,###.00") + End If + End Sub Protected Sub EditarBoleto(sender As Object, e As EventArgs) PnEditarUsuario.Visible = True PnEditarViaje.Visible = False PnAsientos.Visible = False + TxtFechaNacimiento.Enabled = True + TxtNombre.Enabled = True Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) CveViajePasajero = GvRow.DataKey("CveViajePasajero").ToEntero - DdlRuta.SelectedValue = GvRow.DataKey("CveViaje") + DdlRuta.SelectedValueExist(GvRow.DataKey("CveViaje")) LbPartida.Text = GvRow.DataKey("Partida").ToString() LbDestino.Text = GvRow.DataKey("Destino").ToString() LbImporte.Text = Convert.ToDecimal(GvRow.DataKey("Importe")).ToString("C") @@ -960,6 +1003,12 @@ Partial Class RepContratoDetalle TxtEstatus.Text = GvRow.DataKey("Estatus").ToString LbEstatus.CssClass = If(CBool(GvRow.DataKey("Estatus").ToString), "text-success bold", "text-danger bold") TxtAsiento.Text = GvRow.DataKey("Asiento").ToString() + TxtFechaNacimiento.Text = GvRow.DataKey("FechaNacimiento").ToString().ToDate.ToString("yyyy-MM-dd") 'Este es el formato que admite el control + + If EsAgencia Then + TxtFechaNacimiento.Enabled = False + TxtNombre.Enabled = False + End If UpTabContainer.Update() UpModal.Update() @@ -985,6 +1034,7 @@ Partial Class RepContratoDetalle LbEstatus.Text = GvRow.DataKey("Estatus").ToString() LbCreado.Text = GvRow.DataKey("FechaIng").ToString() TxtAsiento.Text = GvRow.DataKey("Asiento").ToString() + TxtFechaNacimiento.Text = GvRow.DataKey("FechaNacimiento").ToString().ToDate.ToString("dd/MM/yyyy") 'Seleccionamos la ruta que tiene el usuario actual DdlRuta.ClearSelection() @@ -998,7 +1048,7 @@ Partial Class RepContratoDetalle DdlRuta.Items.Add(listItem) Next End If - DdlRuta.SelectedValue = GvRow.DataKey("CveViaje") + DdlRuta.SelectedValueExist(GvRow.DataKey("CveViaje")) ObjContratos.Dispose() UpTabContainer.Update() RegistraScript(String.Format("$('#{0}').modal('show');", "ModalEditar")) @@ -1185,6 +1235,83 @@ Partial Class RepContratoDetalle End Class #End Region + + Protected Sub DdlVendedor_SelectedIndexChanged(sender As Object, e As EventArgs) + CargaDatosViajes() + End Sub + + +#Region "IMPRESION MANIFIESTO" + + 'Private Sub ImgExcel_Click(sender As Object, e As EventArgs) Handles ImgExcel.Click + ' GeneraPDF("Excel") + ' 'GvDatos.ExportToExcel("ReporteProductosServicios" & NowADS().ToShortDateString) + 'End Sub + + Private Sub PreparaManifiesto() + + + End Sub + + Protected Sub GeneraPDF(Optional Formato As String = "PDF") + + Dim DTManifiestoViajes As DataTable = DTViajesPasajeros.Copy + DTManifiestoViajes.Rows.Clear() + DTManifiestoViajes.Columns.Add("SexoStr") + + For x = 1 To 50 + + Dim dRow As DataRow = DTManifiestoViajes.NewRow + + Dim Encontrado As Boolean = False + + For Each faRow As DataRow In DTViajesPasajeros.Rows + + If faRow("Asiento").ToString.ToEntero = x Then + Encontrado = True + dRow("Asiento") = x + dRow("Nombre") = faRow("Nombre").ToString + dRow("Visa") = faRow("Visa").ToString + dRow("Celular") = faRow("Celular").ToString + dRow("SexoStr") = If(Boolean.Parse(faRow("Sexo").ToString), "Masculino", "Femenino") + dRow("Partida") = faRow("Partida").ToString + dRow("Destino") = faRow("Destino").ToString + dRow("Importe") = faRow("Importe").ToString.ToDecimal + Exit For + End If + + Next + + If Not Encontrado Then + dRow("Asiento") = x + End If + + DTManifiestoViajes.Rows.Add(dRow) + + Next + DTManifiestoViajes.TableName = "DTManifiestoViajes" + DTManifiestoViajes.AcceptChanges() + Dim DTManifiesto As DataTable = DTManifiestoViajes.FiltraParametros("", "Asiento") + DTManifiesto.TableName = "DTManifiestoViajes" + + Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png") + Dim params As New List(Of ReportParameter)() + params.Add(New ReportParameter("Empresa", UsuarioActual.Empresa.Empresa)) + params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) + params.Add(New ReportParameter("Contrato", TxtFolio.Text)) + params.Add(New ReportParameter("LogoPath", If(Imagen.Exists, $"file://{Imagen.FullName}", ""))) + params.Add(New ReportParameter("FechaSalida", TxtFechaSalida.Text)) + + ImprimirPDF("Empresas/Grales/Formatos/ManifiestoViajes.rdlc", DTManifiesto, params, "Reporte de Productos Servicios", Formato) + + End Sub + + + Protected Sub ImgPDF_Click(sender As Object, e As EventArgs) + GeneraPDF() + End Sub + +#End Region End Class diff --git a/Transportes/RepContratos.aspx b/Transportes/RepContratos.aspx index b1f82b7f8..90934b020 100644 --- a/Transportes/RepContratos.aspx +++ b/Transportes/RepContratos.aspx @@ -349,6 +349,7 @@
    + diff --git a/Transportes/RepViajes.aspx b/Transportes/RepViajes.aspx index e16860123..9754d8b19 100644 --- a/Transportes/RepViajes.aspx +++ b/Transportes/RepViajes.aspx @@ -186,19 +186,7 @@ TargetControlID="RFVTxtFechaViaje" Width="400px" BehaviorID="_content_VCETxtFechaViaje">
    -
    - -
    - -
    - - -
    -
    +
    diff --git a/Transportes/RepViajes.aspx.vb b/Transportes/RepViajes.aspx.vb index 334277a42..6736d3178 100644 --- a/Transportes/RepViajes.aspx.vb +++ b/Transportes/RepViajes.aspx.vb @@ -24,12 +24,27 @@ Partial Class ListadoViajes ViewState("Ruta") = value End Set End Property + + Private Property CveTipoActivoFijo As Integer + Get + If ViewState("CveTipoActivoFijo") Is Nothing Then + ViewState("CveTipoActivoFijo") = -1 + End If + Return ViewState("CveTipoActivoFijo").ToString().ToEntero + End Get + Set(value As Integer) + ViewState("CveTipoActivoFijo") = value + End Set + End Property + + #End Region #Region "Carga Página" Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load If Not IsPostBack Then + CveTipoActivoFijo = 181 'Autobuses CargaDatos() InicializaCombos() End If @@ -69,6 +84,7 @@ Partial Class ListadoViajes End If ObjContratos.Dispose() GvContratos.DataBind() + UpDatos.Update() End Sub #End Region @@ -94,7 +110,7 @@ Partial Class ListadoViajes BtnGuardar.Text = "Agregar" ModalLabel.InnerHtml = "Agregar Nuevo Viaje" - DdlTipoAF.SelectedValueExist(-1) + 'DdlTipoAF.SelectedValueExist(-1) DdlAF.SelectedValueExist(-1) DdlChofer.SelectedValueExist(-1) DdlChofer2.SelectedValueExist(-1) @@ -144,7 +160,7 @@ Partial Class ListadoViajes ObjContratos.IniciaTransacSQL() If Not ObjContratos.AddContratos(LbFolio.Text, "", "", UsuarioActual.CveProveedor, -1, -1, fecha, fecha, "", "", DdlRutas.SelectedValue.ToEntero, -1, -1, -1, -1, "", "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, -1, -1, -1, -1, 0, CveContratoTipo:=35, CveContratosEstatus:=50, CvePartida:=DdlPartida.SelectedValue.ToEntero, CveDestino:=DdlDestino.SelectedValue.ToEntero, CveMasivo:=CveMasivo, CveVendedor:=UsuarioActual.CveVendedor, - CveTipoAF:=DdlTipoAF.SelectedValue.ToEntero, CveAF:=DdlAF.SelectedValue.ToEntero, CveChofer:=DdlChofer.SelectedValue.ToEntero, CveChofer2:=DdlChofer2.SelectedValue.ToEntero) > 0 Then + CveTipoAF:=CveTipoActivoFijo, CveAF:=DdlAF.SelectedValue.ToEntero, CveChofer:=DdlChofer.SelectedValue.ToEntero, CveChofer2:=DdlChofer2.SelectedValue.ToEntero) > 0 Then 'ObjContratos.Commit() ErrorProceso = True Exit For @@ -192,14 +208,14 @@ Partial Class ListadoViajes If BtnGuardar.Text = "Agregar" Then If Not ObjContratos.AddContratos(LbFolio.Text, "", "", UsuarioActual.CveProveedor, -1, -1, TxtFechaViaje.Text.ToDate, TxtFechaViaje.Text.ToDate, "", "", DdlRutas.SelectedValue.ToEntero, -1, -1, -1, -1, "", "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, 0, 0, 0, 2, 0, CveContratoTipo:=35, CveContratosEstatus:=50, CvePartida:=DdlPartida.SelectedValue.ToEntero, CveDestino:=DdlDestino.SelectedValue.ToEntero, - CveTipoAF:=DdlTipoAF.SelectedValue.ToEntero, CveAF:=DdlAF.SelectedValue.ToEntero, CveChofer:=DdlChofer.SelectedValue.ToEntero, CveChofer2:=DdlChofer2.SelectedValue.ToEntero) > 0 Then + CveTipoAF:=CveTipoActivoFijo, CveAF:=DdlAF.SelectedValue.ToEntero, CveChofer:=DdlChofer.SelectedValue.ToEntero, CveChofer2:=DdlChofer2.SelectedValue.ToEntero) > 0 Then ErrorProceso = True End If Else 'Actualizamos Viaje If Not ObjContratos.UpdateContratos(CveContrato.ToEntero, LbFolio.Text, "", "", UsuarioActual.CveProveedor, -1, -1, TxtFechaInicial.Text.ToDate, TxtFechaInicial.Text.ToDate, "", "", DdlRutas.SelectedValue.ToEntero, -1, -1, -1, -1, "", "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, -1, -1, -1, 2, 0, CveContratoTipo:=35, CveContratosEstatus:=50, CvePartida:=DdlPartida.SelectedValue.ToEntero, CveDestino:=DdlDestino.SelectedValue.ToEntero, - CveTipoAF:=DdlTipoAF.SelectedValue.ToEntero, CveAF:=DdlAF.SelectedValue.ToEntero, CveChofer:=DdlChofer.SelectedValue.ToEntero, CveChofer2:=DdlChofer2.SelectedValue.ToEntero) = True Then + CveTipoAF:=CveTipoActivoFijo, CveAF:=DdlAF.SelectedValue.ToEntero, CveChofer:=DdlChofer.SelectedValue.ToEntero, CveChofer2:=DdlChofer2.SelectedValue.ToEntero) = True Then ErrorProceso = True End If End If @@ -262,15 +278,15 @@ Partial Class ListadoViajes Private Sub CargaUnidades() - Dim dttipoaf As DataTable = GlobalDTTipoActivoFijo(UsuarioActual.CveEmpresa).FiltraParametros("MedidaVehicularClave IN (2,3)") - DdlTipoAF.DataSource = dttipoaf - DdlTipoAF.DataBind() - DdlTipoAF.Items.Insert(0, New ListItem("-", "-1")) + 'Dim dttipoaf As DataTable = GlobalDTTipoActivoFijo(UsuarioActual.CveEmpresa).FiltraParametros("MedidaVehicularClave IN (2,3)") + 'DdlTipoAF.DataSource = dttipoaf + 'DdlTipoAF.DataBind() + 'DdlTipoAF.Items.Insert(0, New ListItem("-", "-1")) + + DdlAF.DataSource = GlobalDTActivoFijos(UsuarioActual.CveEmpresa).FiltraParametros($" EstadoActivoFijo= 'Activo' AND CveTipoActivoFijo = {CveTipoActivoFijo}") + DdlAF.DataBind() + DdlAF.Items.Insert(0, New ListItem("-", "-1")) - 'DdlAF.DataSource = GlobalDTActivoFijos(UsuarioActual.CveEmpresa).FiltraParametros(" EstadoActivoFijo= 'Activo' ") - 'DdlAF.DataBind() - 'DdlAF.Items.Insert(0, New ListItem("-", "-1")) - 'UpDatos.Update() UpModal.Update() End Sub Private Sub CargaChoferes() @@ -299,50 +315,5 @@ Partial Class ListadoViajes End Sub - Protected Sub DdlTipoAF_SelectedIndexChanged(sender As Object, e As EventArgs) - 'Dim FechaInicio As Date = TxtFechaViaje.Text.ToDate - 'If FechaInicio <= MinFecha Then - ' Alert("Debe seleccionar Fecha de viaje.", TipoMensaje.MsgAdvertencia) - ' DdlTipoAF.SelectedValueExist(-1) - ' UpModal.Update() - ' Exit Sub - 'End If - - CargaAFDdl(DdlTipoAF.SelectedValue.ToEntero) - - End Sub - - 'FIXME OIC REVISAR SI SE VA USAR - Private Sub CargaAFDdl(CveTipoAF As Integer) - 'Lista de Activos fijos - - 'DdlAF.ClearSelection() - 'DdlAF.SelectedValue = Nothing - 'DdlAF.Items.Clear() - - 'Dim FechaInicio As Date = TxtFechaViaje.Text.ToDate - 'Dim FinDeAnio As Date = New Date(FechaInicio.Year, 12, 31) - - 'Dim ObjContratos As New ClsContratos - 'If ObjContratos.GetContratosValUnidadesAgendadas(DdlAF.SelectedValue.ToEntero, TxtFechaViaje.Text.ToDate, FinDeAnio, UsuarioActual.CveEmpresa, -1, 2) Then - - ' If CveTipoAF > 0 Then - ' DdlAF.DataSource = ObjContratos.DtResultados.FiltraParametros($" CveTipoActivoFijo = {CveTipoAF} ") - ' Else - ' DdlAF.DataSource = ObjContratos.DtResultados - ' End If - 'End If - 'ObjContratos.Dispose() - - - - 'Lista de Activos fijos - DdlAF.DataSource = GlobalDTActivoFijos(UsuarioActual.CveEmpresa).FiltraParametros($" EstadoActivoFijo= 'Activo' AND CveTipoActivoFijo = {CveTipoAF} ") - DdlAF.DataBind() - DdlAF.Items.Insert(0, New ListItem("-", "-1")) - UpModal.Update() - - - End Sub End Class diff --git a/Ventas/ActualizarPrecios.aspx.vb b/Ventas/ActualizarPrecios.aspx.vb index 04d8660e0..f40f86240 100644 --- a/Ventas/ActualizarPrecios.aspx.vb +++ b/Ventas/ActualizarPrecios.aspx.vb @@ -263,6 +263,7 @@ Partial Class Ventas_ActualizarPrecios If UsuarioActual.CveEmpresa = 119 Then 'JAM GVPrecios.Columns(6).Visible = True + GVPrecios.Columns(7).Visible = False 'ult costo GVPrecios.Columns(11).Visible = True GVPrecios.Columns(13).Visible = True GVPrecios.Columns(15).Visible = True @@ -958,7 +959,7 @@ Partial Class Ventas_ActualizarPrecios If Dr IsNot Nothing Then 'VERIFICA QUE EL INDICE DE LA COLUMNA DEL DT NO SEA MAYOR A LA DEL GRIDVIEW - If indiceColumna <= DtPreciosMultiple.Columns.Count - 1 Then + If indiceColumna <= DtPreciosMultiple.Columns.Count - 3 Then Dim Valor As Decimal = DtPreciosMultiple.Rows(e.Row.RowIndex)(indiceColumna).ToString().ToDecimal() e.Row.FCTextBox(TxtId).Text = Valor.FormatoNumero(2) diff --git a/Ventas/BKActualizarPrecios.aspx.BK b/Ventas/BKActualizarPrecios.aspx.BK new file mode 100644 index 000000000..e54266f0b --- /dev/null +++ b/Ventas/BKActualizarPrecios.aspx.BK @@ -0,0 +1,896 @@ +<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="ActualizarPrecios.aspx.vb" Inherits="Ventas_ActualizarPrecios" EnableEventValidation="false" %> + + + + + + + + Actualizar Precios + + + + +
  • + Importar Listado +
  • + + + +
  • + Exportar Excel +
  • +
    + + + +
    + +
    + + + + +
    +
    +
    + + +
    +
    +
    + +
    + +
    +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + + + + +
    +
    +
    +
    +
    +
    + +
    + + Todos + Activos + Incativos + +
    + +
    + +
    + +
    + + +
    + +
    + +
    +
    +
    +
    +
    +
    + + +
    +
    +
    +
    +
    + + Actualizar Precio de Lista +
    +
    +
    +
    +
    +
    + +
    +
    +
    +
    +
    + + + + +
    +
    +
    +
    +
    + + + + $ +
    +
    + +
    +
    +
    +
    + + + + $ +
    +
    + +
    + + +
    + + + +
    +
    + +
    +
    +
    +
    +
    +
    +
    + + +
    +
    + " style="display: inline-block; margin-right: -20px; width: 150px;" /> + " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> +
    + + + + + + + + + + + + + + + + + + + + + + + <%-- + + --%> + + + + + + + + + + + <%-- + + --%> + + + + + + + + + + + + + + + + + + + +
    +
    +
    +
    +
    + +
    +
    +
    +
    +
    + " style="display: inline-block; margin-right: -20px; width: 150px;" /> + " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    +
    +
    +
    + + + <%--CARGA EXCEL--%> + +
    + + + + + diff --git a/Ventas/BKActualizarPrecios.aspx.vb.BK b/Ventas/BKActualizarPrecios.aspx.vb.BK new file mode 100644 index 000000000..e33509076 --- /dev/null +++ b/Ventas/BKActualizarPrecios.aspx.vb.BK @@ -0,0 +1,1201 @@ + +Option Explicit On +Option Strict On + +Imports System.Data +Imports System.IO +Imports Extensiones +Imports GemBox.Spreadsheet +Imports Microsoft.Reporting.WebForms +Imports ZXing + +Partial Class Ventas_ActualizarPrecios + Inherits ClsPaginas + + Private Property DtListasPrecios As DataTable + Get + Return If(IsNothing(ViewState("DtListasPrecios")), Nothing, CType(ViewState("DtListasPrecios"), DataTable)) + End Get + Set(value As DataTable) + ViewState("DtListasPrecios") = value + End Set + End Property + + Private Property DtSubProyectos As DataTable + Get + Return If(IsNothing(ViewState("DtSubProyectos")), Nothing, CType(ViewState("DtSubProyectos"), DataTable)) + End Get + Set(value As DataTable) + ViewState("DtSubProyectos") = value + End Set + End Property + + Private Property DtDatosPrecios As DataTable + Get + Return If(IsNothing(ViewState("DtDatosPrecios")), Nothing, CType(ViewState("DtDatosPrecios"), DataTable)) + End Get + Set(value As DataTable) + ViewState("DtDatosPrecios") = value + End Set + End Property + + Private Property DtPreciosMultiple As DataTable + Get + Return If(IsNothing(ViewState("DtPreciosMultiple")), Nothing, CType(ViewState("DtPreciosMultiple"), DataTable)) + End Get + Set(value As DataTable) + ViewState("DtPreciosMultiple") = value + End Set + End Property + + Private Property CveSucursal As Integer + Get + If ViewState("CveSucursal") Is Nothing Then + Return -1 + Else + Return ViewState("CveSucursal").ToString.ToEntero + End If + End Get + Set(value As Integer) + ViewState("CveSucursal") = value + End Set + End Property + + Private Property CvePS As Integer + Get + If ViewState("CvePS") Is Nothing Then + Return -1 + Else + Return ViewState("CvePS").ToString.ToEntero + End If + End Get + Set(value As Integer) + ViewState("CvePS") = value + End Set + End Property + + Private Property PS As String + Get + If ViewState("PS") Is Nothing Then + Return "" + Else + Return ViewState("PS").ToString + End If + End Get + Set(value As String) + ViewState("PS") = value + End Set + End Property + + Private Property PermisoEdicionLista As Boolean + Get + If ViewState("BloquearEdicionListas") Is Nothing Then + ViewState("BloquearEdicionListas") = True + End If + Return Boolean.Parse(ViewState("BloquearEdicionListas").ToString) + End Get + Set(value As Boolean) + ViewState("BloquearEdicionListas") = value + End Set + End Property + + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load + If Not Page.IsPostBack Then + If UsuarioActual.Empresa.Funcionalidad(578) = "1" Then + LblModalidad.Visible = True + DivModalidad.Visible = True + End If + If UsuarioActual.CveEmpresa.Contiene(189, 190, 192, 193) Then + LblModalidad.Visible = True + DivModalidad.Visible = True + End If + + If UsuarioActual.TienePermisoProceso(282) Then + PermisoEdicionLista = False + DivActualizarPrecio.Visible = False + HlAgregarExcel.Visible = False + End If + + CargaCombos() + + End If + End Sub + Public Sub CargaCombos() + CargaDDlClasif() + CargaPS() + CargaPreciosLista() + CargaProveedores() + CargarMarcas() + CargarModelos() + End Sub + Public Sub CargaDDlClasif() + DDlClasificacion.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa) + DDlClasificacion.DataBind() + DDlClasificacion.Items.Insert(0, New ListItem("Todos", "-1")) + End Sub + + Public Sub CargaPreciosLista() + + DdlPrecioLista.Items.Clear() + + If UsuarioActual.Empresa.Funcionalidad(404).ToEntero > 0 Then 'si maneja precios de lista + + Dim primerItem As String = "" + + DtListasPrecios = GlobalDTPrecioListas(UsuarioActual.CveEmpresa).Copy() + DdlPrecioLista.DataSource = DtListasPrecios + DdlPrecioListaCarga.DataSource = DtListasPrecios + DdlMultiplePrecioLista.DataSource = DtListasPrecios + primerItem = DtListasPrecios.FiltroPrimeroValor("CvePrecioLista") + + DdlPrecioLista.DataBind() + DdlPrecioListaCarga.DataBind() + DdlMultiplePrecioLista.DataBind() + + Dim SeleccionMaxima As Integer = 14 + If DtListasPrecios IsNot Nothing Then + If (DtListasPrecios.Rows.Count - 1) < 14 Then + SeleccionMaxima = DtListasPrecios.Rows.Count - 1 + End If + + Dim sbMultiple As New StringBuilder + For Each Row As DataRow In DtListasPrecios.FiltraPorIndices(0, SeleccionMaxima).Rows + sbMultiple.AppendFormat("{0},", Row("CvePrecioLista")) + Next + DdlMultiplePrecioLista.SelectedValuesIfExistM(sbMultiple.ToString(), True) + + If (DdlPrecioLista.Items.Count = 1) Then + DdlPrecioLista.Items.FindByValue(primerItem).Selected = True + End If + End If + + Else + DdlPrecioLista.Items.Insert(0, New ListItem("Sin Precio Lista", "-2")) + DdlPrecioListaCarga.Items.Insert(0, New ListItem("Sin Precio Lista", "-2")) + End If + + End Sub + + Public Sub CargaPS() + 'FUNCIONALIDAD 105 + If UsuarioActual.Empresa.Funcionalidad(105) = "1" Then + DDlPs.setEsWebService(True) + Else + DDlPs.setEsWebService(False) + + 'FUNCIONALIDAD DE COMPUESTO + If UsuarioActual.Empresa.Funcionalidad(143) = "1" Then + DDlPs.ddl.DataTextField = "PSCodigoCompuesto" + End If + + DDlPs.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa) + DDlPs.DataBind() + + DDlPs.ddl.Items.Insert(0, New ListItem("Todos", "-1")) + End If + End Sub + Private Sub CargaProveedores() + If UsuarioActual.Empresa.Funcionalidad(524) <> "" Then + DdlProveedor.setEsWebService(True) + DivProveedorCompra.Visible = True + LblProveedorCompra.Visible = True + End If + End Sub + Protected Sub CargarMarcas() + If UsuarioActual.Empresa.Funcionalidad(130) = "1" Then + Dim ObjMarcas As New ClsProductosServicios + If ObjMarcas.GetMarcas(UsuarioActual.CveEmpresa) Then + DdlMarca.DataSource = ObjMarcas.DtResultados.Copy + End If + ObjMarcas.Dispose() + DdlMarca.DataBind() + + LblMarca.Visible = True + DivMarca.Visible = True + End If + + DdlMarca.Items.Insert(0, New ListItem("Todos", "-1")) + End Sub + Private Sub CargarModelos() + If UsuarioActual.Empresa.Funcionalidad(558).ToString = "1" Then + lblModelo.Visible = True + DivModelo.Visible = True + Dim ObjGeneral As New ClsGenerales + If ObjGeneral.GetModelos(UsuarioActual.CveEmpresa) Then + DdlModelo.DataSource = ObjGeneral.DtResultados + End If + ObjGeneral.Dispose() + DdlModelo.DataBind() + End If + DdlModelo.Items.Insert(0, New ListItem("Seleccione", "-1")) + + End Sub + Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) + + Dim CveProveedor As Integer = -1 + Dim CvePS As Integer = -1 + Dim Marcas As String = If(DdlMarca.GetSelectedValuesM = "", "-1", DdlMarca.GetSelectedValuesM) + + If DDlPs.SelectedValue.ToEntero > 0 Then + CvePS = DDlPs.SelectedValue.ToEntero + End If + + If DdlProveedor.txtValue.Value.ToEntero > 0 Then + CveProveedor = DdlProveedor.txtValue.Value.ToEntero + End If + + 'POR LISTA DE PRECIO + If DdlModalidad.SelectedValue = "1" Then + Dim objPS As New ClsProductosServicios + If objPS.GetPSPreciosLista(UsuarioActual.CveEmpresa, DdlPrecioLista.SelectedValue.ToEntero, DDlClasificacion.SelectedValue.ToEntero, CvePS, + CveProveedor:=CveProveedor, Estado:=DdlEstado.SelectedValue.ToEntero, Marcas:=Marcas, CveModelo:=DdlModelo.SelectedValue.ToEntero) Then + DtDatosPrecios = objPS.DtResultados + GVPrecios.DataSource = DtDatosPrecios + End If + objPS.Dispose() + + If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then 'Empresa Acumuladores + GVPrecios.Columns(2).Visible = True + End If + + If UsuarioActual.CveEmpresa = 153 Then 'Empresa servec + GVPrecios.Columns(11).Visible = True + End If + + dvDatos.Visible = True + dvMultiple.Visible = False + + DivActualizarPrecio.Visible = True + + If UsuarioActual.TienePermisoProceso(282) Then + DivActualizarPrecio.Visible = False + End If + + GVPrecios.DataBind() + End If + + 'MULTIPLE LISTAS DE PRECIO + If DdlModalidad.SelectedValue = "2" Then + + Dim ListasPrecios As String = If(DdlMultiplePrecioLista.GetSelectedValuesM = "", "-1", DdlMultiplePrecioLista.GetSelectedValuesM) + + Dim objPS As New ClsProductosServicios + If objPS.GetPSMultiplesPreciosLista(UsuarioActual.CveEmpresa, ListasPrecios:=ListasPrecios, CveClasificacion:=DDlClasificacion.SelectedValue.ToEntero, CvePS:=CvePS, + CveProveedor:=CveProveedor, Estado:=DdlEstado.SelectedValue.ToEntero, Marcas:=Marcas, CveModelo:=DdlModelo.SelectedValue.ToEntero) Then + DtPreciosMultiple = objPS.DtResultados.Copy() + GvMultiple.DataSource = DtPreciosMultiple + End If + objPS.Dispose() + + dvDatos.Visible = False + dvMultiple.Visible = True + DivActualizarPrecio.Visible = False + + For colIndex As Integer = 2 To GvMultiple.Columns.Count - 1 + If colIndex <= DtPreciosMultiple.Columns.Count - 1 Then + GvMultiple.Columns(colIndex).Visible = True + Else + GvMultiple.Columns(colIndex).Visible = False + End If + Next + + GvMultiple.DataBind() + End If + + + UpDescargar.Update() + UpDatos.Update() + UPPrecioLista.Update() + End Sub + Protected Sub DDlClasificacion_SelectedIndexChanged(sender As Object, e As EventArgs) + CargaPS() + UpEncabezado.Update() + End Sub + Protected Sub RblTipo_SelectedIndexChanged(sender As Object, e As EventArgs) + If RblTipo.SelectedValue = "Imp" Then + ImporteFijo.Visible = True + Else + ImporteFijo.Visible = False + End If + UPPrecioLista.Update() + End Sub + Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs) Handles BtnGuardar.Click + If RblTipo.SelectedIndex = 1 And TxtPorcentaje.Text.ToDecimal = 0 Then + Alert("Se debe de especificar un porcentaje.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + Dim TieneError As Boolean = False + 'Dim Importe As Decimal = If(TxtImporte.Text = "", -1, TxtImporte.Text.ToDecimal) + Dim Porcentaje As Decimal = If(TxtPorcentaje.Text = "", -1, TxtPorcentaje.Text.ToDecimal) + Dim MensajeAlert As New StringBuilder + Dim sbProductos As New StringBuilder + + Dim ObjPS As New ClsProductosServicios + ObjPS.IniciaTransacSQL() + Try + For Each row As GridViewRow In GVPrecios.Rows + If row.FCCheckBox("chkPS").Checked Then + TieneError = Not ObjPS.UpdatePSPreciosLista(row.FCTextBox("TxtPrecio").Text.ToDecimal, DdlPrecioLista.SelectedValue.ToEntero, Porcentaje, row.DataKey("CvePS").ToEntero, UsuarioActual.CveUsuario, NowADS(), If(RblTipo.SelectedValue = "Imp", True, False), PrecioMinimo:=row.FCTextBox("TxtPrecioMinimo").Text.ToDecimal) + If CBool(row.DataKey("ProductoExhibicion")) Then + sbProductos.AppendFormat("{0},", row.DataKey("CvePS").ToEntero) + End If + + + If Not TieneError Then + TieneError = ActualizarPreciosFranquicia(ObjPS, row.DataKey("Codigo"), row.FCTextBox("TxtPrecio").Text.ToDecimal, row.FCTextBox("TxtPrecioMinimo").Text.ToDecimal, DdlPrecioLista.SelectedItem.Text) + Else + Exit For + End If + End If + Next + + If Not TieneError Then + If UsuarioActual.Empresa.Funcionalidad(109) = "1" AndAlso sbProductos.Length > 0 Then + MensajeAlert.AppendFormat("Los precios de lista de los productos/servicios se actualizaron correctamente.
    Descargar Etiquetas", Encripta(String.Format("OP=ETIQUETA&CVEPRECIOLISTA={0}&PRODUCTOS={1}", DdlPrecioLista.SelectedValue.ToEntero, sbProductos.ToString()))) + ImprimirEtiquetas(sbProductos.ToString()) + Else + MensajeAlert.Append("Los precios de lista de los productos/servicios se actualizaron correctamente.") + End If + + Alert(MensajeAlert.ToString()) + End If + Catch ex As Exception + TieneError = True + GuardaLog(ex.ToString()) + End Try + + If TieneError Then + ObjPS.RollBack() + Alert("Ocurrió un error al actualizar precios", TipoMensaje.MsgError) + Else + ObjPS.Commit() + End If + + ObjPS.Dispose() + BtnConsultar_Click(Nothing, Nothing) + RegistraScript("$('#divAgregar').modal('hide')") + TxtImporte.Text = "" + TxtPrecio.Text = "" + TxtPorcentaje.Text = "" + End Sub + +#Region "MODAL PRECIOS MINIMOS" + Public Sub LnkPrecioMinActual_Click(sender As Object, e As EventArgs) + + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + + CvePS = GvRow.DataKey("CvePS").ToEntero + PS = GvRow.DataKey("PS").ToString + + TxtAplicarPrecio.Text = "" + + CargaDatosModalPreciosMinimos() + + RegistraScript("$('#ModalActualizaPrecios').modal({ backdrop: 'static', keyboard: false}); $('#ChkSeleccionarTodos').find('input[type=checkbox]').prop('checked', false);") + + End Sub + + + Protected Sub LnkModalGuardarPreciosMinimos_Click(sender As Object, e As EventArgs) + ProcesaPreciosSucursales() + CargaDatosModalPreciosMinimos() + End Sub + + Private Sub CargaDatosModalPreciosMinimos() + + + Dim ObjPS As New ClsProductosServicios + If ObjPS.GetPSSucursales(CvePS, UsuarioActual.CveEmpresa) Then + gvSucursal.DataSource = ObjPS.DtResultados + End If + + ObjPS.Dispose() + gvSucursal.DataBind() + LtlModalTitleUpModalTitulo.Text = PS + UpModalActualizaPrecios.Update() + UpModalTitulo.Update() + + End Sub + + Private Sub ProcesaPreciosSucursales() + + Dim ObjProductosServicios As New ClsProductosServicios() + + For i As Integer = 0 To gvSucursal.Rows.Count - 1 + + If gvSucursal.Rows(i).FCCheckBox("chkSucursal").Checked Then + + If gvSucursal.Rows(i).FCHiddenField("hdnEnBD").Value.ToEntero = 1 Then + ObjProductosServicios.UpdatePSSucursales(CvePS, -1, gvSucursal.Rows(i).FCTextBox("TxtMinimo").Text.ToDouble, -1, UsuarioActual.CveUsuario, gvSucursal.Rows(i).DataKey("CveSubProyecto").ToEntero, PrecioMinimo:=gvSucursal.Rows(i).FCTextBox("TxtPrecioMinimo").Text.ToDecimal) + Else + ObjProductosServicios.AddPSSucursales(CvePS, Nothing, gvSucursal.Rows(i).FCTextBox("TxtMinimo").Text.ToDouble, -1, UsuarioActual.CveUsuario, gvSucursal.Rows(i).DataKey("CveSubProyecto").ToEntero, PrecioMinimo:=gvSucursal.Rows(i).FCTextBox("TxtPrecioMinimo").Text.ToDecimal) + End If + + End If + Next + + ObjProductosServicios.Dispose() + + End Sub + +#End Region + +#Region "C A R G A R E X C E L " + Private Sub BtnDescargarFormato_Click(sender As Object, e As EventArgs) Handles BtnDescargarFormato.Click + + Dim DtExcel As DataTable = (From row As GridViewRow In GVPrecios.Rows.Cast(Of GridViewRow) + Where row.RowType = DataControlRowType.DataRow + Select New With + { + .Codigo = row.DataKey("Codigo"), + .NumeroParte = row.DataKey("NumeroParte"), + .PS = row.DataKey("PS"), + .Precio = row.FCTextBox("TxtPrecio").Text.ToDecimal() + }).QueryToDataTable(True) + If DtExcel.Rows.Count < 1 Then + Alert("No hay resultados en la busqueda.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + + If DdlPrecioLista.SelectedItem IsNot Nothing Then + Dim worksheetName As String = DdlPrecioLista.SelectedItem.Text + + Const invalidCharsRegex As String = "[/\\*'?[\]:]+" + Const maxLength As Integer = 31 + Dim safeName As String = Regex.Replace(worksheetName, invalidCharsRegex, " ").Replace(" ", " ").Trim() + + If String.IsNullOrEmpty(safeName) Then + safeName = "Precios" ' cannot be empty + ElseIf safeName.Length > maxLength Then + safeName = safeName.Substring(0, maxLength) + End If + + DtExcel.TableName = safeName + Else + DtExcel.TableName = "Precios" + End If + + + DtExcel.Columns("Codigo").ColumnName = "Código" + DtExcel.Columns("PS").ColumnName = "Producto / Servicio" + DtExcel.Columns("NumeroParte").ColumnName = "Número de parte" + + If UsuarioActual.Empresa.Funcionalidad(531) = "1" OrElse UsuarioActual.Empresa.Funcionalidad(578) = "1" Then 'Empresa Acumuladores + If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then + DtExcel.Columns("Número de parte").ColumnName = "Código CPK" + End If + Else + DtExcel.Columns.Remove("Número de parte") + End If + + SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet) + + Dim FileExcel As New ExcelFile() + + Dim worksheet As ExcelWorksheet = FileExcel.Worksheets.Add(DtExcel.TableName) + worksheet.InsertDataTable(DtExcel, New InsertDataTableOptions() With + { + .ColumnHeaders = True, + .StartRow = 0, + .StartColumn = 0 + }) + worksheet.Rows(0).Style.FillPattern.SetPattern(FillPatternStyle.Solid, SpreadsheetColor.FromArgb(75, 119, 190), SpreadsheetColor.FromArgb(255, 255, 255)) + worksheet.Rows(0).Style.Font.Color = SpreadsheetColor.FromArgb(255, 255, 255) + + Dim columnCount As Integer = worksheet.CalculateMaxUsedColumns() + For i As Integer = 0 To columnCount + worksheet.Columns(i).AutoFit(1, worksheet.Rows(0), worksheet.Rows(worksheet.Rows.Count - 1)) + Next + + FileExcel.Save(Response, "Precios.xlsx", SaveOptions.XlsxDefault) + + End Sub + Private Sub BtnCargaExcel_Click(sender As Object, e As EventArgs) Handles BtnCargaExcel.Click + + If TxtExcel.getfiles().Archivos.Count > 0 Then + Dim file As Archivo = TxtExcel.getfiles().Archivos(0) + Dim Directorio As String = AppDomain.CurrentDomain.BaseDirectory & file.path + CargarArchivo(Directorio, file.filename) + Else + Alert("No existe el archivo. Favor de subir un archivo excel a la plataforma.", TipoMensaje.MsgError) + End If + End Sub + Private Sub CargarArchivo(Ruta As String, FileName As String) + SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet) + Dim Tipo As String = "EXCEL" + Dim dt As DataTable = Nothing + Dim ErrorArchivo As Boolean = False + + Try + dt = ReadExcelFile(Ruta + FileName, True) + Catch ex As Exception + ErrorArchivo = True + OnError("Ocurrio un error al leer el archivo
    " & ex.Message, ex) + End Try + If Not ErrorArchivo AndAlso dt IsNot Nothing Then + + If DdlPrecioListaCarga.SelectedValue.ToEntero() = -1 Then + Alert("Debe Seleccionar la lista de precios a cargar. Favor de corregirlo", TipoMensaje.MsgError) + Exit Sub + End If + + 'LA PRIMERA COLUMNA SIEMRPE ES CODIGO + If Not dt.Columns(0).ColumnName = "Código" Then + Alert("El nombre de la primera columna debe ser 'Codigo'. Favor de corregirlo", TipoMensaje.MsgError) + Exit Sub + End If + + Dim IndiceActualColExcel As Integer = 1 + Dim StrColPos As String() = {"primera", "segunda", "tecera", "cuarta"} + + 'SI ES EMPRESA DE ACUMULADORES SE AGREGA LA COLUMNA "Código CPK" + If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then + If Not dt.Columns(IndiceActualColExcel).ColumnName = "Código CPK" Then + Alert("El nombre de la segunda columna debe ser 'Código CPK'. Favor de corregirlo", TipoMensaje.MsgError) + Exit Sub + End If + + IndiceActualColExcel += 1 + End If + + If UsuarioActual.Empresa.Funcionalidad(578) = "1" Then + If Not dt.Columns(IndiceActualColExcel).ColumnName = "Número de parte" Then + Alert("El nombre de la segunda columna debe ser 'Número de parte'. Favor de corregirlo", TipoMensaje.MsgError) + Exit Sub + End If + + IndiceActualColExcel += 1 + End If + + If Not dt.Columns(IndiceActualColExcel).ColumnName = "Producto / Servicio" Then + Alert($"El nombre de la {StrColPos(IndiceActualColExcel)} columna debe ser 'Producto / Servicio'. Favor de corregirlo", TipoMensaje.MsgError) + Exit Sub + End If + + IndiceActualColExcel += 1 + + If Not dt.Columns(IndiceActualColExcel).ColumnName = "Precio" Then + Alert($"El nombre de la {StrColPos(IndiceActualColExcel)} columna debe ser 'Precio'. Favor de corregirlo", TipoMensaje.MsgError) + Exit Sub + End If + + + dt.TableName = "Datos" + Dim ProductosNoCargados As New StringBuilder() + Dim RowsCargados As Integer = 0 + Dim RowsNoCargados As Integer = 0 + Dim ObjPS As New ClsProductosServicios + 'ObjPS.IniciaTransacSQL() + Try + Dim DtPS As DataTable = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa) + For Each row As DataRow In dt.FiltraParametros("Código <> ''").Rows + Dim Correcto As Boolean = False + Dim TieneError As Boolean = False + Dim CvePS As Integer = DtPS.FiltroPrimeroValor("CvePS", String.Format("Codigo='{0}'", row(0).ToString())).ToEntero + Dim CvePrecioLista As Integer = DdlPrecioListaCarga.SelectedValue.ToEntero() + Dim PrecioNuevo As Decimal = row("Precio").ToString().ToDecimal() + Dim Porcentaje As Decimal = -1 + + If CvePS > 0 AndAlso CvePrecioLista > 0 Then + + Correcto = ObjPS.UpdatePSPreciosLista(PrecioNuevo, CvePrecioLista, Porcentaje, CvePS, UsuarioActual.CveUsuario, NowADS(), True) + If Correcto Then + RowsCargados += 1 + TieneError = ActualizarPreciosFranquicia(ObjPS, row(0).ToString(), PrecioNuevo, 0, DdlPrecioListaCarga.SelectedItem.Text) + End If + Else + If CvePS > 0 AndAlso CvePrecioLista = -2 Then + Correcto = ObjPS.UpdatePSPrecios(PrecioNuevo, CvePrecioLista, Porcentaje, CvePS, UsuarioActual.CveUsuario, NowADS(), True) + If Correcto Then + RowsCargados += 1 + End If + Else + Correcto = False + End If + + End If + If Not Correcto Then + ProductosNoCargados.AppendFormat("{0}-{1},", row(0).ToString(), row("Producto / Servicio").ToString()) + RowsNoCargados += 1 + End If + Next + Catch ex As Exception + OnError("Ocurrió un error al cargar los precios.", ex) + Finally + + Dim MensajeFinal As New StringBuilder() + If RowsNoCargados = 0 AndAlso RowsCargados > 0 Then + MensajeFinal.Append("Los precios de los Productos/Servicios se cargaron correctamente.

    ") + End If + If RowsCargados > 0 Then + MensajeFinal.Append("Se actualizaron " & RowsCargados & " Productos o Servicios correctamente.") + End If + If RowsNoCargados > 0 Then + MensajeFinal.Append("No se pudieron actualizar " & RowsNoCargados & " Productos/Servicios.
    Los siguientes Productos o Servicios no se pudieron actualizar: " & ProductosNoCargados.ToString()) + End If + + Alert(MensajeFinal.ToString()) + ObjPS.Dispose() + End Try + + + End If + End Sub + +#End Region + + Protected Sub gvSucursal_RowDataBound(sender As Object, e As GridViewRowEventArgs) + If e.Row.RowType = DataControlRowType.DataRow Then + e.Row.FCTextBox("TxtPrecioMinimo").Attributes.Add("onKeyUp", String.Format("FncSeleccionaChk({0});", e.Row.FCCheckBox("chkSucursal").ClientID)) + End If + End Sub + + Private Function ActualizarPreciosFranquicia(ObjPS As ClsProductosServicios, Codigo As String, Precio As Decimal, PrecioMinimo As Decimal, PrecioLista As String, Optional UpdatePrecioMinimo As Boolean = True) As Boolean + Dim FranquiciasStr As String = UsuarioActual.Empresa.Funcionalidad(563) + Dim StrMsg As New StringBuilder + Dim StrMsgError As New StringBuilder + If FranquiciasStr <> "" Then + Dim Franquicias As String() = FranquiciasStr.Split(","c) + Dim Porcentaje As Decimal = If(TxtPorcentaje.Text = "", -1, TxtPorcentaje.Text.ToDecimal) + + For Each Franquicia As String In Franquicias + Dim CveFranquicia As Integer = Franquicia.ToEntero + Dim CvePS As Integer = GlobalDTPSSimplificado(CveFranquicia, Codigo:=Codigo).FiltroPrimeroValor("CvePS", "").ToEntero + Dim CvePrecioLisa As Integer = GlobalDTPrecioListas(CveFranquicia).FiltroPrimeroValor("CvePrecioLista", String.Format("PrecioLista = '{0}'", PrecioLista)).ToEntero + + If CvePS <= 0 Then + Dim EmpresaFranquicia As String = GlobalDTEmpresas(CveEmpresa:=CveFranquicia).FiltroPrimeroValor("Empresa") + StrMsg.AppendFormat("El producto '{0}' no se encuentra en la Franquicia '{1}'
    ", PS, EmpresaFranquicia) + + End If + 'If CvePrecioLisa <= 0 Then + ' Dim EmpresaFranquicia As String = GlobalDTEmpresas(CveEmpresa:=CveFranquicia).FiltroPrimeroValor("Empresa") + ' StrMsg.AppendFormat("El precio lista '{0}' no existe en la Franquicia '{1}'
    ", DdlPrecioLista.SelectedItem.Text, EmpresaFranquicia) + 'End If + If CvePrecioLisa > 0 AndAlso CvePS > 0 AndAlso Not ObjPS.UpdatePSPreciosLista(Precio, CvePrecioLisa, Porcentaje, CvePS, UsuarioActual.CveUsuario, NowADS(), If(RblTipo.SelectedValue = "Imp", True, False), PrecioMinimo:=If(UpdatePrecioMinimo, PrecioMinimo, 0)) Then + StrMsgError.AppendFormat("No se pudo actualizar el producto") + End If + Next + + End If + + If StrMsgError.ToString = "" Then + If StrMsg.ToString <> "" Then + Alert(StrMsg.ToString, TipoMensaje.MsgAdvertencia) + End If + Return False + Else + Return True + End If + + End Function + Protected Sub LnkExportarExcel_Click(sender As Object, e As EventArgs) + Dim DtExcel As New DataTable("Precios") + DtExcel.Columns.Add(New DataColumn("Código", GetType(String))) + + If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then 'Empresa Acumuladores + DtExcel.Columns.Add(New DataColumn("Código CPK", GetType(String))) + End If + + If UsuarioActual.Empresa.Funcionalidad(578) = "1" Then 'Empresa Acumuladores + DtExcel.Columns.Add(New DataColumn("Número de parte", GetType(String))) + End If + + DtExcel.Columns.Add(New DataColumn("Producto/Servicio", GetType(String))) + DtExcel.Columns.Add(New DataColumn("Clasificación", GetType(String))) + DtExcel.Columns.Add(New DataColumn("Importe", GetType(Decimal))) + DtExcel.Columns.Add(New DataColumn("Precio Mínimo", GetType(Decimal))) + DtExcel.Columns.Add(New DataColumn("U.M.", GetType(String))) + DtExcel.Columns.Add(New DataColumn("Moneda", GetType(String))) + + If UsuarioActual.CveEmpresa = 153 Then 'Empresa servec + DtExcel.Columns.Add(New DataColumn("C. Promedio", GetType(Decimal))) + End If + + DtExcel.Columns.Add(New DataColumn("E. Mínimo", GetType(Decimal))) + DtExcel.Columns.Add(New DataColumn("Importe Anterior", GetType(Decimal))) + DtExcel.Columns.Add(New DataColumn("Precio Mínimo Anterior", GetType(Decimal))) + DtExcel.Columns.Add(New DataColumn("Fecha Modificación", GetType(DateTime))) + DtExcel.Columns.Add(New DataColumn("Usuario Modificó", GetType(String))) + DtExcel.Columns.Add(New DataColumn("Porcentaje", GetType(Decimal))) + DtExcel.Columns.Add(New DataColumn("Fecha Ingreso", GetType(DateTime))) + DtExcel.Columns.Add(New DataColumn("Usuario Ingresó", GetType(String))) + + + If DtDatosPrecios IsNot Nothing Then + For Each Row As DataRow In DtDatosPrecios.Rows + Dim NewRow As DataRow = DtExcel.NewRow() + + NewRow("Código") = Row("Codigo") + + If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then 'Empresa Acumuladores + NewRow("Código CPK") = Row("NumeroParte") + End If + + NewRow("Producto/Servicio") = Row("PS") + NewRow("Clasificación") = Row("Clasificacion") + NewRow("Importe") = Row("PrecioLista") + NewRow("Precio Mínimo") = Row("PrecioMinimo") + NewRow("U.M.") = Row("UnidadMedida") + NewRow("Moneda") = Row("Moneda") + + If UsuarioActual.CveEmpresa = 153 Then 'Empresa servec + NewRow("C. Promedio") = Row("CostoPromedio") + End If + + NewRow("E. Mínimo") = Row("VentaMinima") + NewRow("Importe Anterior") = Row("ImporteAnterior") + NewRow("Precio Mínimo Anterior") = Row("PrecioMinimoAnterior") + NewRow("Fecha Modificación") = Row("FechaModificacion") + NewRow("Usuario Modificó") = Row("UsuarioModifico") + NewRow("Porcentaje") = Row("Porcentaje") + NewRow("Fecha Ingreso") = Row("FechaIng") + NewRow("Usuario Ingresó") = Row("Usuario") + + DtExcel.Rows.Add(NewRow) + Next + End If + + SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet) + + Dim FileExcel As New ExcelFile() + + Dim worksheet As ExcelWorksheet = FileExcel.Worksheets.Add(DtExcel.TableName) + worksheet.InsertDataTable(DtExcel, New InsertDataTableOptions() With + { + .ColumnHeaders = True, + .StartRow = 0, + .StartColumn = 0 + }) + worksheet.Rows(0).Style.FillPattern.SetPattern(FillPatternStyle.Solid, SpreadsheetColor.FromArgb(75, 119, 190), SpreadsheetColor.FromArgb(255, 255, 255)) + worksheet.Rows(0).Style.Font.Color = SpreadsheetColor.FromArgb(255, 255, 255) + + Dim columnCount As Integer = worksheet.CalculateMaxUsedColumns() + For i As Integer = 0 To columnCount + worksheet.Columns(i).AutoFit(1, worksheet.Rows(0), worksheet.Rows(worksheet.Rows.Count - 1)) + Next + + Dim FechaIMes As String = "", FechaFMes As String = "", Titulo As String = "LISTADO DE PRECIOS", ListaPrecios As String = DdlPrecioLista.SelectedItem.Text, Divisor As Integer = 1, AlturaImagen As Double = 100, AnchoImagen As Double = 100, DatoTituloExtra As String = "" + + + Dim TotalRowHeader As Integer = 8 + Dim TotalRowFooter As Integer = 2 + + + worksheet.Rows.InsertEmpty(0, TotalRowHeader) + Dim celdasConTexto As CellRange = worksheet.GetUsedCellRange(True) + celdasConTexto.Style.Font.Name = "Calibri Light" + + Dim RangoNombreEmpresa As CellRange = worksheet.Cells.GetSubrangeAbsolute(1, celdasConTexto.FirstColumnIndex, 1, celdasConTexto.LastColumnIndex) + RangoNombreEmpresa.Merged = True + RangoNombreEmpresa.Value = UsuarioActual.Empresa.Empresa + RangoNombreEmpresa.Style.Font.Size = 20 * 20 + RangoNombreEmpresa.Style.Font.Name = "Calibri Light" + RangoNombreEmpresa.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center + RangoNombreEmpresa.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center + + + Dim RangoTitulo As CellRange = worksheet.Cells.GetSubrangeAbsolute(3, celdasConTexto.FirstColumnIndex, 3, celdasConTexto.LastColumnIndex) + RangoTitulo.Merged = True + RangoTitulo.Value = Titulo + RangoTitulo.Style.Font.Size = 17 * 20 + RangoTitulo.Style.Font.Name = "Calibri Light" + RangoTitulo.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center + RangoTitulo.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center + + + 'If FechaIMes.Trim.Length > 0 And FechaFMes.Trim.Length > 0 Then + ' Dim RangoFechas = worksheet.Cells.GetSubrangeAbsolute(4, celdasConTexto.FirstColumnIndex, 4, celdasConTexto.LastColumnIndex) + ' RangoFechas.Merged = True + ' RangoFechas.Value = $"Fechas: {FechaIMes} a {FechaFMes}" + ' RangoFechas.Style.Font.Size = 15 * 20 + ' RangoFechas.Style.Font.Name = "Calibri Light" + ' RangoFechas.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center + ' RangoFechas.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center + 'End If + + + If ListaPrecios.Length > 0 Then + Dim RangoSubProyecto As CellRange = worksheet.Cells.GetSubrangeAbsolute(5, celdasConTexto.FirstColumnIndex, 5, celdasConTexto.LastColumnIndex) + RangoSubProyecto.Merged = True + RangoSubProyecto.Value = $"Lista de precio: {ListaPrecios}" + RangoSubProyecto.Style.Font.Size = 14 * 20 + RangoSubProyecto.Style.Font.Name = "Calibri Light" + RangoSubProyecto.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center + RangoSubProyecto.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center + End If + + For i As Integer = celdasConTexto.FirstColumnIndex To celdasConTexto.LastColumnIndex + + worksheet.Rows(8).Cells(i).Style.Font.Size = 12 * 20 + worksheet.Rows(8).Cells(i).Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center + worksheet.Rows(8).Cells(i).Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center + + worksheet.Rows(8).Cells(i).Style.FillPattern.SetPattern(GemBox.Spreadsheet.FillPatternStyle.Solid, GemBox.Spreadsheet.SpreadsheetColor.FromArgb(75, 119, 190), GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255)) + worksheet.Rows(8).Cells(i).Style.Font.Color = GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255) + If i > 0 Then + Try + worksheet.Columns(i).AutoFit(1) + Catch ex As Exception + End Try + End If + Next + Dim IndexEndTable As Integer = DtExcel.Rows.Count + TotalRowHeader + TotalRowFooter + + worksheet.Rows(IndexEndTable).Cells(0).Value = "Usuario Imprimió" + worksheet.Rows(IndexEndTable + 1).Cells(0).Value = UsuarioActual.Nombre + worksheet.Rows(IndexEndTable).Cells(2).Value = "Fecha Impresión" + worksheet.Rows(IndexEndTable + 1).Cells(2).Value = NowADS().ToString("dd/MM/yyyy") + + Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png") + + If Imagen.Exists Then + Dim Ruta As String = String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta) + Using sr As New StreamReader(Ruta) + Dim ms As New MemoryStream() + sr.BaseStream.CopyTo(ms) + worksheet.Pictures.Add(ms, ExcelPictureFormat.Png, "A1", AnchoImagen, AlturaImagen, LengthUnit.Pixel) + End Using + End If + + For I As Integer = celdasConTexto.FirstColumnIndex To celdasConTexto.LastColumnIndex + + If I > 0 Then + + If Divisor = 1 Then + worksheet.Columns(I + 1).Style.NumberFormat = "#,##0.00" + Else + worksheet.Columns(I + 1).Style.NumberFormat = "#,##" + End If + + Try + worksheet.Columns(I).AutoFit(1) + Catch ex As Exception + End Try + + End If + Next + + FileExcel.Save(Response, "Precios.xlsx", SaveOptions.XlsxDefault) + + End Sub + Protected Sub GvMultiple_RowCreated(sender As Object, e As GridViewRowEventArgs) + 'QUITAR COLUMNA "CvePS" + 'e.Row.Cells(1).Visible = False + + 'If e.Row.RowType = DataControlRowType.Header Then + ' For colIndex = 2 To e.Row.Cells.Count - 1 + + ' Dim indiceColumna As Integer = (colIndex) + ' Dim LtlId = "LtlLista" + (colIndex - 1).ToString() + ' Dim Dr = DtPreciosMultiple.Rows(e.Row.RowIndex) + ' If Dr IsNot Nothing Then + ' 'VERIFICA QUE EL INDICE DE LA COLUMNA DEL DT NO SEA MAYOR A LA DEL GRIDVIEW + ' If indiceColumna <= DtPreciosMultiple.Columns.Count - 1 Then + ' Dim cell = e.Row.Cells(colIndex) + + ' Dim text = cell.Text + ' Dim splitValues = text.Split("|"c) + + ' If splitValues.Length > 1 Then + ' Dim CvePrecioLista = splitValues(0) + ' Dim PrecioLista = splitValues(1) + ' e.Row.FCLiteral(LtlId).Text = PrecioLista + ' cell.Attributes.Add("cvepreciolista", CvePrecioLista) + ' End If + + ' End If + + ' End If + + ' Next + 'End If + End Sub + Protected Sub GvMultiple_RowDataBound(sender As Object, e As GridViewRowEventArgs) + If e.Row.RowType = DataControlRowType.Header Then + For colIndex As Integer = 2 To e.Row.Cells.Count - 1 + + Dim indiceColumna As Integer = (colIndex) + Dim LtlId As String = "LtlLista_" + (colIndex - 1).ToString() + + If indiceColumna <= DtPreciosMultiple.Columns.Count - 1 Then + + Dim text As String = DtPreciosMultiple.Columns(indiceColumna).ColumnName + Dim splitValues As String() = text.Split("|"c) + + If splitValues.Length > 1 Then + Dim CvePrecioLista As String = splitValues(0) + Dim PrecioLista As String = splitValues(1) + e.Row.FCLabel(LtlId).Text = PrecioLista + e.Row.FCLabel(LtlId).Attributes.Add("cvepreciolista", CvePrecioLista) + End If + + End If + + Next + End If + + If e.Row.RowType = DataControlRowType.DataRow Then + For colIndex As Integer = 2 To e.Row.Cells.Count - 1 + + Dim indiceColumna As Integer = (colIndex) + Dim TxtId As String = "TxtPrecio_" + (colIndex - 1).ToString() + + + Dim Dr As DataRow = DtPreciosMultiple.Rows(e.Row.RowIndex) + If Dr IsNot Nothing Then + + 'VERIFICA QUE EL INDICE DE LA COLUMNA DEL DT NO SEA MAYOR A LA DEL GRIDVIEW + If indiceColumna <= DtPreciosMultiple.Columns.Count - 1 Then + Dim Valor As Decimal = DtPreciosMultiple.Rows(e.Row.RowIndex)(indiceColumna).ToString().ToDecimal() + + e.Row.FCTextBox(TxtId).Text = Valor.FormatoNumero(2) + e.Row.FCTextBox(TxtId).Enabled = PermisoEdicionLista + End If + + End If + Next + End If + End Sub + Protected Sub LnkGuardarMultiple_Click(sender As Object, e As EventArgs) + Dim TieneError As Boolean = False + + Dim DtPS As DataTable = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa) + + Dim ObjPS As New ClsProductosServicios + ObjPS.IniciaTransacSQL() + Try + For Each GvRow As GridViewRow In GvMultiple.Rows + + If GvRow.FCCheckBox("chkPS").Checked Then + For colIndex As Integer = 2 To GvRow.Cells.Count - 1 + + Dim indiceColumna As Integer = (colIndex) + + Dim LtlId As String = "LtlLista_" + (colIndex - 1).ToString() + 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 CvePS As Integer = DtPreciosMultiple.Rows(GvRow.RowIndex)("CvePS").ToString().ToEntero() + + Dim Precio As Decimal = GvRow.FCTextBox(TxtId).Text.ToDecimal() + + TieneError = Not ObjPS.UpdatePSPreciosLista(Precio, CvePrecioLista, 0, CvePS, UsuarioActual.CveUsuario, NowADS(), True) + + If Not TieneError Then + + Dim text As String = DtPreciosMultiple.Columns(indiceColumna).ColumnName + 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) + TieneError = True + End Try + + + If Not TieneError Then + Alert("Los Precios de lista de los Productos/Servicios se actualizaron correctamente") + Else + Alert("Ocurrió un error al actualizar precios", TipoMensaje.MsgError) + End If + + If TieneError Then + ObjPS.RollBack() + Else + ObjPS.Commit() + End If + + ObjPS.Dispose() + + If Not TieneError Then + BtnConsultar_Click(Nothing, Nothing) + End If + + End Sub + Protected Sub DdlModalidad_SelectedIndexChanged(sender As Object, e As EventArgs) + DivPrecioLista.Visible = DdlModalidad.SelectedValue = "1" + DivMultiplePrecioLista.Visible = DdlModalidad.SelectedValue = "2" + + dvDatos.Visible = DdlModalidad.SelectedValue = "1" + DivActualizarPrecio.Visible = DdlModalidad.SelectedValue = "1" + If UsuarioActual.TienePermisoProceso(282) Then + DivActualizarPrecio.Visible = False + End If + dvMultiple.Visible = DdlModalidad.SelectedValue = "2" + + UPPrecioLista.Update() + UpEncabezado.Update() + UpDatos.Update() + End Sub + + Protected Sub ImprimirEtiquetas(StrClavesPS As String) + Dim CvePrecioListaPredeterminada = GlobalDTPrecioListas(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CvePrecioLista", "Predeterminada = True").ToEntero() + Dim DtPrecios As DataTable = Nothing + + Dim ObjVentas As New ClsProductosServicios + If ObjVentas.GetPSPrecios(CvePrecioListaPredeterminada, StrClavesPS) AndAlso ObjVentas.DtResultados IsNot Nothing AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then + DtPrecios = ObjVentas.DtResultados.Copy() + End If + ObjVentas.Dispose() + + If DtPrecios IsNot Nothing Then + + DtPrecios.Columns.Add(New DataColumn("CBBase64", GetType(String))) + + For Each Row As DataRow In DtPrecios.Rows + Row("CBBase64") = Convert.ToBase64String(GeneraCodigoQR(Row("CodigoBarras").ToString(), 40, 150, 0, "CODE_39", True)) + Next + + Dim DirectorioArchivo As String = "Empresas/Grales/Formatos/Etiqueta.mrt" + If System.IO.File.Exists(UsuarioActual.Empresa.Ruta + "Formatos/Etiqueta.mrt") Then + DirectorioArchivo = UsuarioActual.Empresa.Ruta + "Formatos/Etiqueta.mrt" + End If + Dim params As New List(Of ReportParameter) + + Dim lrds As New List(Of ReportDataSource) + Dim rds As New ReportDataSource + rds.Name = "Datos" + rds.Value = DtPrecios + lrds.Add(rds) + + Dim bytesPDF = StreamBytesStimul("Facturas", DirectorioArchivo, lrds, params, NombreArchivo:="Precios", Formato:="PDF") + Dim pdf64 = Convert.ToBase64String(bytesPDF) + + RegistraScript($"impresionBase64('{pdf64}');", "Imprimir") + 'ImprimirPDFStimul(DirectorioArchivo, DtPrecios, params, "Precios") + End If + + End Sub + + Private Function GeneraCodigoQR(CodigoBarras As String, Alto As Integer, Largo As Integer, Margen As Integer, Formato As String, Optional PureBacode As Boolean = False) As Byte() + + Dim barcodeWriter As New BarcodeWriter + Dim opciones As New ZXing.Common.EncodingOptions + Dim FormatoBar As New BarcodeFormat + 'Dim Respuesta As Byte() + + opciones.Height = Alto + opciones.Width = Largo + opciones.Margin = Margen + opciones.PureBarcode = PureBacode + barcodeWriter.Options = opciones + + Select Case Formato + Case "All_1D" + barcodeWriter.Format = BarcodeFormat.All_1D + Exit Select + Case "AZTEC" + barcodeWriter.Format = BarcodeFormat.AZTEC + Exit Select + Case "CODABAR" + barcodeWriter.Format = BarcodeFormat.CODABAR + Exit Select + Case "CODE_128" + barcodeWriter.Format = BarcodeFormat.CODE_128 + Exit Select + Case "CODE_39" + barcodeWriter.Format = BarcodeFormat.CODE_39 + Exit Select + Case "CODE_93" + barcodeWriter.Format = BarcodeFormat.CODE_93 + Exit Select + Case "DATA_MATRIX" + barcodeWriter.Format = BarcodeFormat.DATA_MATRIX + Exit Select + Case "EAN_13" + barcodeWriter.Format = BarcodeFormat.EAN_13 + Exit Select + Case "EAN_8" + barcodeWriter.Format = BarcodeFormat.EAN_8 + Exit Select + Case "IMB" + barcodeWriter.Format = BarcodeFormat.IMB + Exit Select + Case "ITF" + barcodeWriter.Format = BarcodeFormat.ITF + Exit Select + Case "MAXICODE" + barcodeWriter.Format = BarcodeFormat.MAXICODE + Exit Select + Case "MSI" + barcodeWriter.Format = BarcodeFormat.MSI + Exit Select + Case "PDF_417" + barcodeWriter.Format = BarcodeFormat.PDF_417 + Exit Select + Case "PLESSEY" + barcodeWriter.Format = BarcodeFormat.PLESSEY + Exit Select + Case "QR_CODE" + barcodeWriter.Format = BarcodeFormat.QR_CODE + Exit Select + Case "RSS_14" + barcodeWriter.Format = BarcodeFormat.RSS_14 + Exit Select + Case "RSS_EXPANDED" + barcodeWriter.Format = BarcodeFormat.RSS_EXPANDED + Exit Select + Case "UPC_A" + barcodeWriter.Format = BarcodeFormat.UPC_A + Exit Select + Case "UPC_E" + barcodeWriter.Format = BarcodeFormat.UPC_E + Exit Select + Case "UPC_EAN_EXTENSION" + barcodeWriter.Format = BarcodeFormat.UPC_EAN_EXTENSION + Exit Select + + End Select + + Dim imgCod As Drawing.Bitmap = barcodeWriter.Write(CodigoBarras) + Dim memoriStream As New System.IO.MemoryStream + imgCod.Save(memoriStream, Drawing.Imaging.ImageFormat.Bmp) + + 'Respuesta = Convert.ToBase64String(memoriStream.ToArray()) + + Return memoriStream.ToArray() + + End Function + + + Protected Sub GVPrecios_RowDataBound(sender As Object, e As GridViewRowEventArgs) + + If e.Row.RowType = DataControlRowType.DataRow Then + + e.Row.FCTextBox("TxtPrecio").Enabled = PermisoEdicionLista + e.Row.FCTextBox("TxtPrecioMinimo").Enabled = PermisoEdicionLista + + End If + + End Sub +End Class \ No newline at end of file From e061c5ae957ddb2afe87bf00d2656bfedc7640de Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Wed, 27 Nov 2024 22:25:57 -0700 Subject: [PATCH 2/3] refacturacion con linea adicional --- App_Code/Modelos.vb | 2 ++ Ventas/Ventas.aspx.vb | 13 ++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb index 8ab5a4c43..d35d6198d 100644 --- a/App_Code/Modelos.vb +++ b/App_Code/Modelos.vb @@ -8052,6 +8052,8 @@ Namespace Modelos Public Property CveSATPeriodicidad As Integer = -1 Public Property CveSATMes As Integer = -1 Public Property SATAnio As Integer = -1 + Public Property CveLineaAdicional As Integer = -1 + Public Sub SetSubProyecto() If CveSubProyecto > 0 AndAlso UsuarioActual IsNot Nothing Then diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index ff89e081b..424f451d5 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -8591,6 +8591,10 @@ Partial Class Ventas DdlNCFactura.SelectedValueExist(pCveVenta) DdlNCFactura.Enabled = False + If ObjFacturaNC IsNot Nothing AndAlso ObjFacturaNC.CveLineaAdicional > 0 Then + DdlLineaAdicional.SelectedValueExist(ObjFacturaNC.CveLineaAdicional) + End If + End If Else @@ -14442,6 +14446,13 @@ Partial Class Ventas CveAlmacenTraspasoDestino = -1 End If + Dim CveLAdicional = DdlLineaAdicional.SelectedValue.ToEntero() + + If ObjFacturaNC IsNot Nothing Then + If NuevaFactura = 1 AndAlso ObjFacturaNC.CveLineaAdicional > 0 Then + CveLAdicional = ObjFacturaNC.CveLineaAdicional + End If + End If If Not ObjVentas.AddVenta(factura.TipoDocto, factura.Folio, factura.CveCliente, factura.CveClienteSucursal, factura.SubTotalTC, factura.DescuentoTC, factura.AmortizacionTC, factura.IVATC, factura.RetIVATC, factura.RetISRTC, @@ -14459,7 +14470,7 @@ Partial Class Ventas DiasCredito:=factura.DiasCredito, EsDiasCreditoFijo:=factura.EsDiasCreditoFijo, AnticipoEspecial:=If(TrAntEspecial.Visible, ChkAntEspecial.Checked, False), Kilometraje:=TxtKilometraje.Text.ToDouble, EsAmortizacion:=EsNCAmortizacion, CveTipoRetencion:=factura.CveTipoRetencion, CorreoNotificacion:=TxtCorreoNotificaciones.Text, FormaPaqueteria:=RblPaqueteria.SelectedValue.ToEntero, FacturarSucursal:=factura.FacturarSucursal, VentaDesglosaIEPS:=factura.VentaDesglosaIEPS, RFCReceptor:=RFCReceptor, Adjunto:=Adjunto, DevolucionImportePagado:=factura.DevolucionImportePagado, EsGarantia:=factura.EsGarantia, ServicioDomicilio:=TrServicioDomicilio.Visible, - CveLineaAdicional:=DdlLineaAdicional.SelectedValue.ToEntero(), DescripcionVenta:=DescripcionVenta, + CveLineaAdicional:=CveLAdicional, DescripcionVenta:=DescripcionVenta, CveMedico:=CveMedico, CveProcedimiento:=CveProcedimiento, CveTipoVenta:=CveTipoVentaGuardar, RequiereOS:=ChkRequiereTecnico.Checked, FechaParaSurtir:=factura.FechaParaSurtir, Paciente:=TxtPaciente.Text, Episodio:=TxtEpisodio.Text, CveMotivoDevolucion:=CveMotivoDevolucion, CveCobranzaEstatusTurno:=DdlGestionCobranza.SelectedValue.ToEntero, Addenda:=factura.Addenda) Then ErrorList.Add("Ocurrió un error al Generar la Venta.
    Revise su factura y cualquier detalle comuníquese a Soporte Técnico") From f08f16c91d17be776651ca8938f333f362456dd9 Mon Sep 17 00:00:00 2001 From: rakcsle Date: Thu, 28 Nov 2024 11:26:08 -0700 Subject: [PATCH 3/3] Local VyA Viajes --- App_Code/ClsContratos.vb | 6 +-- Transportes/RepContratoDetalle.aspx | 59 +++++++++++++++++----- Transportes/RepContratoDetalle.aspx.vb | 2 +- Transportes/RepContratos.aspx | 35 ++++++++++--- Transportes/RepContratosCalendario.aspx.vb | 10 ++++ Ventas/ActualizarPrecios.aspx.vb | 9 +++- 6 files changed, 98 insertions(+), 23 deletions(-) diff --git a/App_Code/ClsContratos.vb b/App_Code/ClsContratos.vb index 7482500e9..cdbabf36e 100644 --- a/App_Code/ClsContratos.vb +++ b/App_Code/ClsContratos.vb @@ -430,10 +430,10 @@ Public Class ClsContratos Ubicacion As String, Responsable As String, CveSubProyecto As Integer, PorIVA As Double, PorAnticipo As Double, PorAmortizacionAnticipo As Double, PorGarantia As Double, Archivo As String, Geom As String, CveContratoPadre As Integer, CveUsuario As Integer, CveEmpresa As Integer, EsPresupuestal As Boolean, Minimo As Double, Maximo As Double, Importe As Double, CveMoneda As Integer, ModalidadDetalle As Integer, Optional CveContratosEstatus As Integer = -1, Optional CveContratoTipo As Integer = -1, Optional TipoCambio As Double = -1, Optional CveSucursalCliente As Integer = -1, Optional CveAlmacenOrigen As Integer = -1, Optional CveAlmacenDestino As Integer = -1, Optional PorcentajeComision As Integer = -1, - Optional TipoGarantia As Integer = -1, Optional Folio As Integer = -1, Optional FechaVenc As Date = Nothing, Optional EstatusFianza As Integer = -1, Optional CveContratoPlantilla As Integer = -1, Optional CveCuentaEquipo As Integer = -1, + Optional TipoGarantia As Integer = -1, Optional Folio As Integer = -1, Optional FechaVenc As Date = MinFecha, Optional EstatusFianza As Integer = -1, Optional CveContratoPlantilla As Integer = -1, Optional CveCuentaEquipo As Integer = -1, Optional CveVendedor As Integer = -1, Optional Observaciones As String = "", Optional CveDireccionEnvio As Integer = -1, Optional AplicaImpuestosLocales As Boolean = False, Optional CorreoNotificacionPedDev As String = "", Optional FacturacionCicilica As Boolean = False, Optional FacturacionCiclicaAutomatico As Boolean = False, - Optional DiaMesFacturacion As Integer = 1, Optional CvePeriodo As Integer = -1, Optional ObservacionesGenerales As String = "", Optional CveTipoAF As Integer = Nothing, Optional CveChofer As Integer = Nothing, Optional CveChofer2 As Integer = Nothing, Optional CveAF As Integer = Nothing, - Optional CantidadPasajeros As Integer = Nothing, Optional CvePartida As Integer = Nothing, Optional CveDestino As Integer = Nothing, Optional CveMasivo As Integer = -1, Optional NumChoferes As Integer = -1) As Boolean + Optional DiaMesFacturacion As Integer = 1, Optional CvePeriodo As Integer = -1, Optional ObservacionesGenerales As String = "", Optional CveTipoAF As Integer = -1, Optional CveChofer As Integer = -1, Optional CveChofer2 As Integer = -1, Optional CveAF As Integer = -1, + Optional CantidadPasajeros As Integer = -1, Optional CvePartida As Integer = -1, Optional CveDestino As Integer = -1, Optional CveMasivo As Integer = -1, Optional NumChoferes As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Con_ContratosUpdate") diff --git a/Transportes/RepContratoDetalle.aspx b/Transportes/RepContratoDetalle.aspx index 907b28858..3cea65576 100644 --- a/Transportes/RepContratoDetalle.aspx +++ b/Transportes/RepContratoDetalle.aspx @@ -229,18 +229,29 @@
    - + type="datetime">--%> + +
    + + + + +
    + + + + TargetControlID="RFVTxtFechaSalida" Width="300px"> -
    + <%--
    -
    +
    --%>
    @@ -250,18 +261,29 @@
    - + type="datetime">--%> + +
    + + + + +
    + + + + + TargetControlID="RFVTxtFechaRegreso" Width="300px"> -
    + <%--
    -
    +
    --%>
    @@ -891,10 +913,23 @@
    - - --%> + +
    + + + + +
    + + + + + +
    diff --git a/Transportes/RepContratoDetalle.aspx.vb b/Transportes/RepContratoDetalle.aspx.vb index 57bf1dc1a..f205fe81f 100644 --- a/Transportes/RepContratoDetalle.aspx.vb +++ b/Transportes/RepContratoDetalle.aspx.vb @@ -1003,7 +1003,7 @@ Partial Class RepContratoDetalle TxtEstatus.Text = GvRow.DataKey("Estatus").ToString LbEstatus.CssClass = If(CBool(GvRow.DataKey("Estatus").ToString), "text-success bold", "text-danger bold") TxtAsiento.Text = GvRow.DataKey("Asiento").ToString() - TxtFechaNacimiento.Text = GvRow.DataKey("FechaNacimiento").ToString().ToDate.ToString("yyyy-MM-dd") 'Este es el formato que admite el control + TxtFechaNacimiento.Text = GvRow.DataKey("FechaNacimiento").ToString().ToDate.ToString("dd/MM/yyyy") If EsAgencia Then TxtFechaNacimiento.Enabled = False diff --git a/Transportes/RepContratos.aspx b/Transportes/RepContratos.aspx index 90934b020..dab036b52 100644 --- a/Transportes/RepContratos.aspx +++ b/Transportes/RepContratos.aspx @@ -350,16 +350,27 @@
    - + >--%> + +
    + + + + +
    + + + + TargetControlID="RFVTxtFechaSalida" Width="300px"> +
    @@ -369,14 +380,26 @@
    - + >--%> + + + +
    + + + + +
    + + + + TargetControlID="RFVTxtFechaRegreso" Width="300px">
    diff --git a/Transportes/RepContratosCalendario.aspx.vb b/Transportes/RepContratosCalendario.aspx.vb index ade8b4e1c..b332f97dc 100644 --- a/Transportes/RepContratosCalendario.aspx.vb +++ b/Transportes/RepContratosCalendario.aspx.vb @@ -590,8 +590,15 @@ Partial Class RepContratosCalendario TxtFechaSalida.Text = Convert.ToDateTime(DRow("FechaInicial")).ToString("dd/MM/yyyy HH:mm:ss") TxtFechaRegreso.Text = Convert.ToDateTime(DRow("FechaFinal")).ToString("dd/MM/yyyy HH:mm:ss ") TxtMoneda.Text = DRow("Moneda").ToString + + TxtAnticipo.Text = DRow("ImporteMin").ToString + TxtDolares.Text = DRow("Importe").ToString + 'Requeridos + DdlChofer.SelectedValueExist(-1) + DdlChofer2.SelectedValueExist(-1) + DdlChofer.SelectedValueExist(DRow("CveChofer").ToString) DdlChofer2.SelectedValueExist(DRow("CveChofer2").ToString) chkSegundoChofer.Checked = If(NumChoferes = 2, True, False) @@ -719,6 +726,9 @@ Partial Class RepContratosCalendario TxtFechaSalida.Text = Convert.ToDateTime(GvRow.DataKey("FechaInicial")).ToString("dd/MM/yyyy HH:mm:ss") TxtFechaRegreso.Text = Convert.ToDateTime(GvRow.DataKey("FechaFinal")).ToString("dd/MM/yyyy HH:mm:ss ") TxtMoneda.Text = GvRow.DataKey("Moneda") + + TxtAnticipo.Text = GvRow.DataKey("ImporteMin") + TxtDolares.Text = GvRow.DataKey("Importe") 'Requeridos DdlChofer.SelectedValueExist(GvRow.DataKey("CveChofer")) diff --git a/Ventas/ActualizarPrecios.aspx.vb b/Ventas/ActualizarPrecios.aspx.vb index f40f86240..f333636f3 100644 --- a/Ventas/ActualizarPrecios.aspx.vb +++ b/Ventas/ActualizarPrecios.aspx.vb @@ -710,7 +710,11 @@ Partial Class Ventas_ActualizarPrecios DtExcel.Columns.Add(New DataColumn("Código CPK", GetType(String))) End If - If UsuarioActual.Empresa.Funcionalidad(578) = "1" Then 'Empresa Acumuladores + 'If UsuarioActual.Empresa.Funcionalidad(531) = "1" Or UsuarioActual.Empresa.Funcionalidad(382) = "1" Then 'Empresa Acumuladores + + 'End If + + If UsuarioActual.Empresa.Funcionalidad(578) = "1" Or UsuarioActual.Empresa.Funcionalidad(531) = "1" Or UsuarioActual.Empresa.Funcionalidad(382) = "1" Then ' DtExcel.Columns.Add(New DataColumn("Número de parte", GetType(String))) End If @@ -744,6 +748,9 @@ Partial Class Ventas_ActualizarPrecios If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then 'Empresa Acumuladores NewRow("Código CPK") = Row("NumeroParte") End If + If UsuarioActual.Empresa.Funcionalidad(578) = "1" Or UsuarioActual.Empresa.Funcionalidad(531) = "1" Or UsuarioActual.Empresa.Funcionalidad(382) = "1" Then ' + NewRow("Número de parte") = Row("NumeroParte") + End If NewRow("Producto/Servicio") = Row("PS") NewRow("Clasificación") = Row("Clasificacion")