-- código temporal, para activación de GDIAZ -- cliente DICA, precio ventas 7% arriba costo

This commit is contained in:
2025-01-09 07:28:58 -07:00
parent b0201d1c93
commit 5831f47925

View File

@@ -9054,69 +9054,66 @@ Partial Class Ventas
GvPS.DataSource = TmpDT
DtInv = TmpDT.Copy.FiltraParametros("CveTipoPS = 2")
GvPS.DataBind()
If UsuarioActual.TienePermisoProceso(253) Then
GvPS.Rows(e.NewEditIndex).FCTextBox("TxtPrecio").Enabled = True
End If
Dim gvr As GridViewRow = GvPS.Rows(e.NewEditIndex)
If UsuarioActual.Empresa.Funcionalidad(558) = "1" Then
GvPS.Rows(e.NewEditIndex).FCDropDownList("DdlUnidadMedida").Enabled = False
GvPS.Rows(e.NewEditIndex).FCDropDownList("DdlClasificacion").Enabled = False
gvr.FCDropDownList("DdlUnidadMedida").Enabled = False
gvr.FCDropDownList("DdlClasificacion").Enabled = False
End If
'SI ES LLANTERA NO DEBE BLOQUEAR EL TEXTBOX
If GvPS.Rows(e.NewEditIndex).DataKey("CvePromocionDetalle").ToString().ToEntero() > 0 AndAlso (Not UsuarioActual.Empresa.Funcionalidad(558) = "1") Then
GvPS.Rows(e.NewEditIndex).FCTextBox("TxtDescuento").Enabled = False
GvPS.Rows(e.NewEditIndex).FCTextBox("TxtDescuento").ToolTip = "No se puede editar el descuento porque viene de una promoción"
If gvr.DataKey("CvePromocionDetalle").ToString().ToEntero() > 0 AndAlso (Not UsuarioActual.Empresa.Funcionalidad(558) = "1") Then
gvr.FCTextBox("TxtDescuento").Enabled = False
gvr.FCTextBox("TxtDescuento").ToolTip = "No se puede editar el descuento porque viene de una promoción"
End If
If Me.CveVenta > 0 AndAlso UsuarioActual.CveEmpresa = 119 AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Cot") Then
GvPS.Rows(e.NewEditIndex).FCTextBox("TxtDescuento").Enabled = False
gvr.FCTextBox("TxtDescuento").Enabled = False
End If
If CveVenta > 0 AndAlso UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
GvPS.Rows(e.NewEditIndex).FCTextBox("TxtCantidad").Enabled = False
gvr.FCTextBox("TxtCantidad").Enabled = False
GvPS.Rows(e.NewEditIndex).FCDropDownList("DdlUnidadMedida").Enabled = False
GvPS.Rows(e.NewEditIndex).FCDropDownLost("DdlPS").Enabled = False
GvPS.Rows(e.NewEditIndex).FCDropDownLost("DdlPS").ddlWS.Attributes.Add("disabled", "disabled")
GvPS.Rows(e.NewEditIndex).FCDropDownList("DdlUnidadMedida").Enabled = False
GvPS.Rows(e.NewEditIndex).FCDropDownList("DdlClasificacion").Enabled = False
GvPS.Rows(e.NewEditIndex).FCDropDownList("DdlProyecto").Enabled = False
GvPS.Rows(e.NewEditIndex).FCDropDownList("DdlSubProyecto").Enabled = False
gvr.FCDropDownList("DdlUnidadMedida").Enabled = False
gvr.FCDropDownLost("DdlPS").Enabled = False
gvr.FCDropDownLost("DdlPS").ddlWS.Attributes.Add("disabled", "disabled")
gvr.FCDropDownList("DdlUnidadMedida").Enabled = False
gvr.FCDropDownList("DdlClasificacion").Enabled = False
gvr.FCDropDownList("DdlProyecto").Enabled = False
gvr.FCDropDownList("DdlSubProyecto").Enabled = False
GvPS.Rows(e.NewEditIndex).FCTextBox("TxtObsPS").Enabled = True
GvPS.Rows(e.NewEditIndex).FCTextBox("TxtPrecio").Enabled = False
GvPS.Rows(e.NewEditIndex).FCTextBox("TxtDescuento").Enabled = False
gvr.FCTextBox("TxtObsPS").Enabled = True
gvr.FCTextBox("TxtPrecio").Enabled = False
gvr.FCTextBox("TxtDescuento").Enabled = False
End If
If (CveVenta <= 0 OrElse EsCreaApartirDe) AndAlso UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
Try
If GvPS.Rows(e.NewEditIndex).DataKey("CvePrecioLista").ToString().ToEntero() > 0 Then
GvPS.Rows(e.NewEditIndex).FCTextBox("TxtPrecio").Enabled = False
If gvr.DataKey("CvePrecioLista").ToString().ToEntero() > 0 Then
gvr.FCTextBox("TxtPrecio").Enabled = False
End If
Catch ex As Exception
End Try
GvPS.Rows(e.NewEditIndex).FCTextBox("TxtDescuento").Enabled = False
gvr.FCTextBox("TxtDescuento").Enabled = False
End If
If EsVentaMedica Then
GvPS.Rows(e.NewEditIndex).FCTextBox("TxtPrecio").Enabled = False
gvr.FCTextBox("TxtPrecio").Enabled = False
If DdlTipoComprobante.SelectedValue = "Cot" Or RBLTipoVenta.SelectedValue.ToEntero = 2 Then
GvPS.Rows(e.NewEditIndex).FCTextBox("TxtPrecio").Enabled = True
gvr.FCTextBox("TxtPrecio").Enabled = True
End If
End If
If CveCicloComercial > 0 Then
For Each gvr As GridViewRow In GvContratoDetalles.Rows
If gvr.RowType = DataControlRowType.DataRow Then
If gvr.DataKey("Cantidad").ToString().ToDecimal() = GvPS.Rows(e.NewEditIndex).DataKey("Cantidad").ToString().ToDecimal() AndAlso gvr.DataKey("CvePS").ToString().ToEntero() = GvPS.Rows(e.NewEditIndex).DataKey("CvePS").ToString().ToEntero() Then
If gvr.DataKey("LimitarCantidad").ToString() = "False" Then
GvPS.Rows(e.NewEditIndex).FCTextBox("TxtCantidad").Enabled = True
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("LimitarCantidad").ToString() = "False" Then
gvr.FCTextBox("TxtCantidad").Enabled = True
Exit For
End If
End If
@@ -9126,15 +9123,14 @@ Partial Class Ventas
End If
If UsuarioActual.CveEmpresa = 189 Then
Dim DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=TmpDT.Rows(e.NewEditIndex)("CvePS").ToString().ToEntero()).FiltroPrimero("")
Dim DrPS = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=TmpDT.Rows(e.NewEditIndex)("CvePS").ToString().ToEntero()).FiltroPrimero("")
If CBool(DrPS("PrecioLibre")) Then
GvPS.Rows(e.NewEditIndex).FCTextBox("TxtPrecio").Enabled = True
Else
GvPS.Rows(e.NewEditIndex).FCTextBox("TxtPrecio").Enabled = False
If DrPS IsNot Nothing Then
gvr.FCTextBox("TxtPrecio").Enabled = CBool(DrPS("PrecioLibre"))
End If
End If
End If
If UsuarioActual.TienePermisoProceso(253) Then gvr.FCTextBox("TxtPrecio").Enabled = True
UpPS.Update()
@@ -18318,9 +18314,11 @@ Partial Class Ventas
DdlUnidadMedida.DataBind()
DdlUnidadMedida.SelectedValueExist(drPS("CveUnidadMedida").ToString())
If UsuarioActual.TienePermisoProceso(253) Then TxtPrecio.Enabled = True
If EsVentaMedica Then
TxtPrecio.Enabled = False
If UsuarioActual.CveUsuario = 3986 Or RBLTipoVenta.SelectedValue.ToEntero = 2 Then
If UsuarioActual.CveUsuario = 3986 OrElse RBLTipoVenta.SelectedValue = "2" Then
TxtPrecio.Enabled = True
End If
@@ -18339,11 +18337,7 @@ Partial Class Ventas
End If
End If
Dim PSCodigoSAT As String = drPS("SATClavePS").ToString
If UsuarioActual.TienePermisoProceso(68) AndAlso Not PSCodigoSAT.Contiene("84111506", "80141610") Then TxtPrecio.Enabled = False
If UsuarioActual.TienePermisoProceso(68) AndAlso Not drPS("SATClavePS").ToString.Contiene("84111506", "80141610") Then TxtPrecio.Enabled = False
If TmpDT IsNot Nothing AndAlso TmpDT.Rows.Count = 0 AndAlso Not ChkEmitirComercioExterior.Checked Then
DdlMoneda.SelectedValueExist(drPS("CveMoneda").ToString())
@@ -18355,7 +18349,6 @@ Partial Class Ventas
Dim tPrecioSugerido As Decimal = 0
tPrecioSugerido = drPS("Precio").ToString().ToDecimal
Dim ObjPrecioSugerido As Modelos.MPrecioSugerido = CalculaPrecioSugerido(CvePSParametro, drPS("CveClasificacion").ToString().ToEntero())
PrecioSugerido = ObjPrecioSugerido.PrecioSugerido
If ObjPrecioSugerido.CvePrecioLista > 0 AndAlso DivPrecioLista.Visible Then
@@ -18397,14 +18390,10 @@ Partial Class Ventas
If Not CBool(drPS("PrecioLibre")) Then
Alert("No se encontraron listas de precio disponibles", TipoMensaje.MsgAdvertencia)
End If
End If
End If
End If
End If
End If
End If
If UsuarioActual.CveEmpresa = 189 Then
@@ -18423,6 +18412,7 @@ Partial Class Ventas
TxtPrecio.Enabled = CBool(drPS("PrecioLibre"))
End If
End If
If UsuarioActual.TienePermisoProceso(253) Then TxtPrecio.Enabled = True 'permiso para activar los precios
If PrecioSugerido <= 0 Then PrecioSugerido = tPrecioSugerido
@@ -18488,17 +18478,32 @@ Partial Class Ventas
thCosto.Visible = True
thCosto2.Visible = True
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
'RMF código temporal. GDiaz. cliente DICA 7%
If CveCliente = 1555244 Then
PrecioSugerido = Costo * 1.07D
TxtPrecio.Text = PrecioSugerido.ToString("#,##0.####")
End If
If Costo > 0 Then
If TxtPrecio.Text.ToDecimal() > 0 Then
Dim PorUtilidad = String.Format("{0:N2} %", ((TxtPrecio.Text.ToDecimal() - Costo) / TxtPrecio.Text.ToDecimal()) * 100D)
Dim PorUtilidad = String.Format("{0:N2} %", ((TxtPrecio.Text.ToDecimal() - Costo) / Costo) * 100D)
LtlHeaderCosto.Text = String.Format("{0:N2} <br/> {1}", Costo, PorUtilidad)
End If
End If
@@ -19599,7 +19604,7 @@ Partial Class Ventas
objPS.Dispose()
End If
Dim ValidaExistencia As Boolean = (DdlTipoComprobante.SelectedValue <> "Cot" And ChkSinExistencia.Checked = False) Or UsuarioActual.Empresa.Funcionalidad(578).ToEntero = 1
Dim ValidaExistencia As Boolean = (DdlTipoComprobante.SelectedValue <> "Cot" And ChkSinExistencia.Checked = False) OrElse UsuarioActual.Empresa.Funcionalidad(578).ToEntero = 1
If CantidadOriginal > 0 Then
'SI NO HAY CAMBIOS EN LAS CANTIDADES, NO VALIDAR EXISTENCIA
@@ -19673,6 +19678,9 @@ Partial Class Ventas
End If
Dim VerificarCostos As Boolean = True
If CveCliente = 1555244 Then ' GDIAZ - DICA
VerificarCostos = False
End If
If ObjDescuento IsNot Nothing Then
If ObjDescuento.CvePromocionDetalle > 0 Then
VerificarCostos = False
@@ -19755,8 +19763,6 @@ Partial Class Ventas
End If
End If
End If
End If
End If