Non puoi selezionare più di 25 argomenti
Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
101 righe
2.9 KiB
101 righe
2.9 KiB
<?php |
|
|
|
require_once ROOT . "/lib/classes/IDataClass.php"; |
|
|
|
class Esportazioni extends DataClass |
|
{ |
|
const TABLE_NAME = "ESPORTAZIONI"; |
|
const SEQ_NAME = "ESPORTAZIONI_SEQ"; |
|
|
|
public $LOTTO = 0; |
|
public $DATA_CREAZIONE = null; |
|
public $DATA_FILTRO = null; |
|
public $NUMERO_DRS = ''; |
|
public $DATA_DRS = null; |
|
public $FILEPATH = null; |
|
public $TIPO = null; |
|
public $IMPORTO_MANDATO = null; |
|
public $MESE_RIFERIMENTO = ''; |
|
public $CAPITOLO_BILANCIO = ''; |
|
public $ANNO_FINANZIARIO = ''; |
|
public $CODICE_FINANZIARIO = ''; |
|
public $FILEPATH_DRS = null; |
|
|
|
public function __construct($src = null) |
|
{ |
|
global $con; |
|
if ($src == null) { |
|
return; |
|
} |
|
$stripSlashes = false; |
|
if (is_array($src)) { |
|
if (isset($src['LOTTO']) && $src['LOTTO'] > 0) { |
|
$this->_loadAndFillObject($src['LOTTO'], self::TABLE_NAME, $src,$con,'LOTTO'); |
|
} else { |
|
$this->_loadByRow($src, $stripSlashes); |
|
} |
|
} elseif (intval($src)) { |
|
$sql = "SELECT * FROM " . self::TABLE_NAME . " WHERE LOTTO = :id"; |
|
$query = $con->prepare($sql); |
|
$query->bindParam(":id", $src); |
|
try { |
|
$query->execute(); |
|
$it = $query->fetchAll(PDO::FETCH_ASSOC); |
|
Utils::FillObjectFromRow($this, $it[0]); |
|
} catch (Exception $exc) { |
|
$exc->getMessage(); |
|
} |
|
} |
|
} |
|
|
|
public static function Count($filter = null) |
|
{ |
|
return parent::_count(self::TABLE_NAME, $filter); |
|
} |
|
|
|
public static function LoadDataTable($searchQuery = "", $searchArray = array(), $columnName = array(), $columnSortOrder = array(), $start = 0, $offset = 0, $totCount = false) |
|
{ |
|
return parent::_loadDataTable(self::TABLE_NAME, $searchQuery, $searchArray, $columnName, $columnSortOrder, $start, $offset, $totCount); |
|
} |
|
|
|
public function Save() |
|
{ |
|
global $con; |
|
$vars = get_object_vars($this); |
|
unset($vars['DATA_CREAZIONE']); |
|
$sql = Utils::prepareQuery(self::TABLE_NAME, $vars, 'LOTTO'); |
|
//echo $sql; |
|
//Utils::print_array($vars); |
|
|
|
//exit(); |
|
$queryabi = $con->prepare($sql); |
|
foreach ($vars as $k => $v) { |
|
if ($k == "LOTTO" && $v == 0) { |
|
continue; |
|
} |
|
$queryabi->bindValue(":" . $k, $v); |
|
} |
|
|
|
try { |
|
$it = parent::_Save($queryabi); |
|
} catch (Exception $exc) { |
|
$it['descrizioneErrore'] = $exc->getMessage(); |
|
} |
|
return $it; |
|
} |
|
|
|
public function Delete() |
|
{ |
|
return parent::_Delete(self::TABLE_NAME, "LOTTO = " . $this->LOTTO); |
|
} |
|
|
|
public function Parse(&$record, $campo = "") |
|
{ |
|
array_push($record, array("Campo" => $campo, "Valore" => $this->$campo)); |
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|