This commit is contained in:
2024-05-20 08:52:49 -07:00
10 changed files with 366 additions and 112 deletions

View File

@@ -197,8 +197,10 @@ Partial Class Acumuladores_CatFoliosGarantia
DdlSubProyectos.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1) DdlSubProyectos.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1)
DdlSubProyectos.DataBind() DdlSubProyectos.DataBind()
DdlSubProyectos.Items.Insert(0, New ListItem("Todos", "-1")) DdlSubProyectos.Items.Insert(0, New ListItem("Todos", "-1"))
DdlSubProyectos.SelectedValueExist(GvRow.DataKey("CveSubProyecto").ToEntero) DdlSubProyectos.SelectedValueExist(GvRow.DataKey("CveSubProyecto").ToEntero)
DdlArea.SelectedValueExist(GvRow.DataKey("Area"))
BtnAgregarFolioGarantiaModal.Text = "Actualizar" BtnAgregarFolioGarantiaModal.Text = "Actualizar"
UpModalFolioGarantia.Update() UpModalFolioGarantia.Update()

View File

@@ -7,10 +7,10 @@ Imports Extensiones
Public Class ClsAcumuladores Public Class ClsAcumuladores
Implements IDisposable Implements IDisposable
#Region "Campos" #Region "Campos"
'SQL 'SQL
Private SqlConexion As SqlConnection Private SqlConexion As SqlConnection
Private SqlAdapter As SqlDataAdapter Private SqlAdapter As SqlDataAdapter
Private SqlTransacc As SqlTransaction Private SqlTransacc As SqlTransaction
@@ -68,9 +68,9 @@ Public Class ClsAcumuladores
SqlAdapter = New SqlDataAdapter("", SqlConexion) SqlAdapter = New SqlDataAdapter("", SqlConexion)
ConexionAdd() ConexionAdd()
End Sub End Sub
#Region "Conexiones" #Region "Conexiones"
Private Sub ConexionAdd() Private Sub ConexionAdd()
If Not EsTransaccionCompartida AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then If Not EsTransaccionCompartida AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then
Try Try
@@ -103,18 +103,18 @@ Public Class ClsAcumuladores
CveConexion = 0 CveConexion = 0
End If End If
End Sub End Sub
#End Region #End Region
Public ReadOnly Property DtResultados() As DataTable Public ReadOnly Property DtResultados() As DataTable
Get Get
DtResultados = Data DtResultados = Data
End Get End Get
End Property End Property
#End Region #End Region
#Region " TAMAÑOS " #Region " TAMAÑOS "
Public Function TamañoGet(CveTamaño As Integer, CveEmpresa As Integer) As Boolean Public Function TamañoGet(CveTamaño As Integer, CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
'Data = New DataTable 'Data = New DataTable
@@ -270,13 +270,13 @@ Public Class ClsAcumuladores
Return retorno Return retorno
End Function End Function
#End Region #End Region
#Region " TIPOS DEFECTO " #Region " TIPOS DEFECTO "
Public Function TiposDefectoGet(CveTipoDefecto As Integer, CveEmpresa As Integer) As Boolean Public Function TiposDefectoGet(CveTipoDefecto As Integer, CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
'Data = New DataTable 'Data = New DataTable
@@ -375,12 +375,12 @@ Public Class ClsAcumuladores
End Try End Try
Return Retorno Return Retorno
End Function End Function
#End Region #End Region
#Region " TIPOS USO " #Region " TIPOS USO "
Public Function TiposUsoGet(CveTipoUso As Integer, CveEmpresa As Integer) As Boolean Public Function TiposUsoGet(CveTipoUso As Integer, CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
'Data = New DataTable 'Data = New DataTable
@@ -479,12 +479,12 @@ Public Class ClsAcumuladores
End Try End Try
Return Retorno Return Retorno
End Function End Function
#End Region #End Region
#Region " FOLIOS GARANTÍA " #Region " FOLIOS GARANTÍA "
Public Function FoliosGarantiaGet(CveFolioGarantia As Integer, CveEmpresa As Integer, Optional Estatus As Integer = -1, Optional CveSubProyecto As Integer = -1, Optional TipoFolio As String = "-1", Optional Area As Integer = 1) As Boolean Public Function FoliosGarantiaGet(CveFolioGarantia As Integer, CveEmpresa As Integer, Optional Estatus As Integer = -1, Optional CveSubProyecto As Integer = -1, Optional TipoFolio As String = "-1", Optional Area As Integer = 1) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
'Data = New DataTable 'Data = New DataTable
@@ -557,7 +557,7 @@ Public Class ClsAcumuladores
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
.Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto
.Add("@TipoFolio", SqlDbType.VarChar).Value = TipoFolio .Add("@TipoFolio", SqlDbType.VarChar).Value = TipoFolio
.Add("@Limite", SqlDbType.Int).Value = Limite .Add("@Limite", SqlDbType.Int).Value = Limite
.Add("@Area", SqlDbType.Int).Value = Area .Add("@Area", SqlDbType.Int).Value = Area
End With End With
@@ -723,12 +723,12 @@ Public Class ClsAcumuladores
End Try End Try
Return Retorno Return Retorno
End Function End Function
#End Region #End Region
#Region "GARANTIAS DETALLES" #Region "GARANTIAS DETALLES"
Public Function AddGarantiasDetalle(CveVentaDetalle As Integer, CvePS As Integer, CveFolioGarantia As Integer, CveTipoUso As Integer, Public Function AddGarantiasDetalle(CveVentaDetalle As Integer, CvePS As Integer, CveFolioGarantia As Integer, CveTipoUso As Integer,
CodigoEnsamble As String, CodigoLinea As String, CodigoInspeccion As String, CodigoEnsamble As String, CodigoLinea As String, CodigoInspeccion As String,
CveTipoDefecto As Integer, CodigoTD As String, TipoComprobante As Integer, Comprobante As String, Importe As Double, CveTipoDefecto As Integer, CodigoTD As String, TipoComprobante As Integer, Comprobante As String, Importe As Double,
@@ -833,12 +833,12 @@ Public Class ClsAcumuladores
OnError("Ocurrió un error a eliminar de garantia.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) OnError("Ocurrió un error a eliminar de garantia.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try End Try
Return Retorno Return Retorno
End Function End Function
#End Region #End Region
#Region "P O L I Z A - V I R T U A L" #Region "P O L I Z A - V I R T U A L"
Public Function AddPolizaVirtual(CveVenta As Integer, CveVentaDetalle As Integer, CvePS As Integer, Cantidad As Decimal, PU As Decimal, Descuento As Decimal, Total As Decimal, Public Function AddPolizaVirtual(CveVenta As Integer, CveVentaDetalle As Integer, CvePS As Integer, Cantidad As Decimal, PU As Decimal, Descuento As Decimal, Total As Decimal,
TipoServicio As Integer, TipoPoliza As Integer, CveModeloAuto As Integer, AnioVehiculo As Integer, TieneUsado As Boolean, FechaUsado As DateTime, TipoServicio As Integer, TipoPoliza As Integer, CveModeloAuto As Integer, AnioVehiculo As Integer, TieneUsado As Boolean, FechaUsado As DateTime,
@@ -1397,7 +1397,7 @@ Public Class ClsAcumuladores
ConexionClose() ConexionClose()
Dispose(True) Dispose(True)
GC.SuppressFinalize(Me) GC.SuppressFinalize(Me)
End Sub End Sub
#End Region #End Region
End Class End Class

View File

@@ -1338,13 +1338,14 @@ Public Class ClsClientes
Return Retorno Return Retorno
End Function End Function
Public Function GetVentasRemisionesPagos(CveCliente As Integer, Ventas As String) As Boolean Public Function GetVentasRemisionesPagos(CveCliente As Integer, Ventas As String, Optional TipoDocto As String = "Rem") As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
DataAdapter("PA_Vta_VentasRemisionesPagos") DataAdapter("PA_Vta_VentasRemisionesPagos")
With SqlAdapter.SelectCommand.Parameters With SqlAdapter.SelectCommand.Parameters
.Add("@CveCliente", SqlDbType.Int).Value = CveCliente .Add("@CveCliente", SqlDbType.Int).Value = CveCliente
.Add("@Ventas", SqlDbType.VarChar).Value = Ventas .Add("@Ventas", SqlDbType.VarChar).Value = Ventas
.Add("@TipoDocto", SqlDbType.VarChar).Value = TipoDocto
End With End With
Try Try

View File

@@ -654,6 +654,7 @@ Namespace Modelos
End If End If
End Sub End Sub
Public Class MMensajeFactura Public Class MMensajeFactura
Public Property Factura As Modelos.Factura
Sub New() Sub New()
CveVenta = -1 CveVenta = -1
LigaCliente = "" LigaCliente = ""
@@ -1097,7 +1098,7 @@ Namespace Modelos
End If End If
'MENSAJE PRINCIPAL 'MENSAJE PRINCIPAL
MensajeAlert.AppendFormat(String.Format("<br/>La {0}: <b>{1}</b> se generó correctamente.<br/><br/>", Me.TipoDocumento, Me.SerieFolio)) MensajeAlert.AppendFormat(String.Format("<br/>La {0}: <b>{1}</b> se generó correctamente.<br/><br/>", If(Me.TipoDocumento = "Ingresos", "Factura", Me.TipoDocumento), Me.SerieFolio))
' DESCARGA XML - SI SE TIMBRA MANDA CORREO CON FACTURA ' DESCARGA XML - SI SE TIMBRA MANDA CORREO CON FACTURA
@@ -1131,8 +1132,10 @@ Namespace Modelos
End If End If
'ERROR DE NO TIMBRADO 'ERROR DE NO TIMBRADO
If Not SeTimbro And (Me.TipoDocto = "Ing" Or Me.TipoDocto.Contiene("Egs", "Dev") Or Me.TipoDocto = "Ant") Then If Timbrar Then
MensajeAlert.AppendFormat("La factura no se pudo timbrar.</b> Por favor intentelo de nuevo a traves del boton Emitir.") If Not SeTimbro And (Me.TipoDocto = "Ing" Or Me.TipoDocto.Contiene("Egs", "Dev") Or Me.TipoDocto = "Ant") Then
MensajeAlert.AppendFormat("La factura no se pudo timbrar.</b> Por favor intentelo de nuevo a traves del boton Emitir.")
End If
End If End If
'ERROR DE NO TIMBRADO NC 'ERROR DE NO TIMBRADO NC
@@ -3031,9 +3034,67 @@ Namespace Modelos
Private Function ProcesoPrepolizas(ObjFactura As Factura, ByRef ObjConta As ClsContabilidad, CveIE As Integer, TmpDTDetalle As DataTable, Private Function ProcesoPrepolizas(ObjFactura As Factura, ByRef ObjConta As ClsContabilidad, CveIE As Integer, TmpDTDetalle As DataTable,
Optional ValorMultiplicador As Integer = 1, ByRef Optional ObjBancos As ClsBancos = Nothing, ByRef Optional ObjVentas As ClsVentas = Nothing, ByRef Optional ObjEventos As ClsOIEventos = Nothing, Optional ValorMultiplicador As Integer = 1, ByRef Optional ObjBancos As ClsBancos = Nothing, ByRef Optional ObjVentas As ClsVentas = Nothing, ByRef Optional ObjEventos As ClsOIEventos = Nothing,
Optional ByRef DtRemisionesRelacionadas As DataTable = Nothing, Optional SeCancelaRemisionProceso As Boolean = False, Optional CancelarRemisiones As Boolean = False, Optional ListaRemisionesCancelar As List(Of Integer) = Nothing, Optional ByRef DtRemisionesRelacionadas As DataTable = Nothing, Optional SeCancelaRemisionProceso As Boolean = False, Optional CancelarRemisiones As Boolean = False, Optional ListaRemisionesCancelar As List(Of Integer) = Nothing,
Optional CveEstatusRefacturacion As Integer = 0, Optional ByRef ObjInventario As ClsInventarios = Nothing, Optional FechaCancelacion As DateTime = MinFecha) As Boolean Optional CveEstatusRefacturacion As Integer = 0, Optional ByRef ObjInventario As ClsInventarios = Nothing, Optional FechaCancelacion As DateTime = MinFecha, Optional ObjClientes As ClsClientes = Nothing,
Optional AplicaCancelacionConPagos As Boolean = False) As Boolean
Dim ErrorPrepoliza As Boolean = False Dim ErrorPrepoliza As Boolean = False
Try Try
If ObjFactura.TipoDocto.Contiene("Ing", "Rem") AndAlso AplicaCancelacionConPagos AndAlso ValorMultiplicador = -1 Then
Dim DtPagosVenta As DataTable = Nothing
If ObjClientes IsNot Nothing Then
If ObjClientes.GetVentasRemisionesPagos(CveCliente, Me.CveVenta.ToString(), ObjFactura.TipoDocto) Then
DtPagosVenta = ObjClientes.DtResultados.Copy()
Else
ErrorPrepoliza = True
End If
Else
ErrorPrepoliza = True
End If
'CANCELAR PAGO DE INGRESO
If Not ErrorPrepoliza AndAlso DtPagosVenta IsNot Nothing Then
Dim VentaActual As New ClsPaginas.Venta(ObjFactura, UsuarioActual)
For Each DrPago As DataRow In DtPagosVenta.Rows
'SI ES PAGO DE BANCOS, CANCELAR EL IE
If DrPago("TipoPago").ToString() = "B" Then
ErrorPrepoliza = ObjBancos.CancelarBancos_IE(UsuarioActual.CveUsuario, DrPago("CveIE").ToString().ToEntero(), False, -1, -1, Now) <= 0
Else
'RESTAR SALDOS APLICADOS
Dim Importe As Decimal = DrPago("Importe").ToString().ToDecimal() * -1
Dim Pago As New ClsPaginas.VentaPago
Pago.Fecha = Now
Pago.FechaDocumentoRelacionado = DrPago("FechaDocumento").ToString().ToDate
Pago.ImportePagoVenta = Importe
Pago.ImportePago = Importe
Pago.CveIE = DrPago("CveIE").ToString().ToEntero()
Pago.CveMonedaPago = DrPago("CveMoneda").ToString().ToEntero()
Pago.TCPago = DrPago("TipoCambio").ToString().ToDecimal()
Pago.AplicaTraslado = False
Pago.Referencia = DrPago("Folio").ToString()
Pago.CveVentaAmortizacion = DrPago("CveVenta").ToString().ToEntero()
Pago.TipoPago = DrPago("TipoPago").ToString()
Pago.CveClientePago = ObjFactura.CveCliente
ErrorPrepoliza = ClsPaginas.AplicaPrePolizaPagoVenta(VentaActual, Pago, ObjFactura.CvePrePoliza, ObjConta, AplicarConceptoAplicacion:=True)
End If
If ErrorPrepoliza Then
Exit For
End If
Next
End If
If ErrorPrepoliza Then
Return ErrorPrepoliza
End If
End If
Dim DT As DataTable Dim DT As DataTable
Dim CvePlantilaPoliza As Integer Dim CvePlantilaPoliza As Integer
Dim PorcentajeAmortizacion As Decimal = 0 Dim PorcentajeAmortizacion As Decimal = 0
@@ -4206,6 +4267,7 @@ Namespace Modelos
'REGRESA SALDO A LAS REMISIONES QUE SE FACTURARON EN EL INGRESO QUE SE ESTA CANCELANDO 'REGRESA SALDO A LAS REMISIONES QUE SE FACTURARON EN EL INGRESO QUE SE ESTA CANCELANDO
'SE DEBE DE EXCLUIR CUANDO ES REFACTURACIÓN 'SE DEBE DE EXCLUIR CUANDO ES REFACTURACIÓN
If ObjFactura.TipoDocto = "Ing" And ValorMultiplicador = -1 AndAlso CveEstatusRefacturacion = 0 AndAlso Not SeCancelaRemisionProceso AndAlso DtRemisionesRelacionadas IsNot Nothing Then ' se debe de excluir cuando es refacturación If ObjFactura.TipoDocto = "Ing" And ValorMultiplicador = -1 AndAlso CveEstatusRefacturacion = 0 AndAlso Not SeCancelaRemisionProceso AndAlso DtRemisionesRelacionadas IsNot Nothing Then ' se debe de excluir cuando es refacturación
For Each Dr As DataRow In DtRemisionesRelacionadas.Rows For Each Dr As DataRow In DtRemisionesRelacionadas.Rows
Dim DebeCancelar As Boolean = CancelarRemisiones AndAlso ListaRemisionesCancelar.Any(Function(CveRemision) CveRemision = Dr("CveVenta").ToString.ToEntero()) Dim DebeCancelar As Boolean = CancelarRemisiones AndAlso ListaRemisionesCancelar.Any(Function(CveRemision) CveRemision = Dr("CveVenta").ToString.ToEntero())
@@ -5427,7 +5489,7 @@ Namespace Modelos
''' <param name="FechaCancelacion"></param> ''' <param name="FechaCancelacion"></param>
''' <param name="AcuseCancelacion"></param> ''' <param name="AcuseCancelacion"></param>
''' <returns></returns> ''' <returns></returns>
Public Function EjecutarCancelacionPendiente(CveEstatus As Integer, FechaCancelacion As DateTime, AcuseCancelacion As String, Optional ValidarSAT As Boolean = True) As MCancelacionVentaMensaje Public Function EjecutarCancelacionPendiente(CveEstatus As Integer, FechaCancelacion As DateTime, AcuseCancelacion As String, Optional ValidarSAT As Boolean = True, Optional AplicaCancelacionConPagos As Boolean = False) As MCancelacionVentaMensaje
Dim ListaRemisionesCancelar As New List(Of Integer) Dim ListaRemisionesCancelar As New List(Of Integer)
Dim ObjVentas As New ClsVentas() Dim ObjVentas As New ClsVentas()
If ObjVentas.GetRemisionesXCancelar(Me.CveVenta) Then If ObjVentas.GetRemisionesXCancelar(Me.CveVenta) Then
@@ -5437,7 +5499,7 @@ Namespace Modelos
End If End If
ObjVentas.Dispose() ObjVentas.Dispose()
Return CancelarVenta(Me, Me.UsuarioActual, RealizarDevolucionAlmacen:=Me.RealizarDevolucionAlmacen, ListaRemisionesCancelar:=ListaRemisionesCancelar, CveEstatusFacturaAsignado:=CveEstatus, FechaCancelacion:=FechaCancelacion.ToString("dd/MM/yyyy hh:mm:ss"), AcuseCancelacion:=AcuseCancelacion, CveMotivoCancelacion:=Me.CveMotivoCancelacion, MotivoCancelacion:=Me.MotivoCancelacion, ValidarSAT:=ValidarSAT) Return CancelarVenta(Me, Me.UsuarioActual, RealizarDevolucionAlmacen:=Me.RealizarDevolucionAlmacen, ListaRemisionesCancelar:=ListaRemisionesCancelar, CveEstatusFacturaAsignado:=CveEstatus, FechaCancelacion:=FechaCancelacion.ToString("dd/MM/yyyy hh:mm:ss"), AcuseCancelacion:=AcuseCancelacion, CveMotivoCancelacion:=Me.CveMotivoCancelacion, MotivoCancelacion:=Me.MotivoCancelacion, ValidarSAT:=ValidarSAT, AplicaCancelacionConPagos:=AplicaCancelacionConPagos)
End Function End Function
''' <summary> ''' <summary>
''' Cancela la factura para poder realizar la refacturacion ''' Cancela la factura para poder realizar la refacturacion
@@ -5452,15 +5514,16 @@ Namespace Modelos
''' <param name="RealizarDevolucionAlmacen"></param> ''' <param name="RealizarDevolucionAlmacen"></param>
''' <param name="ListaRemisionesCancelar"></param> ''' <param name="ListaRemisionesCancelar"></param>
''' <returns></returns> ''' <returns></returns>
Public Function CancelarFactura(RealizarDevolucionAlmacen As Boolean, Optional ListaRemisionesCancelar As List(Of Integer) = Nothing, Optional CveMotivoCancelacion As Integer = -1, Optional Motivo As String = "", Optional ValidarSAT As Boolean = True, Optional CveEstadoCancelacion As Integer = 0, Optional CancelarBoletos As Boolean = False) As MCancelacionVentaMensaje Public Function CancelarFactura(RealizarDevolucionAlmacen As Boolean, Optional ListaRemisionesCancelar As List(Of Integer) = Nothing, Optional CveMotivoCancelacion As Integer = -1, Optional Motivo As String = "", Optional ValidarSAT As Boolean = True, Optional CveEstadoCancelacion As Integer = 0, Optional CancelarBoletos As Boolean = False, Optional AplicaCancelacionConPagos As Boolean = False) As MCancelacionVentaMensaje
'Comprobante emitido con errores sin relación 'Comprobante emitido con errores sin relación
Return CancelarVenta(Me, Me.UsuarioActual, RealizarDevolucionAlmacen:=RealizarDevolucionAlmacen, ListaRemisionesCancelar:=ListaRemisionesCancelar, CveMotivoCancelacion:=CveMotivoCancelacion, MotivoCancelacion:=Motivo, CveEstadoCancelacion:=CveEstadoCancelacion, CancelarBoletos:=CancelarBoletos) Return CancelarVenta(Me, Me.UsuarioActual, RealizarDevolucionAlmacen:=RealizarDevolucionAlmacen, ListaRemisionesCancelar:=ListaRemisionesCancelar, CveMotivoCancelacion:=CveMotivoCancelacion, MotivoCancelacion:=Motivo, CveEstadoCancelacion:=CveEstadoCancelacion, CancelarBoletos:=CancelarBoletos, AplicaCancelacionConPagos:=AplicaCancelacionConPagos)
End Function End Function
Private Function CancelarVenta(ObjFactura As Modelos.Factura, UsuarioActual As Usuario, Optional EsRefacturacion As Boolean = False, Optional RealizarDevolucionAlmacen As Boolean = False, Private Function CancelarVenta(ObjFactura As Modelos.Factura, UsuarioActual As Usuario, Optional EsRefacturacion As Boolean = False, Optional RealizarDevolucionAlmacen As Boolean = False,
Optional ListaRemisionesCancelar As List(Of Integer) = Nothing, Optional CveEstatusFacturaAsignado As Integer = -1, Optional FechaCancelacion As String = "-1", Optional ListaRemisionesCancelar As List(Of Integer) = Nothing, Optional CveEstatusFacturaAsignado As Integer = -1, Optional FechaCancelacion As String = "-1",
Optional AcuseCancelacion As String = "", Optional CveMotivoCancelacion As Integer = -1, Optional MotivoCancelacion As String = "", Optional AcuseCancelacion As String = "", Optional CveMotivoCancelacion As Integer = -1, Optional MotivoCancelacion As String = "",
Optional FolioSustitucion As String = "", Optional ValidarSAT As Boolean = True, Optional CveEstadoCancelacion As Integer = 0, Optional CancelarBoletos As Boolean = False) As MCancelacionVentaMensaje Optional FolioSustitucion As String = "", Optional ValidarSAT As Boolean = True, Optional CveEstadoCancelacion As Integer = 0,
Optional CancelarBoletos As Boolean = False, Optional AplicaCancelacionConPagos As Boolean = False) As MCancelacionVentaMensaje
Dim Retorno As New MCancelacionVentaMensaje() Dim Retorno As New MCancelacionVentaMensaje()
Dim ErrorList As New List(Of String) Dim ErrorList As New List(Of String)
@@ -5519,7 +5582,7 @@ Namespace Modelos
End If End If
'VALIDA QUE LA FACTURA NO TENGA PAGOS 'VALIDA QUE LA FACTURA NO TENGA PAGOS
If Not AplicaRefacturacionConPagos AndAlso ObjFactura.TipoDocto.Contiene("Ing", "Rem") AndAlso ObjFactura.Pagado > 0 Then If Not AplicaRefacturacionConPagos AndAlso Not AplicaCancelacionConPagos AndAlso ObjFactura.TipoDocto.Contiene("Ing", "Rem") AndAlso ObjFactura.Pagado > 0 Then
Retorno.Mensaje = "La factura no se puede cancelar debido a que tiene pagos vinculados." Retorno.Mensaje = "La factura no se puede cancelar debido a que tiene pagos vinculados."
Retorno.TipoMensaje = TipoMensaje.MsgAdvertencia Retorno.TipoMensaje = TipoMensaje.MsgAdvertencia
@@ -5922,6 +5985,7 @@ Namespace Modelos
Dim ObjContrato As New ClsContratos(ObjVentas.IniciaTransacSQL()) Dim ObjContrato As New ClsContratos(ObjVentas.IniciaTransacSQL())
Dim ObjEventos As New ClsOIEventos(ObjVentas.IniciaTransacSQL()) Dim ObjEventos As New ClsOIEventos(ObjVentas.IniciaTransacSQL())
Dim ObjAcum As New ClsAcumuladores(ObjVentas.IniciaTransacSQL()) Dim ObjAcum As New ClsAcumuladores(ObjVentas.IniciaTransacSQL())
Dim ObjClientes As New ClsClientes(ObjVentas.IniciaTransacSQL())
Try Try
If ObjFactura.TipoDocto.Contiene("Egs", "Dev") Then If ObjFactura.TipoDocto.Contiene("Egs", "Dev") Then
@@ -5933,7 +5997,7 @@ Namespace Modelos
End If End If
'CUANDO LA CANCELACION ESTA EN PROCESO NO DEBE REALIZAR NADA DE ESTE PROCESO 'CUANDO LA CANCELACION ESTA EN PROCESO NO DEBE REALIZAR NADA DE ESTE PROCESO
If Not AplicaRefacturacionConPagos AndAlso ((((ObjFactura.Saldo > 0 AndAlso (CveEstatus > 0 AndAlso Not CveEstatus.Contiene(20, 23))) OrElse (ObjFactura.Total = 0 AndAlso UsuarioActual.CveEmpresa.Contiene(72) AndAlso ObjFactura.TipoDocto.Contiene("Ing"))) AndAlso CveEstatus.Contiene(4, 5)) OrElse (CvePlantillaPoliza = 7 AndAlso (CveEstatus > 0 AndAlso Not CveEstatus.Contiene(20, 23)))) Then If Not AplicaRefacturacionConPagos AndAlso (((((ObjFactura.Saldo > 0 OrElse AplicaCancelacionConPagos) AndAlso (CveEstatus > 0 AndAlso Not CveEstatus.Contiene(20, 23))) OrElse (ObjFactura.Total = 0 AndAlso UsuarioActual.CveEmpresa.Contiene(72) AndAlso ObjFactura.TipoDocto.Contiene("Ing"))) AndAlso CveEstatus.Contiene(4, 5)) OrElse (CvePlantillaPoliza = 7 AndAlso (CveEstatus > 0 AndAlso Not CveEstatus.Contiene(20, 23)))) Then
'CUANDO SE CANCELA, LA PÓLIZA DEBE DE SER DE DIARIO 'CUANDO SE CANCELA, LA PÓLIZA DEBE DE SER DE DIARIO
CvePrePoliza = ObjConta.AddPrePolizas("Modelos/CancelarDocumento", CvePlantillaPoliza, ObjFactura.Total, ObjFactura.Total, ObjFactura.CveMoneda, CancelacionFecha, ObjFactura.Cliente.Nombre, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoPoliza:=3, TipoContable:=ObjFactura.TipoContable) CvePrePoliza = ObjConta.AddPrePolizas("Modelos/CancelarDocumento", CvePlantillaPoliza, ObjFactura.Total, ObjFactura.Total, ObjFactura.CveMoneda, CancelacionFecha, ObjFactura.Cliente.Nombre, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoPoliza:=3, TipoContable:=ObjFactura.TipoContable)
@@ -5957,7 +6021,8 @@ Namespace Modelos
'CANCELA PREPOLIZA 'CANCELA PREPOLIZA
If Not ErrorCancelar Then If Not ErrorCancelar Then
ErrorCancelar = ProcesoPrepolizas(ObjFactura, ObjConta, -1, ObjFactura.DtDetalle, -1, ObjBancos, ObjVentas, ObjEventos, DtRemisionesRelacionadas:=DtRemisionesRelacionadas, SeCancelaRemisionProceso:=SeCancelaRemisionProceso, ErrorCancelar = ProcesoPrepolizas(ObjFactura, ObjConta, -1, ObjFactura.DtDetalle, -1, ObjBancos, ObjVentas, ObjEventos, DtRemisionesRelacionadas:=DtRemisionesRelacionadas, SeCancelaRemisionProceso:=SeCancelaRemisionProceso,
CancelarRemisiones:=CancelarRemisiones, ListaRemisionesCancelar:=ListaRemisionesCancelar, CveEstatusRefacturacion:=CveEstatusRefacturacion, ObjInventario:=ObjInventario, FechaCancelacion:=CancelacionFecha) CancelarRemisiones:=CancelarRemisiones, ListaRemisionesCancelar:=ListaRemisionesCancelar, CveEstatusRefacturacion:=CveEstatusRefacturacion, ObjInventario:=ObjInventario, FechaCancelacion:=CancelacionFecha,
ObjClientes:=ObjClientes, AplicaCancelacionConPagos:=AplicaCancelacionConPagos)
MensajeError = "Ocurrió un error al generar la prepoliza de cancelación." MensajeError = "Ocurrió un error al generar la prepoliza de cancelación."
End If End If

Binary file not shown.

View File

@@ -780,7 +780,6 @@
<PaddingTop>=IIf(rownumber(nothing) = 1, "2pt", "0pt")</PaddingTop> <PaddingTop>=IIf(rownumber(nothing) = 1, "2pt", "0pt")</PaddingTop>
</Style> </Style>
</Textbox> </Textbox>
<rd:Selected>true</rd:Selected>
</CellContents> </CellContents>
</TablixCell> </TablixCell>
<TablixCell> <TablixCell>
@@ -1588,7 +1587,7 @@
</TablixCells> </TablixCells>
</TablixRow> </TablixRow>
<TablixRow> <TablixRow>
<Height>0.33542cm</Height> <Height>0.2825cm</Height>
<TablixCells> <TablixCells>
<TablixCell> <TablixCell>
<CellContents> <CellContents>
@@ -1972,7 +1971,7 @@
<DataSetName>DsInventarios</DataSetName> <DataSetName>DsInventarios</DataSetName>
<Top>0.14111cm</Top> <Top>0.14111cm</Top>
<Left>0.10068cm</Left> <Left>0.10068cm</Left>
<Height>3.1562cm</Height> <Height>3.10328cm</Height>
<Width>25.45761cm</Width> <Width>25.45761cm</Width>
<Style> <Style>
<Border> <Border>
@@ -2048,6 +2047,18 @@
<PaddingBottom>2pt</PaddingBottom> <PaddingBottom>2pt</PaddingBottom>
</Style> </Style>
</Textbox> </Textbox>
<Line Name="Line4">
<Top>4.79214cm</Top>
<Left>0.10068cm</Left>
<Height>0cm</Height>
<Width>25.72414cm</Width>
<ZIndex>2</ZIndex>
<Style>
<Border>
<Style>Solid</Style>
</Border>
</Style>
</Line>
</ReportItems> </ReportItems>
<Height>1.88667in</Height> <Height>1.88667in</Height>
<Style /> <Style />
@@ -2055,7 +2066,7 @@
<Width>10.19535in</Width> <Width>10.19535in</Width>
<Page> <Page>
<PageHeader> <PageHeader>
<Height>4.44499cm</Height> <Height>4.55082cm</Height>
<PrintOnFirstPage>true</PrintOnFirstPage> <PrintOnFirstPage>true</PrintOnFirstPage>
<PrintOnLastPage>true</PrintOnLastPage> <PrintOnLastPage>true</PrintOnLastPage>
<ReportItems> <ReportItems>
@@ -2544,7 +2555,7 @@ Municipio y/o Delegación: </Value>
<rd:DefaultName>Textbox7</rd:DefaultName> <rd:DefaultName>Textbox7</rd:DefaultName>
<Top>2.32101cm</Top> <Top>2.32101cm</Top>
<Left>0.13678cm</Left> <Left>0.13678cm</Left>
<Height>2.12398cm</Height> <Height>2.05342cm</Height>
<Width>20.93288cm</Width> <Width>20.93288cm</Width>
<ZIndex>9</ZIndex> <ZIndex>9</ZIndex>
<Style> <Style>
@@ -2565,7 +2576,7 @@ Municipio y/o Delegación: </Value>
</Style> </Style>
</PageHeader> </PageHeader>
<PageFooter> <PageFooter>
<Height>3.8269cm</Height> <Height>2.5569cm</Height>
<PrintOnFirstPage>true</PrintOnFirstPage> <PrintOnFirstPage>true</PrintOnFirstPage>
<PrintOnLastPage>true</PrintOnLastPage> <PrintOnLastPage>true</PrintOnLastPage>
<ReportItems> <ReportItems>
@@ -2588,7 +2599,7 @@ Municipio y/o Delegación: </Value>
</Paragraph> </Paragraph>
</Paragraphs> </Paragraphs>
<rd:DefaultName>Textbox21</rd:DefaultName> <rd:DefaultName>Textbox21</rd:DefaultName>
<Top>1.37766cm</Top> <Top>0.74266cm</Top>
<Left>5.68986cm</Left> <Left>5.68986cm</Left>
<Height>0.50243cm</Height> <Height>0.50243cm</Height>
<Width>5.79375cm</Width> <Width>5.79375cm</Width>
@@ -2624,7 +2635,7 @@ Municipio y/o Delegación: </Value>
</Paragraph> </Paragraph>
</Paragraphs> </Paragraphs>
<rd:DefaultName>Textbox21</rd:DefaultName> <rd:DefaultName>Textbox21</rd:DefaultName>
<Top>1.37766cm</Top> <Top>0.74266cm</Top>
<Left>14.40467cm</Left> <Left>14.40467cm</Left>
<Height>0.50243cm</Height> <Height>0.50243cm</Height>
<Width>5.78664cm</Width> <Width>5.78664cm</Width>
@@ -2675,9 +2686,9 @@ Municipio y/o Delegación: </Value>
</Paragraph> </Paragraph>
</Paragraphs> </Paragraphs>
<rd:DefaultName>Textbox21</rd:DefaultName> <rd:DefaultName>Textbox21</rd:DefaultName>
<Top>1.66375cm</Top> <Top>1.02875cm</Top>
<Left>5.69781cm</Left> <Left>5.69781cm</Left>
<Height>1.2cm</Height> <Height>0.82958cm</Height>
<Width>5.78664cm</Width> <Width>5.78664cm</Width>
<ZIndex>2</ZIndex> <ZIndex>2</ZIndex>
<Visibility> <Visibility>
@@ -2726,9 +2737,9 @@ Municipio y/o Delegación: </Value>
</Paragraph> </Paragraph>
</Paragraphs> </Paragraphs>
<rd:DefaultName>Textbox21</rd:DefaultName> <rd:DefaultName>Textbox21</rd:DefaultName>
<Top>1.6632cm</Top> <Top>1.0282cm</Top>
<Left>14.41177cm</Left> <Left>14.41177cm</Left>
<Height>1.2cm</Height> <Height>0.82958cm</Height>
<Width>5.78664cm</Width> <Width>5.78664cm</Width>
<ZIndex>3</ZIndex> <ZIndex>3</ZIndex>
<Visibility> <Visibility>
@@ -2763,7 +2774,7 @@ Municipio y/o Delegación: </Value>
</Paragraph> </Paragraph>
</Paragraphs> </Paragraphs>
<rd:DefaultName>Textbox22</rd:DefaultName> <rd:DefaultName>Textbox22</rd:DefaultName>
<Top>0.07331cm</Top> <Top>0.04156cm</Top>
<Left>5.69781cm</Left> <Left>5.69781cm</Left>
<Height>0.6cm</Height> <Height>0.6cm</Height>
<Width>5.78664cm</Width> <Width>5.78664cm</Width>
@@ -2800,7 +2811,7 @@ Municipio y/o Delegación: </Value>
</Paragraph> </Paragraph>
</Paragraphs> </Paragraphs>
<rd:DefaultName>Textbox22</rd:DefaultName> <rd:DefaultName>Textbox22</rd:DefaultName>
<Top>0.07331cm</Top> <Top>0.04156cm</Top>
<Left>14.41177cm</Left> <Left>14.41177cm</Left>
<Height>0.6cm</Height> <Height>0.6cm</Height>
<Width>5.78664cm</Width> <Width>5.78664cm</Width>
@@ -2835,7 +2846,7 @@ Municipio y/o Delegación: </Value>
</Paragraph> </Paragraph>
</Paragraphs> </Paragraphs>
<rd:DefaultName>Textbox21</rd:DefaultName> <rd:DefaultName>Textbox21</rd:DefaultName>
<Top>0.45106cm</Top> <Top>0.41931cm</Top>
<Left>10.04017cm</Left> <Left>10.04017cm</Left>
<Height>0.63528cm</Height> <Height>0.63528cm</Height>
<Width>5.78664cm</Width> <Width>5.78664cm</Width>
@@ -2886,9 +2897,9 @@ Municipio y/o Delegación: </Value>
</Paragraph> </Paragraph>
</Paragraphs> </Paragraphs>
<rd:DefaultName>Textbox21</rd:DefaultName> <rd:DefaultName>Textbox21</rd:DefaultName>
<Top>1.6632cm</Top> <Top>1.0282cm</Top>
<Left>10.04727cm</Left> <Left>10.04727cm</Left>
<Height>1.2cm</Height> <Height>0.82958cm</Height>
<Width>5.78664cm</Width> <Width>5.78664cm</Width>
<ZIndex>7</ZIndex> <ZIndex>7</ZIndex>
<Visibility> <Visibility>
@@ -2923,7 +2934,7 @@ Municipio y/o Delegación: </Value>
</Paragraph> </Paragraph>
</Paragraphs> </Paragraphs>
<rd:DefaultName>Textbox22</rd:DefaultName> <rd:DefaultName>Textbox22</rd:DefaultName>
<Top>0.07331cm</Top> <Top>0.04156cm</Top>
<Left>10.04727cm</Left> <Left>10.04727cm</Left>
<Height>0.6cm</Height> <Height>0.6cm</Height>
<Width>5.78664cm</Width> <Width>5.78664cm</Width>
@@ -2971,7 +2982,7 @@ Municipio y/o Delegación: </Value>
</Paragraph> </Paragraph>
</Paragraphs> </Paragraphs>
<rd:DefaultName>Textbox29</rd:DefaultName> <rd:DefaultName>Textbox29</rd:DefaultName>
<Top>3.40709cm</Top> <Top>2.13709cm</Top>
<Left>0.10068cm</Left> <Left>0.10068cm</Left>
<Height>0.41981cm</Height> <Height>0.41981cm</Height>
<Width>5.78083cm</Width> <Width>5.78083cm</Width>
@@ -3009,7 +3020,7 @@ Municipio y/o Delegación: </Value>
</Paragraph> </Paragraph>
</Paragraphs> </Paragraphs>
<rd:DefaultName>Textbox31</rd:DefaultName> <rd:DefaultName>Textbox31</rd:DefaultName>
<Top>3.40709cm</Top> <Top>2.13709cm</Top>
<Left>11.33129cm</Left> <Left>11.33129cm</Left>
<Height>0.41981cm</Height> <Height>0.41981cm</Height>
<Width>5.13762cm</Width> <Width>5.13762cm</Width>
@@ -3035,23 +3046,12 @@ Municipio y/o Delegación: </Value>
</Border> </Border>
</Style> </Style>
</Line> </Line>
<Line Name="Line4">
<Left>0.13678cm</Left>
<Height>0cm</Height>
<Width>25.72414cm</Width>
<ZIndex>12</ZIndex>
<Style>
<Border>
<Style>Solid</Style>
</Border>
</Style>
</Line>
<Line Name="Line6"> <Line Name="Line6">
<Top>3.26597cm</Top> <Top>1.99597cm</Top>
<Left>0.10068cm</Left> <Left>0.10068cm</Left>
<Height>0cm</Height> <Height>0cm</Height>
<Width>25.76024cm</Width> <Width>25.76024cm</Width>
<ZIndex>13</ZIndex> <ZIndex>12</ZIndex>
<Style> <Style>
<Border> <Border>
<Style>Solid</Style> <Style>Solid</Style>
@@ -3077,11 +3077,11 @@ Municipio y/o Delegación: </Value>
</Paragraph> </Paragraph>
</Paragraphs> </Paragraphs>
<rd:DefaultName>Textbox10</rd:DefaultName> <rd:DefaultName>Textbox10</rd:DefaultName>
<Top>3.40709cm</Top> <Top>2.13709cm</Top>
<Left>23.00537cm</Left> <Left>23.00537cm</Left>
<Height>0.41981cm</Height> <Height>0.41981cm</Height>
<Width>2.55292cm</Width> <Width>2.55292cm</Width>
<ZIndex>14</ZIndex> <ZIndex>13</ZIndex>
<Style> <Style>
<Border> <Border>
<Style>None</Style> <Style>None</Style>

View File

@@ -695,7 +695,7 @@ Partial Class Inventarios_EntregaAlmacen
TipoMovimiento = If(TipoDocto.Contiene({"Rem", "Ped", "Ing", "Ped", "PeC", "Ant"}) And (EsDevolucionVenta = 0 Or CveVentaAD > 0), 1, 2) TipoMovimiento = If(TipoDocto.Contiene({"Rem", "Ped", "Ing", "Ped", "PeC", "Ant"}) And (EsDevolucionVenta = 0 Or CveVentaAD > 0), 1, 2)
If UsuarioActual.Empresa.Funcionalidad(578).ToEntero = 1 AndAlso TipoDocto.Contiene("Ped", "Ing") Then If UsuarioActual.Empresa.Funcionalidad(578).ToEntero = 1 AndAlso TipoDocto.Contiene("Ped", "Ing") Then
TxtObservaciones.Text = $"Dr. {drE("Medico").ToString}{vbCrLf}Cx. {drE("Procedimiento").ToString}{vbCrLf}F. Cirugía {drE("FechaEjecucion").ToString.ToDateTime.ToString("dd/MM/yyyy HH:mm")}{vbCrLf}H. {drE("Sucursal").ToString}{vbCrLf}" TxtObservaciones.Text = $"Dr. {drE("Medico").ToString}{vbCrLf}Cx. {drE("Procedimiento").ToString}{vbCrLf}F. Cirugía {drE("FechaParaSurtir").ToString.ToDateTime.ToString("dd/MM/yyyy HH:mm")}{vbCrLf}H. {drE("Sucursal").ToString}{vbCrLf}"
TxtObservaciones.Rows = 4 TxtObservaciones.Rows = 4
End If End If
@@ -2258,8 +2258,22 @@ Partial Class Inventarios_EntregaAlmacen
If ObjInventario.GetExistenciasPSXML(StrXML.ToString(), DdlAlmacen.SelectedValue.ToEntero(), TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), CveSubProyecto, CveVendedor, If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), If(TipoEntrega = 2, 1, -1), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then If ObjInventario.GetExistenciasPSXML(StrXML.ToString(), DdlAlmacen.SelectedValue.ToEntero(), TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), CveSubProyecto, CveVendedor, If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), If(TipoEntrega = 2, 1, -1), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
If ObjInventario.DtResultados.Rows.Count > 0 Then If ObjInventario.DtResultados.Rows.Count > 0 Then
TieneErrorExistencia = True TieneErrorExistencia = True
For Each Dr As DataRow In ObjInventario.DtResultados.Rows For Each Dr As DataRow In ObjInventario.DtResultados.Rows
TextoError.AppendFormat("<b> - {0}</b> Existencia: {1:#,##0.##} <br/>", Dr("CodigoPS"), Dr("Existencia"))
Dim SerieLoteCaducidad As String = ","
If Dr("Serie").ToString.Trim.Length > 0 AndAlso Dr("Serie").ToString.Trim <> "-1" Then
SerieLoteCaducidad = $" Serie: { Dr("Serie").ToString.Trim}"
End If
If Dr("Lote").ToString.Trim.Length > 0 AndAlso Dr("Lote").ToString.Trim <> "-1" Then
SerieLoteCaducidad = $"{SerieLoteCaducidad} Lote: {Dr("Lote").ToString.Trim}"
End If
If Dr("FechaCaducidad").ToString.Trim.Length > 0 AndAlso Dr("FechaCaducidad").ToString.Trim <> "-1" Then
SerieLoteCaducidad = $"{SerieLoteCaducidad} Caducidad: { Dr("FechaCaducidad").ToString.Trim.ToDate.ToString("dd/MM/yyyy")}"
End If
TextoError.AppendFormat("<b> - {0}</b> Existencia: {1:#,##0.##} {2}<br/>", Dr("CodigoPS"), Dr("Existencia"), If(SerieLoteCaducidad <> ",", SerieLoteCaducidad, ""))
Next Next
End If End If
Else Else

View File

@@ -397,7 +397,7 @@ Partial Class Ventas_PVCobranza
If DbRowVenta IsNot Nothing Then If DbRowVenta IsNot Nothing Then
Dim VentaActual As New Venta(UsuarioActual) Dim VentaActual As New Venta(UsuarioActual)
VentaActual.CveVenta = CveVenta VentaActual.CveVenta = CveVenta
VentaActual.TipoDocto = DbRowVenta("TipoDocto").ToString
VentaActual.Fecha = DbRowVenta("Fecha").ToString.ToDate VentaActual.Fecha = DbRowVenta("Fecha").ToString.ToDate
VentaActual.CveCliente = DbRowVenta("CveCliente").ToString.ToEntero VentaActual.CveCliente = DbRowVenta("CveCliente").ToString.ToEntero
VentaActual.CveMoneda = DbRowVenta("CveMoneda").ToString.ToEntero VentaActual.CveMoneda = DbRowVenta("CveMoneda").ToString.ToEntero
@@ -422,10 +422,30 @@ Partial Class Ventas_PVCobranza
Dim SaldoTotalInicial As Decimal = DbRowVenta("Saldo").ToString.ToDecimal Dim SaldoTotalInicial As Decimal = DbRowVenta("Saldo").ToString.ToDecimal
Dim PagoAplicado As Decimal = 0 Dim PagoAplicado As Decimal = 0
Dim ObjConta As New ClsContabilidad Dim ObjVentas2 As New ClsVentas()
Dim ObjIE As New ClsBancos(ObjConta.IniciaTransacSQL()) Dim ObjIE As New ClsBancos(ObjVentas2.IniciaTransacSQL())
Dim ObjVentas2 As New ClsVentas(ObjConta.IniciaTransacSQL()) Dim ObjConta As New ClsContabilidad(ObjVentas2.IniciaTransacSQL())
Dim ObjClientes As New ClsClientes(ObjVentas2.IniciaTransacSQL())
Dim respFactura As Modelos.Factura.MMensajeFactura = Nothing
Try Try
'FACTURAR LA REMISION PARA HACER EL PAGO
If UsuarioActual.CveEmpresa = 193 AndAlso VentaActual.TipoDocto = "Rem" Then
respFactura = GenerarFactura(VentaActual, ObjVentas2, ObjClientes)
If respFactura Is Nothing Then
MsgError = "Ocurrío un error al generar la factura"
ElseIf (respFactura IsNot Nothing AndAlso respFactura.Mensajes.Count > 0) AndAlso respFactura.TieneError Then
MsgError = respFactura.Mensajes(0)
End If
'REALIZAR EL PAGO EN LA FACTURA
If respFactura IsNot Nothing AndAlso Not respFactura.TieneError Then
CveVenta = respFactura.CveVenta
End If
End If
CvePrePoliza = ObjConta.AddPrePolizas("PVCobranza", 11, 0, 0, 1, Fecha, $"Pago {VentaActual.SerieFolio}", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoPoliza:=3) CvePrePoliza = ObjConta.AddPrePolizas("PVCobranza", 11, 0, 0, 1, Fecha, $"Pago {VentaActual.SerieFolio}", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoPoliza:=3)
If CvePrePoliza > 0 Then If CvePrePoliza > 0 Then
@@ -487,21 +507,41 @@ Partial Class Ventas_PVCobranza
End Try End Try
If MsgError = "" Then If MsgError = "" Then
ObjConta.Commit() ObjVentas2.Commit()
Alert($"Pago Registrado correctamente.<br/><br/> <a href=""/Compras/PopUpVerFactura.aspx?P={Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1&TICKET=1&REGENERAR=1", CveVenta))}"" class='Texto'>Imprimir ticket</a>", TipoMensaje.MsgInformacion)
'SI SE GENERO FACTURA DE INGRESO, TIMBRARLA DESPUES DE REALIZAR EL PAGO
If respFactura IsNot Nothing Then
If Not respFactura.Factura.TimbrarFactura() Then
Alert("La factura no se pudo timbrar", TipoMensaje.MsgAdvertencia)
End If
End If
Dim msBuild As New StringBuilder()
If respFactura IsNot Nothing Then
msBuild.Append($"Pago Registrado correctamente.")
For Each m In respFactura.Mensajes
msBuild.AppendFormat("<br/> {0}", m)
Next
Else
msBuild.Append($"Pago Registrado correctamente.<br/><br/> <a href=""/Compras/PopUpVerFactura.aspx?P={Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1&TICKET=1&REGENERAR=1", CveVenta))}"" class='Texto'>Imprimir ticket</a>")
End If
Alert(msBuild.ToString(), TipoMensaje.MsgInformacion)
Else Else
ObjConta.RollBack() ObjVentas2.RollBack()
Alert(MsgError, TipoMensaje.MsgError) Alert(MsgError, TipoMensaje.MsgError)
End If End If
ObjVentas2.Dispose()
ObjConta.Dispose() ObjConta.Dispose()
ObjIE.Dispose() ObjIE.Dispose()
ObjVentas2.Dispose() ObjClientes.Dispose()
If MsgError = "" Then If MsgError = "" Then
Try Try
If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then
ImpresionDirectaPDF(HdnCveVenta.Value.ToEntero) ImpresionDirectaPDF(CveVenta)
End If End If
PnlContado.Visible = False PnlContado.Visible = False
@@ -517,6 +557,113 @@ Partial Class Ventas_PVCobranza
End Sub End Sub
Private Function GenerarFactura(ByRef VentaRemision As Venta, ByRef ObjVentas As ClsVentas, ByRef ObjClientes As ClsClientes) As Modelos.Factura.MMensajeFactura
Dim Retorno As Modelos.Factura.MMensajeFactura = Nothing
Dim DtRemisiones As New DataTable
DtRemisiones.Columns.Add(New DataColumn("CveVenta", GetType(Integer)))
DtRemisiones.Columns.Add(New DataColumn("SerieFolio", GetType(String)))
DtRemisiones.Rows.Add({VentaRemision.CveVenta, VentaRemision.SerieFolio})
Dim RemisionesLista As New List(Of Integer)
RemisionesLista.Add(VentaRemision.CveVenta)
Dim DtRemisionesPS As New DataTable()
Dim DtPagosFacturaGlobal As New DataTable()
If ObjClientes.GetVentasRemisionesTotales(VentaRemision.CveCliente, VentaRemision.CveVenta.ToString(), 1) Then
DtRemisionesPS = ObjClientes.DtResultados.Copy()
End If
Dim ObjFactura = Modelos.Factura.CrearVentaNueva(UsuarioActual, VentaRemision.CveSubProyecto, VentaRemision.CveCliente, VentaRemision.CveMoneda, "Ing")
ObjFactura.RemisionesLista = RemisionesLista
ObjFactura.DtRemisionesPS = DtRemisionesPS
ObjFactura.DtRemisiones = DtRemisiones
For Each Dr As DataRow In ObjFactura.DtRemisionesPS.Rows
ObjFactura.AgregarPS(Dr("CvePS").ToString().ToEntero(), Dr("Cantidad").ToString().ToDecimal(), Dr("PU").ToString().ToDecimal(), Dr("Descuento").ToString().ToDecimal, Dr("Obs").ToString(), CveUM:=Dr("CveUM").ToString().ToEntero(),
CveProyecto:=Dr("CveProyecto").ToString().ToEntero(), CveSubProyecto:=Dr("CveSubProyecto").ToString().ToEntero(), CveVentaDetallePadre:=Dr("CveVentaDetalle").ToString().ToEntero(), CveVentaDetalleRemision:=Dr("CveVentaDetalle").ToString().ToEntero(),
PorcentajeIVA:=Dr("PorcentajeIVA").ToString().ToDecimal())
Next
ObjFactura.GenerarSalidaAlmacen = True
ObjFactura.DtInventario = ObjFactura.DtDetalle.FiltraParametros("CveTipoPS = 2").Copy()
ObjFactura.CveAlmacen = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveAlmacen", $"CveTipoAlmacen = 1 AND CveSubProyecto = {VentaRemision.CveSubProyecto}").ToString().ToEntero()
ObjFactura.CalculaTotales()
ObjFactura.PreparaTimbre()
Dim SbAlert As New StringBuilder()
Try
Retorno = ObjFactura.EmitirFactura(False, Transac:=ObjVentas.IniciaTransacSQL(), Modulo:="Cobranza/GuardarVenta")
Retorno.Factura = ObjFactura
If Retorno IsNot Nothing AndAlso Retorno.CveVenta > 0 Then
For Each msg In Retorno.Mensajes
SbAlert.AppendFormat("{0} <br/>", msg)
Next
SbAlert.AppendFormat("<ul><li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar PDF Factura</a></li></ul><br/>", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", Retorno.CveVenta)))
Else
SbAlert.Append("Ocurrió un error al generar la factura")
End If
Catch ex As Exception
SbAlert.Append("Ocurrió un error al generar el documento")
GuardaLog(ex.ToString())
End Try
If Retorno IsNot Nothing AndAlso Retorno.Mensajes IsNot Nothing AndAlso Retorno.Mensajes.Count > 0 Then
Retorno.Mensajes.Clear()
Retorno.Mensajes.Add(SbAlert.ToString())
If Not Retorno.TieneError Then
'CONVERTIR LA REMISION EN OBJETO DE FACTURA DE INGRESO, PARA HACER EL PAGO EN LA FACTURA
VentaRemision = Nothing
If ObjVentas.GetVenta(Retorno.CveVenta, UsuarioActual.CveEmpresa) Then
Dim DbRowVenta = ObjVentas.DtResultados.Copy().FiltroPrimero("")
If DbRowVenta IsNot Nothing Then
Dim VentaActual As New Venta(UsuarioActual)
VentaActual.CveVenta = Retorno.CveVenta
VentaActual.TipoDocto = DbRowVenta("TipoDocto").ToString
VentaActual.Fecha = DbRowVenta("Fecha").ToString.ToDate
VentaActual.CveCliente = DbRowVenta("CveCliente").ToString.ToEntero
VentaActual.CveMoneda = DbRowVenta("CveMoneda").ToString.ToEntero
VentaActual.SerieFolio = DbRowVenta("SerieFolio").ToString
VentaActual.ClienteNombre = DbRowVenta("ClienteNombre").ToString
VentaActual.TC = DbRowVenta("TipoCambio").ToString.ToDecimal
VentaActual.Total = DbRowVenta("Total").ToString.ToDecimal
VentaActual.IVA = DbRowVenta("IVA").ToString.ToDecimal
VentaActual.IEPS = DbRowVenta("IEPS").ToString.ToDecimal
VentaActual.RetIVA = DbRowVenta("RetIVA").ToString.ToDecimal
VentaActual.RetISR = DbRowVenta("RetISR").ToString.ToDecimal
VentaActual.PorcentajeIVA = DbRowVenta("PorcentajeIVA").ToString.ToDecimal
VentaActual.UsuarioActual = UsuarioActual
VentaActual.CveSubProyecto = DbRowVenta("CveSubProyecto").ToString.ToEntero
VentaRemision = VentaActual
End If
End If
End If
Else
Retorno = New Modelos.Factura.MMensajeFactura()
Retorno.TieneError = True
If SbAlert.Length = 0 Then
SbAlert.Append("Ocurrió un error al generar la factura")
End If
Retorno.Mensajes.Add(SbAlert.ToString())
End If
Return Retorno
End Function
Private Function RegistraIE(Metodo As Integer, CveBancoCuenta As Integer, ImportePago As Decimal, Fecha As Date, CvePrePoliza As Integer, VentaActual As Venta, ByRef ObjIE As ClsBancos, ByRef ObjConta As ClsContabilidad, ByRef ObjVentas As ClsVentas) As String Private Function RegistraIE(Metodo As Integer, CveBancoCuenta As Integer, ImportePago As Decimal, Fecha As Date, CvePrePoliza As Integer, VentaActual As Venta, ByRef ObjIE As ClsBancos, ByRef ObjConta As ClsContabilidad, ByRef ObjVentas As ClsVentas) As String
Dim Retorno As String = "" Dim Retorno As String = ""
Dim CveIEPago As Integer = 0 Dim CveIEPago As Integer = 0
@@ -761,17 +908,25 @@ Partial Class Ventas_PVCobranza
Dim ExistePDF As Boolean = False Dim ExistePDF As Boolean = False
Dim ArchivoPDF As String = "" Dim ArchivoPDF As String = ""
Dim AplicaTicket As Boolean = ObjFactura.CveEmpresa.Contiene(190, 192)
If ObjFactura.TipoDocto = "Ing" Then If ObjFactura.TipoDocto = "Ing" Then
ArchivoPDF = String.Format("{0}/PDF/{1}/{2}_Ticket.pdf", UsuarioActual.Empresa.Ruta, ObjFactura.TipoDocto, ObjFactura.SerieFolio) If AplicaTicket Then
ArchivoPDF = String.Format("{0}/PDF/{1}/{2}_Ticket.pdf", UsuarioActual.Empresa.Ruta, ObjFactura.TipoDocto, ObjFactura.SerieFolio)
Else
ArchivoPDF = String.Format("{0}/PDF/{1}/{2}.pdf", UsuarioActual.Empresa.Ruta, ObjFactura.TipoDocto, ObjFactura.SerieFolio)
End If
Else Else
ArchivoPDF = String.Format("{0}/PDF/{1}/{2}.pdf", UsuarioActual.Empresa.Ruta, ObjFactura.TipoDocto, ObjFactura.SerieFolio) ArchivoPDF = String.Format("{0}/PDF/{1}/{2}.pdf", UsuarioActual.Empresa.Ruta, ObjFactura.TipoDocto, ObjFactura.SerieFolio)
End If End If
If File.Exists(ArchivoPDF) AndAlso ObjFactura.TipoDocto = "Rem" Then If File.Exists(ArchivoPDF) AndAlso ObjFactura.TipoDocto = "Rem" Then
ExistePDF = True ExistePDF = True
Else Else
'REGENERAR EL PDF 'REGENERAR EL PDF
Try Try
GenerarPDFVenta(CveVenta, AplicaPagare:="1", GuardarPDF:=True, RegenerarPDF:=True, DescargarArchivo:=False, EsTicket:=True) GenerarPDFVenta(CveVenta, AplicaPagare:="1", GuardarPDF:=True, RegenerarPDF:=True, DescargarArchivo:=False, EsTicket:=AplicaTicket)
If File.Exists(ArchivoPDF) Then If File.Exists(ArchivoPDF) Then
ExistePDF = True ExistePDF = True
End If End If

View File

@@ -631,10 +631,10 @@
<asp:TextBox ID="TxtFolioRemision" runat="server" Style="width: 130px" MaxLength="20" Enabled="false"></asp:TextBox> <asp:TextBox ID="TxtFolioRemision" runat="server" Style="width: 130px" MaxLength="20" Enabled="false"></asp:TextBox>
</td> </td>
<td runat="server" id="Td10" > <td runat="server" id="Td10" >
<b>Tipo de Venta:</b>
</td> </td>
<td runat="server"> <td runat="server">
<asp:Label runat="server" ID="LblTipoVenta"></asp:Label>
</td> </td>
</tr> </tr>
</table> </table>

View File

@@ -5072,7 +5072,7 @@ Partial Class Ventas
' End If ' End If
'End If 'End If
'si utiliza cortes, y cajas, no permitir cancelar de días anteriores 'si utiliza cortes, y cajas, no permitir cancelar de días anteriores
If UsuarioActual.Empresa.Funcionalidad(109) = "1" AndAlso DbRowVenta("Fecha").ToString.ToDate.ToShortDateString.ToDate < Now.ToShortDateString.ToDate Then If UsuarioActual.CveRol <> 1 AndAlso UsuarioActual.Empresa.Funcionalidad(109) = "1" AndAlso DbRowVenta("Fecha").ToString.ToDate.ToShortDateString.ToDate < Now.ToShortDateString.ToDate Then
LbCancelarDocumento.Visible = False LbCancelarDocumento.Visible = False
End If End If
End If End If
@@ -6173,6 +6173,10 @@ Partial Class Ventas
TxtPaciente.Enabled = False TxtPaciente.Enabled = False
TxtEpisodio.Enabled = False TxtEpisodio.Enabled = False
TrVentasMedicas4.Visible = True
TxtFolioRemision.Text = DbRowVenta("Alfa1").ToString
LblTipoVenta.Text = DbRowVenta("TipoVenta").ToString
If DbRowVenta("FechaParaSurtir").ToString().ToDate() > DateTime.MinValue Then If DbRowVenta("FechaParaSurtir").ToString().ToDate() > DateTime.MinValue Then
TrVentasMedicas2.Visible = True TrVentasMedicas2.Visible = True
@@ -6181,12 +6185,9 @@ Partial Class Ventas
TxtFechaOS.Text = DbRowVenta("FechaParaSurtir").ToString().ToDateTime().ToString("yyyy-MM-dd HH:mm").Replace(" ", "T") TxtFechaOS.Text = DbRowVenta("FechaParaSurtir").ToString().ToDateTime().ToString("yyyy-MM-dd HH:mm").Replace(" ", "T")
End If End If
End If End If
If DdlTipoDocto.SelectedValue.Contiene("Ing", "Rem") Then
TrVentasMedicas4.Visible = True
TxtFolioRemision.Text = DbRowVenta("Alfa1").ToString
End If
End If End If
End If End If
End Using End Using
@@ -8612,6 +8613,9 @@ Partial Class Ventas
'If UsuarioActual.CveEmpresa = 119 Then 'If UsuarioActual.CveEmpresa = 119 Then
' e.Row.FCTextBox("TxtDescuento").Enabled = False ' e.Row.FCTextBox("TxtDescuento").Enabled = False
'End If 'End If
Else Else
'MODO NORMAL 'MODO NORMAL
@@ -8760,11 +8764,13 @@ Partial Class Ventas
End If End If
If EsVentaMedica Then If EsVentaMedica Then
GvPS.Rows(e.NewEditIndex).FCTextBox("TxtPrecio").Enabled = False GvPS.Rows(e.NewEditIndex).FCTextBox("TxtPrecio").Enabled = False
If DdlTipoComprobante.SelectedValue = "Cot" Then If DdlTipoComprobante.SelectedValue = "Cot" Or RBLTipoVenta.SelectedValue.ToEntero = 1 Then
GvPS.Rows(e.NewEditIndex).FCTextBox("TxtPrecio").Enabled = True GvPS.Rows(e.NewEditIndex).FCTextBox("TxtPrecio").Enabled = True
End If End If
End If End If
If CveCicloComercial > 0 Then If CveCicloComercial > 0 Then
@@ -17676,7 +17682,7 @@ Partial Class Ventas
If EsVentaMedica Then If EsVentaMedica Then
TxtPrecio.Enabled = False TxtPrecio.Enabled = False
If UsuarioActual.CveUsuario = 3986 Then If UsuarioActual.CveUsuario = 3986 Or RBLTipoVenta.SelectedValue.ToEntero = 1 Then
TxtPrecio.Enabled = True TxtPrecio.Enabled = True
End If End If
@@ -22799,8 +22805,9 @@ Partial Class Ventas
End If End If
End If End If
TxtAtencionA.Enabled = True
UpCliente.Update()
UPPVentas.Update() UPPVentas.Update()
UpPS.Update() UpPS.Update()
UpCliente.Update() UpCliente.Update()
@@ -23473,8 +23480,8 @@ Partial Class Ventas
' DdlCuentaTarjetaDebito.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND (CveTipoCuenta <> 1 OR TieneTerminal = 1)", If(DdlMoneda.SelectedValue.ToEntero() <= 0, 1, DdlMoneda.SelectedValue.ToEntero()))) ' DdlCuentaTarjetaDebito.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND (CveTipoCuenta <> 1 OR TieneTerminal = 1)", If(DdlMoneda.SelectedValue.ToEntero() <= 0, 1, DdlMoneda.SelectedValue.ToEntero())))
'End If 'End If
If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then If UsuarioActual.Empresa.Funcionalidad(109) = "1" OrElse UsuarioActual.CveEmpresa = 195 Then
DdlCuentaTransferencia.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0}", If(DdlMoneda.SelectedValue.ToEntero() <= 0, 1, DdlMoneda.SelectedValue.ToEntero()))) DdlCuentaTransferencia.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta = 1", If(DdlMoneda.SelectedValue.ToEntero() <= 0, 1, DdlMoneda.SelectedValue.ToEntero())))
Else Else
DdlCuentaTransferencia.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta <> 1", If(DdlMoneda.SelectedValue.ToEntero() <= 0, 1, DdlMoneda.SelectedValue.ToEntero()))) DdlCuentaTransferencia.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta <> 1", If(DdlMoneda.SelectedValue.ToEntero() <= 0, 1, DdlMoneda.SelectedValue.ToEntero())))
End If End If
@@ -25595,7 +25602,13 @@ Partial Class Ventas
ChkDevAlm.Checked = True ChkDevAlm.Checked = True
End If End If
resp = ObjFacturaCancelacion.CancelarFactura(ChkDevAlm.Checked, ListaRemisionesCancelar, CveMotivoCancelacion:=DdlMotivoCancelacion.SelectedValue.ToEntero(), Motivo:=TxtMotivoCancelacion.Text.Trim(), CveEstadoCancelacion:=Me.CveEstadoCancelacion) Dim AplicaCancelacionConPagos As Boolean = False
If UsuarioActual.CveRol = 1 AndAlso UsuarioActual.Empresa.Funcionalidad(109) = "1" AndAlso ObjFactura.TipoDocto.Contiene("Ing", "Rem") AndAlso Not EsRefacturacion AndAlso ObjFactura.Pagado > 0 Then
AplicaCancelacionConPagos = True
End If
resp = ObjFacturaCancelacion.CancelarFactura(ChkDevAlm.Checked, ListaRemisionesCancelar, CveMotivoCancelacion:=DdlMotivoCancelacion.SelectedValue.ToEntero(), Motivo:=TxtMotivoCancelacion.Text.Trim(), CveEstadoCancelacion:=Me.CveEstadoCancelacion, AplicaCancelacionConPagos:=AplicaCancelacionConPagos)
strMensaje.Append(resp.Mensaje) strMensaje.Append(resp.Mensaje)
Dim DtBonificaciones As DataTable = Nothing Dim DtBonificaciones As DataTable = Nothing
@@ -37779,6 +37792,10 @@ Partial Class Ventas
AsignaAlmacenWS() AsignaAlmacenWS()
'CargaPS(-1, DdlPS) 'CargaPS(-1, DdlPS)
End If End If
If RBLTipoVenta.SelectedValue.Contiene("1") Then
TxtPrecio.Enabled = True
UpPS.Update()
End If
RegistraScript("$('#DvModalTipoVenta').modal('hide');") RegistraScript("$('#DvModalTipoVenta').modal('hide');")
UpCliente.Update() UpCliente.Update()