function listComplaints() { global $db, $cust_id, $response, $ajaxmode; $where = $_SESSION['access_level'] == 1 ? " where c.id = {$cust_id}" : ''; $query = <<<Q SELECT concat(c.first_name, ' ', c.last_name) as fullname, c.id as cid, cc.id as id, cc.status as status, cc.time as time, cc.title as title, cc.details as details FROM `customer_complaints`as cc inner join `customers` as c on c.id = cc.customer_id {$where} order by cc.time desc; Q; $db->runQuery($query); $list = array(); $curr = new stdClass(); while ($row = $db->result->fetch_object()) { $curr->id = 'complaint-' . $row->id; $curr->stat = $row->status == 1 ? 'open' : 'closed'; $curr->info = '<div class="header"><h4>' . $row->title . '</h4>'; $cust = $_SESSION['access_level'] == 4 ? '| by <a href="profile.php?domain=customers&id=' . $row->cid . '">' . $row->fullname . '</a>' : ''; $curr->info .= '<small>' . mysql_to_date($row->time) . $cust . '</small></div>'; $curr->info .= '<p>' . $row->details . '</p>'; if ($_SESSION['access_level'] == 4) { $axn = $row->status == 1 ? 'Close Complaint' : 'Re-open Complaint'; $curr->ctrl = '<p><a href="#" class="update" rel="' . $row->id . '">' . $axn . '</a></p>'; } else { $curr->ctrl = ''; } $list[] = $curr; unset($curr); } if ($ajaxmode) { echo json_encode($list); exit; } $response->History = $list; }
// 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) { add_table_row('Tabella1', array("NOTE: " . $l[note]), $oo_ar10); } } // create content $OO_PAGE_STYLE = set_page_style($PAGE_STYLE); $OO_PAGE_HEADER = set_page_header("#DATA#\t\t\t\tELENCO PRATICHE\t\tPag.: #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);
<?php require 'includes/_.php'; check_auth(); $_SESSION['view'] = 'Home'; get_header(); ?> <h1>Welcome, <?php echo $_SESSION['full_name']; ?> </h1> <p>Activity since <?php echo mysql_to_date($_SESSION['last_access']); ?> </p> <ul id="activity-list"> <?php if ($_SESSION['access_level'] == 3) { ?> <li><a href="viewEditLead.php?status=Open"><span class="count delta"> <?php $employeeID = $_SESSION['user_id']; $db->runQuery("select count(*) as count from customer_leads CL,leads L where CL.employee_id={$employeeID} and L.status='Open' and CL.lead_id = L.id;"); $rows = $db->result->fetch_assoc(); echo $rows['count']; ?> </span> Open Leads</a></li> <li><a href="viewEditLead.php?status=Closed"><span class="count delta"> <?php $employeeID = $_SESSION['user_id'];
$tot_imp += $l['spese_imponibili']; $tot_nimp += $l['spese_non_imponibili']; $spese_sost = $l['spese_imponibili'] + $l['spese_non_imponibili']; $tot_spe += $spese_sost; $tot_dir += $l['diritti']; $ono_field = $l['onorari']; 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));
$curtab = $tab1; while ($l = $q->FetchRow()) { utf8_encode_array($l); if ($l[day] != $prev_day && in_array(3, $_GET[print_note])) { if ($prev_day != '') { $OO_TEXT .= render_table($curtab[name]); } $curtab = $prev_day == '' ? $tab1 : $tab2; new_table($curtab); add_table_header($curtab[name], array(EXPORT_SXW_DATE . '/' . EXPORT_SXW_TIME, EXPORT_SXW_OPER, EXPORT_SXW_IMP, EXPORT_SXW_PRAT), make_bold($oo_def_c)); $prev_day = $l[day]; } list($yy, $mm, $dd) = explode('-', $l[day]); $weekday = date('w', mktime(7, 0, 0, $mm, $dd, $yy)); $weekday = $daylist[$weekday]; $l[day] = mysql_to_date($l[day]); $l[time] = mysql_to_time($l[time]); if ($l[time] == '00:00') { $l[time] = ''; } $opers = ''; $ops = explode(',,', trim($l[operator])); $op2 = array(); foreach ($ops as $o) { $op2[] = $OPER[$o][0]; $used_operators[$o] = 1; } $opers = count($op2) ? implode(' - ', $op2) : ''; $f1 = $rapida ? "{$l['day']}\n{$weekday}" : "{$l['day']}\n{$l['time']}\n{$weekday}"; $f2 = "{$opers}\n"; $f3 = "{$l['title']}\n";
$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]; $opers = ''; $ops = explode(',,', trim($l[operator])); foreach ($ops as $o) { $opers .= $OPER[$o]; } add_table_row('Tabella1', array(mysql_to_date($l[data]) . "\n" . $weekday, $l[descr], $opers, $l['filename'], $l['version'], $l['pr_codice'] . "\n" . $l['pr_oggetto']), array($oo_def_e, $oo_def, $oo_def, $oo_def_c, $oo_def_c, $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 $OO_PAGE_STYLE = set_page_style($PAGE_STYLE); $OO_PAGE_HEADER = set_page_header("#DATA#\t\t\t\t" . EXPORT_SXW_TIT_DOC . "\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);