Пример #1
0
 public function select()
 {
     $r = '';
     $array = $this->get_valide();
     $r .= HtmlInput::hidden('gDossier', dossier::id());
     if (empty($array) == false) {
         $acompte = new INum('acompte');
         $acompte->value = 0;
         $r .= _(" Acompte à déduire");
         $r .= $acompte->input();
         $r .= '<p>';
         $e_comm_paiement = new IText('e_comm_paiement');
         $e_comm_paiement->table = 0;
         $e_comm_paiement->setReadOnly(false);
         $e_comm_paiement->size = 60;
         $e_comm_paiement->tabindex = 3;
         $r .= _(" Libellé du paiement");
         $r .= $e_comm_paiement->input();
         $r .= '</p>';
     }
     $r .= '<ol>';
     $r .= '<li ><input type="radio" name="e_mp" value="0" checked>' . _('Paiement encodé plus tard');
     if (empty($array) == false) {
         foreach ($array as $row) {
             $f = '';
             /* if the qcode is  null the propose a search button to select
                the card */
             if ($row->mp_qcode == NULL) {
                 $a = new ICard();
                 $a->jrn = $row->mp_jrn_def_id;
                 $a->set_attribute('typecard', $row->mp_fd_id);
                 $a->name = 'e_mp_qcode_' . $row->mp_id;
                 $a->set_dblclick("fill_ipopcard(this);");
                 $a->set_callback('filter_card');
                 $a->set_function('fill_data');
                 $a->set_attribute('ipopup', 'ipopcard');
                 $a->set_attribute('label', $a->name . '_label');
                 $s = new ISpan();
                 $s->name = $a->name . '_label';
                 $f = _(" paiement par ") . $a->input() . $s->input();
             } else {
                 /* if the qcode is not null then add a hidden variable with
                    the qcode */
                 $fiche = new Fiche($this->cn);
                 $fiche->get_by_qcode($row->mp_qcode);
                 $f = HtmlInput::hidden('e_mp_qcode_' . $row->mp_id, $row->mp_qcode);
                 //	  $f.=$fiche->strAttribut(ATTR_DEF_NAME);
             }
             $r .= '<li><input type="radio" name="e_mp" value="' . $row->mp_id . '">';
             $r .= $row->mp_lib . '  ' . $f;
         }
     }
     $r .= '</ol>';
     return $r;
 }
Пример #2
0
 /**
  * display detail of a ledger
  *
  */
 function display_ledger()
 {
     if ($this->load() == -1) {
         throw new Exception(_("Journal n'existe pas"), -1);
     }
     $type = $this->jrn_def_type;
     $name = $this->jrn_def_name;
     $code = $this->jrn_def_code;
     $str_add_button = "";
     /* widget for searching an account */
     $wSearch = new IPoste();
     $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->table = 3;
     $wSearch->name = "p_jrn_class_deb";
     $wSearch->size = 20;
     $wSearch->value = $this->jrn_def_class_deb;
     $search = $wSearch->input();
     $wPjPref = new IText();
     $wPjPref->name = 'jrn_def_pj_pref';
     $wPjPref->value = $this->jrn_def_pj_pref;
     $pj_pref = $wPjPref->input();
     $wPjSeq = new INum();
     $wPjSeq->value = 0;
     $wPjSeq->name = 'jrn_def_pj_seq';
     $pj_seq = $wPjSeq->input();
     $last_seq = $this->get_last_pj();
     $name = $this->jrn_def_name;
     $hidden = HtmlInput::hidden('p_jrn', $this->id);
     $hidden .= HtmlInput::hidden('sa', 'detail');
     $hidden .= dossier::hidden();
     $hidden .= HtmlInput::hidden('p_jrn_deb_max_line', 10);
     $hidden .= HtmlInput::hidden('p_ech_lib', 'echeance');
     $hidden .= HtmlInput::hidden('p_jrn_type', $type);
     $min_row = new INum("min_row", $this->jrn_deb_max_line);
     $min_row->prec = 0;
     $description = new ITextarea('p_description');
     $description->style = 'class="itextarea" style="margin:0px;"';
     $description->value = $this->jrn_def_description;
     $str_description = $description->input();
     /* Load the card */
     $card = $this->get_fiche_def();
     $rdeb = explode(',', $card['deb']);
     $rcred = explode(',', $card['cred']);
     /* Numbering (only FIN) */
     $num_op = new ICheckBox('numb_operation');
     if ($this->jrn_def_num_op == 1) {
         $num_op->selected = true;
     }
     /* bank card */
     $qcode_bank = '';
     if ($type == 'FIN') {
         $f_id = $this->jrn_def_bank;
         if (isNumber($f_id) == 1) {
             $fBank = new Fiche($this->db, $f_id);
             $qcode_bank = $fBank->get_quick_code();
         }
     }
     $new = 0;
     $cn = $this->db;
     echo $hidden;
     require_once NOALYSS_INCLUDE . '/template/param_jrn.php';
 }
