diff --git a/Admin/Install/Media/bill.pdf.php b/Admin/Install/Media/bill.pdf.php index fe0100b..3ba00e9 100755 --- a/Admin/Install/Media/bill.pdf.php +++ b/Admin/Install/Media/bill.pdf.php @@ -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 = ' - +
Date: 13th November 2008
- - - - - + + + + +
- SOLD TO:

- 345 Anotherstreet
- Little Village
- Their City
- CB22 6SO -
  - SHIP TO:

- 345 Anotherstreet
- Little Village
- Their City
CB22 6SO
+ SOLD TO:

+ 345 Anotherstreet
+ Little Village
+ Their City
+ CB22 6SO +
  + SHIP TO:

+ 345 Anotherstreet
+ Little Village
+ Their City
CB22 6SO

- - - - - - - - - + + + + + + + + + '; foreach ($elements as $element) { $html .= ' - - - - - - - '; + + + + + + + '; } $html .= ' - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + +
Ref. No.QuantityDescriptionUnit PriceAmount
Ref. No.QuantityDescriptionUnit PriceAmount
' . $element->itemNumber . '' . $element->quantity . '' . $element->itemName . '' . $element->singleSalesPriceNet->getCurrency(null) . '' . $element->totalSalesPriceNet->getCurrency(null) . '
' . $element->itemNumber . '' . $element->quantity . '' . $element->itemName . '' . $element->singleSalesPriceNet->getCurrency(null) . '' . $element->totalSalesPriceNet->getCurrency(null) . '
Subtotal:' . $bill->net->getCurrency(null) . '
Tax:£18.25
Shipping:£42.56
TOTAL:' . $bill->gross->getCurrency(null) . '
Deposit:£100.00
Balance due:£1782.56
Subtotal:' . $bill->net->getCurrency(null) . '
Tax:£18.25
Shipping:£42.56
TOTAL:' . $bill->gross->getCurrency(null) . '
Deposit:£100.00
Balance due:£1782.56
Payment terms: payment due in 30 days
diff --git a/Controller/ApiController.php b/Controller/ApiController.php index 5ef79b3..20f94a0 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -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; diff --git a/Models/Bill.php b/Models/Bill.php index 6a5b6da..811b42a 100755 --- a/Models/Bill.php +++ b/Models/Bill.php @@ -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. diff --git a/Models/BillElement.php b/Models/BillElement.php index 4e8a75c..64314e5 100755 --- a/Models/BillElement.php +++ b/Models/BillElement.php @@ -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. * diff --git a/Models/BillStatus.php b/Models/BillStatus.php index e3f8bbc..e502133 100755 --- a/Models/BillStatus.php +++ b/Models/BillStatus.php @@ -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; } diff --git a/Models/BillTransferType.php b/Models/BillTransferType.php index 473bc16..d0e3d9e 100755 --- a/Models/BillTransferType.php +++ b/Models/BillTransferType.php @@ -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; } diff --git a/Models/BillType.php b/Models/BillType.php index 6775f64..4ca85cc 100755 --- a/Models/BillType.php +++ b/Models/BillType.php @@ -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); } } diff --git a/Models/BillTypeL11n.php b/Models/BillTypeL11n.php index df51dfd..6d1f6cf 100755 --- a/Models/BillTypeL11n.php +++ b/Models/BillTypeL11n.php @@ -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. diff --git a/Models/PermissionState.php b/Models/PermissionState.php index 7486bd5..d34fb4b 100755 --- a/Models/PermissionState.php +++ b/Models/PermissionState.php @@ -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; diff --git a/Models/PurchaseBillMapper.php b/Models/PurchaseBillMapper.php index 972f250..ff8c8ed 100755 --- a/Models/PurchaseBillMapper.php +++ b/Models/PurchaseBillMapper.php @@ -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(); diff --git a/Models/SalesBillMapper.php b/Models/SalesBillMapper.php index 2ff8354..7992d87 100755 --- a/Models/SalesBillMapper.php +++ b/Models/SalesBillMapper.php @@ -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); diff --git a/Models/StockBillMapper.php b/Models/StockBillMapper.php index ad2f0ab..63acb52 100755 --- a/Models/StockBillMapper.php +++ b/Models/StockBillMapper.php @@ -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); } diff --git a/Theme/Backend/region-analysis.tpl.php b/Theme/Backend/region-analysis.tpl.php index eba0a01..3117255 100644 --- a/Theme/Backend/region-analysis.tpl.php +++ b/Theme/Backend/region-analysis.tpl.php @@ -32,13 +32,13 @@ echo $this->getData('nav')->render();
- request->uri->fragment === 'c-tab-1' ? ' checked' : ''; ?>> + request->uri->fragment === 'c-tab-1' ? ' checked' : ''; ?>>
-
+
-
-
getHtml('Filter'); ?>
+ +
getHtml('Filter'); ?>
@@ -86,579 +86,579 @@ echo $this->getData('nav')->render();
-
-
-
+ +
+
request->uri->fragment === 'c-tab-1' ? ' checked' : ''; ?>>
-
-
-
-
- Sales per Region - Current - -
- getData('currentCustomerRegion'); ?> -
- , - , - , - , - , - - ], - "backgroundColor": [ - "rgb(255, 99, 132)", - "rgb(255, 159, 64)", - "rgb(255, 205, 86)", - "rgb(75, 192, 192)", - "rgb(54, 162, 235)", - "rgb(153, 102, 255)" - ] - }] - }, - "options": { - "title": { - "display": false, - "text": "Customers per Region - Currently" - } - } - }'> +
+
+
+
+ Sales per Region - Current + +
+ getData('currentCustomerRegion'); ?> +
+ , + , + , + , + , + + ], + "backgroundColor": [ + "rgb(255, 99, 132)", + "rgb(255, 159, 64)", + "rgb(255, 205, 86)", + "rgb(75, 192, 192)", + "rgb(54, 162, 235)", + "rgb(153, 102, 255)" + ] + }] + }, + "options": { + "title": { + "display": false, + "text": "Customers per Region - Currently" + } + } + }'> -
- - -
- - - - - $values) : $sum += $values; ?> - - -
Region - Customer count -
- - -
Total - -
-
-
-
-
-
+
+ + +
+ + + + + $values) : $sum += $values; ?> + + +
Region + Customer count +
+ + +
Total + +
+
+
+
+
+
-
-
-
- Sales per Region - Annual - -
- getData('annualCustomerRegion'); ?> -
- - - ], - "datasets": [ - { - "label": "getHtml('Total'); ?>", - "type": "line", - "data": [ - - - ], - "fill": false, - "borderColor": "rgb(139, 139, 139)", - "backgroundColor": "rgb(139, 139, 139)", - "tension": 0.0 - }, - { - "label": "getHtml('Europe'); ?>", - "type": "line", - "data": [ - - - ], - "fill": false, - "borderColor": "rgb(255, 99, 132)", - "backgroundColor": "rgb(255, 99, 132)", - "tension": 0.0 - }, - { - "label": "getHtml('America'); ?>", - "type": "line", - "data": [ - - - ], - "fill": false, - "borderColor": "rgb(255, 159, 64)", - "backgroundColor": "rgb(255, 159, 64)", - "tension": 0.0 - }, - { - "label": "getHtml('Asia'); ?>", - "type": "line", - "data": [ - - - ], - "fill": false, - "borderColor": "rgb(255, 205, 86)", - "backgroundColor": "rgb(255, 205, 86)", - "tension": 0.0 - }, - { - "label": "getHtml('Africa'); ?>", - "type": "line", - "data": [ - - - ], - "fill": false, - "borderColor": "rgb(75, 192, 192)", - "backgroundColor": "rgb(75, 192, 192)", - "tension": 0.0 - }, - { - "label": "getHtml('CIS'); ?>", - "type": "line", - "data": [ - - - ], - "fill": false, - "borderColor": "rgb(54, 162, 235)", - "backgroundColor": "rgb(54, 162, 235)", - "tension": 0.0 - }, - { - "label": "getHtml('Other'); ?>", - "type": "line", - "data": [ - - - ], - "fill": false, - "borderColor": "rgb(153, 102, 255)", - "backgroundColor": "rgb(153, 102, 255)", - "tension": 0.0 - } - ] - }, - "options": { - "title": { - "display": false, - "text": "Sales per Region - Annual" - }, - "scales": { - "yAxes": [ - { - "id": "axis-1", - "display": true, - "position": "left" - } - ] - } - } - }'> +
+
+
+ Sales per Region - Annual + +
+ getData('annualCustomerRegion'); ?> +
+ + + ], + "datasets": [ + { + "label": "getHtml('Total'); ?>", + "type": "line", + "data": [ + + + ], + "fill": false, + "borderColor": "rgb(139, 139, 139)", + "backgroundColor": "rgb(139, 139, 139)", + "tension": 0.0 + }, + { + "label": "getHtml('Europe'); ?>", + "type": "line", + "data": [ + + + ], + "fill": false, + "borderColor": "rgb(255, 99, 132)", + "backgroundColor": "rgb(255, 99, 132)", + "tension": 0.0 + }, + { + "label": "getHtml('America'); ?>", + "type": "line", + "data": [ + + + ], + "fill": false, + "borderColor": "rgb(255, 159, 64)", + "backgroundColor": "rgb(255, 159, 64)", + "tension": 0.0 + }, + { + "label": "getHtml('Asia'); ?>", + "type": "line", + "data": [ + + + ], + "fill": false, + "borderColor": "rgb(255, 205, 86)", + "backgroundColor": "rgb(255, 205, 86)", + "tension": 0.0 + }, + { + "label": "getHtml('Africa'); ?>", + "type": "line", + "data": [ + + + ], + "fill": false, + "borderColor": "rgb(75, 192, 192)", + "backgroundColor": "rgb(75, 192, 192)", + "tension": 0.0 + }, + { + "label": "getHtml('CIS'); ?>", + "type": "line", + "data": [ + + + ], + "fill": false, + "borderColor": "rgb(54, 162, 235)", + "backgroundColor": "rgb(54, 162, 235)", + "tension": 0.0 + }, + { + "label": "getHtml('Other'); ?>", + "type": "line", + "data": [ + + + ], + "fill": false, + "borderColor": "rgb(153, 102, 255)", + "backgroundColor": "rgb(153, 102, 255)", + "tension": 0.0 + } + ] + }, + "options": { + "title": { + "display": false, + "text": "Sales per Region - Annual" + }, + "scales": { + "yAxes": [ + { + "id": "axis-1", + "display": true, + "position": "left" + } + ] + } + } + }'> -
- - -
- - - - - - -
Region - $values) : ?> - - -
- $annual) : ?> - - -
-
-
-
-
-
-
+
+ + +
+ + + + + + +
Region + $values) : ?> + + +
+ $annual) : ?> + + +
+
+
+
+ +
+
-
-
-
-
- Profit per Region - Current - -
- getData('currentCustomerRegion'); ?> -
- , - , - , - , - , - - ], - "backgroundColor": [ - "rgb(255, 99, 132)", - "rgb(255, 159, 64)", - "rgb(255, 205, 86)", - "rgb(75, 192, 192)", - "rgb(54, 162, 235)", - "rgb(153, 102, 255)" - ] - }] - }, - "options": { - "title": { - "display": false, - "text": "Customers per Region - Currently" - } - } - }'> +
+
+
+
+ Profit per Region - Current + +
+ getData('currentCustomerRegion'); ?> +
+ , + , + , + , + , + + ], + "backgroundColor": [ + "rgb(255, 99, 132)", + "rgb(255, 159, 64)", + "rgb(255, 205, 86)", + "rgb(75, 192, 192)", + "rgb(54, 162, 235)", + "rgb(153, 102, 255)" + ] + }] + }, + "options": { + "title": { + "display": false, + "text": "Customers per Region - Currently" + } + } + }'> -
- - -
- - - - - $values) : $sum += $values; ?> - - -
Region - Customer count -
- - -
Total - -
-
-
-
-
-
+
+ + +
+ + + + + $values) : $sum += $values; ?> + + +
Region + Customer count +
+ + +
Total + +
+
+
+
+
+
-
-
-
- Profit per Region - Annual - -
- getData('annualCustomerRegion'); ?> -
- - - ], - "datasets": [ - { - "label": "getHtml('Total'); ?>", - "type": "line", - "data": [ - - - ], - "fill": false, - "borderColor": "rgb(139, 139, 139)", - "backgroundColor": "rgb(139, 139, 139)", - "tension": 0.0 - }, - { - "label": "getHtml('Europe'); ?>", - "type": "line", - "data": [ - - - ], - "fill": false, - "borderColor": "rgb(255, 99, 132)", - "backgroundColor": "rgb(255, 99, 132)", - "tension": 0.0 - }, - { - "label": "getHtml('America'); ?>", - "type": "line", - "data": [ - - - ], - "fill": false, - "borderColor": "rgb(255, 159, 64)", - "backgroundColor": "rgb(255, 159, 64)", - "tension": 0.0 - }, - { - "label": "getHtml('Asia'); ?>", - "type": "line", - "data": [ - - - ], - "fill": false, - "borderColor": "rgb(255, 205, 86)", - "backgroundColor": "rgb(255, 205, 86)", - "tension": 0.0 - }, - { - "label": "getHtml('Africa'); ?>", - "type": "line", - "data": [ - - - ], - "fill": false, - "borderColor": "rgb(75, 192, 192)", - "backgroundColor": "rgb(75, 192, 192)", - "tension": 0.0 - }, - { - "label": "getHtml('CIS'); ?>", - "type": "line", - "data": [ - - - ], - "fill": false, - "borderColor": "rgb(54, 162, 235)", - "backgroundColor": "rgb(54, 162, 235)", - "tension": 0.0 - }, - { - "label": "getHtml('Other'); ?>", - "type": "line", - "data": [ - - - ], - "fill": false, - "borderColor": "rgb(153, 102, 255)", - "backgroundColor": "rgb(153, 102, 255)", - "tension": 0.0 - } - ] - }, - "options": { - "title": { - "display": false, - "text": "Sales per Region - Annual" - }, - "scales": { - "yAxes": [ - { - "id": "axis-1", - "display": true, - "position": "left" - } - ] - } - } - }'> +
+
+
+ Profit per Region - Annual + +
+ getData('annualCustomerRegion'); ?> +
+ + + ], + "datasets": [ + { + "label": "getHtml('Total'); ?>", + "type": "line", + "data": [ + + + ], + "fill": false, + "borderColor": "rgb(139, 139, 139)", + "backgroundColor": "rgb(139, 139, 139)", + "tension": 0.0 + }, + { + "label": "getHtml('Europe'); ?>", + "type": "line", + "data": [ + + + ], + "fill": false, + "borderColor": "rgb(255, 99, 132)", + "backgroundColor": "rgb(255, 99, 132)", + "tension": 0.0 + }, + { + "label": "getHtml('America'); ?>", + "type": "line", + "data": [ + + + ], + "fill": false, + "borderColor": "rgb(255, 159, 64)", + "backgroundColor": "rgb(255, 159, 64)", + "tension": 0.0 + }, + { + "label": "getHtml('Asia'); ?>", + "type": "line", + "data": [ + + + ], + "fill": false, + "borderColor": "rgb(255, 205, 86)", + "backgroundColor": "rgb(255, 205, 86)", + "tension": 0.0 + }, + { + "label": "getHtml('Africa'); ?>", + "type": "line", + "data": [ + + + ], + "fill": false, + "borderColor": "rgb(75, 192, 192)", + "backgroundColor": "rgb(75, 192, 192)", + "tension": 0.0 + }, + { + "label": "getHtml('CIS'); ?>", + "type": "line", + "data": [ + + + ], + "fill": false, + "borderColor": "rgb(54, 162, 235)", + "backgroundColor": "rgb(54, 162, 235)", + "tension": 0.0 + }, + { + "label": "getHtml('Other'); ?>", + "type": "line", + "data": [ + + + ], + "fill": false, + "borderColor": "rgb(153, 102, 255)", + "backgroundColor": "rgb(153, 102, 255)", + "tension": 0.0 + } + ] + }, + "options": { + "title": { + "display": false, + "text": "Sales per Region - Annual" + }, + "scales": { + "yAxes": [ + { + "id": "axis-1", + "display": true, + "position": "left" + } + ] + } + } + }'> -
- - -
- - - - - - -
Region - $values) : ?> - - -
- $annual) : ?> - - -
-
-
-
-
-
-
+
+ + +
+ + + + + + +
Region + $values) : ?> + + +
+ $annual) : ?> + + +
+
+
+
+ +
+ -
-
-
-
- Sales / Region - -
- - - - -
Country - Sales PY - Sales B - Sales A - Diff PY - Diff B -
-
-
-
+
+
+
+
+ Sales / Region + +
+ + + + +
Country + Sales PY + Sales B + Sales A + Diff PY + Diff B +
+
+
+
request->uri->fragment === 'c-tab-3' ? ' checked' : ''; ?>>
-
+
@@ -675,7 +675,7 @@ echo $this->getData('nav')->render();
-
+
@@ -1750,7 +1750,7 @@ echo $this->getData('nav')->render();
-
+
\ No newline at end of file diff --git a/Theme/Backend/rep-analysis.tpl.php b/Theme/Backend/rep-analysis.tpl.php index 1d8c1df..c8f49ab 100644 --- a/Theme/Backend/rep-analysis.tpl.php +++ b/Theme/Backend/rep-analysis.tpl.php @@ -319,12 +319,12 @@ echo $this->getData('nav')->render();
-
+
-
- Sales / Rep - -
+
+ Sales / Rep + +
diff --git a/composer.json b/composer.json index 8f2fb6d..7ad134b 100755 --- a/composer.json +++ b/composer.json @@ -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",