0) { $this->_loadAndFillObject($src['ID'], self::TABLE_NAME, $src); } else { $this->_loadByRow($src, $stripSlashes); } } elseif (intval($src)) { $sql = "SELECT * FROM " . self::TABLE_NAME . " WHERE ID = :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(); } } $this->loadDati(); } public static function Count($filter = null) { return parent::_count(self::TABLE_NAME, $filter); } /* protocollo locale */ public function generaProtocollo() { return date('Ym') . str_pad($this->ID, 6, '0', STR_PAD_LEFT); } /* identificativo locale */ public function generaIdentificativo() { return "D" . Date::dateOracleTimeStamp($this->DATA_REGISTRAZIONE, 'Ym') . str_pad($this->ID, 6, '0', STR_PAD_LEFT); } public function loadDati() { $this->dichiarazioni = DomandaDichiarazioni::AllFromDomanda($this->ID); $this->allegati = Allegati::ListByDomanda($this->ID); $this->richieste_sconti = DomandaSconti::load($this->ID, RS_IN_ELABORAZIONE); $this->richieste_sconti_erogati = DomandaSconti::load($this->ID, RS_PRESA_IN_CARICO); } /* OBBLIGA LA GENERAZIONE DEL PDF IN CASO DI MODIFICA */ public function ResetPdfGenerato() { if ($this->ID > 0 && $this->STATO == STATO_DOMANDA_IN_PREPARAZIONE) { $this->ALLEGATO_GENERATO = null; $this->DATA_ALLEGATO = null; } } /* * Verifica completamento domanda per generazione pdf */ public function CanGenPdf() { return Allegati::checkDocumentiObbligatoriCompletati(); } public function CountDocObbligatori() { return Allegati::checkDocumentiObbligatoriCompletati(false, true); } public function CountDocObbligatoriAllegati() { return Allegati::checkDocumentiObbligatoriCompletati(false, false, true); } /* * Verifica completamento domanda */ public function CheckCompletata() { return Allegati::checkAllegatiObbligatoriCompletatiPreInvio(); } public function AllegatoGenerato() { return ( $this->ALLEGATO_GENERATO != null && $this->ALLEGATO_GENERATO != '' ? true : false); } /** * Load Domanda From CF Account with all dependencies * @params => $codiceFiscale * @return => Domanda (Object) */ public static function loadDomandaFromAccount($idAccount = 0) { global $con, $LoggedAccount; $domanda = new Domanda(); $sql = "SELECT * FROM DOMANDA WHERE ID_ACCOUNT = :id_account"; $query = $con->prepare($sql); $query->bindParam(":id_account", $idAccount); try { $query->execute(); $row = $query->fetch(PDO::FETCH_ASSOC); if (isset($row['ID']) && $row['ID'] > 0) { $domanda->_loadByRow($row); $domanda->loadDati(); } } catch (Exception $exc) { $exc->getMessage(); } return $domanda; } public static function selectFromAccount() { global $con, $LoggedAccount; $return = array(); if ($LoggedAccount->ID > 0) { $verify = $con->prepare("SELECT * FROM " . self::TABLE_NAME . " WHERE ID_ACCOUNT=:id_account AND STATO < 6 ORDER BY ID ASC"); $verify->bindParam(":id_account", $LoggedAccount->ID); try { $verify->execute(); $return = $verify->fetchAll(PDO::FETCH_ASSOC); } catch (Exception $exc) { $return['esito'] = -999; $return['erroreDescrizione'] = $exc->getMessage(); } } return $return; } /** * Funzione di verifica dei dati POST prima del salvataggio */ public static function checkVerificaDatiPreSalvataggio() { global $LoggedAccount; $_POST['ID_ACCOUNT'] = $LoggedAccount->ID; $_POST['ISTITUTO_CREDITO'] = Utils::get_filter_string_POST('ISTITUTO_CREDITO'); $_POST['FILIALE_CREDITO'] = Utils::get_filter_string_POST('FILIALE_CREDITO'); $_POST['IBAN'] = Utils::get_filter_string_POST('IBAN'); $_POST['RIPETI_IBAN'] = Utils::get_filter_string_POST('RIPETI_IBAN'); $_POST['ISEE'] = Utils::get_filter_string_POST('ISEE'); $_POST['ISE_DIPENDENTE'] = Utils::get_filter_string_POST('ISE_DIPENDENTE'); $_POST['ISE_AUTONOMO'] = Utils::get_filter_string_POST('ISE_AUTONOMO'); $_POST['REDDITO'] = Utils::get_filter_int_POST('REDDITO'); $_POST['DICHIARAZIONE_SOSTENTAMENTO'] = Utils::get_filter_int_POST('DICHIARAZIONE_SOSTENTAMENTO'); $_POST['INCREMENTO_NUCLEO_FAMILIARE'] = Utils::get_filter_int_POST('INCREMENTO_NUCLEO_FAMILIARE'); $_POST["DATA_REGISTRAZIONE"] = date('d-M-Y h.i.s.u A'); $_POST["REDDITO"] = (isset($_POST["REDDITO"]) ? $_POST["REDDITO"] : 0); $_POST["ISE_DIPENDENTE"] = (isset($_POST["ISE_DIPENDENTE"]) ? $_POST["ISE_DIPENDENTE"] : 0); $_POST["ISE_AUTONOMO"] = (isset($_POST["ISE_AUTONOMO"]) ? $_POST["ISE_AUTONOMO"] : 0); $_POST["DICHIARAZIONE_SOSTENTAMENTO"] = (isset($_POST["DICHIARAZIONE_SOSTENTAMENTO"]) ? $_POST["DICHIARAZIONE_SOSTENTAMENTO"] : 0); $_POST["INCREMENTO_NUCLEO_FAMILIARE"] = (isset($_POST["INCREMENTO_NUCLEO_FAMILIARE"]) ? $_POST["INCREMENTO_NUCLEO_FAMILIARE"] : 0); if(intval($_POST["DICHIARAZIONE_SOSTENTAMENTO"])>0){ $_POST["ISE_DIPENDENTE"] = 0; $_POST["ISE_AUTONOMO"] = 0; } } public function checkDatiPreSave() { global $LoggedAccount; $response = array(); $controllValidita = true; $dati_mancanti = ''; /*CONTROLLO I DATI OBBLIGATORI DELLE DICHIARAZIONI*/ $anag_dic = AnagraficaDichiarazioni::getObblGruopByCodice(); $arrayDicDb = array(); foreach ($anag_dic as $k => $v){ $arrayDicDb[$k] = 0; } $count_dic_da_salvare = AnagraficaDichiarazioni::Count(' OBBLIGO = 1 GROUP BY CODICE'); $count_dic_salvate = 0; foreach ($this->dichiarazioni as $k => $s) { $arrayDicDb[$s] = 1; $count_dic_salvate++; } if ($count_dic_da_salvare > $count_dic_salvate) { $txtpunti = ""; $i=0; foreach ($arrayDicDb as $k => $v){ if($v == 0){ $i++; $txtpunti.=( $i > 1 ? ', '.$k : $k); } } $controllValidita = false; $dati_mancanti .= "Selezionare i seguenti punti: $txtpunti "; } if ($this->ISTITUTO_CREDITO == "") { $controllValidita = false; $dati_mancanti .= "
L'istituto di credito "; } if ($this->FILIALE_CREDITO == "") { $controllValidita = false; $dati_mancanti .= "
La filiale dell'istituto di credito "; } if ($this->IBAN == "") { $controllValidita = false; $dati_mancanti .= "
Il codice IBAN "; } if(!Utils::inizia_con($this->IBAN, 'IT') && SOLO_IBAN_ITALIANI){ $controllValidita = false; $dati_mancanti .= "
Si accettano solo IBAN di banche italiane"; } if (strlen($this->IBAN) > LUNGHEZZA_IBAN) { $controllValidita = false; $dati_mancanti .= "
La lunghezza del codice IBAN deve essere di massimo (".LUNGHEZZA_IBAN.") caratteri "; } if (isset($_POST['RIPETI_IBAN']) && ($_POST['RIPETI_IBAN'] == "" || ($_POST['RIPETI_IBAN'] != $this->IBAN))) { $controllValidita = false; $dati_mancanti .= "
Campo Iban errato o non corrispondente"; } if (SOLO_IBAN_ITALIANI && !Utils::checkIban($this->IBAN)) { $controllValidita = false; $dati_mancanti .= "
Il codice IBAN non è valido"; } if(intval($this->ISE_AUTONOMO) == 0 && intval($this->ISE_DIPENDENTE == 0) && intval($this->DICHIARAZIONE_SOSTENTAMENTO) == 0 ){ $controllValidita = false; $dati_mancanti .= "
Il tipo di sostentamento (lavoro autonomo, lavoro dipendente o altro) "; } if (intval($this->ISEE) == 0) { $controllValidita = false; $dati_mancanti .= "
Il valore ISEE "; } $response['checkDati'] = $controllValidita; $response['txt_dati_mancanti'] = $dati_mancanti; return $response; } public function presentaDomanda() { global $LoggedAccount; $response = Utils::initDefaultResponse(); if ($LoggedAccount->ID == $this->ID_ACCOUNT && $this->STATO == INPREPARAZIONE) { $this->STATO = PREPARATA; $this->DATA_PRESENTAZIONE = date(FORMAT_TIMESTAMP_ORACLE); $response = $this->Save(); } return $response; } /* * Modificare ogni qual volta si fa un update o insert */ public function Save() { global $con, $LoggedAccount; $vars = get_object_vars($this); unset($vars['dichiarazioni']); unset($vars['contratti']); unset($vars['allegati']); unset($vars['documenti']); unset($vars['DATA_REGISTRAZIONE']); $sql = Utils::prepareQuery(self::TABLE_NAME, $vars); //echo $sql; $queryabi = $con->prepare($sql); foreach ($vars as $k => $v) { if ($k == "ID" && $v == 0){ continue; } // echo "
:" . $k. " => ". $v; $queryabi->bindValue(":" . $k, $v); } try { $it = parent::_Save($queryabi); } catch (Exception $exc) { $it['erroreDescrizione'] = $exc->getMessage(); } return $it; } public function statoDomandaCompletata() { global $con, $LoggedAccount; $risultato = array(); $sql = "SELECT * FROM " . self::TABLE_NAME . " WHERE ID_ACCOUNT=:id AND STATO=1"; $query = $con->prepare($sql); $query->bindParam(":id", $LoggedAccount->ID); try { $query->execute(); $it = $query->fetchAll(PDO::FETCH_ASSOC); $risultato['esito'] = 1; $risultato['dati'] = $it; } catch (Exception $exc) { $risultato['esito'] = -999; $risultato['erroreDescrizione'] = $exc->getMessage(); } return $risultato; } /** * Setta lo stato della domanda a chiusa * @global type $con * @return type */ public function setDomandaChiusa() { global $con; $risultato = array(); $sql = "UPDATE " . self::TABLE_NAME . " SET STATO=5 WHERE ID=:id"; $query = $con->prepare($sql); $query->bindParam(":id", $this->ID); try { $query->execute(); $risultato['esito'] = 1; } catch (Exception $exc) { $risultato['esito'] = -999; $risultato['erroreDescrizione'] = $exc->getMessage(); } return $risultato; } public function setDomandaEsclusa() { global $con, $LoggedAccount; $risultato = array(); $sql = "UPDATE " . self::TABLE_NAME . " SET STATO=".NONAMMESSA.", NOTE = :note, ID_UID_FIREBASE = :account WHERE ID=:id"; $query = $con->prepare($sql); $query->bindParam(":id", $this->ID); $query->bindParam(":note", $this->NOTE); $query->bindParam(":account", $LoggedAccount->ID); try { $query->execute(); $risultato['esito'] = 1; } catch (Exception $exc) { $risultato['esito'] = -999; $risultato['erroreDescrizione'] = $exc->getMessage(); } return $risultato; } public function setDomandaAnnullata() { global $con, $LoggedAccount; $risultato = array(); $sql = "UPDATE " . self::TABLE_NAME . " SET STATO=".ANNULLATA.", NOTE = :note, ID_UID_FIREBASE = :account WHERE ID=:id"; $query = $con->prepare($sql); $query->bindParam(":id", $this->ID); $query->bindParam(":note", $this->NOTE); $query->bindParam(":account", $LoggedAccount->ID); try { $query->execute(); $risultato['esito'] = 1; } catch (Exception $exc) { $risultato['esito'] = -999; $risultato['erroreDescrizione'] = $exc->getMessage(); } return $risultato; } public function setDomandaRiammessa() { global $con,$LoggedAccount; $risultato = array(); $this->NOTE = ''; $sql = "UPDATE " . self::TABLE_NAME . " SET STATO=".PREPARATA.", NOTE = :note, ID_UID_FIREBASE = :account WHERE ID=:id"; $query = $con->prepare($sql); $query->bindParam(":id", $this->ID); $query->bindParam(":note", $this->NOTE); $query->bindParam(":account", $LoggedAccount->ID); try { $query->execute(); $risultato['esito'] = 1; } catch (Exception $exc) { $risultato['esito'] = -999; $risultato['erroreDescrizione'] = $exc->getMessage(); } return $risultato; } public function Delete() { return parent::_Delete(self::TABLE_NAME, "ID = " . $this->ID); } /** * Funzione per la visualizzazione dei logs * @param type $record * @param type $campo */ public function Parse(&$record, $campo = "") { array_push($record, array("Campo" => $campo, "Valore" => $this->$campo)); } public function generateDirForUpload($basePath = ROOT_UPLOAD, $destinationPath = '') { $path = ''; if ($basePath != "") { //$path = $basePath . $this->ID_ACCOUNT; $path = File::getFolderFromDomanda($this, ROOT_UPLOAD_PRESENTAZIONE); File::createPath($path); if (is_dir($path) && !empty($destinationPath)) { $path .= "/" . $destinationPath; File::createPath($path); } else { $path = ''; } if (!is_dir($path)) { $path = ''; } } return $path; } /** * Verifico se posso accedere alla sezione * @param type $sezione * @return boolean */ public function checkSezioneAttiva($sezione = null){ $return = false; if(!empty($sezione)){ $sections = $this->renderDashboard(); if($sections[$sezione]['on_click']!=""){ $return = true; } } return $return; } /** * Renderizzo le voci delle sezioni con il relativo link con lo stato di avanzamento della domanda * @global type $LoggedAccount * @global type $DASHBOARD_TEXT * @return type */ public function renderDashboard(){ global $LoggedAccount, $DASHBOARD_TEXT; $response = array(); $array_text = $DASHBOARD_TEXT; if(Utils::isStatoSportelloPreparazione()){ $controlliDomanda = $this->checkDatiPreSave(); $response[SEZIONE_ANAGRAFICA_RICHIEDENTE] = array( 'stato_icon' => "fa-square", 'alert_css' => "alert-dark", 'btn_css_icon' => "btn-dark", 'on_click' => "", 'stato' => false ); $response[SEZIONE_NUCLEO_FAMILIARE] = array( 'stato_icon' => "fa-square", 'alert_css' => "alert-dark", 'btn_css_icon' => "btn-dark", 'on_click' => "", 'stato' => false ); $response[SEZIONE_ISTANZA] = array( 'stato_icon' => "fa-square", 'alert_css' => "alert-dark", 'btn_css_icon' => "btn-dark", 'on_click' => "", 'stato' => false ); $response[SEZIONE_CONTRATTI] = array( 'stato_icon' => "fa-square", 'alert_css' => "alert-dark", 'btn_css_icon' => "btn-dark", 'on_click' => "", 'stato' => false ); $response[SEZIONE_ALLEGATI] = array( 'stato_icon' => "fa-square", 'alert_css' => "alert-dark", 'btn_css_icon' => "btn-dark", 'on_click' => "", 'stato' => false ); $response[SEZIONE_PRESENTAZIONE] = array( 'stato_icon' => "fa-square", 'alert_css' => "alert-dark", 'btn_css_icon' => "btn-dark", 'on_click' => "", 'text_btn' => ' Presenta domanda.', 'desc_sezione' => "Per presentare la domanda di concessione di contributo è necessario completare tutte le sezioni.", 'stato' => false ); if(intval($LoggedAccount->ID)>0){ $response[SEZIONE_ANAGRAFICA_RICHIEDENTE] = array( 'stato_icon' => "fa-check-square", 'alert_css' => "alert-success", 'btn_css_icon' => "btn-primary", 'on_click' => "visualizzaReg('".intval($LoggedAccount->ID)."')", 'stato' => true ); $response[SEZIONE_NUCLEO_FAMILIARE] = array( 'stato_icon' => "fa-square", 'alert_css' => "alert-warning", 'btn_css_icon' => "btn-primary", 'on_click' => "goToPage('nucleo_familiare.php', '".$this->ID."')", 'stato' => false ); $nucleo = $LoggedAccount->loadNucleoFamiliare(); if(count($nucleo)>0){ $response[SEZIONE_NUCLEO_FAMILIARE] = array( 'stato_icon' => "fa-check-square", 'alert_css' => "alert-success", 'btn_css_icon' => "btn-primary", 'on_click' => "goToPage('nucleo_familiare.php', '".$this->ID."')", 'stato' => true ); $response[SEZIONE_ISTANZA] = array( 'stato_icon' => "fa-square", 'alert_css' => "alert-warning", 'btn_css_icon' => "btn-primary", 'on_click' => "goToDomanda('".intval($this->ID)."', '".intval($this->STATO)."')", 'stato' => false ); if($controlliDomanda['checkDati']){ $response[SEZIONE_ISTANZA] = array( 'stato_icon' => "fa-check-square", 'alert_css' => "alert-success", 'btn_css_icon' => "btn-primary", 'on_click' => "goToDomanda('".intval($this->ID)."', '".intval($this->STATO)."')", 'stato' => true ); $response[SEZIONE_CONTRATTI] = array( 'stato_icon' => "fa-square", 'alert_css' => "alert-warning", 'btn_css_icon' => "btn-primary", 'on_click' => "goToPage('contratti_affitto.php', '".$this->ID."')", 'stato' => false ); if(count($this->contratti)>0){ $response[SEZIONE_CONTRATTI] = array( 'stato_icon' => "fa-check-square", 'alert_css' => "alert-success", 'btn_css_icon' => "btn-primary", 'on_click' => "goToPage('contratti_affitto.php', '".$this->ID."')", 'stato' => true ); $response[SEZIONE_ALLEGATI] = array( 'stato_icon' => "fa-square", 'alert_css' => "alert-warning", 'btn_css_icon' => "btn-primary", 'on_click' => "goToPage('gestione_allegati.php', '".$this->ID."')", 'stato' => false ); $controlloAllegati = Allegati::checkDocumentiObbligatoriCompletati(); if($controlloAllegati){ $response[SEZIONE_ALLEGATI] = array( 'stato_icon' => "fa-check-square", 'alert_css' => "alert-success", 'btn_css_icon' => "btn-primary", 'on_click' => "goToPage('gestione_allegati.php', '".$this->ID."')", 'stato' => true ); $response[SEZIONE_PRESENTAZIONE] = array( 'stato_icon' => "fa-square", 'alert_css' => "alert-warning", 'btn_css_icon' => "btn-primary", 'on_click' => "presenta()", 'text_btn' => ' Presenta istanza', 'desc_sezione' => "Hai quasi concluso! Ti manca quest'ultimo passaggio per concludere e presentare la domanda. Dopo non sarà più possibile modificare le informazioni inserite e le stesse saranno disponibili in sola lettura.", 'stato' => false ); if($this->STATO >= PREPARATA){ $response[SEZIONE_PRESENTAZIONE] = array( 'stato_icon' => "fa-check-square", 'alert_css' => "alert-success", 'btn_css_icon' => "btn-success", 'on_click' => "downloadIstanza()", 'text_btn' => ' Scarica istanza', 'desc_sezione' => "Ora puoi scaricare la tua istanza presentata.", 'stato' => true ); } } } } } $response[SEZIONE_ANAGRAFICA_RICHIEDENTE] = array_merge($response[SEZIONE_ANAGRAFICA_RICHIEDENTE],$array_text[SEZIONE_ANAGRAFICA_RICHIEDENTE]); $response[SEZIONE_NUCLEO_FAMILIARE] = array_merge($response[SEZIONE_NUCLEO_FAMILIARE],$array_text[SEZIONE_NUCLEO_FAMILIARE]); $response[SEZIONE_ISTANZA] = array_merge($response[SEZIONE_ISTANZA],$array_text[SEZIONE_ISTANZA]); $response[SEZIONE_CONTRATTI] = array_merge($response[SEZIONE_CONTRATTI],$array_text[SEZIONE_CONTRATTI]); $response[SEZIONE_ALLEGATI] = array_merge($response[SEZIONE_ALLEGATI],$array_text[SEZIONE_ALLEGATI]); } } return $response; } public static function LoadDataTable($searchQuery = "", $searchArray = array(), $columnName = array(), $columnSortOrder = array(), $start = 0, $offset = 0) { $select = " D.*, AA.CODICE_FISCALE, AA.NOME, AA.COGNOME "; $sql = self::TABLE_NAME . " D " . "INNER JOIN " . Account::TABLE_NAME . " A ON A.ID = D.ID_ACCOUNT " . "INNER JOIN " . AccountAnagrafica::TABLE_NAME . " AA ON A.CODICE_FISCALE = AA.CODICE_FISCALE "; return parent::_loadDataTableEx($select, $sql, $searchQuery, $searchArray, $columnName, $columnSortOrder, $start, $offset); } /** * Calcola il numero dei giorni intercosi tra due date * @global type $con * @param type $dal * @param type $al * @return int */ public function GetGiorni($dal = null , $al = null) { global $con; $res = array(); if(!empty($dal) && !empty($al)){ $sql = "select TO_DATE('" . $al . "','DD-MM-YYYY') - TO_DATE('" . $dal . "','DD-MM-YYYY') AS GIORNI FROM DUAL"; $query = $con->prepare($sql); try { $query->execute(); $res = $query->fetch(PDO::FETCH_ASSOC); } catch (Exception $exc) { $exc->getMessage(); } } if ($res['GIORNI'] > 0) { return ($res['GIORNI']+1); } else { return 0; } } /** * Verifico se ho scelto la fascia covid * @return boolean */ public function isFasciaCovid(){ $covid = false; foreach ($this->dichiarazioni as $value) { if($value['ID_ANAG_DICHIARAZIONI'] == ID_FILE_COVID){ $covid = true; } } return $covid; } /** * Restituisce la fascia di appartenenza sulla base dei dati ise che inserisce l'utente * Viene sommato il reddito ise di lavoro autonomo al reddito ise del lavoro dipendente * @return string */ public function GetFascia(){ global $con; $res = array(); $sql = "SELECT FNGETCONTRIBUTO(".$this->ID.", 'FASCIA') AS FASCIA FROM DUAL "; $query = $con->prepare($sql); try { $query->execute(); $res = $query->fetch(PDO::FETCH_ASSOC); } catch (Exception $exc) { $exc->getMessage(); } return $res['FASCIA']; } /** * Restituisce l'importo delle detrazioni in base al numero dei figli a carico * @return type */ public function GetDetrazioniFigliCarico(){ $richiedente = new Account($this->ID_ACCOUNT); $nFigliCarico = 0; foreach ($richiedente->NucleoFamiliare as $value) { if($value['RAPPORTO_PARENTELA'] == FIGLIO_A_CARICO){ $nFigliCarico++; } } $res = (DIMINUZIONE_FIGLI * $nFigliCarico); return $res; } /** * Restituisce l'importo dell'ISEE * @param type $format * @return type */ public function GetISEE($format = false){ $isee = $this->ISEE; return ($format ? number_format($isee, 2 , ',', '.') : $isee); } /** * Restituisce la somma del canone annuo di tutti i contratti inseriti nella domanda * @param type $format * @return type */ public function GetCanoneAnnuo($format = false) { global $con; $res = array(); $sql = "SELECT FNGETCONTRIBUTO(".$this->ID.", 'CANONEANNUO') AS CANONEANNUO FROM DUAL "; $query = $con->prepare($sql); try { $query->execute(); $res = $query->fetch(PDO::FETCH_ASSOC); } catch (Exception $exc) { $exc->getMessage(); } return ($format ? number_format($res['CANONEANNUO'], 2 , ',', '.') : $res['CANONEANNUO']); /* $canoneRapportato = 0; foreach ($this->contratti as $value) { $f = 'd-M-Y'; $dataInizio = new DateTime($value['CONTRATTO_DAL']); if($value['SFRATTO_ESECUTIVO'] == 1){ $d_al = new DateTime($value['CONTRATTO_AL']); $d_sfratto = new DateTime($value['SFRATTO_ESECUTIVO_DATA']); $dataFine = ($d_sfratto< $d_al ? $d_sfratto : $d_al); }else{ $dataFine = new DateTime($value['CONTRATTO_AL']); } $dataInizioMin = new DateTime(MIN_DATA_CONTRIBUTO); $dataFinMax = new DateTime(MAX_DATA_CONTRIBUTO); if($dataInizio < $dataInizioMin){ $dal = $dataInizioMin->format($f); }else{ $dal = $dataInizio->format($f); } if($dataFinMax >= $dataFine){ $al = $dataFine->format($f); }else{ $al = $dataFinMax->format($f); } $giorni = $this->GetGiorni($dal, $al); $giorniAnno = $this->GetGiorni($dataInizioMin->format($f), $dataFinMax->format($f)); $canneAnnuo = (($value['CANONE_ANNUO']/$giorniAnno)*$giorni); $canoneRapportato +=$canneAnnuo; } return ($format ? number_format($canoneRapportato, 2 , ',', '.') : $canoneRapportato);*/ } /** * Restituisce la percentuale di incidenza del canone annuo sulreddito ISE Netto * @return type */ public function GetIncidenza() { global $con; $res = array(); $sql = "SELECT FNGETCONTRIBUTO(".$this->ID.", 'INCIDENZA') AS INCIDENZA FROM DUAL "; $query = $con->prepare($sql); try { $query->execute(); $res = $query->fetch(PDO::FETCH_ASSOC); } catch (Exception $exc) { $exc->getMessage(); } return $res['INCIDENZA']; /*$incidenza = 0; $canoneAnnuo = $this->GetCanoneAnnuo(); $isee = $this->GetISEE(); $incidenza = ($isee>0 ? ($canoneAnnuo/$isee*100) : $isee) ; return $incidenza;*/ } /** * Restituisce la percentuale ai fini del calcolo del contributo * @return type */ public function GetPercentualeContributo() { global $con; $res = array(); $sql = "SELECT FNGETCONTRIBUTO(".$this->ID.", 'PERC_CONTRIBUTO') AS PERC_CONTRIBUTO FROM DUAL "; $query = $con->prepare($sql); try { $query->execute(); $res = $query->fetch(PDO::FETCH_ASSOC); } catch (Exception $exc) { $exc->getMessage(); } return $res['PERC_CONTRIBUTO']; /* $perc_contributo = 0; $isee = $this->GetISEE(); if($isee>0){ $incidenza = $this->GetIncidenza(); if(!$this->isFasciaCovid()){ if($this->INCREMENTO_NUCLEO_FAMILIARE > 0){ if($isee < MAX_ISE_A_INCREMENTATO){ $perc_contributo = $incidenza - PERCENTUALE_INCIDENZA_A; }else{ $perc_contributo = $incidenza - PERCENTUALE_INCIDENZA_B; } }else{ if($isee < MAX_ISE_A){ $perc_contributo = $incidenza - PERCENTUALE_INCIDENZA_A; }else{ $perc_contributo = $incidenza - PERCENTUALE_INCIDENZA_B; } } }else{ if($isee <= MAX_ISE_COVID){ $perc_contributo = $incidenza - PERCENTUALE_INCIDENZA_COVID; } } } return $perc_contributo;*/ } /** * Restituisce il calcolo del contributo teorico spettante * @param type $format * @return type */ public function GetContributoTeorico($format = false) { $perc_contributo = $this->GetPercentualeContributo(); $canone_contributo = $this->GetCanoneAnnuo(); if($perc_contributo>0){ $contributo = ($canone_contributo*($perc_contributo/100)); if($contributo>$canone_contributo){ $contributo = $canone_contributo; } }else if($perc_contributo<0){ $contributo = 0; }else{ $contributo = $canone_contributo; } return ($format ? number_format($contributo, 2 , ',', '.') : $contributo); } /** * Restituisce il calcolo del contributo spettante e potenzialmente da erogare se le risorse sono disponibili. * @param type $format * @return type */ public function GetContributo($format = false) { global $con; $res = array(); $sql = "SELECT FNGETCONTRIBUTO(".$this->ID.", '') AS CONTRIBUTO FROM DUAL "; $query = $con->prepare($sql); try { $query->execute(); $res = $query->fetch(PDO::FETCH_ASSOC); } catch (Exception $exc) { $exc->getMessage(); } return ($format ? number_format($res['CONTRIBUTO'], 2 , ',', '.') : $res['CONTRIBUTO']); /* $contributo = 0; $contributo_teorico = $this->GetContributoTeorico(); $fascia = $this->GetFascia(); if($fascia == "A" && $contributo_teorico>0){ $contributo = (($contributo_teorico) <= (CONTRINUTO_MAX_A) ? $contributo_teorico : CONTRINUTO_MAX_A); }else if($fascia == "B" && $contributo_teorico > 0 ){ $contributo = ($contributo_teorico <= CONTRINUTO_MAX_B ? $contributo_teorico : CONTRINUTO_MAX_B); }else if($fascia == "COVID" && $contributo_teorico > 0 ){ $contributo = ($contributo_teorico <= CONTRINUTO_MAX_COVID ? $contributo_teorico : CONTRINUTO_MAX_COVID); } $contributo = ($contributo >= CONTRINUTO_MIN ? $contributo : 0); return ($format ? number_format($contributo, 2 , ',', '.') : $contributo);*/ } public static function GetTotaleContributoProvincia() { global $con; $result = array(); $sql = "SELECT TO_CHAR(SUM(DD.SCONTO_TOTALE)) AS CONTRIBUTO_PROVINCIA, DD.PROV_RESIDENZA AS PROVINCIA FROM VIEW_EXPORT_SCONTI DD WHERE DD.STATO < 99 GROUP BY DD.PROV_RESIDENZA"; $query = $con->prepare($sql); try { $query->execute(); $result = $query->fetchAll(PDO::FETCH_ASSOC); } catch (Exception $exc) { $exc->getMessage(); } return $result; } public static function GetUtentiRegistrati() { global $con; $result = array(); $sql = "SELECT COUNT(AA.CODICE_FISCALE) AS NUM_ACCOUNT, AA.SESSO FROM ".Account::TABLE_NAME." A INNER JOIN ".AccountAnagrafica::TABLE_NAME." AA ON AA.CODICE_FISCALE = A.CODICE_FISCALE WHERE A.CANCELLATO = 0 GROUP BY AA.SESSO"; $query = $con->prepare($sql); try { $query->execute(); $res = $query->fetchAll(PDO::FETCH_ASSOC); } catch (Exception $exc) { $exc->getMessage(); } foreach ($res as $r){ $result[$r['SESSO']]= $r['NUM_ACCOUNT']; } return $result; } public static function GetUtentiRegistratiFromData($data_inizio, $data_fine) { global $con; $result = array(); $sql = "SELECT COUNT(AA.CODICE_FISCALE) AS NUM_ACCOUNT, AA.SESSO FROM ".Account::TABLE_NAME." A INNER JOIN ".AccountAnagrafica::TABLE_NAME." AA ON AA.CODICE_FISCALE = A.CODICE_FISCALE WHERE A.DATA_REGISTRAZIONE BETWEEN TO_DATE( :P_INIZIO,'dd/mm/yyyy hh24:mi:ss') AND TO_DATE( :P_FINE,'dd/mm/yyyy hh24:mi:ss') AND A.CANCELLATO = 0 GROUP BY AA.SESSO"; $query = $con->prepare($sql); $query->bindParam(":P_INIZIO", $data_inizio); $query->bindParam(":P_FINE", $data_fine); //echo $sql;exit(); try { $query->execute(); $res = $query->fetchAll(PDO::FETCH_ASSOC); } catch (Exception $exc) { $exc->getMessage(); } foreach ($res as $r){ $result[$r['SESSO']]= $r['NUM_ACCOUNT']; } return $result; } public static function GetScontiFromData($data_inizio, $data_fine) { global $con; $result = array(); $res = array(); $sql2 = "SELECT * FROM ( SELECT 'RESIDENTI' AS TIPO , COUNT(S.ID) AS NUM , SUM(S.SCONTO_TOTALE) AS IMPORTO FROM VIEW_EXPORT_SCONTI S INNER JOIN DOMANDA D ON D.ID = S.ID_DOMANDA WHERE S.STATO >= 0 AND S.ISEE = 0 AND S.PRIORITA = 0 AND S.DATA_REGISTRAZIONE BETWEEN TO_DATE(:P_INIZIO,'dd/mm/yyyy hh24:mi:ss') AND TO_DATE(:P_FINE,'dd/mm/yyyy hh24:mi:ss') UNION SELECT 'PRIORITARI' AS TIPO , COUNT(S.ID) AS NUM, SUM(S.SCONTO_TOTALE) AS IMPORTO FROM VIEW_EXPORT_SCONTI S INNER JOIN DOMANDA D ON D.ID = S.ID_DOMANDA WHERE S.STATO >= 0 AND (S.ISEE = 1 OR S.PRIORITA = 1 ) AND S.DATA_REGISTRAZIONE BETWEEN TO_DATE(:P_INIZIO,'dd/mm/yyyy hh24:mi:ss') AND TO_DATE(:P_FINE,'dd/mm/yyyy hh24:mi:ss') )T"; $query = $con->prepare($sql2); $query->bindParam(":P_INIZIO", $data_inizio); $query->bindParam(":P_FINE", $data_fine); try { $query->execute(); $res = $query->fetchAll(PDO::FETCH_ASSOC); } catch (Exception $exc) { $exc->getMessage(); } return $res; } public static function GetScontiFromCompagnieFromData($data_inizio, $data_fine) { global $con; $result = array(); $res = array(); $sql2 = "SELECT SUM(T.SCONTO_TOTALE) AS TOT_SCONTO, count(T.ID) AS TOT, C.NOME AS COMPAGNIA FROM ( SELECT D.SCONTO_TOTALE, D.ID, D.COMPAGNIA_ID FROM VIEW_EXPORT_SCONTI D WHERE D.DATA_REGISTRAZIONE BETWEEN TO_DATE(:P_INIZIO,'dd/mm/yyyy hh24:mi:ss') AND TO_DATE(:P_FINE,'dd/mm/yyyy hh24:mi:ss') )T left join ANAG_COMPAGNIE C on C.ID = T.COMPAGNIA_ID GROUP BY C.NOME"; $query = $con->prepare($sql2); $query->bindParam(":P_INIZIO", $data_inizio); $query->bindParam(":P_FINE", $data_fine); try { $query->execute(); $res = $query->fetchAll(PDO::FETCH_ASSOC); } catch (Exception $exc) { $exc->getMessage(); } foreach ($res as $r){ $result[$r['COMPAGNIA']]['N_RICHIESTE'] = $r['TOT']; $result[$r['COMPAGNIA']]['TOT_SCONTO'] = $r['TOT_SCONTO']; } return $result; } public static function GetScontiFromCompagnie($format = false) { global $con; $result = array(); $res = array(); $sql2 = "SELECT SUM(T.SCONTO_TOTALE) AS TOT_SCONTO, count(T.ID) AS TOT, C.NOME AS COMPAGNIA FROM ( SELECT D.SCONTO_TOTALE, D.ID, D.COMPAGNIA_ID FROM VIEW_EXPORT_SCONTI D )T left join ANAG_COMPAGNIE C on C.ID = T.COMPAGNIA_ID GROUP BY C.NOME"; $query = $con->prepare($sql2); try { $query->execute(); $res = $query->fetchAll(PDO::FETCH_ASSOC); } catch (Exception $exc) { $exc->getMessage(); } foreach ($res as $r){ $result[$r['COMPAGNIA']]['TOT_SCONTO'] = ($format ? number_format($r['TOT_SCONTO'], 2 , ',', '.') : $r['TOT_SCONTO']); $result[$r['COMPAGNIA']]['N_RICHIESTE'] = $r['TOT']; } return $result; } public static function GetScontiFromTopTratte($format = false) { global $con; $result = array(); $res = array(); $sql2 = "SELECT T.* FROM ( SELECT T.*, ROWNUM AS ROWINDEX FROM ( SELECT CONCAT(CONCAT(AEROPORTO_PARTENZA,' - '), AEROPORTO_DESTINAZIONE) AS TRATTA, COUNT(S.ID) AS NUM_RICHIESTE FROM VIEW_EXPORT_SCONTI S INNER JOIN DOMANDA D ON D.ID = S.ID_DOMANDA WHERE S.STATO <= 0 GROUP BY CONCAT(CONCAT(AEROPORTO_PARTENZA,' - '), AEROPORTO_DESTINAZIONE) ORDER BY COUNT(S.ID) DESC)T)T WHERE ROWINDEX > 0 AND ROWINDEX <= 10"; $query = $con->prepare($sql2); try { $query->execute(); $res = $query->fetchAll(PDO::FETCH_ASSOC); } catch (Exception $exc) { $exc->getMessage(); } foreach ($res as $r){ $result[$r['TRATTA']]['N_RICHIESTE'] = $r['NUM_RICHIESTE']; } return $result; } /** * Calcola il contributo di tutte le istanza presentate * @global type $con * @param type $dal * @param type $al * @return int */ public static function GetTotaleContributo($format = false) { global $con; $result = array(); $res = array(); $sql2 = "SELECT SUM(T.SCONTO_TOTALE) AS TOT_SCONTO, count(T.ID) AS TOT, T.STATO FROM ( SELECT D.SCONTO_TOTALE, D.ID, D.STATO FROM VIEW_EXPORT_SCONTI D )T GROUP BY T.STATO"; $query = $con->prepare($sql2); try { $query->execute(); $res = $query->fetchAll(PDO::FETCH_ASSOC); } catch (Exception $exc) { $exc->getMessage(); } foreach ($res as $r){ $result[$r['STATO']]['TOT_SCONTO'] = ($format ? number_format($r['TOT_SCONTO'], 2 , ',', '.') : $r['TOT_SCONTO']); $result[$r['STATO']]['N_RICHIESTE'] = $r['TOT']; } return $result; } public static function GetTipoContributo($format = false) { global $con; $result = array(); $res = array(); $sql2 = "SELECT T.TIPO, SUM(T.SCONTO_TOTALE) AS TOT_SCONTO, count(T.ID) AS TOT FROM ( SELECT D.SCONTO_TOTALE, D.ID, 'RESIDENTI' AS TIPO FROM VIEW_EXPORT_SCONTI D WHERE D.ISEE = 0 AND D.PRIORITA = 0 )T GROUP BY T.TIPO UNION SELECT T.TIPO, SUM(T.SCONTO_TOTALE) AS TOT_SCONTO, count(T.ID) AS TOT FROM ( SELECT D.SCONTO_TOTALE, D.ID, 'PRIORITARI' AS TIPO FROM VIEW_EXPORT_SCONTI D WHERE (D.ISEE = 1 OR D.PRIORITA = 1) )T GROUP BY T.TIPO"; $query = $con->prepare($sql2); try { $query->execute(); $res = $query->fetchAll(PDO::FETCH_ASSOC); } catch (Exception $exc) { $exc->getMessage(); } foreach ($res as $r){ $result[$r['TIPO']]['TOT_SCONTO'] = ($format ? number_format($r['TOT_SCONTO'], 2 , ',', '.') : $r['TOT_SCONTO']); $result[$r['TIPO']]['N_RICHIESTE'] = $r['TOT']; } return $result; } /** * * @global type $con * @return type */ public static function GetTotalePerFascia() { global $con; $result = array(); $res = array(); $sql2 = "SELECT FNGETCONTRIBUTO(ID, 'FASCIA') AS FASCIA, COUNT(ID) AS NUM FROM DOMANDA WHERE STATO = 1 GROUP BY FNGETCONTRIBUTO(ID, 'FASCIA')"; $query = $con->prepare($sql2); try { $query->execute(); $res = $query->fetchAll(PDO::FETCH_ASSOC); } catch (Exception $exc) { $exc->getMessage(); } return $res; } public static function GetChartDay() { global $con; $result = array(); $res = array(); $sql = "SELECT Q.NUM_DOMANDE, Q.TOT_SCONTO, Q.DATA AS LABELS FROM (SELECT count(T.ID) AS NUM_DOMANDE, SUM(SCONTO_TOTALE) as TOT_SCONTO, T.DATA FROM ( SELECT ID, SCONTO_TOTALE, TO_CHAR(DATA_REGISTRAZIONE, 'dd/mm/YYYY') AS DATA FROM VIEW_EXPORT_SCONTI WHERE STATO >= 0)T GROUP BY T.DATA)Q ORDER BY TO_DATE(Q.DATA, 'dd/mm/YYYY') ASC"; $query = $con->prepare($sql); try { $query->execute(); $res = $query->fetchAll(PDO::FETCH_ASSOC); } catch (Exception $exc) { $exc->getMessage(); } /*$i = 0; foreach ($res as $r){ $result[$r['SFRATTO']][$i]['NUM_DOMANDE'] = intval($r['NUM_DOMANDE']); $result[$r['SFRATTO']][$i]['LABELS'] = $r['LABELS']; $i++; } */ return $res; } public static function getDisponibilita($simulaDisponibilita = DISPONIBILITA_FINANZIARIA, $tipo_coefficente = -1){ $result = array(); $totale_contributo = Domanda::GetTotaleContributo(false); $DISPONIBILITA_FINANZIARIA_SFRATTO = (($simulaDisponibilita/100)*PERC_PER_FRATTO); $DISPONIBILITA_FINANZIARIA_ALTRI = (($simulaDisponibilita-$DISPONIBILITA_FINANZIARIA_SFRATTO)); $eccedenza = ($DISPONIBILITA_FINANZIARIA_ALTRI-$totale_contributo[1][0]['TOT_CONTRIBUTO']>0 ? $DISPONIBILITA_FINANZIARIA_ALTRI-$totale_contributo[1][0]['TOT_CONTRIBUTO'] : 0); $coefficente_sfratto = ($totale_contributo[1][1]['TOT_CONTRIBUTO']>0 ? ($DISPONIBILITA_FINANZIARIA_SFRATTO/$totale_contributo[1][1]['TOT_CONTRIBUTO']) : 0); $eccedenza_sfratto = ($DISPONIBILITA_FINANZIARIA_SFRATTO-$totale_contributo[1][1]['TOT_CONTRIBUTO']>0 ? $DISPONIBILITA_FINANZIARIA_SFRATTO-$totale_contributo[1][1]['TOT_CONTRIBUTO'] : 0); $disponibilita_altri = ($DISPONIBILITA_FINANZIARIA_ALTRI+$eccedenza_sfratto); $coefficente_altri = ($totale_contributo[1][0]['TOT_CONTRIBUTO']>0 ? ($disponibilita_altri/$totale_contributo[1][0]['TOT_CONTRIBUTO']) : 0); if($tipo_coefficente == 1){ $result['COEFFICENTE'] = floatval($coefficente_sfratto); }elseif($tipo_coefficente == 0){ $result['COEFFICENTE'] = floatval($coefficente_altri); }else{ $result['DISPONIBILITA_FINANZIARIA'] = $simulaDisponibilita; $result['DISPONIBILITA_FINANZIARIA_SFRATTO'] = $DISPONIBILITA_FINANZIARIA_SFRATTO; $result['TOTALE_CONTRIBUTO_SFRATTO'] = $totale_contributo[1][1]['TOT_CONTRIBUTO']; $result['NUM_DOMANDE_SFRATTO'] = intval($totale_contributo[1][1]['N_DOMANDE']); $result['COEFFICENTE_SFRATTO'] = (is_infinite($coefficente_sfratto) ? 0 : $coefficente_sfratto ); $result['ECCEDENZA_SFRATTO'] = $eccedenza_sfratto; $result['DISPONIBILITA_FINANZIARIA_ALTRI'] = $DISPONIBILITA_FINANZIARIA_ALTRI; $result['DISPONIBILITA_ALTRI'] = floatval($disponibilita_altri); $result['TOTALE_CONTRIBUTO'] = $totale_contributo[1][0]['TOT_CONTRIBUTO']; $result['NUM_DOMANDE'] = intval($totale_contributo[1][0]['N_DOMANDE']); $result['COEFFICENTE_ALTRI'] = $coefficente_altri; $result['RESIDUO'] = $eccedenza; } return $result; } public function GetTotaleContributoOracle($tipo = '') { global $con; $res = array(); $sql = "SELECT FNGETCONTRIBUTO(".$this->ID.", '".$tipo."') AS CONTRIBUTO FROM DUAL "; $query = $con->prepare($sql); try { $query->execute(); $res = $query->fetch(PDO::FETCH_ASSOC); } catch (Exception $exc) { $exc->getMessage(); } return $res['CONTRIBUTO']; } public function GetIBANCorrente(){ global $con; $res = array(); $res['IBAN'] = null; $res['ISTITUTO_CREDITO'] = null; $res['FILIALE_CREDITO'] = null; if(count($this->cambio_iban)>0){ $cambio = DomandaIban::getIBAN($this->ID); $res['IBAN'] = $cambio[0]['IBAN']; $res['ISTITUTO_CREDITO'] = $cambio[0]['ISTITUTO_CREDITO']; $res['FILIALE_CREDITO'] = $cambio[0]['FILIALE_CREDITO']; }else{ $res['IBAN'] = $this->IBAN; $res['ISTITUTO_CREDITO'] = $this->ISTITUTO_CREDITO; $res['FILIALE_CREDITO'] = $this->FILIALE_CREDITO; } return $res; } } class DomandaDichiarazioni extends DataClass { const TABLE_NAME = "DOMANDA_DICHIARAZIONI"; const SP_ = "SPDICHIARAZIONISAVE"; public $ID_DOMANDA = 0; //FK public $ID_ANAG_DICHIARAZIONI = 0; public function __construct($src = null) { global $con; if ($src == null) return; if (is_array($src)) { $this->_loadByRow($src, $stripSlashes); } elseif (intval($src)) { $this->_loadById($src, self::TABLE_NAME, true); } } public static function Count($filter = null) { return parent::_count(self::TABLE_NAME, $filter); } /** * Load titoli di studio * * * return * For $id => array of DomandaTitoliStudio, for other array of array of DomandaTitoliStudio * * * params: * $id (int): load single rows from id * $id_anag_titolo (int): filter from id_anag_titolo */ public static function load($id_domanda = 0, $id_anag_dichiarazione = 0) { global $con; if ($id_domanda <= 0) { return array(); } $rows = array(); $select = ($onlyCount ? " COUNT(ID_DOMANDA) AS TOT " : " * "); $filter = ""; if (!empty($id_domanda)) { $filter .= ($filter != "" ? " AND " : "") . " ID_DOMANDA = :id_domanda "; } if (!empty($id_anag_dichiarazione)) { $filter .= ($filter != "" ? " AND " : "") . " ID_ANAG_DICHIARAZIONE = :id_anag_dichiarazione "; } $filter = ($filter != "" ? " WHERE " : "") . $filter; $sql = "SELECT " . $select . " FROM " . self::TABLE_NAME . $filter; $query = $con->prepare($sql); if (!empty($id_domanda)) { $query->bindParam(":id_domanda", $id_domanda); } if (!empty($id_anag_dichiarazione)) { $query->bindParam(":id_anag_dichiarazione", $id_anag_dichiarazione); } try { $query->execute(); $rows = $query->fetchAll(PDO::FETCH_ASSOC); } catch (Exception $exc) { echo $exc->getMessage(); } return $rows; } public static function AllFromDomanda($id_domanda = 0, $onlyDomanda = false) { global $con; $rows = array(); $filter = " T.CANCELLATO = 0 "; $order = " ORDER BY T.POSIZIONE, T.CODICE"; if (!empty($id_domanda) && $onlyDomanda) { $filter .= ($filter != "" ? " AND " : "") . " D.ID_DOMANDA = :id_domanda "; } $filter = ($filter != "" ? " WHERE " : "") . $filter; $sql = "SELECT T.ID AS ID_DICHIARAZIONE, T.DESCRIZIONE, T.CODICE, T.OBBLIGO, D.ID_DOMANDA, D.ID_ANAG_DICHIARAZIONI " . "FROM " . AnagraficaDichiarazioni::TABLE_NAME . " T LEFT JOIN " . self::TABLE_NAME . " D on D.ID_ANAG_DICHIARAZIONI = T.ID AND D.ID_DOMANDA = :id_domanda " . $filter . $order; $query = $con->prepare($sql); if (!empty($id_domanda)) { $query->bindParam(":id_domanda", $id_domanda); } try { $query->execute(); $rows = $query->fetchAll(PDO::FETCH_ASSOC); } catch (Exception $exc) { echo $exc->getMessage(); } return $rows; } public function Delete() { return parent::_Delete(self::TABLE_NAME, "ID_DOMANDA = " . $this->ID_DOMANDA); } public function Save() { global $con, $LoggedAccount; $sql = "CALL " . self::SP_ . " (?,?)"; $query = $con->prepare($sql); $query->bindParam(1, $this->ID_DOMANDA); $query->bindParam(2, $this->ID_ANAG_DICHIARAZIONI); try { if ($query->execute()) { $it['esito'] = 1; } } catch (Exception $exc) { $it['descrizioneErrore'] = $exc->getMessage(); } return $it; } }