-- 0 Dejó de pedir autorizacion de aplicacion de anticipos. - poner bitácora de autorización. - una vez aplicado se pone estatus de bloqueado.
This commit is contained in:
@@ -10764,17 +10764,34 @@ Partial Class Clientes
|
||||
Dim CveIE As Integer = GvRow.DataKey("CveIE").ToEntero()
|
||||
|
||||
If CveVenta > 0 OrElse CveIE > 0 Then
|
||||
Dim Actualizo As Boolean = False
|
||||
|
||||
Using ObjVentas As New ClsVentas
|
||||
If GvRow.DataKey("Tipo").Contiene("NC", "Ant") Then
|
||||
If ObjVentas.UpdateVentaAnticipoAutorizado(CveVenta, True) Then
|
||||
Alert("El anticipo se autorizó correctamente")
|
||||
Actualizo = True
|
||||
End If
|
||||
ElseIf GvRow.DataKey("Tipo").Contiene("IxC") Then
|
||||
If ObjVentas.UpdateIxCAnticipoAutorizado(CveIE, True) Then
|
||||
Alert("El anticipo se autorizó correctamente")
|
||||
Actualizo = True
|
||||
End If
|
||||
End If
|
||||
End Using
|
||||
|
||||
If Actualizo Then
|
||||
Dim ObjEventoBitacora As New ClsOIEventos
|
||||
If ObjEventoBitacora.AddEventoBitacora($"El folio '{GvRow.DataKey("Folio")}' ha sido autorizado", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, CveCliente, -1, -1, -1, -1, -1) Then
|
||||
GvEB.DataSource = ObjEventoBitacora.DtResultados
|
||||
End If
|
||||
ObjEventoBitacora.Dispose()
|
||||
GvEB.DataBind()
|
||||
|
||||
UPEventoBitacora.Update()
|
||||
CargaEventoBitacora()
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
CargaAnticipos()
|
||||
@@ -10783,13 +10800,38 @@ Partial Class Clientes
|
||||
Protected Sub LnkCancelarAnticipo_Click(sender As Object, e As EventArgs)
|
||||
Dim GvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow)
|
||||
Dim CveVenta As Integer = GvRow.DataKey("CveVenta").ToEntero()
|
||||
If CveVenta > 0 Then
|
||||
Dim CveIE As Integer = GvRow.DataKey("CveIE").ToEntero()
|
||||
|
||||
If CveVenta > 0 OrElse CveIE > 0 Then
|
||||
Dim Actualizo As Boolean = False
|
||||
Using ObjVentas As New ClsVentas
|
||||
If ObjVentas.UpdateVentaAnticipoAutorizado(CveVenta, False) Then
|
||||
Alert("El anticipo se desautorizó correctamente")
|
||||
If GvRow.DataKey("Tipo").Contiene("NC", "Ant") Then
|
||||
If ObjVentas.UpdateVentaAnticipoAutorizado(CveVenta, False) Then
|
||||
Alert("El anticipo se desautorizó correctamente")
|
||||
Actualizo = True
|
||||
End If
|
||||
ElseIf GvRow.DataKey("Tipo").Contiene("IxC") Then
|
||||
If ObjVentas.UpdateIxCAnticipoAutorizado(CveIE, False) Then
|
||||
Alert("El anticipo se desautorizó correctamente")
|
||||
Actualizo = True
|
||||
End If
|
||||
End If
|
||||
End Using
|
||||
CargaAnticipos()
|
||||
|
||||
If Actualizo Then
|
||||
Dim ObjEventoBitacora As New ClsOIEventos
|
||||
If ObjEventoBitacora.AddEventoBitacora($"El folio '{GvRow.DataKey("Folio")}' ha sido bloqueado", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, CveCliente, -1, -1, -1, -1, -1) Then
|
||||
GvEB.DataSource = ObjEventoBitacora.DtResultados
|
||||
End If
|
||||
ObjEventoBitacora.Dispose()
|
||||
GvEB.DataBind()
|
||||
|
||||
UPEventoBitacora.Update()
|
||||
CargaEventoBitacora()
|
||||
End If
|
||||
|
||||
|
||||
End If
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
@@ -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)
|
||||
@@ -634,6 +634,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
|
||||
@@ -660,6 +661,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
|
||||
|
||||
@@ -682,6 +691,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"
|
||||
@@ -884,6 +901,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 folio '{Folio}' ha sido bloqueado", "", 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 = ""
|
||||
@@ -1017,6 +1059,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
|
||||
@@ -1033,8 +1076,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
|
||||
|
||||
@@ -1173,6 +1217,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
|
||||
@@ -1189,8 +1234,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