Add VAT number handling in order processing and invoice templates
This commit is contained in:
BIN
assets/.DS_Store
vendored
BIN
assets/.DS_Store
vendored
Binary file not shown.
@@ -4559,6 +4559,7 @@ function transformOrderData(array $orderData): array {
|
||||
'country' => $firstRow['address_country'],
|
||||
'phone' => $firstRow['address_phone'],
|
||||
'language' => $firstRow['user_language'],
|
||||
'vat_number' => $firstRow['vat_number']
|
||||
],
|
||||
'products' => [],
|
||||
'invoice' => [
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
$payment_method = 'payment_method_'.$invoice_data['header']['payment_method'];
|
||||
|
||||
$message = '
|
||||
<!DOCTYPE html>
|
||||
@@ -30,11 +31,28 @@ $message = '
|
||||
5061 JR OISTERWIJK<br>
|
||||
Nederland
|
||||
</td>
|
||||
<td width="50%" style="vertical-align: top; text-align: right;">
|
||||
<!-- Contact details if needed -->
|
||||
<td width="50%" style="vertical-align: top; text-align: left;">
|
||||
<strong style="color: #2c5f5d; font-size: 14px;">contact-details</strong><br>
|
||||
Ralf Adams<br>
|
||||
+31 13 8221480<br>
|
||||
ralfadams@totalsafetysolutions.nl
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- Customer -->
|
||||
<table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%" style="margin-bottom: 25px;">
|
||||
<tr>
|
||||
<td width="50%" style="vertical-align: top; font-size: 13px; line-height: 1.5;">
|
||||
<strong style="color: #2c5f5d; font-size: 14px;">Customer</strong><br>
|
||||
'.$invoice_data['customer']['name'].'<br>
|
||||
'.$invoice_data['customer']['street'].'<br>
|
||||
'.$invoice_data['customer']['zip'].', '.$invoice_data['customer']['city'].'<br>
|
||||
'.$invoice_data['customer']['country'].'
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- Invoice Details -->
|
||||
<table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%" style="margin-bottom: 25px; font-size: 13px;">
|
||||
@@ -49,6 +67,10 @@ $message = '
|
||||
<td style="padding: 3px 0;"><strong>Invoice Number:</strong></td>
|
||||
<td style="padding: 3px 0;">' . htmlspecialchars($order_id) . '</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: 3px 0;"><strong>Your Vat Number:</strong></td>
|
||||
<td style="padding: 3px 0;">' . htmlspecialchars($invoice_data['customer']['vat_number'] ?? '') . '</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td width="50%" style="vertical-align: top; padding-left: 10px;">
|
||||
@@ -61,6 +83,10 @@ $message = '
|
||||
<td style="padding: 3px 0;"><strong>Order number:</strong></td>
|
||||
<td style="padding: 3px 0;">' . htmlspecialchars($order_id) . '</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: 3px 0;"><strong>Payment Methodr:</strong></td>
|
||||
<td style="padding: 3px 0;">' . (${$payment_method} ?? $invoice_data['header']['payment_method'] ). '</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
$payment_method = 'payment_method_'.$invoice_data['header']['payment_method'];
|
||||
|
||||
$pdf = '<!DOCTYPE html>
|
||||
<html lang="' . strtolower($language) . '">
|
||||
@@ -217,6 +218,20 @@ $pdf = '<!DOCTYPE html>
|
||||
<p>Nederland</p>
|
||||
</div>
|
||||
<div class="contact-details">
|
||||
<h3>contact-details</h3>
|
||||
<p>Ralf Adams</p>
|
||||
<p>+31 13 8221480</p>
|
||||
<p>ralfadams@totalsafetysolutions.nl</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="company-header">
|
||||
<div class="company-info">
|
||||
<h3>Customer</h3>
|
||||
<p>'.$invoice_data['customer']['name'].'</p>
|
||||
<p>'.$invoice_data['customer']['street'].'</p>
|
||||
<p>'.$invoice_data['customer']['zip'].', '.$invoice_data['customer']['city'].'</p>
|
||||
<p>'.$invoice_data['customer']['country'].'</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -230,6 +245,10 @@ $pdf = '<!DOCTYPE html>
|
||||
<div class="detail-label">Invoice Number</div>
|
||||
<div class="detail-value">: ' . htmlspecialchars($order_id) . '</div>
|
||||
</div>
|
||||
<div class="detail-row">
|
||||
<div class="detail-label">Your Vat Number</div>
|
||||
<div class="detail-value">: ' . htmlspecialchars($invoice_data['customer']['vat_number'] ?? '') . '</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="invoice-right">
|
||||
<div class="detail-row">
|
||||
@@ -240,6 +259,10 @@ $pdf = '<!DOCTYPE html>
|
||||
<div class="detail-label">Order number</div>
|
||||
<div class="detail-value">: ' . htmlspecialchars($order_id) . '</div>
|
||||
</div>
|
||||
<div class="detail-row">
|
||||
<div class="detail-label">Payment Method</div>
|
||||
<div class="detail-value">: ' . (${$payment_method} ?? $invoice_data['header']['payment_method'] ). '</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1280,6 +1280,11 @@ function showPaymentModal(option) {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label style="display: block; margin-bottom: 5px; color: #333; font-weight: 500;">VAT Number</label>
|
||||
<input type="text" name="vat_number" id="paymentVatNumber" placeholder="Optional" style="width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 4px; font-size: 14px;">
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label style="display: block; margin-bottom: 5px; color: #333; font-weight: 500;">Payment Method *</label>
|
||||
<select name="payment_method" required style="width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 4px; font-size: 14px;">
|
||||
@@ -1354,6 +1359,7 @@ function showPaymentModal(option) {
|
||||
if (customerData.address) document.getElementById("paymentAddress").value = customerData.address;
|
||||
if (customerData.city) document.getElementById("paymentCity").value = customerData.city;
|
||||
if (customerData.postal) document.getElementById("paymentPostal").value = customerData.postal;
|
||||
if (customerData.vat_number) document.getElementById("paymentVatNumber").value = customerData.vat_number;
|
||||
if (customerData.country) {
|
||||
document.getElementById("paymentCountry").value = customerData.country;
|
||||
updateTaxDisplay(); // Calculate tax based on saved country
|
||||
@@ -1392,6 +1398,7 @@ function showPaymentModal(option) {
|
||||
city: formData.get("city"),
|
||||
postal: formData.get("postal"),
|
||||
country: formData.get("country"),
|
||||
vat_number: formData.get("vat_number") || '',
|
||||
payment_method: paymentMethod,
|
||||
payment_provider: paymentProvider,
|
||||
version_id: option.version_id,
|
||||
@@ -1408,7 +1415,8 @@ function showPaymentModal(option) {
|
||||
address: paymentData.address,
|
||||
city: paymentData.city,
|
||||
postal: paymentData.postal,
|
||||
country: paymentData.country
|
||||
country: paymentData.country,
|
||||
vat_number: paymentData.vat_number
|
||||
}));
|
||||
|
||||
await processPayment(paymentData, option, modal);
|
||||
|
||||
Reference in New Issue
Block a user