Пример #3
0
 function display($p_array)
 {
     global $g_parameter, $g_user;
     require_once NOALYSS_INCLUDE . '/class_acc_ledger.php';
     $legder = new Acc_Ledger($this->db, $this->jrn_def_id);
     $legder->nb = $legder->get_min_row();
     if ($p_array != null) {
         extract($p_array);
     }
     $add_js = "";
     $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', $legder->id);
         $f_add_button->javascript = " this.jrn=\$('p_jrn').value;select_card_type(this);";
         $f_add_button->input();
     }
     $nb_row = isset($nb_item) ? $nb_item : $legder->nb;
     $ret .= HtmlInput::hidden('nb_item', $nb_row);
     $ret .= HtmlInput::hidden('p_jrn', $this->jrn_def_id);
     $ret .= dossier::hidden();
     $ret .= dossier::hidden();
     $ret .= HtmlInput::hidden('jrn_type', $legder->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="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);
         $quick_code->set_attribute('jrn', $legder->id);
         // 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->jrn = $legder->id;
         $quick_code->value = isset(${'qc_' . $i}) ? ${'qc_' . $i} : "";
         $label = '';
         if ($quick_code->value != '') {
             $Fiche = new Fiche($legder->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', $legder->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();
         if ($poste->value != '') {
             $Poste = new Acc_Account($legder->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->javascript = ' onChange="format_number(this);checkTotalDirect()"';
         // D/C
         $deb = new ICheckBox();
         $deb->name = 'ck' . $i;
         $deb->selected = isset(${'ck' . $i}) ? true : false;
         $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>';
     return $ret;
 }
Пример #4
0
 function display($p_array)
 {
     require_once NOALYSS_INCLUDE . '/class_acc_ledger_purchase.php';
     global $g_parameter, $g_user;
     extract($p_array);
     $ledger = new Acc_Ledger_Purchase($this->db, $this->jrn_def_id);
     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->label = _('Créer une nouvelle fiche');
     $f_add_button->tabindex = -1;
     $f_add_button->set_attribute('ipopup', 'ipop_newcard');
     $f_add_button->set_attribute('jrn', $this->jrn_def_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', $ledger->get_all_fiche_def());
     //    $f_add_button2->set_attribute('jrn',$ledger->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();
     }
     $r = "";
     $r .= dossier::hidden();
     $f_legend = _("En-tête facture fournisseur");
     $f_legend_detail = _("Détail articles acheté");
     // Ledger (p_jrn)
     //--
     /* if we suggest the next pj, then we need a javascript */
     $add_js = "";
     // Display the customer
     //--
     $fiche = 'cred';
     // Save old value and set a new one
     //--
     $e_client = isset($e_client) ? $e_client : "";
     $e_client_label = "&nbsp;";
     //str_pad("",100,".");
     // retrieve e_client_label
     //--
     if (strlen(trim($e_client)) != 0) {
         $fClient = new Fiche($ledger->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 = _("Fournisseur ") . 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', 'cred');
     // 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
     $min = $ledger->get_min_row();
     $p_article = isset($nb_item) ? $nb_item : $min;
     $max = $p_article < $min ? $min : $p_article;
     $e_comment = isset($e_comment) ? $e_comment : "";
     $Hid = new IHidden();
     $r .= $Hid->input("nb_item", $p_article);
     // 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"} : "";
         /* use vat */
         if ($g_parameter->MY_TVA_USE == '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($ledger->db);
             $fMarch->get_by_qcode($march);
             $march_label = $fMarch->strAttribut(ATTR_DEF_NAME);
             /* vat use */
             if (!isset($march_tva_id) && $g_parameter->MY_TVA_USE == 'Y') {
                 $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_dblclick("fill_ipopcard(this);");
         $W1->set_attribute('ipopup', 'ipopcard');
         $W1->set_attribute('typecard', 'deb');
         // 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('purchase', 'e_march' . $i . '_price');
         /* autocomplete */
         $W1->set_attribute('price', 'e_march' . $i . '_price');
         /* via search */
         // 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();
         $array[$i]['hidden'] = '';
         // For computing we need some hidden field for holding the value
         if ($g_parameter->MY_TVA_USE == 'Y') {
             $array[$i]['hidden'] .= HtmlInput::hidden('tva_march' . $i, 0);
         }
         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();
         $htva = new INum('htva_march' . $i);
         $htva->readOnly = 1;
         $htva->value = 0;
         $array[$i]['htva'] = $htva->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);
         if ($g_parameter->MY_TVA_USE == 'Y') {
             // vat label
             //--
             $Tva = new ITva_Popup($ledger->db);
             $Tva->js = "onblur=\"format_number(this);onChange=clean_tva({$i});compute_ledger({$i})\"";
             $Tva->in_table = true;
             $Tva->set_attribute('compute', $i);
             $Tva->value = $march_tva_id;
             $array[$i]['tva'] = $Tva->input("e_march{$i}" . "_tva_id");
             // Tva_amount
             // price
             $Tva_amount = new INum();
             $Tva_amount->setReadOnly(false);
             $Tva_amount->size = 9;
             $Tva_amount->javascript = "onBlur='format_number(this);compute_ledger({$i})'";
             $array[$i]['amount_tva'] = $Tva_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 = 9;
         $Quantity->javascript = "onChange=format_number(this);clean_tva({$i});compute_ledger({$i})";
         $array[$i]['quantity'] = $Quantity->input("e_quant" . $i, $quant);
     }
     $f_type = _('Fournisseur');
     ob_start();
     require_once NOALYSS_INCLUDE . '/template/predf_ledger_detail.php';
     $r .= ob_get_contents();
     ob_end_clean();
     // Set correctly the REQUEST param for jrn_type
     $r .= HtmlInput::hidden('jrn_type', 'ACH');
     $r .= HtmlInput::button('add_item', _('Ajout article'), ' onClick="ledger_add_row()"');
     return $r;
 }
Пример #5
0
 function display_form_plan($p_array, $p_null, $p_mode, $p_seq, $p_amount, $p_id = '', $p_add_button = true)
 {
     if ($p_array != null) {
         extract($p_array);
     }
     $result = "";
     $plan = new Anc_Plan($this->db);
     $a_plan = $plan->get_list(" order by pa_id ");
     if (empty($a_plan)) {
         return "";
     }
     $table_id = "t" . $p_seq;
     $hidden = new IHidden();
     $readonly = $p_mode == 1 ? false : true;
     $result .= $hidden->input('amount_' . $table_id, $p_amount);
     if ($p_mode == 1) {
         $result .= '<table id="' . $p_id . $table_id . '">';
     } else {
         $result .= '<table>';
     }
     $result .= "<tr>" . $plan->header() . "<th>montant</th></tr>";
     /* compute the number of rows */
     $nb_row = isset($val[$p_seq]) ? count($val[$p_seq]) : 1;
     $count = 0;
     $remain = abs($p_amount);
     $ctrl_remain = "remain" . $this->in_div . $table_id;
     for ($i = 0; $i < $nb_row; $i++) {
         $result .= '<tr>';
         foreach ($a_plan as $r_plan) {
             $array = $this->db->make_array("select po_id as value," . " html_quote(po_name) as label from poste_analytique " . " where pa_id = " . $r_plan['id'] . " order by po_name", $p_null);
             $select = new ISelect("hplan[" . $p_seq . "][]", $array);
             $select->table = 0;
             // view only or editables
             if ($p_mode == 1) {
                 // editable
                 $select->readonly = false;
                 if (isset($hplan) && isset($hplan[$p_seq][$count])) {
                     $select->selected = $hplan[$p_seq][$count];
                 }
             } else {
                 if (isset($hplan) && isset($hplan[$p_seq][$count])) {
                     $select->selected = $hplan[$p_seq][$count];
                 }
                 // view only
                 $select->readOnly = true;
             }
             if ($p_mode == 1) {
                 $result .= '<td>' . $select->input() . '</td>';
             } else {
                 $result .= '<td>' . $select->display() . '</td>';
             }
             $count++;
         }
         $value = new INum();
         $value->javascript = 'onchange="format_number(this);anc_refresh_remain(\'' . $this->in_div . $table_id . '\',\'' . $p_seq . '\')"';
         $value->name = "val[" . $p_seq . "][]";
         $value->size = 6;
         $value->value = isset($val[$p_seq][$i]) ? $val[$p_seq][$i] : abs($p_amount);
         $value->readOnly = $p_mode == 1 ? false : true;
         $remain = bcsub($remain, $value->value);
         $result .= '<td>' . $value->input() . '</td>';
         $result .= "</tr>";
     }
     $result .= "</table>";
     if ($p_add_button && $p_mode == 1) {
         $style_remain = $remain == 0 ? 'style="color:green"' : ' style="color:red"';
         $result .= " Reste à imputer =  " . '<span class="remain" ' . $style_remain . ' id="' . $ctrl_remain . '">' . $remain . '</span>';
         // add a button to add a row
         $button = new IButton();
         $button->javascript = "add_row('" . $p_id . "{$table_id}',{$p_seq});";
         $button->name = "js" . $p_id . $p_seq;
         $button->label = _("Nouvelle ligne");
         $result .= "<br>" . $button->input();
         /**
          * Add a button for distribution key
          * 
          */
         $ledger = HtmlInput::default_value_post("p_jrn", 0);
         if ($ledger == 0) {
             $ledger = $this->db->get_value('select j_jrn_def from jrnx where j_id=$1', array($this->j_id));
         }
         $gDossier = Dossier::id();
         $button_key = new IButton();
         $button_key->javascript = "anc_key_choice(" . $gDossier . ",'" . $p_id . "{$table_id}',{$p_amount},'" . $ledger . "');";
         $button_key->name = "js" . $p_id . $p_seq;
         $button_key->label = _("Clef");
         $result .= $button_key->input();
     }
     return $result;
 }
Пример #6
0
 * \brief display or save a periode
 * variable received $op, $cn $g_user
 */
$err = 0;
$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\')"');
 function form($p_readonly = 0)
 {
     $wDate = new IDate("pdate", $this->date);
     $wDate->table = 1;
     $wDate->size = 10;
     $wDate->readonly = $p_readonly;
     $wDescription = new IText("pdesc");
     $wDescription->table = 0;
     $wDescription->size = 80;
     $wDescription->readonly = $p_readonly;
     // Show an existing operation
     //
     if (isset($this->a_operation[0])) {
         $wDate->value = $this->a_operation[0]->oa_date;
         $wDescription->value = $this->a_operation[0]->oa_description;
     }
     $ret = "";
     $ret .= '<table style="result"	>';
     $ret .= "<TR>" . $wDate->input() . "</tr>";
     $ret .= '<tr><td>Description</td>' . '<td colspan="3">' . $wDescription->input() . "</td></tr>";
     $Plan = new Anc_Plan($this->db);
     $aPlan = $Plan->get_list();
     $max = count($this->a_operation) < $this->nMaxRow ? $this->nMaxRow : count($this->a_operation);
     $ret .= '</table><table  id="ago" style="width: 100%;">';
     /* show 10 rows */
     $ret .= "<tr>";
     foreach ($aPlan as $d) {
         $idx = $d['id'];
         /* array of possible value for the select */
         $aPoste[$idx] = $this->db->make_array("select po_id as value," . " po_name||':'||coalesce(po_description,'-') as label " . " from poste_analytique " . " where pa_id = " . $idx . " order by po_name ");
         $ret .= "<th> Poste </th>";
     }
     $ret .= "<th></th>" . "<th> Montant</th>" . "<th>D&eacute;bit</th>" . "</tr>";
     for ($i = 0; $i < $max; $i++) {
         $ret .= "<tr>";
         foreach ($aPlan as $d) {
             $idx = $d['id'];
             // init variable
             $wSelect = new ISelect("pop" . $i . "plan" . $idx);
             $wSelect->value = $aPoste[$idx];
             $wSelect->size = 12;
             $wSelect->readOnly = $p_readonly;
             if (isset($this->a_operation[$i])) {
                 $wSelect->selected = $this->a_operation[$i]->po_id;
             }
             $ret .= td($wSelect->input());
         }
         $wAmount = new INum("pamount{$i}", 0.0);
         $wAmount->size = 12;
         $wAmount->table = 1;
         $wAmount->javascript = " onChange=format_number(this);caod_checkTotal()";
         $wAmount->readOnly = $p_readonly;
         $wDebit = new ICheckBox("pdeb{$i}");
         $wDebit->readOnly = $p_readonly;
         $wDebit->javascript = " onChange=caod_checkTotal()";
         if (isset($this->a_operation[$i])) {
             $wSelect->selected = $this->a_operation[$i]->po_id;
             $wAmount->value = $this->a_operation[$i]->oa_amount;
             $wDebit->value = $this->a_operation[$i]->oa_debit;
             if ($wDebit->value == 't') {
                 $wDebit->selected = true;
             }
         }
         // build the table
         $ret .= "<TD></TD>";
         $ret .= $wAmount->input();
         $ret .= td($wDebit->input());
         $ret .= "</tr>";
     }
     $ret .= "</table>";
     if ($p_readonly == false) {
         $add_row = new IButton('Ajouter');
         $add_row->label = _('Ajouter une ligne');
         $add_row->javascript = 'anc_add_row(\'ago\');';
         $ret .= HtmlInput::hidden('nbrow', $max);
         $ret .= $add_row->input();
     }
     return $ret;
 }
Пример #8
0
echo '<form method="post" id="rec1">';
echo dossier::hidden();
echo HtmlInput::get_to_hidden(array('sa', 'p_action', 'p_jrn'));
$operation = $cn->get_array("select jr_id,jr_internal,\n\t\t\t\t\t\t\t\tjr_comment,\n\t\t\t\t\t\t\t\tto_char(jr_date,'DD.MM.YYYY') as fmt_date,\n\t\t\t\t\t\t\t\tjr_montant,\n\t\t\t\t\t\t\t\tto_char(jr_date,'YYYYMMDD') as raw_date\n                              from jrn where jr_def_id=\$1 and (jr_pj_number is null or jr_pj_number='') order by jr_date", array($Ledger->id));
echo '<p>';
$iextrait = new IText('ext');
if (isset($_POST['ext'])) {
    $iextrait->value = $_POST['ext'];
} else {
    $iextrait->value = $Ledger->guess_pj();
}
$nstart_extrait = new INum('start_extrait');
if (isset($_POST['start_extrait'])) {
    $nstart_extrait->value = $_POST['start_extrait'];
}
$nend_extrait = new INum('end_extrait');
if (isset($_POST['end_extrait'])) {
    $nend_extrait->value = $_POST['end_extrait'];
}
echo "Extrait / relevé :" . $iextrait->input();
echo 'solde Début' . $nstart_extrait->input();
echo 'solde Fin' . $nend_extrait->input();
echo IButton::tooggle_checkbox('rec1');
echo '</p>';
echo '<p>';
echo _('Filtre') . HtmlInput::infobulle(25);
echo HtmlInput::filter_table("t_rec_bk", "0,1,2,3", "1");
echo '</p>';
echo HtmlInput::submit('save', 'Mettre à jour le n° de relevé bancaire');
echo '<span style="display:block">';
echo '</span>';
Пример #9
0
            $percent = $a_percent[$j];
        }
        $select->selected = $selected;
        ?>
                        <td>
                            <?php 
        echo $select->input();
        ?>
                
                        </td>
                        <?php 
    }
    ?>
                        <td class="num">
                        <?php 
    $inum_percent = new INum('percent[]');
    $inum_percent->javascript = ' onchange="format_number(this,2);anc_key_compute_table();"';
    $inum_percent->value = sprintf("%.2f", $percent);
    echo $inum_percent->input();
    ?>
                    </td>
                </tr>
                <?php 
}
?>
                <tfoot style="font-weight: bolder">
                    <tr>
                        <td style="width: auto" colspan="<?php 
echo count($plan) + 1;
?>
">
Пример #10
0
 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&eacute;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&eacute;e</TD>' : '<TD>Ferm&eacute;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&eacute;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>';
     }
 }
Пример #11
0
 /**
  * \brief Display the object, the tags for the FORM
  *        are in the caller. It will be used for adding and updating
  *        action
  * \note  If  ag_id is not equal to zero then it is an update otherwise
  *        it is a new document
  *
  * \param $p_view form will be in readonly mode (value: READ, UPD or NEW  )
  * \param $p_gen true we show the tag for generating a doc (value : true or false) and adding files
  * \param $p_base is the ac parameter
  * \param $retour is the html code for the return button
  * \note  update the reference number or the document type is not allowed
  *
  *
  * \return string containing the html code
  */
 function Display($p_view, $p_gen, $p_base, $retour = "")
 {
     global $g_user;
     if ($p_view == 'UPD') {
         $upd = true;
         $readonly = false;
     } elseif ($p_view == "NEW") {
         $upd = false;
         $readonly = false;
         $this->ag_ref = _("Nouveau");
     } elseif ($p_view == 'READ') {
         $upd = true;
         $readonly = true;
     } else {
         throw new Exception('class_action' . __LINE__ . 'Follow_Up::Display error unknown parameter' . $p_view);
     }
     // Compute the widget
     // Date
     $date = new IDate();
     $date->readOnly = $readonly;
     $date->name = "ag_timestamp";
     $date->id = "ag_timestamp";
     $date->value = $this->ag_timestamp;
     $remind_date = new IDate();
     $remind_date->readOnly = $readonly;
     $remind_date->name = "ag_remind_date";
     $remind_date->id = "ag_remind_date";
     $remind_date->value = $this->ag_remind_date;
     // Doc Type
     $doc_type = new ISelect();
     $doc_type->name = "dt_id";
     $doc_type->value = $this->db->make_array("select dt_id,dt_value from document_type order by dt_value", 1);
     $doc_type->selected = $this->dt_id;
     $doc_type->readOnly = $readonly;
     $str_doc_type = $doc_type->input();
     // Description
     $desc = new ITextArea();
     $desc->style = ' class="itextarea" style="width:80%;margin-left:0px"';
     $desc->name = "ag_comment";
     $desc->readOnly = $readonly;
     $acomment = $this->db->get_array("SELECT agc_id, ag_id, to_char(agc_date,'DD.MM.YYYY HH24:MI') as str_agc_date, agc_comment, tech_user\n\t\t\t\t FROM action_gestion_comment where ag_id=\$1 order by agc_id;", array($this->ag_id));
     // List opération liées
     $operation = $this->db->get_array("select ago_id,j.jr_id,j.jr_internal,j.jr_comment,to_char(j.jr_date,'DD.MM.YY') as str_date\n\t\t\tfrom jrn as j join action_gestion_operation as ago on (j.jr_id=ago.jr_id)\n\t\t\twhere ag_id=\$1 order by jr_date", array($this->ag_id));
     $iconcerned = new IConcerned('operation');
     // List related action
     $action = $this->db->get_array("\n\t\t\tselect ag_id,ag_ref,substr(ag_title,1,40) as sub_title,to_char(ag_timestamp,'DD.MM.YY') as str_date ,\n\t\t\t\tag_timestamp,dt_value\n\t\t\t\t\tfrom action_gestion\n\t\t\t\t\t join document_type on (ag_type=dt_id)\n\t\t\t\twhere\n\t\t\t\tag_id in (select aga_greatest from action_gestion_related where aga_least =\$1)\n\t\t\t\tor\n\t\t\t\tag_id in (select aga_least from action_gestion_related where aga_greatest =\$1)\n\t\t\t\torder by ag_timestamp", array($this->ag_id));
     $iaction = new IRelated_Action('action');
     $iaction->value = isset($this->action) ? $this->action : "";
     // state
     // Retrieve the value
     $a = $this->db->make_array("select s_id,s_value from document_state ");
     $state = new ISelect();
     $state->readOnly = $readonly;
     $state->name = "ag_state";
     $state->value = $a;
     $state->selected = $this->ag_state;
     $str_state = $state->input();
     // Retrieve the value if there is an attached doc
     $doc_ref = "";
     // Document id
     $h2 = new IHidden();
     $h2->name = "d_id";
     $h2->value = $this->d_id;
     if ($this->d_id != 0 && $this->d_id != "") {
         $h2->readonly = $p_view == 'NEW' ? false : true;
         $doc = new Document($this->db, $this->d_id);
         $doc->get();
         if (strlen(trim($doc->d_lob)) != 0) {
             $d_id = new IHidden();
             $doc_ref = "<p> Document " . $doc->anchor() . '</p>';
             $doc_ref .= $h2->input() . $d_id->input('d_id', $this->d_id);
         }
     }
     // title
     $title = new IText();
     $title->readOnly = $readonly;
     $title->name = "ag_title";
     $title->value = $this->ag_title;
     $title->size = 60;
     // Priority of the ag_priority
     $ag_priority = new ISelect();
     $ag_priority->readOnly = $readonly;
     $ag_priority->name = "ag_priority";
     $ag_priority->selected = $this->ag_priority;
     $ag_priority->value = array(array('value' => 1, 'label' => 'Haute'), array('value' => 2, 'label' => 'Moyenne'), array('value' => 3, 'label' => 'Basse'));
     $str_ag_priority = $ag_priority->input();
     // hour of the action (meeting) ag_hour
     $ag_hour = new IText();
     $ag_hour->readOnly = $readonly;
     $ag_hour->name = "ag_hour";
     $ag_hour->value = $this->ag_hour;
     $ag_hour->size = 6;
     $ag_hour->javascript = " onblur=check_hour('ag_hour');";
     $str_ag_hour = $ag_hour->input();
     // Profile in charged of the action
     $ag_dest = new ISelect();
     $ag_dest->readOnly = $readonly;
     $ag_dest->name = "ag_dest";
     // select profile
     $aAg_dest = $this->db->make_array("select  p_id as value, " . "p_name as label " . " from profile  where p_id in (select p_granted from user_sec_action_profile where ua_right='W' and p_id=" . $g_user->get_profile() . ") order by 2");
     $ag_dest->value = $aAg_dest;
     $ag_dest->selected = $this->ag_dest;
     $str_ag_dest = $ag_dest->input();
     // ag_ref
     // Always false for update
     $client_label = new ISpan();
     /* 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');
     $filter = $this->db->make_list('select fd_id from fiche_def ');
     $f_add_button->set_attribute('filter', $filter);
     $f_add_button->javascript = " select_card_type(this);";
     $str_add_button = $f_add_button->input();
     // f_id_dest sender
     if ($this->qcode_dest != NOTFOUND && strlen(trim($this->qcode_dest)) != 0) {
         $tiers = new Fiche($this->db);
         $tiers->get_by_qcode($this->qcode_dest);
         $qcode_dest_label = $tiers->strAttribut(1);
         $this->f_id_dest = $tiers->id;
     } else {
         $qcode_dest_label = $this->f_id_dest == 0 || trim($this->qcode_dest) == "" ? 'Interne ' : 'Error';
     }
     $h_ag_id = new IHidden();
     // if concerns another action : show the link otherwise nothing
     //
     // sender
     $w = new ICard();
     $w->readOnly = $readonly;
     $w->jrn = 0;
     $w->name = 'qcode_dest';
     $w->value = $this->f_id_dest != 0 ? $this->qcode_dest : "";
     $w->label = "";
     $list_recipient = $this->db->make_list('select fd_id from fiche_def where frd_id in (14,25,8,9,16)');
     $w->extra = $list_recipient;
     $w->set_attribute('typecard', $list_recipient);
     $w->set_dblclick("fill_ipopcard(this);");
     $w->set_attribute('ipopup', 'ipopcard');
     // name of the field to update with the name of the card
     $w->set_attribute('label', 'qcode_dest_label');
     // name of the field to update with the name of the card
     $w->set_attribute('typecard', $w->extra);
     $w->set_function('fill_data');
     $w->javascript = sprintf(' onchange="fill_data_onchange(\'%s\');" ', $w->name);
     $sp = new ISpan();
     $sp->name = 'qcode_dest_label';
     $sp->value = $qcode_dest_label;
     // autre - a refaire pour avoir plusieurs fiches
     // Sur le modèle des tags
     $ag_contact = new ICard();
     $ag_contact->readOnly = $readonly;
     $ag_contact->jrn = 0;
     $ag_contact->name = 'ag_contact';
     $ag_contact->value = '';
     $ag_contact->set_attribute('ipopup', 'ipopcard');
     if ($this->ag_contact != 0) {
         $contact = new Fiche($this->db, $this->ag_contact);
         $ag_contact->value = $contact->get_quick_code();
     }
     $ag_contact->label = "";
     $list_contact = $this->db->make_list('select fd_id from fiche_def where frd_id=16');
     $ag_contact->extra = $list_contact;
     $ag_contact->set_dblclick("fill_ipopcard(this);");
     // name of the field to update with the name of the card
     $ag_contact->set_attribute('label', 'ag_contact_label');
     // name of the field to update with the name of the card
     $ag_contact->set_attribute('typecard', $list_contact);
     $ag_contact->set_function('fill_data');
     $ag_contact->javascript = sprintf(' onchange="fill_data_onchange(\'%s\');" ', $ag_contact->name);
     $spcontact = new ISpan();
     $spcontact->name = 'ag_contact_label';
     $spcontact->value = '';
     $fiche_contact = new Fiche($this->db);
     $fiche_contact->get_by_qcode($this->ag_contact);
     if ($fiche_contact->id != 0) {
         $spcontact->value = $fiche_contact->strAttribut(ATTR_DEF_NAME);
     }
     $h_agrefid = new IHidden();
     $iag_ref = new IText("ag_ref");
     $iag_ref->value = $this->ag_ref;
     $iag_ref->readOnly = $p_view == "NEW" || $p_view == 'READ' ? true : false;
     $str_ag_ref = $iag_ref->input();
     // Preparing the return string
     $r = "";
     /* for new files */
     $upload = new IFile();
     $upload->name = "file_upload[]";
     $upload->readOnly = $readonly;
     $upload->value = "";
     $aAttachedFile = $this->db->get_array('select d_id,d_filename,d_description,d_mimetype,' . '\'show_document.php?' . Dossier::get() . '&d_id=\'||d_id as link' . ' from document where ag_id=$1', array($this->ag_id));
     /* create the select for document */
     $aDocMod = new ISelect();
     $aDocMod->name = 'doc_mod';
     $aDocMod->value = $this->db->make_array('select md_id,dt_value||\' : \'||md_name as md_name' . ' from document_modele join document_type on (md_type=dt_id)' . ' order by md_name');
     $str_select_doc = $aDocMod->input();
     /* if no document then do not show the generate button */
     if (empty($aDocMod->value)) {
         $str_submit_generate = "";
     } else {
         $str_submit_generate = HtmlInput::submit("generate", _("Génére le document"));
     }
     $ag_id = $this->ag_id;
     /* fid = Icard  */
     $icard = new ICard();
     $icard->jrn = 0;
     $icard->table = 0;
     $icard->extra2 = 'QuickCode';
     $icard->noadd = "no";
     $icard->extra = 'all';
     /* Text desc  */
     $text = new IText();
     $num = new INum();
     /* TVA */
     $itva = new ITva_Popup($this->db);
     $itva->in_table = true;
     $aCard = array();
     /* create aArticle for the detail section */
     $article_count = count($this->aAction_detail) == 0 ? MAX_ARTICLE : count($this->aAction_detail);
     /* Compute total */
     $tot_item = 0;
     $tot_vat = 0;
     for ($i = 0; $i < $article_count; $i++) {
         /* fid = Icard  */
         $icard = new ICard();
         $icard->jrn = 0;
         $icard->table = 0;
         $icard->noadd = "no";
         $icard->extra = 'all';
         $icard->name = "e_march" . $i;
         $tmp_ad = isset($this->aAction_detail[$i]) ? $this->aAction_detail[$i] : false;
         $icard->readOnly = $readonly;
         $icard->value = '';
         $aCard[$i] = 0;
         if ($tmp_ad) {
             $march = new Fiche($this->db);
             $f = $tmp_ad->get_parameter('qcode');
             if ($f != 0) {
                 $march->id = $f;
                 $icard->value = $march->get_quick_code();
                 $aCard[$i] = $f;
             }
         }
         $icard->set_dblclick("fill_ipopcard(this);");
         // name of the field to update with the name of the card
         $icard->set_attribute('label', "e_march" . $i . "_label");
         // name of the field to update with the name of the card
         $icard->set_attribute('typecard', $icard->extra);
         $icard->set_attribute('ipopup', 'ipopcard');
         $icard->set_function('fill_data');
         $icard->javascript = sprintf(' onchange="fill_data_onchange(\'%s\');" ', $icard->name);
         $aArticle[$i]['fid'] = $icard->search() . $icard->input();
         $text->javascript = ' onchange="clean_tva(' . $i . ');compute_ledger(' . $i . ')"';
         $text->css_size = "100%";
         $text->name = "e_march" . $i . "_label";
         $text->id = "e_march" . $i . "_label";
         $text->size = 40;
         $text->value = $tmp_ad ? $tmp_ad->get_parameter('text') : "";
         $text->readOnly = $readonly;
         $aArticle[$i]['desc'] = $text->input();
         $num->javascript = ' onchange="format_number(this);clean_tva(' . $i . ');compute_ledger(' . $i . ')"';
         $num->name = "e_march" . $i . "_price";
         $num->id = "e_march" . $i . "_price";
         $num->size = 8;
         $num->readOnly = $readonly;
         $num->value = $tmp_ad ? $tmp_ad->get_parameter('price_unit') : 0;
         $aArticle[$i]['pu'] = $num->input();
         $num->name = "e_quant" . $i;
         $num->id = "e_quant" . $i;
         $num->size = 8;
         $num->value = $tmp_ad ? $tmp_ad->get_parameter('quantity') : 0;
         $aArticle[$i]['quant'] = $num->input();
         $itva->name = 'e_march' . $i . '_tva_id';
         $itva->id = 'e_march' . $i . '_tva_id';
         $itva->value = $tmp_ad ? $tmp_ad->get_parameter('tva_id') : 0;
         $itva->readOnly = $readonly;
         $itva->js = ' onchange="format_number(this);clean_tva(' . $i . ');compute_ledger(' . $i . ')"';
         $itva->set_attribute('compute', $i);
         $aArticle[$i]['tvaid'] = $itva->input();
         $num->name = "e_march" . $i . "_tva_amount";
         $num->id = "e_march" . $i . "_tva_amount";
         $num->value = $tmp_ad ? $tmp_ad->get_parameter('tva_amount') : 0;
         $num->javascript = " onchange=\"compute_ledger('" . $i . " ')\"";
         $num->size = 8;
         $aArticle[$i]['tva'] = $num->input();
         $tot_vat = bcadd($tot_vat, $num->value);
         $num->name = "tvac_march" . $i;
         $num->id = "tvac_march" . $i;
         $num->value = $tmp_ad ? $tmp_ad->get_parameter('total') : 0;
         $num->size = 8;
         $aArticle[$i]['tvac'] = $num->input();
         $tot_item = bcadd($tot_item, $num->value);
         $aArticle[$i]['hidden_htva'] = HtmlInput::hidden('htva_march' . $i, 0);
         $aArticle[$i]['hidden_tva'] = HtmlInput::hidden('tva_march' . $i, 0);
         $aArticle[$i]['ad_id'] = $tmp_ad ? HtmlInput::hidden('ad_id' . $i, $tmp_ad->get_parameter('id')) : HtmlInput::hidden('ad_id' . $i, 0);
     }
     /* Add the needed hidden values */
     $r .= dossier::hidden();
     /* add the number of item */
     $Hid = new IHidden();
     $r .= $Hid->input("nb_item", $article_count);
     $r .= HtmlInput::request_to_hidden(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"));
     $a_tag = $this->tag_get();
     $menu = new Default_Menu();
     /* get template */
     ob_start();
     require 'template/detail-action.php';
     $content = ob_get_contents();
     ob_end_clean();
     $r .= $content;
     //hidden
     $r .= "<p>";
     $r .= $h2->input();
     $r .= $h_ag_id->input('ag_id', $this->ag_id);
     $hidden2 = new IHidden();
     $r .= $hidden2->input('f_id_dest', $this->f_id_dest);
     $r .= "</p>";
     return $r;
 }
Пример #12
0
 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 = "&nbsp;";
     //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;
 }
Пример #13
0
 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;
 }
