Merged revisions 2258,2260-2262,2264-2268,2270-2283,2285-2297,2299-2322,2324-2340 via svnmerge from
svn+ssh://danydb@svn/svn/phpcompta/branches/rel430 ........ r2258 | danydb | 2008-12-18 23:21:00 +0100 (Thu, 18 Dec 2008) | 1 line Add debug ........ r2262 | danydb | 2008-12-19 22:38:25 +0100 (Fri, 19 Dec 2008) | 1 line Add a local admin ........ r2270 | danydb | 2008-12-21 20:11:26 +0100 (Sun, 21 Dec 2008) | 1 line Doc. remove the useless todo list ........ r2271 | danydb | 2008-12-22 21:18:46 +0100 (Mon, 22 Dec 2008) | 3 lines Remove obsolete functions insertRapt, deleteRapt and getconcerned Remove obsolete file user_update ........ r2272 | danydb | 2008-12-22 21:21:46 +0100 (Mon, 22 Dec 2008) | 2 lines Remove obsolete function isFicheOfJrn ........ r2273 | danydb | 2008-12-22 21:44:28 +0100 (Mon, 22 Dec 2008) | 1 line Improve Invoice : add the username ........ r2287 | danydb | 2009-01-13 21:37:07 +0100 (Tue, 13 Jan 2009) | 1 line Code cleaning replace GetConcerned by Acc_Reconciliation ........ r2288 | danydb | 2009-01-13 21:38:40 +0100 (Tue, 13 Jan 2009) | 1 line Add a comment on jrn operation ........ r2289 | danydb | 2009-01-13 21:40:13 +0100 (Tue, 13 Jan 2009) | 1 line Code cleaning : add comments to the code ........ r2290 | danydb | 2009-01-13 21:40:46 +0100 (Tue, 13 Jan 2009) | 1 line Code cleaning replace GetConcerned by Acc_Reconciliation ........ r2291 | danydb | 2009-01-13 21:41:35 +0100 (Tue, 13 Jan 2009) | 1 line Code cleaning replace GetConcerned by Acc_Reconciliation ........ r2292 | danydb | 2009-01-13 21:42:15 +0100 (Tue, 13 Jan 2009) | 1 line Add documentation about new tags ........ r2293 | danydb | 2009-01-13 21:43:22 +0100 (Tue, 13 Jan 2009) | 1 line Code cleaning start rewriting of the security part ........ r2294 | danydb | 2009-01-14 20:09:18 +0100 (Wed, 14 Jan 2009) | 1 line Improve : template of security + security code ........ r2295 | danydb | 2009-01-14 20:21:51 +0100 (Wed, 14 Jan 2009) | 1 line Improve security : add new variable ........ r2296 | danydb | 2009-01-14 20:39:58 +0100 (Wed, 14 Jan 2009) | 1 line Improve security : modify layout ........ r2297 | danydb | 2009-01-15 19:21:47 +0100 (Thu, 15 Jan 2009) | 1 line Improve security : user setting ........ r2299 | danydb | 2009-01-15 19:28:56 +0100 (Thu, 15 Jan 2009) | 2 lines Clean code : can_request doens't have a connx parameter ........ r2300 | danydb | 2009-01-16 19:12:47 +0100 (Fri, 16 Jan 2009) | 1 line Improve Ecriture directe libelle : new widget js_search_card_control ........ r2301 | danydb | 2009-01-16 22:29:39 +0100 (Fri, 16 Jan 2009) | 1 line Improve Quick Writing : remove span, and update the comment field ........ r2302 | danydb | 2009-01-16 23:01:24 +0100 (Fri, 16 Jan 2009) | 1 line Improve cosmetic : GL + remove the select topmenu ........ r2303 | danydb | 2009-01-19 08:41:09 +0100 (Mon, 19 Jan 2009) | 1 line Cosmetic : a inline ........ r2304 | danydb | 2009-01-20 23:03:59 +0100 (Tue, 20 Jan 2009) | 6 lines Code Cleaning Security : remove obsolete files & function Class_user : add new functions for the security Only the menu in text mode with a break line ........ r2305 | danydb | 2009-01-20 23:05:01 +0100 (Tue, 20 Jan 2009) | 1 line code cleaning rewriting of Security ........ r2306 | danydb | 2009-01-21 21:13:15 +0100 (Wed, 21 Jan 2009) | 1 line Security printing unicode and fix some bugs ........ r2309 | danydb | 2009-01-26 19:56:28 +0100 (Mon, 26 Jan 2009) | 1 line ADD : company without VAT ........ r2310 | danydb | 2009-01-26 23:33:14 +0100 (Mon, 26 Jan 2009) | 1 line Add : no vat for Purchase ledger ........ r2312 | danydb | 2009-01-28 19:57:30 +0100 (Wed, 28 Jan 2009) | 1 line Integration ........ r2313 | danydb | 2009-01-28 22:46:27 +0100 (Wed, 28 Jan 2009) | 1 line Work with or without VAT ........ r2314 | danydb | 2009-01-29 22:18:57 +0100 (Thu, 29 Jan 2009) | 2 lines Remove debug info ........ r2315 | danydb | 2009-01-29 23:23:14 +0100 (Thu, 29 Jan 2009) | 1 line ADD the possibility to enter a piece number ........ r2316 | danydb | 2009-01-31 23:20:00 +0100 (Sat, 31 Jan 2009) | 1 line Documentation ........ r2317 | danydb | 2009-02-04 20:14:54 +0100 (Wed, 04 Feb 2009) | 1 line Template for ledger ........ r2318 | danydb | 2009-02-05 15:52:58 +0100 (Thu, 05 Feb 2009) | 1 line Add PJ setting + default in Ledger, fix bug in listJrn ........ r2319 | danydb | 2009-02-05 17:09:56 +0100 (Thu, 05 Feb 2009) | 2 lines Search by PJ ........ r2320 | danydb | 2009-02-05 17:23:24 +0100 (Thu, 05 Feb 2009) | 1 line Finished with pj ........ r2321 | danydb | 2009-02-05 18:11:35 +0100 (Thu, 05 Feb 2009) | 1 line PJ is readonly ........ r2322 | danydb | 2009-02-05 20:10:34 +0100 (Thu, 05 Feb 2009) | 1 line Saldo : write the first saldo (ajax) ........ r2324 | danydb | 2009-02-06 00:07:50 +0100 (Fri, 06 Feb 2009) | 5 lines Add database script Cosmetic (menu) Fix Bug ........ r2325 | danydb | 2009-02-06 14:07:07 +0100 (Fri, 06 Feb 2009) | 1 line Improve Pj seq ........ r2326 | danydb | 2009-02-09 22:47:23 +0100 (Mon, 09 Feb 2009) | 6 lines Fix Bug privilege (compta_ven) Fix if the pj is empty do not increment the sequence (class_acc_operation) Fix remove PJ if pj is empty (modify_op.php) Cosmetic do not print PJ if pj is null or empty (listing) ........ r2327 | danydb | 2009-02-10 21:04:48 +0100 (Tue, 10 Feb 2009) | 5 lines Fix bug in PJ seq Fix bug in export jrn csv Improve avoid the removal of vat rate Add security for card ........ r2328 | danydb | 2009-02-12 20:26:36 +0100 (Thu, 12 Feb 2009) | 4 lines Cosmetic menu_tool Impression add tag PJ Cosmetic menu administration ........ r2329 | danydb | 2009-02-12 21:43:19 +0100 (Thu, 12 Feb 2009) | 5 lines filter the folder the local admin can access add a function check_dossier which must be implemented everywhere Printing with PJ NoAccess default = javascript ........ r2330 | danydb | 2009-02-14 18:11:49 +0100 (Sat, 14 Feb 2009) | 2 lines improve add libelle for balance csv ........ r2331 | danydb | 2009-02-14 19:10:56 +0100 (Sat, 14 Feb 2009) | 7 lines Balance csv add label Bug Financial ledger list BUG period access BUG stock access IMPROVE list ledger with PJ ........ r2332 | danydb | 2009-02-15 18:21:59 +0100 (Sun, 15 Feb 2009) | 1 line Bug order was not saved for report ........ r2333 | danydb | 2009-02-15 18:22:17 +0100 (Sun, 15 Feb 2009) | 1 line Add security for normal user ........ r2334 | danydb | 2009-02-15 18:23:24 +0100 (Sun, 15 Feb 2009) | 3 lines Bug forget to import class ........ r2335 | danydb | 2009-02-17 21:33:17 +0100 (Tue, 17 Feb 2009) | 5 lines Fix quick writing let write Fix card priv Remove button if no priv to add card or cancel an op ........ r2336 | danydb | 2009-02-19 21:01:36 +0100 (Thu, 19 Feb 2009) | 4 lines Check for CA common Bug with the repository ........ r2337 | danydb | 2009-02-19 21:50:35 +0100 (Thu, 19 Feb 2009) | 2 lines Test the parameter security part ........
This commit is contained in:
parent
56f66d3b87
commit
8834d14ee5
127 changed files with 3649 additions and 4181 deletions
Binary file not shown.
|
|
@ -30,9 +30,9 @@ STRIP_FROM_INC_PATH =
|
|||
SHORT_NAMES = NO
|
||||
JAVADOC_AUTOBRIEF = NO
|
||||
MULTILINE_CPP_IS_BRIEF = NO
|
||||
DETAILS_AT_TOP = NO
|
||||
DETAILS_AT_TOP = YES
|
||||
INHERIT_DOCS = YES
|
||||
DISTRIBUTE_GROUP_DOC = NO
|
||||
DISTRIBUTE_GROUP_DOC = YES
|
||||
SEPARATE_MEMBER_PAGES = NO
|
||||
TAB_SIZE = 8
|
||||
ALIASES =
|
||||
|
|
@ -43,8 +43,8 @@ SUBGROUPING = YES
|
|||
# Build related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
EXTRACT_ALL = YES
|
||||
EXTRACT_PRIVATE = NO
|
||||
EXTRACT_STATIC = NO
|
||||
EXTRACT_PRIVATE = YES
|
||||
EXTRACT_STATIC = YES
|
||||
EXTRACT_LOCAL_CLASSES = YES
|
||||
EXTRACT_LOCAL_METHODS = YES
|
||||
HIDE_UNDOC_MEMBERS = YES
|
||||
|
|
@ -57,8 +57,8 @@ HIDE_SCOPE_NAMES = NO
|
|||
SHOW_INCLUDE_FILES = YES
|
||||
INLINE_INFO = YES
|
||||
SORT_MEMBER_DOCS = YES
|
||||
SORT_BRIEF_DOCS = NO
|
||||
SORT_BY_SCOPE_NAME = NO
|
||||
SORT_BRIEF_DOCS = YES
|
||||
SORT_BY_SCOPE_NAME = YES
|
||||
GENERATE_TODOLIST = YES
|
||||
GENERATE_TESTLIST = YES
|
||||
GENERATE_BUGLIST = YES
|
||||
|
|
@ -77,7 +77,7 @@ WARN_IF_UNDOCUMENTED = YES
|
|||
WARN_IF_DOC_ERROR = YES
|
||||
WARN_NO_PARAMDOC = NO
|
||||
WARN_FORMAT = "$file:$line: $text"
|
||||
WARN_LOGFILE =
|
||||
WARN_LOGFILE = doxygen-warn.log
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the input files
|
||||
#---------------------------------------------------------------------------
|
||||
|
|
@ -147,7 +147,7 @@ VERBATIM_HEADERS = YES
|
|||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the alphabetical class index
|
||||
#---------------------------------------------------------------------------
|
||||
ALPHABETICAL_INDEX = NO
|
||||
ALPHABETICAL_INDEX = YES
|
||||
COLS_IN_ALPHA_INDEX = 5
|
||||
IGNORE_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -33,11 +33,12 @@ require_once ('class_dossier.php');
|
|||
require_once('class_todo_list.php');
|
||||
|
||||
|
||||
$user=new User(DbConnect());
|
||||
$user->check_dossier(dossier::id());
|
||||
|
||||
$cn=DbConnect(dossier::id());
|
||||
$user=new User($cn);
|
||||
if ($user->AccessJrn($cn,dossier::id()) == false ){
|
||||
exit('<h2 class="error">Permission refusee </h2>');
|
||||
}
|
||||
$user->db=$cn;
|
||||
$user->Check();
|
||||
|
||||
if ( DBVERSION!=dossier::get_version($cn)) {
|
||||
echo '<h2 class="error">Votre base de données n\'est pas à jour, ';
|
||||
|
|
@ -48,7 +49,7 @@ if ( DBVERSION!=dossier::get_version($cn)) {
|
|||
|
||||
html_page_start($_SESSION['g_theme']);
|
||||
echo '<div class="u_tmenu">';
|
||||
echo menu_tool('access');
|
||||
echo menu_tool('access.php');
|
||||
echo '</div>';
|
||||
echo '<div class="content">';
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -387,7 +387,7 @@ echo '<hr>';
|
|||
echo "<h2>Mise à jour Repository</h2>";
|
||||
$cn=DbConnect();
|
||||
if ( DEBUG == 'false') ob_start();
|
||||
$MaxVersion=8;
|
||||
$MaxVersion=9;
|
||||
for ($i=4;$i<= $MaxVersion;$i++)
|
||||
{
|
||||
if ( get_version($cn) <= $i ) {
|
||||
|
|
|
|||
10
html/admin/sql/patch/ac-upgrade9.sql
Normal file
10
html/admin/sql/patch/ac-upgrade9.sql
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
begin;
|
||||
--- on account_repository
|
||||
update priv_user set priv_priv='X' where priv_priv='NO';
|
||||
update priv_user set priv_priv='R' where priv_priv='W';
|
||||
update user_global_pref set parameter_value='TEXT' where parameter_type='TOPMENU';
|
||||
|
||||
|
||||
update version set val=10;
|
||||
commit;
|
||||
|
||||
168
html/admin/sql/patch/upgrade56.sql
Normal file
168
html/admin/sql/patch/upgrade56.sql
Normal file
|
|
@ -0,0 +1,168 @@
|
|||
begin;
|
||||
CREATE OR REPLACE FUNCTION create_missing_sequence()
|
||||
RETURNS integer AS
|
||||
$BODY$
|
||||
declare
|
||||
p_sequence text;
|
||||
nSeq integer;
|
||||
c1 cursor for select jrn_def_id from jrn_def;
|
||||
begin
|
||||
open c1;
|
||||
loop
|
||||
fetch c1 into nSeq;
|
||||
if not FOUND THEN
|
||||
close c1;
|
||||
return 0;
|
||||
end if;
|
||||
p_sequence:='s_jrn_pj'||nSeq::text;
|
||||
execute 'create sequence '||p_sequence;
|
||||
end loop;
|
||||
close c1;
|
||||
return 0;
|
||||
|
||||
end;
|
||||
$BODY$
|
||||
LANGUAGE 'plpgsql';
|
||||
|
||||
select create_missing_sequence();
|
||||
|
||||
|
||||
CREATE OR REPLACE FUNCTION drop_index(p_constraint character varying)
|
||||
RETURNS void AS
|
||||
$BODY$
|
||||
declare
|
||||
nCount integer;
|
||||
begin
|
||||
select count(*) into nCount from pg_indexes where indexname=p_constraint;
|
||||
if nCount = 1 then
|
||||
execute 'drop index '||p_constraint ;
|
||||
end if;
|
||||
end;
|
||||
$BODY$
|
||||
LANGUAGE 'plpgsql';
|
||||
-- on dossier
|
||||
|
||||
insert into parameter (pr_id,pr_value) values ('MY_TVA_USE','Y');
|
||||
insert into parameter (pr_id,pr_value) values ('MY_PJ_SUGGEST','Y');
|
||||
|
||||
-- new security
|
||||
alter table action add ac_module text;
|
||||
alter table action add ac_code varchar(9);
|
||||
create unique index uj_login_uj_jrn_id on user_sec_jrn(uj_login,uj_jrn_id);
|
||||
|
||||
-- PostgreSQL database dump
|
||||
--
|
||||
delete from user_Sec_act;
|
||||
delete from action;
|
||||
|
||||
COMMENT ON TABLE action IS 'The different privileges';
|
||||
select drop_index('x_act');
|
||||
|
||||
INSERT INTO action (ac_id, ac_description, ac_module, ac_code) VALUES (100, 'Accès en lecture', 'budget', 'BUDLEC');
|
||||
INSERT INTO action (ac_id, ac_description, ac_module, ac_code) VALUES (110, 'Création hypothèse', 'budget', 'BUDHYP');
|
||||
INSERT INTO action (ac_id, ac_description, ac_module, ac_code) VALUES (120, 'Création de fiche', 'budget', 'BUDFIC');
|
||||
INSERT INTO action (ac_id, ac_description, ac_module, ac_code) VALUES (130, 'Impression', 'budget', 'BUDIMP');
|
||||
INSERT INTO action (ac_id, ac_description, ac_module, ac_code) VALUES (210, 'Ajout de plan analytique', 'compta_anal', 'CAPA');
|
||||
INSERT INTO action (ac_id, ac_description, ac_module, ac_code) VALUES (220, 'Ajout de poste analytique', 'compta_anal', 'CAPO');
|
||||
INSERT INTO action (ac_id, ac_description, ac_module, ac_code) VALUES (230, 'Ajout de groupe analytique', 'compta_anal', 'CAGA');
|
||||
INSERT INTO action (ac_id, ac_description, ac_module, ac_code) VALUES (235, 'Ajout d''operation diverses', 'compta_anal', 'CAOD');
|
||||
INSERT INTO action (ac_id, ac_description, ac_module, ac_code) VALUES (240, 'Impression', 'compta_anal', 'CAIMP');
|
||||
INSERT INTO action (ac_id, ac_description, ac_module, ac_code) VALUES (300, 'Gestion', 'gestion', 'GESTION');
|
||||
INSERT INTO action (ac_id, ac_description, ac_module, ac_code) VALUES (305, 'Import en Banque', 'gestion', 'GEBQ');
|
||||
INSERT INTO action (ac_id, ac_description, ac_module, ac_code) VALUES (307, 'Effacement d''opération', 'gestion', 'GEOP');
|
||||
INSERT INTO action (ac_id, ac_description, ac_module, ac_code) VALUES (310, 'Courrier (lecture & écriture)', 'gestion', 'GECOUR');
|
||||
INSERT INTO action (ac_id, ac_description, ac_module, ac_code) VALUES (311, 'Fournisseur', 'gestion', 'GESUPPL');
|
||||
INSERT INTO action (ac_id, ac_description, ac_module, ac_code) VALUES (312, 'Client', 'gestion', 'GECUST');
|
||||
-- INSERT INTO action (ac_id, ac_description, ac_module, ac_code) VALUES (320, 'gestion de stock', 'gestion', 'GESTOCK');
|
||||
INSERT INTO action (ac_id, ac_description, ac_module, ac_code) VALUES (700, 'Rapport', 'impression', 'IMPRAP');
|
||||
INSERT INTO action (ac_id, ac_description, ac_module, ac_code) VALUES (710, 'Journaux', 'impression', 'IMPJRN');
|
||||
INSERT INTO action (ac_id, ac_description, ac_module, ac_code) VALUES (720, 'Fiche', 'impression', 'IMPFIC');
|
||||
INSERT INTO action (ac_id, ac_description, ac_module, ac_code) VALUES (730, 'Poste', 'impression', 'IMPPOSTE');
|
||||
INSERT INTO action (ac_id, ac_description, ac_module, ac_code) VALUES (740, 'Bilan', 'impression', 'IMPBIL');
|
||||
INSERT INTO action (ac_id, ac_description, ac_module, ac_code) VALUES (750, 'Balance', 'impression', 'IMPBAL');
|
||||
INSERT INTO action (ac_id, ac_description, ac_module, ac_code) VALUES (800, 'Ajout de fiche', 'fiche', 'FICADD');
|
||||
INSERT INTO action (ac_id, ac_description, ac_module, ac_code) VALUES (805, 'Création, modification et effacement de fiche', 'fiche', 'FIC');
|
||||
INSERT INTO action (ac_id, ac_description, ac_module, ac_code) VALUES (910, 'création, modification et effacement de catégorie de fiche', 'fiche', 'FICCAT');
|
||||
INSERT INTO action (ac_id, ac_description, ac_module, ac_code) VALUES (1100, 'Mode comptabilité analytique', 'parametre', 'PARCA');
|
||||
INSERT INTO action (ac_id, ac_description, ac_module, ac_code) VALUES (1110, 'Ajout de période', 'parametre', 'PARPER');
|
||||
INSERT INTO action (ac_id, ac_description, ac_module, ac_code) VALUES (1120, 'Catégorie des fiches', 'parametre', 'PARFIC');
|
||||
INSERT INTO action (ac_id, ac_description, ac_module, ac_code) VALUES (1130, 'Document', 'parametre', 'PARDOC');
|
||||
INSERT INTO action (ac_id, ac_description, ac_module, ac_code) VALUES (1140, 'Modification journaux', 'parametre', 'PARJRN');
|
||||
INSERT INTO action (ac_id, ac_description, ac_module, ac_code) VALUES (1150, 'TVA', 'parametre', 'PARTVA');
|
||||
INSERT INTO action (ac_id, ac_description, ac_module, ac_code) VALUES (1160, 'Moyen de paiement', 'parametre', 'PARMP');
|
||||
INSERT INTO action (ac_id, ac_description, ac_module, ac_code) VALUES (1180, 'Clôture ', 'parametre', 'PARCLO');
|
||||
INSERT INTO action (ac_id, ac_description, ac_module, ac_code) VALUES (1185, 'Changement du plan comptable ', 'parametre', 'PARPCMN');
|
||||
INSERT INTO action (ac_id, ac_description, ac_module, ac_code) VALUES (1170, 'Poste Comptable de base', 'parametre', 'PARPOS');
|
||||
INSERT INTO action (ac_id, ac_description, ac_module, ac_code) VALUES (1190, 'Centralisation', 'parametre', 'PARCENT');
|
||||
INSERT INTO action (ac_id, ac_description, ac_module, ac_code) VALUES (1200, 'Écriture d''ouverture', 'parametre', 'PAREO');
|
||||
INSERT INTO action (ac_id, ac_description, ac_module, ac_code) VALUES (1210, 'Mode strict', 'parametre', 'PARSTR');
|
||||
INSERT INTO action (ac_id, ac_description, ac_module, ac_code) VALUES (1220, 'Coordonnées société', 'parametre', 'PARCOORD');
|
||||
INSERT INTO action (ac_id, ac_description, ac_module, ac_code) VALUES (1230, 'Création de rapport', 'parametre', 'PARRAP');
|
||||
INSERT INTO action (ac_id, ac_description, ac_module, ac_code) VALUES (1240, 'Effacement et création d''opération prédéfinie', 'parametre', 'PARPREDE');
|
||||
INSERT INTO action (ac_id, ac_description, ac_module, ac_code) VALUES (1245, 'Sécurité du dossier', 'parametre', 'PARSEC');
|
||||
INSERT INTO action (ac_id, ac_description, ac_module, ac_code) VALUES (1500, 'Stock (lecture)', 'stock', 'STOLE');
|
||||
INSERT INTO action (ac_id, ac_description, ac_module, ac_code) VALUES (1510, 'Stock (changement)', 'stock', 'STOWRITE');
|
||||
|
||||
ALTER TABLE jrn ADD COLUMN jr_pj_number text;
|
||||
ALTER TABLE del_jrn ADD COLUMN jr_pj_number text;
|
||||
ALTER TABLE jrn_def ADD COLUMN jrn_def_pj_pref text;
|
||||
|
||||
update jrn_def set jrn_def_pj_pref=jrn_def_type ;
|
||||
|
||||
CREATE OR REPLACE FUNCTION jrn_del()
|
||||
RETURNS trigger AS
|
||||
$BODY$
|
||||
declare
|
||||
row jrn%ROWTYPE;
|
||||
begin
|
||||
row:=OLD;
|
||||
insert into del_jrn ( jr_id,
|
||||
jr_def_id,
|
||||
jr_montant,
|
||||
jr_comment,
|
||||
jr_date,
|
||||
jr_grpt_id,
|
||||
jr_internal,
|
||||
jr_tech_date,
|
||||
jr_tech_per,
|
||||
jrn_ech,
|
||||
jr_ech,
|
||||
jr_rapt,
|
||||
jr_valid,
|
||||
jr_opid,
|
||||
jr_c_opid,
|
||||
jr_pj,
|
||||
jr_pj_name,
|
||||
jr_pj_type,
|
||||
jr_pj_number,
|
||||
del_jrn_date)
|
||||
select jr_id,
|
||||
jr_def_id,
|
||||
jr_montant,
|
||||
jr_comment,
|
||||
jr_date,
|
||||
jr_grpt_id,
|
||||
jr_internal,
|
||||
jr_tech_date,
|
||||
jr_tech_per,
|
||||
jrn_ech,
|
||||
jr_ech,
|
||||
jr_rapt,
|
||||
jr_valid,
|
||||
jr_opid,
|
||||
jr_c_opid,
|
||||
jr_pj,
|
||||
jr_pj_name,
|
||||
jr_pj_type,
|
||||
jr_pj_number
|
||||
,now() from jrn where jr_id=row.jr_id;
|
||||
return row;
|
||||
end;
|
||||
$BODY$
|
||||
LANGUAGE 'plpgsql' ;
|
||||
|
||||
|
||||
|
||||
update version set val=57;
|
||||
|
||||
commit;
|
||||
|
|
@ -43,7 +43,9 @@ if ($User->admin != 1) {
|
|||
}
|
||||
|
||||
echo '<H2 class="info"> Administration Globale</H2>';
|
||||
echo "<div>".MenuAdmin()."</div>";
|
||||
echo '<div style="float:left;background-color:#879ED4;width:100%;">';
|
||||
|
||||
echo MenuAdmin()."</div>";
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
*/
|
||||
include_once ("constant.php");
|
||||
include_once ("postgres.php");
|
||||
include ('class_user.php');
|
||||
require_once ('class_user.php');
|
||||
require_once ('class_dossier.php');
|
||||
|
||||
|
||||
|
|
@ -37,6 +37,8 @@ require_once ('class_dossier.php');
|
|||
$cn=DbConnect(dossier::id());
|
||||
|
||||
$User=new User($cn);
|
||||
$User->check_dossier(dossier::id());
|
||||
$User->can_request('GEBQ');
|
||||
$User->Check();
|
||||
if ( isset ($_GET['action']) &&
|
||||
$_GET['action']=='update'
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ require_once ("user_common.php");
|
|||
require_once ("debug.php");
|
||||
require_once('class_dossier.php');
|
||||
require_once('class_acc_report.php');
|
||||
require_once('class_user.php');
|
||||
if ( ! isset($_GET['gDossier']) ||
|
||||
! isset($_GET['f']) )
|
||||
{
|
||||
|
|
@ -39,6 +40,13 @@ if ( ! isset($_GET['gDossier']) ||
|
|||
print $a;
|
||||
exit();
|
||||
}
|
||||
$cn=DbConnect(dossier::id());
|
||||
|
||||
$User=new User($cn);
|
||||
$User->Check();
|
||||
$User->check_dossier(dossier::id());
|
||||
$User->can_request('PARRAP',0);
|
||||
|
||||
|
||||
|
||||
$gDossier=dossier::id();
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@ require_once("class_widget.php");
|
|||
require_once("class_acc_ledger.php");
|
||||
require_once("class_acc_operation.php");
|
||||
require_once ('class_periode.php');
|
||||
require_once('class_acc_reconciliation.php');
|
||||
|
||||
|
||||
/* Admin. Dossier */
|
||||
include_once ("class_user.php");
|
||||
|
|
@ -42,6 +44,8 @@ $gDossier=dossier::id();
|
|||
$cn=DbConnect($gDossier);
|
||||
$User=new User($cn);
|
||||
$User->Check();
|
||||
$User->check_dossier(dossier::id());
|
||||
$User->can_request(GEOP,0);
|
||||
|
||||
html_page_start($User->theme,"onLoad='window.focus();'");
|
||||
echo JS_VIEW_JRN_MODIFY;
|
||||
|
|
@ -50,12 +54,10 @@ if ( isset( $_REQUEST['p_jrn'] )) {
|
|||
}
|
||||
|
||||
// Check privilege
|
||||
// CheckJrn verify that the user is not an admin
|
||||
// an admin has all right
|
||||
if ( CheckJrn($gDossier,$_SESSION['g_user'],$_GET['p_jrn']) != 2 ) {
|
||||
NoAccess();
|
||||
exit -1;
|
||||
}
|
||||
if ( $User->check_jrn($_GET['p_jrn']) != 'W') {
|
||||
NoAccess();
|
||||
exit -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -223,7 +225,10 @@ if ($p_id != -1 ) { // A
|
|||
|
||||
// Add a "concerned operation to bound these op.together
|
||||
//
|
||||
$Res=InsertRapt($cn,$seq,$l_array['jr_id']);
|
||||
$rec=new Acc_Reconciliation ($cn);
|
||||
$rec->set_jr_id($seq);
|
||||
$rec->insert($l_array['jr_id']);
|
||||
|
||||
// Check return code
|
||||
if ( $Res == false ) { throw (new Exception(__FILE__.__LINE__."sql a echoue [ $sql ]"));}
|
||||
|
||||
|
|
@ -404,8 +409,10 @@ for ( $i = 0; $i < $max_cred;$i++) {
|
|||
echo ${"e_class_cred$i"}." $lib "."<B>".${"e_mont_cred$i"}."</B>";
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
$a=GetConcerned($cn,$e_jr_id);
|
||||
/* concerned operation */
|
||||
$rec=new Acc_Reconciliation($cn);
|
||||
$rec->set_jr_id($e_jr_id);
|
||||
$a=$rec->get();
|
||||
|
||||
if ( $a != null ) {
|
||||
|
||||
|
|
|
|||
|
|
@ -36,11 +36,13 @@ $cn=DbConnect($gDossier);
|
|||
require_once ('class_user.php');
|
||||
$User=new User(DbConnect());
|
||||
$User->Check();
|
||||
if ( $User->check_action($cn,BALANCE) == 0)
|
||||
if ( $User->check_action(IMPBAL) == 0)
|
||||
{
|
||||
NoAccess();
|
||||
exit;
|
||||
}
|
||||
echo 'poste;libelle;deb;cred;solde deb;solde cred';
|
||||
printf("\n");
|
||||
$bal=new Acc_Balance($cn);
|
||||
|
||||
$t_cent="";
|
||||
|
|
|
|||
|
|
@ -40,16 +40,8 @@ $User->Check();
|
|||
|
||||
// TODO a specific level of security for the "bilan" ???
|
||||
// Change must be done here
|
||||
if ( $User->admin == 0 ) {
|
||||
if ($User->check_action($cn,IMP)
|
||||
==0
|
||||
)
|
||||
{
|
||||
/* Cannot Access */
|
||||
NoAccess();
|
||||
}
|
||||
$User->can_request(IMPBIL);
|
||||
|
||||
}
|
||||
|
||||
$bilan=new Acc_Bilan($cn);
|
||||
$bilan->get_request_get();
|
||||
|
|
|
|||
|
|
@ -29,11 +29,16 @@ extract ($_POST);
|
|||
require_once ('class_dossier.php');
|
||||
require_once ('class_bud_data.php');
|
||||
require_once ('debug.php');
|
||||
require_once('class_user.php');
|
||||
|
||||
echo_debug(__FILE__.':'.__LINE__,' $POST ',$_POST);
|
||||
|
||||
|
||||
$cn=DbConnect(dossier::id());
|
||||
$User=new User($cn);
|
||||
$User->Check();
|
||||
$User->check_dossier(dossier::id());
|
||||
$User->can_request('BUDLEC',1);
|
||||
|
||||
|
||||
|
||||
if ( $_POST['action'] == 'delete') {
|
||||
if ( $bd_id != 0 ) {
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ $User=new User($rep);
|
|||
$User->Check();
|
||||
|
||||
echo '<div class="u_tmenu">';
|
||||
echo menu_tool("budget");
|
||||
echo menu_tool("budget.php");
|
||||
echo '<div style="clear:both">';
|
||||
/* security */
|
||||
|
||||
|
|
@ -86,7 +86,7 @@ echo ShowItem(array(
|
|||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
$User->can_request($rep,BUDGET);
|
||||
$User->can_request(BUDLEC,1);
|
||||
|
||||
$cn=DbConnect($gDossier);
|
||||
$obj=new Bud_Hypo($cn);
|
||||
|
|
@ -96,6 +96,7 @@ $obj=new Bud_Hypo($cn);
|
|||
//-----------------------------------------------------
|
||||
if ( $p_action == "hypo" )
|
||||
{
|
||||
$User->can_request(BUDHYP,1);
|
||||
require_once("bud_hypo.inc.php");
|
||||
}
|
||||
|
||||
|
|
@ -104,6 +105,7 @@ if ( $p_action == "hypo" )
|
|||
//-----------------------------------------------------
|
||||
if ( $p_action == "fiche" )
|
||||
{
|
||||
$User->can_request(BUDFIC,1);
|
||||
if ( $obj->size()==0 ) {
|
||||
echo '<h2 class="info">Desole pas d\'hypothese definie</h2>';
|
||||
exit();
|
||||
|
|
@ -130,6 +132,7 @@ if ( $p_action == "detail" )
|
|||
//-----------------------------------------------------
|
||||
if ( $p_action == "synthese" )
|
||||
{
|
||||
$User->can_request(BUDIMP,1);
|
||||
if ( $obj->size()==0 ) {
|
||||
echo '<h2 class="info">Desole pas d\'hypothese definie</h2>';
|
||||
exit();
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ $rep=DbConnect($gDossier);
|
|||
require_once ("class_user.php");
|
||||
$User=new User($rep);
|
||||
$User->Check();
|
||||
$User->check_dossier($gDossier);
|
||||
|
||||
//-----------------------------------------------------
|
||||
// update preference
|
||||
|
|
@ -70,13 +71,16 @@ require_once('class_widget.php');
|
|||
include_once("preference.php");
|
||||
include_once("user_menu.php");
|
||||
$str_dossier=dossier::get();
|
||||
echo '<div class="u_tmenu">';
|
||||
echo menu_tool('gestion');
|
||||
echo '</div>';
|
||||
|
||||
$p_action=(isset ($_REQUEST['p_action']))?$_REQUEST['p_action']:"";
|
||||
// TODO Menu with all the customer
|
||||
//echo '<div class="u_tmenu">';
|
||||
echo '<div style="float:left">';
|
||||
///echo '<div style="float:left">';
|
||||
echo '<div class="u_tmenu">';
|
||||
echo menu_tool('commercial.php');
|
||||
|
||||
echo '<div style="float:left;background-color:#879ED4;width:100%;">';
|
||||
|
||||
echo ShowItem(array(
|
||||
array('?p_action=client&'.$str_dossier,'Client'),
|
||||
array('?p_action=ven&'.$str_dossier,'Vente/Facture'),
|
||||
|
|
@ -95,13 +99,11 @@ echo ShowItem(array(
|
|||
),
|
||||
'H',"mtitle","mtitle","?p_action=$p_action&".$str_dossier,' width="100%"');
|
||||
|
||||
|
||||
//
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
|
||||
|
||||
$cn=DbConnect($gDossier);
|
||||
$User->can_request($cn,SEC_GESTION);
|
||||
|
||||
echo JS_VIEW_JRN_MODIFY;
|
||||
echo JS_AJAX_FICHE;
|
||||
|
||||
|
|
@ -118,12 +120,14 @@ if ( $p_action == "pref" )
|
|||
//-----------------------------------------------------
|
||||
if ( $p_action == "client" )
|
||||
{
|
||||
$User->can_request(GECUST,1);
|
||||
require_once("client.inc.php");
|
||||
}// $p_action == fournisseur
|
||||
//-----------------------------------------------------
|
||||
// Fournisseur
|
||||
if ( $p_action == 'fournisseur')
|
||||
{
|
||||
$User->can_request(GESUPPL,1);
|
||||
require_once("supplier.inc.php");
|
||||
}
|
||||
|
||||
|
|
@ -131,6 +135,7 @@ if ( $p_action == 'fournisseur')
|
|||
// action
|
||||
if ( $p_action == 'suivi_courrier')
|
||||
{
|
||||
$User->can_request(GECOUR,1);
|
||||
require_once("action.inc.php");
|
||||
}
|
||||
//-----------------------------------------------------
|
||||
|
|
@ -167,13 +172,14 @@ if ( $p_action=='quick_writing') {
|
|||
// Impression
|
||||
if ( $p_action == 'impress')
|
||||
{
|
||||
if ( $User->check_action($cn,IMP) == 0)
|
||||
{
|
||||
NoAccess();
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once("impress.inc.php");
|
||||
if ( $User->check_action(IMPRAP)==1 ||
|
||||
$User->check_action(IMPJRN)==1 ||
|
||||
$User->check_action(IMPFIC)==1 ||
|
||||
$User->check_action(IMPPOSTE)==1 ||
|
||||
$User->check_action(IMPBIL)==1 )
|
||||
require_once("impress.inc.php");
|
||||
else
|
||||
$User->can_request(9999,1);
|
||||
}
|
||||
if ( $p_action == 'fiche') {
|
||||
require_once('fiche.inc.php');
|
||||
|
|
@ -182,14 +188,20 @@ if ( $p_action == 'stock') {
|
|||
require_once('stock.inc.php');
|
||||
}
|
||||
if ( $p_action=='periode') {
|
||||
require_once ('periode.inc.php');
|
||||
if ( $User->check_action(PARPER)==1 ||
|
||||
$User->check_action(PARCLO)==1)
|
||||
require_once ('periode.inc.php');
|
||||
else
|
||||
$User->can_request(9999,1);
|
||||
}
|
||||
if ( $p_action=='central') {
|
||||
$User->can_request(PARCENT,1);
|
||||
require_once ('central.inc.php');
|
||||
}
|
||||
//-----------------------------------------------------
|
||||
// Expense
|
||||
if ( $p_action == 'defreport')
|
||||
{
|
||||
$User->can_request(PARPREDE,1);
|
||||
require_once("report.inc.php");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ $gDossier=dossier::id();
|
|||
include_once ("ac_common.php");
|
||||
$action=(isset($_REQUEST['p_action']))?$_REQUEST['p_action']:'';
|
||||
$use_html=1;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/*!\todo find a way to improve performance : the calendar must not
|
||||
* always be loaded and takes at least 50KB
|
||||
|
|
@ -71,8 +72,6 @@ echo '</div>';
|
|||
// call impress sub-menu
|
||||
if ( $action == 'impress' ) {
|
||||
|
||||
$User->can_request($cn,IMP) ;
|
||||
|
||||
require_once('impress.inc.php');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ require_once ("class_user.php");
|
|||
require_once ('user_menu.php');
|
||||
$User=new User($cn);
|
||||
$User->Check();
|
||||
|
||||
$User->check_dossier($gDossier);
|
||||
|
||||
|
||||
html_page_start($_SESSION['g_theme']);
|
||||
|
|
@ -47,30 +47,27 @@ html_page_start($_SESSION['g_theme']);
|
|||
//Header
|
||||
echo '<div class="u_tmenu">';
|
||||
//-----------------------------------------------------------------
|
||||
echo menu_tool('analytic');
|
||||
echo menu_tool('comptanalytic.php');
|
||||
$def=-1;
|
||||
if ( isset ($_REQUEST['p_action']))
|
||||
{
|
||||
switch ($_REQUEST['p_action'])
|
||||
{
|
||||
case 'ca_pa':
|
||||
$User->can_request($cn,CA_ACCESS);
|
||||
$def=0;
|
||||
break;
|
||||
case 'ca_od':
|
||||
$User->can_request($cn,CA_ODS);
|
||||
$def=1;
|
||||
break;
|
||||
case 'ca_imp':
|
||||
$User->can_request($cn,CA_IMPRESSION);
|
||||
$def=2;
|
||||
break;
|
||||
case 'ca_groupe':
|
||||
$def=3;
|
||||
break;
|
||||
}
|
||||
switch ($_REQUEST['p_action'])
|
||||
{
|
||||
case 'ca_pa':
|
||||
$def=0;
|
||||
break;
|
||||
case 'ca_od':
|
||||
$def=1;
|
||||
break;
|
||||
case 'ca_imp':
|
||||
$def=2;
|
||||
break;
|
||||
case 'ca_groupe':
|
||||
$def=3;
|
||||
break;
|
||||
}
|
||||
}
|
||||
echo '<div style="float:left">';
|
||||
echo '<div style="float:left;background-color:#879ED4;width:100%;">';
|
||||
echo ShowItem(array(
|
||||
array('?p_action=ca_pa&'.$str_dossier,'Plan Analytique',"Plan Analytique",0),
|
||||
array('?p_action=ca_od&'.$str_dossier,'Opérations Diverses',"Permet d'enregistrer des operations sur la compta analytique",1),
|
||||
|
|
@ -81,6 +78,29 @@ echo ShowItem(array(
|
|||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
if ( isset ($_REQUEST['p_action']))
|
||||
{
|
||||
switch ($_REQUEST['p_action'])
|
||||
{
|
||||
case 'ca_pa':
|
||||
$User->can_request(CAPA,1);
|
||||
$def=0;
|
||||
break;
|
||||
case 'ca_od':
|
||||
$User->can_request(CAOD,1);
|
||||
$def=1;
|
||||
break;
|
||||
case 'ca_imp':
|
||||
$User->can_request(CAIMP,1);
|
||||
$def=2;
|
||||
break;
|
||||
case 'ca_groupe':
|
||||
$User->can_request(CAGA,1);
|
||||
$def=3;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !isset($_REQUEST['p_action']))
|
||||
exit();
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
* \brief respond ajax request, the get contains
|
||||
* the value :
|
||||
* - c for qcode
|
||||
* - t for tva_id
|
||||
* - t for tva_id -1 if there is no TVA to compute
|
||||
* - p for price
|
||||
* - q for quantity
|
||||
* - n for number of the ctrl
|
||||
|
|
@ -48,20 +48,27 @@ foreach (array('t','c','p','q','n','gDossier') as $a) {
|
|||
}
|
||||
$cn=DbConnect(dossier::id());
|
||||
|
||||
// Retrieve the rate of vat
|
||||
|
||||
$tva_rate=new Acc_Tva($cn);
|
||||
$tva_rate->set_parameter('id',$t);
|
||||
$tva_rate->load();
|
||||
// Retrieve the rate of vat, it $t == -1 it means no VAT
|
||||
if ( $t != -1 ){
|
||||
$tva_rate=new Acc_Tva($cn);
|
||||
$tva_rate->set_parameter('id',$t);
|
||||
$tva_rate->load();
|
||||
}
|
||||
|
||||
$total=new Acc_Compute();
|
||||
bcscale(4);
|
||||
$amount=round(bcmul($p,$q),2);
|
||||
$total->set_parameter('amount',$amount);
|
||||
$total->set_parameter('amount_vat_rate',$tva_rate->get_parameter('rate'));
|
||||
$total->compute_vat();
|
||||
$tvac=bcadd($total->get_parameter('amount_vat'),$amount);
|
||||
header("Content-type: text/html; charset: utf8",true);
|
||||
echo '{"ctl":"'.$n.'","htva":"'.$amount.'","tva":"'.$total->get_parameter('amount_vat').'","tvac":"'.$tvac.'"}';
|
||||
if ( $t != -1 ) {
|
||||
$total->set_parameter('amount_vat_rate',$tva_rate->get_parameter('rate'));
|
||||
$total->compute_vat();
|
||||
$tvac=bcadd($total->get_parameter('amount_vat'),$amount);
|
||||
header("Content-type: text/html; charset: utf8",true);
|
||||
echo '{"ctl":"'.$n.'","htva":"'.$amount.'","tva":"'.$total->get_parameter('amount_vat').'","tvac":"'.$tvac.'"}';
|
||||
} else {
|
||||
/* there is no vat to compute */
|
||||
header("Content-type: text/html; charset: utf8",true);
|
||||
echo '{"ctl":"'.$n.'","htva":"'.$amount.'","tva":"NA","tvac":"'.$amount.'"}';
|
||||
}
|
||||
?>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,73 +0,0 @@
|
|||
<?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 Manage the hypothese for the budget module
|
||||
*/
|
||||
extract ($_GET);
|
||||
/* m for requested module
|
||||
* f from module
|
||||
*/
|
||||
foreach (array('gDossier','m') as $i) {
|
||||
if ( ! isset (${$i}) ) {
|
||||
echo "Erreur parametre manquant";
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
require_once('class_dossier.php');
|
||||
require_once('user_common.php');
|
||||
|
||||
$phpsessid='&PHPSESSID='.$_REQUEST['PHPSESSID'];
|
||||
switch ($m) {
|
||||
case 'budget':
|
||||
get_redirect('budget.php?'.dossier::get().$phpsessid);
|
||||
break;
|
||||
case 'compta':
|
||||
get_redirect('user_compta.php?'.dossier::get().$phpsessid);
|
||||
break;
|
||||
case 'analytic':
|
||||
get_redirect('comptanalytic.php?'.dossier::get().$phpsessid);
|
||||
break;
|
||||
case 'home':
|
||||
get_redirect('user_login.php?'.$phpsessid);
|
||||
break;
|
||||
case 'gestion':
|
||||
get_redirect('commercial.php?'.dossier::get().$phpsessid);
|
||||
break;
|
||||
case 'param':
|
||||
get_redirect('parametre.php?'.dossier::get().$phpsessid);
|
||||
break;
|
||||
case 'pref':
|
||||
get_redirect('user_pref.php?'.dossier::get().$phpsessid);
|
||||
break;
|
||||
case 'home':
|
||||
get_redirect('user_login.php'.$phpsessid);
|
||||
break;
|
||||
case 'access':
|
||||
get_redirect('access.php?'.dossier::get().$phpsessid);
|
||||
break;
|
||||
|
||||
case 'logout':
|
||||
get_redirect('logout.php');
|
||||
}
|
||||
|
||||
351
html/fiche.php
351
html/fiche.php
|
|
@ -1,351 +0,0 @@
|
|||
<?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 module to manage the card (removing, listing, creating, modify attribut)
|
||||
*/
|
||||
?>
|
||||
<h2> ERREUR MAUVAIS APPEL </H2>
|
||||
|
||||
<?php
|
||||
exit();
|
||||
include_once ("ac_common.php");
|
||||
require_once('class_fiche.php');
|
||||
|
||||
html_page_start($_SESSION['g_theme']);
|
||||
|
||||
if ( ! isset ( $_SESSION['g_dossier'] ) ) {
|
||||
echo "You must choose a Dossier ";
|
||||
exit -2;
|
||||
}
|
||||
include_once ("postgres.php");
|
||||
include_once ("user_menu.php");
|
||||
|
||||
|
||||
$rep=DbConnect();
|
||||
include_once ("class_user.php");
|
||||
$User=new User($rep);
|
||||
$User->Check();
|
||||
include ("check_priv.php");
|
||||
echo '<div class="u_tmenu">';
|
||||
|
||||
echo ShowMenuCompta($_SESSION['g_dossier']);
|
||||
echo '</div>';
|
||||
echo JS_SEARCH_POSTE;
|
||||
|
||||
if ( !isset($sessid))
|
||||
{
|
||||
$sessid=$_REQUEST["PHPSESSID"];
|
||||
}
|
||||
$search='<INPUT TYPE="BUTTON" VALUE="Cherche" OnClick="SearchPoste(\''.$sessid."')\">";
|
||||
|
||||
|
||||
include_once("fiche_inc.php");
|
||||
|
||||
$cn=DbConnect($_SESSION['g_dossier']);
|
||||
|
||||
// Security check
|
||||
$read=$User->check_action($cn,FICHE_READ);
|
||||
$write=$User->check_action($cn,FICHE_WRITE);
|
||||
if ($read+$write == 0 ){
|
||||
/* Cannot Access */
|
||||
NoAccess();
|
||||
}
|
||||
function ShowFicheDefInput($p_fiche_def)
|
||||
{
|
||||
$r="";
|
||||
// Save the label
|
||||
|
||||
$p_fiche_def->SaveLabel($_REQUEST['label']);
|
||||
$p_fiche_def->Get();
|
||||
$p_fiche_def->GetAttribut();
|
||||
$r.= '<H2 class="info">'.$p_fiche_def->label.'</H2>';
|
||||
|
||||
$r.= '<FORM action="fiche.php" method="POST">';
|
||||
$r.= '<INPUT TYPE="HIDDEN" NAME="fd_id" VALUE="'.$p_fiche_def->id.'">';
|
||||
|
||||
$r.= $p_fiche_def->DisplayAttribut();
|
||||
$r.= ' <INPUT TYPE="SUBMIT" Value="Ajoute cet élément" NAME="add_line">';
|
||||
$r.= "</form>";
|
||||
return $r;
|
||||
}
|
||||
// Creation of a new model of card
|
||||
// in the database
|
||||
if ( isset($_POST['add_modele']) and $write != 0) {
|
||||
// insert the model of card in database
|
||||
$fiche_def=new fiche_def($cn);
|
||||
$fiche_def->Add($_POST);
|
||||
}
|
||||
$r="";
|
||||
// Add a line in the card model
|
||||
if ( isset ($_POST["add_line"]) ) {
|
||||
$r= '<DIV class="u_redcontent">';
|
||||
if ( $write ==0)
|
||||
$r.= "<h2 class=\"error\"> Pas d'accès </h2>";
|
||||
else
|
||||
{
|
||||
$fiche_def=new fiche_def($cn,$_REQUEST['fd_id']);
|
||||
// Insert Line
|
||||
$fiche_def->InsertAttribut($_REQUEST['ad_id']);
|
||||
|
||||
$r.=ShowFicheDefInput($fiche_def);
|
||||
|
||||
}
|
||||
$r.= '</DIV>';
|
||||
}
|
||||
// Change the name of the card model
|
||||
if ( isset ($_POST["change_name"] ) ) {
|
||||
$r= '<DIV class="u_redcontent">';
|
||||
if ( $write ==0)
|
||||
$r.= "<h2 class=\"error\"> Pas d'accès </h2>";
|
||||
else
|
||||
{
|
||||
$fiche_def=new fiche_def($cn,$_REQUEST['fd_id']);
|
||||
$r.=ShowFicheDefInput($fiche_def);
|
||||
}
|
||||
$r.= '</DIV>';
|
||||
}
|
||||
|
||||
//var_dump($_GET);
|
||||
ShowMenuFiche($_SESSION['g_dossier']);
|
||||
echo $r;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Get action
|
||||
if ( isset ( $_GET["action"]) ) {
|
||||
$action=$_GET["action"];
|
||||
// View the details of the selected cat. of cards
|
||||
if ( isset ($_GET["fiche"]) && $action=="vue"
|
||||
&& ! isset ($_POST['add_fiche'])
|
||||
&& ! isset ($_POST['update_fiche'])
|
||||
&& ! isset ($_POST['delete'])) {
|
||||
echo '<DIV class="u_redcontent">';
|
||||
$fiche_def=new fiche_def($cn,$_GET['fiche']);
|
||||
$fiche_def->myList();
|
||||
|
||||
echo '</DIV>';
|
||||
|
||||
}
|
||||
//_________________________________________________________________________
|
||||
// Display the detail of a card
|
||||
if ($action== "detail" ) {
|
||||
echo '<DIV class="u_redcontent">';
|
||||
$t=false;
|
||||
if ( $write == 0)
|
||||
{
|
||||
echo '<H2 class="info"> Vos changements ne seront pas sauvés</h2>';
|
||||
$t=true;
|
||||
}
|
||||
$str="";
|
||||
$fiche=new fiche($cn,$_GET["fiche_id"]);
|
||||
if ( $_SESSION['g_pagesize'] != -1 ){
|
||||
// retrieve value
|
||||
// with offet &offset=15&step=15&page=2&size=15
|
||||
if ( isset($_GET['offset']) && $_SESSION['g_pagesize'] != -1) {
|
||||
$str=sprintf("&offset=%s&step=%s&page=%s&size=%s",
|
||||
$_GET['offset'],
|
||||
$_GET['step'],
|
||||
$_GET['page'],
|
||||
$_GET['size']);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if ( $write != 0 )
|
||||
echo '<form method="post" action="fiche.php?action=vue&fiche='.$_GET['fiche'].$str.'">';
|
||||
echo $fiche->Display($t);
|
||||
echo '<input type="hidden" name="f_id" value="'.$_GET['fiche_id'].'">';
|
||||
if ( $write != 0 ) {
|
||||
echo '<input type="submit" name="update_fiche" value="Mise à jour">';
|
||||
echo '<input type="submit" name="delete" value="Effacer cette fiche">';
|
||||
}
|
||||
$str="";
|
||||
|
||||
echo '<a class="mtitle" href="fiche.php?action=vue&fiche='.$fiche->fiche_def.$str.
|
||||
'"><input type="button" value="annuler"></A>';
|
||||
if ( $write != 0 ) echo '</form>';
|
||||
echo '</DIV>';
|
||||
}
|
||||
//_________________________________________________________________________
|
||||
// Display the form where you can enter
|
||||
// the property of the card model
|
||||
if ($action == "add_modele" and $write !=0) {
|
||||
echo '<DIV class="u_redcontent">';
|
||||
CreateCategory($cn,$search);
|
||||
echo '</DIV>';
|
||||
}
|
||||
//_________________________________________________________________________
|
||||
// Modify a card Model
|
||||
if ($action == "modifier" ) {
|
||||
echo '<DIV class="u_redcontent">';
|
||||
if ( $write ==0)
|
||||
echo "<h2 class=\"error\"> Pas d'accès </h2>";
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
$fiche_def=new fiche_def($cn,$_GET['fiche']);
|
||||
$fiche_def->Get();
|
||||
$fiche_def->GetAttribut();
|
||||
echo '<H2 class="info">'.$fiche_def->label.'</H2>';
|
||||
|
||||
echo '<FORM action="fiche.php" method="POST">';
|
||||
echo '<INPUT TYPE="HIDDEN" NAME="fd_id" VALUE="'.$fiche_def->id.'">';
|
||||
|
||||
echo $fiche_def->DisplayAttribut();
|
||||
echo ' <INPUT TYPE="SUBMIT" Value="Ajoute cet élément" NAME="add_line">';
|
||||
echo "</form>";
|
||||
}
|
||||
echo '</DIV>';
|
||||
}
|
||||
//_________________________________________________________________________
|
||||
// Search a card
|
||||
if ( $action == "search" )
|
||||
{
|
||||
$sql="select distinct f_id,fd_id,av_text from fiche join jnt_fic_att_value using (f_id)
|
||||
join attr_value using (jft_id) where
|
||||
upper(av_text) like upper('%".FormatString($_GET["search_text"])."%') order by av_text,f_id";
|
||||
$all=get_array($cn,$sql);
|
||||
// test on the size
|
||||
//
|
||||
if ( sizeof($all) != 0 )
|
||||
{
|
||||
echo '<DIV class="u_redcontent">';
|
||||
echo "Nombre de résultat : ".sizeof($all).'<br>';
|
||||
foreach ($all as $f_id){
|
||||
$fiche=new fiche($cn,$f_id['f_id']);
|
||||
echo '<A class="mtitle" href="?p_action=fiche&action=detail&fiche_id='.$f_id['f_id'].
|
||||
'&fiche='.$f_id['fd_id'].'">'.
|
||||
$fiche->getName().'</A><br>';
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
echo '<DIV class="u_redcontent">';
|
||||
echo '<form method="GET" action="?">';
|
||||
$w=new widget('text');
|
||||
$search_text=(isset($_REQUEST['search_text']))?$_REQUEST['search_text']:"";
|
||||
$h=new widget('hidden');
|
||||
echo $h->IOValue('action','search');
|
||||
echo "Recherche :".$w->IOValue('search_text',$search_text);
|
||||
echo widget::submit('submit','Rechercher');
|
||||
echo '</form>';
|
||||
echo "Aucun résultat trouvé";
|
||||
|
||||
echo '</div>';
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
// Display a blank card from the selected category
|
||||
if ( isset ($_POST["fiche"]) && isset ($_POST["add"] ) ) {
|
||||
echo '<DIV class="u_redcontent">';
|
||||
if ( $write ==0)
|
||||
echo "<h2 class=\"error\"> Pas d'accès </h2>";
|
||||
else
|
||||
{
|
||||
$url=$_SERVER['REQUEST_URI'];
|
||||
$fiche=new fiche($cn,0);
|
||||
|
||||
echo '<form method="post" action="'.$url.'&fiche='.$_POST['fiche'].'">';
|
||||
echo $fiche->blank($_POST['fiche']);
|
||||
echo '<input type="submit" name="add_fiche" value="Ajout">';
|
||||
echo '<a class="mtitle" href="'.$url.'&fiche='.$_POST['fiche'].'">'.
|
||||
'<input type="button" value="annuler"></A>';
|
||||
|
||||
|
||||
echo '</form>';
|
||||
}
|
||||
echo '</DIV>';
|
||||
exit();
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
// delete a card
|
||||
if (isset($_POST['delete']) ) {
|
||||
echo '<DIV class="u_redcontent">';
|
||||
if ( $write ==0)
|
||||
echo "<h2 class=\"error\"> Pas d'accès </h2>";
|
||||
else
|
||||
{
|
||||
$fiche=new fiche($cn,$_POST["f_id"]);
|
||||
$fiche->remove();
|
||||
}
|
||||
$fiche_def=new fiche_def($cn,$_GET['fiche']);
|
||||
$fiche_def->myList();
|
||||
|
||||
echo "</DIV>";
|
||||
exit();
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
// Add the data (attribute) of the card
|
||||
if ( isset ($_POST["add_fiche"]) ) {
|
||||
echo '<DIV class="u_redcontent">';
|
||||
|
||||
if ( $write ==0)
|
||||
echo "<h2 class=\"error\"> Pas d'accès </h2>";
|
||||
else
|
||||
{
|
||||
$fiche=new fiche($cn);
|
||||
$fiche->Save($_REQUEST['fiche']);
|
||||
$fiche_def=new fiche_def($cn,$_GET['fiche']);
|
||||
$fiche_def->myList();
|
||||
|
||||
|
||||
}
|
||||
echo '</DIV>';
|
||||
exit();
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
// Update a card
|
||||
if ( isset ($_POST["update_fiche"]) ) {
|
||||
echo '<DIV class="u_redcontent">';
|
||||
if ( $write ==0)
|
||||
echo "<h2 class=\"error\"> Pas d'accès </h2>";
|
||||
else
|
||||
{
|
||||
$fiche=new fiche($cn,$_POST['f_id']);
|
||||
$fiche->Save();
|
||||
|
||||
}
|
||||
$fiche_def=new fiche_def($cn,$_GET['fiche']);
|
||||
$fiche_def->myList();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
echo '</DIV>';
|
||||
}
|
||||
//--Search menu
|
||||
if ( ! isset($_REQUEST['action']) ){
|
||||
echo '<DIV class="u_redcontent">';
|
||||
echo '<form method="GET" action="?">';
|
||||
$w=new widget('text');
|
||||
$search_text=(isset($_REQUEST['search_text']))?$_REQUEST['search_text']:"";
|
||||
$h=new widget('hidden');
|
||||
echo $h->IOValue('action','search');
|
||||
echo "Recherche :".$w->IOValue('search_text',$search_text);
|
||||
echo widget::submit('submit','Rechercher');
|
||||
echo '</form>';
|
||||
echo '</div>';
|
||||
}
|
||||
html_page_stop();
|
||||
?>
|
||||
|
|
@ -34,12 +34,11 @@ $gDossier=dossier::id();
|
|||
if ( isset ($_REQUEST['with_amount'])) include_once("class_acc_account_ledger.php");
|
||||
$cn=DbConnect($gDossier);
|
||||
|
||||
$rep=DbConnect();
|
||||
require_once ('class_user.php');
|
||||
$User=new User($rep);
|
||||
$User=new User($cn);
|
||||
$User->Check();
|
||||
|
||||
$User->can_request($cn,FICHE_READ);
|
||||
$User->check_dossier($gDossier);
|
||||
$User->can_request(IMPFIC,0);
|
||||
|
||||
|
||||
if ( isset ($_POST['fd_id'])) {
|
||||
|
|
|
|||
|
|
@ -33,19 +33,19 @@ require_once("class_fiche_def.php");
|
|||
|
||||
/* $Revision$ */
|
||||
/* Admin. Dossier */
|
||||
$rep=DbConnect();
|
||||
include_once ("class_user.php");
|
||||
$User=new User($rep);
|
||||
$User->Check();
|
||||
$gDossier=dossier::id();
|
||||
$cn=DbConnect($gDossier);
|
||||
|
||||
include_once ("class_user.php");
|
||||
$User=new User($cn);
|
||||
$User->Check();
|
||||
$User->check_dossier($gDossier);
|
||||
html_min_page_start($User->theme,"onLoad='window.focus();'");
|
||||
require_once('class_dossier.php');
|
||||
$gDossier=dossier::id();
|
||||
|
||||
$cn=DbConnect($gDossier);
|
||||
// TODO add security here
|
||||
// Get The priv on the selected folder
|
||||
if ( $User->check_action($cn,FICHE_WRITE)== 0) {
|
||||
if ( $User->check_action(FICADD)== 0) {
|
||||
/* Cannot Access */
|
||||
echo '<h2 class="error"> Vous ne pouvez pas ajouter de fiche</h2>';
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -20,17 +20,43 @@
|
|||
/* $Revision$ */
|
||||
/*! \file
|
||||
* \brief Search a card in a popup window
|
||||
*
|
||||
* This parameter given to this file via the javascript popup windows are
|
||||
* caller = searchcard
|
||||
* - first when is the first call it doesn't lookup directly
|
||||
* - search
|
||||
* - p_jrn the ledger id
|
||||
* - PHPSESSID
|
||||
* - type deb only the deb card from the ledger, cred means credit only, all the card, filter all the card of the ledger
|
||||
* - name of the control
|
||||
* - gDossier the dossier id
|
||||
* -the caller (what jascript function triggers this window)
|
||||
* caller = searchcardCtrl
|
||||
* - first
|
||||
* - searh
|
||||
* - p_jrn the ledger id
|
||||
* - PHPSESSID
|
||||
* - type deb only the deb card from the ledger, cred means credit only, all the card, filter all the card of the ledger
|
||||
* - name of the control
|
||||
* - ctrl the second control to set up
|
||||
* - gDossier the dossier id
|
||||
* -the caller (what jascript function triggers this window)
|
||||
*/
|
||||
|
||||
include_once ("ac_common.php");
|
||||
include_once ("poste.php");
|
||||
include_once ("postgres.php");
|
||||
include_once("jrn.php");
|
||||
/* Admin. Dossier */
|
||||
$rep=DbConnect();
|
||||
require_once('class_dossier.php');
|
||||
include_once ("class_user.php");
|
||||
$User=new User($rep);
|
||||
// include_once ("check_priv.php");
|
||||
$gDossier=dossier::id();
|
||||
$cn=DbConnect($gDossier);
|
||||
|
||||
$User=new User($cn);
|
||||
$User->Check();
|
||||
$User->check_dossier($gDossier);
|
||||
|
||||
echo JS_SEARCH_CARD;
|
||||
echo JS_MINTOOLKIT;
|
||||
//determine focus:
|
||||
|
|
@ -44,18 +70,6 @@ if ( isset ( $_GET['search']) )
|
|||
|
||||
|
||||
|
||||
require_once('class_dossier.php');
|
||||
$gDossier=dossier::id();
|
||||
|
||||
include_once ("check_priv.php");
|
||||
$cn=DbConnect($gDossier);
|
||||
// Get The priv on the selected folder
|
||||
if ( $User->check_action($cn,FICHE_READ) == 0 ){
|
||||
/* Cannot Access */
|
||||
echo '<h2 class="error"> Vous n\' avez pas accès</h2>';
|
||||
return;
|
||||
}
|
||||
|
||||
function get_list_fiche($p_cn,$get,$p_jrn)
|
||||
{
|
||||
$sql="select $get as fiche from jrn_def where jrn_def_id=$p_jrn";
|
||||
|
|
@ -82,23 +96,29 @@ function SetData (name_ctl,value,value_2,value_3,value_4,value_5,value_6) {
|
|||
self.opener.SetData(name_ctl,value,value_2,value_3,value_4,value_5,value_6);
|
||||
window.close();
|
||||
}
|
||||
function setCtrl(name_ctl,value,name_ctl2,value_3) {
|
||||
self.opener.setCtrl(name_ctl,value,name_ctl2,value_3);
|
||||
window.close();
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
$cn=DbConnect($gDossier);
|
||||
$r="";
|
||||
|
||||
// Propose to add a card if the ledger is not 0 (the great ledger)
|
||||
/*!\todo if the person can add a card, propose also the new button */
|
||||
if ($_GET['p_jrn'] != 0 ) {
|
||||
$add_card=new widget('button');
|
||||
$add_card->javascript=sprintf("NewCard('%s','%s','%s')",
|
||||
$_REQUEST['PHPSESSID'],
|
||||
$_GET['type'],
|
||||
"fic_search");
|
||||
$add_card->label="Ajout d'une fiche";
|
||||
if ( $User->check_action(FICADD)==1) {
|
||||
$add_card=new widget('button');
|
||||
$add_card->javascript=sprintf("NewCard('%s','%s','%s')",
|
||||
$_REQUEST['PHPSESSID'],
|
||||
$_GET['type'],
|
||||
"fic_search");
|
||||
$add_card->label="Ajout d'une fiche";
|
||||
}
|
||||
}
|
||||
foreach ($_GET as $key=>$element) {
|
||||
// The value are e_name e_type e_PHPSESSID
|
||||
${"e_$key"}=$element;
|
||||
echo_debug('fiche_search.php',__LINE__,"e_$key =$element<br>");
|
||||
|
||||
}
|
||||
$e_fic_search=(isset ($_REQUEST['fic_search']))?$_REQUEST['fic_search']:"";
|
||||
|
|
@ -202,7 +222,7 @@ if (
|
|||
$text=FormatString($row['vw_name']);
|
||||
$r.="<span class=\"$class\">";
|
||||
$qcode= $row['quick_code'] ;
|
||||
|
||||
if ( $e_caller=='searchcard') {
|
||||
$r.=sprintf ('<input name="%s" type="button" onClick="'."SetData('%s','%s','%s','%s','%s','%s','%s')".'" value="%s">',
|
||||
"select" . $i,
|
||||
$e_name,
|
||||
|
|
@ -214,6 +234,16 @@ if (
|
|||
$row['tva_label'] ,
|
||||
$qcode
|
||||
);
|
||||
} else {
|
||||
$r.=sprintf ('<input name="%s" type="button" onClick="'."setCtrl('%s','%s','%s','%s')".'" value="%s">',
|
||||
"select" . $i,
|
||||
$e_name,
|
||||
$row['quick_code'] ,
|
||||
$e_extra,
|
||||
$text,
|
||||
$row['quick_code']
|
||||
);
|
||||
}
|
||||
$r.=" ".h($row['vw_name']);
|
||||
if ( $row['vw_addr'] !="")
|
||||
$r.="<br><font size=-1>Adresse: ".h($row['vw_addr'])." ".h($row['vw_cp'])."</font>";
|
||||
|
|
@ -227,6 +257,6 @@ echo $r;
|
|||
?>
|
||||
|
||||
<?php
|
||||
if ( $_GET['p_jrn'] != 0 )echo $add_card->IOValue();
|
||||
if ( $_GET['p_jrn'] != 0 && $User->check_action(FICADD)==1)echo $add_card->IOValue();
|
||||
html_page_stop();
|
||||
?>
|
||||
|
|
|
|||
22
html/fid.php
22
html/fid.php
|
|
@ -22,15 +22,26 @@
|
|||
|
||||
/*!\file
|
||||
* \brief Fid for the ajax request for cards
|
||||
*
|
||||
* Valid parameter GET are
|
||||
* - d type = cred, deb, all or filter (see fiche_search.php')
|
||||
* - j is the legdger
|
||||
* - PHPSESSID
|
||||
* - caller give you what is the caller
|
||||
* - caller=searchcardCtrl : p_extra contains the control to update
|
||||
* - caller =searchcard p_extra is not used
|
||||
* - extra extra data, its meaning depends of the caller
|
||||
*/
|
||||
|
||||
|
||||
require_once('class_own.php');
|
||||
require_once ("constant.php");
|
||||
require_once ("postgres.php");
|
||||
require_once ("user_common.php");
|
||||
require_once ("debug.php");
|
||||
require_once('class_dossier.php');
|
||||
$gDossier=dossier::id();
|
||||
$caller=$_GET['caller'];
|
||||
$extra=$_GET['extra'];
|
||||
|
||||
echo_debug('fid.php',__LINE__,"Recherche fid.php".$_GET["FID"]);
|
||||
$cn=DbConnect($gDossier);
|
||||
|
|
@ -71,7 +82,12 @@ if ( isset($_SESSION['isValid']) && $_SESSION['isValid'] == 1)
|
|||
$array=get_array($cn,$sql, array($_GET['FID']));
|
||||
|
||||
echo_debug("fid",__LINE__,$array);
|
||||
/* Different behaviour depending of the caller */
|
||||
if ( strcmp($caller,'searchcardCtrl') === 0 ){
|
||||
$name=$array[0]['vw_name'];
|
||||
} else
|
||||
$name=$array[0]['vw_name']." ".$array[0]['vw_addr']." ".$array[0]['vw_cp'];
|
||||
|
||||
$sell=$array[0]['vw_sell'] ;
|
||||
$buy=$array[0]['vw_buy'];
|
||||
$tva_id=$array[0]['tva_id'];
|
||||
|
|
@ -82,7 +98,9 @@ if ( isset($_SESSION['isValid']) && $_SESSION['isValid'] == 1)
|
|||
$buy=($buy==null)?" ":str_replace('"','',$buy);
|
||||
$tva_id=($tva_id==null)?" ":str_replace('"','',$tva_id);
|
||||
|
||||
$a='{"answer":"ok","name":"'.$name.'","sell":"'.$sell.'","buy":"'.$buy.'","tva_id":"'.$tva_id.'","ctl":"'.$_GET['ctl'].'"}';
|
||||
|
||||
|
||||
$a='{"answer":"ok","name":"'.$name.'","sell":"'.$sell.'","buy":"'.$buy.'","tva_id":"'.$tva_id.'","ctl":"'.$_GET['ctl'].'","caller":"'.$caller.'","extra":"'.$extra.'"}';
|
||||
|
||||
}
|
||||
else
|
||||
|
|
|
|||
57
html/get_pj.php
Normal file
57
html/get_pj.php
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
<?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 respond ajax request, the get contains
|
||||
* the value :
|
||||
* - l for ledger
|
||||
* - gDossier
|
||||
* - PHPSESSID
|
||||
* Must return at least tva, htva and tvac
|
||||
* \todo must add the security
|
||||
*/
|
||||
|
||||
require_once ('constant.php');
|
||||
require_once ('postgres.php');
|
||||
require_once ('debug.php');
|
||||
require_once('class_dossier.php');
|
||||
require_once('class_acc_ledger.php');
|
||||
|
||||
// Check if the needed field does exist
|
||||
extract ($_GET);
|
||||
foreach (array('l','gDossier') as $a) {
|
||||
if ( ! isset (${$a}) ) { echo "error $a is not set "; exit();}
|
||||
}
|
||||
if ( ereg('^[0-9]+$',$l) == false ) {exit();}
|
||||
$cn=DbConnect(dossier::id());
|
||||
$Ledger=new Acc_Ledger($cn,$l);
|
||||
$prop=$Ledger->get_propertie();
|
||||
$pj_pref=$prop["jrn_def_pj_pref"];
|
||||
$pj_seq=$Ledger->get_last_pj();
|
||||
$string='{"pj":"'.$pj_pref.$pj_seq.'"}';
|
||||
|
||||
header("Content-type: text/json; charset: utf8",true);
|
||||
echo $string;
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
|
@ -1,27 +1,27 @@
|
|||
<?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
|
||||
// Author Olivier Dzwoniarkiewicz
|
||||
/*! \file
|
||||
* \brief for importing Bank operations
|
||||
*/
|
||||
/*
|
||||
* 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
|
||||
// Author Olivier Dzwoniarkiewicz
|
||||
/*! \file
|
||||
* \brief for importing Bank operations
|
||||
*/
|
||||
|
||||
include_once("ac_common.php");
|
||||
include_once("user_menu.php");
|
||||
|
|
@ -38,6 +38,7 @@ $cn=DbConnect($gDossier);
|
|||
include ('class_user.php');
|
||||
$User=new User($cn);
|
||||
$User->Check();
|
||||
$User->check_dossier(dossier::id());
|
||||
|
||||
html_page_start($User->theme);
|
||||
echo JS_PROTOTYPE;
|
||||
|
|
@ -53,24 +54,24 @@ echo '</div>';
|
|||
|
||||
|
||||
echo ShowMenuAdvanced(7);
|
||||
$User->can_request($cn,IMP_BQE);
|
||||
$User->can_request(GEBQ,1);
|
||||
|
||||
echo JS_AJAX_FICHE;
|
||||
echo '<div class="lmenu">';
|
||||
ShowMenuImport();
|
||||
echo '</div>';
|
||||
if ( isset( $_REQUEST['PHPSESSID'])) {
|
||||
$sessid = $_REQUEST['PHPSESSID'];
|
||||
$sessid = $_REQUEST['PHPSESSID'];
|
||||
}
|
||||
|
||||
|
||||
// if action is set proceed to it
|
||||
if ( isset ($_GET["action"]) ) {
|
||||
$action=$_GET["action"];
|
||||
// menu = import cvs
|
||||
// menu = import cvs
|
||||
if ($action == "import" ) {
|
||||
if(isset($_FILES['fupload'])) {
|
||||
// load the table with the cvs' content
|
||||
// load the table with the cvs' content
|
||||
echo '<DIV class="u_redcontent">';
|
||||
ImportCSV($cn,$_FILES['fupload']['tmp_name'],$_POST['import_bq'],$_POST['format_csv'],$_POST['import_jrn']);
|
||||
echo "</DIV>";
|
||||
|
|
|
|||
|
|
@ -19,7 +19,10 @@
|
|||
* <li>Documenter avec les tags doxygen votre nouveau code,</li>
|
||||
* <li>Dans le répertoire include: Les noms de fichiers sont *.inc.php pour les fichiers à éxécuter</li>
|
||||
* <li>Dans le répertoire include: Les noms de fichiers sont *.php pour les fichiers contenant des fonctions uniquement</li>
|
||||
* <li>Dans le répertoire include: Les noms de fichier sont class_*.php pour les fichiers contenant des classes.</li>
|
||||
* <li>Dans le répertoire include: Les noms de fichier sont
|
||||
* class_*.php pour les fichiers contenant des classes.</li>
|
||||
* <li>Dans le répertoire include/template: les fichiers de
|
||||
* présentation HTML </li>
|
||||
* <li>Utiliser sql/upgrade.sql comme fichier temporaire pour modifier la base de données, en général
|
||||
* ce fichier deviendra l'un des patch </li>
|
||||
* <li>Faire de la doc </li>
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
header('Content-type: application/csv');
|
||||
header('Content-Disposition: attachment;filename="jrn.csv"',FALSE);
|
||||
include_once ("ac_common.php");
|
||||
require_once('class_own.php');
|
||||
|
||||
require_once('class_dossier.php');
|
||||
$gDossier=dossier::id();
|
||||
|
|
@ -33,24 +34,24 @@ include_once ("postgres.php");
|
|||
include_once("check_priv.php");
|
||||
require_once("class_acc_ledger.php");
|
||||
$cn=DbConnect($gDossier);
|
||||
$rep=DbConnect();
|
||||
|
||||
|
||||
require_once ('class_user.php');
|
||||
$User=new User($rep);
|
||||
$User=new User($cn);
|
||||
$User->Check();
|
||||
if ( $User->check_action($cn,IMP) == 0 ||
|
||||
$User->AccessJrn($cn,$_GET['jrn_id']) == false){
|
||||
/* Cannot Access */
|
||||
NoAccess();
|
||||
}
|
||||
$User->can_request(IMPJRN,0);
|
||||
$User->check_dossier($gDossier);
|
||||
|
||||
if ($_GET['jrn_id']!=0 && $User->check_jrn($_GET['jrn_id']) =='X') {
|
||||
NoAccess(); exit();}
|
||||
|
||||
$p_cent=( isset ( $_GET['central']) )?$_GET['central']:'off';
|
||||
$p_cent=( isset ( $_GET['central']) )?$_GET['central']:'off';
|
||||
|
||||
$Jrn=new Acc_Ledger($cn,$_GET['jrn_id']);
|
||||
|
||||
$Jrn->get_name();
|
||||
$jrn_type=$Jrn->get_type();
|
||||
|
||||
// Detailled printing
|
||||
//---
|
||||
if ( $_GET['p_simple'] == 0 )
|
||||
|
|
@ -140,12 +141,16 @@ if ( $_GET['p_simple'] == 0 )
|
|||
//-----------------------------------------------------
|
||||
if ( $jrn_type=='ACH' || $jrn_type=='VEN')
|
||||
{
|
||||
$a_Tva=get_array($cn,"select tva_id,tva_label from tva_rate where tva_rate != 0.0000 order by tva_rate");
|
||||
$own=new Own($cn);
|
||||
$col_tva="";
|
||||
foreach($a_Tva as $line_tva)
|
||||
{
|
||||
$col_tva.='"Tva '.$line_tva['tva_label'].'";';
|
||||
}
|
||||
|
||||
if ( $own->MY_TVA_USE=='Y') {
|
||||
$a_Tva=get_array($cn,"select tva_id,tva_label from tva_rate where tva_rate != 0.0000 order by tva_rate");
|
||||
foreach($a_Tva as $line_tva)
|
||||
{
|
||||
$col_tva.='"Tva '.$line_tva['tva_label'].'";';
|
||||
}
|
||||
}
|
||||
echo '"Date";"operation";"Client/Fourn.";"Commentaire";"inter.";"HTVA";'.$col_tva.'"TVAC"'."\n\r";
|
||||
foreach ($Row as $line)
|
||||
{
|
||||
|
|
@ -169,16 +174,16 @@ if ( $_GET['p_simple'] == 0 )
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($a_Tva as $line_tva)
|
||||
{
|
||||
$a=$line_tva['tva_id'];
|
||||
if ( isset($a_tva_amount[$a]))
|
||||
printf("% 8.2f;",$a_tva_amount[$a]);
|
||||
else
|
||||
printf("0;");
|
||||
}
|
||||
|
||||
if ($own->MY_TVA_USE == 'Y' ) {
|
||||
foreach ($a_Tva as $line_tva)
|
||||
{
|
||||
$a=$line_tva['tva_id'];
|
||||
if ( isset($a_tva_amount[$a]))
|
||||
printf("% 8.2f;",$a_tva_amount[$a]);
|
||||
else
|
||||
printf("0;");
|
||||
}
|
||||
}
|
||||
printf("% 9.2f\r\n",$line['TVAC']);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
297
html/jrn_pdf.php
297
html/jrn_pdf.php
|
|
@ -41,12 +41,16 @@ include_once("preference.php");
|
|||
include_once("class_acc_ledger.php");
|
||||
include_once("check_priv.php");
|
||||
require_once ('header_print.php');
|
||||
require_once('class_own.php');
|
||||
|
||||
|
||||
echo_debug('jrn_pdf.php',__LINE__,"imp pdf journaux");
|
||||
$cn=DbConnect($gDossier);
|
||||
$l_type="JRN";
|
||||
$centr=" Non centralisé";
|
||||
$l_centr=0;
|
||||
$own=new Own($cn);
|
||||
|
||||
if ($_GET['central'] == 'on' ) {
|
||||
$centr=utf8_decode(" centralisé ");
|
||||
$l_centr=1;
|
||||
|
|
@ -54,12 +58,13 @@ if ($_GET['central'] == 'on' ) {
|
|||
$Jrn=new Acc_Ledger($cn,$_GET['jrn_id']);
|
||||
|
||||
$Jrn->get_name();
|
||||
$User=new User(DbConnect());
|
||||
$User=new User($cn);
|
||||
$User->Check();
|
||||
$User->check_dossier($gDossier);
|
||||
$User->can_request(IMPJRN,0);
|
||||
|
||||
// Security
|
||||
if ($User->check_action($cn,IMP) == 0 ||
|
||||
$User->AccessJrn($cn,$_GET['jrn_id']) == false){
|
||||
if ( $_GET['jrn_id']!=0 && $User->check_jrn($_GET['jrn_id']) == 'X' ){
|
||||
/* Cannot Access */
|
||||
NoAccess();
|
||||
}
|
||||
|
|
@ -180,131 +185,201 @@ if ( $Jrn->id==0 || $jrn_type=='FIN' || $jrn_type=='ODS' || $_REQUEST['p_simple
|
|||
//---------------------------------------------------------------------
|
||||
if ( ($jrn_type=='ACH' || $jrn_type=='VEN' ) && $_REQUEST['p_simple']== 1 )
|
||||
{
|
||||
/* simple printing with vat */
|
||||
if ( $own->MY_TVA_USE=='Y') {
|
||||
echo_debug ('jrn_pdf',__LINE__,'here');
|
||||
echo_debug('jrn_pdf',__LINE__,$Jrn);
|
||||
$pdf= new Cezpdf("A4",'landscape');
|
||||
// $pdf->selectFont('./addon/fonts/Helvetica.afm');
|
||||
$pdf->selectFont('./addon/fonts/Courier.afm');
|
||||
header_pdf($cn,$pdf);
|
||||
|
||||
echo_debug ('jrn_pdf',__LINE__,'here');
|
||||
echo_debug('jrn_pdf',__LINE__,$Jrn);
|
||||
$pdf= new Cezpdf("A4",'landscape');
|
||||
// $pdf->selectFont('./addon/fonts/Helvetica.afm');
|
||||
$pdf->selectFont('./addon/fonts/Courier.afm');
|
||||
header_pdf($cn,$pdf);
|
||||
|
||||
$offset=0;$limit=30;$step=30;
|
||||
$a_Tva=get_array($cn,"select tva_id,tva_label,tva_poste from tva_rate where tva_rate != 0.0000 order by tva_id");
|
||||
$col_tva="TVA ";
|
||||
$space=0;
|
||||
$total_HTVA=0.0;
|
||||
$total_TVAC=0.0;
|
||||
foreach($a_Tva as $line_tva)
|
||||
{
|
||||
//initialize Amount TVA
|
||||
$tmp1=$line_tva['tva_label'];
|
||||
$rap_tva[$tmp1]=0.0;
|
||||
if ( $space == 0 )
|
||||
$col_tva=str_repeat(" ",6).utf8_decode($line_tva['tva_label']);
|
||||
else {
|
||||
$ecart=$space-strlen($line_tva['tva_label']);
|
||||
$ecart=($ecart<0)?0:$ecart;
|
||||
$col_tva.=str_repeat(" ",$ecart).utf8_decode($line_tva['tva_label']);
|
||||
}
|
||||
$space=9;
|
||||
}
|
||||
|
||||
// if the period is centralized get the first amounts
|
||||
if ( $l_centr==1)
|
||||
list($total_TVAC,$total_HTVA)=get_rappel_simple($cn,$Jrn->id,$jrn_type,$_GET['from_periode'],$rap_tva);
|
||||
|
||||
|
||||
|
||||
while (1) {
|
||||
|
||||
$a=0;
|
||||
$a_jrn=$Jrn->get_rowSimple($_GET['from_periode'],
|
||||
$_GET['to_periode'],
|
||||
$_GET['central'],
|
||||
1,
|
||||
$limit,
|
||||
$offset);
|
||||
if ( $a_jrn == null ) break;
|
||||
|
||||
// page Header
|
||||
$t=sprintf("Rappel TVAC = %.2f HTVA= %.2f",$total_TVAC,$total_HTVA);
|
||||
foreach($rap_tva as $idx=>$am) {
|
||||
$t.=utf8_decode(sprintf('[ %s = % .2f]',$idx,$am));
|
||||
}
|
||||
$pdf->ezText($t,9,array('justification'=>'left'));
|
||||
|
||||
$offset+=$step;
|
||||
//total page
|
||||
$total_htva_page=0.0;$total_tvac_page=0.0;
|
||||
$offset=0;$limit=30;$step=30;
|
||||
$a_Tva=get_array($cn,"select tva_id,tva_label,tva_poste from tva_rate where tva_rate != 0.0000 order by tva_id");
|
||||
$col_tva="TVA ";
|
||||
$space=0;
|
||||
$total_HTVA=0.0;
|
||||
$total_TVAC=0.0;
|
||||
foreach($a_Tva as $line_tva)
|
||||
{
|
||||
//initialize Amount TVA
|
||||
$tmp1=$line_tva['tva_label'];
|
||||
$page_tva[$tmp1]=0.0;
|
||||
$rap_tva[$tmp1]=0.0;
|
||||
if ( $space == 0 )
|
||||
$col_tva=str_repeat(" ",6).utf8_decode($line_tva['tva_label']);
|
||||
else {
|
||||
$ecart=$space-strlen($line_tva['tva_label']);
|
||||
$ecart=($ecart<0)?0:$ecart;
|
||||
$col_tva.=str_repeat(" ",$ecart).utf8_decode($line_tva['tva_label']);
|
||||
}
|
||||
$space=9;
|
||||
}
|
||||
|
||||
// if the period is centralized get the first amounts
|
||||
if ( $l_centr==1)
|
||||
list($total_TVAC,$total_HTVA)=get_rappel_simple($cn,$Jrn->id,$jrn_type,$_GET['from_periode'],$rap_tva);
|
||||
|
||||
|
||||
|
||||
while (1) {
|
||||
|
||||
$a=0;
|
||||
$a_jrn=$Jrn->get_rowSimple($_GET['from_periode'],
|
||||
$_GET['to_periode'],
|
||||
$_GET['central'],
|
||||
1,
|
||||
$limit,
|
||||
$offset);
|
||||
if ( $a_jrn == null ) break;
|
||||
|
||||
// page Header
|
||||
$t=sprintf("Rappel TVAC = %.2f HTVA= %.2f",$total_TVAC,$total_HTVA);
|
||||
foreach($rap_tva as $idx=>$am) {
|
||||
$t.=utf8_decode(sprintf('[ %s = % .2f]',$idx,$am));
|
||||
}
|
||||
$str_tva="";
|
||||
$pdf->ezText($t,9,array('justification'=>'left'));
|
||||
|
||||
$offset+=$step;
|
||||
//total page
|
||||
$total_htva_page=0.0;$total_tvac_page=0.0;
|
||||
foreach($a_Tva as $line_tva)
|
||||
{
|
||||
//initialize Amount TVA
|
||||
$tmp1=$line_tva['tva_label'];
|
||||
$page_tva[$tmp1]=0.0;
|
||||
}
|
||||
$str_tva="";
|
||||
|
||||
|
||||
$pdf->ezTable($a_jrn,
|
||||
array('num'=>utf8_decode('Numéro'),
|
||||
'date'=>'Date',
|
||||
'client'=>'Client',
|
||||
'jr_internal'=>'Int.',
|
||||
'comment'=>'Description',
|
||||
'HTVA'=>'HTVA',
|
||||
'TVA_INLINE'=>$col_tva,
|
||||
'TVAC'=>'TVAC'),
|
||||
utf8_decode($Jrn->name),
|
||||
array('shaded'=>0,'showHeadings'=>1,'fontSize'=>8,'width'=>750,'Maxwidth'=>750),
|
||||
true
|
||||
$pdf->ezTable($a_jrn,
|
||||
array('num'=>utf8_decode('Numéro'),
|
||||
'date'=>'Date',
|
||||
'jr_internal'=>'Int.',
|
||||
'client'=>'Client',
|
||||
'comment'=>'Description',
|
||||
'HTVA'=>'HTVA',
|
||||
'TVA_INLINE'=>$col_tva,
|
||||
'TVAC'=>'TVAC'),
|
||||
utf8_decode($Jrn->name),
|
||||
array('shaded'=>0,'showHeadings'=>1,'fontSize'=>8,'width'=>750,'Maxwidth'=>750),
|
||||
true
|
||||
|
||||
|
||||
|
||||
);
|
||||
//--------------------------------------------------------------------------------
|
||||
// Foot
|
||||
// Set total foot page
|
||||
// amount VAT
|
||||
foreach ($a_jrn as $row)
|
||||
{
|
||||
$total_TVAC+=$row['TVAC'];
|
||||
$total_HTVA+=$row['HTVA'];
|
||||
$total_tvac_page+=$row['TVAC'];
|
||||
$total_htva_page+=$row['HTVA'];
|
||||
);
|
||||
//--------------------------------------------------------------------------------
|
||||
// Foot
|
||||
// Set total foot page
|
||||
// amount VAT
|
||||
foreach ($a_jrn as $row)
|
||||
{
|
||||
$total_TVAC+=$row['TVAC'];
|
||||
$total_HTVA+=$row['HTVA'];
|
||||
$total_tvac_page+=$row['TVAC'];
|
||||
$total_htva_page+=$row['HTVA'];
|
||||
|
||||
foreach ($row['TVA'] as $line)
|
||||
{
|
||||
$tva_id=$line[1][1];
|
||||
$rap_tva[$tva_id]+=$line[1][2];
|
||||
$page_tva[$tva_id]+=$line[1][2];
|
||||
}
|
||||
foreach ($row['TVA'] as $line)
|
||||
{
|
||||
$tva_id=$line[1][1];
|
||||
$rap_tva[$tva_id]+=$line[1][2];
|
||||
$page_tva[$tva_id]+=$line[1][2];
|
||||
}
|
||||
}
|
||||
//total page
|
||||
$t=sprintf("total page TVAC = %.2f HTVA= %.2f",$total_tvac_page,$total_htva_page);
|
||||
foreach($page_tva as $idx=>$am) {
|
||||
$t.=utf8_decode(sprintf('[ %s = % .2f ]',$idx,$am));
|
||||
}
|
||||
//total page
|
||||
$t=sprintf("total page TVAC = %.2f HTVA= %.2f",$total_tvac_page,$total_htva_page);
|
||||
foreach($page_tva as $idx=>$am) {
|
||||
$t.=utf8_decode(sprintf('[ %s = % .2f ]',$idx,$am));
|
||||
$pdf->ezText($t,9,array('justification'=>'left'));
|
||||
|
||||
$t=utf8_decode(sprintf("total à reporter TVAC = %.2f HTVA= %.2f",$total_TVAC,$total_HTVA));
|
||||
foreach($rap_tva as $idx=>$am) {
|
||||
$t.=utf8_decode(sprintf('[ %s = % .2f ]',$idx,$am));
|
||||
}
|
||||
$pdf->ezText($t,9,array('justification'=>'left'));
|
||||
|
||||
// New Page
|
||||
$pdf->ezNewPage();
|
||||
header_pdf($cn,$pdf);
|
||||
echo_debug('jrn_pdf',__LINE__,$a_jrn);
|
||||
}
|
||||
$pdf->ezText($t,9,array('justification'=>'left'));
|
||||
} else { /* we do not use any vat */
|
||||
|
||||
$t=utf8_decode(sprintf("total à reporter TVAC = %.2f HTVA= %.2f",$total_TVAC,$total_HTVA));
|
||||
foreach($rap_tva as $idx=>$am) {
|
||||
$t.=utf8_decode(sprintf('[ %s = % .2f ]',$idx,$am));
|
||||
$pdf= new Cezpdf("A4",'landscape');
|
||||
// $pdf->selectFont('./addon/fonts/Helvetica.afm');
|
||||
$pdf->selectFont('./addon/fonts/Courier.afm');
|
||||
header_pdf($cn,$pdf);
|
||||
|
||||
$offset=0;$limit=30;$step=30;
|
||||
$space=0;
|
||||
$total_HTVA=0.0;
|
||||
$total_TVAC=0.0;
|
||||
|
||||
if ( $l_centr==1)
|
||||
list($total_TVAC,$total_HTVA)=get_rappel_simple($cn,$Jrn->id,$jrn_type,$_GET['from_periode'],$rap_tva);
|
||||
|
||||
|
||||
while (1) {
|
||||
|
||||
$a=0;
|
||||
$a_jrn=$Jrn->get_rowSimple($_GET['from_periode'],
|
||||
$_GET['to_periode'],
|
||||
$_GET['central'],
|
||||
1,
|
||||
$limit,
|
||||
$offset);
|
||||
if ( $a_jrn == null ) break;
|
||||
// page Header
|
||||
$t=sprintf("Rappel Total = %.2f ",$total_TVAC);
|
||||
|
||||
$pdf->ezText($t,9,array('justification'=>'left'));
|
||||
|
||||
$offset+=$step;
|
||||
//total page
|
||||
$total_htva_page=0.0;$total_tvac_page=0.0;
|
||||
|
||||
|
||||
$pdf->ezTable($a_jrn,
|
||||
array('num'=>utf8_decode('Numéro'),
|
||||
'date'=>'Date',
|
||||
'client'=>'Client',
|
||||
'jr_internal'=>'Int.',
|
||||
'comment'=>'Description',
|
||||
'TVAC'=>'Total'),
|
||||
utf8_decode($Jrn->name),
|
||||
array('shaded'=>0,'showHeadings'=>1,'fontSize'=>8,'width'=>750,'Maxwidth'=>750),
|
||||
true
|
||||
|
||||
|
||||
|
||||
);
|
||||
//--------------------------------------------------------------------------------
|
||||
// Foot
|
||||
// Set total foot page
|
||||
// amount VAT
|
||||
foreach ($a_jrn as $row)
|
||||
{
|
||||
$total_TVAC+=$row['TVAC'];
|
||||
$total_tvac_page+=$row['TVAC'];
|
||||
|
||||
}
|
||||
//total page
|
||||
$t=sprintf("total page = %.2f ",$total_tvac_page);
|
||||
|
||||
$pdf->ezText($t,9,array('justification'=>'left'));
|
||||
|
||||
$t=utf8_decode(sprintf("total à reporter = %.2f ",$total_TVAC));
|
||||
|
||||
$pdf->ezText($t,9,array('justification'=>'left'));
|
||||
|
||||
// New Page
|
||||
$pdf->ezNewPage();
|
||||
header_pdf($cn,$pdf);
|
||||
echo_debug('jrn_pdf',__LINE__,$a_jrn);
|
||||
}
|
||||
$pdf->ezText($t,9,array('justification'=>'left'));
|
||||
|
||||
// New Page
|
||||
$pdf->ezNewPage();
|
||||
header_pdf($cn,$pdf);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
echo_debug('jrn_pdf',__LINE__,$a_jrn);
|
||||
}
|
||||
echo_debug('jrn_pdf',__LINE__,'Envoie PDF');
|
||||
} /* else */
|
||||
|
||||
$pdf->ezStream();
|
||||
exit(0);
|
||||
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ function clean_Fid(p_ctl)
|
|||
if ( $(nSell) ) { $(nSell).value=""; }
|
||||
if ( $(nBuy) ) { $(nBuy).value="";}
|
||||
if ( $(nTva_id) ) { $(nTva_id).value="-1"; }
|
||||
if ( $("first_sold")) { $("first_sold").value=""; }
|
||||
|
||||
}
|
||||
function errorFid(request,json) {
|
||||
|
|
@ -54,8 +55,10 @@ function errorFid(request,json) {
|
|||
* \param p_deb if debit of credit
|
||||
* \param p_jrn the ledger
|
||||
* \param phpsessid
|
||||
*\param p_caller id of the caller
|
||||
*\param p_extra extra parameter, change depends of the caller
|
||||
*/
|
||||
function ajaxFid(p_ctl,p_deb,phpsessid)
|
||||
function ajaxFid(p_ctl,p_deb,phpsessid,p_caller,p_extra)
|
||||
{
|
||||
var gDossier=$('gDossier').value;
|
||||
var ctl_value=trim($(p_ctl).value);
|
||||
|
|
@ -63,7 +66,7 @@ function ajaxFid(p_ctl,p_deb,phpsessid)
|
|||
var p_jrn=$('p_jrn').value;
|
||||
if ( trim(ctl_value)==0 ) {
|
||||
nLabel=p_ctl+"_label";
|
||||
$(nLabel).value="";
|
||||
if ($(nLabel) ){$(nLabel).value="";}
|
||||
$(nLabel).innerHTML=" ";
|
||||
clean_Fid(p_ctl);
|
||||
return;
|
||||
|
|
@ -71,6 +74,7 @@ function ajaxFid(p_ctl,p_deb,phpsessid)
|
|||
queryString="?FID="+ctl_value;
|
||||
queryString=queryString+"&d="+p_deb+"&j="+p_jrn+'&gDossier='+gDossier;
|
||||
queryString=queryString+'&ctl='+p_ctl+'&PHPSESSID='+phpsessid;
|
||||
queryString=queryString+'&caller='+p_caller+'&extra='+p_extra;
|
||||
/* alert(queryString); */
|
||||
var action=new Ajax.Request (
|
||||
"fid.php",
|
||||
|
|
@ -95,12 +99,20 @@ function successFid(request,json) {
|
|||
var buy=answer.buy;
|
||||
var tva_id=answer.tva_id;
|
||||
var ctl=answer.ctl;
|
||||
var extra=answer.extra;
|
||||
var caller=answer.caller;
|
||||
if ( caller == 'searchcardControl') {
|
||||
if ( trim (data)== "") { $(ctl).style.color="red";}
|
||||
else { $(ctl).style.color="black"; $(extra).value=data;}
|
||||
}
|
||||
var toSet=ctl+'_label';
|
||||
if (trim(data) == "" ) {
|
||||
$(toSet).innerHTML="Fiche Inconnue";
|
||||
$(toSet).style.color="red";
|
||||
clean_Fid(ctl);
|
||||
$(ctl).style.color="red";
|
||||
} else {
|
||||
$(ctl).style.color="black";
|
||||
var nSell=ctl+"_price";
|
||||
var nBuy=ctl+"_price";
|
||||
var nTva_id=ctl+"_tva_id";
|
||||
|
|
@ -109,11 +121,48 @@ function successFid(request,json) {
|
|||
if ( $(nTva_id) ) {
|
||||
$(nTva_id).value=tva_id;
|
||||
}
|
||||
if ( $(nSell ) ) {
|
||||
if ( $(nSell ) && trim(sell)!="" ) {
|
||||
$(nSell).value=sell;
|
||||
}
|
||||
if ( $(nBuy) ) $(nBuy).value=buy;
|
||||
if ( $(nBuy) && trim(buy)!="") { $(nBuy).value=buy; }
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
function ajax_error_saldo(request,json) {
|
||||
alert('erreur : ajax fiche');
|
||||
}
|
||||
/*!\brief this function get the saldo
|
||||
* \param p_ctl the ctrl where we take the quick_code
|
||||
* \param phpsessid
|
||||
*/
|
||||
function ajax_saldo(phpsessid,p_ctl)
|
||||
{
|
||||
var gDossier=$('gDossier').value;
|
||||
var ctl_value=trim($(p_ctl).value);
|
||||
var jrn=$('p_jrn').value;
|
||||
queryString="?FID="+ctl_value;
|
||||
queryString=queryString+'&gDossier='+gDossier+'&j='+jrn;
|
||||
queryString=queryString+'&ctl='+ctl_value+'&PHPSESSID='+phpsessid;
|
||||
/* alert(queryString); */
|
||||
var action=new Ajax.Request (
|
||||
"get_saldo.php",
|
||||
{
|
||||
method:'get',
|
||||
parameters:queryString,
|
||||
onFailure:ajax_error_saldo,
|
||||
onSuccess:ajax_success_saldo
|
||||
}
|
||||
|
||||
);
|
||||
|
||||
}
|
||||
/*!\brief callback function for ajax
|
||||
* \param request : object request
|
||||
* \param json : json answer */
|
||||
function ajax_success_saldo(request,json) {
|
||||
var answer=request.responseText.evalJSON(true);
|
||||
$('first_sold').value=answer.saldo;
|
||||
|
||||
}
|
||||
//-->
|
||||
|
|
|
|||
|
|
@ -415,7 +415,9 @@ function compute_sold(p_ctl_nb) {
|
|||
refresh_sold();
|
||||
return;
|
||||
}
|
||||
var tva_id=$('e_march'+p_ctl_nb+'_tva_id').value;
|
||||
var tva_id=-1;
|
||||
if ($('e_march'+p_ctl_nb+'_tva_id')) tva_id=$('e_march'+p_ctl_nb+'_tva_id').value;
|
||||
|
||||
$('e_march'+p_ctl_nb+'_price').value=trim($('e_march'+p_ctl_nb+'_price').value);
|
||||
|
||||
var price=$('e_march'+p_ctl_nb+'_price').value;
|
||||
|
|
@ -438,32 +440,31 @@ function refresh_sold () {
|
|||
var tva=0; var htva=0;var tvac=0;
|
||||
|
||||
for (var i=0;i<$("nb_item").value;i++) {
|
||||
tva+=$('tva_march'+i).value*1;
|
||||
htva+=$('htva_march'+i).value*1;
|
||||
tvac+=$('tvac_march'+i).value*1;
|
||||
$('tva_march'+i+'_show').value=$('tva_march'+i).value;
|
||||
if ( $('tva_march'+i) ) tva+=$('tva_march'+i).value*1;
|
||||
if ($('htva_march'+i)) htva+=$('htva_march'+i).value*1;
|
||||
if ($('tvac_march'+i)) tvac+=$('tvac_march'+i).value*1;
|
||||
if ($('tva_march'+i+'_show')) $('tva_march'+i+'_show').value=$('tva_march'+i).value;
|
||||
|
||||
}
|
||||
|
||||
$('tva').innerHTML=Math.round(tva*100)/100;
|
||||
$('htva').innerHTML=Math.round(htva*100)/100;
|
||||
$('tvac').innerHTML=Math.round(tvac*100)/100;
|
||||
if ( $('tva')) $('tva').innerHTML=Math.round(tva*100)/100;
|
||||
if ( $('htva')) $('htva').innerHTML=Math.round(htva*100)/100;
|
||||
if ($('tvac')) $('tvac').innerHTML=Math.round(tvac*100)/100;
|
||||
}
|
||||
/**
|
||||
* @brief update the field htva, tva_id and tvac, callback function for compute_sold
|
||||
*/
|
||||
function success_compute_sold(request,json) {
|
||||
|
||||
var answer=request.responseText.evalJSON(true);
|
||||
var rtva=answer.tva*1;
|
||||
var rhtva=answer.htva*1;
|
||||
var rtvac=answer.tvac*1;
|
||||
var ctl=answer.ctl;
|
||||
$('sum').show();
|
||||
$('tva_march'+ctl).value=rtva;
|
||||
$('htva_march'+ctl).value=rhtva;
|
||||
$('tvac_march'+ctl).value=rtvac;
|
||||
refresh_sold();
|
||||
var answer=request.responseText.evalJSON(true);
|
||||
var rtva=answer.tva*1;
|
||||
var rhtva=answer.htva*1;
|
||||
var rtvac=answer.tvac*1;
|
||||
var ctl=answer.ctl;
|
||||
$('sum').show();
|
||||
if($('tva_march'+ctl)) $('tva_march'+ctl).value=rtva;
|
||||
if($('htva_march'+ctl)) $('htva_march'+ctl).value=rhtva;
|
||||
if ($('tvac_march'+ctl)) $('tvac_march'+ctl).value=rtvac;
|
||||
refresh_sold();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -515,6 +516,43 @@ function error_get_predef(request,json) {
|
|||
alert ("Erreur mise à jour champs non possible");
|
||||
|
||||
}
|
||||
/**
|
||||
* @brief update the list of available predefined operation when we change the ledger.
|
||||
*/
|
||||
function update_pj() {
|
||||
var jrn=$("p_jrn").value;
|
||||
var phpsessid=$("phpsessid").value;
|
||||
var dossier=$("gDossier").value;
|
||||
var querystring='?PHPSESSID='+phpsessid+'&gDossier='+dossier+'&l='+jrn;
|
||||
var action=new Ajax.Request(
|
||||
"get_pj.php",
|
||||
{
|
||||
method:'get',
|
||||
parameters:querystring,
|
||||
onFailure:error_get_pj,
|
||||
onSuccess:success_get_pj
|
||||
}
|
||||
);
|
||||
}
|
||||
/**
|
||||
* @brief update the field predef
|
||||
*/
|
||||
function success_get_pj(request,json) {
|
||||
|
||||
var answer=request.responseText.evalJSON(true);
|
||||
obj=$("e_pj");
|
||||
obj.value='';
|
||||
if ( answer.count == 0 ) return;
|
||||
obj.value=answer.pj;
|
||||
$("e_pj_suggest").value=answer.pj;
|
||||
}
|
||||
/**
|
||||
* @brief update the field predef
|
||||
*/
|
||||
function error_get_pj(request,json) {
|
||||
alert("Ajax a echoue");
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief add a line in the form for the ledger fin
|
||||
*/
|
||||
|
|
@ -545,24 +583,24 @@ function ledger_fin_add_row(){
|
|||
* @brief add a line in the form for the purchase ledger
|
||||
*/
|
||||
function ledger_purchase_add_row(){
|
||||
style='class="input_text"';
|
||||
var mytable=$("sold_item").tBodies[0];
|
||||
var line=mytable.rows.length;
|
||||
var row=mytable.insertRow(line);
|
||||
var phpsessid=$("phpsessid");
|
||||
var nb=$("nb_item");
|
||||
var newNode = mytable.rows[1].cloneNode(true);
|
||||
var tt=newNode.innerHTML;
|
||||
mytable.appendChild(newNode);
|
||||
new_tt=tt.replace(/march0/g,"march"+nb.value);
|
||||
new_tt=new_tt.replace(/quant0/g,"quant"+nb.value);
|
||||
new_tt=new_tt.replace(/sold\(0\)/g,"sold("+nb.value+")");
|
||||
newNode.innerHTML=new_tt;
|
||||
$("e_march"+nb.value+"_label").innerHTML=' ';
|
||||
$("e_march"+nb.value+"_price").value='0';
|
||||
$("e_march"+nb.value).value="";
|
||||
$("e_quant"+nb.value).value="1";
|
||||
nb.value++;
|
||||
style='class="input_text"';
|
||||
var mytable=$("sold_item").tBodies[0];
|
||||
var line=mytable.rows.length;
|
||||
var row=mytable.insertRow(line);
|
||||
var phpsessid=$("phpsessid");
|
||||
var nb=$("nb_item");
|
||||
var newNode = mytable.rows[1].cloneNode(true);
|
||||
var tt=newNode.innerHTML;
|
||||
mytable.appendChild(newNode);
|
||||
new_tt=tt.replace(/march0/g,"march"+nb.value);
|
||||
new_tt=new_tt.replace(/quant0/g,"quant"+nb.value);
|
||||
new_tt=new_tt.replace(/sold\(0\)/g,"sold("+nb.value+")");
|
||||
newNode.innerHTML=new_tt;
|
||||
$("e_march"+nb.value+"_label").innerHTML=' ';
|
||||
$("e_march"+nb.value+"_price").value='0';
|
||||
$("e_march"+nb.value).value="";
|
||||
$("e_quant"+nb.value).value="1";
|
||||
nb.value++;
|
||||
|
||||
}
|
||||
/**
|
||||
|
|
@ -573,15 +611,19 @@ function ledger_purchase_add_row(){
|
|||
function compute_purchase(p_ctl_nb) {
|
||||
var phpsessid=$("phpsessid").value;
|
||||
var dossier=$("gDossier").value;
|
||||
var a=trim($("e_march"+p_ctl_nb+'_tva_amount').value);
|
||||
$("e_march"+p_ctl_nb+'_tva_amount').value=a;
|
||||
|
||||
var a=-1;
|
||||
if ( document.getElementById("e_march"+p_ctl_nb+'_tva_amount')) {
|
||||
a=trim($("e_march"+p_ctl_nb+'_tva_amount').value);
|
||||
$("e_march"+p_ctl_nb+'_tva_amount').value=a;
|
||||
}
|
||||
$("e_march"+p_ctl_nb).value=trim($("e_march"+p_ctl_nb).value);
|
||||
var qcode=$("e_march"+p_ctl_nb).value;
|
||||
|
||||
if ( qcode.length == 0 ) { clean_purchase(p_ctl_nb);refresh_purchase();return;}
|
||||
|
||||
var tva_id=$('e_march'+p_ctl_nb+'_tva_id').value;
|
||||
var tva_id=-1;
|
||||
if ( $('e_march'+p_ctl_nb+'_tva_id') ) {
|
||||
tva_id=$('e_march'+p_ctl_nb+'_tva_id').value;
|
||||
}
|
||||
|
||||
$('e_march'+p_ctl_nb+'_price').value=trim($('e_march'+p_ctl_nb+'_price').value);
|
||||
var price=$('e_march'+p_ctl_nb+'_price').value;
|
||||
|
|
@ -604,36 +646,52 @@ function refresh_purchase() {
|
|||
var tva=0; var htva=0;var tvac=0;
|
||||
|
||||
for (var i=0;i<$("nb_item").value;i++) {
|
||||
tva+=$('tva_march'+i).value*1;
|
||||
if( $('tva_march'+i)) tva+=$('tva_march'+i).value*1;
|
||||
htva+=$('htva_march'+i).value*1;
|
||||
tvac+=$('tvac_march'+i).value*1;
|
||||
}
|
||||
|
||||
$('tva').innerHTML=Math.round(tva*100)/100;
|
||||
if ( $('tva') ) $('tva').innerHTML=Math.round(tva*100)/100;
|
||||
$('htva').innerHTML=Math.round(htva*100)/100;
|
||||
$('tvac').innerHTML=Math.round(tvac*100)/100;
|
||||
if ($('tvac')) $('tvac').innerHTML=Math.round(tvac*100)/100;
|
||||
}
|
||||
/**
|
||||
* @brief update the field htva, tva_id and tvac, callback function for compute_sold
|
||||
* it the field TVA in the answer contains NA it means that VAT is appliable and then do not
|
||||
* update the VAT field except htva_martc
|
||||
*/
|
||||
function success_compute_purchase(request,json) {
|
||||
|
||||
var answer=request.responseText.evalJSON(true);
|
||||
var rtva=answer.tva*1;
|
||||
var ctl=answer.ctl;
|
||||
var rtva=answer.tva;
|
||||
var rhtva=answer.htva*1;
|
||||
var rtvac=answer.tvac*1;
|
||||
var ctl=answer.ctl;
|
||||
$('sum').show();
|
||||
|
||||
if ( $('e_march'+ctl+'_tva_amount').value=="" || $('e_march'+ctl+'_tva_amount').value==0 ){
|
||||
$('tva_march'+ctl).value=rtva;
|
||||
$('e_march'+ctl+'_tva_amount').value=rtva;
|
||||
}
|
||||
else {
|
||||
$('tva_march'+ctl).value=$('e_march'+ctl+'_tva_amount').value;
|
||||
}
|
||||
$('htva_march'+ctl).value=rhtva;
|
||||
$('tvac_march'+ctl).value=parseFloat($('htva_march'+ctl).value)+parseFloat($('tva_march'+ctl).value);
|
||||
if ( rtva == 'NA' ) {
|
||||
var rhtva=answer.htva*1;
|
||||
$('htva_march'+ctl).value=rhtva;
|
||||
$('tvac_march'+ctl).value=rtvac;
|
||||
$('sum').show();
|
||||
refresh_purchase();
|
||||
|
||||
return;
|
||||
}
|
||||
rtva=answer.tva*1;
|
||||
|
||||
|
||||
|
||||
$('sum').show();
|
||||
if ( $('e_march'+ctl+'_tva_amount').value=="" || $('e_march'+ctl+'_tva_amount').value==0 ){
|
||||
$('tva_march'+ctl).value=rtva;
|
||||
$('e_march'+ctl+'_tva_amount').value=rtva;
|
||||
}
|
||||
else {
|
||||
$('tva_march'+ctl).value=$('e_march'+ctl+'_tva_amount').value;
|
||||
}
|
||||
$('htva_march'+ctl).value=rhtva;
|
||||
$('tvac_march'+ctl).value=parseFloat($('htva_march'+ctl).value)+parseFloat($('tva_march'+ctl).value);
|
||||
|
||||
refresh_purchase();
|
||||
}
|
||||
|
||||
|
|
@ -651,20 +709,20 @@ function compute_all_purchase() {
|
|||
var tva=0; var htva=0;var tvac=0;
|
||||
|
||||
for (var i=0;i<$("nb_item").value;i++) {
|
||||
tva+=$('tva_march'+i).value*1;
|
||||
if ( $('tva_march') ) tva+=$('tva_march'+i).value*1;
|
||||
htva+=$('htva_march'+i).value*1;
|
||||
tvac+=$('tvac_march'+i).value*1;
|
||||
}
|
||||
|
||||
$('tva').innerHTML=Math.round(tva*100)/100;
|
||||
if ( $('tva') ) $('tva').innerHTML=Math.round(tva*100)/100;
|
||||
$('htva').innerHTML=Math.round(htva*100)/100;
|
||||
$('tvac').innerHTML=Math.round(tvac*100)/100;
|
||||
if ($('tvac'))$('tvac').innerHTML=Math.round(tvac*100)/100;
|
||||
|
||||
|
||||
}
|
||||
|
||||
function clean_tva(p_ctl) {
|
||||
$('e_march'+p_ctl+'_tva_amount').value=0;
|
||||
if ( $('e_march'+p_ctl+'_tva_amount') )$('e_march'+p_ctl+'_tva_amount').value=0;
|
||||
}
|
||||
|
||||
function clean_sold( p_ctl_nb)
|
||||
|
|
@ -682,10 +740,10 @@ function clean_purchase(p_ctl_nb) {
|
|||
var qcode=$("e_march"+p_ctl_nb).value;
|
||||
$('e_march'+p_ctl_nb+'_price').value='';
|
||||
$('e_quant'+p_ctl_nb).value='1';
|
||||
$('e_march'+p_ctl_nb+'_tva_amount').value='0';
|
||||
$('tva_march'+p_ctl_nb).value=0;
|
||||
$('htva_march'+p_ctl_nb).value=0;
|
||||
$('tvac_march'+p_ctl_nb).value=0;
|
||||
if ( $('e_march'+p_ctl_nb+'_tva_amount') )$('e_march'+p_ctl_nb+'_tva_amount').value='0';
|
||||
if ( $('tva_march'+p_ctl_nb)) $('tva_march'+p_ctl_nb).value=0;
|
||||
if ($('htva_march'+p_ctl_nb)) $('htva_march'+p_ctl_nb).value=0;
|
||||
if( $('tvac_march'+p_ctl_nb)) $('tvac_march'+p_ctl_nb).value=0;
|
||||
}
|
||||
/**
|
||||
* @brief add a line in the form for the quick_writing
|
||||
|
|
@ -715,9 +773,14 @@ function quick_writing_add_row(){
|
|||
$("amount"+nb.value).value='';
|
||||
$("poste"+nb.value).value='';
|
||||
$("ld"+nb.value).value='';
|
||||
$('qc_'+nb.value+'_label').innerHTML='';
|
||||
$('poste'+nb.value+'_label').innerHTML='';
|
||||
|
||||
|
||||
nb.value++;
|
||||
|
||||
}
|
||||
function my_clear(p_ctrl) {
|
||||
if ( document.getElementById(p_ctrl)){
|
||||
document.getElementById(p_ctrl).value="";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -21,32 +21,51 @@
|
|||
|
||||
/*! \file
|
||||
* \brief
|
||||
* open a windows for searching a card
|
||||
*
|
||||
*/
|
||||
/*!\brief open a windows for showing a card
|
||||
* \param p_sessid must be given
|
||||
* \param the qcode
|
||||
*\todo is obsolete ??
|
||||
*/
|
||||
|
||||
function showfiche(p_sessid,p_qcode)
|
||||
{
|
||||
p_dossier=document.getElementById("gDossier").value;
|
||||
var a=window.open('show_fiche.php?PHPSESSID='+p_sessid+'&gDossier='+p_dossier+'&q='+p_qcode,'','toolbar=no,width=350,height=450,scrollbar=yes,statusbar=no');
|
||||
a.focus();
|
||||
}
|
||||
|
||||
/* type must be cred or deb and name is
|
||||
* the control's name
|
||||
/*!\brief Open a window for searching a card
|
||||
*
|
||||
* Remark The ledger (jrn_id) must be in the calling form as a hidden field named p_jrn
|
||||
*\param p_sessid is the PHPSESSID
|
||||
*\param type must be deb or cred
|
||||
*\param name is the name of the control, it is used for computing the name of the VAT, Price field
|
||||
* \see SetData()
|
||||
*/
|
||||
function SearchCard(p_sessid,type,name)
|
||||
{
|
||||
|
||||
var search=document.getElementById(name).value;
|
||||
var gDossier=document.getElementById('gDossier').value;
|
||||
var jrn=0;
|
||||
if ( document.getElementById("p_jrn") ) {
|
||||
jrn=document.getElementById("p_jrn").value;
|
||||
}
|
||||
var a=window.open('fiche_search.php?first&search&fic_search='+search+'&p_jrn='+jrn+'&PHPSESSID='+p_sessid+'&type='+type+'&name='+name+'&gDossier='+gDossier,'item','toolbar=no,width=350,height=450,scrollbars=yes,statusbar=no');
|
||||
var file='fiche_search.php';
|
||||
var
|
||||
query='?first&search&fic_search='+search+'&p_jrn='+jrn+'&PHPSESSID='+p_sessid
|
||||
+'&type='+type+'&name='+name+'&gDossier='+gDossier;
|
||||
query+="&caller=searchcard";
|
||||
var a=window.open(file+query,'item','toolbar=no,width=350,height=450,scrollbars=yes,statusbar=no');
|
||||
a.focus();
|
||||
return false;
|
||||
}
|
||||
/*!\brief Open a window for adding a card
|
||||
*
|
||||
* Remark The ledger (jrn_id) must be in the calling form as a hidden field named p_jrn
|
||||
*\param p_sessid is the PHPSESSID
|
||||
*\param type must be deb or cred
|
||||
*\param name is the name of the control, it is used for computing the name of the VAT, Price field
|
||||
*/
|
||||
function NewCard(p_sessid,type,name)
|
||||
{
|
||||
var search=document.getElementById(name).value;
|
||||
|
|
@ -56,9 +75,9 @@ function NewCard(p_sessid,type,name)
|
|||
return false;
|
||||
|
||||
}
|
||||
/* SetValue( p_ctl,p_value )
|
||||
/* p_ctl is the name of the control
|
||||
/* p_value is the value to set in
|
||||
/*!brief set the value of a ctrl
|
||||
*\param p_ctl control to change
|
||||
*\param p_value value to set (only)
|
||||
*/
|
||||
function SetValue(p_ctl,p_value)
|
||||
{
|
||||
|
|
@ -70,14 +89,17 @@ function SetValue(p_ctl,p_value)
|
|||
|
||||
|
||||
}
|
||||
/* Parameters
|
||||
* i = ctl _name
|
||||
* p_id = code id (fiche.f_id)
|
||||
*¨p_label = label
|
||||
* p_price vw_fiche_attr.vw_price
|
||||
* p_price vw_fiche_attr.vw_price
|
||||
* p_tva_id vw_fiche_attr.tva_id
|
||||
* p_tva_label vw_fiche_attr.tva_label
|
||||
/*!\brief Set the data from the child window to the parent one
|
||||
*
|
||||
* Set the data found during the search (tva_id, price, tva_label) to the form, the name are based on i.
|
||||
* The url contains the caller (searchcard).This function is called if the caller is searchcard
|
||||
* \param i ctl _name
|
||||
* \param p_id code id (quickcode
|
||||
* \param p_label = label
|
||||
* \param p_price vw_fiche_attr.vw_price
|
||||
* \param p_price vw_fiche_attr.vw_price
|
||||
* \param p_tva_id vw_fiche_attr.tva_id
|
||||
* \param p_tva_label vw_fiche_attr.tva_label
|
||||
*/
|
||||
function SetData(i,p_id,p_label,p_price,p_price,p_tva_id, p_tva_label)
|
||||
{
|
||||
|
|
@ -121,5 +143,44 @@ function SetValue(p_ctl,p_value)
|
|||
document.getElementById(a).innerHTML=p_tva_label;
|
||||
}
|
||||
}
|
||||
/*!\brief Set the value of 2 input fields
|
||||
*
|
||||
* Set the quick code in the first ctrl and the label of the quickcode in the second one. This function is a variant of SetData for
|
||||
* some specific need. This function is called if the caller is searchcardCtrl
|
||||
*
|
||||
*\param p_ctrl the input with the name of the quick code
|
||||
*\param p_quickcode the found quick_code
|
||||
*\param p_ctrlname the name of the input field with the label
|
||||
*\param p_label the label of the quickcode
|
||||
*/
|
||||
function setCtrl(p_ctrl,p_quickcode,p_ctrlname,p_label){
|
||||
var ctrl=document.getElementById(p_ctrl);
|
||||
if ( ctrl ) { ctrl.value=p_quickcode; }
|
||||
var ctrl_name=document.getElementById(p_ctrlname);
|
||||
if ( ctrl_name ) { ctrl_name.value=p_label; }
|
||||
}
|
||||
|
||||
|
||||
/*!\brief Open a window for searching a card
|
||||
*
|
||||
* Remark The ledger (jrn_id) must be in the calling form as a hidden field named p_jrn, this function is derived from searchCard because
|
||||
* the returns value are also handled differently (so a paramter caller is added to the url
|
||||
*\param p_sessid is the PHPSESSID
|
||||
*\param name is the name of the control, it is used for computing the name of the VAT, Price field
|
||||
* \see SetData()
|
||||
*/
|
||||
function searchCardCtrl(p_sessid,type,name,ctrl)
|
||||
{
|
||||
var search=document.getElementById(name).value;
|
||||
var gDossier=document.getElementById('gDossier').value;
|
||||
var jrn=0;
|
||||
if ( document.getElementById("p_jrn") ) {
|
||||
jrn=document.getElementById("p_jrn").value;
|
||||
}
|
||||
var file='fiche_search.php';
|
||||
var query='?first&search&fic_search='+search+'&p_jrn='+jrn+'&PHPSESSID='+p_sessid+'&type='+type+'&name='+name+'&gDossier='+gDossier;
|
||||
query+="&extra="+ctrl;
|
||||
query+="&caller=searchcardCtrl";
|
||||
var a=window.open(file+query,'item','toolbar=no,width=350,height=450,scrollbars=yes,statusbar=no');
|
||||
a.focus();
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,17 +30,23 @@
|
|||
*\param p_jrn the concerned ledger id
|
||||
*\param p_return update with the pcm_val or pcm_lib (value=label or poste)
|
||||
*\param p_search take the value of the ctl and make a search
|
||||
*\param p_ctrl the control (input) to update (default value = none )
|
||||
*\note the script will to see if it founds a hidden value in the document.form
|
||||
* to know if the return must update or replace
|
||||
*\see poste_search.php
|
||||
*/
|
||||
function SearchPoste(p_sessid,p_dossier,p_ctl,p_jrn,p_return,p_search)
|
||||
function SearchPoste(p_sessid,p_dossier,p_ctl,p_jrn,p_return,p_search,p_ctrl)
|
||||
{
|
||||
var comment="";
|
||||
if ( document.getElementById(p_ctl) && p_search=='Y') {
|
||||
comment=document.getElementById(p_ctl).value;
|
||||
}
|
||||
|
||||
|
||||
var win=window.open('poste_search.php?gDossier='+p_dossier+'&p_jrn='+p_jrn+'&p_ctl='+p_ctl+'&PHPSESSID='+p_sessid+"&p_comment="+comment+"&search"+"&ret="+p_return,'Cherche','toolbar=no,width=600,height=600,scrollbars=yes,resizable=yes');
|
||||
var
|
||||
win=window.open('poste_search.php?gDossier='+p_dossier+'&p_jrn='+p_jrn+'&p_ctl='
|
||||
+p_ctl+'&PHPSESSID='+p_sessid+"&p_comment="+comment+"&search"+"&ret="+p_return+
|
||||
'&ctrl='+p_ctrl,
|
||||
'Cherche','toolbar=no,width=600,height=600,scrollbars=yes,resizable=yes');
|
||||
}
|
||||
/*!\brief open a window for searching a account
|
||||
*\param p_sessid PHPSESSID
|
||||
|
|
@ -49,32 +55,34 @@ function SearchPoste(p_sessid,p_dossier,p_ctl,p_jrn,p_return,p_search)
|
|||
*\param p_jrn the concerned ledger id
|
||||
*\param p_return update with the pcm_val or pcm_lib (value=label or poste)
|
||||
*\param p_search take the value of the ctl and make a search
|
||||
*\param p_ctrl the control to update (default value = none )
|
||||
*\see poste_search.php
|
||||
*/
|
||||
|
||||
function SearchPosteFilter(p_sessid,p_dossier,p_ctl,p_filter,jrn)
|
||||
function SearchPosteFilter(p_sessid,p_dossier,p_ctl,p_filter,jrn,p_ctrl)
|
||||
{
|
||||
var comment="";
|
||||
if ( document.getElementById(p_ctl) ) {
|
||||
comment=document.getElementById(p_ctl).value;
|
||||
}
|
||||
|
||||
var win=window.open('poste_search.php?gDossier='+p_dossier+'&p_jrn='+jrn+'&p_ctl='+p_ctl+'&PHPSESSID='+p_sessid+'&filter='+p_filter+'&p_comment='+comment+"&search&ret=label",'Cherche','toolbar=no,width=600,height=600,scrollbars=yes,resizable=yes');
|
||||
var win=window.open('poste_search.php?gDossier='+p_dossier+'&p_jrn='+jrn+'&p_ctl='+p_ctl+'&PHPSESSID='+p_sessid+'&filter='+p_filter+'&p_comment='+comment+"&search&ret=label"+'&ctrl='+p_ctrl,'Cherche','toolbar=no,width=600,height=600,scrollbars=yes,resizable=yes');
|
||||
}
|
||||
function GetIt() {
|
||||
window.close();
|
||||
}
|
||||
function SetItChild(p_ctl,p_value,p_label) {
|
||||
function SetItChild(p_ctl,p_value,p_label,p_ctrl) {
|
||||
|
||||
self.opener.SetItParent(p_ctl,p_value,p_label);
|
||||
self.opener.SetItParent(p_ctl,p_value,p_label,p_ctrl);
|
||||
window.close();
|
||||
}
|
||||
function SetItParent(p_ctl,p_value,p_label) {
|
||||
function SetItParent(p_ctl,p_value,p_label,p_ctrl) {
|
||||
|
||||
var f=document.getElementById(p_ctl);
|
||||
f.value=p_value;
|
||||
var f1=document.getElementById(p_ctl+"_label");
|
||||
if ( f1) f1.innerHTML=p_label;
|
||||
if ( document.getElementById(p_ctrl)) document.getElementById(p_ctrl).value=p_label;
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -90,7 +98,18 @@ function set_poste_parent(p_ctl,p_value) {
|
|||
|
||||
}
|
||||
|
||||
function set_jrn_child(p_ctl,p_value) {
|
||||
|
||||
self.opener.set_jrn_parent(p_ctl,p_value);
|
||||
window.close();
|
||||
}
|
||||
function set_jrn_parent(p_ctl,p_value) {
|
||||
var f=document.getElementById(p_ctl);
|
||||
if ( f ) {
|
||||
if ( trim(f.value)!="") f.value+=' ';
|
||||
f.value+=p_value;
|
||||
}
|
||||
}
|
||||
/* SetValue( p_ctl,p_value )
|
||||
/* p_ctl is the name of the control
|
||||
/* p_value is the value to set in
|
||||
|
|
@ -105,3 +124,7 @@ function SetValue(p_ctl,p_value)
|
|||
|
||||
|
||||
}
|
||||
|
||||
function clear(p_ctrl) {
|
||||
if ( document.getElementById(p_ctrl)) document.getElementById(p_ctrl)='';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ $User=new User($rep);
|
|||
$User->Check();
|
||||
html_page_start($User->theme,"onLoad='window.focus();'");
|
||||
$cn=DbConnect($gDossier);
|
||||
$User->can_request($cn,MPCMN);
|
||||
$User->can_request(PARPCMN);
|
||||
|
||||
|
||||
include ("user_menu.php");
|
||||
|
|
@ -111,7 +111,7 @@ echo $acc->form(true);
|
|||
<TR>
|
||||
<TD><INPUT TYPE="Submit" VALUE="Sauve">
|
||||
<INPUT TYPE="HIDDEN" name="update">
|
||||
<?php printf ('<INPUT TYPE="HIDDEN" name="p_old" value="%s">',$acc->get_parameter('value')); ?>
|
||||
<?php printf ('<INPUT TYPE="HIDDEN" name="p_old" value="%s">',h($acc->get_parameter('value'))); ?>
|
||||
</TD><TD><input type="button" Value="Retour sans sauver" onClick='window.close();'></TD></TR>
|
||||
</TABLE>
|
||||
</FORM>
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ if ( isset ($_POST["p_user"] ) ) {
|
|||
$rep=DbConnect();
|
||||
include_once ("class_user.php");
|
||||
$User=new User($rep);
|
||||
$User->Check();
|
||||
$User->Check();
|
||||
|
||||
echo "<META HTTP-EQUIV=\"REFRESH\" content=\"0;url=user_login.php?PHPSESSID=" . $_REQUEST["PHPSESSID"] . "\">";
|
||||
|
||||
|
|
|
|||
|
|
@ -33,19 +33,28 @@ include_once ("postgres.php");
|
|||
include_once("jrn.php");
|
||||
include_once("class_widget.php");
|
||||
require_once ("constant.php");
|
||||
require_once('class_acc_reconciliation.php');
|
||||
require_once('class_acc_operation.php');
|
||||
|
||||
/* Admin. Dossier */
|
||||
$rep=DbConnect();
|
||||
$gDossier=dossier::id();
|
||||
$cn=DbConnect($gDossier);
|
||||
|
||||
include_once ("class_user.php");
|
||||
$User=new User($rep);
|
||||
$User=new User($cn);
|
||||
$User->Check();
|
||||
$User->check_dossier(dossier::id());
|
||||
|
||||
html_page_start($User->theme,"onLoad='window.focus();'");
|
||||
require_once('class_dossier.php');
|
||||
$gDossier=dossier::id();
|
||||
// $p_jrn=(isset($_REQUEST['p_jrn']))?$_REQUEST['p_jrn']:0;
|
||||
$acc=new Acc_Operation($cn);
|
||||
if (isset($_REQUEST['line']))
|
||||
$acc->jr_id=$_REQUEST ['line'];
|
||||
else
|
||||
$acc->jr_id=$_REQUEST ['jr_ir'];
|
||||
|
||||
$cn=DbConnect($gDossier);
|
||||
$p_jrn=(isset($_REQUEST['p_jrn']))?$_REQUEST['p_jrn']:0;
|
||||
$p_jrn=$acc->get_ledger();
|
||||
|
||||
if ( isset ( $_GET['action'] ) ) {
|
||||
$action=$_GET['action'];
|
||||
|
|
@ -86,7 +95,9 @@ function hide_div (p_div) {
|
|||
echo_debug(__FILE__,__LINE__,"action is $action");
|
||||
//-----------------------------------------------------
|
||||
if ( $action == 'update' ) {
|
||||
if ( ($priv=CheckJrn($gDossier,$_SESSION['g_user'],$_GET['p_jrn'],true)) < 1 ) {
|
||||
if ( $User->check_jrn($p_jrn) =='X' ) {
|
||||
echo ' <script> window.close();</script>';
|
||||
|
||||
NoAccess();
|
||||
exit -1;
|
||||
|
||||
|
|
@ -120,7 +131,8 @@ if ( $action == 'update' ) {
|
|||
$view.="<br>";
|
||||
$view.="<br>";
|
||||
$view.="<br>";
|
||||
$view.=($p_view == 'S')?'<input type="SUBMIT" name="update_record" value="Enregistre">':"";
|
||||
if ( $User->check_jrn($p_jrn) == 'W')
|
||||
$view.=($p_view == 'S')?'<input type="SUBMIT" name="update_record" value="Enregistre">':"";
|
||||
$view.=" ";
|
||||
$view.='<input type="button" value="Fermer" onClick="window.close(); self.opener.RefreshMe();">';
|
||||
$view.='</FORM>';
|
||||
|
|
@ -142,7 +154,8 @@ if ( $action == 'update' ) {
|
|||
$view.="<br>";
|
||||
$view.="<br>";
|
||||
$view.="<br>";
|
||||
$view.=($p_view == 'E') ?'<input type="SUBMIT" name="update_record" value="Enregistre">':"";
|
||||
if ( $User->check_jrn($p_jrn) == 'W')
|
||||
$view.=($p_view == 'E') ?'<input type="SUBMIT" name="update_record" value="Enregistre">':"";
|
||||
$view.=" ";
|
||||
$view.='<input type="button" value="Fermer" onClick="window.close(); self.opener.RefreshMe();">';
|
||||
$view.='</div>';
|
||||
|
|
@ -187,34 +200,49 @@ if ( $action=="view_ca") {
|
|||
// update the record and upload files
|
||||
//----------------------------------------------------------------------
|
||||
if ( isset($_POST['update_record']) ) {
|
||||
if ( ($priv=CheckJrn($gDossier,$_SESSION['g_user'],$p_jrn,true)) !=2 ) {
|
||||
/* in what ledger are we working */
|
||||
$acc=new Acc_Operation($cn);
|
||||
$acc->jr_id=$_POST['jr_id'];
|
||||
$l=$acc->get_ledger();
|
||||
if ( $User->check_jrn($l) != 'W' ) {
|
||||
echo ' <script> window.close();</script>';
|
||||
NoAccess();
|
||||
exit -1;
|
||||
|
||||
}
|
||||
try {
|
||||
// NO UPDATE except rapt & comment && upload pj
|
||||
// NO UPDATE except rapt & comment && upload pj && PJ Number
|
||||
StartSql($cn);
|
||||
|
||||
UpdateComment($cn,$_POST['jr_id'],$_POST['comment']);
|
||||
$acc=new Acc_Operation($cn);
|
||||
$acc->jr_id=$_POST['jr_id'];
|
||||
/* set the pj */
|
||||
$acc->pj=$_POST['pj']; $acc->set_pj();
|
||||
$acc->operation_update_comment($_POST['comment']);
|
||||
/* insert now the grouping */
|
||||
if ( trim($_POST['rapt']) != "" ) {
|
||||
if ( strpos($_POST['rapt'],',') !== 0 )
|
||||
{
|
||||
$aRapt=split(',',$_POST['rapt']);
|
||||
/* reconcialition */
|
||||
$rec=new Acc_Reconciliation ($cn);
|
||||
$rec->set_jr_id($_POST['jr_id']);
|
||||
|
||||
foreach ($aRapt as $rRapt) {
|
||||
|
||||
|
||||
if ( isNumber($rRapt) == 1 )
|
||||
{
|
||||
InsertRapt($cn,$_POST['jr_id'],$rRapt);
|
||||
// Add a "concerned operation to bound these op.together
|
||||
//
|
||||
$rec->insert($rRapt);
|
||||
}
|
||||
}
|
||||
} else
|
||||
if ( isNumber($_POST['rapt']) == 1 )
|
||||
{
|
||||
InsertRapt($cn,$_POST['jr_id'],$_POST['rapt']);
|
||||
$rec->insert($_POST['rapt']);
|
||||
}
|
||||
}
|
||||
|
||||
// InsertRapt($cn,$_POST['jr_id'],$_POST['rapt']);
|
||||
if ( isset ($_FILES)) {
|
||||
echo_debug("modify_op.php",__LINE__, "start upload doc.");
|
||||
save_upload_document($cn,$_POST['jr_grpt_id']);
|
||||
|
|
@ -320,8 +348,9 @@ if ( isset($_POST['update_record']) ) {
|
|||
} // if update_record
|
||||
//-----------------------------------------------------
|
||||
if ( $action == 'delete' ) {
|
||||
echo_debug('modify_op.php',__LINE__," Call DeleteRapt($cn,".$_GET['line'].",".$_GET['line2'].")");
|
||||
DeleteRapt($cn,$_GET['line'],$_GET['line2']);
|
||||
$rec=new Acc_Reconciliation ($cn);
|
||||
$rec->set_jr_id($_GET ['line']);
|
||||
$rec->remove($_GET['line2']);
|
||||
echo ' <script>
|
||||
window.close();
|
||||
self.opener.RefreshMe();
|
||||
|
|
|
|||
|
|
@ -31,24 +31,35 @@ $gDossier=dossier::id();
|
|||
|
||||
include_once ("postgres.php");
|
||||
/* Admin. Dossier */
|
||||
$rep=DbConnect();
|
||||
$cn=DbConnect($gDossier);
|
||||
include_once ("class_user.php");
|
||||
$User=new User($rep);
|
||||
$User=new User($cn);
|
||||
$User->Check();
|
||||
$User->check_dossier($gDossier);
|
||||
|
||||
html_page_start($_SESSION['g_theme']);
|
||||
include_once("preference.php");
|
||||
include_once("user_menu.php");
|
||||
echo '<div class="u_tmenu">';
|
||||
|
||||
echo menu_tool('param');
|
||||
echo '<div style="float:left">';
|
||||
echo menu_tool('parametre.php');
|
||||
|
||||
echo '<div style="float:left;background-color:#879ED4;width:100%;">';
|
||||
|
||||
include_once ("check_priv.php");
|
||||
|
||||
$cn=DbConnect($gDossier);
|
||||
$authorized =0;
|
||||
foreach ( array(PARCA,PARPER,PARFIC,PARDOC,PARJRN,PARTVA,
|
||||
PARMP, PARPOS,PARCOORD,PARSEC)
|
||||
as $a)
|
||||
{
|
||||
if ( $User->check_action($a) == 1 ) {
|
||||
$authorized=1;break;
|
||||
}
|
||||
}
|
||||
|
||||
$User->can_request($cn,PARM);
|
||||
if ($authorized==0)
|
||||
$User->can_request(9999,1);
|
||||
|
||||
// First action
|
||||
$p_action="";
|
||||
|
|
@ -110,6 +121,7 @@ echo_debug("parametre",__LINE__,$_POST);
|
|||
if ( $p_action == "tva" )
|
||||
{
|
||||
echo '</div>';
|
||||
$User->can_request(PARTVA,1);
|
||||
require_once("tva.inc.php");
|
||||
//
|
||||
}
|
||||
|
|
@ -118,6 +130,7 @@ if ( $p_action == "tva" )
|
|||
//-----------------------------------------------------
|
||||
if ( $p_action == "poste" )
|
||||
{
|
||||
$User->can_request(PARPOS,1);
|
||||
require_once('poste.inc.php');
|
||||
|
||||
}
|
||||
|
|
@ -126,6 +139,7 @@ if ( $p_action == "poste" )
|
|||
//-----------------------------------------------------
|
||||
if ( $p_action == "fiche" )
|
||||
{
|
||||
$User->can_request(PARFIC,1);
|
||||
require_once('fiche_def.inc.php');
|
||||
return;
|
||||
}
|
||||
|
|
@ -199,7 +213,7 @@ if ( $p_action == 'divers') {
|
|||
}
|
||||
}
|
||||
if ( $sa=='mp') {
|
||||
|
||||
$User->can_request(PARMP,1);
|
||||
require_once('payment_middle.inc.php');
|
||||
exit;
|
||||
}
|
||||
|
|
@ -208,6 +222,7 @@ if ( $p_action == 'divers') {
|
|||
// Coord societe
|
||||
//-----------------------------------------------------
|
||||
if ( $p_action=='company') {
|
||||
$User->can_request(PARCOORD,1);
|
||||
echo '<div class="content">';
|
||||
require_once("class_own.php");
|
||||
require_once("class_widget.php");
|
||||
|
|
@ -223,8 +238,10 @@ if ( $p_action=='company') {
|
|||
$m->MY_TEL=$p_tel;
|
||||
$m->MY_FAX=$p_fax;
|
||||
$m->MY_PAYS=$p_pays;
|
||||
$m->MY_ANALYTIC=$p_compta;
|
||||
$m->MY_STRICT=$p_strict;
|
||||
if ( $User->check_action(PARCA)!=0)$m->MY_ANALYTIC=$p_compta;
|
||||
if ( $User->check_action(PARSTR)!=0) $m->MY_STRICT=$p_strict;
|
||||
if ( $User->check_action(PARTVA)!=0)$m->MY_TVA_USE=$p_tva_use;
|
||||
$m->MY_PJ_SUGGEST=$p_pj;
|
||||
$m->Update();
|
||||
}
|
||||
|
||||
|
|
@ -248,6 +265,14 @@ if ( $p_action=='company') {
|
|||
$strict->table=1;
|
||||
$strict->selected=$my->MY_STRICT;
|
||||
|
||||
$tva_use=new widget("select");
|
||||
$tva_use->table=1;
|
||||
$tva_use->selected=$my->MY_TVA_USE;
|
||||
|
||||
$pj_suggest=new widget("select");
|
||||
$pj_suggest->table=1;
|
||||
$pj_suggest->selected=$my->MY_PJ_SUGGEST;
|
||||
|
||||
// other parameters
|
||||
$all=new widget("text");
|
||||
$all->table=1;
|
||||
|
|
@ -263,8 +288,13 @@ if ( $p_action=='company') {
|
|||
echo "<tr>".$all->IOValue("p_Commune",$my->MY_COMMUNE,"Commune")."</tr>";
|
||||
echo "<tr>".$all->IOValue("p_pays",$my->MY_PAYS,"Pays")."</tr>";
|
||||
echo "<tr>".$all->IOValue("p_tva",$my->MY_TVA,"Numéro de Tva")."</tr>";
|
||||
if ( $User->check_action(PARCA)==0) $compta->setReadonly(true);
|
||||
echo "<tr>".$compta->IOValue("p_compta",$array,"Utilisation de la compta. analytique")."</tr>";
|
||||
if ( $User->check_action(PARSTR)==0) $strict->setReadonly(true);
|
||||
echo "<tr>".$strict->IOValue("p_strict",$strict_array,"Utilisation du mode strict ")."</tr>";
|
||||
if ( $User->check_action(PARTVA)==0) $tva_use->setReadonly(true);
|
||||
echo "<tr>".$tva_use->IOValue("p_tva_use",$strict_array,"Assujetti à la tva")."</tr>";
|
||||
echo "<tr>".$pj_suggest->IOValue("p_pj",$strict_array,"Suggérer le numéro de pièce justificative")."</tr>";
|
||||
|
||||
echo "</table>";
|
||||
$submit=new widget("submit");
|
||||
|
|
@ -278,6 +308,7 @@ if ( $p_action=='company') {
|
|||
//-----------------------------------------------------
|
||||
echo "</DIV>";
|
||||
if ( $p_action == 'document' ) {
|
||||
$User->can_request(PARDOC,1);
|
||||
echo '<div class="content">';
|
||||
require_once('document_modele.inc.php');
|
||||
echo '</div>';
|
||||
|
|
@ -286,18 +317,21 @@ if ( $p_action == 'document' ) {
|
|||
// Plan Comptable
|
||||
//----------------------------------------------------------------------
|
||||
if ( $p_action == 'pcmn' ) {
|
||||
$User->can_request(PARPCMN,1);
|
||||
require_once('param_pcmn.inc.php');
|
||||
}
|
||||
//----------------------------------------------------------------------
|
||||
// Security
|
||||
//----------------------------------------------------------------------
|
||||
if ( $p_action == 'sec' ) {
|
||||
$User->can_request(PARSEC,1);
|
||||
require_once('param_sec.inc.php');
|
||||
}
|
||||
//----------------------------------------------------------------------
|
||||
// Predefined operation
|
||||
//----------------------------------------------------------------------
|
||||
if ( $p_action == 'preod' ) {
|
||||
$User->can_request(PARPREDE,1);
|
||||
require_once('preod.inc.php');
|
||||
}
|
||||
|
||||
|
|
@ -305,12 +339,14 @@ if ( $p_action == 'preod' ) {
|
|||
// Definition of report
|
||||
//---------------------------------------------------------------------------
|
||||
if ( $p_action == 'defrapport' ) {
|
||||
$User->can_request(PARRAP,1);
|
||||
require_once('report.inc.php');
|
||||
}
|
||||
//----------------------------------------------------------------------
|
||||
// Ledger parameter
|
||||
//----------------------------------------------------------------------
|
||||
if ( $p_action == 'jrn' ) {
|
||||
$User->can_request(PARJRN,1);
|
||||
$sa=(isset($_REQUEST['sa']))?$_REQUEST['sa']:"";
|
||||
// echo '<div class="content">';
|
||||
if ( $sa == "add")
|
||||
|
|
|
|||
|
|
@ -38,6 +38,9 @@ $cn=DbConnect($gDossier);
|
|||
|
||||
$User=new User($cn);
|
||||
$User->Check();
|
||||
$User->check_dossier($gDossier);
|
||||
$User->can_request(IMPPOSTE,0);
|
||||
|
||||
if ( isset ( $_REQUEST['poste_fille']) )
|
||||
{ //choisit de voir tous les postes
|
||||
$a_poste=get_array($cn,"select pcm_val from tmp_pcmn where pcm_val::text like '".$_REQUEST["poste_id"]."%'");
|
||||
|
|
@ -73,8 +76,8 @@ if ( ! isset ($_REQUEST['oper_detail'])) {
|
|||
foreach ( $Poste->row as $op ) {
|
||||
echo '"'.$pos['pcm_val'].'";'.
|
||||
'"'.$op['jr_internal'].'"'.";".
|
||||
'"'.$op['jr_date'].'"'.";".
|
||||
'"'.$op['description'].'"'.";".
|
||||
'"'.$op['j_date'].'"'.";".
|
||||
'"'.$op['description']." ".$op['jr_pj_number'].'"'.";".
|
||||
sprintf("%8.4f",$op['deb_montant']).";".
|
||||
sprintf("%8.4f",$op['cred_montant']);
|
||||
printf("\n");
|
||||
|
|
@ -119,12 +122,13 @@ if ( ! isset ($_REQUEST['oper_detail'])) {
|
|||
$op->jr_id=$a['jr_id'];
|
||||
$result=$op->get_jrnx_detail();
|
||||
foreach ( $result as $r) {
|
||||
printf('"%s";"%s";"%s";"%s";"%s";%12.2f;"%s"',
|
||||
printf('"%s";"%s";"%s";"%s";"%s";%12.2f;"%s %s"',
|
||||
$r['j_poste'],
|
||||
$r['j_qcode'],
|
||||
$r['jr_internal'],
|
||||
$r['jr_date'],
|
||||
$a['description'],
|
||||
$a['jr_pj_number'],
|
||||
$r['j_montant'],
|
||||
$r['debit']);
|
||||
printf("\r\n");
|
||||
|
|
|
|||
|
|
@ -31,16 +31,23 @@ include_once("impress_inc.php");
|
|||
require_once("poste.php");
|
||||
require_once ('header_print.php');
|
||||
require_once('class_dossier.php');
|
||||
require_once('class_user.php');
|
||||
|
||||
$gDossier=dossier::id();
|
||||
|
||||
/* Security */
|
||||
$cn=DbConnect($gDossier);
|
||||
foreach ($_POST as $key=>$element) {
|
||||
${"$key"}=$element;
|
||||
}
|
||||
$User=new User($cn);
|
||||
$User->Check();
|
||||
$User->check_dossier($gDossier);
|
||||
$User->can_request(IMPPOSTE,0);
|
||||
|
||||
extract($_POST);
|
||||
|
||||
if ( isset ( $poste_fille) ){ //choisit de voir tous les postes
|
||||
$a_poste=get_array($cn,"select pcm_val from tmp_pcmn where pcm_val like '$poste_id%'");
|
||||
$a_poste=get_array($cn,"select pcm_val from tmp_pcmn where pcm_val::text like '$poste_id%'");
|
||||
} else
|
||||
$a_poste=get_array($cn,"select pcm_val from tmp_pcmn where pcm_val = '$poste_id'");
|
||||
$a_poste=get_array($cn,"select pcm_val from tmp_pcmn where pcm_val::text = '$poste_id'");
|
||||
|
||||
|
||||
$ret="";
|
||||
|
|
|
|||
|
|
@ -41,12 +41,12 @@ $gDossier=dossier::id();
|
|||
|
||||
$c_comment="";
|
||||
$c_class="";
|
||||
extract ($_GET);
|
||||
|
||||
$condition="";
|
||||
$cn=DbConnect($gDossier);
|
||||
if ( isset($_GET['search']) ) {
|
||||
$c1=0;
|
||||
extract ($_GET);
|
||||
|
||||
$condition="";
|
||||
if ( strlen(trim($p_comment)) != 0 ) {
|
||||
|
|
@ -56,7 +56,7 @@ if ( isset($_GET['search']) ) {
|
|||
|
||||
}
|
||||
$url="";
|
||||
|
||||
$ctrl=(isset($_GET['ctrl']))?$_GET['ctrl']:"";
|
||||
//--------------------------------------------------
|
||||
// Filter defined in the ledger's parameter
|
||||
//
|
||||
|
|
@ -124,16 +124,13 @@ echo_debug('poste_search.php',__LINE__,"condition = $condition");
|
|||
|
||||
echo '<FORM ACTION="poste_search.php'.$url.'" METHOD="GET">';
|
||||
echo dossier::hidden();
|
||||
|
||||
echo widget::hidden('ctrl',$_GET['ctrl']);
|
||||
if ( isset($p_ctl) ) {
|
||||
echo '<INPUT TYPE="hidden" name="p_ctl" value="'.$p_ctl.'">';
|
||||
}
|
||||
if (isset ($ret)) echo widget::hidden('ret',$ret);
|
||||
|
||||
/* echo '<TD>Poste Comptable Commence par </TD>'; */
|
||||
/* if ( ! isset ($p_class) ) $p_class=""; */
|
||||
/* $opt=" <INPUT TYPE=\"text\" value=\"$p_class\" name=\"st_with\">"; */
|
||||
/* echo '<TD> <INPUT TYPE="text" name="p_class" VALUE="'.$p_class.'"></TD>'; */
|
||||
|
||||
echo 'Libellé ou poste comptable ';
|
||||
echo ' contient ';
|
||||
if ( ! isset ($p_comment) ) $p_comment="";
|
||||
|
|
@ -162,16 +159,20 @@ if ( isset($_GET['search']) || isset($_GET['filter']) ) {
|
|||
// if p_ctl is set we need to be able to return the value
|
||||
if (isset($ret) && $ret == 'label' ){
|
||||
$slabel=FormatString($l_line['pcm_lib']);
|
||||
$ahref='<A href="#" class="mtitle" onClick="SetItChild(\''.$p_ctl.'\',\''.$l_line['pcm_val'].'\',\''.
|
||||
$slabel.'\')">';
|
||||
$ahref='<A href="#" class="mtitle" onClick="SetItChild(\''.$p_ctl.'\',\''.$l_line['pcm_val'].'\',\''.
|
||||
$slabel.'\',\''.$ctrl.'\')">';
|
||||
|
||||
$end_ahref='</A>';
|
||||
|
||||
}
|
||||
if (isset($ret) && $ret == 'poste' ){
|
||||
} else if (isset($ret) && $ret == 'poste' ){
|
||||
$ahref='<A href="#" class="mtitle" onClick="set_poste_child(\''.$p_ctl.'\',\''.$l_line['pcm_val'].'\')">';
|
||||
$end_ahref='</A>';
|
||||
|
||||
}
|
||||
} else if (isset($ret) && $ret == 'jrn' ){
|
||||
$ahref='<A href="#" class="mtitle" onClick="set_jrn_child(\''.$p_ctl.'\',\''.$l_line['pcm_val'].'\')">';
|
||||
$end_ahref='</A>';
|
||||
|
||||
}
|
||||
|
||||
echo "<TD class=\"$even\">";
|
||||
echo $ahref;
|
||||
|
|
@ -190,6 +191,6 @@ if ( isset($_GET['search']) || isset($_GET['filter']) ) {
|
|||
|
||||
echo '</TABLE>';
|
||||
}
|
||||
echo '<INPUT TYPE="BUTTON" Value="Close" onClick=\'GetIt()\'>';
|
||||
echo '<INPUT TYPE="BUTTON" Value="Fermer" onClick=\'GetIt()\'>';
|
||||
html_page_stop();
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ $User=new User($rep);
|
|||
$User->Check();
|
||||
|
||||
$bal=new Acc_Balance($cn);
|
||||
$User->can_request($cn,BALANCE);
|
||||
$User->can_request(IMPBAL,1);
|
||||
|
||||
echo_debug('print_balance.php',__LINE__,"imp pdf journaux");
|
||||
foreach ($_POST as $key=>$element) {
|
||||
|
|
|
|||
|
|
@ -25,14 +25,13 @@ include_once("postgres.php");
|
|||
include_once("debug.php");
|
||||
include_once("user_menu.php");
|
||||
html_page_start($_SESSION['g_theme']);
|
||||
echo_debug('priv_user.php',__LINE__,"entering priv_users");
|
||||
|
||||
|
||||
$rep=DbConnect();
|
||||
include_once ("class_user.php");
|
||||
$User=new User($rep);
|
||||
$User->Check();
|
||||
|
||||
/* only the global admin can modify something here
|
||||
*/
|
||||
if ($User->admin != 1) {
|
||||
html_page_stop();
|
||||
return;
|
||||
|
|
@ -45,9 +44,11 @@ if (! isset ($_GET['UID']) && ! isset($_POST['UID']) ) {
|
|||
return;
|
||||
}
|
||||
$uid=( isset ($_GET['UID']))? $_GET['UID']: $_POST['UID'];
|
||||
$UserChange=new User($rep,$uid);
|
||||
|
||||
echo_debug('priv_user.php',__LINE__,"UID IS DEFINED");
|
||||
|
||||
$r_UID=GetUid($uid);
|
||||
$r_UID=$UserChange->id;
|
||||
if ( $r_UID == false ) {
|
||||
echo_debug('priv_user.php',__LINE__,"UID NOT VALID");
|
||||
// Message d'erreur
|
||||
|
|
@ -78,21 +79,17 @@ if ( isset ( $_GET['reset_passwd']) ){
|
|||
$Res=ExecSql($cn, "update ac_users set use_pass='$l_pass' where use_id=$uid");
|
||||
echo '<H2 class="info"> Password remis à phpcompta</H2>';
|
||||
}
|
||||
/* Save the changes */
|
||||
if ( isset ($_POST['SAVE']) ){
|
||||
$uid = $_POST['UID'];
|
||||
echo_debug('priv_user.php',__LINE__,"SAVE is set");
|
||||
|
||||
// Update User
|
||||
$cn=DbConnect();
|
||||
$first_name=pg_escape_string($_POST['fname']);
|
||||
$last_name=pg_escape_string($_POST['lname']);
|
||||
$login=$_POST['login'];
|
||||
$login=str_replace("'","",$login);
|
||||
$login=str_replace('"',"",$login);
|
||||
$login=str_replace(" ","",$login);
|
||||
$login=strtolower($login);
|
||||
$last_name=pg_escape_string($_POST['fname']);
|
||||
$first_name=pg_escape_string($_POST['lname']);
|
||||
|
||||
$Sql="update ac_users set use_first_name='".$first_name."', use_name='".$last_name."'
|
||||
,use_login='".$login."',use_active=".$_POST['Actif'].",use_admin=".$_POST['Admin']." where
|
||||
,use_active=".$_POST['Actif'].",use_admin=".$_POST['Admin']." where
|
||||
use_id=".$uid;
|
||||
$Res=ExecSql($cn,$Sql);
|
||||
// Update Priv on Folder
|
||||
|
|
@ -108,10 +105,11 @@ if ( isset ($_POST['SAVE']) ){
|
|||
{
|
||||
$Res=ExecSql($cn,"insert into jnt_use_dos(dos_id,use_id) values(".$db_id.",".$uid.")");
|
||||
}
|
||||
|
||||
$jnt=GetJnt($db_id,$uid);
|
||||
if (ExistePriv($jnt) > 0)
|
||||
{
|
||||
$Res=ExecSql($cn,"update priv_user set priv_priv='".$elem."' where priv_jnt=".$jnt);
|
||||
$Res=ExecSql($cn,"update priv_user set priv_priv='".$elem."' where priv_jnt=".$jnt);
|
||||
} else {
|
||||
$Res=ExecSql($cn,"insert into priv_user(priv_jnt,priv_priv) values (".$jnt.",'".$elem."')");
|
||||
}
|
||||
|
|
@ -132,29 +130,28 @@ if ( isset ($_POST['SAVE']) ){
|
|||
return;
|
||||
}
|
||||
}
|
||||
$r_UID=GetUid($uid);
|
||||
$UserChange->load();
|
||||
?>
|
||||
<FORM ACTION="priv_user.php" METHOD="POST">
|
||||
|
||||
<?php printf('<INPUT TYPE=HIDDEN NAME=UID VALUE="%s">',$uid); ?>
|
||||
<TABLE BORDER=0>
|
||||
<TR>
|
||||
|
||||
<?php printf('<td>login</td><td> %s</td>',$UserChange->login); ?>
|
||||
</TD></tr>
|
||||
<TR><TD>
|
||||
<?php printf('First name <INPUT type="text" NAME="fname" value="%s"> ',$r_UID[0]['use_first_name']); ?>
|
||||
</TD><TD>
|
||||
<?php printf('Name <INPUT type="text" NAME="lname" value="%s"> ',$r_UID[0]['use_name']); ?>
|
||||
</TD>
|
||||
</TR><TR>
|
||||
<TD>
|
||||
<?php printf('login <INPUT type="text" NAME="login" value="%s">',$r_UID[0]['use_login']); ?>
|
||||
</TD>
|
||||
<TD class="mtitle">
|
||||
<?php printf('<A class="mtitle" HREF="priv_user.php?reset_passwd&UID=%s">Reset Password</A>',$uid); ?>
|
||||
<?php printf('Nom de famille </TD><td><INPUT type="text" NAME="fname" value="%s"> ',$UserChange->name); ?>
|
||||
</TD></TR>
|
||||
<?php printf('<td>prénom</td><td>
|
||||
<INPUT type="text" NAME="lname" value="%s"> ',$UserChange->first_name); ?>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR><TD>
|
||||
</table>
|
||||
|
||||
<TABLE>
|
||||
<?php
|
||||
if ( $r_UID[0]['use_active'] == 1 ) {
|
||||
if ( $UserChange->active == 1 ) {
|
||||
$ACT="CHECKED";$NACT="UNCHECKED";
|
||||
} else {
|
||||
$ACT="UNCHECKED";$NACT="CHECKED";
|
||||
|
|
@ -170,15 +167,15 @@ echo "</TD></TR>";
|
|||
<TD>
|
||||
<TABLE>
|
||||
<?php
|
||||
if ( $r_UID[0]['use_admin'] == 1 ) {
|
||||
if ( $UserChange->admin == 1 ) {
|
||||
$ACT="CHECKED";$NACT="UNCHECKED";
|
||||
} else {
|
||||
$ACT="UNCHECKED";$NACT="CHECKED";
|
||||
}
|
||||
echo "<TR><TD>";
|
||||
printf('<INPUT type="RADIO" NAME="Admin" VALUE="1" %s> Administrator',$ACT);
|
||||
printf('<INPUT type="RADIO" NAME="Admin" VALUE="1" %s> Administrateur global',$ACT);
|
||||
echo "</TD><TD>";
|
||||
printf('<INPUT type="RADIO" NAME="Admin" VALUE="0" %s> Normal user',$NACT);
|
||||
printf('<INPUT type="RADIO" NAME="Admin" VALUE="0" %s> Pas administrateur global ',$NACT);
|
||||
echo "</TD></TR>";
|
||||
?>
|
||||
</TABLE>
|
||||
|
|
@ -187,61 +184,54 @@ echo "</TD></TR>";
|
|||
<TR>
|
||||
<TD>
|
||||
<!-- Show all database and rights -->
|
||||
<H2 class="info"> Droit par défaut </H2>
|
||||
<H2 class="info"> Droit sur les dossiers pour les utilisateurs normaux </H2>
|
||||
<p class="notice">
|
||||
Les autres droits doivent être réglés dans les dossiers (paramètre->sécurité)
|
||||
</p>
|
||||
<TABLE>
|
||||
<?php
|
||||
$array=array(
|
||||
array('value'=>'X','label'=>'Aucun Accès'),
|
||||
array('value'=>'R','label'=>'Utilisateur normal'),
|
||||
array('value'=>'L','label'=>'Administrateur local(Tous les droits)')
|
||||
);
|
||||
|
||||
$Dossier=ShowDossier('all',1,0);
|
||||
if ( empty ( $Dossier )) {
|
||||
echo '* Aucun Dossier *';
|
||||
echo '</div>';
|
||||
exit();
|
||||
}
|
||||
$mod_user=new User(DbConnect(),$uid);
|
||||
foreach ( $Dossier as $rDossier) {
|
||||
$NORIGHT="";$Write="";$Read="";
|
||||
echo_debug('priv_user.php',__LINE__,"Dossier : ".$rDossier['dos_id']);
|
||||
$login_name=get_login($uid);
|
||||
$priv=GetPriv($rDossier['dos_id'],$login_name);
|
||||
|
||||
$priv=$mod_user->get_privilege($rDossier['dos_id']);
|
||||
printf("<TR><TD> Dossier : %s </TD>",$rDossier['dos_name']);
|
||||
if ( $priv==0 )
|
||||
{ $NORIGHT="CHECKED";}
|
||||
else {
|
||||
$A=$priv[0]['priv_priv'];
|
||||
echo_debug('priv_user.php',__LINE__,"Priv = $A");
|
||||
if ( $priv[0]['priv_priv']=='W' )
|
||||
{$Write="CHECKED";}
|
||||
else {
|
||||
if ( $priv[0]['priv_priv']=='R' )
|
||||
{ $Read="CHECKED";}
|
||||
else {
|
||||
if ($priv[0]['priv_priv']=='N') {
|
||||
$NORIGHT="CHECKED";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
printf('</TD><TD>No Right<INPUT TYPE="RADIO" NAME="PRIV%s" VALUE="NO" %s>',$rDossier['dos_id'],$NORIGHT);
|
||||
printf('</TD><TD>Read/Write <INPUT TYPE="RADIO" NAME="PRIV%s" VALUE="W" %s>',$rDossier['dos_id'],$Write);
|
||||
printf('</TD><TD>Read<INPUT TYPE="RADIO" NAME="PRIV%s" VALUE="R" %s>',$rDossier['dos_id'],$Read);
|
||||
|
||||
$select=new widget('select');
|
||||
$select->table=1;
|
||||
$select->name=sprintf('PRIV%s',$rDossier['dos_id']);
|
||||
$select->value=$array;
|
||||
$select->selected=$priv;
|
||||
echo $select->IOValue();
|
||||
echo "</TD></TR>";
|
||||
}
|
||||
|
||||
?>
|
||||
</TABLE>
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
<?php echo widget::button_href('Reinitialiser le mot de passe',
|
||||
sprintf('priv_user.php?reset_passwd&UID=%s',$uid));
|
||||
?>
|
||||
|
||||
|
||||
|
||||
<TR><TD><input type="Submit" NAME="SAVE" VALUE="Save changes"></TD>
|
||||
<TD>
|
||||
<A class="mtitle" HREF="admin_repo.php?action=user_mgt"><input type="button" value="Retour"></A>
|
||||
</TD>
|
||||
<TD><input type="Submit" NAME="DELETE" VALUE="Delete User"></TD>
|
||||
</TR>
|
||||
<input type="Submit" NAME="SAVE" VALUE="Sauver les changements changes">
|
||||
|
||||
<input type="Submit" NAME="DELETE" VALUE="Effacer" onclick="return confirm('Confirmer effacement ?');" >
|
||||
|
||||
</FORM>
|
||||
</TABLE>
|
||||
<A href='admin_repo.php?action=user_mgt'>Retour</a>
|
||||
</DIV>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ printf("\n");
|
|||
foreach ( $Fiche->row as $op ) {
|
||||
echo '"'.$op['j_qcode'].'";'.
|
||||
'"'.$op['jr_internal'].'"'.";".
|
||||
'"'.$op['jr_date'].'"'.";".
|
||||
'"'.$op['j_date'].'"'.";".
|
||||
'"'.$op['description'].'"'.";".
|
||||
sprintf("%8.4f",$op['deb_montant']).";".
|
||||
sprintf("%8.4f",$op['cred_montant']);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PhpCompta.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ include_once ("class_user.php");
|
|||
$User=new User($rep);
|
||||
$User->Check();
|
||||
// Check Priv
|
||||
$User->can_request($cn,SECU);
|
||||
$User->can_request(PARSEC,1);
|
||||
|
||||
//-----------------------------------------------------
|
||||
// Get User's info
|
||||
|
|
@ -72,19 +72,22 @@ if ( $SecUser->admin==1)
|
|||
//-----------------------------------------------------
|
||||
// Journal
|
||||
$Res=ExecSql($cn,"select jrn_def_id,jrn_def_name from jrn_def ");
|
||||
$SecUser->db=$cn;
|
||||
for ($e=0;$e < pg_NumRows($Res);$e++) {
|
||||
$row=pg_fetch_array($Res,$e);
|
||||
$a_jrn[$e]['jrn_name']=$row['jrn_def_name'];
|
||||
$priv=CheckJrn($gDossier,$SecUser->login,$row['jrn_def_id']);
|
||||
$a_jrn[$e]['jrn_name']=utf8_decode($row['jrn_def_name']);
|
||||
$priv=$SecUser->check_jrn($row['jrn_def_id']);
|
||||
switch($priv) {
|
||||
case 0:
|
||||
$a_jrn[$e]['priv']="pas d'accès";
|
||||
case 'X':
|
||||
$a_jrn[$e]['priv']=utf8_decode("pas d'accès");
|
||||
break;
|
||||
case 1:
|
||||
$a_jrn[$e]['priv']="lecture";
|
||||
case 'R':
|
||||
$a_jrn[$e]['priv']=utf8_decode("lecture");
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
case 'O':
|
||||
$a_jrn[$e]['priv']=utf8_decode("Operation prédéfinie uniquement");
|
||||
break;
|
||||
case 'W':
|
||||
$a_jrn[$e]['priv']="Ecriture";
|
||||
break;
|
||||
}
|
||||
|
|
@ -92,7 +95,7 @@ for ($e=0;$e < pg_NumRows($Res);$e++) {
|
|||
}
|
||||
$pdf->ezTable($a_jrn,
|
||||
array ('jrn_name'=>' Journal',
|
||||
'priv'=>'Privilège')," ",
|
||||
'priv'=>utf8_decode('Privilège'))," ",
|
||||
array('shaded'=>0,'showHeadings'=>1,'width'=>500));
|
||||
|
||||
//-----------------------------------------------------
|
||||
|
|
@ -104,22 +107,22 @@ $Max=pg_NumRows($Res);
|
|||
|
||||
for ( $i =0 ; $i < $Max; $i++ ) {
|
||||
$l_line=pg_fetch_array($Res,$i);
|
||||
$action['lib']=$l_line['ac_description'];
|
||||
$action['lib']=utf8_decode($l_line['ac_description']);
|
||||
$right=check_action($gDossier,$SecUser->login,$l_line['ac_id']);
|
||||
switch ($right) {
|
||||
case 0:
|
||||
$action['priv']="Pas d'accès";
|
||||
$action['priv']=utf8_decode("Pas d'accès");
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
$action['priv']="Accès";
|
||||
$action['priv']=utf8_decode("Accès");
|
||||
break;
|
||||
}
|
||||
$a_action[$i]=$action;
|
||||
}
|
||||
$pdf->ezTable($a_action ,
|
||||
array ('lib'=>'Description',
|
||||
'priv'=>'Privilège')," ",
|
||||
'priv'=>utf8_decode('Privilège'))," ",
|
||||
array('shaded'=>0,'showHeadings'=>1,'width'=>500));
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -47,11 +47,6 @@ if ( ! isset ($_REQUEST['q'])) {
|
|||
}
|
||||
// connect to the database
|
||||
$cn=DbConnect($gDossier);
|
||||
if ( $User->check_action($cn,FICHE_READ) == 0 ){
|
||||
/* Cannot Access */
|
||||
echo '<h2 class="error"> Vous n\' avez pas accès</h2>';
|
||||
return;
|
||||
}
|
||||
|
||||
// Create a object fiche
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ if ( pg_num_rows($r) == 0 ) {
|
|||
$a=pg_fetch_array($r,0);
|
||||
$jrn=$a['jr_def_id'];
|
||||
|
||||
if ($User->AccessJrn($cn,$jrn) == false ){
|
||||
if ($User->check_jrn($jrn) == 'X' ){
|
||||
/* Cannot Access */
|
||||
NoAccess();
|
||||
exit -1;
|
||||
|
|
|
|||
|
|
@ -273,7 +273,7 @@ td.selectedcell{
|
|||
a.mtitle {
|
||||
font-size:10px;
|
||||
text-decoration:none;
|
||||
display:block;
|
||||
display:inline;
|
||||
color: blue;
|
||||
|
||||
}
|
||||
|
|
@ -300,7 +300,7 @@ tr.even:hover td
|
|||
a.mtitle:hover
|
||||
{
|
||||
text-decoration:none;
|
||||
display:block;
|
||||
display:inline;
|
||||
background-color:#a9d6e4;
|
||||
color:white;
|
||||
}
|
||||
|
|
|
|||
218
html/test.php
218
html/test.php
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
|
||||
<style type="text/css">
|
||||
<!--
|
||||
h2 {
|
||||
|
|
@ -31,7 +31,12 @@ h2 {
|
|||
*/
|
||||
/* $Revision*/
|
||||
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
|
||||
|
||||
/*!\file
|
||||
*\brief this file let you debug and test the different functionnalities, there are 2 important things to do
|
||||
* - first do not forget to create the authorized_debug file in the html folder
|
||||
* - secund the test must adapted to this page : if you do a post (or get) from a test, you won't get any result
|
||||
* if the $_REQUEST[test_select] is not set, so set it .
|
||||
*/
|
||||
include_once("ac_common.php");
|
||||
include_once("postgres.php");
|
||||
require_once ('class_dossier.php');
|
||||
|
|
@ -48,96 +53,129 @@ if ( ! isset($_REQUEST['gDossier'])) {
|
|||
echo "L'url aurait du etre test.php?gDossier=xx";
|
||||
exit();
|
||||
}
|
||||
$array=array(
|
||||
array(1,'Plan Analytic'),
|
||||
array(2,'Poste Analytic'),
|
||||
array(3,'Budget Card'),
|
||||
array(4,'Budget Hypo'),
|
||||
array(5,'Budget Detail Periode'),
|
||||
array(6,'Budget Data'),
|
||||
array(7,'Budget Synthese compte'),
|
||||
array(8,'Budget Synthese group'),
|
||||
array(9,'Budget Synthese ANC'),
|
||||
array(10,'Budget Synthese Hypo'),
|
||||
array(11,'Periode'),
|
||||
array(12,'verif.inc.php'),
|
||||
array(13,'Rapport(class_acc_report'),
|
||||
array(14,'Tva(class_acc_tav'),
|
||||
array(15,'Compute(class_acc_compute'),
|
||||
array(16,'widget'),
|
||||
array(17,'Ledger info(class_acc_ledger_info'),
|
||||
array(18,'Toddo list(class_todo'),
|
||||
array(19,'Payment (class_acc_payment')
|
||||
);
|
||||
$r='<form method="get">';
|
||||
$r.='<select name="test_select" >';
|
||||
foreach ($array as $value) {
|
||||
$r.='<option value="'.$value[0].'">'.$value[1];
|
||||
}
|
||||
$r.='</select>';
|
||||
$r.='<input type="submit" value="Testons">';
|
||||
r.='</form>';
|
||||
|
||||
echo $r;
|
||||
|
||||
/*
|
||||
require_once('class_plananalytic.php');
|
||||
PlanAnalytic::testme();
|
||||
if ( ! isset($_REQUEST['test_select']))
|
||||
exit();
|
||||
|
||||
$act=$_REQUEST['test_select'];
|
||||
|
||||
switch ($act) {
|
||||
case 1:
|
||||
require_once('class_anc_plan.php');
|
||||
Anc_Plan::testme();
|
||||
break;
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
require_once("class_poste_analytic.php");
|
||||
Poste_analytique::testme();
|
||||
|
||||
|
||||
require_once ('class_bud_card.php');
|
||||
Bud_Card::testme();
|
||||
|
||||
|
||||
|
||||
require_once('class_bud_hypo.php');
|
||||
Bud_Hypo::testme();
|
||||
|
||||
|
||||
require_once ('class_bud_detail_periode.php');
|
||||
Bud_Detail_Periode::test_me();
|
||||
|
||||
|
||||
|
||||
require_once ('class_bud_data.php');
|
||||
Bud_Data::test_me();
|
||||
|
||||
require_once ('class_bud_synthese_acc.php');
|
||||
Bud_Synthese_Acc::test_me();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
require_once ('class_bud_synthese_group.php');
|
||||
Bud_Synthese_Group::test_me();
|
||||
|
||||
|
||||
require_once ('class_bud_synthese_anc.php');
|
||||
Bud_Synthese_Anc::test_me();
|
||||
|
||||
require_once ('class_bud_synthese_hypo.php');
|
||||
Bud_Synthese_Hypo::test_me();
|
||||
require_once ('class_periode.php');
|
||||
Periode::test_me();
|
||||
|
||||
require_once ('verif.inc.php');
|
||||
|
||||
|
||||
require_once('class_acc_report.php');
|
||||
Rapport::test_me();
|
||||
require_once('class_acc_report_row.php');
|
||||
Rapport_Row::test_me();
|
||||
|
||||
require_once('class_acc_tva.php');
|
||||
Acc_Tva::test_me();
|
||||
|
||||
require('class_acc_compute.php');
|
||||
Acc_Compute::test_me();
|
||||
|
||||
require_once('class_widget.php');
|
||||
|
||||
echo widget::button_href("On y va",'login.php');
|
||||
|
||||
|
||||
require_once('class_acc_ledger_info.php');
|
||||
Acc_Ledger_Info::test_me();
|
||||
|
||||
require('class_acc_compute.php');
|
||||
Acc_Compute::test_me();
|
||||
|
||||
|
||||
require_once('class_todo_list.php');
|
||||
require_once('class_widget.php');
|
||||
require_once ('constant.php');
|
||||
echo JS_PROTOTYPE;
|
||||
Todo_List::test_me();
|
||||
echo '<script src="js/todo_list.js"></script>';
|
||||
echo '<form method="get">';
|
||||
echo widget::hidden('phpsessid',$_REQUEST['PHPSESSID']);
|
||||
echo dossier::hidden();
|
||||
echo 'title : <input type="text" id="p_title"><br>';
|
||||
echo 'desc : <input type="text" id="p_desc"><br>';
|
||||
echo 'date : <input type="text" id="p_date"><br>';
|
||||
echo '<input type="button" onClick="todo_list_add();return false;">';
|
||||
echo '</form>';
|
||||
|
||||
*/
|
||||
require_once('class_acc_payment.php');
|
||||
Acc_Payment::test_me();
|
||||
case 2:
|
||||
require_once("class_anc_account.php");
|
||||
Anc_Account::testme();
|
||||
break;
|
||||
case 3:
|
||||
require_once ('class_bud_card.php');
|
||||
Bud_Card::testme();
|
||||
break;
|
||||
case 4:
|
||||
require_once('class_bud_hypo.php');
|
||||
Bud_Hypo::testme();
|
||||
break;
|
||||
case 5:
|
||||
require_once ('class_bud_detail_periode.php');
|
||||
Bud_Detail_Periode::test_me();
|
||||
break;
|
||||
case 6:
|
||||
require_once ('class_bud_data.php');
|
||||
Bud_Data::test_me();
|
||||
break;
|
||||
case 7:
|
||||
require_once ('class_bud_synthese_acc.php');
|
||||
Bud_Synthese_Acc::test_me();
|
||||
break;
|
||||
case 8:
|
||||
require_once ('class_bud_synthese_group.php');
|
||||
Bud_Synthese_Group::test_me();
|
||||
break;
|
||||
case 9:
|
||||
require_once ('class_bud_synthese_anc.php');
|
||||
Bud_Synthese_Anc::test_me();
|
||||
break;
|
||||
case 10:
|
||||
require_once ('class_bud_synthese_hypo.php');
|
||||
Bud_Synthese_Hypo::test_me();
|
||||
break;
|
||||
case 11:
|
||||
require_once ('class_periode.php');
|
||||
Periode::test_me();
|
||||
break;
|
||||
case 13:
|
||||
require_once('class_acc_report.php');
|
||||
Rapport::test_me();
|
||||
require_once('class_acc_report_row.php');
|
||||
Rapport_Row::test_me();
|
||||
break;
|
||||
case 14:
|
||||
require_once('class_acc_tva.php');
|
||||
Acc_Tva::test_me();
|
||||
break;
|
||||
case 15:
|
||||
require('class_acc_compute.php');
|
||||
Acc_Compute::test_me();
|
||||
break;
|
||||
case 16:
|
||||
require_once('class_widget.php');
|
||||
echo widget::button_href("On y va",'login.php');
|
||||
break;
|
||||
case 17:
|
||||
require_once('class_acc_ledger_info.php');
|
||||
Acc_Ledger_Info::test_me();
|
||||
break;
|
||||
case 18:
|
||||
require_once('class_todo_list.php');
|
||||
require_once('class_widget.php');
|
||||
require_once ('constant.php');
|
||||
echo JS_PROTOTYPE;
|
||||
Todo_List::test_me();
|
||||
echo '<script src="js/todo_list.js"></script>';
|
||||
echo '<form method="get">';
|
||||
echo widget::hidden('phpsessid',$_REQUEST['PHPSESSID']);
|
||||
echo dossier::hidden();
|
||||
echo 'title : <input type="text" id="p_title"><br>';
|
||||
echo 'desc : <input type="text" id="p_desc"><br>';
|
||||
echo 'date : <input type="text" id="p_date"><br>';
|
||||
echo '<input type="button" onClick="todo_list_add();return false;">';
|
||||
echo '</form>';
|
||||
break;
|
||||
case 19:
|
||||
require_once('class_acc_payment.php');
|
||||
Acc_Payment::test_me();
|
||||
break;
|
||||
}
|
||||
|
|
@ -36,7 +36,10 @@ $rep=DbConnect();
|
|||
include_once ("class_user.php");
|
||||
$User=new User($rep);
|
||||
$User->Check();
|
||||
$User->check_dossier(dossier::id());
|
||||
$cn=DbConnect(dossier::id());
|
||||
$User->db=$cn;
|
||||
|
||||
include_once ("postgres.php");
|
||||
echo_debug('user_advanced.php',__LINE__,"user is ".$_SESSION['g_user']);
|
||||
|
||||
|
|
@ -81,8 +84,9 @@ default:
|
|||
echo ShowMenuAdvanced($high);
|
||||
|
||||
if ($p_action == "periode" ) {
|
||||
if ( $User->admin == 0 && check_action($gDossier,$_SESSION['g_user'],GESTION_PERIODE) == 0 )
|
||||
NoAccess();
|
||||
|
||||
if ( $User->check_action(PARPER) == 0 && $User->check_action(PARCLO) == 0 )
|
||||
NoAccess();
|
||||
|
||||
$p_action=$_REQUEST['p_action'];
|
||||
include_once("periode.inc.php");
|
||||
|
|
|
|||
|
|
@ -27,9 +27,10 @@ include_once ("postgres.php");
|
|||
* \brief main page of the accountancy module
|
||||
*/
|
||||
|
||||
$rep=DbConnect();
|
||||
|
||||
$User=new User($rep);
|
||||
$User=new User(DbConnect());
|
||||
$User->check_dossier(dossier::id());
|
||||
$cn=DbConnect(dossier::id());
|
||||
$User->cn=$cn;
|
||||
$User->Check();
|
||||
|
||||
html_page_start($User->theme);
|
||||
|
|
@ -37,16 +38,13 @@ $gDossier=dossier::id();
|
|||
|
||||
echo_debug('user_compta.php',__LINE__,"user is ".$_SESSION['g_user']);
|
||||
|
||||
// Synchronize rights
|
||||
SyncRight($gDossier,$_SESSION['g_user']);
|
||||
|
||||
// Get The priv on the selected folder
|
||||
if ( $User->admin == 0 ) {
|
||||
if ( $User->admin == 0 && $User->is_local_admin(dossier::id()) == 0 ) {
|
||||
|
||||
$r=GetPriv($gDossier,$_SESSION['g_user']);
|
||||
if ($r == 0 ){
|
||||
$r=$User->get_privilege($gDossier);
|
||||
if ($r == 'X' ){
|
||||
/* Cannot Access */
|
||||
NoAccess();
|
||||
NoAccess(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,129 +0,0 @@
|
|||
<?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
|
||||
*/
|
||||
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
|
||||
|
||||
/* $Revision$ */
|
||||
|
||||
/*! \file
|
||||
* \brief Main page for encoding in the ledger
|
||||
*/
|
||||
require_once('class_dossier.php');
|
||||
include_once("ac_common.php");
|
||||
include_once("user_menu.php");
|
||||
include_once ("constant.php");
|
||||
include_once ("postgres.php");
|
||||
include_once ("check_priv.php");
|
||||
include_once ("class_widget.php");
|
||||
require_once("jrn.php");
|
||||
echo '<h1> OBSOLETE FILES USER_JRN.PHP</H1>';
|
||||
// Check if dossier set
|
||||
$gDossier=dossier::id();
|
||||
|
||||
$cn=DbConnect($gDossier);
|
||||
include_once ('class_user.php');
|
||||
$User=new User($cn);
|
||||
$User->Check();
|
||||
|
||||
html_page_start($User->theme,
|
||||
"onLoad=\"SetFocus('e_date',0);checkTotal();\" ",
|
||||
"js/compute.js");
|
||||
|
||||
|
||||
/* Get the _REQUEST value for p_jrn (jrn_def.jrn_def_id) and jrn_type (jrn_def.jrn_def_code) */
|
||||
$p_jrn=(isset($_REQUEST['p_jrn']))?$_REQUEST['p_jrn']:-1;
|
||||
$jrn_type=(isset($_REQUEST['jrn_type']))?$_REQUEST['jrn_type']:-1;
|
||||
|
||||
|
||||
echo '<div class="u_tmenu">';
|
||||
|
||||
echo ShowMenuCompta("user_jrn.php?jrn_type=".$jrn_type."&".dossier::get());
|
||||
echo '</div>';
|
||||
|
||||
if ( $User->admin == 0 ) {
|
||||
// check if user can access
|
||||
// Acces Grand livre
|
||||
if ($jrn_type== 'NONE' && check_action($gDossier,$_SESSION['g_user'],ENCJRN) == 0 ){
|
||||
|
||||
/* Cannot Access */
|
||||
NoAccess();
|
||||
}
|
||||
|
||||
if ( $jrn_type != 'NONE' && CheckJrn($gDossier,$_SESSION['g_user'],$p_jrn) == 0 ){
|
||||
|
||||
/* Cannot Access */
|
||||
NoAccess();
|
||||
exit -1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// if a journal is selected show the journal's menu
|
||||
if ( $p_jrn != -1 )
|
||||
{
|
||||
// display jrn's menu
|
||||
|
||||
// echo '</DIV>';
|
||||
echo '<div class="u_subtmenu">';
|
||||
// show the available ledger of the type jrn_type
|
||||
ShowMenuJrnUser($gDossier,$jrn_type,$p_jrn);
|
||||
echo '</div>';
|
||||
echo '<div class="lmenu">';
|
||||
// show the menu for this journal (Nouveau, voir,...)
|
||||
$menu_jrn=ShowMenuJrn($cn,$jrn_type, $p_jrn);
|
||||
echo $menu_jrn;
|
||||
|
||||
echo '</div>';
|
||||
|
||||
|
||||
$g_user=$_SESSION['g_user'];
|
||||
echo JS_AJAX_FICHE;
|
||||
// Execute Action for p_jrn
|
||||
if ( $jrn_type=='VEN' ) require('user_action_ven.php');
|
||||
if ( $jrn_type=='ACH' ) require('user_action_ach.php');
|
||||
if ( $jrn_type=='FIN' ) require('user_action_fin.php');
|
||||
if ( $jrn_type=='ODS' ) require('user_action_ods.php');
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( $jrn_type=='NONE')
|
||||
{
|
||||
include_once('user_action_gl.php');
|
||||
|
||||
} else {
|
||||
// no journal are selected so we select the first one
|
||||
$p_jrn=GetFirstJrnIdForJrnType($gDossier,$jrn_type);
|
||||
// display jrn's menu
|
||||
|
||||
// echo '</DIV>';
|
||||
echo '<div class="u_subtmenu">';
|
||||
ShowMenuJrnUser($gDossier,$jrn_type,$p_jrn);
|
||||
echo '</div>';
|
||||
echo '<div class="lmenu">';
|
||||
$menu_jrn=ShowMenuJrn($cn,$jrn_type, $p_jrn);
|
||||
|
||||
echo $menu_jrn;
|
||||
echo '</div><br>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
html_page_stop();
|
||||
|
||||
?>
|
||||
|
|
@ -68,7 +68,7 @@ if ( isset ($_GET ['p_nom'])) {
|
|||
}
|
||||
|
||||
// If admin show everything otherwise only the available dossier
|
||||
$res=u_ShowDossier($_SESSION['g_user'],$User->admin,$filtre);
|
||||
$res=u_ShowDossier($_SESSION['g_user'],$User->Admin(),$filtre);
|
||||
echo $res;
|
||||
?>
|
||||
<P>
|
||||
|
|
|
|||
|
|
@ -67,16 +67,18 @@ if ( isset ( $_POST['p_size']) ) {
|
|||
}
|
||||
|
||||
// Topmenu
|
||||
// not used for the moment
|
||||
//---------------------------------------------------------------------------
|
||||
// Here we put all the changes
|
||||
//---------------------------------------------------------------------------
|
||||
/*
|
||||
if ( isset ($_POST['val']) ){
|
||||
// Change the top menu
|
||||
$_SESSION['g_topmenu']=$_POST['topmenu'];
|
||||
$User->update_global_pref('TOPMENU',$_POST['topmenu']);
|
||||
$User->update_global_pref('TOPMENU',$_POST['topmenu']);
|
||||
if ( isset ($_POST['minirap'])) $User->set_mini_report($_POST['minirap']);
|
||||
}
|
||||
|
||||
*/
|
||||
// show the top menu depending of the use_style
|
||||
// comta style
|
||||
|
||||
|
|
@ -86,7 +88,7 @@ if ( isset ($_REQUEST['gDossier']) )
|
|||
if ( $_REQUEST['gDossier'] != 0 )
|
||||
{
|
||||
echo '<div class="u_tmenu">';
|
||||
echo menu_tool('pref');
|
||||
echo menu_tool('user_pref.php');
|
||||
echo "</div>";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,280 +0,0 @@
|
|||
<?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
|
||||
*/
|
||||
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
|
||||
|
||||
/* $Revision$ */
|
||||
|
||||
/*! \file
|
||||
* \brief Set the security for an user
|
||||
*/
|
||||
|
||||
include_once ("ac_common.php");
|
||||
include_once("check_priv.php");
|
||||
html_page_start($_SESSION['g_theme']);
|
||||
require_once('class_dossier.php');
|
||||
$gDossier=dossier::id();
|
||||
$str_dossier=dossier::get();
|
||||
|
||||
include_once ("postgres.php");
|
||||
/* Admin. Dossier */
|
||||
$rep=DbConnect();
|
||||
include_once ("class_user.php");
|
||||
$User=new User($rep);
|
||||
$User->Check();
|
||||
|
||||
include_once ("user_menu.php");
|
||||
|
||||
$cn_dossier=DbConnect($gDossier);
|
||||
|
||||
if ( $User->check_action($cn_dossier,GJRN) == 0 ) {
|
||||
/* Cannot Access */
|
||||
NoAccess();
|
||||
exit -1;
|
||||
}
|
||||
echo "<H2 class=\"info\">".dossier::name();
|
||||
echo '<div align="right">
|
||||
<A HREF="login.php" title="Accueil"><INPUT TYPE="IMAGE" width="36" src="image/home.png" ></A>
|
||||
<A HREF="logout.php" title="Sortie"><input type="IMAGE" title="Logout" src="image/logout.png" width="36"></A>
|
||||
</div></h2>';
|
||||
|
||||
|
||||
echo ShowMenuParam("user_sec.php");
|
||||
|
||||
|
||||
$cn=DbConnect();
|
||||
$User=ExecSql($cn,"select use_id,use_first_name,use_name,use_login from ac_users natural join jnt_use_dos where use_login != 'phpcompta' and dos_id=".$gDossier);
|
||||
$MaxUser=pg_NumRows($User);
|
||||
|
||||
|
||||
echo '<DIV >';
|
||||
|
||||
echo '<TABLE CELLSPACING="20" ALIGN="CENTER">';
|
||||
for ($i = 0;$i < $MaxUser;$i++) {
|
||||
$l_line=pg_fetch_array($User,$i);
|
||||
// echo '<TR>';
|
||||
if ( $i % 3 == 0 && $i != 0)
|
||||
echo "</TR><TR>";
|
||||
|
||||
printf ('<TD><A href="user_sec.php?action=view&user_id=%s&'.$str_dossier.'">%s %s ( %s )</A></TD>',
|
||||
$l_line['use_id'],
|
||||
$l_line['use_first_name'],
|
||||
$l_line['use_name'],
|
||||
$l_line['use_login'] );
|
||||
|
||||
}
|
||||
echo "</TR>";
|
||||
echo '</TABLE>';
|
||||
$action="";
|
||||
|
||||
if ( isset ($_GET["action"] )) {
|
||||
$action=$_GET["action"];
|
||||
|
||||
}
|
||||
|
||||
// session_register set to off, so variable are undefined
|
||||
foreach ($_GET as $name=>$value)
|
||||
${"$name"}=$value;
|
||||
|
||||
if ( $action == "change_jrn" ) {
|
||||
// Check if the user can access that folder
|
||||
if ( CheckDossier($_GET['login'],$gDossier) == 0 ) {
|
||||
echo "<H2 class=\"error\">Cet utilisateur ne peut pas accéder ce dossier</H2>";
|
||||
$action="";
|
||||
return;
|
||||
}
|
||||
$login=$_GET['login'];
|
||||
$jrn=$_GET['jrn'];
|
||||
$access=$_GET['access'];
|
||||
$l_Db=sprintf("dossier%d",$gDossier);
|
||||
echo_debug('user_sec.php',__LINE__,"select * from user_sec_jrn where uj_login='$login' and uj_jrn_id=$jrn");
|
||||
$cn_dossier=DbConnect($gDossier);
|
||||
$l2_Res=ExecSql($cn_dossier,
|
||||
"select * from user_sec_jrn where uj_login='$login' and uj_jrn_id=$jrn");
|
||||
$l2_count=pg_NumRows($l2_Res);
|
||||
if ( $l2_count == 1 ) {
|
||||
$Res=ExecSql($cn_dossier,"update user_sec_jrn set uj_priv='$access' where uj_login='$login' and uj_jrn_id=$jrn");
|
||||
} else {
|
||||
$Res=ExecSql($cn_dossier,"insert into user_sec_jrn(uj_login,uj_jrn_id,uj_priv) values( '$login' ,$jrn,'$access')");
|
||||
}
|
||||
|
||||
$action="view";
|
||||
}
|
||||
if ( $action == "change_act" ) {
|
||||
// Check if the user can access that folder
|
||||
if ( CheckDossier($_GET['login'],$gDossier) == 0 ) {
|
||||
echo "<H2 class=\"error\">he cannot access this folder</H2>";
|
||||
$action="";
|
||||
return;
|
||||
}
|
||||
$l_Db=sprintf("dossier%d",$gDossier);
|
||||
$cn_dossier=DbConnect($gDossier);
|
||||
if ( $_GET['access']==0) {
|
||||
echo_debug('user_sec.php',__LINE__,"delete right");
|
||||
$Res=ExecSql($cn_dossier,
|
||||
"delete from user_sec_act where ua_login='".$_GET['login']."' and ua_act_id=$act");
|
||||
} else {
|
||||
echo_debug('user_sec.php',__LINE__,"insert right");
|
||||
if ( CountSql($cn_dossier,"select * from user_sec_act where ua_login='$login' and ua_act_id=$act") < 1 )
|
||||
{
|
||||
$Res=ExecSql($cn_dossier,
|
||||
"insert into user_sec_act(ua_login,ua_act_id) values( '$login' ,$act)");
|
||||
}
|
||||
}
|
||||
$action="view";
|
||||
}
|
||||
// Action == View detail for users
|
||||
if ( $action == "view" ) {
|
||||
$l_Db=sprintf("dossier%d",$gDossier);
|
||||
$cn_dossier=DbConnect($gDossier);
|
||||
$cn=DbConnect();
|
||||
$User=ExecSql($cn,
|
||||
"select use_id,use_first_name,use_name,use_login
|
||||
from ac_users where use_id=".$_GET['user_id']);
|
||||
$MaxUser=pg_NumRows($User);
|
||||
if ( $MaxUser == 0 ) return;
|
||||
$l2_line=pg_fetch_array($User,0);
|
||||
|
||||
printf ('<H2 class="info"> Détail utilisateur %s %s (%s) </H2>',
|
||||
$l2_line['use_first_name'],
|
||||
$l2_line['use_name'],
|
||||
$l2_line['use_login']);
|
||||
// Check if the user can access that folder
|
||||
if ( CheckDossier($l2_line['use_login'],$gDossier) == 0 ) {
|
||||
echo "<H2 class=\"error\">he cannot access this folder</H2>";
|
||||
$action="";
|
||||
return;
|
||||
}
|
||||
// Print button
|
||||
printf ('<TD><A href="sec_pdf.php?user_id=%s&'.$str_dossier.'">Imprime</A></TD>',
|
||||
$l2_line['use_id']
|
||||
);
|
||||
|
||||
// Show access for journal
|
||||
$Res=ExecSql($cn_dossier,"select jrn_def_id,jrn_def_name from jrn_def ");
|
||||
$admin=CheckIsAdmin($l2_line['use_login']);
|
||||
|
||||
echo '<table align="CENTER" width="100%">';
|
||||
$MaxJrn=pg_NumRows($Res);
|
||||
for ( $i =0 ; $i < $MaxJrn; $i++ ) {
|
||||
$l_line=pg_fetch_array($Res,$i);
|
||||
echo '<TR> ';
|
||||
if ( $i == 0 ) echo '<TD> <B> Journal </B> </TD>';else echo "<TD></TD>";
|
||||
echo "<TD> $l_line[jrn_def_name] </TD>";
|
||||
|
||||
$l_change="action=change_jrn&jrn=$l_line[jrn_def_id]&login=$l2_line[use_login]&user_id=$l2_line[use_id]";
|
||||
|
||||
if ( $admin == 0) {
|
||||
$right= CheckJrn($gDossier,$l2_line['use_login'],$l_line['jrn_def_id'] );
|
||||
echo_debug('user_sec.php',__LINE__,"Privilege is $right");
|
||||
} else $right = 3;
|
||||
if ( $right == 0 ) {
|
||||
echo "<TD BGCOLOR=RED>";
|
||||
echo "Pas d'accès";
|
||||
echo "</TD>";
|
||||
echo '<TD class="mtitle"> <A CLASS="mtitle" HREF="user_sec.php?'.$l_change.'&access=R&'.$str_dossier.'"> Lecture</A></TD>';
|
||||
echo '<TD class="mtitle"> <A CLASS="mtitle" HREF="user_sec.php?'.$l_change.'&access=W&'.$str_dossier.'"> Ecriture</A></TD>';
|
||||
|
||||
}
|
||||
if ( $right == 1 ) {
|
||||
echo '<TD class="mtitle"> <A CLASS="mtitle" HREF="user_sec.php?'.$l_change.'&access=X&'.$str_dossier.'"> Pas d\'accès</A></TD>';
|
||||
echo "<TD BGCOLOR=\"#3BCD27\">";
|
||||
echo "Lecture ";
|
||||
echo "</TD>";
|
||||
echo '<TD class="mtitle"> <A CLASS="mtitle" HREF="user_sec.php?'.$l_change.'&access=W&'.$str_dossier.'"> Ecriture</A></TD>';
|
||||
}
|
||||
if ( $right == 2 ) {
|
||||
echo '<TD class="mtitle"> <A CLASS="mtitle" HREF="user_sec.php?'.$l_change.'&access=X&'.$str_dossier.'"> Pas d\'accès</A></TD>';
|
||||
echo '<TD class="mtitle"> <A CLASS="mtitle" HREF="user_sec.php?'.$l_change.'&access=R&'.$str_dossier.'"> Lecture</A></TD>';
|
||||
|
||||
echo "<TD BGCOLOR=\"#3BCD27\">";
|
||||
echo "Ecriture ";
|
||||
echo "</TD>";
|
||||
|
||||
}
|
||||
if ( $right == 3 ) {
|
||||
echo '<TD class="mtitle"> Pas d\'accès</TD>';
|
||||
echo '<TD class="mtitle"> Lecture </TD>';
|
||||
|
||||
echo "<TD BGCOLOR=\"#3BCD27\">";
|
||||
echo "Ecriture ";
|
||||
echo "</TD>";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
echo '</TR>';
|
||||
}
|
||||
|
||||
// Priv. for actions
|
||||
$Res=ExecSql($cn_dossier,
|
||||
"select ac_id, ac_description from action order by ac_id ");
|
||||
|
||||
$MaxJrn=pg_NumRows($Res);
|
||||
|
||||
for ( $i =0 ; $i < $MaxJrn; $i++ ) {
|
||||
$l_line=pg_fetch_array($Res,$i);
|
||||
echo '<TR> ';
|
||||
if ( $i == 0 ) echo '<TD> <B> Action <B></TD>';
|
||||
if ($i != 0 && $l_line['ac_id'] != 50) echo "<TD></TD>";
|
||||
if ( $l_line['ac_id'] == 50 )
|
||||
echo '<TD colspan="3"> <B> Compta. Analytique <B></TD><tr><td></td>';
|
||||
|
||||
echo "<TD>". $l_line['ac_description']." </TD>";
|
||||
|
||||
$l_change="action=change_act&act=".$l_line['ac_id']."&login=".$l2_line['use_login']."&user_id=".$l2_line['use_id'];
|
||||
if ( $admin ==0 ) {
|
||||
$right=check_action($gDossier,$l2_line['use_login'],$l_line['ac_id']);
|
||||
} else {
|
||||
$right = 2;
|
||||
}
|
||||
if ( $right == 0 ) {
|
||||
echo "<TD BGCOLOR=RED>";
|
||||
echo "Pas d'accès";
|
||||
echo "</TD>";
|
||||
$l_change=$l_change."&access=1";
|
||||
echo '<TD class="mtitle"> <A CLASS="mtitle" HREF="user_sec.php?'.$l_change.'&'.$str_dossier.'"> Accès </A></TD>';
|
||||
}
|
||||
if ( $right == 1) {
|
||||
$l_change=$l_change."&access=0";
|
||||
echo '<TD class="mtitle"> <A CLASS="mtitle" HREF="user_sec.php?'.$l_change.'&'.$str_dossier.'"> Pas d\'accès </A></TD>';
|
||||
echo "<TD BGCOLOR=\"#3BCD27\">";
|
||||
echo "Accès ";
|
||||
echo "</TD>";
|
||||
|
||||
}
|
||||
if ( $right == 2) {
|
||||
|
||||
echo '<TD class="mtitle"> Change </TD>';
|
||||
echo "<TD BGCOLOR=\"#3BCD27\">";
|
||||
echo "Accès ";
|
||||
echo "</TD>";
|
||||
|
||||
}
|
||||
|
||||
|
||||
echo '</TR>';
|
||||
}
|
||||
|
||||
echo '</TABLE>';
|
||||
|
||||
}
|
||||
echo "</DIV>";
|
||||
html_page_stop();
|
||||
?>
|
||||
|
|
@ -31,7 +31,8 @@ require_once ("postgres.php");
|
|||
the string to be diplayed must be protected
|
||||
*/
|
||||
function h($p_string) { return htmlspecialchars($p_string);}
|
||||
|
||||
function hi($p_string) { return '<i>'.htmlspecialchars($p_string).'</i>';}
|
||||
function hb($p_string) { return '<b>'.htmlspecialchars($p_string).'</b>';}
|
||||
/*!
|
||||
* \brief log error into the /tmp/phpcompta_error.log it doesn't work on windows
|
||||
*
|
||||
|
|
@ -270,7 +271,7 @@ function html_button_logout() {
|
|||
*/
|
||||
|
||||
|
||||
function NoAccess($js=0)
|
||||
function NoAccess($js=1)
|
||||
{
|
||||
if ( $js == 1 )
|
||||
{
|
||||
|
|
@ -290,7 +291,6 @@ function NoAccess($js=0)
|
|||
* \brief Fix the problem with the quote char for the database
|
||||
*
|
||||
* \param $p_string
|
||||
* \todo replace par pg_escape_string !!!
|
||||
* \return a string which won't let strange char for the database
|
||||
*/
|
||||
function FormatString($p_string)
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
/*! \file
|
||||
* \brief Page who manage the different action (meeting, letter)
|
||||
*/
|
||||
$User->can_request($cn,SEC_ACTION);
|
||||
$User->can_request(GECOUR);
|
||||
|
||||
//-----------------------------------------------------
|
||||
// Action
|
||||
|
|
|
|||
|
|
@ -30,7 +30,9 @@ include_once ("ac_common.php");
|
|||
include_once("preference.php");
|
||||
include_once ("class_widget.php");
|
||||
include_once("class_acc_balance.php");
|
||||
$User->can_request($cn,BALANCE);
|
||||
require_once('class_acc_ledger.php');
|
||||
|
||||
$User->can_request(IMPBAL);
|
||||
|
||||
|
||||
echo '<div class="content">';
|
||||
|
|
@ -56,9 +58,11 @@ if ( isset ($_POST['to_periode']) )
|
|||
|
||||
echo $w->IOValue('to_periode',$periode_end);
|
||||
//-------------------------------------------------
|
||||
$journal=new widget("select");
|
||||
$l=new Acc_Ledger($cn,0);
|
||||
$journal=$l->select_ledger('ALL',3);
|
||||
$journal->name="p_jrn";
|
||||
$journal->value=make_array($cn,"select jrn_def_id as value, jrn_def_name as label from jrn_Def",1);
|
||||
|
||||
|
||||
if ( isset($_POST['p_jrn'])) $journal->selected=$_POST['p_jrn'];
|
||||
echo JS_SEARCH_POSTE;
|
||||
echo "Journal = ".$journal->IOValue();
|
||||
|
|
|
|||
|
|
@ -1,366 +0,0 @@
|
|||
<?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
|
||||
require_once('class_acc_ledger.php');
|
||||
require_once('user_form_fin.php');
|
||||
require_once('jrn.php');
|
||||
require_once('class_widget.php');
|
||||
require_once("class_document.php");
|
||||
require_once("class_fiche.php");
|
||||
require_once("class_acc_parm_code.php");
|
||||
require_once("check_priv.php");
|
||||
require_once ('class_pre_op_fin.php');
|
||||
|
||||
/*!\file
|
||||
* \brief the purpose off this file encode expense and to record them
|
||||
*
|
||||
*/
|
||||
echo JS_PROTOTYPE;
|
||||
|
||||
// First we show the menu
|
||||
// If nothing is asked the propose a blank form
|
||||
// to enter a new invoice
|
||||
if ( ! isset ($_REQUEST['p_jrn'])) {
|
||||
// no journal are selected so we select the first one
|
||||
$p_jrn=GetFirstJrnIdForJrnType($gDossier,'FIN');
|
||||
|
||||
} else
|
||||
{
|
||||
$p_jrn=$_REQUEST['p_jrn'];
|
||||
}
|
||||
|
||||
if ( CheckJrn($gDossier,$_SESSION['g_user'],$p_jrn) < 1 ) {
|
||||
NoAccess();
|
||||
exit -1;
|
||||
}
|
||||
|
||||
// for the back button
|
||||
$retour="";
|
||||
$h_url="";
|
||||
|
||||
if ( isset ($_REQUEST['url']))
|
||||
{
|
||||
$retour=widget::button_href('Retour',urldecode($_REQUEST['url']));
|
||||
$h_url=sprintf('<input type="hidden" name="url" value="%s">',urldecode($_REQUEST['url']));
|
||||
}
|
||||
|
||||
$sub_action=(isset($_REQUEST['sa']))?$_REQUEST['sa']:"";
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// ask the saldo of the bank
|
||||
if ( $sub_action == "solde" )
|
||||
{
|
||||
// Check privilege
|
||||
if ( CheckJrn($gDossier,$_SESSION['g_user'],$p_jrn) < 1 ) {
|
||||
NoAccess();
|
||||
exit -1;
|
||||
}
|
||||
echo '<div class="u_subtmenu">';
|
||||
|
||||
echo ShowMenuJrnUser($gDossier,'FIN',0,'<td class="mtitle"><A class="mtitle" HREF="commercial.php?liste&'.dossier::get().'&p_action=bank&sa=list">Liste</A></td>'.
|
||||
'<td class="selectedcell">Solde</td>');
|
||||
echo '</div>';
|
||||
require_once("poste.php");
|
||||
// find the bank account
|
||||
// NOTE : those values are in a table because
|
||||
// they are _national_ parameters
|
||||
$banque=new Acc_Parm_Code($cn,'BANQUE');
|
||||
$caisse=new Acc_Parm_Code($cn,'CAISSE');
|
||||
$vir_interne=new Acc_Parm_Code($cn,'VIREMENT_INTERNE');
|
||||
$accountSql="select distinct pcm_val::text,pcm_lib from
|
||||
tmp_pcmn
|
||||
where pcm_val::text like '".$banque->p_value."%' or pcm_val::text like '".$vir_interne->p_value."%'
|
||||
or pcm_val::text like '".$caisse->p_value."%'
|
||||
order by pcm_val::text";
|
||||
$ResAccount=ExecSql($cn,$accountSql);
|
||||
echo '<div class="content">';
|
||||
|
||||
echo "<table>";
|
||||
// Filter the saldo
|
||||
// on the current year
|
||||
$filter_year=" and j_tech_per in (select p_id from parm_periode where p_exercice='".$User->get_exercice()."')";
|
||||
|
||||
// for each account
|
||||
for ( $i = 0; $i < pg_NumRows($ResAccount);$i++) {
|
||||
// get the saldo
|
||||
$l=pg_fetch_array($ResAccount,$i);
|
||||
$m=get_solde($cn,$l['pcm_val'],$filter_year);
|
||||
// print the result if the saldo is not equal to 0
|
||||
if ( $m != 0.0 ) {
|
||||
echo "<tr>";
|
||||
echo "<TD>".
|
||||
$l['pcm_val'].
|
||||
"</TD>".
|
||||
"<TD>".
|
||||
$l['pcm_lib'].
|
||||
"</TD>"."<TD>".
|
||||
$m.
|
||||
"</TD>"."</TR>";
|
||||
}
|
||||
}// for
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
exit();
|
||||
}
|
||||
//-----------------------------------------------------
|
||||
// If a list of depense is asked
|
||||
//
|
||||
if ( $sub_action == "list")
|
||||
{
|
||||
// show the menu with the list item selected
|
||||
echo '<div class="u_subtmenu">';
|
||||
echo ShowMenuJrnUser($gDossier,'FIN',0,'<td class="selectedcell">Liste</td>'.
|
||||
'<td class="mtitle"><A class="mtitle" HREF="commercial.php?liste&p_action=bank&sa=solde&'.dossier::get().'">Solde</A></td>');
|
||||
echo '</div>';
|
||||
|
||||
echo '<div class="content">';
|
||||
|
||||
|
||||
echo '<form>';
|
||||
echo dossier::hidden();
|
||||
$hid=new widget("hidden");
|
||||
|
||||
$hid->name="p_action";
|
||||
$hid->value="bank";
|
||||
echo $hid->IOValue();
|
||||
|
||||
|
||||
$hid->name="sa";
|
||||
$hid->value="list";
|
||||
echo $hid->IOValue();
|
||||
|
||||
|
||||
|
||||
$w=new widget("select");
|
||||
// filter on the current year
|
||||
$filter_year=" where p_exercice='".$User->get_exercice()."'";
|
||||
|
||||
$periode_start=make_array($cn,"select p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode $filter_year order by p_start,p_end",1);
|
||||
// User is already set User=new User($cn);
|
||||
$current=(isset($_GET['p_periode']))?$_GET['p_periode']:$User->get_periode();
|
||||
$w->selected=$current;
|
||||
|
||||
echo 'Période '.$w->IOValue("p_periode",$periode_start);
|
||||
$qcode=(isset($_GET['qcode']))?$_GET['qcode']:"";
|
||||
echo JS_SEARCH_CARD;
|
||||
$w=new widget('js_search_only');
|
||||
$w->name='qcode';
|
||||
$w->value=$qcode;
|
||||
$w->label='';
|
||||
$w->extra='4';
|
||||
$sp= new widget("span");
|
||||
echo $sp->IOValue("qcode_label",$qcode)."</TD></TR>";
|
||||
echo $w->IOValue();
|
||||
echo widget::submit('gl_submit','Rechercher');
|
||||
echo '</form>';
|
||||
echo $retour;
|
||||
// Show list of sell
|
||||
// Date - date of payment - Customer - amount
|
||||
if ( $current != -1 )
|
||||
{
|
||||
$filter_per=" and jr_tech_per=".$current;
|
||||
}
|
||||
else
|
||||
{
|
||||
$filter_per=" and jr_tech_per in (select p_id from parm_periode where p_exercice=".
|
||||
$User->get_exercice().")";
|
||||
}
|
||||
/* security */
|
||||
$available_ledger=" and ".$User->get_ledger_sql();
|
||||
|
||||
// Show list of sell
|
||||
// Date - date of payment - Customer - amount
|
||||
$sql=SQL_LIST_ALL_INVOICE.$filter_per." and jr_def_type='FIN'".
|
||||
" $available_ledger" ;
|
||||
$step=$_SESSION['g_pagesize'];
|
||||
$page=(isset($_GET['offset']))?$_GET['page']:1;
|
||||
$offset=(isset($_GET['offset']))?$_GET['offset']:0;
|
||||
|
||||
$l="";
|
||||
// check if qcode contains something
|
||||
if ( $qcode != "" )
|
||||
{
|
||||
// add a condition to filter on the quick code
|
||||
$l=" and jr_grpt_id in (select j_grpt from jrnx where j_qcode='$qcode') ";
|
||||
}
|
||||
|
||||
list($max_line,$list)=ListJrn($cn,0,"where jrn_def_type='FIN' $filter_per $l $available_ledger "
|
||||
,null,$offset,0);
|
||||
$bar=jrn_navigation_bar($offset,$max_line,$step,$page);
|
||||
|
||||
echo "<hr> $bar";
|
||||
echo $list;
|
||||
echo "$bar <hr>";
|
||||
echo $retour;
|
||||
|
||||
echo '</div>';
|
||||
|
||||
exit();
|
||||
}
|
||||
//-----------------------------------------------------
|
||||
echo '<div class="u_subtmenu">';
|
||||
echo ShowMenuJrnUser($gDossier,'FIN',$p_jrn,
|
||||
'<td class="mtitle"><A class="mtitle" HREF="commercial.php?liste&p_action=bank&sa=list&'.dossier::get().'">Liste</A></td>'.
|
||||
'<td class="mtitle"><A class="mtitle" HREF="commercial.php?liste&p_action=bank&sa=solde&'.dossier::get().'">Solde</A></td>');
|
||||
echo '</div>';
|
||||
//--------------------------------------------------------------------------------
|
||||
// use a predefined operation
|
||||
//--------------------------------------------------------------------------------
|
||||
if ( $sub_action=="use_opd" ) {
|
||||
$op=new Pre_op_fin($cn);
|
||||
$op->set_od_id($_REQUEST['pre_def']);
|
||||
$p_post=$op->compute_array();
|
||||
echo_debug(__FILE__.':'.__LINE__.'- ','p_post = ',$p_post);
|
||||
// submit button in the form
|
||||
$submit='<INPUT TYPE="SUBMIT" NAME="add_item" VALUE="Ajout article">'.
|
||||
'<INPUT TYPE="SUBMIT" NAME="view_invoice" VALUE="Enregistrer">';
|
||||
|
||||
$form=FormFin($cn,$_GET['p_jrn'],$User->get_periode(),$submit,$p_post,false,$p_post['nb_item']);
|
||||
echo '<div class="content">';
|
||||
echo $form;
|
||||
echo '</div>';
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------
|
||||
// if we request to add an item
|
||||
// the $_POST['add_item'] is set
|
||||
// or if we ask to correct the invoice
|
||||
if ( isset ($_POST['add_item']) || isset ($_POST['correct']) )
|
||||
{
|
||||
if ( CheckJrn($gDossier,$_SESSION['g_user'],$p_jrn) != 2 ) {
|
||||
NoAccess();
|
||||
exit -1;
|
||||
}
|
||||
|
||||
$nb_item=$_POST['nb_item'];
|
||||
if ( isset ($_POST['add_item']))
|
||||
$nb_item++;
|
||||
// Submit button in the form
|
||||
$submit='<INPUT TYPE="SUBMIT" NAME="add_item" VALUE="Ajout article">
|
||||
<INPUT TYPE="SUBMIT" NAME="view_invoice" VALUE="Enregistrer" ID="SubmitButton">';
|
||||
$form=FormFin($cn,$p_jrn,$User->get_periode(),$submit,$_POST,false, $nb_item);
|
||||
//$form=FormFin($cn,$p_jrn,$User->get_periode(),$submit,$_POST,false, $nb_number);
|
||||
|
||||
echo '<div class="content">';
|
||||
echo $form;
|
||||
echo JS_CALC_LINE;
|
||||
echo '</div>';
|
||||
exit();
|
||||
}
|
||||
//-----------------------------------------------------
|
||||
// Save : record
|
||||
//
|
||||
if ( isset($_POST['save']))
|
||||
{
|
||||
if ( CheckJrn($gDossier,$_SESSION['g_user'],$p_jrn) != 2 ) {
|
||||
NoAccess();
|
||||
exit -1;
|
||||
}
|
||||
|
||||
// we save the expense
|
||||
$r=RecordFin($cn,$_POST,$User,$p_jrn);
|
||||
$nb_number=$_POST['nb_item'];
|
||||
|
||||
$submit='<h2 class="info"> Opération '.$r.' enregistré</h2>';
|
||||
|
||||
$form=FormFin($cn,$p_jrn,$User->get_periode(),$submit,$_POST,true,$nb_number,true);
|
||||
|
||||
echo '<div class="content">';
|
||||
echo $form;
|
||||
echo '<hr>';
|
||||
echo '</form>';
|
||||
echo '<A href="commercial.php?p_action=bank&p_jrn='.$p_jrn.'&'.dossier::get().'">
|
||||
<input type="button" Value="Nouveau"></A>';
|
||||
exit();
|
||||
}
|
||||
//-----------------------------------------------------
|
||||
// we show the confirmation screen
|
||||
//
|
||||
if ( isset ($_POST['view_invoice']) )
|
||||
{
|
||||
if ( CheckJrn($gDossier,$_SESSION['g_user'],$p_jrn) != 2 ) {
|
||||
NoAccess();
|
||||
exit -1;
|
||||
}
|
||||
|
||||
$nb_number=$_POST["nb_item"];
|
||||
$submit='<INPUT TYPE="SUBMIT" name="save" value="Confirmer">';
|
||||
$submit.='<INPUT TYPE="SUBMIT" name="correct" value="Corriger">';
|
||||
if ( form_verify_input ($cn,$p_jrn,$User->get_periode(),$_POST,$nb_number) != null ) {
|
||||
// Should use a read only view instead of FormFin
|
||||
// where we can check
|
||||
$form=FormFin($cn,$p_jrn,$User->get_periode(),$submit,$_POST,true, $nb_number,false);
|
||||
} else {
|
||||
// if something goes wrong, correct it
|
||||
$submit='<INPUT TYPE="SUBMIT" NAME="add_item" VALUE="Ajout article">
|
||||
<INPUT TYPE="SUBMIT" NAME="view_invoice" VALUE="Enregistrer">';
|
||||
$form=FormFin($cn,$p_jrn,$User->get_periode(),$submit,$_POST,false, $nb_number);
|
||||
|
||||
}
|
||||
|
||||
echo '<div class="u_redcontent">';
|
||||
echo $form;
|
||||
echo '</div>';
|
||||
exit();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------
|
||||
// By default we add a new invoice
|
||||
if ( $p_jrn != -1 )
|
||||
{
|
||||
if ( CheckJrn($gDossier,$_SESSION['g_user'],$p_jrn) != 2 ) {
|
||||
exit -1;
|
||||
}
|
||||
|
||||
$jrn=new Acc_Ledger($cn, $p_jrn);
|
||||
echo_debug('depense.inc.php',__LINE__,"Blank form");
|
||||
// Submit button in the form
|
||||
$submit='<INPUT TYPE="SUBMIT" NAME="add_item" VALUE="Ajout article">
|
||||
<INPUT TYPE="SUBMIT" NAME="view_invoice" VALUE="Enregistrer" ID="SubmitButton">';
|
||||
// Show an empty form of invoice
|
||||
$form=FormFin($cn,$p_jrn,$User->get_periode(),$submit,null,false,$jrn->GetDefLine('deb'));
|
||||
echo '<div class="content">';
|
||||
echo $form;
|
||||
echo '<form method="GET">';
|
||||
$op=new Pre_operation($cn);
|
||||
$op->p_jrn=$p_jrn;
|
||||
$op->od_direct='f';
|
||||
|
||||
$hid=new widget("hidden");
|
||||
echo $hid->IOValue("p_action","bank");
|
||||
echo $hid->IOValue("sa","use_opd");
|
||||
echo dossier::hidden();
|
||||
echo $hid->IOValue("p_jrn",$p_jrn);
|
||||
echo $hid->IOValue("jrn_type","FIN");
|
||||
|
||||
if ($op->count() != 0 )
|
||||
echo widget::submit('use_opd','Utilisez une op.prédéfinie');
|
||||
echo $op->show_button();
|
||||
|
||||
echo '</form>';
|
||||
|
||||
echo JS_CALC_LINE;
|
||||
echo '</div>';
|
||||
}
|
||||
|
|
@ -31,7 +31,7 @@ $gDossier=dossier::id();
|
|||
|
||||
include_once ("postgres.php");
|
||||
/* Admin. Dossier */
|
||||
$rep=DbConnect();
|
||||
$rep=DbConnect(dossier::id());
|
||||
include_once ("class_user.php");
|
||||
$User=new User($rep);
|
||||
$User->Check();
|
||||
|
|
@ -44,7 +44,7 @@ $cn=DbConnect($gDossier);
|
|||
include_once("central_inc.php");
|
||||
|
||||
|
||||
$User->can_request($cn,CENTRALIZE);
|
||||
$User->can_request(PARCENT,1);
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -93,22 +93,10 @@ function CheckJrn($p_dossier,$p_user,$p_jrn,$p_detail=False)
|
|||
$Def=pg_fetch_array($Res,0);
|
||||
|
||||
// Si les droits par défaut == NO, alors user n'a pas accès au dossier
|
||||
if ( $Def['priv_priv'] == "NO" ) return 0;
|
||||
if ( $Def['priv_priv'] == "NO" || $Def['priv_priv']=='X') return 0;
|
||||
|
||||
if ( $Def['priv_priv'] == "W") {
|
||||
// Si droit pas défaut == écriture
|
||||
if ( $PrivJrn == 0 ) {
|
||||
// Pas de droit spécifique sur jrn => droit par défaut = W
|
||||
return 2;
|
||||
}
|
||||
$Priv=pg_fetch_array($Res2,0);
|
||||
|
||||
if ( $Priv['uj_priv'] == "X" ) return 0;
|
||||
if ( $Priv['uj_priv'] == "R" ) return 1;
|
||||
if ( $Priv['uj_priv'] == "W" ) return 2;
|
||||
echo '<H2 class="error"> Undefined right</H2>';
|
||||
echo_debug ("Droit Journal $Priv[uj_priv]");
|
||||
return 0;
|
||||
if ( $Def['priv_priv'] == "L") {
|
||||
return 2;
|
||||
}
|
||||
if ( $Def['priv_priv'] == "R") {
|
||||
// Si droit pas défaut == Lire
|
||||
|
|
@ -122,10 +110,13 @@ function CheckJrn($p_dossier,$p_user,$p_jrn,$p_detail=False)
|
|||
if ( $Priv['uj_priv'] == "R" ) return 1;
|
||||
if ( $Priv['uj_priv'] == "W" ) return 2;
|
||||
echo_debug ("Droit Journal $Priv[uj_priv]");
|
||||
echo '<H2 class="error"> Undefined right</H2>';
|
||||
echo '<H2 class="error"> Undefined right '.$Priv['uj_priv'].' </H2>';
|
||||
|
||||
return 0;
|
||||
}
|
||||
echo '<H2 class="error"> Undefined default right</H2>';
|
||||
|
||||
|
||||
echo '<H2 class="error"> Undefined default right default</H2>';
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
|
@ -147,8 +138,14 @@ function CheckJrn($p_dossier,$p_user,$p_jrn,$p_detail=False)
|
|||
function check_action ( $p_dossier,$p_login,$p_action_id)
|
||||
{
|
||||
if ( CheckIsAdmin ($p_login) ) return 1;
|
||||
// if( is_local_admin($p_login,$p_dossier)) return 1;
|
||||
|
||||
|
||||
$cn=DbConnect($p_dossier);
|
||||
$Res=ExecSql($cn,"select * from user_sec_act where ua_login='$p_login' and ua_act_id=$p_action_id");
|
||||
|
||||
/* check if user is a local admin */
|
||||
$a="select * from user_sec_act where ua_login='$p_login' and ua_act_id=$p_action_id";
|
||||
$Res=ExecSql($cn,$a);
|
||||
$Count=pg_NumRows($Res);
|
||||
if ( $Count == 0 ) return 0;
|
||||
if ( $Count == 1 ) return 1;
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ class Acc_Account_Ledger {
|
|||
"case when j_debit='t' then j_montant else 0 end as deb_montant,".
|
||||
"case when j_debit='f' then j_montant else 0 end as cred_montant,".
|
||||
" jr_comment as description,jrn_def_name as jrn_name,".
|
||||
"j_debit, jr_internal ".
|
||||
"j_debit, jr_internal,jr_pj_number ".
|
||||
" from jrnx left join jrn_def on jrn_def_id=j_jrn_def ".
|
||||
" left join jrn on jr_grpt_id=j_grpt".
|
||||
" where j_poste=".$this->id." and ".$periode.
|
||||
|
|
@ -252,7 +252,7 @@ function get_solde_detail($p_cond="") {
|
|||
echo "<TR>".
|
||||
"<TD>".$op['jr_internal']."</TD>".
|
||||
"<TD>".$op['j_date']."</TD>".
|
||||
"<TD>".h($op['description'])."</TD>".
|
||||
"<TD>".h($op['description']).' '.h($op['jr_pj_number'])."</TD>".
|
||||
"<TD>".$op['deb_montant']."</TD>".
|
||||
"<TD>".$op['cred_montant']."</TD>".
|
||||
"</TR>";
|
||||
|
|
|
|||
|
|
@ -25,7 +25,9 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* @brief this class aims to compute the
|
||||
* @brief this class aims to compute different amount
|
||||
*
|
||||
* This class compute without decimal error the following amount
|
||||
* - vat
|
||||
* - amount without vat
|
||||
* - no deductible vat
|
||||
|
|
@ -320,4 +322,4 @@ class Acc_Compute {
|
|||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ require_once ('class_periode.php');
|
|||
require_once ('class_gestion_purchase.php');
|
||||
require_once ('class_acc_account.php');
|
||||
require_once('ac_common.php');
|
||||
|
||||
/*!\file
|
||||
* \brief Class for jrn, class acc_ledger for manipulating the ledger
|
||||
*/
|
||||
|
|
@ -58,6 +57,13 @@ class Acc_Ledger {
|
|||
$this->row=null;
|
||||
$this->nb=10;
|
||||
}
|
||||
function get_last_pj() {
|
||||
if ( exist_sequence($this->db,"s_jrn_pj".$this->id) )
|
||||
return getDbValue($this->db,"select last_value from s_jrn_pj".$this->id);
|
||||
else
|
||||
create_sequence($this->db,"s_jrn_pj".$this->id);
|
||||
return 0;
|
||||
}
|
||||
/*!
|
||||
* \brief Return the type of a ledger (ACH,VEN,ODS or FIN) or GL
|
||||
*
|
||||
|
|
@ -108,9 +114,6 @@ class Acc_Ledger {
|
|||
* \param $p_cent (on or off)
|
||||
* \param p_limit starting line
|
||||
* \param p_offset number of lines
|
||||
*
|
||||
* gen :
|
||||
* - none
|
||||
* \return Array with the asked data
|
||||
*
|
||||
*/
|
||||
|
|
@ -135,7 +138,7 @@ class Acc_Ledger {
|
|||
case j_debit when 'f' then j_montant::text else ' ' end as cred_montant,
|
||||
j_debit as debit,j_poste as poste,jr_montant , ".
|
||||
"coalesce(j_text,pcm_lib) as description,j_grpt as grp,
|
||||
jr_comment||' ('||jr_internal||')' as jr_comment ,
|
||||
jr_comment||' ('||jr_internal||')'||case when jr_pj_number is not null and jr_pj_number !='' then jr_pj_number else '' end as jr_comment,
|
||||
j_qcode,
|
||||
jr_rapt as oc, j_tech_per as periode
|
||||
from jrnx left join jrn on ".
|
||||
|
|
@ -157,7 +160,7 @@ class Acc_Ledger {
|
|||
c_poste as poste,
|
||||
coalesce(j_text,pcm_lib) as description,
|
||||
j_qcode,
|
||||
jr_comment||' ('||c_internal||')' as jr_comment,
|
||||
jr_comment||' ('||c_internal||')'||case when jr_pj_number is not null and jr_pj_number !='' then 'pj:'||coalesce(jr_pj_number,'-') else '' end as jr_comment,
|
||||
jr_montant,
|
||||
c_grp as grp,
|
||||
c_comment as comment,
|
||||
|
|
@ -185,7 +188,7 @@ class Acc_Ledger {
|
|||
case j_debit when 'f' then j_montant::text else ' ' end as cred_montant,
|
||||
j_debit as debit,j_poste as poste,".
|
||||
"coalesce(j_text,pcm_lib) as description,j_grpt as grp,
|
||||
jr_comment||' ('||jr_internal||')' as jr_comment,
|
||||
jr_comment||' ('||jr_internal||')'||case when jr_pj_number is not null and jr_pj_number !='' then 'pj:'||coalesce(jr_pj_number,'-') else '' end as jr_comment,
|
||||
jr_montant,
|
||||
j_qcode,
|
||||
jr_rapt as oc, j_tech_per as periode from jrnx left join jrn on ".
|
||||
|
|
@ -205,11 +208,11 @@ class Acc_Ledger {
|
|||
case c_debit when 'f' then c_montant::text else ' ' end as cred_montant,
|
||||
c_debit as j_debit,
|
||||
c_poste as poste,
|
||||
coalesce(j_text,pcm_lib as description),
|
||||
jr_comment||' ('||c_internal||'/ PJ :'||jr_opid||')' as jr_comment,
|
||||
coalesce(j_text,pcm_lib) as description,
|
||||
jr_comment||' ('||c_internal||')'||case when jr_pj_number is not null and jr_pj_number !='' then 'pj:'||coalesce(jr_pj_number,'-') else '' end as jr_comment,
|
||||
jr_montant,
|
||||
c_grp as grp,
|
||||
c_comment||' ('||c_internal||' '||jr_opid||')' as comment,
|
||||
c_comment||' ('||c_internal||' '||jr_opid||')'||'pj:'||coalesce(jr_pj_number,'-') as comment,
|
||||
c_rapt as oc,
|
||||
j_qcode,
|
||||
c_periode as periode
|
||||
|
|
@ -349,7 +352,7 @@ class Acc_Ledger {
|
|||
jrn.jr_id as num ,
|
||||
jrn.jr_def_id as jr_def_id,
|
||||
jrn.jr_montant as montant,
|
||||
substr(jrn.jr_comment,1,30) as comment,
|
||||
substr(jrn.jr_comment,1,30)|| case when jr_pj_number is not null and jr_pj_number !='' then 'pj:'||coalesce(jr_pj_number,'-') else '' end as comment,
|
||||
to_char(jrn.jr_date,'DD-MM-YYYY') as date,
|
||||
jr_internal,
|
||||
jrn.jr_grpt_id as grpt_id,
|
||||
|
|
@ -374,7 +377,7 @@ class Acc_Ledger {
|
|||
$id ,
|
||||
jrn.jr_def_id as jr_def_id,
|
||||
jrn.jr_montant as montant,
|
||||
substr(jrn.jr_comment,1,30) as comment,
|
||||
substr(jrn.jr_comment,1,30)|| case when jr_pj_number is not null and jr_pj_number !='' then 'pj:'||coalesce(jr_pj_number,'-') else '' end as comment,
|
||||
to_char(jrn.jr_date,'DD-MM-YYYY') as date,
|
||||
jr_internal,
|
||||
jrn.jr_grpt_id as grpt_id,
|
||||
|
|
@ -422,6 +425,14 @@ class Acc_Ledger {
|
|||
return $array;
|
||||
}// end function get_rowSimple
|
||||
|
||||
/*!\brief guess what the next pj should be
|
||||
*/
|
||||
function guess_pj() {
|
||||
$prop=$this->get_propertie();
|
||||
$pj_pref=$prop["jrn_def_pj_pref"];
|
||||
$pj_seq=$this->get_last_pj();
|
||||
return $pj_pref.$pj_seq;
|
||||
}
|
||||
/*!\brief Show all the operation, propose a form to select the
|
||||
*ledger and the periode
|
||||
*\return none
|
||||
|
|
@ -453,8 +464,8 @@ class Acc_Ledger {
|
|||
$w->extra='filter';
|
||||
$w->extra2='QuickCode';
|
||||
$w->table=0;
|
||||
$sp= new widget("span");
|
||||
echo $sp->IOValue("qcode_label","",$qcode);
|
||||
$sp= new widget("span");
|
||||
echo $sp->IOValue("qcode_label","",$qcode);
|
||||
echo $w->IOValue();
|
||||
|
||||
echo widget::submit('gl_submit','Recherche');
|
||||
|
|
@ -713,7 +724,7 @@ class Acc_Ledger {
|
|||
|
||||
$Res=ExecSqlParam($this->db,"select jrn_Def_id,jrn_def_name,jrn_def_class_deb,jrn_def_class_cred,jrn_def_type,
|
||||
jrn_deb_max_line,jrn_cred_max_line,jrn_def_ech,jrn_def_ech_lib,jrn_def_code,
|
||||
jrn_def_fiche_deb,jrn_def_fiche_deb
|
||||
jrn_def_fiche_deb,jrn_def_fiche_deb,jrn_def_pj_pref
|
||||
from jrn_Def
|
||||
where jrn_def_id=$1",array($this->id));
|
||||
$Count=pg_NumRows($Res);
|
||||
|
|
@ -866,6 +877,7 @@ class Acc_Ledger {
|
|||
$ret.="<table>";
|
||||
$ret.="<tr><td>Date : </td><td>$date</td></tr>";
|
||||
$ret.="<tr><td>Description </td><td>".h($desc)."</td></tr>";
|
||||
$ret.="<tr><td>PJ Num </td><td>".h($e_pj)."</td></tr>";
|
||||
$ret.='</table>';
|
||||
$ret.="<table>";
|
||||
$ret.="<tr>";
|
||||
|
|
@ -878,6 +890,9 @@ class Acc_Ledger {
|
|||
$hidden=new widget('hidden');
|
||||
$ret.=$hidden->IOValue('date',$date);
|
||||
$ret.=$hidden->IOValue('desc',$desc);
|
||||
$ret.=widget::hidden('e_pj',$e_pj);
|
||||
$ret.=widget::hidden('e_pj_suggest',$e_pj_suggest);
|
||||
|
||||
// For predefined operation
|
||||
$ret.=$hidden->IOValue('e_comm',$desc);
|
||||
$ret.=$hidden->IOValue('jrn_type',$this->get_type());
|
||||
|
|
@ -986,6 +1001,23 @@ class Acc_Ledger {
|
|||
$wDescription->table=1;
|
||||
$wDescription->value=(isset($desc))?$desc:'';
|
||||
$ret.=$wDescription->IOValue();
|
||||
$ret.= '</td>';
|
||||
|
||||
$wPJ=new widget('text',"PJ Num: ",'e_pj');
|
||||
$wPJ->readonly=false;
|
||||
$wPJ->table=1;
|
||||
$wPJ->size=10;
|
||||
|
||||
/* suggest PJ ? */
|
||||
$default_pj='';
|
||||
$own=new Own($this->db);
|
||||
if ( $own->MY_PJ_SUGGEST=='Y') {
|
||||
$default_pj=$this->guess_pj();
|
||||
}
|
||||
$wPJ->value=(isset($e_pj))?$e_pj:$default_pj;
|
||||
|
||||
$ret.=$wPJ->IOValue();
|
||||
$ret.=widget::hidden('e_pj_suggest',$default_pj);
|
||||
$ret.= '</td></tr>';
|
||||
|
||||
$ret.= '</table>';
|
||||
|
|
@ -1006,12 +1038,20 @@ class Acc_Ledger {
|
|||
'<th> Montant</th>'.
|
||||
'<th>Débit</th>'.
|
||||
'</tr>';
|
||||
$l_sessid=$_REQUEST['PHPSESSID'];
|
||||
|
||||
for ($i = 0 ;$i<$nb_row;$i++){
|
||||
// Quick Code
|
||||
$quick_code=new widget('js_search_only');
|
||||
$quick_code=new widget('js_search_card_control');
|
||||
$quick_code->name='qc_'.$i;
|
||||
$quick_code->ctrl="ld".$i;
|
||||
$quick_code->value=(isset(${'qc_'.$i}))?${'qc_'.$i}:"";
|
||||
$quick_code->javascript=sprintf('onBlur="ajaxFid(\'%s\',\'filter\',\'%s\',\'%s\',\'%s\'); if ( this.value!=\'\' ) my_clear(\'poste'.$i.'\'); "',
|
||||
$quick_code->name,
|
||||
$l_sessid,
|
||||
"searchcardControl",
|
||||
$quick_code->ctrl
|
||||
);
|
||||
$quick_code->readonly=$p_readonly;
|
||||
$quick_code->extra2='QuickCode?';
|
||||
$quick_code->extra='filter';
|
||||
|
|
@ -1021,7 +1061,7 @@ class Acc_Ledger {
|
|||
$Fiche->get_by_qcode($quick_code->value);
|
||||
$label=$Fiche->strAttribut(ATTR_DEF_NAME);
|
||||
}
|
||||
$qc_span=new widget('span','','qc_'.$i.'_label',$label);
|
||||
|
||||
|
||||
// Account
|
||||
$poste=new widget('js_search_poste');
|
||||
|
|
@ -1030,18 +1070,19 @@ class Acc_Ledger {
|
|||
$poste->readonly=$p_readonly;
|
||||
$poste->extra=$this->id;
|
||||
$poste->extra2=$this->get_class_def();
|
||||
$label='';
|
||||
$poste->ctrl="ld".$i;
|
||||
|
||||
if ( $poste->value != '' ) {
|
||||
$Poste=new Acc_Account($this->db);
|
||||
$Poste->pcm_value=$poste->value;
|
||||
$label=$Poste->get_lib();
|
||||
}
|
||||
|
||||
// Description of the line
|
||||
$line_desc=new widget('text');
|
||||
$line_desc->name='ld'.$i;
|
||||
$line_desc->size=30;
|
||||
|
||||
$poste_span=new widget('span','','poste'.$i.'_label',$label);
|
||||
$line_desc->value=(isset(${"ld".$i}))?${"ld".$i}:$label;
|
||||
|
||||
// Amount
|
||||
$amount=new widget('text');
|
||||
|
|
@ -1059,9 +1100,9 @@ class Acc_Ledger {
|
|||
|
||||
$ret.='<tr>';
|
||||
$ret.='<td>'.$quick_code->IOValue().'</td>';
|
||||
$ret.='<td>'.$qc_span->IOValue().'</td>';
|
||||
$ret.='<td>'.$poste->IOValue().'</td>';
|
||||
$ret.='<td>'.$poste_span->IOValue().'</td>';
|
||||
$ret.='<td>'.$poste->IOValue().
|
||||
'<script> document.getElementById(\'poste'.$i.'\').onblur=function(){ if (trim(this.value) !=\'\') my_clear(\'qc_'.$i.'\');}</script>'.
|
||||
'</td>';
|
||||
$ret.='<td>'.$line_desc->IOValue().'</td>';
|
||||
$ret.='<td>'.$amount->IOValue().'</td>';
|
||||
$ret.='<td>'.$deb->IOValue().'</td>';
|
||||
|
|
@ -1284,6 +1325,14 @@ class Acc_Ledger {
|
|||
$jr_id= $acc_end->insert_jrn();
|
||||
if ($jr_id == false )
|
||||
throw new Exception('Balance incorrecte');
|
||||
$acc_end->pj=$e_pj;
|
||||
|
||||
/* if e_suggest != e_pj then do not increment sequence */
|
||||
if ( strcmp($e_pj,$e_pj_suggest) == 0 && strlen(trim($e_pj)) !=0) {
|
||||
$this->inc_seq_pj();
|
||||
}
|
||||
|
||||
$this->pj=$acc_end->set_pj();
|
||||
|
||||
ExecSql($this->db,"update jrn set jr_internal='".$internal."' where ".
|
||||
" jr_grpt_id = ".$seq);
|
||||
|
|
@ -1300,6 +1349,7 @@ class Acc_Ledger {
|
|||
if ( isset($this->with_concerned) && $this->with_concerned==true) {
|
||||
$orap=new acc_reconciliation($this->db);
|
||||
$orap->jr_id=$jr_id;
|
||||
|
||||
$orap->insert($jrn_concerned);
|
||||
}
|
||||
|
||||
|
|
@ -1603,4 +1653,10 @@ function get_last_date()
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
/*!\brief increment the sequence for the pj */
|
||||
function inc_seq_pj() {
|
||||
$sql="select nextval('s_jrn_pj".$this->id."')";
|
||||
ExecSql($this->db,$sql);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
require_once('class_acc_ledger.php');
|
||||
require_once('poste.php');
|
||||
require_once('ac_common.php');
|
||||
require_once('class_acc_reconciliation.php');
|
||||
|
||||
class Acc_Ledger_Fin extends Acc_Ledger {
|
||||
/*!\brief verify that the data are correct before inserting or confirming
|
||||
|
|
@ -221,6 +222,15 @@ class Acc_Ledger_Fin extends Acc_Ledger {
|
|||
$W1->extra='deb'; // credits
|
||||
$W1->extra2="Recherche";
|
||||
$W1->table=0;
|
||||
$W1->javascript= sprintf('onBlur="ajaxFid(\'%s\',\'%s\',\'%s\',\'%s\',\'%s\');ajax_saldo(\'%s\',\'%s\')"',
|
||||
$W1->name,
|
||||
$W1->extra, //deb or cred
|
||||
$_REQUEST['PHPSESSID'],
|
||||
'js_search_only',
|
||||
'none',
|
||||
$_REQUEST['PHPSESSID'],
|
||||
$W1->name
|
||||
);
|
||||
$r.="<TR><td colspan=\"4\">".$W1->IOValue();
|
||||
$Span=new widget ("span");
|
||||
$Span->SetReadOnly($pview_only);
|
||||
|
|
@ -252,6 +262,11 @@ class Acc_Ledger_Fin extends Acc_Ledger {
|
|||
$wFirst=new widget('text');
|
||||
$wFist->table=0;
|
||||
$first_sold=(isset($first_sold))?$first_sold:"";
|
||||
|
||||
/* $wFirst->javascript=sprintf(' onfocus="ajax_saldo(\'%s\',\'%s\');"',
|
||||
$_REQUEST['PHPSESSID'],
|
||||
$W1->name);
|
||||
*/
|
||||
$r.='<td>'.$wFirst->IOValue('first_sold',$first_sold).'</td>';
|
||||
$wLast=new widget('text');
|
||||
$wLast->table=1;
|
||||
|
|
@ -590,15 +605,21 @@ class Acc_Ledger_Fin extends Acc_Ledger {
|
|||
{
|
||||
$aRapt=split(',',${"e_concerned".$i});
|
||||
foreach ($aRapt as $rRapt) {
|
||||
// Add a "concerned operation to bound these op.together
|
||||
//
|
||||
$rec=new Acc_Reconciliation ($this->db);
|
||||
$rec->set_jr_id($jr_id);
|
||||
$rec->insert($l_array['jr_id']);
|
||||
|
||||
if ( isNumber($rRapt) == 1 )
|
||||
{
|
||||
InsertRapt($this->db,$jr_id,$rRapt);
|
||||
$rec->insert($rRapt);
|
||||
}
|
||||
}
|
||||
} else
|
||||
if ( isNumber(${"e_concerned".$i}) == 1 )
|
||||
{
|
||||
InsertRapt($this->db,$jr_id,${"e_concerned$i"});
|
||||
$rec->insert(${"e_concerned$i"});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -642,15 +663,9 @@ class Acc_Ledger_Fin extends Acc_Ledger {
|
|||
$r.="<br>Nouveau solde ".$new_solde;
|
||||
return $r;
|
||||
}
|
||||
/*!\brief
|
||||
*\param
|
||||
*\return
|
||||
*\note
|
||||
*\see
|
||||
*\todo
|
||||
/*!\brief display operation of a FIN ledger
|
||||
*\return html code into a string
|
||||
*/
|
||||
|
||||
|
||||
function show_ledger() {
|
||||
echo dossier::hidden();
|
||||
$hid=new widget("hidden");
|
||||
|
|
@ -710,7 +725,7 @@ class Acc_Ledger_Fin extends Acc_Ledger {
|
|||
}
|
||||
else
|
||||
{
|
||||
$filter_per=" and jr_tech_per in (select p_id from parm_periode where p_exercice=".
|
||||
$filter_per=" and jr_tech_per in (select p_id from parm_periode where p_exercice::integer=".
|
||||
$User->get_exercice().")";
|
||||
}
|
||||
/* security */
|
||||
|
|
|
|||
|
|
@ -180,27 +180,31 @@ class Acc_Ledger_Purchase extends Acc_Ledger {
|
|||
$fiche->get_by_qcode(${"e_march".$i});
|
||||
|
||||
/* tva */
|
||||
$idx_tva=${'e_march'.$i.'_tva_id'};
|
||||
$oTva=new Acc_Tva($this->db);
|
||||
$oTva->set_parameter('id',$idx_tva);
|
||||
$oTva->load();
|
||||
if ($own->MY_TVA_USE=='Y') {
|
||||
$idx_tva=${'e_march'.$i.'_tva_id'};
|
||||
$oTva=new Acc_Tva($this->db);
|
||||
$oTva->set_parameter('id',$idx_tva);
|
||||
$oTva->load();
|
||||
}
|
||||
|
||||
/* We have to compute all the amount thanks Acc_Compute */
|
||||
$amount=bcmul(${'e_march'.$i.'_price'},${'e_quant'.$i});
|
||||
$acc_amount=new Acc_Compute();
|
||||
$acc_amount->check=false;
|
||||
$acc_amount->set_parameter('amount',$amount);
|
||||
$acc_amount->set_parameter('amount_vat_rate',$oTva->get_parameter('rate'));
|
||||
if ( strlen(trim(${'e_march'.$i.'_tva_amount'})) ==0) {
|
||||
$acc_amount->compute_vat();
|
||||
echo_debug( 'vat is computed = '.$acc_amount->amount_vat);
|
||||
|
||||
} else {
|
||||
$acc_amount->amount_vat= ${'e_march'.$i.'_tva_amount'};
|
||||
echo_debug( 'vat is given = '.$acc_amount->amount_vat);
|
||||
|
||||
if ( $own->MY_TVA_USE=='Y') {
|
||||
$acc_amount->set_parameter('amount_vat_rate',$oTva->get_parameter('rate'));
|
||||
if ( strlen(trim(${'e_march'.$i.'_tva_amount'})) ==0) {
|
||||
$acc_amount->compute_vat();
|
||||
echo_debug( 'vat is computed = '.$acc_amount->amount_vat);
|
||||
|
||||
} else {
|
||||
$acc_amount->amount_vat= ${'e_march'.$i.'_tva_amount'};
|
||||
echo_debug( 'vat is given = '.$acc_amount->amount_vat);
|
||||
|
||||
}
|
||||
$tot_tva+=$acc_amount->amount_vat;
|
||||
}
|
||||
$tot_tva+=$acc_amount->amount_vat;
|
||||
|
||||
$acc_operation=new Acc_Operation($this->db);
|
||||
$acc_operation->date=$e_date;
|
||||
|
|
@ -251,15 +255,15 @@ class Acc_Ledger_Purchase extends Acc_Ledger {
|
|||
|
||||
/* Compute sum vat */
|
||||
|
||||
if ( $own->MY_TVA_USE=='Y') {
|
||||
$tva_item=$acc_amount->amount_vat;
|
||||
|
||||
if (isset($tva[$idx_tva] ) )
|
||||
$tva[$idx_tva]+=$tva_item;
|
||||
else
|
||||
$tva[$idx_tva]=$tva_item;
|
||||
|
||||
$tva_item=$acc_amount->amount_vat;
|
||||
|
||||
if (isset($tva[$idx_tva] ) )
|
||||
$tva[$idx_tva]+=$tva_item;
|
||||
else
|
||||
$tva[$idx_tva]=$tva_item;
|
||||
|
||||
|
||||
}
|
||||
/* Save the stock */
|
||||
/* if the quantity is < 0 then the stock increase (return of
|
||||
* material)
|
||||
|
|
@ -285,23 +289,40 @@ class Acc_Ledger_Purchase extends Acc_Ledger {
|
|||
}
|
||||
// insert into quant_purchase
|
||||
//-----
|
||||
if ( $own->MY_TVA_USE=='Y') {
|
||||
$r=ExecSql($this->db,"select insert_quant_purchase ".
|
||||
"('".$internal."'".
|
||||
",".$j_id.
|
||||
",'".${"e_march".$i}."'".
|
||||
",".${"e_quant".$i}.",".
|
||||
round($amount,2).
|
||||
",".$acc_amount->amount_vat.
|
||||
",".$oTva->get_parameter('id').
|
||||
",".$acc_amount->amount_nd.
|
||||
",".$acc_amount->nd_vat.
|
||||
",".$acc_amount->nd_ded_vat.
|
||||
",".$acc_amount->amount_perso.
|
||||
",'".$e_client."')");
|
||||
|
||||
} else {
|
||||
$r=ExecSql($this->db,"select insert_quant_purchase ".
|
||||
"('".$internal."'".
|
||||
",".$j_id.
|
||||
",'".${"e_march".$i}."'".
|
||||
",".${"e_quant".$i}.",".
|
||||
round($amount,2).
|
||||
",0".
|
||||
",null".
|
||||
",".$acc_amount->amount_nd.
|
||||
",0".
|
||||
",".$acc_amount->nd_ded_vat.
|
||||
",".$acc_amount->amount_perso.
|
||||
",'".$e_client."')");
|
||||
|
||||
|
||||
$r=ExecSql($this->db,"select insert_quant_purchase ".
|
||||
"('".$internal."'".
|
||||
",".$j_id.
|
||||
",'".${"e_march".$i}."'".
|
||||
",".${"e_quant".$i}.",".
|
||||
round($amount,2).
|
||||
",".$acc_amount->amount_vat.
|
||||
",".$oTva->get_parameter('id').
|
||||
",".$acc_amount->amount_nd.
|
||||
",".$acc_amount->nd_vat.
|
||||
",".$acc_amount->nd_ded_vat.
|
||||
",".$acc_amount->amount_perso.
|
||||
",'".$e_client."')");
|
||||
|
||||
|
||||
} // end loop : save all items
|
||||
}
|
||||
|
||||
} // end loop : save all items
|
||||
/* save total customer */
|
||||
$cust_amount=round(bcadd($tot_amount,$tot_tva),2);
|
||||
$acc_operation=new Acc_Operation($this->db);
|
||||
|
|
@ -365,28 +386,30 @@ class Acc_Ledger_Purchase extends Acc_Ledger {
|
|||
|
||||
}
|
||||
|
||||
/* save all vat
|
||||
* $i contains the tva_id and value contains the vat amount
|
||||
*/
|
||||
foreach ($tva as $i => $value) {
|
||||
$oTva=new Acc_Tva($this->db);
|
||||
$oTva->set_parameter('id',$i);
|
||||
$oTva->load();
|
||||
if ( $own->MY_TVA_USE=='Y') {
|
||||
/* save all vat
|
||||
* $i contains the tva_id and value contains the vat amount
|
||||
*/
|
||||
foreach ($tva as $i => $value) {
|
||||
$oTva=new Acc_Tva($this->db);
|
||||
$oTva->set_parameter('id',$i);
|
||||
$oTva->load();
|
||||
|
||||
$poste_vat=$oTva->get_side('d');
|
||||
$poste_vat=$oTva->get_side('d');
|
||||
|
||||
$cust_amount=bcadd($tot_amount,$tot_tva);
|
||||
$acc_operation=new Acc_Operation($this->db);
|
||||
$acc_operation->date=$e_date;
|
||||
$acc_operation->poste=$poste_vat;
|
||||
$acc_operation->amount=$value;
|
||||
$acc_operation->grpt=$seq;
|
||||
$acc_operation->jrn=$p_jrn;
|
||||
$acc_operation->type='d';
|
||||
$acc_operation->periode=$periode;
|
||||
if ( $value > 0 ) $tot_debit=bcadd($tot_debit,$value);
|
||||
$acc_operation->insert_jrnx();
|
||||
$cust_amount=bcadd($tot_amount,$tot_tva);
|
||||
$acc_operation=new Acc_Operation($this->db);
|
||||
$acc_operation->date=$e_date;
|
||||
$acc_operation->poste=$poste_vat;
|
||||
$acc_operation->amount=$value;
|
||||
$acc_operation->grpt=$seq;
|
||||
$acc_operation->jrn=$p_jrn;
|
||||
$acc_operation->type='d';
|
||||
$acc_operation->periode=$periode;
|
||||
if ( $value > 0 ) $tot_debit=bcadd($tot_debit,$value);
|
||||
$acc_operation->insert_jrnx();
|
||||
|
||||
}
|
||||
}
|
||||
/* insert into jrn */
|
||||
$acc_operation=new Acc_Operation($this->db);
|
||||
|
|
@ -397,12 +420,19 @@ class Acc_Ledger_Purchase extends Acc_Ledger {
|
|||
$acc_operation->grpt=$seq;
|
||||
$acc_operation->jrn=$p_jrn;
|
||||
$acc_operation->periode=$periode;
|
||||
$acc_operation->pj=$e_pj;
|
||||
$acc_operation->insert_jrn();
|
||||
$this->pj=$acc_operation->set_pj();
|
||||
|
||||
// Set Internal code
|
||||
$this->grpt_id=$seq;
|
||||
$this->update_internal_code($internal);
|
||||
|
||||
|
||||
/* if e_suggest != e_pj then do not increment sequence */
|
||||
if ( strcmp($e_pj,$e_pj_suggest) == 0 && strlen(trim($e_pj)) != 0 ) {
|
||||
$this->inc_seq_pj();
|
||||
}
|
||||
|
||||
/* Save the attachment */
|
||||
if ( isset ($_FILES)) {
|
||||
if ( sizeof($_FILES) != 0 )
|
||||
|
|
@ -592,7 +622,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger {
|
|||
if ( $p_array != null ) extract($p_array);
|
||||
|
||||
$user = new User($this->db);
|
||||
|
||||
$own=new Own($this->db);
|
||||
// The first day of the periode
|
||||
$oPeriode=new Periode($this->db);
|
||||
list ($l_date_start,$l_date_end)=$oPeriode->get_date_limit($user->get_periode());
|
||||
|
|
@ -600,12 +630,12 @@ class Acc_Ledger_Purchase extends Acc_Ledger {
|
|||
$op_date=( ! isset($e_date) ) ?$l_date_start:$e_date;
|
||||
$e_ech=(isset($e_ech))?$e_ech:"";
|
||||
$e_comm=(isset($e_comm))?$e_comm:"";
|
||||
|
||||
|
||||
$r="";
|
||||
$r.="<FORM NAME=\"form_detail\" METHOD=\"POST\">";
|
||||
$r.=JS_INFOBULLE;
|
||||
$r.=JS_SEARCH_CARD;
|
||||
//!\todo do we need JS_TVA ??? Remove if no
|
||||
$r.=JS_SHOW_TVA;
|
||||
$r.=JS_TVA;
|
||||
$r.=JS_AJAX_FICHE;
|
||||
|
|
@ -646,10 +676,15 @@ class Acc_Ledger_Purchase extends Acc_Ledger {
|
|||
$r.="</tr><tr>";
|
||||
// Ledger (p_jrn)
|
||||
//--
|
||||
/* if we suggest the next pj, then we need a javascript */
|
||||
$add_js="";
|
||||
if ( $own->MY_PJ_SUGGEST=='Y') {
|
||||
$add_js="update_pj();";
|
||||
}
|
||||
$wLedger=$this->select_ledger('ACH',2);
|
||||
if ($wLedger == null) exit ('Pas de journal disponible');
|
||||
$wLedger->table=1;
|
||||
$wLedger->javascript="onChange='update_predef(\"ach\",\"f\")'";
|
||||
$wLedger->javascript="onChange='update_predef(\"ach\",\"f\");$add_js'";
|
||||
$wLedger->label=" Journal ".widget::infobulle(2) ;
|
||||
|
||||
$r.=$wLedger->IOValue();
|
||||
|
|
@ -658,14 +693,30 @@ class Acc_Ledger_Purchase extends Acc_Ledger {
|
|||
$Commentaire=new widget("text");
|
||||
$Commentaire->table=0;
|
||||
$Commentaire->SetReadOnly(false);
|
||||
$Commentaire->size=80;
|
||||
$Commentaire->size=60;
|
||||
$Commentaire->tabindex=3;
|
||||
$label=" Description ".widget::infobulle(1) ;
|
||||
$r.="<tr>";
|
||||
$r.='<td class="input_text">'.$label.'</td>'.
|
||||
'<td colspan="5">'.$Commentaire->IOValue("e_comm",$e_comm)."</td>";
|
||||
$r.="</tr>";
|
||||
'<td colspan="3">'.$Commentaire->IOValue("e_comm",$e_comm)."</td>";
|
||||
// PJ
|
||||
//--
|
||||
/* suggest PJ ? */
|
||||
$default_pj='';
|
||||
if ( $own->MY_PJ_SUGGEST=='Y') {
|
||||
$default_pj=$this->guess_pj();
|
||||
}
|
||||
$pj->value=(isset($e_pj))?$e_pj:$default_pj;
|
||||
|
||||
$pj=new widget('text');
|
||||
$pj->table=0;
|
||||
$pj->name="e_pj";
|
||||
$pj->size=10;
|
||||
$pj->readonly=false;
|
||||
$pj->value=$default_pj;
|
||||
|
||||
$r.=widget::hidden('e_pj_suggest',$default_pj);
|
||||
$r.='<td class="input_text">Num.PJ</td><td>'.$pj->IOValue().'</td>';
|
||||
// Display the customer
|
||||
//--
|
||||
$fiche='cred';
|
||||
|
|
@ -710,6 +761,8 @@ class Acc_Ledger_Purchase extends Acc_Ledger {
|
|||
$p_article= ( isset ($p_article))?$p_article:MAX_ARTICLE;
|
||||
$r.=$Hid->IOValue("nb_item",$p_article);
|
||||
$e_comment=(isset($e_comment))?$e_comment:"";
|
||||
/*!\todo for the PJ we suggest the PJ Number, the pj number must also be settable in the ledger
|
||||
setting and editable in the details popup window */
|
||||
$r.="</fieldset>";
|
||||
|
||||
// Start the div for item to sell
|
||||
|
|
@ -723,11 +776,15 @@ class Acc_Ledger_Purchase extends Acc_Ledger {
|
|||
$r.="<th>Dénomination</th>";
|
||||
$label=widget::infobulle(6) ;
|
||||
$r.="<th>$label prix / unité htva </th>";
|
||||
$r.="<th>tva</th>";
|
||||
$label=widget::infobulle(8) ;
|
||||
$r.="<th> $label Total tva</th>";
|
||||
/* use vat */
|
||||
if ( $own->MY_TVA_USE=='Y') {
|
||||
$r.="<th>tva</th>";
|
||||
$label=widget::infobulle(8) ;
|
||||
$r.="<th> $label Total tva</th>";
|
||||
}
|
||||
$r.="<th>quantité</th>";
|
||||
|
||||
|
||||
$r.='</TR>';
|
||||
// For each article
|
||||
//--
|
||||
|
|
@ -736,8 +793,12 @@ class Acc_Ledger_Purchase extends Acc_Ledger {
|
|||
//--
|
||||
$march=(isset(${"e_march$i"}))?${"e_march$i"}:"";
|
||||
$march_price=(isset(${"e_march".$i."_price"}))?${"e_march".$i."_price"}:"";
|
||||
$march_tva_id=(isset(${"e_march$i"."_tva_id"}))?${"e_march$i"."_tva_id"}:"";
|
||||
$march_tva_amount=(isset(${"e_march$i"."_tva_amount"}))?${"e_march$i"."_tva_amount"}:"";
|
||||
/* use vat */
|
||||
if ( $own->MY_TVA_USE=='Y') {
|
||||
$march_tva_id=(isset(${"e_march$i"."_tva_id"}))?${"e_march$i"."_tva_id"}:"";
|
||||
$march_tva_amount=(isset(${"e_march$i"."_tva_amount"}))?${"e_march$i"."_tva_amount"}:"";
|
||||
}
|
||||
|
||||
|
||||
|
||||
$march_label=" ";
|
||||
|
|
@ -747,7 +808,8 @@ class Acc_Ledger_Purchase extends Acc_Ledger {
|
|||
$fMarch=new fiche($this->db);
|
||||
$fMarch->get_by_qcode($march);
|
||||
$march_label=$fMarch->strAttribut(ATTR_DEF_NAME);
|
||||
if ( ! isset($march_tva_id) )
|
||||
/* vat use */
|
||||
if ( ! isset($march_tva_id) && $own->MY_TVA_USE=='Y' )
|
||||
$march_tva_id=$fMarch->strAttribut(ATTR_DEF_TVA);
|
||||
}
|
||||
// Show input
|
||||
|
|
@ -769,9 +831,11 @@ class Acc_Ledger_Purchase extends Acc_Ledger {
|
|||
$W1->readonly=false;
|
||||
$r.="<TR>".$W1->IOValue();
|
||||
// For computing we need some hidden field for holding the value
|
||||
$r.=widget::hidden('tva_march'.$i,0);
|
||||
$r.=widget::hidden('htva_march'.$i,0);
|
||||
if ( $own->MY_TVA_USE=='Y') {
|
||||
$r.=widget::hidden('tva_march'.$i,0);
|
||||
}
|
||||
$r.=widget::hidden('tvac_march'.$i,0);
|
||||
$r.=widget::hidden('htva_march'.$i,0);
|
||||
$r.="</TD>";
|
||||
$Span=new widget ("span");
|
||||
$Span->SetReadOnly(false);
|
||||
|
|
@ -785,23 +849,25 @@ class Acc_Ledger_Purchase extends Acc_Ledger {
|
|||
$Price->size=9;
|
||||
$Price->javascript="onBlur='clean_tva($i);compute_purchase($i)'";
|
||||
$r.=$Price->IOValue("e_march".$i."_price",$march_price);
|
||||
// vat label
|
||||
//--
|
||||
$select_tva=make_array($this->db,"select tva_id,tva_label from tva_rate order by tva_rate desc",0);
|
||||
$Tva=new widget("select");
|
||||
$Tva->javascript="onChange=\"clean_tva($i);compute_purchase($i);\"";
|
||||
$Tva->table=1;
|
||||
$Tva->selected=$march_tva_id;
|
||||
$r.=$Tva->IOValue("e_march$i"."_tva_id",$select_tva);
|
||||
// Tva_amount
|
||||
// price
|
||||
$Tva_amount=new widget("text");
|
||||
$Tva_amount->SetReadOnly(false);
|
||||
$Tva_amount->table=1;
|
||||
$Tva_amount->size=9;
|
||||
$Tva_amount->javascript="onBlur='compute_purchase($i)'";
|
||||
$r.=$Tva_amount->IOValue("e_march".$i."_tva_amount",$march_tva_amount);
|
||||
|
||||
if ( $own->MY_TVA_USE=='Y') {
|
||||
// vat label
|
||||
//--
|
||||
$select_tva=make_array($this->db,"select tva_id,tva_label from tva_rate order by tva_rate desc",0);
|
||||
$Tva=new widget("select");
|
||||
$Tva->javascript="onChange=\"clean_tva($i);compute_purchase($i);\"";
|
||||
$Tva->table=1;
|
||||
$Tva->selected=$march_tva_id;
|
||||
$r.=$Tva->IOValue("e_march$i"."_tva_id",$select_tva);
|
||||
// Tva_amount
|
||||
|
||||
// price
|
||||
$Tva_amount=new widget("text");
|
||||
$Tva_amount->SetReadOnly(false);
|
||||
$Tva_amount->table=1;
|
||||
$Tva_amount->size=9;
|
||||
$Tva_amount->javascript="onBlur='compute_purchase($i)'";
|
||||
$r.=$Tva_amount->IOValue("e_march".$i."_tva_amount",$march_tva_amount);
|
||||
}
|
||||
// quantity
|
||||
//--
|
||||
$quant=(isset(${"e_quant$i"}))?${"e_quant$i"}:"1";
|
||||
|
|
@ -823,17 +889,25 @@ class Acc_Ledger_Purchase extends Acc_Ledger {
|
|||
$r.="</div>";
|
||||
|
||||
$r.='<div style="position:float;float:right;text-align:left;font-size:1.2em;font-weight:bold;color:blue" id="sum">';
|
||||
$r.='<br><span id="htva">0.0</span>';
|
||||
$r.='<br><span id="tva">0.0</span>';
|
||||
$r.='<br><span id="tvac">0.0</span>';
|
||||
if ( $own->MY_TVA_USE=='Y') {
|
||||
$r.='<br><span id="htva">0.0</span>';
|
||||
$r.='<br><span id="tva">0.0</span>';
|
||||
$r.='<br><span id="tvac">0.0</span>';
|
||||
} else {
|
||||
$r.='<br><span id="htva">0.0</span>';
|
||||
}
|
||||
$r.="</div>";
|
||||
|
||||
|
||||
|
||||
$r.='<div style="position:float;float:right;text-align:right;padding-right:5px;font-size:1.2em;font-weight:bold;color:blue">';
|
||||
$r.='<br>Total HTVA';
|
||||
$r.='<br>Total TVA';
|
||||
$r.='<br>Total TVAC';
|
||||
if ( $own->MY_TVA_USE=='Y') {
|
||||
$r.='<br>Total HTVA';
|
||||
$r.='<br>Total TVA';
|
||||
$r.='<br>Total TVAC';
|
||||
} else
|
||||
$r.='<br>Total';
|
||||
|
||||
$r.="</div>";
|
||||
$r.=widget::button('add_item','Ajout article', ' onClick="ledger_sold_add_row()"');
|
||||
|
||||
|
|
@ -857,6 +931,12 @@ class Acc_Ledger_Purchase extends Acc_Ledger {
|
|||
$r.='</form>';
|
||||
$r.="</DIV>";
|
||||
|
||||
/* if we suggest the pj n# the run the script */
|
||||
if ( $own->MY_PJ_SUGGEST=='Y') {
|
||||
$r.='<script> update_pj();</script>';
|
||||
}
|
||||
|
||||
|
||||
$r.=JS_CALC_LINE;
|
||||
return $r;
|
||||
}
|
||||
|
|
@ -868,7 +948,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger {
|
|||
function confirm($p_array) {
|
||||
extract ($p_array);
|
||||
$this->verify($p_array) ;
|
||||
|
||||
|
||||
// to show a select list for the analytic
|
||||
// if analytic is op (optionnel) there is a blank line
|
||||
$own = new Own($this->db);
|
||||
|
|
@ -895,7 +975,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger {
|
|||
$r.='<td> Journal '.h($this->get_name()).'</td>';
|
||||
$r.='</tr>';
|
||||
$r.='<tr>';
|
||||
$r.='<td colspan="3"> Description '.h($e_comm).'</td>';
|
||||
$r.='<td colspan="2"> Description '.h($e_comm).'</td><td> Pj :'.h($e_pj).'</td>';
|
||||
$r.='</tr>';
|
||||
$r.='<tr>';
|
||||
$r.='<td colspan="3"> Fournisseur '.h($e_client.':'.$client_name).'</td>';
|
||||
|
|
@ -908,15 +988,23 @@ class Acc_Ledger_Purchase extends Acc_Ledger {
|
|||
$r.="<th>Code</th>";
|
||||
$r.="<th>Dénomination</th>";
|
||||
$r.="<th>prix</th>";
|
||||
$r.="<th>tva</th>";
|
||||
$r.="<th>quantité</th>";
|
||||
|
||||
$r.='<th> Montant TVA</th>';
|
||||
$r.='<th>Montant HTVA</th>';
|
||||
/* vat use */
|
||||
if ( $own->MY_TVA_USE=='Y') {
|
||||
$r.="<th>tva</th>";
|
||||
$r.="<th>quantité</th>";
|
||||
$r.='<th> Montant TVA</th>';
|
||||
$r.='<th>Montant HTVA</th>';
|
||||
} else {
|
||||
$r.="<th>quantité</th>";
|
||||
$r.='<th> Total</th>';
|
||||
}
|
||||
$r.=($own->MY_ANALYTIC!='nu')?'<th>Compt. Analytique</th>':'';
|
||||
$r.='</tr>';
|
||||
$tot_amount=0.0;
|
||||
$tot_tva=0.0;
|
||||
//--
|
||||
// For each item
|
||||
//--
|
||||
for ($i = 0; $i < $nb_item;$i++) {
|
||||
if ( strlen(trim(${"e_march".$i})) == 0 ) continue;
|
||||
|
||||
|
|
@ -924,29 +1012,35 @@ class Acc_Ledger_Purchase extends Acc_Ledger {
|
|||
$fiche=new fiche($this->db);
|
||||
$fiche->get_by_qcode(${"e_march".$i});
|
||||
$fiche_name=h($fiche->getName());
|
||||
$idx_tva=${"e_march".$i."_tva_id"};
|
||||
$oTva=new Acc_Tva($this->db);
|
||||
$oTva->set_parameter('id',$idx_tva);
|
||||
$oTva->load();
|
||||
|
||||
if ( $own->MY_TVA_USE=='Y') {
|
||||
$idx_tva=${"e_march".$i."_tva_id"};
|
||||
$oTva=new Acc_Tva($this->db);
|
||||
$oTva->set_parameter('id',$idx_tva);
|
||||
$oTva->load();
|
||||
}
|
||||
$amount=bcmul(${"e_march".$i."_price"},${'e_quant'.$i});
|
||||
|
||||
//----- if tva_amount is not given we compute the vat ----
|
||||
if ( strlen (trim (${'e_march'.$i.'_tva_amount'})) == 0) {
|
||||
if ( $own->MY_TVA_USE=='Y') {
|
||||
//----- if tva_amount is not given we compute the vat ----
|
||||
if ( strlen (trim (${'e_march'.$i.'_tva_amount'})) == 0) {
|
||||
$op=new Acc_Compute();
|
||||
|
||||
|
||||
$op->set_parameter("amount",$amount);
|
||||
$op->set_parameter('amount_vat_rate',$oTva->get_parameter('rate'));
|
||||
$op->compute_vat();
|
||||
$tva_item=$op->get_parameter('amount_vat');
|
||||
} else
|
||||
$tva_item=round(${'e_march'.$i.'_tva_amount'},2);
|
||||
|
||||
if (isset($tva[$idx_tva] ) )
|
||||
$tva[$idx_tva]+=$tva_item;
|
||||
else
|
||||
$tva[$idx_tva]=$tva_item;
|
||||
$tva_item=round(${'e_march'.$i.'_tva_amount'},2);
|
||||
|
||||
if (isset($tva[$idx_tva] ) )
|
||||
$tva[$idx_tva]+=$tva_item;
|
||||
else
|
||||
$tva[$idx_tva]=$tva_item;
|
||||
$tot_tva=round(bcadd($tva_item,$tot_tva),2);
|
||||
}
|
||||
$tot_amount=round(bcadd($tot_amount,$amount),2);
|
||||
$tot_tva=round(bcadd($tva_item,$tot_tva),2);
|
||||
|
||||
$r.='<tr>';
|
||||
$r.='<td>';
|
||||
$r.=${"e_march".$i};
|
||||
|
|
@ -960,13 +1054,14 @@ class Acc_Ledger_Purchase extends Acc_Ledger {
|
|||
$r.='<td align="right">';
|
||||
$r.=${"e_quant".$i};
|
||||
$r.='</td>';
|
||||
|
||||
$r.='<td align="right">';
|
||||
$r.=$oTva->get_parameter('label');
|
||||
$r.='</td>';
|
||||
$r.='<td align="right">';
|
||||
$r.=$tva_item;
|
||||
$r.='</td>';
|
||||
if ($own->MY_TVA_USE == 'Y') {
|
||||
$r.='<td align="right">';
|
||||
$r.=$oTva->get_parameter('label');
|
||||
$r.='</td>';
|
||||
$r.='<td align="right">';
|
||||
$r.=$tva_item;
|
||||
$r.='</td>';
|
||||
}
|
||||
$r.='<td align="right">';
|
||||
$r.=$amount;
|
||||
$r.='</td>';
|
||||
|
|
@ -999,26 +1094,30 @@ class Acc_Ledger_Purchase extends Acc_Ledger {
|
|||
$tot=round(bcadd($tot_amount,$tot_tva),2);
|
||||
$r.='<div style="position:float;float:left;text-align:right;padding-left:5%;padding-right:5%;color:blue;font-size:1.2em;font-weight:bold">';
|
||||
$r.='<br>Total HTVA';
|
||||
if ($own->MY_TVA_USE=='Y') {
|
||||
foreach ($tva as $i=>$value) {
|
||||
$oTva->set_parameter('id',$i);
|
||||
$oTva->load();
|
||||
|
||||
foreach ($tva as $i=>$value) {
|
||||
$oTva->set_parameter('id',$i);
|
||||
$oTva->load();
|
||||
|
||||
$r.='<br> TVA à '.$oTva->get_parameter('label');
|
||||
}
|
||||
$r.='<br>Total TVA';
|
||||
$r.='<br>Total TVAC';
|
||||
$r.='<br> TVA à '.$oTva->get_parameter('label');
|
||||
$r.='<br>Total TVA';
|
||||
}
|
||||
|
||||
$r.='<br>Total TVAC';
|
||||
}
|
||||
$r.="</div>";
|
||||
|
||||
|
||||
$r.='<div style="position:float;float:left;text-align:right;color:blue;font-size:1.2em;font-weight:bold">';
|
||||
$r.='<br><span id="htva">'.$tot_amount.'</span>';
|
||||
|
||||
foreach ($tva as $i=>$value) {
|
||||
$r.='<br>'.$tva[$i];
|
||||
}
|
||||
$r.='<br><span id="tva">'.$tot_tva.'</span>';
|
||||
$r.='<br><span id="tvac">'.$tot.'</span>';
|
||||
if ( $own->MY_TVA_USE=='Y') {
|
||||
foreach ($tva as $i=>$value) {
|
||||
$r.='<br>'.$tva[$i];
|
||||
}
|
||||
$r.='<br><span id="tva">'.$tot_tva.'</span>';
|
||||
$r.='<br><span id="tvac">'.$tot.'</span>';
|
||||
}
|
||||
$r.="</div>";
|
||||
|
||||
|
||||
|
|
@ -1033,6 +1132,9 @@ class Acc_Ledger_Purchase extends Acc_Ledger {
|
|||
$r.=widget::hidden('e_date',$e_date);
|
||||
$r.=widget::hidden('e_ech',$e_ech);
|
||||
$r.=widget::hidden('jrn_type',$jrn_type);
|
||||
$r.=widget::hidden('e_pj',$e_pj);
|
||||
$r.=widget::hidden('e_pj_suggest',$e_pj_suggest);
|
||||
|
||||
$e_mp=(isset($e_mp))?$e_mp:0;
|
||||
$r.=widget::hidden('e_mp',$e_mp);
|
||||
/* Paid by */
|
||||
|
|
@ -1049,9 +1151,12 @@ class Acc_Ledger_Purchase extends Acc_Ledger {
|
|||
for ($i=0;$i < $nb_item;$i++) {
|
||||
$r.=widget::hidden("e_march".$i,${"e_march".$i});
|
||||
$r.=widget::hidden("e_march".$i."_price",${"e_march".$i."_price"});
|
||||
$r.=widget::hidden("e_march".$i."_tva_id",${"e_march".$i."_tva_id"});
|
||||
$r.=widget::hidden('e_march'.$i.'_tva_amount', ${'e_march'.$i.'_tva_amount'});
|
||||
$r.=widget::hidden("e_quant".$i,${"e_quant".$i});
|
||||
if ( $own->MY_TVA_USE=='Y' ) {
|
||||
$r.=widget::hidden("e_march".$i."_tva_id",${"e_march".$i."_tva_id"});
|
||||
$r.=widget::hidden('e_march'.$i.'_tva_amount', ${'e_march'.$i.'_tva_amount'});
|
||||
}
|
||||
$r.=widget::hidden("e_quant".$i,${"e_quant".$i});
|
||||
|
||||
}
|
||||
// check for upload piece
|
||||
$file=new widget("file");
|
||||
|
|
@ -1113,12 +1218,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger {
|
|||
|
||||
|
||||
}
|
||||
/*!\brief
|
||||
*\param
|
||||
*\return
|
||||
*\note
|
||||
*\see
|
||||
*\todo
|
||||
/*!\brief Test function
|
||||
*/
|
||||
static function test_me() {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,8 @@ require_once('class_anc_operation.php');
|
|||
require_once('user_common.php');
|
||||
require_once('class_acc_payment.php');
|
||||
require_once('ac_common.php');
|
||||
require_once('class_own.php');
|
||||
|
||||
/*!\brief Handle the ledger of sold,
|
||||
*
|
||||
*
|
||||
|
|
@ -149,6 +151,7 @@ class Acc_Ledger_Sold extends Acc_Ledger {
|
|||
$seq=NextSequence($this->db,'s_grpt');
|
||||
$this->id=$p_jrn;
|
||||
$internal=$this->compute_internal_code($seq);
|
||||
|
||||
$cust=new fiche($this->db);
|
||||
$cust->get_by_qcode($e_client);
|
||||
$poste=$cust->strAttribut(ATTR_DEF_ACCOUNT);
|
||||
|
|
@ -181,25 +184,26 @@ class Acc_Ledger_Sold extends Acc_Ledger {
|
|||
if ( $amount < 0 ) $tot_debit=bcadd($tot_debit,abs($amount));
|
||||
|
||||
$j_id=$acc_operation->insert_jrnx();
|
||||
|
||||
/* Compute sum vat */
|
||||
$oTva=new Acc_Tva($this->db);
|
||||
$idx_tva=${'e_march'.$i.'_tva_id'};
|
||||
$oTva->set_parameter('id',$idx_tva);
|
||||
$oTva->load();
|
||||
$op_tva=new Acc_Compute();
|
||||
$op_tva->set_parameter("amount",$amount);
|
||||
$op_tva->set_parameter('amount_vat_rate',$oTva->get_parameter('rate'));
|
||||
$op_tva->compute_vat();
|
||||
$tva_item=$op_tva->get_parameter('amount_vat');
|
||||
|
||||
if ($own->MY_TVA_USE == 'Y' ) {
|
||||
/* Compute sum vat */
|
||||
$oTva=new Acc_Tva($this->db);
|
||||
$idx_tva=${'e_march'.$i.'_tva_id'};
|
||||
$oTva->set_parameter('id',$idx_tva);
|
||||
$oTva->load();
|
||||
$op_tva=new Acc_Compute();
|
||||
$op_tva->set_parameter("amount",$amount);
|
||||
$op_tva->set_parameter('amount_vat_rate',$oTva->get_parameter('rate'));
|
||||
$op_tva->compute_vat();
|
||||
$tva_item=$op_tva->get_parameter('amount_vat');
|
||||
|
||||
|
||||
if (isset($tva[$idx_tva] ) )
|
||||
$tva[$idx_tva]+=$tva_item;
|
||||
else
|
||||
$tva[$idx_tva]=$tva_item;
|
||||
$tot_tva=round(bcadd($tva_item,$tot_tva),2);
|
||||
|
||||
if (isset($tva[$idx_tva] ) )
|
||||
$tva[$idx_tva]+=$tva_item;
|
||||
else
|
||||
$tva[$idx_tva]=$tva_item;
|
||||
$tot_tva=round(bcadd($tva_item,$tot_tva),2);
|
||||
}
|
||||
|
||||
/* Save the stock */
|
||||
/* if the quantity is < 0 then the stock increase (return of
|
||||
|
|
@ -224,6 +228,7 @@ class Acc_Ledger_Sold extends Acc_Ledger {
|
|||
$op->oa_description=FormatString($e_comm);
|
||||
$op->save_form_plan($_POST,$i);
|
||||
}
|
||||
if ( $own->MY_TVA_USE=='Y') {
|
||||
/* save into quant_sold */
|
||||
$r=ExecSql($this->db,"select insert_quant_sold ".
|
||||
"('".$internal."',".$j_id.",'".${'e_march'.$i}
|
||||
|
|
@ -231,8 +236,15 @@ class Acc_Ledger_Sold extends Acc_Ledger {
|
|||
",".$tva_item.
|
||||
",".$idx_tva.",'".$e_client."')");
|
||||
|
||||
} // end loop : save all items
|
||||
|
||||
} else {
|
||||
$r=ExecSql($this->db,"select insert_quant_sold ".
|
||||
"('".$internal."',".$j_id.",'".${'e_march'.$i}
|
||||
."',".${'e_quant'.$i}.",".$amount.
|
||||
",0".
|
||||
",null,'".$e_client."')");
|
||||
|
||||
} // if ( $own->MY_TVA_USE=='Y') {
|
||||
}// end loop : save all items
|
||||
|
||||
/* save total customer */
|
||||
$cust_amount=bcadd($tot_amount,$tot_tva);
|
||||
|
|
@ -251,29 +263,31 @@ class Acc_Ledger_Sold extends Acc_Ledger {
|
|||
|
||||
/* save all vat
|
||||
* $i contains the tva_id and value contains the vat amount
|
||||
* if if ($own->MY_TVA_USE == 'Y' )
|
||||
*/
|
||||
foreach ($tva as $i => $value) {
|
||||
$oTva=new Acc_Tva($this->db);
|
||||
$oTva->set_parameter('id',$i);
|
||||
$oTva->load();
|
||||
if ($own->MY_TVA_USE == 'Y' ) {
|
||||
foreach ($tva as $i => $value) {
|
||||
$oTva=new Acc_Tva($this->db);
|
||||
$oTva->set_parameter('id',$i);
|
||||
$oTva->load();
|
||||
|
||||
$poste_vat=$oTva->get_side('c');
|
||||
|
||||
$cust_amount=bcadd($tot_amount,$tot_tva);
|
||||
$acc_operation=new Acc_Operation($this->db);
|
||||
$acc_operation->date=$e_date;
|
||||
$acc_operation->poste=$poste_vat;
|
||||
$acc_operation->amount=$value;
|
||||
$acc_operation->grpt=$seq;
|
||||
$acc_operation->jrn=$p_jrn;
|
||||
$acc_operation->type='c';
|
||||
$acc_operation->periode=$periode;
|
||||
if ($value < 0 ) $tot_debit=bcadd($tot_debit,abs($value));
|
||||
$acc_operation->insert_jrnx();
|
||||
|
||||
|
||||
}
|
||||
$poste_vat=$oTva->get_side('c');
|
||||
|
||||
$cust_amount=bcadd($tot_amount,$tot_tva);
|
||||
$acc_operation=new Acc_Operation($this->db);
|
||||
$acc_operation->date=$e_date;
|
||||
$acc_operation->poste=$poste_vat;
|
||||
$acc_operation->amount=$value;
|
||||
$acc_operation->grpt=$seq;
|
||||
$acc_operation->jrn=$p_jrn;
|
||||
$acc_operation->type='c';
|
||||
$acc_operation->periode=$periode;
|
||||
if ($value < 0 ) $tot_debit=bcadd($tot_debit,abs($value));
|
||||
$acc_operation->insert_jrnx();
|
||||
|
||||
|
||||
}
|
||||
} // if ($own->MY_TVA_USE=='Y')
|
||||
/* insert into jrn */
|
||||
$acc_operation=new Acc_Operation($this->db);
|
||||
$acc_operation->date=$e_date;
|
||||
|
|
@ -283,7 +297,16 @@ class Acc_Ledger_Sold extends Acc_Ledger {
|
|||
$acc_operation->grpt=$seq;
|
||||
$acc_operation->jrn=$p_jrn;
|
||||
$acc_operation->periode=$periode;
|
||||
$acc_operation->pj=$e_pj;
|
||||
$acc_operation->insert_jrn();
|
||||
$this->pj=$acc_operation->set_pj();
|
||||
|
||||
/* if e_suggest != e_pj then do not increment sequence */
|
||||
/* and e_pj is not null */
|
||||
if ( strcmp($e_pj,$e_pj_suggest) == 0 && strlen( trim($e_pj)) != 0 ) {
|
||||
$this->inc_seq_pj();
|
||||
}
|
||||
|
||||
ExecSql($this->db,"update jrn set jr_internal='".$internal."' where ".
|
||||
" jr_grpt_id = ".$seq);
|
||||
|
||||
|
|
@ -297,7 +320,7 @@ class Acc_Ledger_Sold extends Acc_Ledger {
|
|||
echo $this->create_document($internal,$p_array);
|
||||
echo '<br>';
|
||||
}
|
||||
//----------------------------------------
|
||||
//----------------------------------------
|
||||
// Save the payer
|
||||
//----------------------------------------
|
||||
if ( $e_mp != 0 ) {
|
||||
|
|
@ -476,7 +499,7 @@ class Acc_Ledger_Sold extends Acc_Ledger {
|
|||
if ( $p_array != null ) extract($p_array);
|
||||
|
||||
$user = new User($this->db);
|
||||
|
||||
$own=new Own($this->db);
|
||||
// The first day of the periode
|
||||
$oPeriode=new Periode($this->db);
|
||||
list ($l_date_start,$l_date_end)=$oPeriode->get_date_limit($user->get_periode());
|
||||
|
|
@ -484,12 +507,12 @@ class Acc_Ledger_Sold extends Acc_Ledger {
|
|||
$op_date=( ! isset($e_date) ) ?$l_date_start:$e_date;
|
||||
$e_ech=(isset($e_ech))?$e_ech:"";
|
||||
$e_comm=(isset($e_comm))?$e_comm:"";
|
||||
|
||||
|
||||
$r="";
|
||||
|
||||
$r.=JS_INFOBULLE;
|
||||
$r.=JS_SEARCH_CARD;
|
||||
//!\todo check if JS_SHOW_TVA is really needed here otherwise remove it (same for class_acc_ledger_purchase)
|
||||
$r.=JS_SHOW_TVA;
|
||||
$r.=JS_TVA;
|
||||
$r.=JS_AJAX_FICHE;
|
||||
|
|
@ -531,11 +554,16 @@ class Acc_Ledger_Sold extends Acc_Ledger {
|
|||
// Ledger (p_jrn)
|
||||
//--
|
||||
$wLedger=$this->select_ledger('VEN',2);
|
||||
/* if we suggest the next pj, then we need a javascript */
|
||||
$add_js="";
|
||||
if ( $own->MY_PJ_SUGGEST=='Y') {
|
||||
$add_js="update_pj();";
|
||||
}
|
||||
|
||||
if ( $wLedger == null )
|
||||
exit('Pas de journal disponible');
|
||||
$wLedger->table=1;
|
||||
$wLedger->javascript="onChange='update_predef(\"ven\",\"f\")'";
|
||||
$wLedger->javascript="onChange='update_predef(\"ven\",\"f\");$add_js'";
|
||||
$wLedger->label=" Journal ".widget::infobulle(2) ;
|
||||
|
||||
$r.=$wLedger->IOValue();
|
||||
|
|
@ -544,12 +572,29 @@ class Acc_Ledger_Sold extends Acc_Ledger {
|
|||
$Commentaire=new widget("text");
|
||||
$Commentaire->table=0;
|
||||
$Commentaire->SetReadOnly(false);
|
||||
$Commentaire->size=80;
|
||||
$Commentaire->size=60;
|
||||
$Commentaire->tabindex=3;
|
||||
$label=" Description ".widget::infobulle(1) ;
|
||||
$r.="<tr>";
|
||||
$r.='<td class="input_text">'.$label.'</td>'.
|
||||
'<td colspan="5">'.$Commentaire->IOValue("e_comm",h($e_comm))."</td>";
|
||||
'<td colspan="3">'.$Commentaire->IOValue("e_comm",h($e_comm))."</td>";
|
||||
// PJ
|
||||
//--
|
||||
/* suggest PJ ? */
|
||||
$default_pj='';
|
||||
if ( $own->MY_PJ_SUGGEST=='Y') {
|
||||
$default_pj=$this->guess_pj();
|
||||
}
|
||||
|
||||
$pj=new widget('text');
|
||||
|
||||
|
||||
$pj->table=0;
|
||||
$pj->name="e_pj";
|
||||
$pj->size=10;
|
||||
$pj->value=(isset($e_pj))?$e_pj:$default_pj;
|
||||
|
||||
$r.='<td class="input_text">Num.PJ</td><td>'.$pj->IOValue().widget::hidden('e_pj_suggest',$default_pj).'</td>';
|
||||
$r.="</tr>";
|
||||
|
||||
// Display the customer
|
||||
|
|
@ -609,11 +654,16 @@ class Acc_Ledger_Sold extends Acc_Ledger {
|
|||
$r.="<th>Dénomination</th>";
|
||||
$label=widget::infobulle(6) ;
|
||||
$r.="<th>$label prix / unité htva </th>";
|
||||
$r.="<th>tva</th>";
|
||||
$r.="<th>montant total tva</th>";
|
||||
if ( $own->MY_TVA_USE=='Y') {
|
||||
$r.="<th>tva</th>";
|
||||
$r.="<th>montant total tva</th>";
|
||||
}
|
||||
|
||||
$r.="<th>quantité</th>";
|
||||
|
||||
$r.='</TR>';
|
||||
|
||||
$own=new Own($this->db);
|
||||
// For each article
|
||||
//--
|
||||
for ($i=0;$i< MAX_ARTICLE;$i++) {
|
||||
|
|
@ -621,7 +671,8 @@ class Acc_Ledger_Sold extends Acc_Ledger {
|
|||
//--
|
||||
$march=(isset(${"e_march$i"}))?${"e_march$i"}:"";
|
||||
$march_price=(isset(${"e_march".$i."_price"}))?${"e_march".$i."_price"}:"";
|
||||
$march_tva_id=(isset(${"e_march$i"."_tva_id"}))?${"e_march$i"."_tva_id"}:"";
|
||||
if ( $own->MY_TVA_USE=='Y')
|
||||
$march_tva_id=(isset(${"e_march$i"."_tva_id"}))?${"e_march$i"."_tva_id"}:"";
|
||||
|
||||
|
||||
$march_label=" ";
|
||||
|
|
@ -631,9 +682,11 @@ class Acc_Ledger_Sold extends Acc_Ledger {
|
|||
$fMarch=new fiche($this->db);
|
||||
$fMarch->get_by_qcode($march);
|
||||
$march_label=$fMarch->strAttribut(ATTR_DEF_NAME);
|
||||
if ( ! (isset(${"e_march$i"."_tva_id"})))
|
||||
$march_tva_id=$fMarch->strAttribut(ATTR_DEF_TVA);
|
||||
}
|
||||
if ( $own->MY_TVA_USE=='Y') {
|
||||
if ( ! (isset(${"e_march$i"."_tva_id"})))
|
||||
$march_tva_id=$fMarch->strAttribut(ATTR_DEF_TVA);
|
||||
}
|
||||
}
|
||||
// Show input
|
||||
//--
|
||||
$W1=new widget("js_search_only");
|
||||
|
|
@ -652,7 +705,7 @@ class Acc_Ledger_Sold extends Acc_Ledger {
|
|||
$W1->readonly=false;
|
||||
$r.="<TR>".$W1->IOValue();
|
||||
// For computing we need some hidden field for holding the value
|
||||
$r.=widget::hidden('tva_march'.$i,0);
|
||||
if ( $own->MY_TVA_USE=='Y') $r.=widget::hidden('tva_march'.$i,0);
|
||||
$r.=widget::hidden('htva_march'.$i,0);
|
||||
$r.=widget::hidden('tvac_march'.$i,0);
|
||||
$r.="</TD>";
|
||||
|
|
@ -668,22 +721,24 @@ class Acc_Ledger_Sold extends Acc_Ledger {
|
|||
$Price->size=9;
|
||||
$Price->javascript="onBlur='compute_sold($i)'";
|
||||
$r.=$Price->IOValue("e_march".$i."_price",$march_price);
|
||||
// vat label
|
||||
//--
|
||||
$select_tva=make_array($this->db,"select tva_id,tva_label from tva_rate order by tva_rate desc",0);
|
||||
$Tva=new widget("select");
|
||||
$Tva->javascript="onChange=compute_sold($i)";
|
||||
$Tva->table=1;
|
||||
$Tva->selected=$march_tva_id;
|
||||
$r.=$Tva->IOValue("e_march$i"."_tva_id",$select_tva);
|
||||
// vat amount (disable)
|
||||
//--
|
||||
$wTva_amount=new widget("text");
|
||||
$wTva_amount->table=1;
|
||||
$wTva_amount->readonly=true;
|
||||
$wTva_amount->size=6;
|
||||
$r.=$wTva_amount->IOValue("tva_march$i"."_show");
|
||||
|
||||
// if tva is not needed then no tva field
|
||||
if ( $own->MY_TVA_USE == 'Y' ) {
|
||||
// vat label
|
||||
//--
|
||||
$select_tva=make_array($this->db,"select tva_id,tva_label from tva_rate order by tva_rate desc",0);
|
||||
$Tva=new widget("select");
|
||||
$Tva->javascript="onChange=compute_sold($i)";
|
||||
$Tva->table=1;
|
||||
$Tva->selected=$march_tva_id;
|
||||
$r.=$Tva->IOValue("e_march$i"."_tva_id",$select_tva);
|
||||
// vat amount (disable)
|
||||
//--
|
||||
$wTva_amount=new widget("text");
|
||||
$wTva_amount->table=1;
|
||||
$wTva_amount->readonly=true;
|
||||
$wTva_amount->size=6;
|
||||
$r.=$wTva_amount->IOValue("tva_march$i"."_show");
|
||||
}
|
||||
// quantity
|
||||
//--
|
||||
$quant=(isset(${"e_quant$i"}))?${"e_quant$i"}:"1";
|
||||
|
|
@ -706,16 +761,21 @@ class Acc_Ledger_Sold extends Acc_Ledger {
|
|||
|
||||
$r.='<div style="position:float;float:right;text-align:left;font-size:1.2em;font-weight:bold;color:blue" id="sum">';
|
||||
$r.='<br><span id="htva">0.0</span>';
|
||||
$r.='<br><span id="tva">0.0</span>';
|
||||
$r.='<br><span id="tvac">0.0</span>';
|
||||
if ( $own->MY_TVA_USE=='Y' ) {
|
||||
$r.='<br><span id="tva">0.0</span>';
|
||||
$r.='<br><span id="tvac">0.0</span>';
|
||||
}
|
||||
$r.="</div>";
|
||||
|
||||
|
||||
|
||||
$r.='<div style="position:float;float:right;text-align:right;padding-right:5px;font-size:1.2em;font-weight:bold;color:blue">';
|
||||
if ( $own->MY_TVA_USE=='Y') {
|
||||
$r.='<br>Total HTVA';
|
||||
$r.='<br>Total TVA';
|
||||
$r.='<br>Total TVAC';
|
||||
}
|
||||
$r.='<br>Total';
|
||||
$r.="</div>";
|
||||
|
||||
$r.="</fieldset>";
|
||||
|
|
@ -747,7 +807,7 @@ class Acc_Ledger_Sold extends Acc_Ledger {
|
|||
extract ($p_array);
|
||||
$this->verify($p_array) ;
|
||||
|
||||
// to show a select list for the analytic
|
||||
// to show a select list for the analytic & VAT USE
|
||||
// if analytic is op (optionnel) there is a blank line
|
||||
$own = new Own($this->db);
|
||||
|
||||
|
|
@ -773,7 +833,7 @@ class Acc_Ledger_Sold extends Acc_Ledger {
|
|||
$r.='<td> Journal '.h($this->get_name()).'</td>';
|
||||
$r.='</tr>';
|
||||
$r.='<tr>';
|
||||
$r.='<td colspan="3"> Description '.h($e_comm).'</td>';
|
||||
$r.='<td colspan="3"> Description '.h($e_comm).'</td><td>PJ Num: '.h($e_pj).'</td>';
|
||||
$r.='</tr>';
|
||||
$r.='<tr>';
|
||||
$r.='<td colspan="3"> Client '.h($e_client.':'.$client_name).'</td>';
|
||||
|
|
@ -789,8 +849,10 @@ class Acc_Ledger_Sold extends Acc_Ledger {
|
|||
$r.="<th>tva</th>";
|
||||
$r.="<th>quantité</th>";
|
||||
|
||||
$r.='<th> Montant TVA</th>';
|
||||
$r.='<th>Montant HTVA</th>';
|
||||
if ( $own->MY_TVA_USE=='Y') {
|
||||
$r.='<th> Montant TVA</th>';
|
||||
$r.='<th>Montant HTVA</th>';
|
||||
}
|
||||
$r.=($own->MY_ANALYTIC!='nu')?'<th>Compt. Analytique</th>':'';
|
||||
$r.='</tr>';
|
||||
$tot_amount=0.0;
|
||||
|
|
@ -802,24 +864,28 @@ class Acc_Ledger_Sold extends Acc_Ledger {
|
|||
$fiche=new fiche($this->db);
|
||||
$fiche->get_by_qcode(${"e_march".$i});
|
||||
$fiche_name=h($fiche->getName());
|
||||
$oTva=new Acc_Tva($this->db);
|
||||
$idx_tva=${"e_march".$i."_tva_id"};
|
||||
|
||||
$oTva->set_parameter('id',$idx_tva);
|
||||
$oTva->load();
|
||||
if ( $own->MY_TVA_USE=='Y') {
|
||||
$oTva=new Acc_Tva($this->db);
|
||||
$idx_tva=${"e_march".$i."_tva_id"};
|
||||
|
||||
$oTva->set_parameter('id',$idx_tva);
|
||||
$oTva->load();
|
||||
}
|
||||
$op=new Acc_Compute();
|
||||
$amount=bcmul(${"e_march".$i."_price"},${'e_quant'.$i});
|
||||
|
||||
$op->set_parameter("amount",$amount);
|
||||
$op->set_parameter('amount_vat_rate',$oTva->get_parameter('rate'));
|
||||
$op->compute_vat();
|
||||
$tva_item=$op->get_parameter('amount_vat');
|
||||
if (isset($tva[$idx_tva] ) )
|
||||
$tva[$idx_tva]+=$tva_item;
|
||||
else
|
||||
$tva[$idx_tva]=$tva_item;
|
||||
if ( $own->MY_TVA_USE=='Y') {
|
||||
$op->set_parameter('amount_vat_rate',$oTva->get_parameter('rate'));
|
||||
$op->compute_vat();
|
||||
$tva_item=$op->get_parameter('amount_vat');
|
||||
if (isset($tva[$idx_tva] ) )
|
||||
$tva[$idx_tva]+=$tva_item;
|
||||
else
|
||||
$tva[$idx_tva]=$tva_item;
|
||||
$tot_tva=round(bcadd($tva_item,$tot_tva),2);
|
||||
}
|
||||
$tot_amount=round(bcadd($tot_amount,$amount),2);
|
||||
$tot_tva=round(bcadd($tva_item,$tot_tva),2);
|
||||
|
||||
$r.='<tr>';
|
||||
$r.='<td>';
|
||||
$r.=${"e_march".$i};
|
||||
|
|
@ -833,13 +899,14 @@ class Acc_Ledger_Sold extends Acc_Ledger {
|
|||
$r.='<td align="right">';
|
||||
$r.=${"e_quant".$i};
|
||||
$r.='</td>';
|
||||
|
||||
$r.='<td align="right">';
|
||||
$r.=$oTva->get_parameter('label');
|
||||
$r.='</td>';
|
||||
$r.='<td align="right">';
|
||||
$r.=$tva_item;
|
||||
$r.='</td>';
|
||||
if ( $own->MY_TVA_USE=='Y') {
|
||||
$r.='<td align="right">';
|
||||
$r.=$oTva->get_parameter('label');
|
||||
$r.='</td>';
|
||||
$r.='<td align="right">';
|
||||
$r.=$tva_item;
|
||||
$r.='</td>';
|
||||
}
|
||||
$r.='<td align="right">';
|
||||
$r.=$amount;
|
||||
$r.='</td>';
|
||||
|
|
@ -873,26 +940,32 @@ class Acc_Ledger_Sold extends Acc_Ledger {
|
|||
$r.='<fieldset> <legend>Totaux</legend>';
|
||||
$tot=round(bcadd($tot_amount,$tot_tva),2);
|
||||
$r.='<div style="width:40%;position:float;float:left;text-align:right;padding-left:5%;padding-right:5%;color:blue;font-size:1.2em;font-weight:bold">';
|
||||
$r.='<br>Total HTVA';
|
||||
|
||||
foreach ($tva as $i=>$value) {
|
||||
$oTva->set_parameter('id',$i);
|
||||
$oTva->load();
|
||||
|
||||
$r.='<br> TVA à '.$oTva->get_parameter('label');
|
||||
/* use VAT */
|
||||
if ($own->MY_TVA_USE == 'Y' ) {
|
||||
$r.='<br>Total HTVA';
|
||||
foreach ($tva as $i=>$value) {
|
||||
$oTva->set_parameter('id',$i);
|
||||
$oTva->load();
|
||||
|
||||
$r.='<br> TVA à '.$oTva->get_parameter('label');
|
||||
}
|
||||
$r.='<br>Total TVA';
|
||||
$r.='<br>Total TVAC';
|
||||
} else {
|
||||
$r.='<br>Total ';
|
||||
}
|
||||
$r.='<br>Total TVA';
|
||||
$r.='<br>Total TVAC';
|
||||
$r.='</div>';
|
||||
|
||||
$r.='<div style="position:float;float:left;text-align:right;color:blue;font-size:1.2em;font-weight:bold">';
|
||||
$r.='<br><span id="htva">'.$tot_amount.'</span>';
|
||||
|
||||
foreach ($tva as $i=>$value) {
|
||||
$r.='<br>'.$tva[$i];
|
||||
if ($own->MY_TVA_USE == 'Y' ) {
|
||||
foreach ($tva as $i=>$value) {
|
||||
$r.='<br>'.$tva[$i];
|
||||
}
|
||||
$r.='<br><span id="tva">'.$tot_tva.'</span>';
|
||||
$r.='<br><span id="tvac">'.$tot.'</span>';
|
||||
}
|
||||
$r.='<br><span id="tva">'.$tot_tva.'</span>';
|
||||
$r.='<br><span id="tvac">'.$tot.'</span>';
|
||||
$r.="</div>";
|
||||
|
||||
|
||||
|
|
@ -905,10 +978,13 @@ class Acc_Ledger_Sold extends Acc_Ledger {
|
|||
$r.=widget::hidden('nb_item',$nb_item);
|
||||
$r.=widget::hidden('p_jrn',$p_jrn);
|
||||
$r.=widget::hidden('periode',$periode);
|
||||
/*\todo comment les types hidden gérent ils des contenus avec des quotes, double quote ou < > ??? */
|
||||
/*\todo comment les types hidden gérent ils des contenus avec des quotes, double quote ou < > ??? */
|
||||
$r.=widget::hidden('e_comm',$e_comm);
|
||||
$r.=widget::hidden('e_date',$e_date);
|
||||
$r.=widget::hidden('e_ech',$e_ech);
|
||||
$r.=widget::hidden('e_pj',$e_pj);
|
||||
$r.=widget::hidden('e_pj_suggest',$e_pj_suggest);
|
||||
|
||||
$e_mp=(isset($e_mp))?$e_mp:0;
|
||||
$r.=widget::hidden('e_mp',$e_mp);
|
||||
/* Paid by */
|
||||
|
|
@ -927,7 +1003,7 @@ class Acc_Ledger_Sold extends Acc_Ledger {
|
|||
for ($i=0;$i < $nb_item;$i++) {
|
||||
$r.=widget::hidden("e_march".$i,${"e_march".$i});
|
||||
$r.=widget::hidden("e_march".$i."_price",${"e_march".$i."_price"});
|
||||
$r.=widget::hidden("e_march".$i."_tva_id",${"e_march".$i."_tva_id"});
|
||||
if ( $own->MY_TVA_USE=='Y') $r.=widget::hidden("e_march".$i."_tva_id",${"e_march".$i."_tva_id"});
|
||||
$r.=widget::hidden("e_quant".$i,${"e_quant".$i});
|
||||
}
|
||||
|
||||
|
|
@ -1010,13 +1086,8 @@ class Acc_Ledger_Sold extends Acc_Ledger {
|
|||
|
||||
|
||||
}
|
||||
/*!\brief
|
||||
*\param
|
||||
*\return
|
||||
*\note
|
||||
*\see
|
||||
*\todo
|
||||
*/
|
||||
/*!\brief test function
|
||||
*/
|
||||
static function test_me() {
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -88,7 +88,51 @@ var $jr_id; /*!< pk of jrn */
|
|||
$this->jrnx_id=GetSequence($this->db,'s_jrn_op');
|
||||
return $this->jrnx_id;
|
||||
|
||||
}
|
||||
}
|
||||
/*!\brief set the pj of a operation in jrn. the jr_id must be set
|
||||
*\note if the jr_id it fails
|
||||
*/
|
||||
function set_pj() {
|
||||
if ( strlen(trim($this->pj)) == 0 ) {
|
||||
$sql="update jrn set jr_pj_number=$1 where jr_id=$2";
|
||||
ExecSqlParam($this->db,$sql,array(null,$this->jr_id));
|
||||
return '';
|
||||
}
|
||||
/* is pj uniq ? */
|
||||
if ( CountSql($this->db,"select jr_id from jrn where jr_pj_number=$1 and jr_def_id=$2",
|
||||
array($this->pj,$this->jrn)
|
||||
) == 0 ) {
|
||||
$sql="update jrn set jr_pj_number=$1 where jr_id=$2";
|
||||
ExecSqlParam($this->db,$sql,array($this->pj,$this->jr_id));
|
||||
} else {
|
||||
/* get pref */
|
||||
$pref=getDbValue($this->db,"select jrn_def_pj_pref from jrn_def where jrn_def_id=$1",
|
||||
array($this->jrn));
|
||||
/* try another seq */
|
||||
$flag=0;$limit=100;
|
||||
while ( $flag == 0 ) {
|
||||
/* limit the search to $limit */
|
||||
if ( $limit < 1 ) { $this->pj='';$flag=2; break;}
|
||||
|
||||
$seq=NextSequence($this->db,'s_jrn_pj'.$this->jrn);
|
||||
$this->pj=$pref.$seq;
|
||||
|
||||
/* check if the new pj numb exist */
|
||||
$c=CountSql($this->db,"select jr_id from jrn where jr_pj_number=$1 and jr_def_id=$2",
|
||||
array($this->pj,$this->jrn)
|
||||
);
|
||||
if ( $c == 0 ) { $flag=1; break;}
|
||||
$limit--;
|
||||
}
|
||||
/* a pj numb is found */
|
||||
if ( $flag == 1 ) {
|
||||
$sql="update jrn set jr_pj_number=$1 where jr_id=$2";
|
||||
ExecSqlParam($this->db,$sql,array($this->pj,$this->jr_id));
|
||||
}
|
||||
}
|
||||
return $this->pj;
|
||||
}
|
||||
|
||||
/*!
|
||||
**************************************************
|
||||
*\brief Insert into the table Jrn, the amount is computed from jrnx thanks the
|
||||
|
|
@ -101,7 +145,7 @@ var $jr_id; /*!< pk of jrn */
|
|||
function insert_jrn()
|
||||
{
|
||||
$p_comment=FormatString($this->desc);
|
||||
|
||||
|
||||
$diff=getDbValue($this->db,"select check_balance ($1)",array($this->grpt));
|
||||
if ( $diff != 0 ) {
|
||||
|
||||
|
|
@ -172,6 +216,18 @@ function get_internal() {
|
|||
$sql="update jrnx set j_text=$1 where j_id=$2";
|
||||
ExecSqlParam($this->db,$sql,array($p_text,$this->jrnx_id));
|
||||
}
|
||||
/*!\brief add a comment to the operation (jrn.jr_text) */
|
||||
function operation_update_comment($p_text)
|
||||
{
|
||||
$sql="update jrn set jr_comment=$1 where jr_id=$2";
|
||||
ExecSqlParam($this->db,$sql,array($p_text,$this->jr_id));
|
||||
}
|
||||
/*!\brief return the jrn_def_id from jrn */
|
||||
function get_ledger() {
|
||||
$sql="select jr_def_id from jrn where jr_id=$1";
|
||||
$row=getDbValue($this->db,$sql,array($this->jr_id));
|
||||
return $row;
|
||||
}
|
||||
/*!\brief display_jrnx_detail : get the data from get_jrnx_data and
|
||||
return a string with HTML code
|
||||
* \param table(=0 no code for table,1 code for table,2 code for CSV)
|
||||
|
|
|
|||
|
|
@ -327,6 +327,7 @@ class Acc_Payment
|
|||
$ac=new Acc_Payment($cn);
|
||||
$ac->set_parameter('type','ACH');
|
||||
echo '<form method="post">';
|
||||
echo widget::hidden('test_select',$_REQUEST['test_select']);
|
||||
echo $ac->select();
|
||||
echo widget::submit('go','go');
|
||||
echo '</form>';
|
||||
|
|
|
|||
|
|
@ -22,12 +22,9 @@
|
|||
|
||||
/*!\file
|
||||
* \brief class acc_reconciliation, this class is new and the code
|
||||
* must use it (remove the function insertRapt)
|
||||
* must use it
|
||||
*
|
||||
*/
|
||||
/*!\todo replace all the use of the reconciliation by this class
|
||||
*/
|
||||
|
||||
require_once ('postgres.php');
|
||||
require_once ('class_dossier.php');
|
||||
require_once ('class_widget.php');
|
||||
|
|
|
|||
|
|
@ -143,6 +143,7 @@ function form($p_line=0) {
|
|||
$r.='<td>';
|
||||
$search=new widget('js_search_poste_only');
|
||||
$search->extra="form".$i;
|
||||
$search->extra2='poste';
|
||||
$r.=$search->IOValue();
|
||||
$r.='</td>';
|
||||
|
||||
|
|
@ -218,7 +219,6 @@ function form($p_line=0) {
|
|||
if ( strlen(trim($row->get_parameter("name"))) != 0 &&
|
||||
strlen(trim($row->get_parameter("formula"))) != 0 )
|
||||
{
|
||||
|
||||
$ix=($row->get_parameter("position")!="")?$row->get_parameter("position"):$ix;
|
||||
$row->set_parameter("position",$ix);
|
||||
$ret_sql=ExecSqlParam($this->db,
|
||||
|
|
@ -391,7 +391,7 @@ function form($p_line=0) {
|
|||
/* Add a line should be a javascript see comptanalytic */
|
||||
// $r.= '<INPUT TYPE="submit" value="Ajoute une ligne" name="add_line">';
|
||||
echo '<INPUT TYPE="submit" value="Efface ce rapport" name="del_form">';
|
||||
|
||||
echo widget::hidden('test_select',$_REQUEST['test_select']);
|
||||
echo "</FORM>";
|
||||
if ( isset ($_POST['update'])) {
|
||||
$b=new Acc_Report($cn);
|
||||
|
|
|
|||
|
|
@ -77,12 +77,14 @@ class Acc_Report_Row
|
|||
|
||||
if ( isset(${'form'.$ix}) && isset ( ${'text'.$ix} )) {
|
||||
$obj=new Acc_Report_Row( ${'text'.$ix},${'form'.$ix});
|
||||
|
||||
if ( isset(${'pos'.$ix}) && isNumber(${'pos'.$ix})==1 )
|
||||
$obj->set_parameter("position",$ix);
|
||||
$obj->set_parameter("position",${'pos'.$ix});
|
||||
else {
|
||||
$obj->set_parameter("position",$found);
|
||||
$found++;
|
||||
}
|
||||
|
||||
$obj->fo_id=0;
|
||||
$obj->fo_fr_id=$this->fo_fr_id;
|
||||
$obj->db=$this->db;
|
||||
|
|
|
|||
|
|
@ -147,11 +147,7 @@ class Acc_Tva
|
|||
$res=ExecSqlParam($this->cn,$sql,array($this->tva_id));
|
||||
}
|
||||
/*!\brief
|
||||
*\param
|
||||
*\return
|
||||
*\note
|
||||
*\see
|
||||
*\todo
|
||||
* Test function
|
||||
*/
|
||||
static function test_me() {
|
||||
$cn=DbConnect(dossier::id());
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ class action
|
|||
$desc->heigh=100;
|
||||
$desc->name="ag_comment";
|
||||
$desc->readonly=$readonly;
|
||||
/*!\todo Formatstring and urldecode ?? */
|
||||
|
||||
$desc->value=FormatString(urldecode($this->ag_comment));
|
||||
|
||||
// state
|
||||
|
|
|
|||
|
|
@ -110,7 +110,6 @@ class Anc_Operation
|
|||
}
|
||||
|
||||
/*!\brief update a row in the table operation_analytique
|
||||
* \todo update
|
||||
*/
|
||||
function update() {
|
||||
if ( $this->po_id == -1) { $this->delete();return;}
|
||||
|
|
@ -120,7 +119,6 @@ class Anc_Operation
|
|||
}
|
||||
|
||||
/*!\brief get a list of row from a certain periode
|
||||
* \todo to be done
|
||||
*/
|
||||
function get_list($p_from,$p_to,$p_from_poste="",$p_to_poste="") {
|
||||
$cond="";
|
||||
|
|
|
|||
|
|
@ -401,6 +401,7 @@ class Bud_Data {
|
|||
" from bud_hypothese join poste_analytique using (pa_id)";
|
||||
$w=new widget("select");
|
||||
echo '<form>';
|
||||
echo widget::hidden('test_select',$_REQUEST['test_select']);
|
||||
echo dossier::hidden();
|
||||
$w->selected=(isset($_REQUEST['bh_po_id']))?$_REQUEST['bh_po_id']:"";
|
||||
echo $w->IOValue('bh_po_id',make_array($cn,$sql));
|
||||
|
|
|
|||
|
|
@ -287,6 +287,7 @@ class Bud_Synthese_Acc extends Bud_Synthese {
|
|||
if ( isset($_GET['recherche'])) {
|
||||
$obj->from_array($_GET);
|
||||
echo '<form method="GET">';
|
||||
widget::hidden('test_select',$_REQUEST['test_select']);
|
||||
echo $obj->form();
|
||||
echo widget::hidden('bh_id',$obj->bh_id);
|
||||
echo widget::submit('recherche2','recherche');
|
||||
|
|
|
|||
|
|
@ -274,12 +274,14 @@ class Bud_Synthese_Anc extends Bud_Synthese {
|
|||
$cn=DbConnect(dossier::id());
|
||||
$obj=new Bud_Synthese_Anc($cn);
|
||||
echo '<form method="GET">';
|
||||
echo widget::hidden('test_select',$_REQUEST['test_select']);
|
||||
echo $obj->select_hypo();
|
||||
echo widget::submit('recherche','recherche');
|
||||
echo '</form>';
|
||||
if ( isset($_GET['recherche'])) {
|
||||
$obj->from_array($_GET);
|
||||
echo '<form method="GET">';
|
||||
echo widget::hidden('test_select',$_REQUEST['test_select']);
|
||||
echo $obj->form();
|
||||
echo widget::hidden('bh_id',$obj->bh_id);
|
||||
echo widget::submit('recherche2','recherche');
|
||||
|
|
|
|||
|
|
@ -522,6 +522,7 @@ Array
|
|||
$cn=DbConnect(dossier::id());
|
||||
$obj=new Bud_Synthese_Group($cn);
|
||||
echo '<form method="GET">';
|
||||
echo widget::hidden('test_select',$_REQUEST['test_select']);
|
||||
echo $obj->select_hypo();
|
||||
echo widget::submit('recherche','recherche');
|
||||
echo '</form>';
|
||||
|
|
@ -530,6 +531,7 @@ Array
|
|||
echo '<form method="GET">';
|
||||
echo $obj->form();
|
||||
echo widget::hidden('bh_id',$obj->bh_id);
|
||||
echo widget::hidden('test_select',$_REQUEST['test_select']);
|
||||
echo widget::submit('recherche2','recherche');
|
||||
echo '</form>';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -406,6 +406,7 @@ Array
|
|||
$cn=DbConnect(dossier::id());
|
||||
$obj=new Bud_Synthese_Hypo($cn);
|
||||
echo '<form method="GET">';
|
||||
echo widget::hidden('test_select',$_REQUEST['test_select']);
|
||||
echo $obj->form();
|
||||
echo widget::submit('recherche','Recherche');
|
||||
echo '</form>';
|
||||
|
|
|
|||
|
|
@ -70,12 +70,11 @@ class Customer extends fiche{
|
|||
|
||||
}
|
||||
/*!
|
||||
**************************************************
|
||||
* \brief Get all the info for making a vat listing
|
||||
* for the vat administration
|
||||
* \todo optimize SQL
|
||||
*
|
||||
* \param periode
|
||||
* \param $p_year
|
||||
*
|
||||
* \return double array structure is
|
||||
* ( j_poste,name,vat_number,amount,tva,customer(object)
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ require_once('class_own.php');
|
|||
require_once('class_acc_account_ledger.php');
|
||||
require_once('class_action.php');
|
||||
require_once('class_acc_tva.php');
|
||||
require_once('class_user.php');
|
||||
|
||||
/*! \file
|
||||
* \brief Class Document corresponds to the table document
|
||||
|
|
@ -455,7 +456,7 @@ class Document
|
|||
* - [VEN_TVA]
|
||||
* - [TOTAL_VEN_HTVA]
|
||||
* - [DATE]
|
||||
* - [NUMBER_ID]
|
||||
* - [NUMBER]
|
||||
* - [MY_NAME]
|
||||
* - [MY_CP]
|
||||
* - [MY_COMMUNE]
|
||||
|
|
@ -467,6 +468,10 @@ class Document
|
|||
* - BON_COMMANDE
|
||||
* - OTHER_INFO
|
||||
* - CUST_NUM
|
||||
* - CUST_BANQUE_NAME
|
||||
* - CUST_BANQUE_NO
|
||||
* - USER
|
||||
* - REFERENCE
|
||||
*
|
||||
* \param $p_tag TAG
|
||||
* \return String which must replace the tag
|
||||
|
|
@ -613,7 +618,10 @@ class Document
|
|||
$r=$this->d_number;
|
||||
break;
|
||||
|
||||
|
||||
case 'USER' :
|
||||
return $_SESSION['use_name'].', '.$_SESSION['use_first_name'];
|
||||
|
||||
break;
|
||||
case 'REFERENCE':
|
||||
$act=new action($this->db);
|
||||
$act->ag_id=$this->ag_id;
|
||||
|
|
@ -708,6 +716,8 @@ class Document
|
|||
$qt='e_quant'.$counter;
|
||||
$price='e_march'.$counter.'_price' ;
|
||||
$tva='e_march'.$counter.'_tva_id';
|
||||
/* if we do not use vat this var. is not set */
|
||||
if ( !isset(${$tva}) ) return '';
|
||||
if ( !isset (${'e_march'.$counter}) ) return "";
|
||||
// check that something is sold
|
||||
if ( ${$price} == 0 || ${$qt} == 0
|
||||
|
|
@ -715,7 +725,7 @@ class Document
|
|||
|| strlen(trim($qt)) ==0)
|
||||
return "";
|
||||
$a_tva=GetTvaRate($this->db,${$tva});
|
||||
echo_debug('class_document',__LINE__,'Tva :'.var_export($a_tva,true));
|
||||
echo_debug('class_document',__LINE__,'Tva :'.var_eanalyticxport($a_tva,true));
|
||||
// if no vat returns 0
|
||||
if ( sizeof($a_tva) == 0 ) return "";
|
||||
$r=round(${$price},2)*${$qt}*$a_tva['tva_rate'];
|
||||
|
|
@ -787,10 +797,6 @@ class Document
|
|||
|| strlen(trim( ${'e_march'.$counter.'_price'} )) ==0
|
||||
|| strlen(trim(${'e_quant'.$counter})) ==0)
|
||||
return "";
|
||||
/*!\todo verify that price and quant are numeric
|
||||
*/
|
||||
/*!\todo carefull round problem ?
|
||||
*/
|
||||
|
||||
$r=round(${$id}*${$quant},2);
|
||||
break;
|
||||
|
|
@ -805,14 +811,15 @@ class Document
|
|||
// check that something is sold
|
||||
if ( ${'e_march'.$counter.'_price'} == 0 || ${'e_quant'.$counter} == 0 )
|
||||
return "";
|
||||
/*!\todo verify that price and quant are numeric
|
||||
*/
|
||||
/*!\todo carefull round problem ?
|
||||
*/
|
||||
$r=${$id}*${$quant};
|
||||
$tva=GetTvaRate($this->db,${'e_march'.$counter.'_tva_id'});
|
||||
$tva='e_march'.$counter.'_tva_id';
|
||||
/* if we do not use vat this var. is not set */
|
||||
if ( !isset(${$tva}) ) return $r;
|
||||
|
||||
$tva=GetTvaRate($this->db,${$tva});
|
||||
// if there is no vat we return now
|
||||
if ( $tva == null || $tva == 0 ) return $r;
|
||||
|
||||
// we compute with the vat included
|
||||
$r=$r+$r*$tva['tva_rate'];
|
||||
$r=round($r,2);
|
||||
|
|
@ -849,9 +856,15 @@ class Document
|
|||
$sum=0.0;
|
||||
for ($i=0;$i<$nb_item;$i++)
|
||||
{
|
||||
$tva=GetTvaRate($this->db,${'e_march'.$i.'_tva_id'});
|
||||
$tva_rate=( $tva == null || $tva == 0 )?0.0:$tva['tva_rate'];
|
||||
echo_debug('class_document',__LINE__,' :'.$i.' sur '.$nb_item);
|
||||
$tva='e_march'.$counter.'_tva_id';
|
||||
$tva_rate=0;
|
||||
/* if we do not use vat this var. is not set */
|
||||
if ( isset(${$tva}) )
|
||||
{
|
||||
$tva=GetTvaRate($this->db,${'e_march'.$i.'_tva_id'});
|
||||
$tva_rate=( $tva == null || $tva == 0 )?0.0:$tva['tva_rate'];
|
||||
echo_debug('class_document',__LINE__,' :'.$i.' sur '.$nb_item);
|
||||
}
|
||||
$sell=${'e_march'.$i.'_price'};
|
||||
$qt=${'e_quant'.$i};
|
||||
echo_debug('class_document',__LINE__,'sell :'.$sell.' qt = '.$qt);
|
||||
|
|
@ -864,6 +877,10 @@ class Document
|
|||
break;
|
||||
case 'TOTAL_TVA':
|
||||
extract($_POST);
|
||||
$tva='e_march'.$counter.'_tva_id';
|
||||
/* if we do not use vat this var. is not set */
|
||||
if ( !isset(${$tva}) ) return '0';
|
||||
|
||||
$sum=0.0;
|
||||
for ($i=0;$i<$nb_item;$i++)
|
||||
{
|
||||
|
|
@ -886,14 +903,22 @@ class Document
|
|||
else
|
||||
return "";
|
||||
break;
|
||||
case 'PJ':
|
||||
if ( isset($_REQUEST['e_pj']))
|
||||
return $_REQUEST['e_pj'];
|
||||
else
|
||||
return "";
|
||||
|
||||
case 'OTHER_INFO':
|
||||
if ( isset($_REQUEST['other_info']))
|
||||
return $_REQUEST['other_info'];
|
||||
else
|
||||
return "";
|
||||
break;
|
||||
|
||||
|
||||
case 'COMMENT':
|
||||
if ( isset($_REQUEST['e_comm']))
|
||||
return $_REQUEST['e_comm'];
|
||||
break;
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -893,8 +893,6 @@ class fiche {
|
|||
}
|
||||
/*!
|
||||
* \brief HtmlTable, display a HTML of a card for the asked period
|
||||
* \param none
|
||||
*
|
||||
* \return none
|
||||
*/
|
||||
function HtmlTableDetail($p_array=null)
|
||||
|
|
@ -1084,7 +1082,7 @@ function get_solde_detail($p_cond="") {
|
|||
'solde'=>abs($r['sum_deb']-$r['sum_cred']));
|
||||
}
|
||||
/*!\brief check if an attribute is empty
|
||||
*\param
|
||||
*\param $p_attr the id of the attribut to check (ad_id)
|
||||
*\return return true is the attribute is empty or missing
|
||||
*/
|
||||
function empty_attribute($p_attr) {
|
||||
|
|
@ -1126,9 +1124,6 @@ function empty_attribute($p_attr) {
|
|||
* \param $p_jrn journal_id
|
||||
* \param $p_type : deb or cred default empty
|
||||
*
|
||||
*\todo fiche::belong_ledger this function will replace fiche_inc.php
|
||||
*function isFicheOfJrn , it should be replaced everywhere in the code
|
||||
*
|
||||
* \return 1 if the fiche is in the range otherwise < 1
|
||||
* -1 the card doesn't exist
|
||||
* -2 the ledger has no card to check
|
||||
|
|
|
|||
|
|
@ -510,11 +510,11 @@ class fiche_def {
|
|||
}
|
||||
|
||||
/*!\brief save the order of a card, update the column jnt_fic_attr.jnt_order
|
||||
*\param array containing the order
|
||||
*\param $p_array containing the order
|
||||
*/
|
||||
function save_order($p_array) {
|
||||
extract($p_array);
|
||||
|
||||
echo_debug('class_fiche_def::save_order',$p_array);
|
||||
$this->GetAttribut();
|
||||
foreach ($this->attribut as $row){
|
||||
if ( $row->ad_id == 1 ) continue;
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class Own {
|
|||
&& $this->MY_STRICT != 'Y'
|
||||
&& $this->MY_STRICT != 'N')
|
||||
$p_value='N';
|
||||
$p_value=htmlentities($p_value);
|
||||
$p_value=htmlspecialchars($p_value);
|
||||
}
|
||||
/*!
|
||||
**************************************************
|
||||
|
|
@ -56,9 +56,9 @@ class Own {
|
|||
*
|
||||
*/
|
||||
function save($p_attr) {
|
||||
$value=FormatString($this->$p_attr);
|
||||
$this->check($p_attr);
|
||||
// check if the parameter does exù
|
||||
$value=$this->$p_attr;
|
||||
// check if the parameter does exist
|
||||
if ( getDbValue($this->db,'select count(*) from parameter where pr_id=$1',array($p_attr)) != 0 )
|
||||
{
|
||||
$Res=ExecSqlParam($this->db,"update parameter set pr_value=$1 where pr_id=$2",
|
||||
|
|
@ -91,6 +91,8 @@ class Own {
|
|||
$this->save('MY_FAX');
|
||||
$this->save('MY_ANALYTIC');
|
||||
$this->save('MY_STRICT');
|
||||
$this->save('MY_TVA_USE');
|
||||
$this->save('MY_PJ_SUGGEST');
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,9 +44,9 @@ class Pre_op_ach extends Pre_operation_detail {
|
|||
for ($i=0;$i<$this->operation->nb_item;$i++) {
|
||||
$march="e_march".$i;
|
||||
$this->$march=$_POST['e_march'.$i];
|
||||
$this->{"e_march".$i."_price"}=$_POST['e_march'.$i."_price"];
|
||||
$this->{"e_march".$i."_tva_id"}=$_POST['e_march'.$i."_tva_id"];
|
||||
$this->{"e_march".$i."_tva_amount"}=$_POST['e_march'.$i."_tva_amount"];
|
||||
$this->{"e_march".$i."_price"}=(isset ($_POST['e_march'.$i."_price"]))?$_POST['e_march'.$i."_price"]:0;
|
||||
$this->{"e_march".$i."_tva_id"}=(isset ($_POST['e_march'.$i."_tva_id"]))?$_POST['e_march'.$i."_tva_id"]:0;
|
||||
$this->{"e_march".$i."_tva_amount"}=(isset($_POST['e_march'.$i."_tva_amount"]))?$_POST['e_march'.$i."_tva_amount"]:0;
|
||||
$this->{"e_quant".$i}=$_POST['e_quant'.$i];
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ class Pre_op_ven extends Pre_operation_detail {
|
|||
$march="e_march".$i;
|
||||
$this->$march=$_POST['e_march'.$i];
|
||||
$this->{"e_march".$i."_price"}=$_POST['e_march'.$i."_price"];
|
||||
$this->{"e_march".$i."_tva_id"}=$_POST['e_march'.$i."_tva_id"];
|
||||
$this->{"e_march".$i."_tva_id"}=(isset($_POST['e_march'.$i."_tva_id"]))?$_POST['e_march'.$i."_tva_id"]:0;
|
||||
$this->{"e_quant".$i}=$_POST['e_quant'.$i];
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@
|
|||
|
||||
/*!\brief
|
||||
* This class manages the table todo_list
|
||||
*
|
||||
*
|
||||
* Data Member :
|
||||
* - $cn database connx
|
||||
* - $variable
|
||||
|
|
|
|||
|
|
@ -1,34 +1,34 @@
|
|||
<?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
|
||||
* Data & function about connected users
|
||||
*/
|
||||
/*!
|
||||
* \brief
|
||||
* Data & function about connected users
|
||||
*/
|
||||
/*
|
||||
* 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
|
||||
* Data & function about connected users
|
||||
*/
|
||||
/*!
|
||||
* \brief
|
||||
* Data & function about connected users
|
||||
*/
|
||||
|
||||
include_once("constant.php");
|
||||
require_once('class_dossier.php');
|
||||
|
||||
class User {
|
||||
var $id;
|
||||
|
|
@ -42,113 +42,171 @@ class User {
|
|||
if ( $p_id == -1 ) {
|
||||
if ( ! isset ($_SESSION['g_user']))
|
||||
exit('<h2 class="error"> Utilisateur déconnecté</h2>');
|
||||
echo_debug('class_user.php',__LINE__," g_user = ".$_SESSION['g_user']);
|
||||
|
||||
$this->id=$_SESSION['g_user'];
|
||||
$this->pass=$_SESSION['g_pass'];
|
||||
$this->valid=(isset ($_SESSION['isValid']))?1:0;
|
||||
$this->db=$p_cn;
|
||||
if ( isset($_SESSION['g_theme']) )
|
||||
$this->theme=$_SESSION['g_theme'];
|
||||
$this->login=$_SESSION['g_user'];
|
||||
$this->pass=$_SESSION['g_pass'];
|
||||
$this->valid=(isset ($_SESSION['isValid']))?1:0;
|
||||
$this->db=$p_cn;
|
||||
$this->id=-1;
|
||||
if ( isset($_SESSION['g_theme']) )
|
||||
$this->theme=$_SESSION['g_theme'];
|
||||
|
||||
$this->admin=( isset($_SESSION['use_admin']) )?$_SESSION['use_admin']:0;
|
||||
$this->admin=( isset($_SESSION['use_admin']) )?$_SESSION['use_admin']:0;
|
||||
|
||||
if ( isset($_SESSION['use_name']) )
|
||||
$this->name=$_SESSION['use_name'];
|
||||
if ( isset($_SESSION['use_first_name']) )
|
||||
$this->first_name=$_SESSION['use_first_name'];
|
||||
if ( isset($_SESSION['use_name']) )
|
||||
$this->name=$_SESSION['use_name'];
|
||||
if ( isset($_SESSION['use_first_name']) )
|
||||
$this->first_name=$_SESSION['use_first_name'];
|
||||
$this->load();
|
||||
}
|
||||
else // if p_id is set get data of another user
|
||||
{
|
||||
echo_debug('class_user',__LINE__,"Info for use_id = $p_id");
|
||||
$this->id=$p_id;
|
||||
$this->db=$p_cn;
|
||||
$Sql="select use_first_name,
|
||||
$this->id=$p_id;
|
||||
$this->db=$p_cn;
|
||||
$this->load();
|
||||
}
|
||||
}
|
||||
/*!\brief load data from database.
|
||||
* if this->id == -1, it is unknown so we have to retrieve it
|
||||
from the database by the login
|
||||
* return -1 if nothing is found
|
||||
*/
|
||||
function load() {
|
||||
/* if this->id == -1, it is unknown so we have to retrieve it from
|
||||
the database thanks it login */
|
||||
if ( $this->id < 0 ) {
|
||||
$sql_cond=" where use_login=$1";
|
||||
$sql_array=array($this->login);
|
||||
} else {
|
||||
$sql_cond=" where use_id=$1";
|
||||
$sql_array=array($this->id);
|
||||
}
|
||||
$sql="select use_id,
|
||||
use_first_name,
|
||||
use_name,
|
||||
use_login,
|
||||
use_active,
|
||||
use_admin
|
||||
from ac_users
|
||||
where use_id=$p_id";
|
||||
echo_debug('class_user',__LINE__,'SQL = '.$Sql);
|
||||
$cn=DbConnect();
|
||||
$Res=pg_exec($cn,$Sql);
|
||||
if (($Max=pg_NumRows($Res)) == 0 ) return -1;
|
||||
$row=pg_fetch_array($Res,0);
|
||||
$this->first_name=$row['use_first_name'];
|
||||
$this->name=$row['use_name'];
|
||||
$this->active=$row['use_active'];
|
||||
$this->login=$row['use_login'];
|
||||
$this->admin=$row['use_admin'];
|
||||
}
|
||||
from ac_users ";
|
||||
$cn=DbConnect();
|
||||
$Res=ExecSqlParam($cn,$sql.$sql_cond,$sql_array);
|
||||
if (($Max=pg_NumRows($Res)) == 0 ) return -1;
|
||||
$row=pg_fetch_array($Res,0);
|
||||
$this->id=$row['use_id'];
|
||||
$this->first_name=$row['use_first_name'];
|
||||
$this->name=$row['use_name'];
|
||||
$this->active=$row['use_active'];
|
||||
$this->login=$row['use_login'];
|
||||
$this->admin=$row['use_admin'];
|
||||
|
||||
}
|
||||
/*!
|
||||
* \brief Check if user is active and exists in therepository
|
||||
* Automatically redirect
|
||||
* Automatically redirect, it doesn't check if a user can access a folder
|
||||
*
|
||||
++*/
|
||||
function Check()
|
||||
{
|
||||
|
||||
$res=0;
|
||||
$pass5=md5($this->pass);
|
||||
$res=0;
|
||||
$pass5=md5($this->pass);
|
||||
|
||||
$cn=DbConnect();
|
||||
if ( $cn != false ) {
|
||||
$sql="select ac_users.use_login,ac_users.use_active, ac_users.use_pass,
|
||||
$cn=DbConnect();
|
||||
if ( $cn != false ) {
|
||||
$sql="select ac_users.use_login,ac_users.use_active, ac_users.use_pass,
|
||||
use_admin,use_first_name,use_name
|
||||
from ac_users
|
||||
where ac_users.use_login='$this->id'
|
||||
where ac_users.use_id='$this->id'
|
||||
and ac_users.use_active=1
|
||||
and ac_users.use_pass='$pass5'";
|
||||
echo_debug('class_user.php',__LINE__,"Sql = $sql");
|
||||
$ret=pg_exec($cn,$sql);
|
||||
$res=pg_NumRows($ret);
|
||||
echo_debug('class_user.php',__LINE__,"Number of found rows : $res");
|
||||
if ( $res >0 ) {
|
||||
$r=pg_fetch_array($ret,0);
|
||||
$_SESSION['use_admin']=$r['use_admin'];
|
||||
$_SESSION['use_name']=$r['use_name'];
|
||||
$_SESSION['use_first_name']=$r['use_first_name'];
|
||||
$_SESSION['isValid']=1;
|
||||
echo_debug('class_user.php',__LINE__,"Sql = $sql");
|
||||
$ret=pg_exec($cn,$sql);
|
||||
$res=pg_NumRows($ret);
|
||||
echo_debug('class_user.php',__LINE__,"Number of found rows : $res");
|
||||
if ( $res >0 ) {
|
||||
$r=pg_fetch_array($ret,0);
|
||||
$_SESSION['use_admin']=$r['use_admin'];
|
||||
$_SESSION['use_name']=$r['use_name'];
|
||||
$_SESSION['use_first_name']=$r['use_first_name'];
|
||||
$_SESSION['isValid']=1;
|
||||
|
||||
$this->admin=$_SESSION['use_admin'];
|
||||
$this->name=$_SESSION['use_name'];
|
||||
$this->first_name=$_SESSION['use_first_name'];
|
||||
$this->load_global_pref();
|
||||
$this->admin=$_SESSION['use_admin'];
|
||||
$this->name=$_SESSION['use_name'];
|
||||
$this->first_name=$_SESSION['use_first_name'];
|
||||
$this->load_global_pref();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( $res == 0 ) {
|
||||
echo '<META HTTP-EQUIV="REFRESH" content="4;url=index.html">';
|
||||
echo "<BR><BR><BR><BR><BR><BR>";
|
||||
echo "<P ALIGN=center><BLINK>
|
||||
if ( $res == 0 ) {
|
||||
echo '<META HTTP-EQUIV="REFRESH" content="4;url=index.html">';
|
||||
echo "<BR><BR><BR><BR><BR><BR>";
|
||||
echo "<P ALIGN=center><BLINK>
|
||||
<FONT size=+12 COLOR=RED>
|
||||
utilisateur ou mot de passe incorrect
|
||||
</FONT></BLINK></P></BODY></HTML>";
|
||||
session_unset();
|
||||
session_unset();
|
||||
|
||||
exit -1;
|
||||
} else {
|
||||
$this->valid=1;
|
||||
}
|
||||
exit -1;
|
||||
} else {
|
||||
$this->valid=1;
|
||||
}
|
||||
|
||||
return $ret;
|
||||
return $ret;
|
||||
|
||||
}
|
||||
/*!
|
||||
* \brief get all the available ledgers for the current user
|
||||
* \param $p_type = ALL or the type of the ledger (ACH,VEN,FIN,ODS)
|
||||
* \param $p_access =3 for READ or WRITE, 2 READ and write, 1 for readonly
|
||||
*
|
||||
* \return an array
|
||||
*/
|
||||
/*!\brief return the access to a folder,
|
||||
* \param $p_dossier id if it is == 0 then we take the value from $_SESSION
|
||||
*\return the priv_priv
|
||||
* - X no access
|
||||
* - R has access (normal user)
|
||||
* - L Local Admin
|
||||
*
|
||||
*/
|
||||
function get_folder_access($p_dossier = 0) {
|
||||
if ($p_dossier==0)
|
||||
$p_dossier=dossier::id();
|
||||
|
||||
$cn=DbConnect();
|
||||
$sql="select priv_priv from priv_user join jnt_use_dos on (jnt_id=priv_jnt) join ac_users using (use_id)
|
||||
where use_id=$1 and dos_id=$2";
|
||||
$res=getDbValue($cn,$sql,array($this->id,$p_dossier));
|
||||
return $res;
|
||||
}
|
||||
/*!\brief check that a user is valid and the access to the folder
|
||||
* \param $p_ledger the ledger to check
|
||||
*\return the priv_priv
|
||||
* - O only predefined operation
|
||||
* - W write
|
||||
* - R read only
|
||||
* - X no access
|
||||
*
|
||||
|
||||
*
|
||||
*/
|
||||
function get_ledger_access($p_ledger) {
|
||||
if ( $this->admin == 1 ||
|
||||
$this->is_local_admin(dossier::id()) ==1 )
|
||||
return 'W';
|
||||
|
||||
$sql="select uj_priv from user_sec_jrn where uj_login=$1 and uj_jrn_id=$2";
|
||||
$res=getDbValue($this->db,$sql,array($this->login,$p_ledger));
|
||||
if ( $res=='' ) $res='X';
|
||||
return $res;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief get all the available ledgers for the current user
|
||||
* \param $p_type = ALL or the type of the ledger (ACH,VEN,FIN,ODS)
|
||||
* \param $p_access =3 for Read or WRITE, 2 write, 1 for readonly
|
||||
*
|
||||
* \return an array
|
||||
*/
|
||||
function get_ledger($p_type='ALL',$p_access=3) {
|
||||
|
||||
|
||||
if ( $this->admin != 1) {
|
||||
if ( $this->admin != 1 && $this->is_local_admin() != 1) {
|
||||
$sql_type=($p_type=='ALL')?'':"and jrn_def_type=upper('".FormatString($p_type)."')";
|
||||
switch($p_access) {
|
||||
case 3:
|
||||
|
|
@ -169,9 +227,9 @@ jrn_def_name,jrn_def_class_deb,jrn_def_class_cred,jrn_type_id,jrn_desc,uj_priv,
|
|||
from jrn_def join jrn_type on jrn_def_type=jrn_type_id
|
||||
join user_sec_jrn on uj_jrn_id=jrn_def_id
|
||||
where
|
||||
uj_login='".$this->id."'".
|
||||
$sql_type.$sql_access.
|
||||
" order by jrn_Def_id";
|
||||
uj_login='".$this->login."'".
|
||||
$sql_type.$sql_access.
|
||||
" order by jrn_Def_id";
|
||||
}else {
|
||||
$sql_type=($p_type=='ALL')?'':"where jrn_def_type=upper('".FormatString($p_type)."')";
|
||||
$sql="select jrn_def_id,jrn_def_type,jrn_def_name,jrn_def_class_deb,jrn_def_class_cred,jrn_deb_max_line,jrn_cred_max_line,
|
||||
|
|
@ -194,6 +252,8 @@ jrn_def_name,jrn_def_class_deb,jrn_def_class_cred,jrn_type_id,jrn_desc,uj_priv,
|
|||
*\return string
|
||||
*/
|
||||
function get_ledger_sql($p_type='ALL',$p_access=3) {
|
||||
/* for admin or local admin there is no restriction on the ledger */
|
||||
if ($this->admin == 1 || $this->is_local_admin(dossier::id()) == 1) return ' jrn_def_id > 0 ';
|
||||
$aLedger=$this->get_ledger($p_type,$p_access);
|
||||
$sql=" jrn_def_id in (";
|
||||
foreach ($aLedger as $row) {
|
||||
|
|
@ -202,51 +262,37 @@ jrn_def_name,jrn_def_class_deb,jrn_def_class_cred,jrn_type_id,jrn_desc,uj_priv,
|
|||
$sql.='-1)';
|
||||
return $sql;
|
||||
}
|
||||
/*!
|
||||
**************************************************
|
||||
* \brief Check if an user is an admin
|
||||
*
|
||||
* \return 1 for yes 0 for no
|
||||
*/
|
||||
/*!
|
||||
* \brief Check if an user is an admin
|
||||
*
|
||||
* \return 1 for yes 0 for no
|
||||
*/
|
||||
function Admin() {
|
||||
$res=0;
|
||||
|
||||
if ( $this->id != 'phpcompta') {
|
||||
if ( $this->login != 'phpcompta') {
|
||||
$pass5=md5($this->pass);
|
||||
$sql="select use_id from ac_users where use_login='$this->id'
|
||||
and use_active=1 and use_admin=1 and use_pass='$pass5'";
|
||||
$sql="select use_admin from ac_users where use_login=$1
|
||||
and use_active=1 and use_pass=$2";
|
||||
|
||||
$cn=DbConnect();
|
||||
|
||||
$this->admin=CountSql($cn,$sql);
|
||||
} else $this->admin=1;
|
||||
$res=ExecSqlParam($cn,$sql,array($this->login,$pass5));
|
||||
if ( pg_NumRows($res)==0) exit(__FILE__." ".__LINE__." aucun resultat");
|
||||
$this->admin=pg_fetch_result($res,0);
|
||||
}
|
||||
else $this->admin=1;
|
||||
|
||||
return $this->admin;
|
||||
}
|
||||
function AccessJrn($p_cn,$p_jrn_id) {
|
||||
$this->Admin();
|
||||
if ( $this->admin==1) return true;
|
||||
$sql=CountSql($p_cn,"select uj_id
|
||||
from user_sec_jrn
|
||||
where
|
||||
uj_priv in ('R','W')
|
||||
and uj_jrn_id=".$p_jrn_id.
|
||||
" and uj_login = '".$this->id."'");
|
||||
if ( $sql != 0 ) return true;
|
||||
return false;
|
||||
|
||||
/*!
|
||||
* \brief Set the selected periode in the user's preferences
|
||||
*
|
||||
* \param $p_periode periode
|
||||
* \param - $p_user
|
||||
*
|
||||
*/
|
||||
function set_periode($p_periode) {
|
||||
$sql="update user_local_pref set parameter_value='$p_periode' where user_id='$this->id' and parameter_type='PERIODE'";
|
||||
$Res=ExecSql($this->db,$sql);
|
||||
}
|
||||
/*!
|
||||
* \brief Set the selected periode in the user's preferences
|
||||
*
|
||||
* \param $p_periode periode
|
||||
* \param - $p_user
|
||||
*
|
||||
*/
|
||||
function set_periode($p_periode) {
|
||||
$sql="update user_local_pref set parameter_value='$p_periode' where user_id='$this->id' and parameter_type='PERIODE'";
|
||||
$Res=ExecSql($this->db,$sql);
|
||||
}
|
||||
|
||||
private function set_default_periode() {
|
||||
|
||||
|
|
@ -259,7 +305,7 @@ function set_periode($p_periode) {
|
|||
if ( $pid == null ) {
|
||||
$sql='select min(p_id) as pid from parm_periode where p_start = (select max(p_start) from parm_periode)';
|
||||
$Res2=ExecSql($this->db,$sql);
|
||||
$pid=pg_fetch_result($Res2,0,0);
|
||||
$pid=pg_fetch_result($Res2,0,0);
|
||||
if ( $pid == null ) {
|
||||
echo "Aucune periode trouvable !!!";
|
||||
exit(1);
|
||||
|
|
@ -274,23 +320,23 @@ function set_periode($p_periode) {
|
|||
$Res=ExecSql($this->db,$sql);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Get the default periode from the user's preferences
|
||||
*
|
||||
* \return the default periode
|
||||
*
|
||||
*
|
||||
*/
|
||||
/*!
|
||||
* \brief Get the default periode from the user's preferences
|
||||
*
|
||||
* \return the default periode
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
function get_periode() {
|
||||
function get_periode() {
|
||||
|
||||
$array=$this->get_preference();
|
||||
if ( ! isset ($array['PERIODE'])) {
|
||||
$this->set_default_periode();
|
||||
$array=$this->get_preference();
|
||||
if ( ! isset ($array['PERIODE'])) {
|
||||
$this->set_default_periode();
|
||||
$array=$this->get_preference();
|
||||
}
|
||||
return $array['PERIODE'];
|
||||
}
|
||||
return $array['PERIODE'];
|
||||
}
|
||||
/*!\brief return the mini rapport to display on the welcome page
|
||||
*\return 0 if nothing if found or the report to display (formdef.fr_id)
|
||||
*/
|
||||
|
|
@ -319,187 +365,263 @@ function get_periode() {
|
|||
}
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Get the default user's preferences
|
||||
* \return array of (parameter_type => parameter_value)
|
||||
*/
|
||||
function get_preference ()
|
||||
{
|
||||
$sql="select parameter_type,parameter_value from user_local_pref where user_id='".$this->id."'";
|
||||
$Res=ExecSql($this->db,$sql);
|
||||
$l_array=array();
|
||||
for ( $i =0;$i < pg_NumRows($Res);$i++) {
|
||||
$row= pg_fetch_array($Res,$i);
|
||||
$type=$row['parameter_type'];
|
||||
$l_array[$type]=$row['parameter_value'];
|
||||
/*!
|
||||
* \brief Get the default user's preferences
|
||||
* \return array of (parameter_type => parameter_value)
|
||||
*/
|
||||
function get_preference ()
|
||||
{
|
||||
$sql="select parameter_type,parameter_value from user_local_pref where user_id='".$this->id."'";
|
||||
$Res=ExecSql($this->db,$sql);
|
||||
$l_array=array();
|
||||
for ( $i =0;$i < pg_NumRows($Res);$i++) {
|
||||
$row= pg_fetch_array($Res,$i);
|
||||
$type=$row['parameter_type'];
|
||||
$l_array[$type]=$row['parameter_value'];
|
||||
}
|
||||
|
||||
|
||||
return $l_array;
|
||||
}
|
||||
/*!
|
||||
* \brief Check if an user is allowed to do an action
|
||||
* \param p_action_id
|
||||
* \return
|
||||
* - 0 no priv
|
||||
* - 1 priv granted
|
||||
*
|
||||
*/
|
||||
function check_action ( $p_action_id)
|
||||
{
|
||||
|
||||
|
||||
return $l_array;
|
||||
}
|
||||
/*!
|
||||
* \brief Check if an user is allowed to do an action
|
||||
*
|
||||
* \param p_cn Database connx
|
||||
* \param p_action_id
|
||||
* \return
|
||||
* - 0 no priv
|
||||
* - 1 priv granted
|
||||
*
|
||||
*/
|
||||
function check_action ( $p_cn,$p_action_id)
|
||||
{
|
||||
|
||||
if ( $this->admin==1 ) return 1;
|
||||
|
||||
$Res=ExecSql($p_cn,"select * from user_sec_act where ua_login='".$this->id."' and ua_act_id=$p_action_id");
|
||||
$Count=pg_NumRows($Res);
|
||||
if ( $Count == 0 ) return 0;
|
||||
if ( $Count == 1 ) return 1;
|
||||
echo "<H2 class=\"error\"> Invalid action !!! $Count select * from user_sec_act where ua_login='$p_login' and ua_act_id=$p_action_id </H2>";
|
||||
exit();
|
||||
}
|
||||
/*!
|
||||
**************************************************
|
||||
* \brief Get the global preferences from user_global_pref
|
||||
* in the account_repository db
|
||||
*
|
||||
* \note set $SESSION[g_variable]
|
||||
*/
|
||||
|
||||
|
||||
function load_global_pref()
|
||||
{
|
||||
echo_debug('class_user.php',__LINE__,"function load_global_pref");
|
||||
$cn=Dbconnect();
|
||||
// Load everything in an array
|
||||
$Res=ExecSql ($cn,"select parameter_type,parameter_value from
|
||||
if ( $this->admin==1 ) return 1;
|
||||
if ( $this->is_local_admin(dossier::id()) == 1 ) return 1;
|
||||
|
||||
$Res=ExecSqlParam($this->db,
|
||||
"select * from user_sec_act where ua_login=$1 and ua_act_id=$2",
|
||||
array($this->login,$p_action_id));
|
||||
$Count=pg_NumRows($Res);
|
||||
if ( $Count == 0 ) return 0;
|
||||
if ( $Count == 1 ) return 1;
|
||||
echo "<H2 class=\"error\"> Action Invalide !!! $Count select * from user_sec_act where ua_login='$p_login' and ua_act_id=$p_action_id </H2>";
|
||||
exit();
|
||||
}
|
||||
/*!
|
||||
* \brief Get the global preferences from user_global_pref
|
||||
* in the account_repository db
|
||||
*
|
||||
* \note set $SESSION[g_variable]
|
||||
*/
|
||||
function load_global_pref()
|
||||
{
|
||||
echo_debug('class_user.php',__LINE__,"function load_global_pref");
|
||||
$cn=Dbconnect();
|
||||
// Load everything in an array
|
||||
$Res=ExecSql ($cn,"select parameter_type,parameter_value from
|
||||
user_global_pref
|
||||
where user_id='".$this->id."'");
|
||||
$Max=pg_NumRows($Res);
|
||||
if ( $Max == 0 ) {
|
||||
$this->insert_default_global_pref();
|
||||
$this->load_global_pref();
|
||||
return;
|
||||
}
|
||||
// Load value into array
|
||||
$line=array();
|
||||
for ($i=0;$i<$Max;$i++) {
|
||||
$row=pg_fetch_array($Res,$i);
|
||||
$type=$row['parameter_type'];
|
||||
$line[$type]=$row['parameter_value'];;
|
||||
where user_id='".$this->login."'");
|
||||
$Max=pg_NumRows($Res);
|
||||
if ( $Max == 0 ) {
|
||||
$this->insert_default_global_pref();
|
||||
$this->load_global_pref();
|
||||
return;
|
||||
}
|
||||
// Load value into array
|
||||
$line=array();
|
||||
for ($i=0;$i<$Max;$i++) {
|
||||
$row=pg_fetch_array($Res,$i);
|
||||
$type=$row['parameter_type'];
|
||||
$line[$type]=$row['parameter_value'];;
|
||||
}
|
||||
// save array into g_ variable
|
||||
$array_pref=array ('g_theme'=>'THEME','g_pagesize'=>'PAGESIZE','g_topmenu'=>'TOPMENU');
|
||||
foreach ($array_pref as $name=>$parameter ) {
|
||||
if ( ! isset ($line[$parameter]) ) {
|
||||
echo_debug("Missing pref : ".$parameter);
|
||||
$this->insert_default_global_pref($parameter);
|
||||
$this->load_global_pref();
|
||||
return;
|
||||
}
|
||||
$_SESSION[$name]=$line[$parameter];
|
||||
}
|
||||
}
|
||||
// save array into g_ variable
|
||||
$array_pref=array ('g_theme'=>'THEME','g_pagesize'=>'PAGESIZE','g_topmenu'=>'TOPMENU');
|
||||
foreach ($array_pref as $name=>$parameter ) {
|
||||
if ( ! isset ($line[$parameter]) ) {
|
||||
echo_debug("Missing pref : ".$parameter);
|
||||
$this->insert_default_global_pref($parameter);
|
||||
$this->load_global_pref();
|
||||
return;
|
||||
}
|
||||
$_SESSION[$name]=$line[$parameter];
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
**************************************************
|
||||
* \brief insert default pref
|
||||
* if no parameter are given insert all the existing
|
||||
* parameter otherwise only the requested
|
||||
* \param $p_type parameter's type or nothing
|
||||
* \param $p_value parameter value
|
||||
*
|
||||
*/
|
||||
function insert_default_global_pref($p_type="",$p_value="") {
|
||||
echo_debug('class_user.php',__LINE__,"function insert_default_global_pref");
|
||||
echo_debug('class_user.php',__LINE__,"parameter p_type $p_type p_value $p_value");
|
||||
/*!
|
||||
* \brief insert default pref
|
||||
* if no parameter are given insert all the existing
|
||||
* parameter otherwise only the requested
|
||||
* \param $p_type parameter's type or nothing
|
||||
* \param $p_value parameter value
|
||||
*
|
||||
*/
|
||||
function insert_default_global_pref($p_type="",$p_value="") {
|
||||
echo_debug('class_user.php',__LINE__,"function insert_default_global_pref");
|
||||
echo_debug('class_user.php',__LINE__,"parameter p_type $p_type p_value $p_value");
|
||||
|
||||
$default_parameter= array("THEME"=>"Light",
|
||||
"PAGESIZE"=>"50",'TOPMENU'=>'TEXT');
|
||||
$cn=Dbconnect();
|
||||
$Sql="insert into user_global_pref(user_id,parameter_type,parameter_value)
|
||||
$default_parameter= array("THEME"=>"Light",
|
||||
"PAGESIZE"=>"50",'TOPMENU'=>'TEXT');
|
||||
$cn=Dbconnect();
|
||||
$Sql="insert into user_global_pref(user_id,parameter_type,parameter_value)
|
||||
values ('%s','%s','%s')";
|
||||
if ( $p_type == "" ) {
|
||||
foreach ( $default_parameter as $name=>$value) {
|
||||
$Insert=sprintf($Sql,$this->id,$name,$value);
|
||||
ExecSql($cn,$Insert);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$value=($p_value=="")?$default_parameter[$p_type]:$p_value;
|
||||
$Insert=sprintf($Sql,$this->id,$p_type,$value);
|
||||
ExecSql($cn,$Insert);
|
||||
}
|
||||
if ( $p_type == "" ) {
|
||||
foreach ( $default_parameter as $name=>$value) {
|
||||
$Insert=sprintf($Sql,$this->login,$name,$value);
|
||||
ExecSql($cn,$Insert);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$value=($p_value=="")?$default_parameter[$p_type]:$p_value;
|
||||
$Insert=sprintf($Sql,$this->login,$p_type,$value);
|
||||
ExecSql($cn,$Insert);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
**************************************************
|
||||
* \brief update default pref
|
||||
* if value is not given then use the default value
|
||||
*
|
||||
* \param $p_type parameter's type
|
||||
* \param $p_value parameter's value value of the type
|
||||
*/
|
||||
function update_global_pref($p_type,$p_value="") {
|
||||
$default_parameter= array("THEME"=>"Light",
|
||||
"PAGESIZE"=>"50",'TOPMENU'=>'SELECT');
|
||||
$cn=Dbconnect();
|
||||
$Sql="update user_global_pref set parameter_value='%s'
|
||||
/*!
|
||||
* \brief update default pref
|
||||
* if value is not given then use the default value
|
||||
*
|
||||
* \param $p_type parameter's type
|
||||
* \param $p_value parameter's value value of the type
|
||||
*/
|
||||
function update_global_pref($p_type,$p_value="") {
|
||||
$default_parameter= array("THEME"=>"Light",
|
||||
"PAGESIZE"=>"50",'TOPMENU'=>'SELECT');
|
||||
$cn=Dbconnect();
|
||||
$Sql="update user_global_pref set parameter_value='%s'
|
||||
where parameter_type='%s' and
|
||||
user_id='%s'";
|
||||
$value=($p_value=="")?$default_parameter[$p_type]:$p_value;
|
||||
$Update=sprintf($Sql,$value,$p_type,$this->id);
|
||||
ExecSql($cn,$Update);
|
||||
$value=($p_value=="")?$default_parameter[$p_type]:$p_value;
|
||||
$Update=sprintf($Sql,$value,$p_type,$this->login);
|
||||
ExecSql($cn,$Update);
|
||||
|
||||
}//end function
|
||||
/*!\brief Return the year of current Periode
|
||||
* it is the parm_periode.p_exercice col
|
||||
* if an error occurs return 0
|
||||
*/
|
||||
function get_exercice()
|
||||
{
|
||||
$sql="select p_exercice from parm_periode where p_id=".$this->get_periode();
|
||||
$Ret=ExecSql($this->db,$sql);
|
||||
if (pg_NumRows($Ret) == 1)
|
||||
{
|
||||
$r=pg_fetch_array($Ret,0);
|
||||
return $r['p_exercice'];
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}//end function
|
||||
/*!\brief Return the year of current Periode
|
||||
* it is the parm_periode.p_exercice col
|
||||
* if an error occurs return 0
|
||||
*/
|
||||
function get_exercice()
|
||||
{
|
||||
$sql="select p_exercice from parm_periode where p_id=".$this->get_periode();
|
||||
$Ret=ExecSql($this->db,$sql);
|
||||
if (pg_NumRows($Ret) == 1)
|
||||
{
|
||||
$r=pg_fetch_array($Ret,0);
|
||||
return $r['p_exercice'];
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
/*!\brief Check if the user can access
|
||||
* otherwise warn and exit
|
||||
* \param $p_cn database connx
|
||||
* \param $p_action requested action
|
||||
* \param $p_js = 1 javascript, or 0 just a text
|
||||
* \return nothing the program exits automatically
|
||||
*/
|
||||
function can_request($p_cn,$p_action,$p_js=0)
|
||||
{
|
||||
if ( $this->check_action($p_cn,$p_action)==0 )
|
||||
{
|
||||
if ( $p_js == 1 )
|
||||
{
|
||||
echo "<script>";
|
||||
echo "alert ('Cette action ne vous est pas autorisée. Contactez votre responsable');";
|
||||
echo "</script>";
|
||||
}
|
||||
|
||||
/*!\brief Check if the user can access
|
||||
* otherwise warn and exit
|
||||
* \param $p_action requested action
|
||||
* \param $p_js = 1 javascript, or 0 just a text
|
||||
* \return nothing the program exits automatically
|
||||
*/
|
||||
function can_request($p_action,$p_js=0)
|
||||
{
|
||||
if ( $this->check_action($p_action)==0 )
|
||||
{
|
||||
if ( $p_js == 1 )
|
||||
{
|
||||
echo "<script>";
|
||||
echo "alert ('Cette action ne vous est pas autorisée. Contactez votre responsable');";
|
||||
echo "</script>";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
echo '<div class="u_redcontent">';
|
||||
echo '<h2 class="error"> Cette action ne vous est pas autorisée Contactez votre responsable</h2>';
|
||||
echo '</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
echo '<div class="u_redcontent">';
|
||||
echo '<h2 class="error"> Cette action ne vous est pas autorisée Contactez votre responsable</h2>';
|
||||
echo '</div>';
|
||||
|
||||
}
|
||||
exit(-1);
|
||||
}
|
||||
exit(-1);
|
||||
|
||||
}
|
||||
}
|
||||
/*!
|
||||
* \brief Get the privilege of an user on a folder
|
||||
*/
|
||||
function get_privilege($p_dossier)
|
||||
{
|
||||
/* you must be connected to the repository */
|
||||
$sql="select priv_priv
|
||||
from priv_user left join jnt_use_dos on jnt_id=priv_jnt
|
||||
inner join ac_users on ac_users.use_id=jnt_use_dos.use_id
|
||||
where ac_users.use_id=$1 and dos_id=$2";
|
||||
|
||||
|
||||
$Res=ExecSqlParam($this->db,$sql,array($this->id,$p_dossier));
|
||||
|
||||
$Num=pg_NumRows($Res);
|
||||
|
||||
/* If nothing is found there is no access */
|
||||
if ( $Num==0) return 'X';
|
||||
|
||||
$priv=pg_fetch_row($Res,0);
|
||||
return $priv[0];
|
||||
}
|
||||
/*!
|
||||
* \brief Check if an user is an local administrator
|
||||
*
|
||||
*
|
||||
* \param $p_dossier : dossier_id
|
||||
*
|
||||
* \return
|
||||
* - 0 if no
|
||||
* - 1 if yes
|
||||
*
|
||||
*/
|
||||
function is_local_admin($p_dossier=-1)
|
||||
{
|
||||
if ($p_dossier==-1) {
|
||||
$p_dossier=dossier::id();
|
||||
}
|
||||
|
||||
if ( $this->login == 'phpcompta') return 1;
|
||||
$sql='select priv_priv from ac_users join jnt_use_dos using (use_id) join priv_user '.
|
||||
' on ( jnt_use_dos.jnt_id = priv_user.priv_jnt) '.
|
||||
" where priv_priv='L' and use_login='".$this->login."' and dos_id=$p_dossier";
|
||||
|
||||
$cn=DbConnect();
|
||||
|
||||
$isAdmin=CountSql($cn,$sql);
|
||||
|
||||
|
||||
return $isAdmin;
|
||||
|
||||
}
|
||||
/*!
|
||||
* \brief check the access of an user on a ledger
|
||||
*
|
||||
* \param $p_jrn the ledger id
|
||||
* \return
|
||||
* - O only predefined operation
|
||||
* - W write
|
||||
* - R read only
|
||||
* - X no access
|
||||
*
|
||||
*/
|
||||
|
||||
function check_jrn($p_jrn)
|
||||
{
|
||||
return $this->get_ledger_access($p_jrn);
|
||||
}
|
||||
function check_dossier($p_dossier_id)
|
||||
{
|
||||
$cn=DbConnect();
|
||||
|
||||
$dossier=getDbValue($cn,"select priv_priv from jnt_use_dos join priv_user on (priv_jnt=jnt_id) where dos_id=$1",
|
||||
array($p_dossier_id));
|
||||
if ( $dossier=='X' || $dossier=='') {
|
||||
alert('Dossier non accessible');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
* \brief class widget This class is used to create all the HTML INPUT TYPE
|
||||
* and some specials which works with javascript like
|
||||
* js_search.
|
||||
*
|
||||
* special value
|
||||
* js_search and js_search_only :you need to add a span widget the name
|
||||
* of the js_* widget + '_label' , the member extra contains cred,deb to
|
||||
|
|
@ -51,6 +52,7 @@
|
|||
* - JS_SEARCH_POSTE call a popup window for searching the account
|
||||
* - JS_SEARCH call a popup window for searching a quickcode or to add one
|
||||
* - JS_SEARCH_ONLY like JS_SEARCH but without adding a quickcode
|
||||
* - JS_SEARCH_CARD_CTRL like js_search_only but the tag to update is given
|
||||
* - SPAN
|
||||
* - JS_TVA open a popup window for the VAT
|
||||
* - JS_CONCERNED open a popup window for search a operation, if extra == 0 then
|
||||
|
|
@ -79,7 +81,8 @@ class widget {
|
|||
var $extra; /*!< $extra different usage, it depends of the $type */
|
||||
var $extra2; /*!< $extra2 different usage,
|
||||
it depends of the $type */
|
||||
var $javascript;
|
||||
var $javascript; /*!< $javascript is the javascript to add to the widget */
|
||||
var $ctrl; /*!<$ctrl is the control to update (see js_search_card_control) */
|
||||
|
||||
var $tabindex;
|
||||
function widget($p_type="",$p_label="",$p_name="",$p_value="") {
|
||||
|
|
@ -116,8 +119,10 @@ class widget {
|
|||
$this->value=($p_value===null)?$this->value:$p_value;
|
||||
$this->label=($p_label == "")?$this->label:$p_label;
|
||||
|
||||
// Input text type
|
||||
|
||||
$disabled = $this->disabled ? "readonly" : "";
|
||||
//#####################################################################
|
||||
// Input text type
|
||||
if (strtoupper($this->type)=="TEXT") {
|
||||
$t= ((isset($this->title)))?'title="'.$this->title.'" ':' ';
|
||||
|
||||
|
|
@ -143,11 +148,13 @@ class widget {
|
|||
return $r;
|
||||
}
|
||||
// Hidden field
|
||||
//#####################################################################
|
||||
if (strtoupper($this->type)=="HIDDEN") {
|
||||
$r='<INPUT TYPE="HIDDEN" id="'.$this->name.'" name="'.$this->name.'" value="'.$this->value.'">';
|
||||
if ( $this->readonly==true) return "";
|
||||
return $r;
|
||||
}
|
||||
//#####################################################################
|
||||
// Select value
|
||||
if ( strtoupper($this->type) == "SELECT") {
|
||||
|
||||
|
|
@ -186,6 +193,7 @@ class widget {
|
|||
}
|
||||
return $r;
|
||||
}
|
||||
//#####################################################################
|
||||
// Password
|
||||
if (strtoupper($this->type)=="PASSWORD") {
|
||||
if ( $this->readonly==true) return "";
|
||||
|
|
@ -196,7 +204,7 @@ class widget {
|
|||
}
|
||||
return $r;
|
||||
}
|
||||
|
||||
//#####################################################################
|
||||
// Checkbox
|
||||
if (strtoupper($this->type)=="CHECKBOX") {
|
||||
if ( $this->readonly == true) {
|
||||
|
|
@ -218,7 +226,7 @@ class widget {
|
|||
}
|
||||
return $r;
|
||||
}
|
||||
|
||||
//#####################################################################
|
||||
//radio
|
||||
if (strtoupper($this->type)=="RADIO") {
|
||||
if ( $this->readonly == true) {
|
||||
|
|
@ -238,7 +246,7 @@ class widget {
|
|||
}
|
||||
return $r;
|
||||
}
|
||||
|
||||
//#####################################################################
|
||||
//textarea
|
||||
if (strtoupper($this->type)=="TEXTAREA") {
|
||||
if ( $this->readonly == false ) {
|
||||
|
|
@ -264,9 +272,7 @@ class widget {
|
|||
return $r;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
//#############################################################################
|
||||
// Rich Text
|
||||
/*!\brief
|
||||
* \note for the type RICHTEXT we need to include the javascript file
|
||||
|
|
@ -320,7 +326,7 @@ class widget {
|
|||
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
//#############################################################################
|
||||
//file
|
||||
if (strtoupper($this->type)=="FILE") {
|
||||
if ( $this->readonly == false ) {
|
||||
|
|
@ -330,60 +336,69 @@ class widget {
|
|||
if ( $this->table==1) $r="<TD>$this->label</TD><TD>$r</TD>";
|
||||
return $r;
|
||||
}
|
||||
//----------------------------------------------------------------------
|
||||
//#############################################################################
|
||||
// js_search_poste_only
|
||||
if ( strtolower($this->type == 'js_search_poste_only')) {
|
||||
|
||||
if ( ! isset($this->ctrl) ) $this->ctrl='none';
|
||||
if ( ! isset($this->extra2)) $this->extra2='poste';
|
||||
$r=sprintf('
|
||||
<INPUT class="inp" TYPE="button" onClick=SearchPoste(\'%s\','.dossier::id().',\'%s\',\'%s\',\'poste\',\'N\') value="Poste?">
|
||||
<INPUT class="inp" TYPE="button" onClick=SearchPoste(\'%s\','.dossier::id().',\'%s\',0,\'%s\',\'N\',\'%s\') value="Poste?">
|
||||
%s
|
||||
',
|
||||
$_REQUEST['PHPSESSID'],
|
||||
$this->extra,
|
||||
$this->name,
|
||||
$this->extra2,
|
||||
$this->ctrl,
|
||||
$this->label
|
||||
);
|
||||
return $r;
|
||||
}
|
||||
//----------------------------------------------------------------------
|
||||
//#############################################################################
|
||||
// input type == js_search_poste => button search for the account
|
||||
if ( strtolower($this->type)=="js_search_poste") {
|
||||
|
||||
if ( ! isset($this->ctrl) ) $this->ctrl='none';
|
||||
$l_sessid=$_REQUEST['PHPSESSID'];
|
||||
if ( $this->readonly == false ) {
|
||||
// Do we need to filter ??
|
||||
if ( $this->extra2 == null ) {
|
||||
$r=sprintf('<TD>
|
||||
<INPUT class="inp" TYPE="button" onClick=SearchPoste(\'%s\','.dossier::id().',\'%s\',\'%s\',\'label\',\'Y\') value="Poste?">
|
||||
if ( ! isset($this->javascript)) $this->javascript="";
|
||||
|
||||
// Do we need to filter ??
|
||||
if ( $this->extra2 == null ) {
|
||||
$r=sprintf('<TD>
|
||||
<INPUT class="inp" TYPE="button" onClick=SearchPoste(\'%s\','.dossier::id().',\'%s\',\'%s\',\'label\',\'Y\') %s value="Poste?">
|
||||
%s</TD><TD>
|
||||
|
||||
<INPUT style="border:groove 1px blue;" TYPE="Text" NAME="%s" ID="%s" VALUE="%s" SIZE="8">
|
||||
</TD>',
|
||||
$l_sessid,
|
||||
$this->name,
|
||||
$this->extra,
|
||||
$this->label,
|
||||
$this->name,
|
||||
$this->name,
|
||||
$this->value
|
||||
);
|
||||
|
||||
} else { // $p_list is not null, so we have a filter
|
||||
$r=sprintf('<TD>
|
||||
<INPUT TYPE="button" onClick=SearchPosteFilter(\'%s\','.dossier::id().',\'%s\',\'%s\',\'%s\') value="Poste?">
|
||||
$l_sessid,
|
||||
$this->name,
|
||||
$this->extra,
|
||||
$this->ctrl,
|
||||
$this->label,
|
||||
$this->name,
|
||||
$this->name,
|
||||
$this->value
|
||||
);
|
||||
|
||||
} else { // $p_list is not null, so we have a filter
|
||||
$r=sprintf('<TD>
|
||||
<INPUT TYPE="button" onClick="SearchPosteFilter(\'%s\','.dossier::id().',\'%s\',\'%s\',\'%s\',\'%s\')" %s value="Poste?">
|
||||
%s</TD><TD>
|
||||
|
||||
<INPUT style="border:groove 1px blue;" TYPE="Text" NAME="%s" id="%s" VALUE="%s" SIZE="8">
|
||||
</TD>',
|
||||
$l_sessid,
|
||||
$this->name,
|
||||
$this->extra2,
|
||||
$this->extra,
|
||||
$this->label,
|
||||
$this->name,
|
||||
$this->name,
|
||||
$this->value
|
||||
$this->name,
|
||||
$this->extra2,
|
||||
$this->extra,
|
||||
$this->ctrl,
|
||||
$this->javascript,
|
||||
$this->label,
|
||||
$this->name,
|
||||
$this->name,
|
||||
$this->value
|
||||
);
|
||||
|
||||
|
||||
} //else
|
||||
} else {
|
||||
$r=sprintf('<TD><input type="hidden" name="%s" value="%s">
|
||||
|
|
@ -403,7 +418,7 @@ class widget {
|
|||
return $r;
|
||||
|
||||
} // end js_search_poste
|
||||
|
||||
//#############################################################################
|
||||
// input type == js_search => button search for card
|
||||
if ( strtolower($this->type)=="js_search") {
|
||||
$l_sessid=$_REQUEST['PHPSESSID'];
|
||||
|
|
@ -445,7 +460,7 @@ class widget {
|
|||
return $r;
|
||||
}// poste==js_search
|
||||
|
||||
|
||||
//#############################################################################
|
||||
// input type == js_search => button search for card
|
||||
/*!\brief js_search_only only for searching a card no new button
|
||||
*/
|
||||
|
|
@ -454,10 +469,12 @@ class widget {
|
|||
|
||||
if ( $this->javascript=="") { /* if javascript is empty then we
|
||||
add a default behaviour */
|
||||
$this->javascript=sprintf('onBlur="ajaxFid(\'%s\',\'%s\',\'%s\')"',
|
||||
$this->javascript=sprintf('onBlur="ajaxFid(\'%s\',\'%s\',\'%s\',\'%s\',\'%s\')"',
|
||||
$this->name,
|
||||
$this->extra, //deb or cred
|
||||
$l_sessid
|
||||
$l_sessid,
|
||||
'js_search_only',
|
||||
'none'
|
||||
);
|
||||
}
|
||||
if ( $this->readonly == false ) {
|
||||
|
|
@ -522,11 +539,48 @@ class widget {
|
|||
}
|
||||
return $r;
|
||||
}// poste==js_search_only
|
||||
//#############################################################################
|
||||
// input type == js_search => button search for card
|
||||
/*!\brief js_search_only only for searching a card when it is needed to update a other control
|
||||
* \todo to finish + ajax
|
||||
*/
|
||||
if ( strtolower($this->type)=="js_search_card_control") {
|
||||
$l_sessid=$_REQUEST['PHPSESSID'];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if ( $this->javascript=="") { /* if javascript is empty then we
|
||||
add a default behaviour */
|
||||
$this->javascript=sprintf('onBlur="ajaxFid(\'%s\',\'%s\',\'%s\',\'%s\',\'%s\')"',
|
||||
$this->name,
|
||||
$this->extra, //deb or cred
|
||||
$l_sessid,
|
||||
"searchcardControl",
|
||||
$this->ctrl
|
||||
);
|
||||
}
|
||||
if ( $this->readonly == false ) {
|
||||
if ( $this->extra2 == "" ) $this->extra2="QuickCode";
|
||||
$r=sprintf('<table><tr><TD>
|
||||
<INPUT TYPE="button" onClick="searchCardCtrl(\'%s\',\'%s\',\'%s\',\'%s\')" value="%s">
|
||||
%s</TD><TD> <INPUT class="input_text" TYPE="Text" " '.
|
||||
' NAME="%s" ID="%s" VALUE="%s" SIZE="8" %s></tr></table>',
|
||||
$l_sessid,
|
||||
$this->extra,
|
||||
$this->name,
|
||||
$this->ctrl,
|
||||
$this->extra2,
|
||||
$this->label,
|
||||
$this->name,
|
||||
$this->name,
|
||||
$this->value,
|
||||
$this->javascript
|
||||
);
|
||||
} else {
|
||||
// readonly == true and table == 0
|
||||
$r=sprintf('%s', $this->value );
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
//#############################################################################
|
||||
// type=span
|
||||
if ( strtolower($this->type)=="span") {
|
||||
$r=sprintf('<span style="inline" id="%s">%s </span>',
|
||||
|
|
@ -536,7 +590,7 @@ class widget {
|
|||
|
||||
return $r;
|
||||
}// end type = span
|
||||
|
||||
//#####################################################################
|
||||
// input type == js_tva
|
||||
if ( strtolower($this->type)=="js_tva") {
|
||||
$id=sprintf("<span id=%s></span>",$this->label);
|
||||
|
|
@ -554,7 +608,7 @@ class widget {
|
|||
$l_sessid,dossier::id(),$this->name);
|
||||
return $r;
|
||||
}
|
||||
|
||||
//#####################################################################
|
||||
// input type == js_concerned => button search for the concerned operations
|
||||
if ( strtolower($this->type)=="js_concerned") {
|
||||
$td="";$etd="";
|
||||
|
|
@ -584,9 +638,9 @@ class widget {
|
|||
|
||||
return $r;
|
||||
}// end js_concerned
|
||||
//----------------------------------------------------------------------
|
||||
//#####################################################################
|
||||
// BUTTON
|
||||
//----------------------------------------------------------------------
|
||||
//#####################################################################
|
||||
if ( strtolower($this->type)=="button") {
|
||||
$extra= ( isset($this->extra))?$this->extra:"";
|
||||
if ( $this->readonly==true) return "";
|
||||
|
|
@ -596,9 +650,9 @@ class widget {
|
|||
' onClick="'.$this->javascript.'"'.$extra.'>';
|
||||
return $r;
|
||||
}
|
||||
//----------------------------------------------------------------------
|
||||
//#####################################################################
|
||||
// JS_BUD_SEARCH_POSTE
|
||||
//----------------------------------------------------------------------
|
||||
//#####################################################################
|
||||
if ( strtolower($this->type)=="js_bud_search_poste") {
|
||||
if ( $this->readonly==true) return "";
|
||||
$dis= ( $this->disabled==true) ? "disabled":"";
|
||||
|
|
@ -614,9 +668,9 @@ class widget {
|
|||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
//#####################################################################
|
||||
// JS_DATE
|
||||
//------------------------------------------------------------------------
|
||||
//#####################################################################
|
||||
if ( strtolower($this->type)=="js_date") {
|
||||
if ( $this->readonly) {
|
||||
$r="<span> Date : ".$this->value;
|
||||
|
|
@ -657,6 +711,7 @@ class widget {
|
|||
}
|
||||
return "INVALID WIDGET $this->type ";
|
||||
} //end function
|
||||
//#####################################################################
|
||||
/* Debug
|
||||
*/
|
||||
function debug() {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ $sub_action=(isset($_REQUEST['sb']))?$_REQUEST['sb']:"list";
|
|||
/*! \file
|
||||
* \brief Called from the module "Gestion" to manage the customer
|
||||
*/
|
||||
$User->can_request($cn,CLIENT);
|
||||
$User->can_request(GECUST);
|
||||
$href=basename($_SERVER['PHP_SELF']);
|
||||
|
||||
// Menu
|
||||
|
|
|
|||
|
|
@ -73,11 +73,12 @@ $href=basename($_SERVER['PHP_SELF']);
|
|||
//----------------------------------------------------------------------
|
||||
if ( $def==1 || $def == 4 ) {
|
||||
// Check privilege
|
||||
if ( isset($_REQUEST['p_jrn']) &&
|
||||
CheckJrn($gDossier,$_SESSION['g_user'],$_REQUEST ['p_jrn']) != 2 ) {
|
||||
NoAccess();
|
||||
exit -1;
|
||||
}
|
||||
if ( isset($_REQUEST['p_jrn']))
|
||||
if ( $User->check_jrn($_REQUEST['p_jrn']) != 'W' )
|
||||
{
|
||||
NoAccess();
|
||||
exit -1;
|
||||
}
|
||||
|
||||
/* if a new invoice is encoded, we display a form for confirmation */
|
||||
if ( isset ($_POST['view_invoice'] ) ) {
|
||||
|
|
@ -130,7 +131,7 @@ if ( $def==1 || $def == 4 ) {
|
|||
|
||||
|
||||
/* Save the predefined operation */
|
||||
if ( isset($_POST['opd_save'])) {
|
||||
if ( isset($_POST['opd_save']) && $User->check_action(PARPREDE)==1) {
|
||||
echo_debug(__FILE__,__LINE__,'saving predefined op');
|
||||
$opd=new Pre_op_ach($cn);
|
||||
$opd->get_post();
|
||||
|
|
@ -138,7 +139,14 @@ if ( $def==1 || $def == 4 ) {
|
|||
}
|
||||
|
||||
/* Show button */
|
||||
echo "<h2 class=\"info\">Opération sauvée $internal </h2>";
|
||||
echo '<h2 class="info">'.$Ledger->get_name().'</h2>';
|
||||
echo "<h2 >Opération sauvée $internal ";
|
||||
if ( $Ledger->pj != '') echo ' Piece : '.h($Ledger->pj);
|
||||
echo "</h2>";
|
||||
if ( strcmp($Ledger->pj,$_POST['e_pj']) != 0 ) {
|
||||
echo '<h3 class="notice"> Attention numéro pièce existante, elle a du être adaptée</h3>';
|
||||
}
|
||||
|
||||
echo widget::button_href('Nouvelle dépense',$href.'?p_action=ach&sa=n&'.dossier::get());
|
||||
echo '</div>';
|
||||
exit();
|
||||
|
|
@ -167,8 +175,6 @@ if ( $def==1 || $def == 4 ) {
|
|||
$Ledger->id=$_REQUEST ['p_jrn'];
|
||||
|
||||
|
||||
|
||||
|
||||
/* request for a predefined operation */
|
||||
if ( isset($use_predef) && $use_predef == 1 && isset($_REQUEST['pre_def']) ) {
|
||||
// used a predefined operation
|
||||
|
|
@ -215,11 +221,6 @@ if ( $def==1 || $def == 4 ) {
|
|||
//--------------------------------------------------------------------------------
|
||||
if ( $def == 2 ) {
|
||||
// Check privilege
|
||||
if ( isset($_REQUEST['p_jrn']) &&
|
||||
CheckJrn($gDossier,$_SESSION['g_user'],$_GET['p_jrn']) ==0 ) {
|
||||
NoAccess();
|
||||
exit -1;
|
||||
}
|
||||
|
||||
echo '<div class="content">';
|
||||
$Ledger=new Acc_Ledger_Purchase($cn,0);
|
||||
|
|
@ -229,6 +230,11 @@ if ( $def == 2 ) {
|
|||
} else
|
||||
$Ledger->id=$_GET['p_jrn'];
|
||||
|
||||
if ( $User->check_jrn($Ledger->id)=='X') {
|
||||
NoAccess();
|
||||
exit -1;
|
||||
}
|
||||
|
||||
//------------------------------
|
||||
// UPdate the payment
|
||||
//------------------------------
|
||||
|
|
@ -253,13 +259,6 @@ if ( $def == 2 ) {
|
|||
// Listing unpaid
|
||||
//---------------------------------------------------------------------------
|
||||
if ( $def==3 ) {
|
||||
// Check privilege
|
||||
if ( isset($_REQUEST['p_jrn']) &&
|
||||
CheckJrn($gDossier,$_SESSION['g_user'],$_GET['p_jrn']) ==0 ) {
|
||||
NoAccess();
|
||||
exit -1;
|
||||
}
|
||||
|
||||
$Ledger=new Acc_Ledger_Purchase($cn,0);
|
||||
if ( !isset($_GET['p_jrn'])) {
|
||||
$def_ledger=$Ledger->get_first('ach');
|
||||
|
|
@ -267,6 +266,11 @@ if ( $def==3 ) {
|
|||
} else
|
||||
$Ledger->id=$_GET['p_jrn'];
|
||||
|
||||
if ( $User->check_jrn($Ledger->id)=='X') {
|
||||
NoAccess();
|
||||
exit -1;
|
||||
}
|
||||
|
||||
// Ask to update payment
|
||||
if ( isset ( $_GET['paid'])) {
|
||||
$Ledger->update_paid($_GET);
|
||||
|
|
@ -290,5 +294,6 @@ if ( $def==3 ) {
|
|||
|
||||
}
|
||||
if ( $p_action == 'fournisseur') {
|
||||
$User->can_request(GESUPPL,1);
|
||||
require_once ('supplier.inc.php');
|
||||
}
|
||||
|
|
@ -24,7 +24,6 @@
|
|||
* \brief this file is to be included to handle the financial ledger
|
||||
*/
|
||||
require_once ('class_acc_ledger_fin.php');
|
||||
require_once ('check_priv.php');
|
||||
$gDossier=dossier::id();
|
||||
$p_action=(isset ($_REQUEST['p_action']))?$_REQUEST['p_action']:'';
|
||||
|
||||
|
|
@ -57,16 +56,11 @@ echo '</div>';
|
|||
|
||||
$href=basename($_SERVER['PHP_SELF']);
|
||||
$Ledger=new Acc_Ledger_Fin($cn,0);
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// Encode a new financial operation
|
||||
//--------------------------------------------------------------------------------
|
||||
if ( $def == 1 ) {
|
||||
// Check privilege
|
||||
if ( isset($_REQUEST['p_jrn']) &&
|
||||
CheckJrn($gDossier,$_SESSION['g_user'],$_REQUEST ['p_jrn']) != 2 ) {
|
||||
NoAccess();
|
||||
exit -1;
|
||||
}
|
||||
|
||||
$href=basename($_SERVER['PHP_SELF']);
|
||||
|
||||
|
|
@ -76,6 +70,13 @@ if ( $def == 1 ) {
|
|||
$def_ledger=$Ledger->get_first('fin');
|
||||
$Ledger->id=$def_ledger['jrn_def_id'];
|
||||
}
|
||||
$jrn_priv=$User->check_action($Ledger->id);
|
||||
// Check privilege
|
||||
if ( isset($_REQUEST['p_jrn']) && ( $jrn_priv == 'X')) {
|
||||
NoAccess();
|
||||
exit -1;
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
// Confirm the operations
|
||||
//----------------------------------------
|
||||
|
|
@ -153,9 +154,11 @@ if ( $def == 1 ) {
|
|||
// Show the listing
|
||||
//--------------------------------------------------------------------------------
|
||||
if ( $def == 2) {
|
||||
$Ledger->id=$_REQUEST['p_jrn'];
|
||||
$jrn_priv=$User->check_action($Ledger->id);
|
||||
|
||||
// Check privilege
|
||||
if ( isset($_REQUEST['p_jrn']) &&
|
||||
CheckJrn($gDossier,$_SESSION['g_user'],$_GET['p_jrn']) ==0 ) {
|
||||
if ( isset($_REQUEST['p_jrn']) && $jrn_priv=='X') {
|
||||
NoAccess();
|
||||
exit -1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,14 +74,17 @@ $href=basename($_SERVER['PHP_SELF']);
|
|||
// empty form for encoding
|
||||
//----------------------------------------------------------------------
|
||||
if ( $def==1 || $def == 4 ) {
|
||||
// Check privilege
|
||||
if ( isset($_REQUEST['p_jrn']) &&
|
||||
CheckJrn($gDossier,$_SESSION['g_user'],$_REQUEST ['p_jrn']) != 2 )
|
||||
{
|
||||
NoAccess();
|
||||
exit -1;
|
||||
}
|
||||
$Ledger=new Acc_Ledger_Sold($cn,0);
|
||||
|
||||
// Check privilege
|
||||
if ( isset($_REQUEST['p_jrn']) &&
|
||||
$User->check_jrn($_REQUEST['p_jrn']) != 'W' )
|
||||
{
|
||||
|
||||
NoAccess();
|
||||
exit -1;
|
||||
}
|
||||
|
||||
/* if a new invoice is encoded, we display a form for confirmation */
|
||||
if ( isset ($_POST['view_invoice'] ) ) {
|
||||
$Ledger=new Acc_Ledger_Sold($cn,$_POST['p_jrn']);
|
||||
|
|
@ -120,7 +123,7 @@ if ( $def==1 || $def == 4 ) {
|
|||
|
||||
if ( isset($_POST['record']) ){
|
||||
// Check privilege
|
||||
if ( CheckJrn($gDossier,$_SESSION['g_user'],$_REQUEST['p_jrn']) != 2 ) {
|
||||
if ( $User->check_jrn($_REQUEST['p_jrn']) != 'W' ) {
|
||||
NoAccess();
|
||||
exit -1;
|
||||
}
|
||||
|
|
@ -136,6 +139,7 @@ if ( $def==1 || $def == 4 ) {
|
|||
echo '<div class="content">';
|
||||
$Ledger=new Acc_Ledger_Sold($cn,$_POST['p_jrn']);
|
||||
$internal=$Ledger->insert($_POST);
|
||||
|
||||
/* Save the predefined operation */
|
||||
if ( isset($_POST['opd_save'])) {
|
||||
$opd=new Pre_op_ven($cn);
|
||||
|
|
@ -144,7 +148,14 @@ if ( $def==1 || $def == 4 ) {
|
|||
}
|
||||
|
||||
/* Show button */
|
||||
echo "<h2 class=\"info\">Opération sauvée $internal </h2>";
|
||||
echo '<h2 class="info">'.$Ledger->get_name().'</h2>';
|
||||
echo "<h2 >Opération sauvée $internal ";
|
||||
if ( $Ledger->pj != '') echo ' Piece : '.h($Ledger->pj);
|
||||
echo "</h2>";
|
||||
|
||||
if ( strcmp($Ledger->pj,$_POST['e_pj']) != 0 ) {
|
||||
echo '<h3 class="notice"> Attention numéro pièce existante, elle a du être adaptée</h3>';
|
||||
}
|
||||
/* Here you need to generate the invoice */
|
||||
if ( isset($_REQUEST['gen_invoice']) ) {
|
||||
$doc=new Document($cn);
|
||||
|
|
@ -232,6 +243,11 @@ if ( $def==1 || $def == 4 ) {
|
|||
$op->set('ledger_type',"VEN");
|
||||
$op->set('direct','f');
|
||||
echo $op->form_get();
|
||||
$own=new Own($cn);
|
||||
/* if we suggest the pj n# the run the script */
|
||||
if ( $own->MY_PJ_SUGGEST=='Y') {
|
||||
echo '<script> update_pj();</script>';
|
||||
}
|
||||
echo '</form>';
|
||||
echo '<form onsubmit="cal();return false;" name="calc_line" method="get">';
|
||||
echo JS_CALC_LINE;
|
||||
|
|
@ -246,7 +262,7 @@ if ( $def == 2 ) {
|
|||
echo '<div class="content">';
|
||||
// Check privilege
|
||||
if ( isset($_REQUEST['p_jrn']) &&
|
||||
CheckJrn($gDossier,$_SESSION['g_user'],$_REQUEST['p_jrn']) ==0 ) {
|
||||
$User->check_jrn($_REQUEST['p_jrn']) == 'X') {
|
||||
NoAccess();
|
||||
exit -1;
|
||||
}
|
||||
|
|
@ -284,11 +300,11 @@ if ( $def == 2 ) {
|
|||
if ( $def==3 ) {
|
||||
// Check privilege
|
||||
if ( isset($_REQUEST['p_jrn']) &&
|
||||
CheckJrn($gDossier,$_SESSION['g_user'],$_REQUEST['p_jrn']) ==0 ) {
|
||||
NoAccess();
|
||||
exit -1;
|
||||
$User->check_jrn($_REQUEST['p_jrn']) == 'X') {
|
||||
NoAccess();
|
||||
exit -1;
|
||||
}
|
||||
|
||||
|
||||
$Ledger=new Acc_Ledger_Sold($cn,0);
|
||||
if ( !isset($_REQUEST['p_jrn'])) {
|
||||
$def_ledger=$Ledger->get_first('ven');
|
||||
|
|
@ -304,6 +320,10 @@ if ( $def==3 ) {
|
|||
|
||||
echo '<FORM METHOD="GET" action="'.$href.'">';
|
||||
$wLedger=$Ledger->select_ledger('VEN',2);
|
||||
if ( $wLedger == null ) {
|
||||
alert('aucun journal de disponible');
|
||||
exit();
|
||||
}
|
||||
$wLedger->javascript="onChange=submit()";
|
||||
echo "Journal ".$wLedger->IOValue();
|
||||
echo widget::submit ('search','Recherche');
|
||||
|
|
@ -318,5 +338,6 @@ if ( $def==3 ) {
|
|||
|
||||
}
|
||||
if ( $p_action == 'client') {
|
||||
$User->can_request(GECUST,1);
|
||||
require_once ('client.inc.php');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,12 +81,7 @@ function config_file_form($p_array=null)
|
|||
$r.='</div>';
|
||||
return $r;
|
||||
}
|
||||
/*!\brief
|
||||
*\param
|
||||
*\return
|
||||
*\note
|
||||
*\see
|
||||
*\todo
|
||||
/*!\brief create the config file
|
||||
*/
|
||||
function config_file_create($p_array,$from_setup=1,$os=1) {
|
||||
extract ($p_array);
|
||||
|
|
|
|||
|
|
@ -24,61 +24,14 @@
|
|||
* and some parameter
|
||||
*/
|
||||
require_once ('config.inc.php');
|
||||
require_once('constant.security.php');
|
||||
|
||||
define ("DBVERSION",56);
|
||||
define ("DBVERSION",57);
|
||||
|
||||
define ("MAX_COMPTE",4);
|
||||
define ('MAX_BUD_DETAIL',20);
|
||||
define ('MAX_ARTICLE',8);
|
||||
define ("DEBUG","false");
|
||||
|
||||
|
||||
|
||||
// securite correspond a la table
|
||||
// action
|
||||
// access aux journaux
|
||||
define ("ENCJRN",1);
|
||||
// création facture
|
||||
// define("FACT",2);
|
||||
// lecture aux fiche
|
||||
define ("FICHE_READ",3);
|
||||
// Impression
|
||||
define ("IMP",4);
|
||||
//formulaire
|
||||
define("FORM",5);
|
||||
// Modif du Plan Comptable
|
||||
define ("MPCMN",6);
|
||||
// Gestion des journaux
|
||||
define ("GJRN",7);
|
||||
// Gestion des param�tres globaux
|
||||
define ("PARM",8);
|
||||
// Voir la balance des compte
|
||||
define ("BALANCE",20);
|
||||
// Access � la centralisation
|
||||
define ("CENTRALIZE",10);
|
||||
define ("VEN",11);
|
||||
define ("BQE",12);
|
||||
define ("ODS",13);
|
||||
// Access gestion periode comptable
|
||||
define ("GESTION_PERIODE",31);
|
||||
|
||||
//!\enum Security
|
||||
define("SEC_ACTION", 28); // Module Suivi Document
|
||||
define("CLIENT",22); // Module Client
|
||||
define("SUPPL",24); // Module Fournisseur
|
||||
define("ADMIN",26); // Module Administration
|
||||
define("SEC_GESTION",30); // Module Gestion
|
||||
define ('BUDGET',60);
|
||||
|
||||
define ("FICHE_WRITE",15);
|
||||
define ("STOCK_WRITE",17);
|
||||
define ("STOCK_READ",16);
|
||||
define ("EXP_IMP_ECR",21);
|
||||
define ("IMP_BQE",22);
|
||||
|
||||
define ("CA_ACCESS",50);
|
||||
define ("CA_IMPRESSION",51);
|
||||
define ("CA_ODS",52);
|
||||
define ("DEBUG","true");
|
||||
|
||||
// Erreur
|
||||
define ("NOERROR",0);
|
||||
|
|
|
|||
46
include/constant.security.php
Normal file
46
include/constant.security.php
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
define ("BUDLEC",100); //Accès en lecture
|
||||
define ("BUDHYP",110); //Création hypothèse
|
||||
define ("BUDFIC",120); //Création de fiche
|
||||
define ("BUDIMP",130); //Impression
|
||||
define ("CAPA",210); //Ajout de plan analytique
|
||||
define ("CAPO",220); //Ajout de poste analytique
|
||||
define ("CAGA",230); //Ajout de groupe analytique
|
||||
define('CAOD',235); // Ajout d'OD
|
||||
define ("CAIMP",240); //Impression
|
||||
define('GESTION',300); /* Access gestion */
|
||||
define ("GEBQ",305); //Import en Banque
|
||||
define ("GEOP",307); //Effacement d'opération
|
||||
define ("GECOUR",310); //Courrier (lecture & écriture)
|
||||
define ("GESUPPL",311); /* Fournisseur */
|
||||
define ("GECUST",312); /* Clients */
|
||||
define ("GESTOCK",320); //gestion de stock
|
||||
define ("IMPRAP",700); //Rapport
|
||||
define ("IMPJRN",710); //Journaux
|
||||
define ("IMPFIC",720); //Fiche
|
||||
define ("IMPPOSTE",730); //Poste
|
||||
define ("IMPBIL",740); //Bilan
|
||||
define ("IMPBAL",750); /* Impression balance */
|
||||
define ('FICADD',800); /* Ajout de fiche */
|
||||
define ("FIC",805); //Création, modification et effacement de fiche
|
||||
define ("FICCAT",910); //création, modification et effacement de catégorie de fiche
|
||||
define ("PARCA",1100); //Mode comptabilité analytique
|
||||
define ("PARPER",1110); //Ajout de période
|
||||
define ("PARFIC",1120); //Catégorie des fiches
|
||||
define ("PARDOC",1130); //Document
|
||||
define ("PARJRN",1140); //Modification journaux
|
||||
define ("PARSEC",1245); /* Sécurité */
|
||||
define ("PARTVA",1150); //TVA
|
||||
define ("PARMP",1160); //Moyen de paiement
|
||||
define ("PARCLO",1180); //Clôture
|
||||
define ("PARPCMN",1185); /* Chagt plan comptable */
|
||||
define ("PARPOS",1170); //Poste Comptable de base
|
||||
define ("PARCENT",1190); //Centralisation
|
||||
define ("PAREO",1200); //Écriture d'ouverture
|
||||
define ("PARSTR",1210); //Mode strict
|
||||
define ("PARCOORD",1220); //Coordonnées société
|
||||
define ("PARRAP",1230); //Création de rapport
|
||||
define ("PARPREDE",1240); //Effacement et création d'opération prédéfinie
|
||||
define ("STOLE",1500); //Stock (lecture)
|
||||
define ("STOWRITE",1510); //Stock (changement)
|
||||
?>
|
||||
|
|
@ -33,9 +33,9 @@ echo JS_SEARCH_POSTE;
|
|||
echo JS_AJAX_FICHE;
|
||||
|
||||
if ( !isset($sessid))
|
||||
{
|
||||
$sessid=$_REQUEST["PHPSESSID"];
|
||||
}
|
||||
{
|
||||
$sessid=$_REQUEST["PHPSESSID"];
|
||||
}
|
||||
$search='<INPUT TYPE="BUTTON" VALUE="Cherche" OnClick="SearchPoste(\''.$sessid."',".dossier::id().",'class_base','')\">";
|
||||
|
||||
|
||||
|
|
@ -44,9 +44,8 @@ include_once("fiche_inc.php");
|
|||
$cn=DbConnect($gDossier);
|
||||
echo_debug(__FILE__,__LINE__,"Connected");
|
||||
// Security check
|
||||
$read=$User->check_action($cn,FICHE_READ);
|
||||
$write=$User->check_action($cn,FICHE_WRITE);
|
||||
if ($read+$write == 0 ){
|
||||
$write=$User->check_action(FICADD);
|
||||
if ($write == 0 ){
|
||||
/* Cannot Access */
|
||||
NoAccess();
|
||||
}
|
||||
|
|
@ -73,7 +72,7 @@ function ShowFicheDefInput($p_fiche_def)
|
|||
$p_fiche_def->Get();
|
||||
$p_fiche_def->GetAttribut();
|
||||
if (isset ($_REQUEST['label']) )
|
||||
$p_fiche_def->SaveLabel($_REQUEST['label']);
|
||||
$p_fiche_def->SaveLabel($_REQUEST['label']);
|
||||
$r.= '<H2 class="info">'.h($p_fiche_def->label).'</H2>';
|
||||
|
||||
$r.= '<FORM action="?p_action=fiche" method="POST">';
|
||||
|
|
@ -98,14 +97,15 @@ attributs sélectionnés. Il ne sera pas possible de revenir en arrière</p>";
|
|||
$recherche=true;
|
||||
// Creation of a new model of card
|
||||
// in the database
|
||||
if ( isset($_POST['add_modele']) and $write != 0) {
|
||||
// insert the model of card in database
|
||||
$fiche_def=new fiche_def($cn);
|
||||
$fiche_def->Add($_POST);
|
||||
}
|
||||
if ( isset($_POST['add_modele']) && $User->can_request(FICCAT) )
|
||||
{
|
||||
// insert the model of card in database
|
||||
$fiche_def=new fiche_def($cn);
|
||||
$fiche_def->Add($_POST);
|
||||
}
|
||||
$r="";
|
||||
|
||||
if ( isset ($_POST['remove_cat'] )) {
|
||||
if ( isset ($_POST['remove_cat'] ) && $User->can_request(FICCAT) ) {
|
||||
$fd_id=new fiche_def($cn,$_POST['fd_id']);
|
||||
$remains=$fd_id->remove();
|
||||
if ( $remains != 0 )
|
||||
|
|
@ -114,46 +114,49 @@ if ( isset ($_POST['remove_cat'] )) {
|
|||
'Les fiches non utilisées ont cependant été effacées');
|
||||
}
|
||||
// Add a line in the card model
|
||||
if ( isset ($_POST["add_line"]) ) {
|
||||
if ( isset ($_POST["add_line"]) && $User->can_request(FIC) ) {
|
||||
$r= '<DIV class="u_redcontent">';
|
||||
if ( $write ==0)
|
||||
$r.= "<h2 class=\"error\"> Pas d'accès </h2>";
|
||||
else
|
||||
{
|
||||
$fiche_def=new fiche_def($cn,$_REQUEST['fd_id']);
|
||||
// Insert Line
|
||||
$fiche_def->InsertAttribut($_REQUEST['ad_id']);
|
||||
if ( $write ==0)
|
||||
$r.= "<h2 class=\"error\"> Pas d'accès </h2>";
|
||||
else
|
||||
{
|
||||
$fiche_def=new fiche_def($cn,$_REQUEST['fd_id']);
|
||||
// Insert Line
|
||||
$fiche_def->InsertAttribut($_REQUEST['ad_id']);
|
||||
|
||||
$r.=ShowFicheDefInput($fiche_def);
|
||||
$r.=ShowFicheDefInput($fiche_def);
|
||||
|
||||
}
|
||||
}
|
||||
$r.= '</DIV>';
|
||||
$recherche=false;
|
||||
}
|
||||
/* ------------------------------------------------- */
|
||||
/* SAVE ORDER */
|
||||
/* ------------------------------------------------- */
|
||||
|
||||
if ( isset($_POST['save_line'])) {
|
||||
$User->can_request(FICCAT);
|
||||
$fiche_def=new fiche_def($cn,$_REQUEST['fd_id']);
|
||||
$fiche_def->save_order($_POST);
|
||||
$r= '<DIV class="u_redcontent">';
|
||||
if ( $write ==0)
|
||||
$r.= "<h2 class=\"error\"> Pas d'accès </h2>";
|
||||
$r.= "<h2 class=\"error\"> Pas d'accès </h2>";
|
||||
else
|
||||
{
|
||||
$fiche_def=new fiche_def($cn,$_REQUEST['fd_id']);
|
||||
// Insert Line
|
||||
$r.=ShowFicheDefInput($fiche_def);
|
||||
|
||||
}
|
||||
}
|
||||
$r.= '</DIV>';
|
||||
$recherche=false;
|
||||
|
||||
}
|
||||
// Remove lines from a card model
|
||||
if ( isset ($_POST['remove_line']))
|
||||
{
|
||||
$r= '<DIV class="u_redcontent">';
|
||||
if ( isset ($_POST['remove_line']) )
|
||||
{
|
||||
$User->can_request(FICCAT);
|
||||
$r= '<DIV class="u_redcontent">';
|
||||
if ( $write ==0)
|
||||
$r.= "<h2 class=\"error\"> Pas d'accès </h2>";
|
||||
else
|
||||
|
|
@ -166,24 +169,24 @@ if ( isset ($_POST['remove_line']))
|
|||
$r.=ShowFicheDefInput($fiche_def);
|
||||
|
||||
}
|
||||
$r.= '</DIV>';
|
||||
$recherche=false;
|
||||
}
|
||||
$r.= '</DIV>';
|
||||
$recherche=false;
|
||||
}
|
||||
// Change the name of the card model
|
||||
if ( isset ($_POST["change_name"] ) ) {
|
||||
if ( isset ($_POST["change_name"] ) ) {
|
||||
$User->can_request(FICCAT);
|
||||
$r= '<DIV class="u_redcontent">';
|
||||
if ( $write ==0)
|
||||
$r.= "<h2 class=\"error\"> Pas d'accès </h2>";
|
||||
$r.= "<h2 class=\"error\"> Pas d'accès </h2>";
|
||||
else
|
||||
{
|
||||
$fiche_def=new fiche_def($cn,$_REQUEST['fd_id']);
|
||||
$r.=ShowFicheDefInput($fiche_def);
|
||||
}
|
||||
{
|
||||
$fiche_def=new fiche_def($cn,$_REQUEST['fd_id']);
|
||||
$r.=ShowFicheDefInput($fiche_def);
|
||||
}
|
||||
$r.= '</DIV>';
|
||||
$recherche=false;
|
||||
}
|
||||
|
||||
//var_dump($_GET);
|
||||
ShowMenuFiche($gDossier);
|
||||
echo $r;
|
||||
|
||||
|
|
@ -196,6 +199,7 @@ if ( isset ( $_GET["action"]) ) {
|
|||
&& ! isset ($_POST['add_fiche'])
|
||||
&& ! isset ($_POST['update_fiche'])
|
||||
&& ! isset ($_POST['delete'])) {
|
||||
$User->can_request(FICADD);
|
||||
|
||||
echo '<DIV class="u_redcontent">';
|
||||
$fiche_def=new fiche_def($cn,$_GET['fiche']);
|
||||
|
|
@ -203,14 +207,14 @@ if ( isset ( $_GET["action"]) ) {
|
|||
|
||||
echo '</DIV>';
|
||||
|
||||
$recherche=false;
|
||||
$recherche=false;
|
||||
}
|
||||
//_________________________________________________________________________
|
||||
// Display the detail of a card
|
||||
// Display the detail of a card
|
||||
if ($action== "detail" ) {
|
||||
echo '<DIV class="u_redcontent">';
|
||||
$t=false;
|
||||
if ( $write == 0)
|
||||
if ( $User->check_action(FICADD)==0)
|
||||
{
|
||||
echo '<H2 class="info"> Vos changements ne seront pas sauvés</h2>';
|
||||
$t=true;
|
||||
|
|
@ -225,19 +229,19 @@ if ( isset ( $_GET["action"]) ) {
|
|||
if ( $_SESSION['g_pagesize'] != -1 ){
|
||||
// retrieve value
|
||||
// with offet &offset=15&step=15&page=2&size=15
|
||||
if ( isset($_GET['offset']) && $_SESSION['g_pagesize'] != -1) {
|
||||
$str=sprintf("&offset=%s&step=%s&page=%s&size=%s",
|
||||
$_GET['offset'],
|
||||
$_GET['step'],
|
||||
$_GET['page'],
|
||||
$_GET['size']);
|
||||
}
|
||||
if ( isset($_GET['offset']) && $_SESSION['g_pagesize'] != -1) {
|
||||
$str=sprintf("&offset=%s&step=%s&page=%s&size=%s",
|
||||
$_GET['offset'],
|
||||
$_GET['step'],
|
||||
$_GET['page'],
|
||||
$_GET['size']);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if ( $write != 0 )
|
||||
echo '<form method="post" action="?p_action=fiche&action=vue&fiche='.$_GET['fiche'].$str.'">';
|
||||
echo dossier::hidden();
|
||||
echo dossier::hidden();
|
||||
echo $fiche->Display($t);
|
||||
echo '<input type="hidden" name="f_id" value="'.$_GET['fiche_id'].'">';
|
||||
if ( $write != 0 ) {
|
||||
|
|
@ -250,39 +254,33 @@ if ( isset ( $_GET["action"]) ) {
|
|||
'"><input type="button" value="Annuler"></A>';
|
||||
if ( $write != 0 ) echo '</form>';
|
||||
echo '</DIV>';
|
||||
$recherche=false;
|
||||
$recherche=false;
|
||||
}
|
||||
//_________________________________________________________________________
|
||||
// Display the form where you can enter
|
||||
// the property of the card model
|
||||
if ($action == "add_modele" and $write !=0) {
|
||||
if ($action == "add_modele" && $User->can_request(FICCAT) !=0) {
|
||||
echo '<DIV class="u_redcontent">';
|
||||
CreateCategory($cn,$search);
|
||||
echo '</DIV>';
|
||||
$recherche=false;
|
||||
$recherche=false;
|
||||
}
|
||||
//_________________________________________________________________________
|
||||
// Modify a card Model
|
||||
if ($action == "modifier" ) {
|
||||
$User->can_request(FICCAT);
|
||||
echo '<DIV class="u_redcontent">';
|
||||
if ( $write ==0)
|
||||
echo "<h2 class=\"error\"> Pas d'accès </h2>";
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
$fiche_def=new fiche_def($cn,$_GET['fiche']);
|
||||
|
||||
echo ShowFicheDefInput($fiche_def);
|
||||
}
|
||||
$fiche_def=new fiche_def($cn,$_GET['fiche']);
|
||||
|
||||
echo ShowFicheDefInput($fiche_def);
|
||||
echo '</DIV>';
|
||||
$recherche=false;
|
||||
$recherche=false;
|
||||
}
|
||||
//_________________________________________________________________________
|
||||
// Search a card
|
||||
if ( $action == "search" )
|
||||
{
|
||||
ShowRecherche();
|
||||
ShowRecherche();
|
||||
$sql="select distinct f_id,fd_id,av_text from fiche join jnt_fic_att_value using (f_id)
|
||||
join attr_value using (jft_id) where
|
||||
upper(av_text) like upper('%".FormatString($_GET["search_text"])."%') order by av_text,f_id";
|
||||
|
|
@ -290,51 +288,53 @@ if ( isset ( $_GET["action"]) ) {
|
|||
// test on the size
|
||||
//
|
||||
if ( sizeof($all) != 0 )
|
||||
{
|
||||
echo '<DIV class="u_redcontent">';
|
||||
echo "Nombre de résultat : ".sizeof($all).'<br>';
|
||||
foreach ($all as $f_id){
|
||||
$fiche=new fiche($cn,$f_id['f_id']);
|
||||
echo '<A class="mtitle" href="?p_action=fiche&'.$str_dossier.'&action=detail&fiche_id='.$f_id['f_id'].
|
||||
'&fiche='.$f_id['fd_id'].'">'.
|
||||
$fiche->getName().'</A><br>';
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
{
|
||||
echo '<DIV class="u_redcontent">';
|
||||
echo "Nombre de résultat : ".sizeof($all).'<br>';
|
||||
foreach ($all as $f_id){
|
||||
$fiche=new fiche($cn,$f_id['f_id']);
|
||||
echo '<A class="mtitle" href="?p_action=fiche&'.$str_dossier.'&action=detail&fiche_id='.$f_id['f_id'].
|
||||
'&fiche='.$f_id['fd_id'].'">'.
|
||||
$fiche->getName().'</A><br>';
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
echo '<DIV class="u_redcontent">';
|
||||
echo "Aucun résultat trouvé";
|
||||
{
|
||||
echo '<DIV class="u_redcontent">';
|
||||
echo "Aucun résultat trouvé";
|
||||
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
|
||||
}
|
||||
}
|
||||
$recherche=false;
|
||||
$recherche=false;
|
||||
}
|
||||
// Display a blank card from the selected category
|
||||
if ( isset ($_POST["fiche"]) && isset ($_POST["add"] ) ) {
|
||||
$User->can_request(FICADD);
|
||||
|
||||
echo '<DIV class="u_redcontent">';
|
||||
if ( $write ==0)
|
||||
echo "<h2 class=\"error\"> Pas d'accès </h2>";
|
||||
else
|
||||
{
|
||||
$fiche_def=new fiche_def($cn,$_POST['fiche']);
|
||||
$fiche_def->Get();
|
||||
echo '<h2 class="info">'.$fiche_def->label.'</h2>';
|
||||
$url=$_SERVER['REQUEST_URI'];
|
||||
$fiche=new fiche($cn,0);
|
||||
if ( $write ==0)
|
||||
echo "<h2 class=\"error\"> Pas d'accès </h2>";
|
||||
else
|
||||
{
|
||||
$fiche_def=new fiche_def($cn,$_POST['fiche']);
|
||||
$fiche_def->Get();
|
||||
echo '<h2 class="info">'.$fiche_def->label.'</h2>';
|
||||
$url=$_SERVER['REQUEST_URI'];
|
||||
$fiche=new fiche($cn,0);
|
||||
|
||||
echo '<form method="post" action="'.$url.'&fiche='.$_POST['fiche'].'">';
|
||||
echo dossier::hidden();
|
||||
echo $fiche->blank($_POST['fiche']);
|
||||
echo '<input type="submit" name="add_fiche" value="Ajout">';
|
||||
echo '<a class="mtitle" href="'.$url.'&fiche='.$_POST['fiche'].'&'.$str_dossier.'">'.
|
||||
'<input type="button" value="Annuler"></A>';
|
||||
echo '<form method="post" action="'.$url.'&fiche='.$_POST['fiche'].'">';
|
||||
echo dossier::hidden();
|
||||
echo $fiche->blank($_POST['fiche']);
|
||||
echo '<input type="submit" name="add_fiche" value="Ajout">';
|
||||
echo '<a class="mtitle" href="'.$url.'&fiche='.$_POST['fiche'].'&'.$str_dossier.'">'.
|
||||
'<input type="button" value="Annuler"></A>';
|
||||
|
||||
|
||||
echo '</form>';
|
||||
}
|
||||
echo '</form>';
|
||||
}
|
||||
echo '</DIV>';
|
||||
$recherche=false;
|
||||
exit();
|
||||
|
|
@ -342,29 +342,30 @@ if ( isset ($_POST["fiche"]) && isset ($_POST["add"] ) ) {
|
|||
//------------------------------------------------------------------------------
|
||||
// delete a card
|
||||
if (isset($_POST['delete']) ) {
|
||||
ShowRecherche();
|
||||
echo '<DIV class="u_redcontent">';
|
||||
if ( $write ==0)
|
||||
echo "<h2 class=\"error\"> Pas d'accès </h2>";
|
||||
else
|
||||
{
|
||||
$fiche=new fiche($cn,$_POST["f_id"]);
|
||||
$fiche->remove();
|
||||
}
|
||||
$fiche_def=new fiche_def($cn,$_GET['fiche']);
|
||||
$fiche_def->myList();
|
||||
$User->can_request(FIC);
|
||||
ShowRecherche();
|
||||
echo '<DIV class="u_redcontent">';
|
||||
if ( $write ==0)
|
||||
echo "<h2 class=\"error\"> Pas d'accès </h2>";
|
||||
else
|
||||
{
|
||||
$fiche=new fiche($cn,$_POST["f_id"]);
|
||||
$fiche->remove();
|
||||
}
|
||||
$fiche_def=new fiche_def($cn,$_GET['fiche']);
|
||||
$fiche_def->myList();
|
||||
|
||||
echo "</DIV>";
|
||||
exit();
|
||||
}
|
||||
echo "</DIV>";
|
||||
exit();
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
// Add the data (attribute) of the card
|
||||
if ( isset ($_POST["add_fiche"]) ) {
|
||||
|
||||
$User->can_request(FICADD);
|
||||
if ( $write ==0) {
|
||||
echo '<DIV class="u_redcontent">';
|
||||
echo '<DIV class="u_redcontent">';
|
||||
echo "<h2 class=\"error\"> Pas d'accès </h2>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowRecherche();
|
||||
|
|
@ -382,18 +383,18 @@ if ( isset ($_POST["add_fiche"]) ) {
|
|||
//------------------------------------------------------------------------------
|
||||
// Update a card
|
||||
if ( isset ($_POST["update_fiche"]) ) {
|
||||
|
||||
$User->can_request(FIC);
|
||||
echo '<DIV class="u_redcontent">';
|
||||
if ( $write ==0)
|
||||
echo "<h2 class=\"error\"> Pas d'accès </h2>";
|
||||
else
|
||||
{
|
||||
$fiche=new fiche($cn,$_POST['f_id']);
|
||||
$fiche->Save();
|
||||
if ( $write ==0)
|
||||
echo "<h2 class=\"error\"> Pas d'accès </h2>";
|
||||
else
|
||||
{
|
||||
$fiche=new fiche($cn,$_POST['f_id']);
|
||||
$fiche->Save();
|
||||
|
||||
}
|
||||
$fiche_def=new fiche_def($cn,$_GET['fiche']);
|
||||
$fiche_def->myList();
|
||||
}
|
||||
$fiche_def=new fiche_def($cn,$_GET['fiche']);
|
||||
$fiche_def->myList();
|
||||
|
||||
|
||||
|
||||
|
|
@ -404,7 +405,7 @@ if ( isset ($_POST["update_fiche"]) ) {
|
|||
}
|
||||
//--Search menu
|
||||
if ( $recherche==true) {
|
||||
ShowRecherche();
|
||||
ShowRecherche();
|
||||
}
|
||||
html_page_stop();
|
||||
html_page_stop();
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -212,66 +212,4 @@ function getFicheAttribut($p_cn,$p_id,$p_attr="") {
|
|||
}
|
||||
}
|
||||
|
||||
/*! IsFicheOfJrn
|
||||
***************************************************
|
||||
* \brief Check if a fiche is used by a jrn
|
||||
* return 1 if the fiche is in the range otherwise 0
|
||||
*
|
||||
*
|
||||
* \param $p_cn connextion
|
||||
* \param $j_jrn journal_id
|
||||
* \param $p_fiche : quick_code
|
||||
* \param $p_type : deb or cred default empty
|
||||
*
|
||||
*\todo fiche_inc.php function isFicheOfJrn this function is now in
|
||||
* class_fiche with the name belong_ledger, it should be replace
|
||||
* everywhere in the code
|
||||
*
|
||||
* \return 1 if the fiche is in the range otherwise 0
|
||||
*
|
||||
*/
|
||||
function IsFicheOfJrn($p_cn,$p_jrn,$p_fiche,$p_type="")
|
||||
{
|
||||
$get="";
|
||||
if ( $p_type == 'deb' ) {
|
||||
$get='jrn_def_fiche_deb';
|
||||
}
|
||||
if ( $p_type == 'cred' ) {
|
||||
$get='jrn_def_fiche_cred';
|
||||
}
|
||||
if ( $get != "" ) {
|
||||
$Res=ExecSql($p_cn,"select $get as fiche from jrn_def where jrn_def_id=$p_jrn");
|
||||
} else {
|
||||
// Get all the fiche type (deb and cred)
|
||||
$Res=ExecSql($p_cn," select jrn_def_fiche_cred as fiche
|
||||
from jrn_def where jrn_def_id=$p_jrn
|
||||
union
|
||||
select jrn_def_fiche_deb
|
||||
from jrn_def where jrn_def_id=$p_jrn"
|
||||
);
|
||||
}
|
||||
$Max=pg_NumRows($Res);
|
||||
if ( $Max==0) {
|
||||
echo_warning("No rows");
|
||||
return null;
|
||||
}
|
||||
// Normally Max must be == 1
|
||||
$list=pg_fetch_array($Res,0);
|
||||
if ( $list['fiche']=="") {
|
||||
echo_warning("No fiche");
|
||||
return null;
|
||||
}
|
||||
$p_fiche=FormatString($p_fiche);
|
||||
$sql="select *
|
||||
from vw_fiche_attr
|
||||
where
|
||||
fd_id in (".$list['fiche'].") and quick_code=upper('$p_fiche')";
|
||||
|
||||
$Res=ExecSql($p_cn,$sql);
|
||||
$Max=pg_NumRows($Res);
|
||||
if ($Max==0 )
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue