36 lines
1.2 KiB
PHP
36 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace KupShop\PohodaBundle\Admin;
|
|
|
|
use Query\Operator;
|
|
|
|
class pohodaMissingOrders
|
|
{
|
|
public function showMissingOrders()
|
|
{
|
|
$qb = sqlQueryBuilder()
|
|
->select('o.id, o.order_no, invoice_name, invoice_surname, invoice_firm')
|
|
->from('orders', 'o')
|
|
->where('o.pohoda_id is null AND status_storno=0')
|
|
->andWhere(Operator::andX(['source != "import"',
|
|
'date_created >= NOW() - INTERVAL 365 DAY',
|
|
'date_created <= NOW() - INTERVAL 1 DAY', ]));
|
|
foreach ($qb->execute()->fetchAllAssociative() as $order) {
|
|
$parts = [];
|
|
if ($order['invoice_firm']) {
|
|
$parts[] = $order['invoice_firm'];
|
|
}
|
|
|
|
if ($order['invoice_name'] || $order['invoice_surname']) {
|
|
$parts[] = join(' ', [$order['invoice_surname'], $order['invoice_name']]);
|
|
}
|
|
$name = join(', ', $parts);
|
|
|
|
echo "Kód objednávky {$order['order_no']} (ID: {$order['id']}) {$name} <a href=\"launch.php?s=orders.php&acn=edit&ID={$order['id']}\">{$order['order_no']}</a><br>";
|
|
}
|
|
}
|
|
}
|
|
|
|
$missingOrders = new pohodaMissingOrders();
|
|
$missingOrders->showMissingOrders();
|