include ("../common/public.php") ; $arrPerc = array() ; $str = "" ; if ($id > 0) { /************************************************************************************ * recupero sia i dati dell'agente il cui id č stato passato dalla pagina precedente * che le provvigioni rispetto ai fornitori ************************************************************************************/ $q = " select * from agenti where idagenti = $id" ; list($n, $d) = $db->RecuperaDati($q) ; for ($i=0; $i<$n; $i++) { $nome = $d['Nome'][0] ; $ind = $d['Indirizzo'][0] ; $cit = $d['Citta'][0] ; $tel = $d['Telefono'][0] ; $cell = $d['Cellulare'][0] ; $email = $d['Email'][0] ; $piva = $d['PIva'][0] ; $cap = $d['Cap'][0] ; $prov = $d['Provincia'][0] ; $fax = $d['Fax'][0] ; $imp = $df['Importanza'][0] ; $fac = $df['Facilita'][0] ; $ban = $d['Banca'][0] ; $codiban = $d['CodIban'][0] ; $abi = $d['Abi'][0] ; $cab = $d['Cab'][0] ; $cc = $d['Cc'][0] ; $perc = $d['Percentuale'][0] ; $note = $d['Note'][0] ; $tipoMandato = $d['TipoMandato'][0] ; $titolo = "Modifica i dati dell'Agente " . $nome . "" ; $strComando = "Modifica" ; } } else { $titolo = "Operazione di inserimento di un nuovo agente" ; $tipoMandato = 1 ; // Default => Plurimandatario $strComando = "Conferma" ; } /************************************************************************************************ * Per recuperare la lista dei fornitori e le relative percentuali devo operare nel seguente modo * in quanto ci possono essere situazioni strane da gestire *************************************************************************************************/ $dbt = new FC_SQL ; $qfor = " select F.* from fornitori F where F.Attivo = 1 or (F.Attivo = 0 and YEAR(F.DataDisattivazione) > $anno) order by F.Nome " ; list($n, $d) = $db->RecuperaDati($qfor) ; for($i=0; $i<$n; $i++) { $idfor = $d['IdFornitori'][$i] ; $nomefor = $d['Nome'][$i] ; $arrPerc[$idfor]['Nome'] = $nomefor ; $arrPerc[$idfor]['Perc'] = '0' ; list($np, $dp) = $dbt->RecuperaDati("select * from ageforper where idagente = $id and idfornitore = $idfor") ; $arrPerc[$idfor]['Perc'] = nfp($dp['Percentuale'][0]) ; } @reset($arrPerc) ; foreach($arrPerc as $idFor => $arrFor) { $str .="" ; $str .="" . htmlspecialchars($arrFor['Nome']) . "" ; $str .="" . nfp($arrFor['Perc']) . "" ; $str .= "" ; } $str .= "" ; // print_r($arrPerc) ; exit ; $header = "Fornitore,% Provv" ; $strSort = "str,int" ; $iniW = "330,70" ; $setColType = "ro,ed" ; $setColAlign = "left,center" ; ?>