Generar una NC por cada factura y solo aplica cuando es la totalidad de la venta
This commit is contained in:
@@ -648,7 +648,8 @@
|
|||||||
$get('LbImporteMN').innerHTML = '$ ' + FormatoNumero(SumaConversion, 2) + ' MXN';
|
$get('LbImporteMN').innerHTML = '$ ' + FormatoNumero(SumaConversion, 2) + ' MXN';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function FnSeleccionaNC(chk, chkNC)
|
|
||||||
|
function FnSeleccionaNC(chk, chkNC,txtImporte)
|
||||||
{
|
{
|
||||||
if (chk.checked) {
|
if (chk.checked) {
|
||||||
chkNC.disabled = false;
|
chkNC.disabled = false;
|
||||||
@@ -659,6 +660,11 @@
|
|||||||
chkNC.click();
|
chkNC.click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
txtImporte.disabled = chkNC.checked;
|
||||||
|
}
|
||||||
|
|
||||||
|
function FnEditarImporte(chkNC, txtImporte) {
|
||||||
|
txtImporte.disabled = chkNC.checked;
|
||||||
}
|
}
|
||||||
|
|
||||||
function FnLimites(chk, txt, limiteInferior, limiteSuperior) {
|
function FnLimites(chk, txt, limiteInferior, limiteSuperior) {
|
||||||
|
|||||||
@@ -616,7 +616,7 @@ Partial Class Ventas_ClientesAbonar
|
|||||||
End Select
|
End Select
|
||||||
|
|
||||||
If e.Row.DBCampo("DescuentoProntoPago").ToDecimal() > 0 Then
|
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
|
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))
|
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
|
End If
|
||||||
@@ -646,8 +646,7 @@ Partial Class Ventas_ClientesAbonar
|
|||||||
|
|
||||||
If e.Row.DBCampo("DescuentoProntoPago").ToDecimal() > 0 Then
|
If e.Row.DBCampo("DescuentoProntoPago").ToDecimal() > 0 Then
|
||||||
e.Row.FCCheckBox("ChkGenerarNC").Visible = True
|
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
|
End If
|
||||||
|
|
||||||
Else
|
Else
|
||||||
@@ -1540,12 +1539,26 @@ Partial Class Ventas_ClientesAbonar
|
|||||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
||||||
If MsgError = "" Then
|
If MsgError = "" Then
|
||||||
If ListaFacturasGenerarNC.Count > 0 Then
|
If ListaFacturasGenerarNC.Count > 0 Then
|
||||||
Dim Resp = GenerarNC(ObjIE.IniciaTransacSQL(), ObjConta, ListaFacturasGenerarNC)
|
For Each Fac As Modelos.Factura In ListaFacturasGenerarNC
|
||||||
If Resp.CveVenta > 0 Then
|
Dim ListaNC As New List(Of Modelos.Factura)
|
||||||
NCGeneradas.Add(Resp)
|
ListaNC.Add(Fac)
|
||||||
Else
|
|
||||||
MsgError = "No se pudo generar la nota de credito"
|
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
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
@@ -1641,21 +1654,14 @@ Partial Class Ventas_ClientesAbonar
|
|||||||
If ObjConta IsNot Nothing Then ObjConta.Commit()
|
If ObjConta IsNot Nothing Then ObjConta.Commit()
|
||||||
|
|
||||||
Dim StrMsg As New StringBuilder
|
Dim StrMsg As New StringBuilder
|
||||||
StrMsg.Append("Abono Registrado Correctamente.<br/>")
|
StrMsg.AppendFormat("Abono Registrado Correctamente. Folio <b><a href='/Bancos/IE.aspx?CveIE={0}' target='_blank' class='Texto'>{1}</a></b> <br/>", CveIE, ObjIE.Folio)
|
||||||
StrMsg.AppendFormat("Folio <b><a href='/Bancos/IE.aspx?CveIE={0}' target='_blank' class='Texto'>{1}</a></b>", CveIE, ObjIE.Folio)
|
|
||||||
|
|
||||||
If IDPoliza > 0 Then StrMsg.AppendFormat("<br/> Poliza: <a href='/Contabilidad/RegPoliza.aspx?IdPoliza={0}' target='_blank' class='Texto'>{1}</a>", IDPoliza, FolioPoliza)
|
If IDPoliza > 0 Then StrMsg.AppendFormat("Poliza: <a href='/Contabilidad/RegPoliza.aspx?IdPoliza={0}' target='_blank' class='Texto'>{1}</a> <br/>", IDPoliza, FolioPoliza)
|
||||||
|
|
||||||
Dim TextoComplementoPago = EmitirComplementoPago(CveIE, CveVentasPago, SeriesPago)
|
Dim TextoComplementoPago = EmitirComplementoPago(CveIE, CveVentasPago, SeriesPago)
|
||||||
|
|
||||||
Dim SbMensaje As New StringBuilder
|
|
||||||
SbMensaje.Append(String.Format("Abono Registrado Correctamente.<br/><br/> Poliza: <a href='/Contabilidad/RegPoliza.aspx?IdPoliza={0}' target='_blank' class='Texto'>{1}</a><br/><br/>{2}", IDPoliza, FolioPoliza, TextoComplementoPago))
|
|
||||||
|
|
||||||
For Each NC In NCGeneradas
|
For Each NC In NCGeneradas
|
||||||
For Each msg In NC.Mensajes
|
StrMsg.AppendFormat("Nota de crédito generada correctamente.<br/><br/> Folio: <a href='/Ventas/Ventas.aspx?CveVenta={0}' target='_blank' class='Texto'>{1}</a><br/>", NC.CveVenta, NC.SerieFolio)
|
||||||
StrMsg.Append(msg)
|
|
||||||
Next
|
|
||||||
StrMsg.Append("</br>")
|
|
||||||
Next
|
Next
|
||||||
|
|
||||||
Alert($"{StrMsg.ToString}<br/><br/>{TextoComplementoPago}", TipoMensaje.MsgInformacion, If(ChkSeguirRegistrando.Checked, "location.href =""#""", "location.href =""/Bancos/RepCxCCliente.aspx"""))
|
Alert($"{StrMsg.ToString}<br/><br/>{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"
|
#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)
|
Dim ObjFacturaDevolucion = New Modelos.Factura(UsuarioActual)
|
||||||
ObjFacturaDevolucion.TipoMensajeRespuesta = Modelos.TipoMensajeRespuesta.HTML
|
ObjFacturaDevolucion.TipoMensajeRespuesta = Modelos.TipoMensajeRespuesta.HTML
|
||||||
ObjFacturaDevolucion.CveUsuario = UsuarioActual.CveUsuario
|
ObjFacturaDevolucion.CveUsuario = UsuarioActual.CveUsuario
|
||||||
@@ -1844,8 +1850,8 @@ Partial Class Ventas_ClientesAbonar
|
|||||||
DtVentasNC.AcceptChanges()
|
DtVentasNC.AcceptChanges()
|
||||||
|
|
||||||
ObjFacturaDevolucion.DtVentasNC = DtVentasNC
|
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()
|
ObjFacturaDevolucion.Dispose()
|
||||||
|
|
||||||
@@ -2370,7 +2376,12 @@ Partial Class Ventas_ClientesAbonar
|
|||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
#Region " COMPLEMENTOS PAGO "
|
#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
|
If Not ChkComplementoPago.Checked Then
|
||||||
Return ""
|
Return ""
|
||||||
End If
|
End If
|
||||||
|
|||||||
Reference in New Issue
Block a user