actualizando el catalogo de metas vendedores

This commit is contained in:
Antonio Gonzalez
2020-03-20 12:14:21 -07:00
parent 5e05c486e6
commit 89db102139
3 changed files with 31 additions and 7 deletions

View File

@@ -4290,7 +4290,7 @@ Public Class ClsVentas
End Try
Return retorno
End Function
Public Function AddMetasVendedores(CveVendedor As Integer, MesAño As Date, CveMarca As Integer, MetaCantidad As Integer, MetaImporte As Decimal, CveClasificacion As Integer) As Boolean
Public Function AddMetasVendedores(CveVendedor As Integer, MesAño As Date, CveMarca As Integer, MetaCantidad As Integer, MetaImporte As Decimal, CveClasificacion As Integer, CveClasificacionSup As Integer) As Boolean
Dim retorno As Boolean = False
DataAdapter("PA_Vta_MetasVendedoresAdd", CommandType.StoredProcedure)
With SqlAdapter.SelectCommand.Parameters
@@ -4300,6 +4300,7 @@ Public Class ClsVentas
.Add("@MetaCantidad", SqlDbType.Int).Value = MetaCantidad
.Add("@MetaImporte", SqlDbType.Decimal).Value = MetaImporte
.Add("@CveClasificacion", SqlDbType.Int).Value = CveClasificacion
.Add("@CveClasificacionSup", SqlDbType.Int).Value = CveClasificacionSup
End With
Try
SqlAdapter.Fill(Data)
@@ -4338,7 +4339,7 @@ Public Class ClsVentas
Return retorno
End Function
Public Function UpdateMetasVendedores(CveMeta As Integer, CveVendedor As Integer, MesAño As String, CveMarca As Integer, MetaCantidad As Integer, MetaImporte As Decimal,
CveClasificacion As Integer) As Boolean
CveClasificacion As Integer, CveClasificacionSup As Integer) As Boolean
Dim retorno As Boolean = False
DataAdapter("PA_Vta_MetasVendedoresUpdate", CommandType.StoredProcedure)
With SqlAdapter.SelectCommand.Parameters
@@ -4349,6 +4350,7 @@ Public Class ClsVentas
.Add("@MetaCantidad", SqlDbType.Int).Value = MetaCantidad
.Add("@MetaImporte", SqlDbType.Decimal).Value = MetaImporte
.Add("@CveClasificacion", SqlDbType.Int).Value = CveClasificacion
.Add("@CveClasificacionSup", SqlDbType.Int).Value = CveClasificacionSup
End With
Try
SqlAdapter.Fill(Data)

View File

@@ -22,7 +22,7 @@
<asp:Content ID="Content6" ContentPlaceHolderID="C" runat="Server">
<asp:UpdatePanel ID="UpDatos" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:GridView ID="GvDatos" runat="server" AutoGenerateColumns="False" DataKeyNames="CveMeta,CveVendedor,CveMarca,CveClasificacion,Vendedor,MesAño,Marca,Clasificacion,MetaCantidad,MetaImporte" EmptyDataText="No se encontraron Motivo de Baja Registrados" ToolTip="Listado de Metas Vendedor" CssClass="table table-striped table-advance table-hover" Style="margin-top: -10px; text-align: center;width:100%" GridLines="None">
<asp:GridView ID="GvDatos" runat="server" AutoGenerateColumns="False" DataKeyNames="CveMeta,CveVendedor,CveMarca,CveClasificacion,CveClasificacionSup,Vendedor,MesAño,Marca,Clasificacion,MetaCantidad,MetaImporte" EmptyDataText="No se encontraron Motivo de Baja Registrados" ToolTip="Listado de Metas Vendedor" CssClass="table table-striped table-advance table-hover" Style="margin-top: -10px; text-align: center;width:100%" GridLines="None">
<Columns>
<asp:TemplateField HeaderText ="Vendedor" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
@@ -54,6 +54,16 @@
<ajax:ValidatorCalloutExtender ID="VCClasificacion" runat="server" HighlightCssClass="vco" TargetControlID="RFVClasificacion" Width="300px"></ajax:ValidatorCalloutExtender>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText ="Clasificacion superior">
<ItemTemplate>
<asp:Literal ID="LtlClasificacionSup" runat="server" Text='<%# Eval("ClasificacionSup", "&nbsp;{0}") %>'></asp:Literal>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="TxtClasificacionSup" runat="server" CausesValidation="true" MaxLength="50" Text='<%# Eval("ClasificacionSup") %>' ValidationGroup="GrpGV" Width="234px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVClasificacionSup" runat="server" ControlToValidate="TxtClasificacionSup" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Clasificacion''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGV"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCClasificacionSup" runat="server" HighlightCssClass="vco" TargetControlID="RFVClasificacionSup" Width="300px"></ajax:ValidatorCalloutExtender>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText ="MesAño">
<ItemTemplate>
<asp:Literal ID="LtlMesAño" runat="server" Text='<%# Eval("MesAño", "&nbsp;{0}") %>'></asp:Literal>
@@ -125,6 +135,11 @@
<asp:DropDownList ID="DdlClasificacion" runat="server" DataTextField="Clasificacion" DataValueField="CveClasificacion" CssClass="form-control input-sm select2me"></asp:DropDownList>
<i></i>
</div>
<div class="form-group form-md-line-input input-iconright">
<label for="DdlMarcas">Clasificacion Superior:</label>
<asp:DropDownList ID="DdlClasificacionSup" runat="server" DataTextField="Clasificacion" DataValueField="CveClasificacion" CssClass="form-control input-sm select2me"></asp:DropDownList>
<i></i>
</div>
<div class="form-group form-md-line-input input-iconright">
<label for="DdlMarcas">Marca:</label>
<asp:DropDownList ID="DdlMarcas" runat="server" DataTextField="Marca" DataValueField="CveMarca" CssClass="form-control input-sm select2me"></asp:DropDownList>

