--Agregar productos similares o complementarios en ventas

This commit is contained in:
2024-06-05 14:05:46 -07:00
parent 8fdf1c8c15
commit 52a976d9ba
10 changed files with 229 additions and 9 deletions

View File

@@ -8710,6 +8710,9 @@ Partial Class Ventas
If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then
e.Row.FCLinkButton("LnkDescuentos").Visible = True
If e.Row.DBCampo("TipoDocto") = "Cot" AndAlso CveVenta > 0 AndAlso Not EsCreaApartirDe Then
e.Row.FCLinkButton("imgClone").Visible = False
End If
End If
'If GvInv.Rows.Count > 0 AndAlso ModalidadEdicion AndAlso DdlTipoComprobante.SelectedValue = "Rem" AndAlso e.Row.DataKey("CveVentaDetalle").ToString().ToEntero() > 0 Then
@@ -31522,6 +31525,10 @@ Partial Class Ventas
LnkDescuentosRNC.Visible = UsuarioActual.TienePermisoProceso(328)
End If
If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then
GvPS.Columns(19).Visible = True
End If
UpPS.Update()
UPPDescuento.Update()
UPObservaciones.Update()
@@ -33635,12 +33642,85 @@ Partial Class Ventas
ObjVentas.Dispose()
ObjEventos.Dispose()
End Sub
#End Region
Private Sub BtnRefrescarPagina_Click(sender As Object, e As EventArgs) Handles BtnRefrescarPagina.Click
Response.Redirect($"~/Ventas/Ventas.aspx?CveVenta={Me.CveVenta}")
End Sub
#End Region
Private Sub BtnCargarPSAdicionales_Click(sender As Object, e As EventArgs) Handles BtnCargarPSAdicionales.Click
Dim CvePS = HdnCvePSComparar.Value.ToEntero()
If CvePS > 0 Then
Dim ObjProductosServicios As New ClsProductosServicios()
If ObjProductosServicios.GetPSAdicionales(CvePS, UsuarioActual.CveEmpresa) Then
GvPSAdicionales.DataSource = ObjProductosServicios.DtResultados.FiltraParametros($"Tipo={HdnTipoPSComparar.Value}")
End If
ObjProductosServicios.Dispose()
If HdnTipoPSComparar.Value = "1" Then
LtlNombreModalPS.Text = "Productos y/o servicios complementarios"
ElseIf HdnTipoPSComparar.Value = "2" Then
LtlNombreModalPS.Text = "Productos y/o servicios similares"
End If
GvPSAdicionales.DataBind()
UpSimilares.Update()
RegistraScript("$('#DivSimilares').modal({backdrop: 'static', keyboard: false });")
End If
End Sub
Private Sub BtnAgregarPSSimilar_Click(sender As Object, e As EventArgs) Handles BtnAgregarPSSimilar.Click
If HdnTipoPSComparar.Value.ToEntero() > 0 Then
If GvPSAdicionales.Rows.Cast(Of GridViewRow)().Count(Function(gvr) gvr.FCCheckBox("chkPSAdicional").Checked) <= 0 Then
Alert($"Debe seleccionar al menos 1 producto", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
'VALIDA
For Each Row As GridViewRow In GvPSAdicionales.Rows
If Row.RowType = DataControlRowType.DataRow Then
If Row.FCCheckBox("chkPSAdicional").Checked Then
If Row.FCTextBox("TxtCantidad").Text.ToDecimal() <= 0.00 Then
Alert($"La cantidad del producto y/o servicio {Row.DataKey("CodigoPS")} debe ser mayor a 0", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
End If
End If
Next
'AGREGA
For Each Row As GridViewRow In GvPSAdicionales.Rows
If Row.RowType = DataControlRowType.DataRow Then
If Row.FCCheckBox("chkPSAdicional").Checked Then
Dim CvePS As Integer = Row.DataKey("CvePS").ToEntero()
HdnPS.Value = CvePS.ToString()
DdlPS.SelectedValue = CvePS.ToString()
DdlPS.SelectedText = Row.DataKey("CodigoPS")
TxtCantidad.Text = Row.FCTextBox("TxtCantidad").Text
Dim DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("")
If DrPS IsNot Nothing Then
DdlUnidadMedida.SelectedValueExistInsert(DrPS("CveUnidadMedida").ToString(), DrPS("UnidadMedida").ToString())
DdlPSIndexChange(DdlPS.SelectedValue.ToEntero(), DdlPS)
AgregarPS()
End If
End If
End If
Next
End If
HdnTipoPSComparar.Value = "-1"
HdnCvePSComparar.Value = "-1"
End Sub
#Region "U S A D O S"