Пример #14
0
/*!
 *\note  With PSQL sequence , the last_value column is 1 when before   AND after the first call, to make the difference between them
 * I have to check whether the sequence has been already called or not */
if ($ret[0]['is_called'] == 'f') {
    $last--;
}
echo $last;
?>
  </td>
  <tr>
  <td><?php 
echo _('Prochain numéro');
?>
	  <?php 
echo HtmlInput::infobulle(15);
?>
  </td>
   <td>
	  <?php 
$seq = new INum('seq', 0);
echo $seq->input();
?>
  </td>
</tr>

</table>

  <?php 
echo HtmlInput::submit("save", _('Sauver'));
?>
</form>
Пример #15
0
 if (isset($_REQUEST['acc'])) {
     $r .= HtmlInput::hidden('acc', $_REQUEST['acc']);
 }
 $r .= HtmlInput::hidden('j_id', $j_id);
 $r .= HtmlInput::hidden('op', $op);
 $r .= HtmlInput::hidden('ot', $ot);
 $r .= '<table>';
 //min amount
 $line = td(_('Montant min. '));
 $min = new INum('min_amount');
 $min->value = isset($min_amount) ? $min_amount : $row['j_montant'];
 $min_amount = isset($min_amount) ? $min_amount : $row['j_montant'];
 $line .= td($min->input());
 // max amount
 $line .= td(_('Montant max. '));
 $max = new INum('max_amount');
 $max->value = isset($max_amount) ? $max_amount : $row['j_montant'];
 $max_amount = isset($max_amount) ? $max_amount : $row['j_montant'];
 $line .= td($max->input());
 $r .= tr($line);
 $date_error = "";
 // start date
 $start = new IDate('search_start');
 /*  check if date are valid */
 if (isset($search_start) && isDate($search_start) == null) {
     ob_start();
     alert(_('Date malformée'));
     $date_error = ob_get_contents();
     ob_end_clean();
     $search_start = $first_per->first_day();
 }
