$p_post = null; if (isset($_REQUEST['pre_def']) && $_REQUEST['pre_def'] != '') { $op->set_od_id($_REQUEST['pre_def']); $p_post = $op->compute_array(); } } } $p_msg = isset($p_msg) ? $p_msg : ""; print '<p class="notice">' . $p_msg . '</p>'; echo '<form method="post" class="print">'; echo dossier::hidden(); echo HtmlInput::request_to_hidden(array('ac')); echo $ledger->input($p_post); echo '<div style="position:absolute;width:40%;right:20px">'; echo '<table class="info_op">' . '<tr>' . td(_('Débit')) . '<td id="totalDeb"></td>' . td(_('Crédit')) . ' <td id="totalCred"></td>' . td(_('Difference')) . ' <td id="totalDiff"></td>'; echo '</table>'; echo '</div>'; $iconcerned = new IConcerned('jrn_concerned'); $iconcerned->amount_id = "totalDeb"; echo "Opération rapprochée : " . $iconcerned->input(); echo '<p>'; echo HtmlInput::button('add', _('Ajout d\'une ligne'), 'onClick="quick_writing_add_row()"'); echo HtmlInput::submit('summary', _('Sauvez')); echo '</p>'; echo '</form>'; echo "<script>checkTotalDirect();</script>"; echo create_script(" update_name()"); if ($g_parameter->MY_DATE_SUGGEST == 'Y') { echo create_script(" get_last_date()"); } echo '</div>';
/** *@brief you can add attribute to this in javascript * this function is a wrapper and create a script (in js) to modify * "this" (in javascript) with the value of obj->attribute from PHP *@return return string with the javascript code */ public function get_js_attr() { require_once NOALYSS_INCLUDE . '/function_javascript.php'; $attr = ""; if (count($this->attribute) == 0) { return ""; } /* Add properties at the widget */ for ($i = 0; $i < count($this->attribute); $i++) { list($name, $value) = $this->attribute[$i]; $tmp1 = sprintf("\$('%s').%s='%s';", $this->name, $name, $value); $attr .= $tmp1; } $attr = create_script($attr); return $attr; }
public function get_js_attr() { $attr = ""; /* Add properties at the widget */ for ($i = 0; $i < count($this->attribute); $i++) { list($name, $value) = $this->attribute[$i]; $tmp1 = sprintf("\$('%s_bt').%s='%s';", $this->id, $name, $value); $attr .= $tmp1; } $attr = create_script($attr); return $attr; }
echo '</div>'; echo '<div class="myfieldset" style="display:none" id="profile_menu_div">'; //Menu / Module /plugin in this profile echo "<h1 class=\"legend\">" . _("Menu") . "</h2>"; $profile_menu = new Profile_Menu($cn); $profile_menu->p_id = $p_id; $profile_menu->display_profile_menu_detail(); echo '</div>'; echo '<div class="myfieldset" style="display:none" id="profile_print_div">'; echo "<h1 class=\"legend\">" . _("Impression") . "</h1>"; $profile_menu->printing(); echo $add_impression; echo '</div>'; echo '<div class="myfieldset" style="display:none" id="profile_gestion_div">'; echo "<h1 class=\"legend\">" . 'Groupe gestion' . "</h1>"; $profile_menu->available_profile(); echo '</div>'; echo '<div class="myfieldset" style="display:none" id="profile_repo_div">'; echo "<h1 class=\"legend\">" . _("Dépôt de stock accessible") . "</h1>"; $profile_menu->available_repository(); echo '</div>'; if (isset($_POST['tab'])) { echo create_script("profile_show('" . $_POST['tab'] . "');"); } } else { echo '</div>'; } ?>
function input($p_array = null, $notused = 0) { global $g_parameter, $g_user; if ($p_array != null) { extract($p_array); } $pview_only = false; $min_article = $this->get_min_row(); $f_add_button = new IButton('add_card'); $f_add_button->label = _('Créer une nouvelle fiche'); $f_add_button->set_attribute('ipopup', 'ipop_newcard'); $f_add_button->set_attribute('jrn', $this->id); $f_add_button->javascript = " this.jrn=\$('p_jrn').value;select_card_type(this);"; $str_add_button = $g_user->check_action(FICADD) == 1 ? $f_add_button->input() : ""; // The first day of the periode $pPeriode = new Periode($this->db); list($l_date_start, $l_date_end) = $pPeriode->get_date_limit($g_user->get_periode()); if ($g_parameter->MY_DATE_SUGGEST == 'Y') { $op_date = !isset($e_date) ? $l_date_start : $e_date; } else { $op_date = !isset($e_date) ? '' : $e_date; } $r = ""; $r .= dossier::hidden(); $f_legend = 'Banque, caisse'; // Date //-- $Date = new IDate("e_date", $op_date); $Date->setReadOnly($pview_only); $f_date = $Date->input(); $f_period = ''; if ($this->check_periode() == true) { // Periode //-- $l_user_per = isset($periode) ? $periode : $g_user->get_periode(); $period = new IPeriod(); $period->cn = $this->db; $period->type = OPEN; $period->value = $l_user_per; $period->user = $g_user; $period->name = 'periode'; try { $l_form_per = $period->input(); } catch (Exception $e) { if ($e->getCode() == 1) { throw new Exception(_("Aucune période ouverte")); } } $label = HtmlInput::infobulle(3); $f_period = "Période comptable {$label}" . $l_form_per; } // Ledger (p_jrn) //-- $onchange = "update_bank();ajax_saldo('first_sold');update_name();update_row('fin_item');"; if ($g_parameter->MY_DATE_SUGGEST == 'Y') { $onchange .= 'get_last_date();'; } if ($g_parameter->MY_PJ_SUGGEST == 'Y') { $onchange .= 'update_pj();'; } $add_js = 'onchange="' . $onchange . '"'; $wLedger = $this->select_ledger('FIN', 2); if ($wLedger == null) { throw new Exception(_('Pas de journal disponible')); } $wLedger->javascript = $add_js; $label = " Journal " . HtmlInput::infobulle(2); $f_jrn = $label . $wLedger->input(); // retrieve bank name, code and account from the jrn_def.jrn_def_bank $f_bank = '<span id="bkname">' . $this->get_bank_name() . '</span>'; if ($this->bank_id == "") { echo h2("Journal de banque non configuré " . $this->get_name(), ' class="error"'); echo '<span class="error"> vous devez donner à ce journal un compte en banque (fiche), modifiez dans CFGLED</span>'; alert("Journal de banque non configuré " . $this->get_name()); } $f_legend_detail = 'Opérations financières'; //-------------------------------------------------- // Saldo begin end //------------------------------------------------- // Extrait $default_pj = ''; if ($g_parameter->MY_PJ_SUGGEST == 'Y') { $default_pj = $this->guess_pj(); } $wPJ = new IText('e_pj'); $wPJ->readonly = false; $wPJ->size = 10; $wPJ->value = isset($e_pj) ? $e_pj : $default_pj; $f_extrait = $wPJ->input() . HtmlInput::hidden('e_pj_suggest', $default_pj); $label = HtmlInput::infobulle(7); $first_sold = isset($first_sold) ? $first_sold : ""; $wFirst = new INum('first_sold', $first_sold); $last_sold = isset($last_sold) ? $last_sold : ""; $wLast = new INum('last_sold', $last_sold); $max = isset($nb_item) ? $nb_item : $min_article; $r .= HtmlInput::hidden('nb_item', $max); //-------------------------------------------------- // financial operation //------------------------------------------------- $array = array(); // Parse each " tiers" for ($i = 0; $i < $max; $i++) { $tiers = isset(${"e_other" . $i}) ? ${"e_other" . $i} : ""; $tiers_amount = isset(${"e_other{$i}" . "_amount"}) ? round(${"e_other{$i}" . "_amount"}, 2) : 0; $tiers_comment = isset(${"e_other{$i}" . "_comment"}) ? ${"e_other{$i}" . "_comment"} : ""; $operation_date = new IDate("dateop" . $i); $operation_date->value = isset(${'dateop' . $i}) ? ${'dateop' . $i} : ""; $array[$i]['dateop'] = $operation_date->input(); ${"e_other{$i}" . "_amount"} = isset(${"e_other{$i}" . "_amount"}) ? ${"e_other{$i}" . "_amount"} : 0; $W1 = new ICard(); $W1->label = ""; $W1->name = "e_other" . $i; $W1->id = "e_other" . $i; $W1->value = $tiers; $W1->extra = 'deb'; // credits $W1->typecard = 'deb'; $W1->style = ' style = "vertical-align:65%"'; $W1->set_dblclick("fill_ipopcard(this);"); $W1->set_attribute('ipopup', 'ipopcard'); // name of the field to update with the name of the card $W1->set_attribute('label', 'e_other_name' . $i); // name of the field to update with the name of the card $W1->set_attribute('typecard', 'filter'); // Add the callback function to filter the card on the jrn $W1->set_callback('filter_card'); $W1->set_function('fill_data'); $W1->javascript = sprintf(' onchange="fill_data_onchange(\'%s\');" ', $W1->name); $W1->readonly = $pview_only; $array[$i]['qcode'] = $W1->input(); $array[$i]['search'] = $W1->search(); // Card name // $card_name = ""; if ($tiers != "") { $fiche = new Fiche($this->db); $fiche->get_by_qcode($tiers); $card_name = $this->db->get_value("Select ad_value from fiche_detail where ad_id=\$1 and f_id=\$2", array(ATTR_DEF_NAME, $fiche->id)); } $wcard_name = new IText("e_other_name" . $i, $card_name); $wcard_name->id = $wcard_name->name; $wcard_name->readOnly = true; $array[$i]['cname'] = $wcard_name->input(); // Comment $wComment = new IText("e_other{$i}" . "_comment", $tiers_comment); $wComment->size = 35; $wComment->setReadOnly($pview_only); $array[$i]['comment'] = $wComment->input(); // amount $wAmount = new INum("e_other{$i}" . "_amount", $tiers_amount); $wAmount->size = 7; $wAmount->setReadOnly($pview_only); $array[$i]['amount'] = $wAmount->input(); // concerned ${"e_concerned" . $i} = isset(${"e_concerned" . $i}) ? ${"e_concerned" . $i} : ""; $wConcerned = new IConcerned("e_concerned" . $i, ${"e_concerned" . $i}); $wConcerned->tiers = "e_other" . $i; $wConcerned->setReadOnly($pview_only); $wConcerned->amount_id = "e_other" . $i . "_amount"; $wConcerned->paid = 'paid'; $array[$i]['concerned'] = $wConcerned->input(); } ob_start(); require_once NOALYSS_INCLUDE . '/template/form_ledger_fin.php'; $r .= ob_get_contents(); ob_end_clean(); $r .= create_script("\$('" . $Date->id . "').focus()"); return $r; }
create_script('function exibir_ocultar() { var type = ("' . $type . '" == "") ? "user" : "' . $type . '"; var use_signature_digital_cripto = null; if (document.all) { // is_ie use_signature_digital_cripto = document.getElementsByName(type+"[use_signature_digital_cripto]")[1]; } else { // not_ie use_signature_digital_cripto = document.getElementsByName(type+"[use_signature_digital_cripto]")[0]; } var default_signature_digital_cripto = "' . $GLOBALS['phpgw_info']['default']['preferences']['expressoMail']['use_signature_digital_cripto'] . '"; if (use_signature_digital_cripto) { var element_signature_digital = document.getElementById(type+"[use_signature_digital]"); var element_signature_cripto = document.getElementById(type+"[use_signature_cripto]"); switch (use_signature_digital_cripto[use_signature_digital_cripto.selectedIndex].value){ case "1": element_signature_digital.style.display=""; element_signature_cripto.style.display=""; break; case "0": element_signature_digital.style.display="none"; element_signature_cripto.style.display="none"; break; case "": if (default_signature_digital_cripto){ element_signature_digital.style.display=""; element_signature_cripto.style.display=""; } else { element_signature_digital.style.display="none"; element_signature_cripto.style.display="none"; } } } } function validateSignature() { var sigs_len = parseInt( document.getElementById("counter").value ); var signatures = {}, types = {}, noSig = true; var default_signature = "", errors = false; for( var i = 0; i < sigs_len; i++ ) { if( !document.getElementById( "_signature" + i ) ) continue; var key = encode64(document.getElementById( "title_signature" + i ).value); var edit = !!document.getElementById( "edit_signature" + i ).checked; var value = edit ? CKEDITOR.instances["user_signature" + i ].getData() : document.getElementById( "user_signature" + i ).value; if( !value ) continue; if( !key ) { alert( "Titulo da assinatura nao pode ser em branco." ); return( false ); } var openTags = value.match(/<[a-z][^&>]*>/g); var closedTags = value.match(/<[/][^&>]*>/g); var oclosedTags = value.match(/[a-z]*[^&<>]* [/]>/g); if( ( openTags || [] ).length !== (( closedTags || [] ).length + ( oclosedTags || [] ).length )) { errors = errors || []; errors.push( key ); } if( errors ) continue; if( document.getElementById( "default_signature" + i ).checked ) default_signature = key; signatures[key] = value; if( edit ) types[key] = edit; if( noSig ) noSig = false; } if( errors ){ alert( "Há erros de html na(s) assinatura(s) \'" + errors.join("\',\'") + "\'.\\nRevise a informação inserida (somente no modo Texto Simples ou visulização do Código-Fonte, no modo Texto Rico).\\nPossivelmente você copiou e colou sua assinatura de outro software. Para evitar erros, recomendamos utilizar apenas o editor Texto Rico do Expresso." ); return( false ); } if( !default_signature ){ if( !noSig ) { alert( "Favor selecionar uma assinatura padrao." ); return( false ); } document.getElementById( "signature_default" ).value = ""; document.getElementById( "signature" ).value = ""; } else { document.getElementById( "signature_default" ).value = default_signature; document.getElementById( "signature" ).value = types[key] ? signatures[default_signature] : signatures[default_signature].replace( /\\n/g, "<br />" ); } if (document.getElementById( "signature" ).value != "") document.getElementById( "signature" ).value = encode64(document.getElementById( "signature" ).value); document.getElementById( "signatures" ).value = toJSON( signatures ); document.getElementById( "signature_types" ).value = toJSON( types ); return( true ); } function fromJSON( value ) { return (new Function( "return " + decode64( value )))(); } function toJSON( value ) { var json = []; for( var key in value ) json.push( \'"\' + key + \'":"\' + escape( value[key] ) + \'"\' ); return encode64( "{" + json.join( "," ) + "}" ); } // This code was written by Tyler Akins and has been placed in the // public domain. It would be nice if you left this header intact. // Base64 code from Tyler Akins -- http://rumkin.com var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; function encode64(input) { var output = new StringMaker(); var chr1, chr2, chr3; var enc1, enc2, enc3, enc4; var i = 0; while (i < input.length) { chr1 = input.charCodeAt(i++); chr2 = input.charCodeAt(i++); chr3 = input.charCodeAt(i++); enc1 = chr1 >> 2; enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); enc4 = chr3 & 63; if (isNaN(chr2)) { enc3 = enc4 = 64; } else if (isNaN(chr3)) { enc4 = 64; } output.append(keyStr.charAt(enc1) + keyStr.charAt(enc2) + keyStr.charAt(enc3) + keyStr.charAt(enc4)); } return output.toString(); } var ua = navigator.userAgent.toLowerCase(); if (ua.indexOf(" chrome/") >= 0 || ua.indexOf(" firefox/") >= 0 || ua.indexOf(" gecko/") >= 0) { var StringMaker = function () { this.str = ""; this.length = 0; this.append = function (s) { this.str += s; this.length += s.length; } this.prepend = function (s) { this.str = s + this.str; this.length += s.length; } this.toString = function () { return this.str; } } } else { var StringMaker = function () { this.parts = []; this.length = 0; this.append = function (s) { this.parts.push(s); this.length += s.length; } this.prepend = function (s) { this.parts.unshift(s); this.length += s.length; } this.toString = function () { return this.parts.join(""); } } } function decode64(input) { var output = new StringMaker(); var chr1, chr2, chr3; var enc1, enc2, enc3, enc4; var i = 0; // remove all characters that are not A-Z, a-z, 0-9, +, /, or = input = input.replace(/[^A-Za-z0-9\\+\\/\\=]/g, ""); while (i < input.length) { enc1 = keyStr.indexOf(input.charAt(i++)); enc2 = keyStr.indexOf(input.charAt(i++)); enc3 = keyStr.indexOf(input.charAt(i++)); enc4 = keyStr.indexOf(input.charAt(i++)); chr1 = (enc1 << 2) | (enc2 >> 4); chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); chr3 = ((enc3 & 3) << 6) | enc4; output.append(String.fromCharCode(chr1)); if (enc3 != 64) { output.append(String.fromCharCode(chr2)); } if (enc4 != 64) { output.append(String.fromCharCode(chr3)); } } return output.toString(); } function normalizerSignature(values){ var value = {}; for( key in values ){ value[isEncoded64(key) ? decode64(key) : key] = values[key]; } return value; } /*Verifica se a string input esta em Base 64*/ function isEncoded64(input){ var baseStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; var encoded = true; if ( (input.length % 4) != 0) return false; for(var i=0; i<input.length; i++){ if ( baseStr.indexOf(input[i]) < 0 ){ encoded = false; break; } } return encoded; } function loadSignature() { var types = fromJSON( document.getElementById( "signature_types" ).value ); var signatures; if (document.getElementById( "signatures" ).value) { signatures = fromJSON(document.getElementById("signatures").value); } else if (document.getElementById( "signature" ).value) // Caso a assinatura esteja no formato da versão 2.2.10: { // TODO: Internazionalizar a string signatures = {}; signatures["Assinatura padrão"] = document.getElementById( "signature" ).value; if (!document.getElementById("signature_default").value) { document.getElementById("signature_default").value = "Assinatura padrão"; } } signatures = normalizerSignature(signatures); types = normalizerSignature(types); var old_signature = document.getElementById( "signature" ).value; var def = document.getElementById( "signature_default" ).value; def = isEncoded64(def) ? decode64(def) : def; var counter = 0, ids = [], def_signature = "", noSig = true; for( key in signatures ) { addSignature( !types || !types[key] ); var value = unescape( signatures[key] ); document.getElementById( "title_signature" + counter ).value = key; document.getElementById( "user_signature" + counter ).value = value; if( def === key ) def_signature = counter; if( noSig ) noSig = false; counter++; } if( def_signature !== "" ) document.getElementById( "default_signature" + def_signature ).checked = true; else if( noSig && old_signature ) { var type_signature = document.getElementById("type_signature"); if (type_signature) { addSignature( type_signature.value !== "html" ); document.getElementById( "user_signature" + counter ).value = old_signature; } } } ');
$html .= $script; if (strlen(trim($_GET['nom_mod'])) != 0) { $array = array("FICHE_REF" => $cat, "nom_mod" => $_GET['nom_mod'], "class_base" => $_GET['class_base'], "fd_description" => $_GET['fd_description']); if (isset($_POST['create'])) { $array['create'] = 1; } $catcard = new Fiche_Def($cn); if ($catcard->Add($array) == -1) { $script = "alert_box('" . _('Catégorie existe déjà') . "')"; } else { $script = "alert_box('" . _('Catégorie sauvée') . "')"; } $html .= create_script($script); } else { $script = "alert_box('" . _("Le nom ne peut pas être vide") . "')"; $html .= create_script($script); $invalid = 1; } } else { $html = alert(_('Action interdite'), true); } break; case 'upc': $html = HtmlInput::title_box("Détail fiche", $ctl); if ($g_user->check_action(FICADD) == 0) { $html .= alert(_('Action interdite'), true); } else { if ($cn->get_value('select count(*) from fiche where f_id=$1', array($_GET['f_id'])) == '0') { $html .= alert(_('Fiche non valide'), true); } else { $html = HtmlInput::title_box(_('Détail fiche (sauvée)'), $ctl);
echo _('Recherche de fiche'); ?> <?php echo HtmlInput::infobulle(18); ?> :<?php echo $search_card->input(); ?> <?php echo HtmlInput::button_anchor(_("Chercher"), "javascript:void(0)", "", $search_card_js, 'smallbutton'); ?> </div> <?php echo '</div>'; $str = "if (g('histo').value==3 || g('histo').value== -1 ) {\n g('trstart').style.display='none';g('trend').style.display='none';g('allcard').style.display='none';}\n else {g('trstart').style.display='';g('trend').style.display='';g('allcard').style.display='';}\n\t if ( g('histo').value== -1 ) { g('allcard').style.display='';}\n\n\t"; echo create_script($str); echo '<hr>'; //----------------------------------------------------- if (!isset($_GET['cat_display'])) { return; } $fd_id = $_GET['cat']; $array = Fiche::get_fiche_def($cn, $_GET['cat'], 'name_asc'); $h_add_card_b = new IButton('add_card'); $h_add_card_b->label = _('Créer une nouvelle fiche'); $h_add_card_b->javascript = "dis_blank_card({gDossier:{$gDossier},fd_id:{$fd_id},ref:2})"; $str_add_card = $g_user->check_action(FICADD) == 1 ? $h_add_card_b->input() : ""; /* * You show now the result */ if ($array == null) {
echo HtmlInput::title_box(_("Favoris"), "bookmark_div"); if (!isset($_GET['ac'])) { /* * find default module */ $_GET['ac'] = find_default_module(); } // Add bookmark if (isset($_GET['bookmark_add'])) { $count = $cn->get_value("select count(*) from bookmark" . " where b_action=\$1 and login=\$2", array($_GET['ac'], $g_user->login)); // Add bookmark only if absent if ($count == 0) { $cn->exec_sql("insert into bookmark(b_action,login) values(\$1,\$2)", array($_GET['ac'], $g_user->login)); } else { $js = "error_message('" . _("Ce favori a déjà été ajouté") . "');"; echo create_script($js); } } // remove bookmark if (isset($_GET['bookmark_delete']) && isset($_GET['book'])) { $a_book = $_GET['book']; for ($e = 0; $e < count($a_book); $e++) { $cn->exec_sql("delete from bookmark where b_id=\$1 and login=\$2", array($a_book[$e], $g_user->login)); } } $bookmark_sql = "select distinct b_id,b_action,b_order,me_code,me_description, javascript" . " from bookmark " . "join v_menu_description_favori on (code=b_action or b_action=me_code)" . "where " . "login=\$1 order by me_code"; $a_bookmark = $cn->get_array($bookmark_sql, array($g_user->login)); $url = "do.php?gDossier=" . Dossier::id() . "&ac="; ?> <div class="content"> <form id="bookmark_del_frm" method="get" onsubmit="remove_bookmark();return false">
//---------------------------------------- // Correct the operations //---------------------------------------- if (isset($_POST['correct'])) { $correct = 1; } //---------------------------------------- // Blank form //---------------------------------------- echo '<div style="position:absolute" class="content">'; echo '<p class="notice">' . $p_msg . '</p>'; echo '<form class="print" name="form_detail" enctype="multipart/form-data" class="print" METHOD="POST">'; echo HtmlInput::hidden('ledger_type', 'fin'); echo HtmlInput::hidden('ac', $_REQUEST['ac']); $array = isset($correct) ? $_POST : null; // show select ledger try { echo $Ledger->input($array); echo HtmlInput::button('add_item', _('Ajout article'), ' onClick="ledger_fin_add_row()"'); echo HtmlInput::submit('save', _('Sauve')); echo HtmlInput::reset(_('Effacer')); if (!isset($_POST['e_date']) && $g_parameter->MY_DATE_SUGGEST == 'Y') { echo create_script(" get_last_date();ajax_saldo('first_sold');"); } else { echo create_script(" ajax_saldo('first_sold');"); } echo create_script(" update_name()"); } catch (Exception $ex) { echo $ex->getMessage(); } return;
function display_form_periode() { $str_dossier = dossier::get(); if ($this->jrn_def_id == 0) { $Res = $this->cn->exec_sql("select p_id,to_char(p_start,'DD.MM.YYYY') as date_start,to_char(p_end,'DD.MM.YYYY') as date_end,p_central,p_closed,p_exercice,\n (select count(jr_id) as count_op from jrn where jr_tech_per = p_id) as count_op\n from parm_periode\n order by p_start,p_end"); $Max = Database::num_row($Res); echo '<form id="periode_frm" method="POST" onsubmit="return confirm_box(this,\'Confirmez-vous la fermeture des périodes choisies ?\')" >'; echo HtmlInput::array_to_hidden(array('ac', 'gDossier', 'jrn_def_id', 'choose'), $_REQUEST); echo '<TABLE ALIGN="CENTER">'; echo "</TR>"; echo '<th>' . ICheckBox::toggle_checkbox("per_toggle", "periode_frm") . "</th>"; echo '<TH> Date début </TH>'; echo '<TH> Date fin </TH>'; echo '<TH> Exercice </TH>'; echo "</TR>"; for ($i = 0; $i < $Max; $i++) { $l_line = Database::fetch_array($Res, $i); $class = "even"; if ($i % 2 == 0) { $class = "odd"; } $style = ''; if ($l_line['p_closed'] == 't') { $style = "color:red"; } echo '<TR class="' . $class . '" style="' . $style . '">'; echo '<td>'; if ($l_line['p_closed'] == 'f') { $per_to_close = new ICheckBox('sel_per_close[]'); $per_to_close->value = $l_line['p_id']; echo $per_to_close->input(); } echo '</td>'; echo '<TD ALIGN="CENTER"> ' . $l_line['date_start'] . '</TD>'; echo '<TD ALIGN="CENTER"> ' . $l_line['date_end'] . '</TD>'; echo '<TD ALIGN="CENTER"> ' . $l_line['p_exercice'] . '</TD>'; if ($l_line['p_closed'] == 't') { $closed = $l_line['p_central'] == 't' ? '<TD>Centralisée</TD>' : '<TD>Fermée</TD>'; $change = '<TD></TD>'; $remove = sprintf(_('Nombre opérations %d'), $l_line['count_op']); $remove = td($remove, ' class="mtitle" '); $change = td('<A class="mtitle" HREF="javascript:void(0)"' . ' onclick="return confirm_box(null,\'' . _('Confirmez Réouverture') . ' ?\',function() {window.location=\'do.php?ac=' . $_REQUEST['ac'] . '&action=reopen&p_per=' . $l_line['p_id'] . '&' . $str_dossier . '\';} )"> Réouverture</A>', ' class="mtitle"'); } else { if ($l_line['count_op'] == 0) { $change = HtmlInput::display_periode($l_line['p_id']); } else { $change = "Non modifiable"; } $change = td($change, ' class="mtitle" '); $reopen = td(""); $remove = '<TD class="mtitle">'; if ($l_line['count_op'] == 0) { $go = 'do.php?' . http_build_query(array('ac' => $_REQUEST['ac'], 'action' => 'delete_per', 'p_per' => $l_line['p_id'], 'gDossier' => Dossier::id())); $remove .= '<A class="mtitle" HREF="javascript:void(0)" ' . 'onclick="return confirm_box (null,\'' . _('Confirmez effacement ?') . '\',function() { window.location=\'' . $go . '\'});" >' . ' Efface</A>'; } else { $remove .= sprintf(_('Nombre opérations %d'), $l_line['count_op']); } $remove .= '</td>'; } echo $change; echo $remove; echo '</TR>'; } echo '</table>'; echo '<p style="text-align:center">'; echo HtmlInput::hidden("close_per", 1); echo HtmlInput::submit('close_per_bt', 'Fermeture des périodes sélectionnées'); echo '</p>'; echo '</form>'; $but = new IButton('show_per_add', 'Ajout d\'une période'); $but->javascript = "\$('periode_add_div').show();"; echo $but->input(); echo '<div class="inner_box" style="width:40%;" id="periode_add_div">'; echo HtmlInput::title_box("Ajout d'une période", "periode_add_div", "hide"); echo '<FORM METHOD="POST">'; echo dossier::hidden(); $istart = new IDate('p_date_start'); $iend = new IDate('p_date_end'); $iexercice = new INum('p_exercice'); $iexercice->size = 5; echo '<table>'; echo '<TR> '; echo td('Date de début'); echo td($istart->input()); echo '</tr><tr>'; echo td('Date de fin'); echo td($iend->input()); echo '</tr><tr>'; echo td('Exercice'); echo td($iexercice->input()); echo '</TABLE>'; echo HtmlInput::submit('add_per', 'Valider'); echo '</FORM>'; echo '</div>'; echo create_script("\$('periode_add_div').hide();new Draggable('periode_add_div',{starteffect:function()\n {\n new Effect.Highlight(obj.id,{scroll:window,queue:'end'});\n }}\n );"); } else { $Res = $this->cn->exec_sql("select p_id,to_char(p_start,'DD.MM.YYYY') as date_start,to_char(p_end,'DD.MM.YYYY') as date_end,status,p_exercice\n from parm_periode join jrn_periode using (p_id) where jrn_def_id=" . $this->jrn_def_id . "\n order by p_start,p_end"); $Max = Database::num_row($Res); $r = $this->cn->exec_sql('select jrn_Def_name from jrn_Def where jrn_Def_id=' . $this->jrn_def_id); $jrn_name = Database::fetch_result($r, 0, 0); echo '<h2> Journal ' . $jrn_name . '</h2>'; echo '<form id="periode_frm" method="POST" onsubmit="return confirm_box(this,\'Confirmez-vous la fermeture des périodes choisies ?\')" >'; echo HtmlInput::array_to_hidden(array('ac', 'gDossier', 'jrn_def_id', 'choose'), $_REQUEST); echo '<TABLE ALIGN="CENTER">'; echo "</TR>"; echo '<th>' . ICheckBox::toggle_checkbox("per_toggle", "periode_frm") . "</th>"; echo '<TH> Date début </TH>'; echo '<TH> Date fin </TH>'; echo '<TH> Exercice </TH>'; echo "</TR>"; for ($i = 0; $i < $Max; $i++) { $l_line = Database::fetch_array($Res, $i); if ($l_line['status'] != 'OP') { echo '<TR style="COLOR:RED">'; } else { echo '<TR>'; } echo '<td>'; if ($l_line['status'] == 'OP') { $per_to_close = new ICheckBox('sel_per_close[]'); $per_to_close->value = $l_line['p_id']; echo $per_to_close->input(); } echo '</td>'; echo '<TD ALIGN="CENTER"> ' . $l_line['date_start'] . '</TD>'; echo '<TD ALIGN="CENTER"> ' . $l_line['date_end'] . '</TD>'; echo '<TD ALIGN="CENTER"> ' . $l_line['p_exercice'] . '</TD>'; $closed = ""; if ($l_line['status'] != 'OP') { $go = 'do.php?' . http_build_query(array('ac' => $_REQUEST['ac'], 'action' => 'reopen', 'p_per' => $l_line['p_id'], 'gDossier' => Dossier::id(), 'jrn_def_id' => $this->jrn_def_id)); $closed = td('<A class="mtitle" HREF="javascript:void(0)" ' . 'onclick="return confirm_box(null,\'' . _('Confirmez Réouverture') . ' ?\',function() {window.location=\'' . $go . '\';} );"> Réouverture</A>', ' class="mtitle"'); } echo "{$closed}"; echo '</TR>'; } echo '</TABLE>'; echo '<p style="text-align:center">'; echo HtmlInput::submit('close_per', 'Fermeture des périodes sélectionnées'); echo '</p>'; echo '</form>'; } }
public function input($p_name = null, $p_value = null) { if ($p_name == null && $this->name == "") { throw new Exception('Le nom d une icard doit être donne'); } $this->value = $p_value == null ? $this->value : $p_value; if ($this->readOnly == true) { return $this->display(); } $this->id = $this->id == "" ? $this->name : $this->id; $label = ''; if ($this->dblclick != '') { $e = sprintf(' ondblclick="%s" ', $this->dblclick); $this->dblclick = $e; } $input = sprintf('<INPUT TYPE="Text" class="input_text" ' . ' NAME="%s" ID="%s" VALUE="%s" SIZE="%d" %s %s>', $this->name, $this->name, $this->value, $this->size, $this->dblclick, $this->javascript); $div = sprintf('<div id="%s_choices" class="autocomplete"></div>', $this->name); $query = "op=autoanc&" . dossier::get(); // add parameter to search into a plan (pa_id) or get the value from // a HtmlObject if ($this->plan != 0) { $query .= "&pa_id=" . $this->plan; } elseif ($this->plan_ctl != '') { $this->set_attribute("plan_ctl", $this->plan_ctl); } $attr = $this->get_js_attr(); $javascript = sprintf('try { new Ajax.Autocompleter("%s","%s_choices","ajax_misc.php?%s",' . '{paramName:"anccard",minChars:1,indicator:null, ' . 'callback:%s, ' . ' afterUpdateElement:%s});} catch (e){alert(e.message);};', $this->name, $this->name, $query, $this->callback, $this->fct); $javascript = create_script($javascript . $this->dblclick); $r = $label . $input . $attr . $div . $javascript; if ($this->table == 1) { $r = td($r); } return $r; }
function input($p_array = null, $p_readonly = 0) { global $g_parameter, $g_user; if ($p_array != null) { extract($p_array); } $flag_tva = $g_parameter->MY_TVA_USE; /* Add button */ $f_add_button = new IButton('add_card'); $f_add_button->tabindex = -1; $f_add_button->label = _('Créer une nouvelle fiche'); $f_add_button->set_attribute('ipopup', 'ipop_newcard'); $f_add_button->set_attribute('jrn', $this->id); $f_add_button->javascript = "this.jrn=\$('p_jrn').value; select_card_type(this);"; $f_add_button2 = new IButton('add_card2'); $f_add_button2->tabindex = -1; $f_add_button2->label = _('Créer une nouvelle fiche'); $f_add_button2->set_attribute('ipopup', 'ipop_newcard'); $f_add_button2->set_attribute('filter', $this->get_all_fiche_def()); // $f_add_button2->set_attribute('jrn',$this->id); $f_add_button2->javascript = " this.jrn=\$('p_jrn').value;select_card_type(this);"; $str_add_button = ""; $str_add_button2 = ""; if ($g_user->check_action(FICADD) == 1) { $str_add_button = $f_add_button->input(); $str_add_button2 = $f_add_button2->input(); } // The first day of the periode $oPeriode = new Periode($this->db); list($l_date_start, $l_date_end) = $oPeriode->get_date_limit($g_user->get_periode()); if ($g_parameter->MY_DATE_SUGGEST == 'Y') { $op_date = !isset($e_date) ? $l_date_start : $e_date; } else { $op_date = !isset($e_date) ? '' : $e_date; } $e_ech = isset($e_ech) ? $e_ech : ""; $e_comm = isset($e_comm) ? $e_comm : ""; $r = ''; $r .= dossier::hidden(); $f_legend = _('Client'); $Echeance = new IDate(); $Echeance->setReadOnly(false); $Echeance->tabindex = 2; $label = HtmlInput::infobulle(4); $f_echeance = $Echeance->input('e_ech', $e_ech, _('Echéance') . $label); $Date = new IDate(); $Date->setReadOnly(false); $f_date = $Date->input("e_date", $op_date); $f_periode = ''; // Periode //-- if ($this->check_periode() == true) { $l_user_per = $g_user->get_periode(); $def = isset($periode) ? $periode : $l_user_per; $period = new IPeriod("period"); $period->user = $g_user; $period->cn = $this->db; $period->value = $def; $period->type = OPEN; try { $l_form_per = $period->input(); } catch (Exception $e) { if ($e->getCode() == 1) { throw new Exception(_("Aucune période ouverte")); } } $label = HtmlInput::infobulle(3); $f_periode = '<td>' . _("Période comptable") . "</td> <td> {$label} " . $l_form_per . '</td>'; } /* if we suggest the next pj, then we need a javascript */ $add_js = ""; if ($g_parameter->MY_PJ_SUGGEST == 'Y') { $add_js = "update_pj();"; } if ($g_parameter->MY_DATE_SUGGEST == 'Y') { $add_js .= 'get_last_date();'; } $add_js .= 'update_name();'; $add_js .= 'update_pay_method();'; $add_js .= 'update_row("sold_item");'; $wLedger = $this->select_ledger('VEN', 2); if ($wLedger == null) { throw new Exception(_('Pas de journal disponible')); } $wLedger->table = 1; $wLedger->javascript = "onChange='update_predef(\"ven\",\"f\",\"" . $_REQUEST['ac'] . "\");{$add_js}'"; $wLedger->label = " Journal " . HtmlInput::infobulle(2); $f_jrn = $wLedger->input(); $Commentaire = new IText(); $Commentaire->table = 0; $Commentaire->setReadOnly(false); $Commentaire->size = 60; $Commentaire->tabindex = 3; $label = HtmlInput::infobulle(1); $f_desc = $Commentaire->input("e_comm", h($e_comm)); // PJ //-- /* suggest PJ ? */ $default_pj = ''; if ($g_parameter->MY_PJ_SUGGEST == 'Y') { $default_pj = $this->guess_pj(); } $pj = new IText(); $pj->table = 0; $pj->name = "e_pj"; $pj->size = 10; $pj->value = isset($e_pj) ? $e_pj : $default_pj; $f_pj = $pj->input() . HtmlInput::hidden('e_pj_suggest', $default_pj); // Display the customer //-- $fiche = 'deb'; // Save old value and set a new one //-- $e_client = isset($e_client) ? $e_client : ""; $e_client_label = " "; //str_pad("",100,"."); // retrieve e_client_label //-- if (strlen(trim($e_client)) != 0) { $fClient = new Fiche($this->db); $fClient->get_by_qcode($e_client); $e_client_label = $fClient->strAttribut(ATTR_DEF_NAME) . ' ' . ' Adresse : ' . $fClient->strAttribut(ATTR_DEF_ADRESS) . ' ' . $fClient->strAttribut(ATTR_DEF_CP) . ' ' . $fClient->strAttribut(ATTR_DEF_CITY) . ' '; } $W1 = new ICard(); $W1->label = "Client " . HtmlInput::infobulle(0); $W1->name = "e_client"; $W1->tabindex = 3; $W1->value = $e_client; $W1->table = 0; $W1->set_dblclick("fill_ipopcard(this);"); $W1->set_attribute('ipopup', 'ipopcard'); // name of the field to update with the name of the card $W1->set_attribute('label', 'e_client_label'); // name of the field to update with the name of the card $W1->set_attribute('typecard', 'deb'); // Add the callback function to filter the card on the jrn $W1->set_callback('filter_card'); $W1->set_function('fill_data'); $W1->javascript = sprintf(' onchange="fill_data_onchange(\'%s\');" ', $W1->name); $f_client_qcode = $W1->input(); $client_label = new ISpan(); $client_label->table = 0; $f_client = $client_label->input("e_client_label", $e_client_label); $f_client_bt = $W1->search(); // Record the current number of article $Hid = new IHidden(); $p_article = isset($nb_item) ? $nb_item : $this->get_min_row(); $r .= $Hid->input("nb_item", $p_article); $max = $p_article < $this->get_min_row() ? $this->get_min_row() : $p_article; $f_legend_detail = _("Détail articles vendus"); // For each article //-- for ($i = 0; $i < $max; $i++) { // Code id, price & vat code //-- $march = isset(${"e_march{$i}"}) ? ${"e_march{$i}"} : ""; $march_price = isset(${"e_march" . $i . "_price"}) ? ${"e_march" . $i . "_price"} : ""; if ($flag_tva == 'Y') { $march_tva_id = isset(${"e_march{$i}" . "_tva_id"}) ? ${"e_march{$i}" . "_tva_id"} : ""; $march_tva_amount = isset(${"e_march{$i}" . "_tva_amount"}) ? ${"e_march{$i}" . "_tva_amount"} : ""; } $march_label = isset(${"e_march" . $i . "_label"}) ? ${"e_march" . $i . "_label"} : ""; // retrieve the tva label and name //-- if (strlen(trim($march)) != 0 && strlen(trim($march_label)) == 0) { $fMarch = new Fiche($this->db); $fMarch->get_by_qcode($march); $march_label = $fMarch->strAttribut(ATTR_DEF_NAME); if ($flag_tva == 'Y') { if (!isset(${"e_march{$i}" . "_tva_id"})) { $march_tva_id = $fMarch->strAttribut(ATTR_DEF_TVA); } } } // Show input //-- $W1 = new ICard(); $W1->label = ""; $W1->name = "e_march" . $i; $W1->value = $march; $W1->table = 1; $W1->set_attribute('typecard', 'cred'); $W1->set_dblclick("fill_ipopcard(this);"); $W1->set_attribute('ipopup', 'ipopcard'); // name of the field to update with the name of the card $W1->set_attribute('label', 'e_march' . $i . '_label'); // name of the field with the price $W1->set_attribute('price', 'e_march' . $i . '_price'); // name of the field with the TVA_ID $W1->set_attribute('tvaid', 'e_march' . $i . '_tva_id'); // Add the callback function to filter the card on the jrn $W1->set_callback('filter_card'); $W1->set_function('fill_data'); $W1->javascript = sprintf(' onchange="fill_data_onchange(\'%s\');" ', $W1->name); $W1->readonly = false; $array[$i]['quick_code'] = $W1->input(); $array[$i]['bt'] = $W1->search(); // For computing we need some hidden field for holding the value $array[$i]['hidden'] = ''; if ($flag_tva == 'Y') { $array[$i]['hidden'] .= HtmlInput::hidden('tva_march' . $i, 0); } $htva = new INum('htva_march' . $i); $htva->readOnly = 1; $htva->value = 0; $array[$i]['htva'] = $htva->input(); if ($g_parameter->MY_TVA_USE == 'Y') { $tvac = new INum('tvac_march' . $i); } else { $tvac = new IHidden('tvac_march' . $i); } $tvac->readOnly = 1; $tvac->value = 0; $array[$i]['tvac'] = $tvac->input(); if ($g_parameter->MY_UPDLAB == 'Y') { $Span = new IText("e_march" . $i . "_label"); $Span->css_size = "100%"; } else { $Span = new ISpan("e_march" . $i . "_label"); } $Span->value = $march_label; $Span->setReadOnly(false); // card's name, price //-- $array[$i]['denom'] = $Span->input("e_march" . $i . "_label", $march_label); // price $Price = new INum(); $Price->setReadOnly(false); $Price->size = 9; $Price->javascript = "onBlur='format_number(this);clean_tva({$i});compute_ledger({$i})'"; $array[$i]['pu'] = $Price->input("e_march" . $i . "_price", $march_price); $array[$i]['tva'] = ''; $array[$i]['amount_tva'] = ''; // if tva is not needed then no tva field if ($flag_tva == 'Y') { // vat label //-- $Tva = new ITva_Popup($this->db); $Tva->in_table = true; $Tva->set_attribute('compute', $i); $Tva->js = 'onblur="format_number(this);clean_tva(' . $i . ');compute_ledger(' . $i . ')"'; $Tva->value = $march_tva_id; $array[$i]['tva'] = $Tva->input("e_march{$i}" . "_tva_id"); // vat amount //-- $wTva_amount = new INum(); $wTva_amount->readOnly = false; $wTva_amount->size = 6; $wTva_amount->javascript = "onBlur='format_number(this);compute_ledger({$i})'"; $array[$i]['amount_tva'] = $wTva_amount->input("e_march" . $i . "_tva_amount", $march_tva_amount); } // quantity //-- $quant = isset(${"e_quant{$i}"}) ? ${"e_quant{$i}"} : "1"; $Quantity = new INum(); $Quantity->setReadOnly(false); $Quantity->size = 8; $Quantity->javascript = "onChange='format_number(this);clean_tva({$i});compute_ledger({$i})'"; $array[$i]['quantity'] = $Quantity->input("e_quant" . $i, $quant); } // foreach article $f_type = _('Client'); ob_start(); require_once NOALYSS_INCLUDE . '/template/form_ledger_detail.php'; $r .= ob_get_contents(); ob_end_clean(); // Set correctly the REQUEST param for jrn_type $r .= HtmlInput::hidden('jrn_type', 'VEN'); $r .= HtmlInput::button('add_item', _('Ajout article'), ' onClick="ledger_add_row()"'); $r .= create_script("\$('" . $Date->id . "').focus()"); return $r; }
echo td($row->with_calc); echo td($row->with_direct_form); echo '</tr>'; } $js = sprintf('<a href="javascript:void(0)" class="button" onclick="get_profile_detail(\'%s\',\'%s\')">', $gDossier, -1); echo '<tr>'; echo "<td>" . $js . _("Ajouter un profil") . " </td>"; echo '</tr>'; echo '</table>'; echo '</div>'; //******************************************************* // Show details of the selected profile //******************************************************* echo '<div id="detail_profile" class="content">'; if (isset($_POST['p_id'])) { require_once NOALYSS_INCLUDE . '/ajax_get_profile.php'; ?> <script> $('list_profile').hide() </script> <?php } echo '</div>'; if (isset($_POST['delete_profil'])) { echo create_script(" \$('detail_profile').hide()"); ?> <script> $('list_profile').show() </script> <?php }
/** * @brief Show the form to encode your operation * @param$p_array if you correct or use a predef operation (default = null) * @param$p_readonly 1 for readonly 0 for writable (default 0) *@exception if ledger not found * \return a string containing the form */ function input($p_array = null, $p_readonly = 0) { global $g_parameter, $g_user; $this->nb = $this->get_min_row(); if ($p_readonly == 1) { return $this->confirm($p_array); } if ($p_array != null) { extract($p_array); } $add_js = ""; if ($g_parameter->MY_PJ_SUGGEST == 'Y') { $add_js = "update_pj();"; } if ($g_parameter->MY_DATE_SUGGEST == 'Y') { $add_js .= 'get_last_date();'; } $add_js .= 'update_row("quick_item");'; $ret = ""; if ($g_user->check_action(FICADD) == 1) { /* Add button */ $f_add_button = new IButton('add_card'); $f_add_button->label = _('Créer une nouvelle fiche'); $f_add_button->set_attribute('ipopup', 'ipop_newcard'); $f_add_button->set_attribute('jrn', $this->id); $f_add_button->javascript = " this.jrn=\$('p_jrn').value;select_card_type(this);"; $f_add_button->input(); } $wLedger = $this->select_ledger('ODS', 2); if ($wLedger == null) { throw new Exception(_('Pas de journal disponible')); } $wLedger->javascript = "onChange='update_name();update_predef(\"ods\",\"t\",\"" . $_REQUEST['ac'] . "\");{$add_js}'"; $label = " Journal " . HtmlInput::infobulle(2); $ret .= $label . $wLedger->input(); // Load the javascript // $ret .= "<table>"; $ret .= '<tr ><td colspan="2" style="width:auto">'; $wDate = new IDate('e_date'); $wDate->readonly = $p_readonly; $e_date = isset($e_date) && trim($e_date) != '' ? $e_date : ''; $wDate->value = $e_date; $ret .= _("Date") . ' : ' . $wDate->input(); $ret .= '</td>'; /* insert periode if needed */ // Periode //-- if ($this->check_periode() == true) { $l_user_per = $g_user->get_periode(); $def = isset($periode) ? $periode : $l_user_per; $period = new IPeriod("period"); $period->user = $g_user; $period->cn = $this->db; $period->value = $def; $period->type = OPEN; try { $l_form_per = $period->input(); } catch (Exception $e) { if ($e->getCode() == 1) { echo _("Aucune période ouverte"); exit; } } $label = HtmlInput::infobulle(3); $f_periode = _("Période comptable") . " {$label} " . $l_form_per; $ret .= td($f_periode); } $wPJ = new IText('e_pj'); $wPJ->readonly = false; $wPJ->size = 10; /* suggest PJ ? */ $default_pj = ''; if ($g_parameter->MY_PJ_SUGGEST == 'Y') { $default_pj = $this->guess_pj(); } $wPJ->value = isset($e_pj) ? $e_pj : $default_pj; $ret .= '</tr>'; $ret .= '<tr >'; $ret .= '<td colspan="2" style="width:auto"> ' . _('Pièce') . ' : ' . $wPJ->input(); $ret .= HtmlInput::hidden('e_pj_suggest', $default_pj); $ret .= '</tr>'; $ret .= '</td>'; $ret .= '<tr>'; $ret .= '<td colspan="2" style="width:auto">'; $ret .= _('Libellé'); $wDescription = new IText('desc'); $wDescription->readonly = $p_readonly; $wDescription->size = "50"; $wDescription->value = isset($desc) ? $desc : ''; $ret .= $wDescription->input(); $ret .= '</td>'; $ret .= '</tr>'; $ret .= '</table>'; $nb_row = isset($nb_item) ? $nb_item : $this->nb; $ret .= HtmlInput::hidden('nb_item', $nb_row); $ret .= dossier::hidden(); $ret .= dossier::hidden(); $ret .= HtmlInput::hidden('jrn_type', $this->get_type()); $info = HtmlInput::infobulle(0); $info_poste = HtmlInput::infobulle(9); if ($g_user->check_action(FICADD) == 1) { $ret .= $f_add_button->input(); } $ret .= '<table id="quick_item" style="position:float;width:100%">'; $ret .= '<tr>' . '<th style="text-align:left">Quickcode' . $info . '</th>' . '<th style="text-align:left">' . _('Poste') . $info_poste . '</th>' . '<th style="text-align:left">' . _('Libellé') . '</th>' . '<th style="text-align:left">' . _('Montant') . '</th>' . '<th style="text-align:left">' . _('Débit') . '</th>' . '</tr>'; for ($i = 0; $i < $nb_row; $i++) { // Quick Code $quick_code = new ICard('qc_' . $i); $quick_code->set_dblclick("fill_ipopcard(this);"); $quick_code->set_attribute('ipopup', 'ipopcard'); // name of the field to update with the name of the card $quick_code->set_attribute('label', "ld" . $i); // name of the field to update with the name of the card $quick_code->set_attribute('typecard', 'filter'); // Add the callback function to filter the card on the jrn $quick_code->set_callback('filter_card'); $quick_code->set_function('fill_data'); $quick_code->javascript = sprintf(' onchange="fill_data_onchange(\'%s\');" ', $quick_code->name); $quick_code->value = isset(${'qc_' . $i}) ? ${'qc_' . $i} : ""; $quick_code->readonly = $p_readonly; $label = ''; if ($quick_code->value != '') { $Fiche = new Fiche($this->db); $Fiche->get_by_qcode($quick_code->value); $label = $Fiche->strAttribut(ATTR_DEF_NAME); } // Account $poste = new IPoste(); $poste->name = 'poste' . $i; $poste->set_attribute('jrn', $this->id); $poste->set_attribute('ipopup', 'ipop_account'); $poste->set_attribute('label', 'ld' . $i); $poste->set_attribute('account', 'poste' . $i); $poste->set_attribute('dossier', Dossier::id()); $poste->value = isset(${'poste' . $i}) ? ${"poste" . $i} : ''; $poste->dbl_click_history(); $poste->readonly = $p_readonly; if ($poste->value != '') { $Poste = new Acc_Account($this->db); $Poste->set_parameter('value', $poste->value); $label = $Poste->get_lib(); } // Description of the line $line_desc = new IText(); $line_desc->name = 'ld' . $i; $line_desc->size = 30; $line_desc->value = isset(${"ld" . $i}) ? ${"ld" . $i} : $label; // Amount $amount = new INum(); $amount->size = 10; $amount->name = 'amount' . $i; $amount->value = isset(${'amount' . $i}) ? ${"amount" . $i} : ''; $amount->readonly = $p_readonly; $amount->javascript = ' onChange="format_number(this);checkTotalDirect()"'; // D/C $deb = new ICheckBox(); $deb->name = 'ck' . $i; $deb->selected = isset(${'ck' . $i}) ? true : false; $deb->readonly = $p_readonly; $deb->javascript = ' onChange="checkTotalDirect()"'; $ret .= '<tr>'; $ret .= '<td>' . $quick_code->input() . $quick_code->search() . '</td>'; $ret .= '<td>' . $poste->input() . '<script> document.getElementById(\'poste' . $i . '\').onblur=function(){ if (trim(this.value) !=\'\') {document.getElementById(\'qc_' . $i . '\').value="";}}</script>' . '</td>'; $ret .= '<td>' . $line_desc->input() . '</td>'; $ret .= '<td>' . $amount->input() . '</td>'; $ret .= '<td>' . $deb->input() . '</td>'; $ret .= '</tr>'; // If readonly == 1 then show CA } $ret .= '</table>'; if (isset($this->with_concerned) && $this->with_concerned == true) { $oRapt = new Acc_Reconciliation($this->db); $w = $oRapt->widget(); $w->name = 'jrn_concerned'; $w->value = isset($jrn_concerned) ? $jrn_concerned : ""; $ret .= "Réconciliation/rapprochements : " . $w->input(); } $ret .= create_script("\$('" . $wDate->id . "').focus()"); return $ret; }
/** * 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++; }
$from_periode = 'from_periode=' . format_date($limit[0]->p_start); $to_periode = 'to_periode=' . format_date($limit[1]->p_end); if (isset($_GET['ex'])) { if ($exercice > $_GET['ex']) { $limit_periode = $periode->get_limit($_GET['ex']); $from_periode = 'from_periode=' . format_date($limit_periode[0]->p_start); } else { $limit_periode = $periode->get_limit($_GET['ex']); $to_periode = 'to_periode=' . format_date($limit_periode[1]->p_end); } } if (isset($_GET['pcm_val'])) { $href_csv = "export.php?" . $href . '&poste_id=' . $_GET['pcm_val'] . '&ople=0&type=poste&' . $from_periode . '&' . $to_periode . "&act=CSV:postedetail"; $href_pdf = "export.php?" . $href . '&poste_id=' . $_GET['pcm_val'] . '&ople=0&type=poste&' . $from_periode . '&' . $to_periode . "&act=PDF:postedetail"; } else { $href_csv = "export.php?" . $href . '&f_id=' . $_GET['f_id'] . '&ople=0&type=poste&' . $from_periode . '&' . $to_periode . "&act=CSV:fichedetail"; $href_pdf = "export.php?" . $href . '&f_id=' . $_GET['f_id'] . '&ople=0&type=poste&' . $from_periode . '&' . $to_periode . "&act=PDF:fichedetail"; } echo HtmlInput::print_window(); echo '<a class="smallbutton" href="' . $href_csv . '">' . _("Export CSV") . '</a>'; echo '<a class="smallbutton" href="' . $href_pdf . '">' . _("Export PDF") . '</a>'; } else { echo HtmlInput::print_window(); } echo '</div>'; echo HtmlInput::hidden('inpopup', 1); load_all_script(); $str = $_SERVER['QUERY_STRING'] . "&div=popup"; $script = "\n var obj={id:'popup',fixed:1,cssclass:'content',style:'width:auto',html:loading(),qs:'{$str}',js_success:'success_box',js_error:null,callback:'" . $_GET['ajax'] . "'};\n show_box(obj);\n "; echo create_script($script);
function input() { $r = ""; if ($this->blocking) { $r .= sprintf('<div id="%s_fond" class="popup_back">', $this->name); $r .= "</div>"; } $javascript = sprintf("javascript:hideIPopup('%s')", $this->name); if (isset($this->title) && trim($this->title) != "") { $r .= sprintf('<div id="%s_border" id="%s_border" class="popup_border_title">', $this->name, $this->name); $r .= sprintf('<span id="%s_">%s</span>', $this->name, $this->title); } else { $r .= sprintf('<div id ="%s_border" id="%s_border" class="popup_border_notitle">', $this->name, $this->name); } $r .= '<div style="position:absolute;top:0px;right:10px;font-weight:normal;font-size:9px;color:black;text-align:right">'; $r .= sprintf('<a style="background-color:blue;color:white;text-decoration:none" href="%s">⨉</a></div>', $javascript); $r .= sprintf('<div id ="%s_content" id="%s_content" class="inner_box"> %s </div></div>', $this->name, $this->name, $this->value); /* Add properties at the widget */ $attr = $this->parameter; for ($i = 0; $i < count($this->attribute); $i++) { list($name, $value) = $this->attribute[$i]; $tmp1 = sprintf("\$('%s').%s='%s';", $this->name, $name, $value); $attr .= $tmp1; } $draggable = ''; if ($this->drag == true) { /* add draggable possibility */ $draggable = sprintf(" new Draggable('%s_border',{starteffect:function(){\n new Effect.Highlight('%s_border',{scroll:window,queue:'end'}); } });", $this->name, $this->name); } $attr = create_script($attr . $draggable); $r .= $attr; return $r; }
public function input($p_name = null, $p_value = null) { if ($p_name == null && $this->name == "") { throw new Exception('Le nom d une icard doit être donne'); } $this->value = $p_value == null ? $this->value : $p_value; if ($this->readOnly == true) { return $this->display(); } $this->id = $this->id == "" ? $this->name : $this->id; $this->choice = $this->choice == null ? sprintf("%s_choices", $this->id) : $this->choice; $this->indicator = $this->indicator == null ? sprintf("%s_ind", $this->id) : $this->indicator; $attr = $this->get_js_attr(); $label = ''; if ($this->dblclick != '') { $e = sprintf(' ondblclick="%s" ', $this->dblclick); $this->dblclick = $e; } $input = sprintf('<INPUT TYPE="Text" class="input_text" ' . ' NAME="%s" ID="%s" VALUE="%s" SIZE="%d" %s %s %s>', $this->name, $this->id, $this->value, $this->size, $this->dblclick, $this->javascript, $this->style); if ($this->autocomplete == 1) { $this->indicator = "ind_" . $this->id; $ind = sprintf('<span id="%s" class="autocomplete" style="position:absolute;display:none">Un instant... <img src="image/loading.gif" alt="Chargement..."/>' . '</span>', $this->indicator); $this->indicator = "null"; $div = $this->choice_create == 1 ? sprintf('<div id="%s" class="autocomplete"></div>', $this->choice) : ""; $query = dossier::get() . '&e=' . urlencode($this->typecard); $javascript = sprintf('try { new Ajax.Autocompleter("%s","%s","fid_card.php?%s",' . '{paramName:"FID",minChars:1,indicator:%s, ' . 'callback:%s, ' . ' afterUpdateElement:%s});} catch (e){alert(e.message);};', $this->id, $this->choice, $query, $this->indicator, $this->callback, $this->fct); $javascript = create_script($javascript . $this->dblclick); $r = $label . $input . $attr . $ind . $div . $javascript; } else { $r = $label . $input; } if ($this->table == 1) { $r = td($r); } return $r; }