Sugiere precio en base al Costo de la clasificacion

This commit is contained in:
janeth arvizu
2019-11-11 14:41:25 -07:00
parent 59cb7565ec
commit 0a96123c2d
4 changed files with 78 additions and 41 deletions

View File

@@ -192,7 +192,7 @@ Public Class ClsClasificaciones
End Function
Public Function AddClasificaciones(Clasificacion As String, Codigo As String, IdCuentaGasto As Integer, CuentaGasto As String, IdCuentaCostos As Integer, CuentaCostos As String, IdCuentaIngreso As Integer, CuentaIngreso As String, CveCategoria As Integer, CveUsuario As Integer, CveEmpresa As Integer, Optional RequiereSerieLote As Integer = 0, Optional UsoClasificacion As Integer = -1, Optional CveSATPS As Integer = -1, Optional RequiereAFCompra As Boolean = True, Optional RequiereAFInsumo As Boolean = True, Optional RequierePersonal As Boolean = True,
Optional EsAcumulador As Boolean = False, Optional TopVentas As Boolean = False, Optional TopCompras As Boolean = False) As Boolean
Optional EsAcumulador As Boolean = False, Optional TopVentas As Boolean = False, Optional TopCompras As Boolean = False, Optional PrecioBaseCosto As Decimal = -1) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_ClasificacionesAdd")
@@ -227,6 +227,7 @@ Public Class ClsClasificaciones
.Add("@EsAcumulador", SqlDbType.Bit).Value = EsAcumulador
.Add("@TopCompras", SqlDbType.Bit).Value = TopCompras
.Add("@TopVentas", SqlDbType.Bit).Value = TopVentas
.Add("@PrecioBaseCosto", SqlDbType.Money).Value = PrecioBaseCosto
End With
@@ -300,7 +301,7 @@ Public Class ClsClasificaciones
End Function
Public Function UpdateClasificacion(Clasificacion As String, Codigo As String, IdCuentaGasto As Integer, CuentaGasto As String, IdCuentaCostos As Integer, CuentaCostos As String, IdCuentaIngresos As Integer, CuentaIngresos As String, Estatus As Boolean, Afectable As Boolean, CveCategoria As Integer, CveUsuario As Integer, CveClasificacion As Integer, Optional RequiereSerieLote As Integer = 0, Optional UsoClasificacion As Integer = -1, Optional CveSATPS As Integer = -1, Optional RequiereAFCompra As Boolean = True, Optional RequiereAFInsumo As Boolean = True, Optional RequierePersonal As Boolean = True,
Optional EsAcumulador As Boolean = False, Optional TopVentas As Boolean = False, Optional TopCompras As Boolean = False) As Boolean
Optional EsAcumulador As Boolean = False, Optional TopVentas As Boolean = False, Optional TopCompras As Boolean = False, Optional PrecioBaseCosto As Decimal = -1) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_ClasificacionesUpdate")
@@ -335,6 +336,7 @@ Public Class ClsClasificaciones
.Add("@EsAcumulador", SqlDbType.Bit).Value = EsAcumulador
.Add("@TopCompras", SqlDbType.Bit).Value = TopCompras
.Add("@TopVentas", SqlDbType.Bit).Value = TopVentas
.Add("@PrecioBaseCosto", SqlDbType.Money).Value = PrecioBaseCosto
End With

View File

@@ -76,7 +76,7 @@
<asp:HiddenField ID="HiddenField2" runat="server" ClientIDMode="Static" Value="0" />
<div>
<asp:GridView ID="GvDatos" runat="server" data-sort="true" AutoGenerateColumns="False"
DataKeyNames="CveClasificacion, CveCategoria, Clasificacion, UsoClasificacion, CuentaGasto, CuentaCostos, CuentaIngresos, IdCuentaGasto, IdCuentaCostos, IdCuentaIngresos,RequiereSerieLote,CveSATPS,SATClaveProductoServicio, RequiereAFCompra, RequiereAFInsumo, RequierePersonal, Estatus,EsAcumulador,TopVentas,TopCompras" EmptyDataText="No se encontraron Clasificaciones Registradas" ToolTip="Listado de Clasificaciones" CssClass="table table-striped table-advance table-hover Widthall ScrollAD mysmallbtn" GridLines="None">
DataKeyNames="CveClasificacion, CveCategoria, Clasificacion, UsoClasificacion, CuentaGasto, CuentaCostos, CuentaIngresos, IdCuentaGasto, IdCuentaCostos, IdCuentaIngresos,RequiereSerieLote,CveSATPS,SATClaveProductoServicio, RequiereAFCompra, RequiereAFInsumo, RequierePersonal, Estatus,EsAcumulador,TopVentas,TopCompras,PrecioBaseCosto" EmptyDataText="No se encontraron Clasificaciones Registradas" ToolTip="Listado de Clasificaciones" CssClass="table table-striped table-advance table-hover Widthall ScrollAD mysmallbtn" GridLines="None">
<Columns>
<asp:TemplateField HeaderText="Clasificación">
<ItemTemplate>
@@ -210,41 +210,57 @@
<label for="<%= TxtClasificacion.ClientID.ToString()%>">Clasificación:</label>
</div>
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlCategoria" CssClass="form-control input-sm select2me js-cuenta-programmatic" runat="server" AppendDataBoundItems="true" DataTextField="Categoria" DataValueField="CveCategoria" Width="340px" ValidationGroup="GrpGuardar"></asp:DropDownList>
<label for="<%= DdlCategoria.ClientID.ToString()%>">Categoría:</label>
<br />
<div class="row">
<div class="col-md-8">
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlCategoria" CssClass="form-control input-sm select2me js-cuenta-programmatic" runat="server" AppendDataBoundItems="true" DataTextField="Categoria" DataValueField="CveCategoria" Width="340px" ValidationGroup="GrpGuardar"></asp:DropDownList>
<label for="<%= DdlCategoria.ClientID.ToString()%>">Categoría:</label>
</div>
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlUsoClasificacion" CssClass="form-control input-sm select2me js-cuenta-programmatic" runat="server" AppendDataBoundItems="true" Width="340px" ValidationGroup="GrpGuardar">
<asp:ListItem Text="Ingresos" Value="1"></asp:ListItem>
<asp:ListItem Text="Gasto" Value="2"></asp:ListItem>
<asp:ListItem Text="Ingresos/Gasto" Value="3"></asp:ListItem>
</asp:DropDownList>
<label for="<%= DdlUsoClasificacion.ClientID.ToString()%>">Uso Clasificación:</label>
</div>
<div class="form-group input-iconright" id="DivCuentaGasto" runat="server">
<label for="<%= DdlCuentaGasto.ClientID.ToString()%>" style="color: #888888; font-size: 13px;">Cuenta Gasto:</label>
<asp:DropDownList ID="DdlCuentaGasto" CssClass="form-control input-sm js-cuenta-programmatic" runat="server" AppendDataBoundItems="true" DataTextField="CtaCodigo" DataValueField="Id" Width="340px"></asp:DropDownList>
</div>
<div class="form-group input-iconright" id="DivCuentaCostos" runat="server">
<label for="<%= DdlCuentaCostos.ClientID.ToString()%>" style="color: #888888; font-size: 13px;">Cuenta Costos:</label>
<asp:DropDownList ID="DdlCuentaCostos" CssClass="form-control input-sm js-cuenta-programmatic" runat="server" AppendDataBoundItems="true" DataTextField="CtaCodigo" DataValueField="Id" Width="340px"></asp:DropDownList>
</div>
<div class="form-group input-iconright" id="DivCuentaIngresos" runat="server">
<label for="<%= DdlCuentaIngresos.ClientID.ToString()%>" style="color: #888888; font-size: 13px;">Cuenta Ingresos:</label>
<asp:DropDownList ID="DdlCuentaIngresos" CssClass="form-control input-sm js-cuenta-programmatic" runat="server" AppendDataBoundItems="true" DataTextField="CtaCodigo" DataValueField="Id" Width="340px"></asp:DropDownList>
</div>
<div class="form-group form-md-line-input input-iconright" runat="server" id="DivPSSAT">
<ADS:Dropdownlost runat="server" ID="DdlSATPS" CssStyle="width: 340px;" CssClass="form-control input-sm select2me" DataTextField="Descripcion" DataValueField="CveSATPS" />
<label for="<%= DdlSATPS.ClientID.ToString()%>">Producto Servicio SAT:</label>
</div>
</div>
<div class="col-md-4">
<div class="form-group form-md-line-input" runat="server">
<asp:TextBox ID="TxtPrecioBaseCosto" CssClass="form-control" Width="130px" MaxLength="5" runat="server" CausesValidation="true" Style="text-align: right!important" OnKeyup="FormatoMoneda(this);"></asp:TextBox>
<label for="<%= TxtPrecioBaseCosto.ClientID.ToString()%>" style="width: 130px;">Precio Base Costo:</label>
</div>
</div>
</div>
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlUsoClasificacion" CssClass="form-control input-sm select2me js-cuenta-programmatic" runat="server" AppendDataBoundItems="true" Width="340px" ValidationGroup="GrpGuardar">
<asp:ListItem Text="Ingresos" Value="1"></asp:ListItem>
<asp:ListItem Text="Gasto" Value="2"></asp:ListItem>
<asp:ListItem Text="Ingresos/Gasto" Value="3"></asp:ListItem>
</asp:DropDownList>
<label for="<%= DdlUsoClasificacion.ClientID.ToString()%>">Uso Clasificación:</label>
</div>
<br />
<div class="form-group input-iconright" id="DivCuentaGasto" runat="server">
<label for="<%= DdlCuentaGasto.ClientID.ToString()%>" style="color: #888888; font-size: 13px;">Cuenta Gasto:</label>
<asp:DropDownList ID="DdlCuentaGasto" CssClass="form-control input-sm js-cuenta-programmatic" runat="server" AppendDataBoundItems="true" DataTextField="CtaCodigo" DataValueField="Id" Width="340px"></asp:DropDownList>
</div>
<div class="form-group input-iconright" id="DivCuentaCostos" runat="server">
<label for="<%= DdlCuentaCostos.ClientID.ToString()%>" style="color: #888888; font-size: 13px;">Cuenta Costos:</label>
<asp:DropDownList ID="DdlCuentaCostos" CssClass="form-control input-sm js-cuenta-programmatic" runat="server" AppendDataBoundItems="true" DataTextField="CtaCodigo" DataValueField="Id" Width="340px"></asp:DropDownList>
</div>
<div class="form-group input-iconright" id="DivCuentaIngresos" runat="server">
<label for="<%= DdlCuentaIngresos.ClientID.ToString()%>" style="color: #888888; font-size: 13px;">Cuenta Ingresos:</label>
<asp:DropDownList ID="DdlCuentaIngresos" CssClass="form-control input-sm js-cuenta-programmatic" runat="server" AppendDataBoundItems="true" DataTextField="CtaCodigo" DataValueField="Id" Width="340px"></asp:DropDownList>
</div>
<div class="form-group form-md-line-input input-iconright" runat="server" id="DivPSSAT">
<ADS:Dropdownlost runat="server" ID="DdlSATPS" CssStyle="width: 340px;" CssClass="form-control input-sm select2me" DataTextField="Descripcion" DataValueField="CveSATPS" />
<label for="<%= DdlSATPS.ClientID.ToString()%>">Producto Servicio SAT:</label>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group form-md-line-input input-iconright">
@@ -281,10 +297,6 @@
<label for="<%= ChkTopCompras.ClientID.ToString()%>" style="width: 130px;">TOP 10 Compras:</label>
<asp:CheckBox ID="ChkTopCompras" Checked="false" runat="server" CssClass="make-switchsd" />
</div>
<div class="form-group form-md-line-input" runat="server">
<label for="<%= TxtPrecioBaseCosto.ClientID.ToString()%>" style="width: 130px;">Precio Base Costo:</label>
<asp:TextBox ID="TxtPrecioBaseCosto" CssClass="form-control" Width="50" runat="server"></asp:TextBox>
</div>
</div>
</div>
</div>

