switch ($acquisition_gestion_tva) { case '1': $modif_cde_form .= "\n\t\t\t\t\t\t<th width='6%'>" . htmlentities($msg['acquisition_act_tab_priht'], ENT_QUOTES, $charset) . " " . $msg['acquisition_act_tab_pri_exposant'] . "<br />" . htmlentities($msg['acquisition_act_tab_prittc'], ENT_QUOTES, $charset) . " " . $msg['acquisition_act_tab_pri_exposant'] . "</th>\n\t\t\t\t\t\t<th width='20%'>" . htmlentities($msg['acquisition_act_tab_typ'], ENT_QUOTES, $charset) . "<br />" . htmlentities($msg['acquisition_tva'], ENT_QUOTES, $charset) . " / " . htmlentities($msg['acquisition_remise'], ENT_QUOTES, $charset) . "</th>"; break; case '2': $modif_cde_form .= "\n\t\t\t\t\t\t<th width='6%'>" . htmlentities($msg['acquisition_act_tab_prittc'], ENT_QUOTES, $charset) . " " . $msg['acquisition_act_tab_pri_exposant'] . "<br />" . htmlentities($msg['acquisition_act_tab_priht'], ENT_QUOTES, $charset) . " " . $msg['acquisition_act_tab_pri_exposant'] . "</th>\n\t\t\t\t\t\t<th width='20%'>" . htmlentities($msg['acquisition_act_tab_typ'], ENT_QUOTES, $charset) . "<br />" . htmlentities($msg['acquisition_tva'], ENT_QUOTES, $charset) . " / " . htmlentities($msg['acquisition_remise'], ENT_QUOTES, $charset) . "</th>"; break; default: $modif_cde_form .= "\n\t\t\t\t\t\t<th width='6%'>" . htmlentities($msg['acquisition_act_tab_prittc'], ENT_QUOTES, $charset) . " " . $msg['acquisition_act_tab_pri_exposant'] . "</th>\n\t\t\t\t\t\t<th width='20%'>" . htmlentities($msg['acquisition_act_tab_typ'], ENT_QUOTES, $charset) . "<br />" . htmlentities($msg['acquisition_remise'], ENT_QUOTES, $charset) . "</th>"; break; } $modif_cde_form .= "\t\t<th width='20%'>" . htmlentities($msg['acquisition_act_tab_bud'], ENT_QUOTES, $charset) . "</th>\n\t\t\t\t\t\t<th width='10%'>" . htmlentities($msg['acquisition_lgstat'], ENT_QUOTES, $charset) . "</th>\n\t\t\t\t\t\t<th width='0px' ></th>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<!-- lignes -->\n\t\t\t\t</tbody>\n\t\t\t</table>\n\t\t</div>\n\t\n\t\t<div class='row'>\n\t\t\t<div class='left' >\n\t\t\t\t<input type='button' id='bt_add_line' tabindex='1' class='bouton_small' value='" . $msg['acquisition_act_add_lig'] . "' onclick=\"act_addLine();\" />\n\t\t\t</div>\n\t\t\t<div class='right'>\n\t\t\t\t<input type='button' tabindex='1' class='bouton_small' value='" . $msg['acquisition_del_chk_lig'] . "' onclick=\"act_delLines();\" />\n\t\t\t\t<input type='button' class='bouton_small' style='width:20px;' tabindex='1' value='+' onclick='act_switchCheck();' />\n\t\t\t</div>\n\t\t</div>\n\t\t\n\t\t<div class='row'></div>\n\t\t<hr />\n\t\t\n\t\t<div class='row'>\n\t\t\t<div class='left'>\n\t\t\t\t<input type='button' tabindex='1' class='bouton_small' value='" . $msg['acquisition_calc'] . "' onclick=\"act_calc();\" />"; if ($acquisition_gestion_tva) { $modif_cde_form .= "\n\t\t\t\t<label class='etiquette'>" . htmlentities($msg['acquisition_total_ht'], ENT_QUOTES, $charset) . "</label>\n\t\t\t\t<input type='text' id='tot_ht' name='tot_ht' class='saisie-10emd' style='text-align:right;' readonly='readonly' value='0.00' />\n\t\t\t\t<label class='etiquette'>" . htmlentities($msg['acquisition_tva'], ENT_QUOTES, $charset) . "</label>\n\t\t\t\t<input type='text' id='tot_tva' name='tot_tva' class='saisie-10emd' style='text-align:right;' readonly='readonly' value='0.00' />"; } $modif_cde_form .= "\t\n\t\t\t\t<label class='etiquette'>" . htmlentities($msg['acquisition_total_ttc'], ENT_QUOTES, $charset) . "</label>\n\t\t\t\t<input type='text' id='tot_ttc' name='tot_ttc' class='saisie-10emd' style='text-align:right;' readonly='readonly' value='0.00' />\n\t\t\t\t<label class='etiquette'>" . htmlentities($msg['acquisition_devise'], ENT_QUOTES, $charset) . "</label>\n\t\t\t\t<input type='text' id='devise' name='devise' class='saisie-5em' style='text-align:right;' value='!!devise!!' />\n\t\t\t</div>\n\t\t\t<div class='right'>\n\t\t\t\t<label class='etiquette'>" . htmlentities($msg['acquisition_tot_expl'], ENT_QUOTES, $charset) . "</label>\n\t\t\t\t<input type='text' id='tot_expl' name='tot_expl' class='saisie-5emd' style='text-align:right;' readonly='readonly' value='0' />\n\t\t\t</div>\n\t\t</div>\n\t\t\n\t\t<div class='row'></div>\n\t\t\n\t</div>\n\t\n\t<div class='row'>\n\t\t\t<label class='etiquette'>" . $msg['acquisition_act_tab_pri_exposant_label'] . "</label>\n\t</div>\t\t\t\t\t\n\t<div class='row'>\n\t\t<div class='left'>\n\t\t\t<input type='button' class='bouton' value='" . $msg['76'] . "' onclick=\"document.location='./acquisition.php?categ=ach&sub=cmde&action=list&id_bibli=!!id_bibli!!' \" />\n\t\t\t<!-- bouton_enr -->\n\t\t\t<!-- bouton_val -->\n\t\t\t<!-- bouton_dup -->\n\t\t\t<!-- bouton_imp -->\n\t\t\t<!-- bouton_audit -->\n\t\t</div>\n\t\t<div class='right'>\n\t\t\t<!-- bouton_sup -->\n\t\t</div>\n\t</div>\n\t\n\t<div class='row'></div>\n\n</form>\n<br /><br />\n<script type='text/javascript' src='./javascript/tablist.js'></script>\n<script type='text/javascript' src='./javascript/ajax.js'></script>\n<script type='text/javascript'>\n\tvar acquisition_gestion_tva=" . $acquisition_gestion_tva . ";\n</script>\n<script type='text/javascript' src='./javascript/actes.js'></script>\n<script type='text/javascript'>\t\n\t\n\tdocument.getElementById('statut').value='!!statut!!';\n\t\n\tvar msg_parcourir='" . addslashes($msg['parcourir']) . "'; \n\tvar msg_raz='" . addslashes($msg['raz']) . "'; \n\tvar msg_no_fou = '" . addslashes($msg['acquisition_cde_fou_err']) . "';\n\tvar msg_act_vide='" . addslashes($msg['acquisition_cde_vid']) . "';\n\tvar acquisition_budget = '" . $acquisition_budget . "';\n\tvar msg_no_bud = '" . addslashes($msg['acquisition_act_bud_err']) . "';\n\tvar msg_acquisition_comment_lg='" . htmlentities($msg['acquisition_comment_lg'], ENT_QUOTES, $charset) . "';\n\tvar msg_acquisition_comment_lo='" . htmlentities($msg['acquisition_comment_lo'], ENT_QUOTES, $charset) . "';\n\t\n\tvar lgstat_sel=\"" . lgstat::getHtmlSelect(array(0 => $deflt3lgstatcde), FALSE, array('id' => 'lg_statut[!!lig!!]', 'name' => 'lg_statut[!!lig!!]')) . "\";\n\t\n\tvar act_nblines='!!act_nblines!!';\n\tvar act_curline='!!act_nblines!!';\n\tif(act_nblines>0) {\n\t\tact_calc();\n\t} else {\n\t\tact_addLine(!!id_cde!!);\n\t}\n\t\n</script>\n<!-- jscript -->"; // ------------------------------------------------------------------------------ // template de création/modification pour les lignes de commande // ------------------------------------------------------------------------------ $modif_cde_row_form = "\n<tr id='R_!!no!!'>\n\t<td width='0px' style='overflow:visible;'>\n\t\t<img onclick=\"javascript:expandRow('C_!!no!!_', true);\" src='./images/plus.gif' name='C_!!no!!_Img' id='C_!!no!!_Img' class='act_cell_img_plus' />\n\t</td>\n\t<td>\n\t\t<input type='text' id='code[!!no!!]' name='code[!!no!!]' tabindex='1' class='in_cell' value='!!code!!' />\n\t\t<input type='button' tabindex='1' class='bouton_small' style='width:20px;' value='" . $msg['parcourir'] . "' onclick=\"act_getCode(this);\" />\n\t\t<input type='button' tabindex='1' class='bouton_small' style='width:20px;' value='" . $msg['raz'] . "' onclick=\"act_delCode(this);\" />\n\t</td>\n\t<td>\n\t\t<textarea id='lib[!!no!!]' name='lib[!!no!!]' tabindex='1' class='in_cell' rows='3' wrap='virtual'>!!lib!!</textarea>\n\t</td>\n\t<td>\n\t\t<input type='text' id='qte[!!no!!]' name='qte[!!no!!]' tabindex='1' class='in_cell_nb' value='!!qte!!' />\n\t</td>\n\t<td>\n\t\t<input type='text' id='prix[!!no!!]' name='prix[!!no!!]' tabindex='1' class='in_cell_nb' value='!!prix!!' !!convert_prix!!/>\n\t\t!!convert_ht_ttc!! \n\t</td>\n\t<td>\n\t\t<input type='hidden' id='typ[!!no!!]' name='typ[!!no!!]' value='!!typ!!' />\n\t\t<input type='text' id='lib_typ[!!no!!]' name='lib_typ[!!no!!]' tabindex='1' completion='types_produits' linkfield='id_fou' autfield='typ[!!no!!]' autocomplete='off' callback='callBackTypeProduit' class='in_cell_ro' value='!!lib_typ!!' /><input type='button' tabindex='1' class='bouton_small' style='width:20px' value='" . $msg['parcourir'] . "' onclick=\"act_getType(this);\" /><input type='button' tabindex='1' class='bouton_small' style='width:20px;' value='" . $msg['raz'] . "' onclick=\"act_delType(this);\" />"; if ($acquisition_gestion_tva) { $modif_cde_row_form .= " <input type='text' id='tva[!!no!!]' name='tva[!!no!!]' tabindex='1' class='in_cell_nb' style='width:20%;' value='!!tva!!' !!onchange_tva!! /> %"; } $modif_cde_row_form .= " <input type='text' id='rem[!!no!!]' name='rem[!!no!!]' tabindex='1' class='in_cell_nb' style='width:20%;' value='!!rem!!' /> %\t\t\n\t</td>\n\t<td>\n\t\t<input type='hidden' id='rub[!!no!!]' name='rub[!!no!!]' value='!!rub!!' />\n\t\t<input type='text' id='lib_rub[!!no!!]' name='lib_rub[!!no!!]' tabindex='1' completion='rubriques' param1='!!id_bibli!!' param2='!!id_exer!!' autfield='rub[!!no!!]' autocomplete='off' class='in_cell_ro' value='!!lib_rub!!' /><input type='button' tabindex='1' class='bouton_small' style='width:20px;' value='" . $msg['parcourir'] . "' onclick=\"act_getRubrique(this);\" /><input type='button' tabindex='1' class='bouton_small' style='width:20px;' value='" . $msg['raz'] . "' onclick=\"act_delRubrique(this);\" />\n\t\t!!force_ht_ttc!!\n\t</td>\t\n\t<td>\n\t\t!!lgstat!!\n\t</td>\t\n\t<td width='0px' style='overflow:visible;' >\n\t\t<input type='checkbox' id='chk[!!no!!]' name='chk[!!no!!]' tabindex='1' value='1' class='act_cell_chkbox2' />\n\t\t<input type='hidden' id='id_sug[!!no!!]' name='id_sug[!!no!!]' value='!!id_sug!!' /> \n\t\t<input type='hidden' id='id_lig[!!no!!]' name='id_lig[!!no!!]' value='!!id_lig!!' /> \n\t\t<input type='hidden' id='typ_lig[!!no!!]' name='typ_lig[!!no!!]' value='!!typ_lig!!' /> \t\n\t\t<input type='hidden' id='id_prod[!!no!!]' name='id_prod[!!no!!]' value='!!id_prod!!' />\n\t</td>\n</tr>\n<tr id='C_!!no!!_Child' class='act_cell_comments' style='display:none;'>\n\t<td colspan='9'>\n\t\t<table>\n\t\t\t<tr>\n\t\t\t\t<td width='10%' >" . htmlentities($msg['acquisition_comment_lg'], ENT_QUOTES, $charset) . "</th>\n\t\t\t\t<td width='40%'>\n\t\t\t\t\t<textarea id='comment_lg[!!no!!]' name='comment_lg[!!no!!]' tabindex='1' class='in_cell' rows='1' wrap='virtual'>!!comment_lg!!</textarea>\n\t\t\t\t</td>\n\t\t\t\t<td width='10%'>" . htmlentities($msg['acquisition_comment_lo'], ENT_QUOTES, $charset) . "</th>\n\t\t\t\t<td width='40%'>\n\t\t\t\t\t<textarea id='comment_lo[!!no!!]' name='comment_lo[!!no!!]' tabindex='1' class='in_cell' rows='1' wrap='virtual'>!!comment_lo!!</textarea>\n\t\t\t\t</td>\n\t\t\t<tr />\n\t\t</table>\n\t</td>\n</tr>\n"; //Date paiement modifiable $sel_date_pay_mod = "<input type='hidden' id='date_pay' name='date_pay' value='!!date_pay!!' />\n\t\t\t<input type='button' id='date_pay_lib' class='bouton_small' value='!!date_pay_lib!!' onclick=\"openPopUp('./select.php?what=calendrier&caller='+this.form.name+'&date_caller=¶m1=date_pay¶m2=date_pay_lib&auto_submit=NO&date_anterieure=YES', 'date_date_test', 250, 300, -2, -2, 'toolbar=no, dependent=yes, resizable=yes')\" />\n\t\t\t<input type='button' class='bouton_small' style='width:20px;' value='" . $msg['raz'] . "' onclick=\"this.form.elements['date_pay_lib'].value='" . $msg['parperso_nodate'] . "'; this.form.elements['date_pay'].value='';\" />"; //Date livraison modifiable $sel_date_liv_mod = "<input type='hidden' id='date_liv' name='date_liv' value='!!date_liv!!' />\n\t\t\t<input type='button' id='date_liv_lib' class='bouton_small' value='!!date_liv_lib!!' onclick=\"openPopUp('./select.php?what=calendrier&caller='+this.form.name+'&date_caller=¶m1=date_liv¶m2=date_liv_lib&auto_submit=NO&date_anterieure=YES', 'date_date_test', 250, 300, -2, -2, 'toolbar=no, dependent=yes, resizable=yes')\" />\n\t\t\t<input type='button' class='bouton_small' style='width:20px;' value='" . $msg['raz'] . "' onclick=\"this.form.elements['date_liv_lib'].value='" . $msg['parperso_nodate'] . "'; this.form.elements['date_liv'].value='';\" />"; //Date livraison non modifiable $sel_date_liv_fix = "<input type='hidden' id='date_liv' name='date_liv' value='!!date_liv!!' />!!date_liv_lib!!"; $bt_enr = "<input type='button' class='bouton' value='" . $msg['77'] . "' \n\t\t\tonclick=\" \n\t\t\t\tr=act_verif();\n\t\t\t\tif (!r) return false;\n\t\t\t\tact_calc(); \n\t\t\t\tdocument.forms['act_modif'].setAttribute('action', 'acquisition.php?categ=ach&sub=cmde&action=update'); \n\t\t\t\tdocument.forms['act_modif'].submit(); \" />";
function show_delivery_form($msg_client = '') { global $dbh, $msg, $charset; global $no, $id_lig, $id_prod, $typ_lig; global $recept_deliv_form, $recept_deliv_form_suite; global $recept_form_qte_liv, $recept_bt_update, $recept_bt_undo, $previous, $recept_bt_next; $form = $recept_deliv_form; $lg = new lignes_actes($id_lig); $act = new actes($lg->num_acte); $fou = new entites($act->num_fournisseur); $nb_rec = $lg->getNbDelivered($id_lig); $nb_sol = $lg->nb - $nb_rec; if ($nb_sol > 0) { $form = str_replace('<!-- bt_update -->', $recept_bt_update, $form); $form = str_replace('<!-- qte_liv -->', $recept_form_qte_liv, $form); } else { $form = str_replace('<!-- qte_liv -->', '', $form); } if ($previous) { $tp = unserialize(rawurldecode(stripslashes($previous))); if (is_array($tp) && count($tp)) { $form = str_replace('<!-- bt_undo -->', $recept_bt_undo, $form); $form = str_replace('!!previous!!', stripslashes($previous), $form); } else { $previous = 0; } } if (!$previous) { $form = str_replace('<!-- bt_undo -->', '', $form); $form = str_replace('!!previous!!', 0, $form); } $form = str_replace('<!-- bt_next -->', $recept_bt_next, $form); $lgstat_form = lgstat::getHtmlSelect(array(0 => 0), FALSE, array('id' => 'sel_lgstat_!!id_lig!!', 'onchange' => 'recept_upd_lgstat(this.getAttribute("id"));')); $form = str_replace('!!lib_acte!!', htmlentities($msg['acquisition_recept_fou'], ENT_QUOTES, $charset) . " " . htmlentities($fou->raison_sociale, ENT_QUOTES, $charset) . ' ' . htmlentities($act->type_acte ? $msg['acquisition_act_num_dev'] : $msg['acquisition_act_num_cde'], ENT_QUOTES, $charset) . htmlentities($act->numero, ENT_QUOTES, $charset), $form); $form = str_replace('!!code!!', htmlentities($lg->code, ENT_QUOTES, $charset), $form); $form = str_replace('!!lib!!', nl2br(htmlentities($lg->libelle, ENT_QUOTES, $charset)), $form); $form = str_replace('!!qte_cde!!', $lg->nb, $form); $form = str_replace('!!qte_rec!!', $nb_rec, $form); $form = str_replace('!!qte_sol!!', $nb_sol, $form); $lgstat_form = str_replace("value='" . $lg->statut . "'", "value='" . $lg->statut . "' selected='selected' ", $lgstat_form); $form = str_replace('!!lgstat!!', $lgstat_form, $form); $form = str_replace('!!comment_lg!!', nl2br(htmlentities($lg->commentaires_gestion, ENT_QUOTES, $charset)), $form); $form = str_replace('!!comment_lo!!', nl2br(htmlentities($lg->commentaires_opac, ENT_QUOTES, $charset)), $form); $form = str_replace('!!id_lig!!', $id_lig, $form); $form = str_replace('!!id_prod!!', $id_prod, $form); $form = str_replace('!!typ_lig!!', $typ_lig, $form); $form = str_replace('!!no!!', $no, $form); switch ($typ_lig) { case '1': //notice $form .= do_notice_form($id_prod); $form .= do_explnum_form(); $form .= do_expl_form(); if ($lg->num_acquisition) { $form .= do_sugg_form($lg->num_acquisition); } break; case '2': //bulletin $form .= do_bull_form($id_prod); $form .= do_explnum_form(); $form .= do_expl_form(); //if ($lg->num_acquisition) $form.=do_sugg_form($lg->num_acquisition); break; case '3': //frais break; case '4': //abt break; case '5': //article $form .= do_art_form($id_prod); $form .= do_explnum_form(); if ($lg->num_acquisition) { $form .= do_sugg_form($lg->num_acquisition); } break; default: //non catalogué if ($lg->num_acquisition) { $form .= do_sugg_form($lg->num_acquisition); } break; } $form = str_replace('!!msg_client!!', $msg_client, $form); print $form . $recept_deliv_form_suite; }
function show_lig_cde_from_sug($sugchk) { global $dbh, $charset; global $acquisition_gestion_tva; global $modif_cde_row_form, $deflt3lgstatcde; $form = "\t\n\t<script type='text/javascript'>\t\n\t\tacquisition_force_ttc='" . $msg["acquisition_force_ttc"] . "';\n\t\tacquisition_force_ht='" . $msg["acquisition_force_ht"] . "';\n\t</script>\n\t"; $i = 0; $lgstat_form = lgstat::getHtmlSelect(array(0 => $deflt3lgstatcde), FALSE, array('id' => 'lg_statut[!!i!!]', 'name' => 'lg_statut[!!i!!]')); $arrchk = unserialize(rawurldecode(stripslashes($sugchk))); foreach ($arrchk as $value) { $i++; $sug = new suggestions($value); $form .= $modif_cde_row_form; $code = ""; $taec = ""; $prix = '0'; $nb = 'none'; if ($sug->num_notice) { $q = "select niveau_biblio from notices where notice_id='" . $sug->num_notice . "' "; $r = pmb_mysql_query($q, $dbh); if (pmb_mysql_num_rows($r)) { $nb = pmb_mysql_result($r, 0, 0); } } switch ($nb) { case 'a': $typ_lig = 1; $notice = new sel_article_display($sug->num_notice, ''); $notice->getData(); $notice->responsabilites = get_notice_authors($sug->num_notice); $notice->doHeader(); $taec = $notice->titre; if ($notice->auteur1) { $taec .= "\n" . $notice->auteur1; } if ($notice->in_bull) { $taec .= "\n" . $notice->in_bull; } $prix = $notice->prix; break; case 'm': $typ_lig = 1; $notice = new sel_mono_display($sug->num_notice, ''); $notice->getData(); $notice->responsabilites = get_notice_authors($sug->num_notice); $notice->doHeader(); $code = $notice->code; $taec = $notice->titre; if ($notice->auteur1) { $taec .= "\n" . $notice->auteur1; } if ($notice->editeur1) { $taec .= "\n" . $notice->editeur1; } if ($notice->editeur1 && $notice->ed_date) { $taec .= ", " . $notice->ed_date; } elseif ($notice->ed_date) { $taec .= $notice->ed_date; } if ($notice->collection) { $taec .= "\n" . $notice->collection; } $prix = $notice->prix; break; default: $typ_lig = 0; $code = htmlentities($sug->code, ENT_QUOTES, $charset); $taec = htmlentities($sug->titre, ENT_QUOTES, $charset); if ($sug->auteur != "") { $taec .= "\n" . htmlentities($sug->auteur, ENT_QUOTES, $charset); } if ($sug->editeur != "") { $taec .= "\n" . htmlentities($sug->editeur, ENT_QUOTES, $charset); if ($sug->date_publi != "0000-00-00") { $taec .= "," . htmlentities($sug->date_publi, ENT_QUOTES, $charset); } } $prix = htmlentities($sug->prix, ENT_QUOTES, $charset); break; } $form = str_replace('!!no!!', $i, $form); $form = str_replace('!!code!!', $code, $form); $form = str_replace('!!lib!!', $taec, $form); $form = str_replace('!!qte!!', $sug->nb, $form); $form = str_replace('!!prix!!', $prix, $form); if ($acquisition_gestion_tva) { $form = str_replace('!!tva!!', $row->tva, $form); if ($acquisition_gestion_tva == 1) { $prix_ttc = round($row->prix + $row->prix / 100 * $row->tva, 2); $onchange_tva = "\n\t\t\t\t\tonChange='document.getElementById(\"convert_ht_ttc_{$i}\").innerHTML=\n\t\t\t\t\t\tht_to_ttc(document.getElementById(\"prix[{$i}]\").value,document.getElementById(\"tva[{$i}]\").value);\n\t\t\t\t\t' "; $convert_prix = "\n\t\t\t\t\tonChange='document.getElementById(\"convert_ht_ttc_{$i}\").innerHTML=\n\t\t\t\t\t\tht_to_ttc(document.getElementById(\"prix[{$i}]\").value,document.getElementById(\"tva[{$i}]\").value);\n\t\t\t\t\t' "; $convert_ht_ttc = "\n\t\t\t\t<span class='convert_ht_ttc' id='convert_ht_ttc_{$i}' \n\t\t\t\t\tonclick='\n\t\t\t\t\t\tdocument.getElementById(\"input_convert_ht_ttc_{$i}\").value=\"\";\n\t\t\t\t\t\tdocument.getElementById(\"input_convert_ht_ttc_{$i}\").style.visibility=\"visible\"; \n\t\t\t\t\t\tdocument.getElementById(\"input_convert_ht_ttc_{$i}\").focus();\n\t\t\t\t\t'\t\t\t\t\t\t\t\n\t\t\t\t>" . $prix_ttc . "</span>\n\t\t\t\t<input style='visibility:hidden' type='text' id='input_convert_ht_ttc_{$i}' name='convert_ht_ttc_{$i}' value='' \t\t\t\t\n\t\t\t\t\tonBlur='document.getElementById(\"input_convert_ht_ttc_{$i}\").style.visibility=\"hidden\";'\t\t\t\t\n\t\t\t\t\tonChange='document.getElementById(\"prix[{$i}]\").value=\n\t\t\t\t\t\tttc_to_ht(document.getElementById(\"input_convert_ht_ttc_{$i}\").value,document.getElementById(\"tva[{$i}]\").value);\n\t\t\t\t\t\tdocument.getElementById(\"input_convert_ht_ttc_{$i}\").style.visibility=\"hidden\"; \n\t\t\t\t\t\tdocument.getElementById(\"convert_ht_ttc_{$i}\").innerHTML=document.getElementById(\"input_convert_ht_ttc_{$i}\").value;\n\t\t\t\t\t' \n\t\t\t\t/>"; } elseif ($acquisition_gestion_tva == 2) { $prix = $row->prix; $tva = $row->tva; $prix_ht = round($prix / ($tva / 100 + 1), 2); $onchange_tva = "\n\t\t\t\t\tonChange='document.getElementById(\"convert_ht_ttc_{$i}\").innerHTML=\n\t\t\t\t\t\tttc_to_ht(document.getElementById(\"prix[{$i}]\").value,document.getElementById(\"tva[{$i}]\").value);\n\t\t\t\t\t' "; $convert_prix = "\n\t\t\t\t\tonChange='document.getElementById(\"convert_ht_ttc_{$i}\").innerHTML=\n\t\t\t\t\t\tttc_to_ht(document.getElementById(\"prix[{$i}]\").value,document.getElementById(\"tva[{$i}]\").value);\n\t\t\t\t\t' "; $convert_ht_ttc = "\n\t\t\t\t<span class='convert_ht_ttc' id='convert_ht_ttc_{$i}' \n\t\t\t\t\tonclick='\n\t\t\t\t\t\tdocument.getElementById(\"input_convert_ht_ttc_{$i}\").value=\"\";\n\t\t\t\t\t\tdocument.getElementById(\"input_convert_ht_ttc_{$i}\").style.visibility=\"visible\"; \n\t\t\t\t\t\tdocument.getElementById(\"input_convert_ht_ttc_{$i}\").focus();\n\t\t\t\t\t'\t\t\t\t\t\t\t\n\t\t\t\t>" . $prix_ht . "</span>\n\t\t\t\t<input style='visibility:hidden' type='text' id='input_convert_ht_ttc_{$i}' name='convert_ht_ttc_{$i}' value='{$prix_ttc}' \t\t\t\t\n\t\t\t\t\tonBlur='document.getElementById(\"input_convert_ht_ttc_{$i}\").style.visibility=\"hidden\";'\t\t\t\t\n\t\t\t\t\tonChange='document.getElementById(\"prix[{$i}]\").value=\n\t\t\t\t\t\tht_to_ttc(document.getElementById(\"input_convert_ht_ttc_{$i}\").value,document.getElementById(\"tva[{$i}]\").value);\n\t\t\t\t\t\tdocument.getElementById(\"input_convert_ht_ttc_{$i}\").style.visibility=\"hidden\"; \n\t\t\t\t\t\tdocument.getElementById(\"convert_ht_ttc_{$i}\").innerHTML=document.getElementById(\"input_convert_ht_ttc_{$i}\").value;\n\t\t\t\t\t' \n\t\t\t\t/>"; } if ($row->debit_tva == 1) { $force_ht_ttc = "<br />\n\t\t\t\t<input type='hidden' id='force_debit[{$i}]' name='force_debit[{$i}]' value='1' />\t\t\t\t\n\t\t\t\t<span class='force_ht_ttc' id='force_ht_ttc_{$i}'\t\t\t\t\n\t\t\t\t\tonclick='\n\t\t\t\t\t\tif(document.getElementById(\"force_debit[{$i}]\").value==1){\n\t\t\t\t\t\t\tdocument.getElementById(\"force_ht_ttc_{$i}\").innerHTML=\"" . $msg["acquisition_force_ttc"] . "\";\n\t\t\t\t\t\t\tdocument.getElementById(\"force_debit[{$i}]\").value=2;\n\t\t\t\t\t\t}else{\t\t\t\t\n\t\t\t\t\t\t\tdocument.getElementById(\"force_ht_ttc_{$i}\").innerHTML=\"" . $msg["acquisition_force_ht"] . "\";\n\t\t\t\t\t\t\tdocument.getElementById(\"force_debit[{$i}]\").value=1;\n\t\t\t\t\t\t}\t\t\t\t\n\t\t\t\t\t'\t\t\t\t\n\t\t\t\t>" . $msg["acquisition_force_ht"] . "</span>"; } else { $force_ht_ttc = "<br />\n\t\t\t\t<input type='hidden' id='force_debit[{$i}]' name='force_debit[{$i}]' value='2' />\t\t\t\t\n\t\t\t\t<span class='force_ht_ttc' id='force_ht_ttc_{$i}'\t\t\t\t\n\t\t\t\t\tonclick='\n\t\t\t\t\t\tif(document.getElementById(\"force_debit[{$i}]\").value==2){\n\t\t\t\t\t\t\tdocument.getElementById(\"force_ht_ttc_{$i}\").innerHTML=\"" . $msg["acquisition_force_ht"] . "\";\n\t\t\t\t\t\t\tdocument.getElementById(\"force_debit[{$i}]\").value=1;\n\t\t\t\t\t\t}else{\t\t\t\t\n\t\t\t\t\t\t\tdocument.getElementById(\"force_ht_ttc_{$i}\").innerHTML=\"" . $msg["acquisition_force_ttc"] . "\";\n\t\t\t\t\t\t\tdocument.getElementById(\"force_debit[{$i}]\").value=2;\n\t\t\t\t\t\t}\t\t\t\t\n\t\t\t\t\t'\t\t\t\t\n\t\t\t\t>" . $msg["acquisition_force_ttc"] . "</span>"; } } $form = str_replace('!!onchange_tva!!', $onchange_tva, $form); $form = str_replace('!!convert_prix!!', $convert_prix, $form); $form = str_replace('!!convert_ht_ttc!!', $convert_ht_ttc, $form); $form = str_replace('!!force_ht_ttc!!', $force_ht_ttc, $form); $form = str_replace('!!rem!!', '0.00', $form); $lgstat = str_replace('!!i!!', $i, $lgstat_form); $form = str_replace('!!lgstat!!', $lgstat, $form); $form = str_replace('!!comment_lg!!', htmlentities($row->commentaires_gestion, ENT_QUOTES, $charset), $form); $form = str_replace('!!comment_lo!!', htmlentities($row->commentaires_opac, ENT_QUOTES, $charset), $form); $form = str_replace('!!typ!!', '0', $form); $form = str_replace('!!lib_typ!!', '', $form); $form = str_replace('!!rub!!', '0', $form); $form = str_replace('!!lib_rub!!', '', $form); $form = str_replace('!!id_sug!!', $sug->id_suggestion, $form); $form = str_replace('!!id_lig!!', '0', $form); $form = str_replace('!!typ_lig!!', $typ_lig, $form); $form = str_replace('!!id_prod!!', $sug->num_notice, $form); } $t = array(0 => $i, 1 => $form); return $t; }
function show_list_recept() { global $msg, $charset, $dbh, $tab_bib; global $recept_search_form, $recept_list_form, $recept_search_form_suite, $recept_hrow_form, $recept_row_form, $sel_fou_form, $sel_dem_form, $sel_rub_form, $sel_date_form; global $bt_app, $bt_rel, $bt_chk, $link_not, $link_bull, $link_art, $link_sug, $bt_cat; global $user_userid; global $lgstat_filter, $deflt3lgstatcde; global $id_bibli, $id_exer; global $f_fou_code, $f_dem_code, $t_dem, $f_rub_code; global $cde_query, $all_query, $recept_query; global $chk_dev; global $lgstat_all, $comment_lg_all, $comment_lo_all; global $page, $nb_per_page, $nbr_lignes, $last_param; global $date_inf, $date_sup; //verifications if (!$id_bibli) { $id_bibli = entites::getSessionBibliID(); } if (!$id_bibli) { $id_bibli = $tab_bib[0][0]; } entites::setSessionBibliId($id_bibli); $id_exer = exercices::getSessionExerciceId($id_bibli, $id_exer); //Affichage form de recherche $titre = htmlentities($msg['recherche'] . ' : ' . $msg['acquisition_recept'], ENT_QUOTES, $charset); $recept_form = $recept_search_form; $recept_form = str_replace('!!form_title!!', $titre, $recept_form); $serialized_search = rawurlencode(serialize(array('id_bibli' => $id_bibli, 'id_exer' => $id_exer, 'f_fou_code' => $f_fou_code, 'f_dem_code' => $f_dem_code, 't_dem' => $t_dem, 'f_rub_code' => $f_rub_code, 'cde_query' => stripslashes($cde_query), 'all_query' => stripslashes($all_query), 'chk_dev' => $chk_dev, 'lgstat_filter' => $lgstat_filter))); $recept_form = str_replace('!!serialized_search!!', $serialized_search, $recept_form); //Affichage selecteur etablissement $sel_bibli = entites::getBibliHtmlSelect(SESSuserid, $id_bibli, FALSE, array('class' => 'saisie-50em', 'id' => 'id_bibli', 'name' => 'id_bibli', 'onChange' => 'submit();')); $recept_form = str_replace('<!-- sel_bibli -->', $sel_bibli, $recept_form); //Affichage selecteur exercice $sel_exer = exercices::getHtmlSelect($id_bibli, $id_exer, FALSE, array('id' => 'id_exer', 'name' => 'id_exer', 'onChange' => 'submit();')); $recept_form = str_replace('<!-- sel_exer -->', $sel_exer, $recept_form); //Affichage fournisseurs $i = 0; $tab_fou2 = array(); if (is_array($f_fou_code) && count($f_fou_code)) { $tab_fou = entites::getRaisonSociale($f_fou_code, $id_bibli); foreach ($f_fou_code as $v) { if ($v && $tab_fou[$v]) { $tab_fou2[$v] = $tab_fou[$v]; if ($i > 0) { $recept_form = str_replace('<!-- sel_fou -->', $sel_fou_form . '<!-- sel_fou -->', $recept_form); $recept_form = str_replace('!!i!!', $i, $recept_form); } $recept_form = str_replace('!!f_fou_code!!', $v, $recept_form); $recept_form = str_replace('!!f_fou!!', htmlentities($tab_fou[$v], ENT_QUOTES, $charset), $recept_form); $i++; } } $recept_form = str_replace('!!max_fou!!', $i > 0 ? $i : '1', $recept_form); } if (!$i) { $recept_form = str_replace('!!f_fou_code!!', '0', $recept_form); $recept_form = str_replace('!!f_fou!!', '', $recept_form); $recept_form = str_replace('!!max_fou!!', '1', $recept_form); } //Affichage demandeurs $i = 0; $tab_empr = array(); $tab_user = array(); if (is_array($f_dem_code) && count($f_dem_code) && is_array($t_dem) && count($t_dem)) { foreach ($f_dem_code as $k => $v) { if ($t_dem[$k]) { $tab_empr[] = $v; } else { $tab_user[] = $v; } } $tab_empr = emprunteur::getName($tab_empr); $tab_user = getUserName($tab_user); foreach ($f_dem_code as $k => $v) { if ($v && ($t_dem[$k] === '0' && $tab_user[$v] || $t_dem[$k] === '1' && $tab_empr[$v])) { if ($i > 0) { $recept_form = str_replace('<!-- sel_dem -->', $sel_dem_form . '<!-- sel_dem -->', $recept_form); $recept_form = str_replace('!!i!!', $i, $recept_form); } $recept_form = str_replace('!!f_dem_code!!', $v, $recept_form); $recept_form = str_replace('!!t_dem!!', $t_dem[$k], $recept_form); if ($t_dem[$k]) { $recept_form = str_replace('!!f_dem!!', htmlentities($tab_empr[$v], ENT_QUOTES, $charset), $recept_form); } else { $recept_form = str_replace('!!f_dem!!', htmlentities($tab_user[$v], ENT_QUOTES, $charset), $recept_form); } $i++; } } $recept_form = str_replace('!!max_dem!!', $i > 0 ? $i : '1', $recept_form); } if (!$i) { $recept_form = str_replace('!!f_dem_code!!', '0', $recept_form); $recept_form = str_replace('!!t_dem!!', '0', $recept_form); $recept_form = str_replace('!!f_dem!!', '', $recept_form); $recept_form = str_replace('!!max_dem!!', '1', $recept_form); } //Affichage rubriques budgetaires $i = 0; $tab_rub2 = array(); if (is_array($f_rub_code) && count($f_rub_code)) { $tab_rub = rubriques::getLibelle($f_rub_code, $id_bibli, $id_exer, SESSuserid); foreach ($f_rub_code as $v) { if ($v && $tab_rub[$v]) { $tab_rub2[$v] = $tab_rub[$v]; if ($i > 0) { $recept_form = str_replace('<!-- sel_rub -->', $sel_rub_form . '<!-- sel_rub -->', $recept_form); $recept_form = str_replace('!!i!!', $i, $recept_form); } $recept_form = str_replace('!!f_rub_code!!', $v, $recept_form); $recept_form = str_replace('!!f_rub!!', htmlentities($tab_rub[$v], ENT_QUOTES, $charset), $recept_form); $i++; } } $recept_form = str_replace('!!max_rub!!', $i > 0 ? $i : '1', $recept_form); } if (!$i) { $recept_form = str_replace('!!f_rub_code!!', '0', $recept_form); $recept_form = str_replace('!!f_rub!!', '', $recept_form); $recept_form = str_replace('!!max_rub!!', '1', $recept_form); } //Affichage zone commande if (!isset($chk_dev)) { $chk_dev = TYP_ACT_CDE; } if ($chk_dev) { $recept_form = str_replace('!!dev_checked!!', "checked='checked'", $recept_form); $recept_form = str_replace('!!cde_checked!!', '', $recept_form); } else { $recept_form = str_replace('!!dev_checked!!', '', $recept_form); $recept_form = str_replace('!!cde_checked!!', "checked='checked'", $recept_form); } $recept_form = str_replace('!!cde_query!!', htmlentities(stripslashes($cde_query), ENT_QUOTES, $charset), $recept_form); //Affichage selecteur dates $sel_date_form[0] = str_replace('!!msg!!', htmlentities($msg['acquisition_recept_date'], ENT_QUOTES, $charset), $sel_date_form[0]); if ($date_inf) { $date_inf_lib = formatdate($date_inf); } else { $date_inf_lib = $msg['parperso_nodate']; } $sel_date_form[1] = str_replace('!!date_inf!!', $date_inf, $sel_date_form[1]); $sel_date_form[1] = str_replace('!!date_inf_lib!!', $date_inf_lib, $sel_date_form[1]); if ($date_sup) { $date_sup_lib = formatdate($date_sup); } else { $date_sup_lib = $msg['parperso_nodate']; } $sel_date_form[2] = str_replace('!!date_sup!!', $date_sup, $sel_date_form[2]); $sel_date_form[2] = str_replace('!!date_sup_lib!!', $date_sup_lib, $sel_date_form[2]); $sel_date_form[0] = sprintf($sel_date_form[0], $sel_date_form[1], $sel_date_form[2]); $recept_form = str_replace('<!-- sel_date -->', $sel_date_form[0], $recept_form); //Creation selecteur statut de lignes de commandes if (!(is_array($lgstat_filter) && count($lgstat_filter))) { $lgstat_filter = array(0 => $deflt3lgstatcde); } $sel_lgstat = lgstat::getHtmlSelect($lgstat_filter, FALSE, array('id' => 'lgstat_filter[]', 'name' => 'lgstat_filter[]', 'multiple' => 'multiple', 'size' => '5')); $recept_form = str_replace('<!-- sel_lgstat -->', $sel_lgstat, $recept_form); //Affichage zone tous les champs $recept_form = str_replace('!!all_query!!', htmlentities(stripslashes($all_query), ENT_QUOTES, $charset), $recept_form); //Prise en compte du formulaire de recherche // nombre de références par pages if (!$nb_per_page) { $nb_per_page = 10; } if (!$page) { $page = 1; } $debut = ($page - 1) * $nb_per_page; //La recherche ici $recept = new receptions($id_bibli, $id_exer); //filtre $filtres = $recept->setFiltres(array_keys($tab_fou2), array_keys($tab_empr), array_keys($tab_user), array_keys($tab_rub2), $chk_dev, $cde_query, $lgstat_filter, $date_inf, $date_sup); // comptage if (!$nbr_lignes) { $nbr_lignes = $recept->calcNbLignes($all_query); $err = $recept->getError(); } // liste if ($nbr_lignes) { $t_list = $recept->getLignes(); //Affichage des lignes $recept_form .= $recept_list_form; //Affichage zone de reception $recept_form = str_replace('!!recept_query!!', htmlentities(stripslashes($recept_query), ENT_QUOTES, $charset), $recept_form); $tab_aff = array(); $lgstat_form = lgstat::getHtmlSelect(array(0 => 0), FALSE, array('id' => 'sel_lgstat_!!id_lig!!', 'onchange' => 'recept_upd_lgstat(this.getAttribute("id"));')); $act_form = ''; $i = 1; foreach ($t_list as $id_acte => $t_row) { //Affichage lignes à recevoir foreach ($t_row as $id_ligne => $row) { if (!in_array($id_acte, $tab_aff)) { array_push($tab_aff, $id_acte); $recept_form = str_replace('<!-- actes -->', $act_form . '<!-- actes -->', $recept_form); $act_form = str_replace('!!lib_acte!!', htmlentities($msg['acquisition_recept_fou'], ENT_QUOTES, $charset) . " <a href=\"./acquisition.php?categ=ach&sub=fourn&action=modif&id_bibli=" . $id_bibli . '&id=' . $row['num_fournisseur'] . "\">" . htmlentities($row['raison_sociale'], ENT_QUOTES, $charset) . "</a>" . ' ' . (htmlentities($row['type_acte'] ? $msg['acquisition_act_num_dev'] : $msg['acquisition_act_num_cde'], ENT_QUOTES, $charset) . "<a href=\"./acquisition.php?categ=ach&sub=" . ($row['type_acte'] ? 'devi' : 'cmde') . "&action=modif&id_bibli=" . $id_bibli . ($row['type_acte'] ? '&id_dev=' : '&id_cde=') . $id_acte . "\">" . htmlentities($row['numero'], ENT_QUOTES, $charset) . "</a>") . ' ' . htmlentities($msg['653'], ENT_QUOTES, $charset) . ' ' . formatdate($row['date_acte']), $recept_hrow_form); } $row_form = $recept_row_form; $row_form = str_replace('!!code!!', htmlentities($row['code'], ENT_QUOTES, $charset), $row_form); $row_form = str_replace('!!lib!!', nl2br(htmlentities($row['libelle'], ENT_QUOTES, $charset)), $row_form); $row_form = str_replace('!!qte_cde!!', $row['nb_cde'], $row_form); $row_form = str_replace('!!qte_liv!!', $row['nb_liv'], $row_form); $row_form = str_replace('!!qte_sol!!', $row['nb_sol'], $row_form); $lgstat_row_form = str_replace("value='" . $row['statut'] . "'", "value='" . $row['statut'] . "' selected='selected' ", $lgstat_form); $row_form = str_replace('!!lgstat!!', $lgstat_row_form, $row_form); $row_form = str_replace('!!comment_lg!!', nl2br(htmlentities($row['commentaires_gestion'], ENT_QUOTES, $charset)), $row_form); $row_form = str_replace('!!comment_lo!!', nl2br(htmlentities($row['commentaires_opac'], ENT_QUOTES, $charset)), $row_form); $row_form = str_replace('!!id_lig!!', $id_ligne, $row_form); $row_form = str_replace('!!typ_lig!!', $row['type_ligne'], $row_form); if ($row['num_produit']) { switch ($row['type_ligne']) { case '1': //notice $row_form = str_replace('<!-- link_cat -->', $link_not, $row_form); break; case '2': //bulletin $row_form = str_replace('<!-- link_cat -->', $link_bull, $row_form); break; case '5': //article $id_bull = analysis::getBulletinIdFromAnalysisId($row['num_produit']); if ($id_bull) { $row_form = str_replace('<!-- link_cat -->', $link_art, $row_form); $row_form = str_replace('!!id_bull!!', $id_bull, $row_form); } break; default: break; } } else { $tmp_bt_cat = str_replace('!!id_lig!!', $id_ligne, $bt_cat); $row_form = str_replace('<!-- bt_cat -->', $tmp_bt_cat, $row_form); } if ($row['num_acquisition']) { $row_form = str_replace('<!-- link_sug -->', $link_sug, $row_form); $row_form = str_replace('!!id_sug!!', $row['num_acquisition'], $row_form); } $row_form = str_replace('!!id_prod!!', $row['num_produit'], $row_form); $row_form = str_replace('!!no!!', $i, $row_form); $tab_rel = array(); $tab_rel = lignes_actes::getRelances($id_ligne); $row_form = str_replace('!!nb_relances!!', htmlentities(sprintf($msg['acquisition_recept_hist'], count($tab_rel)), ENT_QUOTES, $charset), $row_form); if (count($tab_rel)) { $row_form = str_replace('<!-- relances -->', implode(' - ', $tab_rel), $row_form); } $act_form = str_replace('<!-- lignes -->', $row_form . '<!-- lignes -->', $act_form); $i++; } } $recept_form = str_replace('<!-- actes -->', $act_form . '<!-- actes -->', $recept_form); $recept_form = str_replace('!!max_no!!', $i * 1 - 1, $recept_form); //Affichage commentaires $recept_form = str_replace('!!comment_lg_all!!', htmlentities(stripslashes($comment_lg_all), ENT_QUOTES, $charset), $recept_form); $recept_form = str_replace('!!comment_lo_all!!', htmlentities(stripslashes($comment_lo_all), ENT_QUOTES, $charset), $recept_form); //boutons $lgstat_all = lgstat::getHtmlSelect(array(0 => 0), $msg['acquisition_recept_lgstat_none'], array('id' => 'sel_lgstat_all', 'name' => 'sel_lgstat_all')); $recept_form = str_replace('<!-- sel_lgstat_all -->', $lgstat_all, $recept_form); $recept_form = str_replace('<!-- bt_app -->', $bt_app, $recept_form); $recept_form = str_replace('<!-- bt_rel -->', $bt_rel, $recept_form); $recept_form = str_replace('<!-- bt_chk -->', $bt_chk, $recept_form); //Barre de navigation /* if (!$last_param) { $nav_bar = aff_pagination ($url_base, $nbr_lignes, $nb_per_page, $page, 10, true, true) ; } else { $nav_bar = ""; } $recept_form=str_replace('<!-- nav_bar -->', $nav_bar,$recept_form); */ $recept_form .= $recept_search_form_suite; print $recept_form; } elseif ($err) { //erreur dans la recherche $recept_form .= $recept_search_form_suite; print $recept_form; print $err; } else { // pas de resultat $recept_form .= $recept_search_form_suite; print $recept_form; $cle = array(); if ($cde_query) { $cle[] = htmlentities($msg['acquisition_recept_act_search'] . ' ' . stripslashes($cde_query), ENT_QUOTES, $charset); } if ($all_query) { $cle[] = htmlentities($msg['acquisition_recept_global_search'] . ' ' . stripslashes($all_query), ENT_QUOTES, $charset); } error_message($msg['acquisition_recept_rech'], str_replace('!!cle!!', implode(',', $cle), $msg['acquisition_recept_rech_error']), 0); } }