View File

@@ -45,6 +45,10 @@ Partial Class CatMetasVendedores
DdlClasificacion.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa)
DdlClasificacion.DataBind()
DdlClasificacion.Items.Insert(0, New ListItem("Todos", "-1"))
DdlClasificacionSup.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa)
DdlClasificacionSup.DataBind()
DdlClasificacionSup.Items.Insert(0, New ListItem("Todos", "-1"))
End Sub
Protected Sub LnkAgregar_Click() Handles LnkAgregar.Click
@@ -53,24 +57,26 @@ Partial Class CatMetasVendedores
Protected Sub BtnAgregarMetaVendedor_Click(sender As Object, e As EventArgs) Handles BtnAgregarMetaVendedor.Click
If DdlVendedores.SelectedValue.ToEntero > 0 AndAlso TxtFechaI.Text <> "" AndAlso DdlMarcas.SelectedValue.ToEntero > 0 Then
If DdlVendedores.SelectedValue.ToEntero > 0 AndAlso TxtFechaI.Text <> "" AndAlso DdlMarcas.SelectedValue.ToEntero > 0 AndAlso DdlClasificacionSup.SelectedValue.ToEntero > 0 Then
Dim ObjVentas As New ClsVentas
If BtnAgregarMetaVendedor.Text = "Agregar" Then
If ObjVentas.AddMetasVendedores(DdlVendedores.SelectedValue.ToEntero, TxtFechaI.Text, DdlMarcas.SelectedValue.ToEntero, TxtMetaCantidad.Text.ToEntero,
TxtMetaImporte.Text.ToDecimal, DdlClasificacion.SelectedValue.ToEntero) Then
TxtMetaImporte.Text.ToDecimal, DdlClasificacion.SelectedValue.ToEntero, DdlClasificacionSup.SelectedValue.ToEntero) Then
Alert("Se agregó la meta al vendedor")
Else
Alert("No se pudo agregar la meta al vendedor", TipoMensaje.MsgError)
End If
ElseIf BtnAgregarMetaVendedor.Text = "Actualizar" Then
If ObjVentas.UpdateMetasVendedores(CveMetaVendedor, DdlVendedores.SelectedValue.ToEntero, TxtFechaI.Text, DdlMarcas.SelectedValue.ToEntero,
TxtMetaCantidad.TextMode.ToEntero, TxtMetaImporte.Text.ToDecimal, DdlClasificacion.SelectedValue.ToEntero) Then
TxtMetaCantidad.Text.ToEntero, TxtMetaImporte.Text.ToDecimal, DdlClasificacion.SelectedValue.ToEntero,
DdlClasificacionSup.SelectedValue.ToEntero) Then
Alert("Se actualizó la información de la meta del vendedor")
Else
Alert("No se pudo actualizar la meta del vendedor", TipoMensaje.MsgError)
End If
End If
Else
Else
Alert(String.Format("Falta Seleccionar {0}{1}{2}", If(DdlVendedores.SelectedValue.ToEntero > 0, "", "Vendedor, "), If(DdlMarcas.SelectedValue.ToEntero > 0, "", "Marca, "), If(TxtFechaI.Text <> "", "", "Fecha, ")))
End If
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTiposD"))
@@ -94,6 +100,7 @@ Partial Class CatMetasVendedores
CveMetaVendedor = GvRow.DataKey("CveMeta").ToEntero
DdlVendedores.SelectedValue = GvRow.DataKey("CveVendedor")
TxtFechaI.Text = GvRow.DataKey("MesAño")
DdlClasificacionSup.SelectedValue = GvRow.DataKey("CveClasificacionSup")
DdlClasificacion.SelectedValue = GvRow.DataKey("CveClasificacion")
DdlMarcas.SelectedValue = GvRow.DataKey("CveMarca")
TxtMetaCantidad.Text = GvRow.DataKey("MetaCantidad")