--Descuento por % porcentaje aplicado en mostrador y Permiso para aplicarlo a determinado usuario.

-- visualizar el % de ganancia
This commit is contained in:
2024-02-10 20:05:19 -07:00
parent 2f406887cd
commit 077df83bfc
3 changed files with 221 additions and 32 deletions

View File

@@ -2567,6 +2567,7 @@ Partial Class Ventas
TabAlmacen.Enabled = UsuarioActual.Empresa.UsaInventarios
TxtPorDescP.Attributes.Add("onKeyUp", "CalculaDescuento();")
TxtDescP.Attributes.Add("onKeyUp", "CalculaDescuento();")
TxtPorPS.Attributes.Add("onKeyUp", "CalculaDescPS();")
CreaDTmpC()
CreaDTmpF()
@@ -8245,6 +8246,10 @@ Partial Class Ventas
e.Row.FCLinkButton("imgE").Visible = True
End If
If UsuarioActual.Empresa.Funcionalidad(109) = "1" AndAlso UsuarioActual.TienePermisoProceso(374) Then
e.Row.FCLinkButton("LnkDescuentos").Visible = True
End If
'If GvInv.Rows.Count > 0 AndAlso ModalidadEdicion AndAlso DdlTipoComprobante.SelectedValue = "Rem" AndAlso e.Row.DataKey("CveVentaDetalle").ToString().ToEntero() > 0 Then
' e.Row.FCLinkButton("imgE").Enabled = False
' e.Row.FCLinkButton("imgE").ToolTip = "No se puede editar debido a que ya hay un movimiento de almacen."
@@ -23888,7 +23893,6 @@ Partial Class Ventas
Dim RowNum As Integer = Convert.ToInt32(e.CommandArgument)
Dim GvRow As GridViewRow = GvPS.Rows(RowNum)
If (GvRow.RowState = DataControlRowState.Edit OrElse GvRow.RowState = 5) Then
TxtCantidad.Text = GvRow.FCTextBox("TxtCantidad").Text
DdlClasificacion.SelectedValue = GvRow.FCDropDownList("DdlClasificacion").SelectedValue
@@ -23914,6 +23918,32 @@ Partial Class Ventas
RegistraScript("Recalcula();")
LbAgregar_Click(Nothing, Nothing)
ElseIf e.CommandName = "Descuento" Then
LblSubtotalDescPS.Text = ""
LblTotalDescPS.Text = ""
LblTituloDesc.Text = "Descuento"
HdnConsecPS.Value = "-1"
HdnTotalCompra.Value = ""
TxtPorPS.Text = ""
LblIVADescPS.Text = ""
Dim GvRow As GridViewRow = GvPS.Rows(e.CommandArgument.ToString().ToEntero())
LblTituloDesc.Text = $"Descuento: {GvRow.DataKey("PS")}"
HdnConsecPS.Value = GvRow.DataKey("Consec")
LblSubtotalDescPS.Text = (GvRow.DataKey("Total").ToDecimal()).FormatoNumero()
LblTotalDescPS.Text = (GvRow.DataKey("Total").ToDecimal() + GvRow.DataKey("ImporteIVA").ToDecimal()).FormatoNumero()
LblIVADescPS.Text = GvRow.DataKey("ImporteIVA").FormatoNumero()
Using ObjPS As New ClsProductosServicios
Dim PrecioCompra = ObjPS.GetUltimoPrecioCompra(UsuarioActual.CveEmpresa, GvRow.DataKey("CvePS").ToEntero())
If PrecioCompra > 0 Then
HdnTotalCompra.Value = (PrecioCompra * GvRow.DataKey("Cantidad").ToDouble() * 1.16).ToString()
End If
End Using
UpDescPS.Update()
RegistraScript("$('#ModalDescPS').modal({backdrop: 'static', keyboard: false});")
Else
DdlPS_SelectedIndexChanged(Nothing, Nothing)
End If
@@ -36794,6 +36824,20 @@ Partial Class Ventas
Protected Sub TxtFechaAnticipoCliente_TextChanged(sender As Object, e As EventArgs)
CargaAnticipos(CveCliente)
End Sub
Protected Sub BtnPorPS_Click(sender As Object, e As EventArgs)
If HdnDescPS.Value.ToEntero() > 0 Then
Dim RowUpdate As DataRow = TmpDT.Select($"Consec = {HdnConsecPS.Value}").FirstOrDefault()
If RowUpdate IsNot Nothing Then
RowUpdate("Descuento") = HdnDescPS.Value.ToDecimal()
RowUpdate("ImporteIVA") = LblIVADescPS.Text.ToDecimal()
CalculaTotalesVenta()
RegistraScript("$('#ModalDescPS').modal('hide');")
End If
Else
Alert("No se pudo aplicar el descuento", TipoMensaje.MsgAdvertencia)
End If
End Sub
End Class