This commit is contained in:
Jorge Luis caudillo esparza
2025-04-12 14:45:45 -07:00
parent 594c36204e
commit 6369329464
2 changed files with 18 additions and 9 deletions

View File

@@ -64,7 +64,9 @@
max-width: 80px; max-width: 80px;
text-align: right; text-align: right;
} }
.ltlzip{
display:none !important;
}
a.sline { a.sline {
white-space: nowrap; white-space: nowrap;
} }
@@ -5295,9 +5297,6 @@
<span class="ltlzip"> <span class="ltlzip">
<asp:Literal ID="LtlZip" runat="server"></asp:Literal></span> <asp:Literal ID="LtlZip" runat="server"></asp:Literal></span>
</ContentTemplate> </ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="BtnGenerateXml" />
</Triggers>
</asp:UpdatePanel> </asp:UpdatePanel>
</asp:Content> </asp:Content>
<asp:Content ID="Content8" ContentPlaceHolderID="JS" runat="Server"> <asp:Content ID="Content8" ContentPlaceHolderID="JS" runat="Server">
@@ -5371,6 +5370,14 @@
document.body.removeChild(elem); document.body.removeChild(elem);
} }
} }
function SavezipB64(filename, base64Content) {
var link = document.createElement('a');
link.href = 'data:application/zip;base64,' + base64Content;
link.download = filename;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}
function Savezip(filename, data) { function Savezip(filename, data) {
var blob = new Blob([data], { type: 'application/zip' }); var blob = new Blob([data], { type: 'application/zip' });
if (window.navigator.msSaveOrOpenBlob) { if (window.navigator.msSaveOrOpenBlob) {

View File

@@ -9780,7 +9780,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
FileInfo file = new FileInfo(PathXML); FileInfo file = new FileInfo(PathXML);
if (!descargaZIP.Any(x => x.FileName.Contains(file.Name))) if (!descargaZIP.Any(x => x.FileName.Contains(file.Name)))
{ {
descargaZIP.AddFile(PathXML); descargaZIP.AddFile(PathXML,"");
} }
} }
@@ -9790,7 +9790,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
FileInfo file = new FileInfo(PathXMLF); FileInfo file = new FileInfo(PathXMLF);
if (!descargaZIP.Any(x => x.FileName.Contains(file.Name))) if (!descargaZIP.Any(x => x.FileName.Contains(file.Name)))
{ {
descargaZIP.AddFile(PathXMLF); descargaZIP.AddFile(PathXMLF, "");
} }
} }
@@ -9801,8 +9801,10 @@ public partial class Nomina_Nomina2 : ClsPaginas
descargaZIP.Save(PathZIP); descargaZIP.Save(PathZIP);
if (!string.IsNullOrEmpty(PathZIP) && System.IO.File.Exists(PathZIP)) if (!string.IsNullOrEmpty(PathZIP) && System.IO.File.Exists(PathZIP))
{ {
LtlZip.Text = System.IO.File.ReadAllText(PathZIP); byte[] fileBytes = System.IO.File.ReadAllBytes(PathZIP);
script = string.Format("Savezip(\"{0}.zip\", $('.ltlzip').html());", DdlPeriodo.SelectedItem.Text); string base64 = Convert.ToBase64String(fileBytes);
LtlZip.Text = base64;
script = string.Format("SavezipB64(\"{0}.zip\", $('.ltlzip').html());", DdlPeriodo.SelectedItem.Text);
System.IO.File.Delete(PathZIP); System.IO.File.Delete(PathZIP);
} }