From 2aac9bafc521558f4036ab5b312f34fc765d39fc Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Thu, 26 Dec 2024 19:58:30 -0700 Subject: [PATCH] =?UTF-8?q?--validaci=C3=B3n=20de=20partidas=20cuando=20ti?= =?UTF-8?q?podocto:anticipo,=20al=20emitir,=20ya=20que=20puede=20venir=20d?= =?UTF-8?q?e=20cotizaci=C3=B3n/remision.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Ventas/Ventas.aspx.vb | 82 ++++++++++++++++++++++++++++++++----------- 1 file changed, 62 insertions(+), 20 deletions(-) diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 2d74eb9bf..bb4823d88 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -8746,12 +8746,16 @@ Partial Class Ventas e.Row.FCDropDownList("DdlPrecioListaEdit").DataSource = Dt End If End Using + ElseIf DdlTipoComprobante.SelectedValue = "Ant" Then + e.Row.FCHtmlGenericControl("DivPrecioLista").Visible = False End If - End If - e.Row.FCDropDownList("DdlPrecioListaEdit").DataBind() - e.Row.FCDropDownList("DdlPrecioListaEdit").SelectedValueExist(e.Row.DBCampo("CvePrecioLista")) + If e.Row.FCHtmlGenericControl("DivPrecioLista").Visible Then + e.Row.FCDropDownList("DdlPrecioListaEdit").DataBind() + e.Row.FCDropDownList("DdlPrecioListaEdit").SelectedValueExist(e.Row.DBCampo("CvePrecioLista")) + End If + End If 'Si es facturacion de OC o Contrato @@ -9351,17 +9355,47 @@ Partial Class Ventas NumTurnos = GvPS.Rows(e.RowIndex).FCTextBox("TxtNumTurnosEditar").Text.ToDecimal() End If + DatarowPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=GvPS.Rows(e.RowIndex).FCDropDownLost("DdlPS").SelectedValue.ToEntero()).FiltroPrimero("") ' Estado = -1 + + If UsuarioActual.Empresa.Funcionalidad(601) = "1" Then 'valida anticipo que tenga conceptos válidos + If DdlTipoComprobante.SelectedValue = "Ant" Then + Dim PSCodigoSAT As String = DatarowPS("SATClavePS").ToString + If PSCodigoSAT <> "84111506" Then + Alert($"El producto y/o servicio no es válido para generar anticipos.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + End If + End If + + If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then + If DdlTipoComprobante.SelectedValue = "Cot" Then + If PU < DatarowPS("PrecioMinimo").ToString().ToDecimal() Then + Alert($"El precio no puede ser menor al precio mínimo. Precio Mínimo: {DatarowPS("PrecioMinimo"):N2}", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + End If + End If + TmpDT.Rows.Remove(TmpDT.Rows(e.RowIndex)) CalculaUsados() Dim CvePrecioLista As Integer = -1 Dim PrecioLista As String = "" + If UsuarioActual.Empresa.Funcionalidad(109) = "1" OrElse UsuarioActual.Empresa.Funcionalidad(360) = "1" Then CvePrecioLista = GvPS.Rows(e.RowIndex).FCDropDownList("DdlPrecioListaEdit").SelectedValue.ToEntero() If UsuarioActual.CveEmpresa = 189 Then - PrecioLista = GvPS.Rows(e.RowIndex).FCDropDownList("DdlPrecioListaEdit").SelectedItem.Text.Split("-"c)(0) + If GvPS.Rows(e.RowIndex).FCDropDownList("DdlPrecioListaEdit").SelectedItem IsNot Nothing Then + Dim listaPL = GvPS.Rows(e.RowIndex).FCDropDownList("DdlPrecioListaEdit").SelectedItem.Text.Split("-"c) + If listaPL.Count() > 0 Then + PrecioLista = listaPL(0) + End If + End If Else - PrecioLista = GvPS.Rows(e.RowIndex).FCDropDownList("DdlPrecioListaEdit").SelectedItem.Text + If GvPS.Rows(e.RowIndex).FCDropDownList("DdlPrecioListaEdit").SelectedItem IsNot Nothing Then + PrecioLista = GvPS.Rows(e.RowIndex).FCDropDownList("DdlPrecioListaEdit").SelectedItem.Text + End If + End If End If @@ -9461,7 +9495,9 @@ Partial Class Ventas If UsuarioActual.Empresa.Funcionalidad(109) = "1" OrElse UsuarioActual.Empresa.Funcionalidad(360) = "1" Then CvePrecioLista = GvPS.Rows(e.RowIndex).FCDropDownList("DdlPrecioListaEdit").SelectedValue.ToEntero() - PrecioLista = GvPS.Rows(e.RowIndex).FCDropDownList("DdlPrecioListaEdit").SelectedItem.Text + If GvPS.Rows(e.RowIndex).FCDropDownList("DdlPrecioListaEdit").SelectedItem IsNot Nothing Then + PrecioLista = GvPS.Rows(e.RowIndex).FCDropDownList("DdlPrecioListaEdit").SelectedItem.Text + End If TmpDT.Rows(e.RowIndex)("CvePrecioLista") = CvePrecioLista TmpDT.Rows(e.RowIndex)("PrecioLista") = PrecioLista @@ -18728,7 +18764,13 @@ Partial Class Ventas Protected Sub DdlPSEdit_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) If UsuarioActual.Empresa.Funcionalidad(109) = "1" OrElse UsuarioActual.Empresa.Funcionalidad(558) = "1" Then - If GvPS.EditIndex >= 0 Then + + Dim EditarPrecio As Boolean = True + If DdlTipoComprobante.SelectedValue = "Ant" AndAlso UsuarioActual.CveEmpresa = 189 Then + EditarPrecio = False + End If + + If GvPS.EditIndex >= 0 AndAlso EditarPrecio Then Dim ddlPSEdit = DirectCast(sender, ADServerControl.Dropdownlost) Dim GvRow = DirectCast(ddlPSEdit.NamingContainer, GridViewRow) @@ -19512,11 +19554,6 @@ Partial Class Ventas Return False End If - If PU <= 0 Then - Alert("No se puede vender a un importe de cero", TipoMensaje.MsgAdvertencia) - Return False - End If - Dim PrecioLibre As Boolean = False @@ -19524,13 +19561,6 @@ Partial Class Ventas If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then Dim DatarowPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") If DatarowPS IsNot Nothing Then - If DdlTipoComprobante.SelectedValue = "Cot" Then - If PU < DatarowPS("PrecioMinimo").ToString().ToDecimal() Then - Alert($"El precio no puede ser menor al precio mínimo. Precio Mínimo: {DatarowPS("PrecioMinimo"):N2}", TipoMensaje.MsgAdvertencia) - Return False - End If - End If - If DdlTipoComprobante.SelectedValue = "Ant" Then Dim PSCodigoSAT As String = DatarowPS("SATClavePS").ToString If PSCodigoSAT <> "84111506" Then @@ -19539,11 +19569,23 @@ Partial Class Ventas End If End If + If DdlTipoComprobante.SelectedValue = "Cot" Then + If PU < DatarowPS("PrecioMinimo").ToString().ToDecimal() Then + Alert($"El precio no puede ser menor al precio mínimo. Precio Mínimo: {DatarowPS("PrecioMinimo"):N2}", TipoMensaje.MsgAdvertencia) + Return False + End If + End If + PrecioLibre = CBool(DatarowPS("PrecioLibre")) End If End If + If PU <= 0 Then + Alert("No se puede vender a un importe de cero", TipoMensaje.MsgAdvertencia) + Return False + End If + 'SI NO VIENE DESDE EL MODAL If CantidadModal = 0 Then If TxtCantidad.Text.ToDecimal() <= 0 Then @@ -19911,7 +19953,7 @@ Partial Class Ventas Descuento = Descuento + ((PU * PromocionPorcentaje / 100) * Cantidad) End If ElseIf TipoPromo = 3 Then 'Promocion por Cantidad - If Cantidad >= CantMinima Then + If Cantidad >= CantMinima Then Descuento = Descuento + TotalPromocion Else CvePromocionDetalle = -1