--FIX varios

This commit is contained in:
2024-12-13 11:17:32 -07:00
parent 65761b0069
commit aea0408671
2 changed files with 98 additions and 67 deletions

View File

@@ -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

View File

@@ -6848,6 +6848,8 @@ Partial Class Ventas
RBLPago.Items(0).Enabled = True
Dim CveUsoCFDICliente As Integer = -1
Dim ObjCliente As New ClsClientes()
If ObjCliente.GetClientes(CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa, Estatus, TipoCliente:=-1) Then
@@ -7001,46 +7003,10 @@ Partial Class Ventas
DdlMetodoPago33.Enabled = True
End If
Dim CveCotizacion As Integer = IfNull(ViewState("CveCotizacion"), 0).ToString().ToEntero()
Me.CveMetodoPago33Cliente = ObjCliente.CveMetodoPago33
Me.CveFormaPago33Cliente = ObjCliente.CveFormaPago33
If (CveVenta <= 0 AndAlso CveCotizacion <= 0) Or EsCreaApartirDe Or NuevaFactura = 1 OrElse ModalidadEdicion Then
'CveMetodoPagoCliente = ObjCliente.CveMetodoPago
If UsuarioActual.Empresa.Funcionalidad(589) = "1" Then
'SI EL METODO DE PAGO ES PUE, SELECCIONA CONTADO
If Me.CveMetodoPago33Cliente = 1 Then
RBLPago.SelectedValue = "2"
ElseIf Me.CveMetodoPago33Cliente = 3 Then
RBLPago.SelectedValue = "1"
End If
RBLPago_SelectedIndexChanged(RBLPago, Nothing)
UPCondicionesPago.Update()
Else
DdlMetodoPago33.SelectedValueExist(ObjCliente.CveMetodoPago33)
CambiaMetodoPago33()
DdlFormaPago33.SelectedValueExist(ObjCliente.CveFormaPago33)
End If
DdlUsoCFDI.SelectedValueExist(ObjCliente.CveUsoCFDI)
'SI ES RFC GENERICO NO TIENE OBLIGACIONES FISCALES
If LblRFC.Text.Contiene("XAXX010101000", "XEXX010101000") Then
'S01 Sin efectos fiscales.
DdlUsoCFDI.SelectedValueExist("23")
DdlUsoCFDI.Enabled = False
RegimenFiscalCliente = "616"
ClienteCodigoRegimenFiscal = "616"
Else
If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then
DdlUsoCFDI.Enabled = True
End If
If NuevaFactura = 1 Then
DdlUsoCFDI.Enabled = True
End If
End If
End If
CveUsoCFDICliente = ObjCliente.CveUsoCFDI
PlazoCobranza = ObjCliente.PlazoCobranza
PlazoCobranzaRemision = ObjCliente.PlazoCobranzaRemision
@@ -7390,6 +7356,48 @@ Partial Class Ventas
CargaRestriccionesCreditoCliente(True, CveVentaRef)
Dim CveCotizacion As Integer = IfNull(ViewState("CveCotizacion"), 0).ToString().ToEntero()
If (CveVenta <= 0 AndAlso CveCotizacion <= 0) Or EsCreaApartirDe Or NuevaFactura = 1 OrElse ModalidadEdicion Then
'CveMetodoPagoCliente = ObjCliente.CveMetodoPago
If UsuarioActual.Empresa.Funcionalidad(589) = "1" Then
'SI EL METODO DE PAGO ES PUE, SELECCIONA CONTADO
If Me.CveMetodoPago33Cliente = 1 Then
RBLPago.SelectedValue = "2"
ElseIf Me.CveMetodoPago33Cliente = 3 Then
RBLPago.SelectedValue = "1"
'SI ESTA BLOQUEADO EL CREDITO, DEJAR CONTADO
If Not RBLPago.Items(0).Enabled Then
RBLPago.SelectedValue = "2"
End If
End If
RBLPago_SelectedIndexChanged(RBLPago, Nothing)
UPCondicionesPago.Update()
Else
DdlMetodoPago33.SelectedValueExist(Me.CveMetodoPago33Cliente)
CambiaMetodoPago33()
DdlFormaPago33.SelectedValueExist(Me.CveFormaPago33Cliente)
End If
DdlUsoCFDI.SelectedValueExist(CveUsoCFDICliente)
'SI ES RFC GENERICO NO TIENE OBLIGACIONES FISCALES
If LblRFC.Text.Contiene("XAXX010101000", "XEXX010101000") Then
'S01 Sin efectos fiscales.
DdlUsoCFDI.SelectedValueExist("23")
DdlUsoCFDI.Enabled = False
RegimenFiscalCliente = "616"
ClienteCodigoRegimenFiscal = "616"
Else
If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then
DdlUsoCFDI.Enabled = True
End If
If NuevaFactura = 1 Then
DdlUsoCFDI.Enabled = True
End If
End If
End If
If CveVenta <= 0 Then
CalculaLineasAdicionales()
HabilitaRemisionPublicoGeneral = 0
@@ -8988,6 +8996,17 @@ Partial Class Ventas
GvPS.Rows(e.NewEditIndex).FCTextBox("TxtDescuento").Enabled = False
End If
If (CveVenta <= 0 OrElse EsCreaApartirDe) AndAlso UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
Try
If GvPS.Rows(e.NewEditIndex).DataKey("CvePrecioLista").ToString().ToEntero() > 0 Then
GvPS.Rows(e.NewEditIndex).FCTextBox("TxtPrecio").Enabled = False
End If
Catch ex As Exception
End Try
GvPS.Rows(e.NewEditIndex).FCTextBox("TxtDescuento").Enabled = False
End If
If EsVentaMedica Then
GvPS.Rows(e.NewEditIndex).FCTextBox("TxtPrecio").Enabled = False
@@ -9023,6 +9042,8 @@ Partial Class Ventas
End If
UpPS.Update()
End Sub
Protected Sub GvPS_RowCancelingEdit(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles GvPS.RowCancelingEdit
GvPS.EditIndex = -1