-- unificación de módulos de Contabilidad a una sola carpeta. como principal ContaSIG

This commit is contained in:
2024-06-17 08:33:45 -07:00
parent 54ac9b836b
commit 9219751707
88 changed files with 17456 additions and 21235 deletions

View File

@@ -4,10 +4,7 @@ Option Strict On
Imports System.Data
Imports Extensiones
Imports Microsoft.Reporting.WebForms
Imports GemBox.Spreadsheet
Imports System.IO
Partial Class Contabilidad_RepEstadoResultados
Partial Class Contabilidad2_RepEstadoResultados
Inherits ClsPaginas
@@ -55,22 +52,6 @@ Partial Class Contabilidad_RepEstadoResultados
ViewState("TotalAnterior") = value
End Set
End Property
Private Property PorcentajeActual As String
Get
PorcentajeActual = ViewState("PorcentajeActual").ToString
End Get
Set(value As String)
ViewState("PorcentajeActual") = value
End Set
End Property
Private Property PorcentajeAcumulado As String
Get
PorcentajeAcumulado = ViewState("PorcentajeAcumulado").ToString
End Get
Set(value As String)
ViewState("PorcentajeAcumulado") = value
End Set
End Property
Private Property FechaI As String
Get
Return ViewState("FechaI").ToString
@@ -145,71 +126,46 @@ Partial Class Contabilidad_RepEstadoResultados
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
If UsuarioActual.Empresa.TipoContabilidad = 1 Then
Response.Redirect($"/Contabilidad2/RepEstadoActividades.aspx")
End If
If UsuarioActual.Empresa.UsaContabilidad Or UsuarioActual.Empresa.UsaAC Then
If UsuarioActual.Empresa.TipoContabilidad = 2 Then Response.Redirect($"/Contabilidad/RepEstadoResultadosCI.aspx")
BtnConsultar.Enabled = True
TabNormal.Enabled = True
TabMensual.Enabled = True
TabAnual.Enabled = True
CargaSegmentosNegocio()
If UsuarioActual.Empresa.UsaAC Then
TipoReporte = -1
Else
TipoReporte = 1
tdTipoReporte.Visible = True
End If
'tdTipoReporte.Visible = True
TipoReporte = 1
CargaDatosGenerales()
DdlEjercicio.SelectedValue = NowADS().Year.ToString
CargaDatosGenerales()
Anos = 0
DdlEjercicio.SelectedValue = NowADS().Year.ToString
'Normal
TotalActual = 0
TotalAnterior = 0
DdlPeriodo.SelectedValue = NowADS().Month.ToString
Anos = 0
TabContainer_ActiveTabChanged(TabContainer, EventArgs.Empty)
Else
Alert("La empresa no usa Contabilidad ni Armonización Contable", TipoMensaje.MsgError)
End If
'Normal
TotalActual = 0
TotalAnterior = 0
DdlPeriodo.SelectedValue = NowADS().Month.ToString
TabContainer_ActiveTabChanged(TabContainer, EventArgs.Empty)
End If
End Sub
Private Sub CargaDatosGenerales()
Dim ClsConta As New ClsContPAQi(UsuarioActual.Empresa)
'Dim ClsConta As New ClsContPAQi(UsuarioActual.Empresa)
Dim ClsConta As New ClsContabilidad
If ClsConta.GetEjercicios() Then
If ClsConta.GetEjercicios(UsuarioActual.CveEmpresa) Then
DdlEjercicio.DataSource = ClsConta.DtResultados
Else
DdlEjercicio.DataSource = Nothing
End If
ClsConta.Dispose()
DdlSubproyecto.DataSource = GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa, -1)
DdlSubproyecto.DataBind()
DdlEjercicio.DataBind()
End Sub
Private Sub CargaSegmentosNegocio()
Dim ObjContpaq As New ClsContPAQi(UsuarioActual.Empresa)
Dim strGlobal As String = ""
If ObjContpaq.GetSegmentosNegocio(-1, "-1") Then
DdlSegmentoNegocio.DataSource = ObjContpaq.DtResultados
DdlSegmentoNegocio.DataBind()
End If
ObjContpaq.Dispose()
DdlSegmentoNegocio.Items.Insert(0, New ListItem("Todos", "-1"))
DdlSegmentoNegocio.SelectedValue = "-1"
End Sub
#Region " NORMAL "
Private Sub CargaDatos()
@@ -217,8 +173,11 @@ Partial Class Contabilidad_RepEstadoResultados
FechaF = DateAdd(DateInterval.Day, -1, DateAdd(DateInterval.Month, 1, CDate(FechaI))).ToString("dd/MM/yyyy")
TipoReporte = If(TipoReporte = -1, -1, DdlTipoReporte.SelectedValue.ToEntero)
Dim ObjConta As New ClsContPAQi(UsuarioActual.Empresa)
If ObjConta.GetEstadoActividades(FechaI.ToDate, FechaF.ToDate, TipoReporte, UsuarioActual.Empresa.UsaAC, DdlSegmentoNegocio.SelectedValue.ToEntero) Then
'Dim ObjConta As New ClsContPAQi(UsuarioActual.Empresa)
Dim CveSubProyecto As Integer = DdlSubproyecto.SelectedValue.ToEntero
Dim ObjConta As New ClsContabilidad
If ObjConta.GetEstadoActividades(FechaI.ToDate, FechaF.ToDate, TipoReporte, -1, CveSubProyecto, UsuarioActual.CveEmpresa) Then
DtDatos = ObjConta.DtResultados.FiltraParametros("(ImporteActual <> 0 OR ImporteAcumulado <> 0)")
Else
DtDatos = Nothing
@@ -250,9 +209,9 @@ Partial Class Contabilidad_RepEstadoResultados
Row.Item("Nombre") = "TOTAL INGRESOS "
Row.Item("ImporteActual") = TotalActualLocal.ToString
Row.Item("PorcentajeActual") = If(TotalActualLocal > 0, (TotalActualLocal * 100 / TotalActualLocal).ToString, "0").FormatoNumero
Row.Item("PorcentajeActual") = "100"
Row.Item("ImporteAcumulado") = TotalAnteriorLocal.ToString
Row.Item("PorcentajeAcumulado") = If(TotalAnteriorLocal > 0, (TotalAnteriorLocal * 100 / TotalAnteriorLocal).ToString, "0").FormatoNumero
Row.Item("PorcentajeAcumulado") = "100"
Row.Item("CtaMayor") = -1
DtIngresos.Rows.Add(Row)
Else
@@ -317,10 +276,6 @@ Partial Class Contabilidad_RepEstadoResultados
UpDatos.Update()
PorcentajeActual = Row.Item("PorcentajeActual").ToString
PorcentajeAcumulado = Row.Item("PorcentajeAcumulado").ToString
DtGastos.Rows.Remove(Row)
End Sub
Private Sub SumaTotales()
@@ -337,64 +292,38 @@ Partial Class Contabilidad_RepEstadoResultados
#Region "GV´S ROW DATA BOUND"
Protected Sub GvNormal_RowDataBound(sender As Object, e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.Header Then
e.Row.ControlStyle.Font.Bold = True
e.Row.Attributes.Add("style", "border-top:2px solid black;")
End If
Protected Sub GvIngresos_RowDataBound(sender As Object, e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.DBCampo("CtaMayor").ToString.ToEntero < 0 Then
If e.Row.DBCampo("CtaMayor").ToString.ToEntero = 3 Then
'METODO ANTERIOR
'TotalActual += e.Row.DBCampo("ImporteActual").ToString.ToDouble
'TotalAnterior += e.Row.DBCampo("ImporteAcumulado").ToString.ToDouble
'e.Row.ControlStyle.BackColor = Drawing.Color.LightGray
'e.Row.ControlStyle.ForeColor = Drawing.Color.White
e.Row.ControlStyle.Font.Bold = True
ElseIf e.Row.DBCampo("CtaMayor").ToString.ToEntero = 3 Then
'e.Row.CssClass = "SubTotales3"
e.Row.ControlStyle.Font.Bold = True
End If
If e.Row.DBCampo("CtaMayor").ToString.ToEntero > 0 Then
e.Row.FCHyperLink("HLActual").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?ID={0}&FF={1}&CM=1", e.Row.DBCampo("Id"), e.Row.DBCampo("FechaFActual").ToDate.ToShortDateString)
e.Row.FCHyperLink("HLAnterior").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?ID={0}&FF={1}&CM=1&FI=01/01/{2}", e.Row.DBCampo("Id"), e.Row.DBCampo("FechaFActual").ToDate.ToShortDateString, e.Row.DBCampo("FechaFActual").ToDate.Year)
e.Row.FCHyperLink("HLActual").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&CM=1&CveSubProyecto={2}", e.Row.DBCampo("CveCuenta"), e.Row.DBCampo("FechaFActual").ToDate.ToShortDateString, DdlSubproyecto.SelectedValue)
e.Row.FCHyperLink("HLAnterior").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&CM=1&CveSubProyecto={2}", e.Row.DBCampo("CveCuenta"), e.Row.DBCampo("FechaFActual").ToDate.ToShortDateString, DdlSubproyecto.SelectedValue)
End If
If e.Row.DBCampo("ImporteActual").ToString.ToDouble < 0 Then
e.Row.FCHyperLink("HLActual").ForeColor = Drawing.Color.Red
End If
If e.Row.DBCampo("ImporteAcumulado").ToString.ToDouble < 0 Then
e.Row.FCHyperLink("HLAnterior").ForeColor = Drawing.Color.Red
End If
'UTILIDAD
If e.Row.DBCampo("CtaMayor").ToString.ToEntero = -2 Then
e.Row.ControlStyle.Font.Bold = True
e.Row.Cells(0).Attributes.Add("style", "padding-top:50px;")
e.Row.Cells(1).Attributes.Add("style", "padding-top:50px;")
e.Row.Cells(2).Attributes.Add("style", "padding-top:50px;")
e.Row.Cells(3).Attributes.Add("style", "padding-top:50px;")
e.Row.Cells(4).Attributes.Add("style", "padding-top:50px;")
e.Row.Font.Size = 12
End If
'TOTALES
If e.Row.DBCampo("CtaMayor").ToString.ToEntero = -1 Then
e.Row.ControlStyle.Font.Bold = True
e.Row.Attributes.Add("style", "border-top:2px solid black;")
End If
End If
'If e.Row.DBCampo("Nombre").ToString.Contiene("INGRESOS", "EGRESOS") Then
' e.Row.ControlStyle.BackColor = Drawing.Color.LightGray
' e.Row.ControlStyle.Font.Bold = True
' asdasdasdsadasd
'End If
End Sub
Protected Sub GvGastos_RowDataBound(sender As Object, e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.DBCampo("CtaMayor").ToString.ToEntero < 0 Then
@@ -420,8 +349,8 @@ Partial Class Contabilidad_RepEstadoResultados
End If
If e.Row.DBCampo("CtaMayor").ToString.ToEntero > 0 Then
e.Row.FCHyperLink("HLActual").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?ID={0}&FF={1}&CM=1", e.Row.DBCampo("Id"), e.Row.DBCampo("FechaFActual").ToDate.ToShortDateString)
e.Row.FCHyperLink("HLAnterior").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?ID={0}&FF={1}&CM=1", e.Row.DBCampo("Id"), e.Row.DBCampo("FechaFActual").ToDate.ToShortDateString)
e.Row.FCHyperLink("HLActual").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&CM=1&CveSubProyecto={2}", e.Row.DBCampo("CveCuenta"), e.Row.DBCampo("FechaFActual").ToDate.ToShortDateString, DdlSubproyecto.SelectedValue)
e.Row.FCHyperLink("HLAnterior").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&CM=1&CveSubProyecto={2}", e.Row.DBCampo("CveCuenta"), e.Row.DBCampo("FechaFActual").ToDate.ToShortDateString, DdlSubproyecto.SelectedValue)
End If
If e.Row.DBCampo("ImporteActual").ToString.ToDouble < 0 Then
@@ -441,10 +370,11 @@ Partial Class Contabilidad_RepEstadoResultados
#Region " MENSUAL "
Private Sub CargaDatosMensual()
Dim ObjConta As New ClsContPAQi(UsuarioActual.Empresa)
'Dim ObjConta As New ClsContPAQi(UsuarioActual.Empresa)
Dim ObjConta As New ClsContabilidad
TipoReporte = If(TipoReporte = -1, -1, DdlTipoReporte.SelectedValue.ToEntero)
If ObjConta.GetEstadoResultadosMensual(DdlEjercicio.SelectedValue.ToEntero, TipoReporte, DdlSegmentoNegocio.SelectedValue.ToEntero) Then
Dim CveSubProyecto As String = DdlSubproyecto.SelectedValue.ToString
If ObjConta.GetEstadoResultadosMensual(DdlEjercicio.SelectedValue.ToEntero, TipoReporte, CveSubProyecto, UsuarioActual.CveEmpresa) Then
DtDatosMensual = ObjConta.DtResultados
Else
DtDatosMensual = Nothing
@@ -496,89 +426,17 @@ Partial Class Contabilidad_RepEstadoResultados
GvDatosMensual.Columns(38).Visible = True
End If
'Esconde Trimestral
GvDatosMensual2.Columns(7).Visible = False
GvDatosMensual2.Columns(8).Visible = False
GvDatosMensual2.Columns(17).Visible = False
GvDatosMensual2.Columns(18).Visible = False
GvDatosMensual2.Columns(27).Visible = False
GvDatosMensual2.Columns(28).Visible = False
GvDatosMensual2.Columns(35).Visible = False
GvDatosMensual2.Columns(36).Visible = False
'Esconde Cuatrimestral
GvDatosMensual2.Columns(11).Visible = False
GvDatosMensual2.Columns(12).Visible = False
GvDatosMensual2.Columns(23).Visible = False
GvDatosMensual2.Columns(24).Visible = False
GvDatosMensual2.Columns(37).Visible = False
GvDatosMensual2.Columns(38).Visible = False
If DdlSubtotales.SelectedValue = "2" Then
GvDatosMensual2.Columns(7).Visible = True
GvDatosMensual2.Columns(8).Visible = True
GvDatosMensual2.Columns(17).Visible = True
GvDatosMensual2.Columns(18).Visible = True
GvDatosMensual2.Columns(27).Visible = True
GvDatosMensual2.Columns(28).Visible = True
GvDatosMensual2.Columns(35).Visible = True
GvDatosMensual2.Columns(36).Visible = True
ElseIf DdlSubtotales.SelectedValue = "3" Then
GvDatosMensual2.Columns(11).Visible = True
GvDatosMensual2.Columns(12).Visible = True
GvDatosMensual2.Columns(23).Visible = True
GvDatosMensual2.Columns(24).Visible = True
GvDatosMensual2.Columns(37).Visible = True
GvDatosMensual2.Columns(38).Visible = True
End If
End Sub
Private Sub CargaGridMensual()
GvDatosMensual.DataSource = DtDatosMensual
GvDatosMensual2.DataSource = DtDatosMensual
GvDatosMensual.DataBind()
GvDatosMensual2.DataBind()
FechasReporte()
For Each GVRow As GridViewRow In GvDatosMensual.Rows
If GVRow.DataKey("IntSubOrden").ToEntero = 2 Then
GVRow.Attributes.Add("style", "border-top:2px solid black")
End If
Next
UpDatosMensual.Update()
UpDatosExelRederMensualidad.Update()
'Fix visual tabla GvDatosMensual
RegistraScript("setTimeout(function() {
$('.adsCol > div').height(29); $('.ADSRow').height(0);
$('#C_TabContainer_TabMensual_GvDatosMensual > tbody > tr.ADSRow > td.adsCol > div').height(0);
$('#C_TabContainer_TabMensual_GvDatosMensual > tbody > tr:nth-child(2) > td.adsCol > div').height(0);
$('#ADColC_TabContainer_TabMensual_GvDatosMensual > tbody > tr.ADSRow').height(1);
$('#ADColC_TabContainer_TabMensual_GvDatosMensual > tbody > tr.ADSRow > td:nth-child(1) > div').height(0);
$('#ADColC_TabContainer_TabMensual_GvDatosMensual > tbody > tr.ADSRow > td.adsCol > div').height(0);
$('.UtilidadPerdida').parent().attr('align', 'right');
$('#ADColC_TabContainer_TabMensual_GvDatosMensual > tbody > tr:nth-child(35) > td:nth-child(1)').attr('align', 'center');
}, 1000); ", "FixTables")
End Sub
Protected Sub GvDatosMensual_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatosMensual.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.DBCampo("CtaMayor").ToString.ToEntero = 4 Then
e.Row.FCHyperLink("HLEnero").Text = ""
e.Row.FCHyperLink("HLFebrero").Text = ""
e.Row.FCHyperLink("HLMarzo").Text = ""
@@ -603,213 +461,56 @@ Partial Class Contabilidad_RepEstadoResultados
e.Row.Cells(20).Text = ""
e.Row.Cells(22).Text = ""
e.Row.Cells(24).Text = ""
End If
'AGRUPADOR DE CUENTAS
If e.Row.DBCampo("CtaMayor").ToString.ToEntero = 4 Then
e.Row.FCHyperLink("HlNombre").Font.Bold = True
e.Row.FCLabel("LbNombre").Font.Bold = True
End If
'TITULO DE CUENTAS
If e.Row.DBCampo("CtaMayor").ToString.ToEntero = 3 Then
e.Row.FCHyperLink("HlNombre").Attributes.Add("style", "padding-left: 10px;")
e.Row.FCLabel("LbNombre").Attributes.Add("style", "padding-left: 10px;")
End If
'CUENTAS
If e.Row.DBCampo("CtaMayor").ToString.ToEntero = 1 Then
e.Row.FCHyperLink("HlNombre").Attributes.Add("style", "padding-left: 20px;")
e.Row.FCHyperLink("HlNombre").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogoMes.aspx?ID={0}&Ejercicio={1}", e.Row.DBCampo("Id"), DdlEjercicio.SelectedValue)
e.Row.FCLabel("LbNombre").Attributes.Add("style", "padding-left: 20px;")
End If
If e.Row.DBCampo("CtaMayor").ToString.ToEntero = 1 Or e.Row.DBCampo("CtaMayor").ToString.ToEntero = 3 Then
e.Row.FCHyperLink("HLEnero").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?ID={0}&FF={1}&TP={2}&CM=1", e.Row.DBCampo("Id"), String.Format("01/01/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte)
e.Row.FCHyperLink("HLFebrero").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?ID={0}&FF={1}&TP={2}&CM=1", e.Row.DBCampo("Id"), String.Format("01/02/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte)
e.Row.FCHyperLink("HLMarzo").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?ID={0}&FF={1}&TP={2}&CM=1", e.Row.DBCampo("Id"), String.Format("01/03/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte)
e.Row.FCHyperLink("HLAbril").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?ID={0}&FF={1}&TP={2}&CM=1", e.Row.DBCampo("Id"), String.Format("01/04/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte)
e.Row.FCHyperLink("HLMayo").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?ID={0}&FF={1}&TP={2}&CM=1", e.Row.DBCampo("Id"), String.Format("01/05/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte)
e.Row.FCHyperLink("HLJunio").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?ID={0}&FF={1}&TP={2}&CM=1", e.Row.DBCampo("Id"), String.Format("01/06/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte)
e.Row.FCHyperLink("HLJulio").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?ID={0}&FF={1}&TP={2}&CM=1", e.Row.DBCampo("Id"), String.Format("01/07/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte)
e.Row.FCHyperLink("HLAgosto").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?ID={0}&FF={1}&TP={2}&CM=1", e.Row.DBCampo("Id"), String.Format("01/08/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte)
e.Row.FCHyperLink("HLSeptiembre").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?ID={0}&FF={1}&TP={2}&CM=1", e.Row.DBCampo("Id"), String.Format("09/01/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte)
e.Row.FCHyperLink("HLOctubre").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?ID={0}&FF={1}&TP={2}&CM=1", e.Row.DBCampo("Id"), String.Format("01/10/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte)
e.Row.FCHyperLink("HLNoviembre").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?ID={0}&FF={1}&TP={2}&CM=1", e.Row.DBCampo("Id"), String.Format("01/11/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte)
e.Row.FCHyperLink("HLDiciembre").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?ID={0}&FF={1}&TP={2}&CM=1", e.Row.DBCampo("Id"), String.Format("01/12/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte)
e.Row.FCHyperLink("HLEnero").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&TP={2}&CM=1&CveSubProyecto={3}", e.Row.DBCampo("CveCuenta"), String.Format("01/01/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte, DdlSubproyecto.SelectedValue)
e.Row.FCHyperLink("HLFebrero").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&TP={2}&CM=1&CveSubProyecto={3}", e.Row.DBCampo("CveCuenta"), String.Format("01/02/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte, DdlSubproyecto.SelectedValue)
e.Row.FCHyperLink("HLMarzo").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&TP={2}&CM=1&CveSubProyecto={3}", e.Row.DBCampo("CveCuenta"), String.Format("01/03/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte, DdlSubproyecto.SelectedValue)
e.Row.FCHyperLink("HLAbril").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&TP={2}&CM=1&CveSubProyecto={3}", e.Row.DBCampo("CveCuenta"), String.Format("01/04/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte, DdlSubproyecto.SelectedValue)
e.Row.FCHyperLink("HLMayo").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&TP={2}&CM=1&CveSubProyecto={3}", e.Row.DBCampo("CveCuenta"), String.Format("01/05/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte, DdlSubproyecto.SelectedValue)
e.Row.FCHyperLink("HLJunio").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&TP={2}&CM=1&CveSubProyecto={3}", e.Row.DBCampo("CveCuenta"), String.Format("01/06/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte, DdlSubproyecto.SelectedValue)
e.Row.FCHyperLink("HLJulio").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&TP={2}&CM=1&CveSubProyecto={3}", e.Row.DBCampo("CveCuenta"), String.Format("01/07/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte, DdlSubproyecto.SelectedValue)
e.Row.FCHyperLink("HLAgosto").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&TP={2}&CM=1&CveSubProyecto={3}", e.Row.DBCampo("CveCuenta"), String.Format("01/08/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte, DdlSubproyecto.SelectedValue)
e.Row.FCHyperLink("HLSeptiembre").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&TP={2}&CM=1&CveSubProyecto={3}", e.Row.DBCampo("CveCuenta"), String.Format("09/01/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte, DdlSubproyecto.SelectedValue)
e.Row.FCHyperLink("HLOctubre").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&TP={2}&CM=1&CveSubProyecto={3}", e.Row.DBCampo("CveCuenta"), String.Format("01/10/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte, DdlSubproyecto.SelectedValue)
e.Row.FCHyperLink("HLNoviembre").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&TP={2}&CM=1&CveSubProyecto={3}", e.Row.DBCampo("CveCuenta"), String.Format("01/11/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte, DdlSubproyecto.SelectedValue)
e.Row.FCHyperLink("HLDiciembre").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&TP={2}&CM=1&CveSubProyecto={3}", e.Row.DBCampo("CveCuenta"), String.Format("01/12/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte, DdlSubproyecto.SelectedValue)
e.Row.FCHyperLink("HLTrimestral1").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?ID={0}&FI={1}&FF={2}&TP={3}&CM=1", e.Row.DBCampo("Id"), String.Format("01/01/{0}", DdlEjercicio.SelectedValue.ToString), String.Format("01/03/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte)
e.Row.FCHyperLink("HLTrimestral2").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?ID={0}&FI={1}&FF={2}&TP={3}&CM=1", e.Row.DBCampo("Id"), String.Format("01/04/{0}", DdlEjercicio.SelectedValue.ToString), String.Format("01/06/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte)
e.Row.FCHyperLink("HLTrimestral3").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?ID={0}&FI={1}&FF={2}&TP={3}&CM=1", e.Row.DBCampo("Id"), String.Format("01/07/{0}", DdlEjercicio.SelectedValue.ToString), String.Format("01/09/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte)
e.Row.FCHyperLink("HLTrimestral4").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?ID={0}&FI={1}&FF={2}&TP={3}&CM=1", e.Row.DBCampo("Id"), String.Format("01/10/{0}", DdlEjercicio.SelectedValue.ToString), String.Format("01/12/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte)
e.Row.FCHyperLink("HLTrimestral1").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FI={1}&FF={2}&TP={3}&CM=1&CveSubProyecto={3}", e.Row.DBCampo("CveCuenta"), String.Format("01/01/{0}", DdlEjercicio.SelectedValue.ToString), String.Format("01/03/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte, DdlSubproyecto.SelectedValue)
e.Row.FCHyperLink("HLTrimestral2").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FI={1}&FF={2}&TP={3}&CM=1&CveSubProyecto={3}", e.Row.DBCampo("CveCuenta"), String.Format("01/04/{0}", DdlEjercicio.SelectedValue.ToString), String.Format("01/06/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte, DdlSubproyecto.SelectedValue)
e.Row.FCHyperLink("HLTrimestral3").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FI={1}&FF={2}&TP={3}&CM=1&CveSubProyecto={3}", e.Row.DBCampo("CveCuenta"), String.Format("01/07/{0}", DdlEjercicio.SelectedValue.ToString), String.Format("01/09/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte, DdlSubproyecto.SelectedValue)
e.Row.FCHyperLink("HLTrimestral4").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FI={1}&FF={2}&TP={3}&CM=1&CveSubProyecto={3}", e.Row.DBCampo("CveCuenta"), String.Format("01/10/{0}", DdlEjercicio.SelectedValue.ToString), String.Format("01/12/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte, DdlSubproyecto.SelectedValue)
e.Row.FCHyperLink("HLCuatrimestral1").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?ID={0}&FI={1}&FF={2}&TP={3}&CM=1", e.Row.DBCampo("Id"), String.Format("01/01/{0}", DdlEjercicio.SelectedValue.ToString), String.Format("01/04/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte)
e.Row.FCHyperLink("HLCuatrimestral2").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?ID={0}&FI={1}&FF={2}&TP={3}&CM=1", e.Row.DBCampo("Id"), String.Format("01/05/{0}", DdlEjercicio.SelectedValue.ToString), String.Format("01/08/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte)
e.Row.FCHyperLink("HLCuatrimestral3").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?ID={0}&FI={1}&FF={2}&TP={3}&CM=1", e.Row.DBCampo("Id"), String.Format("01/09/{0}", DdlEjercicio.SelectedValue.ToString), String.Format("01/12/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte)
e.Row.FCHyperLink("HLCuatrimestral1").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FI={1}&FF={2}&TP={3}&CM=1&CveSubProyecto={3}", e.Row.DBCampo("CveCuenta"), String.Format("01/01/{0}", DdlEjercicio.SelectedValue.ToString), String.Format("01/04/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte, DdlSubproyecto.SelectedValue)
e.Row.FCHyperLink("HLCuatrimestral2").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FI={1}&FF={2}&TP={3}&CM=1&CveSubProyecto={3}", e.Row.DBCampo("CveCuenta"), String.Format("01/05/{0}", DdlEjercicio.SelectedValue.ToString), String.Format("01/08/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte, DdlSubproyecto.SelectedValue)
e.Row.FCHyperLink("HLCuatrimestral3").NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FI={1}&FF={2}&TP={3}&CM=1&CveSubProyecto={3}", e.Row.DBCampo("CveCuenta"), String.Format("01/09/{0}", DdlEjercicio.SelectedValue.ToString), String.Format("01/12/{0}", DdlEjercicio.SelectedValue.ToString).ToDate.LastDayOfMonth.ToShortDateString, TipoReporte, DdlSubproyecto.SelectedValue)
End If
''TOTALES
If e.Row.DBCampo("IntSubOrden").ToString.ToEntero.Contiene(0, 3) And e.Row.DBCampo("CtaMayor").ToString.ToEntero = -1 Then
e.Row.Attributes.Add("style", "Height:29px")
e.Row.Cells(1).Text = ""
e.Row.Cells(2).Text = ""
e.Row.Cells(3).Text = ""
e.Row.Cells(4).Text = ""
e.Row.Cells(5).Text = ""
e.Row.Cells(6).Text = ""
e.Row.Cells(7).Text = ""
e.Row.Cells(8).Text = ""
e.Row.Cells(9).Text = ""
e.Row.Cells(10).Text = ""
e.Row.Cells(11).Text = ""
e.Row.Cells(12).Text = ""
e.Row.Cells(13).Text = ""
e.Row.Cells(14).Text = ""
e.Row.Cells(15).Text = ""
e.Row.Cells(16).Text = ""
e.Row.Cells(17).Text = ""
e.Row.Cells(18).Text = ""
e.Row.Cells(19).Text = ""
e.Row.Cells(20).Text = ""
e.Row.Cells(21).Text = ""
e.Row.Cells(22).Text = ""
e.Row.Cells(23).Text = ""
e.Row.Cells(24).Text = ""
e.Row.Cells(25).Text = ""
e.Row.Cells(26).Text = ""
e.Row.Cells(27).Text = ""
e.Row.Cells(28).Text = ""
e.Row.Cells(29).Text = ""
e.Row.Cells(30).Text = ""
e.Row.Cells(31).Text = ""
e.Row.Cells(32).Text = ""
e.Row.Cells(33).Text = ""
e.Row.Cells(34).Text = ""
'TOTALES
If e.Row.DBCampo("CtaMayor").ToString.ToEntero = 5 Then
e.Row.Attributes.Add("style", "border-top: 1px solid;")
e.Row.FCLabel("LbNombre").Font.Italic = True
End If
If e.Row.DBCampo("IntSubOrden").ToString.ToEntero.Contiene(2, 0) Then
e.Row.Font.Bold = True
End If
If e.Row.DBCampo("CtaMayor").ToString.ToEntero = -1 And e.Row.DBCampo("Nombre").ToString.Length > 0 Then
e.Row.ControlStyle.BackColor = Drawing.Color.LightGray
End If
End If
If e.Row.RowType = DataControlRowType.Footer Then
e.Row.Font.Bold = True
e.Row.Font.Size = 12
e.Row.FCLabel("LblUtiEnero").Text = (DtDatosMensual.SUM("Enero", "CtaMayor = 1 AND Tipo = 'H' ") - DtDatosMensual.SUM("Enero", "CtaMayor = 1 AND Tipo = 'G' ")).ToString("###,###,###.00")
e.Row.FCLabel("LblUtiFebrero").Text = (DtDatosMensual.SUM("Febrero", "CtaMayor = 1 AND Tipo = 'H' ") - DtDatosMensual.SUM("Febrero", "CtaMayor = 1 AND Tipo = 'G' ")).ToString("###,###,###.00")
e.Row.FCLabel("LblUtiMarzo").Text = (DtDatosMensual.SUM("Marzo", "CtaMayor = 1 AND Tipo = 'H' ") - DtDatosMensual.SUM("Marzo", "CtaMayor = 1 AND Tipo = 'G' ")).ToString("###,###,###.00")
e.Row.FCLabel("LblUtiAbril").Text = (DtDatosMensual.SUM("Abril", "CtaMayor = 1 AND Tipo = 'H' ") - DtDatosMensual.SUM("Abril", "CtaMayor = 1 AND Tipo = 'G' ")).ToString("###,###,###.00")
e.Row.FCLabel("LblUtiMayo").Text = (DtDatosMensual.SUM("Mayo", "CtaMayor = 1 AND Tipo = 'H' ") - DtDatosMensual.SUM("Mayo", "CtaMayor = 1 AND Tipo = 'G' ")).ToString("###,###,###.00")
e.Row.FCLabel("LblUtiJunio").Text = (DtDatosMensual.SUM("Junio", "CtaMayor = 1 AND Tipo = 'H' ") - DtDatosMensual.SUM("Junio", "CtaMayor = 1 AND Tipo = 'G' ")).ToString("###,###,###.00")
e.Row.FCLabel("LblUtiJulio").Text = (DtDatosMensual.SUM("Julio", "CtaMayor = 1 AND Tipo = 'H' ") - DtDatosMensual.SUM("Julio", "CtaMayor = 1 AND Tipo = 'G' ")).ToString("###,###,###.00")
e.Row.FCLabel("LblUtiAgosto").Text = (DtDatosMensual.SUM("Agosto", "CtaMayor = 1 AND Tipo = 'H' ") - DtDatosMensual.SUM("Agosto", "CtaMayor = 1 AND Tipo = 'G' ")).ToString("###,###,###.00")
e.Row.FCLabel("LblUtiSeptiembre").Text = (DtDatosMensual.SUM("Septiembre", "CtaMayor = 1 AND Tipo = 'H' ") - DtDatosMensual.SUM("Septiembre", "CtaMayor = 1 AND Tipo = 'G' ")).ToString("###,###,###.00")
e.Row.FCLabel("LblUtiOctubre").Text = (DtDatosMensual.SUM("Octubre", "CtaMayor = 1 AND Tipo = 'H' ") - DtDatosMensual.SUM("Octubre", "CtaMayor = 1 AND Tipo = 'G' ")).ToString("###,###,###.00")
e.Row.FCLabel("LblUtiNoviembre").Text = (DtDatosMensual.SUM("Noviembre", "CtaMayor = 1 AND Tipo = 'H' ") - DtDatosMensual.SUM("Noviembre", "CtaMayor = 1 AND Tipo = 'G' ")).ToString("###,###,###.00")
e.Row.FCLabel("LblUtiDiciembre").Text = (DtDatosMensual.SUM("Diciembre", "CtaMayor = 1 AND Tipo = 'H' ") - DtDatosMensual.SUM("Diciembre", "CtaMayor = 1 AND Tipo = 'G' ")).ToString("###,###,###.00")
End If
End Sub
Private Sub FechasReporte()
Dim FechaInicio As Date
Dim FechaFin As Date
'' If DdlTipoConsulta.SelectedValue.ToEntero = 1 Then
'FechaInicio = New Date(DdlEjercicio.SelectedValue.ToEntero, DdlPeriodo.SelectedValue.ToEntero, 1)
' FechaFin = FechaInicio.LastDayOfMonth()
''Else
'FechaInicio = New Date(DdlEjercicio.SelectedValue.ToEntero, 1, 1)
' FechaFin = New Date(DdlEjercicio.SelectedValue.ToEntero, DdlPeriodo.SelectedValue.ToEntero, 1).LastDayOfMonth
'End If
Dim UrlImagen = $"http://{ HttpContext.Current.Request.Url.Host}:{HttpContext.Current.Request.Url.Port}/Empresas/{UsuarioActual.CveEmpresa}/Logo.png"
If File.Exists($"{UsuarioActual.Empresa.Ruta}Logo.png") Then
ImgLogoReporte.Attributes.Add("src", UrlImagen)
Else
ImgLogoReporte.Attributes.Add("src", "")
End If
LblTituloAniosRango.Text = $"{ UsuarioActual.Empresa.Empresa }"
LblFechas.Text = $"{FechaInicio.ToString("dd/MMMM/yyyy")} al {FechaFin.ToString("dd/MMMM/yyyy")}"
LblFechaReporte.Text = NowADS().ToString("dd/MMMM/yyyy")
End Sub
Protected Sub LnkDescarPersonalizados_Click(sender As Object, e As EventArgs)
DescargaReporte()
End Sub
Private Sub DescargaReporte()
Dim htmlFuente As String = txtDatos.Text
Dim RutaLogo As String = $"{Server.MapPath("~")}\Empresas\{UsuarioActual.CveEmpresa}\logo.png"
htmlFuente = htmlFuente.Replace("<table ", "<table border='1' ")
htmlFuente = htmlFuente.Replace("<a ", "<label ")
htmlFuente = htmlFuente.Replace("</a ", "</label ")
htmlFuente = htmlFuente.Replace("<th ", "<th style='background-color:#ddd!important'; ")
' htmlFuente = Cabera + htmlFuente
'Dim buffer As Byte()
'Dim memoryStream = New System.IO.MemoryStream()
SpreadsheetInfo.SetLicense(SerialGemBoxSpreadsheet)
Dim excel As ExcelFile
Dim options = LoadOptions.HtmlDefault
Using htmlStream = New MemoryStream(options.Encoding.GetBytes(htmlFuente))
excel = ExcelFile.Load(htmlStream, options)
End Using
Dim ws = excel.Worksheets(0)
ws.Name = "Estado Resultado por Segmento"
Dim columnCount = ws.CalculateMaxUsedColumns()
For i As Integer = 0 To columnCount - 1
If i = 0 Then
ws.Columns(i).Width = 10000
Else
ws.Columns(i).Width = 6000
End If
Next
excel.Save(Me.Response, $"RepEstadoResultadosMensual_{NowADS().ToString("yyyyMMddhhmmss")}.xlsx")
End Sub
#End Region
@@ -818,10 +519,12 @@ Partial Class Contabilidad_RepEstadoResultados
#Region " ANUAL "
Private Sub CargaDatosAnual()
Dim ObjConta As New ClsContPAQi(UsuarioActual.Empresa)
'Dim ObjConta As New ClsContPAQi(UsuarioActual.Empresa)
Dim ObjConta As New ClsContabilidad
TipoReporte = If(TipoReporte = -1, -1, DdlTipoReporte.SelectedValue.ToEntero)
If ObjConta.GetEstadoResultadosAnual(DdlEjercicio.SelectedValue.ToEntero, TipoReporte, DdlSegmentoNegocio.SelectedValue.ToEntero) Then
Dim CveSubProyecto As String = DdlSubproyecto.SelectedValue.ToString
If ObjConta.GetEstadoResultadosAnual(DdlEjercicio.SelectedValue.ToEntero, TipoReporte, CveSubProyecto, UsuarioActual.CveEmpresa) Then
DtDatosAnual = ObjConta.DtResultados
Else
DtDatosAnual = Nothing
@@ -885,7 +588,7 @@ Partial Class Contabilidad_RepEstadoResultados
If e.Row.DBCampo("CtaMayor").ToString.ToEntero = 1 Or e.Row.DBCampo("CtaMayor").ToString.ToEntero = 3 Then
For index = 1 To Anos
e.Row.FCHyperLink("HLAno" + index.ToString).NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?ID={0}&FI={1}&FF={2}&TP={3}&CM=1", e.Row.DBCampo("Id"), String.Format("01/01/{0}", (DdlEjercicio.SelectedValue.ToEntero + index - 1).ToString), String.Format("31/12/{0}", (DdlEjercicio.SelectedValue.ToEntero + index - 1).ToString), TipoReporte)
e.Row.FCHyperLink("HLAno" + index.ToString).NavigateUrl = String.Format("/Contabilidad/RepAnexoCatalogo.aspx?CveCuenta={0}&FI={1}&FF={2}&TP={3}&CM=1&CveSubProyecto={4}", e.Row.DBCampo("CveCuenta"), String.Format("01/01/{0}", (DdlEjercicio.SelectedValue.ToEntero + index - 1).ToString), String.Format("31/12/{0}", (DdlEjercicio.SelectedValue.ToEntero + index - 1).ToString), TipoReporte, DdlSubproyecto.SelectedValue)
Next
End If
@@ -917,217 +620,19 @@ Partial Class Contabilidad_RepEstadoResultados
If TabContainer.ActiveTabIndex = 0 Then
CargaDatos()
ImgExcel.Visible = True
Imprimir.Visible = True
liLnkDescarPersonalizado.Visible = False
ElseIf TabContainer.ActiveTabIndex = 1 Then
CargaDatosMensual()
ImgExcel.Visible = False
Imprimir.Visible = False
liLnkDescarPersonalizado.Visible = True
ElseIf TabContainer.ActiveTabIndex = 2 Then
CargaDatosAnual()
ImgExcel.Visible = True
Imprimir.Visible = True
liLnkDescarPersonalizado.Visible = False
End If
UpAcciones.Update()
End Sub
#Region " IMPRESION "
Protected Sub ImgExcel_Click(sender As Object, e As EventArgs) Handles ImgExcel.Click
If TabContainer.ActiveTabIndex = 0 Then
If Not IsNothing(DtDatos) Then
CargaDatos()
ImprimirReporte("Excel")
Else
Alert("No se encontró información para el reporte.", TipoMensaje.MsgAdvertencia)
End If
ElseIf TabContainer.ActiveTabIndex = 1 Then
If Not IsNothing(DtDatosMensual) Then
CargaDatosMensual()
ImprimirReporteMensual("Excel")
Else
Alert("No se encontró información para el reporte.", TipoMensaje.MsgAdvertencia)
End If
ElseIf TabContainer.ActiveTabIndex = 2 Then
If Not IsNothing(DtDatosAnual) Then
CargaDatosAnual()
ImprimirReporteAnual("Excel")
Else
Alert("No se encontró información para el reporte.", TipoMensaje.MsgAdvertencia)
End If
End If
End Sub
Protected Sub Imprimir_click(sender As Object, e As EventArgs) Handles Imprimir.Click
If TabContainer.ActiveTabIndex = 0 Then
If Not IsNothing(DtDatos) Then
CargaDatos()
ImprimirReporte()
Else
Alert("No se encontró información para el reporte.", TipoMensaje.MsgAdvertencia)
End If
ElseIf TabContainer.ActiveTabIndex = 1 Then
If Not IsNothing(DtDatosMensual) Then
CargaDatosMensual()
ImprimirReporteMensual()
Else
Alert("No se encontró información para el reporte.", TipoMensaje.MsgAdvertencia)
End If
ElseIf TabContainer.ActiveTabIndex = 2 Then
If Not IsNothing(DtDatosAnual) Then
CargaDatosAnual()
ImprimirReporteAnual()
Else
Alert("No se encontró información para el reporte.", TipoMensaje.MsgAdvertencia)
End If
End If
End Sub
Private Sub ProcesaImpresion()
Dim FechaI = String.Format("01/{0}/{1}", DdlPeriodo.SelectedValue.PadLeft(2, CChar("0")), If(DdlEjercicio.SelectedValue.Length = 0, NowADS().Year.ToString, DdlEjercicio.SelectedValue)).ToDate
Dim FechaF = FechaI.ToDate.LastDayOfMonth
TipoReporte = If(TipoReporte = -1, -1, DdlTipoReporte.SelectedValue.ToEntero)
Dim IdCuentaAhorroDesahorro = If(UsuarioActual.CveEmpresa = 48, 87, 9999)
Dim ObjConta As New ClsContPAQi(UsuarioActual.Empresa)
If ObjConta.GetEstadoActividades(FechaI.ToDate, FechaF.ToDate, TipoReporte, UsuarioActual.Empresa.UsaAC) Then
DtDatos = ObjConta.DtResultados
Else
DtDatos = Nothing
Alert("Ocurrio un error al cargar los datos del estado de resultados", TipoMensaje.MsgError)
End If
ObjConta.Dispose()
If DtDatos Is Nothing Then
Exit Sub
End If
'ProcesaDTImprimir(FiltroActivoCirculante, "AC", DtDatos)
'ProcesaDTImprimir(FiltroActivoNoCirculante, "ANC", DtDatos)
'ProcesaDTImprimir(FiltroActivoDiferido, "AD", DtDatos)
'ProcesaDTImprimir(FiltroPasivoCirculante, "PC", DtDatos)
'ProcesaDTImprimir(FiltroPasivoNoCirculante, "PNC", DtDatos)
'ProcesaDTImprimir(FiltroPasivoDiferido, "PD", DtDatos)
'ProcesaDTImprimir(FiltroCapital, "C", DtDatos)
'ProcesaDTImprimir(FiltroUtilidad, "C", DtDatos)
For Each Row As DataRow In DtDatos.Select("CtaMayor=3")
DtDatos.Rows.Remove(Row)
Next
End Sub
Private Sub ProcesaDTImprimir(Filtro As String, Sup As String, ByRef Dt As DataTable)
For Each Row As DataRow In Dt.Select(Filtro)
Row("Sup") = Sup
Next
Dt.AcceptChanges()
End Sub
Private Sub ImprimirReporte(Optional Formato As String = "PDF")
ProcesaImpresion()
'nombre del archivo a generar
Dim fileName As String = "EstadoResultados"
'ubicacion del rdlc
Dim reportpath As String = "Contabilidad/Reportes/RepEstadoResultados.rdlc"
Dim FechaI = String.Format("01/{0}/{1}", DdlPeriodo.SelectedValue.PadLeft(2, CChar("0")), DdlEjercicio.SelectedValue)
Dim FechaF = DateAdd(DateInterval.Day, -1, DateAdd(DateInterval.Month, 1, CDate(FechaI))).ToString("dd/MM/yyyy")
'parametros a enviar al reporte
Dim params As New List(Of ReportParameter)
params.Add(New ReportParameter("pEmp", UsuarioActual.Empresa.Empresa))
Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png")
params.Add(New ReportParameter("pImg", If(Imagen.Exists, $"file://{Imagen.FullName}", "")))
params.Add(New ReportParameter("pFirma1", ""))
params.Add(New ReportParameter("pFirma2", ""))
params.Add(New ReportParameter("pFechaFin", FechaF))
params.Add(New ReportParameter("lbTotalActual", TotalActual.ToString))
params.Add(New ReportParameter("lbTotalAcumulado", TotalAnterior.ToString))
params.Add(New ReportParameter("TPorcentajeActual", PorcentajeActual))
params.Add(New ReportParameter("TPorcentajeAcumulado", PorcentajeAcumulado))
Dim lrds As New List(Of ReportDataSource)
Dim rds1 As New ReportDataSource With {.Name = "DataSet1", .Value = If(DtIngresos IsNot Nothing, DtIngresos, New DataTable)} ' sino esta creado el objeto, lo creamos, para que no truene el reporte
Dim rds2 As New ReportDataSource With {.Name = "DataSet2", .Value = If(DtGastos IsNot Nothing, DtGastos, New DataTable)}
lrds.Add(rds1)
lrds.Add(rds2)
ImprimirPDF(reportpath, lrds, params, fileName, Formato)
End Sub
Private Sub ImprimirReporteMensual(Optional Formato As String = "PDF")
ProcesaImpresion()
'nombre del archivo a generar
Dim fileName As String = "EstadoResultadosMensual"
'ubicacion del rdlc
Dim reportpath As String = Server.MapPath("~/Empresas/Grales/Formatos/RepEstadoResultadosMensual.rdlc")
'Dim FechaI = String.Format("01/{0}/{1}", 12, DdlEjercicio.SelectedValue)
Dim FechaF = DateAdd(DateInterval.Day, -1, DateAdd(DateInterval.Month, 1, CDate(String.Format("01/{0}/{1}", 12, DdlEjercicio.SelectedValue)))).ToString("dd/MM/yyyy")
'parametros a enviar al reporte
Dim params As New List(Of ReportParameter)
params.Add(New ReportParameter("pEmp", UsuarioActual.Empresa.Empresa))
Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png")
params.Add(New ReportParameter("pImg", If(Imagen.Exists, $"file://{Imagen.FullName}", "")))
params.Add(New ReportParameter("pFechaFin", FechaF))
params.Add(New ReportParameter("pSubtotal", DdlSubtotales.SelectedValue.ToString))
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Usuario))
params.Add(New ReportParameter("FechaImpresion", NowADS().ToShortDateString))
ImprimirPDF(reportpath, DtDatosMensual, params, fileName, Formato)
End Sub
Private Sub ImprimirReporteAnual(Optional Formato As String = "PDF")
ProcesaImpresion()
'nombre del archivo a generar
Dim fileName As String = "EstadoResultadosAnual"
'ubicacion del rdlc
Dim reportpath As String = Server.MapPath("~/Empresas/Grales/Formatos/RepEstadoResultadosAnual.rdlc")
'Dim FechaI = String.Format("01/{0}/{1}", DdlPeriodo.SelectedValue.PadLeft(2, CChar("0")), DdlEjercicio.SelectedValue)
'Dim FechaF = DateAdd(DateInterval.Day, -1, DateAdd(DateInterval.Month, 1, CDate(FechaI))).ToString("dd/MM/yyyy")
'parametros a enviar al reporte
Dim params As New List(Of ReportParameter)
params.Add(New ReportParameter("pEmp", UsuarioActual.Empresa.Empresa))
Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png")
params.Add(New ReportParameter("pImg", If(Imagen.Exists, $"file://{Imagen.FullName}", "")))
params.Add(New ReportParameter("pFechaI", DdlEjercicio.SelectedValue))
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Usuario))
params.Add(New ReportParameter("FechaImpresion", NowADS().ToShortDateString))
ImprimirPDF(reportpath, DtDatosAnual, params, fileName, Formato)
End Sub
#End Region
Protected Sub TabContainer_ActiveTabChanged(sender As Object, e As EventArgs)
'Nota: