vwd.webinfo
This commit is contained in:
@@ -13,6 +13,7 @@ Public Class ClsInventarios
|
||||
Private SqlAdapter As SqlDataAdapter
|
||||
Private SqlTransacc As SqlTransaction
|
||||
Private Data As DataTable
|
||||
Private Dataset As DataSet
|
||||
|
||||
Private disposedValue As Boolean = False ' Para detectar llamadas redundantes
|
||||
'REGISTRAR CONEXIONES ABIERTAS
|
||||
@@ -140,6 +141,12 @@ Public Class ClsInventarios
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property DataSetResultados() As DataSet
|
||||
Get
|
||||
DataSetResultados = DataSet
|
||||
End Get
|
||||
End Property
|
||||
|
||||
#End Region
|
||||
|
||||
Sub New(Optional TransaccionCompartida As SqlTransaction = Nothing)
|
||||
@@ -5878,14 +5885,14 @@ Public Class ClsInventarios
|
||||
#Region "JAM - POG"
|
||||
Public Function GetJAM_BASF_POG(Fecha As Date) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
|
||||
Dataset = New DataSet()
|
||||
DataAdapter("PA_JAM_BASF_POG")
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@Fecha", SqlDbType.Date).Value = Fecha
|
||||
End With
|
||||
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
SqlAdapter.Fill(Dataset)
|
||||
Retorno = True
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al obtener las existencias.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||
@@ -5903,6 +5910,7 @@ Public Class ClsInventarios
|
||||
If disposing Then
|
||||
' TODO: Liberar otro estado (objetos administrados).
|
||||
If Not Data Is Nothing Then Data.Dispose() : Data = Nothing
|
||||
If Not Dataset Is Nothing Then Dataset.Dispose() : Dataset = Nothing
|
||||
If Not SqlAdapter Is Nothing Then SqlAdapter.Dispose() : SqlAdapter = Nothing
|
||||
If Not SqlTransacc Is Nothing Then SqlTransacc.Dispose() : SqlTransacc = Nothing
|
||||
If SqlConexion.State <> ConnectionState.Closed Then SqlConexion.Close()
|
||||
|
||||
@@ -379,7 +379,7 @@ Namespace Modelos
|
||||
End If
|
||||
Timbre = New CFDITimbre
|
||||
End Sub
|
||||
Public Sub New(UsuarioActual As Usuario, CveVenta As Integer, CveEmpresa As Integer, Optional DirectorioServidor As String = "", Optional EsCancelacion As Boolean = False)
|
||||
Public Sub New(UsuarioActual As Usuario, CveVenta As Integer, CveEmpresa As Integer, Optional DirectorioServidor As String = "", Optional EsCancelacion As Boolean = False, Optional CargaDTDetalle As Boolean = True, Optional CargaDatosCliente As Boolean = True, Optional CargaDatosRelacionados As Boolean = True)
|
||||
Me.UsuarioActual = UsuarioActual
|
||||
Me.CveVenta = CveVenta
|
||||
Me.CveEmpresa = CveEmpresa
|
||||
@@ -397,9 +397,12 @@ Namespace Modelos
|
||||
|
||||
SetMetodoPago()
|
||||
SetMoneda()
|
||||
SetSubProyecto()
|
||||
SetSubProyectoMatriz()
|
||||
SetCliente()
|
||||
|
||||
If Me.CveSubProyecto > 0 Then
|
||||
SetSubProyecto()
|
||||
SetSubProyectoMatriz()
|
||||
End If
|
||||
|
||||
If ObjVentas.DtResultados.Rows(0)("IEPS").ToString.ToDecimal <= 0 Then
|
||||
Me.VentaDesglosaIEPS = False
|
||||
Else
|
||||
@@ -408,11 +411,23 @@ Namespace Modelos
|
||||
SetTotales(ObjVentas.DtResultados, ObjVentas)
|
||||
End If
|
||||
End If
|
||||
If ObjVentas.GetVentaDetalle(CveVenta) Then
|
||||
Me.DtDetalle = ObjVentas.DtResultados.Copy()
|
||||
|
||||
If CargaDTDetalle Then
|
||||
If ObjVentas.GetVentaDetalle(CveVenta) Then
|
||||
Me.DtDetalle = ObjVentas.DtResultados.Copy()
|
||||
End If
|
||||
End If
|
||||
|
||||
ObjVentas.Dispose()
|
||||
IniciaValoresVentas(EsCancelacion)
|
||||
|
||||
If CargaDatosCliente Then
|
||||
SetCliente()
|
||||
End If
|
||||
|
||||
If CargaDatosRelacionados Then
|
||||
IniciaValoresVentas(EsCancelacion)
|
||||
End If
|
||||
|
||||
If String.IsNullOrEmpty(DirectorioServidor) Then
|
||||
DirectorioServidor = ModExtensiones.DirectorioBaseEmpresas
|
||||
End If
|
||||
@@ -5543,7 +5558,7 @@ Namespace Modelos
|
||||
End If
|
||||
|
||||
If SaldoAlmacenExA <> 0 Then
|
||||
If Not CancelarMovimientosRemision(CveRemision, CveAlmacen, CveAlmacenDevolucion, DtDevRemision.FiltraParametros($"CveMovimiento={RowDevolucion("CveMovimiento")}"), ObjVentas, ObjInventario) Then
|
||||
If Not CancelarMovimientosRemision(CveRemision, CveAlmacen, CveAlmacenDevolucion, DtDevRemision.FiltraParametros($"CveMovimiento={RowDevolucion("CveMovimiento")}"), ObjVentas, ObjInventario, ObjConta) Then
|
||||
ErrorCancelar = True
|
||||
MensajeError = "Ocurrió un error al cancelar los movimientos de la remisión."
|
||||
Exit For
|
||||
@@ -5665,7 +5680,7 @@ Namespace Modelos
|
||||
For Each RowDevolucion As DataRow In DtDevMovs.Rows
|
||||
CveAlmacen = RowDevolucion("CveAlmacen").ToString().ToEntero()
|
||||
|
||||
If Not CancelarMovimientosRemision(CveVenta, CveAlmacen, CveAlmacenGeneral, DtMovRemision.FiltraParametros($"CveMovimiento={RowDevolucion("CveMovimiento")} AND CvePS > 0"), ObjVentas, ObjInventario) Then
|
||||
If Not CancelarMovimientosRemision(CveVenta, CveAlmacen, CveAlmacenGeneral, DtMovRemision.FiltraParametros($"CveMovimiento={RowDevolucion("CveMovimiento")} AND CvePS > 0"), ObjVentas, ObjInventario, ObjConta) Then
|
||||
ErrorCancelar = True
|
||||
MensajeError = "Ocurrió un error al cancelar los movimientos de la remisión."
|
||||
Exit For
|
||||
@@ -6639,7 +6654,7 @@ Namespace Modelos
|
||||
Public Property ObservacionesAlmacen As String
|
||||
Public Property CveOC As Integer = -1
|
||||
Public Property CveCuentaTerminal As Integer = -1
|
||||
Public Property ClienteEsDistribuidor As Boolean = False
|
||||
Public Property EsDistribuidor As Boolean = False
|
||||
Public Property AplicaGastoContrato As Boolean = False
|
||||
Public Property FacturaDevolucion As Modelos.Factura
|
||||
Public Property CveOrdenProduccion As Integer = -1
|
||||
@@ -7065,7 +7080,7 @@ Namespace Modelos
|
||||
|
||||
Public Sub SetSubProyecto()
|
||||
If CveSubProyecto > 0 AndAlso UsuarioActual IsNot Nothing Then
|
||||
SubProyecto = New Modelos.SubProyectoModel(GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero($"CveSubProyecto = {CveSubProyecto}"))
|
||||
SubProyecto = New Modelos.SubProyectoModel(GlobalDTSubProyectos(-1, CveSubProyecto:=CveSubProyecto, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero(""))
|
||||
End If
|
||||
End Sub
|
||||
Public Sub SetSubProyectoMatriz()
|
||||
|
||||
@@ -600,7 +600,6 @@ Public Class Timbrado
|
||||
Dim Clave As String = Empresa.ContraseñaKey
|
||||
Dim UrlServicio As String = "" ' Produccion
|
||||
|
||||
'UrlServicio = "http://juancalderon-001-site1.ftempurl.com/timbrado.asmx?WSDL"
|
||||
'UrlServicio = "http://alterno.gofac.com.mx/cfdi/timbrado.asmx?WSDL" ' alterno
|
||||
UrlServicio = "https://cfdi.gofac.com.mx/timbrado.asmx?WSDL"
|
||||
|
||||
@@ -1138,10 +1137,10 @@ Public Class Timbrado
|
||||
Equivalencia = 1
|
||||
'condiciones especiales para el pago en pesos, facturas en moneda extranjera
|
||||
ElseIf MonedaPago = "MXN" AndAlso VentaAbreviaturaSAT <> "MXN" Then
|
||||
VentaTipoCambio = VentaTipoCambio.RoundSQL(6)
|
||||
Equivalencia = (1 / VentaTipoCambio).RoundSQL(6)
|
||||
VentaTipoCambio = Math.Round(VentaTipoCambio, 6)
|
||||
Equivalencia = Math.Round((1 / VentaTipoCambio), 6)
|
||||
ElseIf MonedaPago = "USD" AndAlso VentaAbreviaturaSAT <> "USD" Then
|
||||
VentaTipoCambio = VentaTipoCambio.RoundSQL(6)
|
||||
VentaTipoCambio = Math.Round(VentaTipoCambio, 6)
|
||||
Equivalencia = VentaTipoCambio
|
||||
End If
|
||||
|
||||
@@ -1167,8 +1166,8 @@ Public Class Timbrado
|
||||
.TasaOCuota = drp("PorcentajeImpuesto").ToString().ToDecimal,
|
||||
.Impuesto = drp("TipoImpuesto").ToString,
|
||||
.Importe = drp("Importe").ToString().ToDecimal.RoundSQL,
|
||||
.BaseMN = (drp("Base").ToString.ToDecimal / Equivalencia).RoundSQL(2),
|
||||
.ImporteMN = (drp("Importe").ToString.ToDecimal / Equivalencia).RoundSQL(2)
|
||||
.BaseMN = Math.Round((drp("Base").ToString.ToDecimal / Equivalencia), 2),
|
||||
.ImporteMN = Math.Round((drp("Importe").ToString.ToDecimal / Equivalencia), 2)
|
||||
}
|
||||
)
|
||||
|
||||
@@ -2235,7 +2234,6 @@ Public Class Timbrado
|
||||
Case 2
|
||||
UrlServicio = "http://generacfdi.com.mx/rvltimbrado/service1.asmx?WSDL" 'productivo
|
||||
Case 4
|
||||
'UrlServicio = "http://juancalderon-001-site1.ftempurl.com/timbrado.asmx?WSDL"
|
||||
'UrlServicio = "http://alterno.gofac.com.mx/cfdi/timbrado.asmx?WSDL" ' alterno
|
||||
UrlServicio = "https://cfdi.gofac.com.mx/timbrado.asmx?WSDL"
|
||||
End Select
|
||||
@@ -2260,7 +2258,7 @@ Public Class Timbrado
|
||||
Case 4
|
||||
UsuarioServicio = "UserTest"
|
||||
ClaveServicio = "1234567890"
|
||||
UrlServicio = "http://juancalderon-001-site1.ftempurl.com/timbrado.asmx?WSDL"
|
||||
UrlServicio = "https://cfdi.gofac.com.mx/timbrado.asmx"
|
||||
End Select
|
||||
End If
|
||||
|
||||
@@ -4074,52 +4072,11 @@ Public Class Timbrado
|
||||
#Region " Complemento Pago"
|
||||
|
||||
If ObjCFDITimbre.Comprobante.TipoComprobante = "P" Then
|
||||
Dim ComPag = New Profact.TimbraCFDI40.Complementos.Pagos20.Pagos()
|
||||
|
||||
ComPag.Pago = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPago(0) {}
|
||||
ComPag.Pago(0) = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPago()
|
||||
ComPag.Pago(0).FechaPago = ObjCFDITimbre.ComplementoPagos.FechaPago.ToString("yyyy-MM-ddTHH:mm:ss").ToDate()
|
||||
ComPag.Pago(0).FormaDePagoP = ObjCFDITimbre.ComplementoPagos.FormaDePagoP
|
||||
ComPag.Pago(0).MonedaP = ObjCFDITimbre.ComplementoPagos.MonedaP
|
||||
ComPag.Pago(0).TipoCambioPSpecified = True 'If(ObjCFDITimbre.ComplementoPagos.MonedaP = "MXN", False, True)
|
||||
ComPag.Pago(0).TipoCambioP = ObjCFDITimbre.ComplementoPagos.TipoCambioP
|
||||
ComPag.Pago(0).Monto = ObjCFDITimbre.ComplementoPagos.Monto
|
||||
If ObjCFDITimbre.ComplementoPagos.NumOperacion <> "" Then
|
||||
ComPag.Pago(0).NumOperacion = ObjCFDITimbre.ComplementoPagos.NumOperacion
|
||||
End If
|
||||
If ObjCFDITimbre.ComplementoPagos.RfcEmisorCtaOrd <> "" Then
|
||||
ComPag.Pago(0).RfcEmisorCtaOrd = ObjCFDITimbre.ComplementoPagos.RfcEmisorCtaOrd
|
||||
End If
|
||||
If ObjCFDITimbre.ComplementoPagos.NomBancoOrdExt <> "" Then
|
||||
ComPag.Pago(0).NomBancoOrdExt = ObjCFDITimbre.ComplementoPagos.NomBancoOrdExt
|
||||
End If
|
||||
If ObjCFDITimbre.ComplementoPagos.CtaOrdenante <> "" Then
|
||||
ComPag.Pago(0).CtaOrdenante = ObjCFDITimbre.ComplementoPagos.CtaOrdenante
|
||||
End If
|
||||
If ObjCFDITimbre.ComplementoPagos.RfcEmisorCtaBen <> "" Then
|
||||
ComPag.Pago(0).RfcEmisorCtaBen = ObjCFDITimbre.ComplementoPagos.RfcEmisorCtaBen
|
||||
End If
|
||||
If ObjCFDITimbre.ComplementoPagos.CtaBeneficiario <> "" Then
|
||||
ComPag.Pago(0).CtaBeneficiario = ObjCFDITimbre.ComplementoPagos.CtaBeneficiario
|
||||
End If
|
||||
If ObjCFDITimbre.ComplementoPagos.TipoCadPago <> "" Then
|
||||
ComPag.Pago(0).TipoCadPagoSpecified = True
|
||||
ComPag.Pago(0).TipoCadPago = ObjCFDITimbre.ComplementoPagos.TipoCadPago
|
||||
End If
|
||||
|
||||
If ObjCFDITimbre.ComplementoPagos.CertPago <> "" Then
|
||||
ComPag.Pago(0).CertPago = System.Text.Encoding.Default.GetBytes(ObjCFDITimbre.ComplementoPagos.CertPago).ToString()
|
||||
End If
|
||||
If ObjCFDITimbre.ComplementoPagos.CadPago <> "" Then
|
||||
ComPag.Pago(0).CadPago = ObjCFDITimbre.ComplementoPagos.CadPago
|
||||
End If
|
||||
If ObjCFDITimbre.ComplementoPagos.SelloPago <> "" Then
|
||||
ComPag.Pago(0).SelloPago = System.Text.Encoding.Default.GetBytes(ObjCFDITimbre.ComplementoPagos.SelloPago).ToString()
|
||||
End If
|
||||
If ObjCFDITimbre.ComplementoPagos20.ComplementoPagos.Count > 0 Then
|
||||
|
||||
If ObjCFDITimbre.ComplementoPagos.DocumentosRelacionados.Count > 0 Then
|
||||
Dim Totales As New Profact.TimbraCFDI40.Complementos.Pagos20.PagosTotales()
|
||||
'Totales Generales
|
||||
Dim Totales As New Profact.TimbraCFDI40.Complementos.Pagos20.PagosTotales() 'Totales Generales
|
||||
|
||||
Totales.MontoTotalPagos = ObjCFDITimbre.ComplementoPagos20.MontoTotalPagos.RoundSQL
|
||||
|
||||
@@ -4137,6 +4094,7 @@ Public Class Timbrado
|
||||
Totales.TotalTrasladosBaseIVA0Specified = Totales.TotalTrasladosBaseIVA0 > 0
|
||||
Totales.TotalTrasladosImpuestoIVA0 = 0
|
||||
Totales.TotalTrasladosImpuestoIVA0Specified = Totales.TotalTrasladosBaseIVA0 > 0 ' si hay base > 0, debe de ponerse aunque sea en cero
|
||||
|
||||
If ObjCFDITimbre.ComplementoPagos20.TotalRetencionesIEPS > 0 Then
|
||||
Totales.TotalRetencionesIEPS = ObjCFDITimbre.ComplementoPagos20.TotalRetencionesIEPS.RoundSQL
|
||||
Totales.TotalRetencionesIEPSSpecified = True
|
||||
@@ -4144,105 +4102,141 @@ Public Class Timbrado
|
||||
Totales.TotalRetencionesIEPSSpecified = False
|
||||
End If
|
||||
|
||||
Dim ComPag = New Profact.TimbraCFDI40.Complementos.Pagos20.Pagos()
|
||||
|
||||
ComPag.Totales = Totales
|
||||
ComPag.Pago = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPago(ObjCFDITimbre.ComplementoPagos20.ComplementoPagos.Count - 1) {}
|
||||
Dim ii As Integer = 0
|
||||
For Each docp As CFDIComplementoPago In ObjCFDITimbre.ComplementoPagos20.ComplementoPagos
|
||||
|
||||
ComPag.Pago(0).DoctoRelacionado = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoDoctoRelacionado(ObjCFDITimbre.ComplementoPagos.DocumentosRelacionados.Count - 1) {}
|
||||
Dim i As Integer
|
||||
For Each doc As CFDIComplementoPagosDocsRelacionados In ObjCFDITimbre.ComplementoPagos.DocumentosRelacionados
|
||||
ComPag.Pago(0).DoctoRelacionado(i) = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoDoctoRelacionado()
|
||||
ComPag.Pago(0).DoctoRelacionado(i).IdDocumento = doc.IdDocumento
|
||||
If Not String.IsNullOrEmpty(doc.Serie) Then
|
||||
ComPag.Pago(0).DoctoRelacionado(i).Serie = doc.Serie
|
||||
ComPag.Pago(ii) = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPago()
|
||||
ComPag.Pago(ii).FechaPago = docp.FechaPago.ToString("yyyy-MM-ddTHH:mm:ss").ToDate()
|
||||
ComPag.Pago(ii).FormaDePagoP = docp.FormaDePagoP
|
||||
ComPag.Pago(ii).MonedaP = docp.MonedaP
|
||||
ComPag.Pago(ii).TipoCambioPSpecified = True 'If(ObjCFDITimbre.ComplementoPagos.MonedaP = "MXN", False, True)
|
||||
ComPag.Pago(ii).TipoCambioP = docp.TipoCambioP
|
||||
ComPag.Pago(ii).Monto = docp.Monto
|
||||
If docp.NumOperacion <> "" Then ComPag.Pago(ii).NumOperacion = docp.NumOperacion
|
||||
|
||||
If docp.RfcEmisorCtaOrd <> "" Then ComPag.Pago(ii).RfcEmisorCtaOrd = docp.RfcEmisorCtaOrd
|
||||
|
||||
If docp.NomBancoOrdExt <> "" Then ComPag.Pago(ii).NomBancoOrdExt = docp.NomBancoOrdExt
|
||||
|
||||
If docp.CtaOrdenante <> "" Then ComPag.Pago(ii).CtaOrdenante = docp.CtaOrdenante
|
||||
|
||||
If docp.RfcEmisorCtaBen <> "" Then ComPag.Pago(ii).RfcEmisorCtaBen = docp.RfcEmisorCtaBen
|
||||
|
||||
If docp.CtaBeneficiario <> "" Then ComPag.Pago(ii).CtaBeneficiario = docp.CtaBeneficiario
|
||||
|
||||
If docp.TipoCadPago <> "" Then
|
||||
ComPag.Pago(ii).TipoCadPagoSpecified = True
|
||||
ComPag.Pago(ii).TipoCadPago = docp.TipoCadPago
|
||||
End If
|
||||
ComPag.Pago(0).DoctoRelacionado(i).Folio = doc.Folio
|
||||
ComPag.Pago(0).DoctoRelacionado(i).MonedaDR = doc.MonedaDR
|
||||
ComPag.Pago(0).DoctoRelacionado(i).NumParcialidad = doc.NumParcialidad.ToString
|
||||
ComPag.Pago(0).DoctoRelacionado(i).ImpSaldoAnt = doc.ImpSaldoAnt.RoundSQL
|
||||
ComPag.Pago(0).DoctoRelacionado(i).ImpPagadoSpecified = True
|
||||
ComPag.Pago(0).DoctoRelacionado(i).ImpPagado = doc.ImpPagado.RoundSQL
|
||||
ComPag.Pago(0).DoctoRelacionado(i).ImpSaldoInsoluto = doc.ImpSaldoInsoluto.RoundSQL
|
||||
ComPag.Pago(0).DoctoRelacionado(i).EquivalenciaDR = doc.EquivalenciaDR.RoundSQL(6)
|
||||
ComPag.Pago(0).DoctoRelacionado(i).EquivalenciaDRSpecified = True
|
||||
ComPag.Pago(0).DoctoRelacionado(i).ObjetoImpDR = doc.ObjetoImpuesto
|
||||
|
||||
If doc.Impuestos IsNot Nothing Then
|
||||
ComPag.Pago(0).DoctoRelacionado(i).ImpuestosDR = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoDoctoRelacionadoImpuestosDR
|
||||
If docp.CertPago <> "" Then ComPag.Pago(ii).CertPago = System.Text.Encoding.Default.GetBytes(docp.CertPago).ToString()
|
||||
|
||||
''retenciones
|
||||
If (doc.Impuestos).Where(Function(x) x.TrasladooRetencion = "R").Count > 0 Then
|
||||
Dim j As Integer = 0
|
||||
ComPag.Pago(0).DoctoRelacionado(i).ImpuestosDR.RetencionesDR = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoDoctoRelacionadoImpuestosDRRetencionDR(doc.Impuestos.Where(Function(x) x.TrasladooRetencion = "R").Count - 1) {}
|
||||
If docp.CadPago <> "" Then ComPag.Pago(ii).CadPago = docp.CadPago
|
||||
|
||||
For Each docimp As CFDIConceptosImpuestos In doc.Impuestos.Where(Function(x) x.TrasladooRetencion = "R")
|
||||
If docimp.TrasladooRetencion = "R" Then
|
||||
Dim Tra As New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoDoctoRelacionadoImpuestosDRRetencionDR
|
||||
Tra.BaseDR = docimp.Base.RoundSQL(2)
|
||||
Tra.ImporteDR = docimp.Importe.RoundSQL(2)
|
||||
Tra.ImpuestoDR = docimp.Impuesto
|
||||
Tra.TipoFactorDR = docimp.TipoFactor
|
||||
Tra.TasaOCuotaDR = docimp.TasaOCuota.RoundSQL(6)
|
||||
ComPag.Pago(0).DoctoRelacionado(i).ImpuestosDR.RetencionesDR(j) = Tra
|
||||
End If
|
||||
j += 1
|
||||
If docp.SelloPago <> "" Then ComPag.Pago(ii).SelloPago = System.Text.Encoding.Default.GetBytes(docp.SelloPago).ToString()
|
||||
|
||||
ComPag.Pago(ii).DoctoRelacionado = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoDoctoRelacionado(docp.DocumentosRelacionados.Count - 1) {}
|
||||
|
||||
Dim i As Integer
|
||||
For Each doc As CFDIComplementoPagosDocsRelacionados In docp.DocumentosRelacionados
|
||||
ComPag.Pago(ii).DoctoRelacionado(i) = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoDoctoRelacionado()
|
||||
ComPag.Pago(ii).DoctoRelacionado(i).IdDocumento = doc.IdDocumento
|
||||
If Not String.IsNullOrEmpty(doc.Serie) Then
|
||||
ComPag.Pago(ii).DoctoRelacionado(i).Serie = doc.Serie
|
||||
End If
|
||||
ComPag.Pago(ii).DoctoRelacionado(i).Folio = doc.Folio
|
||||
ComPag.Pago(ii).DoctoRelacionado(i).MonedaDR = doc.MonedaDR
|
||||
ComPag.Pago(ii).DoctoRelacionado(i).NumParcialidad = doc.NumParcialidad.ToString
|
||||
ComPag.Pago(ii).DoctoRelacionado(i).ImpSaldoAnt = doc.ImpSaldoAnt.RoundSQL
|
||||
ComPag.Pago(ii).DoctoRelacionado(i).ImpPagadoSpecified = True
|
||||
ComPag.Pago(ii).DoctoRelacionado(i).ImpPagado = doc.ImpPagado.RoundSQL
|
||||
ComPag.Pago(ii).DoctoRelacionado(i).ImpSaldoInsoluto = doc.ImpSaldoInsoluto.RoundSQL
|
||||
ComPag.Pago(ii).DoctoRelacionado(i).EquivalenciaDR = doc.EquivalenciaDR.RoundSQL(6)
|
||||
ComPag.Pago(ii).DoctoRelacionado(i).EquivalenciaDRSpecified = True
|
||||
ComPag.Pago(ii).DoctoRelacionado(i).ObjetoImpDR = doc.ObjetoImpuesto
|
||||
|
||||
If doc.Impuestos IsNot Nothing Then
|
||||
ComPag.Pago(ii).DoctoRelacionado(i).ImpuestosDR = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoDoctoRelacionadoImpuestosDR
|
||||
|
||||
''retenciones
|
||||
If (doc.Impuestos).Where(Function(x) x.TrasladooRetencion = "R").Count > 0 Then
|
||||
Dim j As Integer = 0
|
||||
ComPag.Pago(ii).DoctoRelacionado(i).ImpuestosDR.RetencionesDR = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoDoctoRelacionadoImpuestosDRRetencionDR(doc.Impuestos.Where(Function(x) x.TrasladooRetencion = "R").Count - 1) {}
|
||||
|
||||
For Each docimp As CFDIConceptosImpuestos In doc.Impuestos.Where(Function(x) x.TrasladooRetencion = "R")
|
||||
If docimp.TrasladooRetencion = "R" Then
|
||||
Dim Tra As New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoDoctoRelacionadoImpuestosDRRetencionDR
|
||||
Tra.BaseDR = docimp.Base.RoundSQL(2)
|
||||
Tra.ImporteDR = docimp.Importe.RoundSQL(2)
|
||||
Tra.ImpuestoDR = docimp.Impuesto
|
||||
Tra.TipoFactorDR = docimp.TipoFactor
|
||||
Tra.TasaOCuotaDR = docimp.TasaOCuota.RoundSQL(6)
|
||||
ComPag.Pago(ii).DoctoRelacionado(i).ImpuestosDR.RetencionesDR(j) = Tra
|
||||
End If
|
||||
j += 1
|
||||
Next
|
||||
End If
|
||||
|
||||
''traslados
|
||||
If (doc.Impuestos).Where(Function(x) x.TrasladooRetencion = "T").Count > 0 Then
|
||||
Dim j As Integer = 0
|
||||
ComPag.Pago(ii).DoctoRelacionado(i).ImpuestosDR.TrasladosDR = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoDoctoRelacionadoImpuestosDRTrasladoDR(doc.Impuestos.Where(Function(x) x.TrasladooRetencion = "T").Count - 1) {}
|
||||
|
||||
For Each docimp As CFDIConceptosImpuestos In doc.Impuestos.Where(Function(x) x.TrasladooRetencion = "T")
|
||||
|
||||
If docimp.TrasladooRetencion = "T" Then
|
||||
Dim Tra As New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoDoctoRelacionadoImpuestosDRTrasladoDR
|
||||
Tra.BaseDR = docimp.Base.RoundSQL(2)
|
||||
Tra.ImporteDRSpecified = True
|
||||
Tra.ImporteDR = docimp.Importe.RoundSQL(2)
|
||||
Tra.ImpuestoDR = docimp.Impuesto
|
||||
Tra.TipoFactorDR = docimp.TipoFactor
|
||||
Tra.TasaOCuotaDRSpecified = True
|
||||
Tra.TasaOCuotaDR = docimp.TasaOCuota.RoundSQL(6)
|
||||
ComPag.Pago(ii).DoctoRelacionado(i).ImpuestosDR.TrasladosDR(j) = Tra
|
||||
End If
|
||||
j += 1
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
i += 1
|
||||
Next
|
||||
|
||||
If docp.Retenciones.Count > 0 OrElse docp.Traslados.Count > 0 Then
|
||||
ComPag.Pago(ii).ImpuestosP = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoImpuestosP(0) {}
|
||||
ComPag.Pago(ii).ImpuestosP(0) = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoImpuestosP()
|
||||
|
||||
If docp.Retenciones.Count > 0 Then
|
||||
Dim x As Integer
|
||||
ComPag.Pago(ii).ImpuestosP(0).RetencionesP = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoImpuestosPRetencionP(docp.Retenciones.Count - 1) {}
|
||||
For Each Ret As CFDIRetenciones In ObjCFDITimbre.ComplementoPagos.Retenciones
|
||||
ComPag.Pago(ii).ImpuestosP(0).RetencionesP(x) = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoImpuestosPRetencionP()
|
||||
ComPag.Pago(ii).ImpuestosP(0).RetencionesP(x).ImpuestoP = Ret.Impuesto
|
||||
ComPag.Pago(ii).ImpuestosP(0).RetencionesP(x).ImporteP = Ret.ImporteMN
|
||||
x += 1
|
||||
Next
|
||||
End If
|
||||
|
||||
''traslados
|
||||
If (doc.Impuestos).Where(Function(x) x.TrasladooRetencion = "T").Count > 0 Then
|
||||
Dim j As Integer = 0
|
||||
ComPag.Pago(0).DoctoRelacionado(i).ImpuestosDR.TrasladosDR = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoDoctoRelacionadoImpuestosDRTrasladoDR(doc.Impuestos.Where(Function(x) x.TrasladooRetencion = "T").Count - 1) {}
|
||||
|
||||
For Each docimp As CFDIConceptosImpuestos In doc.Impuestos.Where(Function(x) x.TrasladooRetencion = "T")
|
||||
|
||||
If docimp.TrasladooRetencion = "T" Then
|
||||
Dim Tra As New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoDoctoRelacionadoImpuestosDRTrasladoDR
|
||||
Tra.BaseDR = docimp.Base.RoundSQL(2)
|
||||
Tra.ImporteDRSpecified = True
|
||||
Tra.ImporteDR = docimp.Importe.RoundSQL(2)
|
||||
Tra.ImpuestoDR = docimp.Impuesto
|
||||
Tra.TipoFactorDR = docimp.TipoFactor
|
||||
Tra.TasaOCuotaDRSpecified = True
|
||||
Tra.TasaOCuotaDR = docimp.TasaOCuota.RoundSQL(6)
|
||||
ComPag.Pago(0).DoctoRelacionado(i).ImpuestosDR.TrasladosDR(j) = Tra
|
||||
End If
|
||||
j += 1
|
||||
If docp.Traslados.Count > 0 Then
|
||||
Dim x As Integer
|
||||
ComPag.Pago(ii).ImpuestosP(0).TrasladosP = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoImpuestosPTrasladoP(docp.Traslados.Count - 1) {}
|
||||
For Each Tra As CFDITraslados In (docp.Traslados)
|
||||
ComPag.Pago(ii).ImpuestosP(0).TrasladosP(x) = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoImpuestosPTrasladoP()
|
||||
ComPag.Pago(ii).ImpuestosP(0).TrasladosP(x).ImpuestoP = Tra.Impuesto
|
||||
ComPag.Pago(ii).ImpuestosP(0).TrasladosP(x).TipoFactorP = Tra.TipoFactor
|
||||
ComPag.Pago(ii).ImpuestosP(0).TrasladosP(x).TasaOCuotaP = Tra.TasaOCuota.RoundSQL(6)
|
||||
ComPag.Pago(ii).ImpuestosP(0).TrasladosP(x).ImporteP = Tra.ImporteMN.RoundSQL(6)
|
||||
ComPag.Pago(ii).ImpuestosP(0).TrasladosP(x).BaseP = Tra.BaseMN.RoundSQL(2)
|
||||
x += 1
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
i += 1
|
||||
Next
|
||||
|
||||
If (ObjCFDITimbre.ComplementoPagos.Retenciones).Count > 0 OrElse ObjCFDITimbre.ComplementoPagos.Traslados.Count > 0 Then
|
||||
ComPag.Pago(0).ImpuestosP = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoImpuestosP(0) {}
|
||||
ComPag.Pago(0).ImpuestosP(0) = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoImpuestosP()
|
||||
|
||||
If (ObjCFDITimbre.ComplementoPagos.Retenciones).Count > 0 Then
|
||||
Dim x As Integer
|
||||
ComPag.Pago(0).ImpuestosP(0).RetencionesP = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoImpuestosPRetencionP((ObjCFDITimbre.ComplementoPagos.Retenciones).Count - 1) {}
|
||||
For Each Ret As CFDIRetenciones In ObjCFDITimbre.ComplementoPagos.Retenciones
|
||||
ComPag.Pago(0).ImpuestosP(0).RetencionesP(x) = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoImpuestosPRetencionP()
|
||||
ComPag.Pago(0).ImpuestosP(0).RetencionesP(x).ImpuestoP = Ret.Impuesto
|
||||
ComPag.Pago(0).ImpuestosP(0).RetencionesP(x).ImporteP = Ret.ImporteMN
|
||||
x += 1
|
||||
Next
|
||||
End If
|
||||
|
||||
If ObjCFDITimbre.ComplementoPagos.Traslados.Count > 0 Then
|
||||
Dim x As Integer
|
||||
ComPag.Pago(0).ImpuestosP(0).TrasladosP = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoImpuestosPTrasladoP((ObjCFDITimbre.ComplementoPagos.Traslados).Count - 1) {}
|
||||
For Each Tra As CFDITraslados In (ObjCFDITimbre.ComplementoPagos.Traslados)
|
||||
ComPag.Pago(0).ImpuestosP(0).TrasladosP(x) = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoImpuestosPTrasladoP()
|
||||
ComPag.Pago(0).ImpuestosP(0).TrasladosP(x).ImpuestoP = Tra.Impuesto
|
||||
ComPag.Pago(0).ImpuestosP(0).TrasladosP(x).TipoFactorP = Tra.TipoFactor
|
||||
ComPag.Pago(0).ImpuestosP(0).TrasladosP(x).TasaOCuotaP = Tra.TasaOCuota.RoundSQL(6)
|
||||
ComPag.Pago(0).ImpuestosP(0).TrasladosP(x).ImporteP = Tra.ImporteMN.RoundSQL(6)
|
||||
ComPag.Pago(0).ImpuestosP(0).TrasladosP(x).BaseP = Tra.BaseMN.RoundSQL(2)
|
||||
x += 1
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
Dim nsComp As New System.Xml.Serialization.XmlSerializerNamespaces()
|
||||
nsComp.Add("pago20", "http://www.sat.gob.mx/Pagos20")
|
||||
Dim xmlComp As String = Profact.TimbraCFDI.XMLUtilerias.SerializaObjeto(ComPag, GetType(Profact.TimbraCFDI40.Complementos.Pagos20.Pagos), nsComp)
|
||||
|
||||
303
Ashx/E119.ashx
Normal file
303
Ashx/E119.ashx
Normal file
@@ -0,0 +1,303 @@
|
||||
<%@ WebHandler Language="VB" Class="E119" %>
|
||||
|
||||
Option Strict On
|
||||
Option Explicit On
|
||||
|
||||
Imports System.Data
|
||||
Imports System.IO
|
||||
Imports System.Net.Http
|
||||
Imports Newtonsoft.Json
|
||||
Imports Newtonsoft.Json.Linq
|
||||
Imports Extensiones
|
||||
|
||||
Public Class E119 : Implements IHttpHandler
|
||||
|
||||
Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
|
||||
Get
|
||||
Return False
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private ReadOnly Property CveEmpresa As Integer = 119
|
||||
|
||||
Public ReadOnly Property EsProduccion As Boolean
|
||||
Get
|
||||
If IsNothing(System.Configuration.ConfigurationManager.AppSettings("EsProduccion")) Then
|
||||
Return False
|
||||
Else
|
||||
Return (System.Configuration.ConfigurationManager.AppSettings("EsProduccion").ToString() = "1")
|
||||
End If
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property UsuarioWSE119 As String
|
||||
Get
|
||||
If IsNothing(System.Configuration.ConfigurationManager.AppSettings("UsuarioWSE119")) Then
|
||||
Return ""
|
||||
Else
|
||||
Return System.Configuration.ConfigurationManager.AppSettings("UsuarioWSE119").ToString()
|
||||
End If
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property PasswordWSE119 As String
|
||||
Get
|
||||
If IsNothing(System.Configuration.ConfigurationManager.AppSettings("PasswordWSE119")) Then
|
||||
Return ""
|
||||
Else
|
||||
Return System.Configuration.ConfigurationManager.AppSettings("PasswordWSE119").ToString()
|
||||
End If
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property TokenAutorizacion As String
|
||||
Get
|
||||
Return "$2y$10$LGqtRWUloKQmAt.jcUldc.PmS5LJ6l.WU2w1G4PBOTLMVKZRNQFPS"
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property URLBase As String
|
||||
Get
|
||||
Return "https://services.fidelityapps.mx/"
|
||||
End Get
|
||||
End Property
|
||||
|
||||
|
||||
#Region "V A L I D A - D A T O S"
|
||||
Private Function ValidaUsuarioSistema(CveUsuario As Integer, CveEmpresa As Integer) As Usuario
|
||||
Dim UsuarioActual As Usuario = Nothing
|
||||
Dim ObjUsuarios As New ClsSisUsuarios
|
||||
If ObjUsuarios.GetUsuarios(CveUsuario) Then
|
||||
If ObjUsuarios.DtResultados.Rows.Count > 0 Then
|
||||
Dim Usuario = ObjUsuarios.DtResultados.Rows(0)("Usuario").ToString()
|
||||
Dim Contrasenia = ObjUsuarios.DtResultados.Rows(0)("Contraseña").ToString()
|
||||
UsuarioActual = ObjUsuarios.ValidaUsuario(Usuario, Contrasenia, IMEI, CveEmpresa)
|
||||
UsuarioActual.CveEmpresa = CveEmpresa
|
||||
CreaObjetoEmpresa(UsuarioActual)
|
||||
End If
|
||||
End If
|
||||
ObjUsuarios.Dispose()
|
||||
Return UsuarioActual
|
||||
End Function
|
||||
Private Sub CreaObjetoEmpresa(ByRef UsuarioActual As Usuario)
|
||||
Dim ObjEmpresa As New ClsSisEmpresas()
|
||||
If ObjEmpresa.GetEmpresas(UsuarioActual.CveEmpresa, "-1", "-1", "-1", "-1") Then
|
||||
If ObjEmpresa.GetEmpresasFuncionalidades(UsuarioActual.CveEmpresa) Then
|
||||
Dim dttmp As Data.DataTable = ObjEmpresa.DtResultados
|
||||
|
||||
Dim EmpresasFuncionalidades As New HybridDictionary
|
||||
For Each Row As Data.DataRow In dttmp.Rows
|
||||
EmpresasFuncionalidades.Add(Convert.ToInt32(Row("CveFuncionalidad")), Row("Valor").ToString)
|
||||
Next
|
||||
ObjEmpresa.Empresa.SetFuncionalidades(EmpresasFuncionalidades)
|
||||
End If
|
||||
|
||||
UsuarioActual.Empresa = ObjEmpresa.Empresa
|
||||
End If
|
||||
ObjEmpresa.Dispose()
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
|
||||
Dim retorno As String = ""
|
||||
Try
|
||||
Dim Metodo = If(context.Request("Metodo") = Nothing, "", context.Request("Metodo").ToString())
|
||||
'OBTENER EXISTENCIAS
|
||||
If Metodo = "ConsultaBASF_POG" Then
|
||||
context.Response.ContentType = "application/json"
|
||||
Dim Auth = ValidarSolicitud(context)
|
||||
|
||||
If Auth.IsSucces Then
|
||||
retorno = ConsultaDatos(context)
|
||||
Else
|
||||
context.Response.StatusCode = Auth.StatusCode
|
||||
retorno = JsonConvert.SerializeObject(Auth.ErrorMessage)
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
context.Response.Write(retorno)
|
||||
|
||||
Catch ex As Exception
|
||||
context.Response.ContentType = "text/html"
|
||||
retorno = ex.ToString()
|
||||
ex.GuardaLog(ex.ToString())
|
||||
|
||||
context.Response.Write(retorno)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Function ValidarSolicitud(ByVal context As HttpContext) As AuthMessage
|
||||
Dim unauthorized As Boolean = True
|
||||
Dim respuesta As New AuthMessage
|
||||
|
||||
Dim authHeader = context.Request.Headers("Authorization")
|
||||
If authHeader IsNot Nothing Then
|
||||
Dim basicAuth As String = authHeader.Replace("Basic ", "")
|
||||
|
||||
Dim usernamePasswordArray = Encoding.UTF8.GetString(Convert.FromBase64String(basicAuth)).Split(":"c)
|
||||
|
||||
Dim userName = usernamePasswordArray(0)
|
||||
Dim password = usernamePasswordArray(1)
|
||||
unauthorized = Not (userName = Me.UsuarioWSE119 AndAlso password = Me.PasswordWSE119)
|
||||
|
||||
Else
|
||||
respuesta.ErrorMessage = New ResponseMsgError() With {.message = "el usuario y/o contraseña son requeridos"}
|
||||
respuesta.IsSucces = False
|
||||
respuesta.StatusCode = 200
|
||||
|
||||
Return respuesta
|
||||
End If
|
||||
|
||||
If unauthorized Then
|
||||
respuesta.ErrorMessage = New ResponseMsgError() With {.message = "el usuario y/o contraseña no son validos"}
|
||||
respuesta.IsSucces = False
|
||||
respuesta.StatusCode = 200
|
||||
|
||||
Return respuesta
|
||||
Else
|
||||
respuesta.ErrorMessage = Nothing
|
||||
respuesta.IsSucces = True
|
||||
respuesta.StatusCode = 200
|
||||
|
||||
Return respuesta
|
||||
End If
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
Private Function ConsultaDatos(ByVal context As HttpContext) As String
|
||||
Dim Respuesta As New ResponseMsg
|
||||
Dim RespuestaError As New ResponseMsgError
|
||||
Dim TieneError As Boolean = False
|
||||
|
||||
Dim strFecha = If(context.Request("Fecha") = Nothing, "", context.Request("Fecha").ToString())
|
||||
|
||||
If String.IsNullOrEmpty(strFecha) Then
|
||||
RespuestaError.message = "Debe especificar una fecha"
|
||||
context.Response.StatusCode = 200
|
||||
Return JsonConvert.SerializeObject(RespuestaError)
|
||||
End If
|
||||
|
||||
If Not IsDate(strFecha) Then
|
||||
RespuestaError.message = "La fecha no tiene el formato correcto"
|
||||
context.Response.StatusCode = 200
|
||||
Return JsonConvert.SerializeObject(RespuestaError)
|
||||
End If
|
||||
|
||||
Dim Fecha As DateTime = strFecha.ToDateTime()
|
||||
Dim Facturas As JArray = Nothing
|
||||
Dim Stock As JArray = Nothing
|
||||
|
||||
If Fecha > MinFecha Then
|
||||
Using ObjInventario As New ClsInventarios
|
||||
If ObjInventario.GetJAM_BASF_POG(Fecha) AndAlso ObjInventario.DataSetResultados IsNot Nothing Then
|
||||
Facturas = JArray.Parse(ObjInventario.DataSetResultados.Tables(0).DataTableToJSONIPP())
|
||||
Stock = JArray.Parse(ObjInventario.DataSetResultados.Tables(1).DataTableToJSONIPP())
|
||||
Else
|
||||
RespuestaError.message = "no se pudo obtener los datos"
|
||||
TieneError = True
|
||||
End If
|
||||
End Using
|
||||
Else
|
||||
RespuestaError.message = "la fecha no es leida correctamente"
|
||||
TieneError = True
|
||||
End If
|
||||
|
||||
If TieneError Then
|
||||
context.Response.StatusCode = 200
|
||||
Return JsonConvert.SerializeObject(RespuestaError)
|
||||
Else
|
||||
context.Response.StatusCode = 200
|
||||
Try
|
||||
Respuesta.data = New JObject(New JProperty("Facturas", Facturas), New JProperty("Stock", Stock))
|
||||
Respuesta.message = "Los datos se obtuvieron correctamente"
|
||||
Return JsonConvert.SerializeObject(Respuesta)
|
||||
Catch ex As Exception
|
||||
RespuestaError.message = "Ocurrió un error al generar la petición"
|
||||
Return JsonConvert.SerializeObject(RespuestaError)
|
||||
End Try
|
||||
|
||||
End If
|
||||
End Function
|
||||
|
||||
Private Class ResponseMsg
|
||||
Sub New()
|
||||
status = "success"
|
||||
End Sub
|
||||
Public Property status As String
|
||||
Public Property data As Object
|
||||
Public Property message As String
|
||||
End Class
|
||||
|
||||
Private Class ResponseMsgError
|
||||
Sub New()
|
||||
status = "error"
|
||||
End Sub
|
||||
Public Property status As String
|
||||
Public Property message As String
|
||||
End Class
|
||||
|
||||
Private Class AuthMessage
|
||||
Public Property IsSucces As Boolean
|
||||
Public Property ErrorMessage As ResponseMsgError
|
||||
Public Property StatusCode As Integer
|
||||
End Class
|
||||
|
||||
'Private Function ActualizarExistenciasJson(Todos As Boolean) As String
|
||||
' Dim payload = New JObject()
|
||||
|
||||
' Dim CountPeticiones As Integer = 0, CountPeticionesExitosas As Integer = 0
|
||||
|
||||
' Dim DtPS As DataTable = Nothing
|
||||
' Using ObjPS As New ClsProductosServicios
|
||||
' If ObjPS.GetExistenciasEmpresa("-1", CveEmpresa) Then
|
||||
' DtPS = ObjPS.DtResultados.Copy()
|
||||
' End If
|
||||
' End Using
|
||||
|
||||
' If DtPS IsNot Nothing Then
|
||||
' payload.Add(New JProperty("stock", GenerarPayloadExistencias(DtPS)))
|
||||
' End If
|
||||
|
||||
' Return payload.ToString()
|
||||
'End Function
|
||||
|
||||
|
||||
|
||||
Private Function Parametros(Cadena As String) As Hashtable
|
||||
Dim P1() As String = Cadena.Split("&"c)
|
||||
Dim Tmp As String
|
||||
Dim P2() As String
|
||||
|
||||
Dim URLParametros As New Hashtable
|
||||
|
||||
For Each Tmp In P1
|
||||
P2 = Tmp.Replace("%26%", "&").Split("="c)
|
||||
URLParametros.Add(P2(0).ToString.ToUpper, P2(1))
|
||||
Next
|
||||
Return URLParametros
|
||||
End Function
|
||||
|
||||
Private Shared Function IsValidJson(ByVal strInput As String) As Boolean
|
||||
If String.IsNullOrWhiteSpace(strInput) Then
|
||||
Return False
|
||||
End If
|
||||
|
||||
strInput = strInput.Trim()
|
||||
|
||||
If (strInput.StartsWith("{") AndAlso strInput.EndsWith("}")) OrElse (strInput.StartsWith("[") AndAlso strInput.EndsWith("]")) Then
|
||||
|
||||
Try
|
||||
Dim obj = JToken.Parse(strInput)
|
||||
Return True
|
||||
Catch jex As JsonReaderException
|
||||
Console.WriteLine(jex.Message)
|
||||
Return False
|
||||
Catch ex As Exception
|
||||
Console.WriteLine(ex.ToString())
|
||||
Return False
|
||||
End Try
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
End Function
|
||||
|
||||
End Class
|
||||
@@ -4468,6 +4468,15 @@ Partial Class Inventarios_EntradasSalidas
|
||||
End If
|
||||
End If
|
||||
|
||||
Dim RetornoVirtual As MMovimientoVirtual = Nothing
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
||||
RetornoVirtual = GenerarMovimientoVirtual(CveMovimiento, ObjInventario)
|
||||
End If
|
||||
|
||||
If RetornoVirtual IsNot Nothing Then
|
||||
ErrorMovInv = RetornoVirtual.TieneError
|
||||
End If
|
||||
|
||||
If Not ErrorMovInv Then
|
||||
ObjInventario.Commit() ' aplica los movimientos insertados
|
||||
|
||||
|
||||
@@ -613,7 +613,7 @@ Partial Class Inventarios_RecepcionUsados
|
||||
CargaPS()
|
||||
End Sub
|
||||
|
||||
Private Sub CargaAlmacen(Optional CveSubProyecto As Integer = -1, Optional TipoAlmacen As Integer = 22)
|
||||
Private Sub CargaAlmacen(Optional CveSubProyecto As Integer = -1, Optional TipoAlmacen As Integer = 22, Optional BloquearAlmacen As Boolean = False)
|
||||
DdlAlmacen.Items.Clear()
|
||||
'Llenar el dropdownlist de almacén
|
||||
Dim dt As DataTable = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoAlmacen:=TipoAlmacen)
|
||||
@@ -633,6 +633,9 @@ Partial Class Inventarios_RecepcionUsados
|
||||
Dim CveAlmacen As Integer = dt.FiltroPrimeroValor("CveAlmacen", $"CveSubProyecto = {CveSubProyecto}").ToEntero()
|
||||
If CveAlmacen > 0 Then
|
||||
DdlAlmacen.SelectedValueExist(CveAlmacen)
|
||||
If BloquearAlmacen Then
|
||||
DdlAlmacen.Enabled = False
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
@@ -766,10 +769,13 @@ Partial Class Inventarios_RecepcionUsados
|
||||
TmpDTAjustes.Rows.Clear()
|
||||
End If
|
||||
|
||||
RblUsadosAjuste.Enabled = True
|
||||
|
||||
CveRemisionRecibida = -1
|
||||
EsDistribuidor = False
|
||||
DdlClientes.SelectedValueExist("-1")
|
||||
DdlClientes_SelectedIndexChanged(DdlClientes, EventArgs.Empty)
|
||||
InicializaClientes(True)
|
||||
DdlClientes.Enabled = True
|
||||
ChkClientesTodos.Enabled = True
|
||||
|
||||
SiguienteFolio()
|
||||
|
||||
@@ -2024,15 +2030,17 @@ Partial Class Inventarios_RecepcionUsados
|
||||
Protected Sub DdlClientes_SelectedIndexChanged(sender As Object, e As EventArgs)
|
||||
CambiaCliente()
|
||||
End Sub
|
||||
Private Sub CambiaCliente()
|
||||
DivClienteSucursal.Visible = False
|
||||
DdlClientesSucursales.Items.Clear()
|
||||
|
||||
Private Sub CambiaCliente(Optional CargaSucursales As Boolean = True, Optional CargaFacturas As Boolean = True)
|
||||
If DdlClientes.SelectedValue.ToEntero > 0 Then
|
||||
Me.EsDistribuidor = CBool(GlobalDTCliente(UsuarioActual.CveEmpresa, CveCliente:=DdlClientes.SelectedValue.ToEntero()).FiltroPrimeroValor("EsDistribuidor", ""))
|
||||
|
||||
CargaSucursalesCliente()
|
||||
CargaFacturasCliente()
|
||||
If CargaSucursales Then
|
||||
DivClienteSucursal.Visible = False
|
||||
DdlClientesSucursales.Items.Clear()
|
||||
CargaSucursalesCliente()
|
||||
End If
|
||||
If CargaFacturas Then
|
||||
CargaFacturasCliente()
|
||||
End If
|
||||
End If
|
||||
UpGenerales.Update()
|
||||
End Sub
|
||||
@@ -2250,7 +2258,12 @@ Partial Class Inventarios_RecepcionUsados
|
||||
Me.CveRemisionRecibida = -1
|
||||
Me.CveRemisionRecibida = CType(CType(sender, LinkButton).NamingContainer, GridViewRow).DataKey("CveVenta").ToEntero()
|
||||
|
||||
RecibirRemision()
|
||||
If Me.CveRemisionRecibida > 0 Then
|
||||
RecibirRemision()
|
||||
Else
|
||||
Alert("No se pudo recibir la remisión", TipoMensaje.MsgError)
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub RecibirRemision()
|
||||
@@ -2261,7 +2274,7 @@ Partial Class Inventarios_RecepcionUsados
|
||||
Me.ObjFactura = Nothing
|
||||
End If
|
||||
|
||||
Me.ObjFactura = New Modelos.Factura(UsuarioActual, CveRemisionRecibida, UsuarioActual.CveEmpresa, DirectorioServidor:=ModExtensiones.DirectorioBaseEmpresas)
|
||||
Me.ObjFactura = New Modelos.Factura(UsuarioActual, CveRemisionRecibida, UsuarioActual.CveEmpresa, DirectorioServidor:=ModExtensiones.DirectorioBaseEmpresas, CargaDatosCliente:=False, CargaDatosRelacionados:=False)
|
||||
|
||||
If Me.ObjFactura IsNot Nothing Then
|
||||
|
||||
@@ -2271,28 +2284,15 @@ Partial Class Inventarios_RecepcionUsados
|
||||
Dim DtUsados As DataTable = Nothing
|
||||
Dim CveCliente As Integer = -1
|
||||
|
||||
EsDistribuidor = ObjFactura.EsDistribuidor
|
||||
CveCliente = Me.ObjFactura.CveCliente
|
||||
|
||||
Dim ObjVentas As New ClsVentas
|
||||
If ObjVentas.GetVenta(CveRemisionRecibida, UsuarioActual.CveEmpresa) AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then
|
||||
EsDistribuidor = CBool(ObjVentas.DtResultados.Rows(0)("EsDistribuidor").ToString())
|
||||
CveCliente = ObjVentas.DtResultados.Rows(0)("CveCliente").ToString().ToEntero()
|
||||
End If
|
||||
|
||||
If ObjVentas.GetVentasUsadosDetalle(CveRemisionRecibida) Then
|
||||
DtUsados = ObjVentas.DtResultados.Copy()
|
||||
End If
|
||||
|
||||
'RELACIONA LA VENTA DETALLA DE LA REMISION
|
||||
If DtUsados IsNot Nothing Then
|
||||
DtUsados.Columns.Add(New DataColumn("CveVentaDetalle", GetType(Integer)))
|
||||
For Each RowUsado As DataRow In DtUsados.Rows
|
||||
Dim CveVentaDetalle As Integer = Me.ObjFactura.DtDetalle.FiltroPrimeroValor("CveVentaDetalle", $"EsCargo = 1 AND Cantidad = {RowUsado("Cantidad")} AND CvePS = {RowUsado("CvePS")}").ToEntero()
|
||||
If CveVentaDetalle > 0 Then
|
||||
RowUsado("CveVentaDetalle") = CveVentaDetalle
|
||||
End If
|
||||
Next
|
||||
|
||||
End If
|
||||
|
||||
Dim RecepcionValida As Boolean = True
|
||||
|
||||
If ObjVentas.GetVentasUsados(ObjFactura.CveVenta, ObjFactura.CveSubProyecto, ObjFactura.Fecha, UsuarioActual.CveEmpresa, ServicioDomicilio:=ObjFactura.ServicioDomicilio) Then
|
||||
@@ -2312,22 +2312,38 @@ Partial Class Inventarios_RecepcionUsados
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
'RELACIONA LA VENTA DETALLA DE LA REMISION
|
||||
If DtUsados IsNot Nothing Then
|
||||
DtUsados.Columns.Add(New DataColumn("CveVentaDetalle", GetType(Integer)))
|
||||
For Each RowUsado As DataRow In DtUsados.Rows
|
||||
Dim CveVentaDetalle As Integer = Me.ObjFactura.DtDetalle.FiltroPrimeroValor("CveVentaDetalle", $"EsCargo = 1 AND Cantidad = {RowUsado("Cantidad")} AND CvePS = {RowUsado("CvePS")}").ToEntero()
|
||||
If CveVentaDetalle > 0 Then
|
||||
RowUsado("CveVentaDetalle") = CveVentaDetalle
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
|
||||
If ObjFactura.CveSubProyecto > 0 Then
|
||||
CargaAlmacen(CveSubProyecto:=ObjFactura.CveSubProyecto)
|
||||
CargaAlmacen(CveSubProyecto:=ObjFactura.CveSubProyecto, BloquearAlmacen:=True)
|
||||
End If
|
||||
|
||||
If CveCliente > 0 Then
|
||||
DivCliente.Visible = True
|
||||
|
||||
DdlClientes.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa).FiltraParametros(String.Format("CveCliente = {0}", CveCliente))
|
||||
DdlClientes.DataBind()
|
||||
|
||||
DdlClientes.SelectedValueExist(CveCliente)
|
||||
CambiaCliente(False, False)
|
||||
|
||||
DdlClientes.Enabled = False
|
||||
ChkClientesTodos.Enabled = False
|
||||
End If
|
||||
|
||||
RblUsadosAjuste.Enabled = False
|
||||
|
||||
'SI ES DISTRIBUIDOR VAMOS A GENERAR LA REMISION DE NOTA DE CREDITO
|
||||
If EsDistribuidor Then
|
||||
DivCliente.Visible = True
|
||||
DdlClientes.SelectedValueExist(CveCliente)
|
||||
DdlClientes_SelectedIndexChanged(DdlClientes, EventArgs.Empty)
|
||||
|
||||
If Me.ObjRemisionNC IsNot Nothing Then
|
||||
Me.ObjRemisionNC.Dispose()
|
||||
Me.ObjRemisionNC = Nothing
|
||||
@@ -2337,9 +2353,6 @@ Partial Class Inventarios_RecepcionUsados
|
||||
'CreaRemisionNC(ObjFactura.CveCliente, ObjFactura.CveSubProyecto, ObjFactura.CveMoneda)
|
||||
DivTotal.Visible = True
|
||||
End If
|
||||
Else
|
||||
'DivCliente.Visible = False
|
||||
'DivFactura.Visible = False
|
||||
End If
|
||||
|
||||
If DtUsados IsNot Nothing Then
|
||||
|
||||
@@ -578,7 +578,7 @@
|
||||
<asp:HyperLink ID="HypPDF" ToolTip="Formato Timbre" CssClass="btn btn-circle btn-sm btn-xs red mysmallbtn" Visible="false" NavigateUrl="#" runat="server"><i class="fa fa-file-pdf-o"></i></asp:HyperLink>
|
||||
<asp:LinkButton runat="server" ID="LnkTimbrar" CssClass="btn btn-circle btn-sm btn-xs blue mysmallbtn" Text="<i class='fa fa-bell'></i>" OnClick="LnkTimbrar_Click" data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea Timbrar?" data-btn-ok-label="si" />
|
||||
<asp:LinkButton runat="server" ID="Imgdesautorizar" CssClass="btn btn-circle btn-sm btn-xs yellow-gold mysmallbtn" Text="<i class='fa fa-ban'></i>" OnClick="Imgdesautorizar_Click" CommandArgument='<%# Eval("CveNomina") %>' Visible='<%# (Eval("CveNomina").ToString() != "" && Eval("SeTimbro").ToString() == "False"? true :false)%>' data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea eliminar la autorizacion?" data-btn-ok-label="si" />
|
||||
<asp:LinkButton runat="server" ID="ImgDelete" CssClass="btn btn-circle btn-sm btn-xs red mysmallbtn" Text="<i class='icon-trash'></i>" OnClick="ImgDelete_Click" CommandArgument='<%# Eval("CveNomina") %>' Visible='<%# (Eval("CveNomina").ToString() != "" && Eval("SeTimbro").ToString() == "False"? true :false)%>' data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea eliminar la nómina?" data-btn-ok-label="si" />
|
||||
<asp:LinkButton runat="server" ID="ImgDelete" CssClass="btn btn-circle btn-sm btn-xs red mysmallbtn" Text="<i class='icon-trash'></i>" OnClick="ImgDelete_Click" CommandArgument='<%# Eval("CveNomina") %>' Visible='<%# (Eval("CveNomina").ToString() != "" && Eval("SeTimbro").ToString() == "False"? false :false)%>' data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea eliminar la nómina?" data-btn-ok-label="si" />
|
||||
<asp:LinkButton runat="server" ID="LnkCancelar" CssClass="btn btn-circle btn-sm btn-xs yellow-gold mysmallbtn" Text="<i class='fa fa-ban'></i>" OnClick="LnkCancelar_Click" CommandArgument='<%# Eval("CveNomina") %>' Visible='<%# (Eval("CveNomina").ToString() != "" && PermisoCancelarEmitido && Eval("SeTimbro").ToString() == "True"? true :false)%>' data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea cancelar la nómina?" data-btn-ok-label="si" />
|
||||
</div>
|
||||
</ItemTemplate>
|
||||
|
||||
@@ -3372,6 +3372,7 @@
|
||||
<asp:BoundField DataField="IMEI" ItemStyle-Width="20%" HeaderText="IMEI" ItemStyle-HorizontalAlign="Left" />
|
||||
<asp:BoundField DataField="NumeroTelefono" ItemStyle-Width="20%" HeaderText="Número Teléfono" ItemStyle-HorizontalAlign="Center" />
|
||||
<asp:BoundField DataField="FechaIng" DataFormatString="{0:dd/MM/yyyy}" ItemStyle-Width="15%" HeaderText="Fecha Ing" ItemStyle-HorizontalAlign="Left" />
|
||||
<asp:BoundField DataField="FechaBaja" DataFormatString="{0:dd/MM/yyyy}" ItemStyle-Width="15%" HeaderText="Fecha Baja" ItemStyle-HorizontalAlign="Left" />
|
||||
|
||||
<asp:TemplateField HeaderText="Estatus" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle" FooterStyle-VerticalAlign="Middle">
|
||||
<ItemTemplate>
|
||||
|
||||
@@ -510,10 +510,6 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user