Permiso para bloquear totales en reporte ps de venta

This commit is contained in:
2022-05-27 19:22:23 -07:00
parent fcd459581b
commit 19c1b11883
2 changed files with 130 additions and 115 deletions

View File

@@ -6,10 +6,10 @@ Imports Microsoft.Reporting.WebForms
Imports System.Data
Partial Class Ventas_RepProductosServicios
Inherits ClsPaginas
Inherits ClsPaginas
#Region "PROPIEDADES"
Private Property DtVentas As DataTable
Get
Return DirectCast(ViewState("DtVentas"), DataTable)
@@ -52,24 +52,24 @@ Partial Class Ventas_RepProductosServicios
Set(value As Integer)
ViewState("TipoCambio") = value
End Set
End Property
End Property
#End Region
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
If UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario.Contiene(77, 21) Then Response.Redirect("/Inicio.aspx")
CargarMarcas()
SetValues()
SetValues()
End If
End Sub
End Sub
#Region " CARGA DATOS INICIALES "
Private Sub CargaGrupo()
DdlGrupo.Items.Insert(0, New ListItem("Categoria", "3"))
DdlGrupo.Items.Insert(1, New ListItem("Clasificación", "4"))
@@ -89,7 +89,7 @@ Partial Class Ventas_RepProductosServicios
DdlGrupo.Items.Insert(15, New ListItem("Cliente - PS", "20"))
DdlGrupo.Items.Insert(16, New ListItem("Sucursal - PS", "21"))
DdlGrupo.Items.Insert(17, New ListItem("Familia - Marca - Tipo", "22"))
DdlGrupo.Items.Insert(18, New ListItem("Tipo Cliente", "23"))
DdlGrupo.Items.Insert(18, New ListItem("Tipo Cliente", "23"))
DdlGrupo.Items.Insert(18, New ListItem("Marca", "24"))
DdlGrupo.Items.Insert(18, New ListItem("Cliente Sucursal", "26"))
@@ -168,24 +168,24 @@ Partial Class Ventas_RepProductosServicios
'Cargo Clasificaciones
DdlClasificacion.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa)
DdlClasificacion.DataBind()
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
DvLitraje.Visible = True
'garantia
divgarantia1.Visible = True
divgarantia2.Visible = True
divdistribuidor1.Visible = True
divdistribuidor2.Visible = True
DdlClasificacion2.DataSource = GlobalDTClasificaciones2(UsuarioActual.CveEmpresa)
DdlClasificacion2.DataBind()
divClasif2texto.Visible = True
divClasif2.Visible = True
DdlGrupo.Items.Add(New ListItem("Clasificacion2", "25"))
End If
DdlClasificacion.DataBind()
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
DvLitraje.Visible = True
'garantia
divgarantia1.Visible = True
divgarantia2.Visible = True
divdistribuidor1.Visible = True
divdistribuidor2.Visible = True
DdlClasificacion2.DataSource = GlobalDTClasificaciones2(UsuarioActual.CveEmpresa)
DdlClasificacion2.DataBind()
divClasif2texto.Visible = True
divClasif2.Visible = True
DdlGrupo.Items.Add(New ListItem("Clasificacion2", "25"))
End If
@@ -196,7 +196,7 @@ Partial Class Ventas_RepProductosServicios
DdlSubProyectoEjecucion.DataBind()
'Vendedor
DdlVendedor.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa, VendedorTipo:=-1).FiltraParametros("VendedorTipo in (1,4)") 'vendedores y vendedores de piso
DdlVendedor.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa, VendedorTipo:=-1).FiltraParametros("VendedorTipo in (1,4)") 'vendedores y vendedores de piso
DdlVendedor.DataBind()
'CargaUsuarios
@@ -259,21 +259,28 @@ Partial Class Ventas_RepProductosServicios
DdlClientes.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa, -1)
DdlClientes.DataBind()
DdlClientes.ddl.Items.Insert(0, New ListItem("Todos", "-1"))
End If
End If
If UsuarioActual.CveVendedor > 0 AndAlso Not UsuarioActual.TienePermisoProceso(263) Then
DdlVendedor.SelectedValueExist(UsuarioActual.CveVendedor.ToString())
DdlVendedor.Attributes.Add("disabled", "disabled")
DdlVendedor.Enabled = False
End If
End If
txtFechaI.Text = Now.FirstDayOfMonth.ToShortDateString
txtFechaF.Text = Now.ToShortDateString
End Sub
If UsuarioActual.TienePermisoProceso(339) Then
GvDatos.Columns(2).Visible = False
GvDatos.Columns(3).Visible = False
GvDatos.Columns(4).Visible = False
GvDatos.Columns(5).Visible = False
End If
End Sub
#End Region
#Region " CARGA DATOS "
Protected Sub BtnConsultar_Click(sender As Object, e As System.EventArgs) Handles BtnConsultar.Click
CargaDatos()
@@ -300,7 +307,7 @@ Partial Class Ventas_RepProductosServicios
DdlPS.SelectedValue.ToEntero, FechaI, FechaF, FechaIEjec, FechaFEjec, CveCliente,
DdlSubProyectoEjecucion.SelectedValue.ToEntero, DdlVendedor.SelectedValue.ToEntero, DdlUsuario.SelectedValue.ToEntero, DdlEstatus.SelectedValue.ToEntero, "-1",
UsuarioActual.CveEmpresa, DdlGrupo.SelectedValue.ToEntero, CveUsuarioConsulta:=UsuarioActual.CveUsuario, TipoDocto:=TipoComprobante,
CveClienteClasificacion:=DdlClienteClasificacion.SelectedValue.ToEntero, TipoCambio:=TipoCambio, TCEspecifico:=TCEspecifico, CveProveedorCompra:=CveProveedorCompra,
CveClienteClasificacion:=DdlClienteClasificacion.SelectedValue.ToEntero, TipoCambio:=TipoCambio, TCEspecifico:=TCEspecifico, CveProveedorCompra:=CveProveedorCompra,
CveMarca:=DdlMarcaPSDes.SelectedValue.ToEntero, MostrarLitraje:=ChkLitraje.Checked, TipoCliente:=DdlTipoCliente.SelectedValue.ToEntero, EsGarantia:=DdlGarantia.SelectedValue.ToEntero, ModalidadContable:=ModalidadContable,
CveCondicionesPago:=DdlCondicionesPago.SelectedValue.ToEntero, EsDistribuidor:=DdlDistribuidor.SelectedValue.ToEntero, CveClasificacion2:=DdlClasificacion2.SelectedValue.ToEntero) Then
GvDatos.DataSource = ObjVentas.DtResultados
@@ -324,55 +331,55 @@ Partial Class Ventas_RepProductosServicios
DivMarca.Visible = True
LblMarca.Visible = True
Using ObjMarcas As New ClsProductosServicios
If ObjMarcas.GetMarcas(UsuarioActual.CveEmpresa) Then
DdlMarcaPSDes.DataSource = ObjMarcas.DtResultados
DdlMarcaPSDes.DataBind()
End If
Using ObjMarcas As New ClsProductosServicios
If ObjMarcas.GetMarcas(UsuarioActual.CveEmpresa) Then
DdlMarcaPSDes.DataSource = ObjMarcas.DtResultados
DdlMarcaPSDes.DataBind()
End If
End Using
End If
DdlMarcaPSDes.Items.Insert(0, New ListItem(" Todos ", "-1"))
End Sub
End Sub
#End Region
#Region " GV DATOS - PERSONALIZAR "
Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
Dim Css As String = "Texto"
Dim CveClasificacionDetalle As String = "-1"
Dim cveMarca As String = DdlMarcaPSDes.SelectedValue
If DdlGrupo.SelectedValue.ToEntero = 22 Then
Dim tipo As Integer = If(e.Row.DBCampo("CveClasificacionDetalle").ToEntero() > 0, 4, If(e.Row.DBCampo("CveMarca").ToEntero() > 0, 3, If(e.Row.DBCampo("CveClasificacion").ToEntero() > 0, 2, 1)))
Select Case tipo
Case 4
CveClasificacionDetalle = e.Row.DBCampo("CveClasificacionDetalle").ToString() ' String.Format("{0}&CveClasificacionDetalle={1}&CveMarca={2}", squery, e.Row.DBCampo("CveClasificacionDetalle").ToEntero(), e.Row.DBCampo("CveMarca").ToEntero())
cveMarca = e.Row.DBCampo("CveMarca").ToString()
Case 3
'squery = String.Format("{0}&CveMarca{1}", squery, e.Row.DBCampo("CveMarca").ToEntero())
cveMarca = e.Row.DBCampo("CveMarca").ToString()
e.Row.CssClass = "SubTotalesB"
Case 2
e.Row.CssClass = "SubTotales"
Case 1
e.Row.CssClass = "Totales"
End Select
Else
If e.Row.DBCampo("Orden") = "" Then
e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Center
e.Row.Cells(0).Width = Unit.Pixel(200)
e.Row.Cells(1).HorizontalAlign = HorizontalAlign.Center
e.Row.Cells(1).Width = Unit.Pixel(60)
e.Row.Cells(2).Width = Unit.Pixel(90)
e.Row.Cells(3).Width = Unit.Pixel(90)
e.Row.Cells(5).Width = Unit.Pixel(80)
e.Row.Cells(8).Width = Unit.Pixel(100)
e.Row.CssClass = "Totales"
Css = "Totales"
ElseIf DdlGrupo.SelectedValue.Contiene("20", "21") And Not e.Row.DBCampo("CvePS").ToEntero > 0 Then
e.Row.CssClass = "SubTotales"
End If
If DdlGrupo.SelectedValue.ToEntero = 22 Then
Dim tipo As Integer = If(e.Row.DBCampo("CveClasificacionDetalle").ToEntero() > 0, 4, If(e.Row.DBCampo("CveMarca").ToEntero() > 0, 3, If(e.Row.DBCampo("CveClasificacion").ToEntero() > 0, 2, 1)))
Select Case tipo
Case 4
CveClasificacionDetalle = e.Row.DBCampo("CveClasificacionDetalle").ToString() ' String.Format("{0}&CveClasificacionDetalle={1}&CveMarca={2}", squery, e.Row.DBCampo("CveClasificacionDetalle").ToEntero(), e.Row.DBCampo("CveMarca").ToEntero())
cveMarca = e.Row.DBCampo("CveMarca").ToString()
Case 3
'squery = String.Format("{0}&CveMarca{1}", squery, e.Row.DBCampo("CveMarca").ToEntero())
cveMarca = e.Row.DBCampo("CveMarca").ToString()
e.Row.CssClass = "SubTotalesB"
Case 2
e.Row.CssClass = "SubTotales"
Case 1
e.Row.CssClass = "Totales"
End Select
Else
If e.Row.DBCampo("Orden") = "" Then
e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Center
e.Row.Cells(0).Width = Unit.Pixel(200)
e.Row.Cells(1).HorizontalAlign = HorizontalAlign.Center
e.Row.Cells(1).Width = Unit.Pixel(60)
e.Row.Cells(2).Width = Unit.Pixel(90)
e.Row.Cells(3).Width = Unit.Pixel(90)
e.Row.Cells(5).Width = Unit.Pixel(80)
e.Row.Cells(8).Width = Unit.Pixel(100)
e.Row.CssClass = "Totales"
Css = "Totales"
ElseIf DdlGrupo.SelectedValue.Contiene("20", "21") And Not e.Row.DBCampo("CvePS").ToEntero > 0 Then
e.Row.CssClass = "SubTotales"
End If
End If
' PARA LIGA
@@ -386,7 +393,7 @@ Partial Class Ventas_RepProductosServicios
e.Row.DBCampo("CveProyecto"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveCategoria"), e.Row.DBCampo("CveClasificacion"), e.Row.DBCampo("CvePS"),
e.Row.DBCampo("CveCliente"), e.Row.DBCampo("CveSubProyectoEjecucion"), e.Row.DBCampo("Vendedor"), e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveEstatusFactura"),
e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("AnioEjec"), e.Row.DBCampo("MesEjec"), e.Row.DBCampo("AnioMesEjec"), e.Row.DBCampo("FechaEjec"),
FechaI, FechaF, FechaIEjec, FechaFEjec, e.Row.DBCampo("TipoDocto"), e.Row.DBCampo("CveGpo"), e.Row.DBCampo("CveMoneda"), e.Row.DBCampo("TipoCambio"), e.Row.DBCampo("TCEspecifico"), e.Row.DBCampo("CveClienteClasificacion"), e.Row.DBCampo("CveProveedorCompra"), cveMarca,
FechaI, FechaF, FechaIEjec, FechaFEjec, e.Row.DBCampo("TipoDocto"), e.Row.DBCampo("CveGpo"), e.Row.DBCampo("CveMoneda"), e.Row.DBCampo("TipoCambio"), e.Row.DBCampo("TCEspecifico"), e.Row.DBCampo("CveClienteClasificacion"), e.Row.DBCampo("CveProveedorCompra"), cveMarca,
CveClasificacionDetalle, If(DdlGrupo.SelectedValue.ToEntero = 23, e.Row.DBCampo("TipoCliente"), DdlTipoCliente.SelectedValue), If(Not ChkLecturaAdmin.Checked, 1, 0),
e.Row.DBCampo("EsGarantia"), e.Row.DBCampo("CveCondicionesPago"), IIf(e.Row.DBCampo("MostrarLitraje") = "True", 1, 0), e.Row.DBCampo("EsDistribuidor"), e.Row.DBCampo("CveClienteSucursal").ToString.ToEntero)
@@ -437,10 +444,10 @@ Partial Class Ventas_RepProductosServicios
End If
UPDatos.Update()
End Sub
End Sub
#End Region
#Region " SELECTED INDEX CHANGED"
Protected Sub DdlClienteClasificacion_SelectedIndexChanged(sender As Object, e As EventArgs)
CargaClientes()
@@ -492,8 +499,8 @@ Partial Class Ventas_RepProductosServicios
If DdlTipoComprobante.SelectedValue <> "-1" Then
DdlEstatus.DataSource = GlobalDTEstatusFactura.FiltraParametros(String.Format("TipoDocto = '{0}'", DdlTipoComprobante.SelectedValue))
Else
DdlEstatus.DataSource = GlobalDTEstatusFactura
DdlEstatus.DataSource = GlobalDTEstatusFactura
End If
DdlEstatus.Items.Add(New ListItem("Todos", "-1"))
DdlEstatus.DataBind()
@@ -511,10 +518,10 @@ Partial Class Ventas_RepProductosServicios
LiEspecifico.Visible = False
End If
UpBodyTipoCambio.Update()
End Sub
End Sub
#End Region
#Region " IMPRIMIR "
Protected Sub LnkPdf_Click(sender As Object, e As EventArgs) Handles LnkPdf.Click
If GvDatos.Rows.Count > 0 Then
@@ -531,21 +538,21 @@ Partial Class Ventas_RepProductosServicios
FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.ToDate, MinFecha)
FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.ToDate, MaxFecha)
FechaIEjec = If(IsDate(TxtFechaIEjec.Text.Trim()), TxtFechaIEjec.Text.ToDate, MinFecha)
FechaFEjec = If(IsDate(TxtFechaFEjec.Text.Trim()), TxtFechaFEjec.Text.ToDate, MaxFecha)
Dim Cliente = If(DdlClientes.SelectedText = "", "", $"&emsp;<b>Cliente:</b>&nbsp;{DdlClientes.SelectedText}")
Dim Proveedor = If(DdlProveedor.SelectedValue = "", "", $"&emsp;<b>Proveedor:</b>&nbsp;{DdlProveedor.SelectedText}")
Dim FechaInicio = If(txtFechaI.Text = "", "", $"&emsp;<b>Fecha Inicio:</b>&nbsp;{txtFechaI.Text}")
Dim FechaFin = If(txtFechaF.Text = "", "", $"&emsp;<b>Fecha Fin:</b>&nbsp;{txtFechaF.Text}")
Dim Grupo = If(DdlGrupo.SelectedValue = "-1", "", $"&emsp;<b>Agrupado por:</b>&nbsp;{DdlGrupo.SelectedItem.Text}")
Dim Categoria = If(DdlCategoria.SelectedValue = "-1", "", $"&emsp;<b>Categoria:</b>&nbsp;{DdlCategoria.SelectedItem.Text }")
Dim Clasificacion = If(DdlClasificacion.SelectedValue = "-1", "", $"&emsp;<b>Clasificación:</b>&nbsp;{DdlClasificacion.SelectedItem.Text}")
Dim PS = If(DdlPS.SelectedValue = "-1", "", $"&emsp;<b>P.S.:</b>&nbsp;{DdlPS.SelectedText}")
Dim Proyecto = If(DdlSubProyecto.SelectedValue = "-1", "", $"&emsp;<b>Proyecto:</b>&nbsp;{DdlSubProyecto.SelectedItem.Text}")
Dim Estatus = If(DdlEstatus.SelectedValue = "-1", "", $"&emsp;<b>Estatus:</b>&nbsp;{DdlEstatus.SelectedItem.Text}")
Dim Usuario = If(DdlUsuario.SelectedValue = "-1", "", $"&emsp;<b>Usuario:</b>&nbsp;{DdlUsuario.SelectedItem.Text}")
FechaFEjec = If(IsDate(TxtFechaFEjec.Text.Trim()), TxtFechaFEjec.Text.ToDate, MaxFecha)
Dim Cliente = If(DdlClientes.SelectedText = "", "", $"&emsp;<b>Cliente:</b>&nbsp;{DdlClientes.SelectedText}")
Dim Proveedor = If(DdlProveedor.SelectedValue = "", "", $"&emsp;<b>Proveedor:</b>&nbsp;{DdlProveedor.SelectedText}")
Dim FechaInicio = If(txtFechaI.Text = "", "", $"&emsp;<b>Fecha Inicio:</b>&nbsp;{txtFechaI.Text}")
Dim FechaFin = If(txtFechaF.Text = "", "", $"&emsp;<b>Fecha Fin:</b>&nbsp;{txtFechaF.Text}")
Dim Grupo = If(DdlGrupo.SelectedValue = "-1", "", $"&emsp;<b>Agrupado por:</b>&nbsp;{DdlGrupo.SelectedItem.Text}")
Dim Categoria = If(DdlCategoria.SelectedValue = "-1", "", $"&emsp;<b>Categoria:</b>&nbsp;{DdlCategoria.SelectedItem.Text }")
Dim Clasificacion = If(DdlClasificacion.SelectedValue = "-1", "", $"&emsp;<b>Clasificación:</b>&nbsp;{DdlClasificacion.SelectedItem.Text}")
Dim PS = If(DdlPS.SelectedValue = "-1", "", $"&emsp;<b>P.S.:</b>&nbsp;{DdlPS.SelectedText}")
Dim Proyecto = If(DdlSubProyecto.SelectedValue = "-1", "", $"&emsp;<b>Proyecto:</b>&nbsp;{DdlSubProyecto.SelectedItem.Text}")
Dim Estatus = If(DdlEstatus.SelectedValue = "-1", "", $"&emsp;<b>Estatus:</b>&nbsp;{DdlEstatus.SelectedItem.Text}")
Dim Usuario = If(DdlUsuario.SelectedValue = "-1", "", $"&emsp;<b>Usuario:</b>&nbsp;{DdlUsuario.SelectedItem.Text}")
If DtVentas IsNot Nothing AndAlso DtVentas.Rows.Count > 0 Then
Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
@@ -555,7 +562,7 @@ Partial Class Ventas_RepProductosServicios
params.Add(New ReportParameter("FechaFin", If(txtFechaF.Text <> "", FechaF.ToShortDateString, "")))
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString))
params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString))
params.Add(New ReportParameter("Filtros", $"{Grupo}{Cliente}{FechaInicio}{FechaFin}{Categoria}{Clasificacion}{PS}{Proyecto}{Estatus}{Usuario}{Proveedor}"))
If Imagen.Exists Then
params.Add(New ReportParameter("LogoPath", logouri))
@@ -567,12 +574,12 @@ Partial Class Ventas_RepProductosServicios
Alert("No hay información para mostrar.", TipoMensaje.MsgAdvertencia)
End If
End Sub
End Sub
#End Region
#Region "GRAFICA"
Protected Sub LnkVerGrafica_Click(sender As Object, e As EventArgs)
If Not DtVentas IsNot Nothing AndAlso DtVentas.Rows.Count > 0 Then
Alert("No hay datos disponibles", TipoMensaje.MsgAdvertencia)
@@ -704,9 +711,9 @@ Partial Class Ventas_RepProductosServicios
Protected Sub DdlVer_SelectedIndexChanged(sender As Object, e As EventArgs)
CambioGrafica()
End Sub
End Sub
#End Region
End Class

View File

@@ -273,6 +273,14 @@ Partial Class Ventas_RepProductosServiciosDetalle
TCEspecifico = 0
TipoCambio = 1
If UsuarioActual.TienePermisoProceso(339) Then
GvDatos.Columns(10).Visible = False
GvDatos.Columns(11).Visible = False
GvDatos.Columns(12).Visible = False
GvDatos.Columns(13).Visible = False
GvDatos.Columns(14).Visible = False
End If
End Sub
Private Sub CargaSucursales(CveCliente As Integer, CveClienteSucursal As Integer)