Пример #16
0
    if ($p_level == 0) {
        // There is no dependency
        // Menu which can be added
        $ame_code = $cn->make_array("\nselect me_code,me_code||' '||coalesce(me_menu,'')||' '||coalesce(me_description,'')\n\t||'('|| case when me_type='SP' then 'Special'\n\t\twhen me_type='PL' then 'Plugin'\n\t\twhen me_type='ME' and me_file is null and me_javascript is null and me_url is null then 'Module - Menu principal'\n\t\twhen me_type='ME' then 'Menu'\n\t\telse\n\t\tme_type\n\t\tend||')'\n\tfrom\n\tmenu_ref\n        where\n        me_type<>'PR'\n\torder by 1\n\t");
    } elseif ($p_level == 1) {
        // dependency is in dep
        // Menu which can be added
        $ame_code = $cn->make_array("\nselect me_code,me_code||' '||coalesce(me_menu,'')||' '||coalesce(me_description,'')\n\t||'('|| case when me_type='SP' then 'Special'\n\t\twhen me_type='PL' then 'Plugin'\n\t\twhen me_type='ME' and me_file is null and me_javascript is null and me_url is null then 'Module - Menu principal'\n\t\twhen me_type='ME' then 'Menu'\n\t\telse\n\t\tme_type\n\t\tend||')'\n\tfrom\n\tmenu_ref\n        where\n        me_type<>'PR'\n\torder by 1\n\t");
    } elseif ($p_level == 2) {
        // menu can *NOT* have submenu
        // Menu which can be added
        $ame_code = $cn->make_array("\nselect me_code,me_code||' '||coalesce(me_menu,'')||' '||coalesce(me_description,'')\n\t||'('|| case when me_type='SP' then 'Special'\n\t\twhen me_type='PL' then 'Plugin'\n\t\twhen me_type='ME' and me_file is null and me_javascript is null and me_url is null then 'Module - Menu principal'\n\t\twhen me_type='ME' then 'Menu'\n\t\telse\n\t\tme_type\n\t\tend||')'\n\tfrom\n\tmenu_ref\n        where\n        me_type<>'PR' and\n       (\n          coalesce(me_file,'') <> '' or\n          coalesce(me_url,'') <> '' or\n          coalesce(me_javascript,'') <> ''\n        )\n\torder by 1\n\t");
    } else {
        throw new Exception('LEVEL ERROR');
    }
    $p_order = new INum("p_order", "10");
    $me_code = new ISelect('me_code');
    $me_code->value = $ame_code;
    $pm_default = new ICheckBox('pm_default');
    echo HtmlInput::title_box(_("Nouveau"), $ctl);
    ?>
    <form method="POST" id="menu_new_frm" onsubmit="return confirm_box('menu_new_frm','<?php 
    echo _('Vous confirmez');
    ?>
 ?')">
        <?php 
    echo HtmlInput::hidden('tab', 'profile_menu_div');
    ?>
        <?php 
    echo HtmlInput::hidden('p_id', $p_id);
    ?>
