This commit is contained in:
rakcsle
2022-04-06 11:27:20 -07:00
25 changed files with 2676 additions and 1262 deletions

View File

@@ -3684,7 +3684,7 @@ Public Class ClsGenerales
Public Function AddGralTimbre(TipoDocto As String, CveSubProyecto As Integer, Fecha As DateTime, CveUsuario As Integer, CveEmpresa As Integer,
Optional Serie As String = "-1", Optional Folio As Integer = -1, Optional Estatus As Integer = 0,
Optional CveEntregaAlmacen As Integer = -1, Optional AplicaCP As Boolean = False) As Integer
Optional CveEntregaAlmacen As Integer = -1, Optional AplicaCP As Boolean = False, Optional CveVenta As Integer = -1) As Integer
Dim Retorno As Integer = -1
DataAdapter("PA_Gral_TimbreAdd")
@@ -3701,6 +3701,7 @@ Public Class ClsGenerales
.Add("@AplicaCP", SqlDbType.Bit).Value = AplicaCP
.Add("@CveEntregaAlmacen", SqlDbType.Int).Value = CveEntregaAlmacen
.Add("@CveSubProyectoOrigen", SqlDbType.Int).Value = CveSubProyecto
.Add("@CveVenta", SqlDbType.Int).Value = CveVenta
.Add("@CveTimbre", SqlDbType.Int).Direction = ParameterDirection.Output
.Add("@FolioInsertado", SqlDbType.Int).Direction = ParameterDirection.Output
@@ -3722,7 +3723,7 @@ Public Class ClsGenerales
Return Retorno
End Function
Public Function GetGralTimbre(CveTimbre As Integer, TipoDocto As String, FechaI As Date, FechaF As Date, Estatus As Integer, CveEmpresa As Integer, CveMovimiento As Integer) As Boolean
Public Function GetGralTimbre(CveTimbre As Integer, TipoDocto As String, FechaI As Date, FechaF As Date, Estatus As Integer, CveEmpresa As Integer, CveMovimiento As Integer, Optional CveVenta As Integer = -1) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Gral_TimbreGet")
@@ -3734,7 +3735,7 @@ Public Class ClsGenerales
.Add("@Estatus", SqlDbType.Int).Value = Estatus
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@CveMovimiento", SqlDbType.Int).Value = CveMovimiento
.Add("@CveVenta", SqlDbType.Int).Value = CveVenta
End With
Try

View File

@@ -3547,6 +3547,24 @@ Public Class ClsInventarios
Return Retorno
End Function
Public Function GetSaldoVentaDetalleAlmacen(CveVenta As Integer, CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Vta_VentaDetalleSaldoAlmacen")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveVenta", SqlDbType.Int).Value = CveVenta
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al obtener datos de almacen por detalle.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
Return Retorno
End Function
Public Function GetMovimientosDevoluciones(CveVenta As Integer, CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Vta_VentaDetalleAlmacenDevolucion")

View File

@@ -529,7 +529,7 @@ Public Class ClsVentas
Optional TipoDocto As String = "Cot", Optional Vigencia As Date = MinFecha, Optional CondicionesPago As Integer = -1,
Optional AtencionA As String = "-1", Optional PedidoContrato As String = "-1", Optional CveFormaPago33 As Integer = -1, Optional CveMetodoPago33 As Integer = -1,
Optional CveCliente As Integer = -1, Optional CveClienteSucursal As Integer = -1, Optional OrdenCompra As String = "-1", Optional RetIVA As Double = -1,
Optional RetISR As Double = -1, Optional Kilometraje As Double = 0, Optional CveUsoCFDi As Integer = -1, Optional ServicioDomicilio As Boolean = False) As Boolean
Optional RetISR As Double = -1, Optional Kilometraje As Double = 0, Optional CveUsoCFDi As Integer = -1, Optional ServicioDomicilio As Boolean = False, Optional CveVendedor As Integer = -1) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Vta_VentasUpdate")
@@ -562,6 +562,7 @@ Public Class ClsVentas
.Add("@Kilometraje", SqlDbType.Float).Value = Kilometraje
.Add("@CveUsoCFDi", SqlDbType.SmallInt).Value = CveUsoCFDi
.Add("@ServicioDomicilio", SqlDbType.Bit).Value = ServicioDomicilio
.Add("@CveVendedor", SqlDbType.Int).Value = CveVendedor
End With
Try
@@ -1014,13 +1015,14 @@ Public Class ClsVentas
Return Retorno
End Function
Public Function ObtenerClienteLimitesVenta(CveCliente As Integer, CveEmpresa As Integer) As Integer
Public Function ObtenerClienteLimitesVenta(CveCliente As Integer, CveEmpresa As Integer, Optional TipoVerificacion As Integer = -1) As Integer
Dim Retorno As Integer = 0
DataAdapter("PA_Vta_ClientesLimitesVentaGet")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveCliente", SqlDbType.Int).Value = CveCliente
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@TipoVerificacion", SqlDbType.Int).Value = TipoVerificacion
.Add("@Opcion", SqlDbType.Int).Direction = ParameterDirection.Output
.Add("@OpcionMsg", SqlDbType.VarChar, 100).Direction = ParameterDirection.Output
End With
@@ -5334,7 +5336,7 @@ Public Class ClsVentas
#End Region
Public Function AddAutorizacionLimite(CveEmpresa As Integer, CveCliente As Integer, CveVendedor As Integer, Importe As Decimal, CveEstatus As Integer, CveUsuario As Integer, TipoAutorizacion As Integer, TipoDocumento As String, Optional DiasVencidos As Integer = 0) As Boolean
Public Function AddAutorizacionLimite(CveEmpresa As Integer, CveCliente As Integer, CveVendedor As Integer, Importe As Decimal, CveEstatus As Integer, CveUsuario As Integer, TipoAutorizacion As Integer, TipoDocumento As String, Optional DiasVencidos As Integer = 0, Optional Motivo As String = "") As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Vta_AutorizacionLimitesAdd")
With SqlAdapter.SelectCommand.Parameters
@@ -5347,6 +5349,7 @@ Public Class ClsVentas
.Add("@TipoAutorizacion", SqlDbType.Int).Value = TipoAutorizacion
.Add("@TipoDocumento", SqlDbType.VarChar).Value = TipoDocumento
.Add("@DiasVencidos", SqlDbType.Int).Value = DiasVencidos
.Add("@Motivo", SqlDbType.VarChar).Value = Motivo
End With
Try
SqlAdapter.Fill(Data)

View File

@@ -2208,12 +2208,11 @@ Namespace Modelos
If DtMovimientosEntrada IsNot Nothing Then
For Each Dr As DataRow In DtMovimientosEntrada.Rows
If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, CveAF:=Dr("CveAF").ToString.ToEntero, Serie:=Dr("Serie").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, Observaciones:=Dr("Observaciones").ToString, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then
If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, CveAF:=Dr("CveAF").ToString.ToEntero, Serie:=Dr("Serie").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, Observaciones:=Dr("Observaciones").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString().ToEntero(), CveUsuarioModifico:=UsuarioActual.CveUsuario) Then
CveMovimiento = -1
Exit For
End If
Next
DtMovimientosEntrada.Dispose()
DtMovimientosEntrada = Nothing
End If
@@ -5389,9 +5388,9 @@ Namespace Modelos
If DtVirtuales IsNot Nothing Then
For Each RowVirtual As DataRow In DtVirtuales.Rows
'REALIZA LA DEVOLUCION AL ALMACEN VIRTUAL
If Not ErrorCancelar AndAlso Not GeneraMovimientosVirtuales(CveVenta, CveMovimientoDevolucion, RowVirtual("CveMovimiento").ToString().ToEntero(), ObjInventario) Then
If Not ErrorCancelar AndAlso Not CancelarMovimientosVirtuales(CveVenta, CveMovimientoDevolucion, RowVirtual("CveMovimiento").ToString().ToEntero(), ObjInventario) Then
ErrorCancelar = True
MensajeError = "Ocurrió un error al cargar los datos de devolución. Por favor vuelva a intentar."
MensajeError = "Ocurrió un error al realizar la devolución del virtual. Por favor vuelva a intentar."
End If
Next
End If
@@ -5419,6 +5418,24 @@ Namespace Modelos
'DEBE REGRESAR LA EXISTENCIA DE (ENTREGA POR ADELANTADO) AL ALMACEN ORGINAL (GENERAL,SIN COSTO)
If Not ErrorCancelar AndAlso DtDevoluciones IsNot Nothing AndAlso DtDevoluciones.Rows.Count > 0 Then
For Each CveRemision As Integer In ListaRemisionesCancelar
Dim ObjRemision As New Factura(UsuarioActual, CveRemision, UsuarioActual.CveEmpresa)
If ObjRemision IsNot Nothing AndAlso ObjRemision.SaldoAlmacen <> 0 Then
Dim SaldoAlmacenExA As Decimal = 0
Dim SaldoAlmacenUsados As Decimal = 0
Dim DtSaldosAlmacenRemision As DataTable = Nothing
'VERIFICA SI HACE FALTA DEVOLVER PRODUCTOS Y USADOS EN ESPECIFICO
If Not ErrorCancelar Then
If ObjInventario.GetSaldoVentaDetalleAlmacen(ObjRemision.CveVenta, UsuarioActual.CveEmpresa) Then
DtSaldosAlmacenRemision = ObjInventario.DtResultados.Copy()
Else
ErrorCancelar = True
MensajeError = "Ocurrió un error al cargar los saldos de devolución. Por favor vuelva a intentar."
End If
End If
Dim DtDevRemision As DataTable = DtDevoluciones.FiltraParametros($"CveRemision={CveRemision}")
Dim DtDevMovs = DtDevRemision.FiltraParametros("", DistinctColumns:={"CveMovimiento", "CveRemision", "CveAlmacen", "CveAlmacenDestino"})
@@ -5427,13 +5444,60 @@ Namespace Modelos
CveAlmacen = RowDevolucion("CveAlmacen").ToString().ToEntero()
CveAlmacenDevolucion = RowDevolucion("CveAlmacenDestino").ToString().ToEntero()
If CveAlmacen > 0 AndAlso DtSaldosAlmacenRemision IsNot Nothing Then
SaldoAlmacenExA = DtSaldosAlmacenRemision.SUMD("SaldoAlmacen", $"CveAlmacen = {CveAlmacen}")
End If
If SaldoAlmacenExA <> 0 Then
If Not CancelarMovimientosRemision(CveRemision, CveAlmacen, CveAlmacenDevolucion, DtDevRemision.FiltraParametros($"CveMovimiento={RowDevolucion("CveMovimiento")}"), ObjVentas, ObjInventario) Then
ErrorCancelar = True
MensajeError = "Ocurrió un error al cancelar los movimientos de la remisión."
Exit For
End If
End If
Next
'CANCELAR MOVIMIENTOS DE USADOS SI TIENE
If Not ErrorCancelar AndAlso UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
Dim CveAlmacenUsado As Integer = 0
Dim CveMovimientoUsado As Integer = 0
If ObjInventario.GetInv_Mov(ObjRemision.CveVenta, UsuarioActual.CveEmpresa) Then
CveMovimientoUsado = ObjInventario.DtResultados.FiltroPrimeroValor("CveMovimiento", "CvePS IS NULL AND CveConcepto = 42").ToEntero()
CveAlmacenUsado = ObjInventario.DtResultados.FiltroPrimeroValor("CveAlmacen", "CvePS IS NULL AND CveConcepto = 42").ToEntero()
Else
ErrorCancelar = True
MensajeError = "Ocurrió un error al cargar los datos de devolución de usado. Por favor vuelva a intentar."
End If
If CveAlmacenUsado > 0 AndAlso DtSaldosAlmacenRemision IsNot Nothing Then
SaldoAlmacenUsados = DtSaldosAlmacenRemision.SUMD("SaldoAlmacen", $"CveAlmacen = {CveAlmacenUsado}")
End If
If Not ErrorCancelar AndAlso CveMovimientoUsado > 0 AndAlso SaldoAlmacenUsados <> 0 Then
If CancelarInventarioUsado(ObjRemision, CveAlmacenUsado, CveMovimientoUsado, ObjInventario) <= 0 Then
ErrorCancelar = True
MensajeError = "Ocurrió un error al cancelar los usados. Por favor vuelva a intentar."
End If
End If
End If
If DtDevRemision IsNot Nothing Then
DtDevRemision.Dispose()
End If
If DtDevMovs IsNot Nothing Then
DtDevMovs.Dispose()
End If
End If
If ObjRemision IsNot Nothing Then
ObjRemision.Dispose()
End If
If ErrorCancelar Then
Exit For
End If
@@ -5444,22 +5508,48 @@ Namespace Modelos
End If
'CANCELACION DE MOVIMIENTOS DE REMISION
If Not ErrorCancelar AndAlso ObjFactura.TipoDocto = "Rem" AndAlso RealizarDevolucionAlmacen Then
If Not ErrorCancelar AndAlso ObjFactura.TipoDocto = "Rem" AndAlso RealizarDevolucionAlmacen AndAlso ObjFactura.SaldoAlmacen <> 0 Then
Dim CveMovimientoUsado As Integer = -1
Dim CveAlmacenUsado As Integer = 0
Dim CveAlmacenGeneral As Integer = 0
Dim CveAlmacenExA As Integer = 0
Dim SaldoAlmacenExA As Decimal = 0
Dim SaldoAlmacenUsados As Decimal = 0
Dim DtMovRemision As DataTable = Nothing
'VERIFICA LOS MOVIMIENTOS DE DEVOLUCION YA GENERADOS QUE TENGAN EXISTENCIA EN (ENTREGA POR ADELANTADO)
If Not ErrorCancelar Then
If ObjInventario.GetInv_Mov(CveVenta, UsuarioActual.CveEmpresa) Then
DtMovRemision = ObjInventario.DtResultados.FiltraParametros("CveTipoAlmacen = 10")
CveAlmacenGeneral = ObjInventario.DtResultados.FiltroPrimeroValor("CveAlmacen", "CveTipoAlmacen = 1").ToString().ToEntero()
CveAlmacenExA = ObjInventario.DtResultados.FiltroPrimeroValor("CveAlmacen", "CveTipoAlmacen = 10").ToString().ToEntero()
CveMovimientoUsado = ObjInventario.DtResultados.FiltroPrimeroValor("CveMovimiento", "CvePS IS NULL AND CveConcepto = 42").ToEntero()
CveAlmacenUsado = ObjInventario.DtResultados.FiltroPrimeroValor("CveAlmacen", "CvePS IS NULL AND CveConcepto = 42").ToEntero()
Else
ErrorCancelar = True
MensajeError = "Ocurrió un error al cargar los datos de devolución. Por favor vuelva a intentar."
End If
End If
'VERIFICA SI HACE FALTA DEVOLVER PRODUCTOS Y USADOS EN ESPECIFICO
If Not ErrorCancelar Then
If ObjInventario.GetSaldoVentaDetalleAlmacen(CveVenta, UsuarioActual.CveEmpresa) Then
If CveAlmacenExA > 0 Then
SaldoAlmacenExA = ObjInventario.DtResultados.SUMD("SaldoAlmacen", $"CveAlmacen = {CveAlmacenExA}")
End If
If CveAlmacenUsado > 0 Then
SaldoAlmacenUsados = ObjInventario.DtResultados.SUMD("SaldoAlmacen", $"CveAlmacen = {CveAlmacenUsado}")
End If
Else
ErrorCancelar = True
MensajeError = "Ocurrió un error al cargar los saldos de devolución. Por favor vuelva a intentar."
End If
End If
'DEBE REGRESAR LA EXISTENCIA DE (ENTREGA POR ADELANTADO) AL ALMACEN ORGINAL (GENERAL,SIN COSTO)
If Not ErrorCancelar AndAlso DtMovRemision IsNot Nothing AndAlso DtMovRemision.Rows.Count > 0 Then
If Not ErrorCancelar AndAlso DtMovRemision IsNot Nothing AndAlso DtMovRemision.Rows.Count > 0 AndAlso SaldoAlmacenExA <> 0 Then
Dim DtDevMovs = DtMovRemision.FiltraParametros("", DistinctColumns:={"CveMovimiento", "CveAlmacen"})
@@ -5475,6 +5565,14 @@ Namespace Modelos
End If
'CANCELAR MOVIMIENTOS DE USADOS SI TIENE
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso Not ErrorCancelar AndAlso CveMovimientoUsado > 0 AndAlso SaldoAlmacenUsados <> 0 Then
If CancelarInventarioUsado(ObjFactura, CveAlmacenUsado, CveMovimientoUsado, ObjInventario) <= 0 Then
ErrorCancelar = True
MensajeError = "Ocurrió un error al cancelar los movimientos de usados."
End If
End If
End If
'VERIFICAR MOVIMIENTOS DE APARTADOS
@@ -5739,6 +5837,20 @@ Namespace Modelos
CveAlmacenVirtual = ObjInventario.DtResultados.FiltroPrimeroValor("CveAlmacen").ToEntero()
End If
Dim SaldoVirtual As Decimal = 0
'VERIFICA SI HACE FALTA DEVOLVER PRODUCTOS Y USADOS EN ESPECIFICO
If Not ErrorCancelar Then
If ObjInventario.GetSaldoVentaDetalleAlmacen(CveVenta, UsuarioActual.CveEmpresa) Then
If CveAlmacenVirtual > 0 Then
SaldoVirtual = ObjInventario.DtResultados.SUMD("SaldoAlmacen", $"CveAlmacen = {CveAlmacenVirtual}")
End If
Else
ErrorCancelar = True
End If
End If
If Not ErrorCancelar AndAlso SaldoVirtual <> 0 Then
If ObjInventario.GetMovimientosDetalleVirtual(CveMovimiento, UsuarioActual.CveEmpresa, CveMovimientoRelacionado:=CveMovimientoRelacionado) Then
DtPSVirtual = ObjInventario.DtResultados
End If
@@ -5775,6 +5887,85 @@ Namespace Modelos
ErrorCancelar = True
End If
End If
End If
Catch ex As Exception
OnError("Ocurrió un error al realizar la devolución al almacen virtual.", ex)
ErrorCancelar = True
End Try
Return Not ErrorCancelar
End Function
Private Function CancelarMovimientosVirtuales(CveVenta As Integer, CveMovimientoDevolucion As Integer, CveMovimientoVirtualSalida As Integer, ByRef ObjInventario As ClsInventarios) As Boolean
Dim ErrorCancelar As Boolean = False
Try
If UsuarioActual.Empresa.Funcionalidad(573) = "1" Then
Dim CveMovimientoVirtual As Integer = -1
Dim ValidaVirtual = True
Dim DtPSVirtual As New DataTable("DtTamanios")
Dim CveAlmacenVirtual As Integer = -1
If ObjInventario.GetMovimientos(CveMovimientoVirtualSalida, -1, -1, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then
CveAlmacenVirtual = ObjInventario.DtResultados.FiltroPrimeroValor("CveAlmacen").ToEntero()
End If
Dim SaldoVirtual As Decimal = 0
'VERIFICA SI HACE FALTA DEVOLVER PRODUCTOS Y USADOS EN ESPECIFICO
If Not ErrorCancelar Then
If ObjInventario.GetSaldoVentaDetalleAlmacen(CveVenta, UsuarioActual.CveEmpresa) Then
If CveAlmacenVirtual > 0 Then
SaldoVirtual = ObjInventario.DtResultados.SUMD("SaldoAlmacen", $"CveAlmacen = {CveAlmacenVirtual}")
End If
Else
ErrorCancelar = True
End If
End If
If Not ErrorCancelar AndAlso SaldoVirtual <> 0 Then
If ObjInventario.GetMovimientosDetalle(CveMovimientoVirtualSalida, UsuarioActual.CveEmpresa) Then
DtPSVirtual = ObjInventario.DtResultados
End If
Dim CveConceptoMovimientoVirtual As Integer = 36
Dim CveMovimientoRelacionadoVirtual As Integer = CveMovimientoDevolucion
If DtPSVirtual IsNot Nothing AndAlso DtPSVirtual.Rows.Count > 0 AndAlso CveAlmacenVirtual > 0 AndAlso CveConceptoMovimientoVirtual > 0 Then
CveMovimientoVirtual = ObjInventario.AddMovimiento(CveAlmacenVirtual, CveConceptoMovimientoVirtual, 1, Now, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVenta, -1, -1,
Observaciones:="", Guia:="", CveMovimientoRelacionado:=CveMovimientoRelacionadoVirtual, Modulo:="Modelos/CancelarVirtual")
If CveMovimientoVirtual > 0 Then
For Each RowUsado As DataRow In DtPSVirtual.Rows
Dim CvePS = RowUsado("CvePS").ToString().ToEntero()
Dim CantidadUsado As Double = RowUsado("Cantidad").ToString().ToDouble()
Dim PU As Decimal = RowUsado("PU").ToString().ToDecimal()
Dim CveUM As Integer = RowUsado("CveUM").ToString().ToEntero()
Dim CveVentaDetalle As Integer = RowUsado("CveVentaDetalle").ToString().ToEntero()
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoVirtual, CantidadUsado, CveUM, CvePS, PU, -1, CveVentaDetalle:=CveVentaDetalle) Then
ErrorCancelar = True
Exit For
End If
Next
Else
ErrorCancelar = True
End If
Else
If ValidaVirtual Then
ErrorCancelar = True
End If
End If
If DtPSVirtual.Rows.Count = 0 AndAlso ValidaVirtual = True Then
ErrorCancelar = True
End If
End If
End If
Catch ex As Exception
OnError("Ocurrió un error al realizar la devolución al almacen virtual.", ex)
ErrorCancelar = True
@@ -9921,7 +10112,9 @@ Namespace Modelos
Public Property Colonia As String
Public Property Localidad As String
Public Property Municipio As String
Public Property CveEstado As Integer
Public Property Estado As String
Public Property CvePais As Integer
Public Property Pais As String
Public Property CP As String
Public Property IVA As Decimal

