/** *@brief print the pdf *@param *@param *@return *@see */ function export() { $a_jrn = $this->ledger->get_rowSimple($_GET['from_periode'], $_GET['to_periode']); $this->SetFont('DejaVu', '', 6); if ($a_jrn == null) { return; } for ($i = 0; $i < count($a_jrn); $i++) { $row = $a_jrn[$i]; $this->LongLine(30, 5, $row['jr_pj_number']); $this->Cell(10, 5, smaller_date($row['date'])); $this->Cell(20, 5, $row['jr_internal']); $type = $this->cn->get_value("select jrn_def_type from jrn_def where jrn_def_id=\$1", array($a_jrn[$i]['jr_def_id'])); $other = mb_substr($this->ledger->get_tiers($type, $a_jrn[$i]['jr_id']), 0, 25); $this->LongLine(25, 5, $other, 0, 'L'); $positive = $row['montant']; $this->LongLine(80, 5, $row['comment'], 0, 'L'); if ($type == 'FIN') { $positive = $this->cn->get_value("select qf_amount from quant_fin " . " where jr_id=" . $row['jr_id']); } $this->Cell(15, 5, nbm($positive), 0, 0, 'R'); $this->Ln(5); } }
$check->selected = false; } if ($this->content[$i]['letter'] < 0 || $check->selected == true) { echo $check->input(); } echo HtmlInput::hidden('letter_j_id[]', $this->content[$i]['j_id']); ?> </td> <td> <?php $letter = $this->content[$i]['letter'] < 0 ? " " : strtoupper(base_convert($this->content[$i]['letter'], 10, 36)); echo $letter; ?> </td> <td> <?php echo smaller_date($this->content[$i]['j_date_fmt']); ?> </td> <?php $r = sprintf('<A class="detail" style="text-decoration:underline" HREF="javascript:viewOperation(\'%s\',\'%s\')" >%s</A>', $this->content[$i]['jr_id'], $gDossier, $this->content[$i]['jr_internal']); ?> <td> <?php echo $r; ?> </td> <td> <?php echo $this->content[$i]['jr_comment']; ?> </td> <?php if ($this->content[$i]['j_debit'] == 't') {
require_once NOALYSS_INCLUDE . '/class_follow_up.php'; $gestion = new Follow_Up($cn); $array = $gestion->get_last(MAX_ACTION_SHOW); $len_array = count($array); ?> <table style="width: 100%"> <?php for ($i = 0; $i < $len_array; $i++) { ?> <tr class=" <?php echo $i % 2 == 0 ? 'even' : 'odd'; ?> "> <td class="box"> <?php echo smaller_date($array[$i]['ag_timestamp_fmt']); ?> </td> <td class="box"> <?php echo HtmlInput::detail_action($array[$i]['ag_id'], $array[$i]['ag_ref'], 1); ?> </td> <td class="box"> <?php echo mb_substr(h($array[$i]['quick_code']), 0, 15); ?> </td> <td class="box cut"> <?php echo h($array[$i]['ag_title']);
/** * @brief Display a box with the contains * @param type $p_array Data to display * @param type $p_title Title of the box * @param type $p_div id of the box */ function display_dashboard_operation($p_array, $p_title, $p_div) { ?> <div id="<?php echo $p_div; ?> " class="inner_box" style="display:none;position:fixed;top:250px;left:12%;width: 75%;min-height:50%;overflow:auto;"> <?php echo HtmlInput::title_box($p_title, $p_div, "hide"); ?> <?php if (count($p_array) > 0) { ?> <table class="result"> <tr> <th><?php echo _('Date'); ?> </th> <th><?php echo _('Code Interne'); ?> </th> <th><?php echo _('Pièce'); ?> </th> <th><?php echo _('Description'); ?> </th> <th> <?php echo _('Montant'); ?> </th> </tr> <?php for ($i = 0; $i < count($p_array); $i++) { ?> <tr class="<?php echo $i % 2 == 0 ? 'odd' : 'even'; ?> "> <td> <?php echo smaller_date(format_date($p_array[$i]['jr_date'])); ?> </td> <td> <?php echo HtmlInput::detail_op($p_array[$i]['jr_id'], $p_array[$i]['jr_internal']); ?> </td> <td> <?php echo h($p_array[$i]['jr_pj_number']); ?> </td> <td> <?php echo h($p_array[$i]['jr_comment']); ?> </td> <td> <?php echo nbm($p_array[$i]['jr_montant']); ?> </td> </tr> <?php } ?> </table> <?php } else { ?> <h2 class="notice"><?php echo _('Aucune donnée'); ?> </h2> <?php } ?> </div> <?php }
$tot['dna'] = 0; $tot['tva_nd'] = 0; $tot['tvac'] = 0; $tot['tva'] = array(); bcscale(2); foreach ($Row as $line) { $i++; /* * Get date of reconcile operation */ $ret_reconcile = $cn->execute('reconcile_date', array($line['jr_id'])); $class = $i % 2 == 0 ? ' class="even" ' : ' class="odd" '; echo "<tr {$class}>"; echo "<TD>" . h($line['jr_pj_number']) . "</TD>"; echo "<TD>" . smaller_date($line['date']) . "</TD>"; echo "<TD>" . smaller_date($line['date_paid']) . "</TD>"; echo "<TD>" . HtmlInput::detail_op($line['jr_id'], $line['jr_internal']) . "</TD>"; $tiers = $Jrn->get_tiers($line['jrn_def_type'], $line['jr_id']); echo td($tiers); echo "<TD>" . h($line['comment']) . "</TD>"; $dep_priv = $line['dep_priv'] == 0 ? "" : nbm($line['dep_priv']); $tot['dep_priv'] = bcadd($tot['dep_priv'], floatval($line['dep_priv'])); $dna = $line['dna'] == 0 ? "" : nbm($line['dna']); $tot['dna'] = bcadd($tot['dna'], floatval($line['dna'])); echo "<TD class=\"num\">" . nbm($line['HTVA']) . "</TD>"; $tot['htva'] = bcadd($tot['htva'], floatval($line['HTVA'])); echo "<TD class=\"num\">" . $dep_priv . "</TD>"; echo "<TD class=\"num\">" . $dna . "</TD>"; if ($own->MY_TVA_USE == 'Y') { $tva_dna = $line['tva_dna'] == 0 ? "" : nbm($line['tva_dna']); $tot['tva_nd'] = bcadd($tot['tva_nd'], floatval($line['tva_dna']));
function HtmlTable($p_array = null, $op_let = 0, $from_div = 1) { if ($p_array == null) { $p_array = $_REQUEST; } $progress = 0; // if from_periode is greater than to periode then swap the values if (cmpDate($p_array['from_periode'], $p_array['to_periode']) > 0) { $tmp = $p_array['from_periode']; $p_array['from_periode'] = $p_array['to_periode']; $p_array['to_periode'] = $tmp; } list($array, $tot_deb, $tot_cred) = $this->get_row_date($p_array['from_periode'], $p_array['to_periode'], $op_let); if (count($this->row) == 0) { return -1; } $rep = ""; if ($from_div == 1) { echo "<TABLE class=\"resultfooter\" style=\"margin:1%;width:98%;;border-collapse:separate;border-spacing:0px 5px\">"; } else { echo "<TABLE id=\"tb" . $from_div . "\"class=\"result\" style=\"margin:1%;width:98%;border-collapse:separate;border-spacing:0px 2px\">"; } echo '<tbody>'; echo "<TR>" . "<TH style=\"text-align:left\">" . _('Date') . "</TH>" . "<TH style=\"text-align:left\">" . _('n° pièce') . " </TH>" . "<TH style=\"text-align:left\">" . _('Code interne') . " </TH>" . "<TH style=\"text-align:left\">" . _('Description') . " </TH>" . "<TH style=\"text-align:right\">" . _('Débit') . " </TH>" . "<TH style=\"text-align:right\">" . _('Crédit') . " </TH>" . th('Prog.', 'style="text-align:right"') . th('Let.', 'style="text-align:right"'); "</TR>"; $old_exercice = ""; $sum_deb = 0; $sum_cred = 0; bcscale(2); $idx = 0; foreach ($this->row as $op) { $vw_operation = sprintf('<A class="detail" style="text-decoration:underline;color:red" HREF="javascript:modifyOperation(\'%s\',\'%s\')" >%s</A>', $op['jr_id'], dossier::id(), $op['jr_internal']); $let = ''; $html_let = ""; if ($op['letter'] != -1) { $let = strtoupper(base_convert($op['letter'], 10, 36)); $html_let = HtmlInput::show_reconcile($from_div, $let); } $tmp_diff = bcsub($op['deb_montant'], $op['cred_montant']); /* * reset prog. balance to zero if we change of exercice */ if ($old_exercice != $op['p_exercice']) { if ($old_exercice != '') { $progress = bcsub($sum_deb, $sum_cred); $side = " " . $this->get_amount_side($progress); echo "<TR class=\"highlight\">" . "<TD>{$old_exercice}</TD>" . td('') . "<TD></TD>" . "<TD>Totaux</TD>" . "<TD style=\"text-align:right\">" . nbm($sum_deb) . "</TD>" . "<TD style=\"text-align:right\">" . nbm($sum_cred) . "</TD>" . td(nbm(abs($progress)) . $side, 'style="text-align:right"') . td('') . "</TR>"; $sum_cred = 0; $sum_deb = 0; $progress = 0; } } $progress = bcadd($progress, $tmp_diff); $side = " " . $this->get_amount_side($progress); $sum_cred = bcadd($sum_cred, $op['cred_montant']); $sum_deb = bcadd($sum_deb, $op['deb_montant']); if ($idx % 2 == 0) { $class = 'class="odd"'; } else { $class = ' class="even"'; } $idx++; echo "<TR {$class} name=\"tr_" . $let . "_" . $from_div . "\">" . "<TD>" . smaller_date(format_date($op['j_date_fmt'])) . "</TD>" . td(h($op['jr_pj_number'])) . "<TD>" . $vw_operation . "</TD>" . "<TD>" . h($op['description']) . "</TD>" . "<TD style=\"text-align:right\">" . nbm($op['deb_montant']) . "</TD>" . "<TD style=\"text-align:right\">" . nbm($op['cred_montant']) . "</TD>" . td(nbm(abs($progress)) . $side, 'style="text-align:right"') . td($html_let, ' style="text-align:right"') . "</TR>"; $old_exercice = $op['p_exercice']; } $solde_type = $sum_deb > $sum_cred ? "solde débiteur" : "solde créditeur"; $diff = abs(bcsub($sum_deb, $sum_cred)); echo '<tfoot>'; echo "<TR class=\"highlight\">" . "<TD>Totaux</TD>" . "<TD ></TD>" . "<TD ></TD>" . "<TD></TD>" . "<TD style=\"text-align:right\">" . nbm($sum_deb) . "</TD>" . "<TD style=\"text-align:right\">" . nbm($sum_cred) . "</TD>" . "<TD style=\"text-align:right\">" . nbm($diff) . "</TD>" . "</TR>"; echo "<TR style=\"font-weight:bold\">" . "<TD>{$solde_type}</TD>" . "<TD style=\"text-align:right\">" . nbm($diff) . "</TD>" . "<TD></TD>" . "</TR>"; echo '</tfoot>'; echo '</tbody>'; echo "</table>"; return 0; }
/** * myList($p_base, $p_filter = "", $p_search = "") * Show list of action by default if sorted on date * @param $p_base base url with ac... * @param $p_filter filters on the document_type * @param $p_search must a valid sql command ( ex 'and ag_title like upper('%hjkh%')) * @return string containing html code */ function myList($p_base, $p_filter = "", $p_search = "") { // for the sort $url = HtmlInput::get_to_string(array("closed_action", "remind_date_end", "remind_date", "sag_ref", "only_internal", "state", "qcode", "ag_dest_query", "action_query", "tdoc", "date_start", "date_end", "hsstate", "searchtag")) . '&' . $p_base; $table = new Sort_Table(); $table->add('Date Doc.', $url, 'order by ag_timestamp asc', 'order by ag_timestamp desc', 'da', 'dd'); $table->add('Date Comm.', $url, 'order by last_comment', 'order by last_comment desc', 'dca', 'dcd'); $table->add('Date Limite', $url, 'order by ag_remind_date asc', 'order by ag_remind_date desc', 'ra', 'rd'); $table->add('Tag', $url, 'order by tags asc', 'order by tags desc', 'taa', 'tad'); $table->add('Réf.', $url, 'order by ag_ref asc', 'order by ag_ref desc', 'ra', 'rd'); $table->add('Groupe', $url, "order by coalesce((select p_name from profile where p_id=ag_dest),'Aucun groupe')", "order by coalesce((select p_name from profile where p_id=ag_dest),'Aucun groupe') desc", 'dea', 'ded'); $table->add('Dest/Exp', $url, 'order by name asc', 'order by name desc', 'ea', 'ed'); $table->add('Titre', $url, 'order by ag_title asc', 'order by ag_title desc', 'ta', 'td'); $ord = !isset($_GET['ord']) ? "dcd" : $_GET['ord']; $sort = $table->get_sql_order($ord); if (strlen(trim($p_filter)) != 0) { $p_filter_doc = " dt_id in ( {$p_filter} )"; } else { $p_filter_doc = " 1=1 "; } $sql = "\n select ag_id,to_char(ag_timestamp,'DD.MM.YYYY') as my_date,\n to_char(ag_remind_date,'DD.MM.YYYY') as my_remind,\n to_char(coalesce((select max(agc_date) from action_gestion_comment as agc where agc.ag_id=ag.ag_id),ag_timestamp),'DD.MM.YY') as str_last_comment,\n coalesce((select max(agc_date) from action_gestion_comment as agc where agc.ag_id=ag.ag_id),ag_timestamp) as last_comment,\n f_id_dest,\n s_value,\n ag_title,dt_value,ag_ref, ag_priority,ag_state,\n coalesce((select p_name from profile where p_id=ag_dest),'Aucun groupe') as dest,\n (select ad_value from fiche_Detail where f_id=ag.f_id_dest and ad_id=1) as name,\n array_to_string((select array_agg(t1.t_tag) from action_tags as a1 join tags as t1 on (a1.t_id=t1.t_id) where a1.ag_id=ag.ag_id ),',') as tags\n from action_gestion as ag\n join document_type on (ag_type=dt_id)\n join document_state on (ag_state=s_id)\n where {$p_filter_doc} {$p_search} {$sort}"; $max_line = $this->db->count_sql($sql); $step = $_SESSION['g_pagesize']; $page = isset($_GET['offset']) ? $_GET['page'] : 1; $offset = isset($_GET['offset']) ? Database::escape_string($_GET['offset']) : 0; if ($step != -1) { $limit = " LIMIT {$step} OFFSET {$offset} "; } else { $limit = ''; } $bar = navigation_bar($offset, $max_line, $step, $page); $Res = $this->db->exec_sql($sql . $limit); $a_row = Database::fetch_all($Res); $r = ""; $r .= '<p>' . $bar . '</p>'; $r .= '<table class="document">'; $r .= "<tr>"; $r .= '<th name="ag_id_td" style="display:none" >' . ICheckBox::toggle_checkbox('ag', 'list_ag_frm') . '</th>'; $r .= '<th>' . $table->get_header(0) . '</th>'; $r .= '<th>' . $table->get_header(1) . '</th>'; $r .= '<th>' . $table->get_header(2) . '</th>'; $r .= '<th>' . $table->get_header(3) . '</th>'; $r .= '<th>' . $table->get_header(4) . '</th>'; $r .= '<th>' . $table->get_header(5) . '</th>'; $r .= '<th>' . $table->get_header(6) . '</th>'; $r .= '<th>' . $table->get_header(7) . '</th>'; $r .= th('Priorité'); $r .= "</tr>"; // if there are no records return a message if (sizeof($a_row) == 0 or $a_row == false) { $r = '<div style="clear:both">'; $r .= '<hr>Aucun enregistrement trouvé'; $r .= "</div>"; return $r; } $today = date('d.m.Y'); $i = 0; $checkbox = new ICheckBox("mag_id[]"); //show the sub_action foreach ($a_row as $row) { $href = '<A class="document" HREF="do.php?' . $p_base . HtmlInput::get_to_string(array("closed_action", "remind_date_end", "remind_date", "sag_ref", "only_internal", "state", "gDossier", "qcode", "ag_dest_query", "action_query", "tdoc", "date_start", "date_end", "hsstate", "searchtag", "ac"), "&") . '&sa=detail&ag_id=' . $row['ag_id'] . '">'; $i++; $tr = $i % 2 == 0 ? 'even' : 'odd'; if ($row['ag_priority'] < 2) { $tr = 'priority1'; } $st = ''; if ($row['my_date'] == $today) { $st = ' style="font-weight:bold; border:2px solid orange;"'; } $date_remind = format_date($row['my_remind'], 'DD.MM.YYYY', 'YYYYMMDD'); $date_today = date('Ymd'); if ($date_remind != "" && $date_remind == $date_today && $row['ag_state'] != 1 && $row['ag_state'] != 3) { $st = ' style="font-weight:bold;background:orange"'; } if ($date_remind != "" && $date_remind < $date_today && $row['ag_state'] != 1 && $row['ag_state'] != 3) { $st = ' style="font-weight:bold;background:#FF0000;color:white;"'; } $r .= "<tr class=\"{$tr}\" {$st}>"; $checkbox->value = $row['ag_id']; $r .= '<td name="ag_id_td" style="display:none">' . $checkbox->input() . '</td>'; $r .= "<td>" . $href . smaller_date($row['my_date']) . '</a>' . "</td>"; $r .= "<td>" . $href . $row['str_last_comment'] . '</a>' . "</td>"; $r .= "<td>" . $href . smaller_date($row['my_remind']) . '</a>' . "</td>"; $r .= "<td>" . $href . h($row['tags']) . '</a>' . "</td>"; $r .= "<td>" . $href . $row['ag_ref'] . '</a>' . "</td>"; $r .= "<td>" . $href . h($row['dest']) . '</a>' . "</td>"; // Expediteur $fexp = new Fiche($this->db); $fexp->id = $row['f_id_dest']; $qcode_dest = $fexp->strAttribut(ATTR_DEF_QUICKCODE); $qexp = $qcode_dest == NOTFOUND ? "Interne" : $qcode_dest; $jsexp = sprintf("javascript:showfiche('%s')", $qexp); if ($qexp != 'Interne') { $r .= "<td>{$href}" . $qexp . " : " . $fexp->getName() . '</a></td>'; } else { $r .= "<td>{$href} Interne </a></td>"; } $ref = ""; $r .= '<td>' . $href . h($row['ag_title']) . "</A></td>"; /* * State */ switch ($row['ag_priority']) { case 1: $priority = 'Haute'; break; case 2: $priority = "Moyenne"; break; case 3: $priority = "Important"; break; } $r .= td($priority); $r .= "<td>" . $ref . "</td>"; $r .= "</tr>"; } $r .= "</table>"; $r .= '<p>' . $bar . '</p>'; return $r; }