View File

@@ -178,11 +178,12 @@ Partial Class CatClasificaciones
DdlCuentaCostos.SelectedValue.ToEntero, DdlCuentaCostos.SelectedItem.Text,
DdlCuentaIngresos.SelectedValue.ToEntero, DdlCuentaIngresos.SelectedItem.Text,
DdlCategoria.SelectedValue.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, RequiereSerieLote:=RequireSerieLote, UsoClasificacion:=DdlUsoClasificacion.SelectedValue.ToEntero, CveSATPS:=DdlSATPS.SelectedValue.ToEntero,
RequiereAFCompra:=ChkRequiereAFCompra.Checked, RequiereAFInsumo:=ChkRequiereAFInsumo.Checked, RequierePersonal:=ChkRequierePersonal.Checked, EsAcumulador:=ChkEsAcumulador.Checked, TopVentas:=ChkTopVentas.Checked, TopCompras:=ChkTopCompras.Checked) Then
RequiereAFCompra:=ChkRequiereAFCompra.Checked, RequiereAFInsumo:=ChkRequiereAFInsumo.Checked, RequierePersonal:=ChkRequierePersonal.Checked, EsAcumulador:=ChkEsAcumulador.Checked, TopVentas:=ChkTopVentas.Checked, TopCompras:=ChkTopCompras.Checked, PrecioBaseCosto:=TxtPrecioBaseCosto.Text.ToDecimal) Then
ViewState("DTClasificaciones") = ObjClasificaciones.DtResultados.FiltraParametros($"(Codigo IS NULL OR Codigo = '') AND CveEmpresa = {UsuarioActual.CveEmpresa} AND (CveCategoria = {DdlCategoriaFiltro.SelectedValue.ToEntero} OR {DdlCategoriaFiltro.SelectedValue.ToEntero} = -1) AND (UsoClasificacion = {DdlTipoClasificacion.SelectedValue.ToEntero} OR {DdlTipoClasificacion.SelectedValue.ToEntero} = -1 ) AND (Estado = {DdlEstatus.SelectedValue.ToEntero} OR {DdlEstatus.SelectedValue.ToEntero} = -1)")
TxtClasificacion.Text = ""
TxtPrecioBaseCosto.Text = ""
DdlCuentaGasto.SelectedValueExist("0")
DdlCuentaCostos.SelectedValueExist("0")
DdlCuentaIngresos.SelectedValueExist("0")
@@ -201,7 +202,7 @@ Partial Class CatClasificaciones
If ObjClasificaciones.UpdateClasificacion(Clasificacion, "", DdlGasto.SelectedValue.ToEntero, DdlGasto.SelectedItem.Text,
DdlCosto.SelectedValue.ToEntero, DdlCosto.SelectedItem.Text, DdlIngresos.SelectedValue.ToEntero, DdlIngresos.SelectedItem.Text,
Estatus, False, DdlCategoria.SelectedValue.ToEntero, UsuarioActual.CveUsuario, CveClasificacion, RequiereSerieLote:=RequireSerieLote, UsoClasificacion:=DdlUsoClasificacion.SelectedValue.ToEntero, CveSATPS:=DdlSATPS.SelectedValue.ToEntero,
RequiereAFCompra:=ChkRequiereAFCompra.Checked, RequiereAFInsumo:=ChkRequiereAFInsumo.Checked, RequierePersonal:=ChkRequierePersonal.Checked, EsAcumulador:=ChkEsAcumulador.Checked, TopVentas:=ChkTopVentas.Checked, TopCompras:=ChkTopCompras.Checked) Then
RequiereAFCompra:=ChkRequiereAFCompra.Checked, RequiereAFInsumo:=ChkRequiereAFInsumo.Checked, RequierePersonal:=ChkRequierePersonal.Checked, EsAcumulador:=ChkEsAcumulador.Checked, TopVentas:=ChkTopVentas.Checked, TopCompras:=ChkTopCompras.Checked, PrecioBaseCosto:=TxtPrecioBaseCosto.Text.ToDecimal) Then
RegistraScript(String.Format("$('#{0}').modal('hide');", "ModalClasificaciones"))
Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion)
@@ -346,6 +347,7 @@ Partial Class CatClasificaciones
Limpiador()
TxtClasificacion.Text = ""
TxtPrecioBaseCosto.Text = ""
DdlCategoria.SelectedIndex = 0
DdlSATPS.SelectedValue = ""
DdlSATPS.SelectedText = ""
@@ -371,6 +373,7 @@ Partial Class CatClasificaciones
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
Dim CveClasificacion As String = GvRow.DataKey("CveClasificacion").ToString
Dim Clasificacion As String = GvRow.DataKey("Clasificacion").ToString
Dim PrecioBaseCosto As String = GvRow.DataKey("PrecioBaseCosto").ToString
Dim CveCategoria As String = GvRow.DataKey("CveCategoria").ToString
Dim CuentaGasto As String = GvRow.DataKey("CuentaGasto").ToString
Dim CuentaCostos As String = GvRow.DataKey("CuentaCostos").ToString
@@ -421,6 +424,7 @@ Partial Class CatClasificaciones
TxtClasificacion.Text = Clasificacion
TxtPrecioBaseCosto.Text = PrecioBaseCosto.FormatoNumero(2)
DdlCategoria.SelectedValueExist(CveCategoria)
DdlUsoClasificacion.SelectedValue = UsoClasificacion
HdnIDClasificacion.Value = CveClasificacion

