This commit is contained in:
Antonio Gonzalez
2020-03-10 15:38:08 -07:00
parent 86966db1c2
commit 79a111d33e
3 changed files with 35 additions and 109 deletions

View File

@@ -4357,7 +4357,7 @@ Public Class ClsVentas
Return retorno
End Function
Public Function GetRepMetasVendedores(FechaMesActual As String, CveEmpresa As Integer, CveVendedor As Integer, CveCategoria As Integer, CveClasificacion As Integer,
CveClasificacion2 As Integer, CveMarca As Integer, CveSubProyecto As Integer) As Boolean
CveClasificacion2 As Integer, CveMarca As Integer, CveSubProyecto As Integer, CveCliente As Integer) As Boolean
Dim retorno As Boolean = False
DataAdapter("PA_Vta_MetasVendedores", CommandType.StoredProcedure)
With SqlAdapter.SelectCommand.Parameters
@@ -4369,6 +4369,7 @@ Public Class ClsVentas
.Add("@CveClasificacion2", SqlDbType.Int).Value = CveClasificacion2
.Add("@CveMarca", SqlDbType.Int).Value = CveMarca
.Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto
.Add("@CveCliente", SqlDbType.Int).Value = CveCliente
End With
Try
SqlAdapter.Fill(Data)

View File

