--Cambios en metas de vendedores
This commit is contained in:
@@ -33,13 +33,13 @@
|
||||
</div>
|
||||
<div class="titlefiltros caption">
|
||||
<div class="row">
|
||||
<label class="col-md-1 truncate">Sucursal:</label>
|
||||
<div class="col-md-2">
|
||||
<label class="col-md-1 truncate" id="DivLblSucursal" runat="server">Sucursal:</label>
|
||||
<div class="col-md-2" id="DivSucursal" runat="server">
|
||||
<asp:DropDownList ID="DdlSubProyecto" runat="server" Width="100%" DataTextField="SubProyecto" DataValueField="CveSubProyecto" Class="table-group-action-input form-control input-inline input-small input-sm select2me">
|
||||
</asp:DropDownList>
|
||||
</div>
|
||||
<label class="col-md-1 truncate">Mes/Año:</label>
|
||||
<div class="col-md-1" style="min-width: 115px">
|
||||
<label class="col-md-1 truncate" id="DivLblMes" runat="server">Mes/Año:</label>
|
||||
<div class="col-md-1" style="min-width: 115px" id="DivMes" runat="server">
|
||||
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 100px !important; padding: 0px;">
|
||||
<asp:TextBox Width="80px" ID="txtMesAnio" runat="server" CssClass="form-control" CausesValidation="true" MaxLength="10"></asp:TextBox>
|
||||
<span class="input-group-btn ">
|
||||
@@ -54,8 +54,8 @@
|
||||
<asp:DropDownList ID="DdlVendedor" runat="server" Width="100%" DataTextField="Vendedor" DataValueField="CveVendedor" Class="table-group-action-input form-control input-inline input-small input-sm select2me">
|
||||
</asp:DropDownList>
|
||||
</div>
|
||||
<label title="Marca" data-toggle="tooltip" class="col-md-1 truncate">Marca:</label>
|
||||
<div class="col-md-2">
|
||||
<label title="Marca" data-toggle="tooltip" class="col-md-1 truncate" id="DivLblMarca" runat="server">Marca:</label>
|
||||
<div class="col-md-2" id="DivMarca" runat="server">
|
||||
<asp:DropDownList ID="DdlMarca" runat="server" Width="100%" DataTextField="Marca" DataValueField="CveMarca" Class="table-group-action-input form-control input-inline input-small input-sm select2me">
|
||||
</asp:DropDownList>
|
||||
</div>
|
||||
@@ -70,7 +70,7 @@
|
||||
</asp:UpdatePanel>
|
||||
<asp:UpdatePanel ID="UpDatos" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<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 metas registradas" ToolTip="Listado de Metas Vendedor" CssClass="table table-striped table-advance table-hover" Style=" 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 metas registradas" ToolTip="Listado de Metas Vendedor" CssClass="table table-striped table-advance table-hover" Style="width: 100%" GridLines="None">
|
||||
<Columns>
|
||||
<asp:TemplateField HeaderText="Vendedor" ItemStyle-HorizontalAlign="Left">
|
||||
<ItemTemplate>
|
||||
@@ -162,48 +162,54 @@
|
||||
<asp:Literal ID="LtlTituloModalTiposD" runat="server">Metas Vendedores</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 class="row" style="display: flex; align-items: center; margin-bottom: 10px;">
|
||||
<div class="col-md-2 truncate">Vendedor</div>
|
||||
<div class="col-md-10">
|
||||
<asp:DropDownList ID="DdlVendedores" runat="server" DataTextField="Vendedor" DataValueField="CveVendedor" CssClass="form-control input-sm select2me" Width="100%"></asp:DropDownList>
|
||||
</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">Clasificacion Superior:</label>
|
||||
<asp:DropDownList ID="DdlClasificacionSup" runat="server" DataTextField="Clasificacion" DataValueField="CveClasificacion" CssClass="form-control input-sm select2me"></asp:DropDownList>
|
||||
<i></i>
|
||||
<div class="row" style="display: flex; align-items: center; margin-bottom: 10px;" id="Div3" runat="server" visible="false">
|
||||
<div class="col-md-2 truncate">Marca</div>
|
||||
<div class="col-md-4">
|
||||
<asp:DropDownList ID="DdlMarcas" runat="server" DataTextField="Marca" DataValueField="CveMarca" CssClass="form-control input-sm select2me" Width="100%"></asp:DropDownList>
|
||||
</div>
|
||||
<div class="col-md-2 truncate">Mes y Año</div>
|
||||
<div class="col-md-4">
|
||||
<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>
|
||||
<div class="form-group form-md-line-input input-iconright">
|
||||
<label for="DdlMarcas">Clasificacion:</label>
|
||||
<asp:DropDownList ID="DdlClasificacion" runat="server" DataTextField="Clasificacion" DataValueField="CveClasificacion" CssClass="form-control input-sm select2me"></asp:DropDownList>
|
||||
<i></i>
|
||||
<div class="row" style="display: flex; align-items: center; margin-bottom: 10px;" id="Div2" runat="server" visible="false">
|
||||
<div class="col-md-2">Clasificación Superior</div>
|
||||
<div class="col-md-10">
|
||||
<asp:DropDownList ID="DdlClasificacionSup" runat="server" DataTextField="Clasificacion" DataValueField="CveClasificacion" CssClass="form-control input-sm select2me" Width="100%"></asp:DropDownList>
|
||||
</div>
|
||||
</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 class="row" style="display: flex; align-items: center; margin-bottom: 10px;" id="Div1" runat="server" visible="false">
|
||||
<label class="col-md-2 truncate">Clasificación</label>
|
||||
<div class="col-md-10">
|
||||
<asp:DropDownList ID="DdlClasificacion" runat="server" DataTextField="Clasificacion" DataValueField="CveClasificacion" CssClass="form-control input-sm select2me" Width="100%"></asp:DropDownList>
|
||||
</div>
|
||||
</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 class="row" style="display: flex; align-items: center; margin-bottom: 10px;">
|
||||
<div class="col-md-2">Cantidad meta</div>
|
||||
<div class="col-md-4">
|
||||
<asp:TextBox ID="TxtMetaCantidad" CssClass="form-control" runat="server" MaxLength="70" CausesValidation="true"></asp:TextBox>
|
||||
<asp:CompareValidator ID="CVCantidad" runat="server" ControlToValidate="TxtMetaCantidad" Display="None" ErrorMessage="El campo <b>''Cantidad meta''</b> no tiene el formato correcto, por favor corrija e intente de nuevo (Solo formato numérico)." Operator="DataTypeCheck" Type="Double" ValidationGroup="GrpTiposD"></asp:CompareValidator>
|
||||
<asp:RequiredFieldValidator ID="RFVTxtMetaCantidad" runat="server" ControlToValidate="TxtMetaCantidad" Display="None" ErrorMessage="El campo <b>''Cantidad meta''</b> es requerido por la aplicación, por favor ingrese una fecha." ValidationGroup="GrpTiposD"></asp:RequiredFieldValidator>
|
||||
</div>
|
||||
<div class="col-md-2">Importe meta</div>
|
||||
<div class="col-md-4">
|
||||
<asp:TextBox ID="TxtMetaImporte" CssClass="form-control" runat="server" MaxLength="70" CausesValidation="true"></asp:TextBox>
|
||||
<asp:CompareValidator ID="CVImporte" runat="server" ControlToValidate="TxtMetaImporte" Display="None" ErrorMessage="El campo <b>''Cantidad meta''</b> no tiene el formato correcto, por favor corrija e intente de nuevo (Solo formato numérico)." Operator="DataTypeCheck" Type="Double" ValidationGroup="GrpTiposD"></asp:CompareValidator>
|
||||
<asp:RequiredFieldValidator ID="RFVTxtMetaImporte" runat="server" ControlToValidate="TxtMetaImporte" Display="None" ErrorMessage="El campo <b>''Importe meta''</b> es requerido por la aplicación, por favor ingrese una fecha." ValidationGroup="GrpTiposD"></asp:RequiredFieldValidator>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
|
||||
@@ -33,16 +33,31 @@ Partial Class CatMetasVendedores
|
||||
|
||||
Private Sub CargaDatos()
|
||||
Dim Mes As Integer = -1, Anio As Integer = -1
|
||||
If Not String.IsNullOrEmpty(txtMesAnio.Text) Then
|
||||
Dim FechaRef As DateTime = txtMesAnio.Text.ToDate()
|
||||
Mes = FechaRef.Month
|
||||
Anio = FechaRef.Year
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
||||
If Not String.IsNullOrEmpty(txtMesAnio.Text) Then
|
||||
Dim FechaRef As DateTime = txtMesAnio.Text.ToDate()
|
||||
Mes = FechaRef.Month
|
||||
Anio = FechaRef.Year
|
||||
End If
|
||||
Else
|
||||
GvDatos.Columns(1).Visible = False
|
||||
GvDatos.Columns(2).Visible = False
|
||||
GvDatos.Columns(3).Visible = False
|
||||
GvDatos.Columns(4).Visible = False
|
||||
|
||||
DivLblSucursal.Visible = False
|
||||
DivSucursal.Visible = False
|
||||
DivLblMes.Visible = False
|
||||
DivMes.Visible = False
|
||||
DivLblMarca.Visible = False
|
||||
DivMarca.Visible = False
|
||||
End If
|
||||
|
||||
Dim ObjVentas As New ClsVentas
|
||||
If ObjVentas.GetMetasVendedores(UsuarioActual.CveEmpresa, CveSubProyecto:=DdlSubProyecto.SelectedValue.ToEntero(), CveVendedor:=DdlVendedor.SelectedValue.ToEntero(), CveMarca:=DdlMarca.SelectedValue.ToEntero(), Mes:=Mes, Anio:=Anio) Then
|
||||
GvDatos.DataSource = ObjVentas.DtResultados
|
||||
DtDatos = ObjVentas.DtResultados
|
||||
If ObjVentas.GetMetasVendedores(UsuarioActual.CveEmpresa, CveSubProyecto:=DdlSubProyecto.SelectedValue.ToEntero(), CveVendedor:=DdlVendedor.SelectedValue.ToEntero(), CveMarca:=DdlMarca.SelectedValue.ToEntero(), Mes:=Mes, Anio:=Anio) Then
|
||||
DtDatos = ObjVentas.DtResultados.Copy()
|
||||
GvDatos.DataSource = DtDatos
|
||||
End If
|
||||
ObjVentas.Dispose()
|
||||
GvDatos.DataBind()
|
||||
@@ -64,7 +79,13 @@ Partial Class CatMetasVendedores
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub CargaDatosModal()
|
||||
Private Sub CargaDatosModal()
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
||||
Div1.Visible = True
|
||||
Div2.Visible = True
|
||||
Div3.Visible = True
|
||||
End If
|
||||
|
||||
DdlVendedores.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa)
|
||||
DdlVendedores.DataBind()
|
||||
DdlVendedores.Items.Insert(0, New ListItem("Seleccionar", "-1"))
|
||||
@@ -93,29 +114,50 @@ 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 AndAlso DdlClasificacionSup.SelectedValue.ToEntero > 0 Then
|
||||
Dim CveVendedor As Integer = DdlVendedores.SelectedValue.ToEntero()
|
||||
Dim Fecha As Date = MinFecha
|
||||
Dim CveMarca As Integer = -1
|
||||
Dim CveClasificacionSuperior As Integer = -1
|
||||
Dim CveClasificacion As Integer = -1
|
||||
|
||||
Dim ObjVentas As New ClsVentas
|
||||
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
||||
|
||||
If Not (DdlVendedores.SelectedValue.ToEntero > 0 AndAlso TxtFechaI.Text <> "" AndAlso DdlMarcas.SelectedValue.ToEntero > 0 AndAlso DdlClasificacionSup.SelectedValue.ToEntero > 0) Then
|
||||
Alert(String.Format("Falta Seleccionar {0}{1}{2}", If(DdlVendedores.SelectedValue.ToEntero > 0, "", "Vendedor, "), If(DdlMarcas.SelectedValue.ToEntero > 0, "", "Marca, "), If(TxtFechaI.Text <> "", "", "Fecha, ")))
|
||||
Exit Sub
|
||||
End If
|
||||
Fecha = TxtFechaI.Text.ToDate()
|
||||
CveClasificacionSuperior = DdlClasificacionSup.SelectedValue.ToEntero
|
||||
CveClasificacion = DdlClasificacion.SelectedValue.ToEntero
|
||||
CveMarca = DdlMarca.SelectedValue.ToEntero
|
||||
|
||||
Else
|
||||
If Not (DdlVendedores.SelectedValue.ToEntero > 0) Then
|
||||
Alert("Falta Seleccionar el vendedor")
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
|
||||
Using ObjVentas As New ClsVentas
|
||||
If BtnAgregarMetaVendedor.Text = "Agregar" Then
|
||||
If ObjVentas.AddMetasVendedores(DdlVendedores.SelectedValue.ToEntero, TxtFechaI.Text.ToDate, DdlMarcas.SelectedValue.ToEntero, TxtMetaCantidad.Text.ToEntero,
|
||||
TxtMetaImporte.Text.ToDecimal, DdlClasificacion.SelectedValue.ToEntero, DdlClasificacionSup.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then
|
||||
If ObjVentas.AddMetasVendedores(CveVendedor, Fecha, DdlMarcas.SelectedValue.ToEntero, TxtMetaCantidad.Text.ToEntero, TxtMetaImporte.Text.ToDecimal, CveClasificacion, CveClasificacionSuperior, UsuarioActual.CveEmpresa) 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.Text.ToEntero, TxtMetaImporte.Text.ToDecimal, DdlClasificacion.SelectedValue.ToEntero,
|
||||
DdlClasificacionSup.SelectedValue.ToEntero) Then
|
||||
If ObjVentas.UpdateMetasVendedores(CveMetaVendedor, CveVendedor, Fecha.ToString("dd/MM/yyyy"), CveMarca, TxtMetaCantidad.Text.ToEntero, TxtMetaImporte.Text.ToDecimal, CveClasificacion, CveClasificacionSuperior) 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
|
||||
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
|
||||
End If
|
||||
End Using
|
||||
|
||||
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTiposD"))
|
||||
|
||||
ResetDatosSeleccionadosModal()
|
||||
CargaDatos()
|
||||
UpDatos.Update()
|
||||
@@ -135,12 +177,17 @@ Partial Class CatMetasVendedores
|
||||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||
CveMetaVendedor = GvRow.DataKey("CveMeta").ToEntero
|
||||
DdlVendedores.SelectedValue = GvRow.DataKey("CveVendedor")
|
||||
TxtFechaI.Text = GvRow.DataKey("MesAño")
|
||||
|
||||
DdlClasificacionSup.SelectedValueExist(GvRow.DataKey("CveClasificacionSup"))
|
||||
DdlClasificacion.SelectedValueExist(GvRow.DataKey("CveClasificacion"))
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
||||
|
||||
TxtFechaI.Text = GvRow.DataKey("MesAño")
|
||||
|
||||
DdlClasificacionSup.SelectedValueExist(GvRow.DataKey("CveClasificacionSup"))
|
||||
DdlClasificacion.SelectedValueExist(GvRow.DataKey("CveClasificacion"))
|
||||
|
||||
DdlMarcas.SelectedValue = GvRow.DataKey("CveMarca")
|
||||
End If
|
||||
|
||||
DdlMarcas.SelectedValue = GvRow.DataKey("CveMarca")
|
||||
TxtMetaCantidad.Text = GvRow.DataKey("MetaCantidad")
|
||||
TxtMetaImporte.Text = GvRow.DataKey("MetaImporte")
|
||||
UpModalTiposD.Update()
|
||||
|
||||
Reference in New Issue
Block a user