Payment netto / brutto
This commit is contained in:
parent
b29ec1b4b5
commit
99fda694d1
@ -116,6 +116,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$address = $_POST['address'] ?? '';
|
||||
$city = $_POST['city'] ?? '';
|
||||
$zip_code = $_POST['zip_code'] ?? '';
|
||||
$language = $_POST['language'] ?? 'pl';
|
||||
|
||||
if (empty($name)) {
|
||||
$errorMessage = 'Nazwa klienta jest wymagana.';
|
||||
@ -123,36 +124,39 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
try {
|
||||
if ($isNewClient) {
|
||||
$credit_limit = (isset($_SESSION['user_role']) && $_SESSION['user_role'] === 'admin') ? ($_POST['credit_limit'] ?? 0) : 0;
|
||||
$stmt = $db->prepare("INSERT INTO clients (name, nip, street, city, postal_code, credit_limit, credit_balance) VALUES (:name, :tax_id, :address, :city, :zip_code, :credit_limit, :credit_limit)");
|
||||
$stmt = $db->prepare("INSERT INTO clients (name, nip, street, city, postal_code, language, credit_limit, credit_balance) VALUES (:name, :tax_id, :address, :city, :zip_code, :language, :credit_limit, :credit_limit)");
|
||||
$params = [
|
||||
'name' => $name,
|
||||
'tax_id' => $tax_id,
|
||||
'address' => $address,
|
||||
'city' => $city,
|
||||
'zip_code' => $zip_code,
|
||||
'language' => $language,
|
||||
'credit_limit' => $credit_limit
|
||||
];
|
||||
} else {
|
||||
if (isset($_SESSION['user_role']) && $_SESSION['user_role'] === 'admin') {
|
||||
$credit_limit = $_POST['credit_limit'] ?? $client['credit_limit'];
|
||||
$stmt = $db->prepare("UPDATE clients SET name = :name, nip = :tax_id, street = :address, city = :city, postal_code = :zip_code, credit_limit = :credit_limit WHERE id = :id");
|
||||
$stmt = $db->prepare("UPDATE clients SET name = :name, nip = :tax_id, street = :address, city = :city, postal_code = :zip_code, language = :language, credit_limit = :credit_limit WHERE id = :id");
|
||||
$params = [
|
||||
'name' => $name,
|
||||
'tax_id' => $tax_id,
|
||||
'address' => $address,
|
||||
'city' => $city,
|
||||
'zip_code' => $zip_code,
|
||||
'language' => $language,
|
||||
'credit_limit' => $credit_limit,
|
||||
'id' => $clientId
|
||||
];
|
||||
} else {
|
||||
$stmt = $db->prepare("UPDATE clients SET name = :name, nip = :tax_id, street = :address, city = :city, postal_code = :zip_code WHERE id = :id");
|
||||
$stmt = $db->prepare("UPDATE clients SET name = :name, nip = :tax_id, street = :address, city = :city, postal_code = :zip_code, language = :language WHERE id = :id");
|
||||
$params = [
|
||||
'name' => $name,
|
||||
'tax_id' => $tax_id,
|
||||
'address' => $address,
|
||||
'city' => $city,
|
||||
'zip_code' => $zip_code,
|
||||
'language' => $language,
|
||||
'id' => $clientId
|
||||
];
|
||||
}
|
||||
@ -218,6 +222,13 @@ $page_title = $pageTitle;
|
||||
<label for="city" class="form-label">Miasto</label>
|
||||
<input type="text" class="form-control" id="city" name="city" value="<?php echo htmlspecialchars($client['city'] ?? ''); ?>">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="language" class="form-label">Język</label>
|
||||
<select class="form-control" id="language" name="language">
|
||||
<option value="pl" <?php echo (($client['language'] ?? 'pl') === 'pl') ? 'selected' : ''; ?>>Polski</option>
|
||||
<option value="en" <?php echo (($client['language'] ?? '') === 'en') ? 'selected' : ''; ?>>Angielski</option>
|
||||
</select>
|
||||
</div>
|
||||
<?php if (isset($_SESSION['user_role']) && $_SESSION['user_role'] === 'admin'): ?>
|
||||
<div class="mb-3">
|
||||
<label for="credit_limit" class="form-label">Limit kredytu kupieckiego</label>
|
||||
|
||||
10
cart.php
10
cart.php
@ -22,6 +22,8 @@ if (!empty($cart)) {
|
||||
$stmt->execute($product_ids);
|
||||
$products = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
$lang = $_SESSION['lang'] ?? 'pl';
|
||||
|
||||
foreach ($products as $product) {
|
||||
$quantity = $cart[$product['id']];
|
||||
|
||||
@ -29,7 +31,7 @@ if (!empty($cart)) {
|
||||
$price_net = $price_info['net'];
|
||||
$price_gross = $price_info['gross'];
|
||||
|
||||
$line_total_gross = $price_gross * $quantity;
|
||||
$line_total = ($lang === 'en') ? ($price_net * $quantity) : ($price_gross * $quantity);
|
||||
|
||||
$cart_products[] = [
|
||||
'id' => $product['id'],
|
||||
@ -37,10 +39,10 @@ if (!empty($cart)) {
|
||||
'price_net' => $price_net,
|
||||
'price_gross' => $price_gross,
|
||||
'quantity' => $quantity,
|
||||
'line_total' => $line_total_gross,
|
||||
'line_total' => $line_total,
|
||||
];
|
||||
|
||||
$total_price += $line_total_gross;
|
||||
$total_price += $line_total;
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
die(t('db_connection_error') . $e->getMessage());
|
||||
@ -102,7 +104,7 @@ $user_role = get_user_role();
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="4" class="text-end"><strong><?= t('total_gross_label') ?></strong></td>
|
||||
<td colspan="4" class="text-end"><strong><?= ($lang === 'en') ? t('total_net_label') : t('total_gross_label') ?></strong></td>
|
||||
<td colspan="2"><strong><?= format_money($total_price, $_SESSION['lang'] ?? 'pl', $pdo) ?></strong></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
|
||||
@ -31,7 +31,9 @@ if (!empty($cart)) {
|
||||
$stmt->execute($product_ids);
|
||||
$products = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
$lang = $_SESSION['lang'] ?? 'pl';
|
||||
$is_supplier_delivery = false;
|
||||
|
||||
foreach ($products as $product) {
|
||||
$quantity = $cart[$product['id']];
|
||||
|
||||
@ -39,7 +41,8 @@ if (!empty($cart)) {
|
||||
$price_net = $price_info['net'];
|
||||
$price_gross = $price_info['gross'];
|
||||
|
||||
$line_total = $price_gross * $quantity;
|
||||
$line_total = ($lang === 'en') ? ($price_net * $quantity) : ($price_gross * $quantity);
|
||||
|
||||
$cart_products[] = [
|
||||
'id' => $product['id'],
|
||||
'name' => $product['name'],
|
||||
@ -87,7 +90,7 @@ require_once __DIR__ . '/includes/header.php';
|
||||
<th><?= t('quantity') ?></th>
|
||||
<th><?= t('price_net') ?></th>
|
||||
<th><?= t('price_gross') ?></th>
|
||||
<th><?= t('total_gross') ?></th>
|
||||
<th><?= ($lang === 'en') ? t('total_net') : t('total_gross') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -103,7 +106,7 @@ require_once __DIR__ . '/includes/header.php';
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="4" class="text-end"><strong><?= t('total_gross') ?>:</strong></td>
|
||||
<td colspan="4" class="text-end"><strong><?= ($lang === 'en') ? t('total_net') : t('total_gross') ?>:</strong></td>
|
||||
<td><strong><?= format_money($total_price, $_SESSION['lang'] ?? 'pl', $pdo) ?></strong></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
|
||||
477
debug_price.log
477
debug_price.log
@ -15179,3 +15179,480 @@ Client price query executed. Found: {"price_net":"837.40","price_gross":"1030.00
|
||||
Found client price. Net: 837.4, Gross: 1030
|
||||
FINAL: Returning Net: 837.4, Gross: 1030
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 1, client
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"1111.00","price_gross":"1366.53"}
|
||||
Found product price. Net: 1111, Gross: 1366.53
|
||||
FINAL: Returning Net: 1111, Gross: 1366.53
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 2, client
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"1318.05","price_gross":"1621.20"}
|
||||
Found product price. Net: 1318.05, Gross: 1621.2
|
||||
FINAL: Returning Net: 1318.05, Gross: 1621.2
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 3, client
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"}
|
||||
Found product price. Net: 9.95, Gross: 12.24
|
||||
FINAL: Returning Net: 9.95, Gross: 12.24
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 4, client
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"}
|
||||
Found product price. Net: 9.95, Gross: 12.24
|
||||
FINAL: Returning Net: 9.95, Gross: 12.24
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 5, client
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"}
|
||||
Found product price. Net: 68, Gross: 83.64
|
||||
FINAL: Returning Net: 68, Gross: 83.64
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 6, client
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"171.60","price_gross":"211.07"}
|
||||
Found product price. Net: 171.6, Gross: 211.07
|
||||
FINAL: Returning Net: 171.6, Gross: 211.07
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 7, client
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84"}
|
||||
Found product price. Net: 233.2, Gross: 286.84
|
||||
FINAL: Returning Net: 233.2, Gross: 286.84
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 1, client
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"1111.00","price_gross":"1366.53"}
|
||||
Found product price. Net: 1111, Gross: 1366.53
|
||||
FINAL: Returning Net: 1111, Gross: 1366.53
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 2, client
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"1318.05","price_gross":"1621.20"}
|
||||
Found product price. Net: 1318.05, Gross: 1621.2
|
||||
FINAL: Returning Net: 1318.05, Gross: 1621.2
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 3, client
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"}
|
||||
Found product price. Net: 9.95, Gross: 12.24
|
||||
FINAL: Returning Net: 9.95, Gross: 12.24
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 4, client
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"}
|
||||
Found product price. Net: 9.95, Gross: 12.24
|
||||
FINAL: Returning Net: 9.95, Gross: 12.24
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 5, client
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"}
|
||||
Found product price. Net: 68, Gross: 83.64
|
||||
FINAL: Returning Net: 68, Gross: 83.64
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 6, client
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"171.60","price_gross":"211.07"}
|
||||
Found product price. Net: 171.6, Gross: 211.07
|
||||
FINAL: Returning Net: 171.6, Gross: 211.07
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 7, client
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84"}
|
||||
Found product price. Net: 233.2, Gross: 286.84
|
||||
FINAL: Returning Net: 233.2, Gross: 286.84
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 1, client
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"1111.00","price_gross":"1366.53"}
|
||||
Found product price. Net: 1111, Gross: 1366.53
|
||||
FINAL: Returning Net: 1111, Gross: 1366.53
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 2, client
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"1318.05","price_gross":"1621.20"}
|
||||
Found product price. Net: 1318.05, Gross: 1621.2
|
||||
FINAL: Returning Net: 1318.05, Gross: 1621.2
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 3, client
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"}
|
||||
Found product price. Net: 9.95, Gross: 12.24
|
||||
FINAL: Returning Net: 9.95, Gross: 12.24
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 4, client
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"}
|
||||
Found product price. Net: 9.95, Gross: 12.24
|
||||
FINAL: Returning Net: 9.95, Gross: 12.24
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 5, client
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"}
|
||||
Found product price. Net: 68, Gross: 83.64
|
||||
FINAL: Returning Net: 68, Gross: 83.64
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 6, client
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"171.60","price_gross":"211.07"}
|
||||
Found product price. Net: 171.6, Gross: 211.07
|
||||
FINAL: Returning Net: 171.6, Gross: 211.07
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 7, client
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84"}
|
||||
Found product price. Net: 233.2, Gross: 286.84
|
||||
FINAL: Returning Net: 233.2, Gross: 286.84
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 1, client 1
|
||||
Client price query executed. Found: {"price_net":"837.40","price_gross":"1030.00"}
|
||||
Found client price. Net: 837.4, Gross: 1030
|
||||
FINAL: Returning Net: 837.4, Gross: 1030
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 2, client 1
|
||||
Client price query executed. Found: {"price_net":"1056.91","price_gross":"1300.00"}
|
||||
Found client price. Net: 1056.91, Gross: 1300
|
||||
FINAL: Returning Net: 1056.91, Gross: 1300
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 3, client 1
|
||||
Client price query executed. Found: {"price_net":"32.52","price_gross":"40.00"}
|
||||
Found client price. Net: 32.52, Gross: 40
|
||||
FINAL: Returning Net: 32.52, Gross: 40
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 4, client 1
|
||||
Client price query executed. Found: No
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"}
|
||||
Found product price. Net: 9.95, Gross: 12.24
|
||||
FINAL: Returning Net: 9.95, Gross: 12.24
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 5, client 1
|
||||
Client price query executed. Found: No
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"}
|
||||
Found product price. Net: 68, Gross: 83.64
|
||||
FINAL: Returning Net: 68, Gross: 83.64
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 6, client 1
|
||||
Client price query executed. Found: No
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"171.60","price_gross":"211.07"}
|
||||
Found product price. Net: 171.6, Gross: 211.07
|
||||
FINAL: Returning Net: 171.6, Gross: 211.07
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 7, client 1
|
||||
Client price query executed. Found: No
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84"}
|
||||
Found product price. Net: 233.2, Gross: 286.84
|
||||
FINAL: Returning Net: 233.2, Gross: 286.84
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 2, client 1
|
||||
Client price query executed. Found: {"price_net":"1056.91","price_gross":"1300.00"}
|
||||
Found client price. Net: 1056.91, Gross: 1300
|
||||
FINAL: Returning Net: 1056.91, Gross: 1300
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 1, client 1
|
||||
Client price query executed. Found: {"price_net":"837.40","price_gross":"1030.00"}
|
||||
Found client price. Net: 837.4, Gross: 1030
|
||||
FINAL: Returning Net: 837.4, Gross: 1030
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 2, client 1
|
||||
Client price query executed. Found: {"price_net":"1056.91","price_gross":"1300.00"}
|
||||
Found client price. Net: 1056.91, Gross: 1300
|
||||
FINAL: Returning Net: 1056.91, Gross: 1300
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 3, client 1
|
||||
Client price query executed. Found: {"price_net":"32.52","price_gross":"40.00"}
|
||||
Found client price. Net: 32.52, Gross: 40
|
||||
FINAL: Returning Net: 32.52, Gross: 40
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 4, client 1
|
||||
Client price query executed. Found: No
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"}
|
||||
Found product price. Net: 9.95, Gross: 12.24
|
||||
FINAL: Returning Net: 9.95, Gross: 12.24
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 5, client 1
|
||||
Client price query executed. Found: No
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"}
|
||||
Found product price. Net: 68, Gross: 83.64
|
||||
FINAL: Returning Net: 68, Gross: 83.64
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 6, client 1
|
||||
Client price query executed. Found: No
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"171.60","price_gross":"211.07"}
|
||||
Found product price. Net: 171.6, Gross: 211.07
|
||||
FINAL: Returning Net: 171.6, Gross: 211.07
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 7, client 1
|
||||
Client price query executed. Found: No
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84"}
|
||||
Found product price. Net: 233.2, Gross: 286.84
|
||||
FINAL: Returning Net: 233.2, Gross: 286.84
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 2, client 1
|
||||
Client price query executed. Found: {"price_net":"1056.91","price_gross":"1300.00"}
|
||||
Found client price. Net: 1056.91, Gross: 1300
|
||||
FINAL: Returning Net: 1056.91, Gross: 1300
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 3, client 1
|
||||
Client price query executed. Found: {"price_net":"32.52","price_gross":"40.00"}
|
||||
Found client price. Net: 32.52, Gross: 40
|
||||
FINAL: Returning Net: 32.52, Gross: 40
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 4, client 1
|
||||
Client price query executed. Found: No
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"}
|
||||
Found product price. Net: 9.95, Gross: 12.24
|
||||
FINAL: Returning Net: 9.95, Gross: 12.24
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 5, client 1
|
||||
Client price query executed. Found: No
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"}
|
||||
Found product price. Net: 68, Gross: 83.64
|
||||
FINAL: Returning Net: 68, Gross: 83.64
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 6, client 1
|
||||
Client price query executed. Found: No
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"171.60","price_gross":"211.07"}
|
||||
Found product price. Net: 171.6, Gross: 211.07
|
||||
FINAL: Returning Net: 171.6, Gross: 211.07
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 7, client 1
|
||||
Client price query executed. Found: No
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84"}
|
||||
Found product price. Net: 233.2, Gross: 286.84
|
||||
FINAL: Returning Net: 233.2, Gross: 286.84
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 2, client 1
|
||||
Client price query executed. Found: {"price_net":"1056.91","price_gross":"1300.00"}
|
||||
Found client price. Net: 1056.91, Gross: 1300
|
||||
FINAL: Returning Net: 1056.91, Gross: 1300
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 2, client 1
|
||||
Client price query executed. Found: {"price_net":"1056.91","price_gross":"1300.00"}
|
||||
Found client price. Net: 1056.91, Gross: 1300
|
||||
FINAL: Returning Net: 1056.91, Gross: 1300
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 2, client 1
|
||||
Client price query executed. Found: {"price_net":"1056.91","price_gross":"1300.00"}
|
||||
Found client price. Net: 1056.91, Gross: 1300
|
||||
FINAL: Returning Net: 1056.91, Gross: 1300
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 1, client 1
|
||||
Client price query executed. Found: {"price_net":"837.40","price_gross":"1030.00"}
|
||||
Found client price. Net: 837.4, Gross: 1030
|
||||
FINAL: Returning Net: 837.4, Gross: 1030
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 2, client 1
|
||||
Client price query executed. Found: {"price_net":"1056.91","price_gross":"1300.00"}
|
||||
Found client price. Net: 1056.91, Gross: 1300
|
||||
FINAL: Returning Net: 1056.91, Gross: 1300
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 3, client 1
|
||||
Client price query executed. Found: {"price_net":"32.52","price_gross":"40.00"}
|
||||
Found client price. Net: 32.52, Gross: 40
|
||||
FINAL: Returning Net: 32.52, Gross: 40
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 4, client 1
|
||||
Client price query executed. Found: No
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"}
|
||||
Found product price. Net: 9.95, Gross: 12.24
|
||||
FINAL: Returning Net: 9.95, Gross: 12.24
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 5, client 1
|
||||
Client price query executed. Found: No
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"}
|
||||
Found product price. Net: 68, Gross: 83.64
|
||||
FINAL: Returning Net: 68, Gross: 83.64
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 6, client 1
|
||||
Client price query executed. Found: No
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"171.60","price_gross":"211.07"}
|
||||
Found product price. Net: 171.6, Gross: 211.07
|
||||
FINAL: Returning Net: 171.6, Gross: 211.07
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 7, client 1
|
||||
Client price query executed. Found: No
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84"}
|
||||
Found product price. Net: 233.2, Gross: 286.84
|
||||
FINAL: Returning Net: 233.2, Gross: 286.84
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 1, client 1
|
||||
Client price query executed. Found: {"price_net":"837.40","price_gross":"1030.00"}
|
||||
Found client price. Net: 837.4, Gross: 1030
|
||||
FINAL: Returning Net: 837.4, Gross: 1030
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 2, client 1
|
||||
Client price query executed. Found: {"price_net":"1056.91","price_gross":"1300.00"}
|
||||
Found client price. Net: 1056.91, Gross: 1300
|
||||
FINAL: Returning Net: 1056.91, Gross: 1300
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 3, client 1
|
||||
Client price query executed. Found: {"price_net":"32.52","price_gross":"40.00"}
|
||||
Found client price. Net: 32.52, Gross: 40
|
||||
FINAL: Returning Net: 32.52, Gross: 40
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 4, client 1
|
||||
Client price query executed. Found: No
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"}
|
||||
Found product price. Net: 9.95, Gross: 12.24
|
||||
FINAL: Returning Net: 9.95, Gross: 12.24
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 5, client 1
|
||||
Client price query executed. Found: No
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"}
|
||||
Found product price. Net: 68, Gross: 83.64
|
||||
FINAL: Returning Net: 68, Gross: 83.64
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 6, client 1
|
||||
Client price query executed. Found: No
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"171.60","price_gross":"211.07"}
|
||||
Found product price. Net: 171.6, Gross: 211.07
|
||||
FINAL: Returning Net: 171.6, Gross: 211.07
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 7, client 1
|
||||
Client price query executed. Found: No
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84"}
|
||||
Found product price. Net: 233.2, Gross: 286.84
|
||||
FINAL: Returning Net: 233.2, Gross: 286.84
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 2, client 1
|
||||
Client price query executed. Found: {"price_net":"1056.91","price_gross":"1300.00"}
|
||||
Found client price. Net: 1056.91, Gross: 1300
|
||||
FINAL: Returning Net: 1056.91, Gross: 1300
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 3, client 1
|
||||
Client price query executed. Found: {"price_net":"32.52","price_gross":"40.00"}
|
||||
Found client price. Net: 32.52, Gross: 40
|
||||
FINAL: Returning Net: 32.52, Gross: 40
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 4, client 1
|
||||
Client price query executed. Found: No
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"}
|
||||
Found product price. Net: 9.95, Gross: 12.24
|
||||
FINAL: Returning Net: 9.95, Gross: 12.24
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 5, client 1
|
||||
Client price query executed. Found: No
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"}
|
||||
Found product price. Net: 68, Gross: 83.64
|
||||
FINAL: Returning Net: 68, Gross: 83.64
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 6, client 1
|
||||
Client price query executed. Found: No
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"171.60","price_gross":"211.07"}
|
||||
Found product price. Net: 171.6, Gross: 211.07
|
||||
FINAL: Returning Net: 171.6, Gross: 211.07
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 7, client 1
|
||||
Client price query executed. Found: No
|
||||
Client price not found or not set, falling back to product price.
|
||||
Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84"}
|
||||
Found product price. Net: 233.2, Gross: 286.84
|
||||
FINAL: Returning Net: 233.2, Gross: 286.84
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 2, client 1
|
||||
Client price query executed. Found: {"price_net":"1056.91","price_gross":"1300.00"}
|
||||
Found client price. Net: 1056.91, Gross: 1300
|
||||
FINAL: Returning Net: 1056.91, Gross: 1300
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 2, client 1
|
||||
Client price query executed. Found: {"price_net":"1056.91","price_gross":"1300.00"}
|
||||
Found client price. Net: 1056.91, Gross: 1300
|
||||
FINAL: Returning Net: 1056.91, Gross: 1300
|
||||
---
|
||||
---
|
||||
START getEffectivePrice for product 2, client 1
|
||||
Client price query executed. Found: {"price_net":"1056.91","price_gross":"1300.00"}
|
||||
Found client price. Net: 1056.91, Gross: 1300
|
||||
FINAL: Returning Net: 1056.91, Gross: 1300
|
||||
---
|
||||
|
||||
@ -20,7 +20,7 @@ if (!is_logged_in()) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$stmt = db()->prepare("SELECT o.*, c.name as client_name, c.email as client_email FROM orders o JOIN clients c ON o.client_id = c.id WHERE o.id = ?");
|
||||
$stmt = db()->prepare("SELECT o.*, c.name as client_name, c.email as client_email, c.language as client_language FROM orders o JOIN clients c ON o.client_id = c.id WHERE o.id = ?");
|
||||
$stmt->execute([$order_id]);
|
||||
$order = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
@ -128,8 +128,16 @@ $pdf->Ln($headerRowHeight);
|
||||
$pdf->SetFont('DejaVu', '', 12);
|
||||
$vatRate = 1.23;
|
||||
foreach ($order_items as $item) {
|
||||
$unit_price_gross = (float)$item['unit_price'];
|
||||
$unit_price_net = $unit_price_gross / $vatRate;
|
||||
$client_language = $order['client_language'];
|
||||
$vatRate = 1.23;
|
||||
|
||||
if ($client_language === 'en') {
|
||||
$unit_price_net = (float)$item['unit_price'];
|
||||
$unit_price_gross = $unit_price_net * $vatRate;
|
||||
} else {
|
||||
$unit_price_gross = (float)$item['unit_price'];
|
||||
$unit_price_net = $unit_price_gross / $vatRate;
|
||||
}
|
||||
|
||||
// --- Cell data ---
|
||||
$widths = [70, 30, 30, 30, 30];
|
||||
|
||||
@ -120,6 +120,7 @@ $translations = [
|
||||
'update_button' => 'Zaktualizuj',
|
||||
'remove_button' => 'Usuń',
|
||||
'total_gross_label' => 'Razem (brutto):',
|
||||
'total_net_label' => 'Razem (netto):',
|
||||
'proceed_to_checkout' => 'Przejdź do zamówienia',
|
||||
'db_connection_error' => 'Błąd połączenia z bazą danych: ',
|
||||
'price_per' => 'Cena za',
|
||||
@ -326,6 +327,7 @@ $translations = [
|
||||
'update_button' => 'Update',
|
||||
'remove_button' => 'Remove',
|
||||
'total_gross_label' => 'Total (gross):',
|
||||
'total_net_label' => 'Total (net):',
|
||||
'proceed_to_checkout' => 'Proceed to checkout',
|
||||
'db_connection_error' => 'Database connection error: ',
|
||||
'price_per' => 'Price per',
|
||||
|
||||
@ -28,14 +28,14 @@ try {
|
||||
// 1. Get product details from the database
|
||||
$product_ids = array_keys($cart);
|
||||
$placeholders = implode(',', array_fill(0, count($product_ids), '?'));
|
||||
$stmt = $pdo->prepare("SELECT id, price, units_per_pallet FROM products WHERE id IN ($placeholders)");
|
||||
$stmt = $pdo->prepare("SELECT id, price, units_per_pallet, name FROM products WHERE id IN ($placeholders)");
|
||||
$stmt->execute($product_ids);
|
||||
$products_by_id = $stmt->fetchAll(PDO::FETCH_GROUP|PDO::FETCH_UNIQUE|PDO::FETCH_ASSOC);
|
||||
|
||||
|
||||
// 2. Calculate total amount
|
||||
$total_amount_gross = 0;
|
||||
$total_amount = 0;
|
||||
$client_id = $_SESSION['client_id'] ?? null;
|
||||
$lang = $_SESSION['lang'] ?? 'pl';
|
||||
|
||||
$order_items_data = [];
|
||||
|
||||
@ -45,15 +45,24 @@ try {
|
||||
$product = $products_by_id[$product_id];
|
||||
|
||||
$price_info = getEffectivePrice($pdo, $product_id, $client_id);
|
||||
$price_net = $price_info['net'];
|
||||
$price_gross = $price_info['gross'];
|
||||
|
||||
$total_amount_gross += $price_gross * $quantity;
|
||||
if ($lang === 'en') {
|
||||
$unit_price = $price_net;
|
||||
} else {
|
||||
$unit_price = $price_gross;
|
||||
}
|
||||
|
||||
$line_total = $unit_price * $quantity;
|
||||
$total_amount += $line_total;
|
||||
|
||||
$order_items_data[] = [
|
||||
'product_id' => $product_id,
|
||||
'quantity' => $quantity,
|
||||
'unit_price' => $price_gross, // Save gross price
|
||||
'line_total' => $price_gross * $quantity,
|
||||
'unit_price' => $unit_price,
|
||||
'line_total' => $line_total,
|
||||
'name' => $product['name'],
|
||||
];
|
||||
|
||||
$units_per_pallet = $product['units_per_pallet'];
|
||||
@ -72,11 +81,11 @@ try {
|
||||
$stmt->execute([$client_id]);
|
||||
$credit_info = $stmt->fetch();
|
||||
|
||||
if (!$credit_info || !$credit_info['credit_enabled'] || $credit_info['credit_balance'] < $total_amount_gross) {
|
||||
if (!$credit_info || !$credit_info['credit_enabled'] || $credit_info['credit_balance'] < $total_amount) {
|
||||
throw new Exception('Invalid payment method or insufficient credit.');
|
||||
}
|
||||
|
||||
$new_balance = $credit_info['credit_balance'] - $total_amount_gross;
|
||||
$new_balance = $credit_info['credit_balance'] - $total_amount;
|
||||
$stmt = $pdo->prepare('UPDATE clients SET credit_balance = ? WHERE id = ?');
|
||||
$stmt->execute([$new_balance, $client_id]);
|
||||
}
|
||||
@ -87,7 +96,7 @@ try {
|
||||
);
|
||||
$stmt->execute([
|
||||
$client_id,
|
||||
$total_amount_gross,
|
||||
$total_amount,
|
||||
$_POST['payment_method'],
|
||||
$delivery_source,
|
||||
$_POST['notes'],
|
||||
@ -131,7 +140,7 @@ try {
|
||||
// Register transaction with P24
|
||||
$p24_data = [
|
||||
'sessionId' => $p24_session_id,
|
||||
'amount' => (int)($total_amount_gross * 100), // Amount in grosze
|
||||
'amount' => (int)($total_amount * 100), // Amount in grosze
|
||||
'description' => "Order #" . $order_id,
|
||||
'email' => $client_email,
|
||||
'client' => $client_name,
|
||||
@ -162,16 +171,13 @@ try {
|
||||
} elseif (isset($response['error'])) {
|
||||
$error_message = $response['error'];
|
||||
}
|
||||
redirect_with_error('checkout.php', 'Błąd podczas przetwarzania zamówienia: ' . $error_message);
|
||||
redirect_with_error('checkout.php', 'Error processing order: ' . $error_message);
|
||||
}
|
||||
}
|
||||
|
||||
$pdo->commit();
|
||||
|
||||
// 6. Send email notifications
|
||||
|
||||
|
||||
// --- Data Fetching for Emails ---
|
||||
$user_id = $_SESSION['user_id'] ?? null;
|
||||
$stmt = $pdo->prepare('SELECT email FROM users WHERE id = ?');
|
||||
$stmt->execute([$user_id]);
|
||||
@ -183,27 +189,24 @@ try {
|
||||
$client = $stmt->fetch();
|
||||
$client_company_name = $client['name'] ?? 'N/A';
|
||||
|
||||
$product_ids_for_names = array_map(function($item) { return $item['product_id']; }, $order_items_data);
|
||||
$placeholders = implode(',', array_fill(0, count($product_ids_for_names), '?'));
|
||||
$stmt = $pdo->prepare("SELECT id, name FROM products WHERE id IN ($placeholders)");
|
||||
$stmt->execute($product_ids_for_names);
|
||||
$products_by_id_for_email = $stmt->fetchAll(PDO::FETCH_KEY_PAIR);
|
||||
|
||||
$order_details_link = get_site_url() . '/order_details.php?id=' . $order_id;
|
||||
$admin_order_details_link = get_site_url() . '/admin/order_details.php?id=' . $order_id;
|
||||
$admin_email = getenv('MAIL_TO') ?: 'admin@example.com';
|
||||
|
||||
// --- Email Sending Logic ---
|
||||
$site_name = get_site_url(); // Or your site name
|
||||
$site_name = get_site_url();
|
||||
$lang = get_lang();
|
||||
|
||||
$products_by_id_for_email = [];
|
||||
foreach($order_items_data as $item){
|
||||
$products_by_id_for_email[$item['product_id']] = $item['name'];
|
||||
}
|
||||
|
||||
if ($client_email) {
|
||||
// 1. Client - Order Confirmation
|
||||
$data_client = [
|
||||
'order_id' => $order_id,
|
||||
'order_items' => $order_items_data,
|
||||
'products' => $products_by_id_for_email,
|
||||
'total_amount_gross' => $total_amount_gross,
|
||||
'total_amount' => $total_amount,
|
||||
'payment_method' => $_POST['payment_method'],
|
||||
'order_details_link' => $order_details_link,
|
||||
'site_name' => $site_name,
|
||||
@ -211,22 +214,21 @@ try {
|
||||
];
|
||||
MailService::sendTemplatedMail($client_email, $lang, 'order_confirmation', $data_client);
|
||||
|
||||
// 3. Client - Payment Instructions (Bank Transfer)
|
||||
if ($_POST['payment_method'] === 'bank_transfer') {
|
||||
// Fetch bank details from the settings table
|
||||
$stmt = $pdo->query("SELECT `key`, `value` FROM settings WHERE `key` IN ('bank_name', 'bank_account_number')");
|
||||
$settings = $stmt->fetchAll(PDO::FETCH_KEY_PAIR);
|
||||
|
||||
$bank_name = $settings['bank_name'] ?? '';
|
||||
$bank_account_number = $settings['bank_account_number'] ?? '';
|
||||
|
||||
$bank_account_details = "Bank: " . $bank_name . "\nAccount Number: " . $bank_account_number;
|
||||
$bank_account_details = "Bank: " . $bank_name . "
|
||||
Account Number: " . $bank_account_number;
|
||||
$transfer_title = "Order #{$order_id}";
|
||||
$payment_deadline = date('Y-m-d', strtotime('+7 days'));
|
||||
|
||||
$data_bank = [
|
||||
'order_id' => $order_id,
|
||||
'total_amount_gross' => $total_amount_gross,
|
||||
'total_amount' => $total_amount,
|
||||
'bank_account_details' => $bank_account_details,
|
||||
'transfer_title' => $transfer_title,
|
||||
'payment_deadline' => $payment_deadline,
|
||||
@ -236,11 +238,10 @@ try {
|
||||
MailService::sendTemplatedMail($client_email, $lang, 'payment_instructions', $data_bank);
|
||||
}
|
||||
|
||||
// 6. Client - Credit Payment Confirmation
|
||||
if ($_POST['payment_method'] === 'credit') {
|
||||
$data_credit = [
|
||||
'order_id' => $order_id,
|
||||
'total_amount_gross' => $total_amount_gross,
|
||||
'total_amount' => $total_amount,
|
||||
'new_balance' => $new_balance,
|
||||
'order_details_link' => $order_details_link,
|
||||
'site_name' => $site_name,
|
||||
@ -250,21 +251,25 @@ try {
|
||||
}
|
||||
}
|
||||
|
||||
// 2. Admin - New Order Notification
|
||||
$data_admin = [
|
||||
'order_id' => $order_id,
|
||||
'client_company_name' => $client_company_name,
|
||||
'total_amount_gross' => $total_amount_gross,
|
||||
'total_amount' => $total_amount,
|
||||
'payment_method' => $_POST['payment_method'],
|
||||
'delivery_source' => $delivery_source,
|
||||
'admin_order_details_link' => $admin_order_details_link,
|
||||
'site_name' => $site_name,
|
||||
'pdo' => $pdo,
|
||||
];
|
||||
MailService::sendTemplatedMail($admin_email, 'en', 'admin_new_order', $data_admin); // Admin email in English
|
||||
MailService::sendTemplatedMail($admin_email, 'en', 'admin_new_order', $data_admin);
|
||||
|
||||
// 7. Supplier - New Order Items
|
||||
$stmt = $pdo->prepare("\n SELECT p.supplier_id, s.name as supplier_name, s.email as supplier_email, p.name as product_name, oi.quantity\n FROM order_items oi\n JOIN products p ON oi.product_id = p.id\n JOIN suppliers s ON p.supplier_id = s.id\n WHERE oi.order_id = ? AND p.supplier_id IS NOT NULL\n ");
|
||||
$stmt = $pdo->prepare("
|
||||
SELECT p.supplier_id, s.name as supplier_name, s.email as supplier_email, p.name as product_name, oi.quantity
|
||||
FROM order_items oi
|
||||
JOIN products p ON oi.product_id = p.id
|
||||
JOIN suppliers s ON p.supplier_id = s.id
|
||||
WHERE oi.order_id = ? AND p.supplier_id IS NOT NULL
|
||||
");
|
||||
$stmt->execute([$order_id]);
|
||||
$supplier_items = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
@ -288,16 +293,14 @@ try {
|
||||
'site_name' => $site_name,
|
||||
'pdo' => $pdo,
|
||||
];
|
||||
MailService::sendTemplatedMail($supplier_data['email'], 'en', 'supplier_new_order_items', $data_supplier); // Supplier email in English
|
||||
MailService::sendTemplatedMail($supplier_data['email'], 'en', 'supplier_new_order_items', $data_supplier);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 8. Clear the cart and store order ID in session for the confirmation page
|
||||
unset($_SESSION['cart']);
|
||||
$_SESSION['latest_order_id'] = $order_id;
|
||||
|
||||
// 9. Redirect to confirmation page
|
||||
header('Location: order_confirmation.php');
|
||||
exit;
|
||||
|
||||
@ -305,18 +308,18 @@ try {
|
||||
if ($pdo->inTransaction()) {
|
||||
$pdo->rollBack();
|
||||
}
|
||||
// In a real application, log this error
|
||||
die("Błąd podczas przetwarzania zamówienia: " . $e->getMessage());
|
||||
error_log("Error in order_process.php: " . $e->getMessage());
|
||||
die("Error processing order. Please try again later.");
|
||||
} catch (PDOException $e) {
|
||||
if ($pdo->inTransaction()) {
|
||||
$pdo->rollBack();
|
||||
}
|
||||
// In a real application, log this error
|
||||
die("Błąd podczas przetwarzania zamówienia: " . $e->getMessage());
|
||||
error_log("PDOError in order_process.php: " . $e->getMessage());
|
||||
die("Error processing order. Please try again later.");
|
||||
} catch (Throwable $t) {
|
||||
if ($pdo->inTransaction()) {
|
||||
$pdo->rollBack();
|
||||
}
|
||||
die("An unexpected error occurred: " . $t->getMessage());
|
||||
}
|
||||
|
||||
error_log("Fatal error in order_process.php: " . $t->getMessage());
|
||||
die("An unexpected error occurred. Please try again later.");
|
||||
}
|
||||
@ -4,7 +4,7 @@
|
||||
/**
|
||||
* @var int $order_id
|
||||
* @var string $client_company_name
|
||||
* @var float $total_amount_gross
|
||||
* @var float $total_amount
|
||||
* @var string $payment_method
|
||||
* @var string $delivery_source
|
||||
* @var string $admin_order_details_link
|
||||
@ -14,7 +14,7 @@
|
||||
<p>A new order has been placed.</p>
|
||||
<p><strong>Order ID:</strong> <?php echo $order_id; ?></p>
|
||||
<p><strong>Client:</strong> <?php echo htmlspecialchars($client_company_name); ?></p>
|
||||
<p><strong>Total Amount:</strong> <?php echo format_money($total_amount_gross, $lang, $db); ?></p>
|
||||
<p><strong>Total Amount:</strong> <?php echo format_money($total_amount, $lang, $db); ?></p>
|
||||
<p><strong>Payment Method:</strong> <?php echo htmlspecialchars(ucfirst(str_replace('_', ' ', $payment_method))); ?></p>
|
||||
<p><strong>Delivery Source:</strong> <?php echo htmlspecialchars(strtoupper($delivery_source)); ?></p>
|
||||
<p>View order details: <a href="<?php echo $admin_order_details_link; ?>"><?php echo $admin_order_details_link; ?></a></p>
|
||||
@ -3,13 +3,13 @@
|
||||
|
||||
/**
|
||||
* @var int $order_id
|
||||
* @var float $total_amount_gross
|
||||
* @var float $total_amount
|
||||
* @var float $new_balance
|
||||
* @var string $order_details_link
|
||||
*/
|
||||
?>
|
||||
|
||||
<p>Hello,</p>
|
||||
<p>We confirm that your payment of <?php echo format_money($total_amount_gross, $lang, $db); ?> for order #<?php echo $order_id; ?> has been successfully processed using your trade credit.</p>
|
||||
<p>We confirm that your payment of <?php echo format_money($total_amount, $lang, $db); ?> for order #<?php echo $order_id; ?> has been successfully processed using your trade credit.</p>
|
||||
<p>Your new credit balance is <?php echo format_money($new_balance, $lang, $db); ?>.</p>
|
||||
<p>You can view your order details here: <a href="<?php echo $order_details_link; ?>"><?php echo $order_details_link; ?></a></p>
|
||||
@ -4,7 +4,7 @@
|
||||
/**
|
||||
* @var int $order_id
|
||||
* @var string $product_list_html
|
||||
* @var float $total_amount_gross
|
||||
* @var float $total_amount
|
||||
* @var string $payment_method
|
||||
* @var string $order_details_link
|
||||
*/
|
||||
@ -18,7 +18,7 @@
|
||||
<li><?php echo htmlspecialchars($products[$item['product_id']] ?? 'Unknown Product'); ?> (Quantity: <?php echo $item['quantity']; ?>)</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<p><strong>Total:</strong> <?php echo format_money($total_amount_gross, $lang, $db); ?></p>
|
||||
<p><strong>Total:</strong> <?php echo format_money($total_amount, $lang, $db); ?></p>
|
||||
<p><strong>Payment Method:</strong> <?php echo htmlspecialchars(ucfirst(str_replace('_', ' ', $payment_method))); ?></p>
|
||||
<p>You can view your order details here: <a href="<?php echo $order_details_link; ?>"><?php echo $order_details_link; ?></a></p>
|
||||
<p>Thank you for your business!</p>
|
||||
@ -3,7 +3,7 @@
|
||||
|
||||
/**
|
||||
* @var int $order_id
|
||||
* @var float $total_amount_gross
|
||||
* @var float $total_amount
|
||||
* @var string $bank_account_details
|
||||
* @var string $transfer_title
|
||||
* @var string $payment_deadline
|
||||
@ -12,7 +12,7 @@
|
||||
|
||||
<p>Hello,</p>
|
||||
<p>Please use the following details to make a bank transfer for your order #<?php echo $order_id; ?>.</p>
|
||||
<p><strong>Amount:</strong> <?php echo format_money($total_amount_gross, $lang, $db); ?></p>
|
||||
<p><strong>Amount:</strong> <?php echo format_money($total_amount, $lang, $db); ?></p>
|
||||
<p><strong>Bank Details:</strong></p>
|
||||
<pre><?php echo htmlspecialchars($bank_account_details); ?></pre>
|
||||
<p><strong>Transfer Title:</strong> <?php echo htmlspecialchars($transfer_title); ?></p>
|
||||
|
||||
@ -3,13 +3,13 @@
|
||||
|
||||
/**
|
||||
* @var int $order_id
|
||||
* @var float $total_amount_gross
|
||||
* @var float $total_amount
|
||||
* @var float $new_balance
|
||||
* @var string $order_details_link
|
||||
*/
|
||||
?>
|
||||
|
||||
<p>Dzień dobry,</p>
|
||||
<p>Potwierdzamy, że Twoja płatność w wysokości <?php echo format_money($total_amount_gross, $lang, $db); ?> za zamówienie #<?php echo $order_id; ?> została pomyślnie przetworzona przy użyciu kredytu kupieckiego.</p>
|
||||
<p>Potwierdzamy, że Twoja płatność w wysokości <?php echo format_money($total_amount, $lang, $db); ?> za zamówienie #<?php echo $order_id; ?> została pomyślnie przetworzona przy użyciu kredytu kupieckiego.</p>
|
||||
<p>Twoje nowe saldo kredytowe wynosi <?php echo format_money($new_balance, $lang, $db); ?>.</p>
|
||||
<p>Możesz zobaczyć szczegóły zamówienia tutaj: <a href="<?php echo $order_details_link; ?>"><?php echo $order_details_link; ?></a></p>
|
||||
@ -4,7 +4,7 @@
|
||||
/**
|
||||
* @var int $order_id
|
||||
* @var string $product_list_html
|
||||
* @var float $total_amount_gross
|
||||
* @var float $total_amount
|
||||
* @var string $payment_method
|
||||
* @var string $order_details_link
|
||||
*/
|
||||
@ -18,7 +18,7 @@
|
||||
<li><?php echo htmlspecialchars($products[$item['product_id']] ?? 'Nieznany produkt'); ?> (Ilość: <?php echo $item['quantity']; ?>)</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<p><strong>Suma:</strong> <?php echo format_money($total_amount_gross, $lang, $db); ?></p>
|
||||
<p><strong>Suma:</strong> <?php echo format_money($total_amount, $lang, $db); ?></p>
|
||||
<p><strong>Metoda płatności:</strong> <?php echo htmlspecialchars(ucfirst(str_replace('_', ' ', $payment_method))); ?></p>
|
||||
<p>Możesz zobaczyć szczegóły zamówienia tutaj: <a href="<?php echo $order_details_link; ?>"><?php echo $order_details_link; ?></a></p>
|
||||
<p>Dziękujemy za zakupy!</p>
|
||||
@ -3,7 +3,7 @@
|
||||
|
||||
/**
|
||||
* @var int $order_id
|
||||
* @var float $total_amount_gross
|
||||
* @var float $total_amount
|
||||
* @var string $bank_account_details
|
||||
* @var string $transfer_title
|
||||
* @var string $payment_deadline
|
||||
@ -12,7 +12,7 @@
|
||||
|
||||
<p>Dzień dobry,</p>
|
||||
<p>Proszę użyć poniższych danych do wykonania przelewu bankowego za zamówienie #<?php echo $order_id; ?>.</p>
|
||||
<p><strong>Kwota:</strong> <?php echo format_money($total_amount_gross, $lang, $db); ?></p>
|
||||
<p><strong>Kwota:</strong> <?php echo format_money($total_amount, $lang, $db); ?></p>
|
||||
<p><strong>Dane bankowe:</strong></p>
|
||||
<pre><?php echo htmlspecialchars($bank_account_details); ?></pre>
|
||||
<p><strong>Tytuł przelewu:</strong> <?php echo htmlspecialchars($transfer_title); ?></p>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user