Пример #17
0
 /**
  *@brief display a form for modifying or add a forecast
  *@return HTML code
  */
 public function form_item()
 {
     $forecast = new Forecast($this->cn, $this->f_id);
     $forecast->load();
     $str_name = $forecast->get_parameter('name');
     $str_start = $forecast->get_parameter('start_date');
     $str_end = $forecast->get_parameter('end_date');
     $r = "";
     $str_action = _("Elements");
     $cat = new Forecast_Cat($this->cn);
     $array = $cat->make_array($this->f_id);
     $periode = new Periode($this->cn);
     $aPeriode = $this->cn->make_array("select p_id,to_char(p_start,'MM.YYYY') as label from parm_periode\n                                  where p_start >= (select p_start from parm_periode where p_id={$str_start})\n                                   and p_end <= (select p_end from parm_periode where p_id={$str_end})\n\t\t\t\t   order by p_start");
     $aPeriode[] = array('value' => 0, 'label' => 'Mensuel');
     $value = $this->cn->get_array("select fi_id,fi_text,fi_account,fi_card,fc_id,fi_amount,fi_debit,fi_pid " . " from forecast_item " . " \twhere fc_id in (select fc_id from forecast_cat where f_id = \$1)", array($this->f_id));
     $max = count($value) < MAX_FORECAST_ITEM ? MAX_FORECAST_ITEM : count($value);
     $r .= HtmlInput::hidden('nbrow', $max);
     for ($i = 0; $i < $max; $i++) {
         if (isset($value[$i]['fi_id'])) {
             $r .= HtmlInput::hidden('fi_id' . $i, $value[$i]['fi_id']);
         }
         /* category*/
         $category = new ISelect();
         $category->name = 'an_cat' . $i;
         $category->value = $array;
         $category->selected = isset($value[$i]["fc_id"]) ? $value[$i]["fc_id"] : -1;
         $aCat[$i]['cat'] = $category->input();
         /* amount 	 */
         $amount = new INum('an_cat_amount' . $i);
         $amount->value = isset($value[$i]["fi_amount"]) ? $value[$i]["fi_amount"] : 0;
         $aCat[$i]['amount'] = $amount->input();
         /* Accounting*/
         $account = new IPoste('an_cat_acc' . $i);
         $account->set_attribute('ipopup', 'ipop_account');
         //            $account->set_attribute('label','an_label'.$i);
         $account->set_attribute('account', 'an_cat_acc' . $i);
         $account->set_attribute('bracket', 1);
         $account->set_attribute('no_overwrite', 1);
         $account->set_attribute('noquery', 1);
         $account->css_size = "85%";
         $account->value = isset($value[$i]["fi_account"]) ? $value[$i]["fi_account"] : "";
         $aCat[$i]['account'] = $account->input();
         /*Quick Code */
         $qc = new ICard('an_qc' . $i);
         // If double click call the javascript fill_ipopcard
         $qc->set_dblclick("fill_ipopcard(this);");
         // This attribute is mandatory, it is the name of the IPopup
         $qc->set_attribute('ipopup', 'ipopcard');
         // name of the field to update with the name of the card
         $qc->set_attribute('label', 'an_label' . $i);
         // Type of card : all
         $qc->set_attribute('typecard', 'all');
         $qc->set_attribute('jrn', 0);
         $qc->extra = 'all';
         // when value selected in the autcomplete
         $qc->set_function('fill_data');
         if (isset($value[$i]["fi_card"])) {
             $f = new Fiche($this->cn, $value[$i]["fi_card"]);
             $qc->value = $f->strAttribut(ATTR_DEF_QUICKCODE);
         }
         $aCat[$i]['qc'] = $qc->search() . $qc->input();
         /* Label */
         $label = new IText('an_label' . $i);
         $label->value = isset($value[$i]["fi_text"]) ? $value[$i]["fi_text"] : "";
         $aCat[$i]['name'] = $label->input();
         //Deb or Cred
         $deb = new ISelect('an_deb' . $i);
         $deb->selected = isset($value[$i]["fi_debit"]) ? $value[$i]["fi_debit"] : -1;
         $deb->value = array(array('value' => 'D', 'label' => _('Débit')), array('value' => 'C', 'label' => _('Crédit')));
         $aCat[$i]['deb'] = $deb->input();
         //Periode
         $isPeriode = new ISelect('month' . $i);
         $isPeriode->value = $aPeriode;
         $isPeriode->selected = isset($value[$i]["fi_pid"]) ? $value[$i]["fi_pid"] : 0;
         $aCat[$i]['per'] = $isPeriode->input();
     }
     $add_row = new IButton('add_row');
     $add_row->label = _('Ajouter une ligne');
     $add_row->javascript = 'for_add_row(\'fortable\')';
     $f_add_row = $add_row->input();
     ob_start();
     require_once NOALYSS_INCLUDE . '/template/forecast-detail.php';
     $r .= ob_get_contents();
     ob_end_clean();
     return $r;
 }
