diff --git a/Ventas/ClientesAbonar.aspx b/Ventas/ClientesAbonar.aspx
index 28a85c533..d23679560 100644
--- a/Ventas/ClientesAbonar.aspx
+++ b/Ventas/ClientesAbonar.aspx
@@ -648,7 +648,8 @@
$get('LbImporteMN').innerHTML = '$ ' + FormatoNumero(SumaConversion, 2) + ' MXN';
}
}
- function FnSeleccionaNC(chk, chkNC)
+
+ function FnSeleccionaNC(chk, chkNC,txtImporte)
{
if (chk.checked) {
chkNC.disabled = false;
@@ -659,6 +660,11 @@
chkNC.click();
}
}
+ txtImporte.disabled = chkNC.checked;
+ }
+
+ function FnEditarImporte(chkNC, txtImporte) {
+ txtImporte.disabled = chkNC.checked;
}
function FnLimites(chk, txt, limiteInferior, limiteSuperior) {
diff --git a/Ventas/ClientesAbonar.aspx.vb b/Ventas/ClientesAbonar.aspx.vb
index 8f01ade50..9650088cf 100644
--- a/Ventas/ClientesAbonar.aspx.vb
+++ b/Ventas/ClientesAbonar.aspx.vb
@@ -616,7 +616,7 @@ Partial Class Ventas_ClientesAbonar
End Select
If e.Row.DBCampo("DescuentoProntoPago").ToDecimal() > 0 Then
- e.Row.FCCheckBox("Chk").Attributes.Add("onclick", String.Format("FnSuma(this,{0},{1}); FnCambia({2},this,{1},0,{3},{4}); FnSeleccionaNC({5},{6});", e.Row.FCTextBox("TxtAbonar").ClientID, e.Row.DBCampo("Saldo"), e.Row.FCCheckBox("Chk").ClientID, CveMonedaFiltro, moneda, e.Row.FCCheckBox("Chk").ClientID, e.Row.FCCheckBox("ChkGenerarNC").ClientID))
+ e.Row.FCCheckBox("Chk").Attributes.Add("onclick", String.Format("FnSuma(this,{0},{1}); FnCambia({2},this,{1},0,{3},{4}); FnSeleccionaNC({5},{6},{0});", e.Row.FCTextBox("TxtAbonar").ClientID, e.Row.DBCampo("Saldo"), e.Row.FCCheckBox("Chk").ClientID, CveMonedaFiltro, moneda, e.Row.FCCheckBox("Chk").ClientID, e.Row.FCCheckBox("ChkGenerarNC").ClientID))
Else
e.Row.FCCheckBox("Chk").Attributes.Add("onclick", String.Format("FnSuma(this,{0},{1}); FnCambia({2},this,{1},0,{3},{4});", e.Row.FCTextBox("TxtAbonar").ClientID, e.Row.DBCampo("Saldo"), e.Row.FCCheckBox("Chk").ClientID, CveMonedaFiltro, moneda))
End If
@@ -646,8 +646,7 @@ Partial Class Ventas_ClientesAbonar
If e.Row.DBCampo("DescuentoProntoPago").ToDecimal() > 0 Then
e.Row.FCCheckBox("ChkGenerarNC").Visible = True
- e.Row.FCCheckBox("ChkGenerarNC").Attributes.Add("onclick", String.Format("FnSuma(this,{0},{1}); FnCambia({2},this,{1},0,{3},{4});", e.Row.FCTextBox("TxtAbonar").ClientID, e.Row.DBCampo("Saldo").ToDecimal - e.Row.DBCampo("DescuentoProntoPago").ToDecimal, e.Row.FCCheckBox("ChkGenerarNC").ClientID, CveMonedaFiltro, moneda))
-
+ e.Row.FCCheckBox("ChkGenerarNC").Attributes.Add("onclick", String.Format("FnSuma(this,{0},{1}); FnCambia({2},this,{1},0,{3},{4}); FnEditarImporte({2}, {0});", e.Row.FCTextBox("TxtAbonar").ClientID, e.Row.DBCampo("Saldo").ToDecimal - e.Row.DBCampo("DescuentoProntoPago").ToDecimal, e.Row.FCCheckBox("ChkGenerarNC").ClientID, CveMonedaFiltro, moneda))
End If
Else
@@ -1540,12 +1539,26 @@ Partial Class Ventas_ClientesAbonar
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
If MsgError = "" Then
If ListaFacturasGenerarNC.Count > 0 Then
- Dim Resp = GenerarNC(ObjIE.IniciaTransacSQL(), ObjConta, ListaFacturasGenerarNC)
- If Resp.CveVenta > 0 Then
- NCGeneradas.Add(Resp)
- Else
- MsgError = "No se pudo generar la nota de credito"
+ For Each Fac As Modelos.Factura In ListaFacturasGenerarNC
+ Dim ListaNC As New List(Of Modelos.Factura)
+ ListaNC.Add(Fac)
+
+ Dim Resp As Modelos.Factura.MMensajeFactura = GenerarNC(ObjIE.IniciaTransacSQL(), ObjConta, ListaNC)
+
+ If Resp.CveVenta > 0 Then
+ NCGeneradas.Add(Resp)
+ Else
+ MsgError = "No se pudo generar la nota de crédito"
+ Exit For
+ End If
+ Next
+
+ If MsgError = "" Then
+ If NCGeneradas.Count <> ListaFacturasGenerarNC.Count Then
+ MsgError = "No se generaron las notas de crédito seleccionadas"
+ End If
End If
+
End If
End If
End If
@@ -1641,21 +1654,14 @@ Partial Class Ventas_ClientesAbonar
If ObjConta IsNot Nothing Then ObjConta.Commit()
Dim StrMsg As New StringBuilder
- StrMsg.Append("Abono Registrado Correctamente.
")
- StrMsg.AppendFormat("Folio {1}", CveIE, ObjIE.Folio)
+ StrMsg.AppendFormat("Abono Registrado Correctamente. Folio {1}
", CveIE, ObjIE.Folio)
- If IDPoliza > 0 Then StrMsg.AppendFormat("
Poliza: {1}", IDPoliza, FolioPoliza)
+ If IDPoliza > 0 Then StrMsg.AppendFormat("Poliza: {1}
", IDPoliza, FolioPoliza)
Dim TextoComplementoPago = EmitirComplementoPago(CveIE, CveVentasPago, SeriesPago)
- Dim SbMensaje As New StringBuilder
- SbMensaje.Append(String.Format("Abono Registrado Correctamente.
Poliza: {1}
{2}", IDPoliza, FolioPoliza, TextoComplementoPago))
-
For Each NC In NCGeneradas
- For Each msg In NC.Mensajes
- StrMsg.Append(msg)
- Next
- StrMsg.Append("")
+ StrMsg.AppendFormat("Nota de crédito generada correctamente.
Folio: {1}
", NC.CveVenta, NC.SerieFolio)
Next
Alert($"{StrMsg.ToString}
{TextoComplementoPago}", TipoMensaje.MsgInformacion, If(ChkSeguirRegistrando.Checked, "location.href =""#""", "location.href =""/Bancos/RepCxCCliente.aspx"""))
@@ -1680,7 +1686,7 @@ Partial Class Ventas_ClientesAbonar
#Region " N O T A - D E - C R E D I T O"
- Private Function GenerarNC(Trasac As SqlClient.SqlTransaction, ObjConta As ClsContPAQi, ListaVentasGenerarNC As List(Of Modelos.Factura)) As Modelos.Factura.MMensajeFactura
+ Private Function GenerarNC(SqlTransaccion As SqlClient.SqlTransaction, ObjConta As ClsContPAQi, ListaVentasGenerarNC As List(Of Modelos.Factura)) As Modelos.Factura.MMensajeFactura
Dim ObjFacturaDevolucion = New Modelos.Factura(UsuarioActual)
ObjFacturaDevolucion.TipoMensajeRespuesta = Modelos.TipoMensajeRespuesta.HTML
ObjFacturaDevolucion.CveUsuario = UsuarioActual.CveUsuario
@@ -1844,8 +1850,8 @@ Partial Class Ventas_ClientesAbonar
DtVentasNC.AcceptChanges()
ObjFacturaDevolucion.DtVentasNC = DtVentasNC
- 'ObjFacturaDevolucion.GenerarPDFFactura = True
- Dim Resp = ObjFacturaDevolucion.EmitirFactura(False, Transac:=Trasac, ObjContPaqTransac:=ObjConta)
+
+ Dim Resp = ObjFacturaDevolucion.EmitirFactura(False, Transac:=SqlTransaccion, ObjContPaqTransac:=ObjConta)
ObjFacturaDevolucion.Dispose()
@@ -2370,7 +2376,12 @@ Partial Class Ventas_ClientesAbonar
#End Region
#Region " COMPLEMENTOS PAGO "
- Private Function EmitirComplementoPago(CveIE As Integer, CveVentas As List(Of Integer), Series As List(Of String)) As String
+ Private Function EmitirComplementoPago(CveIE As Integer, CveVentas As List(Of Integer), Series As List(Of String)) As String
+
+ If Not UsuarioActual.Empresa.FacturaProduccion Then
+ Return ""
+ End If
+
If Not ChkComplementoPago.Checked Then
Return ""
End If