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;
text-align: right;
}
.ltlzip{
display:none !important;
}
a.sline {
white-space: nowrap;
}
@@ -5294,10 +5296,7 @@
<asp:Literal ID="LtlXmlfin" runat="server"></asp:Literal></span>
<span class="ltlzip">
<asp:Literal ID="LtlZip" runat="server"></asp:Literal></span>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="BtnGenerateXml" />
</Triggers>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
<asp:Content ID="Content8" ContentPlaceHolderID="JS" runat="Server">
@@ -5371,6 +5370,14 @@
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) {
var blob = new Blob([data], { type: 'application/zip' });
if (window.navigator.msSaveOrOpenBlob) {

View File

@@ -9780,7 +9780,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
FileInfo file = new FileInfo(PathXML);
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);
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);
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);
byte[] fileBytes = System.IO.File.ReadAllBytes(PathZIP);
string base64 = Convert.ToBase64String(fileBytes);
LtlZip.Text = base64;
script = string.Format("SavezipB64(\"{0}.zip\", $('.ltlzip').html());", DdlPeriodo.SelectedItem.Text);
System.IO.File.Delete(PathZIP);
}