--FIX varios
This commit is contained in:
@@ -504,6 +504,7 @@ Partial Class Ventas_PVCobranza
|
||||
VentaActual.PorcentajeIVA = DbRowVenta("PorcentajeIVA").ToString.ToDecimal
|
||||
VentaActual.UsuarioActual = UsuarioActual
|
||||
VentaActual.CveSubProyecto = DbRowVenta("CveSubProyecto").ToString.ToEntero
|
||||
Dim CveVendedor As Integer = DbRowVenta("CveVendedor").ToString.ToEntero
|
||||
|
||||
If tCveCorte <= 0 AndAlso DbRowVenta("CveCorte").ToString.ToEntero > 0 Then tCveCorte = DbRowVenta("CveCorte").ToString.ToEntero
|
||||
|
||||
@@ -529,7 +530,7 @@ Partial Class Ventas_PVCobranza
|
||||
|
||||
CveVentaRemision = HdnCveVenta.Value.ToEntero
|
||||
|
||||
respFactura = GenerarFactura(VentaActual, ObjVentas2, ObjClientes)
|
||||
respFactura = GenerarFactura(CveVendedor, VentaActual, ObjVentas2, ObjClientes)
|
||||
|
||||
If respFactura Is Nothing Then
|
||||
MsgError = "Ocurrió un error al generar la factura"
|
||||
@@ -552,7 +553,7 @@ Partial Class Ventas_PVCobranza
|
||||
|
||||
'GENERAR NC PARA AMORTIZACION
|
||||
If MsgError = "" AndAlso UsuarioActual.CveEmpresa.Contiene(189) AndAlso HdnTipoAmortizacion.Value = "2" Then
|
||||
respNC = GenerarNC(VentaActual, ObjVentas2)
|
||||
respNC = GenerarNC(CveVendedor, VentaActual, ObjVentas2)
|
||||
|
||||
If respNC IsNot Nothing Then
|
||||
If respNC.TieneError Then
|
||||
@@ -760,7 +761,7 @@ Partial Class Ventas_PVCobranza
|
||||
UpL.Update()
|
||||
End Sub
|
||||
|
||||
Private Function GenerarFactura(ByRef VentaRemision As Venta, ByRef ObjVentas As ClsVentas, ByRef ObjClientes As ClsClientes) As Modelos.Factura.MMensajeFactura
|
||||
Private Function GenerarFactura(CveVendedor As Integer, ByRef VentaRemision As Venta, ByRef ObjVentas As ClsVentas, ByRef ObjClientes As ClsClientes) As Modelos.Factura.MMensajeFactura
|
||||
Dim Retorno As Modelos.Factura.MMensajeFactura = Nothing
|
||||
Dim SbAlert As New StringBuilder()
|
||||
|
||||
@@ -878,6 +879,8 @@ Partial Class Ventas_PVCobranza
|
||||
ObjFactura.DtAnticiposAplicados = DtAnticipos
|
||||
End If
|
||||
|
||||
ObjFactura.CveVendedor = CveVendedor
|
||||
|
||||
Retorno = ObjFactura.EmitirFactura(False, Transac:=ObjVentas.IniciaTransacSQL(), Modulo:="Cobranza/GuardarVenta", MostrarURL:=True)
|
||||
Retorno.Factura = ObjFactura
|
||||
|
||||
@@ -945,7 +948,7 @@ Partial Class Ventas_PVCobranza
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Private Function GenerarNC(ByRef Venta As Venta, ByRef ObjVentas As ClsVentas) As Modelos.Factura.MMensajeFactura
|
||||
Private Function GenerarNC(CveVendedor As Integer, ByRef Venta As Venta, ByRef ObjVentas As ClsVentas) As Modelos.Factura.MMensajeFactura
|
||||
Dim Retorno As Modelos.Factura.MMensajeFactura = Nothing
|
||||
Dim SbAlert As New StringBuilder()
|
||||
|
||||
@@ -1026,6 +1029,8 @@ Partial Class Ventas_PVCobranza
|
||||
ObjNC.CveMetodoPago33 = 1
|
||||
ObjNC.CveMetodoPago = 1
|
||||
|
||||
ObjNC.CveVendedor = CveVendedor
|
||||
|
||||
Retorno = ObjNC.EmitirFactura(False, Transac:=ObjVentas.IniciaTransacSQL(), Modulo:="Cobranza/GuardarVenta", MostrarURL:=True)
|
||||
Retorno.Factura = ObjNC
|
||||
|
||||
@@ -1127,34 +1132,39 @@ Partial Class Ventas_PVCobranza
|
||||
|
||||
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, tCveCorte As Integer, Optional Obs As String = "", Optional CveAutorizacion As String = "", Optional CveSubProyecto As Integer = -1) As String
|
||||
Dim Retorno As String = ""
|
||||
Dim CveIEPago As Integer = 0
|
||||
Dim ErrorConta As Boolean
|
||||
If String.IsNullOrEmpty(Obs) Then
|
||||
Obs = VentaActual.SerieFolio
|
||||
If CveBancoCuenta > 0 Then
|
||||
Dim CveIEPago As Integer = 0
|
||||
Dim ErrorConta As Boolean
|
||||
If String.IsNullOrEmpty(Obs) Then
|
||||
Obs = VentaActual.SerieFolio
|
||||
End If
|
||||
CveIEPago = ObjIE.AddBancos_IE(CveBancoCuenta, Metodo, Fecha, "-1", VentaActual.ClienteNombre, ImportePago, 1, 1, Obs, "", False, True, 0, CvePrePoliza, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCorte:=tCveCorte, CveAutorizacion:=CveAutorizacion, CveSubProyecto:=CveSubProyecto)
|
||||
If CveIEPago > 0 Then
|
||||
Dim Pago As New VentaPago
|
||||
Pago.ImportePagoVenta = ImportePago
|
||||
Pago.ImportePago = ImportePago
|
||||
Pago.CveIE = CveIEPago
|
||||
Pago.CveMonedaPago = VentaActual.CveMoneda
|
||||
Pago.Fecha = NowADS()
|
||||
Pago.Referencia = VentaActual.SerieFolio
|
||||
|
||||
ErrorConta = AplicaPrePolizaPagoVenta(VentaActual, Pago, CvePrePoliza, ObjConta)
|
||||
If ErrorConta Then
|
||||
Retorno = "Error en aplicación de pago"
|
||||
End If
|
||||
Dim MetodoPago As Integer = If(Metodo = 13, 1, If(Metodo = 12, 4, If(Metodo = 11, 5, If(Metodo = 3, 2, 3))))
|
||||
If Not ErrorConta AndAlso Not ObjVentas.AddVta_VentaPago(VentaActual.CveVenta, MetodoPago, ImportePago) Then
|
||||
Retorno = "Error en aplicación de pago.."
|
||||
ErrorConta = True
|
||||
End If
|
||||
Else
|
||||
Retorno = "Pago en Bancos no registrado"
|
||||
ErrorConta = True
|
||||
End If
|
||||
Else
|
||||
Retorno = "No se ha especificado la cuenta"
|
||||
End If
|
||||
CveIEPago = ObjIE.AddBancos_IE(CveBancoCuenta, Metodo, Fecha, "-1", VentaActual.ClienteNombre, ImportePago, 1, 1, Obs, "", False, True, 0, CvePrePoliza, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCorte:=tCveCorte, CveAutorizacion:=CveAutorizacion, CveSubProyecto:=CveSubProyecto)
|
||||
If CveIEPago > 0 Then
|
||||
Dim Pago As New VentaPago
|
||||
Pago.ImportePagoVenta = ImportePago
|
||||
Pago.ImportePago = ImportePago
|
||||
Pago.CveIE = CveIEPago
|
||||
Pago.CveMonedaPago = VentaActual.CveMoneda
|
||||
Pago.Fecha = NowADS()
|
||||
Pago.Referencia = VentaActual.SerieFolio
|
||||
|
||||
ErrorConta = AplicaPrePolizaPagoVenta(VentaActual, Pago, CvePrePoliza, ObjConta)
|
||||
If ErrorConta Then
|
||||
Retorno = "Error en aplicación de pago"
|
||||
End If
|
||||
Dim MetodoPago As Integer = If(Metodo = 13, 1, If(Metodo = 12, 4, If(Metodo = 11, 5, If(Metodo = 3, 2, 3))))
|
||||
If Not ErrorConta AndAlso Not ObjVentas.AddVta_VentaPago(VentaActual.CveVenta, MetodoPago, ImportePago) Then
|
||||
Retorno = "Error en aplicación de pago.."
|
||||
ErrorConta = True
|
||||
End If
|
||||
Else
|
||||
Retorno = "Pago en Bancos no registrado"
|
||||
ErrorConta = True
|
||||
End If
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Reference in New Issue
Block a user