This commit is contained in:
2023-03-18 10:00:30 -07:00
6 changed files with 179 additions and 24 deletions

View File

@@ -1963,10 +1963,12 @@ Public Class ClsPaginas
End Using End Using
End If End If
GlobalDTTipoPeriodo = DirectCast(HttpContext.Current.Application(AppNombre), DataTable) GlobalDTTipoPeriodo = DirectCast(HttpContext.Current.Application(AppNombre), DataTable)
End Get End Get
Set(value As DataTable) Set(value As DataTable)
Dim AppNombre As String = "GlobalDTTipoPeriodo" Dim AppNombre As String = "GlobalDTTipoPeriodo"
HttpContext.Current.Application(AppNombre) = value HttpContext.Current.Application(AppNombre) = value
End Set End Set
End Property End Property
'Fin TipoPeriodo 'Fin TipoPeriodo
@@ -3794,7 +3796,7 @@ Public Class ClsPaginas
End Property End Property
#End Region #End Region
#Region "*********** D T - C O M B U S T I B L E S ***********" #Region "*********** D T - C O M B U S T I B L E S ***********"
Public Shared Property GlobalDTCombustibles(CveEmpresa As Integer) As DataTable Public Shared Property GlobalDTCombustibles(CveEmpresa As Integer) As DataTable
Get Get
Dim AppNombre As String = $"GlobalDTCombustibles-{CveEmpresa}" Dim AppNombre As String = $"GlobalDTCombustibles-{CveEmpresa}"
'sino existe, recarga los datos 'sino existe, recarga los datos

View File

@@ -10,6 +10,9 @@ using Microsoft.Reporting.WebForms;
using System.Activities.Expressions; using System.Activities.Expressions;
using System.Text; using System.Text;
using System.IO; using System.IO;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using System.Diagnostics;
public partial class Contabilidad_RepIVA : ClsPaginas public partial class Contabilidad_RepIVA : ClsPaginas
{ {
@@ -245,7 +248,11 @@ public partial class Contabilidad_RepIVA : ClsPaginas
}else }else
{ {
Ruta = ModExtensiones.DirectorioBaseEmpresas + $@"Empresas\Grales\Formatos\{Formato}"; 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(); Ruta.GuardaLogAD();
//ImprimirbytesPDF(ImprimirPDFCrystal(Ruta, Dt, para, "Reporte de IVA", Opcion), "Reporte de IVA", Opcion); //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<CrystalParametro> 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;
//}
} }

Binary file not shown.

View File

@@ -779,6 +779,10 @@ Partial Class RH_Reclutamiento
Try Try
Dim dt As DataTable = GlobalDTTipoPeriodo()
HdfEmpresa.Value = UsuarioActual.CveEmpresa.ToString HdfEmpresa.Value = UsuarioActual.CveEmpresa.ToString
If Page.ClientQueryString.Contains("CvePersonal") Then If Page.ClientQueryString.Contains("CvePersonal") Then

View File

@@ -705,31 +705,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 TextoError = "" And TxtBDContPAQi.Text.Trim <> "" And TxtBDContPAQi.Text.Trim <> "" And TxtBDContPAQi.Text.Trim <> "" And TxtBDContPAQi.Text.Trim <> "" Then
If UsuarioActual.Empresa.UsaContabilidad 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 ObjContPAQ = New ClsContPAQi(Empresa)
'ADD
If BDContPAQ = "" Then If ObjContPAQ.Conectado Then
If Not ObjContPAQ.TRIGGER(TxtBDContPAQi.Text.Trim) Then 'ADD
TextoError = "Los datos de conexion al servidor de contabilidad son incorrectos" 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
End If
'UPDATE 'UPDATE
If BDContPAQ <> "" And (BDContPAQ <> TxtBDContPAQi.Text.Trim Or ServerContPAQ <> TxtServerContPAQi.Text.Trim) Then If BDContPAQ <> "" And (BDContPAQ <> TxtBDContPAQi.Text.Trim Or ServerContPAQ <> TxtServerContPAQi.Text.Trim) Then
If Not ObjContPAQ.TRIGGER(TxtBDContPAQi.Text.Trim) Then If Not ObjContPAQ.TRIGGER(TxtBDContPAQi.Text.Trim) Then
TextoError = "Los datos de conexion al servidor de contabilidad son incorrectos" TextoError = "Los datos de conexion al servidor de contabilidad son incorrectos"
End If
End If End If
Else
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 End If
End If End If
Else Else
Alert("La empresa tiene la información para el uso de contabilidad pero no se tiene activada", TipoMensaje.MsgAdvertencia) Alert("La empresa tiene la información para el uso de contabilidad pero no se tiene activada", TipoMensaje.MsgAdvertencia)
End If End If
@@ -780,11 +784,16 @@ Partial Class Sistemas_Empresa
If ObjEmpresa.GetEmpresas(CveEmpresa, "-1", "-1", "-1", "-1") Then If ObjEmpresa.GetEmpresas(CveEmpresa, "-1", "-1", "-1", "-1") Then
Empresa = ObjEmpresa.Empresa Empresa = ObjEmpresa.Empresa
Dim ObjContabilidad As New ClsContPAQi(Empresa)
If ObjContabilidad.GetCuentas(-1, "-1", -1, IdPadre:=IdCuentaPadre) Then If Empresa.TipoContabilidad = 2 Then
DtCuentasContables = ObjContabilidad.DtResultados Dim ObjContabilidad As New ClsContPAQi(Empresa)
If ObjContabilidad.GetCuentas(-1, "-1", -1, IdPadre:=IdCuentaPadre) Then
DtCuentasContables = ObjContabilidad.DtResultados
End If
ObjContabilidad.Dispose()
End If End If
ObjContabilidad.Dispose()
End If End If
ObjEmpresa.Dispose() ObjEmpresa.Dispose()
@@ -1409,7 +1418,7 @@ Partial Class Sistemas_Empresa
Private Sub CargaCuentasIVA(ByRef ObjEmpresas As ClsSisEmpresas) Private Sub CargaCuentasIVA(ByRef ObjEmpresas As ClsSisEmpresas)
If ObjEmpresas.GetEmpresas(CveEmpresa, "-1", "-1", "-1", "-1") Then 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 'If ObjEmpresas.Empresa.TipoContabilidad = 2 Then
Dim Cuenta As New ClsContPAQi(ObjEmpresas.Empresa) Dim Cuenta As New ClsContPAQi(ObjEmpresas.Empresa)
@@ -1436,6 +1445,8 @@ Partial Class Sistemas_Empresa
Catch ex As Exception Catch ex As Exception
End Try End Try
End If End If
End If End If
'ObjEmpresas.Dispose() 'ObjEmpresas.Dispose()