request("sa", "string", "anc_menu");
//---------------------------------------------------------------------------
// action
// Compute the redcontent div
//---------------------------------------------------------------------------
// show the form for adding a pa
if ($sa=="add_pa")
{
$new=new Anc_Plan($cn);
if ($new->isAppend()==true)
{
$ret.= '
';
$ret.=HtmlInput::title_box(_('Nouveau plan'), 'anc_div_add', 'hide');
$ret.= '';
$ret.= '
';
}
else
{
$ret.= '';
$ret.= $new->form();
$ret.= $wSa;
$ret.="
";
$ret.=HtmlInput::button_anchor(_('Efface ce plan'), '', '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
// Use Manage_Table
//---------------------------------------------------------------------
$count=0;
$new=new Anc_Plan($cn, $pa_id);
$new->get();
$ret.='
';
$anc=new Poste_analytique_SQL($cn);
$anc->pa_id=$pa_id;
$accounting=new Anc_Account_Table($anc);
$accounting->set_callback("ajax_misc.php");
$accounting->add_json_param("op", "anc_accounting");
$accounting->add_json_param("pa_id", $pa_id);
$accounting->set_sort_column("po_name");
ob_start();
$accounting->display_table(" where pa_id = $1 order by po_name ",array($pa_id));
$accounting->create_js_script();
$ret.=ob_get_clean();
$ret.= '
';
}
//---------------------------------------------------------------------------
// Show lmenu
//
//---------------------------------------------------------------------------
if ($sa=='anc_menu')
{
$obj=new Anc_Plan($cn);
$list=$obj->get_list();
$ac=$http->request("ac");
if (empty($list))
{
$url=http_build_query(array("sa"=>"add_pa","ac"=>$ac,
"gDossier"=>Dossier::id()));
echo '
';
if (!isset($_REQUEST['sa']))
echo '
'.
_("Aucun plan analytique n'est défini").
'
';
}
else
{
$url=http_build_query(array("sa"=>"add_pa","ac"=>$ac,
"gDossier"=>Dossier::id()));
echo '
';
}
}
//---------------------------------------------------------------------------
// show the content part
//
//
//---------------------------------------------------------------------------
echo $ret;