diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 7cd0e04ae..d137c079e 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -1921,10 +1921,19 @@ Public Class ClsPaginas 'TipoPerioso Property GlobalDTTipoPeriodo() As DataTable Get + If HttpContext.Current.Application("GlobalDTTipoPeriodo") Is Nothing Then + Using ObjNom As New ClsNominas() + If ObjNom.GetTiposPeriodos() Then Application("GlobalDTTipoPeriodo") = ObjNom.DtResultados Else Application("GlobalDTTipoPeriodo") = Nothing + End Using + End If + GlobalDTTipoPeriodo = DirectCast(Application("GlobalDTTipoPeriodo"), DataTable) + End Get Set(value As DataTable) + Application("GlobalDTTipoPeriodo") = value + End Set End Property 'Fin TipoPeriodo diff --git a/Contabilidad/RepIVA.aspx.cs b/Contabilidad/RepIVA.aspx.cs index 4c8bbe71f..61cdc8e9e 100644 --- a/Contabilidad/RepIVA.aspx.cs +++ b/Contabilidad/RepIVA.aspx.cs @@ -10,6 +10,9 @@ using Microsoft.Reporting.WebForms; using System.Activities.Expressions; using System.Text; using System.IO; +using CrystalDecisions.CrystalReports.Engine; +using CrystalDecisions.Shared; +using System.Diagnostics; public partial class Contabilidad_RepIVA : ClsPaginas { @@ -245,7 +248,11 @@ public partial class Contabilidad_RepIVA : ClsPaginas }else { Ruta = ModExtensiones.DirectorioBaseEmpresas + $@"Empresas\Grales\Formatos\{Formato}"; - ImprimirbytesPDF(ImprimirSubRepPDFCrystal(Ruta,Dt,para, DtIEPSA,DtIVAA,"RepIEPSPorcentaje.rpt","RepIVAPorcentaje.rpt", "Reporte de IVA", Opcion), "Reporte de IVA", Opcion); + + + ImprimirbytesPDF(ImprimirSubRepPDFCrystal(Ruta, Dt, para, DtIEPSA, DtIVAA, "RepIEPSPorcentaje.rpt", "RepIVAPorcentaje.rpt", "Reporte de IVA", Opcion), "Reporte de IVA", Opcion); + + } Ruta.GuardaLogAD(); //ImprimirbytesPDF(ImprimirPDFCrystal(Ruta, Dt, para, "Reporte de IVA", Opcion), "Reporte de IVA", Opcion); @@ -398,4 +405,135 @@ public partial class Contabilidad_RepIVA : ClsPaginas } } } + + //public void IImprimirbytesPDF(byte[] bytes, string NombreArchivo = "Reporte", string Formato = "PDF", bool Descarga = false, string Content_Disposition = "attachment", string Extension = "") + //{ + // // limpio ReportViwer + // string mimeType = null; + // // If Descarga Then + // // Try + // // bytes = bytes + // // File.WriteAllBytes(String.Format("{0}PDF/whatever.gif", UsuarioActual.Empresa.Ruta), img) + // // Catch ex As Exception + // // If UsuarioActual.CveRol = 1 Then + // // Alert(ex.Message, TipoMensaje.MsgAdvertencia) + // // Else + // // Alert("Ocurrió un error al generar la descarga. Favor de contactar a soporte tecnico cod'IMPDFclspag'", TipoMensaje.MsgAdvertencia) + // // End If + // // End Try + // // End If + // try + // { + // bytes = bytes; + // //Response.Buffer = true; + // //Response.Clear(); + // //if (Formato == "PDF") + // // Response.ContentType = "application/pdf"; + // //else + // // Response.ContentType = mimeType; + // //Response.ClearHeaders(); + // //string fileExtension = ""; + // //if (!string.IsNullOrEmpty(Extension)) + // // fileExtension = Extension; + // //else + // // fileExtension = Formato == "PDF" ? "pdf" : "xls"; + // //Response.AddHeader("content-disposition", string.Format("{0}; filename=\"{1}.{2}\"", Content_Disposition, NombreArchivo, fileExtension)); + // //Response.BinaryWrite(bytes); // create the file + // //Response.Flush(); // send it to the client to download + // //bytes = null; + // //HttpContext.Current.Response.SuppressContent = true; + // //HttpContext.Current.ApplicationInstance.CompleteRequest(); + // Alert("ok"); + // } + // // HttpContext.Current.Response.End() + // catch (Exception ex) + // { + // if (UsuarioActual.CveRol == 1) { + + // } + // else + // Alert("Ocurrió un error al generar la descarga. Favor de contactar a soporte tecnico cod:'IMPDFclspag'", TipoMensaje.MsgAdvertencia); + // } + //} + + + //public byte[] IImprimirSubRepPDFCrystal(string RutaReporte, DataTable DataSource, List Parametros, DataTable DataSource1, DataTable DataSource2, string SubRep1, string SubRep2, string NombreArchivo = "Reporte", string Formato = "PDF", ReportDocument MR = null/* TODO Change to default(_) if this is not a reference type */) + //{ + // // limpio ReportViwer + // Stopwatch sw = Stopwatch.StartNew(); + + // if (MR == null) + // MR = new ReportDocument(); + // ReportDocument SR1 = new ReportDocument(); + // ReportDocument SR2 = new ReportDocument(); + // byte[] Bytes = null; + // ExportFormatType formatType = ExportFormatType.NoFormat; + // try + // { + // MR.Load(RutaReporte); + // SR1 = MR.OpenSubreport(SubRep1); + // SR2 = MR.OpenSubreport(SubRep2); + // MR.SetDataSource(DataSource); + // SR1.SetDataSource(DataSource1); + // SR2.SetDataSource(DataSource2); + // foreach (CrystalParametro item in Parametros) + // MR.SetParameterValue(item.Nombre, item.Valor); + // switch (Formato) + // { + // case "PDF": + // { + // formatType = ExportFormatType.PortableDocFormat; + // break; + // } + + // case "EXCEL": + // { + // formatType = ExportFormatType.Excel; + // break; + // } + // } + // System.IO.Stream Stream = MR.ExportToStream(formatType); + // BinaryReader BD = new BinaryReader(MR.ExportToStream(formatType)); + // Bytes = BD.ReadBytes(System.Convert.ToInt32(MR.ExportToStream(formatType).Length)); + // BD.Dispose(); + // Stream.Dispose(); + // } + // // Dim Buffer(CInt(Stream.Length)) As Byte + // // Bytes = Buffer + // // MR.ExportToHttpResponse(formatType, Response, True, NombreArchivo) + // catch (CrystalReportsException ex) + // { + // if(ex.Message != null) + // { + // Alert(ex.Message); + // } + // if (ex.InnerException != null) + // { + // Alert(ex.InnerException.Message); + // } + + // } + // // 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 (Exception ex) + // { + // //GuardaLog(ex.InnerException != null && ex.Message != null ? $"Error: {ex.InnerException.Message ?? ex.Message} | Descripcion: {ex.InnerException != null && ex.InnerException.InnerException != null && ex.InnerException.InnerException.Message != null ? ex.InnerException.InnerException.Message : ex.InnerException != null && ex.InnerException.Message != null ? ex.InnerException.Message : "Sin descripcion"} Ruta {RutaReporte}" : $"Sin descripción - Ruta {RutaReporte}"); + // if (ex.Message != null) + // { + // Alert(ex.Message); + // } + // if (ex.InnerException != null) + // { + // Alert(ex.InnerException.Message); + // } + // } + // sw.Stop(); + // if (sw.Elapsed.TotalSeconds > 10) + // // GuardaLog($"Reporte:{RutaReporte} | Tiempo Renderizado Milisegundos: {sw.ElapsedMilliseconds},Total Segundos: {sw.Elapsed.TotalSeconds} "); + // if (MR != null) + // MR.Dispose(); + // return Bytes; + //} + + } \ No newline at end of file diff --git a/Empresas/Grales/Formatos/RepIVA.rpt b/Empresas/Grales/Formatos/RepIVA.rpt index 213d81132..d89ea9c2f 100644 Binary files a/Empresas/Grales/Formatos/RepIVA.rpt and b/Empresas/Grales/Formatos/RepIVA.rpt differ diff --git a/Empresas/Grales/Formatos/RepIVAAcreditable.rpt b/Empresas/Grales/Formatos/RepIVAAcreditable.rpt index f24a98c61..1a6b0df11 100644 Binary files a/Empresas/Grales/Formatos/RepIVAAcreditable.rpt and b/Empresas/Grales/Formatos/RepIVAAcreditable.rpt differ diff --git a/Global.asax b/Global.asax index 92c7c2a8c..bc5c46baa 100644 --- a/Global.asax +++ b/Global.asax @@ -89,7 +89,7 @@ Using ObjNom As New ClsNominas() 'If ObjNom.GetConceptos(-1) Then Application("GlobalDTNomConceptos") = ObjNom.DtResultados Else Application("GlobalDTNomConceptos") = Nothing If ObjNom.GetConceptosFunciones() Then Application("GlobalDTNomConceptosFunciones") = ObjNom.DtResultados Else Application("GlobalDTNomConceptosFunciones") = Nothing - If ObjNom.GetTiposPeriodos() Then Application("GlobalDTTipoPeriodo") = ObjNom.DtResultados Else Application("GlobalDTTipoPeriodo") = Nothing + 'If ObjNom.GetTiposPeriodos() Then Application("GlobalDTTipoPeriodo") = ObjNom.DtResultados Else Application("GlobalDTTipoPeriodo") = Nothing If ObjNom.GetPeriodos(-1, -1, -1, -1, -1) Then Application("GlobalDTNominasPeriodos") = ObjNom.DtResultados Else Application("GlobalDTNominasPeriodos") = Nothing If ObjNom.GetBancos Then Application("GlobalDTNomSatBancos") = ObjNom.DtResultados Else Application("GlobalDTNomSatBancos") = Nothing If ObjNom.GetConceptos Then Application("GlobalDTNomSatConceptos") = ObjNom.DtResultados Else Application("GlobalDTNomSatConceptos") = Nothing diff --git a/RH/Reclutamiento.aspx.vb b/RH/Reclutamiento.aspx.vb index aa802fcca..a1e137583 100644 --- a/RH/Reclutamiento.aspx.vb +++ b/RH/Reclutamiento.aspx.vb @@ -779,6 +779,10 @@ Partial Class RH_Reclutamiento Try + Dim dt As DataTable = GlobalDTTipoPeriodo() + + + HdfEmpresa.Value = UsuarioActual.CveEmpresa.ToString If Page.ClientQueryString.Contains("CvePersonal") Then diff --git a/Sistemas/Empresa.aspx.vb b/Sistemas/Empresa.aspx.vb index 3b0e210b9..8ed21b71e 100644 --- a/Sistemas/Empresa.aspx.vb +++ b/Sistemas/Empresa.aspx.vb @@ -706,31 +706,35 @@ Partial Class Sistemas_Empresa If TextoError = "" And TxtBDContPAQi.Text.Trim <> "" And TxtBDContPAQi.Text.Trim <> "" And TxtBDContPAQi.Text.Trim <> "" And TxtBDContPAQi.Text.Trim <> "" Then If UsuarioActual.Empresa.UsaContabilidad Then - 'CREA OBJETO EMPRESA - If ObjEmpresas.GetEmpresas(TxtCveEmpresa.Text.ToEntero, "-1", "-1", "-1", "-1") Then - Dim Empresa As New Empresa - Empresa = ObjEmpresas.Empresa - ObjContPAQ = New ClsContPAQi(Empresa) + If UsuarioActual.Empresa.TipoContabilidad = 2 Then + 'CREA OBJETO EMPRESA + If ObjEmpresas.GetEmpresas(TxtCveEmpresa.Text.ToEntero, "-1", "-1", "-1", "-1") Then + Dim Empresa As New Empresa + Empresa = ObjEmpresas.Empresa - If ObjContPAQ.Conectado Then - 'ADD - If BDContPAQ = "" Then - If Not ObjContPAQ.TRIGGER(TxtBDContPAQi.Text.Trim) Then - TextoError = "Los datos de conexion al servidor de contabilidad son incorrectos" + ObjContPAQ = New ClsContPAQi(Empresa) + + If ObjContPAQ.Conectado Then + 'ADD + If BDContPAQ = "" Then + If Not ObjContPAQ.TRIGGER(TxtBDContPAQi.Text.Trim) Then + TextoError = "Los datos de conexion al servidor de contabilidad son incorrectos" + End If End If - End If - 'UPDATE - If BDContPAQ <> "" And (BDContPAQ <> TxtBDContPAQi.Text.Trim Or ServerContPAQ <> TxtServerContPAQi.Text.Trim) Then - If Not ObjContPAQ.TRIGGER(TxtBDContPAQi.Text.Trim) Then - TextoError = "Los datos de conexion al servidor de contabilidad son incorrectos" + 'UPDATE + If BDContPAQ <> "" And (BDContPAQ <> TxtBDContPAQi.Text.Trim Or ServerContPAQ <> TxtServerContPAQi.Text.Trim) Then + If Not ObjContPAQ.TRIGGER(TxtBDContPAQi.Text.Trim) Then + TextoError = "Los datos de conexion al servidor de contabilidad son incorrectos" + End If End If + Else + TextoError = "Los datos de conexion al servidor de contabilidad son incorrectos" End If - Else - TextoError = "Los datos de conexion al servidor de contabilidad son incorrectos" End If End If + Else Alert("La empresa tiene la información para el uso de contabilidad pero no se tiene activada", TipoMensaje.MsgAdvertencia) End If @@ -781,11 +785,16 @@ Partial Class Sistemas_Empresa If ObjEmpresa.GetEmpresas(CveEmpresa, "-1", "-1", "-1", "-1") Then Empresa = ObjEmpresa.Empresa - Dim ObjContabilidad As New ClsContPAQi(Empresa) - If ObjContabilidad.GetCuentas(-1, "-1", -1, IdPadre:=IdCuentaPadre) Then - DtCuentasContables = ObjContabilidad.DtResultados + + If Empresa.TipoContabilidad = 2 Then + Dim ObjContabilidad As New ClsContPAQi(Empresa) + If ObjContabilidad.GetCuentas(-1, "-1", -1, IdPadre:=IdCuentaPadre) Then + DtCuentasContables = ObjContabilidad.DtResultados + End If + ObjContabilidad.Dispose() End If - ObjContabilidad.Dispose() + + End If ObjEmpresa.Dispose() @@ -1410,7 +1419,7 @@ Partial Class Sistemas_Empresa Private Sub CargaCuentasIVA(ByRef ObjEmpresas As ClsSisEmpresas) If ObjEmpresas.GetEmpresas(CveEmpresa, "-1", "-1", "-1", "-1") Then - If ObjEmpresas.Empresa.UsaContabilidad Then + If ObjEmpresas.Empresa.UsaContabilidad And ObjEmpresas.Empresa.TipoContabilidad = 2 Then 'If ObjEmpresas.Empresa.TipoContabilidad = 2 Then Dim Cuenta As New ClsContPAQi(ObjEmpresas.Empresa) @@ -1437,6 +1446,8 @@ Partial Class Sistemas_Empresa Catch ex As Exception End Try End If + + End If 'ObjEmpresas.Dispose()