isAppend() == true) { $ret.= '
'; $ret.=HtmlInput::title_box(_('Nouveau plan'),'','none'); $ret.= '
'; $ret.=dossier::hidden(); $ret.= $new->form(); $ret.= HtmlInput::hidden("sa","pa_write"); $ret.=HtmlInput::submit("submit",_("Enregistre")); $ret.= '
'; $ret.= '
'; } else { $ret.= '
'. '

'. _("Maximum de plan analytique est atteint"). "

"; } $sa="anc_menu"; } // Add if ( $sa == "pa_write") { $new=new Anc_Plan($cn); if ( $new->isAppend() == false) { $ret.= '

'. _("Maximum de plan analytique est atteint"). "

"; } else { $new=new Anc_Plan($cn); $new->name=$_POST['pa_name']; $new->description=$_POST['pa_description']; $new->add(); } $sa="anc_menu"; } // Update the PA if ( $sa == "pa_update" ) { $new=new Anc_Plan($cn,$_GET['pa_id']); $new->name=$_POST['pa_name']; $new->description=$_POST['pa_description']; $new->update(); $ret='
'; $ret.='

'._('Mis à jour').'

'; $ret.="
"; $sa="anc_menu"; } // show the form for add a poste if ( $sa=='po_add') { $po=new Anc_Account($cn); $po->pa_id=$_REQUEST['pa_id']; $wSa=HtmlInput::hidden("sa","po_write"); $ret.='
'; $ret.=h2(_("Ajout d'un poste analytique")); $ret.='
'; $ret.=dossier::hidden(); $ret.=$po->form(); $ret.=$wSa; $ret.=HtmlInput::submit("add",_("Ajout")); $ret.="
"; $ret.="
"; } // record the poste if ( $sa=="po_write") { // var_dump($_POST); $po=new Anc_Account($cn); $po->get_from_array($_POST); $po->add(); $sa="pa_detail"; } /* delete pa */ if ( $sa == "pa_delete") { $delete=new Anc_Plan($cn,$_GET['pa_id']); $delete->delete(); $sa="anc_menu"; } /* po detail *---> in ajax : montre detail d'un poste analytique * */ if ( $sa=="po_detail") { $ret.=h2(_('Modification')); $po=new Anc_Account($cn,$_GET['po_id']); $po->get_by_id(); $ret.='
'; $ret.='
'; $ret.=dossier::hidden(); $ret.=$po->form(); $ret.=HtmlInput::hidden('sa','po_update'); $ret.=HtmlInput::submit('Correction','Correction'); $ret.=sprintf('id, $_REQUEST['pa_id'] ); $ret.='
'; $ret.='
'; $sa=""; } /** * mise à jour po */ if ( $sa=="po_update") { $po=new Anc_Account($cn); $po->get_from_array($_POST); $po->update(); $sa="pa_detail"; } /** * Efface po */ if ( $sa=="po_delete") { $po=new Anc_Account($cn,$_REQUEST['po_id']); $po->delete(); $sa="pa_detail"; } // show the detail if ( $sa == "pa_detail" ) { $new=new Anc_Plan($cn,$_GET['pa_id']); $wSa=HtmlInput::hidden("sa","pa_update"); $new->get(); $ret.= '
'; $ret.= '

'._("Mise à jour").'

'; $ret.= '
'; $ret.=dossier::hidden(); $ret.= $new->form(); $ret.= $wSa; $ret.=HtmlInput::submit("submit",_("Enregistre")); $ret.=HtmlInput::button_anchor(_('Efface'), '', 'remove_analytic_plan', 'onclick="return confirm_box(\'remove_analytic_plan\',\'Effacer ?\',function () {window.location=\'do.php?ac='.$_REQUEST['ac'].'&pa_id='.$_GET['pa_id'].'&sa=pa_delete&'.$str_dossier.'\';})"', 'smallbutton'); $ret.= '
'; /** * Detail now */ $count=0; $new=new Anc_Plan($cn,$_REQUEST['pa_id']); $new->get(); $array=$new->get_poste_analytique(" order by po_name"); $ret.='
'; $ret.=''; $ret.=""; $ret.=""; $ret.=""; $class=""; foreach ($array as $obj) { $count++; if ( $count %2 == 0 ) $class="even"; else $class="odd"; $ret.=""; $ret.="" ; $ret.=""; $ret.=""; $ret.=""; $ret.=""; $ret.=""; } $ret.="
"._("Nom")." "; $ret.=""._("Montant")." "; $ret.=""._("Description")." "; $ret.=""._("Groupe").""._("Plan A")." "; $ret.="
". ''. h($obj->name). ''; "".$obj->amount."".h($obj->description)."".$obj->ga_id."".h($new->name)."
"; // ---> montre form pour ajouter po $ret.=HtmlInput::button_anchor(_('Ajout'),"?ac=".$_REQUEST['ac']."&sa=po_add&pa_id=".$_GET['pa_id']."&".$str_dossier,'','','smallbutton'); $href=http_build_query(array('ac'=>$_REQUEST['ac'],'gDossier'=>$_REQUEST['gDossier'])); $ret.= ''._('Retour').''; $ret.= '
'; } } else { $sa="anc_menu"; } //--------------------------------------------------------------------------- // Show lmenu // //--------------------------------------------------------------------------- if ($sa=='anc_menu') { $obj=new Anc_Plan($cn); $list=$obj->get_list(); if (empty($list)) { echo '
'; echo ''; echo ''; echo '
'; echo ''._("Ajout d'un plan comptable").''; echo '
'; echo '
'; if (!isset($_REQUEST['sa'])) echo '
'. _("Aucun plan analytique n'est défini"). '
'; } else { echo '
'; echo ''; if ($obj->isAppend()==true) { echo ''; } foreach ($list as $line) { echo ''; echo '"; echo "\n"; } echo '
'; echo ''._("Ajout d'un plan comptable").''; echo '
'. ''. h($line['name']); echo $line['description'].""; echo "
'; echo '
'; } } //--------------------------------------------------------------------------- // show the content part // // //--------------------------------------------------------------------------- echo $ret;