@@ -45,9 +45,6 @@
Metas de Vendedores
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
<li>
<asp:LinkButton ID="LnkAgregar" runat="server"> Agregar Meta</asp:LinkButton>
</li>
<li>
<asp:LinkButton ID="LnkPDF" runat="server"><i class="fa fa-file-pdf-o" style="font-weight:bold;"></i> PDF</asp:LinkButton>
</li>
@@ -69,7 +66,7 @@
<div class="row">
<div class="col-md-1 truncate text-right">Fecha del mes: </div>
<div class="col-md-2 col-sm-2">
<div class="col-md-3 col-sm-2">
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 95px !important; padding: 0px;">
<asp:TextBox Style="width: 80px !important;" ID="TxtFechaMes" runat="server" CssClass="form-control" CausesValidation="true" MaxLength="10"></asp:TextBox>
<span class="input-group-btn ">
@@ -81,16 +78,16 @@
</div>
<div class="col-md-1 truncate text-right">Sucursal: </div>
<div class="col-md-2">
<div class="col-md-1 text-right">Sucursal: </div>
<div class="col-md-3">
<asp:DropDownList ID="DdlSubProyectoFiltro" runat="server" CssClass="form-control input-sm select2me" Width="50%" DataValueField="CveSubProyecto" DataTextField="SubProyecto"></asp:DropDownList>
</div>
<label class="col-md-1 text-right">Marca: </label>
<div class="col-md-3">
<asp:DropDownList ID="DdlMarcaFiltro" runat="server" DataTextField="Marca" DataValueField="CveMarca" Class="table-group-action-input form-control input-inline input-sm select2me" Width="50%"></asp:DropDownList>
</div>
</div>
<div class="row" style="margin-top: 10px">
<label class="col-md-1 text-right">Marca: </label>
<div class="col-md-3">
<asp:DropDownList ID="DdlMarcaFiltro" runat="server" DataTextField="Marca" DataValueField="CveMarca" CssClass="form-control input-sm select2me"></asp:DropDownList>
</div>
<label class="col-md-1 text-right">Vendedor: </label>
<div class="col-md-3">
@@ -101,17 +98,21 @@
<div class="col-md-3">
<asp:DropDownList ID="DdlCategoria" runat="server" Class="table-group-action-input form-control input-inline input-sm select2me" Width="50%" DataValueField="CveCategoria" DataTextField="Categoria"></asp:DropDownList>
</div>
</div>
<div class="row" style="margin-top: 10px">
<label class="col-md-1 text-right">Clasificaciones: </label>
<div class="col-md-3">
<asp:DropDownList ID="DdlClasificaciones" runat="server" Class="table-group-action-input form-control input-inline input-sm select2me" Width="50%" DataValueField="CveClasificacion" DataTextField="Clasificacion"></asp:DropDownList>
</div>
</div>
<div class="row" style="margin-top: 10px">
<label class="col-md-1 text-right">Sub Clasificaciones: </label>
<div class="col-md-3">
<asp:DropDownList ID="DdlClasificacion2" runat="server" Class="table-group-action-input form-control input-inline input-sm select2me" Width="50%" DataValueField="CveClasificacion" DataTextField="Clasificacion"></asp:DropDownList>
</div>
<label class="col-md-1 text-right">Cliente: </label>
<div class="col-md-3">
<asp:DropDownList ID="DdlCliente" runat="server" Class="table-group-action-input form-control input-inline input-sm select2me" Width="50%" DataValueField="CveCliente" DataTextField="NombreComercial"></asp:DropDownList>
</div>
</div>
</div>
@@ -144,11 +145,16 @@
<asp:Label ID="lblRealMes" runat="server" Target="_blank" Text='<%# Eval("RealMes").ToString() %>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Ventata Mes Año Anterior" ItemStyle-HorizontalAlign="Center">
<asp:TemplateField HeaderText="Venta Mes Año Anterior" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:Label ID="lblVtaMesAA" runat="server" Target="_blank" Text='<%# Eval("VtaMesAA").ToString() %>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Obj Mes" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:Label ID="lblObjMes" runat="server" Target="_blank" Text='<%# Eval("ObjMes").ToString() %>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Real Acumulado" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:Label ID="lblRealAcumulado" runat="server" Target="_blank" Text='<%# Eval("RealAcumulado").ToString() %>'> </asp:Label>
@@ -159,63 +165,21 @@
<asp:Label ID="lblRealMesPorcentaje" runat="server" Target="_blank" Text='<%# Eval("RealMesPorcentaje").ToString() %>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="A. Ant. Acumulado" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:Label ID="lblAAntAcumulado" runat="server" Target="_blank" Text='<%# Eval("AAntAcumulado").ToString() %>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Obj Acumulado" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:Label ID="lblObjAcumulado" runat="server" Target="_blank" Text='<%# Eval("ObjAcumulado").ToString() %>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<div id="DivAgregarTiposD" class="modal ADS fade" role="dialog">
<div class="modal-dialog" style="width: 450px;">
<asp:UpdatePanel runat="server" class="modal-content" ID="UpModalTiposD" UpdateMode="Conditional">
<ContentTemplate>
<div class="modal-header ">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">
<asp:Literal ID="LtlTituloModalTiposD" runat="server">Motivos de baja</asp:Literal></h4>
</div>
<div class="modal-body">
<div class="form-group form-md-line-input input-iconright">
<label for="DdlVendedores">Vendedor:</label>
<asp:DropDownList ID="DdlVendedores" runat="server" DataTextField="Vendedor" DataValueField="CveVendedor" CssClass="form-control input-sm select2me"></asp:DropDownList>
<i></i>
</div>
<div class="form-group form-md-line-input input-iconright">
<label for="MotivoTxt">Mes y Año:</label>
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 95px !important; padding: 0px;">
<asp:TextBox Style="width: 110px !important;" ID="TxtFechaI" runat="server" CssClass="form-control" CausesValidation="true" MaxLength="10"></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="ImgFechaI" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
</div>
<ajax:MaskedEditExtender ID="MEEFechaI" runat="server" TargetControlID="TxtFechaI" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="CEFechaI" TargetControlID="TxtFechaI" PopupButtonID="ImgFechaI" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
</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>
<i></i>
</div>
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtMetaCantidad" CssClass="form-control " runat="server" MaxLength="70" CausesValidation="true"></asp:TextBox>
<asp:RequiredFieldValidator ID="RfvTxtTiposD" runat="server" ControlToValidate="TxtMetaCantidad" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cantidad meta''</b> es necesario, por favor ingréselo." ValidationGroup="GrpTiposD"></asp:RequiredFieldValidator>
<label for="MotivoTxt">Cantidad meta:</label>
<i></i>
</div>
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtMetaImporte" CssClass="form-control " runat="server" MaxLength="70" CausesValidation="true"></asp:TextBox>
<asp:RequiredFieldValidator ID="RfvTxtMetaImporte" runat="server" ControlToValidate="TxtMetaImporte" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Importe meta''</b> es necesario, por favor ingréselo." ValidationGroup="GrpTiposD"></asp:RequiredFieldValidator>
<label for="MotivoTxt">Importe meta:</label>
<i></i>
</div>
</div>
<div class="modal-footer">
<asp:Button ID="BtnAgregarMetaVendedor" runat="server" class="btn btn-success" Text="Agregar" ValidationGroup="GrpTiposD" />
<button id="Button3" runat="server" type="button" class="btn default" data-dismiss="modal">Cancelar</button>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server">
<script src="/Metronic/assets/global/scripts/datatable.js"></script>

