$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 ($l[note] && in_array(1, $P[print_note]) && !$rapida) {
$fw = fopen($f, 'w'); fwrite($fw, $content); fclose($fw); } ///////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////// // note: "name" must be unique! $ver_12 = array(name => 'Verdana12', face => 'Verdana', size => '12pt', b => 0); $ver_12_b = array(name => 'Verdana12b', face => 'Verdana', size => '12pt', b => 1); $ar_20_b_u = array(name => 'Arial20bu', face => 'Arial', size => '20pt', b => 0, u => 1, i => 1, align => 'center'); $ver_12_b_end = array(name => 'Verdana12be', face => 'Times New Roman', size => '40pt', b => 1, align => 'end'); // note: "name" must be unique! $tab = array(name => 'Tabella1', width => '18.00', cols => 3, border => '0.002cm solid #000000', padding => '0.5', bg_header => '#dddddd', bg_rows => '#ffffff', col_width => array(10.0, 2.0, 4.0)); new_table($tab); add_table_header('Tabella1', array('nome', 'cognome', 'indirizzo'), $ver_12, false); add_table_row('Tabella1', array('valerio', 'morettini', 'via pratesi'), $ver_12); add_table_row('Tabella1', array('mario', 'rossi', 'via rossi d fsd fsd fds fd sfsd fsdf'), $ver_12_b); add_table_row('Tabella1', array('mar2io', 'ross2i', 'via ross2i'), $ar_20_b_u); add_table_row('Tabella1', array('valerio', 'morettini', 'via pratesi'), $ver_12); add_table_row('Tabella1', array('mario'), $ver_12_b); add_table_row('Tabella1', array('mar2io', 'ross2i', 'via ross2i'), $ar_20_b_u); add_table_row('Tabella1', array('valerio', 'm', 'via pratesi'), $ver_12); add_table_row('Tabella1', array('mario', 'rossi', 'via rossi d fsd fsd fds fd sfsd fsdf'), $ver_12_b); add_table_row('Tabella1', array('mar2io', 'ross2i', 'via ross2i'), $ar_20_b_u); add_table_row('Tabella1', array('valerio', 'morettini', 'via pratesi'), $ver_12); add_table_row('Tabella1', array('mario', 'rossi', 'via rossi d fsd fsd fds fd sfsd fsdf'), $ver_12_b); add_table_row('Tabella1', array('mar2io', 'ross2i', 'via ross2i'), $ar_20_b_u); // create content $OO_PAGE_STYLE = set_page_style($PAGE_STYLE); $OO_PAGE_HEADER = set_page_header('Pagina #PAGINA# di #PAGINE#');
$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); } } // create content
$o = $DB->Execute("SELECT * FROM INT_valute WHERE id='{$currency}'"); $CUR = $o->FetchRow(); utf8_encode_array($CUR); $n_dec = $CUR['va_sep_decimali']; $n_tho = $CUR['va_sep_migliaia']; $n_cod = $CUR['va_cod']; $n_name = $CUR['va_nome']; $n_val = $CUR['va_val']; } $int2_font = $oo_def; $int2_font[ml] = 1; $int2_font[name] = 'Arial12int2'; $OO_TEXT .= print_text("\n\n" . $oggetto . "\n\n\n" . EXPORT_DICIT1 . ": " . $dicit1 . " {$nome_pratica}\n" . EXPORT_DICIT2 . ": " . $dicit2 . "\n\n" . ($currency > 0 ? EXPORT_SXW_VALUTA . ": {$n_cod} ({$n_name})\n\n" : "\n"), $int2_font); // create table new_table(get_default_table('Tabella1', array(3, 9.5, 2.5, 2.5, 2.5), 0)); add_table_header('Tabella1', array(EXPORT_SXW_DATE, EXPORT_SXW_PRESTAZ, EXPORT_SXW_SPSOST, EXPORT_COST_RIGHTS, EXPORT_COST_ONOR), array($oo_def_c, $oo_def, $oo_def_e, $oo_def_e, $oo_def_e)); $where = implode(' AND ', $wh); // operatori $op = $DB->Execute("SELECT id,codice FROM users"); while ($k = $op->FetchRow()) { $OP[$k[id]] = $k[codice]; } utf8_encode_array($OP); // aggiorna note e fatture if (($tipo_stampa == 'N' || $tipo_stampa == 'F') && strlen($rif_print2)) { $field = $tipo_stampa == 'N' ? 'nota1' : 'fattura1'; $DB->Execute("\tUPDATE prestazioni \r\n\t\t\t\t\t\t\tSET {$field} = " . $DB->Quote($rif_print2) . "\r\n\t\t\t\t\t\t\tWHERE {$where}"); } $q = $DB->Execute(" SELECT prestazioni.*,\r\n\t\t\t\t\t\t\t\tpr_criterio,pr_valore,pr_codice,pr_numero,pr_comp_cod\r\n FROM prestazioni,pratiche\r\n WHERE (pratiche.id = prestazioni.ref_id) AND {$where}\r\n ORDER BY ref_id ASC, data ASC"); // ricalcola le prestazioni nel database if ($ricalcolo && $ricalc_save && $prevalenza == 1) {
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#"); $OO_PAGE_FOOTER = '';
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); $OO_PAGE_HEADER = set_page_header("#DATA#\t\t\t\t" . EXPORT_SXW_TIT_TAR . "\t\t\t" . EXPORT_SXW_TIT_PG . ": #PAGINA#");
if ($righe_ann > 0 && !$rapida) { $txt = ''; for ($i = 1; $i < $righe_ann; $i++) { $txt .= "\n"; } add_table_row($curtab[name], array($txt), $oo_def); } $cur_row++; } //render last table if (in_array(3, $_GET[print_note])) { $OO_TEXT .= render_table($curtab[name]); } //operators new_table($tab3); add_table_header('Tabella3', array(EXPORT_CODE, EXPORT_USER), make_bold($oo_def_c)); foreach ($used_operators as $k => $v) { add_table_row('Tabella3', array($OPER[$k][0], $OPER[$k][1]), array($oo_def_c, $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_SCA . "\t\t" . EXPORT_SXW_TIT_PG . ": #PAGINA#"); $OO_PAGE_FOOTER = ''; // set_page_footer('#DATA# #ORA#'); $header_style = array(color => '#000000', size => '12pt', align => 'start', face => 'Verdana'); //$footer_style = array(color => '#ffff00', size => '12pt', align => 'end', face => 'Verdana'); $OO_HEADER_STYLE = set_header_style($header_style); $OO_FOOTER_STYLE = ''; // set_footer_style($footer_style); $OO_TABLE_STYLES = gen_table_style(); if (!in_array(3, $_GET[print_note])) {
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)); $weekday = $daylist[$weekday];