function create_query_histo($p_array) { global $cn, $g_user; $profile = $g_user->get_profile(); $sql = "\n\t\t\tselect sg_id,\n\t\t\t\tsg.f_id,\n\t\t\t\t(select ad_value from fiche_Detail as fd1 where ad_id=1 and fd1.f_id=jx.f_id) as fname,\n\t\t\t\t(select ad_value from fiche_Detail as fd1 where ad_id=23 and fd1.f_id=jx.f_id) as qcode,\n\t\t\t\tsg_code,\n\t\t\t\tcoalesce(sg_comment,jr_comment) as ccomment,\n\t\t\t\tsg_exercice,\n\t\t\t\tr_name,\n\t\t\t\tsg.r_id,\n\t\t\t\tj_montant,\n\t\t\t\tjr_date,\n\t\t\t\tsg_quantity,\n\t\t\t\tcase when sg_type='c' then 'OUT' when sg_type='d' then 'IN' end as direction,\n\t\t\t\tjr_internal,\n\t\t\t\tjr_id,\n\t\t\t\tcoalesce(sg_date,jr_date) as real_date,\n\t\t\t\tto_char(coalesce(sg_date,jr_date),'DD.MM.YY') as cdate\n\t\t\tfrom stock_goods as sg\n\t\t\tjoin stock_repository as sr on (sg.r_id=sr.r_id)\n\t\t\tleft join jrnx as jx on (sg.j_id=jx.j_id)\n\t\t\tleft join jrn as j on (j.jr_grpt_id=jx.j_grpt)\n\t\t\twhere\n\t\t\tsg.r_id in (select r_id from profile_sec_repository where p_id = {$profile})"; $and = " and "; $clause = ""; if (isset($p_array['wdate_start']) && $p_array['wdate_start'] != '') { $clause = $and . " to_date('" . sql_string($p_array['wdate_start']) . "','DD.MM.YYYY')<=coalesce(sg_date,jr_date) "; } if (isset($p_array['wdate_end']) && $p_array['wdate_end'] != '') { $clause .= $and . " to_date('" . sql_string($p_array['wdate_end']) . "','DD.MM.YYYY')>=coalesce(sg_date,jr_date) "; } if (isset($p_array['wamount_start']) && $p_array['wamount_start'] != '' && isNumber($p_array['wamount_start']) == 1 && $p_array['wamount_start'] != 0) { $clause .= $and . " j_montant >= " . sql_string($p_array['wamount_start']); } if (isset($p_array['wamount_end']) && $p_array['wamount_end'] != '' && $p_array['wamount_end'] != 0 && isNumber($p_array['wamount_end']) == 1) { $clause .= $and . " j_montant <= " . sql_string($p_array['wamount_end']); } if (isset($p_array['wcard']) && $p_array['wcard'] != '') { $f = new Fiche($this->cn); $f->get_by_qcode($p_array['wcard'], false); if ($f->id != 0) { $clause .= $and . " sg.f_id = " . sql_string($f->id); } } if (isset($p_array['wcode_stock']) && $p_array['wcode_stock'] != "") { $clause .= $and . " upper(sg_code) = upper('" . sql_string(trim($p_array['wcode_stock'])) . "')"; } if (isset($p_array['wrepo']) && $p_array['wrepo'] != -1) { $clause .= $and . " sg.r_id = " . sql_string($p_array['wrepo']); } if (isset($p_array['wdirection']) && $p_array['wdirection'] != -1) { $clause .= $and . " sg.sg_type = '" . sql_string($p_array['wdirection']) . "'"; } return $sql . $clause; }
/** * Insert a new ledger * @param type $array normally $_POST * @see verify_ledger */ function save_new($array) { $this->load(); extract($array); $this->jrn_def_id = -1; $this->jrn_def_name = $p_jrn_name; $this->jrn_def_ech_lib = $p_ech_lib; $this->jrn_def_max_line_deb = $p_jrn_deb_max_line; $this->jrn_def_type = $p_jrn_type; $this->jrn_def_pj_pref = $jrn_def_pj_pref; $this->jrn_def_fiche_deb = isset($FICHEDEB) ? join($FICHEDEB, ',') : ""; $this->jrn_deb_max_line = $min_row; $this->jrn_def_code = sprintf("%s%02d", trim(substr($this->jrn_def_type, 0, 1)), Acc_Ledger::next_number($this->db, $this->jrn_def_type)); $this->jrn_def_description = $p_description; switch ($this->jrn_def_type) { case 'ACH': case 'VEN': $this->jrn_def_fiche_cred = isset($FICHECRED) ? join($FICHECRED, ',') : ''; break; case 'ODS': $this->jrn_def_class_deb = $p_jrn_class_deb; $this->jrn_def_fiche_cred = null; break; case 'FIN': $a = new Fiche($this->db); $result = $a->get_by_qcode(trim(strtoupper($_POST['bank'])), false); $bank = $a->id; $this->jrn_def_bank = $bank; if ($result == -1) { throw new Exception(_("Aucun compte en banque n'est donné")); } $this->jrn_def_num_op = isset($numb_operation) ? 1 : 0; break; } parent::insert(); }
$detail->get(); if ($owner->MY_ANALYTIC != 'nu') { $anc = new Anc_Plan($cn); $a_anc = $anc->get_list(' order by pa_id '); $x = count($a_anc); /* set the width of the col */ $str_anc .= '<th colspan="' . $x . '" style="width:auto;text-align:center">' . _('Compt. Analytique') . '</th>'; /* add hidden variables pa[] to hold the value of pa_id */ $str_anc .= Anc_Plan::hidden($a_anc); } bcscale(2); for ($e = 0; $e < count($detail->det->array); $e++) { $row = ''; $q = $detail->det->array; $fiche = new Fiche($cn); $fiche->get_by_qcode($q[$e]['j_qcode']); /* Analytic accountancy */ if ($owner->MY_ANALYTIC != "nu") { $poste = $fiche->strAttribut(ATTR_DEF_ACCOUNT); if (preg_match('/^(6|7)/', $q[$e]['j_poste'])) { $qcode = $fiche->strAttribut(ATTR_DEF_QUICKCODE); $anc_op = new Anc_Operation($cn); $anc_op->j_id = $q[$e]['j_id']; $anc_op->in_div = $div; $str_anc .= '<tr>'; $str_anc .= td($poste); $str_anc .= td($qcode); $str_anc .= td(nbm($q[$e]['j_montant'])); $str_anc .= '<td>'; $str_anc .= HtmlInput::hidden('op[]', $anc_op->j_id); $montant = $q[$e]['j_debit'] == "t" ? $q[$e]['j_montant'] : bcmul($q[$e]['j_montant'], -1);
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; }
function Summary($p_search = "", $p_action = "", $p_sql = "", $p_nothing = false) { $p_search = sql_string($p_search); $extra_sql = ""; if ($this->company != "") { $extra_sql = "and f_id in (select f_id from fiche_detail\n where ad_value=upper('" . $this->company . "') and ad_id=" . ATTR_DEF_COMPANY . ") "; } $url = urlencode($_SERVER['REQUEST_URI']); $script = $_SERVER['PHP_SELF']; // Creation of the nav bar // Get the max numberRow $all_contact = $this->count_by_modele($this->fiche_def_ref, $p_search, $extra_sql); // Get offset and page variable $offset = isset($_REQUEST['offset']) ? $_REQUEST['offset'] : 0; $page = isset($_REQUEST['page']) ? $_REQUEST['page'] : 1; $bar = navigation_bar($offset, $all_contact, $_SESSION['g_pagesize'], $page); // set a filter ? $search = ""; if (trim($p_search) != "") { $search = " and f_id in\n (select f_id from fiche_Detail\n where\n ad_id=1 and ad_value ~* '{$p_search}') "; } // Get The result Array $step_contact = $this->get_by_category($offset, $search . $extra_sql . $p_sql); if ($all_contact == 0) { return ""; } $r = $bar; $r .= '<table id="contact_tb" class="sortable"> <TR> <th>Quick Code</th> <th>Nom</th> <th>Prénom</th> <th>Société</th> <th>Téléphone</th> <th>email</th> <th>Fax</th> </TR>'; $base = $_SERVER['PHP_SELF']; // Compute the url $url = ""; $and = "?"; $get = $_GET; if (isset($get)) { foreach ($get as $name => $value) { // we clean the parameter offset, step, page and size if (!in_array($name, array('f_id', 'detail'))) { $url .= $and . $name . "=" . $value; $and = "&"; } // if } //foreach } // if $back_url = urlencode($_SERVER['REQUEST_URI']); if (sizeof($step_contact) == 0) { return $r; } $idx = 0; foreach ($step_contact as $contact) { $l_company = new Fiche($this->cn); $l_company->get_by_qcode($contact->strAttribut(ATTR_DEF_COMPANY), false); $l_company_name = $l_company->strAttribut(ATTR_DEF_NAME); if ($l_company_name == NOTFOUND) { $l_company_name = ""; } // add popup for detail if ($l_company_name != "") { $l_company_name = HtmlInput::card_detail($contact->strAttribut(ATTR_DEF_COMPANY), $l_company_name, 'style="text-decoration:underline;"'); } $tr = $idx % 2 == 0 ? ' <tr class="odd">' : '<tr class="even">'; $idx++; $r .= $tr; $qcode = $contact->strAttribut(ATTR_DEF_QUICKCODE); $r .= '<TD>' . HtmlInput::card_detail($qcode) . "</TD>"; $r .= "<TD>" . $contact->strAttribut(ATTR_DEF_NAME) . "</TD>"; $r .= "<TD>" . $contact->strAttribut(ATTR_DEF_FIRST_NAME) . "</TD>"; $r .= "<TD>" . $l_company_name . "</TD>"; $r .= "<TD>" . $contact->strAttribut(ATTR_DEF_TEL) . "</TD>"; $r .= "<TD>" . $contact->strAttribut(ATTR_DEF_EMAIL) . "</TD>" . "<TD> " . $contact->strAttribut(ATTR_DEF_FAX) . "</TD>"; $r .= "</TR>"; } $r .= "</TABLE>"; $r .= $bar; return $r; }
} } if (strlen(trim($_POST['an_cat_acc' . $i])) != 0 || strlen(trim($_POST['an_qc' . $i])) != 0) { /* we save only if there is something */ $e = new Forecast_item($cn); if (isset($_POST['fi_id' . $i])) { $e->set_parameter("id", $_POST['fi_id' . $i]); } $e->set_parameter('text', $_POST['an_label' . $i]); $e->set_parameter('amount', $_POST['an_cat_amount' . $i]); $e->set_parameter('debit', $_POST['an_deb' . $i]); $e->set_parameter('cat_id', $_POST['an_cat' . $i]); $e->set_parameter('account', $_POST['an_cat_acc' . $i]); $e->set_parameter('periode', $_POST['month' . $i]); $f = new Fiche($cn); if ($f->get_by_qcode($_POST['an_qc' . $i], false) == 0) { $e->set_parameter('card', $f->id); } else { $e->set_parameter('card', null); } $e->set_parameter('order', $i); $e->save(); } } $cn->commit(); $sa = 'vw'; // to avoid to restart the add of new anticipation } catch (Exception $e) { $cn->rollback(); alert($e->getMessage()); $correct = 1;
public function from_array($array, $idx) { $row = $array; $this->ad_id = isset($row['ad_id' . $idx]) ? $row['ad_id' . $idx] : 0; $qcode = isset($row['e_march' . $idx]) ? $row['e_march' . $idx] : ""; if (trim($qcode) == '') { $this->f_id = 0; } else { $tmp = new Fiche($this->db); $tmp->get_by_qcode($qcode, false); $this->f_id = $tmp->id; } $this->ad_text = isset($row['e_march' . $idx . '_label']) ? $row['e_march' . $idx . '_label'] : ""; $this->ad_pu = isset($row['e_march' . $idx . '_price']) ? $row['e_march' . $idx . '_price'] : 0; $this->ad_quant = isset($row['e_quant' . $idx]) ? $row['e_quant' . $idx] : 0; $this->ad_tva_id = isset($row['e_march' . $idx . '_tva_id']) ? $row['e_march' . $idx . '_tva_id'] : 0; $this->ad_tva_amount = isset($row['e_march' . $idx . '_tva_amount']) ? $row['e_march' . $idx . '_tva_amount'] : 0; $this->ad_total_amount = isset($row['tvac_march' . $idx]) ? $row['tvac_march' . $idx] : 0; $this->ag_id = isset($array['ag_id']) ? $array['ag_id'] : 0; /* protect numeric */ if (trim($this->ad_pu) == "" || isNumber($this->ad_pu) == 0) { $this->ad_pu = 0; } if (trim($this->ad_quant) == "" || isNumber($this->ad_quant) == 0) { $this->ad_quant = 0; } if (trim($this->ad_tva_amount) == "" || isNumber($this->ad_tva_amount) == 0) { $this->ad_tva_amount = 0; } if (trim($this->ad_total_amount) == "" || isNumber($this->ad_total_amount) == 0) { $this->ad_total_amount = 0; } if (trim($this->ad_tva_id) == "" || isNumber($this->ad_tva_id) == 0) { $this->ad_tva_id = 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; }
} $html = ob_get_contents(); ob_end_clean(); break; /* ------------------------------------------------------------ */ /* Display card detail */ /* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */ /* Display card detail */ /* ------------------------------------------------------------ */ case 'dc': $f = new Fiche($cn); /* add title + close */ $html = HtmlInput::title_box(_("Détail fiche"), $ctl); if ($qcode != '') { $f->get_by_qcode($qcode); $can_modify = $g_user->check_action(FIC); if (isset($ro)) { $can_modify = 0; } if ($can_modify == 1) { $card = $f->Display(false); } else { $card = $f->Display(true); } if ($card == 'FNT') { $html .= '<h2 class="error">' . _('Fiche non trouvée') . '</h2>'; } else { if ($can_modify == 1) { $html .= '<form id="form_' . $ctl . '"method="get" onsubmit="update_card(this);return false;">'; $html .= dossier::hidden();
/** * Get date from $_GET and create the sql stmt for the query * @note the query is taken in $_REQUEST * @see Follow_Up::ShowActionList * @return string SQL condition */ static function create_query($cn, $p_array = null) { if ($p_array == null) { $p_array = $_GET; } extract($p_array); $action_query = ""; if (isset($_REQUEST['action_query'])) { // if a query is request build the sql stmt $action_query = "and (ag_title ~* '" . sql_string($_REQUEST['action_query']) . "' " . "or ag_ref ='" . trim(sql_string($_REQUEST['action_query'])) . "' or ag_id in (select ag_id from action_gestion_comment where agc_comment ~* '" . trim(sql_string($_REQUEST['action_query'])) . "')" . ")"; } $str = ""; if (isset($qcode)) { // verify that qcode is not empty if (strlen(trim($qcode)) != 0) { $fiche = new Fiche($cn); $fiche->get_by_qcode($_REQUEST['qcode']); // if quick code not found then nothing if ($fiche->id == 0) { $str = ' and false '; } else { $str = " and (f_id_dest= " . $fiche->id . " or ag_id in (select ag_id from action_person as ap where ap.f_id=" . $fiche->id . ") )"; } } } if (isset($tdoc) && $tdoc != -1) { $action_query .= ' and dt_id = ' . sql_string($tdoc); } if (isset($state) && $state != -1) { $action_query .= ' and ag_state= ' . sql_string($state); } if (isset($hsstate) && $hsstate != -1) { $action_query .= ' and ag_state <> ' . sql_string($hsstate); } if (isset($sag_ref) && trim($sag_ref) != "") { $query .= ' and ag_ref= \'' . sql_string($sag_ref) . "'"; } if (isset($_GET['only_internal'])) { $action_query .= ' and f_id_dest=0 '; } if (isset($date_start) && isDate($date_start) != null) { $action_query .= " and ag_timestamp >= to_date('{$date_start}','DD.MM.YYYY')"; } if (isset($date_end) && isDate($date_end) != null) { $action_query .= " and ag_timestamp <= to_date('{$date_end}','DD.MM.YYYY')"; } if (isset($ag_dest_query) && $ag_dest_query != -2) { $action_query .= " and ((ag_dest = " . sql_string($ag_dest_query) . " and " . self::sql_security_filter($cn, "R") . ") or " . "(ag_dest = " . sql_string($ag_dest_query) . " and " . self::sql_security_filter($cn, "R") . " and " . " ag_owner='" . $_SESSION['g_user'] . "'))"; } else { $action_query .= " and (ag_owner='" . $_SESSION['g_user'] . "' or " . self::sql_security_filter($cn, "R") . " or ag_dest=-1 )"; } if (isNumber($ag_id) == 1 && $ag_id != 0) { $action_query = " and ag_id= " . sql_string($ag_id); } if (isset($remind_date) && $remind_date != "" && isDate($remind_date) == $remind_date) { $action_query .= " and to_date('" . sql_string($remind_date) . "','DD.MM.YYYY')<= ag_remind_date"; } if (isset($remind_date_end) && $remind_date_end != "" && isDate($remind_date_end) == $remind_date_end) { $action_query .= " and to_date('" . sql_string($remind_date_end) . "','DD.MM.YYYY')>= ag_remind_date"; } if (!isset($closed_action)) { $action_query .= " and s_status is null "; } if (isset($searchtag)) { $action_query .= Follow_Up::filter_by_tag($cn, $p_array); } return $action_query . $str; }
function Display($p_readonly) { $this->GetAttribut(); $attr = $this->attribut; /* show card type here */ $type_card = $this->cn->get_value('select fd_label ' . ' from fiche_def join fiche using (fd_id) where f_id=$1', array($this->id)); $ret = ""; $ret .= h2(_("Catégorie") . " " . $type_card, 'style="display:inline"'); $ret .= '<span style="font-weight:bolder;margin-right:5px;float:right">' . _('id fiche') . ':' . $this->id . "</span>"; $ret .= "<table style=\"width:98%;margin:1%\">"; if (empty($attr)) { return 'FNT'; } /* for each attribute */ foreach ($attr as $r) { $msg = ""; $bulle = ""; if ($p_readonly) { $w = new IText(); $w->table = 1; $w->readOnly = true; $w->css_size = "100%"; } if ($p_readonly == false) { if ($r->ad_id == ATTR_DEF_ACCOUNT) { $w = new IPoste("av_text" . $r->ad_id); $w->set_attribute('ipopup', 'ipop_account'); $w->set_attribute('account', "av_text" . $r->ad_id); $w->dbl_click_history(); // account created automatically $w->table = 0; $w->value = $r->av_text; // account created automatically $sql = "select account_auto({$this->fiche_def})"; $ret_sql = $this->cn->exec_sql($sql); $a = Database::fetch_array($ret_sql, 0); $bulle = HtmlInput::infobulle(10); if ($a['account_auto'] == 't') { $bulle .= HtmlInput::warnbulle(11); } } elseif ($r->ad_id == ATTR_DEF_TVA) { $w = new ITva_Popup('popup_tva'); $w->table = 1; $w->value = $r->av_text; } else { switch ($r->ad_type) { case 'text': $w = new IText('av_text' . $r->ad_id); $w->css_size = "100%"; $w->value = $r->av_text; break; case 'numeric': $w = new INum('av_text' . $r->ad_id); $w->size = $r->ad_size; $w->prec = $r->ad_extra == "" ? 2 : $r->ad_extra; $w->value = $r->av_text; break; case 'date': $w = new IDate('av_text' . $r->ad_id); $w->value = $r->av_text; break; case 'zone': $w = new ITextArea('av_text' . $r->ad_id); $w->style = ' class="itextarea" style="margin:0px;width:100%"'; $w->value = $r->av_text; break; case 'poste': $w = new IPoste("av_text" . $r->ad_id); $w->set_attribute('ipopup', 'ipop_account'); $w->set_attribute('account', "av_text" . $r->ad_id); $w->dbl_click_history(); $w->width = $r->ad_size; $w->table = 0; $bulle = HtmlInput::infobulle(14); $w->value = $r->av_text; break; case 'card': $uniq = rand(0, 1000); $w = new ICard("av_text" . $r->ad_id); $w->id = "card_" . $this->id . $uniq; // filter on ad_extra $filter = $r->ad_extra; $w->width = $r->ad_size; $w->extra = $filter; $w->extra2 = 0; $label = new ISpan(); $label->name = "av_text" . $uniq . $r->ad_id . "_label"; $fiche = new Fiche($this->cn); $fiche->get_by_qcode($r->av_text); if ($fiche->id == 0) { $label->value = trim($r->av_text) == '' ? "" : " " . _("Fiche non trouvée") . " "; $r->av_text = ""; } else { $label->value = $fiche->strAttribut(ATTR_DEF_NAME) . " " . $fiche->strAttribut(ATTR_DEF_FIRST_NAME, 0); } $w->set_attribute('ipopup', 'ipopcard'); $w->set_attribute('typecard', $filter); $w->set_attribute('inp', "av_text" . $r->ad_id); $w->set_attribute('label', $label->name); $w->autocomplete = 0; $w->dblclick = "fill_ipopcard(this);"; $msg = $w->search(); $msg .= $label->input(); $w->value = $r->av_text; break; case 'select': $w = new ISelect(); $w->value = $this->cn->make_array($r->ad_extra); $w->selected = $r->av_text; $w->style = ' style="width:100%" '; break; default: var_dump($r); throw new Exception("Type invalide"); } $w->table = 0; } } else { switch ($r->ad_type) { case 'select': $x = new ISelect(); $x->value = $this->cn->make_array($r->ad_extra); $x->selected = $r->av_text; $value = $x->display(); $w->value = $value; break; default: $w->value = $r->av_text; } } $w->name = "av_text" . $r->ad_id; $w->readOnly = $p_readonly; if ($r->ad_id == 21 || $r->ad_id == 22 || $r->ad_id == 20 || $r->ad_id == 31) { $bulle = HtmlInput::infobulle(21); } $ret .= "<TR>" . td(_($r->ad_text) . $bulle) . td($w->input() . " " . $msg) . " </TR>"; } $ret .= "</table>"; return $ret; }
$event_priority = HtmlInput::default_value_get("event_priority", 0); $title = HtmlInput::default_value_get("title_event", NULL); $summary = HtmlInput::default_value_get("summary", ""); $type_event = HtmlInput::default_value_get('type_event', -1); /* * Check if data are valid */ try { if ($date_event == -1 || isDate($date_event) == 0) { throw new Exception(_('Date invalide')); } if (trim($dest) == "") { $dest_id = NULL; } else { $fiche = new Fiche($cn); $fiche->get_by_qcode($dest); $dest_id = $fiche->id; if ($dest_id == 0) { throw new Exception(_('Destinataire invalide')); } } if ($type_event == -1) { throw new Exception(_('Type invalide')); } if (trim($title) == "") { throw new Exception(_('Aucun titre')); } } catch (Exception $ex) { header('Content-type: text/xml; charset=UTF-8'); $dom = new DOMDocument('1.0', 'UTF-8'); $xml_content = $dom->createElement('content', $ex->getMessage());
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; }
public function insert($p_array = null) { global $g_parameter; bcscale(2); $internal_code = ""; $oid = 0; extract($p_array); $ret = ''; // Debit = banque $bank_id = $this->get_bank(); $fBank = new Fiche($this->db, $bank_id); $e_bank_account = $fBank->strAttribut(ATTR_DEF_QUICKCODE); // Get the saldo $pPeriode = new Periode($this->db); $sposte = $fBank->strAttribut(ATTR_DEF_ACCOUNT); // if 2 accounts, take only the debit one for customer if (strpos($sposte, ',') != 0) { $array = explode(',', $sposte); $poste_val = $array[0]; } else { $poste_val = $sposte; } $acc_account = new Acc_Account_Ledger($this->db, $poste_val); // If date = deposit date if ($chdate == 1) { if ($this->check_periode() == true) { $pPeriode->p_id = $periode; } else { $pPeriode->find_periode($e_date); } $exercice = $pPeriode->get_exercice(); $filter_year = " j_tech_per in (select p_id from parm_periode where p_exercice='" . $exercice . "')"; $asolde = $acc_account->get_solde_detail($filter_year); $deb = $asolde['debit']; $cred = $asolde['credit']; $solde = bcsub($deb, $cred); $new_solde = $solde; } try { $this->db->start(); $amount = 0.0; $idx_operation = 0; $ret = '<table class="result" >'; $ret .= tr(th('Date') . th('n° interne') . th('Quick Code') . th('Nom') . th('Libellé') . th('Montant', ' style="text-align:right"')); // Credit = goods $get_solde = true; for ($i = 0; $i < $nb_item; $i++) { // insert it into the database // and quit the loop ? if (strlen(trim(${"e_other{$i}"})) == 0) { continue; } if ($chdate == 2) { $e_date = ${'dateop' . $i}; } // if date is date of operation if ($chdate == 2 && $get_solde) { $get_solde = false; if ($this->check_periode() == true) { $pPeriode->p_id = $periode; } else { $pPeriode->find_periode($e_date); } $exercice = $pPeriode->get_exercice(); $filter_year = " j_tech_per in (select p_id from parm_periode where p_exercice='" . $exercice . "')"; $solde = $acc_account->get_solde($filter_year); $new_solde = $solde; } $fPoste = new Fiche($this->db); $fPoste->get_by_qcode(${"e_other{$i}"}); // round it ${"e_other{$i}" . "_amount"} = round(${"e_other{$i}" . "_amount"}, 2); $amount += ${"e_other{$i}" . "_amount"}; // Record a line for the bank // Compute the j_grpt $seq = $this->db->get_next_seq('s_grpt'); $acc_operation = new Acc_Operation($this->db); $acc_operation->date = $e_date; $sposte = $fPoste->strAttribut(ATTR_DEF_ACCOUNT); // if 2 accounts if (strpos($sposte, ',') != 0) { $array = explode(',', $sposte); if (${"e_other{$i}" . "_amount"} < 0) { $poste_val = $array[1]; } else { $poste_val = $array[0]; } } else { $poste_val = $sposte; } $acc_operation->poste = $poste_val; $acc_operation->amount = ${"e_other{$i}" . "_amount"} * -1; $acc_operation->grpt = $seq; $acc_operation->jrn = $p_jrn; $acc_operation->type = 'd'; if (isset($periode)) { $tperiode = $periode; } else { $per = new Periode($this->db); $tperiode = $per->find_periode($e_date); } $acc_operation->periode = $tperiode; $acc_operation->qcode = ${"e_other" . $i}; $j_id = $acc_operation->insert_jrnx(); $acc_operation = new Acc_Operation($this->db); $acc_operation->date = $e_date; $sposte = $fBank->strAttribut(ATTR_DEF_ACCOUNT); // if 2 accounts if (strpos($sposte, ',') != 0) { $array = explode(',', $sposte); if (${"e_other{$i}" . "_amount"} < 0) { $poste_val = $array[1]; } else { $poste_val = $array[0]; } } else { $poste_val = $sposte; } $acc_operation->poste = $poste_val; $acc_operation->amount = ${"e_other{$i}" . "_amount"}; $acc_operation->grpt = $seq; $acc_operation->jrn = $p_jrn; $acc_operation->type = 'd'; $acc_operation->periode = $tperiode; $acc_operation->qcode = $e_bank_account; $acc_operation->insert_jrnx(); if (sql_string(${"e_other{$i}" . "_comment"}) == null) { // if comment is blank set a default one $comment = " compte : " . $fBank->strAttribut(ATTR_DEF_NAME) . ' a ' . $fPoste->strAttribut(ATTR_DEF_NAME); } else { $comment = ${'e_other' . $i . '_comment'}; } $acc_operation = new Acc_Operation($this->db); $acc_operation->jrn = $p_jrn; $acc_operation->amount = abs(${"e_other{$i}" . "_amount"}); $acc_operation->date = $e_date; $acc_operation->desc = $comment; $acc_operation->grpt = $seq; $acc_operation->periode = $tperiode; $acc_operation->mt = $mt; $idx_operation++; $acc_operation->pj = ''; if (trim($e_pj) != '' && $this->numb_operation() == true) { $acc_operation->pj = $e_pj . str_pad($idx_operation, 3, 0, STR_PAD_LEFT); } if (trim($e_pj) != '' && $this->numb_operation() == false) { $acc_operation->pj = $e_pj; } $jr_id = $acc_operation->insert_jrn(); // $acc_operation->set_pj(); $this->db->exec_sql('update jrn set jr_pj_number=$1 where jr_id=$2', array($acc_operation->pj, $jr_id)); $internal = $this->compute_internal_code($seq); if (trim(${"e_concerned" . $i}) != "") { if (strpos(${"e_concerned" . $i}, ',') != 0) { $aRapt = explode(',', ${"e_concerned" . $i}); foreach ($aRapt as $rRapt) { // Add a "concerned operation to bound these op.together // $rec = new Acc_Reconciliation($this->db); $rec->set_jr_id($jr_id); if (isNumber($rRapt) == 1) { $rec->insert($rRapt); } } } else { if (isNumber(${"e_concerned" . $i}) == 1) { $rec = new Acc_Reconciliation($this->db); $rec->set_jr_id($jr_id); $rec->insert(${"e_concerned{$i}"}); } } } // Set Internal code $this->grpt_id = $seq; /** * save also into quant_fin */ $this->insert_quant_fin($fBank->id, $jr_id, $fPoste->id, ${"e_other{$i}" . "_amount"}); if ($g_parameter->MY_ANALYTIC != "nu") { // for each item, insert into operation_analytique */ $op = new Anc_Operation($this->db); $op->oa_group = $this->db->get_next_seq("s_oa_group"); /* for analytic */ $op->j_id = $j_id; $op->oa_date = $e_date; $op->oa_debit = 'f'; $op->oa_description = sql_string($comment); $op->save_form_plan($_POST, $i, $j_id); } $this->update_internal_code($internal); $js_detail = HtmlInput::detail_op($jr_id, $internal); // Compute display $row = td($e_date) . td($js_detail) . td(${"e_other{$i}"}) . td($fPoste->strAttribut(ATTR_DEF_NAME)) . td(${"e_other" . $i . "_comment"}) . td(nbm(${"e_other{$i}" . "_amount"}), 'class="num"'); $class = $i % 2 == 0 ? ' class="even" ' : ' class="odd" '; $ret .= tr($row, $class); if ($i == 0) { // first record we upload the files and // keep variable to update other row of jrn if (isset($_FILES)) { $oid = $this->db->save_upload_document($seq); } } else { if ($oid != 0) { $this->db->exec_sql("update jrn set jr_pj=\$1 , jr_pj_name=\$2,\n jr_pj_type=\$3 where jr_grpt_id=\$4", array($oid, $_FILES['pj']['name'], $_FILES['pj']['type'], $seq)); } } } // for nbitem // increment pj if (strlen(trim($e_pj)) != 0) { $this->inc_seq_pj(); } $ret .= '</table>'; } catch (Exception $e) { $r = '<span class="error">' . 'Erreur dans l\'enregistrement ' . __FILE__ . ':' . __LINE__ . ' ' . $e->getMessage(); $this->db->rollback(); throw new Exception($r); } $this->db->commit(); $r = ""; $r .= "<br>Ancien solde " . nbm($solde); $new_solde = bcadd($new_solde, $amount); $r .= "<br>Nouveau solde " . nbm($new_solde); $ret .= $r; return $ret; }
// we ask a poste_id if (isset($_GET['poste_id']) && strlen(trim($_GET['poste_id'])) != 0) { if (isset($_GET['poste_fille'])) { $parent = $_GET['poste_id']; $a_poste = $cn->get_array("select pcm_val from tmp_pcmn where pcm_val::text like '{$parent}%' order by pcm_val::text"); $go = 3; } elseif ($cn->count_sql('select * from tmp_pcmn where pcm_val=$1', array($_GET['poste_id'])) != 0) { $Poste = new Acc_Account_Ledger($cn, $_GET['poste_id']); $go = 1; } } if (strlen(trim($_GET['f_id'])) != 0) { require_once NOALYSS_INCLUDE . '/class_fiche.php'; // thanks the qcode we found the poste account $fiche = new Fiche($cn); $qcode = $fiche->get_by_qcode($_GET['f_id']); $p = $fiche->strAttribut(ATTR_DEF_ACCOUNT); if ($p != NOTFOUND) { $go = 2; } } // A account is given if ($go == 1) { echo '<div class="content">'; if (!isset($_REQUEST['oper_detail'])) { Acc_Account_Ledger::HtmlTableHeader(); echo '<div class="content">'; $Poste->HtmlTable(null, $_GET['ople']); echo '</div>'; echo Acc_Account_Ledger::HtmlTableHeader(); } else {
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 = " "; //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; }
/** *Replace a special tag *TAGxxxx with the value from fiche_detail, the xxxx * is the ad_value * @param $p_qcode qcode of the card * @param $p_tag tag to parse * @return the ad_value contained in fiche_detail or for the type "select" the * label */ function replace_special_tag($p_qcode, $p_tag) { // check if the march exists if ($p_qcode == "") { return ""; } $f = new Fiche($this->db); $found = $f->get_by_qcode($p_qcode, false); // if not found exit if ($found == 1) { return ""; } // get the ad_id $attr = preg_replace("/^.*ATTR/", "", $p_tag); if (isNumber($attr) == 0) { return ""; } $ad_type = $this->db->get_value("select ad_type from attr_def where ad_id=\$1", array($attr)); // get ad_value $ad_value = $this->db->get_value("select ad_value from fiche_detail where f_id=\$1 and ad_id=\$2", array($f->id, $attr)); // if ad_id is type select execute select and get value if ($ad_type == "select") { $sql = $this->db->get_value("select ad_extra from attr_def where ad_id=\$1", array($attr)); $array = $this->db->make_array($sql); for ($a = 0; $a < count($array); $a++) { if ($array[$a]['value'] == $ad_value) { return $array[$a]['label']; } } } // if ad_id is not type select get value return $ad_value; }
/** * Insert into stock_goods from ACH and VEN * @param type $p_array KEY : db => database conx, j_id => jrnx.j_id,goods=> f_id of the goods * 'quant' => quantity ,'dir'=> d or c (c for sales OUT and d for purchase IN),'repo'=>r_id of the * repository (stock_repository.r_id */ static function insert_goods(&$p_cn, $p_array) { global $g_user; extract($p_array); if ($g_user->can_write_repo($repo) == false) { return false; } // Retrieve the good account for stock $code = new Fiche($p_cn); $code->get_by_qcode($goods); $code_marchandise = $code->strAttribut(ATTR_DEF_STOCK); if ($code_marchandise == NOTFOUND || $code_marchandise == '') { return false; } $exercice = $g_user->get_exercice(); if ($exercice == 0) { throw new Exception('Annee invalide erreur'); } $Res = $p_cn->exec_sql("insert into stock_goods (\n j_id,\n f_id,\n sg_code,\n sg_quantity,\n sg_type,sg_exercice,r_id ) values (\$1,\$2,\$3,\$4,\$5,\$6,\$7)", array($p_array['j_id'], $code->id, $code_marchandise, $p_array['quant'], $p_array['dir'], $exercice, $p_array['repo'])); return $Res; }
$q = $detail->det->array; $view_history = sprintf('<A class="detail" style="text-decoration:underline" HREF="javascript:view_history_account(\'%s\',\'%s\')" >%s</A>', $q[$e]['j_poste'], $gDossier, $q[$e]['j_poste']); $row .= td($view_history); if ($q[$e]['j_qcode'] != '') { $fiche = new Fiche($cn); $fiche->get_by_qcode($q[$e]['j_qcode']); $view_history = sprintf('<A class="detail" style="text-decoration:underline" HREF="javascript:view_history_card(\'%s\',\'%s\')" >%s</A>', $fiche->id, $gDossier, $q[$e]['j_qcode']); } else { $view_history = ''; } $row .= td($view_history); if ($q[$e]['j_text'] == "") { if ($q[$e]['j_qcode'] != '') { // nom de la fiche $ff = new Fiche($cn); $ff->get_by_qcode($q[$e]['j_qcode']); $row .= td($ff->strAttribut(h(ATTR_DEF_NAME))); } else { // libellé du compte $name = $cn->get_value('select pcm_lib from tmp_pcmn where pcm_val=$1', array($q[$e]['j_poste'])); $row .= td(h($name)); } } else { $row .= td(h($q[$e]['j_text'])); } $montant = td(nbm($q[$e]['j_montant']), 'class="num"'); $row .= $q[$e]['j_debit'] == 't' ? $montant : td(''); $row .= $q[$e]['j_debit'] == 'f' ? $montant : td(''); $class = $e % 2 == 0 ? ' class="even"' : 'class="odd"'; echo tr($row, $class); }
function confirm($p_array, $p_summary = false) { global $g_parameter; extract($p_array); // we don't need to verify if we need only a feedback if (!$p_summary) { $this->verify($p_array); } $anc = null; // to show a select list for the analytic // if analytic is op (optionnel) there is a blank line bcscale(4); $client = new Fiche($this->db); $client->get_by_qcode($e_client, true); $client_name = h($client->getName() . ' ' . $client->strAttribut(ATTR_DEF_ADRESS) . ' ' . $client->strAttribut(ATTR_DEF_CP) . ' ' . $client->strAttribut(ATTR_DEF_CITY)); $lPeriode = new Periode($this->db); if ($this->check_periode() == true) { $lPeriode->p_id = $period; } else { $lPeriode->find_periode($e_date); } $date_limit = $lPeriode->get_date_limit(); $r = ""; $r .= '<TABLE>'; if ($p_summary) { $jr_id = $this->db->get_value('select jr_id from jrn where jr_internal=$1', array($this->internal)); $r .= "<tr>"; $r .= '<td>'; $r .= _('Détail opération '); $r .= '</td>'; $r .= '<td>'; $r .= sprintf('<a class="line" style="display:inline" href="javascript:modifyOperation(%d,%d)">%s</a>', $jr_id, dossier::id(), $this->internal); $r .= '</td>'; $r .= "</tr>"; } $r .= '<tr>'; if (!$p_summary) { $r .= '<td>' . _('Numéro Pièce') . '</td><td>' . hb($e_pj) . '</td>'; } else { if (strcmp($this->pj, $e_pj) != 0) { $r .= '<td>' . _('Numéro Pièce') . '</td><td>' . hb($this->pj) . '<span class="notice"> ' . _('Attention numéro pièce existante, elle a du être adaptée') . '</span></td>'; } else { $r .= '<td>' . _('Numéro Pièce') . '</td><td>' . hb($this->pj) . '</td>'; } } $r .= '</tr>'; $r .= '<td> ' . _('Date') . '</td><td> ' . hb($e_date) . '</td>'; $r .= '</tr>'; $r .= '<tr>'; $r .= '<td>' . _('Echeance') . '</td><td> ' . hb($e_ech) . '</td>'; $r .= '</tr>'; $r .= '<tr>'; $r .= '<td> ' . _('Période Comptable') . '</td><td> ' . hb($date_limit['p_start'] . '-' . $date_limit['p_end']) . '</td>'; $r .= '</tr>'; $r .= '<tr>'; $r .= '<td> ' . _('Journal') . '</td><td> ' . hb($this->get_name()) . '</td>'; $r .= '</tr>'; $r .= '<tr>'; $r .= '<td> ' . _('Libellé') . '</td><td> ' . hb($e_comm) . '</td>'; $r .= '</tr>'; $r .= '<tr>'; $r .= '<tr>'; $r .= '<td> ' . _('Fournisseur') . '</td><td> ' . hb($e_client . ':' . $client_name) . '</td>'; $r .= '</tr>'; $r .= '</table>'; $r .= '<h2>' . _('Détail articles achetés') . '</h2>'; $r .= '<p class="decale">'; $r .= '<table class="result" >'; $r .= '<TR>'; $r .= "<th>" . _('Code') . "</th>"; $r .= "<th>" . _('Dénomination') . "</th>"; $r .= "<th style=\"text-align:right\">" . _('prix') . "</th>"; $r .= "<th style=\"text-align:right\">" . _('quantité') . "</th>"; if ($g_parameter->MY_TVA_USE == 'Y') { $r .= "<th style=\"text-align:right\">" . _('tva') . "</th>"; $r .= '<th style="text-align:right"> ' . _('Montant TVA') . '</th>'; $r .= '<th style="text-align:right">' . _('Montant HTVA') . '</th>'; $r .= '<th style="text-align:right">' . _('Montant TVAC') . '</th>'; } else { $r .= '<th style="text-align:right">' . _('Montant') . '</th>'; } /* if we use the AC */ if ($g_parameter->MY_ANALYTIC != 'nu') { $anc = new Anc_Plan($this->db); $a_anc = $anc->get_list(); $x = count($a_anc); /* set the width of the col */ $r .= '<th colspan="' . $x . '">' . _('Compt. Analytique') . '</th>'; /* add hidden variables pa[] to hold the value of pa_id */ $r .= Anc_Plan::hidden($a_anc); } $r .= '</tr>'; $tot_amount = 0.0; $tot_tva = 0.0; //-- // For each item //-- for ($i = 0; $i < $nb_item; $i++) { $tot_row = 0; if (strlen(trim(${"e_march" . $i})) == 0) { continue; } /* retrieve information for card */ $fiche = new Fiche($this->db); $fiche->get_by_qcode(${"e_march" . $i}); if ($g_parameter->MY_UPDLAB == 'Y') { $fiche_name = h(${"e_march" . $i . "_label"}); } else { $fiche_name = $fiche->strAttribut(ATTR_DEF_NAME); } $amount = bcmul(${"e_march" . $i . "_price"}, ${'e_quant' . $i}); if ($g_parameter->MY_TVA_USE == 'Y') { $idx_tva = ${"e_march" . $i . "_tva_id"}; $oTva = new Acc_Tva($this->db); $oTva->set_parameter('id', $idx_tva); $oTva->load(); $op = new Acc_Compute(); $op->set_parameter("amount", $amount); $op->set_parameter('amount_vat_rate', $oTva->get_parameter('rate')); $op->compute_vat(); $tva_computed = $op->get_parameter('amount_vat'); //----- if tva_amount is not given we compute the vat ---- if (strlen(trim(${'e_march' . $i . '_tva_amount'})) == 0) { $tva_item = $op->get_parameter('amount_vat'); } else { $tva_item = round(${'e_march' . $i . '_tva_amount'}, 2); } if (isset($tva[$idx_tva])) { $tva[$idx_tva] = bcadd($tva_item, $tva[$idx_tva]); } else { $tva[$idx_tva] = $tva_item; } } $tot_amount = round(bcadd($tot_amount, $amount), 2); $tot_row = round(bcadd($tot_row, $amount), 2); $r .= '<tr>'; $r .= '<td>'; $r .= ${"e_march" . $i}; $r .= '</td>'; $r .= '<TD style="border-bottom:1px dotted grey;">'; $r .= $fiche_name; $r .= '</td>'; $r .= '<td class="num">'; $r .= nbm(${"e_march" . $i . "_price"}); $r .= '</td>'; $r .= '<td class="num">'; $r .= nbm(${"e_quant" . $i}); $r .= '</td>'; $both_side = 0; if ($g_parameter->MY_TVA_USE == 'Y') { $r .= '<td class="num">'; $r .= $oTva->get_parameter('label'); $both_side = $oTva->get_parameter("both_side"); if ($both_side == 0) { $tot_row = bcadd($tot_row, $tva_item); $tot_tva = round(bcadd($tva_item, $tot_tva), 2); } $r .= '</td>'; /* warning if tva_computed and given are not the same */ $css_void_tva = $both_side == 1 ? 'style="text-decoration:line-through"' : ''; if (bcsub($tva_item, $tva_computed) != 0 && !($tva_item == 0 && $both_side == 1)) { $r .= '<td style="background-color:red" class="num" ' . $css_void_tva . '>'; $r .= HtmlInput::infobulle(28); $r .= '<a href="#" class="error" style="display:inline" title="' . _("Attention Différence entre TVA calculée et donnée") . '">' . nbm($tva_item) . '<a>'; } else { $r .= '<td class="num" ' . $css_void_tva . '>'; $r .= nbm($tva_item); } $r .= '</td>'; $r .= '<td class="num"> '; $r .= nbm(round($amount, 2)); $r .= '</td>'; } $r .= '<td class="num">'; $r .= nbm(round($tot_row, 2)); $r .= '</td>'; // encode the pa if ($g_parameter->MY_ANALYTIC != 'nu') { // show form $anc_op = new Anc_Operation($this->db); $null = $g_parameter->MY_ANALYTIC == 'op' ? 1 : 0; $r .= '<td>'; $p_mode = $p_summary == false ? 1 : 0; $p_array['pa_id'] = $a_anc; /* op is the operation it contains either a sequence or a jrnx.j_id */ $r .= HtmlInput::hidden('op[]=', $i); $r .= $anc_op->display_form_plan($p_array, $null, $p_mode, $i, $amount); $r .= '</td>'; } $r .= '</tr>'; } // Add the sum $decalage = $g_parameter->MY_TVA_USE == 'Y' ? '<td></td><td></td><td></td><td></td>' : '<td></td>'; $tot = round(bcadd($tot_amount, $tot_tva), 2); $tot_tva = nbm($tot_tva); $tot = nbm($tot); $str_tot = _('Totaux'); $tot_amount = nbm($tot_amount); $r .= <<<EOF <tr class="highlight"> {$decalage} <td> {$str_tot} </td> <td class="num"> {$tot_tva} </td> <td class="num"> {$tot_amount} </td> <td class="num"> {$tot} </td> EOF; $r .= '</table>'; $r .= '</p>'; if ($g_parameter->MY_ANALYTIC != 'nu' && !$p_summary) { // use of AA $r .= '<input type="button" class="button" value="' . _('Vérifiez imputation analytique') . '" onClick="verify_ca(\'\');">'; } $r .= !$p_summary ? '<div id="total_div_id" >' : '<div>'; $r .= '<h2>Totaux</h2>'; /* use VAT */ if ($g_parameter->MY_TVA_USE == 'Y') { $r .= '<table>'; $r .= '<tr><td>Total HTVA</td>'; $r .= td(hb($tot_amount), 'class="num"'); foreach ($tva as $i => $value) { $oTva->set_parameter('id', $i); $oTva->load(); $r .= '<tr><td> TVA ' . $oTva->get_parameter('label') . '</td>'; $r .= td(hb(nbm($tva[$i])), 'class="num"'); } $r .= '<tr>' . td(_('Total TVA')) . td(hb($tot_tva), 'class="num"'); $r .= '<tr>' . td(_('Total TVAC')) . td(hb($tot), 'class="num"'); $r .= '</table>'; } else { $r .= '<br>Total ' . hb($tot); } $r .= '</div>'; /* Add hidden */ $r .= HtmlInput::hidden('e_client', $e_client); $r .= HtmlInput::hidden('nb_item', $nb_item); $r .= HtmlInput::hidden('p_jrn', $p_jrn); if (isset($period)) { $r .= HtmlInput::hidden('period', $period); } $r .= HtmlInput::hidden('e_comm', $e_comm); $r .= HtmlInput::hidden('e_date', $e_date); $r .= HtmlInput::hidden('e_ech', $e_ech); $r .= HtmlInput::hidden('jrn_type', $jrn_type); $r .= HtmlInput::hidden('e_pj', $e_pj); $r .= HtmlInput::hidden('e_pj_suggest', $e_pj_suggest); $mt = microtime(true); $r .= HtmlInput::hidden('mt', $mt); $e_mp = isset($e_mp) ? $e_mp : 0; $r .= HtmlInput::hidden('e_mp', $e_mp); /* Paid by */ /* if the paymethod is not 0 and if a quick code is given */ for ($i = 0; $i < $nb_item; $i++) { $r .= HtmlInput::hidden("e_march" . $i, ${"e_march" . $i}); if (isset(${"e_march" . $i . "_label"})) { $r .= HtmlInput::hidden("e_march" . $i . "_label", ${"e_march" . $i . "_label"}); } $r .= HtmlInput::hidden("e_march" . $i . "_price", ${"e_march" . $i . "_price"}); if ($g_parameter->MY_TVA_USE == 'Y') { $r .= HtmlInput::hidden("e_march" . $i . "_tva_id", ${"e_march" . $i . "_tva_id"}); $r .= HtmlInput::hidden('e_march' . $i . '_tva_amount', ${'e_march' . $i . '_tva_amount'}); } $r .= HtmlInput::hidden("e_quant" . $i, ${"e_quant" . $i}); } /** * */ if ($e_mp != 0 && strlen(trim(${'e_mp_qcode_' . $e_mp})) != 0) { $r .= HtmlInput::hidden('e_mp_qcode_' . $e_mp, ${'e_mp_qcode_' . $e_mp}); $r .= HtmlInput::hidden('acompte', $acompte); $r .= HtmlInput::hidden('e_comm_paiement', $e_comm_paiement); /* needed for generating a invoice */ $r .= HtmlInput::hidden('qcode_benef', ${'e_mp_qcode_' . $e_mp}); $fname = new Fiche($this->db); $fname->get_by_qcode(${'e_mp_qcode_' . $e_mp}); $r .= '<h2>' . _("Payé par") . " " . ${'e_mp_qcode_' . $e_mp} . " " . $fname->getName() . '</h2> ' . '<p class="decale">' . _('Déduction acompte ') . h($acompte) . '</p>' . _('Libellé :') . h($e_comm_paiement); $r .= '<br>'; $r .= '<br>'; } // check for upload piece return $r; }