View File

@@ -15,7 +15,6 @@ Partial Class MetasVendedores
End Property
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
CargaDatosModal()
CargaDatosFiltros()
CargarDatosReporte()
End If
@@ -51,61 +50,23 @@ Partial Class MetasVendedores
DdlClasificacion2.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa)
DdlClasificacion2.DataBind()
DdlClasificacion2.Items.Insert(0, New ListItem("Todos", "-1"))
End Sub
Private Sub CargaDatosModal()
DdlVendedores.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa)
DdlVendedores.DataBind()
DdlVendedores.Items.Insert(0, New ListItem("Seleccionar", "-1"))
Dim ObjPS As New ClsProductosServicios
If ObjPS.GetMarcas(UsuarioActual.CveEmpresa) Then
DdlMarcas.DataSource = ObjPS.DtResultados
End If
ObjPS.Dispose()
DdlMarcas.DataBind()
DdlMarcas.Items.Insert(0, New ListItem("Todos", "-1"))
DdlCliente.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa)
DdlCliente.DataBind()
DdlCliente.Items.Insert(0, New ListItem("Todos", "-1"))
End Sub
Private Sub CargarDatosReporte()
Dim ObjVentas As New ClsVentas
If ObjVentas.GetRepMetasVendedores(TxtFechaMes.Text, UsuarioActual.CveEmpresa, DdlVendedorFiltro.SelectedValue.ToEntero, DdlCategoria.SelectedValue.ToEntero,
DdlClasificaciones.SelectedValue.ToEntero, DdlClasificacion2.SelectedValue.ToEntero, DdlMarcaFiltro.SelectedValue.ToEntero,
DdlSubProyectoFiltro.SelectedValue.ToEntero) Then
DdlSubProyectoFiltro.SelectedValue.ToEntero, DdlCliente.SelectedValue.ToEntero) Then
GV.DataSource = ObjVentas.DtResultados
DtDatos = ObjVentas.DtResultados
End If
ObjVentas.Dispose()
GV.DataBind()
End Sub
Private Sub ResetDatosSeleccionadosModal()
DdlVendedores.SelectedValue = "-1"
TxtFechaI.Text = ""
DdlMarcas.SelectedValue = "-1"
TxtMetaCantidad.Text = ""
TxtMetaImporte.Text = ""
UpModalTiposD.Update()
End Sub
Protected Sub LnkAgregar_Click() Handles LnkAgregar.Click
RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarTiposD"))
End Sub
'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
' Dim ObjVentas As New ClsVentas
' If ObjVentas.AddMetasVendedores(DdlVendedores.SelectedValue.ToEntero, TxtFechaI.Text, DdlMarcas.SelectedValue.ToEntero, TxtMetaCantidad.Text.ToEntero, TxtMetaImporte.Text.ToDecimal) Then
' Alert("Se agregó la meta al vendedor")
' Else
' Alert("No se pudo agregar la meta al vendedor", TipoMensaje.MsgError)
' End If
' 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"))
' ResetDatosSeleccionadosModal()
'End Sub
Protected Sub btConsultar_Click(sender As Object, e As EventArgs) Handles btConsultar.Click
CargarDatosReporte()