Al crear o editar un producto poder introducir el precio de lista de cada una

This commit is contained in:
RPimienta
2024-09-22 02:13:59 -06:00
parent ed5bfaf1e9
commit 8cb75e5633
2 changed files with 115 additions and 1 deletions

View File

@@ -141,6 +141,15 @@ Partial Class ProductosyServicios
ViewState("Imagen") = value
End Set
End Property
Private Property DtPreciosMultiple As DataTable
Get
Return If(IsNothing(ViewState("DtPreciosMultiple")), Nothing, CType(ViewState("DtPreciosMultiple"), DataTable))
End Get
Set(value As DataTable)
ViewState("DtPreciosMultiple") = value
End Set
End Property
#End Region
Private ReadOnly Property PermiteClasificacion2 As Boolean
@@ -273,6 +282,7 @@ Partial Class ProductosyServicios
'CargaFamilia(ViewState("CveSubFamilia").ToString.ToEntero)
CargaSucursaless()
CargaImpuestosLocales()
CargaListaPrecios()
If UsuarioActual.TienePermisoProceso(122) Then
BtnEliminar.Visible = False
@@ -1714,6 +1724,10 @@ Partial Class ProductosyServicios
Next
End If
If Not TieneError Then
GuardarListasPrecios(ObjProductosServicios)
End If
If ObjProductosServicios.CvePS > 0 And Not TieneError Then
TieneError = GuardaEcommerce()
End If
@@ -2967,6 +2981,58 @@ Partial Class ProductosyServicios
#End Region
#Region "LISTA PRECIOS"
Private Sub CargaListaPrecios()
Dim objPS As New ClsProductosServicios
If objPS.GetPSPreciosLista(UsuarioActual.CveEmpresa, -1, CveClasificacion:=-1, CvePS:=CvePS,
CveProveedor:=-1, Estado:=-1, Marcas:="-1", CveModelo:=-1) Then
DtPreciosMultiple = objPS.DtResultados.Copy()
GvMultiple.DataSource = DtPreciosMultiple
End If
objPS.Dispose()
GvMultiple.DataBind()
End Sub
Protected Sub GvMultiple_RowDataBound(sender As Object, e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
Dim Valor As Decimal = DtPreciosMultiple.Rows(e.Row.RowIndex)(2).ToString().ToDecimal()
e.Row.FCTextBox("TxtPrecio").Text = Valor.FormatoNumero(2)
End If
End Sub
Private Sub GuardarListasPrecios(ObjPS As ClsProductosServicios)
Dim TieneError As Boolean = False
Try
For Each GvRow As GridViewRow In GvMultiple.Rows
Dim CvePrecioLista As Integer = GvRow.DataKey("CvePrecioLista").ToEntero()
Dim Precio As Decimal = GvRow.FCTextBox("TxtPrecio").Text.ToDecimal()
TieneError = Not ObjPS.UpdatePSPreciosLista(Precio, CvePrecioLista, 0, CvePS, UsuarioActual.CveUsuario, NowADS(), True)
If TieneError Then
Exit For
End If
Next
Catch ex As Exception
OnError("Ocurrió un error al actualizar precios", ex)
TieneError = True
End Try
If TieneError Then
Alert("Ocurrió un error al actualizar precios", TipoMensaje.MsgError)
End If
End Sub
#End Region
#Region "EXISTENCIAS"
Protected Sub GVExistencias_RowDataBound(sender As Object, e As GridViewRowEventArgs)