fix phpstan/phpcs

This commit is contained in:
Dennis Eichhorn 2021-06-26 14:38:07 +02:00
parent 64c48dbb34
commit 1dfa2f81f1
15 changed files with 781 additions and 849 deletions

View File

@ -13,11 +13,11 @@ $mpdf = new Mpdf([
'format' => 'A4-L',
'orientation' => 'L',
'margin_left' => 20,
'margin_right' => 15,
'margin_top' => 48,
'margin_bottom' => 25,
'margin_header' => 10,
'margin_footer' => 10,
'margin_right' => 15,
'margin_top' => 48,
'margin_bottom' => 25,
'margin_header' => 10,
'margin_footer' => 10,
]);
$mpdf->SetDisplayMode('fullpage');
@ -27,65 +27,65 @@ $mpdf->SetAuthor('Orange Management');
$html = '
<html>
<head>
<style>
body {
font-family: sans-serif;
font-size: 10pt;
}
p { margin: 0pt; }
table.items {
border: 0.1mm solid #000000;
}
td { vertical-align: top; }
.items td {
border-left: 0.1mm solid #000000;
border-right: 0.1mm solid #000000;
}
table thead td {
background-color: #EEEEEE;
text-align: center;
border: 0.1mm solid #000000;
font-variant: small-caps;
}
.items td.blanktotal {
background-color: #EEEEEE;
border: 0.1mm solid #000000;
background-color: #FFFFFF;
border: 0mm none #000000;
border-top: 0.1mm solid #000000;
border-right: 0.1mm solid #000000;
}
.items td.totals {
text-align: right;
border: 0.1mm solid #000000;
}
.items td.cost {
text-align: "." center;
}
</style>
<style>
body {
font-family: sans-serif;
font-size: 10pt;
}
p { margin: 0pt; }
table.items {
border: 0.1mm solid #000000;
}
td { vertical-align: top; }
.items td {
border-left: 0.1mm solid #000000;
border-right: 0.1mm solid #000000;
}
table thead td {
background-color: #EEEEEE;
text-align: center;
border: 0.1mm solid #000000;
font-variant: small-caps;
}
.items td.blanktotal {
background-color: #EEEEEE;
border: 0.1mm solid #000000;
background-color: #FFFFFF;
border: 0mm none #000000;
border-top: 0.1mm solid #000000;
border-right: 0.1mm solid #000000;
}
.items td.totals {
text-align: right;
border: 0.1mm solid #000000;
}
.items td.cost {
text-align: "." center;
}
</style>
</head>
<body>
<!--mpdf
<htmlpageheader name="myheader">
<table width="100%">
<tr>
<td width="50%" style="color:#0000BB; ">
<span style="font-weight: bold; font-size: 14pt;">Orange Management</span><br />
123 1313 Webfoot Street<br />
Duckburg<br />
</td>
<td width="50%" style="text-align: right;">
Invoice No.<br />
<span style="font-weight: bold; font-size: 12pt;">' . $bill->getNumber() . '</span>
</td>
</tr>
</table>
<table width="100%">
<tr>
<td width="50%" style="color:#0000BB; ">
<span style="font-weight: bold; font-size: 14pt;">Orange Management</span><br />
123 1313 Webfoot Street<br />
Duckburg<br />
</td>
<td width="50%" style="text-align: right;">
Invoice No.<br />
<span style="font-weight: bold; font-size: 12pt;">' . $bill->getNumber() . '</span>
</td>
</tr>
</table>
</htmlpageheader>
<htmlpagefooter name="myfooter">
<div style="border-top: 1px solid #000000; font-size: 9pt; text-align: center; padding-top: 3mm; ">
Page {PAGENO} of {nb}
</div>
<div style="border-top: 1px solid #000000; font-size: 9pt; text-align: center; padding-top: 3mm; ">
Page {PAGENO} of {nb}
</div>
</htmlpagefooter>
<sethtmlpageheader name="myheader" value="on" show-this-page="1" />
@ -95,74 +95,74 @@ mpdf-->
<div style="text-align: right">Date: 13th November 2008</div>
<table width="100%" style="font-family: serif;" cellpadding="10">
<tr>
<td width="45%" style="border: 0.1mm solid #888888; ">
<span style="font-size: 7pt; color: #555555; font-family: sans;">SOLD TO:</span><br /><br />
345 Anotherstreet<br />
Little Village<br />
Their City<br />
CB22 6SO
</td>
<td width="10%">&nbsp;</td>
<td width="45%" style="border: 0.1mm solid #888888;">
<span style="font-size: 7pt; color: #555555; font-family: sans;">SHIP TO:</span><br /><br />
345 Anotherstreet<br />
Little Village<br />
Their City<br />CB22 6SO</td>
</tr>
<tr>
<td width="45%" style="border: 0.1mm solid #888888; ">
<span style="font-size: 7pt; color: #555555; font-family: sans;">SOLD TO:</span><br /><br />
345 Anotherstreet<br />
Little Village<br />
Their City<br />
CB22 6SO
</td>
<td width="10%">&nbsp;</td>
<td width="45%" style="border: 0.1mm solid #888888;">
<span style="font-size: 7pt; color: #555555; font-family: sans;">SHIP TO:</span><br /><br />
345 Anotherstreet<br />
Little Village<br />
Their City<br />CB22 6SO</td>
</tr>
</table>
<br />
<table class="items" width="100%" style="font-size: 9pt; border-collapse: collapse; " cellpadding="8">
<thead>
<tr>
<td width="15%">Ref. No.</td>
<td width="10%">Quantity</td>
<td width="45%">Description</td>
<td width="15%">Unit Price</td>
<td width="15%">Amount</td>
</tr>
</thead>
<thead>
<tr>
<td width="15%">Ref. No.</td>
<td width="10%">Quantity</td>
<td width="45%">Description</td>
<td width="15%">Unit Price</td>
<td width="15%">Amount</td>
</tr>
</thead>
<tbody>';
foreach ($elements as $element) {
$html .= '
<tr>
<td align="center">' . $element->itemNumber . '</td>
<td align="center">' . $element->quantity . '</td>
<td>' . $element->itemName . '</td>
<td class="cost">' . $element->singleSalesPriceNet->getCurrency(null) . '</td>
<td class="cost">' . $element->totalSalesPriceNet->getCurrency(null) . '</td>
</tr>';
<tr>
<td align="center">' . $element->itemNumber . '</td>
<td align="center">' . $element->quantity . '</td>
<td>' . $element->itemName . '</td>
<td class="cost">' . $element->singleSalesPriceNet->getCurrency(null) . '</td>
<td class="cost">' . $element->totalSalesPriceNet->getCurrency(null) . '</td>
</tr>';
}
$html .= '
<tr>
<td class="blanktotal" colspan="3" rowspan="6"></td>
<td class="totals">Subtotal:</td>
<td class="totals cost">' . $bill->net->getCurrency(null) . '</td>
</tr>
<tr>
<td class="totals">Tax:</td>
<td class="totals cost">&pound;18.25</td>
</tr>
<tr>
<td class="totals">Shipping:</td>
<td class="totals cost">&pound;42.56</td>
</tr>
<tr>
<td class="totals"><strong>TOTAL:</strong></td>
<td class="totals cost"><strong>' . $bill->gross->getCurrency(null) . '</strong></td>
</tr>
<tr>
<td class="totals">Deposit:</td>
<td class="totals cost">&pound;100.00</td>
</tr>
<tr>
<td class="totals"><strong>Balance due:</strong></td>
<td class="totals cost"><strong>&pound;1782.56</strong></td>
</tr>
</tbody>
<tr>
<td class="blanktotal" colspan="3" rowspan="6"></td>
<td class="totals">Subtotal:</td>
<td class="totals cost">' . $bill->net->getCurrency(null) . '</td>
</tr>
<tr>
<td class="totals">Tax:</td>
<td class="totals cost">&pound;18.25</td>
</tr>
<tr>
<td class="totals">Shipping:</td>
<td class="totals cost">&pound;42.56</td>
</tr>
<tr>
<td class="totals"><strong>TOTAL:</strong></td>
<td class="totals cost"><strong>' . $bill->gross->getCurrency(null) . '</strong></td>
</tr>
<tr>
<td class="totals">Deposit:</td>
<td class="totals cost">&pound;100.00</td>
</tr>
<tr>
<td class="totals"><strong>Balance due:</strong></td>
<td class="totals cost"><strong>&pound;1782.56</strong></td>
</tr>
</tbody>
</table>
<div style="text-align: center; font-style: italic;">Payment terms: payment due in 30 days</div>

