-- nueva opción de descarga de xml timbrados. en acciones
This commit is contained in:
@@ -304,8 +304,11 @@
|
|||||||
<li>
|
<li>
|
||||||
<asp:LinkButton ID="LnkDownArchivosSua" OnClick="LnkDownArchivosSua_Click" runat="server"><i class="fa fa-download"></i> Descargar archivos SUA</asp:LinkButton>
|
<asp:LinkButton ID="LnkDownArchivosSua" OnClick="LnkDownArchivosSua_Click" runat="server"><i class="fa fa-download"></i> Descargar archivos SUA</asp:LinkButton>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<asp:HyperLink ID="HypXMLSTimbrados" Visible="false" onclick="GETXML(-1,-1)" NavigateUrl="#" runat="server"><i class="fa fa-download" aria-hidden="true"></i>Recibos timbrados XML</asp:HyperLink>
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<asp:HyperLink ID="HypPDFSTimbrados" Visible="false" onclick="GETPDF(-1,0)" NavigateUrl="#" runat="server"><i class="fa fa-download" aria-hidden="true"></i>Recibos timbrados</asp:HyperLink>
|
<asp:HyperLink ID="HypPDFSTimbrados" Visible="false" onclick="GETPDF(-1,0)" NavigateUrl="#" runat="server"><i class="fa fa-download" aria-hidden="true"></i>Recibos timbrados PDF</asp:HyperLink>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<asp:LinkButton ID="LnkProcesarModal" OnClick="LnkProcesarModal_Click" runat="server"><i class="fa fa-check"></i> Procesar archivo SUA EBA PDF</asp:LinkButton>
|
<asp:LinkButton ID="LnkProcesarModal" OnClick="LnkProcesarModal_Click" runat="server"><i class="fa fa-check"></i> Procesar archivo SUA EBA PDF</asp:LinkButton>
|
||||||
@@ -5293,6 +5296,8 @@
|
|||||||
<asp:Literal ID="LtlXml" runat="server"></asp:Literal></span>
|
<asp:Literal ID="LtlXml" runat="server"></asp:Literal></span>
|
||||||
<span class="ltlxmlfin">
|
<span class="ltlxmlfin">
|
||||||
<asp:Literal ID="LtlXmlfin" runat="server"></asp:Literal></span>
|
<asp:Literal ID="LtlXmlfin" runat="server"></asp:Literal></span>
|
||||||
|
<span class="ltlzip">
|
||||||
|
<asp:Literal ID="LtlZip" runat="server"></asp:Literal></span>
|
||||||
</ContentTemplate>
|
</ContentTemplate>
|
||||||
</asp:UpdatePanel>
|
</asp:UpdatePanel>
|
||||||
</asp:Content>
|
</asp:Content>
|
||||||
@@ -5367,6 +5372,20 @@
|
|||||||
document.body.removeChild(elem);
|
document.body.removeChild(elem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function Savezip(filename, data) {
|
||||||
|
var blob = new Blob([data], { type: 'application/zip' });
|
||||||
|
if (window.navigator.msSaveOrOpenBlob) {
|
||||||
|
window.navigator.msSaveBlob(blob, filename);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var elem = window.document.createElement('a');
|
||||||
|
elem.href = window.URL.createObjectURL(blob);
|
||||||
|
elem.download = filename;
|
||||||
|
document.body.appendChild(elem);
|
||||||
|
elem.click();
|
||||||
|
document.body.removeChild(elem);
|
||||||
|
}
|
||||||
|
}
|
||||||
function SaveCsv(filename, data) {
|
function SaveCsv(filename, data) {
|
||||||
var blob = new Blob([data], { type: 'text/csv' });
|
var blob = new Blob([data], { type: 'text/csv' });
|
||||||
if (window.navigator.msSaveOrOpenBlob) {
|
if (window.navigator.msSaveOrOpenBlob) {
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ using Modelos;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using iTextSharp.text.pdf.parser;
|
using iTextSharp.text.pdf.parser;
|
||||||
using Profact.TimbraCFDI40;
|
using Profact.TimbraCFDI40;
|
||||||
|
using Ionic.Zip;
|
||||||
|
|
||||||
public partial class Nomina_Nomina2 : ClsPaginas
|
public partial class Nomina_Nomina2 : ClsPaginas
|
||||||
{
|
{
|
||||||
@@ -555,6 +556,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
|||||||
}
|
}
|
||||||
private void CargaTiposPeriodo()
|
private void CargaTiposPeriodo()
|
||||||
{
|
{
|
||||||
|
set_GlobalDTTipoPeriodos(UsuarioActual.CveEmpresa, null);
|
||||||
DdlTipoPeriodo.DataSource = get_GlobalDTTipoPeriodos(UsuarioActual.CveEmpresa);
|
DdlTipoPeriodo.DataSource = get_GlobalDTTipoPeriodos(UsuarioActual.CveEmpresa);
|
||||||
DdlTipoPeriodoCM.DataSource = DdlTipoPeriodo.DataSource;
|
DdlTipoPeriodoCM.DataSource = DdlTipoPeriodo.DataSource;
|
||||||
DdlTipoPeriodoSim.DataSource = DdlTipoPeriodo.DataSource;
|
DdlTipoPeriodoSim.DataSource = DdlTipoPeriodo.DataSource;
|
||||||
@@ -627,6 +629,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
|||||||
FiltAgrupador = 1;
|
FiltAgrupador = 1;
|
||||||
CveTipoTrabajador = DdlTipoTrabajador.SelectedValue.ToEntero();
|
CveTipoTrabajador = DdlTipoTrabajador.SelectedValue.ToEntero();
|
||||||
HypPDFSTimbrados.Attributes.Add("onclick", string.Format("GETPDF({0},{1})", -1, FiltCvePeriodo));
|
HypPDFSTimbrados.Attributes.Add("onclick", string.Format("GETPDF({0},{1})", -1, FiltCvePeriodo));
|
||||||
|
HypXMLSTimbrados.Attributes.Add("onclick", string.Format("GETXML({0},{1})", -1, FiltCvePeriodo));
|
||||||
cargaDatos();
|
cargaDatos();
|
||||||
int empleados = 0;
|
int empleados = 0;
|
||||||
if (dtempleados != null && dtempleados.Rows.Count > 0)
|
if (dtempleados != null && dtempleados.Rows.Count > 0)
|
||||||
@@ -694,6 +697,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
|||||||
LnkPersonalizarNomina.Visible = true;
|
LnkPersonalizarNomina.Visible = true;
|
||||||
LnkFormatoFiscal.Visible = (UsuarioActual.CveEmpresa == 141 || UsuarioActual.CveRol == 1);
|
LnkFormatoFiscal.Visible = (UsuarioActual.CveEmpresa == 141 || UsuarioActual.CveRol == 1);
|
||||||
HypPDFSTimbrados.Visible = true;
|
HypPDFSTimbrados.Visible = true;
|
||||||
|
HypXMLSTimbrados.Visible = true;
|
||||||
if (objnom.GetNominaEmpleado(FiltCveProyecto, FiltCveSubProyecto, FiltCveTurno, FiltCvePeriodo, CveEmpresa, FiltAgrupador,
|
if (objnom.GetNominaEmpleado(FiltCveProyecto, FiltCveSubProyecto, FiltCveTurno, FiltCvePeriodo, CveEmpresa, FiltAgrupador,
|
||||||
DdlRegimenContratacion.SelectedValue.ToEntero(), CveTipoTrabajador: CveTipoTrabajador, Neto: ddlfiniquito.SelectedValue.ToEntero(),
|
DdlRegimenContratacion.SelectedValue.ToEntero(), CveTipoTrabajador: CveTipoTrabajador, Neto: ddlfiniquito.SelectedValue.ToEntero(),
|
||||||
CvePersonal: CvePersonal)
|
CvePersonal: CvePersonal)
|
||||||
@@ -9544,66 +9548,138 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
|||||||
string Xmlname = "";
|
string Xmlname = "";
|
||||||
string XmlnameF = "";
|
string XmlnameF = "";
|
||||||
string empleado = "";
|
string empleado = "";
|
||||||
DataRow dr = dtempleados.FiltroPrimero(string.Format("CvePersonal ={0}", TxtCvePersonal.Text.ToEntero()));
|
|
||||||
if (dr != null)
|
|
||||||
{
|
|
||||||
empleado = string.Format("{0} - {1}", dr["Codigo"], dr["Nombre"]);
|
|
||||||
}
|
|
||||||
using (ClsNominas ObjNomina = new ClsNominas())
|
|
||||||
{
|
|
||||||
if (ObjNomina.GetNom_Nominas(-1, TxtCvePersonal.Text.ToEntero(), TxtCvePeriodo.Text.ToEntero(), -1, UsuarioActual.CveEmpresa))
|
|
||||||
{
|
|
||||||
Ruta = UsuarioActual.Empresa.Ruta;
|
|
||||||
PathXML = $"{Ruta}XML\\Nomina\\{ObjNomina.SerieFolio}.xml";
|
|
||||||
PathXMLF = $"{Ruta}XML\\Nomina\\{ObjNomina.Serie}F-{ObjNomina.Folio}.xml";
|
|
||||||
Xmlname = ObjNomina.SerieFolio;
|
|
||||||
XmlnameF = $"{ObjNomina.Serie}F-{ObjNomina.Folio}";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
try
|
|
||||||
{
|
|
||||||
string script = "";
|
|
||||||
if (!string.IsNullOrEmpty(PathXML) && System.IO.File.Exists(PathXML))
|
|
||||||
{
|
|
||||||
LtlXml.Text = System.IO.File.ReadAllText(PathXML);
|
|
||||||
script = string.Format("Savexml(\"{0} {1}.xml\", $('.ltlxml').html());", Xmlname, empleado);
|
|
||||||
//System.IO.FileInfo file = new System.IO.FileInfo(PathXML);
|
|
||||||
//string mimeType = "text/plain";
|
|
||||||
//try
|
|
||||||
//{
|
|
||||||
// mimeType = MimeMapping.GetMimeMapping(PathXML);
|
|
||||||
//}
|
|
||||||
//catch (Exception)
|
|
||||||
//{
|
|
||||||
|
|
||||||
//}
|
Ruta = UsuarioActual.Empresa.Ruta;
|
||||||
//// Response.Write(path)
|
if (TxtCvePersonal.Text.ToEntero() != -1)
|
||||||
//Response.Clear();
|
{
|
||||||
//Response.ClearHeaders();
|
DataRow dr = dtempleados.FiltroPrimero(string.Format("CvePersonal ={0}", TxtCvePersonal.Text.ToEntero()));
|
||||||
//Response.ClearContent();
|
if (dr != null)
|
||||||
//Response.AddHeader("Content-Disposition", $"attachment; filename= {Uri.EscapeDataString(file.Name)}");
|
|
||||||
//Response.AddHeader("Content-Length", file.Length.ToString());
|
|
||||||
//Response.ContentType = mimeType;
|
|
||||||
//Response.Flush();
|
|
||||||
//Response.TransmitFile(file.FullName);
|
|
||||||
//Response.End();
|
|
||||||
}
|
|
||||||
if (!string.IsNullOrEmpty(PathXML) && System.IO.File.Exists(PathXMLF))
|
|
||||||
{
|
{
|
||||||
LtlXmlfin.Text = System.IO.File.ReadAllText(PathXMLF);
|
empleado = string.Format("{0} - {1}", dr["Codigo"], dr["Nombre"]);
|
||||||
script = string.Format("{1}Savexml(\"{0}(Indemnización) {2}.xml\", $('.ltlxmlfin').html());", Xmlname, script, empleado);
|
|
||||||
}
|
}
|
||||||
if (script.Trim().Length > 0)
|
using (ClsNominas ObjNomina = new ClsNominas())
|
||||||
{
|
{
|
||||||
RegistraScript(script);
|
if (ObjNomina.GetNom_Nominas(-1, TxtCvePersonal.Text.ToEntero(), TxtCvePeriodo.Text.ToEntero(), -1, UsuarioActual.CveEmpresa))
|
||||||
|
{
|
||||||
|
PathXML = $"{Ruta}XML\\Nomina\\{ObjNomina.SerieFolio}.xml";
|
||||||
|
PathXMLF = $"{Ruta}XML\\Nomina\\{ObjNomina.Serie}F-{ObjNomina.Folio}.xml";
|
||||||
|
Xmlname = ObjNomina.SerieFolio;
|
||||||
|
XmlnameF = $"{ObjNomina.Serie}F-{ObjNomina.Folio}";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
try
|
||||||
|
{
|
||||||
|
string script = "";
|
||||||
|
if (!string.IsNullOrEmpty(PathXML) && System.IO.File.Exists(PathXML))
|
||||||
|
{
|
||||||
|
LtlXml.Text = System.IO.File.ReadAllText(PathXML);
|
||||||
|
script = string.Format("Savexml(\"{0} {1}.xml\", $('.ltlxml').html());", Xmlname, empleado);
|
||||||
|
//System.IO.FileInfo file = new System.IO.FileInfo(PathXML);
|
||||||
|
//string mimeType = "text/plain";
|
||||||
|
//try
|
||||||
|
//{
|
||||||
|
// mimeType = MimeMapping.GetMimeMapping(PathXML);
|
||||||
|
//}
|
||||||
|
//catch (Exception)
|
||||||
|
//{
|
||||||
|
|
||||||
|
//}
|
||||||
|
//// Response.Write(path)
|
||||||
|
//Response.Clear();
|
||||||
|
//Response.ClearHeaders();
|
||||||
|
//Response.ClearContent();
|
||||||
|
//Response.AddHeader("Content-Disposition", $"attachment; filename= {Uri.EscapeDataString(file.Name)}");
|
||||||
|
//Response.AddHeader("Content-Length", file.Length.ToString());
|
||||||
|
//Response.ContentType = mimeType;
|
||||||
|
//Response.Flush();
|
||||||
|
//Response.TransmitFile(file.FullName);
|
||||||
|
//Response.End();
|
||||||
|
}
|
||||||
|
if (!string.IsNullOrEmpty(PathXMLF) && System.IO.File.Exists(PathXMLF))
|
||||||
|
{
|
||||||
|
LtlXmlfin.Text = System.IO.File.ReadAllText(PathXMLF);
|
||||||
|
script = string.Format("{1}Savexml(\"{0}(Indemnización) {2}.xml\", $('.ltlxmlfin').html());", Xmlname, script, empleado);
|
||||||
|
}
|
||||||
|
if (script.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
RegistraScript(script);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Alert("No se encontro el archivo");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
{
|
{
|
||||||
Alert("No se encontro el archivo");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception)
|
else
|
||||||
{
|
{
|
||||||
|
using (ClsNominas ObjNomina = new ClsNominas())
|
||||||
|
{
|
||||||
|
if (ObjNomina.GetNom_Nominas(-1, -1, TxtCvePeriodo.Text.ToEntero(), -1, UsuarioActual.CveEmpresa))
|
||||||
|
{
|
||||||
|
string script = "";
|
||||||
|
using (ZipFile descargaZIP = new ZipFile())
|
||||||
|
{
|
||||||
|
descargaZIP.UseZip64WhenSaving = Zip64Option.AsNecessary;
|
||||||
|
|
||||||
|
foreach (DataRow dbrow in ObjNomina.DtResultados.Rows)
|
||||||
|
{
|
||||||
|
Ruta = UsuarioActual.Empresa.Ruta;
|
||||||
|
PathXML = $"{Ruta}XML\\Nomina\\{dbrow["SerieFolio"].ToString()}.xml";
|
||||||
|
PathXMLF = $"{Ruta}XML\\Nomina\\{dbrow["Serie"].ToString()}F-{dbrow["Folio"].ToString()}.xml";
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(PathXML) && System.IO.File.Exists(PathXML))
|
||||||
|
{
|
||||||
|
|
||||||
|
FileInfo file = new FileInfo(PathXML);
|
||||||
|
if (!descargaZIP.Any(x => x.FileName.Contains(file.Name)))
|
||||||
|
{
|
||||||
|
descargaZIP.AddFile(PathXML);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if (!string.IsNullOrEmpty(PathXMLF) && System.IO.File.Exists(PathXMLF))
|
||||||
|
{
|
||||||
|
|
||||||
|
FileInfo file = new FileInfo(PathXMLF);
|
||||||
|
if (!descargaZIP.Any(x => x.FileName.Contains(file.Name)))
|
||||||
|
{
|
||||||
|
descargaZIP.AddFile(PathXMLF);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
String PathZIP = $"{Ruta}XML\\Nomina\\{TxtCvePeriodo.Text.ToEntero()}.zip";
|
||||||
|
descargaZIP.Save(PathZIP);
|
||||||
|
if (!string.IsNullOrEmpty(PathZIP) && System.IO.File.Exists(PathZIP))
|
||||||
|
{
|
||||||
|
LtlZip.Text = System.IO.File.ReadAllText(PathZIP);
|
||||||
|
script = string.Format("Savezip(\"{0}.zip\", $('.ltlzip').html());", DdlPeriodo.SelectedItem.Text);
|
||||||
|
System.IO.File.Delete(PathZIP);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (script.Trim().Length > 0)
|
||||||
|
{
|
||||||
|
RegistraScript(script);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Alert("No se encontro el archivo");
|
||||||
|
}
|
||||||
|
|
||||||
|
//Response.Clear();
|
||||||
|
//Response.AddHeader("Content-Disposition", "attachment; filename=ArchivosXML.zip");
|
||||||
|
//Response.ContentType = "application/zip";
|
||||||
|
//descargaZIP.Save(Response.OutputStream);
|
||||||
|
//Response.End();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -10704,7 +10780,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
|||||||
StringBuilder SbErrores = new StringBuilder();
|
StringBuilder SbErrores = new StringBuilder();
|
||||||
bool ErroresValidaciones = false;
|
bool ErroresValidaciones = false;
|
||||||
int modalidadnomina = 1;
|
int modalidadnomina = 1;
|
||||||
if (UsuarioActual.CveEmpresa.Contiene(189, 193, 195, 196, 197, 172, 173, 174)) modalidadnomina = 2;
|
if (UsuarioActual.CveEmpresa.Contiene(189, 193, 195, 196, 197, 172, 173,174)) modalidadnomina = 2;
|
||||||
|
|
||||||
SbErrores.AppendLine("Se detectaron los siguientes errores en la generación del layout:<br/>");
|
SbErrores.AppendLine("Se detectaron los siguientes errores en la generación del layout:<br/>");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user