| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?php
- class FactureStatCommon
- {
- public $db;
- const HUF = 'HUF';
- const EUR = 'EUR';
- const CASH = 'LIQ';
- const CARD = 'CB';
- /**
- *
- */
- public function __construct()
- {
- global $db;
-
- $this->db = $db;
- }
- /**
- * Generate entity SQL condition to query from facture table
- *
- * @param int $entity Entity ID
- *
- * @return string SQL condition
- */
- public function getEntitySql(int $entity): string
- {
- return ($entity > 0) ? " AND f.entity={$entity}" : '';
- }
- /**
- * Generate facture payment mode SQL condition
- */
- public function getPaymentCodeSql(string $paymentCode): string
- {
- return "
- AND f.fk_mode_reglement=(
- SELECT p.id
- FROM ".MAIN_DB_PREFIX."c_paiement AS p
- WHERE p.entity=f.entity
- AND p.code ILIKE '{$paymentCode}'
- AND p.active=1
- ) ";
- }
- }
|