diff --git a/commit_message.txt b/commit_message.txt
index bd60dfc..ceeae73 100644
--- a/commit_message.txt
+++ b/commit_message.txt
@@ -1,7 +1 @@
-Plan: Change the "Invite User" button text to "Add User" in the User Management page to make it more descriptive and match the modal's title.
-
-Changed:
-* `index.php`: Updated the button text and English localization attribute (`data-en`) from "Invite User" to "Add User".
-
-Next:
-Check out the User Management page to confirm the button now says "Add User". Let me know if you need anything else!
+feat: use outlet information for printed bills and receipts
diff --git a/fix_showreceipt.php b/fix_showreceipt.php
new file mode 100644
index 0000000..2b239cf
--- /dev/null
+++ b/fix_showreceipt.php
@@ -0,0 +1,26 @@
+";
+ const rca = document.getElementById('receiptCompanyAddress');
+ if(rca) rca.innerHTML = data.outlet_address ? data.outlet_address.replace(/\n/g, '
') : "= nl2br(htmlspecialchars($data['settings']['company_address'] ?? '')) ?>";
+
+ // Update labels for Purchase vs Sale
+JS;
+
+$replace = <<<'JS'
+ const rcn = document.getElementById('receiptCompanyName');
+ if(rcn) rcn.textContent = data.outlet_name || "= htmlspecialchars($data['settings']['company_name'] ?? 'Accounting System') ?>";
+ const rca = document.getElementById('receiptCompanyAddress');
+ if(rca) {
+ rca.textContent = data.outlet_address || "= nl2br(htmlspecialchars($data['settings']['company_address'] ?? '')) ?>".replace(/
/gi, '\n');
+ rca.style.whiteSpace = 'pre-line';
+ }
+
+ // Update labels for Purchase vs Sale
+JS;
+
+$content = str_replace($search, $replace, $content);
+file_put_contents('index.php', $content);
diff --git a/patch_lpoprint.php b/patch_lpoprint.php
new file mode 100644
index 0000000..7b6b910
--- /dev/null
+++ b/patch_lpoprint.php
@@ -0,0 +1,23 @@
+${companySettings.company_name || 'Your Company'}
+
+ ${companySettings.company_address || ''}
+ Phone: ${companySettings.company_phone || ''} | Email: ${companySettings.company_email || ''}
+ ${companySettings.tax_number ? `
TRN: ${companySettings.tax_number}` : ''}
+
+ ${data.outlet_address ? data.outlet_address.replace(/\n/g, '
') : (companySettings.company_address || '').replace(/\n/g, '
')}
+ Phone: ${data.outlet_phone || companySettings.company_phone || ''} | Email: ${companySettings.company_email || ''}
+ ${companySettings.tax_number ? `
TRN: ${companySettings.tax_number}` : ''}
+
= nl2br(htmlspecialchars($data['settings']['company_address'] ?? '')) ?>
+HTML; + +$replace = <<<'HTML' += nl2br(htmlspecialchars($data['settings']['company_address'] ?? '')) ?>
+HTML; + +$content = str_replace($search, $replace, $content); +file_put_contents('index.php', $content); diff --git a/patch_showreceipt.php b/patch_showreceipt.php new file mode 100644 index 0000000..ab79f6c --- /dev/null +++ b/patch_showreceipt.php @@ -0,0 +1,22 @@ +"; + const rca = document.getElementById('receiptCompanyAddress'); + if(rca) rca.innerHTML = data.outlet_address ? data.outlet_address.replace(/\n/g, 'VAT: ${companySettings.vat_number}
` : ''; + const companyPhone = companySettings.company_phone ? `Tel: ${companySettings.company_phone}
` : ''; +JS; + +$replace = <<<'JS' + const companyName = data.outlet_name || companySettings.company_name || 'Accounting System'; + const companyAddress = data.outlet_address ? data.outlet_address.replace(/\n/g, 'VAT: ${companySettings.vat_number}
` : ''; + const companyPhone = data.outlet_phone ? `Tel: ${data.outlet_phone}
` : (companySettings.company_phone ? `Tel: ${companySettings.company_phone}
` : ''); +JS; + +$content = str_replace($search, $replace, $content); +file_put_contents('index.php', $content); diff --git a/update_payment.php b/update_payment.php new file mode 100644 index 0000000..ea1de35 --- /dev/null +++ b/update_payment.php @@ -0,0 +1,21 @@ +prepare("SELECT p.*, i.customer_id, c.name as customer_name + FROM payments p + JOIN invoices i ON p.invoice_id = i.id + JOIN customers c ON i.customer_id = c.id + WHERE p.id = ?"); +SQL; +$replace = <<<'SQL' + $stmt = db()->prepare("SELECT p.*, i.customer_id, i.type as inv_type, i.id as inv_id, c.name as customer_name, + o.name as outlet_name, o.address as outlet_address, o.phone as outlet_phone + FROM payments p + JOIN invoices i ON p.invoice_id = i.id + LEFT JOIN customers c ON i.customer_id = c.id + LEFT JOIN outlets o ON i.outlet_id = o.id + WHERE p.id = ?"); +SQL; + +$content = str_replace($search, $replace, $content); +file_put_contents('index.php', $content); // oops wait, file_put_contents