Пример #18
0
            }
        }
        $cn->commit();
    } catch (Exception $e) {
        alert($e->getMessage());
        $cn->rollback();
    }
}
/* show list of existing */
$gDossier = dossier::id();
$array = $fa->seek();
$select_type = new ISelect('type[]');
$select_type->table = 0;
$desc = new IText('desc[]');
$desc->size = 50;
$size = new INum('size[]');
$size->size = 5;
$extra = new IText('extra[]');
$select_type->value = array(array('value' => 'text', 'label' => _('Texte')), array('value' => 'numeric', 'label' => _('Nombre')), array('value' => 'date', 'label' => _('Date')), array('value' => 'zone', 'label' => _('Zone de texte')), array('value' => 'poste', 'label' => _('Poste Comptable')), array('value' => 'card', 'label' => _('Fiche')), array('value' => 'select', 'label' => _('Selection')));
echo '<div class="content">';
echo '<form method="post">';
echo HtmlInput::hidden('sa', 'fat');
echo HtmlInput::hidden('p_action', 'divers');
echo '<table id="tb_rmfa">';
echo '<tr>';
echo th(_("id"));
echo th(_("Description"));
echo th(_("Type"));
echo th(_("Taille"));
echo th(_("Paramètre"));
echo '</tr>';
Пример #19
0
?>
</td>
				<td>
					<?php 