View File

@ -92,10 +92,10 @@ final class ApiController extends Controller
}
/* @var \Modules\Account\Models\Account $account */
$bill = new Bill();
$bill->createdBy = new NullAccount($request->header->account);
$bill->number = '{y}-{id}'; // @todo: use admin defined format
$bill->billTo = $request->getData('billto')
$bill = new Bill();
$bill->createdBy = new NullAccount($request->header->account);
$bill->number = '{y}-{id}'; // @todo: use admin defined format
$bill->billTo = $request->getData('billto')
?? ($account->profile->account->name1 . (!empty($account->profile->account->name2) ? ', ' . $account->profile->account->name2 : '')); // @todo: use defaultInvoiceAddress or mainAddress. also consider to use billto1, billto2, billto3 (for multiple lines e.g. name2, fao etc.)
$bill->billZip = $request->getData('billtopostal') ?? $account->mainAddress->postal;
$bill->billCity = $request->getData('billtocity') ?? $account->mainAddress->city;

View File

@ -55,9 +55,7 @@ class Bill implements \JsonSerializable
* @var int|BillType
* @since 1.0.0
*/
public int |
BillType $type = 0;
public int|BillType $type = 0;
/**
* Bill status.
@ -225,15 +223,15 @@ class Bill implements \JsonSerializable
public string $info = '';
public $payment = 0;
public int $payment = 0;
public string $paymentText = '';
public $terms = 0;
public int $terms = 0;
public string $termsText = '';
public $shipping = 0;
public int $shipping = 0;
public string $shippingText = '';
@ -266,15 +264,15 @@ class Bill implements \JsonSerializable
*/
public function __construct()
{
$this->net = new Money(0);
$this->gross = new Money(0);
$this->costs = new Money(0);
$this->profit = new Money(0);
$this->net = new Money(0);
$this->gross = new Money(0);
$this->costs = new Money(0);
$this->profit = new Money(0);
$this->createdAt = new \DateTimeImmutable();
$this->performanceDate = new \DateTime();
$this->createdBy = new NullAccount();
$this->referral = new NullAccount();
$this->createdAt = new \DateTimeImmutable();
$this->performanceDate = new \DateTime();
$this->createdBy = new NullAccount();
$this->referral = new NullAccount();
}
/**
@ -825,31 +823,6 @@ class Bill implements \JsonSerializable
return $this->info;
}
/**
* Set payment term.
*
* @param int $payment Payment term
*
* @return void
*
* @since 1.0.0
*/
public function setPayment(int $payment) : void
{
$this->payment = $payment;
}
/**
* Get payment term.
*
* @return null|int
*
* @since 1.0.0
*/
public function getPayment() : ?int
{
return $this->payment;
}
/**
* Set payment text.

View File

@ -75,14 +75,29 @@ class BillElement implements \JsonSerializable
public ?FloatInt $totalSalesPriceGross = null;
public $event = 0;
/**
* Event assigned to this element.
*
* @var int
* @since 1.0.0
*/
public int $event = 0;
public $promotion = 0;
/**
* Promotion assigned to this element.
*
* @var int
* @since 1.0.0
*/
public int $promotion = 0;
public int |
Bill $bill = 0;
public int|Bill $bill = 0;
/**
* Constructor.
*
* @since 1.0.0
*/
public function __construct()
{
$this->singleSalesPriceNet = new Money();
@ -104,58 +119,6 @@ class BillElement implements \JsonSerializable
return $this->id;
}
/**
* Set event.
*
* @param int $event Event
*
* @return void
*
* @since 1.0.0
*/
public function setEvent(int $event) : void
{
$this->event = $event;
}
/**
* Get event.
*
* @return mixed
*
* @since 1.0.0
*/
public function getEvent()
{
return $this->event;
}
/**
* Set promotion.
*
* @param int $promotion Promotion
*
* @return void
*
* @since 1.0.0
*/
public function setPromotion(int $promotion) : void
{
$this->promotion = $promotion;
}
/**
* Get promotion.
*
* @return string
*
* @since 1.0.0
*/
public function getPromotion()
{
return $this->promotion;
}
/**
* Set order.
*

View File

@ -26,13 +26,13 @@ use phpOMS\Stdlib\Base\Enum;
*/
abstract class BillStatus extends Enum
{
public const ACTIVE = 1;
public const ACTIVE = 1;
public const ARCHIVED = 2;
public const DELETED = 4;
public const DELETED = 4;
public const DONE = 8;
public const DONE = 8;
public const DRAFT = 16;
public const DRAFT = 16;
}

