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.
202 righe
6.2 KiB
202 righe
6.2 KiB
<?php |
|
|
|
require_once "IDataClass.php"; |
|
|
|
/** |
|
* Description of ClusterDb |
|
* Tabella popolata con i dati di Agenzia delle Entrate e InfoCamere |
|
* @author Anselmo |
|
*/ |
|
class ClusterDb extends DataClass { |
|
|
|
const TABLE_NAME = "CLUSTER_DB"; |
|
const SEQ_NAME = "CLUSTER_DB_ID_SEQ"; |
|
|
|
public $ID = 0; // PK |
|
public $CODICE_FISCALE = ""; // Campo sul quale fare il controllo per il presentazione della domanda. |
|
public $PARTITA_IVA = ""; |
|
public $DENOMINAZIONE = ""; |
|
public $DATA_ISCRIZIONE_REGISTRO = ""; |
|
public $ATECO = ""; |
|
public $TOT_VOL_IVA_2018 = ""; |
|
public $CONTRIBUTO = ""; |
|
|
|
public function __construct($src = null) { |
|
global $con; |
|
if ($src == null) |
|
return; |
|
if (is_array($src)) { |
|
if (isset($src['ID']) && $src['ID'] > 0) { |
|
$this->_loadAndFillObject($src['ID'], self::TABLE_NAME, $src); |
|
} else { |
|
$this->_loadByRow($src, $stripSlashes); |
|
} |
|
} elseif (intval($src)) { |
|
$this->_loadById($src, self::TABLE_NAME, true); |
|
} |
|
} |
|
|
|
/** |
|
* Controllo la presenza del codice fiscale dell'impresa nella colonne CODICE_FISCALE della tabelle CLUSTER DB |
|
* @global type $con |
|
* @param type $cf_impresa |
|
* @return type bool true/false |
|
*/ |
|
public static function Exists($cf_impresa = "") { |
|
global $con; |
|
$return = false; |
|
|
|
//$codice_fiscale = "03392980797";// CF utilizzato in modalità test attiva |
|
$sql = "SELECT ID FROM " . self::TABLE_NAME . " WHERE CODICE_FISCALE=:cf_impresa "; |
|
$verify = $con->prepare($sql); |
|
$verify->bindParam(":cf_impresa", $cf_impresa); |
|
if ($verify->execute()) { |
|
$itVerify = $verify->fetch(PDO::FETCH_ASSOC); |
|
|
|
if ($itVerify['ID'] > 0) |
|
$return = true; |
|
} |
|
return $return; |
|
} |
|
|
|
/** |
|
* Controllo la presenza del codice fiscale dell'impresa nella colonne CODICE_FISCALE della tabelle CLUSTER DB |
|
* @global type $con |
|
* @param type $cf_impresa |
|
* @return type int ID |
|
*/ |
|
public static function getIdFromCodiceFiscale($cf_impresa = "") { |
|
global $con; |
|
$return = 0; |
|
|
|
//$codice_fiscale = "03392980797";// CF utilizzato in modalità test attiva |
|
$sql = "SELECT ID FROM " . self::TABLE_NAME . " WHERE CODICE_FISCALE=:cf_impresa "; |
|
$verify = $con->prepare($sql); |
|
$verify->bindParam(":cf_impresa", $cf_impresa); |
|
if ($verify->execute()) { |
|
$itVerify = $verify->fetch(PDO::FETCH_ASSOC); |
|
|
|
if ($itVerify['ID'] > 0) |
|
$return = $itVerify['ID']; |
|
} |
|
return $return; |
|
} |
|
|
|
public function Parse(&$record, $campo = "") { |
|
$props = get_class_vars(get_class($this)); |
|
switch ($campo) { |
|
|
|
default: |
|
array_push($record, array("Campo" => $campo, "Valore" => $this->$campo)); |
|
break; |
|
} |
|
} |
|
|
|
} |
|
|
|
class ClusterDeroga extends DataClass { |
|
|
|
const TABLE_NAME = "CLUSTER_DEROGA"; |
|
const SEQ_NAME = "CLUSTER_DEROGA_ID_SEQ"; |
|
const SP_ = "SPCLUSTERDEROGASAVE"; |
|
|
|
public $ID = 0; // PK |
|
public $CODICE_FISCALE = ""; // Campo sul quale fare il controllo per il presentazione della domanda. |
|
public $PARTITA_IVA = ""; |
|
public $DENOMINAZIONE = ""; |
|
public $EMAIL = ""; |
|
public $CF_LEGALE = ""; |
|
|
|
public function __construct($src = null) { |
|
global $con; |
|
if ($src == null) |
|
return; |
|
if (is_array($src)) { |
|
if (isset($src['ID']) && $src['ID'] > 0) { |
|
$this->_loadAndFillObject($src['ID'], self::TABLE_NAME, $src); |
|
} else { |
|
$this->_loadByRow($src, $stripSlashes); |
|
} |
|
} elseif (intval($src)) { |
|
$this->_loadById($src, self::TABLE_NAME, true); |
|
} |
|
} |
|
|
|
/** |
|
* Controllo la presenza del codice fiscale dell'impresa nella colonne CODICE_FISCALE della tabelle CLUSTER DB |
|
* @global type $con |
|
* @param type $cf_impresa |
|
* @return type bool true/false |
|
*/ |
|
public static function Exists($cf_impresa = "") { |
|
global $con; |
|
$return = false; |
|
|
|
//$codice_fiscale = "03392980797";// CF utilizzato in modalità test attiva |
|
$sql = "SELECT ID FROM " . self::TABLE_NAME . " WHERE CODICE_FISCALE=:cf_impresa "; |
|
$verify = $con->prepare($sql); |
|
$verify->bindParam(":cf_impresa", $cf_impresa); |
|
if ($verify->execute()) { |
|
$itVerify = $verify->fetch(PDO::FETCH_ASSOC); |
|
|
|
if ($itVerify['ID'] > 0) |
|
$return = true; |
|
} |
|
return $return; |
|
} |
|
|
|
/** |
|
* Controllo la presenza del codice fiscale dell'impresa nella colonne CODICE_FISCALE della tabelle CLUSTER DB |
|
* @global type $con |
|
* @param type $cf_impresa |
|
* @return type int ID |
|
*/ |
|
public static function getIdFromCodiceFiscale($cf_impresa = "") { |
|
global $con; |
|
$return = 0; |
|
|
|
//$codice_fiscale = "03392980797";// CF utilizzato in modalità test attiva |
|
$sql = "SELECT ID FROM " . self::TABLE_NAME . " WHERE CODICE_FISCALE=:cf_impresa "; |
|
$verify = $con->prepare($sql); |
|
$verify->bindParam(":cf_impresa", $cf_impresa); |
|
if ($verify->execute()) { |
|
$itVerify = $verify->fetch(PDO::FETCH_ASSOC); |
|
|
|
if ($itVerify['ID'] > 0) |
|
$return = $itVerify['ID']; |
|
} |
|
return $return; |
|
} |
|
|
|
public function Parse(&$record, $campo = "") { |
|
$props = get_class_vars(get_class($this)); |
|
switch ($campo) { |
|
|
|
default: |
|
array_push($record, array("Campo" => $campo, "Valore" => $this->$campo)); |
|
break; |
|
} |
|
} |
|
|
|
public function Save() { |
|
global $con; |
|
// 1,2,3,4,5,6 |
|
$sql = "CALL " . self::SP_ . " (?,?,?,?,?)"; |
|
|
|
$query = $con->prepare($sql); |
|
$query->bindParam(1, $this->CODICE_FISCALE); |
|
$query->bindParam(2, $this->PARTITA_IVA); |
|
$query->bindParam(3, $this->DENOMINAZIONE); |
|
$query->bindParam(4, $this->EMAIL); |
|
$query->bindParam(5, $this->CF_LEGALE); |
|
|
|
try { |
|
$it = parent::_Save($query); |
|
} catch (Exception $exc) { |
|
|
|
$it['descrizioneErrore'] = $exc->getMessage(); |
|
} |
|
return $it; |
|
} |
|
|
|
}
|
|
|