Merge branch 'master' of http://192.168.10.111:8383/SIG
This commit is contained in:
@@ -589,11 +589,11 @@ Partial Class Ventas_PVCobranza
|
||||
Dim CveVentaRemision As Integer = -1
|
||||
|
||||
Dim DbRowVenta As DataRow = Nothing
|
||||
Dim ObjVentas As New ClsVentas
|
||||
If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then
|
||||
DbRowVenta = ObjVentas.DtResultados.Copy().FiltroPrimero("")
|
||||
Dim ObjVtaRemision As New ClsVentas
|
||||
If ObjVtaRemision.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then
|
||||
DbRowVenta = ObjVtaRemision.DtResultados.Copy().FiltroPrimero("")
|
||||
End If
|
||||
ObjVentas.Dispose()
|
||||
ObjVtaRemision.Dispose()
|
||||
|
||||
If DbRowVenta IsNot Nothing Then
|
||||
Dim VentaActual As New Venta(UsuarioActual)
|
||||
@@ -635,6 +635,7 @@ Partial Class Ventas_PVCobranza
|
||||
Dim ObjIE As New ClsBancos(ObjVentas2.IniciaTransacSQL())
|
||||
Dim ObjConta As New ClsContabilidad(ObjVentas2.IniciaTransacSQL())
|
||||
Dim ObjClientes As New ClsClientes(ObjVentas2.IniciaTransacSQL())
|
||||
Dim ObjOIEventos As New ClsOIEventos(ObjVentas2.IniciaTransacSQL())
|
||||
|
||||
Dim respFactura As Modelos.Factura.MMensajeFactura = Nothing
|
||||
Dim respNC As Modelos.Factura.MMensajeFactura = Nothing
|
||||
@@ -661,6 +662,14 @@ Partial Class Ventas_PVCobranza
|
||||
If respFactura.Factura.DtAnticiposAplicados IsNot Nothing Then
|
||||
PagoAplicado += respFactura.Factura.DtAnticiposAplicados.SUM("Importe")
|
||||
SaldoPendiente = SaldoPendiente - PagoAplicado
|
||||
|
||||
For Each RowAnt As DataRow In respFactura.Factura.DtAnticiposAplicados.Rows
|
||||
If Not ActualizaAnticipos(RowAnt("CveIE").ToString().ToEntero(), RowAnt("CveVenta").ToString().ToEntero(), RowAnt("Tipo").ToString(), RowAnt("Folio").ToString(), ObjVentas2, ObjOIEventos) Then
|
||||
MsgError = "Ocurrió un error al actualizar los anticipos"
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
@@ -683,6 +692,14 @@ Partial Class Ventas_PVCobranza
|
||||
Else
|
||||
PagoAplicado += respNC.Factura.Total
|
||||
SaldoPendiente = SaldoPendiente - PagoAplicado
|
||||
|
||||
For Each RowAnt As DataRow In respNC.Factura.DtAnticiposAplicados.Rows
|
||||
If Not ActualizaAnticipos(RowAnt("CveIE").ToString().ToEntero(), RowAnt("CveVenta").ToString().ToEntero(), RowAnt("Tipo").ToString(), RowAnt("Folio").ToString(), ObjVentas2, ObjOIEventos) Then
|
||||
MsgError = "Ocurrió un error al actualizar los anticipos"
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
|
||||
End If
|
||||
Else
|
||||
MsgError = "Ocurrió un error al generar la nota de crédito"
|
||||
@@ -885,6 +902,31 @@ Partial Class Ventas_PVCobranza
|
||||
|
||||
End Sub
|
||||
|
||||
Private Function ActualizaAnticipos(CveIE As Integer, CveVenta As Integer, Tipo As String, Folio As String, ByRef ObjVentas As ClsVentas, ByRef ObjEventoBitacora As ClsOIEventos) As Boolean
|
||||
Dim Retorno As Boolean = True
|
||||
|
||||
If CveVenta > 0 OrElse CveIE > 0 Then
|
||||
Dim Actualizo As Boolean = False
|
||||
If Tipo.Contiene("NC", "Ant") Then
|
||||
If ObjVentas.UpdateVentaAnticipoAutorizado(CveVenta, False) Then
|
||||
Alert("El anticipo se desautorizó correctamente")
|
||||
Actualizo = True
|
||||
End If
|
||||
ElseIf Tipo.Contiene("IxC") Then
|
||||
If ObjVentas.UpdateIxCAnticipoAutorizado(CveIE, False) Then
|
||||
Alert("El anticipo se desautorizó correctamente")
|
||||
Actualizo = True
|
||||
End If
|
||||
End If
|
||||
|
||||
If Actualizo Then
|
||||
Retorno = ObjEventoBitacora.AddEventoBitacora($"El anticipo se desautorizó correctamente. Folio: <b>{Folio}</b>", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveIE, -1, CveCliente, -1, -1, -1, -1, -1, CveVenta:=CveVenta)
|
||||
End If
|
||||
End If
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Private Sub LimpiarDatos()
|
||||
PnlContado.Visible = False
|
||||
TxtImporteEfectivo.Text = ""
|
||||
@@ -1029,6 +1071,7 @@ Partial Class Ventas_PVCobranza
|
||||
DtAnticipos.Columns.Add("Fecha", GetType(DateTime))
|
||||
DtAnticipos.Columns.Add("TipoCambioPago", GetType(Decimal))
|
||||
DtAnticipos.Columns.Add("Folio", GetType(String))
|
||||
DtAnticipos.Columns.Add("Tipo", GetType(String))
|
||||
|
||||
For Each GvRow As GridViewRow In GVAnticipos.Rows
|
||||
If GvRow.FCCheckBox("Chk" & GvRow.RowIndex) IsNot Nothing AndAlso GvRow.FCCheckBox("Chk" & GvRow.RowIndex).Checked Then
|
||||
@@ -1045,8 +1088,9 @@ Partial Class Ventas_PVCobranza
|
||||
Dim Fecha As DateTime = GvRow.DataKey("Fecha").ToDateTime()
|
||||
Dim TipoCambioPago As Decimal = GvRow.DataKey("TipoCambioPago").ToDecimal()
|
||||
Dim Folio = GvRow.DataKey("Folio")
|
||||
Dim Tipo = GvRow.DataKey("Tipo")
|
||||
|
||||
DtAnticipos.Rows.Add(CveVenta, Importe, CveConceptoContable, CveIE, FolioFiscal, Descuentos, TotalAnticipo, SubTotalAnticipo, CveMoneda, Fecha, TipoCambioPago, Folio)
|
||||
DtAnticipos.Rows.Add(CveVenta, Importe, CveConceptoContable, CveIE, FolioFiscal, Descuentos, TotalAnticipo, SubTotalAnticipo, CveMoneda, Fecha, TipoCambioPago, Folio, Tipo)
|
||||
End If
|
||||
Next
|
||||
|
||||
@@ -1185,6 +1229,7 @@ Partial Class Ventas_PVCobranza
|
||||
DtAnticipos.Columns.Add("Fecha", GetType(DateTime))
|
||||
DtAnticipos.Columns.Add("TipoCambioPago", GetType(Decimal))
|
||||
DtAnticipos.Columns.Add("Folio", GetType(String))
|
||||
DtAnticipos.Columns.Add("Tipo", GetType(String))
|
||||
|
||||
For Each GvRow As GridViewRow In GVAnticipos.Rows
|
||||
If GvRow.FCCheckBox("Chk" & GvRow.RowIndex) IsNot Nothing AndAlso GvRow.FCCheckBox("Chk" & GvRow.RowIndex).Checked Then
|
||||
@@ -1201,8 +1246,10 @@ Partial Class Ventas_PVCobranza
|
||||
Dim Fecha As DateTime = GvRow.DataKey("Fecha").ToDateTime()
|
||||
Dim TipoCambioPago As Decimal = GvRow.DataKey("TipoCambioPago").ToDecimal()
|
||||
Dim Folio = GvRow.DataKey("Folio")
|
||||
Dim Tipo = GvRow.DataKey("Tipo")
|
||||
|
||||
DtAnticipos.Rows.Add(CveVenta, Importe, CveConceptoContable, CveIE, FolioFiscal, Descuentos, TotalAnticipo, SubTotalAnticipo, CveMoneda, Fecha, TipoCambioPago, Folio)
|
||||
|
||||
DtAnticipos.Rows.Add(CveVenta, Importe, CveConceptoContable, CveIE, FolioFiscal, Descuentos, TotalAnticipo, SubTotalAnticipo, CveMoneda, Fecha, TipoCambioPago, Folio, Tipo)
|
||||
End If
|
||||
Next
|
||||
|
||||
|
||||
Reference in New Issue
Block a user