diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb index e0d5d3f62..08036f1b9 100644 --- a/App_Code/Modelos.vb +++ b/App_Code/Modelos.vb @@ -14,6 +14,7 @@ Imports System.Net Imports System.IO.Compression Imports System.Text Imports System.Net.Http +Imports System.Collections.Generic Namespace Modelos @@ -539,7 +540,64 @@ Namespace Modelos Public Property CveEstatus As Integer End Class - + Public Function RegenerarPrePolizas(Optional TransaccionCompartida As SqlClient.SqlTransaction = Nothing, Optional ObjACTransac As ClsContPAQi = Nothing) As Boolean + Dim ErrorPrePolizas As Boolean = False + + Dim ObjVentas As ClsVentas = Nothing + If TransaccionCompartida IsNot Nothing Then + ObjVentas = New ClsVentas(TransaccionCompartida) + Else + ObjVentas = New ClsVentas() + ObjVentas.IniciaTransacSQL() + End If + + Dim ObjConta As New ClsContabilidad(ObjVentas.IniciaTransacSQL()) + Dim ObjBancos As New ClsBancos(ObjVentas.IniciaTransacSQL()) + Dim ObjEventos As New ClsOIEventos(ObjVentas.IniciaTransacSQL()) + Dim ObjAC As ClsContPAQi = Nothing + + If ObjACTransac Is Nothing Then + If UsuarioActual.Empresa.UsaAC Then + ObjAC = New ClsContPAQi(UsuarioActual.Empresa) : ObjAC.IniciaTransacSQL() + End If + Else + ObjAC = ObjACTransac + End If + + ErrorPrePolizas = Not RegeneracionPolizas(Me, ObjVentas, ObjAC, ObjConta, ObjBancos, ObjEventos) + + If TransaccionCompartida Is Nothing Then + ObjVentas.Commit() + ObjVentas.Dispose() + ObjBancos.Dispose() + ObjEventos.Dispose() + End If + + If ObjACTransac Is Nothing Then + If ObjAC IsNot Nothing Then + ObjAC.Commit() + ObjAC.Dispose() + End If + End If + + Return Not ErrorPrePolizas + End Function + Private Function RegeneracionPolizas(ObjFactura As Modelos.Factura, ByRef ObjVentas As ClsVentas, ByRef ObjAC As ClsContPAQi, ByRef ObjConta As ClsContabilidad, ObjBancos As ClsBancos, ObjEventos As ClsOIEventos) As Boolean + Dim ErrorPrePolizas As Boolean = False + + 'REMOVEMOS LOS CONCEPTOS DE LA PREPOLIZA + ErrorPrePolizas = Not ObjConta.RemovePrePolizasDetalle(ObjFactura.CvePrePoliza, -1, ObjFactura.CveVenta, 2) + + 'VUELVE A GENERAR LAS PREPOLIZAS + If Not ErrorPrePolizas Then + ErrorPrePolizas = ProcesoPrepolizas(ObjFactura, ObjConta, -1, ObjFactura.DtDetalle, ObjAC, ValorMultiplicador:=1, ObjBancos:=ObjBancos, ObjVentas:=ObjVentas, ObjEventos:=ObjEventos, DtRemisionesRelacionadas:=New DataTable, SeCancelaRemisionProceso:=False, + CancelarRemisiones:=False, ListaRemisionesCancelar:=New List(Of Integer)) + End If + + If Not ErrorPrePolizas Then ErrorPrePolizas = GuardarVentaImpuestosLocales(ObjFactura, ObjVentas, ObjConta, 1) + + Return Not ErrorPrePolizas + End Function Public Function EmitirFactura(Optional Timbrar As Boolean = True, Optional Transac As SqlClient.SqlTransaction = Nothing, Optional ObjContPaqTransac As ClsContPAQi = Nothing) As MMensajeFactura Dim Retorno As New MMensajeFactura() @@ -1059,7 +1117,7 @@ Namespace Modelos Return Retorno End Function - Private Function DescargarFactura(CveVenta As Integer, CveEmpresa As Integer, Optional GetBytes As Boolean = true) As Byte() + Private Function DescargarFactura(CveVenta As Integer, CveEmpresa As Integer, Optional GetBytes As Boolean = True) As Byte() Dim Url = New Uri(String.Format("http://{0}:{1}/Compras/PopUpVerFactura.aspx?P={2}", HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port, Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", CveVenta)))) Dim File As Byte() = Nothing Try @@ -6067,7 +6125,7 @@ Namespace Modelos End Set End Property - Public ReadOnly Property GlobalDTProductosServiciosEquivalencias(CvePS As Integer, CveUM As Integer, CveEmpresa As Integer) As DataTable + Public ReadOnly Property GlobalDTProductosServiciosEquivalencias(CvePS As Integer, CveUM As Integer, CveEmpresa As Integer) As DataTable Get Dim AppNombre As String = String.Format("GlobalDTProductosServiciosEquivalencias{0}", CveEmpresa) @@ -6085,7 +6143,7 @@ Namespace Modelos GlobalDTProductosServiciosEquivalencias = DirectCast(HttpContext.Current.Application(AppNombre), DataTable) End If End Get - + End Property Property GlobalDTProveedorClasificacion(CveEmpresa As Integer) As DataTable Get diff --git a/Ventas/PV.aspx b/Ventas/PV.aspx index d60fe016f..07ff5a1dc 100644 --- a/Ventas/PV.aspx +++ b/Ventas/PV.aspx @@ -621,7 +621,8 @@ - + <%--0--%> @@ -1331,12 +1332,18 @@
- + + + +
+ + +
@@ -2556,7 +2563,7 @@ - + + -
+

@@ -2807,7 +2814,7 @@
-