View File

@@ -12923,6 +12923,16 @@ Partial Class Ventas
DdlUnidadMedida.DataBind()
DdlUnidadMedida.SelectedValueExist(drPS("CveUnidadMedida").ToString)
If drPS("CveTipoPS").ToString = "1" Then 'Si es servicio
If UsuarioActual.Empresa.Funcionalidad(558).ToString = "1" Then 'Si es Empresa llantera
TxtPrecio.Enabled = True
Else
TxtPrecio.Enabled = False
End If
Else
TxtPrecio.Enabled = True
End If
If TmpDT IsNot Nothing AndAlso TmpDT.Rows.Count = 0 Then
DdlMoneda.SelectedValueExist(drPS("CveMoneda").ToString)
CambiaMoneda()
@@ -12979,7 +12989,16 @@ Partial Class Ventas
End If
Dim PrecioBaseCosto As Decimal = 0
Dim ObjClasificaciones As New ClsClasificaciones
If ObjClasificaciones.GetClasificaciones() Then
PrecioBaseCosto = ObjClasificaciones.DtResultados.FiltroPrimeroValor("PrecioBaseCosto", $"CveEmpresa = {UsuarioActual.CveEmpresa} AND CveClasificacion = {drPS("CveClasificacion")}").ToDecimal
End If
If PrecioSugerido > 0 Then
If PrecioBaseCosto > 0 Then
PrecioSugerido = PrecioSugerido * ((PrecioBaseCosto / 100) + 1)
End If
TxtPrecio.Text = PrecioSugerido.ToString("#,###.####") ' que muestre hasta los 4 digitos si lo requiere
End If