diff --git a/Bancos/DepositosCaja.aspx.vb b/Bancos/DepositosCaja.aspx.vb index a564399a9..e283820f4 100644 --- a/Bancos/DepositosCaja.aspx.vb +++ b/Bancos/DepositosCaja.aspx.vb @@ -511,7 +511,19 @@ Partial Class Bancos_DepositosCaja FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.Trim().ToDate, MinFecha) FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.Trim().ToDate, MaxFecha).AddDays(1) - If ObjMovtos.GetRemisionesCobranza(UsuarioActual.CveEmpresa, DdlSubProyectos.SelectedValue.ToEntero, FechaI, FechaF, UsuarioActual.CveUsuario) Then + Dim CveSubProyecto As Integer = -1 + + If DdlSubProyectos.SelectedValue.ToEntero > 0 Then + CveSubProyecto = DdlSubProyectos.SelectedValue.ToEntero + End If + + Dim CveSubProyectoCuenta = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveCuenta:=DdlCajaChica.SelectedValue.ToEntero(), CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto").ToEntero() + + If CveSubProyectoCuenta > 0 Then + CveSubProyecto = CveSubProyectoCuenta + End If + + If ObjMovtos.GetRemisionesCobranza(UsuarioActual.CveEmpresa, CveSubProyecto, FechaI, FechaF) Then Dim dtt As DataTable = ObjMovtos.DtResultados.FiltraParametros($"CveVenta > 0 AND (CveUsuarioCobranza IS NULL OR CveUsuarioCobranza = {UsuarioActual.CveUsuario}) AND TipoDocto IN ('Ing','Rem') AND RemisionEspecial = 0") 'Dim Dtta As DataTable = dtt.FiltraParametros($"CveUsuarioCobranza = {UsuarioActual.CveUsuario} ") 'If Dtta IsNot Nothing AndAlso Dtta.Rows.Count > 0 Then dtt = Dtta diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 58ed3852e..08e233716 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -8715,8 +8715,25 @@ Partial Class Ventas If UsuarioActual.Empresa.Funcionalidad(360) = "1" OrElse UsuarioActual.Empresa.Funcionalidad(109) = "1" Then e.Row.FCHtmlGenericControl("DivPrecioLista").Visible = True e.Row.FCDropDownList("DdlPrecioListaEdit").DataSource = GlobalDTPrecioListas(UsuarioActual.CveEmpresa) - e.Row.FCDropDownList("DdlPrecioListaEdit").DataBind() + If UsuarioActual.CveEmpresa = 189 Then + If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Cot", "Ped") Then + Using ObjVta As New ClsVentas + If ObjVta.GetPreciosListaSPPermitidos(DdlSubProyectoDatos.SelectedValue.ToEntero(), e.Row.DBCampo("CvePS").ToEntero(), UsuarioActual.CveEmpresa) Then + Dim Dt As DataTable = Nothing + If UsuarioActual.TienePermisoProceso(384) Then + Dt = ObjVta.DtResultados.Copy() + Else + Dt = ObjVta.DtResultados.FiltraParametros("Restringuida = 'False'") + End If + e.Row.FCDropDownList("DdlPrecioListaEdit").DataSource = Dt + End If + End Using + End If + + End If + + e.Row.FCDropDownList("DdlPrecioListaEdit").DataBind() e.Row.FCDropDownList("DdlPrecioListaEdit").SelectedValueExist(e.Row.DBCampo("CvePrecioLista")) End If @@ -8993,8 +9010,15 @@ Partial Class Ventas End If - If UsuarioActual.CveEmpresa = 189 AndAlso Not DdlTipoComprobante.SelectedValue.Contiene("Ant") Then - GvPS.Rows(e.NewEditIndex).FCTextBox("TxtPrecio").Enabled = False + If UsuarioActual.CveEmpresa = 189 Then + Dim DrPS = GlobalDTPS(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 + End If + End If End Sub @@ -9049,6 +9073,7 @@ Partial Class Ventas Dim DatarowPS As DataRow = Nothing DatarowPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=TmpDT.Rows(e.RowIndex)("CvePS").ToString().ToEntero()).FiltroPrimero("") ' Estado = -1 + Dim PrecioLibre As Boolean = False If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then If DdlTipoComprobante.SelectedValue = "Cot" Then If PU < DatarowPS("PrecioMinimo").ToString().ToDecimal() Then @@ -9057,6 +9082,8 @@ Partial Class Ventas End If End If + PrecioLibre = CBool(DatarowPS("PrecioLibre")) + If DdlTipoComprobante.SelectedValue = "Ant" Then Dim PSCodigoSAT As String = DatarowPS("SATClavePS").ToString If PSCodigoSAT <> "84111506" Then @@ -9225,35 +9252,39 @@ Partial Class Ventas 'NO DEJA REGISTRAR MENOS AL PRECIO MINIMO Dim MensajeCosto As New StringBuilder Dim TienePermisoImportes As Boolean = UsuarioActual.TienePermisoProceso(201) - If Not EsValido Then - MensajeCosto.AppendFormat("El Producto {0}. No se puede vender a un precio menor de su Costo
", DatarowPS("PS").ToString()) - If TienePermisoImportes Then - MensajeCosto.AppendFormat("El costo del producto es: ${0:#,###.00}
", Costo) - MensajeCosto.AppendFormat("El rango menor aceptado es: {0:#,###.00}% ${1}
", PorcentajeMinimoCostoEmpresa, CostoMenor) - MensajeCosto.AppendFormat("El precio indicado es: ${0:#,###.00} ({1}% de ganancia)
", PU.FormatoNumero, (If(Costo > 0, ((PU - Costo) * 100) / Costo, 0)).FormatoNumero) + + If Not PrecioLibre Then + If Not EsValido Then + MensajeCosto.AppendFormat("El Producto {0}. No se puede vender a un precio menor de su Costo
", DatarowPS("PS").ToString()) + If TienePermisoImportes Then + MensajeCosto.AppendFormat("El costo del producto es: ${0:#,###.00}
", Costo) + MensajeCosto.AppendFormat("El rango menor aceptado es: {0:#,###.00}% ${1}
", PorcentajeMinimoCostoEmpresa, CostoMenor) + MensajeCosto.AppendFormat("El precio indicado es: ${0:#,###.00} ({1}% de ganancia)
", PU.FormatoNumero, (If(Costo > 0, ((PU - Costo) * 100) / Costo, 0)).FormatoNumero) + End If + + + Alert(String.Format(MensajeCosto.ToString()), TipoMensaje.MsgAdvertencia) + MensajeCosto.Clear() + e.Cancel = True + Exit Sub End If - - Alert(String.Format(MensajeCosto.ToString()), TipoMensaje.MsgAdvertencia) - MensajeCosto.Clear() - e.Cancel = True - Exit Sub - End If - - 'NO DEJA REGISTRAR MAS AL PRECIO MAXIMO - If Not EsValidoMayor Then - MensajeCosto.AppendFormat("El Producto {0}. No se puede vender a un precio mayor de su rango aceptado
", HdnPS.Value) - If TienePermisoImportes Then - MensajeCosto.AppendFormat("El costo del producto es: ${0:#,###.00}
", Costo) - MensajeCosto.AppendFormat("El rango mayor aceptado es: {0}% ${1:#,###.00}
", UsuarioActual.Empresa.Funcionalidad(133).ToEntero(), CostoMayor) - MensajeCosto.AppendFormat("El precio indicado es: ${0:#,###.00} ({1}% de ganancia)
", PU.FormatoNumero, (If(Costo > 0, ((PU - Costo) * 100) / Costo, 0)).FormatoNumero) + 'NO DEJA REGISTRAR MAS AL PRECIO MAXIMO + If Not EsValidoMayor Then + MensajeCosto.AppendFormat("El Producto {0}. No se puede vender a un precio mayor de su rango aceptado
", HdnPS.Value) + If TienePermisoImportes Then + MensajeCosto.AppendFormat("El costo del producto es: ${0:#,###.00}
", Costo) + MensajeCosto.AppendFormat("El rango mayor aceptado es: {0}% ${1:#,###.00}
", UsuarioActual.Empresa.Funcionalidad(133).ToEntero(), CostoMayor) + MensajeCosto.AppendFormat("El precio indicado es: ${0:#,###.00} ({1}% de ganancia)
", PU.FormatoNumero, (If(Costo > 0, ((PU - Costo) * 100) / Costo, 0)).FormatoNumero) + End If + Alert(MensajeCosto.ToString(), TipoMensaje.MsgAdvertencia) + MensajeCosto.Clear() + e.Cancel = True + Exit Sub End If - Alert(MensajeCosto.ToString(), TipoMensaje.MsgAdvertencia) - MensajeCosto.Clear() - e.Cancel = True - Exit Sub End If + End If End If End If @@ -18358,7 +18389,10 @@ Partial Class Ventas tPrecioSugerido = 0 PrecioSugerido = 0 - Alert("No se encontro una lista de precios permitida en la sucursal actual", TipoMensaje.MsgAdvertencia) + If Not CBool(drPS("PrecioLibre")) Then + Alert("No se encontro una lista de precios permitida en la sucursal actual", TipoMensaje.MsgAdvertencia) + End If + End If Else ObjPrecioSugerido.CvePrecioLista = -1 @@ -18366,7 +18400,10 @@ Partial Class Ventas tPrecioSugerido = 0 PrecioSugerido = 0 - Alert("No se encontraron listas de precio disponibles", TipoMensaje.MsgAdvertencia) + If Not CBool(drPS("PrecioLibre")) Then + Alert("No se encontraron listas de precio disponibles", TipoMensaje.MsgAdvertencia) + End If + End If End If @@ -18387,11 +18424,10 @@ Partial Class Ventas tPrecioSugerido = 0 PrecioSugerido = 0 - TxtPrecio.Enabled = True + TxtPrecio.Enabled = CBool(drPS("PrecioLibre")) Else - TxtPrecio.Enabled = False + TxtPrecio.Enabled = CBool(drPS("PrecioLibre")) End If - End If If PrecioSugerido <= 0 Then PrecioSugerido = tPrecioSugerido @@ -18467,8 +18503,10 @@ Partial Class Ventas ObjInventarios.Dispose() If Costo > 0 Then - Dim PorUtilidad = String.Format("{0:N2} %", ((TxtPrecio.Text.ToDecimal() - Costo) / TxtPrecio.Text.ToDecimal()) * 100D) - LtlHeaderCosto.Text = String.Format("{0:N2}
{1}", Costo, PorUtilidad) + If TxtPrecio.Text.ToDecimal() > 0 Then + Dim PorUtilidad = String.Format("{0:N2} %", ((TxtPrecio.Text.ToDecimal() - Costo) / TxtPrecio.Text.ToDecimal()) * 100D) + LtlHeaderCosto.Text = String.Format("{0:N2}
{1}", Costo, PorUtilidad) + End If End If End If End If @@ -19411,6 +19449,8 @@ Partial Class Ventas Return False End If + Dim PrecioLibre As Boolean = False + If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then Dim DatarowPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") If DatarowPS IsNot Nothing Then @@ -19429,6 +19469,8 @@ Partial Class Ventas End If End If + PrecioLibre = CBool(DatarowPS("PrecioLibre")) + End If End If @@ -19647,30 +19689,33 @@ Partial Class Ventas End If 'NO DEJA REGISTRAR MENOS AL PRECIO MINIMO - Dim MensajeCosto As New StringBuilder - Dim TienePermisoImportes As Boolean = UsuarioActual.TienePermisoProceso(201) - If Not EsValido Then - MensajeCosto.AppendFormat("El Producto {0}-{1}. No se puede vender a un precio menor de su Costo
", HdnCodigoPS.Value, HdnPS.Value) - If TienePermisoImportes Then - MensajeCosto.AppendFormat("El costo del producto es: ${0:#,###.00}
", Costo) - MensajeCosto.AppendFormat("El rango menor aceptado es: {0}% ${1:#,###.00}
", PorcentajeMinimoCostoEmpresa, CostoMenor) - MensajeCosto.AppendFormat("El precio indicado es: ${0:#,###.00} ({1}% de ganancia)
", PU.FormatoNumero, (If(Costo > 0, ((PU - Costo) * 100) / Costo, 0)).FormatoNumero) + If Not PrecioLibre Then + Dim MensajeCosto As New StringBuilder + Dim TienePermisoImportes As Boolean = UsuarioActual.TienePermisoProceso(201) + + If Not EsValido Then + MensajeCosto.AppendFormat("El Producto {0}-{1}. No se puede vender a un precio menor de su Costo
", HdnCodigoPS.Value, HdnPS.Value) + If TienePermisoImportes Then + MensajeCosto.AppendFormat("El costo del producto es: ${0:#,###.00}
", Costo) + MensajeCosto.AppendFormat("El rango menor aceptado es: {0}% ${1:#,###.00}
", PorcentajeMinimoCostoEmpresa, CostoMenor) + MensajeCosto.AppendFormat("El precio indicado es: ${0:#,###.00} ({1}% de ganancia)
", PU.FormatoNumero, (If(Costo > 0, ((PU - Costo) * 100) / Costo, 0)).FormatoNumero) + End If + + Alert(String.Format(MensajeCosto.ToString()), TipoMensaje.MsgAdvertencia) + Return False End If - Alert(String.Format(MensajeCosto.ToString()), TipoMensaje.MsgAdvertencia) - Return False - End If - - 'NO DEJA REGISTRAR MAS AL PRECIO MAXIMO - If Not EsValidoMayor Then - MensajeCosto.AppendFormat("El Producto {0}. No se puede vender a un precio mayor de su rango aceptado
", HdnPS.Value) - If TienePermisoImportes Then - MensajeCosto.AppendFormat("El costo del producto es: ${0:#,###.00}
", Costo) - MensajeCosto.AppendFormat("El rango mayor aceptado es: {0}% ${1:#,###.00}
", UsuarioActual.Empresa.Funcionalidad(133).ToEntero(), CostoMayor) - MensajeCosto.AppendFormat("El precio indicado es: ${0:#,###.00} ({1}% de ganancia)
", PU.FormatoNumero, (If(Costo > 0, ((PU - Costo) * 100) / Costo, 0)).FormatoNumero) + 'NO DEJA REGISTRAR MAS AL PRECIO MAXIMO + If Not EsValidoMayor Then + MensajeCosto.AppendFormat("El Producto {0}. No se puede vender a un precio mayor de su rango aceptado
", HdnPS.Value) + If TienePermisoImportes Then + MensajeCosto.AppendFormat("El costo del producto es: ${0:#,###.00}
", Costo) + MensajeCosto.AppendFormat("El rango mayor aceptado es: {0}% ${1:#,###.00}
", UsuarioActual.Empresa.Funcionalidad(133).ToEntero(), CostoMayor) + MensajeCosto.AppendFormat("El precio indicado es: ${0:#,###.00} ({1}% de ganancia)
", PU.FormatoNumero, (If(Costo > 0, ((PU - Costo) * 100) / Costo, 0)).FormatoNumero) + End If + Alert(MensajeCosto.ToString(), TipoMensaje.MsgAdvertencia) + Return False End If - Alert(MensajeCosto.ToString(), TipoMensaje.MsgAdvertencia) - Return False End If End If @@ -19949,9 +19994,14 @@ Partial Class Ventas End If Else - 'sino es la seleccionada se recalcula de nuevo - CargaPrecioLista(DdlPS.SelectedValue.ToEntero) - Exit Sub + + Dim PermiteEdicion = UsuarioActual.CveEmpresa = 189 AndAlso TxtPrecio.Enabled + If Not PermiteEdicion Then + 'sino es la seleccionada se recalcula de nuevo + CargaPrecioLista(DdlPS.SelectedValue.ToEntero) + Exit Sub + End If + End If Else If Me.CvePrecioLista > 0 Then