diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index 844dbb8db..74a7e51f2 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -751,6 +751,22 @@ Public Class ClsVentas Return Retorno End Function + Public Function UpdateVentaAnticipoAutorizado(CveVenta As Integer, Autorizado As Boolean) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_VentaAnticipoAutorizadoUpdate") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveVenta", SqlDbType.Int).Value = CveVenta + .Add("@Autorizado", SqlDbType.Bit).Value = Autorizado + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el estatus del anticipo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + Return Retorno + End Function + Public Function UpdateFechaVencimientoVenta(CveVenta As Integer, FechaVencimiento As Date) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_VentasFechaVencimientoUpdate") diff --git a/Ventas/Clientes.aspx b/Ventas/Clientes.aspx index 90b18644b..74d963242 100644 --- a/Ventas/Clientes.aspx +++ b/Ventas/Clientes.aspx @@ -2301,6 +2301,12 @@ + + + + + + diff --git a/Ventas/Clientes.aspx.vb b/Ventas/Clientes.aspx.vb index 83a8a4a08..59f2643d7 100644 --- a/Ventas/Clientes.aspx.vb +++ b/Ventas/Clientes.aspx.vb @@ -1873,7 +1873,12 @@ Partial Class Clientes GVAnticiposHistorial.DataSource = Nothing DtAnticipoHistorial = Nothing End If - ObjMovtos.Dispose() + ObjMovtos.Dispose() + + If UsuarioActual.Empresa.Funcionalidad(185) = "1" AndAlso UsuarioActual.TienePermisoProceso(379) Then + GVAnticipos.Columns(7).Visible = True + End If + GVAnticipos.DataBind() GVAnticiposHistorial.DataBind() @@ -1889,7 +1894,6 @@ Partial Class Clientes RegistraScript("OrdenarGVAnticiposHistorial();") End If - End Sub Private Sub CargaOrdenesServiciosCliente() Dim ObjOS As New ClsOS @@ -2957,10 +2961,24 @@ Partial Class Clientes e.Row.FCHyperLink("HLDevolverDinero").Visible = True e.Row.FCHyperLink("HLDevolverDinero").NavigateUrl = $"/Bancos/IE.aspx?Opcion=DevDinV&P={Parametros}" End If + End If + + + If UsuarioActual.Empresa.Funcionalidad(185) = "1" AndAlso UsuarioActual.TienePermisoProceso(379) AndAlso CType(sender, GridView).ID = "GVAnticipos" Then + If e.Row.DBCampo("CveVenta").ToString().ToEntero() > 0 AndAlso e.Row.DBCampo("Tipo").ToString() = "Ant" Then + If e.Row.DBCampo("AnticipoAutorizado").ToString() = "False" Then + e.Row.FCLinkButton("LnkAutorizar").Visible = True + e.Row.FCLinkButton("LnkCancelar").Visible = False + Else + e.Row.FCLinkButton("LnkAutorizar").Visible = False + e.Row.FCLinkButton("LnkCancelar").Visible = True + End If + End If End If End If End Sub + #End Region #Region "R H" @@ -10691,6 +10709,31 @@ Partial Class Clientes End Function + Protected Sub LnkAutorizarAnticipo_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 + Using ObjVentas As New ClsVentas + If ObjVentas.UpdateVentaAnticipoAutorizado(CveVenta, True) Then + Alert("El anticipo se autorizó correctamente") + End If + End Using + CargaAnticipos() + End If + End Sub + + 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 + Using ObjVentas As New ClsVentas + If ObjVentas.UpdateVentaAnticipoAutorizado(CveVenta, False) Then + Alert("El anticipo se desautorizó correctamente") + End If + End Using + CargaAnticipos() + End If + End Sub End Class diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx index a2e1f750a..247c1236b 100644 --- a/Ventas/Ventas.aspx +++ b/Ventas/Ventas.aspx @@ -4615,6 +4615,9 @@
+
+ +
" style="display: inline-block; margin-right: -20px; width: 150px;" /> " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 053d9d08d..f5eb42dbd 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -7194,7 +7194,13 @@ Partial Class Ventas End If ObjCliente.Dispose() - If CveCliente > 0 Then CargaAnticipos(CveCliente) : UpAnticipos.Update() + If CveCliente > 0 Then + CargaAnticipos(CveCliente) + If UsuarioActual.Empresa.Funcionalidad(185) = "1" Then + LnkRecargaAnticipos.Visible = True + End If + UpAnticipos.Update() + End If If CveCliente > 0 AndAlso UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso CveVenta <= 0 Then DivVentasUsados.Visible = True @@ -16823,6 +16829,12 @@ Partial Class Ventas GVAnticipos.Columns(8).Visible = True End If + If UsuarioActual.Empresa.Funcionalidad(185) = "1" Then + If e.Row.DBCampo("Tipo").ToString() = "Ant" AndAlso e.Row.DBCampo("AnticipoAutorizado").ToString() = "False" Then + e.Row.FCCheckBox("Chk" & e.Row.RowIndex).Enabled = False + End If + End If + If e.Row.DBCampo("CveMoneda").ToString().ToEntero() = DdlMoneda.SelectedValue.ToEntero() Then e.Row.FCTextBox("TxtTC" & e.Row.RowIndex).Visible = False @@ -38401,5 +38413,10 @@ Partial Class Ventas + Protected Sub LnkRecargaAnticipos_Click(sender As Object, e As EventArgs) + If CveCliente > 0 Then + CargaAnticipos(CveCliente) + End If + End Sub End Class