View File

@ -26,9 +26,9 @@ use phpOMS\Stdlib\Base\Enum;
*/
abstract class BillTransferType extends Enum
{
public const SALES = 1;
public const SALES = 1;
public const PURCHASE = 2;
public const STOCK = 4;
public const STOCK = 4;
}

View File

@ -43,9 +43,7 @@ class BillType
*
* @var string|BillTypeL11n
*/
protected string |
BillTypeL11n $l11n;
protected string|BillTypeL11n $l11n;
/**
* Constructor.
@ -85,12 +83,12 @@ class BillType
{
if ($l11n instanceof BillTypeL11n) {
$this->l11n = $l11n;
} elseif (\is_string($l11n)) {
$this->l11n = new BillTypeL11n();
$this->l11n->name = $l11n;
$this->l11n->setLanguage($lang);
} elseif ($this->l11n instanceof BillTypeL11n && \is_string($l11n)) {
} elseif ($this->l11n instanceof BillTypeL11n) {
$this->l11n->name = $l11n;
} else {
$this->l11n = new BillTypeL11n();
$this->l11n->name = $l11n;
$this->l11n->setLanguage($lang);
}
}

View File

@ -41,9 +41,7 @@ class BillTypeL11n implements \JsonSerializable, ArrayableInterface
* @var int
* @since 1.0.0
*/
protected int |
BillType $type = 0;
protected int|BillType $type = 0;
/**
* Language.

View File

@ -26,7 +26,7 @@ use phpOMS\Stdlib\Base\Enum;
*/
abstract class PermissionState extends Enum
{
public const SALES_INVOICE = 1;
public const SALES_INVOICE = 1;
public const PURCHASE_INVOICE = 2;

View File

@ -49,7 +49,7 @@ final class PurchaseBillMapper extends BillMapper
) : array
{
$query = self::getQuery(null, [], $relations, $depth);
$query->where(BillTypeMapper::getTable() . '_' . ($depth - 1) . '.billing_type_transfer_type', '=', BillTransferType::PURCHASE);
$query->where(BillTypeMapper::getTable() . '_d' . ($depth - 1) . '.billing_type_transfer_type', '=', BillTransferType::PURCHASE);
return self::getBeforePivot($pivot, $column, $limit, $order, $relations, $depth, $query);
}
@ -65,7 +65,7 @@ final class PurchaseBillMapper extends BillMapper
) : array
{
$query = self::getQuery(null, [], $relations, $depth);
$query->where(BillTypeMapper::getTable() . '_' . ($depth - 1) . '.billing_type_transfer_type', '=', BillTransferType::PURCHASE);
$query->where(BillTypeMapper::getTable() . '_d' . ($depth - 1) . '.billing_type_transfer_type', '=', BillTransferType::PURCHASE);
return self::getAfterPivot($pivot, $column, $limit, $order, $relations, $depth, $query);
}
@ -165,15 +165,15 @@ final class PurchaseBillMapper extends BillMapper
// @todo: limit is not working correctly... only returns / 2 or something like that?. Maybe because bills arent unique?
$query ??= self::getQuery(null, [], RelationType::ALL, $depth);
$query->leftJoin(BillElementMapper::getTable(), BillElementMapper::getTable() . '_' . $depth)
->on(self::$table . '_' . $depth . '.billing_bill_id', '=', BillElementMapper::getTable() . '_' . $depth . '.billing_bill_element_bill')
->where(BillElementMapper::getTable() . '_' . $depth . '.billing_bill_element_item', '=', $id)
$query->leftJoin(BillElementMapper::getTable(), BillElementMapper::getTable() . '_d' . $depth)
->on(self::$table . '_d' . $depth . '.billing_bill_id', '=', BillElementMapper::getTable() . '_d' . $depth . '.billing_bill_element_bill')
->where(BillElementMapper::getTable() . '_d' . $depth . '.billing_bill_element_item', '=', $id)
->limit($limit);
if (!empty(self::$createdAt)) {
$query->orderBy(self::$table . '_' . $depth . '.' . self::$columns[self::$createdAt]['name'], 'DESC');
$query->orderBy(self::$table . '_d' . $depth . '.' . self::$columns[self::$createdAt]['name'], 'DESC');
} else {
$query->orderBy(self::$table . '_' . $depth . '.' . self::$columns[self::$primaryField]['name'], 'DESC');
$query->orderBy(self::$table . '_d' . $depth . '.' . self::$columns[self::$primaryField]['name'], 'DESC');
}
return self::getAllByQuery($query, RelationType::ALL, $depth);
@ -186,13 +186,13 @@ final class PurchaseBillMapper extends BillMapper
// @todo: limit is not working correctly... only returns / 2 or something like that?. Maybe because bills arent unique?
$query ??= self::getQuery(null, [], RelationType::ALL, $depth);
$query->where(self::$table . '_' . $depth . '.billing_bill_supplier', '=', $id)
$query->where(self::$table . '_d' . $depth . '.billing_bill_supplier', '=', $id)
->limit($limit);
if (!empty(self::$createdAt)) {
$query->orderBy(self::$table . '_' . $depth . '.' . self::$columns[self::$createdAt]['name'], 'DESC');
$query->orderBy(self::$table . '_d' . $depth . '.' . self::$columns[self::$createdAt]['name'], 'DESC');
} else {
$query->orderBy(self::$table . '_' . $depth . '.' . self::$columns[self::$primaryField]['name'], 'DESC');
$query->orderBy(self::$table . '_d' . $depth . '.' . self::$columns[self::$primaryField]['name'], 'DESC');
}
return self::getAllByQuery($query, RelationType::ALL, $depth);
@ -204,16 +204,16 @@ final class PurchaseBillMapper extends BillMapper
$query ??= SupplierMapper::getQuery(null, [], RelationType::ALL, $depth);
$query->selectAs('SUM(billing_bill_element_total_purchaseprice_net)', 'net_purchase')
->leftJoin(self::$table, self::$table . '_' . $depth)
->on(SupplierMapper::getTable() . '_' . $depth . '.suppliermgmt_supplier_id', '=', self::$table . '_' . $depth . '.billing_bill_supplier')
->leftJoin(BillElementMapper::getTable(), BillElementMapper::getTable() . '_' . $depth)
->on(self::$table . '_' . $depth . '.billing_bill_id', '=', BillElementMapper::getTable() . '_' . $depth . '.billing_bill_element_bill')
->where(BillElementMapper::getTable() . '_' . $depth . '.billing_bill_element_item', '=', $id)
->andWhere(self::$table . '_' . $depth . '.billing_bill_performance_date', '>=', $start)
->andWhere(self::$table . '_' . $depth . '.billing_bill_performance_date', '<=', $end)
->leftJoin(self::$table, self::$table . '_d' . $depth)
->on(SupplierMapper::getTable() . '_d' . $depth . '.suppliermgmt_supplier_id', '=', self::$table . '_d' . $depth . '.billing_bill_supplier')
->leftJoin(BillElementMapper::getTable(), BillElementMapper::getTable() . '_d' . $depth)
->on(self::$table . '_d' . $depth . '.billing_bill_id', '=', BillElementMapper::getTable() . '_d' . $depth . '.billing_bill_element_bill')
->where(BillElementMapper::getTable() . '_d' . $depth . '.billing_bill_element_item', '=', $id)
->andWhere(self::$table . '_d' . $depth . '.billing_bill_performance_date', '>=', $start)
->andWhere(self::$table . '_d' . $depth . '.billing_bill_performance_date', '<=', $end)
->orderBy('net_purchase', 'DESC')
->limit($limit)
->groupBy(SupplierMapper::getTable() . '_' . $depth . '.suppliermgmt_supplier_id');
->groupBy(SupplierMapper::getTable() . '_d' . $depth . '.suppliermgmt_supplier_id');
$suppliers = SupplierMapper::getAllByQuery($query, RelationType::ALL, $depth);
$data = SupplierMapper::getDataLastQuery();

