Option Explicit On
Option Strict On
Imports System.Data
Imports Extensiones
Partial Class PopUpBuscarFolio
Inherits ClsPaginas
Private ReadOnly Property Ruta As String
Get
Return UsuarioActual.Empresa.Ruta
End Get
End Property
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")
CType(Me.Master, BaseMasterPage).EsPopup = True
CType(Me.Master, BaseMasterPage).PopupWidth = 800
txtFechaI.Text = Now.AddMonths(-12).ToShortDateString
'RegistraScript("$get('tdContenido').style.height='500px'")
CargaSubProyectos()
CargaEstatus()
CargaUsuarios()
CargaNombreClientes()
CargaClasificaciones()
CargaPS(-1)
'CargaCodigoCliente()
End If
End Sub
Private Sub CargaNombreClientes()
DdlNombre.setEsWebService(True)
DdlNombre.Attributes.Add("data-metodo", "getcliente")
'DdlNombre.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa)
'DdlNombre.DataBind()
'DdlNombre.Items.Insert(0, New ListItem("Todos", "-1"))
End Sub
Private Sub CargaSubProyectos()
DdlSubProyecto.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1)
DdlSubProyecto.DataBind()
End Sub
Private Sub CargaUsuarios()
DdlUsuario.DataSource = GlobalDTUsuarios(CveEmpresa:=UsuarioActual.CveEmpresa)
DdlUsuario.DataBind()
End Sub
Private Sub CargaClasificaciones()
If UsuarioActual.Empresa.UsaAC Then
DdlClasificacion.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltraParametros(" Codigo = '' OR Codigo IS NULL ", Orderby:="Clasificacion")
Else
DdlClasificacion.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltraParametros("", Orderby:="Clasificacion")
End If
'DdlClasificacion.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa)
DdlClasificacion.DataBind()
End Sub
Protected Sub DdlClasificacion_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles DdlClasificacion.SelectedIndexChanged
CargaPS(DdlClasificacion.SelectedValue.ToEntero)
UPPS.Update()
End Sub
Private Sub CargaPS(CveClasificacion As Integer)
DdlPS.setEsWebService(UsuarioActual.Empresa.Funcionalidad(105) = "1")
If UsuarioActual.Empresa.Funcionalidad(105) = "1" Then
DdlPS.ddlWS.Attributes.Add("data-cveclasificacion", DdlClasificacion.SelectedValue)
DdlPS.SelectedText = ""
DdlPS.SelectedValue = "-1"
Else
DdlPS.ddl.Items.Clear()
DdlPS.ddl.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacion)
DdlPS.ddl.DataBind()
DdlPS.ddl.Items.Insert(0, New ListItem("Todos", "-1"))
End If
End Sub
'Private Sub CargaCodigoCliente()
' DdlCodigoCliente.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa).FiltraParametros("Codigo <> ''")
' DdlCodigoCliente.DataBind()
'End Sub
Protected Sub BtnBuscar_Click(sender As Object, e As System.EventArgs) Handles BtnBuscar.Click
Dim Serie As String = "-1"
Dim Folio As Integer = -1
Dim Codigo As String = "-1"
Dim Cliente As String = "-1"
Dim FechaI As String = "-1"
Dim FechaF As String = "-1"
Dim FolioFiscal As String = "-1"
Dim PeidoContrato As String = "-1"
Dim OrdenCompra As String = "-1"
If TxtFolio.Text.Trim.Length = 0 Then
Serie = "-1"
Folio = -1
Else
Dim Array() As String = TxtFolio.Text.Trim.Split(CChar("-"))
If Array.Length = 2 Then
Serie = Array(0)
Folio = Array(1).ToEntero
Else
Serie = "-1"
Folio = TxtFolio.Text.Trim.ToEntero
End If
End If
Codigo = "-1" 'If(DdlCodigoCliente.SelectedValue.ToEntero > 0, DdlCodigoCliente.SelectedItem.ToString, "-1")
Cliente = If(DdlNombre.SelectedValue.ToEntero > 0, DdlNombre.SelectedValue, "-1")
FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.Trim(), "-1")
FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.Trim(), "-1")
FolioFiscal = If(TxtFolioFiscal.Text.Trim.Length = 0, "-1", TxtFolioFiscal.Text.Trim)
PeidoContrato = If(TxtPedidoContrato.Text.Length = 0, "-1", TxtPedidoContrato.Text.Trim)
OrdenCompra = If(TxtOrdenCompra.Text.Length = 0, "-1", TxtOrdenCompra.Text.Trim)
If ValidarUnFiltroSeleccionado() Then
Dim ObjVentas As New ClsVentas()
If ObjVentas.GetVentas(UsuarioActual.CveEmpresa, DdlTipoDocto.SelectedValue, Serie, Folio, Codigo, Cliente.ToEntero, DdlSubProyecto.SelectedValue.ToEntero,
DdlEstatusFactura.SelectedValue.ToEntero, DdlUsuario.SelectedValue.ToEntero, FechaI, FechaF, FolioFiscal, If(DdlSucursalCliente.Visible, DdlSucursalCliente.SelectedValue.ToEntero, -1),
DdlPS.SelectedValue.ToEntero, PedidoContrato:=PeidoContrato, OrdenCompra:=OrdenCompra, CveUsuarioConsulta:=UsuarioActual.CveUsuario, TopSelect:=100) Then
If ObjVentas.DtResultados.Rows.Count > 0 Then
LtlTotalRegistros.Text = ObjVentas.DtResultados.Rows.Count.ToString.FormatoNumero(0)
GV.DataSource = ObjVentas.DtResultados
Else
LtlTotalRegistros.Text = "0"
GV.DataSource = Nothing
Alert("No se encontraron registros con los parámetros solicitados.", Extensiones.TipoMensaje.MsgAdvertencia)
End If
End If
ObjVentas.Dispose()
GV.DataBind()
UPDatos.Update()
TblBusqueda.Visible = True
Else
Alert("Asigne un valor a cualquiera de los filtros", TipoMensaje.MsgAdvertencia)
End If
End Sub
Protected Sub GV_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GV.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
'If e.Row.RowIndex = 0 Then
' e.Row.Cells(0).Width = Unit.Pixel(38)
' e.Row.Cells(1).Width = Unit.Pixel(65)
' e.Row.Cells(2).Width = Unit.Pixel(70)
' e.Row.Cells(3).Width = Unit.Pixel(250)
' 'e.Row.Cells(4).Width = Unit.Pixel(75)
' e.Row.Cells(4).Width = Unit.Pixel(75)
' e.Row.Cells(5).Width = Unit.Pixel(100)
' e.Row.Cells(6).Width = Unit.Pixel(100)
'End If
e.Row.Cells(3).HorizontalAlign = HorizontalAlign.Left
'e.Row.Cells(4).HorizontalAlign = HorizontalAlign.Right
e.Row.Cells(4).HorizontalAlign = HorizontalAlign.Right
Dim Liga As String = String.Format("", e.Row.DBCampo("CveVenta"))
If UsuarioActual.CveEmpresa = 140 AndAlso e.Row.DBCampo("TipoDocto").Contiene("Rem") Then
Liga = String.Format("", e.Row.DBCampo("CveVenta"))
End If
e.Row.FCLiteral("LtlTipo").Text = String.Format("