Initial setup - gitea
This commit is contained in:
26
PriorBankParser/download_receipt.js
Normal file
26
PriorBankParser/download_receipt.js
Normal file
@@ -0,0 +1,26 @@
|
||||
function downloadCSVFile() {
|
||||
|
||||
const data = [...document.querySelectorAll(".k-grid-content table[role='grid'] tbody tr")]
|
||||
.map(row => [...row.querySelectorAll("td, th")]
|
||||
.map(col => col.innerText)
|
||||
.reduce((a, b) =>
|
||||
`${a},${b}`)).reduce((a, b) => `${a}\r\n${b}`);
|
||||
|
||||
let fileName = document.querySelector('.filter-text span').innerHTML
|
||||
.replace('за период c ', 'receipts_')
|
||||
.replace(' по ', '_')
|
||||
.replaceAll('.', '-');
|
||||
|
||||
fileName = fileName + '.csv'
|
||||
|
||||
const csv_file = new Blob([data], {type: "text/csv"});
|
||||
const download_link = document.createElement("a");
|
||||
|
||||
download_link.download = fileName;
|
||||
download_link.href = window.URL.createObjectURL(csv_file);
|
||||
download_link.style.display = "none";
|
||||
document.body.appendChild(download_link);
|
||||
download_link.click();
|
||||
|
||||
return fileName;
|
||||
}
|
||||
Reference in New Issue
Block a user