svn+ssh://ns352270.ovh.net/svn/phpcompta/branches/rel600-dynamic-menu ........ r4209 | danydb | 2011-10-13 22:06:13 +0200 (Thu, 13 Oct 2011) | 1 line Add new files ........ r4229 | danydb | 2011-10-23 20:51:09 +0200 (Sun, 23 Oct 2011) | 1 line Dynamic menu: impress works ........ r4230 | danydb | 2011-10-24 22:38:15 +0200 (Mon, 24 Oct 2011) | 2 lines #241 : modularity for SALE ledger ........ r4231 | danydb | 2011-10-24 22:47:02 +0200 (Mon, 24 Oct 2011) | 2 lines #241 : modularity for PURCHASE ledger ........ r4232 | danydb | 2011-10-25 23:03:53 +0200 (Tue, 25 Oct 2011) | 2 lines #241 : modularity for FINANCIAL ledger ........ r4234 | danydb | 2011-10-26 01:09:02 +0200 (Wed, 26 Oct 2011) | 2 lines #241 : modularity for CARD ledger + alphanum prob ........ r4237 | danydb | 2011-10-27 20:59:39 +0200 (Thu, 27 Oct 2011) | 2 lines #241 : modularity for lettering ........ r4238 | danydb | 2011-10-27 21:10:19 +0200 (Thu, 27 Oct 2011) | 3 lines #241 :adapt width submenu ........ r4239 | danydb | 2011-10-27 21:40:42 +0200 (Thu, 27 Oct 2011) | 3 lines #241 : modularity : old user_advanced.php ........ r4240 | danydb | 2011-10-27 21:44:27 +0200 (Thu, 27 Oct 2011) | 3 lines #241 : modularity : deprecated function ........ r4241 | danydb | 2011-10-27 21:46:26 +0200 (Thu, 27 Oct 2011) | 3 lines #241 : modularity : remove obsolete files ........ r4242 | danydb | 2011-10-27 21:54:39 +0200 (Thu, 27 Oct 2011) | 3 lines #241 : modularity : gestion card + gestion IMP ........ r4243 | danydb | 2011-10-27 22:28:36 +0200 (Thu, 27 Oct 2011) | 3 lines #241 : modularity : gestion customer + supplier + forecast + follow up ........ r4244 | danydb | 2011-10-28 00:47:55 +0200 (Fri, 28 Oct 2011) | 5 lines #241 : modularity : parameter company periode misc : tva , card attr, middle of payment, accounting,cat of doc, cat of card ........ r4245 | danydb | 2011-10-28 00:51:43 +0200 (Fri, 28 Oct 2011) | 1 line update menu_ref, profile_menu ........ r4246 | danydb | 2011-10-28 00:52:13 +0200 (Fri, 28 Oct 2011) | 1 line rewriting : change ShowMenuPcmn by menu_acc_plan ........ r4247 | danydb | 2011-10-28 20:04:01 +0200 (Fri, 28 Oct 2011) | 1 line #241 : modularity : parameter Document ........ r4248 | danydb | 2011-10-28 22:00:42 +0200 (Fri, 28 Oct 2011) | 1 line #241 : modularity : préférence ........ r4249 | danydb | 2011-10-28 22:16:44 +0200 (Fri, 28 Oct 2011) | 1 line last fix ........
297 lines
8.5 KiB
PHP
297 lines
8.5 KiB
PHP
<?php
|
|
/*
|
|
* This file is part of PhpCompta.
|
|
*
|
|
* PhpCompta is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* PhpCompta is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with PhpCompta; if not, write to the Free Software
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
*/
|
|
/* $Revision$ */
|
|
|
|
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
|
|
|
|
/*!\file
|
|
*
|
|
* \brief Plan Analytique
|
|
*
|
|
*/
|
|
require_once("class_anc_plan.php");
|
|
require_once("class_anc_account.php");
|
|
$ret="";
|
|
$str_dossier=Dossier::get();
|
|
//---------------------------------------------------------------------------
|
|
// action
|
|
// Compute the u_redcontent div
|
|
//---------------------------------------------------------------------------
|
|
if ( isset($_REQUEST['sa']))
|
|
{
|
|
$sa=$_REQUEST['sa'];
|
|
|
|
// show the form for adding a pa
|
|
if ( $sa == "add_pa")
|
|
{
|
|
$new=new Anc_Plan($cn);
|
|
if ( $new->isAppend() == true)
|
|
{
|
|
$ret.= '<div class="u_redcontent">';
|
|
$ret.= '<h2 class="info">Nouveau plan</h2>';
|
|
$ret.= '<form method="post">';
|
|
$ret.=dossier::hidden();
|
|
$ret.= $new->form();
|
|
$ret.= HtmlInput::hidden("sa","pa_write");
|
|
$ret.=HtmlInput::submit("submit","Enregistre");
|
|
$ret.= '</form>';
|
|
$ret.= '</div>';
|
|
}
|
|
else
|
|
{
|
|
$ret.= '<div class="u_redcontent">'.
|
|
'<h2 class="info">'.
|
|
"Maximum de plan analytique est atteint".
|
|
"</h2></div>";
|
|
}
|
|
}
|
|
// Add
|
|
if ( $sa == "pa_write")
|
|
{
|
|
$new=new Anc_Plan($cn);
|
|
|
|
|
|
if ( $new->isAppend() == false)
|
|
{
|
|
$ret.= '<h2 class="info">'.
|
|
"Maximum de plan analytique est atteint".
|
|
"</h2>";
|
|
}
|
|
else
|
|
{
|
|
$new=new Anc_Plan($cn);
|
|
$new->name=$_POST['pa_name'];
|
|
$new->description=$_POST['pa_description'];
|
|
$new->add();
|
|
}
|
|
}
|
|
// show the detail
|
|
if ( $sa == "pa_detail" )
|
|
{
|
|
$new=new Anc_Plan($cn,$_GET['pa_id']);
|
|
$wSa=HtmlInput::hidden("sa","pa_update");
|
|
|
|
$new->get();
|
|
|
|
$ret.= '<div class="u_redcontent">';
|
|
$ret.= '<h2 class="info">Mise à jour</h2>';
|
|
$ret.= '<form method="post">';
|
|
$ret.=dossier::hidden();
|
|
|
|
$ret.= $new->form();
|
|
$ret.= $wSa;
|
|
$ret.=HtmlInput::submit("submit","Enregistre");
|
|
$ret.=HtmlInput::button_anchor('Efface',"?ac=".$_REQUEST['ac']."&pa_id=".$_GET['pa_id']."&sa=pa_delete&$str_dossier",'Efface','onclick="return confirm(\'Effacer ?\')"');
|
|
$ret.= '</form>';
|
|
$ret.= '</div>';
|
|
|
|
}
|
|
// 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='<div class="u_redcontent">';
|
|
$ret.='<h2 class="info">Mis à jour</h2>';
|
|
$ret.="</div>";
|
|
}
|
|
// 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.='<div class="u_redcontent">';
|
|
$ret.='<form method="post">';
|
|
$ret.=dossier::hidden();
|
|
$ret.=$po->form();
|
|
$ret.=$wSa;
|
|
$ret.=HtmlInput::submit("add","Ajout");
|
|
$ret.="</form>";
|
|
$ret.="</div>";
|
|
}
|
|
// record the poste
|
|
if ( $sa=="po_write")
|
|
{
|
|
// var_dump($_POST);
|
|
$po=new Anc_Account($cn);
|
|
$po->get_from_array($_POST);
|
|
$po->add();
|
|
$sa="list";
|
|
|
|
}
|
|
/* delete pa */
|
|
if ( $sa == "pa_delete")
|
|
{
|
|
$delete=new Anc_Plan($cn,$_GET['pa_id']);
|
|
$delete->delete();
|
|
}
|
|
/* po detail
|
|
*
|
|
*/
|
|
if ( $sa=="po_detail")
|
|
{
|
|
$po=new Anc_Account($cn,$_GET['po_id']);
|
|
$po->get_by_id();
|
|
$ret.='<div class="u_redcontent">';
|
|
$ret.='<form method="post">';
|
|
$ret.=dossier::hidden();
|
|
|
|
$ret.=$po->form();
|
|
$ret.=HtmlInput::hidden('sa','po_update');
|
|
$ret.=HtmlInput::submit('Correction','Correction');
|
|
$ret.=sprintf('<A class="mtitle" HREF="?ac='.$_REQUEST['ac'].'&sa=po_delete&po_id=%s&pa_id=%s&'.$str_dossier.'">'.
|
|
'<input type="button" value="Efface" onClick="return confirm(\' Voulez-vous vraiment effacer cette activité\');"></A>',
|
|
$po->id,
|
|
$_REQUEST['pa_id']
|
|
);
|
|
|
|
$ret.='</form>';
|
|
$ret.='</div>';
|
|
}
|
|
if ( $sa=="po_update")
|
|
{
|
|
$po=new Anc_Account($cn);
|
|
$po->get_from_array($_POST);
|
|
$po->update();
|
|
$sa="list";
|
|
}
|
|
if ( $sa=="po_delete")
|
|
{
|
|
$po=new Anc_Account($cn,$_REQUEST['po_id']);
|
|
$po->delete();
|
|
$sa="list";
|
|
}
|
|
/* List poste */
|
|
if ( $sa == "list" )
|
|
{
|
|
$count=0;
|
|
|
|
$new=new Anc_Plan($cn,$_REQUEST['pa_id']);
|
|
$new->get();
|
|
$array=$new->get_poste_analytique(" order by po_name");
|
|
$ret.='<div class="u_redcontent">';
|
|
$ret.='<table style="width:100%;border:solid blue 2px ;border-style:outset;">';
|
|
$ret.="<tr>";
|
|
$ret.="<th> Nom </td>";
|
|
$ret.="<th> Montant </td>";
|
|
$ret.="<th> Description </td>";
|
|
$ret.="<th>Groupe</th>";
|
|
$ret.="<th> Plan A </td>";
|
|
$ret.="</tr>";
|
|
$class="";
|
|
foreach ($array as $obj)
|
|
{
|
|
$count++;
|
|
if ( $count %2 == 0 )
|
|
$class="even";
|
|
else
|
|
$class="odd";
|
|
|
|
$ret.="<TR class=\"$class\">";
|
|
$ret.="<TD >".
|
|
'<a style="text-decoration:underline;" href="?ac='.$_REQUEST['ac'].'&sa=po_detail&po_id='.$obj->id.'&pa_id='.$_REQUEST['pa_id'].'&'.
|
|
$str_dossier.'">'.
|
|
h($obj->name).
|
|
'</a>';
|
|
"</td>"
|
|
;
|
|
$ret.="<TD align=\"right\">".$obj->amount."</td>";
|
|
$ret.="<TD>".h($obj->description)."</td>";
|
|
$ret.="<td>".$obj->ga_id."</td>";
|
|
$ret.="<TD>".h($new->name)."</td>";
|
|
$ret.="</tr>";
|
|
|
|
}
|
|
$ret.="</table>";
|
|
$ret.=HtmlInput::button_anchor('Ajout',"?ac=".$_REQUEST['ac']."&sa=po_add&pa_id=".$_GET['pa_id']."&".$str_dossier);
|
|
$ret.='</div>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
// Show lmenu
|
|
//
|
|
//---------------------------------------------------------------------------
|
|
$obj=new Anc_Plan($cn);
|
|
$list=$obj->get_list();
|
|
|
|
|
|
|
|
|
|
if ( empty($list) )
|
|
{
|
|
echo '<div class="lmenu">';
|
|
echo '<TABLE>';
|
|
echo '<TR><TD class="mtitle">';
|
|
echo '<a class="mtitle" href="?ac='.$_REQUEST['ac'].'&sa=add_pa&'.$str_dossier.'">Ajout d\'un plan comptable</a>';
|
|
echo '</TD></TR>';
|
|
echo '</TABLE>';
|
|
|
|
echo '</div>';
|
|
if ( ! isset ( $_REQUEST['sa']))
|
|
echo '<div class="notice">'.
|
|
"Aucun plan analytique n'est défini".
|
|
'</div>';
|
|
|
|
}
|
|
else
|
|
{
|
|
echo '<div class="lmenu">';
|
|
|
|
echo '<table>';
|
|
foreach ($list as $line)
|
|
{
|
|
echo '<TR>';
|
|
echo '<TD >'.
|
|
'<a class="mtitle" href="?ac='.$_REQUEST['ac'].'&sa=pa_detail&pa_id='.$line['id'].'&'.$str_dossier.'">'.
|
|
h($line['name']).
|
|
'</TD>';
|
|
echo '<td class="mtitle">'.
|
|
'<a class="mtitle" href="?ac='.$_REQUEST['ac'].'&sa=list&pa_id='.$line['id'].'&'.$str_dossier.'">'.
|
|
"Activités".
|
|
"</a>";
|
|
|
|
echo '</TR>';
|
|
}
|
|
echo '</table>';
|
|
if ($obj->isAppend()==true )
|
|
{
|
|
echo '<TABLE>';
|
|
echo '<TR><TD class="mtitle">';
|
|
echo '<a class="mtitle" href="?ac='.$_REQUEST['ac'].'&sa=add_pa&'.$str_dossier.'">Ajout d\'un plan comptable</a>';
|
|
echo '</TD></TR>';
|
|
echo '</TABLE>';
|
|
}
|
|
|
|
|
|
echo '</div>';
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
// show the u_redcontent part
|
|
//
|
|
//
|
|
//---------------------------------------------------------------------------
|
|
|
|
echo $ret;
|