before we could make e-invoice with any date we want and it effects to the qr code… now if i did e-invoice in a day ago it apears in qr code now
Saudi Arabia
@mortada_ahmed, you did not even tell us what country you are in.
@Tut Saudi Arabia
Maybe you accidentally updated the invoice,
I saw the date the QRcode was taken from the Timestamp.
And the timestamp seems to change according to the last time the invoice was updated.
how i can remove this time stamp
If we remove the Timestamp, the date on Qrcode will be the date when the Invoice was opened. The best way, never update the invoice.
i understand you but if i need to make invoice in a month ago how we can do it
It seems like a lot of questions are related to this.
Maybe this method could be a solution.
Create a new Footer - Sales invoice. Give it a name, and Paste the following Script
<script>
document.addEventListener('DOMContentLoaded', () => {
var buffer = '';
function appendTLV(tag, text) {
buffer += String.fromCharCode(tag);
buffer += String.fromCharCode(text.length);
buffer += text;
}
var businessName = 'No name';
var businessNameElement = document.getElementById('BusinessName');
if (businessNameElement != null) businessName = unescape(encodeURIComponent(businessNameElement.innerText));
var vatNumber = '0000000000000';
var vatNumberElement = document.getElementById('d96d97e8-c857-42c6-8360-443c06a13de9');
if (vatNumberElement != null) vatNumber = unescape(encodeURIComponent(vatNumberElement.innerText));
var timestamp = '';
var timestampElement = document.getElementById("InvoiceDate");
var dateString = (timestampElement && timestampElement.innerText.trim()) || '';
if (dateString !== '') {
// Parse the date string "dd/MM/yyyy"
var [day, month, year] = dateString.split('/');
// Construct the custom date string in "yyyy-MM-ddT00:00:00.000Z" format
timestamp = `${year}-${month}-${day}T00:00:00.000Z`;
}
var total = 0;
var totalElement = document.getElementById('Total');
if (totalElement != null) total = parseFloat(totalElement.getAttribute('data-value'));
var vat = 0;
var taxAmounts = document.getElementsByClassName('taxAmount');
for (var i = 0; i < taxAmounts.length; i++) {
vat += parseFloat(taxAmounts[i].getAttribute('data-value'));
}
appendTLV('1', businessName);
appendTLV('2', vatNumber);
appendTLV('3', timestamp); // Use the custom timestamp string
appendTLV('4', total.toFixed(2));
appendTLV('5', vat.toFixed(2));
var mainTable = document.querySelector('#printable-content > table');
if (mainTable) {
var newRow = mainTable.insertRow();
var newCell = newRow.insertCell();
newCell.colSpan = 99;
newCell.innerHTML += '<div id="myqrcode" style="padding: 20px"></div>';
}
new QRCode(document.getElementById("myqrcode"), {
text: btoa(buffer),
width: 128,
height: 128,
colorDark: "#000000",
colorLight: "#ffffff",
correctLevel: QRCode.CorrectLevel.L
});
var qrcodeDiv = document.getElementById('qrcode');
if (qrcodeDiv) {
qrcodeDiv.remove();
}
});
</script>
Make sure the date format you use in the Application Manager matches the date format in the Script. you can customize this part
if (dateString !== '') {
// Parse the date string "dd/MM/yyyy"
var [day, month, year] = dateString.split('/');
// Construct the custom date string in "yyyy-MM-ddT00:00:00.000Z" format
timestamp = `${year}-${month}-${day}T00:00:00.000Z`;
}
Save the Footer, and add this Footer to your Invoice.
The generated qrcode should use the Invoice date. but with Time T00:00:00.000Z.