function display_html() { $r = ""; $array = $this->load(); $odd = 0; if (is_array($array) == false) { return $array; } $old = ""; $tot_deb = 0; $tot_cred = 0; foreach ($array as $row) { $odd++; $r .= $odd % 2 == 0 ? '<tr class="odd">' : '<tr class="even">'; if ($old == $row['a_po_name']) { $r .= '<td></td>'; } else { if ($tot_deb != 0 || $tot_cred != 0) { $r .= "<tr>" . td(''); $r .= "<td>Total </td>" . td(nbm($tot_deb), ' class="num"') . td(nbm($tot_cred), ' class="num"'); $s = abs($tot_deb - $tot_cred); $d = $tot_deb > $tot_cred ? 'debit' : 'credit'; $r .= "<td class=\"num\">" . nbm($s) . "</td><td>{$d}</td>"; $r .= "</tr>"; } $tot_deb = 0; $tot_cred = 0; // new $r .= "</table>"; $r .= "<table class=\"result\" style=\"margin-bottom:3px\">"; $r .= "<tr>"; $r .= "<th style=\"width:30%\" >Poste comptable Analytique</th>"; $r .= "<th style=\"width:30%\">Poste comptable Analytique</th>"; $r .= "<th style=\"text-align:right\">Débit</th>"; $r .= "<th style=\"text-align:right\">Crédit</th>"; $r .= "<th style=\"text-align:right\">Solde</th>"; $r .= "<th>D/C</th>"; $r .= "</tr>"; $r .= '<tr>'; $r .= td($row['a_po_name'] . ' ' . $row['a_po_description']); $old = $row['a_po_name']; $r .= '</tr>'; $r .= '<tr>'; $r .= td(''); } $tot_deb += $row['a_d']; $tot_cred += $row['a_c']; $r .= td($row['b_po_name'] . " " . $row['b_po_description']); $r .= td(nbm($row['a_d']), ' class="num"'); $r .= td(nbm($row['a_c']), ' class="num"'); $r .= td(nbm($row['a_solde']), ' class="num"'); $r .= sprintf("<td>%s</td>", $row['a_debit']); $r .= "</tr>"; } /* end loop */ if ($tot_deb != 0 || $tot_cred != 0) { $r .= "<tr>" . td(''); $r .= "<td>Total </td> <td ' class=\"num\"> " . nbm($tot_deb) . " </td> <td ' class=\"num\">" . nbm($tot_cred) . "</td>"; $s = abs($tot_deb - $tot_cred); $d = $tot_deb > $tot_cred ? 'debit' : 'credit'; $r .= td(nbm($s), ' class="num"') . "<td>{$d}</td>"; $r .= "</tr>"; } $r .= "</table>"; $r .= h2info('Résumé'); $r .= '<table class="result">'; $r .= '<tr>'; $r .= th('Po') . th('Nom') . th('Débit', ' style="text-align:right"') . th('Crédit', 'style="text-align:right" ') . th('Solde', ' style="text-align:right"'); $sum = $this->show_sum($array); $tot_cred = 0; $tot_deb = 0; foreach ($sum as $row) { $r .= '<tr>'; $r .= '<td>' . $row['poste'] . '</td>'; $r .= '<td>' . $row['desc'] . '</td>'; $r .= '<td class="num">' . nbm($row['debit']) . '</td>'; $r .= '<td class="num">' . nbm($row['credit']) . '</td>'; $diff = bcsub($row['debit'], $row['credit']); $tot_cred = bcadd($tot_cred, $row['credit']); $tot_deb = bcadd($tot_deb, $row['debit']); $r .= td(nbm($diff), ' class="num" '); $r .= '<td>' . $row['dc'] . '</td>'; $r .= '</tr>'; } $r .= td(''); $r .= td('total'); $r .= td(nbm($tot_deb), 'class="num"'); $r .= td(nbm($tot_cred), 'class="num"'); $solde = bcsub($tot_deb, $tot_cred); $sign = $tot_cred < $tot_deb ? " - " : " + "; $r .= td($sign . nbm($solde), 'class="num" style="border:solid 1px blue;font-weight:bold"'); $r .= '</tr>'; $r .= '</table>'; return $r; }
echo $supl_hidden; echo HtmlInput::hidden('ac', $_REQUEST['ac']); echo dossier::hidden(); echo $act->Display('UPD', false, $base, $retour); echo '<input type="hidden" name="sa" value="update">'; echo '<input type="hidden" id="delete" name="delete" value="0">'; echo HtmlInput::submit("save", "Sauve", ' onclick="$(\'delete\').value=0"'); echo HtmlInput::submit("add_action_here", _("Ajoute un événement à celui-ci"), ' onclick="$(\'delete\').value=0"'); echo HtmlInput::submit("delete_bt", _("Efface cet événement "), ' onclick="$(\'delete\').value=1;return confirm_box(\'action_common_frm\',\'' . _("Vous confirmez l\\'effacement") . '\')" '); echo $retour; echo '</form>'; } else { if ($g_user->can_read_action($ag_id) == true || $act->ag_dest == -1) { echo $act->Display('READ', false, $base, $retour); } else { echo h2info(_("Ce document n'est pas accessible")); return; } } echo '</div>'; } //------------------------------------------------------------------------------- // Delete an action if ($sub_action == 'delete') { // confirmed $cn->start(); $act = new Follow_Up($cn); $act->ag_id = $_REQUEST['ag_id']; $act->get(); if ($g_user->can_write_action($_REQUEST['ag_id']) == true) { $act->remove();
/** * show the module * @global $g_user * @param $module the $_REQUEST['ac'] exploded into an array * @param $idx the index of the array : the AD code is splitted into an array thanks the slash */ function show_menu($module) { if ($module == 0) { return; } static $level = 0; global $g_user; $cn = Dossier::connect(); /** * Show the submenus */ $amenu = $cn->get_array("\n select \n pm_id,\n me_code,\n pm_id_dep,\n me_file,\n me_javascript,\n me_url,\n me_menu,\n me_description,\n me_description_etendue\n from profile_menu \n join menu_ref using (me_code) \n where pm_id_dep=\$1 and p_id=\$2\n\t order by p_order", array($module, $g_user->get_profile())); // There are submenuS, so show them if (!empty($amenu) && count($amenu) > 1) { $a_style_menu = array('topmenu', 'menu2', 'menu3'); if ($level > count($a_style_menu)) { $style_menu = 'menu3'; } else { $style_menu = $a_style_menu[$level]; } require 'template/menu.php'; } elseif (count($amenu) == 1) { if (trim($amenu[0]['me_url']) != "" || trim($amenu[0]['me_file']) != "" || trim($amenu[0]['me_javascript']) != "") { echo '<div class="topmenu">'; echo h2info(_($amenu[0]['me_menu'])); echo '</div>'; $module = $amenu[0]['pm_id']; } else { $url = $_REQUEST['ac'] . '/' . $amenu[0]['me_code']; echo '<a href="do.php?gDossier=' . Dossier::id() . '&ac=' . $url . '">'; echo _($amenu[0]['me_menu']); echo '</a>'; $level++; return; } } // There is no submenu or only one if (empty($amenu) || count($amenu) == 1) { $file = $cn->get_array("select me_file,me_parameter,me_javascript,me_type\n\t\tfrom menu_ref\n\t\tjoin profile_menu using (me_code)\n\t\tjoin profile_user using (p_id)\n\t\twhere\n\t\tpm_id=\$1 and\n\t\tuser_name=\$2 and\n\t\t(me_file is not null or trim(me_file) <>'' or\n\t\tme_javascript is not null or trim (me_javascript) <> '')", array($module, $g_user->login)); if (count($file) == 0) { return; } if ($file[0]['me_file'] != "") { if ($file[0]['me_parameter'] !== "") { // if there are paramter put them in superglobal $array = compute_variable($file[0]['me_parameter']); put_global($array); } if (DEBUG) { echo $file[0]['me_file'], " param : ", $file[0]['me_parameter']; } /* * Log the file we input to put in the folder test-noalyss for replaying it */ if (LOGINPUT) { $file_loginput = fopen($_ENV['TMP'] . '/scenario-' . $_SERVER['REQUEST_TIME'] . '.php', 'a+'); fwrite($file_loginput, "include '" . $file[0]['me_file'] . "';"); fwrite($file_loginput, "\n"); fclose($file_loginput); } // if file is not a plugin, include the file, otherwise // include the plugin launcher if ($file[0]['me_type'] != 'PL') { require_once $file[0]['me_file']; } else { require 'extension_get.inc.php'; } exit; } if ($file[0]['me_javascript'] != '') { $js = str_replace('<DOSSIER>', dossier::id(), $file[0]['me_javascript']); echo create_script($js); } } $level++; }
/** * Unit test for the class */ static function test_me() { $cn = new Database(25); $cn->start(); echo h2info('Test object vide'); $obj = new Fiche_Attr($cn); var_dump($obj); echo h2info('Test object NON vide'); $obj->set_parameter('j_id', 3); $obj->load(); var_dump($obj); echo h2info('Update'); $obj->set_parameter('j_qcode', 'NOUVEAU CODE'); $obj->save(); $obj->load(); var_dump($obj); echo h2info('Insert'); $obj->set_parameter('j_id', 0); $obj->save(); $obj->load(); var_dump($obj); echo h2info('Delete'); $obj->delete(); echo $obj->load() == 0 ? 'Trouve' : 'non trouve'; var_dump($obj); $cn->rollback(); }
$r .= HtmlInput::hidden($i, ${$i}); $sql_array[$i] = ${$i}; } } /* what is the type of the ledger */ $type = "GL"; if (isset($jrn) && $jrn > 1) { $ledger = new Acc_Ledger($cn, $jrn); $type = $ledger->get_type(); } $fiche = new Fiche($cn); /* Build the SQL and show result */ $sql = $fiche->build_sql($sql_array); if (strpos($sql, " in ()") != 0) { $html = HtmlInput::anchor_close('search_card'); $html .= '<div> ' . h2info(_('Recherche de fiche')) . '</div>'; $html .= '<h3 class="notice">'; $html .= _("Aucune catégorie de fiche ne correspond à" . " votre demande, le journal pourrait n'avoir accès à aucune fiche"); $html .= '</h3>'; break; } /* We limit the search to MAX_SEARCH_CARD records */ $sql = $sql . ' order by vw_name limit ' . MAX_SEARCH_CARD; $a = $cn->get_array($sql); for ($i = 0; $i < count($a); $i++) { $array[$i]['quick_code'] = $a[$i]['quick_code']; $array[$i]['name'] = h($a[$i]['vw_name']); $array[$i]['accounting'] = $a[$i]['accounting']; $array[$i]['first_name'] = h($a[$i]['vw_first_name']); $array[$i]['description'] = h($a[$i]['vw_description']); $array[$i]['javascript'] = sprintf("set_value('%s','%s');", $inp, $array[$i]['quick_code']);
$html = ''; /* we check the security */ switch ($op) { case 'input_per': $per = new Periode($cn, $_GET['p_id']); $per->load(); $limit = $per->get_date_limit($_GET['p_id']); $p_start = new IDate('p_start'); $p_start->value = $limit['p_start']; $p_end = new IDate('p_end'); $p_end->value = $limit['p_end']; $p_exercice = new INum('p_exercice'); $p_exercice->value = $per->p_exercice; $html = ''; $html .= HtmlInput::anchor_close('mod_periode'); $html .= h2info(_('Modification période')); $html .= '<p> ' . _('Modifier les dates de début et fin de période') . '</p>'; $html .= '<p class="notice">' . _('Cela pourrait avoir un impact sur les opérations déjà existantes') . '</p>'; $html .= '<form method="post" onsubmit="return save_periode(this)">'; $html .= dossier::hidden(); $html .= '<table>'; $html .= tr(td(_(' Début période : ')) . td($p_start->input())); $html .= tr(td(_(' Fin période : ')) . td($p_end->input())); $html .= tr(td(_(' Exercice : ')) . td($p_exercice->input())); $html .= '</table>'; $html .= HtmlInput::submit('sauver', _('sauver')); $html .= HtmlInput::button('close', _('fermer'), 'onclick="removeDiv(\'mod_periode\')"'); $html .= HtmlInput::hidden('p_id', $_GET['p_id']); $html .= '</form>'; break; case 'save_per':
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ // Copyright Author Dany De Bontridder dany@alchimerys.be /** * @file * @brief Inventory : add manuel change * */ if (!defined('ALLOWED')) { die('Appel direct ne sont pas permis'); } require_once NOALYSS_INCLUDE . '/class_stock_goods.php'; require_once NOALYSS_INCLUDE . '/class_stock.php'; global $cn; $inv = new Stock_Goods($cn); $array = array(); if (isset($_POST['save'])) { try { $inv->record_save($_POST); echo h2info(_("Opération sauvée")); $inv->input($_POST, true); } catch (Exception $e) { alert($e->getMessage()); $array = input($_POST); } } else { if (isset($_GET['reprise_frm'])) { $array = $inv->take_last_inventory($_GET); } } echo $inv->input($array);