View File

@@ -355,6 +355,252 @@ Public Class Timbres
End If
Return Timbre
End Function
Public Class MMensajeCartaPorte
Public Property TieneError As Boolean
Public Property Mensaje As String
Public Property CveMovimiento As Integer
Public Property FechaSalida As DateTime
Public Property CartaPorte As CFDICartaPorte
End Class
Public Shared Function PreParaCartaPorteFactura(CveTimbre As Integer, Obj As Modelos.Factura, UsuarioActual As Usuario) As MMensajeCartaPorte
Dim Retorno As New MMensajeCartaPorte
Try
Dim CartaPorte As New CFDICartaPorte
Dim _MsgError As New StringBuilder
Dim TieneError As Boolean = False
CartaPorte.TranspInternac = "No"
CartaPorte.EntradaSalidaMercancia = ""
CartaPorte.ViaEntradaSalida = ""
CartaPorte.Mercancias.UnidadPeso = "KGM"
CartaPorte.Mercancias.CargoporTasacion = 0
Dim FI As Date = New Date(1900, 1, 1)
Dim FF As Date = New Date(9999, 1, 1)
Dim FechaLlegada As DateTime
Dim Distancia As Integer = 1
Dim ObjGrales As New ClsGenerales
If ObjGrales.GetGralTimbre(CveTimbre, "Man", FI, FF, -1, UsuarioActual.CveEmpresa, -1) Then
If ObjGrales.DtResultados.Rows.Count = 1 Then
Dim DtMovimientos As DataTable = Nothing
Dim drT As DataRow = ObjGrales.DtResultados.Rows(0)
'Timbre.Receptor.RFC = drT("DestinatarioRFC").ToString
'Timbre.Receptor.Nombre = drT("DestinatarioNombre").ToString
Retorno.CveMovimiento = drT("CveMovimientoAlmacen").ToString.ToEntero
Retorno.FechaSalida = drT("FechaEntrega").ToString.ToDateTime
FechaLlegada = drT("FechaLlegada").ToString.ToDateTime
Distancia = drT("Distancia").ToString.ToEntero
'ObjFactura.Folio = drT("Folio").ToString.ToEntero
'ObjFactura.Serie = drT("Serie").ToString
'Timbre.Comprobante.Serie = Obj.Serie
'Timbre.Comprobante.Folio = Obj.Folio.ToString
'If drT("FolioFiscalRelacionado").ToString <> "" Then
' Timbre.CFDIRelacionados.TipoRelacion = "05"
' Timbre.CFDIRelacionados.UUID.Add(drT("FolioFiscalRelacionado").ToString)
'End If
If ObjGrales.GetGralMovimientosDetalleTimbre(CveTimbre, UsuarioActual.CveEmpresa) Then
DtMovimientos = ObjGrales.DtResultados
Else
TieneError = True
_MsgError.AppendLine("Error al obtener Movimientos")
End If
'ObjFactura.DtDetalle = DtMovimientos
'AplicaCP = Boolean.Parse(drT("AplicaCP").ToString)
'ObjFactura.CveSubProyecto = drT("CveSubProyecto").ToString.ToEntero
'ObjFactura.SetSubProyecto()
'ObjFactura.SetSubProyectoMatriz()
CartaPorte.FiguraTransporte.AutoTransporte.PermisoSCT = drT("ClaveTipoPermisoSCT").ToString '"TPAF01"
CartaPorte.FiguraTransporte.AutoTransporte.NumPermisoSCT = drT("NumPermisoSCT").ToString
CartaPorte.FiguraTransporte.AutoTransporte.NombreSeguroResponsabilidadCivil = drT("NombreAseguradora").ToString
CartaPorte.FiguraTransporte.AutoTransporte.PolizaSeguroResponsabilidadCivil = drT("NumPolizaSeguro").ToString
CartaPorte.FiguraTransporte.AutoTransporte.NombreSeguroMedioAmbiente = drT("NombreAseguradoraMedioAmbiente").ToString
CartaPorte.FiguraTransporte.AutoTransporte.PolizaSeguroMedioAmbiente = drT("NumPolizaSeguroMedioAmbiente").ToString
CartaPorte.FiguraTransporte.AutoTransporte.NombreSeguroCarga = drT("NombreAseguradoraCarga").ToString
CartaPorte.FiguraTransporte.AutoTransporte.PolizaSeguroCarga = drT("NumPolizaSeguroCarga").ToString
CartaPorte.FiguraTransporte.AutoTransporte.Vehiculo.ConfigVehicular = drT("ConfigCartaPorte").ToString
CartaPorte.FiguraTransporte.AutoTransporte.Vehiculo.PlacaVM = drT("Placa").ToString
CartaPorte.FiguraTransporte.AutoTransporte.Vehiculo.AnioModeloVM = drT("Anio").ToString.ToEntero
If drT("ClaveTipoRemolque1").ToString <> "" Then
Dim Rem1 As New CFDICartaPorteRemolque With {.SubTipoRemolque = drT("ClaveTipoRemolque1"), .Placa = drT("PlacaRemolque1")}
CartaPorte.FiguraTransporte.AutoTransporte.Remolques.Add(Rem1)
End If
If drT("ClaveTipoRemolque2").ToString <> "" Then
Dim Rem2 As New CFDICartaPorteRemolque With {.SubTipoRemolque = drT("ClaveTipoRemolque2"), .Placa = drT("PlacaRemolque2")}
CartaPorte.FiguraTransporte.AutoTransporte.Remolques.Add(Rem2)
End If
If drT("ClaveTipoRemolque1").ToString <> "" Then
Dim Rem1 As New CFDICartaPorteRemolque With {.SubTipoRemolque = drT("ClaveTipoRemolque1"), .Placa = drT("PlacaRemolque1")}
CartaPorte.FiguraTransporte.AutoTransporte.Remolques.Add(Rem1)
End If
If drT("ClaveTipoRemolque2").ToString <> "" Then
Dim Rem2 As New CFDICartaPorteRemolque With {.SubTipoRemolque = drT("ClaveTipoRemolque2"), .Placa = drT("PlacaRemolque2")}
CartaPorte.FiguraTransporte.AutoTransporte.Remolques.Add(Rem2)
End If
Dim DomOrigen As CFDICartaPorteDomicilio = Nothing
DomOrigen = New CFDICartaPorteDomicilio With {.Calle = drT("DirOriCalle").ToString,
.Colonia = drT("DirOriClaveSATColonia").ToString,
.CP = drT("DirOriCP").ToString,
.Estado = drT("DirOriClaveSATEstado").ToString,
.Pais = drT("DirOriClaveSATPais").ToString,
.Municipio = drT("DIrOriClaveSATMunicipio").ToString,
.Localidad = drT("DirOriClaveSATLocalidad").ToString}
Dim DomDestino As CFDICartaPorteDomicilio = Nothing
DomDestino = New CFDICartaPorteDomicilio With {.Calle = drT("DirDesCalle").ToString,
.Colonia = drT("DirDesClaveSATColonia").ToString,
.CP = drT("DirDesCP").ToString,
.Estado = drT("DirDesClaveSATEstado").ToString,
.Pais = drT("DirDesClaveSATPais").ToString,
.Municipio = drT("DirDesClaveSATMunicipio").ToString,
.Localidad = drT("DirDesClaveSATLocalidad").ToString}
Dim Ubica As New CFDICartaPorteUbicacion
Ubica.TipoEstacion = ""
Ubica = New CFDICartaPorteUbicacion With {.TipoUbicacion = "Origen", .IDUbicacion = "OR000001", .RFCRemitenteDestinatario = drT("RemitenteRFC").ToString,
.FechaHoraSalidaLlegada = Retorno.FechaSalida.ToString("yyyy-MM-ddTHH:mm:ss"),' "2021-08-23T11:13:01",
.NombreRemitenteDestinatario = drT("RemitenteNombre").ToString,
.Domicilio = DomOrigen}
CartaPorte.Ubicaciones.Add(Ubica)
Ubica = New CFDICartaPorteUbicacion With {.TipoUbicacion = "Destino", .IDUbicacion = "DE000001", .RFCRemitenteDestinatario = drT("DestinatarioRFC").ToString,
.FechaHoraSalidaLlegada = FechaLlegada.ToString("yyyy-MM-ddTHH:mm:ss"),
.NombreRemitenteDestinatario = drT("DestinatarioNombre").ToString,
.Domicilio = DomDestino,
.DistanciaRecorrida = Distancia}
CartaPorte.Ubicaciones.Add(Ubica)
CartaPorte.FiguraTransporte.ClaveTransporte = "01"
Dim DomicilioOperador As New CFDICartaPorteDomicilio With {.Calle = drT("FiguraDomicilio").ToString,
.NumeroExterior = drT("FiguraNumeroExterior").ToString,
.NumeroInterior = drT("FiguraNumeroInterior").ToString,
.Colonia = drT("FiguraClaveSATColonia").ToString,
.Municipio = drT("FiguraClaveSATMunicipio").ToString,
.Estado = drT("FiguraClaveSATEstado").ToString,
.CP = drT("FiguraCP").ToString}
CartaPorte.FiguraTransporte.Operadores.Add(New CFDICartaPorteOperador With {
.RFCFigura = drT("FiguraRFC").ToString,
.NombreFigura = drT("FiguraChofer").ToString,
.NumLicencia = drT("FiguraLicencia").ToString,
.NumRegidTribFigura = drT("FiguraNumRegidTribFigura").ToString,
.ResidenciaFiscalFigura = drT("FiguraResidenciaFiscalFigura").ToString,
.Domicilio = DomicilioOperador})
'concepto único
Dim concepto As New CFDIConceptos With {.Cantidad = 1,
.Descripcion = "Flete",
.ValorUnitario = 0,
.Importe = 0,
.Descuento = 0,
.Unidad = "Servicio",
.ClaveUnidad = "E48",
.ClaveProdServ = "78101802",
.Noidentificacion = "",
.CuentaPredial = ""}
For Each drr As DataRow In DtMovimientos.Rows
Dim tPS As String = ""
If drr("PS").ToString.Length = 1 Then
tPS = drr("Obs").ToString
Else
If drr("PS").ToString.Length = 0 Then
tPS = ""
Else
tPS = String.Format("{0} {1}", drr("PS"), drr("Obs"))
End If
End If
Dim conceptoCarta As New CFDICartaPorteMercancia With {
.BienesTransp = drr("SATClaveProdServ").ToString,
.ClaveSTCC = "", 'para metodo ferroviario
.Cantidad = drr("Cantidad").ToString.ToDecimal,
.Descripción = tPS,
.ClaveUnidad = drr("SATClaveUM").ToString,
.Unidad = drr("UM").ToString,
.Dimensiones = drr("Dimensiones").ToString,
.PesoenKg = drr("PesoKg").ToString.ToDecimal,
.MaterialPeligroso = If(drr("ClaveMaterialPeligroso").ToString <> "", "Sí", ""),
.ClaveMaterialPeligroso = drr("ClaveMaterialPeligroso").ToString,
.Embalaje = drr("ClaveEmbalaje").ToString,
.DescripEmbalaje = drr("Embalaje").ToString,
.ValorMercancia = drr("PU").ToString.ToDecimal,
.Moneda = "MXN", 'temporal
.FraccionArrancelaria = "",
.UUIDComercioExt = ""
}
Dim DetalleMercancia As New CFDICartaPorteMercanciaDetalleMercancia With {.PesoNeto = drr("PesoKg").ToString.ToDecimal, .NumPiezas = drr("Cantidad").ToString.ToDecimal}
conceptoCarta.DetalleMercancia = DetalleMercancia
Dim MercanciaTransporta As New CFDICartaPorteMercanciaTransporta With {.Cantidad = drr("Cantidad").ToString.ToDecimal, .IDOrigen = "OR000001", .IDDestino = "DE000001"}
conceptoCarta.MercanciasCantidadTransporta.Add(MercanciaTransporta)
CartaPorte.Mercancias.Mercancias.Add(conceptoCarta)
Next
Retorno.CartaPorte = CartaPorte
Else
TieneError = True
_MsgError.AppendLine("Consultar datos de timbrado")
End If
ObjGrales.Dispose()
Else
_MsgError.AppendLine("Consultar datos de timbrado")
End If
Retorno.TieneError = If(_MsgError.ToString().Length > 0, True, False)
Retorno.Mensaje = _MsgError.ToString()
Catch ex As Exception
Retorno.TieneError = True
Retorno.Mensaje = ex.ToString()
End Try
Return Retorno
End Function
Public Function Timbrar() As Boolean
Dim Respuesta As Boolean = False

View File

@@ -33,8 +33,9 @@ Partial Class Bancos_CuentasBancarias
Public Sub CargaDatos()
Dim ObjBancos As New ClsBancos
If ObjBancos.GetBancosCuentas(-1) Then
ViewState("DTBancosCuentas") = ObjBancos.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
DtBan = ObjBancos.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
Dim dt = ObjBancos.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa, "", {"CveCuenta", "TipoCuenta", "Banco", "NumCuenta", "CLABE", "Moneda", "FInicial", "Estatus", "Fecha", "Usuario"})
ViewState("DTBancosCuentas") = dt
DtBan = dt
Else
Me.GvDatos.DataSource = Nothing
End If

