Files
SIG/Ventas/AuxiliarCliente.aspx.vb
2024-09-26 20:33:19 -07:00

130 lines
4.8 KiB
VB.net

Option Explicit On
Option Strict On
Imports System.Data
Imports System.IO
Imports Extensiones
Partial Class Ventas_AuxiliarCliente
Inherits ClsPaginas
#Region " PROPIEDADES"
Private Property DtActivosFijos As DataTable
Get
Return CType(ViewState("DtActivosFijos"), DataTable)
End Get
Set(value As DataTable)
ViewState("DtActivosFijos") = value
End Set
End Property
Private ReadOnly Property CveActivoFijo As Integer
Get
Return ViewState("CveActivoFijo").ToString.ToEntero
End Get
End Property
Private Property DTAFCaracteristicas As DataTable
Get
Return CType(ViewState("DTAFCaracteristicas"), DataTable)
End Get
Set(value As DataTable)
ViewState("DTAFCaracteristicas") = value
End Set
End Property
#End Region
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
CargaFiltros()
End If
End Sub
Private Sub CargaFiltros()
If (UsuarioActual.Empresa.Funcionalidad(105) = "1") Then
DdlClientes.setEsWebService(True)
DdlClientes.Attributes.Add("data-metodo", "getcliente")
DdlClientes.SelectedText = "Todos"
DdlClientes.SelectedValue = "-1"
Else
DdlClientes.setEsWebService(False)
DdlClientes.ddl.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa)
DdlClientes.ddl.DataBind()
DdlClientes.ddl.Items.Insert(0, New ListItem("Todos", "-1"))
End If
'DdlConceptosContables.DataSource = GlobalDTContaConceptosContables(-1)
'DdlConceptosContables.DataBind()
'DdlConceptosContables.Items.Insert(0, New ListItem("Todos", "-1"))
CargarCentrosDeCosto(Nothing, DdlSubProyecto, Nothing, LblSubProyecto)
DdlSubProyecto.Items.Insert(0, New ListItem("Todos", "-1"))
DdlSubProyecto.SelectedValuesIfExist("-1")
txtFechaI.Text = NowADS().AddDays(-30).ToString("dd/MM/yyyy")
txtFechaF.Text = NowADS().ToString("dd/MM/yyyy")
End Sub
Private Sub CargaDatos()
Dim ObjConta As New ClsContabilidad
'Falta PA
If ObjConta.GetClienteAuxiliar(DdlClientes.SelectedValue.ToEntero, -1, DdlSubProyecto.SelectedValue.ToEntero, txtFechaI.Text.ToDate, txtFechaF.Text.ToDate, UsuarioActual.CveEmpresa, DdlOpcion.SelectedValue.ToEntero) Then
If DdlOpcion.SelectedValue.ToEntero = 2 Then
GvAuxCliente.DataSource = ObjConta.DtResultados.FiltraParametros($" IIF(ISNULL(CveConceptoContable,0) = 1 AND Importe >= 0,0,1) = 1")
Else
GvAuxCliente.DataSource = ObjConta.DtResultados
End If
Else
GvAuxCliente.DataSource = Nothing
End If
ObjConta.Dispose()
GvAuxCliente.DataBind()
UpDatos.Update()
End Sub
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs)
CargaDatos()
End Sub
Private Sub ImgExcel_Click(sender As Object, e As EventArgs) Handles ImgExcel.Click
ExportToExcelGTest(GvAuxCliente, "Auxiliar" & DdlClientes.SelectedText & ".xlsx", "Auxiliar Clientes", UsuarioActual)
End Sub
Public Overrides Sub VerifyRenderingInServerForm(ByVal control As Control)
End Sub
Public Sub ExportToExcelGTest(Gv As GridView, NombreArchivoXLSx As String, Optional Titulo As String = "Reporte", Optional Usuario As Usuario = Nothing)
ExportToExcelGembox(Gv, NombreArchivoXLSx, Usuario, Titulo)
End Sub
Protected Sub GvAuxCliente_RowDataBound(sender As Object, e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
If DdlOpcion.SelectedValue.ToEntero = 2 Then
If Not e.Row.DBCampo("CveConceptoContable").ToEntero > 0 Then
e.Row.CssClass = "Totales"
Else
e.Row.Cells(0).Text = ""
e.Row.Cells(7).Text = ""
End If
End If
If e.Row.DBCampo("TipoReferencia").ToEntero = 1 Then
e.Row.FCHyperLink("HplReferencia").NavigateUrl = $"/Bancos/IE.aspx?CveIE={e.Row.DBCampo("CveReferencia")}"
ElseIf e.Row.DBCampo("TipoReferencia").ToEntero = 2 Then
e.Row.FCHyperLink("HplReferencia").NavigateUrl = $"/Ventas/Ventas.aspx?CveVenta={e.Row.DBCampo("CveReferencia")}"
ElseIf e.Row.DBCampo("TipoReferencia").ToEntero = 3 Then
e.Row.FCHyperLink("HplReferencia").NavigateUrl = $"/Compras/Compras.aspx?CveCompra={e.Row.DBCampo("CveReferencia")}"
End If
If e.Row.DBCampo("CveConceptoContable").ToEntero = 1 AndAlso e.Row.DBCampo("Importe").ToString.ToDouble < 0 Then
e.Row.ForeColor = Drawing.Color.Red
End If
End If
End Sub
End Class