diff --git a/AF/AF.aspx.vb b/AF/AF.aspx.vb index 506741f34..f4cf2ee95 100644 --- a/AF/AF.aspx.vb +++ b/AF/AF.aspx.vb @@ -3652,11 +3652,12 @@ Partial Class AF_AF DivSeccion.Visible = CBool(drr("AplicaSeccion")) DdlSeccionAlmacen.Items.Clear() If CBool(drr("AplicaSeccion")) Then - Dim dtt As DataTable = GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, DdlAFInvAlmacen.SelectedValue.ToEntero, DdlAFInvPS.SelectedValue.ToEntero) - DdlSeccionAlmacen.DataSource = dtt - DdlSeccionAlmacen.DataBind() + CargaSeccionesAlmacen(DdlSeccionAlmacen, DdlAFInvAlmacen.SelectedValue.ToEntero, DdlAFInvPS.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) + 'Dim dtt As DataTable = GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, DdlAFInvAlmacen.SelectedValue.ToEntero, DdlAFInvPS.SelectedValue.ToEntero) + 'DdlSeccionAlmacen.DataSource = dtt + 'DdlSeccionAlmacen.DataBind() - dtt.Dispose() + 'dtt.Dispose() End If diff --git a/App_Code/ClsBancos.vb b/App_Code/ClsBancos.vb index 8990aaf81..93abdad57 100644 --- a/App_Code/ClsBancos.vb +++ b/App_Code/ClsBancos.vb @@ -4723,7 +4723,7 @@ Public Class ClsBancos strBody.AppendFormat(" ") - For Each dr As DataRow In DtResultados.FiltraParametros("CveConceptoContable IN (17) AND CveCompra > 0").Rows + For Each dr As DataRow In DtResultados.FiltraParametros("CveConceptoContable IN (17,312) AND CveCompra > 0").Rows strBody.AppendFormat(" ") strBody.AppendFormat(" {0}", dr("Fecha").ToString.ToDate.ToShortDateString()) strBody.AppendFormat(" {0}", dr("SerieFolio").ToString) diff --git a/App_Code/ClsClientes.vb b/App_Code/ClsClientes.vb index 9435c83d1..9d76674c8 100644 --- a/App_Code/ClsClientes.vb +++ b/App_Code/ClsClientes.vb @@ -930,9 +930,17 @@ Public Class ClsClientes Retorno = True Catch Ex1 As SqlException If Ex1.Message.Contains("Número: 2627;") Then - Alert("El Cliente no se guardo debido a que actualmente se encuentra registrado.", TipoMensaje.MsgAdvertencia) - ElseIf Ex1.Message.Contains("'UN_ClientesRFCEmpresa'") Then - Alert($"El Cliente no se guardo debido a que el RFC {RFC} se encuentra asignado a otro cliente.", TipoMensaje.MsgAdvertencia) + Alert("El Cliente no se guardo debido a que actualmente se encuentra registrado.", TipoMensaje.MsgAdvertencia) + ElseIf Ex1.Message.Contains("Número: 2601;") Then + + If Ex1.Message.Contains("UN_ClientesRFCEmpresa") Then + Alert($"El Cliente no se guardo debido a que el RFC {RFC} se encuentra asignado a otro cliente.", TipoMensaje.MsgAdvertencia) + End If + + If Ex1.Message.Contains("IND_Clientes_Codigo") Then + Alert("Ya existe un cliente registrado con el mismo Código.", TipoMensaje.MsgAdvertencia) + End If + Else Me.OnError("Ocurrió un error al intentar Actualizar los datos del Cliente.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End If diff --git a/App_Code/ClsContabilidad.vb b/App_Code/ClsContabilidad.vb index 202c993ec..b63588707 100644 --- a/App_Code/ClsContabilidad.vb +++ b/App_Code/ClsContabilidad.vb @@ -4096,7 +4096,7 @@ Public Class ClsContabilidad Return Retorno End Function - Public Function GetAnexoCatalogoMensual(CveCuenta As Integer, Ejercicio As Integer, CveSubproyecto As Integer, CveEmpresa As Integer) As Boolean + Public Function GetAnexoCatalogoMensual(CveCuenta As Integer, Ejercicio As Integer, CveSubproyecto As Integer, CveEmpresa As Integer, Divisor As Integer, CveUsuario As Integer) As Boolean Dim Retorno = False DataAdapter("PA_Conta_AnexoCatalogoMensualGet") @@ -4106,6 +4106,8 @@ Public Class ClsContabilidad .Add("@Ejercicio", SqlDbType.Int).Value = Ejercicio .Add("@CveSubproyecto", SqlDbType.Int).Value = CveSubproyecto .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Divisor", SqlDbType.Int).Value = Divisor + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario End With Try @@ -6176,6 +6178,34 @@ Public Class ClsContabilidad End Function + + Public Function GetAnexoCatalogoMensualHorizontal(IdCuenta As Integer, FechaI As Date, FechaF As Date, OpcionCuentas As Integer, CveSubProyecto As String, CveEmpresa As Integer, Optional TipoMovtos As Integer = -1, Optional SAT As Integer = 0) As Boolean + Dim Retorno = False + + DataAdapter("PA_Conta2_AnexoCatalogoMensualHorizontalGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@FechaI", SqlDbType.Date).Value = FechaI + .Add("@FechaF", SqlDbType.Date).Value = FechaF + .Add("@IdCuentaPadre", SqlDbType.Int).Value = IdCuenta + .Add("@Tipo", SqlDbType.Int).Value = TipoMovtos + .Add("@OpcionCuentas", SqlDbType.Int).Value = OpcionCuentas + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@SAT", SqlDbType.Int).Value = SAT + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + Me.OnError("Ocurrió un error al obtener el Anexo del Catalogo", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function GetEstadosAnualHorizontal(FechaI As Date, FechaF As Date, CveSubProyecto As Integer, Divisor As Integer, CveEmpresa As Integer, CveUsuario As Integer, Optional Tipo As Integer = 1) As Boolean Dim Retorno = False diff --git a/App_Code/ClsEdocumentacion.vb b/App_Code/ClsEdocumentacion.vb index 8ca3b451f..878dbc95b 100644 --- a/App_Code/ClsEdocumentacion.vb +++ b/App_Code/ClsEdocumentacion.vb @@ -505,9 +505,110 @@ Public Class ClsEdocumentacion ' Return Retorno ' End Function -#End Region +#End Region +#Region " P A R A M E T R O S " + + Public Function AddDocumentacionParametros(CveDocumentacion As Integer, Parametro As String, Descripcion As String, CveEmpresa As Integer, CveUsaurio As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Edoc_DocumentacionParametrosAdd") + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveDocumentacion", SqlDbType.Int).Value = CveDocumentacion + .Add("@Parametro", SqlDbType.VarChar).Value = Parametro + .Add("@Descripcion", SqlDbType.VarChar).Value = Descripcion + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveUsaurio", SqlDbType.Int).Value = CveUsaurio + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar el pa.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + + Public Function UpdateDocumentacionParametros(CveDocumentacionParametro As Integer, CveDocumentacion As Integer, Parametro As String, Descripcion As String, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Edoc_DocumentacionParametrosUpdate") + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveDocumentacionParametro", SqlDbType.Int).Value = CveDocumentacionParametro + .Add("@CveDocumentacion", SqlDbType.Int).Value = CveDocumentacion + .Add("@Parametro", SqlDbType.VarChar).Value = Parametro + .Add("@Descripcion", SqlDbType.VarChar).Value = Descripcion + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualiar el parametro.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function GetDocumentacionParametros(CveDocumentacionParametro As Integer, CveDocumentacion As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Edoc_DocumentacionParametrosGet") + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveDocumentacionParametro", SqlDbType.Int).Value = CveDocumentacionParametro + .Add("@CveDocumentacion", SqlDbType.Int).Value = CveDocumentacion + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al consultar los parametros.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + + Public Function RemoveDocumentacionParametros(CveDocumentacionParametro As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Edoc_DocumentacionParametrosRemove") + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveDocumentacionParametro", SqlDbType.Int).Value = CveDocumentacionParametro + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar el parametros.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + +#End Region #Region " IDisposable Support " ' IDisposable diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 72229e216..7cdb07053 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -4269,6 +4269,10 @@ Public Class ClsPaginas PaginaDict.Add("/Contabilidad2/PolizasImpresion.aspx".ToUpper(), 726) PaginaDict.Add("/Contabilidad2/RepEstadoResultadosHorizontal.aspx".ToUpper(), 420) + PaginaDict.Add("/Contabilidad2/RepAnexoCatalogoMensualHorizontal.aspx".ToUpper(), -1) + + + #End Region 'CONTRATOS #Region "Contratos" diff --git a/Compras/PopUpVerFactura.aspx.vb b/Compras/PopUpVerFactura.aspx.vb index 1c4f06b5f..3e8f29ec9 100644 --- a/Compras/PopUpVerFactura.aspx.vb +++ b/Compras/PopUpVerFactura.aspx.vb @@ -1327,7 +1327,7 @@ Partial Class PopUpVerFactura Dim CveTipoAlmacen As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveTipoAlmacen", $"CveAlmacen = {CveAlmacen}").ToString.ToEntero - If CveTipoAlmacen = 19 Or CveTipoAlmacen = 20 Then + If CveTipoAlmacen = 20 Then CveConcepto = 24 End If @@ -1341,7 +1341,7 @@ Partial Class PopUpVerFactura EstadoOrigen, PaisOrigen, CPOrigen, CalleDestino, NoExtDestino, ColoniaDestino, LocalidadDestino, MunicipioDestino, EstadoDestino, PaisDestino, CPDestino, FechaMovimiento, NombreCapturo, PuestoRecibio, PuestoEnrego, RazonSocial, ResponsableCarga, ResponsableRecibio, NombreCliente, - CantidadProductos:=CantidadProductos, CantidadUsados:=CantidadUsados) + CantidadProductos:=CantidadProductos, CantidadUsados:=CantidadUsados, CveTipoAlmacen:=CveTipoAlmacen) End Sub Private Sub PUanacExtr(CveMoneda As Integer) 'preciounitario a moneda nacional o extranjera @@ -1358,7 +1358,7 @@ Partial Class PopUpVerFactura Remision As String, Proveedor As String, CalleOrigen As String, NoExtOrigen As String, ColoniaOrigen As String, LocalidadOrigen As String, MunicipioOrigen As String, EstadoOrigen As String, PaisOrigen As String, CPOrigen As String, CalleDestino As String, NoExtDestino As String, ColoniaDestino As String, LocalidadDestino As String, MunicipioDestino As String, EstadoDestino As String, PaisDestino As String, CPDestino As String, FechaMovimiento As Date, NombreCapturo As String, PuestoRecibio As String, PuestoEntrego As String, - RazonSocial As String, ResponsableCarga As String, ResponsableRecibio As String, NombreCliente As String, Optional CantidadProductos As Decimal = 0, Optional CantidadUsados As Decimal = 0) + RazonSocial As String, ResponsableCarga As String, ResponsableRecibio As String, NombreCliente As String, Optional CantidadProductos As Decimal = 0, Optional CantidadUsados As Decimal = 0, Optional CveTipoAlmacen As Integer = -1) Select Case CveConcepto @@ -1445,6 +1445,7 @@ Partial Class PopUpVerFactura params.Add(New ReportParameter("Concepto", ConceptoFormato)) params.Add(New ReportParameter("Almacen", Almacen)) params.Add(New ReportParameter("FechaImpresion", DateTime.Now.ToString("dd/MM/yyyy"))) + params.Add(New ReportParameter("CveTipoAlmacen", Almacen)) params.Add(New ReportParameter("Folio", Folio)) params.Add(New ReportParameter("FacturaProveedor", If(CveCompra > 0, dr("SerieFolio").ToString, ""))) @@ -2460,19 +2461,19 @@ Partial Class PopUpVerFactura If (UsuarioActual.CveEmpresa = 72) Then params.Add(New ReportParameter("DomicilioFiscal", DomicilioFiscalCompu)) End If - ImprimirPDF(UsuarioActual.Empresa.Ruta & "Formatos/SalidasGarantia.rdlc", DtMovimientos, params, String.Format("SalidaGarantia{0}", Folio.ToString), RDSName:="DsInventarios") - 'Else - ' params.Add(New ReportParameter("Folio", Folio)) - ' params.Add(New ReportParameter("Fecha", Fecha)) - ' params.Add(New ReportParameter("Almacen", Almacen)) - ' params.Add(New ReportParameter("SubProyecto", SubProyecto)) - ' params.Add(New ReportParameter("Observaciones", Observaciones)) - ' params.Add(New ReportParameter("NombreEntrego", String.Format("ENTREGÓ{0}{1}", vbCrLf, Capturo))) - ' params.Add(New ReportParameter("NombreRecibio", String.Format("RECIBIÓ{0}{1}", vbCrLf, Recibio))) - ' ImprimirPDF(UsuarioActual.Empresa.Ruta & "Formatos/Salidas.rdlc", DtMovimientos, params, String.Format("Salida de Almacen - {0}", Folio.ToString), RDSName:="DsInventarios") - 'End If - - + ImprimirPDF(UsuarioActual.Empresa.Ruta & "Formatos/SalidasGarantia.rdlc", DtMovimientos, params, String.Format("SalidaGarantia{0}", Folio.ToString), RDSName:="DsInventarios") + 'Else + ' params.Add(New ReportParameter("Folio", Folio)) + ' params.Add(New ReportParameter("Fecha", Fecha)) + ' params.Add(New ReportParameter("Almacen", Almacen)) + ' params.Add(New ReportParameter("SubProyecto", SubProyecto)) + ' params.Add(New ReportParameter("Observaciones", Observaciones)) + ' params.Add(New ReportParameter("NombreEntrego", String.Format("ENTREGÓ{0}{1}", vbCrLf, Capturo))) + ' params.Add(New ReportParameter("NombreRecibio", String.Format("RECIBIÓ{0}{1}", vbCrLf, Recibio))) + ' ImprimirPDF(UsuarioActual.Empresa.Ruta & "Formatos/Salidas.rdlc", DtMovimientos, params, String.Format("Salida de Almacen - {0}", Folio.ToString), RDSName:="DsInventarios") + 'End If + + Case 18 'D E V O L U C I O N D E L C L I E N T E Dim Archivo As New System.IO.FileInfo(String.Format("{0}Formatos/DevolucionCliente.rdlc", UsuarioActual.Empresa.Ruta)) Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) @@ -2649,36 +2650,36 @@ Partial Class PopUpVerFactura ImprimirPDF(Archivo, DtMovimientos, params, String.Format("Salida por Prestamo - {0}", Folio.ToString), RDSName:="DsInventarios") ElseIf CveConcepto = 22 Then ImprimirPDF(Archivo, DtMovimientos, params, String.Format("Entrada por Prestamo - {0}", Folio.ToString), RDSName:="DsInventarios") - End If - - 'Case 22 'ENTRADA POR PRESTAMO - ' Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) - ' Dim params As New List(Of ReportParameter) - - ' Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) - ' If Imagen.Exists Then - ' params.Add(New ReportParameter("LogoPath", logouri)) - ' Else - ' params.Add(New ReportParameter("LogoPath", "")) - ' End If - - ' params.Add(New ReportParameter("Empresa", UsuarioActual.Empresa.Empresa)) - ' params.Add(New ReportParameter("Concepto", "Entrada por Prestamo")) - ' params.Add(New ReportParameter("Almacen", Almacen)) - ' params.Add(New ReportParameter("Fecha", Fecha)) - ' params.Add(New ReportParameter("FechaImpresion", DateTime.Now.ToString("dd/MM/yyyy"))) - ' params.Add(New ReportParameter("Folio", Folio)) - ' params.Add(New ReportParameter("Descuentos", "")) - ' params.Add(New ReportParameter("IVA", "")) - ' params.Add(New ReportParameter("Total", "")) - ' 'params.Add(New ReportParameter("NombreEntrego", String.Format("ENTREGÓ{0}{1}", vbCrLf, Capturo))) - ' params.Add(New ReportParameter("NombreRecibio", String.Format("RECIBIÓ{0}{1}", vbCrLf, Recibio))) - ' params.Add(New ReportParameter("FacturadoA", NombreCliente)) - ' If (UsuarioActual.CveEmpresa = 72) Then - ' params.Add(New ReportParameter("DomicilioFiscal", DomicilioFiscalCompu)) - ' End If - ' ImprimirPDF("Empresas/Grales/Formatos/EntradaSalida.rdlc", DtMovimientos, params, String.Format("Entrada por Prestamo - {0}", Folio.ToString), RDSName:="DsInventarios") - + End If + + 'Case 22 'ENTRADA POR PRESTAMO + ' Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) + ' Dim params As New List(Of ReportParameter) + + ' Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) + ' If Imagen.Exists Then + ' params.Add(New ReportParameter("LogoPath", logouri)) + ' Else + ' params.Add(New ReportParameter("LogoPath", "")) + ' End If + + ' params.Add(New ReportParameter("Empresa", UsuarioActual.Empresa.Empresa)) + ' params.Add(New ReportParameter("Concepto", "Entrada por Prestamo")) + ' params.Add(New ReportParameter("Almacen", Almacen)) + ' params.Add(New ReportParameter("Fecha", Fecha)) + ' params.Add(New ReportParameter("FechaImpresion", DateTime.Now.ToString("dd/MM/yyyy"))) + ' params.Add(New ReportParameter("Folio", Folio)) + ' params.Add(New ReportParameter("Descuentos", "")) + ' params.Add(New ReportParameter("IVA", "")) + ' params.Add(New ReportParameter("Total", "")) + ' 'params.Add(New ReportParameter("NombreEntrego", String.Format("ENTREGÓ{0}{1}", vbCrLf, Capturo))) + ' params.Add(New ReportParameter("NombreRecibio", String.Format("RECIBIÓ{0}{1}", vbCrLf, Recibio))) + ' params.Add(New ReportParameter("FacturadoA", NombreCliente)) + ' If (UsuarioActual.CveEmpresa = 72) Then + ' params.Add(New ReportParameter("DomicilioFiscal", DomicilioFiscalCompu)) + ' End If + ' ImprimirPDF("Empresas/Grales/Formatos/EntradaSalida.rdlc", DtMovimientos, params, String.Format("Entrada por Prestamo - {0}", Folio.ToString), RDSName:="DsInventarios") + Case 24 'SALIDA POR RESGUARDO If DtMovimientos(0)("CveTipoAlmacen").ToString.ToEntero = 20 Or DtMovimientos(0)("CveTipoAlmacen").ToString.ToEntero = 19 Then Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) @@ -3153,11 +3154,11 @@ Partial Class PopUpVerFactura If CveConcepto = 2 Then ElseIf CveConcepto = 3 Then End If - End Sub - - + End Sub + + #End Region - + #Region "OP = 'OC' - IMPRIME PDF OC" Private Sub ImprimePDFOC(CveOrdenCompra As Integer) Dim reporte As Byte() = NewGeneraBytesOC(CveOrdenCompra, ConBitacora:=(UsuarioActual.Empresa.Funcionalidad(119) = "1")) diff --git a/Contabilidad2/RepAnexoCatalogoMensual.aspx b/Contabilidad2/RepAnexoCatalogoMensual.aspx index cc4b98959..224507d7a 100644 --- a/Contabilidad2/RepAnexoCatalogoMensual.aspx +++ b/Contabilidad2/RepAnexoCatalogoMensual.aspx @@ -3,6 +3,11 @@ + 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/Empresas/72/Formatos/Entradas.rdlc b/Empresas/72/Formatos/Entradas.rdlc index 927878af3..8a86b04cd 100644 --- a/Empresas/72/Formatos/Entradas.rdlc +++ b/Empresas/72/Formatos/Entradas.rdlc @@ -6,19 +6,19 @@ - 1.60907cm + 1.24394cm 2.06688cm - 6.26873cm + 5.79535cm 2.82959cm - 1.67979cm + 2.51831cm 1.11844cm @@ -43,7 +43,7 @@ - CANTIDAD + CANT - SeccionAlmacen @@ -699,8 +701,8 @@ DsInventarios 0.17639cm 0.12931cm - 0.96717cm - 19.16933cm + 1.03773cm + 19.16934cm @@ -708,7 +710,7 @@ - 1.21412cm + 1.53162cm 0.17882cm 0cm 19.11979cm @@ -740,7 +742,7 @@ ImporteLetra - 0.73158in + 0.98158in 1.49813in 0.18861in 6.09975in @@ -853,7 +855,7 @@ DsInventarios - 1.31995cm + 1.95495cm 15.70179cm 0.46771cm 3.59684cm @@ -1047,11 +1049,14 @@ Textbox2 - 2.3622cm + 2.6797cm 0.18166cm - 2.46091cm + 2.14341cm 10.47411cm 2 + + =Not Parameters!CveTipoAlmacen.Value="19" + @@ -1168,9 +1173,9 @@ Textbox50 0.74112cm - 10.83216cm + 3.80525cm 1.86797cm - 8.38745cm + 15.41436cm 3

      Resultados del Ejercicio:

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