View File

@@ -1596,7 +1596,10 @@ Partial Class Bancos_PopIEVentas
CveIE = -1
End If
Case Else
'NO SE HA DEFINIDO PARA FUNCIONARIO Y EMPLEADO
If RBLContado.SelectedValue <> "2" Then
MsgError = "No se ha especificada opcion."
End If
End Select

View File

@@ -4969,6 +4969,7 @@ Partial Class PopUpVerFactura
Dim FolioFiscal = drv("FolioFiscal").ToString()
Dim RFCReceptor = drv("RFCReceptor").ToString()
Dim SelloCancelacion = drv("SelloCancelacion").ToString()
Dim SelloSolicitudCancelacion = drv("SelloSolicitudCancelacion").ToString()
Dim EstadoCancelacion = drv("EstadoCancelacion").ToString()
Dim FechaCancelacion = drv("FechaCancelacion").ToString.ToDateTime
@@ -4994,6 +4995,12 @@ Partial Class PopUpVerFactura
If CveEstatusFactura = 20 Then
Titulo = "Acuse de solicitud de cancelación de CFDI"
EstadoCFDI = "Vigente"
'SI TIENE DATOS EN EL SELLO DE SOLICITUD Y ESTA EN PROCESO, ENVIAR ESTE SELLO
If Not String.IsNullOrEmpty(SelloSolicitudCancelacion) Then
SelloCancelacion = SelloSolicitudCancelacion
End If
If String.IsNullOrEmpty(EstadoCancelacion) Then
EstadoCancelacion = "Cancelable con aceptación"
End If
@@ -5751,6 +5758,7 @@ Partial Class PopUpVerFactura
Dim MarcaAuto As String = RowAjuste("MarcaAuto").ToString
Dim CodigoTD As String = RowAjuste("CodigoTD").ToString
Dim PSAjuste As String = ""
Dim MarcaPS As String = ""
Dim CveMarca As Integer = -1
@@ -5781,7 +5789,15 @@ Partial Class PopUpVerFactura
Dim ObjPS As New ClsProductosServicios
If ObjPS.GetPS(CvePSAjuste, -1, UsuarioActual.CveEmpresa) Then
MarcaPS = ObjPS.DtResultados.FiltroPrimeroValor("Marca", String.Format("CvePS = {0}", CvePSAjuste))
Dim RowPS As DataRow = ObjPS.DtResultados.FiltroPrimero(String.Format("CvePS = {0}", CvePSAjuste))
If RowPS IsNot Nothing Then
PSAjuste = RowPS("PS").ToString()
MarcaPS = RowPS("Marca").ToString()
'SI ES MOTOBATERIAS PONER EL NOMBRE EN EL TIPO
If RowPS("CveClasificacion").ToString() = "20517" Then
BCIAjuste = PSAjuste
End If
End If
End If
ObjPS.Dispose()
@@ -5879,6 +5895,7 @@ Partial Class PopUpVerFactura
Dim MesesUso As String = "0"
Dim PSAjuste As String = ""
Dim MarcaPS As String = ""
Dim CveMarca As Integer = -1
@@ -5909,7 +5926,15 @@ Partial Class PopUpVerFactura
Dim ObjPS As New ClsProductosServicios
If ObjPS.GetPS(CvePSAjuste, -1, UsuarioActual.CveEmpresa) Then
MarcaPS = ObjPS.DtResultados.FiltroPrimeroValor("Marca", String.Format("CvePS = {0}", CvePSAjuste))
Dim RowPS As DataRow = ObjPS.DtResultados.FiltroPrimero(String.Format("CvePS = {0}", CvePSAjuste))
If RowPS IsNot Nothing Then
PSAjuste = RowPS("PS").ToString()
MarcaPS = RowPS("Marca").ToString()
'SI ES MOTOBATERIAS PONER EL NOMBRE EN EL TIPO
If RowPS("CveClasificacion").ToString() = "20517" Then
BCIAjuste = PSAjuste
End If
End If
End If
ObjPS.Dispose()

View File

@@ -990,9 +990,9 @@
</Paragraphs>
<rd:DefaultName>Textbox3</rd:DefaultName>
<Top>2.155in</Top>
<Left>2.56338in</Left>
<Left>2.76123in</Left>
<Height>0.16389in</Height>
<Width>1.23952in</Width>
<Width>1.04167in</Width>
<ZIndex>22</ZIndex>
<Style>
<Border>
@@ -1040,7 +1040,7 @@
<Top>2.155in</Top>
<Left>1.37238in</Left>
<Height>0.16389in</Height>
<Width>1.19096in</Width>
<Width>1.38885in</Width>
<ZIndex>23</ZIndex>
<Style>
<Border>

View File

@@ -524,7 +524,7 @@ Partial Class Inventarios_EntregaAlmacen
ChkTransitorio.Checked = False
TxtResponsable.Text = ""
DivTransitorio2.Visible = False
DdlAlmacen.Enabled = True
Select Case CType(Boton.NamingContainer, GridViewRow).DataKey("TipoEntrega").ToEntero()
Case 1 ' VENTA
@@ -742,12 +742,17 @@ Partial Class Inventarios_EntregaAlmacen
Dim DtMov As DataTable = DtExistencias.FiltraParametros("CveConcepto = 40", "", {"CveAlmacen"})
If DtMov.Rows.Count > 0 AndAlso CveAlmacen <= 0 Then
Dim CveAlmacenDev As Integer = DtMov.Rows(0)("CveAlmacen").ToString().ToEntero()
Dim AlmacenDev As String = ""
If CveAlmacenDev > 0 Then
AlmacenDev = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=CveAlmacenDev).FiltroPrimeroValor("Almacen")
'DdlAlmacen.Items.Clear()
'DdlAlmacen.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1).FiltraParametros($"CveAlmacen = {CveAlmacenDev}")
'DdlAlmacen.DataBind()
DdlAlmacen.SelectedValueExist(CveAlmacenDev) ' se va a poder regresar en algun almacen diferente
DdlAlmacen.SelectedValueExistInsert(CveAlmacenDev, AlmacenDev) ' se va a poder regresar en algun almacen diferente
DdlAlmacen.Enabled = False
End If
EsDevolucionDirecta = True
End If
End If
@@ -2502,7 +2507,7 @@ Partial Class Inventarios_EntregaAlmacen
PU = DtExistencias.FiltroPrimeroValor("PU", $"CveTipoAlmacenDevolucion <> 26 AND CvePS = {Dr("CvePS")} AND CveUM = {Dr("CveUM").ToString().ToEntero()} AND Serie = '{Dr1("Serie").ToString()}'").ToString().ToDecimal
End If
If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, 1, Dr("CveUM").ToString().ToEntero(), Dr("CvePS").ToString().ToEntero(), PU, Serie:=Dr1("Serie").ToString(), CveVentaDetalle:=Dr("CveVentaDetalle").ToString().ToEntero(), FechaCaducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("FechaCaducidad").ToString().ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString(), "-1"), CveSeccionAlmacen:=-3) Then
If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, 1, Dr("CveUM").ToString().ToEntero(), Dr("CvePS").ToString().ToEntero(), PU, Serie:=Dr1("Serie").ToString(), CveVentaDetalle:=Dr("CveVentaDetalle").ToString().ToEntero(), CveVentaDetalleRemision:=Dr("CveVentaDetalleRemision").ToString().ToEntero(), FechaCaducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("FechaCaducidad").ToString().ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString(), "-1"), CveSeccionAlmacen:=-3) Then
ErrorMovInv = True
TextoError.AppendFormat("Ocurrió un error al procesar los conceptos con serie. Por favor vuelva a intentar.")
Exit For
@@ -2515,7 +2520,7 @@ Partial Class Inventarios_EntregaAlmacen
PU = DtExistencias.FiltroPrimeroValor("PU", $"CvePS = {Dr("CvePS")} AND CveUM = {Dr("CveUM").ToString().ToEntero()} AND Serie = '{Dr1("Serie").ToString()}'").ToString().ToDecimal
End If
If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr1("Cantidad").ToString().ToDouble, Dr("CveUM").ToString().ToEntero(), Dr("CvePS").ToString().ToEntero(), PU, CveVentaDetalle:=Dr("CveVentaDetalle").ToString().ToEntero(), FechaCaducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("FechaCaducidad").ToString().ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString(), "-1"), CveSeccionAlmacen:=-3) Then
If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr1("Cantidad").ToString().ToDouble, Dr("CveUM").ToString().ToEntero(), Dr("CvePS").ToString().ToEntero(), PU, CveVentaDetalle:=Dr("CveVentaDetalle").ToString().ToEntero(), CveVentaDetalleRemision:=Dr("CveVentaDetalleRemision").ToString().ToEntero(), FechaCaducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("FechaCaducidad").ToString().ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString(), "-1"), CveSeccionAlmacen:=-3) Then
ErrorMovInv = True
TextoError.AppendFormat("Ocurrió un error al procesar los conceptos con serie. Por favor vuelva a intentar.")
Exit For
@@ -2526,7 +2531,7 @@ Partial Class Inventarios_EntregaAlmacen
PU = DtExistencias.FiltroPrimeroValor("PU", $"CvePS = {Dr("CvePS")} AND CveUM = {Dr("CveUM").ToString().ToEntero()}").ToString().ToDecimal
End If
If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, CantidadPendiente, Dr("CveUM").ToString().ToEntero(), Dr("CvePS").ToString().ToEntero(), PU, CveVentaDetalle:=Dr("CveVentaDetalle").ToString().ToEntero(), FechaCaducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("FechaCaducidad").ToString().ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString(), "-1"), CveSeccionAlmacen:=-3) Then
If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, CantidadPendiente, Dr("CveUM").ToString().ToEntero(), Dr("CvePS").ToString().ToEntero(), PU, CveVentaDetalle:=Dr("CveVentaDetalle").ToString().ToEntero(), CveVentaDetalleRemision:=Dr("CveVentaDetalleRemision").ToString().ToEntero(), FechaCaducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("FechaCaducidad").ToString().ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString(), "-1"), CveSeccionAlmacen:=-3) Then
ErrorMovInv = True
TextoError.AppendFormat("Ocurrió un error al procesar los conceptos de salida. Por favor vuelva a intentar.")
Exit For
@@ -2796,13 +2801,26 @@ Partial Class Inventarios_EntregaAlmacen
FolioVirtual = ObjInventario.Folio
If CveMovimientoVirtual > 0 Then
Dim TmpDTDetalleFactura As DataTable = Nothing
If ObjVentas.GetVentaDetalle(CveVentaSurtir) Then
TmpDTDetalleFactura = ObjVentas.DtResultados.Copy()
End If
For Each RowUsado As DataRow In DtPSVirtual.Rows
Dim CvePS = RowUsado("CvePS").ToString().ToEntero()
Dim CantidadUsado As Decimal = RowUsado("Cantidad").ToString().ToDecimal()
Dim PU As Decimal = RowUsado("Cargo").ToString().ToDecimal()
Dim CveUM As Integer = RowUsado("CveUM").ToString().ToEntero()
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoVirtual, CantidadUsado, CveUM, CvePS, PU) Then
Dim CveVentaDetalle As Integer = -1
If TmpDTDetalleFactura IsNot Nothing Then
CveVentaDetalle = TmpDTDetalleFactura.FiltroPrimeroValor("CveVentaDetalle", $"Cantidad = {RowUsado("Cantidad")} AND CvePS = {RowUsado("CvePS")}").ToEntero()
If CveVentaDetalle <= 0 Then
CveVentaDetalle = -1
End If
End If
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoVirtual, CantidadUsado, CveUM, CvePS, PU, CveVentaDetalle:=CveVentaDetalle) Then
ErrorMovInv = True
TextoError.AppendFormat("Ocurrió un error al procesar los conceptos de traspaso de apartado. Por favor vuelva a intentar.")
Exit For
@@ -3529,6 +3547,9 @@ Partial Class Inventarios_EntregaAlmacen
LbSurtida.Visible = False
TimmerRefresh.Enabled = True
DdlAlmacen.Enabled = True
UpGenerales.Update()
CargaGvDatos()

View File

@@ -653,10 +653,11 @@ public partial class General_RepEntregaAlmacenRuta : ClsPaginas
string ArchivoXML = String.Format("{0}/XML/{1}/{2}.xml", UsuarioActual.Empresa.Ruta, e.Row.DataKey("TimbreTipoDocto"), e.Row.DataKey("SerieFolio"));
//if (File.Exists(ArchivoXML))
//{
// e.Row.Cells[12].Text = "<a CssClass='btn btn-circle btn-sm blue' target= '_blank' href=\"/Compras/PopUpVerFactura.aspx?P=" + Extensiones.ModExtensiones.Encripta(String.Format("OP=DesXmlTra&CVEMOVIMIENTO={0}&EXT={1}&FOLIO={2}&TIPODOCTO={3}", -1, "XML", e.Row.DataKey("SerieFolio"), e.Row.DataKey("TimbreTipoDocto"))) + "\" ><i class='fa fa-file-code-o'></i></a>";
//}
if (File.Exists(ArchivoXML))
{
if (e.Row.FCHyperLink("HplXML") != null)
e.Row.FCHyperLink("HplXML").NavigateUrl = "/Compras/PopUpVerFactura.aspx?P=" + Extensiones.ModExtensiones.Encripta(String.Format("OP=DesXmlTra&CVEMOVIMIENTO={0}&EXT={1}&FOLIO={2}&TIPODOCTO={3}", -1, "XML", e.Row.DataKey("SerieFolio"), e.Row.DataKey("TimbreTipoDocto")));
}
}
else

View File

@@ -4119,7 +4119,7 @@
<span class="caption-subject bold">Agregar</span>
</div>--%>
<asp:HyperLink ID="ImgAddObs" CssClass="caption-subject bold" data-toggle="modal" data-target="#ModalBitacora" runat="server" Text=" <i class='fa fa-commenting font-green'></i><span class='caption-subject bold'>Agregar</span>" Style="font-weight: 700 !important; cursor: pointer;" ToolTip="Observaciones"></asp:HyperLink><br />
<asp:HyperLink ID="HlEvento" CssClass="thickbox caption-subject bold" runat="server" Text=" <i class='fa fa-calendar-plus-o font-green'></i>Agendar" Visible="false" Style="font-weight: 700 !important; cursor: pointer;" ToolTip="Agendar"></asp:HyperLink><br />
<asp:HyperLink ID="HlEvento" CssClass="thickbox font-green caption-subject bold" runat="server" Text=" <i class='fa fa-calendar-plus-o font-green'></i>Agendar" Visible="false" Style="font-weight: 700 !important; cursor: pointer;" ToolTip="Agendar"></asp:HyperLink><br />
<asp:Literal ID="LtlTareaNueva" runat="server"></asp:Literal>
<UserControl:TareaNueva runat="server" ID="TareaNueva" />
</div>

View File

