$int_font[mr] = 2; $int_font[name] = 'Arial12int'; $OO_TEXT .= print_text("\n\nDestinatario:\n\n" . "{$cliente['nome']}\n" . "{$cliente['indirizzo']}\n" . "{$cliente['cap']} {$cliente['citta']}\n", $int_font); } // operator list $j = mysql_query("SELECT id,codice,nome FROM users"); while ($k = mysql_fetch_assoc($j)) { $OPER[$k[id]] = array($k[codice], $k[nome]); } // tipo list $j = mysql_query("SELECT codice,ttp_desc FROM INT_pratiche_tipo"); while ($k = mysql_fetch_assoc($j)) { $PRTIPO[$k[codice]] = $k[ttp_desc]; } // create table new_table(get_default_table('Tabella1', array(7, 19, 3.7))); add_table_header('Tabella1', array('Codice', 'Oggetto', 'Date'), make_bold($oo_ar10c)); $where = implode(' AND ', $wh); $q = mysql_query(" SELECT P.*,C.codice,C.nome \n FROM pratiche P\n\t\t\t\t\t\t\tLEFT JOIN contact C ON pr_ref_idcliente = C.id\n WHERE {$where}\n ORDER BY pr_codice ASC"); while ($l = mysql_fetch_assoc($q)) { $op = $l[pr_operatore]; $oper = is_array($OPER[$op]) ? $OPER[$op][0] . " (" . $OPER[$op][1] . ")" : ''; $valore = 'Indeterminato'; if ($l[pr_valore] == -2) { $valore = 'Indet/Extra'; } if ($l[pr_valore] > 0) { $valore = nform($l[pr_valore]); } add_table_row('Tabella1', array($l[pr_codice] . "\n\nN. " . (int) $l[pr_numero], "Repertorio n. " . $l[pr_repertorio] . "\t\t" . "Cliente: " . $l[codice] . " (" . $l[nome] . ")\n" . $l[pr_oggetto] . "\n" . "Tipo: " . $l[pr_tipo] . " (" . $PRTIPO[$l[pr_tipo]] . ")\t\t" . "Operatore: " . $oper . "\n" . "Valore: {$valore}\t\tCrit.: " . $l[pr_criterio] . "\t\tFido:" . nform($l[pr_fido]) . "\n" . "Aut. C.: " . $l[pr_comp_cod] . " . " . $l[pr_comp_desc] . "\tN.Prov: " . $l[pr_nprovv] . "\n" . "Giud: " . $l[pr_giudice] . "\t\tN.Ruol: " . $l[pr_nruolo], "Ape: " . mysql_to_date($l[pr_data_inizio]) . "\n" . "Ins: " . mysql_to_date($l[pr_data_ins]) . "\n" . "Agg: " . mysql_to_date($l[pr_data_mod])), array($oo_ar10, $oo_ar10, $oo_ar10e)); // note
if ($prevalenza == 2) { $ono_field = $l['on_onorari']; } if ($prevalenza == 3) { $ono_field = $l['on_utente']; } $tot_ono += $ono_field; $tot_acc += $l['acconti']; $tot_ant += $l['anticipazioni']; add_table_row('Tabella1', array($l[data] != $prev_data ? mysql_to_date($l[data]) : '', $l[testo], nform($spese_sost * $n_val, 1, $n_dec, $n_tho), nform($l[diritti] * $n_val, 1, $n_dec, $n_tho), nform($ono_field * $n_val, 1, $n_dec, $n_tho)), array($oo_def_c, $oo_def, $oo_def_e, $oo_def_e, $oo_def_e)); $prev_data = $l[data]; } add_table_row('Tabella1', array('', '', '--------------', '--------------', '--------------'), $oo_def_e); add_table_row('Tabella1', array('', EXPORT_SXW_F_TOTPR, nform($tot_spe * $n_val, 0, $n_dec, $n_tho), nform($tot_dir * $n_val, 0, $n_dec, $n_tho), nform($tot_ono * $n_val, 0, $n_dec, $n_tho)), array($oo_def_c, $oo_def, $oo_def_e, $oo_def_e, $oo_def_e)); // create table new_table(get_default_table('Tabella2', array(14, 6), 0)); $tot1 = 0; $p_tot_imp = nform($tot_imp * $n_val, 0, $n_dec, $n_tho); add_table_row('Tabella2', array(EXPORT_SXW_F_RIEP, $n_cod), array($oo_def, $oo_def_e)); add_table_row('Tabella2', array('------------', '----------------------'), array($oo_def, $oo_def_e)); add_table_row('Tabella2', array(EXPORT_SXW_F_TOTIMP, $p_tot_imp), array($oo_def, $oo_def_e)); $p_tot_dir = nform($tot_dir * $n_val, 0, $n_dec, $n_tho); $p_tot_ono = nform($tot_ono * $n_val, 0, $n_dec, $n_tho); add_table_row('Tabella2', array(EXPORT_SXW_F_TOTDIR, $p_tot_dir), array($oo_def, $oo_def_e)); add_table_row('Tabella2', array(EXPORT_SXW_F_TOTONO, $p_tot_ono), array($oo_def, $oo_def_e)); $tot1 += $tot_imp + $tot_dir + $tot_ono; if ($rimb_for > 0) { $r_perc = nform($rimb_for, $n_dec, $n_tho); $r_molt = $rimb_for / 100; $p_rimb_for = nform(($tot_dir + $tot_ono) * $r_molt * $n_val, 0, $n_dec, $n_tho); add_table_row('Tabella2', array(sprintf(EXPORT_SXW_F_RIMBFOR, $r_perc), $p_rimb_for), array($oo_def, $oo_def_e));
if (count($wh) > 0) { $PAGE_STYLE[width] = 21; $PAGE_STYLE[height] = 29.7; //intestazione: info cliente if ($dest) { $k = $DB->Execute("SELECT * FROM contact WHERE id=" . $DB->Quote($dest)); $cliente = $k->FetchRow(); utf8_encode_array($cliente); $int_font = $oo_def; $int_font[ml] = 15; $int_font[mr] = 2; $int_font[name] = 'Arial12int'; $OO_TEXT .= print_text("\n\n" . EXPORT_SXW_DEST . ":\n\n" . "{$cliente['nome']}\n" . "{$cliente['indirizzo']}\n" . "{$cliente['cap']} {$cliente['citta']}\n", $int_font); } // create table new_table(get_default_table('Tabella1', array(4, 9, 8))); add_table_header('Tabella1', array(EXPORT_SXW_COD, EXPORT_SXW_DENOM, EXPORT_SXW_NTEL), make_bold($oo_def_c)); $where = implode(' AND ', $wh); $TIPI = array(1 => 'AVVR', 2 => 'CLIE', 3 => 'COLL', 4 => 'CONS', 5 => 'CORR', 6 => 'FORN'); $q = $DB->Execute(" SELECT * \r\n FROM contact \r\n WHERE {$where}\r\n ORDER BY codice ASC"); while ($l = $q->FetchRow()) { utf8_encode_array($l); if ($l[data] == '0000-00-00') { $l[data] = ''; } add_table_row('Tabella1', array($l[codice], $rapida ? $l[nome] : "{$l['nome']}\n" . "{$l['indirizzo']}\n" . "{$l['cap']}\t{$l['citta']}\n" . "{$l['stato']}\t- {$l['leg_rap']}\n" . EXPORT_SXW_TYPE . ": " . $TIPI[$l[tipo]] . "\n" . EXPORT_SXW_DCOST . ": {$l['data']} - {$l['luogo']}", $rapida ? $l[telefono] : "{$l['telefono']}\n" . EXPORT_SXW_FAX . ":\t{$l['fax']}\n" . EXPORT_SXW_CFIS . "\t{$l['cod_fis']}\n" . EXPORT_SXW_PIVA . "\t{$l['piva']}\n" . EXPORT_SXW_ISCRCIAAA . ": {$l['iscr_ccia']}\n" . EXPORT_SXW_ISCRTRIB . ": {$l['iscr_trib']}\n" . EXPORT_SXW_PERSFIS . ": " . ($l[tipo_contatto] ? EXPORT_SXW_PERSFIS_NO : EXPORT_SXW_PERSFIS_YES) . "\n"), array($oo_def, $oo_def, $oo_def)); // note if ($l[note] && in_array(1, $P[print_note]) && !$rapida) { add_table_row('Tabella1', array(EXPORT_SXW_NOTE . ": " . $l[note]), $oo_def); } }
} if ($tipo) { $wh[] = "(tipo = " . $DB->Quote($tipo) . ")"; } if (count($wh) > 0) { $PAGE_STYLE[width] = 21; $PAGE_STYLE[height] = 29.7; // gruppi $q = $DB->Execute("\tSELECT gruppi.id,users.nome FROM gruppi,group_user,users \r\n\t\t\t\t\t\t\tWHERE groupid=gruppi.id AND userid = users.id"); while ($l = $q->FetchRow()) { $GRP[$l[id]][] = $l[nome]; } utf8_encode_array($GRP); //intestazione: info cliente // create table new_table(get_default_table('Tabella1', array(5, 8, 4, 4))); add_table_header('Tabella1', array(EXPORT_SXW_NAME, EXPORT_SXW_DESCR, EXPORT_SXW_TYPE, EXPORT_SXW_TAR), make_bold($oo_def_c)); $where = implode(' AND ', $wh); $q = $DB->Execute(" SELECT * \r\n FROM gruppi \r\n WHERE {$where}\r\n ORDER BY name ASC"); $TIPI = array(EXPORT_SXW_T_GRP, EXPORT_SXW_T_DEP, EXPORT_SXW_T_OFF); while ($l = $q->FetchRow()) { utf8_encode_array($l); add_table_row('Tabella1', array($l[name], $l[descr], $TIPI[$l[tipo]], nform($l[on_orar])), array($oo_def_c, $oo_def, $oo_def_c, $oo_def_c)); // note if (is_array($GRP[$l[id]]) && $P[print_note] == 1) { add_table_row('Tabella1', array(EXPORT_SXW_USERS . ": " . implode(", ", $GRP[$l[id]])), $oo_def); } } // create content $OO_PAGE_STYLE = set_page_style($PAGE_STYLE); $OO_PAGE_HEADER = set_page_header("#DATA#\t\t\t\t" . EXPORT_SXW_TIT_GRP . "\t\t\t" . EXPORT_SXW_TIT_PG . ": #PAGINA#");
$wh = array('1 = 1'); if ($codice_from) { $wh[] = "(tatid >= " . $DB->Quote($codice_from) . ")"; } if ($codice_to) { $wh[] = "(tatid <= " . $DB->Quote($codice_to) . ")"; } if ($descr) { $wh[] = "(tat_desc LIKE " . $DB->Quote("%{$descr}%") . ")"; } if (count($wh) > 0) { $PAGE_STYLE[width] = 21; $PAGE_STYLE[height] = 29.7; //intestazione: info cliente // create table new_table(get_default_table('Tabella1', array(1.6, 5.7, 1.5, 1.5, 1.5, 1.7, 1.5, 1.5, 1.7, 1.4, 1.4))); add_table_header('Tabella1', array(EXPORT_SXW_TAR_COD, EXPORT_SXW_TAR_DESCIMP, EXPORT_SXW_TAR_DIR, EXPORT_SXW_TAR_STRA, EXPORT_SXW_TAR_PENA, EXPORT_SXW_TAR_CONC, EXPORT_SXW_TAR_PRET, EXPORT_SXW_TAR_TRIB, EXPORT_SXW_TAR_AMMN, EXPORT_SXW_TAR_CA, EXPORT_SXW_TAR_CC), make_bold($oo_def_c)); $where = implode(' AND ', $wh); $q = $DB->Execute(" SELECT * \r\n FROM INT_tariffe \r\n WHERE {$where}\r\n ORDER BY tatid ASC"); while ($l = $q->FetchRow()) { utf8_encode_array($l); if ($l[tat_imp_molt] == '') { $l[tat_imp_molt] = ' '; } if ($l[tat_nonimp_molt] == '') { $l[tat_nonimp_molt] = ' '; } add_table_row('Tabella1', array($l[tatid], $rapida ? $l[tat_desc] : "{$l['tat_desc']}\n" . EXPORT_SXW_SPE . ":\t" . nform($l[tat_imp]) . " ({$l['tat_imp_molt']})" . " " . nform($l[tat_nonimp]) . " ({$l['tat_nonimp_molt']})", $rapida ? '' : $l[tat_diritti], $rapida ? '' : $l[tat_stragiudiziali], $rapida ? '' : $l[tat_ccostituzionale], $rapida ? '' : $l[tat_conciliazione], $rapida ? '' : $l[tat_pretura], $rapida ? '' : $l[tat_tribunale], $rapida ? '' : $l[tat_amministrative], $rapida ? '' : $l[tat_cappello], $rapida ? '' : $l[tat_ccassazione]), array($oo_def_c, $oo_def, $oo_def_c, $oo_def_c, $oo_def_c, $oo_def_c, $oo_def_c, $oo_def_c, $oo_def_c, $oo_def_c, $oo_def_c)); } // create content $OO_PAGE_STYLE = set_page_style($PAGE_STYLE);
$int_font = $oo_def; $int_font[ml] = 15; $int_font[mr] = 2; $int_font[name] = 'Arial12int'; $OO_TEXT .= print_text( "\n\n".EXPORT_SXW_DEST.":\n\n". "$cliente[nome]\n". "$cliente[indirizzo]\n". "$cliente[cap] $cliente[citta]\n", $int_font); } */ // tables $tab1 = get_default_table('Tabella1', array(2.5, 2, 10, 6.5), 0.002, 0); $tab2 = get_default_table('Tabella2', array(2.5, 2, 10, 6.5), 0.002, 1); $tab3 = get_default_table('Tabella3', array(2, 19), 0.002, 0); // create table if (!in_array(3, $_GET[print_note])) { new_table($tab1); add_table_header('Tabella1', array(EXPORT_SXW_DATE . '/' . EXPORT_SXW_TIME, EXPORT_SXW_OPER, EXPORT_SXW_IMP, EXPORT_SXW_PRAT), make_bold($oo_def_c)); } $where = implode(' AND ', $wh); $TIPI = array(1 => 'AVVR', 2 => 'CLIE', 3 => 'COLL', 4 => 'CONS', 5 => 'CORR', 6 => 'FORN'); // operator list $j = $DB->Execute("SELECT id,codice,nome FROM users"); while ($k = $j->FetchRow()) { $OPER[$k[id]] = array($k[codice], $k[nome]); } $q = $DB->Execute("SELECT calendar.*,\r\n\t\t\t\t\t\t\t pratiche.pr_codice,pratiche.pr_numero,pratiche.pr_oggetto, \r\n\t\t\t\t\t\t\t pratiche.pr_comp_cod,pratiche.pr_comp_desc,pratiche.pr_giudice,\r\n\t\t\t\t\t\t\t pratiche.pr_nruolo,pratiche.pr_nprovv \r\n FROM calendar \r\n LEFT JOIN pratiche on ref_prat = pratiche.id\r\n WHERE {$where}\r\n ORDER BY day asc, pratiche.pr_codice asc"); $prev_day = ''; $totrows = $q->RecordCount();
} if ($descr) { $wh[] = "(nome LIKE " . $DB->Quote("%{$descr}%") . ")"; } if (count($wh) > 0) { $PAGE_STYLE[width] = 21; $PAGE_STYLE[height] = 29.7; // gruppi $q = $DB->Execute("SELECT * FROM gruppi,group_user WHERE groupid=id"); while ($l = $q->FetchRow()) { $GRP[$l[userid]][] = $l[name]; } utf8_encode_array($GRP); //intestazione: info cliente // create table new_table(get_default_table('Tabella1', array(3, 14, 4))); add_table_header('Tabella1', array(EXPORT_SXW_COD, EXPORT_SXW_DESCR, EXPORT_SXW_TAR), make_bold($oo_def_c)); $where = implode(' AND ', $wh); $q = $DB->Execute(" SELECT * \r\n FROM users \r\n WHERE {$where}\r\n ORDER BY codice ASC"); while ($l = $q->FetchRow()) { utf8_encode_array($l); if ($l[tat_imp_molt] == '') { $l[tat_imp_molt] = ' '; } if ($l[tat_nonimp_molt] == '') { $l[tat_nonimp_molt] = ' '; } // gruppi $gpr = ''; if (is_array($GRP[$l[id]])) { $gpr = "\n" . EXPORT_SXW_GROUPS . ": ";
$cliente = $k->FetchRow(); utf8_encode_array($cliente); $int_font = $oo_def; $int_font[ml] = 15; $int_font[mr] = 2; $int_font[name] = 'Arial12int'; $OO_TEXT .= print_text("\n\n" . EXPORT_SXW_DEST . ":\n\n" . "{$cliente['nome']}\n" . "{$cliente['indirizzo']}\n" . "{$cliente['cap']} {$cliente['citta']}\n", $int_font); } // operator list $j = $DB->Execute("SELECT id,codice FROM users"); while ($k = $j->FetchRow()) { $OPER[$k[id]] = $k[codice]; } utf8_encode_array($OPER); // create table new_table(get_default_table('Tabella1', array(2.5, 5, 2, 3, 1.5, 7))); add_table_header('Tabella1', array(EXPORT_SXW_DATE, EXPORT_SXW_DESCR, EXPORT_SXW_OPER, EXPORT_SXW_NFILE, EXPORT_SXW_VER, EXPORT_SXW_PRAT), make_bold($oo_def_c)); $where = implode(' AND ', $wh); $q = $DB->Execute(" SELECT D.*,P.pr_codice,P.pr_oggetto\r\n FROM document D,pratiche P \r\n WHERE {$where} AND ref_id = 0\r\n ORDER BY ref_prat ASC, id ASC"); while ($k = $q->FetchRow()) { $q2 = $DB->Execute(" SELECT D.*,P.pr_codice,P.pr_oggetto\r\n \t \tFROM document D,pratiche P \r\n \t WHERE P.id = D.ref_prat \r\n\t\t\t\t\t\t\t\t\tAND ref_id='{$k['id']}' \r\n\t\t\t\t\t\t\t\t\tAND ref_prat='{$k['ref_prat']}' \r\n \t ORDER BY D.version DESC\r\n\t\t\t\t\t\t\t\tLIMIT 1"); if ($q2->RecordCount() > 0) { $l = $q2->FetchRow(); // ci sono altre versioni } else { $l = $k; } // non ci sono altre versioni utf8_encode_array($l); list($yy, $mm, $dd) = explode('-', $l[date]); $weekday = date('w', mktime(7, 0, 0, $mm, $dd, $yy));