--FIX impresion de saldos aplicados

This commit is contained in:
2025-04-12 16:31:02 -07:00
parent 340b508ce9
commit d345089468
3 changed files with 54 additions and 1225 deletions

View File

@@ -1587,19 +1587,18 @@ Partial Class PopUpVerFactura
Dim CVEVENTA As Integer = UrlParametros("CVEVENTA").ToString.ToEntero Dim CVEVENTA As Integer = UrlParametros("CVEVENTA").ToString.ToEntero
Dim CVECLIENTE As Integer = UrlParametros("CVECLIENTE").ToString.ToEntero Dim CVECLIENTE As Integer = UrlParametros("CVECLIENTE").ToString.ToEntero
Dim MONTO As Decimal = UrlParametros("MONTO").ToString.ToDecimal Dim MONTO As Decimal = UrlParametros("MONTO").ToString.ToDecimal
Dim TIPO As String = UrlParametros("TIPO").ToString
If CVECLIENTE > 0 AndAlso (CVEIE > 0 Or CVEVENTA > 0) Then If CVECLIENTE > 0 AndAlso (CVEIE > 0 Or CVEVENTA > 0) Then
ImprimirSaldosAmortizacion(CVEVENTAAMORTIZADA, CVEIE, CVEVENTA, CVECLIENTE, MONTO) ImprimirSaldosAmortizacion(TIPO, CVEVENTAAMORTIZADA, CVEIE, CVEVENTA, CVECLIENTE, MONTO)
End If End If
End If End If
End Sub End Sub
Private Sub ImprimirSaldosAmortizacion(CveVentaAmortizada As Integer, CveIE As Integer, CveVenta As Integer, CveCliente As Integer, Monto As Decimal) Private Sub ImprimirSaldosAmortizacion(Tipo As String, CveVentaAmortizada As Integer, CveIE As Integer, CveVenta As Integer, CveCliente As Integer, Monto As Decimal)
Dim ObjMovtos As New ClsMovimientos()
Dim SaldoAntNCDev As Decimal = 0 Dim SaldoAntNCDev As Decimal = 0
Dim DatosSaldoAntNCDev As New DataTable Dim DatosSaldoAntNCDev As New DataTable
Dim TipoDocto As String = "" Dim TipoDocto As String = ""
@@ -1607,36 +1606,22 @@ Partial Class PopUpVerFactura
Dim Saldo As Decimal = 0D Dim Saldo As Decimal = 0D
Dim DTNCVinculadas As New DataTable Dim DTNCVinculadas As New DataTable
Dim ObjMovtos As New ClsMovimientos()
If ObjMovtos.GetAnticiposNCIxCCliente(CveCliente) Then If ObjMovtos.GetAnticiposNCIxCCliente(CveCliente) Then
DatosSaldoAntNCDev = ObjMovtos.DtResultados If Tipo.Contiene("NC", "Ant") Then
DatosSaldoAntNCDev = ObjMovtos.DtResultados.FiltraParametros($"Tipo='{Tipo}' AND CveVenta={CveVenta}")
ElseIf Tipo.Contiene("IxC") Then
DatosSaldoAntNCDev = ObjMovtos.DtResultados.FiltraParametros($"Tipo='{Tipo}' AND CveIE={CveIE}")
End If
End If End If
ObjMovtos.Dispose() ObjMovtos.Dispose()
If DatosSaldoAntNCDev IsNot Nothing AndAlso DatosSaldoAntNCDev.Rows.Count > 0 Then If DatosSaldoAntNCDev IsNot Nothing AndAlso DatosSaldoAntNCDev.Rows.Count > 0 Then
SaldoAntNCDev = If(CveVenta > 0, SaldoAntNCDev = DatosSaldoAntNCDev.FiltroPrimeroValor("Saldo").ToDecimal
DatosSaldoAntNCDev.FiltroPrimeroValor("Saldo", $"CveVenta={CveVenta}").ToDecimal, TipoDocto = DatosSaldoAntNCDev.FiltroPrimeroValor("Tipo")
DatosSaldoAntNCDev.FiltroPrimeroValor("Saldo", $"CveIE={CveIE}").ToDecimal) Folio = DatosSaldoAntNCDev.FiltroPrimeroValor("Folio")
Saldo = DatosSaldoAntNCDev.FiltroPrimeroValor("Saldo").ToDecimal
TipoDocto = If(CveVenta > 0,
DatosSaldoAntNCDev.FiltroPrimeroValor("Tipo", $"CveVenta={CveVenta}"),
DatosSaldoAntNCDev.FiltroPrimeroValor("Tipo", $"CveIE={CveIE}"))
If CveIE > 0 Then
CveVenta = DatosSaldoAntNCDev.FiltroPrimeroValor("CveVenta", $"CveIE={CveIE}").ToEntero
Folio = DatosSaldoAntNCDev.FiltroPrimeroValor("Folio", $"CveIE={CveIE}")
Saldo = DatosSaldoAntNCDev.FiltroPrimeroValor("Saldo", $"CveIE={CveIE}").ToDecimal
Else
Folio = DatosSaldoAntNCDev.FiltroPrimeroValor("Folio", $"CveVenta={CveVenta}")
Saldo = DatosSaldoAntNCDev.FiltroPrimeroValor("Saldo", $"CveVenta={CveVenta}").ToDecimal
End If
End If End If
@@ -1651,30 +1636,53 @@ Partial Class PopUpVerFactura
ObjVentas.Dispose() ObjVentas.Dispose()
End If End If
If TipoDocto.Contiene("IxC") Then
DTNCVinculadas = New DataTable()
DTNCVinculadas.Columns.Add(New DataColumn("SerieFolioEstatus", GetType(String)))
DTNCVinculadas.Columns.Add(New DataColumn("FechaAplicado", GetType(String)))
DTNCVinculadas.Columns.Add(New DataColumn("Moneda", GetType(String)))
DTNCVinculadas.Columns.Add(New DataColumn("TotalNC", GetType(String)))
Dim DtIxC As DataTable = Nothing
Dim ObjVentas As New ClsVentas
If ObjVentas.GetRepAnticiposNCIXCDetalle(CveCliente, -1, MinFecha, MaxFecha, UsuarioActual.CveEmpresa, -1, 3, -1, MinFecha, MaxFecha, TipoCambio:=1, TCEspecifico:=-1) Then
DtIxC = ObjVentas.DtResultados.FiltraParametros($"CveIE={CveIE} AND TipoColumna ='Aplicación'")
End If
ObjVentas.Dispose()
If DtIxC IsNot Nothing Then
For Each RowIxC As DataRow In DtIxC.Rows
Dim Row As DataRow = DTNCVinculadas.NewRow
Row("SerieFolioEstatus") = RowIxC("SerieFolioAmortizacion")
Row("FechaAplicado") = RowIxC("FechaAmortizacion")
Row("Moneda") = RowIxC("MonedaAmortizacion")
Row("TotalNC") = RowIxC("ImporteAmortizacion")
DTNCVinculadas.Rows.Add(Row)
Next
End If
End If
If DTNCVinculadas IsNot Nothing Then If DTNCVinculadas IsNot Nothing Then
Dim params As New List(Of ReportParameter) Dim params As New List(Of ReportParameter)
params.Add(New ReportParameter("Tipo", Tipo))
Dim ObjVentas As New ClsVentas Dim ObjVentas As New ClsVentas
If ObjVentas.GetVenta(CveVentaAmortizada, UsuarioActual.CveEmpresa) Then If ObjVentas.GetVenta(CveVentaAmortizada, UsuarioActual.CveEmpresa) Then
Dim DbRowVenta = ObjVentas.DtResultados.Copy().FiltroPrimero("") Dim DbRowVenta = ObjVentas.DtResultados.Copy().FiltroPrimero("")
If DbRowVenta IsNot Nothing Then If DbRowVenta IsNot Nothing Then
params.Add(New ReportParameter("SerieFolio", DbRowVenta("SerieFolio").ToString)) params.Add(New ReportParameter("SerieFolio", Folio))
params.Add(New ReportParameter("Moneda", DbRowVenta("Moneda").ToString)) params.Add(New ReportParameter("Moneda", DbRowVenta("Moneda").ToString))
params.Add(New ReportParameter("Cliente", DbRowVenta("ClienteNombre").ToString)) params.Add(New ReportParameter("Cliente", DbRowVenta("ClienteNombre").ToString))
End If End If
End If End If
ObjVentas.Dispose() ObjVentas.Dispose()
Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png") Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png")
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
params.Add(New ReportParameter("FechaImpresion", NowADS().ToString)) params.Add(New ReportParameter("FechaImpresion", NowADS().ToString))

