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.
212 righe
7.9 KiB
212 righe
7.9 KiB
<?php |
|
|
|
switch ($_REQUEST['action']) { |
|
case 'domande_preparate': |
|
domandePreparate(); |
|
break; |
|
case 'load_disponibilita': |
|
loadDisponibilita(); |
|
break; |
|
case 'load_statistiche': |
|
loadStatistiche(); |
|
break; |
|
case 'save_coefficente': |
|
saveCoefficente(); |
|
break; |
|
} |
|
exit(); |
|
|
|
function saveCoefficente(){ |
|
|
|
|
|
$bando = new Bando(ID_BANDO_RIF); |
|
$sfratto = floatval(preg_replace("/[^-0-9\.]/",".",$_POST['sfratto'])); |
|
$nosfratto = floatval(preg_replace("/[^-0-9\.]/",".",$_POST['nosfratto'])); |
|
$bando->COEFFICENTE_SFRATTO = $sfratto; |
|
$bando->COEFFICENTE = $nosfratto; |
|
$res = $bando->Save(); |
|
exit(json_encode(array($res))); |
|
} |
|
|
|
|
|
function loadDisponibilita(){ |
|
$simula = trim($_POST['disponibilita']); |
|
$r = array(); |
|
$r = Domanda::getDisponibilita($simula); |
|
$bando = new Bando(ID_BANDO_RIF); |
|
|
|
$r['COEFFICENTE_SFRATTO_BANDO'] = number_format($bando->COEFFICENTE_SFRATTO, 6); |
|
$r['COEFFICENTE_BANDO'] = number_format($bando->COEFFICENTE, 6); |
|
|
|
|
|
|
|
$r['TOTALE_PRESENTATE'] = ($r['NUM_DOMANDE_SFRATTO'] + $r['NUM_DOMANDE']); |
|
$r['DISPONIBILITA_FINANZIARIA'] = number_format($r['DISPONIBILITA_FINANZIARIA'], 6, ',', '.'); |
|
$r['DISPONIBILITA_FINANZIARIA_SFRATTO'] = number_format($r['DISPONIBILITA_FINANZIARIA_SFRATTO'], 6, ',', '.'); |
|
$r['TOTALE_CONTRIBUTO_SFRATTO'] = number_format(round(str_replace(",", ".", $r['TOTALE_CONTRIBUTO_SFRATTO']), 2), 6, ',', '.'); |
|
$r['COEFFICENTE_SFRATTO'] = number_format($r['COEFFICENTE_SFRATTO'], 6, ',', '.'); |
|
$r['ECCEDENZA_SFRATTO'] = number_format($r['ECCEDENZA_SFRATTO'], 6, ',', '.'); |
|
$r['DISPONIBILITA_FINANZIARIA_ALTRI'] = number_format($r['DISPONIBILITA_FINANZIARIA_ALTRI'], 6, ',', '.'); |
|
$r['DISPONIBILITA_ALTRI'] = number_format($r['DISPONIBILITA_ALTRI'], 6, ',', '.'); |
|
$r['TOTALE_CONTRIBUTO'] = number_format(round(str_replace(",", ".", $r['TOTALE_CONTRIBUTO']), 2), 2, ',', '.'); |
|
$r['COEFFICENTE_ALTRI'] = number_format($r['COEFFICENTE_ALTRI'], 6, ',', '.'); |
|
$r['RESIDUO'] = number_format($r['RESIDUO'], 5, ',', '.'); |
|
|
|
|
|
|
|
// number_format(DISPONIBILITA_FINANZIARIA, 2, ',', '.') |
|
|
|
exit(json_encode(array($r))); |
|
} |
|
|
|
function loadStatistiche(){ |
|
global $PROVINCE_SICILIA; |
|
$result = array(); |
|
$provincie = Domanda::GetTotaleContributoProvincia(); |
|
|
|
$charts['labels'] = array(); |
|
|
|
|
|
for($i = 0; $i<count($provincie); $i++){ |
|
$charts['labels'][] = $PROVINCE_SICILIA[$provincie[$i]['PROVINCIA']]['nome']; |
|
|
|
$provincie[$i]['CONTRIBUTO_PROVINCIA'] = str_replace(",", ".", $provincie[$i]['CONTRIBUTO_PROVINCIA']); |
|
$result['TOTALE_CONTRIBUTO'] += $provincie[$i]['CONTRIBUTO_PROVINCIA']; |
|
$charts['datasets']['backgroundColor'][] = $PROVINCE_SICILIA[$provincie[$i]['PROVINCIA']]['color']; |
|
$charts['datasets']['data'][] = number_format((round($provincie[$i]['CONTRIBUTO_PROVINCIA'], 2)), 2, '.', ''); |
|
$provincie[$i]['PROVINCIA'] = $PROVINCE_SICILIA[$provincie[$i]['PROVINCIA']]['nome']; |
|
$provincie[$i]['CONTRIBUTO_PROVINCIA'] = number_format((round($provincie[$i]['CONTRIBUTO_PROVINCIA'], 2)), 2, ',', '.'); |
|
|
|
} |
|
|
|
$num_domande = Domanda::GetTotaleContributo(); |
|
$num_tipo = Domanda::GetTipoContributo(); |
|
$num_account = Domanda::GetUtentiRegistrati(); |
|
$num_compagnie = Domanda::GetScontiFromCompagnie(); |
|
$num_tratte = Domanda::GetScontiFromTopTratte(); |
|
|
|
//Utils::print_array($num_compagnie); |
|
|
|
|
|
$result['NUM_ACCOUNT_M'] = intval($num_account['M']); |
|
$result['NUM_ACCOUNT_F'] = intval($num_account['F']); |
|
$result['NUM_RESIDENTI'] = intval($num_tipo['RESIDENTI']['N_RICHIESTE']); |
|
$result['NUM_PRIORITARI'] = intval($num_tipo['PRIORITARI']['N_RICHIESTE']); |
|
$result['TOT_RESIDENTI'] = number_format(str_replace(",", ".", round($num_tipo['RESIDENTI']['TOT_SCONTO'], 2)), 2, ',', '.'); |
|
$result['TOT_PRIORITARI'] = number_format(str_replace(",", ".", round($num_tipo['PRIORITARI']['TOT_SCONTO'], 2)), 2, ',', '.'); |
|
$result['NUM_ACCOUNT'] = ($result['NUM_ACCOUNT_M']+$result['NUM_ACCOUNT_F']); |
|
$result['NUM_IN_ELABORAZIONE'] = intval($num_domande[RS_IN_ELABORAZIONE]['N_RICHIESTE']); |
|
$result['NUM_PRESA_IN_CARICO'] = intval($num_domande[RS_PRESA_IN_CARICO]['N_RICHIESTE']); |
|
$result['NUM_APPROVATA'] = intval($num_domande[RS_APPROVATA]['N_RICHIESTE']); |
|
$result['NUM_EROGATA'] = intval($num_domande[RS_EROGATA]['N_RICHIESTE']); |
|
$result['NUM_NON_APPROVATA'] = intval($num_domande[RS_NON_APPROVATA]['N_RICHIESTE'])+intval($num_domande[RS_ANNULLATE_UFFICIO]['N_RICHIESTE']); |
|
|
|
|
|
$result['TOTALE_PRESENTATE'] = ($result['NUM_IN_ELABORAZIONE'] + $result['NUM_PRESA_IN_CARICO']+$result['NUM_APPROVATA']+$result['NUM_EROGATA']+$result['NUM_NON_APPROVATA']); |
|
|
|
$result['TOTALE_CONTRIBUTO'] = number_format(str_replace(",", ".", round($result['TOTALE_CONTRIBUTO'], 2)), 2, ',', '.'); |
|
|
|
|
|
$labels = Domanda::GetChartDay(); |
|
//Utils::print_array($labels); |
|
$datasets['labels'] = array(); |
|
$label_tmp = ''; |
|
foreach($labels as $v){ |
|
if($label_tmp!=$v['LABELS']){ |
|
$label_tmp = $v['LABELS']; |
|
$datasets['labels'][]= $v['LABELS']; |
|
} |
|
|
|
|
|
$datasets['N_RICHIESTE'][] = $v['NUM_DOMANDE']; |
|
//$datasets['SCONTI'][] = $v['TOT_SCONTO']; |
|
|
|
|
|
} |
|
|
|
|
|
$labels_compagnie['labels'] = array(); |
|
|
|
$tmp_colorR = Utils::generaColoreRGB('0.5'); |
|
$tmp_colorS = Utils::generaColoreRGB('0.5'); |
|
foreach($num_compagnie as $k => $v){ |
|
$labels_compagnie['labels'][] = $k; |
|
//Utils::print_array($v); |
|
|
|
foreach($v as $key => $value){ |
|
if($key == 'N_RICHIESTE'){ |
|
$labels_compagnie['datasetsR']['label'] = 'Numero richieste'; |
|
$labels_compagnie['datasetsR']['data'][] = $value; |
|
$labels_compagnie['datasetsR']['backgroundColor'][] = $tmp_colorR; |
|
} |
|
if($key == 'TOT_SCONTO'){ |
|
$labels_compagnie['datasetsS']['label'] = 'Importo richieste'; |
|
$labels_compagnie['datasetsS']['data'][] = $value; |
|
$labels_compagnie['datasetsS']['backgroundColor'][] = $tmp_colorS; |
|
} |
|
|
|
} |
|
} |
|
|
|
$labels_tratte['labels'] = array(); |
|
|
|
$tmp_color = Utils::generaColoreRGB('1'); |
|
foreach($num_tratte as $k => $v){ |
|
$labels_tratte['labels'][] = $k; |
|
//Utils::print_array($v); |
|
|
|
foreach($v as $key => $value){ |
|
if($key == 'N_RICHIESTE'){ |
|
$labels_tratte['datasets']['label'] = 'Numero richieste'; |
|
$labels_tratte['datasets']['data'][] = $value; |
|
$labels_tratte['datasets']['backgroundColor'][] = $tmp_color; |
|
} |
|
|
|
} |
|
} |
|
|
|
|
|
$result['datasets'] = $datasets; |
|
|
|
$result['chardatasets'] = $charts; |
|
$result['provincie'] = $provincie; |
|
$result['compagnie'] = $labels_compagnie; |
|
$result['tratte'] = $labels_tratte; |
|
|
|
exit(json_encode(array($result))); |
|
} |
|
|
|
|
|
|
|
function domandePreparate() { |
|
|
|
$rec = array(); |
|
$rec['domande_presentate'] = Domanda::Count(); |
|
$rec['domande_complete'] = Domanda::Count('STATO = 1'); |
|
$rec['domande_inattesa'] = Domanda::Count('STATO = 0'); |
|
//$microimpreseAll = ClusterDb::Count(); |
|
//$microimpreseRegistrate = Account::Count('CONSENSO = 1'); |
|
//$microimpreseRegistrateNoConsenso = Account::Count('CONSENSO = 0'); |
|
|
|
|
|
exit(json_encode(array($rec))); |
|
} |
|
|
|
|
|
|
|
|
|
function array_to_xml($array, &$xml_istanze) { |
|
foreach ($array as $key => $value) { |
|
if (is_array($value)) { |
|
if (!is_numeric($key)) { |
|
$subnode = $xml_istanze->addChild("$key"); |
|
array_to_xml($value, $subnode); |
|
} else { |
|
$subnode = $xml_istanze->addChild("istanza"); |
|
array_to_xml($value, $subnode); |
|
} |
|
} else { |
|
$xml_istanze->addChild("$key", htmlspecialchars("$value")); |
|
} |
|
} |
|
}
|
|
|