diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb
index c935eefec..025faa0a2 100644
--- a/Ventas/Ventas.aspx.vb
+++ b/Ventas/Ventas.aspx.vb
@@ -8732,7 +8732,7 @@ Partial Class Ventas
e.Row.FCDropDownList("DdlClasificacion").DataBind()
e.Row.FCDropDownList("DdlClasificacion").SelectedValue = e.Row.DBCampo("CveClasificacion")
CargaPS(e.Row.FCDropDownList("DdlClasificacion").SelectedValue.ToEntero(), e.Row.FCDropDownLost("DdlPS"))
- e.Row.FCDropDownLost("DdlPS").SelectedText = e.Row.DBCampo("PS")
+ e.Row.FCDropDownLost("DdlPS").SelectedText = e.Row.DBCampo("CodigoPS")
e.Row.FCDropDownLost("DdlPS").SelectedValue = e.Row.DBCampo("CvePS")
@@ -9044,10 +9044,6 @@ Partial Class Ventas
GvPS.DataBind()
Dim gvr As GridViewRow = GvPS.Rows(e.NewEditIndex)
- If UsuarioActual.TienePermisoProceso(253) Then
- GvPS.Rows(e.NewEditIndex).FCTextBox("TxtPrecio").Enabled = True
- End If
-
If UsuarioActual.Empresa.Funcionalidad(558) = "1" Then
gvr.FCDropDownList("DdlUnidadMedida").Enabled = False
gvr.FCDropDownList("DdlClasificacion").Enabled = False
@@ -9103,7 +9099,7 @@ Partial Class Ventas
If CveCicloComercial > 0 Then
For Each gvrcd As GridViewRow In GvContratoDetalles.Rows
If gvrcd.RowType = DataControlRowType.DataRow Then
- If gvrcd.DataKey("Cantidad").ToString().ToDecimal() = gvr.DataKey("Cantidad").ToString().ToDecimal() AndAlso gvrcd.DataKey("CvePS").ToString().ToEntero() = gvr.DataKey("CvePS").ToString().ToEntero() Then
+ If gvrcd.DataKey("Cantidad").ToString().ToDecimal() = gvr.DataKey("Cantidad").ToDecimal() AndAlso gvrcd.DataKey("CvePS").ToEntero() = gvr.DataKey("CvePS").ToEntero() Then
If gvrcd.DataKey("LimitarCantidad").ToString() = "False" Then
gvr.FCTextBox("TxtCantidad").Enabled = True
Exit For
@@ -9115,7 +9111,7 @@ Partial Class Ventas
End If
If UsuarioActual.CveEmpresa = 189 Then
- Dim DrPS = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=TmpDT.Rows(e.NewEditIndex)("CvePS").ToString().ToEntero()).FiltroPrimero("")
+ Dim DrPS = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=gvr.DataKey("CvePS").ToEntero()).FiltroPrimero("")
If DrPS IsNot Nothing Then
gvr.FCTextBox("TxtPrecio").Enabled = CBool(DrPS("PrecioLibre"))
@@ -18690,6 +18686,31 @@ Partial Class Ventas
End If
End If
+ If UsuarioActual.CveEmpresa = 189 AndAlso CveCliente = 1555244 Then
+ Dim Costo As Decimal
+ If UsuarioActual.Empresa.Funcionalidad(602) = "UC" Then 'validación sobre el último costo
+ Dim ObjInventarios As New ClsInventarios
+ If ObjInventarios.GetUltimoCosto(UsuarioActual.CveEmpresa, CvePSParametro) Then
+ Dim dr As DataRow = ObjInventarios.DtResultados.FiltroPrimero("")
+ If dr IsNot Nothing Then
+ Costo = dr("UltimoCosto").ToString.ToDecimal
+ End If
+ End If
+ ObjInventarios.Dispose()
+ Else
+ Dim ObjInventarios As New ClsInventarios
+ Costo = ObjInventarios.GetCostoPS(CvePSParametro, TxtCantidad.Text.Trim.ToDecimal, -1, "-1", TxtFecha.Text.ToDate, DdlSubProyectoDatos.SelectedValue.ToEntero(), CveTipoAlmacen:=1)
+ 'si el costo es cero, puede ser que no halla movimientos del producto, en esa sucursal. y se volverá a sacar sin especificar sucursal
+ If Costo <= 0 Then Costo = ObjInventarios.GetCostoPS(CvePSParametro, TxtCantidad.Text.Trim.ToDecimal, -1, "-1", TxtFecha.Text.ToDate, -1, CveTipoAlmacen:=1)
+ ObjInventarios.Dispose()
+ End If
+
+ If CveCliente = 1555244 Then
+ PrecioSugerido = Costo * 1.07D
+ 'TxtPrecio.Text = PrecioSugerido.ToString("#,##0.####")
+ End If
+ End If
+
Retorno.PrecioSugerido = PrecioSugerido
Return Retorno
@@ -19660,7 +19681,8 @@ Partial Class Ventas
End Using
If CveVenta <= 0 OrElse Me.EsCreaApartirDe Then
- If Existencia - TmpDT.SUM("Cantidad", $"CvePS = {CvePS} AND (EntregaDirecta IS NULL OR EntregaDirecta < 1)") < (If(CantidadModal > 0, CantidadModal, Cantidad)) Then
+ Dim tCantValidar As Decimal = TmpDT.SUM("Cantidad", $"CvePS = {CvePS} AND (EntregaDirecta IS NULL OR EntregaDirecta < 1)") - CantidadOriginal + (If(CantidadModal > 0, CantidadModal, Cantidad))
+ If Existencia - tCantValidar < 0 Then
Dim CveAlmacenConsulta As Integer = -1
Dim StrAlmacen As New StringBuilder
@@ -19672,12 +19694,12 @@ Partial Class Ventas
StrAlmacen.AppendFormat("
Almacén: {0}", Almacen)
End If
End If
- Alert("No cuenta con la cantidad suficiente en inventario. Cuenta con " + Existencia.FormatoNumero(2) + "." + StrAlmacen.ToString(), TipoMensaje.MsgAdvertencia)
+ Alert("No cuenta con la cantidad suficiente en inventario. Cuenta con " + Existencia.ToString("#,##0.####") + "." + StrAlmacen.ToString(), TipoMensaje.MsgAdvertencia)
Return False
End If
Else
If DdlTipoComprobante.SelectedValue = "Rem" Then
- Dim CantidadVenta As Double = 0
+ Dim CantidadVenta As Decimal = 0
Using ObjVentasE As New ClsVentas
If ObjVentasE.GetVentaDetalle(CveVenta) Then
CantidadVenta = ObjVentasE.DtResultados.SUM("Cantidad", $"CvePS = {CvePS}")
@@ -19687,7 +19709,7 @@ Partial Class Ventas
'SUMA LO YA RESTADO EN PENDIENTE POR SURTIR QUE PERTENESCA A LA VENTA.
'PARA QUE NO RESTE LA EXISTENCIA 2 VECES Y PUEDAS COMPARAR LO REAL
If (Existencia + CantidadVenta) - TmpDT.SUM("Cantidad", $"CvePS = {CvePS} And (EntregaDirecta Is NULL Or EntregaDirecta < 1)") < (If(CantidadModal > 0, CantidadModal, Cantidad)) Then
- Alert("No cuenta con la cantidad suficiente en inventario. Cuenta con " + Existencia.FormatoNumero(2) + ".", TipoMensaje.MsgAdvertencia)
+ Alert("No cuenta con la cantidad suficiente en inventario. Cuenta con " + Existencia.ToString("#,##0.####") + ".", TipoMensaje.MsgAdvertencia)
Return False
End If
End If