File diff suppressed because it is too large Load Diff

View File

@@ -607,6 +607,11 @@ Partial Class Ventas_PVCobranza
Alert("No hay importe para sobrante/faltante", TipoMensaje.MsgAdvertencia) Alert("No hay importe para sobrante/faltante", TipoMensaje.MsgAdvertencia)
Exit Sub Exit Sub
End If End If
Else
If TxtFaltante.Text.ToDecimal() <> 0 Then
Alert("No debe especificar sobrante/faltante", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
End If End If
'validaciones 'validaciones
@@ -1024,12 +1029,12 @@ Partial Class Ventas_PVCobranza
If respFactura IsNot Nothing AndAlso respFactura.Factura IsNot Nothing AndAlso respFactura.Factura.DtAnticiposAplicados IsNot Nothing Then If respFactura IsNot Nothing AndAlso respFactura.Factura IsNot Nothing AndAlso respFactura.Factura.DtAnticiposAplicados IsNot Nothing Then
For Each dr As DataRow In respFactura.Factura.DtAnticiposAplicados.Rows For Each dr As DataRow In respFactura.Factura.DtAnticiposAplicados.Rows
msBuild.AppendLine($"<br><a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={Encripta(String.Format("OP=AMORTIZACIONHIS&CVEIE={0}&CVEVENTA={1}&CVECLIENTE={2}&CVEVENTAAMORTIZADA={3}&MONTO={4}", msBuild.AppendLine($"<br><a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={Encripta(String.Format("OP=AMORTIZACIONHIS&CVEIE={0}&CVEVENTA={1}&CVECLIENTE={2}&CVEVENTAAMORTIZADA={3}&MONTO={4}&TIPO={5}",
dr("CveIE").ToString, dr("CveIE").ToString,
dr("CveVenta").ToString, dr("CveVenta").ToString,
respFactura.Factura.CveCliente, respFactura.Factura.CveCliente,
respFactura.CveVenta, respFactura.CveVenta,
respFactura.Factura.Total))}"">Imprimir Saldo Aplicado {dr("Folio").ToString}</a><br/>") respFactura.Factura.Total, dr("Tipo")))}"">Imprimir Saldo Aplicado {dr("Folio").ToString}</a><br/>")
Next Next
End If End If
@@ -1064,12 +1069,12 @@ Partial Class Ventas_PVCobranza
If respNC IsNot Nothing AndAlso respNC.Factura IsNot Nothing AndAlso respNC.Factura.DtAnticiposAplicados IsNot Nothing Then If respNC IsNot Nothing AndAlso respNC.Factura IsNot Nothing AndAlso respNC.Factura.DtAnticiposAplicados IsNot Nothing Then
For Each dr As DataRow In respNC.Factura.DtAnticiposAplicados.Rows For Each dr As DataRow In respNC.Factura.DtAnticiposAplicados.Rows
msBuild.AppendLine($"<br><a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={Encripta(String.Format("OP=AMORTIZACIONHIS&CVEIE={0}&CVEVENTA={1}&CVECLIENTE={2}&CVEVENTAAMORTIZADA={3}&MONTO={4}", msBuild.AppendLine($"<br><a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={Encripta(String.Format("OP=AMORTIZACIONHIS&CVEIE={0}&CVEVENTA={1}&CVECLIENTE={2}&CVEVENTAAMORTIZADA={3}&MONTO={4}&Tipo={5}",
dr("CveIE").ToString, dr("CveIE").ToString,
dr("CveVenta").ToString, dr("CveVenta").ToString,
respNC.Factura.CveCliente, respNC.Factura.CveCliente,
respNC.CveVenta, respNC.CveVenta,
respNC.Factura.Total))}"">Imprimir Saldo Aplicado {dr("Folio").ToString}</a><br/>") respNC.Factura.Total, dr("Tipo")))}"">Imprimir Saldo Aplicado {dr("Folio").ToString}</a><br/>")
Next Next
End If End If
@@ -1444,22 +1449,6 @@ Partial Class Ventas_PVCobranza
For Each msg In Retorno.Mensajes For Each msg In Retorno.Mensajes
SbAlert.AppendFormat("{0} <br/>", msg) SbAlert.AppendFormat("{0} <br/>", msg)
Next Next
SbAlert.AppendFormat("<ul><li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar PDF Factura</a></li></ul><br/>", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", Retorno.CveVenta)))
For Each dr As DataRow In DtAnticipos.Rows
SBAmortizaciones.AppendLine($"<br><a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={Encripta(String.Format("OP=AMORTIZACIONHIS&CVEIE={0}&CVEVENTA={1}&CVECLIENTE={2}&CVEVENTAAMORTIZADA={3}&MONTO={4}&SALDO={5}",
dr("CveIE").ToString,
dr("CveVenta").ToString,
Retorno.Factura.CveCliente,
Retorno.CveVenta,
Retorno.Factura.Total,
(Retorno.Factura.Total - Retorno.Factura.DtAnticiposAplicados.SUM("Importe"))))}"">Imprimir historial {dr("Folio").ToString}</a><br/>")
Next
SbAlert.Append(SBAmortizaciones.ToString)
Else Else
SbAlert.Append("Ocurrió un error al generar la factura") SbAlert.Append("Ocurrió un error al generar la factura")
End If End If
@@ -2472,9 +2461,9 @@ Partial Class Ventas_PVCobranza
Dim AnticipoAutorizado = CBool(e.Row.DBCampo("AnticipoAutorizado")) Dim AnticipoAutorizado = CBool(e.Row.DBCampo("AnticipoAutorizado"))
'If Not EsProduccion AndAlso UsuarioActual.CveRol = 1 Then If Not EsProduccion AndAlso UsuarioActual.CveRol = 1 Then
' AnticipoAutorizado = True AnticipoAutorizado = True
'End If End If
If UsuarioActual.Empresa.Funcionalidad(185) = "1" Then If UsuarioActual.Empresa.Funcionalidad(185) = "1" Then
If e.Row.DBCampo("Tipo").ToString().Contiene("NC", "Ant", "IxC") AndAlso Not AnticipoAutorizado Then If e.Row.DBCampo("Tipo").ToString().Contiene("NC", "Ant", "IxC") AndAlso Not AnticipoAutorizado Then