@@ -41,18 +41,19 @@
white-space: nowrap;
}
.reporte1 .GVSolicitudTimbreNominaGral tr th:nth-child(2),
.reporte1 .ADScroller-body .GVSolicitudTimbreNominaGral tr:nth-child(2) td:nth-child(2) {
.reporte1 .GVSolicitudTimbreNominaGral tr th:nth-child(2)
/*,.reporte1 .ADScroller-body .GVSolicitudTimbreNominaGral tr:nth-child(2) td:nth-child(2) */
{
background-color: #900;
color: #FFF;
}
.reporte1 .GVSolicitudTimbreNominaGral tr th:nth-child(3),
.reporte1 .GVSolicitudTimbreNominaGral tr th:nth-child(4),
.reporte1 .GVSolicitudTimbreNominaGral tr th:nth-child(5),
.reporte1 .GVSolicitudTimbreNominaGral tr th:nth-child(5)/*,
.reporte1 .ADScroller-body .GVSolicitudTimbreNominaGral tr:nth-child(2) td:nth-child(3),
.reporte1 .ADScroller-body .GVSolicitudTimbreNominaGral tr:nth-child(2) td:nth-child(4),
.reporte1 .ADScroller-body .GVSolicitudTimbreNominaGral tr:nth-child(2) td:nth-child(5) {
.reporte1 .ADScroller-body .GVSolicitudTimbreNominaGral tr:nth-child(2) td:nth-child(5)*/ {
background-color: #3598dc;
color: #FFF;
}
@@ -66,14 +67,14 @@
white-space: nowrap;
}
.reporte2 .GVSolicitudTimbreNominaGral tr th:nth-child(2),
.reporte2 .ADScroller-body .GVSolicitudTimbreNominaGral tr:nth-child(2) td:nth-child(2) {
.reporte2 .GVSolicitudTimbreNominaGral tr th:nth-child(2)/*,
.reporte2 .ADScroller-body .GVSolicitudTimbreNominaGral tr:nth-child(2) td:nth-child(2)*/ {
background-color: #900;
color: #FFF;
}
.reporte2 .GVSolicitudTimbreNominaGral tr th:nth-child(n+3):not(:nth-child(7)),
.reporte2 .ADScroller-body .GVSolicitudTimbreNominaGral tr:nth-child(2) td:nth-child(n+3):not(:nth-child(7)){
.reporte2 .GVSolicitudTimbreNominaGral tr th:nth-child(n+3):not(:nth-child(7))/*,
.reporte2 .ADScroller-body .GVSolicitudTimbreNominaGral tr:nth-child(2) td:nth-child(n+3):not(:nth-child(7))*/{
background-color: #3598dc;
color: #FFF;
}
@@ -93,17 +94,17 @@
}
.reporte3 .GVSolicitudTimbreNominaGral tr th:nth-child(2),
.reporte3 .GVSolicitudTimbreNominaGral tr th:nth-child(n+20),
.reporte3 .GVSolicitudTimbreNominaGral tr th:nth-child(n+20)/*,
.reporte3 .ADScroller-body .GVSolicitudTimbreNominaGral tr:nth-child(2) td:nth-child(2),
.reporte3 .ADScroller-body .GVSolicitudTimbreNominaGral tr:nth-child(2) td:nth-child(n+20){
.reporte3 .ADScroller-body .GVSolicitudTimbreNominaGral tr:nth-child(2) td:nth-child(n+20)*/{
background-color: #900;
color: #FFF;
}
.reporte3 .GVSolicitudTimbreNominaGral tr th:nth-child(1),
.reporte3 .GVSolicitudTimbreNominaGral tr th:nth-child(n+3):not(:nth-child(n+20)),
.reporte3 .GVSolicitudTimbreNominaGral tr th:nth-child(n+3):not(:nth-child(n+20))/*,
.reporte3 .ADScroller-body .GVSolicitudTimbreNominaGral tr:nth-child(2) td:nth-child(1),
.reporte3 .ADScroller-body .GVSolicitudTimbreNominaGral tr:nth-child(2) td:nth-child(n+3):not(:nth-child(n+20)) {
.reporte3 .ADScroller-body .GVSolicitudTimbreNominaGral tr:nth-child(2) td:nth-child(n+3):not(:nth-child(n+20))*/ {
background-color: #3598dc;
color: #FFF;
}
@@ -115,39 +116,82 @@
white-space: nowrap;
}
.reporte4 .GVSolicitudTimbreNominaGral tr th:nth-child(2),
.reporte4 .ADScroller-body .GVSolicitudTimbreNominaGral tr:nth-child(2) td:nth-child(2) {
.reporte4 .GVSolicitudTimbreNominaGral tr th:nth-child(2)/*,
.reporte4 .ADScroller-body .GVSolicitudTimbreNominaGral tr:nth-child(2) td:nth-child(2)*/ {
background-color: #900;
color: #FFF;
}
.reporte4 .GVSolicitudTimbreNominaGral tr th:nth-child(n+3),
.reporte4 .ADScroller-body .GVSolicitudTimbreNominaGral tr:nth-child(2) td:nth-child(n+3) {
.reporte4 .GVSolicitudTimbreNominaGral tr th:nth-child(n+3):not(:nth-child(n+6))/*,
.reporte4 .ADScroller-body .GVSolicitudTimbreNominaGral tr:nth-child(2) td:nth-child(n+3)*/ {
background-color: #3598dc;
color: #FFF;
}
.reporte5 .GVSolicitudTimbreNominaGral tr th:nth-child(2)/*,
.reporte5 .ADScroller-body .GVSolicitudTimbreNominaGral tr:nth-child(2) td:nth-child(2)*/ {
background-color: #900;
color: #FFF;
}
.reporte5 .GVSolicitudTimbreNominaGral tr th:nth-child(3)/*,
.reporte5 .ADScroller-body .GVSolicitudTimbreNominaGral tr:nth-child(2) td:nth-child(3)*/ {
background-color: #3598dc;
color: #FFF;
}
.reporte6 .GVSolicitudTimbreNominaGral tr td:nth-child(n) {
white-space: nowrap;
}
.reporte6 .GVSolicitudTimbreNominaGral tr td:nth-child(n+3),
.reporte6 .GVSolicitudTimbreNominaGral tr th:nth-child(n+3) {
.reporte6 .GVSolicitudTimbreNominaGral tr td:nth-child(n+4),
.reporte6 .GVSolicitudTimbreNominaGral tr th:nth-child(n+4) {
text-align: right !important;
}
.reporte6 .GVSolicitudTimbreNominaGral tr th:nth-child(n+3):not(:nth-child(n+6)) {
.reporte6 .GVSolicitudTimbreNominaGral tr th:nth-child(n+4):not(:nth-child(n+7)) {
background-color: #900;
color: #FFF;
}
.reporte6 .GVSolicitudTimbreNominaGral tr th:nth-child(n+6) {
.reporte6 .GVSolicitudTimbreNominaGral tr th:nth-child(n+7):not(:nth-child(n+10)) {
background-color: #3598dc;
color: #FFF;
}
.reporte7 .GVSolicitudTimbreNominaGral tr td:nth-child(n+3),
.reporte7 .GVSolicitudTimbreNominaGral tr th:nth-child(n+3) {
text-align: right !important;
}
.reporte7 .GVSolicitudTimbreNominaGral tr th:nth-child(n+3):not(:nth-child(n+6)) {
background-color: #900;
color: #FFF;
}
.reporte7 .GVSolicitudTimbreNominaGral tr th:nth-child(n+6):not(:nth-child(n+9)) {
background-color: #3598dc;
color: #FFF;
}
.reporte8 .GVSolicitudTimbreNominaGral tr td:nth-child(n+6),
.reporte8 .GVSolicitudTimbreNominaGral tr th:nth-child(n+6) {
text-align: right !important;
}
.reporte8 .GVSolicitudTimbreNominaGral tr th:nth-child(n+6):not(:nth-child(n+9)) {
background-color: #900;
color: #FFF;
}
.reporte8 .GVSolicitudTimbreNominaGral tr th:nth-child(n+9):not(:nth-child(n+12)) {
background-color: #3598dc;
color: #FFF;
}
.reporte9 .GVSolicitudTimbreNominaGral tr td:nth-child(1),
.reporte9 .GVSolicitudTimbreNominaGral tr td:nth-child(4) {
white-space: nowrap;
@@ -161,7 +205,7 @@
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
<li>
<asp:LinkButton ID="LnkDownloadExcel" OnClick="LnkDownloadExcel_Click" runat="server"><i class="fa fa-excel"></i>Descargar</asp:LinkButton>
<asp:LinkButton ID="LnkDownloadExcel" OnClick="LnkDownloadExcel_Click" runat="server"><i class="fa fa-download"></i>Descargar</asp:LinkButton>
</li>
<asp:UpdatePanel ID="UpAcciones" runat="server" UpdateMode="Conditional">
<ContentTemplate>
@@ -181,21 +225,22 @@
<div class="portlet-title portlet-filterT smalltitle">
<div class="titlefiltros caption">
<div class="row">
<label class="col-md-1">Reporte: </label>
<label class="col-md-1">Agrupador: </label>
<div class="col-md-2">
<asp:DropDownList ID="DdlReporte" runat="server" Style="width: 100% !important;" CssClass="select2me" DataValueField="CveUsuario" DataTextField="Nombre">
<asp:ListItem Value="1" Text="Conciliacion ISR mensual"></asp:ListItem>
<asp:ListItem Value="2" Text="Conciliacion ISR por concepto"></asp:ListItem>
<asp:ListItem Value="3" Text="Conciliacion ISR por recibo"></asp:ListItem>
<asp:ListItem Value="4" Text="Anual sueldos y salarios resumen general"></asp:ListItem>
<asp:ListItem Value="5" Text="Anual sueldos y salarios global por conceptos"></asp:ListItem>
<asp:ListItem Value="6" Text="Anual sueldos y salarios por clave SAT"></asp:ListItem>
<asp:ListItem Value="7" Text="Anual sueldos y salarios por empleado"></asp:ListItem>
<asp:ListItem Value="8" Text="Anual sueldos y salarios por concepto"></asp:ListItem>
<asp:ListItem Value="4" Text="Anual sueldos y salarios "></asp:ListItem>
<asp:ListItem Value="5" Text="Anual sueldos y salarios resumen general"></asp:ListItem>
<asp:ListItem Value="6" Text="Anual sueldos y salarios global por empleado"></asp:ListItem>
<asp:ListItem Value="7" Text="Anual sueldos y salarios por clave SAT"></asp:ListItem>
<asp:ListItem Value="8" Text="Anual sueldos y salarios por empleado y concepto"></asp:ListItem>
<%--<asp:ListItem Value="8" Text="Anual sueldos y salarios por concepto"></asp:ListItem>--%>
<asp:ListItem Value="9" Text="Anual sueldos y salarios por recibo"></asp:ListItem>
</asp:DropDownList>
</div>
<label class="col-md-1 mediocol">del:</label>
<label class="col-md-1 mediocol">Fecha inicio:</label>
<div class="col-md-1">
<%--<asp:TextBox ID="TxtPeriodoInicio" Text="0" CssClass="form-control" runat="server"></asp:TextBox>--%>
@@ -210,7 +255,7 @@
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender1" runat="server" HighlightCssClass="vco" TargetControlID="rfvRpdFechaInicio"></ajax:ValidatorCalloutExtender>
</div>
</div>
<label class="col-md-1 mediocol">al:</label>
<label class="col-md-1 mediocol">Fecha fin:</label>
<div class="col-md-1">
<%--<asp:TextBox ID="TxtPeriodoFin" Text="99" CssClass="form-control" runat="server"></asp:TextBox>--%>
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 138px !important; padding: 0px; margin-bottom: -10px;">

View File

@@ -60,6 +60,54 @@ public partial class SAT_SolicitudesNominaSat : ClsPaginas
ClosedXML.Excel.XLWorkbook wb = new ClosedXML.Excel.XLWorkbook();
var libro = wb.AddWorksheet(nom.DtResultados , "Nomina");
libro.ColumnsUsed().AdjustToContents();
libro.Range(1, 1, 1, nom.DtResultados.Columns.Count).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(153, 153, 153));
switch (DdlReporte.SelectedValue.ToString().ToEntero())
{
case 1:
libro.Range(1, 2, 1, 2).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(153,0,0));
libro.Range(1, 3, 1, 5).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(53, 152, 220));
break;
case 2:
libro.Range(1, 2, 1, 2).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(153, 0, 0));
libro.Range(1, 3, 1, 6).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(53, 152, 220));
libro.Range(1, 8, 1, 11).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(53, 152, 220));
break;
case 3:
libro.Range(1, 1, 1, 10).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(53, 152, 220));
libro.Range(1, 11, 1, nom.DtResultados.Columns.Count).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(153, 0, 0));
break;
case 4:
libro.Range(1, 2, 1, 2).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(153, 0, 0));
libro.Range(1, 3, 1, 5).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(53, 152, 220));
break;
case 5:
libro.Range(1, 2, 1, 2).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(153, 0, 0));
libro.Range(1, 3, 1, 3).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(53, 152, 220));
break;
case 6:
libro.Range(1, 4, 1, 6).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(153, 0, 0));
libro.Range(1, 7, 1, 9).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(53, 152, 220));
break;
case 7:
libro.Range(1, 3, 1, 5).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(153, 0, 0));
libro.Range(1, 6, 1, 8).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(53, 152, 220));
break;
case 8:
libro.Range(1, 6, 1, 8).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(153, 0, 0));
libro.Range(1, 9, 1, 12).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(53, 152, 220));
break;
case 9:
break;
default:
break;
}
libro.Row(1).InsertRowsAbove(4);
libro.Range(1, 2, 1, 6).Merge().Value = UsuarioActual.Empresa.Empresa;
libro.Range(2, 2, 2, 6).Merge().Value = $"Reporte de {DdlReporte.SelectedItem.Text }";
libro.Range(3, 2, 3, 6).Merge().Value = $"del {fechaInicio.ToDateTime():dd/MM/yyyy} al {fechaFin.ToDateTime():dd/MM/yyyy}";
libro.Range(2, 7, 2, 9).Merge().Value = $"Fecha:{DateTime.Now:dd/MM/yyyy}";
libro.Range(3, 7, 3, 9).Merge().Value = $"Hora:{DateTime.Now:HH:mm}";
System.IO.Stream fs = new System.IO.MemoryStream();
wb.SaveAs(fs);
fs.Position = 0;
@@ -75,7 +123,7 @@ public partial class SAT_SolicitudesNominaSat : ClsPaginas
Response.Buffer = true;
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
Response.AddHeader("content-disposition", string.Format("attachment;filename={0}.xlsx", "Visor nómina "));
Response.AddHeader("content-disposition", string.Format("attachment;filename={0}.xlsx", $"Visor nómina ( Reporte :{DdlReporte.SelectedValue}) "));
Response.BinaryWrite(memoryStream.ToArray());
Response.End();
}

View File

