From ecae4cf4bd39d79b30f4004c09a2bac494d9456f Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Mon, 20 Jul 2020 20:57:18 -0700 Subject: [PATCH 01/58] Correciones de impresion de PDF en API SALI --- Ashx/GenerarPDFFactura.ashx | 162 +- Empresas/Grales/ReporteAPI.rdlc | 3710 +++++++++++++++++++++++++++++++ 2 files changed, 3822 insertions(+), 50 deletions(-) create mode 100644 Empresas/Grales/ReporteAPI.rdlc diff --git a/Ashx/GenerarPDFFactura.ashx b/Ashx/GenerarPDFFactura.ashx index e4e126787..b6a4e841c 100644 --- a/Ashx/GenerarPDFFactura.ashx +++ b/Ashx/GenerarPDFFactura.ashx @@ -17,6 +17,16 @@ Public Class GenerarPDFFactura : Implements IHttpHandler End Get End Property + Public ReadOnly Property EsProduccion As Boolean + Get + If IsNothing(System.Configuration.ConfigurationManager.AppSettings("EsProduccion")) Then + Return False + Else + Return (System.Configuration.ConfigurationManager.AppSettings("EsProduccion").ToString() = "1") + End If + End Get + End Property + Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest Dim retorno As String = "no se encontro la variable" @@ -34,7 +44,7 @@ Public Class GenerarPDFFactura : Implements IHttpHandler Dim ListaDS = New List(Of ReportDataSource) Dim Parametros As New List(Of ReportParameter) - Dim Formato = context.ModExtensiones.DirectorioBaseEmpresas + "Empresas/1/Report.rdlc" + Dim Formato = ModExtensiones.DirectorioBaseEmpresas + "Empresas/Grales/ReporteAPI.rdlc" Parametros.Add(New ReportParameter("Empresa", datos.Empresa.Empresa)) Parametros.Add(New ReportParameter("RFC", datos.Empresa.RFC)) @@ -49,20 +59,20 @@ Public Class GenerarPDFFactura : Implements IHttpHandler Parametros.Add(New ReportParameter("ImporteLetra", datos.Factura.Total.Texto2Letras())) Parametros.Add(New ReportParameter("FormaPago", datos.Factura.FormaPago)) Parametros.Add(New ReportParameter("MetodoPago", datos.Factura.MetodoPago)) - Parametros.Add(New ReportParameter("SelloCFDI", "")) - Parametros.Add(New ReportParameter("SelloSAT", "")) - Parametros.Add(New ReportParameter("CadenaOriginal", "")) + Parametros.Add(New ReportParameter("SelloCFDI", datos.Timbrado.SelloCFDI)) + Parametros.Add(New ReportParameter("SelloSAT", datos.Timbrado.SelloSAT)) + Parametros.Add(New ReportParameter("CadenaOriginal", datos.Timbrado.CadenaOriginal)) Parametros.Add(New ReportParameter("FolioFiscal", datos.Factura.UUID)) - Parametros.Add(New ReportParameter("SerieCertificadoSAT", "")) - Parametros.Add(New ReportParameter("FechaCertificado", "")) - Parametros.Add(New ReportParameter("CertificadoContribuyente", "")) + Parametros.Add(New ReportParameter("SerieCertificadoSAT", datos.Timbrado.SerieCertificadoSAT)) + Parametros.Add(New ReportParameter("FechaCertificado", datos.Timbrado.FechaCertificado)) + Parametros.Add(New ReportParameter("CertificadoContribuyente", datos.Timbrado.CertificadoContribuyente)) Parametros.Add(New ReportParameter("UsoCFDI", datos.Factura.UsoCFDI)) - Parametros.Add(New ReportParameter("Vencimiento", Now.AddDays(30))) + Parametros.Add(New ReportParameter("Vencimiento", datos.Factura.FechaVencimiento)) Parametros.Add(New ReportParameter("SubTotal", datos.Factura.SubTotal)) Parametros.Add(New ReportParameter("IVA", datos.Factura.IVA)) Parametros.Add(New ReportParameter("IEPS", datos.Factura.IEPS)) Parametros.Add(New ReportParameter("Total", datos.Factura.Total)) - Parametros.Add(New ReportParameter("QR", "")) + Parametros.Add(New ReportParameter("QR", datos.Timbrado.QR)) Dim DtDatos As New DataTable DtDatos.Columns.Add(New DataColumn("Cantidad", GetType(Decimal))) @@ -85,9 +95,10 @@ Public Class GenerarPDFFactura : Implements IHttpHandler DtDatos.Rows.Add(Row) Next + ListaDS.Add(New ReportDataSource("DsProductos", DtDatos)) - ImprimirbytesPDF(context, StreamPDF(context, Formato, ListaDS, Parametros), "test") + ImprimirbytesPDF(context, StreamPDF(context, Formato, ListaDS, Parametros), "Factura") End If Catch ex As Exception @@ -97,48 +108,87 @@ Public Class GenerarPDFFactura : Implements IHttpHandler End Sub - Public Function StreamPDF(ByVal context As HttpContext, RutaReporte As String, DataSource As List(Of ReportDataSource), Parametros As List(Of ReportParameter), Optional NombreArchivo As String = "Reporte", Optional Formato As String = "PDF", Optional MR As ReportViewer = Nothing) As Byte() - 'limpio ReportViwer - Dim sw As New System.Diagnostics.Stopwatch() - sw.Start() - - If IsNothing(MR) Then MR = New ReportViewer - Dim Bytes As Byte() = Nothing - Try - ' MasterReporteador.LocalReport.DataSources.Clear() - For Each RDS As ReportDataSource In DataSource - MR.LocalReport.DataSources.Add(RDS) - Next - - MR.LocalReport.ReportPath = RutaReporte - MR.ProcessingMode = ProcessingMode.Local - MR.LocalReport.EnableExternalImages = True - MR.LocalReport.SetParameters(Parametros) - MR.LocalReport.Refresh() - Dim Warnings As Warning() = Nothing - Dim StreamIds As String() = Nothing - Dim MimeType As String = Nothing - Dim Encoding As String = Nothing - Dim Extension As String = Nothing - Bytes = MR.LocalReport.Render(Formato, Nothing, MimeType, Encoding, Extension, StreamIds, Warnings) - Catch ex As Microsoft.Reporting.WebForms.ScriptManagerNotFoundException - GuardaLog($"Error: { If(ex.InnerException.Message IsNot Nothing, ex.InnerException.Message, ex.Message) } | Descripcion: {If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException.Message IsNot Nothing, ex.InnerException.InnerException.Message, If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.Message IsNot Nothing, ex.InnerException.Message, "Sin descripcion"))} - Ruta {RutaReporte}") - 'HAY QUE VALIDAR QUE LOS OBJETOS QUE SE USAN PARA GUARDAR LOG EXISTEN!!! IPP 14 AGOSTO 2017 - 'GuardaLog($"Error: {ex.InnerException.Message} | Descripcion: {If(ex.InnerException.InnerException IsNot Nothing, ex.InnerException.InnerException.Message, "Sin descripcion")} - Ruta {RutaReporte}") - Catch ex As Exception - GuardaLog($"Error: { If(ex.InnerException.Message IsNot Nothing, ex.InnerException.Message, ex.Message) } | Descripcion: {If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException.Message IsNot Nothing, ex.InnerException.InnerException.Message, If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.Message IsNot Nothing, ex.InnerException.Message, "Sin descripcion"))} - Ruta {RutaReporte}") - 'HAY QUE VALIDAR QUE LOS OBJETOS QUE SE USAN PARA GUARDAR LOG EXISTEN!!! IPP 14 AGOSTO 2017 - 'GuardaLog($"Error {ex.InnerException.Message} | Descripcion: {If(ex.InnerException.InnerException IsNot Nothing, ex.InnerException.InnerException.Message, "Sin descripcion")} - Ruta {RutaReporte}") - End Try - - sw.Stop() - If sw.Elapsed.TotalSeconds > 10 Then - GuardaLog($"Reporte:{RutaReporte} | Tiempo Renderizado Milisegundos: {sw.ElapsedMilliseconds},Total Segundos: {sw.Elapsed.TotalSeconds} ") - End If - - Return Bytes + Public Function StreamPDF(ByVal context As HttpContext, RutaReporte As String, DataSource As List(Of ReportDataSource), Parametros As List(Of ReportParameter), Optional NombreArchivo As String = "Reporte", Optional Formato As String = "PDF", Optional MR As ReportViewer = Nothing) As Byte() + 'limpio ReportViwer + Dim sw As New System.Diagnostics.Stopwatch() + sw.Start() + Dim Bytes As Byte() = Nothing + + Dim bdir As String = If(RutaReporte.Contains("Empresas"), ModExtensiones.DirectorioBaseEmpresas, AppDomain.CurrentDomain.BaseDirectory) + RutaReporte.Replace("/", "\") + If Not RutaReporte.ToUpper().StartsWith(bdir.ToUpper()) Then + RutaReporte = String.Format("{0}{1}", bdir, RutaReporte) + End If + + If EsProduccion Then + + Dim CveUsuario As Integer = 0 + Dim CveEmpresa As Integer = 0 + + Dim wsreport As New WSRDLC.WebServiceSoapClient + Dim params As New List(Of WSRDLC.ReportParameter) + Dim ds As New DataSet + For Each rpds As ReportDataSource In DataSource + Dim dt As DataTable = DirectCast(rpds.Value, Data.DataTable) + If dt Is Nothing Then + dt = New DataTable() + Else + dt = dt.Copy() + End If + dt.TableName = rpds.Name + ds.Tables.Add(dt) + Next + For Each rpds As ReportParameter In Parametros + Dim param As New WSRDLC.ReportParameter + param.Name = rpds.Name + param.Values = {rpds.Values(0)} + params.Add(param) + Next + Bytes = wsreport.StreamPDFBytes(RutaReporte, ds, params.ToArray(), NombreArchivo, Formato, CveEmpresa, CveUsuario) + wsreport = Nothing + params = Nothing + Else + If IsNothing(MR) Then MR = New ReportViewer + Try + ' MasterReporteador.LocalReport.DataSources.Clear() + For Each RDS As ReportDataSource In DataSource + MR.LocalReport.DataSources.Add(RDS) + Next + + MR.LocalReport.ReportPath = RutaReporte + MR.ProcessingMode = ProcessingMode.Local + MR.LocalReport.EnableExternalImages = True + MR.LocalReport.SetParameters(Parametros) + MR.LocalReport.Refresh() + Dim Warnings As Warning() = Nothing + Dim StreamIds As String() = Nothing + Dim MimeType As String = Nothing + Dim Encoding As String = Nothing + Dim Extension As String = Nothing + Bytes = MR.LocalReport.Render(Formato, Nothing, MimeType, Encoding, Extension, StreamIds, Warnings) + Catch ex As Microsoft.Reporting.WebForms.ScriptManagerNotFoundException + GuardaLog($"Error: { If(ex.InnerException.Message IsNot Nothing, ex.InnerException.Message, ex.Message) } | Descripcion: {If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException.Message IsNot Nothing, ex.InnerException.InnerException.Message, If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.Message IsNot Nothing, ex.InnerException.Message, "Sin descripcion"))} - Ruta {RutaReporte}") + 'HAY QUE VALIDAR QUE LOS OBJETOS QUE SE USAN PARA GUARDAR LOG EXISTEN!!! IPP 14 AGOSTO 2017 + 'GuardaLog($"Error: {ex.InnerException.Message} | Descripcion: {If(ex.InnerException.InnerException IsNot Nothing, ex.InnerException.InnerException.Message, "Sin descripcion")} - Ruta {RutaReporte}") + Catch ex As Exception + GuardaLog($"Error: { If(ex.InnerException.Message IsNot Nothing, ex.InnerException.Message, ex.Message) } | Descripcion: {If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException.Message IsNot Nothing, ex.InnerException.InnerException.Message, If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.Message IsNot Nothing, ex.InnerException.Message, "Sin descripcion"))} - Ruta {RutaReporte}") + 'HAY QUE VALIDAR QUE LOS OBJETOS QUE SE USAN PARA GUARDAR LOG EXISTEN!!! IPP 14 AGOSTO 2017 + 'GuardaLog($"Error {ex.InnerException.Message} | Descripcion: {If(ex.InnerException.InnerException IsNot Nothing, ex.InnerException.InnerException.Message, "Sin descripcion")} - Ruta {RutaReporte}") + End Try + MR.Dispose() + + End If + sw.Stop() + + If sw.Elapsed.TotalSeconds > 5 Then + GuardaLog($"Reporte:{RutaReporte} | Tiempo Renderizado Milisegundos: {sw.ElapsedMilliseconds},Total Segundos: {sw.Elapsed.TotalSeconds} ") + End If + + Return Bytes End Function + + Public Sub ImprimirbytesPDF(ByVal context As HttpContext, bytes As Byte(), Optional NombreArchivo As String = "Reporte", Optional Formato As String = "PDF", Optional Descarga As Boolean = False) 'limpio ReportViwer Dim mimeType As String = Nothing @@ -181,6 +231,7 @@ Public Class GenerarPDFFactura : Implements IHttpHandler Public Property CveCliente As Integer Public Property NombreCliente As String Public Property Fecha As DateTime + Public Property FechaVencimiento As DateTime Public Property CveSubCentroCosto As Integer Public Property CveTipoDocumento As Integer Public Property TipoDocumento As String @@ -271,10 +322,21 @@ Public Class GenerarPDFFactura : Implements IHttpHandler Public Property RegimenFiscal As String End Class + Public Class DatosSATWS + Public Property SelloCFDI As String + Public Property SelloSAT As String + Public Property CadenaOriginal As String + Public Property SerieCertificadoSAT As String + Public Property FechaCertificado As String + Public Property CertificadoContribuyente As String + Public Property QR As String + End Class + Public Class ParametroWS Public Property Factura As FacturaWS Public Property Cliente As ClienteWS Public Property Empresa As EmpresaWS + Public Property Timbrado As DatosSATWS End Class diff --git a/Empresas/Grales/ReporteAPI.rdlc b/Empresas/Grales/ReporteAPI.rdlc new file mode 100644 index 000000000..620989a0f --- /dev/null +++ b/Empresas/Grales/ReporteAPI.rdlc @@ -0,0 +1,3710 @@ + + + + + + + + + 0.68312in + + + 0.74612in + + + 3.55631in + + + 0.73983in + + + 0.67767in + + + 0.68332in + + + 0.77646in + + + + + 0.21354in + + + + + true + true + + + + + Cantidad + + + + + + + Textbox15 + + + #4f81bd + Middle + 2pt + 2pt + + + + + + + + true + true + + + + + Unidad + + + + + + + Textbox33 + + + #4f81bd + Middle + 2pt + 2pt + + + + + + + + true + true + + + + + Descripción + + + + + + + Textbox17 + + + #4f81bd + Middle + 2pt + 2pt + + + + + + + + true + true + + + + + Precio + + + + + + + Textbox21 + + + #4f81bd + Middle + 2pt + 2pt + + + + + + + + true + true + + + + + IVA + + + + + + + Textbox1 + + + #4f81bd + Middle + 2pt + 2pt + + + + + + + + true + true + + + + + IEPS + + + + + + + Textbox14 + + + #4f81bd + Middle + 2pt + 2pt + + + + + + + + true + true + + + + + Importe + + + + + + + Textbox23 + + + #4f81bd + Middle + 2pt + 2pt + + + + + + + + 0.25521in + + + + + true + true + + + + + =Fields!Cantidad.Value + + + + + + + Cantidad + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!UnidadMedida.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!PS.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!PU.Value + + + + + + + PU + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!IVA.Value + + + + + + + IVA + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!IEPS.Value + + + + + + + IEPS + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Total.Value + + + + + + + Total + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.03125in + + + + + true + true + + + + + =Sum(Fields!Cantidad.Value) + + + + + + + Textbox71 + + + + #1414ff + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + + + + + + + + #1414ff + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + + + + + + + + #1414ff + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Sum(Fields!PU.Value) + + + + + + + Textbox74 + + + + #1414ff + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Sum(Fields!IVA.Value) + + + + + + + Textbox5 + + + + #1414ff + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Sum(Fields!IEPS.Value) + + + + + + + Textbox26 + + + + #1414ff + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Sum(Fields!Total.Value) + + + + + + + Textbox75 + + + + #1414ff + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + + + + + + + + + + + + + + + + After + + + + + + Before + + + + DsProductos + 2.02937in + 0.03703cm + 0.5in + 7.86283in + + + + + + true + true + + + + + Tipo + + + + + + + Textbox3 + 0.912in + 5.63144in + 0.5cm + 2.24597in + 1 + + + #4f81bd + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Fecha y hora de emisión + + + + + + + + + + + + + + + + Textbox3 + 0.46414in + 5.63144in + 0.5cm + 2.24597in + 2 + + + #4f81bd + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!Serie.Value + + + + - + + + + =Parameters!Folio.Value + + + + + + + Textbox3 + 0.22455in + 5.63144in + 0.60856cm + 2.24597in + 3 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + FACTURA + + + + + + + Textbox3 + 0.0412cm + 5.63144in + 0.5cm + 2.24597in + 4 + + + #4f81bd + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!Empresa.Value + + + + + + + + + R.F.C + + + + =Parameters!RFC.Value + + + + + + + Textbox4 + 1.75306in + 0.46414in + 3.96172in + 5 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + SON: ( + + + + =Microsoft.VisualBasic.Strings.UCase(Parameters!ImporteLetra.Value) + + + + ) + + + + + + + ImporteLetra + 2.53743in + 1.36047in + 0.23264in + 4.73657in + 6 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!SelloCFDI.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!SelloSAT.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!CadenaOriginal.Value + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + Database + =System.Convert.FromBase64String(Parameters!QR.Value) + image/png + FitProportional + 4.61035in + 0.00068in + 1.46528in + 1.56699in + 10 + + + + + + true + true + + + + + =Parameters!Fecha.Value + + + + + + + Textbox3 + 0.66099in + 5.63144in + 0.25114in + 2.24597in + 11 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Factura + + + + + + + Textbox3 + 1.10885in + 5.63144in + 0.20721in + 2.24597in + 12 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Domicilio Fiscal + + + + + + + + + =Parameters!DomicilioExpedicion.Value + + + + + + + Textbox10 + 0.46414in + 1.75306in + 0.69679in + 1.74651in + 13 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Lugar de Expedición + + + + + + + + + =Parameters!DomicilioExpedicion.Value + + + + + + + Textbox10 + 0.46414in + 3.81766in + 0.69679in + 1.786in + 14 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Nombre + + + + + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!ClienteNombre.Value + + + + + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Dirección + + + + + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!ClienteDireccion.Value + + + + + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Cuidad + + + + + + + #4f81bd + + 1.25pt + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!ClienteLugar.Value + + + + RFC: + + + + =Parameters!ClienteRFC.Value + + + + + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Sub Total + + + + + + + Textbox19 + 2.55788in + 6.12482in + 0.25in + 0.86113in + 21 + + + #4f81bd + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + IEPS + + + + + + + Textbox19 + 2.96771in + 6.12482in + 0.21875in + 0.84815in + 22 + + + #4f81bd + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Total + + + + + + + Textbox19 + 3.18334in + 6.12482in + 0.21875in + 0.84815in + 23 + + + #4f81bd + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!SubTotal.Value + + + + + + + Textbox42 + 2.57352in + 6.97297in + 0.18211in + 0.89055in + 24 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!IVA.Value + + + + + + + Textbox42 + 2.76813in + 6.97297in + 0.19289in + 0.89054in + 25 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!IEPS.Value + + + + + + + Textbox42 + 2.97282in + 6.97297in + 0.20219in + 0.89054in + 26 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!Total.Value + + + + + + + Textbox42 + 3.19376in + 6.97297in + 0.19791in + 0.89054in + 27 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Importe con letra: + + + + + + + Textbox19 + 2.53316in + 0.00068in + 0.2053in + 1.35979in + 28 + + + #4f81bd + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Forma de pago: + + + + + + + Textbox19 + 2.73851in + 0.00068in + 0.24305in + 1.35979in + 29 + + + #4f81bd + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Sello digital del CFDI: + + + + + + + Textbox19 + 2.93573in + 0.00068in + 0.61916in + 1.35979in + 30 + + + #4f81bd + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Sello del SAT: + + + + + + + Textbox19 + 3.55489in + 0.00068in + 0.30208in + 1.36417in + 31 + + + #4f81bd + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Cadena original del complemento de certificación digital del SAT: + + + + + + + Textbox19 + 3.85765in + 0.21875in + 7.87741in + 32 + + + #4f81bd + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!FormaPago.Value + + + + + + + ImporteLetra + 2.73851in + 1.36047in + 0.20833in + 4.73657in + 33 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Folio Fiscal: + + + + + + + Textbox54 + 4.59646in + 1.62669in + 0.19445in + 4.36369in + 34 + + + + + + + White + + + + + + + + #4f81bd + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + No. Serie del Certificado del SAT: + + + + + + + Textbox54 + 4.79091in + 1.62322in + 0.21105in + 4.37758in + 35 + + + #4f81bd + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Fecha y Hora de certificación: + + + + + + + Textbox54 + 5.00196in + 1.62322in + 0.19444in + 4.37064in + 36 + + + #4f81bd + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Certificado del Contribuyente: + + + + + + + Textbox54 + 5.19715in + 1.62322in + 0.20487in + 4.37064in + 37 + + + #4f81bd + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!FolioFiscal.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!SerieCertificadoSAT.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!FechaCertificado.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!CertificadoContribuyente.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Regímen: Regímen General de Ley Personas Morales; Uso CFDI: + + + + =Parameters!UsoCFDI.Value + + + + ; Método de Pago: + + + + =Parameters!MetodoPago.Value + + + + ; + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Éste documento es una representacion impresa de un CFDi + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + true + true + + + + + P A G A R E con Folio + + + + =Parameters!Serie.Value + + + + - + + + + =Parameters!Folio.Value + + + + Por éste pagare prometo (emos) pagar incondicionalmente a la orden de + + + + =Parameters!Empresa.Value + + + + a su vencimiento el + + + + =Parameters!Vencimiento.Value + + + + , en Hermosillo, Sonora o en el domicilio señalado a elección del acreedor o tenedor la cantidad de $ + + + + =Parameters!Total.Value + + + + SON: ( + + + + =Microsoft.VisualBasic.Strings.UCase(Parameters!ImporteLetra.Value) + + + + ). Valor recibido a mi (nuestra) entera satisfaccion. la falta de pago de éste documento a su vencimiento dará derecho a + + + + =Parameters!Empresa.Value + + + + o tenedor, desde el dia siguiente a cobrar el 10% mensual de interes moratorios hasta su total liquidación y los gastos judiciales que se ocasionén. Lugar y Fecha de Suscripcion: Hermosillo, Sonora a + + + + =Parameters!Fecha.Value + + + + + + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Nombre: + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Dirección: + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!ClienteNombre.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!ClienteDireccion.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Acepto de conformidad + + + + + + 2pt + 2pt + 2pt + 2pt + + + + 0.26711cm + 0.05457cm + 0cm + 0.57653cm + 7 + + + + + + 0.26711cm + 0.69053cm + 0cm + 0.57653cm + 8 + + + + + + 0.26711cm + 1.32627cm + 0cm + 0.57653cm + 9 + + + + + + 0.26711cm + 1.63234cm + 0cm + 0.57653cm + 10 + + + + + + 0.26711cm + 2.2683cm + 0cm + 0.57653cm + 11 + + + + + + 0.26711cm + 2.90404cm + 0cm + 0.57653cm + 12 + + + + + + 0.26711cm + 3.57348cm + 0cm + 0.57653cm + 13 + + + + + + 0.26711cm + 4.20944cm + 0cm + 0.57653cm + 14 + + + + + + 0.26711cm + 4.84518cm + 0cm + 0.57653cm + 15 + + + + + + 0.26711cm + 5.15125cm + 0cm + 0.57653cm + 16 + + + + + + 0.26711cm + 5.78721cm + 0cm + 0.57653cm + 17 + + + + + + 0.26711cm + 6.42295cm + 0cm + 0.57653cm + 18 + + + + + + 0.26711cm + 7.10321cm + 0cm + 0.57653cm + 19 + + + + + + 0.26711cm + 7.73917cm + 0cm + 0.57653cm + 20 + + + + + + 0.26711cm + 8.37491cm + 0cm + 0.57653cm + 21 + + + + + + 0.26711cm + 8.68098cm + 0cm + 0.57653cm + 22 + + + + + + 0.26711cm + 9.31694cm + 0cm + 0.57653cm + 23 + + + + + + 0.26711cm + 9.95268cm + 0cm + 0.57653cm + 24 + + + + + + 0.26711cm + 14.03363cm + 0cm + 0.57653cm + 25 + + + + + + 0.26711cm + 14.66959cm + 0cm + 0.57653cm + 26 + + + + + + 0.26711cm + 15.30533cm + 0cm + 0.57653cm + 27 + + + + + + 0.26711cm + 15.6114cm + 0cm + 0.57653cm + 28 + + + + + + 0.26711cm + 16.24736cm + 0cm + 0.57653cm + 29 + + + + + + 0.26711cm + 16.8831cm + 0cm + 0.57653cm + 30 + + + + + + 0.26711cm + 10.5767cm + 0cm + 0.57653cm + 31 + + + + + + 0.26711cm + 11.21266cm + 0cm + 0.57653cm + 32 + + + + + + 0.26711cm + 11.8484cm + 0cm + 0.57653cm + 33 + + + + + + 0.26711cm + 12.15447cm + 0cm + 0.57653cm + 34 + + + + + + 0.26711cm + 12.79043cm + 0cm + 0.57653cm + 35 + + + + + + 0.26711cm + 13.42617cm + 0cm + 0.57653cm + 36 + + + + + + 0.26711cm + 18.37745cm + 0cm + 0.57653cm + 37 + + + + + + 0.26711cm + 19.01341cm + 0cm + 0.57653cm + 38 + + + + + + 0.26711cm + 17.71435cm + 0cm + 0.57653cm + 39 + + + + + + true + 15.71618cm + 0.01661cm + 4.36819cm + 20.04854cm + 44 + + + + + + true + true + + + + + IVA + + + + + + + Textbox19 + 2.76952in + 6.12573in + 0.19444in + 0.86113in + 45 + + + #4f81bd + 2pt + 2pt + 2pt + 2pt + + + + 20.08437cm + Anexo del Catálogo - Mensual @@ -48,50 +53,58 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + +
diff --git a/Contabilidad2/RepAnexoCatalogoMensual.aspx.vb b/Contabilidad2/RepAnexoCatalogoMensual.aspx.vb index b485b7178..9e698be19 100644 --- a/Contabilidad2/RepAnexoCatalogoMensual.aspx.vb +++ b/Contabilidad2/RepAnexoCatalogoMensual.aspx.vb @@ -22,10 +22,10 @@ Partial Class Contabilidad2_RepAnexoCatalogoMensual If Not IsPostBack Then Dim EjercicioParametro, SubProyectoParametro, DivisorParametro As Integer - CveCuenta = IfNull(Request("C"), "-1").ToString.ToEntero - EjercicioParametro = IfNull(Request("E"), "-1").ToString.ToEntero - SubProyectoParametro = IfNull(Request("S"), "-1").ToString.ToEntero - DivisorParametro = IfNull(Request("D"), "-1").ToString.ToEntero + CveCuenta = IfNull(Request("CveCuenta"), "-1").ToString.ToEntero + EjercicioParametro = IfNull(Request("Ejercicio"), "-1").ToString.ToEntero + SubProyectoParametro = IfNull(Request("CveSubProyecto"), "-1").ToString.ToEntero + DivisorParametro = IfNull(Request("Divisor"), "-1").ToString.ToEntero InicializaValores() @@ -72,7 +72,7 @@ Partial Class Contabilidad2_RepAnexoCatalogoMensual Private Sub CargaDatos() Dim Conta As New ClsContabilidad - If Conta.GetAnexoCatalogoMensual(CveCuenta, DdlEjercicio.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then + If Conta.GetAnexoCatalogoMensual(CveCuenta, DdlEjercicio.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, DdlDivisor.SelectedValue.ToEntero, UsuarioActual.CveUsuario) Then GvMensual2.DataSource = Conta.DtResultados Else GvMensual2.DataSource = Nothing diff --git a/Contabilidad2/RepAnexoCatalogoMensualHorizontal.aspx b/Contabilidad2/RepAnexoCatalogoMensualHorizontal.aspx new file mode 100644 index 000000000..950df1886 --- /dev/null +++ b/Contabilidad2/RepAnexoCatalogoMensualHorizontal.aspx @@ -0,0 +1,335 @@ +<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="RepAnexoCatalogoMensualHorizontal.aspx.vb" Inherits="Contabilidad_RepAnexoCatalogoMensualHorizontal" EnableEventValidation="false" %> + + + + + + + + + + + + + + <%--
  • + Excel +
  • +
  • + PDF +
  • --%> + +
    + + + + +
    +
    +
    + + "><%--class="expand"--%> + +
    +
    + <%--
    --%> +
      +
    • F. I.
    • +
    • + +
      + + + + + + + + + + +
      + +
    • +
    • F. F.
    • +
    • +
      + + + + + + + + + + + +
      +
    • + +
    • Cuenta: +
    • +
    • + + + + + + + + +
    • + + +
    +
    +
    +
    > + +
      +
    • + Tipo Movto: +
    • +
    • + + + + + + + + + +
    • +
    • + +
      + + + +
      +
    • +
    • Tipo: +
    • + +
    • + + + + + +
    • +
    • Tipo de Cuentas: +
    • +
    • + + +
    • + +
    + +
    +
    + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Saldos Iniciales
    DeudorAcreedor
    +
    + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + +
    Saldos Actuales
    DeudorAcreedor
    +
    + + + <%----%> + + + +
    + + + + + + + + + + + + + + + +
    + +
    + +
    +
    + + + + + + + diff --git a/Contabilidad2/RepAnexoCatalogoMensualHorizontal.aspx.vb b/Contabilidad2/RepAnexoCatalogoMensualHorizontal.aspx.vb new file mode 100644 index 000000000..e2ab70cc6 --- /dev/null +++ b/Contabilidad2/RepAnexoCatalogoMensualHorizontal.aspx.vb @@ -0,0 +1,328 @@ +Option Explicit On +Option Strict On + +Imports System.Data +Imports Extensiones +Imports Microsoft.Reporting.WebForms + +Partial Class Contabilidad_RepAnexoCatalogoMensualHorizontal + Inherits ClsPaginas + + +#Region "PROPIEDADES" + Private Property DtDatos As DataTable + Get + DtDatos = DirectCast(ViewState("DtDatos"), DataTable) + End Get + + Set(ByVal value As DataTable) + ViewState("DtDatos") = value + End Set + End Property + Private Property FechaInicio As Date + Get + FechaInicio = ViewState("FechaInicio").ToString.ToDate + End Get + Set(value As Date) + ViewState("FechaInicio") = value + End Set + End Property + + Private Property FechaFin As Date + Get + FechaFin = ViewState("FechaFin").ToString.ToDate + End Get + Set(value As Date) + ViewState("FechaFin") = value + End Set + End Property + Private Property IdCuenta As Integer + Get + IdCuenta = ViewState("CveCuenta").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("CveCuenta") = value + End Set + End Property + 'Private Property DTCuentas As DataTable + ' Get + ' Return CType(ViewState("DTCuentas"), DataTable) + ' End Get + ' Set(value As DataTable) + ' ViewState("DTCuentas") = value + ' End Set + 'End Property + Private Property CveSubProyecto As String + Get + CveSubProyecto = ViewState("CveSubProyecto").ToString + End Get + Set(value As String) + ViewState("CveSubProyecto") = value + End Set + End Property + + Private Property TipoReporte As Integer + Get + TipoReporte = ViewState("TP").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("TP") = value + End Set + End Property +#End Region + + Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load + If Not Page.IsPostBack Then + Dim ErrorParametros = True + DtDatos = Nothing + CargaTipoCuentas() + + FechaInicio = Now.FirstDayOfMonth + FechaFin = Date.Now + + 'If UsuarioActual.Empresa.UsaAC Then + ' TipoReporte = -1 + 'Else + ' TipoReporte = 1 + ' tdTipoReporte.Visible = True + ' tdTipoReporte2.Visible = True + 'End If + + + If Request("CveCuenta") IsNot Nothing AndAlso IsNumeric(Request("CveCuenta")) AndAlso Request("CveCuenta").ToEntero > 0 Then + 'If Request("FI") IsNot Nothing AndAlso Request("FI").ToString.Length = 10 AndAlso Request("FI").ToDate > "01/01/1000".ToDate Then + If Request("FF") IsNot Nothing AndAlso Request("FF").ToString.Length = 10 AndAlso Request("FF").ToDate > "01/01/1000".ToDate Then + IdCuenta = Request("CveCuenta").ToEntero + 'FechaInicio = Request("FI").ToDate + FechaFin = Request("FF").ToDate + DdlCuentas.SelectedValueExist(IdCuenta) + If DdlCuentas.SelectedValue.ToEntero <> -1 Then + 'RegistraScript("Enable();") + DdlTipoCuentas.SelectedValueExist(-2) + End If + + If Request("FI") IsNot Nothing AndAlso Request("FI").ToString.Length = 10 AndAlso Request("FI").ToDate > "01/01/1000".ToDate Then + FechaInicio = Request("FI").ToDate + Else + If Request("ER") IsNot Nothing AndAlso Request("ER").ToString = "1" Then + FechaInicio = DateSerial(Year(FechaFin), Month(FechaFin), 1) + Else + FechaInicio = ("1900/01/01").ToDate + End If + End If + + + If Request("CM") IsNot Nothing AndAlso IsNumeric(Request("CM")) AndAlso Request("CM").ToEntero > 0 Then + DdlCuenta.SelectedValueExist(Request("CM").ToString) + End If + + If Request("CveSubProyecto") IsNot Nothing AndAlso IsNumeric(Request("CveSubProyecto")) Then + CveSubProyecto = Request("CveSubProyecto").ToString + End If + + + ErrorParametros = False + + + If Request("TP") IsNot Nothing AndAlso IsNumeric(Request("TP")) AndAlso Request("TP").ToEntero > 0 Then + TipoReporte = Request("TP").ToEntero + + DdlTipoReporte.SelectedValue = TipoReporte.ToString + End If + End If + 'End If + End If + + + TxtFechaDel.Text = FechaInicio.ToShortDateString + TxtFechaAl.Text = FechaFin.ToShortDateString + + If Not ErrorParametros Then + CargaDatos() + End If + + End If + End Sub + +#Region "CARGA DATOS Y GRID" + 'Public Function WSCuentas() As String + ' Dim Str As New StringBuilder + ' Dim i As Integer = 0 + ' Dim dt As DataTable = DTCuentas '.FiltraParametros("Afectable = 1") + + ' If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then + + ' For Each dr As DataRow In dt.Rows + ' i += 1 + ' Str.AppendFormat("{{value:""{0}"",label:""{1}{3}""}}{2}", dr("CveCuenta"), dr("CtaCodigo").ToString.Replace("""", ""), If(i < dt.Rows.Count, ",", ""), If(dr("Afectable").ToString = "1", " *", "")) + ' Next + + ' End If + + + ' Return Str.ToString + 'End Function + Private Sub CargaTipoCuentas() + 'Dim ObjTipoCuenta As New ClsContPAQi(UsuarioActual.Empresa) + Dim ObjTipoCuenta As New ClsContabilidad + Dim strGlobal As String = "" + + If ObjTipoCuenta.GetCuentas(-1, "-1", -1, UsuarioActual.CveEmpresa) Then + Dim dr As DataRow = ObjTipoCuenta.DtResultados.FiltroPrimero("Codigo IN ('_GLOBAL')") + If dr IsNot Nothing Then strGlobal = dr.Item(0).ToString + 'DTCuentas = ObjTipoCuenta.DtResultados '.FiltraParametros("Afectable = 1") + DdlTipoCuentas.DataSource = ObjTipoCuenta.DtResultados.FiltraParametros("Codigo IN ('_ACTIVO', '_BPASIVO', '_CAPITAL', '_CUADRE', '_ESTADISTICAS', '_ORDEN', '_RACREEDOR', '_RDEUDOR', '_UTILIDAD')") + DdlCuentas.DataSource = ObjTipoCuenta.DtResultados + End If + ObjTipoCuenta.Dispose() + DdlTipoCuentas.DataBind() + 'If strGlobal.Length > 0 Then DdlTipoCuentas.Items.Insert(0, New ListItem("Todas", strGlobal)) + DdlTipoCuentas.Items.Insert(0, New ListItem("Todas las Cuentas", "-1")) + DdlTipoCuentas.Items.Add(New ListItem("Algun específico", "-2")) + DdlTipoCuentas.SelectedValue = "-2" + + DdlCuentas.DataBind() + + DdlSubproyecto.DataSource = GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa, -1) + DdlSubproyecto.DataBind() + End Sub + Private Sub CargaDatos() + 'Dim ObjConta As New ClsContPAQi(UsuarioActual.Empresa) + Dim ObjConta As New ClsContabilidad + + If Request("TipoReporte") IsNot Nothing Then + TipoReporte = If(TipoReporte = -1, -1, DdlTipoReporte.SelectedValue.ToEntero) + Else + TipoReporte = DdlTipoReporte.SelectedValue.ToEntero + End If + 'Dim CveSubProyecto As String + If Request("CveSubProyecto") IsNot Nothing Then + CveSubProyecto = Request("CveSubProyecto").ToString + Else + CveSubProyecto = DdlSubproyecto.SelectedValue.ToEntero.ToString + End If + + If ObjConta.GetAnexoCatalogoMensualHorizontal(IdCuenta, FechaInicio, FechaFin, DdlCuenta.SelectedValue.ToEntero, CveSubProyecto, UsuarioActual.CveEmpresa, TipoReporte) Then + + If Request("CveCuenta") IsNot Nothing AndAlso IsNumeric(Request("CveCuenta")) AndAlso Request("CveCuenta").ToEntero > 0 Then + DtDatos = ObjConta.DtResultados.FiltraParametros(" SaldoInicial <> 0 OR Cargos <> 0 OR Abonos <> 0") + Else + DtDatos = ObjConta.DtResultados + End If + + CargaGrid() + Else + DtDatos = Nothing + Alert("Ocurrio un error al cargar los datos del Anexo del Catálogo.", TipoMensaje.MsgError) + End If + + ObjConta.Dispose() + End Sub + Private Sub CargaGrid() + GvDatos.DataSource = DtDatos + 'GvDatos.Dispose() + GvDatos.DataBind() + UpDatos.Update() + If DtDatos.Rows.Count > 0 Then + RegistraScript("Scroll();") + End If + + End Sub +#End Region + + Protected Sub GvIngresos_RowDataBound(sender As Object, e As GridViewRowEventArgs) + If e.Row.RowType = DataControlRowType.DataRow Then + + If e.Row.DBCampo("CveCuenta").ToEntero = IdCuenta Then + e.Row.ControlStyle.Font.Bold = True + 'e.Row.ControlStyle.Font.Size = 9 + 'e.Row.ControlStyle.Height = 30 + Else + e.Row.ControlStyle.Font.Bold = False + End If + + 'If e.Row.DBCampo("CtaMayor") = "4" Or e.Row.DBCampo("CtaMayor") = "1" Then + ' e.Row.ControlStyle.Font.Bold = True + 'End If + + 'Acomoda Deudor y Acreedor + If e.Row.DBCampo("Tipo") <> "D" Then + 'e.Row.FCLabel("LbSaldoInicial").Text = String.Format("{0}{1}", e.Row.DBCampo("SaldoInicial").FormatoNumero, "          ") + e.Row.FCLabel("LbSaldoInicial2").Visible = True + e.Row.FCLabel("LbSaldoActual").Visible = True + End If + + 'Colorea NEGATIVOS + If e.Row.DBCampo("SaldoInicial").ToString.ToDouble < 0 Then + e.Row.FCLabel("LbSaldoInicial").ForeColor = Drawing.Color.Red + End If + If e.Row.DBCampo("Cargos").ToString.ToDouble < 0 Then + e.Row.FCLabel("LbCargos").ForeColor = Drawing.Color.Red + End If + If e.Row.DBCampo("Abonos").ToString.ToDouble < 0 Then + e.Row.FCLabel("LbAbonos").ForeColor = Drawing.Color.Red + End If + If e.Row.DBCampo("SaldoActual").ToString.ToDouble < 0 Then + e.Row.FCHyperLink("HLSaldoActual").ForeColor = Drawing.Color.Red + End If + + e.Row.FCHyperLink("HLSaldoActual").NavigateUrl = String.Format("/Contabilidad2/RepMovimientosAuxiliaresCatalogo.aspx?CveCuenta={0}&FI={1}&FF={2}&CveSubProyecto={3}&TP={4}", e.Row.DBCampo("CveCuenta"), FechaInicio.ToShortDateString, FechaFin.ToShortDateString, CveSubProyecto, TipoReporte) + End If + End Sub + + Protected Sub LnkImprimir_Click(sender As Object, e As EventArgs) Handles LnkImprimir.Click + If Not IsNothing(DtDatos) Then + ImprimirReporte() + End If + End Sub + + Protected Sub LnkExcel_Click(sender As Object, e As EventArgs) Handles LnkExcel.Click + If Not IsNothing(DtDatos) Then + ImprimirReporte("Excel") + 'GvDatos.ExportToExcelG("AnexoCatalogo" & Now.ToShortDateString & ".xlsx") + 'GvDatos.ExportToExcelG("ExistenciasHorizontal.xlsx", "Anexo Catalogo", UsuarioActual, "".ToString, 100, 200) + End If + End Sub + Private Sub ImprimirReporte(Optional Formato As String = "PDF") + 'ubicacion del rdlc + Dim reportpath As String = "Contabilidad/Reportes/RepAnexoCatalogo.rdlc" + 'nombre del reporte + Dim fileName As String = "AnexoCatalogo" + 'parametros a enviar al reporte + Dim params As New List(Of ReportParameter) + params.Add(New ReportParameter("IdCuenta", IdCuenta.ToString)) + params.Add(New ReportParameter("pEmp", UsuarioActual.Empresa.Empresa)) + params.Add(New ReportParameter("usuarioImprimio", UsuarioActual.Nombre)) + params.Add(New ReportParameter("pImg", New Uri(Server.MapPath(String.Format("~/Empresas/{0}/Logo.png", UsuarioActual.CveEmpresa))).AbsoluteUri)) + params.Add(New ReportParameter("pFechaFin", FechaFin.ToString("dd/MM/yyyy"))) + params.Add(New ReportParameter("pFechaInicio", FechaInicio.ToString("dd/MM/yyyy"))) + + ImprimirPDF(reportpath, DtDatos, params, fileName, Formato) + End Sub + Public Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click + + If DdlTipoCuentas.SelectedValue.ToEntero = -2 AndAlso DdlCuentas.SelectedValue.ToEntero = -1 Then + Alert("El campo Cuenta es obligatorio.", TipoMensaje.MsgError) + Else + FechaInicio = If(TxtFechaDel.Text = "" Or TxtFechaDel.Text = "__/__/____", Date.Now, TxtFechaDel.Text.ToDate) + FechaFin = If(TxtFechaAl.Text = "" Or TxtFechaAl.Text = "__/__/____", Date.Now, TxtFechaAl.Text.ToDate) + IdCuenta = If(DdlTipoCuentas.SelectedValue.ToEntero = -2, DdlCuentas.SelectedValue.ToEntero, DdlTipoCuentas.SelectedValue.ToEntero) + + CargaDatos() + End If + 'RegistraScript("Enable();") + End Sub + Protected Sub DdlTipoCuentas_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlTipoCuentas.SelectedIndexChanged + If DdlTipoCuentas.SelectedValue.ToEntero = -2 Then + DdlCuentas.Enabled = True + Else + DdlCuentas.Enabled = False + DdlCuentas.SelectedValueExist(-1) + End If + End Sub + + Public Overrides Sub VerifyRenderingInServerForm(control As Control) + + End Sub + +End Class diff --git a/Contabilidad2/RepEstadoResultadosHorizontal.aspx b/Contabilidad2/RepEstadoResultadosHorizontal.aspx index ce71fff6b..ce70e7ad1 100644 --- a/Contabilidad2/RepEstadoResultadosHorizontal.aspx +++ b/Contabilidad2/RepEstadoResultadosHorizontal.aspx @@ -10,8 +10,10 @@ - - + +
  • + Generar Excel +
  • @@ -27,15 +29,15 @@
      - +
      - +
      - +
      - +
      @@ -92,7 +94,7 @@ - + @@ -106,16 +108,16 @@ - - <%----%> + + <%-- --%> - - <%----%> + + <%-- --%> @@ -124,7 +126,7 @@

      - + @@ -161,7 +163,7 @@ - +
      + @@ -192,11 +195,13 @@ - + + - + <%----%> + @@ -298,12 +303,13 @@

      - + - + <%----%> + @@ -405,7 +411,7 @@

      - + @@ -492,14 +498,7 @@ - <%-- - - - - - --%> - - <%-- --%> + @@ -558,13 +557,13 @@ - + - + @@ -593,41 +592,7 @@ - <%-- - - - - - - - - - - - - - - - - - - - - - - - - --%> - - - <%-- - - - - - --%> - - <%----%> + @@ -644,13 +609,13 @@ - + - + @@ -700,47 +665,47 @@

      - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + <%-- @@ -756,7 +721,7 @@ - + diff --git a/Contabilidad2/RepEstadoResultadosHorizontal.aspx.vb b/Contabilidad2/RepEstadoResultadosHorizontal.aspx.vb index c051bc71c..4664d9633 100644 --- a/Contabilidad2/RepEstadoResultadosHorizontal.aspx.vb +++ b/Contabilidad2/RepEstadoResultadosHorizontal.aspx.vb @@ -3,7 +3,9 @@ Option Strict On Imports System.Data Imports System.Drawing +Imports System.IO Imports Extensiones +Imports GemBox.Spreadsheet Imports Microsoft.Reporting.WebForms Partial Class Contabilidad_RepEstadoResultadosHorizontal @@ -21,6 +23,7 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal ViewState("DtDatosMes") = value End Set End Property + Private Property DtIngresosMes As DataTable Get DtIngresosMes = DirectCast(ViewState("DtIngresosMes"), DataTable) @@ -291,6 +294,8 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal End If If Tab.ActiveTabIndex = 2 Then + ValidaEjercicios() + LiSubProyectoDdl.Visible = True LiSubProyectoLbl.Visible = True @@ -326,6 +331,39 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal LiDivisorLbl.Visible = True End If + UpFiltros.Update() + End Sub + + + Protected Sub DdlEjercicio_SelectedIndexChanged(sender As Object, e As EventArgs) + ValidaEjercicios() + End Sub + + Protected Sub DdlEjercicio2_SelectedIndexChanged(sender As Object, e As EventArgs) + ValidaEjercicios() + End Sub + + Private Sub ValidaEjercicios() + + + Dim EInicio As Integer = DdlEjercicio.SelectedValue.ToEntero + + + If EInicio > DdlEjercicio2.SelectedValue.ToEntero Then + + If DdlEjercicio2.Items.Count > 0 Then + DdlEjercicio2.SelectedIndex = DdlEjercicio2.Items.Count - 1 + End If + + Dim Fejerciosio As Integer = DdlEjercicio2.SelectedValue.ToEntero + + If Not EInicio + 1 > Fejerciosio Then + DdlEjercicio2.SelectedValueExist(EInicio + 1) + End If + + End If + + UpFiltros.Update() End Sub @@ -366,6 +404,11 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal 'AÑO HORIZONTAL If Tab.ActiveTabIndex = 2 Then + + If DdlEjercicio.SelectedValue.ToEntero > DdlEjercicio2.SelectedValue.ToEntero Then + Alert("El ejercicio inicio no debe ser mayor al ejercicio fin.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If CargaDatosAnualH() End If @@ -478,12 +521,20 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal - Private Sub SumaTotales() - 'Llena Lb´s Totales - LbTotalActual.Text = TotalActualMes.ToString.FormatoNumero - - LbTotalAnterior.Text = TotalAnteriorMes.ToString.FormatoNumero - + Private Sub SumaTotales() + 'Llena Lb´s Totales + + + If DdlDivisor.SelectedValue.ToEntero > 1 Then + LbTotalActual.Text = TotalActualMes.ToString("###,###,##0") + LbTotalAnterior.Text = TotalAnteriorMes.ToString("###,###,##0") + Else + LbTotalActual.Text = TotalActualMes.ToString("###,###,##0.00") + LbTotalAnterior.Text = TotalAnteriorMes.ToString("###,###,##0.00") + End If + + + LbTotalActual.ForeColor = If(TotalActualMes < 0, Drawing.Color.Red, Color.Black) LbTotalAnterior.ForeColor = If(TotalAnteriorMes < 0, Drawing.Color.Red, Color.Black) @@ -493,8 +544,10 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal #Region "GV´S ROW DATA BOUND" - Protected Sub GvIngresos_RowDataBound(sender As Object, e As GridViewRowEventArgs) - If e.Row.RowType = DataControlRowType.DataRow Then + 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 TotalActualMes += e.Row.DBCampo("ImporteActual").ToString.ToDouble TotalAnteriorMes += e.Row.DBCampo("ImporteAcumulado").ToString.ToDouble @@ -507,10 +560,20 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal End If If e.Row.DBCampo("CtaMayor").ToString.ToEntero > 0 Then - e.Row.FCHyperLink("HLActual").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), e.Row.DBCampo("FechaFActual").ToDate.ToShortDateString, e.Row.DBCampo("FechaInicial").ToDate.ToShortDateString) - e.Row.FCHyperLink("HLAnterior").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), e.Row.DBCampo("FechaFActual").ToDate.ToShortDateString, e.Row.DBCampo("FechaInicial").ToDate.ToShortDateString) - End If + e.Row.FCHyperLink("HLActual").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), e.Row.DBCampo("FechaFActual").ToDate.ToShortDateString, e.Row.DBCampo("FechaInicial").ToDate.ToShortDateString) + e.Row.FCHyperLink("HLAnterior").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), e.Row.DBCampo("FechaFActual").ToDate.ToShortDateString, e.Row.DBCampo("FechaInicial").ToDate.ToShortDateString) + + + If DdlDivisor.SelectedValue.ToEntero > 1 Then + e.Row.FCHyperLink("HLActual").Text = e.Row.DataKey("ImporteActual").ToEntero.ToString("###,###,##0") + e.Row.FCHyperLink("HLAnterior").Text = e.Row.DataKey("ImporteAcumulado").ToEntero.ToString("###,###,##0").ToString + Else + e.Row.FCHyperLink("HLActual").Text = e.Row.DataKey("ImporteActual").ToDecimal.ToString("###,###,##0.00") + e.Row.FCHyperLink("HLAnterior").Text = e.Row.DataKey("ImporteAcumulado").ToDecimal.ToString("###,###,##0.00").ToString + End If + + End If If e.Row.DBCampo("ImporteActual").ToString.ToDouble < 0 Then @@ -540,6 +603,14 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal e.Row.FCHyperLink("HLAnterior").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), e.Row.DBCampo("FechaFActual").ToDate.ToShortDateString, e.Row.DBCampo("FechaInicial").ToDate.ToShortDateString) End If + If DdlDivisor.SelectedValue.ToEntero > 1 Then + e.Row.FCHyperLink("HLActual").Text = e.Row.DataKey("ImporteActual").ToEntero.ToString("###,###,##0") + e.Row.FCHyperLink("HLAnterior").Text = e.Row.DataKey("ImporteAcumulado").ToEntero.ToString("###,###,##0").ToString + Else + e.Row.FCHyperLink("HLActual").Text = e.Row.DataKey("ImporteActual").ToDecimal.ToString("###,###,##0.00") + e.Row.FCHyperLink("HLAnterior").Text = e.Row.DataKey("ImporteAcumulado").ToDecimal.ToString("###,###,##0.00").ToString + End If + If e.Row.DBCampo("ImporteActual").ToString.ToDouble < 0 Then e.Row.FCHyperLink("HLActual").ForeColor = Drawing.Color.Red End If @@ -579,8 +650,7 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal ObjConta.Dispose() If DtDatosMesH IsNot Nothing Then - CargaGridsMesH() - SumaTotalesMesH() + CargaGridsMesH() Else End If @@ -616,7 +686,7 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal Row.Item("Noviembre") = DtIngresosMesH.SUM("Noviembre", "NOT CtaMayor in (3,4)") Row.Item("Diciembre") = DtIngresosMesH.SUM("Diciembre", "NOT CtaMayor in (3,4)") - Row.Item("Nombre") = "TOTAL INGRESOS " + Row.Item("Nombre") = "TOTAL INGRESOS" Row.Item("ImporteActual") = TotalActual.ToString Row.Item("PorcentajeActual") = "100.00" Row.Item("ImporteAcumulado") = TotalAnterior.ToString @@ -714,34 +784,25 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal End Sub - Private Sub SumaTotalesMesH() - ''Llena Lb´s Totales - ''********************************************************************************* - 'LbTotalActual.Text = TotalActualMes.ToString.FormatoNumero - 'LbTotalAnterior.Text = TotalAnteriorMes.ToString.FormatoNumero - - 'LbTotalActual.ForeColor = If(TotalActualMes < 0, Drawing.Color.Red, Color.Black) - 'LbTotalAnterior.ForeColor = If(TotalAnteriorMes < 0, Drawing.Color.Red, Color.Black) - - - End Sub Protected Sub GvIngresosMesH_RowDataBound(sender As Object, e As GridViewRowEventArgs) If e.Row.RowType = DataControlRowType.DataRow Then If e.Row.DBCampo("CtaMayor").ToString.ToEntero < 0 Then TotalActualMes += e.Row.DBCampo("ImporteActual").ToString.ToDouble - TotalAnteriorMes += e.Row.DBCampo("ImporteAcumulado").ToString.ToDouble - 'e.Row.ControlStyle.BackColor = Drawing.Color.LightGray - 'e.Row.ControlStyle.ForeColor = Drawing.Color.White + TotalAnteriorMes += e.Row.DBCampo("ImporteAcumulado").ToString.ToDouble e.Row.ControlStyle.Font.Bold = True - ElseIf e.Row.DBCampo("CtaMayor").ToString.ToEntero = 3 Then - 'e.Row.CssClass = "SubTotales3" + ElseIf e.Row.DBCampo("CtaMayor").ToString.ToEntero = 3 Then e.Row.ControlStyle.Font.Bold = True End If If e.Row.DBCampo("CtaMayor").ToString.ToEntero > 0 Then + + 'e.Row.FCHyperLink("HLNombre").NavigateUrl = $"./RepAnexoCatalogoMensualHorizontal.aspx?CveCuenta={e.Row.DBCampo("CveCuenta").ToString}&FF=31/12/{DdlEjercicio.SelectedValue}&FI=01/01/{DdlEjercicio.SelectedValue}&ER=1" + + e.Row.FCHyperLink("HLNombre").NavigateUrl = $"./RepAnexoCatalogoMensual.aspx?CveCuenta={e.Row.DBCampo("CveCuenta").ToString}&Ejercicio={DdlEjercicio.SelectedValue}&Divisor={DdlDivisor.SelectedValue}&CveSubProyecto=-1" + e.Row.FCHyperLink("HLEnero").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/01/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/01/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString) e.Row.FCHyperLink("HLFebrero").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/02/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/02/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString) e.Row.FCHyperLink("HLMarzo").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/03/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/03/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString) @@ -759,14 +820,59 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal e.Row.FCHyperLink("HLAnterior").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), e.Row.DBCampo("FechaFActual").ToDate.ToShortDateString, e.Row.DBCampo("FechaInicial").ToDate.ToShortDateString) 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("CtaMayor").ToString.ToEntero > 0 Or e.Row.DBCampo("Nombre") = "TOTAL INGRESOS" Then + + If DdlDivisor.SelectedValue.ToEntero > 1 Then + + e.Row.FCHyperLink("HLEnero").Text = e.Row.DataKey("Enero").ToDecimal.ToString("###,###,##0") + e.Row.FCHyperLink("HLFebrero").Text = e.Row.DataKey("Febrero").ToDecimal.ToString("###,###,##0") + e.Row.FCHyperLink("HLMarzo").Text = e.Row.DataKey("Marzo").ToDecimal.ToString("###,###,##0") + e.Row.FCHyperLink("HLAbril").Text = e.Row.DataKey("Abril").ToDecimal.ToString("###,###,##0") + e.Row.FCHyperLink("HLMayo").Text = e.Row.DataKey("Mayo").ToDecimal.ToString("###,###,##0") + e.Row.FCHyperLink("HLJunio").Text = e.Row.DataKey("Junio").ToDecimal.ToString("###,###,##0") + e.Row.FCHyperLink("HLJulio").Text = e.Row.DataKey("Julio").ToDecimal.ToString("###,###,##0") + e.Row.FCHyperLink("HLAgosto").Text = e.Row.DataKey("Agosto").ToDecimal.ToString("###,###,##0") + e.Row.FCHyperLink("HLSeptiembre").Text = e.Row.DataKey("Septiembre").ToDecimal.ToString("###,###,##0") + e.Row.FCHyperLink("HLOctubre").Text = e.Row.DataKey("Octubre").ToDecimal.ToString("###,###,##0") + e.Row.FCHyperLink("HLNoviembre").Text = e.Row.DataKey("Noviembre").ToDecimal.ToString("###,###,##0") + e.Row.FCHyperLink("HLDiciembre").Text = e.Row.DataKey("Diciembre").ToDecimal.ToString("###,###,##0") + Else + e.Row.FCHyperLink("HLEnero").Text = e.Row.DataKey("Enero").ToDecimal.ToString("###,###,##0.00") + e.Row.FCHyperLink("HLFebrero").Text = e.Row.DataKey("Febrero").ToDecimal.ToString("###,###,##0.00") + e.Row.FCHyperLink("HLMarzo").Text = e.Row.DataKey("Marzo").ToDecimal.ToString("###,###,##0.00") + e.Row.FCHyperLink("HLAbril").Text = e.Row.DataKey("Abril").ToDecimal.ToString("###,###,##0.00") + e.Row.FCHyperLink("HLMayo").Text = e.Row.DataKey("Mayo").ToDecimal.ToString("###,###,##0.00") + e.Row.FCHyperLink("HLJunio").Text = e.Row.DataKey("Junio").ToDecimal.ToString("###,###,##0.00") + e.Row.FCHyperLink("HLJulio").Text = e.Row.DataKey("Julio").ToDecimal.ToString("###,###,##0.00") + e.Row.FCHyperLink("HLAgosto").Text = e.Row.DataKey("Agosto").ToDecimal.ToString("###,###,##0.00") + e.Row.FCHyperLink("HLSeptiembre").Text = e.Row.DataKey("Septiembre").ToDecimal.ToString("###,###,##0.00") + e.Row.FCHyperLink("HLOctubre").Text = e.Row.DataKey("Octubre").ToDecimal.ToString("###,###,##0.00") + e.Row.FCHyperLink("HLNoviembre").Text = e.Row.DataKey("Noviembre").ToDecimal.ToString("###,###,##0.00") + e.Row.FCHyperLink("HLDiciembre").Text = e.Row.DataKey("Diciembre").ToDecimal.ToString("###,###,##0.00") + End If + + End If + + + e.Row.FCHyperLink("HLEnero").ForeColor = If(e.Row.DataKey("Enero").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLEnero").ForeColor) + e.Row.FCHyperLink("HLFebrero").ForeColor = If(e.Row.DataKey("Febrero").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLFebrero").ForeColor) + e.Row.FCHyperLink("HLMarzo").ForeColor = If(e.Row.DataKey("Marzo").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLMarzo").ForeColor) + e.Row.FCHyperLink("HLAbril").ForeColor = If(e.Row.DataKey("Abril").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLAbril").ForeColor) + e.Row.FCHyperLink("HLMayo").ForeColor = If(e.Row.DataKey("Mayo").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLAbril").ForeColor) + e.Row.FCHyperLink("HLJunio").ForeColor = If(e.Row.DataKey("Junio").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLMayo").ForeColor) + e.Row.FCHyperLink("HLJulio").ForeColor = If(e.Row.DataKey("Julio").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLJulio").ForeColor) + e.Row.FCHyperLink("HLAgosto").ForeColor = If(e.Row.DataKey("Agosto").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLAgosto").ForeColor) + e.Row.FCHyperLink("HLSeptiembre").ForeColor = If(e.Row.DataKey("Septiembre").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLSeptiembre").ForeColor) + e.Row.FCHyperLink("HLOctubre").ForeColor = If(e.Row.DataKey("Octubre").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLOctubre").ForeColor) + e.Row.FCHyperLink("HLNoviembre").ForeColor = If(e.Row.DataKey("Noviembre").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLNoviembre").ForeColor) + e.Row.FCHyperLink("HLDiciembre").ForeColor = If(e.Row.DataKey("Diciembre").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLDiciembre").ForeColor) If e.Row.DBCampo("ImporteAcumulado").ToString.ToDouble < 0 Then - e.Row.FCHyperLink("HLAnterior").ForeColor = Drawing.Color.Red - End If - End If + e.Row.FCHyperLink("HLAnterior").ForeColor = Drawing.Color.Red + End If + + End If + End Sub Protected Sub GvGastosMesH_RowDataBound(sender As Object, e As GridViewRowEventArgs) @@ -786,6 +892,9 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal Dim CveCuenta As Integer = e.Row.DataKey("CveCuenta").ToEntero + 'e.Row.FCHyperLink("HLNombre").NavigateUrl = $"./RepAnexoCatalogoMensualHorizontal.aspx?CveCuenta={e.Row.DBCampo("CveCuenta").ToString}&FF=31/12/{DdlEjercicio.SelectedValue}&FI=01/01/{DdlEjercicio.SelectedValue}&ER=1" + e.Row.FCHyperLink("HLNombre").NavigateUrl = $"./RepAnexoCatalogoMensual.aspx?CveCuenta={e.Row.DBCampo("CveCuenta").ToString}&Ejercicio={DdlEjercicio.SelectedValue}&Divisor={DdlDivisor.SelectedValue}&CveSubProyecto=-1" + e.Row.FCHyperLink("HLEnero").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/01/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/01/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString) e.Row.FCHyperLink("HLFebrero").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/02/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/02/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString) e.Row.FCHyperLink("HLMarzo").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/03/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/03/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString) @@ -801,8 +910,59 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal e.Row.FCHyperLink("HLAnterior").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), e.Row.DBCampo("FechaFActual").ToDate.ToShortDateString, e.Row.DBCampo("FechaInicial").ToDate.ToShortDateString) - End If - + End If + + + + If e.Row.DBCampo("CtaMayor").ToString.ToEntero > 0 Or e.Row.DBCampo("Nombre") = "TOTAL GASTOS" Then + + If DdlDivisor.SelectedValue.ToEntero > 1 Then + + 'Enero,Febrero,Marzo,Abril,Mayo,Junio,Julio,Agosto,Septiembre,Octubre,Noviembre,Diciembre,PorcentajeAcumulado + e.Row.FCHyperLink("HLEnero").Text = e.Row.DataKey("Enero").ToDecimal.ToString("###,###,##0") + e.Row.FCHyperLink("HLFebrero").Text = e.Row.DataKey("Febrero").ToDecimal.ToString("###,###,##0") + e.Row.FCHyperLink("HLMarzo").Text = e.Row.DataKey("Marzo").ToDecimal.ToString("###,###,##0") + e.Row.FCHyperLink("HLAbril").Text = e.Row.DataKey("Abril").ToDecimal.ToString("###,###,##0") + e.Row.FCHyperLink("HLMayo").Text = e.Row.DataKey("Mayo").ToDecimal.ToString("###,###,##0") + e.Row.FCHyperLink("HLJunio").Text = e.Row.DataKey("Junio").ToDecimal.ToString("###,###,##0") + e.Row.FCHyperLink("HLJulio").Text = e.Row.DataKey("Julio").ToDecimal.ToString("###,###,##0") + e.Row.FCHyperLink("HLAgosto").Text = e.Row.DataKey("Agosto").ToDecimal.ToString("###,###,##0") + e.Row.FCHyperLink("HLSeptiembre").Text = e.Row.DataKey("Septiembre").ToDecimal.ToString("###,###,##0") + e.Row.FCHyperLink("HLOctubre").Text = e.Row.DataKey("Octubre").ToDecimal.ToString("###,###,##0") + e.Row.FCHyperLink("HLNoviembre").Text = e.Row.DataKey("Noviembre").ToDecimal.ToString("###,###,##0") + e.Row.FCHyperLink("HLDiciembre").Text = e.Row.DataKey("Diciembre").ToDecimal.ToString("###,###,##0") + + Else + e.Row.FCHyperLink("HLEnero").Text = e.Row.DataKey("Enero").ToDecimal.ToString("###,###,##0.00") + e.Row.FCHyperLink("HLFebrero").Text = e.Row.DataKey("Febrero").ToDecimal.ToString("###,###,##0.00") + e.Row.FCHyperLink("HLMarzo").Text = e.Row.DataKey("Marzo").ToDecimal.ToString("###,###,##0.00") + e.Row.FCHyperLink("HLAbril").Text = e.Row.DataKey("Abril").ToDecimal.ToString("###,###,##0.00") + e.Row.FCHyperLink("HLMayo").Text = e.Row.DataKey("Mayo").ToDecimal.ToString("###,###,##0.00") + e.Row.FCHyperLink("HLJunio").Text = e.Row.DataKey("Junio").ToDecimal.ToString("###,###,##0.00") + e.Row.FCHyperLink("HLJulio").Text = e.Row.DataKey("Julio").ToDecimal.ToString("###,###,##0.00") + e.Row.FCHyperLink("HLAgosto").Text = e.Row.DataKey("Agosto").ToDecimal.ToString("###,###,##0.00") + e.Row.FCHyperLink("HLSeptiembre").Text = e.Row.DataKey("Septiembre").ToDecimal.ToString("###,###,##0.00") + e.Row.FCHyperLink("HLOctubre").Text = e.Row.DataKey("Octubre").ToDecimal.ToString("###,###,##0.00") + e.Row.FCHyperLink("HLNoviembre").Text = e.Row.DataKey("Noviembre").ToDecimal.ToString("###,###,##0.00") + e.Row.FCHyperLink("HLDiciembre").Text = e.Row.DataKey("Diciembre").ToDecimal.ToString("###,###,##0.00") + End If + End If + + e.Row.FCHyperLink("HLEnero").ForeColor = If(e.Row.DataKey("Enero").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLEnero").ForeColor) + e.Row.FCHyperLink("HLFebrero").ForeColor = If(e.Row.DataKey("Febrero").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLFebrero").ForeColor) + e.Row.FCHyperLink("HLMarzo").ForeColor = If(e.Row.DataKey("Marzo").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLMarzo").ForeColor) + e.Row.FCHyperLink("HLAbril").ForeColor = If(e.Row.DataKey("Abril").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLAbril").ForeColor) + e.Row.FCHyperLink("HLMayo").ForeColor = If(e.Row.DataKey("Mayo").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLAbril").ForeColor) + e.Row.FCHyperLink("HLJunio").ForeColor = If(e.Row.DataKey("Junio").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLMayo").ForeColor) + e.Row.FCHyperLink("HLJulio").ForeColor = If(e.Row.DataKey("Julio").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLJulio").ForeColor) + e.Row.FCHyperLink("HLAgosto").ForeColor = If(e.Row.DataKey("Agosto").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLAgosto").ForeColor) + e.Row.FCHyperLink("HLSeptiembre").ForeColor = If(e.Row.DataKey("Septiembre").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLSeptiembre").ForeColor) + e.Row.FCHyperLink("HLOctubre").ForeColor = If(e.Row.DataKey("Octubre").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLOctubre").ForeColor) + e.Row.FCHyperLink("HLNoviembre").ForeColor = If(e.Row.DataKey("Noviembre").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLNoviembre").ForeColor) + e.Row.FCHyperLink("HLDiciembre").ForeColor = If(e.Row.DataKey("Diciembre").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLDiciembre").ForeColor) + + + If e.Row.DBCampo("ImporteAcumulado").ToString.ToDouble < 0 Then e.Row.FCHyperLink("HLAnterior").ForeColor = Drawing.Color.Red End If @@ -818,6 +978,52 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal If e.Row.RowType = DataControlRowType.DataRow Then e.Row.Attributes.Add("style", "Font-weight: bold") + + + If DdlDivisor.SelectedValue.ToEntero > 0 Then + + e.Row.FCHyperLink("HLEnero").Text = e.Row.DataKey("Enero").ToDecimal.ToString("###,###,##0") + e.Row.FCHyperLink("HLFebrero").Text = e.Row.DataKey("Febrero").ToDecimal.ToString("###,###,##0") + e.Row.FCHyperLink("HLMarzo").Text = e.Row.DataKey("Marzo").ToDecimal.ToString("###,###,##0") + e.Row.FCHyperLink("HLAbril").Text = e.Row.DataKey("Abril").ToDecimal.ToString("###,###,##0") + e.Row.FCHyperLink("HLMayo").Text = e.Row.DataKey("Mayo").ToDecimal.ToString("###,###,##0") + e.Row.FCHyperLink("HLJunio").Text = e.Row.DataKey("Junio").ToDecimal.ToString("###,###,##0") + e.Row.FCHyperLink("HLJulio").Text = e.Row.DataKey("Julio").ToDecimal.ToString("###,###,##0") + e.Row.FCHyperLink("HLAgosto").Text = e.Row.DataKey("Agosto").ToDecimal.ToString("###,###,##0") + e.Row.FCHyperLink("HLSeptiembre").Text = e.Row.DataKey("Septiembre").ToDecimal.ToString("###,###,##0") + e.Row.FCHyperLink("HLOctubre").Text = e.Row.DataKey("Octubre").ToDecimal.ToString("###,###,##0") + e.Row.FCHyperLink("HLNoviembre").Text = e.Row.DataKey("Noviembre").ToDecimal.ToString("###,###,##0") + e.Row.FCHyperLink("HLDiciembre").Text = e.Row.DataKey("Diciembre").ToDecimal.ToString("###,###,##0") + + Else + e.Row.FCHyperLink("HLEnero").Text = e.Row.DataKey("Enero").ToDecimal.ToString("###,###,##0.00") + e.Row.FCHyperLink("HLFebrero").Text = e.Row.DataKey("Febrero").ToDecimal.ToString("###,###,##0.00") + e.Row.FCHyperLink("HLMarzo").Text = e.Row.DataKey("Marzo").ToDecimal.ToString("###,###,##0.00") + e.Row.FCHyperLink("HLAbril").Text = e.Row.DataKey("Abril").ToDecimal.ToString("###,###,##0.00") + e.Row.FCHyperLink("HLMayo").Text = e.Row.DataKey("Mayo").ToDecimal.ToString("###,###,##0.00") + e.Row.FCHyperLink("HLJunio").Text = e.Row.DataKey("Junio").ToDecimal.ToString("###,###,##0.00") + e.Row.FCHyperLink("HLJulio").Text = e.Row.DataKey("Julio").ToDecimal.ToString("###,###,##0.00") + e.Row.FCHyperLink("HLAgosto").Text = e.Row.DataKey("Agosto").ToDecimal.ToString("###,###,##0.00") + e.Row.FCHyperLink("HLSeptiembre").Text = e.Row.DataKey("Septiembre").ToDecimal.ToString("###,###,##0.00") + e.Row.FCHyperLink("HLOctubre").Text = e.Row.DataKey("Octubre").ToDecimal.ToString("###,###,##0.00") + e.Row.FCHyperLink("HLNoviembre").Text = e.Row.DataKey("Noviembre").ToDecimal.ToString("###,###,##0.00") + e.Row.FCHyperLink("HLDiciembre").Text = e.Row.DataKey("Diciembre").ToDecimal.ToString("###,###,##0.00") + End If + + e.Row.FCHyperLink("HLEnero").ForeColor = If(e.Row.DataKey("Enero").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLEnero").ForeColor) + e.Row.FCHyperLink("HLFebrero").ForeColor = If(e.Row.DataKey("Febrero").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLFebrero").ForeColor) + e.Row.FCHyperLink("HLMarzo").ForeColor = If(e.Row.DataKey("Marzo").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLMarzo").ForeColor) + e.Row.FCHyperLink("HLAbril").ForeColor = If(e.Row.DataKey("Abril").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLAbril").ForeColor) + e.Row.FCHyperLink("HLMayo").ForeColor = If(e.Row.DataKey("Mayo").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLAbril").ForeColor) + e.Row.FCHyperLink("HLJunio").ForeColor = If(e.Row.DataKey("Junio").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLMayo").ForeColor) + e.Row.FCHyperLink("HLJulio").ForeColor = If(e.Row.DataKey("Julio").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLJulio").ForeColor) + e.Row.FCHyperLink("HLAgosto").ForeColor = If(e.Row.DataKey("Agosto").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLAgosto").ForeColor) + e.Row.FCHyperLink("HLSeptiembre").ForeColor = If(e.Row.DataKey("Septiembre").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLSeptiembre").ForeColor) + e.Row.FCHyperLink("HLOctubre").ForeColor = If(e.Row.DataKey("Octubre").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLOctubre").ForeColor) + e.Row.FCHyperLink("HLNoviembre").ForeColor = If(e.Row.DataKey("Noviembre").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLNoviembre").ForeColor) + e.Row.FCHyperLink("HLDiciembre").ForeColor = If(e.Row.DataKey("Diciembre").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLDiciembre").ForeColor) + + End If End Sub @@ -928,6 +1134,7 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal Row.Item("ImporteAcumulado") = DtIngresosAnualH.SUM("ImporteAcumulado", "NOT CtaMayor in (3,4)") 'TotalAnterior.ToString Row.Item("PorcentajeAcumulado") = "100.00" Row.Item("CtaMayor") = -1 + Row.Item("CountDinamico") = DtGastosAnualH.MAX("CountDinamico") DtIngresosAnualH.Rows.Add(Row) Else Row.Item("Nombre") = "TOTAL INGRESOS " @@ -989,7 +1196,9 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal IndexData = 13 For IndexData = 13 To IndexMax + Row.Item(IndexData) = DtGastosAnualH.SUM($"[{DtIngresosAnualH.Columns(IndexData).ColumnName}]", "Not CtaMayor In (3,4)") + Next Row.Item("Nombre") = "TOTAL GASTOS" @@ -998,6 +1207,7 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal Row.Item("ImporteAcumulado") = TotalAnterior.ToString Row.Item("PorcentajeAcumulado") = If(T2 > 0, (TotalAnterior * 100 / T2).ToString, "0").FormatoNumero Row.Item("CtaMayor") = -1 + Row.Item("CountDinamico") = DtGastosAnualH.MAX("CountDinamico") DtGastosAnualH.Rows.Add(Row) Else Row.Item("Nombre") = "TOTAL GASTOS" @@ -1018,11 +1228,8 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal Next Row.Item("Nombre") = "Resultados del Ejercicio" - 'Row.Item("ImporteActual") = TotalActual.ToString - 'Row.Item("PorcentajeActual") = "100.00" Row.Item("ImporteAcumulado") = DtIngresosAnualH.SUM($"ImporteAcumulado", "Not CtaMayor in (-1,3,4)") - DtGastosAnualH.SUM($"ImporteAcumulado", "Not CtaMayor in (-1,3,4)") - 'Row.Item("PorcentajeAcumulado") = "100.00" - 'Row.Item("CtaMayor") = -1 + DTTotalesAnualH.Rows.Add(Row) @@ -1062,19 +1269,37 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal Dim CveCuenta As Integer = e.Row.DataKey("CveCuenta").ToEntero Dim CveSubProyecto As Integer = e.Row.DataKey("CveSubProyecto").ToEntero + If e.Row.DBCampo("CtaMayor").ToString.ToEntero > 0 Then Dim CountDinamico As Integer = e.Row.DataKey("CountDinamico").ToEntero Dim IndiceInicio As Integer = 1 Dim IndiceMax As Integer = 1 + CountDinamico + For IndiceInicio = 1 To IndiceMax Dim Anio As String = CType(GvGastosAnualH.Columns(IndiceInicio), BoundField).DataField - Dim Importe As String = e.Row.Cells(IndiceInicio).Text - e.Row.Cells(IndiceInicio).Text = $"{Importe}" + Dim Importe As Decimal = e.Row.Cells(IndiceInicio).Text.ToDecimal + e.Row.Cells(IndiceInicio).Text = $"{ If(DdlDivisor.SelectedValue.ToEntero > 1, Importe.ToString("###,###,##0"), Importe.ToString("###,###,###.00")) }" + 'e.Row.Cells(IndiceInicio).ForeColor = If(Importe < 0, Drawing.Color.Red, e.Row.Cells(IndiceInicio).ForeColor) Next IndiceInicio e.Row.FCHyperLink("HLAnterior").NavigateUrl = $"./RepAnexoCatalogo.aspx?CveCuenta={CveCuenta}&FF=31/12/{DdlEjercicio2.SelectedValue}&FI=01/01/{DdlEjercicio.SelectedValue}&ER=1&CveSubProyecto={CveSubProyecto}" + + ElseIf e.Row.DBCampo("CtaMayor").ToString.ToEntero = -1 Then + + Dim CountDinamico As Integer = e.Row.DataKey("CountDinamico").ToEntero + Dim IndiceInicio As Integer = 1 + Dim IndiceMax As Integer = 1 + CountDinamico + + For IndiceInicio = 1 To IndiceMax + + Dim Importe As Decimal = e.Row.Cells(IndiceInicio).Text.ToDecimal + e.Row.Cells(IndiceInicio).Text = $"{ If(DdlDivisor.SelectedValue.ToEntero > 1, Importe.ToString("###,###,##0"), Importe.ToString("###,###,###.00")) }" + + Next IndiceInicio + + End If @@ -1108,11 +1333,26 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal Dim IndiceMax As Integer = 1 + CountDinamico For IndiceInicio = 1 To IndiceMax Dim Anio As String = CType(GvGastosAnualH.Columns(IndiceInicio), BoundField).DataField - Dim Importe As String = e.Row.Cells(IndiceInicio).Text - e.Row.Cells(IndiceInicio).Text = $"{Importe}" + Dim Importe As Decimal = e.Row.Cells(IndiceInicio).Text.ToDecimal + e.Row.Cells(IndiceInicio).Text = $"{If(DdlDivisor.SelectedValue.ToEntero > 1, Importe.ToString("###,###,##0"), Importe.ToString("###,###,###.00"))}" + 'e.Row.Cells(IndiceInicio).ForeColor = If(Importe < 0, Drawing.Color.Red, e.Row.Cells(IndiceInicio).ForeColor) Next IndiceInicio e.Row.FCHyperLink("HLAnterior").NavigateUrl = $"./RepAnexoCatalogo.aspx?CveCuenta={CveCuenta}&FF=31/12/{DdlEjercicio2.SelectedValue}&FI=01/01/{DdlEjercicio.SelectedValue}&ER=1&CveSubProyecto={CveSubProyecto}" + + ElseIf e.Row.DBCampo("CtaMayor").ToString.ToEntero = -1 Then + + Dim CountDinamico As Integer = e.Row.DataKey("CountDinamico").ToEntero + Dim IndiceInicio As Integer = 1 + Dim IndiceMax As Integer = 1 + CountDinamico + + For IndiceInicio = 1 To IndiceMax + + Dim Importe As Decimal = e.Row.Cells(IndiceInicio).Text.ToDecimal + e.Row.Cells(IndiceInicio).Text = $"{ If(DdlDivisor.SelectedValue.ToEntero > 1, Importe.ToString("###,###,##0"), Importe.ToString("###,###,###.00")) }" + + Next IndiceInicio + End If If e.Row.DBCampo("ImporteAcumulado").ToString.ToDouble < 0 Then @@ -1161,7 +1401,6 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal If DtDatosSubProyectoH IsNot Nothing And DTSubProyectosCabecerasH IsNot Nothing Then CargaGridsSubProyectoH() - SumaTotalesSubProyectoH() End If End Sub @@ -1186,9 +1425,6 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal If DtIngresosSubProyectoH.Rows.Count > 0 Then - - - For Each dCoumn As DataColumn In DtIngresosSubProyectoH.Columns If IndexData >= 13 Then @@ -1237,6 +1473,7 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal Row.Item("ImporteAcumulado") = DtIngresosSubProyectoH.SUM("ImporteAcumulado", "NOT CtaMayor in (3,4)") 'TotalAnterior.ToString Row.Item("PorcentajeAcumulado") = "100.00" Row.Item("CtaMayor") = -1 + Row.Item("CountDinamico") = DtIngresosSubProyectoH.MAX("CountDinamico") DtIngresosSubProyectoH.Rows.Add(Row) Else Row.Item("Nombre") = "TOTAL INGRESOS " @@ -1297,6 +1534,8 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal Row.Item("ImporteAcumulado") = TotalAnterior.ToString Row.Item("PorcentajeAcumulado") = If(T2 > 0, (TotalAnterior * 100 / T2).ToString, "0").FormatoNumero Row.Item("CtaMayor") = -1 + Row.Item("CountDinamico") = DtGastosSubProyectoH.MAX("CountDinamico") + DtGastosSubProyectoH.Rows.Add(Row) Else Row.Item("Nombre") = "TOTAL GASTOS" @@ -1310,19 +1549,15 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal Row = DTTotalesSubProyectoH.NewRow - - IndexData = 13 For IndexData = 13 To IndexTotatles Row.Item(IndexData) = DtIngresosSubProyectoH.SUM($"[{DtIngresosSubProyectoH.Columns(IndexData).ColumnName}]", "NOT CtaMayor in (-1,3,4)") - DtGastosSubProyectoH.SUM($"[{DtGastosSubProyectoH.Columns(IndexData).ColumnName}]", "NOT CtaMayor in (-1,3,4)") Next - Row.Item("Nombre") = "Totales:" - 'Row.Item("ImporteActual") = TotalActual.ToString - 'Row.Item("PorcentajeActual") = "100.00" + Row.Item("Nombre") = "Resultado del ejercicio" Row.Item("ImporteAcumulado") = DtIngresosSubProyectoH.SUM($"ImporteAcumulado", "NOT CtaMayor in (-1,3,4)") - DtGastosSubProyectoH.SUM($"ImporteAcumulado", "NOT CtaMayor in (-1,3,4)") - 'Row.Item("PorcentajeAcumulado") = "100.00" Row.Item("CtaMayor") = -2 + Row.Item("CountDinamico") = DtIngresosSubProyectoH.MAX("CountDinamico") DTTotalesSubProyectoH.Rows.Add(Row) @@ -1335,27 +1570,23 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal GvIngresosSubProyectoH.DataSource = DtIngresosSubProyectoH GvIngresosSubProyectoH.DataBind() - 'GvGastosSubProyectoH.DataSource = DtGastosSubProyectoH - 'GvGastosSubProyectoH.DataBind() - 'GvTotalesSubProyectoH.DataSource = DTTotalesSubProyectoH - 'GvTotalesSubProyectoH.DataBind() UpDatosSubProyectoH.Update() End Sub - Private Sub SumaTotalesSubProyectoH() - ''Llena Lb´s Totales - ''********************************************************************************* - 'LbTotalActual.Text = TotalActualMes.ToString.FormatoNumero - 'LbTotalAnterior.Text = TotalAnteriorMes.ToString.FormatoNumero + 'Private Sub SumaTotalesSubProyectoH() + ' ''Llena Lb´s Totales + ' ''********************************************************************************* + ' 'LbTotalActual.Text = TotalActualMes.ToString.FormatoNumero + ' 'LbTotalAnterior.Text = TotalAnteriorMes.ToString.FormatoNumero - 'LbTotalActual.ForeColor = If(TotalActualMes < 0, Drawing.Color.Red, Color.Black) - 'LbTotalAnterior.ForeColor = If(TotalAnteriorMes < 0, Drawing.Color.Red, Color.Black) + ' 'LbTotalActual.ForeColor = If(TotalActualMes < 0, Drawing.Color.Red, Color.Black) + ' 'LbTotalAnterior.ForeColor = If(TotalAnteriorMes < 0, Drawing.Color.Red, Color.Black) - End Sub + 'End Sub Protected Sub GvIngresosSubProyectoH_RowDataBound(sender As Object, e As GridViewRowEventArgs) @@ -1391,17 +1622,47 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal For IndiceInicio = 1 To IndiceMax Dim CveSubProyectoIntermo As String = CType(GvGastosSubProyectoH.Columns(IndiceInicio), BoundField).DataField - Dim Importe As String = e.Row.Cells(IndiceInicio).Text + Dim Importe As Decimal = e.Row.Cells(IndiceInicio).Text.ToDecimal + + e.Row.Cells(IndiceInicio).Text = $"{ If(DdlDivisor.SelectedValue.ToEntero > 1, Importe.ToString("###,###,##0"), Importe.ToString("###,###,###.00")) }" - - e.Row.Cells(IndiceInicio).Text = $"{Importe}" Next IndiceInicio e.Row.FCHyperLink("HLAnterior").NavigateUrl = $"./RepAnexoCatalogo.aspx?CveCuenta={CveCuenta}&FF={FEchaMesFinal.ToString("dd/MM/yyyy")}&FI=01/01/{DdlEjercicio.SelectedValue}&ER=1&CveSubProyecto={-1}" + ElseIf e.Row.DBCampo("CtaMayor").ToString.ToEntero = -1 Then + + Dim CountDinamico As Integer = e.Row.DataKey("CountDinamico").ToEntero + Dim IndiceInicio As Integer = 1 + Dim IndiceMax As Integer = 1 + CountDinamico + + For IndiceInicio = 1 To IndiceMax + + Dim Importe As Decimal = e.Row.Cells(IndiceInicio).Text.ToDecimal + e.Row.Cells(IndiceInicio).Text = $"
      { If(DdlDivisor.SelectedValue.ToEntero > 1, Importe.ToString("###,###,##0"), Importe.ToString("###,###,###.00")) }
      " + Next IndiceInicio + + + + ElseIf e.Row.DBCampo("CtaMayor").ToString.ToEntero = -2 Then + + Dim CountDinamico As Integer = e.Row.DataKey("CountDinamico").ToEntero + Dim IndiceInicio As Integer = 1 + Dim IndiceMax As Integer = 1 + CountDinamico + + For IndiceInicio = 1 To IndiceMax + + Dim Importe As Decimal = e.Row.Cells(IndiceInicio).Text.ToDecimal + e.Row.Cells(IndiceInicio).Text = $"
      { If(DdlDivisor.SelectedValue.ToEntero > 1, Importe.ToString("###,###,##0"), Importe.ToString("###,###,###.00")) }
      " + + Next IndiceInicio + + End If + e.Row.FCHyperLink("HLAnterior").Text = If(DdlDivisor.SelectedValue.ToEntero > 1, e.Row.DBCampo("ImporteAcumulado").ToString.ToDecimal.ToString("###,###,##0"), e.Row.DBCampo("ImporteAcumulado").ToString.ToDecimal.ToString("###,###,##0.00")) + If e.Row.DBCampo("ImporteAcumulado").ToString.ToDouble < 0 Then e.Row.FCHyperLink("HLAnterior").ForeColor = Drawing.Color.Red End If @@ -1414,22 +1675,13 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal If e.Row.DBCampo("CtaMayor").ToString.ToEntero < 0 Then TotalActualMes -= e.Row.DBCampo("ImporteActual").ToString.ToDouble TotalAnteriorMes -= 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 = "SubTotales" e.Row.ControlStyle.Font.Bold = True End If - 'If e.Row.DBCampo("CtaMayor").ToString.ToEntero > 0 Then - ' e.Row.FCHyperLink("HLActual").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), e.Row.DBCampo("FechaFActual").ToDate.ToShortDateString, e.Row.DBCampo("FechaInicial").ToDate.ToShortDateString) - ' e.Row.FCHyperLink("HLAnterior").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), e.Row.DBCampo("FechaFActual").ToDate.ToShortDateString, e.Row.DBCampo("FechaInicial").ToDate.ToShortDateString) - '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 @@ -1453,4 +1705,226 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal #End Region + + + +#Region "DESCARGA EXCEL" + + Private Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkExportar.Click + + Imprimir("Excel") + + End Sub + Private Sub Imprimir(Optional reporte As String = "PDF") + + + + If Tab.ActiveTabIndex = 0 Then + ExportToExcelG(GvIngresosMes, GvGastosMes, TMesT1, "Reporte_Mensual", UsuarioActual, "Mensual") + ElseIf Tab.ActiveTabIndex = 1 Then + ExportToExcelG(GvIngresosMesH, GvGastosMesH, TMesT1, "Reporte_Mensual_Horizontal", UsuarioActual, "Mensual Horizontal", Gv3:=GvTotalesMesH) + ElseIf Tab.ActiveTabIndex = 2 Then + ExportToExcelG(GvIngresosAnualH, GvGastosAnualH, TMesT1, "Reporte_Anual_Horizontal", UsuarioActual, "Anual Horizontal", Gv3:=GvTotalesAnualH) + + ElseIf Tab.ActiveTabIndex = 3 Then + ExportToExcelG(GvIngresosSubProyectoH, GvGastosSubProyectoH, TMesT1, "Reporte_Proyecto_Horizontal", UsuarioActual, "Proyecto Horizontal", Gv3:=GvTotalesSubProyectoH, EsPorSubProtyecto:=True) + + End If + + + + + End Sub + + 'Public Sub ExportToExcelG(Gv1 As GridView, Gv2 As GridView, NombreArchivoXLSx As String, Optional Titulo As String = "Reporte", Optional Usuario As Usuario = Nothing, Optional Filtros As String = "", Optional AlturaImagen As Double = 100, Optional AnchoImagen As Double = 100) + Public Sub ExportToExcelG(Gv1 As GridView, Gv2 As GridView, TablaResultados As HtmlTable, NombreArchivoXLSx As String, Usuario As Usuario, Titulo As String, Optional AlturaImagen As Double = 100, Optional AnchoImagen As Double = 100, Optional Gv3 As GridView = Nothing, Optional EsPorSubProtyecto As Boolean = False) + + Dim sw1 As New StringWriter() + Dim htw1 As New HtmlTextWriter(sw1) + Gv1.RenderControl(htw1) + + Dim sw2 As New StringWriter() + Dim htw2 As New HtmlTextWriter(sw2) + Gv2.RenderControl(htw2) + + + TablaResultados.Width = Gv2.Width.ToString + + Dim sw3 As New StringWriter() + Dim htw3 As New HtmlTextWriter(sw3) + TablaResultados.RenderControl(htw3) + + Dim options = GemBox.Spreadsheet.LoadOptions.HtmlDefault + + Dim htmlStream1 = New MemoryStream(options.Encoding.GetBytes(sw1.ToString())) + Dim htmlStream2 = New MemoryStream(options.Encoding.GetBytes(sw2.ToString())) + Dim htmlStream3 = New MemoryStream(options.Encoding.GetBytes(sw3.ToString())) + + htmlStream1.Position = 0 + Dim sr1 As New StreamReader(htmlStream1) + + htmlStream2.Position = 0 + Dim sr2 As New StreamReader(htmlStream2) + + htmlStream3.Position = 0 + Dim sr3 As New StreamReader(htmlStream3) + + + Dim myStr1 = sr1.ReadToEnd() + Dim myStr2 = sr2.ReadToEnd() + Dim myStr3 = sr3.ReadToEnd() + + sr1.Dispose() + sr2.Dispose() + sr3.Dispose() + + htmlStream1.Dispose() + htmlStream2.Dispose() + htmlStream3.Dispose() + + sw1.Dispose() + sw2.Dispose() + sw3.Dispose() + + If Gv3 IsNot Nothing Then + + Gv3.ShowHeader = False + + Dim sw4 As New StringWriter() + Dim htw4 As New HtmlTextWriter(sw4) + Gv3.RenderControl(htw4) + Dim htmlStream4 = New MemoryStream(options.Encoding.GetBytes(sw4.ToString())) + htmlStream4.Position = 0 + Dim sr4 As New StreamReader(htmlStream4) + myStr3 = sr4.ReadToEnd() + + sr4.Dispose() + htmlStream2.Dispose() + sw4.Dispose() + + End If + + + Dim HtmlCompleto As String = myStr1 & "
      " & myStr2 & "
      " & myStr3 + + Dim asd As String = "" + + + Dim htmlStream5 = New MemoryStream(options.Encoding.GetBytes(HtmlCompleto)) + + + + + GemBox.Spreadsheet.SpreadsheetInfo.SetLicense("ESWN-4QFD-26JF-1SZ8") + + Dim excel As GemBox.Spreadsheet.ExcelFile + 'Dim options = GemBox.Spreadsheet.LoadOptions.HtmlDefault + + 'Using htmlStream = New MemoryStream(options.Encoding.GetBytes(sw.ToString())) + ' excel = GemBox.Spreadsheet.ExcelFile.Load(htmlStream, options) + + excel = GemBox.Spreadsheet.ExcelFile.Load(htmlStream5, options) + + If Usuario IsNot Nothing Then + Dim TotalRowHeader As Integer = 8 + Dim TotalRowFooter As Integer = 2 + + Dim worksheet = excel.Worksheets(0) + worksheet.Rows.InsertEmpty(0, TotalRowHeader) + Dim celdasConTexto = worksheet.GetUsedCellRange(True) + celdasConTexto.Style.Font.Name = "Calibri Light" + + Dim RangoNombreEmpresa = worksheet.Cells.GetSubrangeAbsolute(1, celdasConTexto.FirstColumnIndex, 1, celdasConTexto.LastColumnIndex) + RangoNombreEmpresa.Merged = True + RangoNombreEmpresa.Value = Usuario.Empresa.Empresa + RangoNombreEmpresa.Style.Font.Size = 18 * 20 + RangoNombreEmpresa.Style.Font.Name = "Calibri Light" + RangoNombreEmpresa.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center + RangoNombreEmpresa.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center + + + 'Dim RangoFiltros = worksheet.Cells.GetSubrangeAbsolute(6, celdasConTexto.FirstColumnIndex, 6, celdasConTexto.LastColumnIndex) + 'RangoFiltros.Merged = True + 'RangoFiltros.Value = "Filtros" + 'RangoFiltros.Style.Font.Size = 15 * 20 + 'RangoFiltros.Style.Font.Name = "Calibri Light" + 'RangoFiltros.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Left + 'RangoFiltros.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center + + + Dim RangoTitulo = worksheet.Cells.GetSubrangeAbsolute(3, celdasConTexto.FirstColumnIndex, 3, celdasConTexto.LastColumnIndex) + RangoTitulo.Merged = True + RangoTitulo.Value = Titulo + RangoTitulo.Style.Font.Size = 20 * 20 + RangoTitulo.Style.Font.Name = "Calibri Light" + RangoTitulo.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center + RangoTitulo.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center + + For i = celdasConTexto.FirstColumnIndex To celdasConTexto.LastColumnIndex + worksheet.Rows(8).Cells(i).Style.Font.Size = 12 * 20 + worksheet.Rows(8).Cells(i).Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center + worksheet.Rows(8).Cells(i).Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center + + worksheet.Rows(8).Cells(i).Style.FillPattern.SetPattern(GemBox.Spreadsheet.FillPatternStyle.Solid, GemBox.Spreadsheet.SpreadsheetColor.FromArgb(75, 119, 190), GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255)) + worksheet.Rows(8).Cells(i).Style.Font.Color = GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255) + + + + If Not EsPorSubProtyecto Then + worksheet.Rows(8 + Gv1.Rows.Count + 2).Cells(i).Style.FillPattern.SetPattern(GemBox.Spreadsheet.FillPatternStyle.Solid, GemBox.Spreadsheet.SpreadsheetColor.FromArgb(75, 119, 190), GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255)) + worksheet.Rows(8 + Gv1.Rows.Count + 2).Cells(i).Style.Font.Color = GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255) + Else + worksheet.Rows(18).Cells(i).Style.FillPattern.SetPattern(GemBox.Spreadsheet.FillPatternStyle.Solid, GemBox.Spreadsheet.SpreadsheetColor.FromArgb(75, 119, 190), GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255)) + worksheet.Rows(18).Cells(i).Style.Font.Color = GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255) + End If + + + + If i > 0 Then + Try + worksheet.Columns(i).AutoFit(1) + Catch ex As Exception + End Try + End If + Next + + Dim IndexEndTable As Integer = Gv1.Rows.Count + Gv2.Rows.Count + 4 + TotalRowHeader + TotalRowFooter + + worksheet.Rows(IndexEndTable).Cells(0).Value = "Usuario Imprimió" + worksheet.Rows(IndexEndTable + 1).Cells(0).Value = Usuario.Nombre + + worksheet.Rows(IndexEndTable).Cells(2).Value = "Fecha Impresión" + worksheet.Rows(IndexEndTable + 1).Cells(2).Value = DateTime.Now.ToString("dd/MM/yyyy") + + Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", Usuario.Empresa.Ruta)) + + If Imagen.Exists Then + Dim Ruta As String = String.Format("{0}/Logo.png", Usuario.Empresa.Ruta) + Using sr As New StreamReader(Ruta) + Dim ms As New MemoryStream() + sr.BaseStream.CopyTo(ms) + worksheet.Pictures.Add(ms, ExcelPictureFormat.Png, "A1", AnchoImagen, AlturaImagen, LengthUnit.Pixel) + End Using + End If + + End If + + 'End Using + 'htw.Dispose() + + excel.Save(HttpContext.Current.Response, $"{NombreArchivoXLSx}.xlsx") + + + End Sub + + Public Overrides Sub VerifyRenderingInServerForm(ByVal control As Control) + End Sub + +#End Region + + + + + End Class + diff --git a/Inventarios/CatAlmacenes.aspx b/Inventarios/CatAlmacenes.aspx index 7d8dbc3fe..011c6115b 100644 --- a/Inventarios/CatAlmacenes.aspx +++ b/Inventarios/CatAlmacenes.aspx @@ -225,15 +225,15 @@ - +

      Resultados del Ejercicio:

      @@ -169,6 +171,7 @@