From 89db1021391df4287d56a9cdc5d0ef3239fd25f9 Mon Sep 17 00:00:00 2001 From: Antonio Gonzalez Date: Fri, 20 Mar 2020 12:14:21 -0700 Subject: [PATCH] actualizando el catalogo de metas vendedores --- App_Code/ClsVentas.vb | 6 ++++-- Ventas/CatMetasVendedores.aspx | 17 ++++++++++++++++- Ventas/CatMetasVendedores.aspx.vb | 15 +++++++++++---- 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index 5c98d9754..04145d92c 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -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) diff --git a/Ventas/CatMetasVendedores.aspx b/Ventas/CatMetasVendedores.aspx index cdc2accf6..d3dbf0c60 100644 --- a/Ventas/CatMetasVendedores.aspx +++ b/Ventas/CatMetasVendedores.aspx @@ -22,7 +22,7 @@ - + @@ -54,6 +54,16 @@ + + + + + + + + + + @@ -125,6 +135,11 @@ +
+ + + +
diff --git a/Ventas/CatMetasVendedores.aspx.vb b/Ventas/CatMetasVendedores.aspx.vb index dcc77690f..0f1e9f8f5 100644 --- a/Ventas/CatMetasVendedores.aspx.vb +++ b/Ventas/CatMetasVendedores.aspx.vb @@ -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")