View File

@ -49,7 +49,7 @@ final class SalesBillMapper extends BillMapper
) : array
{
$query = self::getQuery(null, [], $relations, $depth);
$query->where(BillTypeMapper::getTable() . '_' . ($depth - 1) . '.billing_type_transfer_type', '=', BillTransferType::SALES);
$query->where(BillTypeMapper::getTable() . '_d' . ($depth - 1) . '.billing_type_transfer_type', '=', BillTransferType::SALES);
return self::getBeforePivot($pivot, $column, $limit, $order, $relations, $depth, $query);
}
@ -65,7 +65,7 @@ final class SalesBillMapper extends BillMapper
) : array
{
$query = self::getQuery(null, [], $relations, $depth);
$query->where(BillTypeMapper::getTable() . '_' . ($depth - 1) . '.billing_type_transfer_type', '=', BillTransferType::SALES);
$query->where(BillTypeMapper::getTable() . '_d' . ($depth - 1) . '.billing_type_transfer_type', '=', BillTransferType::SALES);
return self::getAfterPivot($pivot, $column, $limit, $order, $relations, $depth, $query);
}
@ -165,15 +165,15 @@ final class SalesBillMapper extends BillMapper
// @todo: limit is not working correctly... only returns / 2 or something like that?. Maybe because bills arent unique?
$query ??= self::getQuery(null, [], RelationType::ALL, $depth);
$query->leftJoin(BillElementMapper::getTable(), BillElementMapper::getTable() . '_' . $depth)
->on(self::$table . '_' . $depth . '.billing_bill_id', '=', BillElementMapper::getTable() . '_' . $depth . '.billing_bill_element_bill')
->where(BillElementMapper::getTable() . '_' . $depth . '.billing_bill_element_item', '=', $id)
$query->leftJoin(BillElementMapper::getTable(), BillElementMapper::getTable() . '_d' . $depth)
->on(self::$table . '_d' . $depth . '.billing_bill_id', '=', BillElementMapper::getTable() . '_d' . $depth . '.billing_bill_element_bill')
->where(BillElementMapper::getTable() . '_d' . $depth . '.billing_bill_element_item', '=', $id)
->limit($limit);
if (!empty(self::$createdAt)) {
$query->orderBy(self::$table . '_' . $depth . '.' . self::$columns[self::$createdAt]['name'], 'DESC');
$query->orderBy(self::$table . '_d' . $depth . '.' . self::$columns[self::$createdAt]['name'], 'DESC');
} else {
$query->orderBy(self::$table . '_' . $depth . '.' . self::$columns[self::$primaryField]['name'], 'DESC');
$query->orderBy(self::$table . '_d' . $depth . '.' . self::$columns[self::$primaryField]['name'], 'DESC');
}
return self::getAllByQuery($query, RelationType::ALL, $depth);
@ -186,13 +186,13 @@ final class SalesBillMapper extends BillMapper
// @todo: limit is not working correctly... only returns / 2 or something like that?. Maybe because bills arent unique?
$query ??= self::getQuery(null, [], RelationType::ALL, $depth);
$query->where(self::$table . '_' . $depth . '.billing_bill_client', '=', $id)
$query->where(self::$table . '_d' . $depth . '.billing_bill_client', '=', $id)
->limit($limit);
if (!empty(self::$createdAt)) {
$query->orderBy(self::$table . '_' . $depth . '.' . self::$columns[self::$createdAt]['name'], 'DESC');
$query->orderBy(self::$table . '_d' . $depth . '.' . self::$columns[self::$createdAt]['name'], 'DESC');
} else {
$query->orderBy(self::$table . '_' . $depth . '.' . self::$columns[self::$primaryField]['name'], 'DESC');
$query->orderBy(self::$table . '_d' . $depth . '.' . self::$columns[self::$primaryField]['name'], 'DESC');
}
return self::getAllByQuery($query, RelationType::ALL, $depth);
@ -204,16 +204,16 @@ final class SalesBillMapper extends BillMapper
$query ??= ClientMapper::getQuery(null, [], RelationType::ALL, $depth);
$query->selectAs('SUM(billing_bill_element_total_salesprice_net)', 'net_sales')
->leftJoin(self::$table, self::$table . '_' . $depth)
->on(ClientMapper::getTable() . '_' . $depth . '.clientmgmt_client_id', '=', self::$table . '_' . $depth . '.billing_bill_client')
->leftJoin(BillElementMapper::getTable(), BillElementMapper::getTable() . '_' . $depth)
->on(self::$table . '_' . $depth . '.billing_bill_id', '=', BillElementMapper::getTable() . '_' . $depth . '.billing_bill_element_bill')
->where(BillElementMapper::getTable() . '_' . $depth . '.billing_bill_element_item', '=', $id)
->andWhere(self::$table . '_' . $depth . '.billing_bill_performance_date', '>=', $start)
->andWhere(self::$table . '_' . $depth . '.billing_bill_performance_date', '<=', $end)
->leftJoin(self::$table, self::$table . '_d' . $depth)
->on(ClientMapper::getTable() . '_d' . $depth . '.clientmgmt_client_id', '=', self::$table . '_d' . $depth . '.billing_bill_client')
->leftJoin(BillElementMapper::getTable(), BillElementMapper::getTable() . '_d' . $depth)
->on(self::$table . '_d' . $depth . '.billing_bill_id', '=', BillElementMapper::getTable() . '_d' . $depth . '.billing_bill_element_bill')
->where(BillElementMapper::getTable() . '_d' . $depth . '.billing_bill_element_item', '=', $id)
->andWhere(self::$table . '_d' . $depth . '.billing_bill_performance_date', '>=', $start)
->andWhere(self::$table . '_d' . $depth . '.billing_bill_performance_date', '<=', $end)
->orderBy('net_sales', 'DESC')
->limit($limit)
->groupBy(ClientMapper::getTable() . '_' . $depth . '.clientmgmt_client_id');
->groupBy(ClientMapper::getTable() . '_d' . $depth . '.clientmgmt_client_id');
$clients = ClientMapper::getAllByQuery($query, RelationType::ALL, $depth);
$data = ClientMapper::getDataLastQuery();
@ -228,15 +228,15 @@ final class SalesBillMapper extends BillMapper
// @todo: limit is not working correctly... only returns / 2 or something like that?. Maybe because bills arent unique?
$query ??= self::getQuery(null, [], RelationType::ALL, $depth);
$query->leftJoin(BillElementMapper::getTable(), BillElementMapper::getTable() . '_' . $depth)
->on(self::$table . '_' . $depth . '.billing_bill_id', '=', BillElementMapper::getTable() . '_' . $depth . '.billing_bill_element_bill')
->where(BillElementMapper::getTable() . '_' . $depth . '.billing_bill_element_item', '=', $id)
$query->leftJoin(BillElementMapper::getTable(), BillElementMapper::getTable() . '_d' . $depth)
->on(self::$table . '_d' . $depth . '.billing_bill_id', '=', BillElementMapper::getTable() . '_d' . $depth . '.billing_bill_element_bill')
->where(BillElementMapper::getTable() . '_d' . $depth . '.billing_bill_element_item', '=', $id)
->limit($limit = 10);
if (!empty(self::$createdAt)) {
$query->orderBy(self::$table . '_' . $depth . '.' . self::$columns[self::$createdAt]['name'], 'DESC');
$query->orderBy(self::$table . '_d' . $depth . '.' . self::$columns[self::$createdAt]['name'], 'DESC');
} else {
$query->orderBy(self::$table . '_' . $depth . '.' . self::$columns[self::$primaryField]['name'], 'DESC');
$query->orderBy(self::$table . '_d' . $depth . '.' . self::$columns[self::$primaryField]['name'], 'DESC');
}
return self::getAllByQuery($query, RelationType::ALL, $depth);
@ -249,15 +249,15 @@ final class SalesBillMapper extends BillMapper
// @todo: limit is not working correctly... only returns / 2 or something like that?. Maybe because bills arent unique?
$query ??= BillElementMapper::getQuery(null, [], RelationType::ALL, $depth);
$query->leftJoin(self::$table, self::$table . '_' . $depth)
->on(BillElementMapper::getTable() . '_' . $depth . '.billing_bill_element_bill', '=', self::$table . '_' . $depth . '.billing_bill_id')
->where(self::$table . '_' . $depth . '.billing_bill_client', '=', $client)
$query->leftJoin(self::$table, self::$table . '_d' . $depth)
->on(BillElementMapper::getTable() . '_d' . $depth . '.billing_bill_element_bill', '=', self::$table . '_d' . $depth . '.billing_bill_id')
->where(self::$table . '_d' . $depth . '.billing_bill_client', '=', $client)
->limit($limit = 10);
if (!empty(self::$createdAt)) {
$query->orderBy(self::$table . '_' . $depth . '.' . self::$columns[self::$createdAt]['name'], 'DESC');
$query->orderBy(self::$table . '_d' . $depth . '.' . self::$columns[self::$createdAt]['name'], 'DESC');
} else {
$query->orderBy(self::$table . '_' . $depth . '.' . self::$columns[self::$primaryField]['name'], 'DESC');
$query->orderBy(self::$table . '_d' . $depth . '.' . self::$columns[self::$primaryField]['name'], 'DESC');
}
return BillElementMapper::getAllByQuery($query, RelationType::ALL, $depth);

