Commit inicial Ventas Productivo
This commit is contained in:
129
Contabilidad/RepIVADiferencias.aspx.vb
Normal file
129
Contabilidad/RepIVADiferencias.aspx.vb
Normal file
@@ -0,0 +1,129 @@
|
||||
Option Explicit On
|
||||
Option Strict On
|
||||
|
||||
Imports System.Data
|
||||
Imports System.IO
|
||||
Imports Extensiones
|
||||
Imports Microsoft.Reporting.WebForms
|
||||
|
||||
Partial Class Contabilidad_RepIVADiferencias
|
||||
Inherits ClsPaginas
|
||||
|
||||
#Region "PROPIEDADES"
|
||||
Private Property DtDatos As DataTable
|
||||
Get
|
||||
Return CType(ViewState("DtDatos"), DataTable)
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("DtDatos") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property Ejercicio As Integer
|
||||
Get
|
||||
Ejercicio = ViewState("Ejercicio").ToString.ToEntero
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
ViewState("Ejercicio") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property PeriodoNumero As Integer
|
||||
Get
|
||||
PeriodoNumero = ViewState("PeriodoNumero").ToString.ToEntero
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
ViewState("PeriodoNumero") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property Periodo As String
|
||||
Get
|
||||
Periodo = ViewState("Periodo").ToString
|
||||
End Get
|
||||
Set(value As String)
|
||||
ViewState("Periodo") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
#End Region
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
If Not IsPostBack Then
|
||||
CargaCombos()
|
||||
If UsuarioActual.Empresa.UsaContabilidad Or UsuarioActual.Empresa.UsaAC Then
|
||||
BtnConsultar.Enabled = True
|
||||
Ejercicio = DdlEjercicio.SelectedValue.ToEntero
|
||||
PeriodoNumero = DdlPeriodo.SelectedValue.ToEntero
|
||||
CargaDatos()
|
||||
Else
|
||||
Alert("La empresa no usa contabilidad ni Armonización Contable", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub CargaCombos()
|
||||
DdlEjercicio.Items.Insert(0, Now.Year.ToString)
|
||||
DdlEjercicio.Items.Insert(1, Now.AddYears(-1).Year.ToString)
|
||||
DdlPeriodo.SelectedValue = Now.Month.ToString
|
||||
End Sub
|
||||
Private Sub CargaDatos()
|
||||
Dim ObjCont As New ClsContPAQi(UsuarioActual.Empresa)
|
||||
If ObjCont.GetIVAsDiferencias(Ejercicio, PeriodoNumero) Then
|
||||
DtDatos = ObjCont.DtResultados
|
||||
Else
|
||||
DtDatos = Nothing
|
||||
End If
|
||||
ObjCont.Dispose()
|
||||
Gv.DataSource = DtDatos
|
||||
Gv.DataBind()
|
||||
UPPDatos.Update()
|
||||
Periodo = DdlPeriodo.SelectedItem.ToString
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click
|
||||
Ejercicio = DdlEjercicio.SelectedValue.ToEntero
|
||||
PeriodoNumero = DdlPeriodo.SelectedValue.ToEntero
|
||||
CargaDatos()
|
||||
End Sub
|
||||
|
||||
Private Sub LnkExcel_Click(sender As Object, e As EventArgs) Handles LnkExcel.Click
|
||||
'Gv.ExportToExcel("DiferenciasIVA")
|
||||
ImprimirReporte("Excel")
|
||||
End Sub
|
||||
Private Sub BtnImprimir_Click(sender As Object, e As EventArgs) Handles BtnImprimir.Click
|
||||
|
||||
ImprimirReporte()
|
||||
|
||||
End Sub
|
||||
Private Sub ImprimirReporte(Optional Formato As String = "PDF")
|
||||
'ubicacion del rdlc
|
||||
Dim reportpath As String = Server.MapPath("~/Empresas/Grales/Formatos/RepIvaDiferencias.rdlc") '"Empresas/Grales/Formatos/RepIvaDiferencias.rdlc"
|
||||
'nombre del reporte
|
||||
Dim fileName As String = "Diferencias IVA"
|
||||
Dim LogoRuta = String.Format("{0}Logo.png", UsuarioActual.Empresa.Ruta)
|
||||
|
||||
If Not IsNothing(DtDatos) AndAlso DtDatos.Rows.Count > 0 Then
|
||||
|
||||
Dim params As New List(Of ReportParameter)
|
||||
If File.Exists(LogoRuta) Then
|
||||
|
||||
If File.Exists(LogoRuta) Then
|
||||
LogoRuta = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
|
||||
End If
|
||||
'POR EMPRESA
|
||||
params.Add(New ReportParameter("pImg", LogoRuta))
|
||||
Else
|
||||
params.Add(New ReportParameter("pImg", ""))
|
||||
End If
|
||||
'parametros a enviar al reporte
|
||||
params.Add(New ReportParameter("pEmp", UsuarioActual.Empresa.Empresa))
|
||||
'params.Add(New ReportParameter("pImg", New Uri(Server.MapPath(String.Format("~/Empresas/{0}/Logo.png", UsuarioActual.CveEmpresa))).AbsoluteUri))
|
||||
params.Add(New ReportParameter("Ejercicio", Ejercicio.ToString))
|
||||
params.Add(New ReportParameter("Periodo", Periodo))
|
||||
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Usuario))
|
||||
params.Add(New ReportParameter("FechaImpresion", Now.ToShortDateString))
|
||||
|
||||
ImprimirPDF(reportpath, DtDatos, params, fileName, Formato)
|
||||
Else
|
||||
Alert("No se encontraron registros", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user