noalyss Version-10
NOALYSS : serveur de comptabilité et ERP (2002)
Loading...
Searching...
No Matches
anc_od.inc.php
Go to the documentation of this file.
1<?php
2/*
3 * This file is part of NOALYSS.
4 *
5 * NOALYSS is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * NOALYSS is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with NOALYSS; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18*/
19
20// Copyright Author Dany De Bontridder danydb@aevalys.eu
21
22/*!\file
23 *
24 *
25 * \brief Misc Operation for analytic accountancy
26 *
27 */
28if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
29
30global $g_user;
32
33$str_dossier=Dossier::get();
35$m=$pa->get_list();
36if ( ! $m )
37{
38
39 echo '<div ><h2 class="error">'._('Aucun plan analytique défini').'</h2></div>';
40 return;
41}
42
43$dossier_id=Dossier::id();
44$see=$http->request("see","string","0");
45$new=$http->request("new","string","0");
46$selected=($see==0)?"new":"see";
47//----------------------------------------------------------------------
48// show the menu
49//----------------------------------------------------------------------
50echo show_menu_extension(array(
51 array(
52 "?".http_build_query(["ac"=>$http->request("ac"),"new"=>1,"gDossier"=>$dossier_id]),
53 _("Nouveau"),
54 _("Nouvelle opération")
55 ,"new"
56 ),
57 array (
58 "?".http_build_query(["ac"=>$http->request("ac"),"see"=>1,"gDossier"=>$dossier_id]),
59 _("Liste"),
60 _("Liste opérations"),
61 "see"
62 )
63 )
65);
66
67
68//----------------------------------------------------------------------
69// the pa_id is set
70//
71//----------------------------------------------------------------------
72if ( isset($_GET['see']))
73{
74
75 // Show the list for the period
76 // and exit
77 //-----------------------------
78 $a=new Anc_Operation($cn);
79
80 echo '
81 <div class="content" >
82 <form method= "get">
83 ';
84
85 echo dossier::hidden();
86 $hid=new IHidden();
87 $exercice=$http->request("exercice","number",0);
88 if ($exercice == 0 ){
89 $exercice=$g_user->get_exercice();
90 }
91 $ex=new Exercice($cn);
92 $js=sprintf("updatePeriode(%d,'%s','%s')",Dossier::id(),'exercice','p_periode');
93 $wex=$ex->select('exercice',$exercice,' onchange="'.$js.'"');
94 echo $wex->input();
95 $hid->name="ac";
96 $hid->value=$http->request("ac");
97 echo $hid->input();
98
99 $hid->name="see";
100 $hid->value="";
101 echo $hid->input();
102
103 $w=new ISelect();
104 $w->name="p_periode";
105// filter on the current year
106 $filter_year=" where p_exercice='".$g_user->get_exercice()."'";
107
108 $periode_start=$cn->make_array("select p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode
109 where p_exercice=$1 order by p_start,p_end",1,[$exercice]);
110 $g_user=new Noalyss_user($cn);
111 $current=$http->get("p_periode","number",$g_user->get_periode());
112 $w->value=$periode_start;
113 $w->selected=$current;
114 echo _('Filtrer par période').":".$w->input().HtmlInput::submit('gl_submit','Valider').'</form>';
115 echo '<hr>';
116
117 echo '<div class="content" >';
118 echo $a->html_table($current);
119 echo '</div>';
120 return;
121}
122if ( isset($_POST['save']))
123{
124 // record the operation and exit
125 // and exit
126 //-----------------------------
127 echo '<div class="redcontent" >'.
128 _('Opération sauvée');
130
131 $a->get_from_array($_POST);
132
133 $a->save();
134 echo $a->show();
135 echo '</div>';
136 return;
137}
138
139if ( isset($_GET['new']))
140{
141 //show the form for entering a new Anc_Operation
142 //------------------------------------------
144
145 $wSubmit=new IHidden("p_action","ca_od");
146 $wSubmit->table=0;
147 echo '<div class="redcontent" >';
148 echo '<form id="anc_od_frm" method="post" onsubmit="return validate_anc(\'anc_od_frm\');return false;">';
149 echo dossier::hidden();
150 echo $wSubmit->input();
151 echo $a->form();
152 echo HtmlInput::submit("save",_("Sauver"));
153 echo '</form>';
154 echo '<div class="info">';
155 echo _('Débit').' = <span id="totalDeb"></span>';
156 echo _('Crédit').' = <span id="totalCred"></span>';
157 echo _('Difference').' = <span id="totalDiff"></span>
158 </div>
159 ';
160
161 echo '</div>';
162 $msg_comment=_("Commentaire vide");
163 $msg_date=_("Date invalide");
164echo <<<EOF
165<script>
166 function validate_anc(p_frm_id) {
167 try {
168 if ($('pdesc').value.length==0) {
169 smoke.alert('$msg_comment');
170 return false;
171 }
172 if ( ! check_date($(p_frm_id)['pdate'].value) ) {
173 smoke.alert('$msg_date');
174 return false;
175 }
176 } catch (e) {
177 smoke.alert(e.message);
178 }
179 return ;
180 }
181
182</script>;
183
184EOF;
185
186 return;
187}
188
189?>
190<div class="redcontent">
show_menu_extension($p_array, $default="", $p_extra="")
Same menu for all extensions, with the right level, it calls ShowItem with the right parameters @glob...
global $g_user
if no group available , then stop
$dossier_id
catch(Exception $e) $exercice
foreach($array as $idx=> $m) $w
$new
$str_dossier
$pa
$selected
$see
$wex
_("actif, passif,charge,...")
$ex
$_GET['qcode']
group of object operations, used for misc operation
this class is used to show the form for entering an operation only FOR analytic operation to save it,...
Concerns the Analytic plan (table plan_analytique)
about the accountancy period (usually 1 year starting in January until december) = exercice
static submit($p_name, $p_value, $p_javascript="", $p_class="smallbutton")
manage the http input (get , post, request) and extract from an array
Html Input.
Html Input , create a tag <SELECT> ... </SELECT> if readonly == true then display the label correspon...
$_POST['ac']
Definition do.php:323
$periode_start
Definition fiche.inc.php:60