View File

@ -46,7 +46,7 @@ final class StockBillMapper extends BillMapper
) : array
{
$query = self::getQuery(null, [], $relations, $depth);
$query->where(BillTypeMapper::getTable() . '_' . ($depth - 1) . '.billing_type_transfer_type', '=', BillTransferType::STOCK);
$query->where(BillTypeMapper::getTable() . '_d' . ($depth - 1) . '.billing_type_transfer_type', '=', BillTransferType::STOCK);
return self::getBeforePivot($pivot, $column, $limit, $order, $relations, $depth, $query);
}
@ -62,7 +62,7 @@ final class StockBillMapper extends BillMapper
) : array
{
$query = self::getQuery(null, [], $relations, $depth);
$query->where(BillTypeMapper::getTable() . '_' . ($depth - 1) . '.billing_type_transfer_type', '=', BillTransferType::STOCK);
$query->where(BillTypeMapper::getTable() . '_d' . ($depth - 1) . '.billing_type_transfer_type', '=', BillTransferType::STOCK);
return self::getAfterPivot($pivot, $column, $limit, $order, $relations, $depth, $query);
}

File diff suppressed because it is too large Load Diff

View File

@ -319,12 +319,12 @@ echo $this->getData('nav')->render();
</div>
<div class="row">
<div class="col-xs-12">
<div class="col-xs-12">
<section class="portlet">
<div class="portlet-head">
Sales / Rep
<?php include __DIR__ . '/../../../../Web/Backend/Themes/popup-export-data.tpl.php'; ?>
</div>
<div class="portlet-head">
Sales / Rep
<?php include __DIR__ . '/../../../../Web/Backend/Themes/popup-export-data.tpl.php'; ?>
</div>
<table class="default">
<thead>
<tr>

View File

@ -9,7 +9,7 @@
],
"require-dev": {
"phpunit/phpunit": ">=9.4",
"friendsofphp/php-cs-fixer": ">=2.18",
"friendsofphp/php-cs-fixer": ">=3.0",
"squizlabs/php_codesniffer": ">=3.5",
"phpmd/phpmd": ">=2.9",
"phpstan/phpstan": ">=0.12.58",