ldc-gen-game-web/ldccrm_client/CPCBon.class.php
2020-10-29 15:40:23 +01:00

199 lines
No EOL
3.3 KiB
PHP

<?php
include_once ('datatypes.inc.php') ;
include_once ('errors.inc.php') ;
include_once ('pi_barcode.php') ;
/**
* Classe faisant abstraction d'un Bon de reduction
*
* @package PlatosClient
* @name CPCBon
*/
class CPCBon
{
/**
* @var int
* @access public
*/
public $iId ;
/**
* @var string
* @access public
*/
public $zTypeBon ;
/**
* @var string
* @access public
*/
public $zMontant ;
/**
* @var string
* @access public
*/
public $zEan13 ;
/**
* @var string
* @access public
*/
public $zDebutValidite ;
/**
* @var string
* @access public
*/
public $zFinValidite ;
/**
* @var string
* @access public
*/
public $zNomMarque ;
/**
* @var string
* @access public
*/
public $zAdresseMarque ;
/**
* @var string
* @access public
*/
public $zRcsMarque ;
/**
* @var string
* @access public
*/
public $zConditionValidite ;
/**
* @var string
* @access public
*/
public $zListeProduits ;
/**
* @var string
* @access public
*/
public $zLimitationGeographique ;
/**
* @var int
* @access public
*/
public $iNombreBons ;
/**
* @var string
* @access public
*/
public $zEan128 ;
/**
* @var int
* @access public
*/
public $iBonId ;
/**
* Vérification code barre pour l'EAN 128
*
*/
public function checkEAN128Code ()
{
if ($this->zEan128 == "")
{
throw new Exception ("Code EAN 128 vide") ;
}
return true ;
}
/**
* Génération du code barre pour l'EAN 128
*
*/
public function printEAN128BarCode ($_iWidth = 300, $_iHeight = 40)
{
if ($this->zEan128 != "")
{
$oCode = new CBCEan128 ($_iWidth, $_iHeight) ;
$oCode->parseHumanReadableString ($this->zEan128) ;
$oCode->showBarcodeImage () ;
}
else
{
throw new Exception ("Code EAN 128 vide") ;
}
}
/**
* Vérification du code pour l'EAN 13 de l'opération
*
*/
public function checkEAN13Code ()
{
if ($this->zEan13 != "")
{
$oCode = new pi_barcode () ;
$oCode->setType ("EAN") ;
$oCode->setCode ($this->zEan13) ;
$oCode->checkCode () ;
if ($oCode->TYPE == "ERR")
{
throw new Exception ($oCode->FULLCODE) ;
}
}
else
{
throw new Exception ("Code EAN 128 vide") ;
}
}
/**
* Génération du code barre pour l'EAN 13 de l'opération
*
*/
public function printEAN13BarCode ($_iWidth = 125, $_iHeight = 40)
{
if ($this->zEan13 != "")
{
$oCode = new pi_barcode () ;
$oCode->setType ("EAN") ;
$oCode->setSize ($_iHeight, $_iWidth) ;
$oCode->setCode ($this->zEan13) ;
$oCode->checkCode () ;
if ($oCode->TYPE == "ERR")
{
throw new Exception ($oCode->FULLCODE) ;
}
$oCode->showBarcodeImage () ;
}
else
{
throw new Exception ("Code EAN 128 vide") ;
}
}
}
?>