formatos Rep iva generales recorregidos, GlobalDTTipoPeriodo

This commit is contained in:
Oscar Irigoyen
2023-03-17 18:33:23 -07:00
parent c0b827bd51
commit 50e09adb17
7 changed files with 186 additions and 24 deletions

View File

@@ -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

View File

@@ -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<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

@@ -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

View File

@@ -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

View File

@@ -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()