@@ -258,19 +258,19 @@ Partial Class Sistemas_PermisosPorUsuario
''Nota, permitir, tiene 3 valores, ''(Vacio), no se ha estipulado, '0' que se denego, '1' permitido(aplicado solo cuando no viene del rol
If HdnCveModuloAcceso.Value <> "" Then
If HdnPermitir.Value = "" OrElse HdnPermitir.Value = "0" Then
If ObjUsuarios.UpdateUsuariosModulos(HdnCveUsuario.Value.ToEntero, HdnCveModulo.Value.ToEntero, Not ChkModuloDenegar.Checked) Then
If ObjUsuarios.UpdateUsuariosModulos(HdnCveUsuario.Value.ToEntero, HdnCveModulo.Value.ToEntero, Not ChkModuloDenegar.Checked, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then
Alert("Se ha actualizado el acceso al modulo correctamente")
End If
End If
'SI EL MODULO TRARE EL PERMISO Y ESTA ASIGNADO TAMBIEN (2 palomitas)
If HdnPermitir.Value = "1" Then
If ObjUsuarios.UpdateUsuariosModulos(HdnCveUsuario.Value.ToEntero, HdnCveModulo.Value.ToEntero, Not ChkModuloDenegar.Checked) Then
If ObjUsuarios.UpdateUsuariosModulos(HdnCveUsuario.Value.ToEntero, HdnCveModulo.Value.ToEntero, Not ChkModuloDenegar.Checked, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then
Alert("Se ha actualizado el acceso al modulo correctamente")
End If
End If
Else
If HdnPermitir.Value = "" OrElse HdnPermitir.Value = "1" Then
If ObjUsuarios.UpdateUsuariosModulos(HdnCveUsuario.Value.ToEntero, HdnCveModulo.Value.ToEntero, ChkModuloPermitir.Checked) Then
If ObjUsuarios.UpdateUsuariosModulos(HdnCveUsuario.Value.ToEntero, HdnCveModulo.Value.ToEntero, ChkModuloPermitir.Checked, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then
Alert("Se ha actualizado el acceso al modulo correctamente")
End If
End If
@@ -464,19 +464,19 @@ Partial Class Sistemas_PermisosPorUsuario
''Nota, permitir, tiene 3 valores, ''(Vacio), no se ha estipulado, '0' que se denego, '1' permitido(aplicado solo cuando no viene del rol
If HdnCveModuloAccesoProceso.Value <> "" Then
If HdnPermitirProceso.Value = "" OrElse HdnPermitirProceso.Value = "0" Then
If ObjUsuarios.UpdateUsuariosProcesos(HdnCveUsuarioProceso.Value.ToEntero, HdnCveProceso.Value.ToEntero, Not ChkDenegarProceso.Checked) Then
If ObjUsuarios.UpdateUsuariosProcesos(HdnCveUsuarioProceso.Value.ToEntero, HdnCveProceso.Value.ToEntero, Not ChkDenegarProceso.Checked, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then
Alert("Se ha actualizado el proceso correctamente")
End If
End If
'SI EL MODULO TRARE EL PERMISO Y ESTA ASIGNADO TAMBIEN (2 palomitas)
If HdnPermitirProceso.Value = "1" Then
If ObjUsuarios.UpdateUsuariosProcesos(HdnCveUsuarioProceso.Value.ToEntero, HdnCveProceso.Value.ToEntero, Not ChkDenegarProceso.Checked) Then
If ObjUsuarios.UpdateUsuariosProcesos(HdnCveUsuarioProceso.Value.ToEntero, HdnCveProceso.Value.ToEntero, Not ChkDenegarProceso.Checked, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then
Alert("Se ha actualizado el proceso correctamente")
End If
End If
Else
If HdnPermitirProceso.Value = "" OrElse HdnPermitirProceso.Value = "1" Then
If ObjUsuarios.UpdateUsuariosProcesos(HdnCveUsuarioProceso.Value.ToEntero, HdnCveProceso.Value.ToEntero, ChkPermitirProceso.Checked) Then
If ObjUsuarios.UpdateUsuariosProcesos(HdnCveUsuarioProceso.Value.ToEntero, HdnCveProceso.Value.ToEntero, ChkPermitirProceso.Checked, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then
Alert("Se ha actualizado el proceso correctamente")
End If
End If

View File

@@ -120,6 +120,7 @@
<asp:BoundField DataField="DiasVencidos" ItemStyle-Width="5%" HeaderText="D.Venc" ItemStyle-HorizontalAlign="Center" DataFormatString="{0:N0}" />
<asp:HyperLinkField DataTextField="FacturaAplicada" Target="_blank" HeaderText="Factura" DataNavigateUrlFields="CveVentaAplicada" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveVenta={0}" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField DataField="Usuario" HeaderText="Usuario" ItemStyle-Width="15%" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField DataField="Motivo" HeaderText="Motivo" ItemStyle-Width="15%" ItemStyle-HorizontalAlign="Left" />
<asp:TemplateField HeaderText="Estatus" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="5%">
<ItemTemplate>
<asp:Label ID="LblEstatus" Text='<%# Eval("Estatus") %>' runat="server"></asp:Label>
@@ -203,6 +204,20 @@
<ajax:ValidatorCalloutExtender ID="VCEDiasVencidos2" runat="server" HighlightCssClass="vco" TargetControlID="RFVDiasVencidos2" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
</div>
<div id="DivMotivo" runat="server" visible="false" class="row">
<div class="col-md-12">
<div class="row">
<label class="col-md-3 truncate" style="color: #888888; font-family: 'Open Sans', sans-serif; direction: ltr; font-size: 12px;">Motivo:</label>
</div>
<div class="row">
<div class="col-md-12">
<asp:TextBox ID="TxtMotivo" CssClass="form-control input-sm" runat="server" Rows="2" TextMode="MultiLine" Width="100%" MaxLength="50"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVMotivo" runat="server" ControlToValidate="TxtMotivo" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Motivo''</b> es necesario, por favor ingréselo." ValidationGroup="VgmGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCEMotivo" runat="server" HighlightCssClass="vco" TargetControlID="RFVMotivo" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<asp:Button ID="BtnGuardar" OnClick="BtnGuardar_Click" runat="server" Text="Agregar" CssClass="btn btn-primary" ValidationGroup="VgmGuardar" />

View File

@@ -4,14 +4,22 @@ Partial Class Ventas_CatAutorizacionLimites
Inherits ClsPaginas
#Region "PROPIEDADES"
Private Property CveAutorizacion() As Integer
Private Property CveAutorizacion() As Integer
Get
Return If(IsNothing(ViewState("CveAutorizacion")), -1, CInt(ViewState("CveAutorizacion")))
Return If(IsNothing(ViewState("CveAutorizacion")), -1, CInt(ViewState("CveAutorizacion")))
End Get
Set
End Get
Set
ViewState("CveAutorizacion") = Value
End Set
End Property
Private Property Modalidad() As String
Get
Return If(IsNothing(ViewState("Modalidad")), "", (ViewState("Modalidad").ToString))
End Set
End Property
End Get
Set
ViewState("Modalidad") = Value
End Set
End Property
#End Region
Private Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
@@ -103,8 +111,10 @@ Partial Class Ventas_CatAutorizacionLimites
LimpiaModal()
Modalidad = "A"
BtnGuardar.Text = "Agregar"
CargaDatos()
ltlMotititulo.Text = "Agregar autorización"
UpModal.Update()
RegistraScript("$('#DModal').modal()")
End Sub
Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs)
If DdlTipoAutorizacion.SelectedValue.ToEntero() <= 0 Then
Alert("Debe seleccionar un tipo de autorización", TipoMensaje.MsgAdvertencia)
@@ -119,8 +129,10 @@ Partial Class Ventas_CatAutorizacionLimites
DiasVencidos = TxtDiasVencidos.Text.ToEntero()
End If
Dim Motivo As String = TxtMotivo.Text.Trim
Dim ObjPS As New ClsVentas
Dim DiasVencidos As Integer = 0
If ObjPS.AddAutorizacionLimite(UsuarioActual.CveEmpresa, DdlCliente.SelectedValue.ToEntero(), DdlVendedor.SelectedValue.ToEntero(), TxtPrecio.Text.ToDecimal(), CveEstatus, UsuarioActual.CveUsuario, CveTipoAutorizacion, TipoDocto, DiasVencidos, Motivo:=Motivo) Then
RegistraScript("$('#DModal').modal('hide')")
Alert("La autorización se agregó correctamente.", TipoMensaje.MsgInformacion)
End If
@@ -132,9 +144,13 @@ Partial Class Ventas_CatAutorizacionLimites
#End Region
#Region "LIMPIAR"
Alert("La autorización se agregó correctamente.", TipoMensaje.MsgInformacion)
Protected Sub LimpiaModal()
Me.CveAutorizacion = -1
TxtPrecio.Text = ""
ObjPS.Dispose()
DdlCliente.SelectedValue = "-1"
DdlVendedor.SelectedValueExist("-1")
End Sub
#End Region
@@ -286,9 +302,11 @@ Partial Class Ventas_CatAutorizacionLimites
If DdlTipoAutorizacion.Items.FindByValue("2") Is Nothing Then
DdlTipoAutorizacion.Items.Insert(0, New ListItem("Vencimiento", "2"))
End If
DivMotivo.Visible = False
Case "Egs"
'QUITAR LA DE VENCIMIENTO
DdlTipoAutorizacion.Items.Remove(DdlTipoAutorizacion.Items.FindByValue("2"))
DivMotivo.Visible = True
End Select
UpModal.Update()
End Sub

View File

@@ -2834,6 +2834,7 @@
<asp:HiddenField ID="HdnAplicaIEPS" runat="server" Value="-1" />
<asp:HiddenField ID="HdnPorcentajeIEPS" runat="server" Value="-1" />
<asp:HiddenField ID="HdnCvePS" runat="server" Value="-1" />
<asp:HiddenField ID="HdnCveClasificacion" runat="server" Value="-1" ClientIDMode="Static" />
<div class="row" runat="server" visible="false">
<div class="col-md-12">
@@ -2898,10 +2899,6 @@
</div>
</div>
<div class="portlet-body form">
<asp:UpdatePanel runat="server" ID="UPPDatosUsado" UpdateMode="Conditional">
<ContentTemplate>
<div class="row">
<div class="col-md-4">
<label>Tipo Servicio:</label>
@@ -2964,15 +2961,10 @@
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</div>
<br />
<div class="row">
<div class="col-md-3">
<div class="form-group form-md-line-input input-iconright">
@@ -3138,7 +3130,7 @@
<div class="col-md-8">
<div id="DivCodEnsamble" runat="server" class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtCodEnsamble" CssClass="form-control" runat="server" MaxLength="50"></asp:TextBox>
<asp:CustomValidator ID="CVCodEnsamble" runat="server" ControlToValidate="TxtCodEnsamble" ClientValidationFunction="ValidarCodigoEnsamble" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cod.Ensamble''</b> es incorrecto, por favor ingréselo correctamente." ValidationGroup="GrpAddVenta" />
<asp:CustomValidator ID="CVCodEnsamble" runat="server" ControlToValidate="TxtCodEnsamble" ValidateEmptyText="true" ClientValidationFunction="ValidarCodigoEnsamble" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cod.Ensamble''</b> es incorrecto, por favor ingréselo correctamente." ValidationGroup="GrpAddVenta" />
<label for="<%= TxtCodEnsamble.ClientID.ToString()%>">Cod.Ensamble:</label>
</div>
</div>
@@ -3329,13 +3321,16 @@
}
function ValidaAnioVehiculo(val, args) {
//VALIDA SOLO SI SE SELECCIONO UN USADO
var cveUsado = ToDouble($get("C_DdlRecepcionUsados").value);
if (cveUsado > 0) {
var today = new Date();
var anioActual = today.getFullYear();
let CveClasificacion = HdnCveClasificacion.value;
const acumuladores = "20520, 20522, 20513, 20511, 20521, 20512, 20514, 20229";
if (acumuladores.includes(CveClasificacion)) {
var anio = ToDouble(args.Value);
if (anio > 0) {
var valido = true;
if (anio < 1900) {
if (anio <= 1900 || anio > anioActual) {
valido = false;
}
if (anio.toString().length != 4) {
@@ -3356,18 +3351,33 @@
//MARCA OPTIMA
if (CveMarca == "1086") {
//SI NO ES REQUERIDO, PONER COMO VALIDO
if (!arguments.Value) {
arguments.IsValid = true;
} else {
let regex = new RegExp("^[0-9]+$");
arguments.IsValid = regex.test(arguments.Value);
}
return;
//MARCA MOTOBATERIAS
} else if ((CveMarca == "1090" || CveMarca == "1091") || CveClasificacion == "20517") {
//EN MOTOBATERIAS ES REQUERIDO
if (!arguments.Value) {
arguments.IsValid = false;
} else {
let regex = new RegExp("^[A-L][0-9][0-9A-Z][A-Q][JAVY]$");
arguments.IsValid = regex.test(arguments.Value);
}
return;
//AUTOMOTRIZ-ACUMULADORES
} else {
//SI NO ES REQUERIDO, PONER COMO VALIDO
if (!arguments.Value) {
arguments.IsValid = true;
} else {
let regex = new RegExp("^[1X]|^[0-9][A-HJ-M][0-3][0-9][A-Z][ACEN][2-5]$");
arguments.IsValid = regex.test(arguments.Value);
}
return;
}
}
@@ -3745,8 +3755,7 @@
$("#LblSubTotal1").text($("#TxtSubTotal").val());
}
function AbrirModalDescuentoAdicional()
{
function AbrirModalDescuentoAdicional() {
$('#ModalDescuento').modal();
$get('LblTitulo1').style.display = '';
$get('LblTitulo2').style.display = 'none';

View File

@@ -4031,6 +4031,7 @@ Partial Class PV
HdnTipoInv.Value = drPS("Inv_CveMetodoInventario").ToString
HdnAplicaIEPS.Value = drPS("AplicaIEPS").ToString
HdnPorcentajeIEPS.Value = drPS("IEPSPorcentaje").ToString
HdnCveClasificacion.Value = drPS("CveClasificacion").ToString
'Muestra la tabla de tamaños
If drPS("CveTamaño").ToString().ToEntero() > 0 Then
DivRecepcionUsados.Visible = True
@@ -4736,6 +4737,7 @@ Partial Class PV
HdnCodigoPS.Value = "-1"
HdnTipoPS.Value = "-1"
HdnTipoInv.Value = "-1"
HdnCveClasificacion.Value = "-1"
DdlClasificacion.SelectedIndex = 0
If Not UsuarioActual.Empresa.Funcionalidad(141).ToString = "1" Then
@@ -5360,6 +5362,8 @@ Partial Class PV
Exit Sub
End If
End If
If DrPS IsNot Nothing Then
'SOLO DEBE AGREGAR POLIZA VIRTUAL SI ES ACUMULADOR
If DrPS("CveClasificacion").ToString().ToEntero().Contiene(20520, 20522, 20513, 20511, 20521, 20512, 20514, 20229) Then
@@ -5368,26 +5372,17 @@ Partial Class PV
Exit Sub
End If
If TxtAnioVehiculo.Text.ToDecimal() < 1900 Then
If TxtAnioVehiculo.Text.ToDecimal() <= 1900 Then
Alert("El campo año debe ser mayor a 1900.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
End If
End If
Else
If DrPS IsNot Nothing Then
'SOLO DEBE AGREGAR POLIZA VIRTUAL SI ES ACUMULADOR
If DrPS("CveClasificacion").ToString().ToEntero().Contiene(20520, 20522, 20513, 20511, 20521, 20512, 20514, 20229) Then
If Not String.IsNullOrEmpty(TxtAnioVehiculo.Text.Trim()) Then
If TxtAnioVehiculo.Text.ToDecimal() < 1900 Then
Alert("El año del vehiculo del vehículo no tiene el formato correcto.", TipoMensaje.MsgAdvertencia)
If TxtAnioVehiculo.Text.ToDecimal() > Now.Year Then
Alert("El campo año no puede ser mayor al año actual.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
End If
End If
End If
End If
If AgregarPS() Then
@@ -5448,9 +5443,14 @@ Partial Class PV
PU = ObjDescuento.PU
End If
Dim RowSP As DataRow = GlobalDTSubProyectos(-1, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero, CveEmpresa:=UsuarioActual.CveEmpresa).Rows(0)
Dim CveProyecto As Integer = -1 '
Dim Proyecto As String = ""
Dim CveProyecto As Integer = GlobalDTSubProyectos(-1, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero, CveEmpresa:=UsuarioActual.CveEmpresa).Rows(0)("CveProyecto").ToString.ToEntero
Dim Proyecto As String = GlobalDTSubProyectos(-1, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero, CveEmpresa:=UsuarioActual.CveEmpresa).Rows(0)("Proyecto").ToString
If RowSP IsNot Nothing Then
CveProyecto = RowSP("CveProyecto").ToString.ToEntero
Proyecto = RowSP("Proyecto").ToString
End If
Dim Consec = AgregarProductoServicio(Cantidad, DdlUnidadMedida.SelectedValue.ToEntero, DdlUnidadMedida.SelectedItem.Text, DdlClasificacion.SelectedValue.ToEntero, DdlClasificacion.SelectedItem.Text,
CvePS, "", TxtObsPS.Text.Trim, PU, ObjDescuento.ImporteDescuento,

View File

@@ -190,9 +190,21 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
var CveEstatus = respCancelacion.CveEstatus;
var ObjVentas = new ClsVentas();
if (ObjVentas.UpdateEstatusVenta(CveVenta, CveEstatus, UsuarioActual.CveEmpresa))
{
if (respCancelacion.CveEstatus == 20)
{
sb.Append("El estatus de la factura fue cambiado a 'Cancelación en proceso'.");
}
else if (respCancelacion.CveEstatus == 23)
{
sb.Append("La solicitud de cancelación no la aplicó el SAT, intente cancelar de nuevo.");
}
else
{
sb.Append("El estatus de la factura fue cambiado a 'Cancelada'.");
}
}
else
{
sb.Append("Ocurrió un error al cambiar el estatus de la factura.");
@@ -311,9 +323,20 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
CveEstatus = respCancelacion.CveEstatus;
var ObjVentas = new ClsVentas();
if (ObjVentas.UpdateEstatusVenta(CveVenta, CveEstatus, UsuarioActual.CveEmpresa))
{
if (respCancelacion.CveEstatus == 20)
{
sb.Append("El estatus de la factura fue cambiado a 'Cancelación en proceso'.");
}
else if (respCancelacion.CveEstatus == 23)
{
sb.Append("La solicitud de cancelación no la aplicó el SAT, intente cancelar de nuevo.");
}
else
{
sb.Append("El estatus de la factura fue cambiado a 'Cancelada'.");
}
}
else
{
sb.Append("Ocurrió un error al cambiar el estatus de la factura.");
@@ -480,10 +503,14 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
// e.Row.FCLinkButton("LnkValidarRefac").Visible = false;
//}
if (e.Row.DBCampo("CveEstatusFactura").ToString().ToEntero() == 23)
{
e.Row.FCLinkButton("LnkValidarRefac").Visible = false;
}
if (e.Row.DBCampo("PuedeRefacturar").ToString().ToEntero() == 0 && e.Row.DBCampo("CveEstatusFactura").ToString().ToEntero() == 23 && e.Row.DBCampo("CveVentaSustitucion").ToEntero() > 0)
{
e.Row.FCLinkButton("LnkCancelar").Visible = true;
//e.Row.FCLinkButton("LnkValidarRefac").Visible = false;
}
}
}

View File

@@ -1020,7 +1020,9 @@ Partial Class RepVentaDetalle
Dim RutaFormato = String.Format("{0}Formatos\RepVentaDetalle.rdlc", UsuarioActual.Empresa.Ruta)
Dim Archivo As New System.IO.FileInfo(RutaFormato)
Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
Dim logouri = String.Format("file://{0}", Imagen.FullName)
Dim dt As DataTable = DtVentas.FiltraParametros("(GPO IS NULL AND Cantidad IS NOT NULL) OR (GPO IS NOT NULL AND Cantidad IS NOT NULL)")
Dim params As New List(Of ReportParameter)

View File

@@ -493,7 +493,7 @@
<table>
<asp:CheckBox ID="ChkDireccionEnvio" runat="server" AutoPostBack="true" />
<span style="margin-left: 1px;">
<asp:DropDownList ID="DdlDireccionEnvio" runat="server" AutoPostBack="true" CssClass="form-control input-sm select2me" AppendDataBoundItems="true" DataTextField="SucursalClienteVentaDireccion" DataValueField="CveDireccionEnvio" Width="180px" Visible="false">
<asp:DropDownList ID="DdlDireccionEnvio" runat="server" AutoPostBack="true" CssClass="form-control input-sm select2me" AppendDataBoundItems="true" DataTextField="SucursalClienteVentaDireccion" DataValueField="CveDireccionEnvio" Width="180px" Visible="false" OnSelectedIndexChanged="DdlDireccionEnvio_SelectedIndexChanged">
<asp:ListItem Selected="true" Text="Seleccione" Value="-1"></asp:ListItem>
</asp:DropDownList>
</span>
@@ -2219,7 +2219,7 @@
<ContentTemplate>
<asp:UpdatePanel ID="UPComplementosSAT" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<table border="0" cellpadding="0" cellspacing="0" class="TextTab">
<table border="0" cellpadding="0" cellspacing="0" class="TextTab" style="width: 100%">
<tr valign="top">
<td rowspan="2" colspan="1">
<div class="portlet light xspadding bordered whitoutcol" style="width: 330px;">
@@ -2445,7 +2445,9 @@
</div>
</td>
<td rowspan="1" colspan="2">
<div class="portlet light xspadding bordered whitoutcol" style="width: 850px;">
<div class="row">
<div class="col-md-7">
<div class="portlet light xspadding bordered whitoutcol" style="width: 100%;">
<div class="portlet-title">
<div class="caption font-green">
<i class="icon-pin font-green"></i>
@@ -2614,6 +2616,127 @@
</asp:UpdatePanel>
</div>
</div>
</div>
<div class="col-md-5">
<div id="DivCartaPorte" runat="server" visible="false" class="portlet light xspadding bordered whitoutcol" style="width: 100%">
<div class="portlet-title">
<div class="caption font-green">
<i class="icon-pin font-green"></i>
<span class="caption-subject bold uppercase">CARTA PORTE</span>
</div>
<div class="actions">
<div class="btn-group">
</div>
</div>
<div class="tools">
<a href="javascript:;" class="collapse"></a>
</div>
</div>
<div class="portlet-body ">
<div class="rowpadding">
<asp:UpdatePanel ID="UpEmitirTransitorio" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="row rowpadding">
<label class="col-md-2">Emitir:</label>
<div class="col-md-10">
<asp:CheckBox ID="ChkEmitirCartaPorte" runat="server" CssClass="chksino" Text=" " />
</div>
</div>
<br />
<div class="row rowpadding">
<label class="col-md-2">Origen:</label>
<div class="col-md-10">
<asp:TextBox ID="TxtOrigenCP" runat="server" Enabled="false" Text="" CssClass="form-control input-sm"></asp:TextBox>
</div>
</div>
<br />
<div class="row rowpadding">
<label class="col-md-2">Destino:</label>
<div class="col-md-10">
<asp:TextBox ID="TxtDestinoCP" runat="server" Enabled="false" Text="" CssClass="form-control input-sm"></asp:TextBox>
</div>
</div>
<br />
<div class="row rowpadding">
<label class="col-md-2">Fecha Llegada:</label>
<div class="col-md-4">
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 117px !important; padding: 0px;">
<asp:TextBox ID="TxtFechaLlegadaCP" runat="server" CssClass="form-control" CausesValidation="true" MaxLength="10"></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="ImgFechaSalidaCP" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
<ajax:MaskedEditExtender ID="MEEFechaSalidaCP" runat="server" TargetControlID="TxtFechaLlegadaCP" Mask="99/99/9999" MaskType="Date" DisplayMoney="Right" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="CEFechaSalidaCP" TargetControlID="TxtFechaLlegadaCP" PopupButtonID="ImgFechaSalidaCP" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
</div>
</div>
<label class="col-md-2">Fecha Entrega:</label>
<div class="col-md-4">
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 117px !important; padding: 0px;">
<asp:TextBox ID="TxtFechaEntregaCP" runat="server" CssClass="form-control" CausesValidation="true" MaxLength="10"></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="ImgFechaEntregaCP" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
<ajax:MaskedEditExtender ID="MEEFechaEntregaCP" runat="server" TargetControlID="TxtFechaEntregaCP" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="CEFEchaEntregaCP" TargetControlID="TxtFechaEntregaCP" PopupButtonID="ImgFechaEntregaCP" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
</div>
</div>
</div>
<br />
<div class="row rowpadding">
<label class="col-md-2">Distancia:</label>
<div class="col-md-10">
<asp:TextBox ID="TxtDistancia" runat="server" CssClass="form-control input-sm" type="number"></asp:TextBox>
</div>
</div>
<br />
<div class="row rowpadding">
<label class="col-md-2">Chofer:</label>
<div class="col-md-10">
<asp:DropDownList ID="DdlChofer" runat="server" DataTextField="ChoferLicencia" DataValueField="CveChofer" CssClass="form-control input-sm select2me" Width="100%"></asp:DropDownList>
<asp:RequiredFieldValidator ID="RfvDdlChofer" runat="server" Enabled="false" ControlToValidate="DdlChofer" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Chofer''</b> es necesario, por favor seleccione uno." InitialValue="-1" ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VceDdlChofer" runat="server" HighlightCssClass="vco" TargetControlID="RfvDdlChofer" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
</div>
<br />
<div class="row rowpadding">
<label class="col-md-2">Unidad:</label>
<div class="col-md-10">
<asp:DropDownList runat="server" ID="DdlUnidadCamion" AutoPostBack="true" Width="100%" AppendDataBoundItems="true" CssClass="form-control input-sm select2me" DataValueField="CveCamion" DataTextField="CamionPlaca" OnSelectedIndexChanged="DdlUnidadCamionActivoFijo_SelectedIndexChanged"></asp:DropDownList>
<asp:RequiredFieldValidator ID="RfvDdlUnidadCamion" runat="server" Enabled="false" ControlToValidate="DdlUnidadCamion" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Unidad''</b> es necesario, por favor seleccione uno." InitialValue="-1" ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VceDdlUnidadCamion" runat="server" HighlightCssClass="vco" TargetControlID="RfvDdlUnidadCamion" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
</div>
<br />
<div class="row rowpadding" runat="server" id="DvConfiguracionVeiculo" visible="false">
<label class="col-md-2">Configuración:</label>
<div class="col-md-10">
<asp:DropDownList ID="DdlConfigAuto" CssClass="form-control input-sm select2me" Width="100%" runat="server" AppendDataBoundItems="true" AutoPostBack="true" OnSelectedIndexChanged="DdlConfigAuto_SelectedIndexChanged" CausesValidation="true" DataTextField="ClaveConfigAutoTransporteDescripcion" DataValueField="CveConfigAutoTransporte" Style="padding: 0px">
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RfvDdlConfigAuto" runat="server" Enabled="false" ControlToValidate="DdlConfigAuto" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Configuración Carta Porte''</b> es necesario, por favor seleccione uno." InitialValue="-1" ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCERfvDdlConfigAuto" runat="server" HighlightCssClass="vco" TargetControlID="RfvDdlConfigAuto" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
</div>
<div class="row rowpadding" runat="server" id="DvRemolque1" visible="false">
<label class="col-md-2">Remolque 1:</label>
<div class="col-md-10">
<asp:DropDownList runat="server" ID="DdlRemolque1" AutoPostBack="true" Width="100%" AppendDataBoundItems="true" CssClass="form-control input-sm select2me" DataValueField="CveCamion" DataTextField="CamionPlaca" OnSelectedIndexChanged="DdlRemolque1_SelectedIndexChanged"></asp:DropDownList>
</div>
</div>
<div class="row rowpadding" runat="server" id="DvRemolque2" visible="false">
<label class="col-md-2">Remolque 2:</label>
<div class="col-md-10">
<asp:DropDownList runat="server" ID="DdlRemolque2" AutoPostBack="true" Width="100%" CssClass="form-control input-sm select2me" DataValueField="CveCamion" DataTextField="CamionPlaca"></asp:DropDownList>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</div>
</div>
</div>
</td>
</tr>
<tr valign="top">
@@ -7890,6 +8013,20 @@
<ajax:ValidatorCalloutExtender ID="VCEImporteSolicitud" runat="server" HighlightCssClass="vco" TargetControlID="CVImporteSolcitud" Width="300px"></ajax:ValidatorCalloutExtender>
<label for="<%= TxtImporteSolicitud.ClientID.ToString()%>">Importe:</label>
</div>
<div id="DivMotivoAutorizacion" runat="server" visible="false" class="row">
<div class="col-md-12">
<div class="row">
<label class="col-md-3 truncate" style="color: #888888; font-family: 'Open Sans', sans-serif; direction: ltr; font-size: 12px;">Motivo:</label>
</div>
<div class="row">
<div class="col-md-12">
<asp:TextBox ID="TxtMotivoAutorizacion" CssClass="form-control input-sm" runat="server" Rows="2" TextMode="MultiLine" Width="100%" MaxLength="50"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVMotivo" runat="server" ControlToValidate="TxtMotivoAutorizacion" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Motivo''</b> es necesario, por favor ingréselo." ValidationGroup="VgmGuardarAut"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCEMotivo" runat="server" HighlightCssClass="vco" TargetControlID="RFVMotivo" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<asp:Button ID="BtnSolicitarCredito" runat="server" Text="Agregar" CssClass="btn btn-primary" ValidationGroup="VgmGuardarAut" />

View File

@@ -1356,6 +1356,15 @@ Partial Class Ventas
ViewState("ListaAnticiposAplicados") = value
End Set
End Property
Private Property CveTimbreCartaPorteVenta As Integer
Get
Return If(IsNothing(ViewState("CveTimbreCartaPorteVenta")), -1, ViewState("CveTimbreCartaPorteVenta").ToString().ToEntero())
End Get
Set(value As Integer)
ViewState("CveTimbreCartaPorteVenta") = value
End Set
End Property
#End Region
#Region "Propiedades PuntoVenta"
@@ -2272,6 +2281,9 @@ Partial Class Ventas
UpFacturar.Update()
'CargaTiposDocumentos()
TrEmitir.Visible = False
If UsuarioActual.CveRol = 1 Then
DivCartaPorte.Visible = True
End If
ViewState("EstablecioFolio") = False
'ViewState("SubProyectoPorcentajeIVA") = 0
RefacturacionGeneroNC = False
@@ -2448,7 +2460,7 @@ Partial Class Ventas
CargaCuentasTerminal()
CargaDdlNCPS()
CargarCamiones()
'SI USUARIO USA AMORTIZACIÓN CONTABLE, se carga las tablas para usarlas mas adelante
If UsuarioActual.Empresa.UsaAC Then
@@ -2643,6 +2655,9 @@ Partial Class Ventas
ObjInventario.Dispose()
End If
If DdlTipoComprobante.SelectedValue = "Ing" Then
CargaVentaCortePorte(Me.CveVenta)
End If
End If
Else
@@ -4888,6 +4903,7 @@ Partial Class Ventas
If DbRowVenta("CveDireccionEnvio").ToString().ToEntero() > 0 AndAlso DbRowVenta("CveDireccionEnvio").ToString() IsNot Nothing Then
ChkDireccionEnvio.Checked = True
DdlDireccionEnvio.SelectedValueExist(DbRowVenta("CveDireccionEnvio").ToString().ToEntero())
DdlDireccionEnvio_SelectedIndexChanged(DdlDireccionEnvio, EventArgs.Empty)
DdlDireccionEnvio.Enabled = False
ChkDireccionEnvio.Enabled = False
DdlDireccionEnvio.Visible = True
@@ -6014,6 +6030,7 @@ Partial Class Ventas
End If
End If
CargaDireccionCP()
ViewState("Vendedor") = ObjCliente.Vendedor
ViewState("CtaContable") = ObjCliente.CuentaContable
@@ -7088,6 +7105,8 @@ Partial Class Ventas
CargaVendedores()
CargaDireccionCP()
'SI LA VENTA YA ESTA REGISTRADA NO DEBE HABILITAR ACCIONES
If CveVenta <= 0 Then
LnkRemisiones.Visible = If(UsuarioActual.TienePermisoProceso(199), True, False) : LnkOCs.Visible = True : LnkCotizaciones.Visible = True : LnkPedido2SinFacturar.Visible = True : InicializaAplicarNCMasiva()
@@ -7099,6 +7118,7 @@ Partial Class Ventas
UpEstatus.Update()
UPCondicionesPago.Update()
UpCliente.Update()
UpEmitirTransitorio.Update()
End Sub
Private Function CargaCreditoDisponible(tCveCliente As Integer, tCveSucursalCliente As Integer, Optional ByRef ObjVentas As ClsVentas = Nothing) As Decimal
Dim Retorno As Decimal = 0
@@ -7594,7 +7614,7 @@ Partial Class Ventas
End If
'VERIFICA SI EL DESCUENTO SUPERA EL SUBTOTAL
If ObjDescuento.ImporteDescuento > (Cantidad * PU) Then
If ObjDescuento.ImporteDescuento.RoundSQL(2) > (Cantidad * PU).RoundSQL(2) Then
Alert("El descuento no puede ser mayor al subtotal", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
@@ -8158,6 +8178,17 @@ Partial Class Ventas
End If
End If
If ChkEmitirCartaPorte.Checked Then
If String.IsNullOrEmpty(TxtOrigenCP.Text.Trim()) Then
Alert("La carta porte no tiene un origen definido.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
If String.IsNullOrEmpty(TxtDestinoCP.Text.Trim()) Then
Alert("La carta porte no tiene un destino definido.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
End If
'CUANDO ES COTIZACION Y SE VA A FACTURAR SE HACE INGRESO
If DdlTipoComprobante.SelectedValue = "Cot" AndAlso BtnEmitirImprimir.Text = "Facturar" Then
DdlTipoComprobante.SelectedValue = "Ing"
@@ -8300,6 +8331,7 @@ Partial Class Ventas
End If
End If
'SI NO TIENE AUTORIZACION VERIFICAR LIMITE DE CREDITO Y CANDADOS DE VENTA
'No exceder el limite de credito, Si no tiene contrato limita el credito, si tiene no hace nada. Si no tiene remisiones tampoco hace nada.
If Me.CveAutorizacion <= 0 AndAlso (Not CveContrato > 0 Or CveContratoTipo.Contiene(28)) AndAlso (Not NuevaFactura = 1) AndAlso RBLPago.SelectedValue = "1" AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Ant") AndAlso RemisionesLista.Count <= 0 AndAlso TxtTotal.Text.ToDecimal > 0 AndAlso Not CvePedidoA > 0 Then
'If UsuarioActual.Empresa.Funcionalidad(518) = "1" AndAlso Not UsuarioActual.TienePermisoProceso(185) Then
@@ -8335,6 +8367,20 @@ Partial Class Ventas
Exit Sub
End If
ObjVentas.Dispose()
'VERIFICA SI TIENE BLOQUEO POR DIAS VENCIDOS
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
Dim Vta As New ClsVentas
Dim Opcion As Integer = Vta.ObtenerClienteLimitesVenta(CveCliente, UsuarioActual.CveEmpresa, TipoVerificacion:=2)
Dim OpcionMsg As String = String.Format("El Cliente se encuentra bloqueado por la siguiente razón: <br> <br> {0}", Vta.SerieVenta)
Vta.Dispose()
If Opcion = 2 Then
Alert(OpcionMsg, TipoMensaje.MsgError)
Exit Sub
End If
End If
End If
'End If
@@ -8778,9 +8824,18 @@ Partial Class Ventas
Dim CveVentaAnterior As Integer = Me.CveVenta
Dim CveTimbreCartaPorte As Integer = -1
GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjContr, ObjFactura, TmpDT, ObjFactura.CveNCaVincular, ObjContPaq, ObjBancos, ObjOS,
ObjEventos, ObjCGame, ObjClientes, EsNCAmortizacion:=EsNCAmortizacion, CveAnticipoPadre:=CveAnticipoPadre)
If ErrorList.Count = 0 AndAlso ChkEmitirCartaPorte.Checked AndAlso ObjFactura.TipoDocto = "Ing" Then
CveTimbreCartaPorte = GuardarCartaPorte(ObjFactura, ObjGeneral, ObjClientes)
If CveTimbreCartaPorte <= 0 Then
ErrorList.Add("Ocurrió un error al registrar la carta porte")
End If
End If
'Agregamos las OCs a la tabla
If ObjFactura.CveVenta > 0 AndAlso ErrorList.Count = 0 AndAlso DTOrdenesCompraPS IsNot Nothing AndAlso DTOrdenesCompraPS.Rows.Count > 0 AndAlso ErrorList.Count = 0 Then
Dim CveVentaDetalle As Integer = 0
@@ -9162,14 +9217,27 @@ Partial Class Ventas
PrepararTimbrado(FM, TmpDT7Eleven, TmpDTComplementosTimbrado)
End If
If ChkEmitirCartaPorte.Checked AndAlso CveTimbreCartaPorte > 0 Then
Dim RespCartaPorte = Timbres.PreParaCartaPorteFactura(CveTimbreCartaPorte, ObjFactura, UsuarioActual)
If Not RespCartaPorte.TieneError Then
ObjFactura.Timbre.Complementos.CartaPorte = RespCartaPorte.CartaPorte
Else
DebeTimbrar = False
Alert(RespCartaPorte.Mensaje, TipoMensaje.MsgAdvertencia)
End If
End If
Dim ObjTimbrado As New Timbrado
If DebeTimbrar Then
SeTimbro = ObjTimbrado.TimbrarFactura(UsuarioActual, ObjFactura)
End If
Dim FolioFiscalFactura As String = ObjTimbrado.UUID
Dim MsgErrorTimbrado = ObjTimbrado.MensajeErrorCFDI
ObjTimbrado = Nothing
'NOTA DE CREDITO - REFACTURADA - CASO ESPECIAL, TIMBRADO E IMPRESION
If DebeTimbrar AndAlso ListaNotasCreditoGeneradas.Count > 0 Then
If DebeTimbrar AndAlso SeTimbro AndAlso ListaNotasCreditoGeneradas.Count > 0 Then
Try
For Each NCGenerada In ListaNotasCreditoGeneradas
If NCGenerada.Timbre IsNot Nothing Then
@@ -12040,6 +12108,8 @@ Partial Class Ventas
End If
End If
'SI ES REFACTURACION, NO DEBE AFECTAR LOS USADOS
If Not NuevaFactura.Contiene(1) Then
If ObjFactura.TipoDocto = "Ing" Then
If Not GuardarUsados(2, ObjVentas.IniciaTransacSQL, factura) Then
ErrorList.Add("Error al guardar usados")
@@ -12049,6 +12119,8 @@ Partial Class Ventas
ErrorList.Add("Error al guardar usados")
End If
End If
End If
If factura.TipoDocto = "Egs" AndAlso NuevaFactura = 1 Then
If DtVentasNC Is Nothing Then
@@ -12372,7 +12444,7 @@ Partial Class Ventas
'INVENTARIOS
If ErrorList.Count = 0 Then
If Not EsNCAmortizacion AndAlso Not NCDescuento Then
If GuardarVentaInventarios(ObjInventario, ObjVentas, ObjConta, factura) Then
If GuardarVentaInventarios(ObjInventario, ObjVentas, ObjConta, factura, TmpDTDetalle) Then
ErrorList.Add("Ocurrio un error al Guardar Inventario")
End If
End If
@@ -14026,7 +14098,7 @@ Partial Class Ventas
End Try
End Function
Private Function GuardarVentaInventarios(ObjInventario As ClsInventarios, ObjVentas As ClsVentas, ObjConta As ClsContabilidad, factura As Modelos.Factura) As Boolean
Private Function GuardarVentaInventarios(ObjInventario As ClsInventarios, ObjVentas As ClsVentas, ObjConta As ClsContabilidad, factura As Modelos.Factura, TmpDTDetalle As DataTable) As Boolean
Dim OcurrioError As Boolean = False
Try
@@ -14035,7 +14107,7 @@ Partial Class Ventas
If RemisionesLista.Count > 0 AndAlso factura.TipoDocto.Contiene("Ing", "Rem") Then
For Each CveRemision As Integer In RemisionesLista
'El almacen general es el Primer Almacen de Material en la Sucursal
If Not TraspasoAlmacen(ObjInventario, ObjVentas, CveRemision, ObjConta, True, 9) Then
If Not TraspasoAlmacen(ObjInventario, ObjVentas, CveRemision, ObjConta, True, 9, TmpDTDetalle) Then
OcurrioError = True
ErrorList.Add("Ocurrió un error al verificar inventario de remisiones.<br />Revise su factura y cualquier detalle comuníquese a Soporte Técnico")
Exit For
@@ -16004,6 +16076,14 @@ Partial Class Ventas
Dim TmpDTComplementosTimbrado As New DataTable
PrepararTimbrado(FM, TmpDT7Eleven, TmpDTComplementosTimbrado)
Dim RespCartaPorte = Timbres.PreParaCartaPorteFactura(CveTimbreCartaPorteVenta, ObjFactura, UsuarioActual)
If Not RespCartaPorte.TieneError Then
ObjFactura.Timbre.Complementos.CartaPorte = RespCartaPorte.CartaPorte
Else
Exit Sub
Alert(RespCartaPorte.Mensaje, TipoMensaje.MsgAdvertencia)
End If
If ObjTimbrado.TimbrarFactura(UsuarioActual, ObjFactura) Then
'MENSAJE PRINCIPAL
@@ -17092,6 +17172,7 @@ Partial Class Ventas
CargaVendedores()
UpDetalle.Update()
UpEmitirTransitorio.Update()
End Sub
Private Sub CambiaSucursal(Optional RecargarPartidas As Boolean = True)
CargaFormatoSucursal()
@@ -17103,6 +17184,8 @@ Partial Class Ventas
RecargaSucursalPartidas()
End If
CargaDireccionSucursalOrigen(GlobalDTSubProyectos(-1, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero(), CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero(""))
DdlPS.Attributes.Remove("data-cvesubproyecto")
DdlPS.Attributes.Add("data-cvesubproyecto", DdlSubProyectoDatos.SelectedValue)
@@ -19579,7 +19662,7 @@ Partial Class Ventas
gvr.FCDropDownList("DdlUnidadMedida").DataBind()
End Sub
Private Function TraspasoAlmacen(ByRef ObjInventario As ClsInventarios, ByRef ObjVentas As ClsVentas, CveRemision As Integer, ByRef ObjConta As ClsContabilidad, ConSalida As Boolean, ConceptoMovimiento As Integer) As Boolean
Private Function TraspasoAlmacen(ByRef ObjInventario As ClsInventarios, ByRef ObjVentas As ClsVentas, CveRemision As Integer, ByRef ObjConta As ClsContabilidad, ConSalida As Boolean, ConceptoMovimiento As Integer, TmpDTDetalle As DataTable) As Boolean
Dim OcurrioError As Boolean = False
Try
Dim DtMovimientos As DataTable
@@ -19715,7 +19798,7 @@ Partial Class Ventas
End If
If Not OcurrioError AndAlso UsuarioActual.Empresa.Funcionalidad(573) = "1" Then
OcurrioError = Not GenerarMovimientoAlmacenVirtual(CveMovimientoSalidaAlmacen, CveAlmacenParaSalida, ObjInventario, ObjConta:=ObjConta)
OcurrioError = Not GenerarMovimientoAlmacenVirtual(TmpDTDetalle, CveMovimientoSalidaAlmacen, CveAlmacenParaSalida, ObjInventario, ObjConta:=ObjConta)
End If
End If
@@ -20131,7 +20214,7 @@ Partial Class Ventas
Return Not OcurrioError
End Function
Private Function GenerarMovimientoAlmacenVirtual(CveMovimientoSalidaAlmacen As Integer, CveAlmacen As Integer, ByRef ObjInventario As ClsInventarios, Optional ByRef ObjConta As ClsContabilidad = Nothing) As Boolean
Private Function GenerarMovimientoAlmacenVirtual(TmpDTDetalle As DataTable, CveMovimientoSalidaAlmacen As Integer, CveAlmacen As Integer, ByRef ObjInventario As ClsInventarios, Optional ByRef ObjConta As ClsContabilidad = Nothing) As Boolean
Dim OcurrioError As Boolean = False
Try
@@ -20162,7 +20245,13 @@ Partial Class Ventas
Dim PU As Decimal = RowUsado("Cargo").ToString().ToDecimal()
Dim CveUM As Integer = RowUsado("CveUM").ToString().ToEntero()
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoVirtual, CantidadUsado, CveUM, CvePS, PU, -1) Then
Dim CveVentaDetalle As Integer = -1
'RELACIONA LA VENTA DETALLA DE LA REMISION
If TmpDTDetalle IsNot Nothing Then
CveVentaDetalle = TmpDTDetalle.FiltroPrimeroValor("CveVentaDetalle", $"Cantidad = {RowUsado("Cantidad")} AND CvePS = {RowUsado("CvePS")}").ToEntero()
End If
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoVirtual, CantidadUsado, CveUM, CvePS, PU, -1, CveVentaDetalle:=CveVentaDetalle) Then
OcurrioError = True
Exit For
End If
@@ -21054,6 +21143,10 @@ Partial Class Ventas
TxtCodigo.ReadOnly = False
End If
If CantidadFacturadaRemision = 0 AndAlso UsuarioActual.TienePermisoProceso(161) Then
DdlVendedor.Enabled = True
End If
TxtCantidad.Enabled = True
DdlClasificacion.Enabled = True
DdlPS.Enabled = True
@@ -21067,6 +21160,8 @@ Partial Class Ventas
LblSubTotal1.Text = TxtSubTotal.Text
LblAmort.Text = TxtSubTotal.Text
LimpiaEscondeContado()
UPPVentas.Update()
UpPS.Update()
UpCliente.Update()
UPObservaciones.Update()
@@ -21164,7 +21259,7 @@ Partial Class Ventas
Vigencia:=TxtFechaVencimientoCotizacion.Text.Trim.ToDate, CondicionesPago:=If(RBLPago.SelectedValue = "2", 0, 1),
PedidoContrato:=TxtPedidoContrato.Text, AtencionA:=TxtAtencionA.Text.Trim, CveMetodoPago33:=DdlMetodoPago33.SelectedValue.ToEntero(),
CveFormaPago33:=DdlFormaPago33.SelectedValue.ToEntero(), TipoDocto:="Rem", CveCliente:=CveCliente, CveClienteSucursal:=CveClienteSucursal,
OrdenCompra:=TxtOrdenCompra.Text, RetIVA:=TxtRetIVA.Text.ToDecimal, RetISR:=TxtRetISR.Text.ToDecimal, Kilometraje:=TxtKilometraje.Text.ToDouble, CveUsoCFDi:=DdlUsoCFDI.SelectedValue.ToEntero()) Then
OrdenCompra:=TxtOrdenCompra.Text, RetIVA:=TxtRetIVA.Text.ToDecimal, RetISR:=TxtRetISR.Text.ToDecimal, Kilometraje:=TxtKilometraje.Text.ToDouble, CveUsoCFDi:=DdlUsoCFDI.SelectedValue.ToEntero(), CveVendedor:=DdlVendedor.SelectedValue.ToEntero()) Then
OcurrioError = True
End If
@@ -21616,7 +21711,7 @@ Partial Class Ventas
LimpiaProntoPago()
'NO PERMITE EDITAR FECHA DEL PAGO
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso Not UsuarioActual.TienePermisoProceso(260) Then
TxtFechaPago.Enabled = False
imgCalendario.Visible = False
End If
@@ -22468,11 +22563,6 @@ Partial Class Ventas
#Region " DEVOLUCION ALMACEN "
Private Sub InicializaDevolucionAlmacen()
If CveVenta.Contiene(2035312, 2035310, 2039679) Then
LBAplicaDevolucion.Visible = True
End If
If Not GvInv.Rows.Count > 0 Then
Exit Sub
End If
@@ -22570,9 +22660,15 @@ Partial Class Ventas
If ChkDireccionEnvio.Checked Then
DdlDireccionEnvio.Visible = True
LnkOtraDireccion.Visible = True
DdlDireccionEnvio_SelectedIndexChanged(DdlDireccionEnvio, EventArgs.Empty)
Else
DdlDireccionEnvio.Visible = False
LnkOtraDireccion.Visible = False
If SucursalDestinoCP IsNot Nothing Then
SucursalDestinoCP = Nothing
SucursalDestinoCP = New Modelos.SucursalModel
TxtDestinoCP.Text = ""
End If
End If
End Sub
Private Sub BtnAgregarDireccion_Click(sender As Object, e As EventArgs) Handles BtnAgregarDireccion.Click
@@ -22611,6 +22707,7 @@ Partial Class Ventas
TxtEnvioTel.Text = ""
CargaDireccionesEnvio()
DdlDireccionEnvio.SelectedValueExist(CveDireccionEnvio)
DdlDireccionEnvio_SelectedIndexChanged(DdlDireccionEnvio, EventArgs.Empty)
End If
ObjClientes.Dispose()
@@ -23838,6 +23935,10 @@ Partial Class Ventas
ObjFacturaCancelacion.CveAlmacenDevolucion = CveAlmacenDevolucion
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso ObjFacturaCancelacion.TipoDocto = "Rem" Then
ChkDevAlm.Checked = True
End If
resp = ObjFacturaCancelacion.CancelarFactura(ChkDevAlm.Checked, ListaRemisionesCancelar, CveMotivoCancelacion:=DdlMotivoCancelacion.SelectedValue.ToEntero(), Motivo:=TxtMotivoCancelacion.Text.Trim(), CveEstadoCancelacion:=Me.CveEstadoCancelacion)
End If
@@ -33748,8 +33849,10 @@ Partial Class Ventas
DiasVencidos = TxtDiasVencidos.Text.ToEntero()
End If
Dim Motivo As String = TxtMotivoAutorizacion.Text
Dim ObjPS As New ClsVentas
If ObjPS.AddAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, DdlVendedor.SelectedValue.ToEntero(), TxtImporteSolicitud.Text.ToDecimal(), CveEstatus, UsuarioActual.CveUsuario, CveTipoAutorizacion, TipoDocumento:=DdlTipoDocto.SelectedValue, DiasVencidos:=DiasVencidos) Then
If ObjPS.AddAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, DdlVendedor.SelectedValue.ToEntero(), TxtImporteSolicitud.Text.ToDecimal(), CveEstatus, UsuarioActual.CveUsuario, CveTipoAutorizacion, TipoDocumento:=DdlTipoDocto.SelectedValue, DiasVencidos:=DiasVencidos, Motivo:=Motivo) Then
RegistraScript("$('#DivModalSolicitarCredito').modal('hide')")
Alert("La autorización se agregó correctamente.", TipoMensaje.MsgInformacion)
End If
@@ -33780,10 +33883,12 @@ Partial Class Ventas
Case "Ing"
If DdlTipoAutorizacion.Items.FindByValue("2") Is Nothing Then
DdlTipoAutorizacion.Items.Insert(0, New ListItem("Vencimiento", "2"))
DivMotivoAutorizacion.Visible = True
End If
Case "Egs"
'QUITAR LA DE VENCIMIENTO
DdlTipoAutorizacion.Items.Remove(DdlTipoAutorizacion.Items.FindByValue("2"))
DivMotivoAutorizacion.Visible = True
End Select
UpModalSolicitud.Update()
End Sub
@@ -33840,19 +33945,398 @@ Partial Class Ventas
End Sub
Protected Sub RdTipoPersona_SelectedIndexChanged(sender As Object, e As EventArgs)
#Region "C A R T A - P O R T E"
DVRegimenSociedad.Visible = False
DivRazonSocial2.Attributes.Add("class", "col-md-12")
Public Sub CargaDireccionCP()
LblDireccion.Text = "Dirección"
LblColonia.Text = "Colonia"
LblCiudad.Text = "Ciudad"
LblEstado.Text = "Estado"
LblCP.Text = "00000"
End Sub
If RdTipoPersona.SelectedValue.ToEntero = 1 And UsuarioActual.Empresa.Funcionalidad(350) = "1" Then
Public Sub CargarCamiones()
DivRazonSocial2.Attributes.Add("class", "col-md-8")
DVRegimenSociedad.Visible = True
TxtFechaEntregaCP.Text = Now.ToString("dd/MM/yyyy")
TxtFechaLlegadaCP.Text = Now.ToString("dd/MM/yyyy")
DdlConfigAuto.Items.Clear()
DdlUnidadCamion.Items.Clear()
DdlChofer.Items.Clear()
DdlChofer.DataSource = GlobalDTChoferes(UsuarioActual.CveEmpresa)
DdlChofer.DataBind()
DdlChofer.Items.Insert(0, New ListItem("Seleccione Uno", "-1"))
Using ObjInv As New ClsInventarios
If ObjInv.GetCamiones(-1, UsuarioActual.CveEmpresa, 1) Then
DdlUnidadCamion.DataSource = ObjInv.DtResultados
End If
UpAgregarCliente.Update()
If ObjInv.GetCamiones(-1, UsuarioActual.CveEmpresa, 2) Then
DdlRemolque1.DataSource = ObjInv.DtResultados
End If
End Using
DdlUnidadCamion.DataBind()
DdlUnidadCamion.Items.Insert(0, New ListItem("Seleccione Uno", "-1"))
DdlRemolque1.DataBind()
DdlRemolque1.Items.Insert(0, New ListItem("Seleccione Uno", "-1"))
Using ObjGrales As New ClsGenerales
If ObjGrales.GetCartaPorteConfigAutoTransportes() Then
DdlConfigAuto.DataSource = ObjGrales.DtResultados
End If
End Using
DdlConfigAuto.DataBind()
DdlConfigAuto.Items.Insert(0, New ListItem("Seleccione una", "-1"))
UpEmitirTransitorio.Update()
End Sub
Protected Sub DdlUnidadCamionActivoFijo_SelectedIndexChanged(sender As Object, e As EventArgs)
ChkEmitirCartaPorte.Checked = True
DvRemolque1.Visible = False
DvRemolque2.Visible = False
DdlRemolque1.SelectedValueExist(-1)
DdlRemolque2.SelectedValueExist(-1)
If DdlUnidadCamion.SelectedValue.ToEntero > 0 Then
Using ObjInv As New ClsInventarios
If ObjInv.GetCamiones(DdlUnidadCamion.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, 1) Then
DdlConfigAuto.SelectedValueExist(ObjInv.DtResultados.FiltroPrimeroValor("CveConfigAutoTransporte"))
DdlConfigAuto_SelectedIndexChanged(Nothing, Nothing)
End If
End Using
End If
UpEmitirTransitorio.Update()
End Sub
Protected Sub DdlConfigAuto_SelectedIndexChanged(sender As Object, e As EventArgs)
ValidaConfiguracionVeiculo()
End Sub
Public Sub CargaVentaCortePorte(CveVenta As Integer)
TxtFechaEntregaCP.Enabled = False
TxtFechaLlegadaCP.Enabled = False
Using ObjGral As New ClsGenerales
If ObjGral.GetGralTimbre(-1, "Man", MinFecha, MaxFecha, 0, UsuarioActual.CveEmpresa, -1, CveVenta:=CveVenta) AndAlso ObjGral.DtResultados.Rows.Count > 0 Then
Dim RowCP As DataRow = ObjGral.DtResultados.Rows(0)
Me.CveTimbreCartaPorteVenta = RowCP("CveTimbre").ToString().ToEntero()
If CveTimbreCartaPorteVenta > 0 Then
ChkEmitirCartaPorte.Checked = True
ChkEmitirCartaPorte.Enabled = False
End If
TxtFechaEntregaCP.Text = RowCP("FechaEntrega").ToString()
TxtFechaLlegadaCP.Text = RowCP("FechaLlegada").ToString()
TxtDistancia.Text = RowCP("Distancia").ToString()
DdlChofer.SelectedValueExist(RowCP("CveChofer").ToString())
DdlUnidadCamion.SelectedValueExist(RowCP("CveCamion").ToString())
End If
End Using
DdlChofer.Enabled = False
DdlUnidadCamion.Enabled = False
End Sub
Private Sub ValidaConfiguracionVeiculo()
DvRemolque1.Visible = False
DvRemolque2.Visible = False
DdlRemolque1.SelectedValueExist(-1)
DdlRemolque2.SelectedValueExist(-1)
If DdlConfigAuto.SelectedValue.ToEntero > 0 Then
Using ObjGrales As New ClsGenerales
If ObjGrales.GetCartaPorteConfigAutoTransportes() Then
Dim Remolque As String = ObjGrales.DtResultados.FiltroPrimeroValor("Remolque", $" CveConfigAutoTransporte ='{DdlConfigAuto.SelectedValue}'")
If Remolque = "1" Then
RequiereRemolque = True
MostrarRemolques = True
End If
If Remolque = "0, 1" Then
RequiereRemolque = False
MostrarRemolques = True
End If
If Remolque = "0" Then
RequiereRemolque = False
MostrarRemolques = False
End If
End If
End Using
Else
RequiereRemolque = False
MostrarRemolques = False
End If
If RequiereRemolque Or MostrarRemolques Then
DvRemolque1.Visible = True
End If
If Not RequiereRemolque Then
DvConfiguracionVeiculo.Visible = False
Else
DvConfiguracionVeiculo.Visible = True
End If
UpEmitirTransitorio.Update()
End Sub
Protected Sub DdlRemolque1_SelectedIndexChanged(sender As Object, e As EventArgs)
DdlRemolque2.Items.Clear()
If DdlRemolque1.SelectedValue.ToEntero > 0 Then
DvRemolque2.Visible = True
Using ObjInv As New ClsInventarios
If ObjInv.GetCamiones(-1, UsuarioActual.CveEmpresa, 2) Then
DdlRemolque2.DataSource = ObjInv.DtResultados.FiltraParametros($"CveCamion <> {DdlRemolque1.SelectedValue.ToEntero}")
End If
End Using
DdlRemolque2.DataBind()
Else
DvRemolque2.Visible = False
End If
DdlRemolque2.Items.Insert(0, New ListItem("Seleccione uno", "-1"))
UpEmitirTransitorio.Update()
End Sub
Private Function GuardarCartaPorte(ByRef ObjFactura As Modelos.Factura, ByRef ObjGral As ClsGenerales, ByRef ObjClientes As ClsClientes) As Integer
Dim ErrorProceso As Boolean = False
Dim CveTimbre As Integer = -1
Try
Dim CveDireccionOrigen As Integer = -1
Dim CveDireccionDestino As Integer = -1
If SucursalOrigenCP IsNot Nothing Then
CveDireccionOrigen = 0 'ObjClientes.DireccionEnvioAdd(-1, SucursalOrigenCP.Direccion, SucursalOrigenCP.NoExt, SucursalOrigenCP.NoInt, SucursalOrigenCP.Colonia, SucursalOrigenCP.Municipio, SucursalOrigenCP.Estado, SucursalOrigenCP.CP.ToEntero(), "", UsuarioActual.CveUsuario, 1, -1, "", CveEstado:=SucursalOrigenCP.CveEstado, CvePais:=SucursalOrigenCP.CvePais, CveEmpresa:=UsuarioActual.CveEmpresa)
End If
If SucursalDestinoCP IsNot Nothing Then
CveDireccionDestino = 0 'ObjClientes.DireccionEnvioAdd(-1, SucursalDestinoCP.Direccion, SucursalDestinoCP.NoExt, SucursalDestinoCP.NoInt, SucursalDestinoCP.Colonia, SucursalDestinoCP.Municipio, SucursalDestinoCP.Estado, SucursalDestinoCP.CP.ToEntero(), "", UsuarioActual.CveUsuario, 1, -1, "", CveEstado:=SucursalDestinoCP.CveEstado, CvePais:=SucursalDestinoCP.CvePais, CveEmpresa:=UsuarioActual.CveEmpresa)
End If
If Not (CveDireccionOrigen > 0 And CveDireccionDestino > 0) Then
ErrorProceso = True
Return -1
End If
Dim Fechallegada As DateTime = TxtFechaLlegadaCP.Text.ToDateTime()
Dim FechaEntrega As DateTime = TxtFechaEntregaCP.Text.ToDateTime()
Dim Distancia As Integer = TxtDistancia.Text.ToEntero()
Dim CveEntregaAlmacen As Integer = ObjGral.AddInvEntregaAlmacenRuta(DdlSubProyectoDatos.SelectedValue.ToEntero, CveDireccionOrigen, CveDireccionDestino, -1, DdlChofer.SelectedValue.ToEntero, DdlUnidadCamion.SelectedValue.ToEntero, FechaEntrega, Fechallegada, "T", "-1", "-1", Fechallegada, 1, 1, Distancia,
CveConfigAutoTransporte:=DdlConfigAuto.SelectedValue.ToEntero, CveCamionRemolque1:=DdlRemolque1.SelectedValue.ToEntero, CveCamionRemolque2:=DdlRemolque2.SelectedValue.ToEntero)
If CveEntregaAlmacen > 0 Then
For Each RowPS As DataRow In ObjFactura.DtDetalle.FiltraParametros("CveTipoPS = 2").Rows
If Not ObjGral.AddEntregaAlmacenRutaDetalle(CveEntregaAlmacen, RowPS("CvePS").ToString().ToEntero, RowPS("Cantidad").ToString().ToEntero, RowPS("CveUM").ToString().ToEntero, UsuarioActual.CveUsuario) Then
ErrorProceso = True
Exit For
End If
Next
CveTimbre = ObjGral.AddGralTimbre("Man", DdlSubProyectoDatos.SelectedValue.ToEntero, TxtFecha.Text.ToDate, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveEntregaAlmacen:=CveEntregaAlmacen, AplicaCP:=True, CveVenta:=ObjFactura.CveVenta)
If Not CveTimbre > 0 Then
ErrorProceso = True
End If
Else
ErrorProceso = True
End If
Catch ex As Exception
ErrorProceso = True
OnError("Ocurrió un error al guardar los datos de la carta porte", ex)
End Try
If Not ErrorProceso Then
Return CveTimbre
Else
Return -1
End If
End Function
Property RequiereRemolque As Boolean
Get
If ViewState("RequiereRemolque") Is Nothing Then
ViewState("RequiereRemolque") = False
End If
Return Boolean.Parse(ViewState("RequiereRemolque").ToString)
End Get
Set(value As Boolean)
ViewState("RequiereRemolque") = value
End Set
End Property
Property MostrarRemolques As Boolean
Get
If ViewState("MostrarRemolques") Is Nothing Then
ViewState("MostrarRemolques") = False
End If
Return Boolean.Parse(ViewState("MostrarRemolques").ToString)
End Get
Set(value As Boolean)
ViewState("MostrarRemolques") = value
End Set
End Property
Property SucursalOrigenCP As Modelos.SucursalModel
Get
If ViewState("SucursalOrigenCP") Is Nothing Then
Return Nothing
End If
Return DirectCast(ViewState("SucursalOrigenCP"), Modelos.SucursalModel)
End Get
Set(value As Modelos.SucursalModel)
ViewState("SucursalOrigenCP") = value
End Set
End Property
Property SucursalDestinoCP As Modelos.SucursalModel
Get
If ViewState("SucursalDestinoCP") Is Nothing Then
Return Nothing
End If
Return DirectCast(ViewState("SucursalDestinoCP"), Modelos.SucursalModel)
End Get
Set(value As Modelos.SucursalModel)
ViewState("SucursalDestinoCP") = value
End Set
End Property
Private Sub CargaDireccionSucursalOrigen(Row As DataRow)
If SucursalOrigenCP Is Nothing Then
SucursalOrigenCP = New Modelos.SucursalModel
Else
SucursalOrigenCP = Nothing
SucursalOrigenCP = New Modelos.SucursalModel
End If
Dim SBDomicilioSucursal As New StringBuilder()
Try
If Row IsNot Nothing Then
SucursalOrigenCP.Direccion = Row("Calle").ToString()
SucursalOrigenCP.NoExt = Row("NoExt").ToString()
SucursalOrigenCP.NoInt = Row("NoInt").ToString()
SucursalOrigenCP.Colonia = Row("Colonia").ToString()
SucursalOrigenCP.CP = Row("CP").ToString()
SucursalOrigenCP.Municipio = Row("Municipio").ToString()
'SucursalOrigenCP.CveEstado = Row("CveEstado").ToString().ToEntero()
SucursalOrigenCP.Estado = Row("Estado").ToString()
'SucursalOrigenCP.CvePais = Row("CvePais").ToString().ToEntero()
SucursalOrigenCP.Pais = Row("Pais").ToString()
SBDomicilioSucursal.AppendFormat("{0}", Row("Calle").ToString())
If Row("NoInt").ToString().Length > 0 Then
SBDomicilioSucursal.AppendFormat(", No.Int: {0}", Row("NoInt").ToString())
End If
If Row("Colonia").ToString().Length > 0 Then
SBDomicilioSucursal.AppendFormat(", Col: {0}", Row("Colonia").ToString())
End If
If Row("CP").ToString().ToEntero > 0 Then
SBDomicilioSucursal.AppendFormat(", CP: {0}", Row("CP").ToString())
End If
If Row("NoExt").ToString().Length > 0 Then
SBDomicilioSucursal.AppendFormat(" No.Ext: {0}", Row("NoExt").ToString())
End If
Dim CiudadSucursal As String = String.Format("{0},{1}", Row("Municipio").ToString(), Row("Estado").ToString())
If CiudadSucursal.Length > 0 Then
SBDomicilioSucursal.AppendFormat(", {0}", CiudadSucursal)
End If
If Row("Pais").ToString().Length > 0 Then
SBDomicilioSucursal.AppendFormat(", {0}", Row("Pais").ToString())
End If
If Not String.IsNullOrEmpty(Row("Telefono").ToString()) Then
SucursalOrigenCP.TelefonoSucursal = Row("Telefono").ToString()
End If
End If
Catch ex As Exception
SBDomicilioSucursal.Clear()
GuardaLog(ex.ToString())
End Try
TxtOrigenCP.Text = SBDomicilioSucursal.ToString
UpEmitirTransitorio.Update()
End Sub
Protected Sub DdlDireccionEnvio_SelectedIndexChanged(sender As Object, e As EventArgs)
If SucursalDestinoCP Is Nothing Then
SucursalDestinoCP = New Modelos.SucursalModel
Else
SucursalDestinoCP = Nothing
SucursalDestinoCP = New Modelos.SucursalModel
End If
If TmpDTEnvioDireccion IsNot Nothing AndAlso TmpDTEnvioDireccion.FiltraParametros(String.Format("CveDireccionEnvio = {0}", DdlDireccionEnvio.SelectedValue.ToEntero())).Rows.Count > 0 Then
Dim Row As DataRow = TmpDTEnvioDireccion.FiltroPrimero(String.Format("CveDireccionEnvio = {0}", DdlDireccionEnvio.SelectedValue.ToEntero()))
If Row IsNot Nothing Then
SucursalDestinoCP.Direccion = Row("EnvioDireccion").ToString()
SucursalDestinoCP.Colonia = Row("EnvioColonia").ToString()
SucursalDestinoCP.Municipio = Row("EnvioCiudad").ToString()
'SucursalDestinoCP.CveEstado = Row("CveEstado").ToString().ToEntero()
SucursalDestinoCP.Estado = Row("EnvioEstado").ToString()
'SucursalDestinoCP.CvePais = Row("CvePais").ToString().ToEntero()
SucursalDestinoCP.Pais = Row("Pais").ToString()
SucursalDestinoCP.CP = Row("EnvioCP").ToString()
TxtDestinoCP.Text = String.Format("{0} col. {1},CP:{2}, {3},{4},{5}", SucursalDestinoCP.Direccion, SucursalDestinoCP.Colonia, SucursalDestinoCP.CP, SucursalDestinoCP.Municipio, SucursalDestinoCP.Estado, SucursalDestinoCP.Pais)
Else
TxtDestinoCP.Text = ""
End If
Else
TxtDestinoCP.Text = ""
End If
UpEmitirTransitorio.Update()
End Sub
#End Region
End Class

View File

@@ -13,6 +13,7 @@ Imports System.Web.Script.Services
Imports System.Web.Script.Serialization
Imports ADGPSModels
Imports System.IO
Imports System.Net.Http
Public Class AuthHeader
@@ -660,7 +661,6 @@ Public Class WSGPSApp
<WebMethod>
Public Function GetHistoricoPosicionesEquipo(params As String) As String
Dim Retorno As String = ""
Dim ObjGPS As New ClsGPS()
Try
Dim Estructura = New With
{
@@ -671,27 +671,140 @@ Public Class WSGPSApp
}
Dim jsonParams As String = Decripta(params)
Dim parametros = JsonConvert.DeserializeAnonymousType(jsonParams, Estructura)
Dim FechaI As DateTime = StartOfDay(parametros.FechaI)
Dim FechaF As DateTime = EndOfDay(parametros.FechaF)
Dim coords As New List(Of MWSGeolocation2)
If ObjGPS.GetPosicionEquipo(parametros.CveDispositivo, parametros.FechaI, parametros.FechaF) Then
If ObjGPS.DtResultados.Rows.Count > 0 Then
For Each Row As DataRow In ObjGPS.DtResultados.Rows
Dim DtRetorno As DataTable = Nothing
Using ObjGPS As New ClsGPS()
If ObjGPS.GetPosicionEquipo(parametros.CveDispositivo, FechaI, FechaF) Then
DtRetorno = ObjGPS.DtResultados.Copy()
End If
End Using
If DtRetorno IsNot Nothing AndAlso DtRetorno.Rows.Count > 0 Then
Dim Direcciones As JArray = ConsultarDirecciones(DtRetorno)
For Each Dir As JObject In Direcciones
DtRetorno.Rows(Dir("Indice").ToEntero())("Direccion") = Dir("Direccion").ToString()
Next
For Each Row As DataRow In DtRetorno.Rows
Dim Coord As MWSGeolocation2 = SQLToGmaps(Row("Posicion").ToString, "POINT")
Coord.Velocidad = Row("Velocidad").ToString().ToDouble().RoundSQL(0)
Coord.FechaTrama = Row("FechaTrama").ToString
Coord.Direccion = Row("Direccion").ToString
Coord.Combustible = Row("Combustible").ToString().ToDouble().RoundSQL(2)
coords.Add(Coord)
Next
End If
End If
If coords.Count > 0 Then
Retorno = JsonConvert.SerializeObject(coords)
End If
Catch ex As Exception
OnError("Ocurrio un error al obtener las posiciones historicas de un dispositivo.", ex)
Finally
ObjGPS.Dispose()
End Try
Return Retorno
End Function
<WebMethod>
Public Function GetHistoricoPosicionesEquipo2(params As String) As String
Dim Retorno As String = ""
Try
Dim Estructura = New With
{
Key .[CveDispositivo] = -1,
Key .[FechaI] = DateTime.Now,
Key .[FechaF] = DateTime.Now,
Key .[Ticks] = ""
}
Dim jsonParams As String = Decripta(params)
Dim parametros = JsonConvert.DeserializeAnonymousType(jsonParams, Estructura)
Dim FechaI As DateTime = parametros.FechaI
Dim FechaF As DateTime = parametros.FechaF
Dim coords As New List(Of MWSGeolocation2)
Dim DtRetorno As DataTable = Nothing
Using ObjGPS As New ClsGPS()
If ObjGPS.GetPosicionEquipo(parametros.CveDispositivo, FechaI, FechaF) Then
DtRetorno = ObjGPS.DtResultados.Copy()
End If
End Using
If DtRetorno IsNot Nothing AndAlso DtRetorno.Rows.Count > 0 Then
Dim Direcciones As JArray = ConsultarDirecciones(DtRetorno)
For Each Dir As JObject In Direcciones
DtRetorno.Rows(Dir("Indice").ToEntero())("Direccion") = Dir("Direccion").ToString()
Next
For Each Row As DataRow In DtRetorno.Rows
Dim Coord As MWSGeolocation2 = SQLToGmaps(Row("Posicion").ToString, "POINT")
Coord.Velocidad = Row("Velocidad").ToString().ToDouble().RoundSQL(0)
Coord.FechaTrama = Row("FechaTrama").ToString
Coord.Direccion = Row("Direccion").ToString
Coord.Combustible = Row("Combustible").ToString().ToDouble().RoundSQL(2)
coords.Add(Coord)
Next
End If
If coords.Count > 0 Then
Retorno = JsonConvert.SerializeObject(coords)
End If
Catch ex As Exception
OnError("Ocurrio un error al obtener las posiciones historicas de un dispositivo.", ex)
End Try
Return Retorno
End Function
Public Function ConsultarDirecciones(Dt As DataTable) As JArray
Dim retorno As JArray = Nothing
Dim posicionesArray = New JArray(From Row As DataRow In Dt
Select New JObject(
New JProperty("indice", Dt.Rows().IndexOf(Row)),
New JProperty("cveTrama", -1),
New JProperty("lat", Row("lat").ToString()),
New JProperty("lon", Row("lon").ToString())
))
Dim Base64array = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(posicionesArray.ToString()))
Using wc As New HttpClient()
Try
wc.Timeout = New TimeSpan(0, 0, 15)
Dim Url = New Uri(String.Format("{0}nominatim/reverseMultiple.php", ClsPaginas.UrlDirecciones))
Dim FormStuff = String.Format("formato=json&posiciones={0}", Base64array)
Dim content = New StringContent(FormStuff, Encoding.UTF8, "application/x-www-form-urlencoded")
Dim response = wc.PostAsync(Url, content).Result
Dim result = response.Content.ReadAsStringAsync().Result
retorno = JArray.Parse(result)
response.Dispose()
content = Nothing
Url = Nothing
FormStuff = Nothing
Catch ex As Exception
OnError("Ocurrió un error al obtener las direcciones", ex)
End Try
End Using
Return retorno
End Function
Public Function EndOfDay(ByVal fecha As DateTime) As DateTime
Return New DateTime(fecha.Year, fecha.Month, fecha.Day, 23, 59, 59, 999)
End Function
Public Function StartOfDay(ByVal fecha As DateTime) As DateTime
Return New DateTime(fecha.Year, fecha.Month, fecha.Day, 0, 0, 0, 0)
End Function
<WebMethod>
Public Function GetEquipoMasCercano(params As String) As String
Dim json = "[]"
@@ -1193,6 +1306,8 @@ Namespace ADGPSModels
Public Property Longitud As Double
Public Property FechaTrama As String
Public Property Velocidad As Double
Public Property Combustible As Double
Public Property Direccion As String
End Class
<Serializable>
Public Class MPosicion2

View File

@@ -464,6 +464,8 @@