echo $osag_ref->input();
?>
				</td>
			</tr>
			<tr>
				<td style="width:180px;text-align:right"> <?php 
echo _("Numéro document");
?>
</td>
				<td>
					<?php 
$num = new INum('ag_id');
echo $num->input();
?>
				</td>
			</tr>
			<tr>
				<td style="width:180px;text-align:right"><?php 
echo _('Destinataire');
?>
</td>
				<?php 
$label = $w->id . "_label";
?>
				<td ><?php 
echo $w->input() . $w->search();
?>
Пример #20
0
        $last--;
    }
}
echo $last;
?>
</td>
</tr>
<tr>
<td>
<?php 
echo _("Redémarrer la séquence (laisser à 0 pour ne pas changer)");
?>
</td>
<td>
<?php 
$pj = new INum('seq');
$pj->value = 0;
echo $pj->input();
?>
</td>
</tr>

</table>
<?php 
echo HtmlInput::hidden('p_action', 'document');
echo dossier::hidden();
echo HtmlInput::hidden('sa', 'mod_template');
echo HtmlInput::hidden('id', $doc->md_id);
echo HtmlInput::submit("mod", _('Sauver'));
?>
</form>
Пример #21
0
 function form()
 {
     $r = '';
     $wName = new IText("po_name", $this->name);
     $wAmount = new INum("po_amount", $this->amount);
     $wDescription = new IText("po_description", $this->description);
     $aGroup_analytic = $this->db->make_array("select ga_id,ga_id from groupe_analytique where pa_id=" . $this->pa_id, 1);
     if (count($aGroup_analytic) > 1) {
         $wGa_id = new ISelect("ga_id");
         $wGa_id->value = $aGroup_analytic;
         $wGa_id->selected = $this->ga_id;
         $wGa_id->table = 1;
     } else {
         $wGa_id = new ISpan();
     }
     $pa = new Anc_Plan($this->db, $this->pa_id);
     $pa->get();
     $wPaName = new IText("", $pa->name);
     $wPaName->table = 1;
     $wPaName->readOnly = true;
     $wName->table = 1;
     $wAmount->table = 1;
     $wDescription->table = 1;
     $r .= HtmlInput::hidden("pa_id", $this->pa_id);
     $r .= HtmlInput::hidden("po_id", $this->id);
     $r .= "<table>";
     $r .= "<tr>";
     $r .= td(_('Nom'));
     $r .= $wName->input();
     $r .= "</tr>";
     $r .= "<tr>";
     $r .= td(_('Montant'));
     $r .= $wAmount->input();
     $r .= "</tr>";
     $r .= "<tr>";
     $r .= td(_('Description'));
     $r .= $wDescription->input();
     $r .= "</tr>";
     $r .= "<tr>";
     $r .= td(_('Plan Analytique'));
     $r .= $wPaName->input();
     $r .= "</tr>";
     $r .= "<tr>";
     $r .= td(_('Groupe'));
     $r .= $wGa_id->input();
     $r .= "</tr>";
     $r .= "</table>";
     return $r;
 }