diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index f50b21481..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 @@ -11153,7 +11153,7 @@ Public Class ClsPaginas OpcionNegritas = "H" Case 4 Asunto = $"Nuevo Pedido:{Remision}" - Contenido.AppendFormat("Pedido: {1}
", CveOS, Folio) + Contenido.AppendFormat("Pedido: {1}
", CveOS, Folio) OpcionNegritas = "H" Case 5 Asunto = "Cirugía de Urgencia" diff --git a/App_Code/ClsProductosServicios.vb b/App_Code/ClsProductosServicios.vb index 96195d57a..946a3f82d 100644 --- a/App_Code/ClsProductosServicios.vb +++ b/App_Code/ClsProductosServicios.vb @@ -1980,7 +1980,8 @@ Public Class ClsProductosServicios #Region "Precios Lista" Public Function GetPSPreciosLista(CveEmpresa As Integer, CvePrecioLista As Integer, Optional CveClasificacion As Integer = -1, Optional CvePS As Integer = -1, - Optional CveProveedor As Integer = -1, Optional Estado As Integer = -1, Optional Marcas As String = "-1", Optional CveModelo As Integer = -1) As Boolean + Optional CveProveedor As Integer = -1, Optional Estado As Integer = -1, Optional Marcas As String = "-1", Optional CveModelo As Integer = -1, + Optional CodigoInicial As String = "-1", Optional CodigoFinal As String = "-1", Optional Opcion As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_PSPrecioListaGet") With SqlAdapter.SelectCommand.Parameters @@ -1992,6 +1993,9 @@ Public Class ClsProductosServicios .Add("@Estado", SqlDbType.Int).Value = Estado .Add("@Marcas", SqlDbType.VarChar).Value = Marcas .Add("@CveModelo", SqlDbType.Int).Value = CveModelo + .Add("@CodigoInicial", SqlDbType.VarChar).Value = CodigoInicial + .Add("@CodigoFinal", SqlDbType.VarChar).Value = CodigoFinal + .Add("@Opcion", SqlDbType.Int).Value = Opcion End With Try SqlAdapter.Fill(Data) @@ -2004,9 +2008,10 @@ Public Class ClsProductosServicios End Function Public Function GetPSMultiplesPreciosLista(CveEmpresa As Integer, Optional ListasPrecios As String = "-1", Optional CveClasificacion As Integer = -1, Optional CvePS As Integer = -1, - Optional CveProveedor As Integer = -1, Optional Estado As Integer = -1, Optional Marcas As String = "-1", Optional CveModelo As Integer = -1) As Boolean + Optional CveProveedor As Integer = -1, Optional Estado As Integer = -1, Optional Marcas As String = "-1", Optional CveModelo As Integer = -1, + Optional CodigoInicial As String = "-1", Optional CodigoFinal As String = "-1") As Boolean Dim Retorno As Boolean = False - DataAdapter("PA_Vta_PSPrecioListaMultipleGet") + DataAdapter("PA_Vta_PSPrecioListaMultipleGetRM") With SqlAdapter.SelectCommand.Parameters .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@ListasPrecios", SqlDbType.VarChar).Value = ListasPrecios @@ -2016,6 +2021,9 @@ Public Class ClsProductosServicios .Add("@Estado", SqlDbType.Int).Value = Estado .Add("@Marcas", SqlDbType.VarChar).Value = Marcas .Add("@CveModelo", SqlDbType.Int).Value = CveModelo + .Add("@CodigoInicial", SqlDbType.VarChar).Value = CodigoInicial + .Add("@CodigoFinal", SqlDbType.VarChar).Value = CodigoFinal + End With Try SqlAdapter.Fill(Data) 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 77875fccb..06c455a78 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -7417,18 +7417,17 @@ Partial Class Compras_Compras Pago.ImportePago = importeMovimiento + ImporComisionAnticipo Pago.CveIE = Ant.CveIE Pago.TCPago = Ant.TCCompra + Pago.CveMonedaPago = If(Ant.TCCompra > 1, 2, 1) If Pago.CveMonedaPago = 1 AndAlso CompraActual.CveMoneda = 2 Then 'Si la venta viene en Dolares y se va a pagar en Pesos - Pago.TCPago = 1 ' TxtTC.Text.ToDecimal - Pago.TCCambioMoneda = Ant.TCCompra 'GlobalTipoCambio(Now).ToDecimal + Pago.TCPago = Ant.TCCompra ' TxtTC.Text.ToDecimal + Pago.TCCambioMoneda = 1 'GlobalTipoCambio(Now).ToDecimal If Ant.TCCompra = 1 Then Pago.TCCambioMoneda = 1 / GlobalTipoCambio(Ant.Fecha).ToDecimal End If - End If - Pago.CveMonedaPago = If(Ant.TCCompra > 1, 2, 1) Pago.OtroGastoIngreso = -ImporComisionAnticipo ErrorPrepoliza = AplicaPrePolizaPagoCompra(CompraActual, Pago, CvePrePoliza, ObjConta) @@ -9479,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 @@ -9522,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/Contabilidad/DiarioPagos.aspx.vb b/Contabilidad/DiarioPagos.aspx.vb index b92daaddf..a614dce7f 100644 --- a/Contabilidad/DiarioPagos.aspx.vb +++ b/Contabilidad/DiarioPagos.aspx.vb @@ -711,7 +711,7 @@ Partial Class Contabilidad_DiarioPagos 'cuando el anticipo no paga toda la factura y no esta contabilizada If AbonoAnticipo < CompraTotal AndAlso Not EsContabilizada Then AbonoProveedor = CompraTotal - AbonoAnticipo 'ejecuta la instruccion para contabilizar la prepoliza de amortizacion cuando es unica, es decir se hace al final del cheque, luego otra prepoliza con la compra y tercera la amortizacion - If Not Bancos.UpdateCompraPrePoliza(TxtFecha.Text.ToDate, NumPoliza, IDPoliza, gvrc.FCHiddenField("HdnCveCompra").Value.ToEntero, CvePlantillaPoliza) Then MsgError = "Error al actualizar compra" : Exit For Else PolizaActualizada = True + If Not Bancos.UpdateCompraPrePoliza(Fecha, NumPoliza, IDPoliza, gvrc.FCHiddenField("HdnCveCompra").Value.ToEntero, CvePlantillaPoliza) Then MsgError = "Error al actualizar compra" : Exit For Else PolizaActualizada = True Case 2, 1 TotalProveedores = TotalBancos @@ -721,7 +721,7 @@ Partial Class Contabilidad_DiarioPagos IdCuentaProveedor = gvrc.FCHiddenField("HdnIdCtaContProveedores").Value.ToEntero Case 20 'contabilizo la prepoliza - If Not Bancos.UpdateCompraPrePoliza(TxtFecha.Text.ToDate, NumPoliza, IDPoliza, gvrc.FCHiddenField("HdnCveCompra").Value.ToEntero, CvePlantillaPoliza) Then MsgError = "Error al actualizar compra" : Exit For Else PolizaActualizada = True + If Not Bancos.UpdateCompraPrePoliza(Fecha, NumPoliza, IDPoliza, gvrc.FCHiddenField("HdnCveCompra").Value.ToEntero, CvePlantillaPoliza) Then MsgError = "Error al actualizar compra" : Exit For Else PolizaActualizada = True Case 8 'FyE AbonoFuncionario = CompraPagadoTotal @@ -803,7 +803,7 @@ Partial Class Contabilidad_DiarioPagos Next 'debe de actualizar - If Not Bancos.UpdateCompraPrePoliza(TxtFecha.Text.ToDate, NumPoliza, IDPoliza, gvrc.FCHiddenField("HdnCveCompra").Value.ToEntero) Then + If Not Bancos.UpdateCompraPrePoliza(Fecha, NumPoliza, IDPoliza, gvrc.FCHiddenField("HdnCveCompra").Value.ToEntero) Then 'ya esta corriendo un proceso que actualiza la 'If Not PolizaActualizada Then MsgError = "Error al actualizar compra" : Exit For End If diff --git a/Inventarios/RecepcionAlmacen.aspx.vb b/Inventarios/RecepcionAlmacen.aspx.vb index 89f924ba6..5326a077e 100644 --- a/Inventarios/RecepcionAlmacen.aspx.vb +++ b/Inventarios/RecepcionAlmacen.aspx.vb @@ -2444,16 +2444,6 @@ Partial Class Inventarios_RecepcionAlmacen End If End If - 'CONTABILIZAR - SIMPLIFICAR - If Retorno Then - - If UsuarioActual.Empresa.Funcionalidad(200) = "1" Then - If Not ObjConta.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then - Retorno = False - End If - End If - - End If Else Retorno = False End If @@ -2509,17 +2499,6 @@ Partial Class Inventarios_RecepcionAlmacen Retorno = False End If End If - - 'CONTABILIZAR - SIMPLIFICAR - If Retorno Then - - If UsuarioActual.Empresa.Funcionalidad(200) = "1" Then - If Not ObjConta.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then - Retorno = False - End If - End If - - End If Else Retorno = False End If @@ -3504,18 +3483,7 @@ Partial Class Inventarios_RecepcionAlmacen End If End If End If - - If UsuarioActual.Empresa.Funcionalidad(200) = "1" Then - If ObjConta.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then - MensajeContabilidad = $"
Movimiento contabilizado en el folio: {ObjConta.ContaFolio}
" - Else - ErrorMovInv = True - MensajeError = "Error al contabilizar los conceptos contables" - End If - End If - End If - End If Else ErrorMovInv = True @@ -3604,16 +3572,6 @@ Partial Class Inventarios_RecepcionAlmacen End If End If End If - - If UsuarioActual.Empresa.Funcionalidad(200) = "1" Then - - If ObjConta.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then - MensajeContabilidad = $"
Movimiento contabilizado en el folio: {ObjConta.ContaFolio}
" - Else - ErrorMovInv = True - MensajeError = "Error al contabilizar los conceptos contables" - End If - End If End If End If Else @@ -4036,18 +3994,6 @@ Partial Class Inventarios_RecepcionAlmacen End If End If - 'If Not ErrorMovInv AndAlso UsuarioActual.Empresa.Funcionalidad(200) = "1" Then - ' ObjContaAC = New ClsContPAQi(UsuarioActual.Empresa) - ' ObjContaAC.IniciaTransacSQL() - ' If ObjConta.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa, ObjConta:=ObjContaAC) Then - ' MensajeError = $"
Movimiento contabilizado en el folio: {ObjConta.ContaFolio}
" - ' Else - ' ErrorMovInv = True - ' MensajeError = "Error al contabilizar los conceptos contables" - ' End If - 'End If - - If Not ErrorMovInv AndAlso CveImportacionSeleccionada > 0 Then If Not ObjInventario.UpdateImportacionCierre(CveImportacionSeleccionada, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario) Then @@ -4056,14 +4002,12 @@ Partial Class Inventarios_RecepcionAlmacen End If - If Not ErrorMovInv AndAlso CveFleteSeleccionado > 0 Then If Not ObjInventario.UpdateFleteCierre(CveFleteSeleccionado, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario) Then ErrorMovInv = True End If End If - 'FINAL If Not ErrorMovInv Then ObjInventario.Commit() ' aplica los movimientos insertados diff --git a/Inventarios/RepVentasXSurtir.aspx.vb b/Inventarios/RepVentasXSurtir.aspx.vb index bf9377f2e..34d3cec63 100644 --- a/Inventarios/RepVentasXSurtir.aspx.vb +++ b/Inventarios/RepVentasXSurtir.aspx.vb @@ -68,9 +68,9 @@ Partial Class Inventarios_RepVentasXSurtir If e.Row.RowType = DataControlRowType.DataRow Then Select Case e.Row.DBCampo("EsDevolucionVenta").ToEntero Case 0 - e.Row.Cells(0).Text = "
Surtir
" + e.Row.Cells(0).Text = $" Surtir" Case 1 - e.Row.Cells(0).Text = "
Recibir
" + e.Row.Cells(0).Text = $" Recibir" End Select End If End Sub 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/Nomina/Nomina.aspx b/Nomina/Nomina.aspx index ca6d5a9d8..4365c23ed 100644 --- a/Nomina/Nomina.aspx +++ b/Nomina/Nomina.aspx @@ -304,8 +304,11 @@
  • Descargar archivos SUA
  • +
  • + Recibos timbrados XML +
  • - Recibos timbrados + Recibos timbrados PDF
  • Procesar archivo SUA EBA PDF @@ -5293,6 +5296,8 @@ + + @@ -5367,6 +5372,20 @@ document.body.removeChild(elem); } } + function Savezip(filename, data) { + var blob = new Blob([data], { type: 'application/zip' }); + if (window.navigator.msSaveOrOpenBlob) { + window.navigator.msSaveBlob(blob, filename); + } + else { + var elem = window.document.createElement('a'); + elem.href = window.URL.createObjectURL(blob); + elem.download = filename; + document.body.appendChild(elem); + elem.click(); + document.body.removeChild(elem); + } + } function SaveCsv(filename, data) { var blob = new Blob([data], { type: 'text/csv' }); if (window.navigator.msSaveOrOpenBlob) { diff --git a/Nomina/Nomina.aspx.cs b/Nomina/Nomina.aspx.cs index de7fe7e14..5d506e66a 100644 --- a/Nomina/Nomina.aspx.cs +++ b/Nomina/Nomina.aspx.cs @@ -14,6 +14,7 @@ using Modelos; using System.Text.RegularExpressions; using iTextSharp.text.pdf.parser; using Profact.TimbraCFDI40; +using Ionic.Zip; public partial class Nomina_Nomina2 : ClsPaginas { @@ -555,6 +556,7 @@ public partial class Nomina_Nomina2 : ClsPaginas } private void CargaTiposPeriodo() { + set_GlobalDTTipoPeriodos(UsuarioActual.CveEmpresa, null); DdlTipoPeriodo.DataSource = get_GlobalDTTipoPeriodos(UsuarioActual.CveEmpresa); DdlTipoPeriodoCM.DataSource = DdlTipoPeriodo.DataSource; DdlTipoPeriodoSim.DataSource = DdlTipoPeriodo.DataSource; @@ -627,6 +629,7 @@ public partial class Nomina_Nomina2 : ClsPaginas FiltAgrupador = 1; CveTipoTrabajador = DdlTipoTrabajador.SelectedValue.ToEntero(); HypPDFSTimbrados.Attributes.Add("onclick", string.Format("GETPDF({0},{1})", -1, FiltCvePeriodo)); + HypXMLSTimbrados.Attributes.Add("onclick", string.Format("GETXML({0},{1})", -1, FiltCvePeriodo)); cargaDatos(); int empleados = 0; if (dtempleados != null && dtempleados.Rows.Count > 0) @@ -694,6 +697,7 @@ public partial class Nomina_Nomina2 : ClsPaginas LnkPersonalizarNomina.Visible = true; LnkFormatoFiscal.Visible = (UsuarioActual.CveEmpresa == 141 || UsuarioActual.CveRol == 1); HypPDFSTimbrados.Visible = true; + HypXMLSTimbrados.Visible = true; if (objnom.GetNominaEmpleado(FiltCveProyecto, FiltCveSubProyecto, FiltCveTurno, FiltCvePeriodo, CveEmpresa, FiltAgrupador, DdlRegimenContratacion.SelectedValue.ToEntero(), CveTipoTrabajador: CveTipoTrabajador, Neto: ddlfiniquito.SelectedValue.ToEntero(), CvePersonal: CvePersonal) @@ -9544,66 +9548,138 @@ public partial class Nomina_Nomina2 : ClsPaginas string Xmlname = ""; string XmlnameF = ""; string empleado = ""; - DataRow dr = dtempleados.FiltroPrimero(string.Format("CvePersonal ={0}", TxtCvePersonal.Text.ToEntero())); - if (dr != null) - { - empleado = string.Format("{0} - {1}", dr["Codigo"], dr["Nombre"]); - } - using (ClsNominas ObjNomina = new ClsNominas()) - { - if (ObjNomina.GetNom_Nominas(-1, TxtCvePersonal.Text.ToEntero(), TxtCvePeriodo.Text.ToEntero(), -1, UsuarioActual.CveEmpresa)) - { - Ruta = UsuarioActual.Empresa.Ruta; - PathXML = $"{Ruta}XML\\Nomina\\{ObjNomina.SerieFolio}.xml"; - PathXMLF = $"{Ruta}XML\\Nomina\\{ObjNomina.Serie}F-{ObjNomina.Folio}.xml"; - Xmlname = ObjNomina.SerieFolio; - XmlnameF = $"{ObjNomina.Serie}F-{ObjNomina.Folio}"; - } - } - try - { - string script = ""; - if (!string.IsNullOrEmpty(PathXML) && System.IO.File.Exists(PathXML)) - { - LtlXml.Text = System.IO.File.ReadAllText(PathXML); - script = string.Format("Savexml(\"{0} {1}.xml\", $('.ltlxml').html());", Xmlname, empleado); - //System.IO.FileInfo file = new System.IO.FileInfo(PathXML); - //string mimeType = "text/plain"; - //try - //{ - // mimeType = MimeMapping.GetMimeMapping(PathXML); - //} - //catch (Exception) - //{ - //} - //// Response.Write(path) - //Response.Clear(); - //Response.ClearHeaders(); - //Response.ClearContent(); - //Response.AddHeader("Content-Disposition", $"attachment; filename= {Uri.EscapeDataString(file.Name)}"); - //Response.AddHeader("Content-Length", file.Length.ToString()); - //Response.ContentType = mimeType; - //Response.Flush(); - //Response.TransmitFile(file.FullName); - //Response.End(); - } - if (!string.IsNullOrEmpty(PathXML) && System.IO.File.Exists(PathXMLF)) + Ruta = UsuarioActual.Empresa.Ruta; + if (TxtCvePersonal.Text.ToEntero() != -1) + { + DataRow dr = dtempleados.FiltroPrimero(string.Format("CvePersonal ={0}", TxtCvePersonal.Text.ToEntero())); + if (dr != null) { - LtlXmlfin.Text = System.IO.File.ReadAllText(PathXMLF); - script = string.Format("{1}Savexml(\"{0}(Indemnización) {2}.xml\", $('.ltlxmlfin').html());", Xmlname, script, empleado); + empleado = string.Format("{0} - {1}", dr["Codigo"], dr["Nombre"]); } - if (script.Trim().Length > 0) + using (ClsNominas ObjNomina = new ClsNominas()) { - RegistraScript(script); + if (ObjNomina.GetNom_Nominas(-1, TxtCvePersonal.Text.ToEntero(), TxtCvePeriodo.Text.ToEntero(), -1, UsuarioActual.CveEmpresa)) + { + PathXML = $"{Ruta}XML\\Nomina\\{ObjNomina.SerieFolio}.xml"; + PathXMLF = $"{Ruta}XML\\Nomina\\{ObjNomina.Serie}F-{ObjNomina.Folio}.xml"; + Xmlname = ObjNomina.SerieFolio; + XmlnameF = $"{ObjNomina.Serie}F-{ObjNomina.Folio}"; + } } - else + try + { + string script = ""; + if (!string.IsNullOrEmpty(PathXML) && System.IO.File.Exists(PathXML)) + { + LtlXml.Text = System.IO.File.ReadAllText(PathXML); + script = string.Format("Savexml(\"{0} {1}.xml\", $('.ltlxml').html());", Xmlname, empleado); + //System.IO.FileInfo file = new System.IO.FileInfo(PathXML); + //string mimeType = "text/plain"; + //try + //{ + // mimeType = MimeMapping.GetMimeMapping(PathXML); + //} + //catch (Exception) + //{ + + //} + //// Response.Write(path) + //Response.Clear(); + //Response.ClearHeaders(); + //Response.ClearContent(); + //Response.AddHeader("Content-Disposition", $"attachment; filename= {Uri.EscapeDataString(file.Name)}"); + //Response.AddHeader("Content-Length", file.Length.ToString()); + //Response.ContentType = mimeType; + //Response.Flush(); + //Response.TransmitFile(file.FullName); + //Response.End(); + } + if (!string.IsNullOrEmpty(PathXMLF) && System.IO.File.Exists(PathXMLF)) + { + LtlXmlfin.Text = System.IO.File.ReadAllText(PathXMLF); + script = string.Format("{1}Savexml(\"{0}(Indemnización) {2}.xml\", $('.ltlxmlfin').html());", Xmlname, script, empleado); + } + if (script.Trim().Length > 0) + { + RegistraScript(script); + } + else + { + Alert("No se encontro el archivo"); + } + } + catch (Exception) { - Alert("No se encontro el archivo"); } } - catch (Exception) + else { + using (ClsNominas ObjNomina = new ClsNominas()) + { + if (ObjNomina.GetNom_Nominas(-1, -1, TxtCvePeriodo.Text.ToEntero(), -1, UsuarioActual.CveEmpresa)) + { + string script = ""; + using (ZipFile descargaZIP = new ZipFile()) + { + descargaZIP.UseZip64WhenSaving = Zip64Option.AsNecessary; + + foreach (DataRow dbrow in ObjNomina.DtResultados.Rows) + { + Ruta = UsuarioActual.Empresa.Ruta; + PathXML = $"{Ruta}XML\\Nomina\\{dbrow["SerieFolio"].ToString()}.xml"; + PathXMLF = $"{Ruta}XML\\Nomina\\{dbrow["Serie"].ToString()}F-{dbrow["Folio"].ToString()}.xml"; + + if (!string.IsNullOrEmpty(PathXML) && System.IO.File.Exists(PathXML)) + { + + FileInfo file = new FileInfo(PathXML); + if (!descargaZIP.Any(x => x.FileName.Contains(file.Name))) + { + descargaZIP.AddFile(PathXML); + } + + } + if (!string.IsNullOrEmpty(PathXMLF) && System.IO.File.Exists(PathXMLF)) + { + + FileInfo file = new FileInfo(PathXMLF); + if (!descargaZIP.Any(x => x.FileName.Contains(file.Name))) + { + descargaZIP.AddFile(PathXMLF); + } + + } + + } + + String PathZIP = $"{Ruta}XML\\Nomina\\{TxtCvePeriodo.Text.ToEntero()}.zip"; + descargaZIP.Save(PathZIP); + if (!string.IsNullOrEmpty(PathZIP) && System.IO.File.Exists(PathZIP)) + { + LtlZip.Text = System.IO.File.ReadAllText(PathZIP); + script = string.Format("Savezip(\"{0}.zip\", $('.ltlzip').html());", DdlPeriodo.SelectedItem.Text); + System.IO.File.Delete(PathZIP); + } + + if (script.Trim().Length > 0) + { + RegistraScript(script); + } + else + { + Alert("No se encontro el archivo"); + } + + //Response.Clear(); + //Response.AddHeader("Content-Disposition", "attachment; filename=ArchivosXML.zip"); + //Response.ContentType = "application/zip"; + //descargaZIP.Save(Response.OutputStream); + //Response.End(); + } + + } + } } } @@ -10704,7 +10780,7 @@ public partial class Nomina_Nomina2 : ClsPaginas StringBuilder SbErrores = new StringBuilder(); bool ErroresValidaciones = false; int modalidadnomina = 1; - if (UsuarioActual.CveEmpresa.Contiene(189, 193, 195, 196, 197, 172, 173, 174)) modalidadnomina = 2; + if (UsuarioActual.CveEmpresa.Contiene(189, 193, 195, 196, 197, 172, 173,174)) modalidadnomina = 2; SbErrores.AppendLine("Se detectaron los siguientes errores en la generación del layout:
    "); diff --git a/Sistemas/Empresa.aspx.vb b/Sistemas/Empresa.aspx.vb index 47d2d5645..c2fb476d0 100644 --- a/Sistemas/Empresa.aspx.vb +++ b/Sistemas/Empresa.aspx.vb @@ -432,7 +432,7 @@ Partial Class Sistemas_Empresa Else If ObjEmpresas.UpdateEmpresa(TxtEmpresa.Text.Trim, TxtDireccion.Text.Trim, TxtNoExt.Text.Trim, TxtNoInt.Text.Trim, TxtColonia.Text.Trim, TxtCiudad.Text.Trim, TxtEstado.Text.Trim, TxtRFC.Text.Trim, TxtCP.Text.Trim, TxtTelefono.Text.Trim, TxtContacto.Text.Trim, TxtMail.Text.Trim, DdlTipoFacturacion.SelectedItem.ToString, TxtBIUsuario.Text.Trim, - TxtBIContraseña.Text.Trim, TxtContraseñaKey.Text.Trim, TxtArchivoKey.Text.Trim, TxtArchivoCer.Text.Trim, TxtArchivoPfx.Text.Trim, "", ChkEstatus.Checked, + TxtBIContraseña.Text.Trim, TxtContraseñaKey.Text, TxtArchivoKey.Text.Trim, TxtArchivoCer.Text.Trim, TxtArchivoPfx.Text.Trim, "", ChkEstatus.Checked, ChkFacturaProduccion.Checked, ChkMostrarRetIVA.Checked, ChkMostrarRetISR.Checked, "", TxtSendMail.Text.Trim, TxtSendMailPassword.Text.Trim, TxtSendMailServer.Text.Trim, TxtSendMailPort.Text.Trim.ToEntero, ChkSendMailSSL.Checked, ChkUsaContabilidad.Checked, ChkUsaBancos.Checked, ChkUsaVentas.Checked, ChkUsaCxC.Checked, ChkUsaCompras.Checked, ChkUsaInventarios.Checked, ChkUsaRH.Checked, ChkUsaNomina.Checked, ChkUsaOS.Checked, TxtBDContPAQi.Text.Trim, 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 b/Ventas/ActualizarPrecios.aspx index dd6743fa4..d367322f9 100644 --- a/Ventas/ActualizarPrecios.aspx +++ b/Ventas/ActualizarPrecios.aspx @@ -90,7 +90,7 @@
    - +
    @@ -106,7 +106,7 @@
    -
    +
    @@ -129,6 +129,20 @@
    +
    +
    +
    +
    +
    + +
    + +
    +
    Código Fin:
    +
    + +
    +
    @@ -151,7 +165,7 @@
    -
    +
    @@ -186,16 +200,19 @@ Aplicar Precio Min.
    - - -
    - - - -
    -
    - -
    +
    +
    +
    + + + + +
    +
    +
    + +
    +
    @@ -213,7 +230,7 @@ CssClass="table table-striped table-advance table-hover Widthall ScrollAD" AutoGenerateColumns="False" data-sort="true" EmptyDataText="No se encontraron registros" OnRowDataBound="GVPrecios_RowDataBound" > - + @@ -221,7 +238,7 @@ - + @@ -229,42 +246,36 @@ - - + - - <%-- - - --%> + +
    +
    -
    - - - - - - + + +
    + <%-- --%>
    + + + + + - - - - - - - - + + - - - - + + + +
    @@ -616,6 +627,8 @@ + + diff --git a/Ventas/ActualizarPrecios.aspx.vb b/Ventas/ActualizarPrecios.aspx.vb index 187ef77b2..f40f86240 100644 --- a/Ventas/ActualizarPrecios.aspx.vb +++ b/Ventas/ActualizarPrecios.aspx.vb @@ -114,6 +114,11 @@ Partial Class Ventas_ActualizarPrecios PermisoEdicionLista = False DivActualizarPrecio.Visible = False HlAgregarExcel.Visible = False + End If + + If UsuarioActual.Empresa.Funcionalidad(382) = "1" OrElse UsuarioActual.Empresa.Funcionalidad(109) = "1" Then 'Empresa gdiaz + GVPrecios.Columns(2).Visible = True + DVFiltroCodigo.Visible = True End If CargaCombos() @@ -202,12 +207,9 @@ Partial Class Ventas_ActualizarPrecios 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() + If UsuarioActual.Empresa.Funcionalidad(130) = "1" Then + + DdlMarca.DataSource = GlobalDTGralMarcas(UsuarioActual.CveEmpresa) DdlMarca.DataBind() LblMarca.Visible = True @@ -248,16 +250,27 @@ Partial Class Ventas_ActualizarPrecios 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 + CveProveedor:=CveProveedor, Estado:=DdlEstado.SelectedValue.ToEntero, Marcas:=Marcas, CveModelo:=DdlModelo.SelectedValue.ToEntero, + CodigoInicial:=TxtCodigoInicio.Text.Trim, CodigoFinal:=TxtCodigoFinal.Text.Trim) Then DtDatosPrecios = objPS.DtResultados GVPrecios.DataSource = DtDatosPrecios End If objPS.Dispose() - If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then 'Empresa Acumuladores + If UsuarioActual.Empresa.Funcionalidad(531) = "1" Or UsuarioActual.Empresa.Funcionalidad(382) = "1" Then 'Empresa Acumuladores GVPrecios.Columns(2).Visible = True End If + 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 + GVPrecios.Columns(16).Visible = True + GVPrecios.Columns(17).Visible = True + End If + If UsuarioActual.CveEmpresa = 153 Then 'Empresa servec GVPrecios.Columns(11).Visible = True End If @@ -281,7 +294,8 @@ Partial Class Ventas_ActualizarPrecios 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 + CveProveedor:=CveProveedor, Estado:=DdlEstado.SelectedValue.ToEntero, Marcas:=Marcas, CveModelo:=DdlModelo.SelectedValue.ToEntero, + CodigoInicial:=TxtCodigoInicio.Text.Trim, CodigoFinal:=TxtCodigoFinal.Text.Trim) Then DtPreciosMultiple = objPS.DtResultados.Copy() GvMultiple.DataSource = DtPreciosMultiple End If @@ -291,17 +305,15 @@ Partial Class Ventas_ActualizarPrecios dvMultiple.Visible = True DivActualizarPrecio.Visible = False - For colIndex As Integer = 2 To GvMultiple.Columns.Count - 1 - If colIndex <= DtPreciosMultiple.Columns.Count - 1 Then + For colIndex As Integer = 2 To GvMultiple.Columns.Count - 3 + If colIndex <= DtPreciosMultiple.Columns.Count - 3 Then GvMultiple.Columns(colIndex).Visible = True Else GvMultiple.Columns(colIndex).Visible = False End If Next - GvMultiple.DataBind() - End If - + End If UpDescargar.Update() UpDatos.Update() @@ -341,7 +353,6 @@ Partial Class Ventas_ActualizarPrecios 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 @@ -948,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 diff --git a/Ventas/PopUpBuscarFolio.aspx.vb b/Ventas/PopUpBuscarFolio.aspx.vb index 3fd06730d..99876fa9b 100644 --- a/Ventas/PopUpBuscarFolio.aspx.vb +++ b/Ventas/PopUpBuscarFolio.aspx.vb @@ -19,6 +19,9 @@ Partial Class PopUpBuscarFolio CType(Me.Master, BaseMasterPage).PopupWidth = 850 txtFechaI.Text = NowADS().AddMonths(-12).ToShortDateString 'RegistraScript("$get('tdContenido').style.height='500px'") + + 'venta de pv, y gdiaz + If UsuarioActual.Empresa.Funcionalidad(109) = "1" OrElse UsuarioActual.Empresa.Funcionalidad(382) = "1" Then txtFechaI.Text = NowADS.ToShortDateString CargaSubProyectos() CargaEstatus() CargaUsuarios() diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 424f451d5..353e03685 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -18584,7 +18584,7 @@ Partial Class Ventas If CvePrecioListaPS > 0 Then Dim ObjPS As New ClsProductosServicios - If ObjPS.GetPSPreciosLista(UsuarioActual.CveEmpresa, CvePrecioListaPS, CvePS:=CvePSParametro) Then + If ObjPS.GetPSPreciosLista(UsuarioActual.CveEmpresa, CvePrecioListaPS, CvePS:=CvePSParametro, Opcion:=1) Then PrecioSugerido = ObjPS.DtResultados.FiltroPrimeroValor("PrecioLista").ToDecimal PorcentajePrecio = ObjPS.DtResultados.FiltroPrimeroValor("Porcentaje").ToDecimal End If @@ -20599,7 +20599,7 @@ Partial Class Ventas 'Dim CvePrecioListaPS = GlobalDTCliente(UsuarioActual.CveEmpresa, -1).FiltroPrimeroValor("CvePrecioLista", $"CveCliente = {CveCliente}").ToEntero() If CvePrecioLista > 0 Then Dim ObjPS As New ClsProductosServicios - If ObjPS.GetPSPreciosLista(UsuarioActual.CveEmpresa, CvePrecioLista, CvePS:=CvePSAdicional) Then + If ObjPS.GetPSPreciosLista(UsuarioActual.CveEmpresa, CvePrecioLista, CvePS:=CvePSAdicional, Opcion:=1) Then PrecioSugerido = ObjPS.DtResultados.FiltroPrimeroValor("PrecioLista").ToDecimal If PrecioSugerido = 0 Then @@ -38125,7 +38125,7 @@ Partial Class Ventas If CvePrecioListaPS > 0 Then Dim ObjPS As New ClsProductosServicios - If ObjPS.GetPSPreciosLista(UsuarioActual.CveEmpresa, CvePrecioListaPS, CvePS:=CvePSParametro) Then + If ObjPS.GetPSPreciosLista(UsuarioActual.CveEmpresa, CvePrecioListaPS, CvePS:=CvePSParametro, Opcion:=1) Then PrecioSugerido = ObjPS.DtResultados.FiltroPrimeroValor("PrecioLista").ToDecimal PorcentajePrecio = ObjPS.DtResultados.FiltroPrimeroValor("Porcentaje").ToDecimal End If @@ -39278,12 +39278,12 @@ Partial Class Ventas Dim drr As DataRow = GlobalDTClientesSucursales(UsuarioActual.CveEmpresa, CveCliente).FiltroPrimero($"CveClienteSucursal={DdlSucursalCliente.SelectedValue}") If drr IsNot Nothing Then - If RBLTipoVenta.SelectedValue.Contiene("6") Then + If RBLTipoVenta.SelectedValue.Contiene("6") Then 'cuando es A-vista tCveAlmacenExistencia = drr("CveAlmacenAlterno").ToString.ToEntero - ElseIf RBLTipoVenta.SelectedValue.Contiene("5") Then + ElseIf RBLTipoVenta.SelectedValue.Contiene("5") Then 'cuando es Consignación tCveAlmacenExistencia = drr("CveAlmacenConsignacion").ToString.ToEntero Else - tCveAlmacenExistencia = drr("CveAlmacenAsignado").ToString.ToEntero + tCveAlmacenExistencia = -1 'drr("CveAlmacenAsignado").ToString.ToEntero End If End If Else @@ -39294,7 +39294,7 @@ Partial Class Ventas ElseIf RBLTipoVenta.SelectedValue.Contiene("5") Then 'cuando es Consignación tCveAlmacenExistencia = drr("CveAlmacenConsignacion").ToString.ToEntero Else - tCveAlmacenExistencia = drr("CveAlmacenAsignado").ToString.ToEntero '' cuando Fuera de Línea + tCveAlmacenExistencia = -1 ' drr("CveAlmacenAsignado").ToString.ToEntero '' cuando Fuera de Línea End If End If End If