/** * display screen to enter a new ledger */ function input_new() { $retry = HtmlInput::default_value_post("sa", ""); // if ( $retry == "add") { $default_type = HtmlInput::default_value_post("p_jrn_type", -1); $previous_jrn_def_pj_pref = HtmlInput::default_value_post("jrn_def_pj_pref", ""); $previous_p_description = HtmlInput::default_value_post("p_description", ""); $previous_p_jrn_name = HtmlInput::default_value_post('p_jrn_name', ''); $previous_p_jrn_type = HtmlInput::default_value_post("p_jrn_type", ""); // } global $g_user; $f_add_button = new ISmallButton('add_card'); $f_add_button->label = _('Créer une nouvelle fiche'); $f_add_button->tabindex = -1; $f_add_button->set_attribute('jrn', -1); $f_add_button->javascript = " this.jrn=-1;select_card_type({type_cat:4});"; $str_add_button = ""; if ($g_user->check_action(FICADD) == 1) { $str_add_button = $f_add_button->input(); } $wSearch = new IPoste(); $wSearch->table = 3; $wSearch->set_attribute('ipopup', 'ipop_account'); $wSearch->set_attribute('account', 'p_jrn_class_deb'); $wSearch->set_attribute('no_overwrite', '1'); $wSearch->set_attribute('noquery', '1'); $wSearch->name = "p_jrn_class_deb"; $wSearch->size = 20; $search = $wSearch->input(); // default for ACH $default_deb_purchase = $this->get_default_card('ACH', 'D'); $default_cred_purchase = $this->get_default_card('ACH', 'C'); // default for VEN $default_deb_sale = $this->get_default_card('VEN', 'D'); $default_cred_sale = $this->get_default_card('VEN', 'C'); // default for FIN $default_fin = $this->get_default_card("FIN", ""); //default ods $default_ods = $this->get_default_card("ODS", ""); /* construct all the hidden */ $hidden = HtmlInput::hidden('p_jrn', -1); $hidden .= HtmlInput::hidden('p_action', 'jrn'); $hidden .= HtmlInput::hidden('sa', 'add'); $hidden .= dossier::hidden(); $hidden .= HtmlInput::hidden('p_jrn_deb_max_line', 10); $hidden .= HtmlInput::hidden('p_ech_lib', 'echeance'); /* properties of the ledger */ $name = $previous_p_jrn_name; $code = ""; $wType = new ISelect(); $a_jrn = $this->db->make_array("select '-1',' -- " . _("choix du type de journal") . " -- ' union select jrn_type_id,jrn_desc from jrn_type"); $wType->selected = '-1'; $wType->value = $a_jrn; $wType->name = "p_jrn_type"; $wType->id = "p_jrn_type_select_id"; $wType->javascript = ' onchange="show_ledger_div()"'; $wType->selected = $default_type; $type = $wType->input(); $rcred = $rdeb = array(); $wPjPref = new IText(); $wPjPref->name = 'jrn_def_pj_pref'; $wPjPref->value = $previous_jrn_def_pj_pref; $pj_pref = $wPjPref->input(); $pj_seq = ''; $last_seq = 0; $new = 1; $description = new ITextarea('p_description'); $description->style = 'class="itextarea" style="margin:0px;"'; $description->value = $previous_p_description; $str_description = $description->input(); /* bank card */ $qcode_bank = ''; /* Numbering (only FIN) */ $num_op = new ICheckBox('numb_operation'); echo dossier::hidden(); echo HtmlInput::hidden('ac', $_REQUEST['ac']); echo $hidden; $cn = $this->db; $min_row = new INum("min_row", MAX_ARTICLE); $min_row->prec = 0; require_once NOALYSS_INCLUDE . '/template/param_jrn.php'; }
/** * * @param type $p_array indice * - div div name * - type ALL, VEN, ACH or ODS * - all_type 1 yes 0 no * */ static function button_choice_ledger($p_array) { extract($p_array); $bledger_param = json_encode(array('dossier' => $_REQUEST['gDossier'], 'type' => $type, 'all_type' => $all_type, 'div' => $div, 'class' => 'inner_box')); $bledger_param = str_replace('"', "'", $bledger_param); $bledger = new ISmallButton('l'); $bledger->label = _("choix des journaux"); $bledger->javascript = " show_ledger_choice({$bledger_param})"; $f_ledger = $bledger->input(); $hid_jrn = ""; if (isset($_REQUEST[$div . 'nb_jrn'])) { for ($i = 0; $i < $_REQUEST[$div . 'nb_jrn']; $i++) { if (isset($_REQUEST[$div . "r_jrn"][$i])) { $hid_jrn .= HtmlInput::hidden($div . 'r_jrn[' . $i . ']', $_REQUEST[$div . "r_jrn"][$i]); } } $hid_jrn .= HtmlInput::hidden($div . 'nb_jrn', $_REQUEST[$div . 'nb_jrn']); } else { $hid_jrn = HtmlInput::hidden($div . 'nb_jrn', 0); } echo $f_ledger; echo '<span id="ledger_id' . $div . '">'; echo $hid_jrn; echo '</span>'; }
/** *@brief show a button, if it is pushed show a popup to select the need vat *@note * - a ipopup must be created before with the name popup_tva * - the javascript scripts.js must be loaded *@return string with html code */ function dbutton() { if (trim($this->name) == '') { throw new Exception(_('Le nom ne peut être vide')); } $this->id = $this->id == "" ? $this->name : $this->id; // button $bt = new ISmallButton('bt_' . $this->id); $bt->tabindex = "-1"; $bt->label = _(' TVA '); $bt->set_attribute('gDossier', dossier::id()); $bt->set_attribute('ctl', $this->id); $bt->set_attribute('popup', 'popup_tva'); if (isset($this->code)) { $bt->set_attribute('jcode', $this->code->name); } if (isset($this->compute)) { $bt->set_attribute('compute', $this->compute); } $bt->javascript = isset($this->but_javascript) ? $this->but_javascript : 'popup_select_tva(this)'; $r = $bt->input(); return $r; }