From aefc4b1eb83dd5f074f54ddbb9c370ec9da4bb77 Mon Sep 17 00:00:00 2001 From: sparkyx Date: Mon, 11 Feb 2008 18:53:44 +0000 Subject: [PATCH] merge with rel310C --- .../copropriete/fr_plan_syndiccoprop.sql | 133 ++++ contrib/document_test/facture.odt | Bin 37190 -> 37736 bytes html/admin/setup.php | 16 +- html/admin/sql/patch/upgrade36.BE.sql | 1 + html/admin/sql/patch/upgrade36.sql | 22 +- html/admin/sql/patch/upgrade37.sql | 43 + html/admin/sql/patch/upgrade38.sql | 28 + html/admin/sql/patch/upgrade39.sql | 40 + html/admin/sql/patch/upgrade40.sql | 49 ++ html/annulation.php | 8 +- html/comptanalytic.php | 2 +- html/export_ouv.php | 4 +- html/fiche.php | 2 +- html/fid.php | 21 +- html/index.php | 26 +- html/jrn_csv.php | 11 +- html/js/ajax_fiche.js | 164 ++-- html/js/scripts.js | 9 - html/modify_op.php | 20 +- html/style.css | 4 - html/test.php | 7 +- html/user_jrn.php | 2 +- include/ac_common.php | 4 +- include/action.inc.php | 5 +- include/bank.inc.php | 7 +- include/bud_detail.inc.php | 2 +- include/bud_synthese.inc.php | 18 +- include/ca_pa.inc.php | 6 +- include/class_acc_account_ledger.php | 6 +- include/class_acc_bilan.php | 2 +- include/class_acc_jrn_info.php | 158 ++++ include/class_acc_ledger.php | 22 +- include/class_action.php | 4 +- include/class_admin.php | 2 +- include/class_anc_account.php | 13 +- include/class_anc_balance_double.php | 8 +- include/class_anc_group_operation.php | 4 +- include/class_anc_plan.php | 2 +- include/class_bud_hypo.php | 8 +- include/class_bud_synthese_acc.php | 8 +- include/class_bud_synthese_anc.php | 9 +- include/class_bud_synthese_group.php | 13 +- include/class_bud_synthese_hypo.php | 2 +- include/class_customer.php | 4 +- include/class_document.php | 35 +- include/class_dossier.php | 1 + include/class_fiche.php | 66 +- include/class_gestion_purchase.php | 7 +- include/class_periode.php | 2 +- include/class_user.php | 6 +- include/class_widget.php | 18 +- include/client.inc.php | 13 +- include/constant.php | 3 +- include/contact.inc.php | 7 +- include/depense.inc.php | 3 +- include/facture.inc.php | 18 +- include/fiche.inc.php | 2 +- include/fiche_def.inc.php | 2 +- include/import_inc.php | 5 +- include/impress_inc.php | 6 +- include/impress_jrn.inc.php | 11 +- include/impress_poste.inc.php | 2 +- include/jrn.php | 70 +- include/poste.inc.php | 6 +- include/postgres.php | 2 +- include/pref.inc.php | 39 +- include/stock_inc.php | 7 +- include/supplier.inc.php | 15 +- include/tva.inc.php | 3 +- include/user_action_ach.php | 6 +- include/user_action_fin.php | 4 +- include/user_common.php | 39 +- include/user_form_ach.php | 198 +++-- include/user_form_ven.php | 30 +- include/user_menu.php | 97 ++- scripts/cleanup.sh | 2 +- sql/upgrade.sql | 750 +----------------- 77 files changed, 1189 insertions(+), 1205 deletions(-) create mode 100644 contrib/comptabilite-francaise/copropriete/fr_plan_syndiccoprop.sql create mode 100644 html/admin/sql/patch/upgrade37.sql create mode 100644 html/admin/sql/patch/upgrade38.sql create mode 100644 html/admin/sql/patch/upgrade39.sql create mode 100644 html/admin/sql/patch/upgrade40.sql create mode 100644 include/class_acc_jrn_info.php diff --git a/contrib/comptabilite-francaise/copropriete/fr_plan_syndiccoprop.sql b/contrib/comptabilite-francaise/copropriete/fr_plan_syndiccoprop.sql new file mode 100644 index 000000000..0dd612dba --- /dev/null +++ b/contrib/comptabilite-francaise/copropriete/fr_plan_syndiccoprop.sql @@ -0,0 +1,133 @@ +-- +-- PostgreSQL database dump +-- Version 2008/02/10 09:19 +-- + +-- +-- Name: TABLE tmp_pcmn; Type: COMMENT; Schema: public; Owner: phpcompta +-- + +COMMENT ON TABLE tmp_pcmn IS 'Plan comptable - Syndicat des copropriétaires : strict'; + +-- +-- Data for Name: tmp_pcmn; Type: TABLE DATA; Schema: public; Owner: phpcompta +-- + +COPY tmp_pcmn (pcm_val, pcm_lib, pcm_val_parent) FROM stdin; +1 Classe 1 - Provisions, avances, subventions et emprunts 0 +10 Provisions et avances : 1 +102 Provisions pour travaux décidés 10 +103 Avances 10 +1031 Avances de trésorerie 103 +1032 Avances travaux au titre de l'article 18, 6e alinéa de la loi susvisée 103 +1033 Autres avances 103 +12 Solde en attente sur travaux et opérations exceptionnelles 1 +13 Subventions : 1 +131 Subventions accordées en instance de versement 13 +4 Classe 4 - Copropriétaires et tiers 0 +40 Fournisseurs : 4 +401 Factures parvenues 40 +408 Factures non parvenues 40 +409 Fournisseurs débiteurs 40 +42 Personnel : 4 +421 Rémunérations dues 42 +43 Sécurité sociale et autres organismes sociaux : 4 +431 Sécurité sociale 43 +432 Autres organismes sociaux 43 +44 Etat et collectivités territoriales : 4 +441 Etat et autres organismes - subventions à recevoir 44 +442 Etat - impôts et versements assimilés 44 +443 Collectivités territoriales - aides 44 +45 Collectivité des copropriétaires : 4 +450 Copropriétaire individualisé 45 +4501 Sur décision AG : Copropriétaire - budget prévisionnel 450 +4502 Sur décision AG : Copropriétaire - travaux de l'article 14-2 de la loi susvisée et opérations exceptionnelles 450 +4503 Sur décision AG : Copropriétaire - avances 450 +4504 Sur décision AG : Copropriétaire - emprunts 450 +459 Copropriétaire - créances douteuses 45 +46 Débiteurs et créditeurs divers : 4 +461 Débiteurs divers 46 +462 Créditeurs divers 46 +47 Compte d'attente : 4 +471 Compte en attente d'imputation débiteur 47 +472 Compte en attente d'imputation créditeur 47 +48 Compte de régularisation : 4 +486 Charges payées d'avance 48 +487 Produits encaissés d'avance 48 +49 Dépréciation des comptes de tiers : 4 +491 Copropriétaires 49 +492 Personnes autres que les copropriétaires 49 +5 Classe 5 - Comptes financiers 0 +50 Fonds placés : 5 +501 Compte à terme 50 +502 Autre compte 50 +51 Banques, ou fonds disponibles en banque pour le syndicat : 5 +512 Banques 51 +514 Chèques postaux 51 +53 Caisse. 5 +6 Classe 6 - Comptes de charges 0 +60 Achats de matières et fournitures : 6 +601 Eau 60 +602 Electricié 60 +603 Chauffage, énergie et combustibles 60 +604 Achats produits d'entretien et petits équipements 60 +605 Matériel 60 +606 Fournitures 60 +61 Services extérieurs : 6 +611 Nettoyage des locaux 5 +612 Locations immobiliéres 61 +613 Locations mobiliéres 61 +614 Contrats de maintenance 61 +615 Entretien et petites réparations 61 +616 Primes d'assurances 61 +62 Frais d'administration et honoraires : 6 +621 Rémunérations du syndic sur gestion copropriété 62 +6211 Rémunération du syndic 621 +6212 Débours 621 +6213 Frais postaux 621 +622 Autres honoraires du syndic 62 +6221 Honoraires travaux 622 +6222 Prestations particulières 622 +6223 Autres honoraires 622 +623 Rémunérations de tiers intervenants 62 +624 Frais du conseil syndical 62 +63 Impôts - taxes et versements assimilés : 6 +632 Taxe de balayage 63 +633 Taxe foncière 63 +634 Autres impôts et taxes 63 +64 Frais de personnel : 6 +641 Salaires 64 +642 Charges sociales et organismes sociaux 64 +643 Taxe sur les salaires 64 +644 Autres (médecine du travail, mutuelles, etc.) 64 +66 Charges financières des emprunts, agios ou autres : 6 +661 Remboursement d'annuités d'emprunt 66 +662 Autres charges financières et agios 66 +67 Charges pour travaux et opérations exceptionnelles : 6 +671 Travaux décidés par l'assemblée générale 67 +672 Travaux urgents 67 +673 Etudes techniques, diagnostic, consultation 67 +677 Pertes sur créances irrécouvrables 67 +678 Charges exceptionnelles 67 +68 Dotations aux dépréciations sur créances douteuses. 6 +7 Classe 7 - Comptes de produits 0 +70 Appels de fonds : 7 +701 Provisions sur opérations courantes 70 +702 Provisions sur travaux de l'article 14-2 et opérations exceptionnelles 70 +703 Avances 70 +704 Remboursements d'annuités d'emprunts 70 +71 Autres produits : 7 +711 Subventions 71 +712 Emprunts 71 +713 Indemnités d'assurances 71 +714 Produits divers (dont intérêts légaux dus par les copropriétaires) 71 +716 Produits financiers 71 +718 Produits exceptionnels 71 +78 Reprises de dépréciations sur créances douteuses. 7 +8 Comptes spéciaux 0 +9 Comptes analytique 0 +\. + +-- +-- PostgreSQL database dump complete +-- diff --git a/contrib/document_test/facture.odt b/contrib/document_test/facture.odt index 0132a5e637b630f8b98e18a545c093a14d4c9ea3..460a0f33d94dfbd0bf5a0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3NQz0CR@hp?Y$73h&0nEl*SG!B=yjgC>)q5Bju~i95mOvI4je!Z%lB3%y`8 ztn`szhiLRKRHzq3sijjmQQ$ljJnHD*ocC*ZkqKN@vB9v*5bbK$6re~5D8l0K6ti6h zEYjy8iQUQ5iQb+h@P!O@>CUX34u#Vd(rsu>n3;GL^`uIAMyrvSbwyUUwgU3%ieU9k z>nGbLFK&N8)czDHl(9O`gmbQC7CX|G)+*6w@XnxB*x!QxseX6W8f-)V{eEa#@l4uZ z@7j!VTr%`)qWrESNRJ5V15e0$R##f-K{oQ&1OHs1tRB$6eV^T)3vTOQFe?GV|Mh(h z_%Xjg|HYwrdr=E!y`$vkE z@PGM;<_X#`eg7H@t;y-za|Lyy6{$uhNS7MojY=y`0zXt#P!TvrH{zESz bNuWu1|E!QW2@mWnGKoKl8mcP#?=JrzKkF*B diff --git a/html/admin/setup.php b/html/admin/setup.php index caedcc798..ca5a0ce65 100644 --- a/html/admin/setup.php +++ b/html/admin/setup.php @@ -147,7 +147,7 @@ function ExecuteScript($p_cn,$script) { echo_debug('setup.php',__LINE__,"Execute sql $sql"); if ( ExecSql($p_cn,$sql,false) == false ) { Rollback($p_cn); - if ( DEBUG=='false' ) ob_clean(); + if ( DEBUG=='false' ) ob_end_clean(); print "ERROR : $sql"; exit(); } @@ -156,7 +156,7 @@ echo_debug('setup.php',__LINE__,"Execute sql $sql"); print "
"; } // while (feof) fclose($hf); - if ( DEBUG=='false' ) ob_clean(); + if ( DEBUG=='false' ) ob_end_clean(); } /*! \brief loop to apply all the path to a folder or * a template @@ -166,7 +166,7 @@ echo_debug('setup.php',__LINE__,"Execute sql $sql"); */ function apply_patch($p_cn,$p_name) { - $MaxVersion=36; + $MaxVersion=40; echo '
    '; for ( $i = 4;$i <= $MaxVersion;$i++) { @@ -238,7 +238,7 @@ function apply_patch($p_cn,$p_name) ExecuteScript($p_cn,"sql/patch/upgrade36.".$country.".sql"); ExecSql($p_cn,'update tmp_pcmn set pcm_type=find_pcm_type(pcm_val)'); } - if ( DEBUG == 'false') ob_clean(); + if ( DEBUG == 'false') ob_end_clean(); } } echo '
'; @@ -415,7 +415,7 @@ if ($account == 0 ) { ExecuteScript($cn,"sql/account_repository/constraint.sql"); Commit($cn); - if ( DEBUG=='false') ob_clean(); + if ( DEBUG=='false') ob_end_clean(); echo "Creation of Modele1"; if ( DEBUG=='false') ob_start(); @@ -426,7 +426,7 @@ if ($account == 0 ) { ExecuteScript($cn,'sql/mod1/data.sql'); ExecuteScript($cn,'sql/mod1/constraint.sql'); Commit($cn); - if ( DEBUG=='false') ob_clean(); + if ( DEBUG=='false') ob_end_clean(); echo "Creation of Modele2"; ExecSql($cn,"create database ".domaine."mod2 encoding='latin1'"); @@ -438,7 +438,7 @@ if ($account == 0 ) { ExecuteScript($cn,'sql/mod1/constraint.sql'); Commit($cn); - if ( DEBUG=='false') ob_clean(); + if ( DEBUG=='false') ob_end_clean(); }// end if // Add a french accountancy model @@ -507,6 +507,6 @@ echo '
'; } } - if (DEBUG=='false') ob_clean(); + if (DEBUG=='false') ob_end_clean(); echo "

Voilà tout est installé ;-)

"; ?> diff --git a/html/admin/sql/patch/upgrade36.BE.sql b/html/admin/sql/patch/upgrade36.BE.sql index 8d1cb76d0..79f8c6b77 100644 --- a/html/admin/sql/patch/upgrade36.BE.sql +++ b/html/admin/sql/patch/upgrade36.BE.sql @@ -12,6 +12,7 @@ INSERT INTO parm_poste (p_value, p_type) VALUES (492, 'PAS'); INSERT INTO parm_poste (p_value, p_type) VALUES (493, 'PAS'); INSERT INTO parm_poste (p_value, p_type) VALUES (2409, 'ACTINV'); INSERT INTO parm_poste (p_value, p_type) VALUES (2, 'ACT'); +INSERT INTO parm_poste (p_value, p_type) VALUES (2409, 'ACTINV'); INSERT INTO parm_poste (p_value, p_type) VALUES (3, 'ACT'); INSERT INTO parm_poste (p_value, p_type) VALUES (5, 'ACT'); INSERT INTO parm_poste (p_value, p_type) VALUES (491, 'ACT'); diff --git a/html/admin/sql/patch/upgrade36.sql b/html/admin/sql/patch/upgrade36.sql index 218298598..9c2ef8200 100644 --- a/html/admin/sql/patch/upgrade36.sql +++ b/html/admin/sql/patch/upgrade36.sql @@ -223,13 +223,6 @@ CREATE SEQUENCE bud_card_bc_id_seq ALTER TABLE public.bud_card_bc_id_seq OWNER TO phpcompta; --- --- Name: bud_card_bc_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: phpcompta --- - -ALTER SEQUENCE bud_card_bc_id_seq OWNED BY bud_card.bc_id; - - -- -- Name: bc_id; Type: DEFAULT; Schema: public; Owner: phpcompta -- @@ -322,12 +315,6 @@ CREATE SEQUENCE bud_detail_bd_id_seq ALTER TABLE public.bud_detail_bd_id_seq OWNER TO phpcompta; --- --- Name: bud_detail_bd_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: phpcompta --- - -ALTER SEQUENCE bud_detail_bd_id_seq OWNED BY bud_detail.bd_id; - -- -- Name: bd_id; Type: DEFAULT; Schema: public; Owner: phpcompta @@ -424,13 +411,6 @@ CREATE SEQUENCE bud_detail_periode_bdp_id_seq ALTER TABLE public.bud_detail_periode_bdp_id_seq OWNER TO phpcompta; --- --- Name: bud_detail_periode_bdp_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: phpcompta --- - -ALTER SEQUENCE bud_detail_periode_bdp_id_seq OWNED BY bud_detail_periode.bdp_id; - - -- -- Name: bdp_id; Type: DEFAULT; Schema: public; Owner: phpcompta -- @@ -682,7 +662,7 @@ begin nLength:=length(str_value); while nLength > 0 loop n_value:=to_number(str_value,'99999999999999999999999999999'); - select into str_type p_type from parm_poste where p_value=n_value; + select p_type into str_type from parm_poste where p_value=n_value; if FOUND then return str_type; end if; diff --git a/html/admin/sql/patch/upgrade37.sql b/html/admin/sql/patch/upgrade37.sql new file mode 100644 index 000000000..bb6dd05f8 --- /dev/null +++ b/html/admin/sql/patch/upgrade37.sql @@ -0,0 +1,43 @@ +begin; + +CREATE OR REPLACE FUNCTION jrn_check_periode() + RETURNS "trigger" AS +$BODY$ +declare +bClosed bool; +str_status text; +ljr_tech_per jrn.jr_tech_per%TYPE; +ljr_def_id jrn.jr_def_id%TYPE; +lreturn jrn%ROWTYPE; +begin +if TG_OP='INSERT' then + ljr_tech_per :=NEW.jr_tech_per; + ljr_def_id :=NEW.jr_def_id; + lreturn :=NEW; +end if; + +if TG_OP='DELETE' then + ljr_tech_per :=OLD.jr_tech_per; + ljr_def_id :=OLD.jr_def_id; + lreturn :=OLD; +end if; + +select p_closed into bClosed from parm_periode + where p_id=ljr_tech_per; + +if bClosed = true then + raise exception 'Periode fermee'; +end if; + +select status into str_status from jrn_periode + where p_id =ljr_tech_per and jrn_def_id=ljr_def_id; + +if str_status <> 'OP' then + raise exception 'Periode fermee'; +end if; + +return lreturn; +end;$BODY$ + LANGUAGE 'plpgsql' VOLATILE; +update version set val=38; +commit; diff --git a/html/admin/sql/patch/upgrade38.sql b/html/admin/sql/patch/upgrade38.sql new file mode 100644 index 000000000..eb39eb6bb --- /dev/null +++ b/html/admin/sql/patch/upgrade38.sql @@ -0,0 +1,28 @@ +begin; +CREATE OR REPLACE FUNCTION find_pcm_type(pp_value "numeric") + RETURNS text AS +$BODY$ +declare + str_type text; + str_value text; + n_value numeric; + nLength integer; +begin + str_value:=trim(to_char(pp_value,'99999999999999999999999999999')); + nLength:=length(str_value); + while nLength > 0 loop + n_value:=to_number(str_value,'99999999999999999999999999999'); + select p_type into str_type from parm_poste where p_value=n_value; + if FOUND then + return str_type; + end if; + nLength:=nLength-1; + str_value:=substring(str_value from 1 for nLength); + end loop; +return 'CON'; +end; +$BODY$ + LANGUAGE 'plpgsql' VOLATILE; + +update version set val=39; +commit; diff --git a/html/admin/sql/patch/upgrade39.sql b/html/admin/sql/patch/upgrade39.sql new file mode 100644 index 000000000..d937f3e97 --- /dev/null +++ b/html/admin/sql/patch/upgrade39.sql @@ -0,0 +1,40 @@ +begin; +create table info_def ( + id_type text primary key, + id_description text null +); + +comment on table info_def is 'Contains the types of additionnal info we can add to a operation'; +create or replace function info_def_ins_upd() returns trigger +AS +$$ +declare + row_info_def info_def%ROWTYPE; + str_type text; +begin +row_info_def:=NEW; +str_type:=upper(trim(NEW.id_type)); +str_type:=replace(str_type,' ',''); +str_type:=replace(str_type,',',''); +str_type:=replace(str_type,';',''); +if length(str_type) =0 then + raise exception 'id_type cannot be null'; +end if; +row_info_def.id_type:=str_type; +return row_info_def; +end; +$$ language plpgsql; +create trigger info_def_ins_upd_t before insert or update on info_def for each row execute procedure info_def_ins_upd(); + +create table jrn_info ( + ji_id serial primary key, + jr_id integer not null, + id_type text not null, + ji_value text +); +alter table jrn_info add constraint fk_jrn foreign key (jr_id) references jrn(jr_id) on delete cascade on update cascade; +alter table jrn_info add constraint fk_info_def foreign key (id_type) references info_def(id_type) on delete cascade on update cascade; +insert into info_def values ('BON_COMMANDE','Numero de bon de commande') ,('OTHER','Info diverses'); +insert into attr_def values(30,'Numero de client'); +update version set val=40; +commit; diff --git a/html/admin/sql/patch/upgrade40.sql b/html/admin/sql/patch/upgrade40.sql new file mode 100644 index 000000000..47ec42da4 --- /dev/null +++ b/html/admin/sql/patch/upgrade40.sql @@ -0,0 +1,49 @@ +begin; + +insert into parm_code values ('DEP_PRIV',4890,'Depense a charge du gerant'); +insert into attr_def values (31,'Depense à charge du gérant (partie privée)'); +alter table quant_purchase add qp_dep_priv numeric(20,4) default 0.0; + +CREATE FUNCTION insert_quant_purchase(p_internal text, p_j_id numeric, p_fiche character varying, p_quant numeric, p_price numeric, p_vat numeric, p_vat_code integer, p_nd_amount numeric, p_nd_tva numeric, p_nd_tva_recup numeric,p_dep_priv numeric , p_client character varying) RETURNS void + AS $$ +declare + fid_client integer; + fid_good integer; +begin + select f_id into fid_client from + attr_value join jnt_fic_att_value using (jft_id) where ad_id=23 and av_text=upper(p_client); + select f_id into fid_good from + attr_value join jnt_fic_att_value using (jft_id) where ad_id=23 and av_text=upper(p_fiche); + insert into quant_purchase + (qp_internal, + j_id, + qp_fiche, + qp_quantite, + qp_price, + qp_vat, + qp_vat_code, + qp_nd_amount, + qp_nd_tva, + qp_nd_tva_recup, + qp_supplier, + qp_dep_priv) + values + (p_internal, + p_j_id, + fid_good, + p_quant, + p_price, + p_vat, + p_vat_code, + p_nd_amount, + p_nd_tva, + p_nd_tva_recup, + fid_client, + p_dep_priv); + return; +end; + $$ + LANGUAGE plpgsql; + +update version set val=41; +commit; diff --git a/html/annulation.php b/html/annulation.php index daf0aa46c..7471ac1d3 100644 --- a/html/annulation.php +++ b/html/annulation.php @@ -136,13 +136,15 @@ if ($p_id != -1 ) { // A if ( $p_id != -1 ) { //B // Test whether date of the operation is in a closed periode // get the period_id - $period_id=getPeriodeFromDate($cn,$e_op_date); + $p=ExecSql($cn,"select jr_tech_per from jrn where jr_grpt_id=".$_REQUEST['jrn_op']); + $period_id=pg_fetch_result($p,0,0); // thanks jrn_op (jrn.jr_id) we find out the concerned ledger - $sql="select jr_def_id from jrn where jr_id=".$_REQUEST['jrn_op']; + + $sql="select jr_def_id from jrn where jr_grpt_id=".$_REQUEST['jrn_op']; $r=ExecSql($cn,$sql); $nJrn=pg_fetch_result($r,0,0); $per=new Periode($cn); - $per->set_jrn(nJrn); + $per->set_jrn($nJrn); $per->set_periode($period_id); // Check the period_id diff --git a/html/comptanalytic.php b/html/comptanalytic.php index 8fe1056ae..5ae193319 100644 --- a/html/comptanalytic.php +++ b/html/comptanalytic.php @@ -72,7 +72,7 @@ if ( isset ($_REQUEST['p_action'])) echo '
'; 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 opérations sur la compta analytique",1), + array('?p_action=ca_od&'.$str_dossier,'Opérations Diverses',"Permet d'enregistrer des operations sur la compta analytique",1), array('?p_action=ca_groupe&'.$str_dossier,'Groupe','Regroupe les postes analytiques',3), array('?p_action=ca_imp&'.$str_dossier,'Impression',"impression de rapport",2) ), diff --git a/html/export_ouv.php b/html/export_ouv.php index 4613e2640..66457121c 100644 --- a/html/export_ouv.php +++ b/html/export_ouv.php @@ -56,8 +56,8 @@ $ret=get_array($cn,"select distinct j_poste::text from jrnx inner join tmp_pcmn on (pcm_val=j_poste) where j_tech_per >= ".$sql_from[0]['min']." and - j_tech_per <= ".$sql_to[0]['max']." and j_poste not like '7%' - and j_poste not like '6%' + j_tech_per <= ".$sql_to[0]['max']." and j_poste::text not like '7%' + and j_poste::text not like '6%' order by j_poste::text"); if ( $ret == null ) {echo 'Rien à exporter'; exit();} printf ("OUVERTURE\n"); diff --git a/html/fiche.php b/html/fiche.php index 4afcdfbfc..21bf7e636 100644 --- a/html/fiche.php +++ b/html/fiche.php @@ -222,7 +222,7 @@ if ( isset ( $_GET["action"]) ) { $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=getArray($cn,$sql); + $all=get_array($cn,$sql); // test on the size // if ( sizeof($all) != 0 ) diff --git a/html/fid.php b/html/fid.php index 78655f5a1..86009af80 100644 --- a/html/fid.php +++ b/html/fid.php @@ -24,7 +24,6 @@ * \brief Fid for the ajax request for cards */ -header("Content-type: text/xml charset=\"ISO8859-1\"",true); require_once ("constant.php"); require_once ("postgres.php"); @@ -77,23 +76,17 @@ if ( isset($_SESSION['isValid']) && $_SESSION['isValid'] == 1) $tva_id=$array[0]['tva_id']; // Check null - $name=($name==null)?" ":$name; - $sell=($sell==null)?" ":$sell; - $buy=($buy==null)?" ":$buy; - $tva_id=($tva_id==null)?" ":$tva_id; + $name=($name==null)?" ":str_replace('"','',$name); + $sell=($sell==null)?" ":str_replace('"','',$sell); + $buy=($buy==null)?" ":str_replace('"','',$buy); + $tva_id=($tva_id==null)?" ":str_replace('"','',$tva_id); - $a=''; - $a.=""; - $a.="".$name.""; - $a.="".$sell.""; - $a.="".$buy.""; - $a.="".$tva_id.""; - $a.=""; + $a='{"answer":"ok","name":"'.$name.'","sell":"'.$sell.'","buy":"'.$buy.'","tva_id":"'.$tva_id.'","ctl":"'.$_GET['ctl'].'"}'; } else - $a="not connected"; + $a='{"answer":"nok"}'; echo_debug("fid.php",__LINE__,"Answer is \n $a"); - +header("Content-type: text/html; charset: ISO8859-1",true); print $a; ?> diff --git a/html/index.php b/html/index.php index 8fb7d77c6..5be91c1f5 100644 --- a/html/index.php +++ b/html/index.php @@ -76,22 +76,18 @@ BODY { -Version 3.1.0 -
-

Il est conseillé de ne PAS utiliser Internet Explorer. -

- Vous pouvez utiliser un autre browser: firefox, mozilla, netscape, Konqueror, opera... -

-

- - Si vous avez envie de nous rejoindre, vous êtes les bienvenus - . -

-
- + +version 3.1.0 + +
+
+
+
Logo
+
+
- +
@@ -105,7 +101,9 @@ Version 3.1.0
+ +
diff --git a/html/jrn_csv.php b/html/jrn_csv.php index c3eaa4bb3..aed02bc4d 100644 --- a/html/jrn_csv.php +++ b/html/jrn_csv.php @@ -99,6 +99,15 @@ if ( $_GET['p_simple'] == 0 ) '"internal";'. '"montant";'. "\r\n"); + // set a filter for the FIN + $a_parm_code=get_array($cn,"select p_value from parm_code where p_code in ('BANQUE','COMPTE_COURANT','CAISSE')"); + $sql_fin="("; + $or=""; + foreach ($a_parm_code as $code) { + $sql_fin.="$or j_poste::text like '".$code['p_value']."%'"; + $or=" or "; + } + $sql_fin.=")"; foreach ($Row as $line) { @@ -113,7 +122,7 @@ if ( $_GET['p_simple'] == 0 ) // Get the jrn type if ( $line['jrn_def_type'] == 'FIN' ) { $positive = CountSql($cn,"select * from jrn inner join jrnx on jr_grpt_id=j_grpt ". - " where jr_id=".$line['jr_id']." and (j_poste like '55%' or j_poste like '57%' )". + " where jr_id=".$line['jr_id']." and $sql_fin ". " and j_debit='f'"); diff --git a/html/js/ajax_fiche.js b/html/js/ajax_fiche.js index 9cb4c6740..79169a78f 100644 --- a/html/js/ajax_fiche.js +++ b/html/js/ajax_fiche.js @@ -41,107 +41,79 @@ function clean_Fid(p_ctl) nSell=p_ctl+"_sell"; nBuy=p_ctl+"_buy"; nTva_id=p_ctl+"_tva_id"; - - if ( document.getElementById(nSell) != null ) { - document.getElementById(nSell).value=""; - } - if ( document.getElementById(nBuy) != null ) { - document.getElementById(nBuy).value=""; - } - - if ( document.getElementById(nTva_id) != null ) { - document.getElementById(nTva_id).value=""; - } - + if ( $(nSell) ) { $(nSell).value=""; } + if ( $(nBuy) ) { $(nBuy).value="";} + if ( $(nTva_id) ) { $(nTva_id).value="-1"; } + +} +function errorFid(request,json) { + alert('erreur : ajax fiche'); } - /*!\brief this function fills the data from fid.php, * \param p_ctl the ctrl to fill * \param p_deb if debit of credit * \param p_jrn the ledger */ -function ajaxFid(p_ctl,p_deb,p_jrn){ - var ajaxRequest; // The variable that makes Ajax possible! -; - try{ - // Opera 8.0+, Firefox, Safari - ajaxRequest = new XMLHttpRequest(); - } catch (e){ - // Internet Explorer Browsers - try{ - ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); - } catch (e) { - try{ - ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); - } catch (e){ - // Something went wrong - alert("Your browser broke!"); - return false; - } - } - } - // Create a function that will receive data sent from the server - ajaxRequest.onreadystatechange = function(){ - if(ajaxRequest.readyState == 4){ - if ( ajaxRequest.status == 200 ) { - - xmldoc = ajaxRequest.responseXML.documentElement; - data = xmldoc.getElementsByTagName('name'); - - label = data[0].firstChild.nodeValue; - sell = xmldoc.getElementsByTagName('sell')[0].firstChild.nodeValue; - buy = xmldoc.getElementsByTagName('buy')[0].firstChild.nodeValue; - tva_id = xmldoc.getElementsByTagName('tva_id')[0].firstChild.nodeValue; - - toSet=p_ctl+"_label"; - - if ( trim(label) == "" ) - { - var ctl_toSet=document.getElementById(toSet); - ctl_toSet.innerHTML="Fiche inconnue"; - ctl_toSet.style.color='red'; - clean_Fid(p_ctl); - } - else { - var ctl_toSet=document.getElementById(toSet); - ctl_toSet.style.color='black'; - ctl_toSet.innerHTML=label; - nSell=p_ctl+"_sell"; - nBuy=p_ctl+"_buy"; - nTva_id=p_ctl+"_tva_id"; - - if ( document.getElementById(nSell) != null ) { - - document.getElementById(nSell).value=sell; - } - if ( document.getElementById(nBuy) != null ) { - - document.getElementById(nBuy).value=buy; - } - - if ( document.getElementById(nTva_id) != null ) { - - document.getElementById(nTva_id).value=tva_id; - } - } - } - } - } - if (document.getElementById(p_ctl).value.length == 0 ) { - var toSet=p_ctl+"_label"; - var ctl_toSet=document.getElementById(toSet); - ctl_toSet.innerHTML=""; - // clean other fields - clean_Fid(p_ctl); - - } else { - var gDossier=document.getElementById('gDossier').value; - queryString="?FID="+document.getElementById(p_ctl).value; - queryString=queryString+"&d="+p_deb+"&j="+p_jrn+'&gDossier='+gDossier; - - ajaxRequest.open("GET", "fid.php"+queryString, true); - ajaxRequest.send(null); - } +function ajaxFid(p_ctl,p_deb,p_jrn) +{ + var gDossier=$('gDossier').value; + var ctl_value=$(p_ctl).value; + if ( trim(ctl_value)==0 ) { + nLabel=p_ctl+"_label"; + $(nLabel).value=""; + $(nLabel).innerHTML=""; + clean_Fid(p_ctl); + return; + } + queryString="?FID="+ctl_value; + queryString=queryString+"&d="+p_deb+"&j="+p_jrn+'&gDossier='+gDossier; + queryString=queryString+'&ctl='+p_ctl; + /* alert(queryString); */ + var action=new Ajax.Request ( + "fid.php", + { + method:'get', + parameters:queryString, + onFailure:errorFid, + onSuccess:successFid + } + + ); + } +/*!\brief callback function for ajax + * \param request : object request + * \param json : json answer */ +function successFid(request,json) { + var answer=request.responseText.evalJSON(true); -//--> \ No newline at end of file + var data=answer.name; + var sell=answer.sell; + var buy=answer.buy; + var tva_id=answer.tva_id; + var ctl=answer.ctl; + +/* alert('data:'+data+' sell:'+sell+' Tva id:'+tva_id); */ + + var toSet=ctl+'_label'; + if (trim(data) == "" ) { + $(toSet).innerHTML="Fiche Inconnue"; + $(toSet).style.color="red"; + clean_Fid(ctl); + } else { + var nSell=ctl+"_sell"; + var nBuy=ctl+"_buy"; + var nTva_id=ctl+"_tva_id"; + $(toSet).innerHTML=data; + $(toSet).style.color="black"; + if ( $(nTva_id) ) { + $(nTva_id).value=tva_id; + } + if ( $(nSell ) ) { + $(nSell).value=sell; + } + $(nBuy).value=buy; + + } +} +//--> diff --git a/html/js/scripts.js b/html/js/scripts.js index 6a5ff8915..db346d085 100644 --- a/html/js/scripts.js +++ b/html/js/scripts.js @@ -30,7 +30,6 @@ // Set the focus to the specified field, // and select it if requested by SelectIt - function GetID(ID) { if (document.all) { return document.all[ID]; @@ -92,14 +91,6 @@ function HandleSubmit(e) { return true; } } -/* - * Open the search screen - */ -function openRecherche(p_sessid,p_dossier,p_style) { - if ( p_style == 'E' ) { p_style="expert";} - var w=window.open("recherche.php?gDossier="+p_dossier+"&PHPSESSID="+p_sessid+'&'+p_style,'','statusbar=no,scrollbars=yes,toolbar=no'); - w.focus(); -} /*!\brief add a row for the CA * \param p_table_id diff --git a/html/modify_op.php b/html/modify_op.php index feacc62c0..41b9e7b4d 100644 --- a/html/modify_op.php +++ b/html/modify_op.php @@ -66,18 +66,18 @@ if ( ! isset ( $action )) { echo JS_VIEW_JRN_MODIFY; ?> "; + "; echo ' + + '; echo ""; diff --git a/include/action.inc.php b/include/action.inc.php index 5c40b3f70..9e07b2e68 100644 --- a/include/action.inc.php +++ b/include/action.inc.php @@ -1,3 +1,4 @@ + '; $retour=""; $h_url=""; if ( isset ($_REQUEST['url'])) { - $retour=sprintf('',urldecode($_REQUEST['url'])); + $retour=widget::button_href('Retour',urldecode($_REQUEST['url'])); $h_url=sprintf('',urldecode($_REQUEST['url'])); } //---------------------------------------------------------------------- diff --git a/include/bank.inc.php b/include/bank.inc.php index 00a5ef160..5cf306768 100644 --- a/include/bank.inc.php +++ b/include/bank.inc.php @@ -21,6 +21,7 @@ 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_parm_code.php"); @@ -56,7 +57,7 @@ $h_url=""; if ( isset ($_REQUEST['url'])) { - $retour=sprintf('',urldecode($_REQUEST['url'])); + $retour=widget::button_href('Retour',urldecode($_REQUEST['url'])); $h_url=sprintf('',urldecode($_REQUEST['url'])); } @@ -85,8 +86,8 @@ if ( $sub_action == "solde" ) $vir_interne=new parm_code($cn,'VIREMENT_INTERNE'); $accountSql="select distinct pcm_val::text,pcm_lib from tmp_pcmn - where pcm_val like '".$banque->p_value."%' or pcm_val like '".$vir_interne->p_value."%' - or pcm_val like '".$caisse->p_value."%' + 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 '
'; diff --git a/include/bud_detail.inc.php b/include/bud_detail.inc.php index 36d6d12cc..62ba03464 100644 --- a/include/bud_detail.inc.php +++ b/include/bud_detail.inc.php @@ -28,7 +28,7 @@ require_once ('class_bud_hypo.php'); require_once ('class_anc_account.php'); echo '
'; -/*!\todo Check if there is Hypothesis */ + /* 1st possibility is not defined */ diff --git a/include/bud_synthese.inc.php b/include/bud_synthese.inc.php index 356c0802c..238b4423f 100644 --- a/include/bud_synthese.inc.php +++ b/include/bud_synthese.inc.php @@ -55,12 +55,24 @@ echo ShowItem(array( // echo '
'; -if ( $do=='po') +if ( $do=='po') { + if ($obj->size_analytic() == 0 ) { + echo '

Desole pas d\'hypothese definie avec un plan analytique

'; + exit(); + + } require_once ('bud_spo.inc.php'); +} + +if ( $do=='ga') { + if ($obj->size_analytic() == 0 ) { + echo '

Desole pas d\'hypothese definie avec un plan analytique

'; + exit(); + + } -if ( $do=='ga') require_once ('bud_sga.inc.php'); - +} if ( $do=='vglobal') require_once ('bud_svglobal.inc.php'); diff --git a/include/ca_pa.inc.php b/include/ca_pa.inc.php index 227dd64b2..5a47ccf8e 100644 --- a/include/ca_pa.inc.php +++ b/include/ca_pa.inc.php @@ -135,6 +135,7 @@ if ( isset($_REQUEST['sa'])) $ret.=$po->form(); $ret.=$wSa->IOValue(); $ret.=widget::submit("add","Ajout"); + $ret.=""; $ret.="
"; } // record the poste @@ -231,10 +232,7 @@ if ( isset($_REQUEST['sa'])) } $ret.=""; - $ret.=sprintf(''. - '', - $_GET['pa_id'] - ); + $ret.=widget::button_href('Ajout',"?p_action=ca_pa&sa=po_add&pa_id=".$_GET['pa_id']."&".$str_dossier); $ret.='
'; } diff --git a/include/class_acc_account_ledger.php b/include/class_acc_account_ledger.php index 6df553909..412950151 100644 --- a/include/class_acc_account_ledger.php +++ b/include/class_acc_account_ledger.php @@ -133,7 +133,7 @@ function get_solde($p_cond=" true ") { case when j_debit='f' then j_montant else 0 end as cred from jrnx join tmp_pcmn on j_poste=pcm_val where - j_poste like ('$this->id'::text) and + j_poste::text like ('$this->id'::text) and $p_cond ) as m "); $Max=pg_NumRows($Res); @@ -157,7 +157,7 @@ function get_solde_detail($p_cond="") { case when j_debit='f' then j_montant else 0 end as cred from jrnx join tmp_pcmn on j_poste=pcm_val where - j_poste like ('$this->id'::text) + j_poste::text like ('$this->id'::text) $p_cond ) as m "; @@ -327,7 +327,7 @@ function get_solde_detail($p_cond="") { if ( strlen (trim($item_cred))) { if ( strstr($item_cred,"*") == true ) { $item_cred=strtr($item_cred,"*","%"); - $SqlItem="$or pcm_val like '$item_cred'"; + $SqlItem="$or pcm_val::text like '$item_cred'"; $or=" or "; } else { $SqlItem="$or pcm_val = '$item_cred' "; diff --git a/include/class_acc_bilan.php b/include/class_acc_bilan.php index 2f7f4cf88..d5db1d4ad 100644 --- a/include/class_acc_bilan.php +++ b/include/class_acc_bilan.php @@ -229,7 +229,7 @@ class Acc_Bilan { function load(){ try { if ( $this->id=="") - throw new Exception("le formulaire id n'est pas donnée"); + throw new Exception("le formulaire id n'est pas donnee"); $sql="select b_name,b_file_template,b_file_form,lower(b_type) as b_type from bilan where". " b_id = ".$this->id; diff --git a/include/class_acc_jrn_info.php b/include/class_acc_jrn_info.php new file mode 100644 index 000000000..acf89d7ef --- /dev/null +++ b/include/class_acc_jrn_info.php @@ -0,0 +1,158 @@ +cn=$p_cn; + $this->ji_id=$p_ji_id; + } + function insert() { + if ( ! isset ($this->jr_id) || + ! isset ($this->ji_value) || + ! isset ($this->id_type ) ) + { + echo 'Appel incorrecte '.__FILE__.__LINE__; + var_dump($this); + exit(); + } + try { + $sql=ExecSqlParam( + $this->cn, + 'insert into jrn_info(jr_id,id_type,ji_value) values ($1,$2,$3)'. + ' returning ji_id ', + array ($this->jr_id,$this->id_type,$this->ji_value) + ); + $this->ji_id=pg_fetch_result($sql,0,0); + } catch (Exception $e) { + echo "Echec sauvegarde info additionnelles"; + throw $e; + } + } + function update() { + if ( ! isset ($this->jr_id) || + ! isset ($this->ji_value) || + ! isset ($this->jr_id ) ) + { + echo 'Appel incorrecte '.__FILE__.__LINE__; + var_dump($this); + exit(); + } + try { + $sql=ExecSqlParam( + $this->cn, + 'update jrn_info set jr_id=$1 ,id_type=$2,ji_value=$3 where ji_id=$4)'. + array ($this->jr_id,$this->id_type,$this->ji_value,$this->ji_id) + ); + } catch (Exception $e) { + Rollback($this->cn); + echo "Echec sauvegarde info additionnelles"; + throw $e; + } + } + function load() { + $sql="select jr_id,id_type,ji_value from jrn_info where ji_id=".$this->ji_id; + $r=ExecSql($this->cn,$sql); + if (pg_NumRows ($r) > 0 ) { + $this->from_array(pg_fetch_array($r,0)); + return 0; + }else { + return 1; + } + + } + function from_array($p_array) { + foreach ($p_array as $col=>$value) { + $this->$col=$value; + } + } + function set_id($p_ji_id) { + $this->$ji_id=$p_ji_id; + } + function set_jrn_id($p_id) { + $this->jr_id=$p_id; + } + function set_type($p_id) { + $this->id_type=$p_id; + } + function set_value($p_id) { + $this->ji_value=$p_id; + } + /*!\brief load all the jrn_info thanks the jr_id + * \return an array of object + */ + function load_all() { + if ( ! isset ($this->jr_id) ) { echo "jr_id is not set ".__FILE__.__LINE__;exit();} + + $sql="select ji_id from jrn_info where jr_id=".$this->jr_id; + $r=ExecSql($this->cn,$sql); + if (pg_NumRows($r) == 0 ) + return array(); + $array=pg_fetch_all($r); + $ret=array(); + foreach ($array as $row) { + $o=new Acc_Jrn_Info($this->cn,$row['ji_id']); + $o->load(); + $ret[]=clone $o; + } + return $ret; + } + function count() { + $sql="select ji_id from jrn_info where jr_id=".$this->jr_id; + return CountSql($this->cn,$sql); + } + function search_id_internal($p_internal) { + $sql="select jr_id from jrn where jr_internal='$p_internal'"; + $r=ExecSql($this->cn,$sql); + if (pg_NumRows($r) > 0 ) { + $this->jr_id=pg_fetch_result($r,0,0); + return $this->jr_id; + } else { + $this->jr_id=-1; + return $this->jr_id; + } + } + static function test_me() { + echo "Dossier = ".Dossier::id(); + $cn=DbConnect(Dossier::id()); + $a=new Acc_Jrn_Info($cn); + $a->jr_id=3; + $a->id_type='BON_COMMANDE'; + $a->ji_value='BON'; + var_dump($a); + $a->insert(); + + $a->set_jrn_id(7); + $a->set_type('OTHER'); + $a->set_value('Autre test'); + $a->insert(); + } +} diff --git a/include/class_acc_ledger.php b/include/class_acc_ledger.php index 6ffc75480..479f7b60d 100644 --- a/include/class_acc_ledger.php +++ b/include/class_acc_ledger.php @@ -123,8 +123,8 @@ class Acc_Ledger { if ( $this->id != 0 ) { if ( $cent=='off' ) { - echo_debug('class_acc_ledger.php',__LINE__,"journaux non centralisé"); - // Journaux non centralisés + echo_debug('class_acc_ledger.php',__LINE__,"journaux non centralise"); + // Journaux non centralises $Res=ExecSql($this->db,"select j_id,j_id as int_j_id,to_char(j_date,'DD.MM.YYYY') as j_date, jr_internal, case j_debit when 't' then j_montant::text else ' ' end as deb_montant, @@ -141,8 +141,8 @@ class Acc_Ledger { " and ".$periode." order by j_date::date asc,jr_internal,j_debit desc ". $cond_limite); }else { - // Journaux centralisés - // echo'class_acc_ledger.php',__LINE__,"journaux centralisé"; + // Journaux centralises + // echo'class_acc_ledger.php',__LINE__,"journaux centralise"; $Sql="select jr_opid as j_id, c_order as int_j_id, to_char (c_date,'DD.MM.YYYY') as j_date , @@ -173,8 +173,8 @@ class Acc_Ledger { } else { // Grand Livre if ( $cent == 'off') { - echo_debug('class_acc_ledger.php',__LINE__,"Grand livre non centralisé"); - // Non centralisé + echo_debug('class_acc_ledger.php',__LINE__,"Grand livre non centralise"); + // Non centralise $Res=ExecSql($this->db,"select j_id,j_id as int_j_id,to_char(j_date,'DD.MM.YYYY') as j_date, jr_internal, case j_debit when 't' then j_montant::text else ' ' end as deb_montant, @@ -190,8 +190,8 @@ class Acc_Ledger { $cond_limite); } else { - echo_debug('class_acc_ledger.php',__LINE__,"Grand livre centralisé"); - // Centralisé + echo_debug('class_acc_ledger.php',__LINE__,"Grand livre centralise"); + // Centralise $Sql="select jr_c_opid as j_id, c_order as int_j_id, c_j_id, @@ -334,7 +334,7 @@ class Acc_Ledger { // Non Centralise si cent=off //-- if ($cent=='off') - {// Non centralisé + {// Non centralise $periode=sql_filter_per($this->db,$p_from,$p_to,'p_id','jr_tech_per'); @@ -361,7 +361,7 @@ class Acc_Ledger { $periode=sql_filter_per($this->db,$p_from,$p_to,'p_id','jr_tech_per'); $cond_limite=($p_limit!=-1)?" limit ".$p_limit." offset ".$p_offset:""; - //Centralisé + //Centralise //--- $id=($this->id == 0 ) ?"jr_c_opid as num":"jr_opid as num"; @@ -1254,7 +1254,7 @@ class Acc_Ledger { $op->p_jrn=$id; $op->od_direct='t'; if ($op->count() != 0 ) - echo widget::submit('use_opd','Utilisez une op.prédéfinie'); + echo widget::submit('use_opd','Utilisez une op.prédéfinie'); echo $op->show_button(); echo ''; exit(); diff --git a/include/class_action.php b/include/class_action.php index 4abc87fd3..8c80674a4 100644 --- a/include/class_action.php +++ b/include/class_action.php @@ -398,8 +398,8 @@ class action $str_type=$v[0]; if ( isset ($_REQUEST['url'])) { - $retour=sprintf('', - urldecode($_REQUEST['url'])); + $retour=widget::button_href('Retour',urldecode($_REQUEST['url'])); + $h_url=sprintf('',urldecode($_REQUEST['url'])); } else diff --git a/include/class_admin.php b/include/class_admin.php index 724a8f80c..c704d8cb1 100644 --- a/include/class_admin.php +++ b/include/class_admin.php @@ -101,7 +101,7 @@ class Admin extends fiche{ return $r; foreach ($step_admin as $admin ) { $r.=""; - $e=sprintf(' ', + $e=sprintf(' ', $script,$admin->id,$str_dossier,$url); $r.=" $e".$admin->strAttribut(ATTR_DEF_QUICKCODE).""; diff --git a/include/class_anc_account.php b/include/class_anc_account.php index c8db6ebff..c8ee246df 100644 --- a/include/class_anc_account.php +++ b/include/class_anc_account.php @@ -226,10 +226,15 @@ class Anc_Account $wPa_id=new widget("hidden","pa_id","pa_id",$this->pa_id); $wAmount=new widget("text","Montant","po_amount",$this->amount); $wDescription=new widget("text","Description","po_description",$this->description); - $wGa_id=new widget("select","Groupe","ga_id"); - $wGa_id->value=make_array($this->db,"select ga_id,ga_id from groupe_analytique",1); - $wGa_id->selected=$this->ga_id; - $wGa_id->table=1; + $aGroup_analytic=make_array($this->db,"select ga_id,ga_id from groupe_analytique where pa_id=".$this->pa_id,1); + if ( count($aGroup_analytic) > 1 ) { + $wGa_id=new widget("select","Groupe","ga_id"); + $wGa_id->value=$aGroup_analytic; + $wGa_id->selected=$this->ga_id; + $wGa_id->table=1; + } else { + $wGa_id=new widget('span'); + } $pa=new Anc_Plan($this->db,$this->pa_id); $pa->get(); $wPaName=new widget("text","Plan A.","",$pa->name); diff --git a/include/class_anc_balance_double.php b/include/class_anc_balance_double.php index df0e042af..f763c1de6 100644 --- a/include/class_anc_balance_double.php +++ b/include/class_anc_balance_double.php @@ -204,7 +204,7 @@ class Anc_Balance_Double extends Anc_Print 'solde'=>'Solde', 'dc'=>'D/C'), 'Totaux', - array('shaded'=>1,'showHeadings'=>1,cols=>array + array('shaded'=>1,'showHeadings'=>1,'cols'=>array ('debit'=>array('justification'=>'right'), 'credit'=>array('justification'=>'right'), 'solde'=>array('justification'=>'right'), ) @@ -274,7 +274,7 @@ class Anc_Balance_Double extends Anc_Print $choose=new widget("button"); $choose->name="Choix Poste"; $choose->label="Recherche"; - $choose->javascript="onClick=search_ca('".$_REQUEST['PHPSESSID']."',".dossier::id().",'from_poste2','pa_id')"; + $choose->javascript="onClick=search_ca('".$_REQUEST['PHPSESSID']."',".dossier::id().",'from_poste2','pa_id2')"; $r.=$choose->IOValue(); $r.=" et le poste ".$poste->IOValue("to_poste2",$this->to_poste2); @@ -370,7 +370,7 @@ class Anc_Balance_Double extends Anc_Print $and=" and "; } if ( $filter_poste != "") - $filter_poste.=" where ".$filter_poste; + $filter_poste=" where ".$filter_poste; $sql=" select a_po_id , @@ -386,7 +386,7 @@ b.po_id as b_po_id, case when a.oa_debit='t' then a.oa_amount else 0 end as a_oa_amount_d, case when a.oa_debit='f' then a.oa_amount else 0 end as a_oa_amount_c from -operation_analytique as a join operation_analytique as b using (oa_group) +operation_analytique as a join operation_analytique as b using (j_id) where a.pa_id=". $this->pa_id." and b.pa_id=".$this->pa_id2." ".$this->set_sql_filter()." diff --git a/include/class_anc_group_operation.php b/include/class_anc_group_operation.php index 7af0720e0..f743b7412 100644 --- a/include/class_anc_group_operation.php +++ b/include/class_anc_group_operation.php @@ -174,12 +174,12 @@ class Anc_Group_Operation $p->oa_amount=$p_array["pamount$i"]; $p->oa_description=$p_array["pdesc"]; - $p->oa_date=$_POST['pdate']; + $p->oa_date=$p_array['pdate']; $p->j_id=0; $p->oa_debit=(isset ($p_array["pdeb$i"]))?'t':'f'; $p->oa_group=0; - $p->po_id=$_POST["pop$i"."plan".$idx]; + $p->po_id=$p_array["pop$i"."plan".$idx]; $p->pa_id=$idx; $this->a_operation[]=clone $p; } diff --git a/include/class_anc_plan.php b/include/class_anc_plan.php index 8e4b3b778..273bcdd12 100644 --- a/include/class_anc_plan.php +++ b/include/class_anc_plan.php @@ -209,7 +209,7 @@ class Anc_Plan var_dump($p); echo "

Update

"; $p->name="Update "; - $p->description="c'est changé"; + $p->description="c'est change"; $p->update(); $p->get(); var_dump($p); diff --git a/include/class_bud_hypo.php b/include/class_bud_hypo.php index b88d5ffb0..5963dd9d5 100644 --- a/include/class_bud_hypo.php +++ b/include/class_bud_hypo.php @@ -77,7 +77,7 @@ class Bud_Hypo { function add() { $bh_saldo=(isNumber($this->bh_saldo) == 1 ) ?$this->bh_saldo:0; $pa_id=($this->pa_id <= 0 )?null:$this->pa_id; - + if ( strlen(trim ($this->bh_name)) == 0 ) return; $sql="insert into bud_hypothese( bh_name,bh_saldo,bh_description,pa_id) ". " values ($1,$2,$3,$4) returning bh_id"; $array=array( @@ -90,6 +90,7 @@ class Bud_Hypo { $this->bh_id=pg_fetch_result($a,0,0); } function update() { + if ( strlen(trim ($this->bh_name)) == "" ) return; $bh_name=pg_escape_string($this->bh_name); $bh_saldo=(isNumber($this->bh_saldo) == 1 ) ?$this->bh_saldo:0; $bh_description=pg_escape_string($this->bh_description); @@ -174,6 +175,11 @@ class Bud_Hypo { $count=getDbValue($this->db,"select count(*) from bud_hypothese"); return $count; } + function size_analytic() { + $count=getDbValue($this->db,"select count(*) from bud_hypothese where pa_id is not null"); + return $count; + } + static function test_me() { $cn=DbConnect (dossier::id()); ExecSql($cn,"delete from bud_hypothese"); diff --git a/include/class_bud_synthese_acc.php b/include/class_bud_synthese_acc.php index a633ede01..d0348bd1e 100644 --- a/include/class_bud_synthese_acc.php +++ b/include/class_bud_synthese_acc.php @@ -59,7 +59,7 @@ class Bud_Synthese_Acc extends Bud_Synthese { /* 2nd Step */ if ( $this->bh_id == 0 ) - throw new Exception ("bh_id n'est pas sélectionné"); + throw new Exception ("bh_id n'est pas selectionne"); $hypo=new Bud_Hypo($this->cn); $hypo->bh_id=$this->bh_id; $hypo->load(); @@ -163,6 +163,8 @@ class Bud_Synthese_Acc extends Bud_Synthese { " join parm_periode using (p_id) ". " where bc_id=$1 and $per and pcm_val=$2 group by p_id,p_start order by p_start"); + if ( empty ($aBudCard)) + return; // foreach card get the detail per pcm_val and periode foreach ($aBudCard as $rBudCard) { $line=array(); @@ -232,10 +234,10 @@ class Bud_Synthese_Acc extends Bud_Synthese { function display_html($p_array) { $r=""; if (empty($p_array)) return; + $persql=sql_filter_per($this->cn,$this->from,$this->to,'p_id','p_id'); $per=get_array($this->cn,"select to_char(p_start,'MM.YYYY') as d". " from parm_periode ". - " where p_id between ".$this->from.' and '. - $this->to." order by p_start" ); + " where $persql"); $heading=" CE "; foreach( $per as $c) { $heading.=''.$c['d'].'';} diff --git a/include/class_bud_synthese_anc.php b/include/class_bud_synthese_anc.php index 6deca935f..7026ba96b 100644 --- a/include/class_bud_synthese_anc.php +++ b/include/class_bud_synthese_anc.php @@ -57,7 +57,7 @@ class Bud_Synthese_Anc extends Bud_Synthese { /* 2nd Step */ if ( $this->bh_id == 0 ) - throw new Exception ("bh_id n'est pas sélectionné"); + throw new Exception ("bh_id n'est pas selectionne"); $hypo=new Bud_Hypo($this->cn); $hypo->bh_id=$this->bh_id; $hypo->load(); @@ -112,7 +112,7 @@ class Bud_Synthese_Anc extends Bud_Synthese { [80] => 14.0000 ) - [acc_name] => Electricité + [acc_name] => Electricite [acc_amount] => 0 ) @@ -225,10 +225,11 @@ class Bud_Synthese_Anc extends Bud_Synthese { function display_html($p_array) { $r=""; if (empty($p_array)) return; + $persql=sql_filter_per($this->cn,$this->from,$this->to,'p_id','p_id'); $per=get_array($this->cn,"select to_char(p_start,'MM.YYYY') as d". " from parm_periode ". - " where p_id between ".$this->from.' and '. - $this->to." order by p_start" ); + " where $persql"); + $heading=" CE "; foreach( $per as $c) { $heading.=''.$c['d'].'';} $heading.="Total Unite"; diff --git a/include/class_bud_synthese_group.php b/include/class_bud_synthese_group.php index 7d57cd4f3..63a61f2cf 100644 --- a/include/class_bud_synthese_group.php +++ b/include/class_bud_synthese_group.php @@ -1,4 +1,3 @@ - bh_id == 0 ) - throw new Exception ("bh_id n'est pas sélectionné"); + throw new Exception ("bh_id n'est pas selectionne"); $hypo=new Bud_Hypo($this->cn); $hypo->bh_id=$this->bh_id; $hypo->load(); @@ -192,6 +191,9 @@ class Bud_Synthese_Group extends Bud_Synthese { $pcm_val=""; $old="XX"; $sub=array(); + if ( empty($res) ) + return; + foreach ($res as $row) { $pcm_val=$row['pcm_val']; @@ -375,11 +377,11 @@ Array function display_html($p_array) { $r=""; + $persql=sql_filter_per($this->cn,$this->from,$this->to,'p_id','p_id'); list ($head,$foot)=$this->head_foot($p_array); $per=get_array($this->cn,"select p_id,to_char(p_start,'MM.YYYY') as d". " from parm_periode ". - " where p_id between ".$this->from.' and '. - $this->to." order by p_start" ); + " where $persql"); $r.=''; $heading=""; foreach( $per as $c) { @@ -401,7 +403,8 @@ Array $r.=''; $r.=''; // content - + if ( empty($p_array)) + return; foreach ($p_array as $key => $value ){ $r.=''; $r.=''; diff --git a/include/class_bud_synthese_hypo.php b/include/class_bud_synthese_hypo.php index 1075676ee..f6b6c038e 100644 --- a/include/class_bud_synthese_hypo.php +++ b/include/class_bud_synthese_hypo.php @@ -87,7 +87,7 @@ Array [GROUPE1] => 81.7 [GROUPE3] => 28 [total_row] => 109.7 - [acc_name] => Electricité + [acc_name] => Electricite [acc_amount] => 0 ) diff --git a/include/class_customer.php b/include/class_customer.php index ac69ffaa2..9f23b0653 100644 --- a/include/class_customer.php +++ b/include/class_customer.php @@ -105,8 +105,8 @@ class Customer extends fiche{ jrnx as A join jrnx as B using (j_grpt) where - A.j_poste like '".$CUSTOMER."%' and - B.j_poste like '".$SOLD."%' + A.j_poste::text like '".$CUSTOMER."%' and + B.j_poste::text like '".$SOLD."%' $cond_sql "; diff --git a/include/class_document.php b/include/class_document.php index 427e93cd0..06da2fcd8 100644 --- a/include/class_document.php +++ b/include/class_document.php @@ -464,6 +464,9 @@ class Document * - [MY_TVA] * - [MY_STREET] * - [MY_NUMBER] + * - BON_COMMANDE + * - OTHER_INFO + * - CUST_NUM * * \param TAG * \return String which must replace the tag @@ -554,8 +557,7 @@ class Document case 'CUST_CP': $tiers=new fiche($this->db); -$qcode=isset($_REQUEST['qcode_dest'])?$_REQUEST['qcode_dest']:$_REQUEST[ -'e_client']; + $qcode=isset($_REQUEST['qcode_dest'])?$_REQUEST['qcode_dest']:$_REQUEST['e_client']; $tiers->get_by_qcode($qcode,false); $r=$tiers->strAttribut(ATTR_DEF_CP); @@ -563,8 +565,7 @@ $qcode=isset($_REQUEST['qcode_dest'])?$_REQUEST['qcode_dest']:$_REQUEST[ case 'CUST_CITY': $tiers=new fiche($this->db); -$qcode=isset($_REQUEST['qcode_dest'])?$_REQUEST['qcode_dest']:$_REQUEST[ -'e_client']; + $qcode=isset($_REQUEST['qcode_dest'])?$_REQUEST['qcode_dest']:$_REQUEST['e_client']; $tiers->get_by_qcode($qcode,false); $r=$tiers->strAttribut(ATTR_DEF_CITY); @@ -573,8 +574,7 @@ $qcode=isset($_REQUEST['qcode_dest'])?$_REQUEST['qcode_dest']:$_REQUEST[ case 'CUST_CO': $tiers=new fiche($this->db); -$qcode=isset($_REQUEST['qcode_dest'])?$_REQUEST['qcode_dest']:$_REQUEST[ -'e_client']; + $qcode=isset($_REQUEST['qcode_dest'])?$_REQUEST['qcode_dest']:$_REQUEST['e_client']; $tiers->get_by_qcode($qcode,false); $r=$tiers->strAttribut(ATTR_DEF_PAYS); @@ -584,11 +584,17 @@ $qcode=isset($_REQUEST['qcode_dest'])?$_REQUEST['qcode_dest']:$_REQUEST[ case 'CUST_VAT': $tiers=new fiche($this->db); -$qcode=isset($_REQUEST['qcode_dest'])?$_REQUEST['qcode_dest']:$_REQUEST[ -'e_client']; + $qcode=isset($_REQUEST['qcode_dest'])?$_REQUEST['qcode_dest']:$_REQUEST['e_client']; $tiers->get_by_qcode($qcode,false); $r=$tiers->strAttribut(ATTR_DEF_NUMTVA); break; + case 'CUST_NUM': + $tiers=new fiche($this->db); + $qcode=isset($_REQUEST['qcode_dest'])?$_REQUEST['qcode_dest']:$_REQUEST['e_client']; + $tiers->get_by_qcode($qcode,false); + $r=$tiers->strAttribut(ATTR_DEF_NUMBER_CUSTOMER); + break; + // Marchandise in $_POST['e_march*'] // \see user_form_achat.php or user_form_ven.php case 'NUMBER': @@ -811,6 +817,19 @@ $qcode=isset($_REQUEST['qcode_dest'])?$_REQUEST['qcode_dest']:$_REQUEST[ $r=$sum; break; + case 'BON_COMMANDE': + if ( isset($_REQUEST['bon_comm'])) + return $_REQUEST['bon_comm']; + else + return ""; + break; + case 'OTHER_INFO': + if ( isset($_REQUEST['other_info'])) + return $_REQUEST['other_info']; + else + return ""; + break; + } return $r; diff --git a/include/class_dossier.php b/include/class_dossier.php index cd32a3894..3ad92d9bf 100644 --- a/include/class_dossier.php +++ b/include/class_dossier.php @@ -37,6 +37,7 @@ require_once('ac_common.php'); class dossier { + /*!\brief return the $_REQUEST['gDossier'] after a check */ static function id() { echo_debug(__FILE__,__LINE__,"id"); diff --git a/include/class_fiche.php b/include/class_fiche.php index d05171cbb..15e1e15f9 100644 --- a/include/class_fiche.php +++ b/include/class_fiche.php @@ -431,9 +431,13 @@ class fiche { * \brief insert a new record * * \param p_fiche_def fiche_def.fd_id + * \param p_array is the array containing the data */ - function insert($p_fiche_def) + function insert($p_fiche_def,$p_array=null) { + if ( $p_array == null) + $p_array=$_POST; + $fiche_id=NextSequence($this->cn,'s_fiche'); $this->id=$fiche_id; // first we create the card @@ -444,8 +448,8 @@ class fiche { " values (%d,%d)", $fiche_id,$p_fiche_def); $Ret=ExecSql($this->cn,$sql); - // parse the $_POST array - foreach ($_POST as $name=>$value ) + // parse the $p_array array + foreach ($p_array as $name=>$value ) { echo_debug ("class_fiche",__LINE__,"Name = $name value $value") ; list ($id) = sscanf ($name,"av_text%d"); @@ -471,8 +475,8 @@ class fiche { $exercice=$user->get_exercice(); if ( $exercice == 0 ) throw Exception ('Annee invalide erreur'); - $str_stock=sprintf('insert into stock_goods(f_id,sg_initial,sg_code,sg_type,sg_exercice) '. - ' values (%d,upper(\'%s\'),\'c\',\'%s\')', + $str_stock=sprintf('insert into stock_goods(f_id,sg_quantity,sg_comment,sg_code,sg_type,sg_exercice) '. + ' values (%d,0,\'%s\',upper(\'%s\'),\'d\',\'%s\')', $fiche_id, 'initial', FormatString($value), @@ -565,12 +569,15 @@ class fiche { /*!\brief update a card * \todo add a check to return an error and rollback operation */ - function update() + function update($p_array=null) { + if ( $p_array == null) + $p_array=$_POST; + try { StartSql($this->cn); - // parse the $_POST array - foreach ($_POST as $name=>$value ) + // parse the $p_array array + foreach ($p_array as $name=>$value ) { echo_debug ("class_fiche",__LINE__,"Name = $name value $value") ; list ($id) = sscanf ($name,"av_text%d"); @@ -619,19 +626,24 @@ class fiche { } if ( $id == ATTR_DEF_STOCK ) { $st=CountSql($this->cn,'select * from stock_goods where '. - " upper(sg_code)=upper('$value')"); + " f_id=".$this->id); if ( $st == 0 ) { $user=new User($this->cn); $exercice=$user->get_exercice(); if ( $exercice == 0 ) throw Exception ('Annee invalide erreur'); - $str_stock=sprintf('insert into stock_goods(f_id,sg_comment,sg_code,sg_type,sg_exercice) '. - ' values (%d,upper(\'%s\'),upper(\'%s\'),\'d\',%s)', - $this->id, - 'initial', - FormatString($value), - $exercice); - + $str_stock=sprintf('insert into stock_goods(f_id,sg_quantity,sg_comment,sg_code,sg_type,sg_exercice) '. + ' values (%d,0,\'%s\',upper(\'%s\'),\'d\',\'%s\')', + $this->id, + 'initial', + FormatString($value), + $exercice); + + ExecSql($this->cn,$str_stock); + }else { + $str_stock=sprintf("update stock_goods set sg_code=upper('%s') where f_id=%d", + FormatString($value), + $this->id); ExecSql($this->cn,$str_stock); } } @@ -876,12 +888,15 @@ class fiche { * * \return none */ - function HtmlTable() + function HtmlTable($p_array=null) { + if ( $p_array == null) + $p_array=$_POST; + $name=$this->getName(); - list($array,$tot_deb,$tot_cred)=$this->get_row( $_POST['from_periode'], - $_POST['to_periode'] + list($array,$tot_deb,$tot_cred)=$this->get_row( $p_array['from_periode'], + $p_array['to_periode'] ); if ( count($this->row ) == 0 ) @@ -928,8 +943,11 @@ class fiche { * * \return none */ - function HtmlTableHeader() + function HtmlTableHeader($p_array=null) { + if ( $p_array == null) + $p_array=$_POST; + $submit=new widget(); $hid=new widget("hidden"); echo '
'; @@ -948,8 +966,8 @@ class fiche { $hid->IOValue('p_action','impress'). $hid->IOValue("f_id",$this->id). dossier::hidden(). - $hid->IOValue("from_periode",$_POST['from_periode']). - $hid->IOValue("to_periode",$_POST['to_periode']); + $hid->IOValue("from_periode",$p_array['from_periode']). + $hid->IOValue("to_periode",$p_array['to_periode']); echo ""; echo '
"; echo "
CE
'.$key.'
'. @@ -958,8 +976,8 @@ class fiche { $hid->IOValue("type","poste"). $hid->IOValue('p_action','impress'). $hid->IOValue("f_id",$this->id). - $hid->IOValue("from_periode",$_POST['from_periode']). - $hid->IOValue("to_periode",$_POST['to_periode']); + $hid->IOValue("from_periode",$p_array['from_periode']). + $hid->IOValue("to_periode",$p_array['to_periode']); echo "
"; diff --git a/include/class_gestion_purchase.php b/include/class_gestion_purchase.php index 9fb475207..eb51ed160 100644 --- a/include/class_gestion_purchase.php +++ b/include/class_gestion_purchase.php @@ -43,7 +43,9 @@ class gestion_purchase extends gestion_table var $qp_nd_tva_recup; /*!< tva ded via taxe */ var $qp_supplier; /*!< supplier code (f_id) */ var $qp_valid; - var $j_id; /*!< jrnx.j_id */ + var $j_id; /*!< jrnx.j_id + */ + var $qp_dep_priv; /*!< private purchase */ /*!\brief return an array of gestion_table, the object are * retrieved thanks the qs_internal */ @@ -63,7 +65,8 @@ class gestion_purchase extends gestion_table qp_nd_tva, qp_nd_tva_recup, qp_supplier, - j_id + j_id, + qp_dep_priv from quant_purchase left join tva_rate on (qp_vat_code=tva_id) where qp_internal='".$this->qp_internal."'"; $ret=ExecSql($this->db,$sql); diff --git a/include/class_periode.php b/include/class_periode.php index 95fbbba0b..1b656cf0c 100644 --- a/include/class_periode.php +++ b/include/class_periode.php @@ -217,7 +217,7 @@ class Periode { echo ' '.$l_line['p_exercice'].''; if ( $l_line['status'] != 'OP' ) { - $closed=($l_line['status']=='CE')?'Centralisée':'Fermée'; + $closed=($l_line['status']=='CE')?'Centralisee':'Fermée'; } else { $closed=''; $closed.=' Cloturer'; diff --git a/include/class_user.php b/include/class_user.php index 703768d1a..fc11f2dc6 100644 --- a/include/class_user.php +++ b/include/class_user.php @@ -324,7 +324,7 @@ function load_global_pref() $line[$type]=$row['parameter_value'];; } // save array into g_ variable - $array_pref=array ('g_theme'=>'THEME','g_pagesize'=>'PAGESIZE'); + $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); @@ -349,7 +349,7 @@ function insert_default_global_pref($p_type="",$p_value="") { echo_debug('class_user.php',__LINE__,"parameter p_type $p_type p_value $p_value"); $default_parameter= array("THEME"=>"Light", - "PAGESIZE"=>"50"); + "PAGESIZE"=>"50",'TOPMENU'=>'SELECT'); $cn=Dbconnect(); $Sql="insert into user_global_pref(user_id,parameter_type,parameter_value) values ('%s','%s','%s')"; @@ -378,7 +378,7 @@ function insert_default_global_pref($p_type="",$p_value="") { */ function update_global_pref($p_type,$p_value="") { $default_parameter= array("THEME"=>"Light", - "PAGESIZE"=>"50"); + "PAGESIZE"=>"50",'TOPMENU'=>'SELECT'); $cn=Dbconnect(); $Sql="update user_global_pref set parameter_value='%s' where parameter_type='%s' and diff --git a/include/class_widget.php b/include/class_widget.php index 554a39813..afb7dbf51 100644 --- a/include/class_widget.php +++ b/include/class_widget.php @@ -129,7 +129,7 @@ class widget { $r='javascript." ".$disabled." $readonly $this->extra >"; + 'SIZE="'.$this->size.'" '.$this->javascript." ".$disabled." $readonly $this->extra >"; if ($this->table==1) { if ( $this->label != "") { @@ -657,9 +657,19 @@ class widget { return ''; } static function button_href($p_name,$p_value) { - return sprintf('', - $p_value, - $p_name); + $agent=$_SERVER['HTTP_USER_AGENT']; + + if ( strpos($agent,'MSIE') == 0 && + strpos ($agent,'Konqueror') ==0) + return sprintf('', + $p_value, + $p_name); + + return sprintf(' '. + ' %s', + $p_value, + $p_name); + } } diff --git a/include/client.inc.php b/include/client.inc.php index ce2324cba..fcd395b5d 100644 --- a/include/client.inc.php +++ b/include/client.inc.php @@ -46,8 +46,7 @@ if ( isset ($_POST['delete']) ) if ( $sub_action=="insert" ) { - $retour=sprintf('', - urldecode($_REQUEST['url'])); + $retour=widget::button_href("Retour", urldecode($_REQUEST['url'])); $customer=new Customer($cn); $customer->Save($_REQUEST['fd_id']); @@ -77,8 +76,8 @@ if ( $sub_action == "" ) if ( $sub_action=="blank") { - $retour=sprintf('', - "commercial.php?p_action=client&$str_dossier"); + $retour=widget::button_href('Retour','commercial.php?p_action=fournisseur&'.dossier::get()); + echo '
'; echo $retour; @@ -116,7 +115,6 @@ if ( $sub_action == "list" )
- +
@@ -148,8 +147,8 @@ if ( $sub_action == 'detail' ) $f_id=$_REQUEST['f_id']; echo '
'; $client=new Customer($cn,$f_id); - $retour=sprintf('', - urldecode($_REQUEST['url'])); + $retour=widget::button_href("Retour", urldecode($_REQUEST['url'])); + echo $retour; echo '
'; echo dossier::hidden(); diff --git a/include/constant.php b/include/constant.php index b413b7acc..08aea30ae 100644 --- a/include/constant.php +++ b/include/constant.php @@ -136,7 +136,8 @@ define ("ATTR_DEF_EMAIL",18); define ("ATTR_DEF_CITY",24); define ("ATTR_DEF_COMPANY",25); define ("ATTR_DEF_FAX",26); - +define ("ATTR_DEF_NUMBER_CUSTOMER",30); +define ("ATTR_DEF_DEP_PRIV",31); define ("FICHE_TYPE_CLIENT",9); define ("FICHE_TYPE_VENTE",1); diff --git a/include/contact.inc.php b/include/contact.inc.php index e16eb3bf6..d0b4a5ae3 100644 --- a/include/contact.inc.php +++ b/include/contact.inc.php @@ -36,7 +36,8 @@ $sub_action=(isset($_REQUEST['sa']))?$_REQUEST['sa']:""; // TODO add function for generating url, hidden tags... if ( isset ($_REQUEST['url'])) { - $retour=sprintf('',urldecode($_REQUEST['url'])); + $retour=widget::button_href('Retour',urldecode($_REQUEST['url'])); + $h_url=sprintf('',urldecode($_REQUEST['url'])); } else @@ -87,8 +88,8 @@ if ( $sub_action == "" ) //Display a blank card if ( $sub_action=="blank") { - $retour_action=sprintf('', - "commercial.php?p_action=contact&$str_dossier"); + $retour_action=widget::button_href('Retour', "commercial.php?p_action=contact&$str_dossier"); + echo '
'; echo $retour_action; diff --git a/include/depense.inc.php b/include/depense.inc.php index 33b2ae8eb..d3981e5e4 100644 --- a/include/depense.inc.php +++ b/include/depense.inc.php @@ -52,7 +52,8 @@ $h_url=""; if ( isset ($_REQUEST['url'])) { - $retour=sprintf('',urldecode($_REQUEST['url'])); + $retour=widget::button_href('Retour',urldecode($_REQUEST['url'])); + $h_url=sprintf('',urldecode($_REQUEST['url'])); } diff --git a/include/facture.inc.php b/include/facture.inc.php index 28c0b0b0f..6b682c986 100644 --- a/include/facture.inc.php +++ b/include/facture.inc.php @@ -24,6 +24,8 @@ require_once('jrn.php'); require_once("class_document.php"); require_once("class_fiche.php"); require_once("check_priv.php"); +require_once('class_acc_jrn_info.php'); + $tag_list='Liste'; $tag_list_sel='Liste'; $tag_unpaid='Non paye'; @@ -52,7 +54,8 @@ $h_url=""; if ( isset ($_REQUEST['url'])) { - $retour=sprintf('',urldecode($_REQUEST['url'])); + $retour=widget::button_href('Retour',urldecode($_REQUEST['url'])); + $h_url=sprintf('',urldecode($_REQUEST['url'])); } @@ -357,6 +360,19 @@ if ( isset($_POST['record_and_print_invoice'])) // Update the comment with invoice number $sql="update jrn set jr_comment='Facture ".$doc->d_number."' where jr_internal='$internal'"; ExecSql($cn,$sql); + /* Save the additional information into jrn_info */ + $obj=new Acc_Jrn_Info($cn); + $jr_id=$obj->search_id_internal($internal); + if (strlen(trim($_POST['bon_comm'] )) != 0 ) { + $obj->set_type('BON_COMMANDE'); + $obj->set_value($_POST['bon_comm']); + $obj->insert(); + } + if (strlen(trim($_POST['other_info'] )) != 0 ) { + $obj->set_type('OTHER'); + $obj->set_value($_POST['other_info']); + $obj->insert(); + } echo $str_file; } } else { diff --git a/include/fiche.inc.php b/include/fiche.inc.php index 549a04268..acc9a26ac 100644 --- a/include/fiche.inc.php +++ b/include/fiche.inc.php @@ -255,7 +255,7 @@ if ( isset ( $_GET["action"]) ) { $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=getArray($cn,$sql); + $all=get_array($cn,$sql); // test on the size // if ( sizeof($all) != 0 ) diff --git a/include/fiche_def.inc.php b/include/fiche_def.inc.php index fed2f7318..8f311bf52 100644 --- a/include/fiche_def.inc.php +++ b/include/fiche_def.inc.php @@ -56,7 +56,7 @@ echo ""; if ( isset ($_POST['mod']) ) { extract ($_POST); - echo '
'; + echo '
'; echo "Voulez-vous modifier ?
Attention, ne changer pas la signification de "; echo " ce poste, par exemple ne pas changer Client par fournisseur,
sinon le programme fonctionnera mal, utiliser uniquement des chiffres pour la classe de base ou rien
"; $idx=$_POST['idx']; diff --git a/include/import_inc.php b/include/import_inc.php index b70533e2b..126267d86 100644 --- a/include/import_inc.php +++ b/include/import_inc.php @@ -27,7 +27,7 @@ require_once('class_user.php'); require_once('class_widget.php'); require_once('class_fiche.php'); require_once('class_acc_ledger.php'); - +require_once('class_parm_code.php'); /*! ************************************************** * \brief Parse the file and insert the record @@ -389,7 +389,8 @@ $w=new widget("select"); $w->label='Journal'; echo $w->label." :".$w->IOValue('import_jrn',$jrn)."
"; // choose the bank account - $bq=make_array($p_cn,"select pcm_val,pcm_lib from tmp_pcmn where pcm_val like '550%'"); + $banque=new parm_code($p_cn,'BANQUE'); + $bq=make_array($p_cn,"select pcm_val,pcm_lib from tmp_pcmn where pcm_val::text like '".$banque->p_value."%'"); $w->label='Banque'; echo "Compte en banque :".$w->IOValue('import_bq',$bq)."
"; $format_csv=make_array($p_cn,"select include_file,name from format_csv_banque;"); diff --git a/include/impress_inc.php b/include/impress_inc.php index 00ca6cf31..3bec06932 100644 --- a/include/impress_inc.php +++ b/include/impress_inc.php @@ -584,7 +584,7 @@ function ParseFormula($p_cn,$p_label,$p_formula,$p_start,$p_end,$p_eval=true,$p_ "select p_exercice from parm_periode where p_id=$user_periode"); $sql_per="select to_char(p_start,'MM.YYYY') as start from parm_periode where ". " p_exercice='".$periode."' order by p_start"; - $ret=getArray($p_cn,$sql_per); + $ret=get_array($p_cn,$sql_per); $from=$ret[0]['start']; } @@ -650,7 +650,7 @@ function GetFormulaValue($p_cn,$p_label,$p_formula,$p_cond) $l_credit=0; // somme debit $Res=ExecSql($p_cn,"select sum (j_montant) as montant from - jrnx where $p_cond and j_debit='t' and j_poste like '$p_formula'"); + jrnx where $p_cond and j_debit='t' and j_poste::text like '$p_formula'"); if (pg_NumRows($Res)==0){ $l_debit=0; } else { @@ -659,7 +659,7 @@ function GetFormulaValue($p_cn,$p_label,$p_formula,$p_cond) } // somme credit $Res=ExecSql($p_cn,"select sum (j_montant) as montant from - jrnx where $p_cond and j_debit='f' and j_poste like '$p_formula'"); + jrnx where $p_cond and j_debit='f' and j_poste::text like '$p_formula'"); if (pg_NumRows($Res)==0) { $l_credit=0; } else { diff --git a/include/impress_jrn.inc.php b/include/impress_jrn.inc.php index a0ecfba31..b69aceeeb 100644 --- a/include/impress_jrn.inc.php +++ b/include/impress_jrn.inc.php @@ -126,6 +126,15 @@ require_once("class_acc_ledger.php"); /* "Pièce justificative". */ " montant". ""; + // set a filter for the FIN + $a_parm_code=get_array($cn,"select p_value from parm_code where p_code in ('BANQUE','COMPTE_COURANT','CAISSE')"); + $sql_fin="("; + $or=""; + foreach ($a_parm_code as $code) { + $sql_fin.="$or j_poste::text like '".$code['p_value']."%'"; + $or=" or "; + } + $sql_fin.=")"; foreach ($Row as $line) { @@ -140,7 +149,7 @@ require_once("class_acc_ledger.php"); // Get the jrn type if ( $line['jrn_def_type'] == 'FIN' ) { $positive = CountSql($cn,"select * from jrn inner join jrnx on jr_grpt_id=j_grpt ". - " where jr_id=".$line['jr_id']." and (j_poste like '55%' or j_poste like '57%' )". + " where jr_id=".$line['jr_id']." and $sql_fin ". " and j_debit='f'"); echo ""; diff --git a/include/impress_poste.inc.php b/include/impress_poste.inc.php index b91b057c0..ece12386b 100644 --- a/include/impress_poste.inc.php +++ b/include/impress_poste.inc.php @@ -94,7 +94,7 @@ if ( isset( $_POST['bt_html'] ) ) { if ( isset ($_POST['poste_fille']) ) { $parent=$_POST['poste_id']; - $a_poste=get_array($cn,"select pcm_val from tmp_pcmn where pcm_val like '$parent%' order by pcm_val::text"); + $a_poste=get_array($cn,"select pcm_val from tmp_pcmn where pcm_val::text like '$parent%' order by pcm_val::text"); $go=3; } // Check if the post is numeric and exists diff --git a/include/jrn.php b/include/jrn.php index 1e7a66d9c..859eff31c 100644 --- a/include/jrn.php +++ b/include/jrn.php @@ -30,6 +30,8 @@ require_once ('class_anc_plan.php'); require_once ('class_anc_operation.php'); require_once ('class_acc_ledger.php'); require_once ('class_acc_operation.php'); +require_once ('class_acc_jrn_info.php'); + /*! * \brief Display the form to UPDATE account operation in the expert view * @@ -143,11 +145,14 @@ function ShowOperationExpert($p_cn,$p_jr_id,$p_mode=1) if ( $content['jr_pj_name'] != "") $r.='Effacer PJ '; } - $r.="".sprintf('%s', - $content['jr_id'], - $content['jr_grpt_id'], - $str_dossier, - $content['jr_pj_name']).""; + $r.="".sprintf('%s', + $content['jr_id'], + $content['jr_grpt_id'], + $str_dossier, + $_REQUEST['PHPSESSID'], + $content['jr_pj_name'] + + ).""; $r.=""; if ( $p_mode == 1 ) { @@ -287,12 +292,14 @@ function ShowOperationUser($p_cn,$p_jr_id,$p_mode=1) $r.='Nom'; $r.='PU'; $r.='Quantité'; + $r.=' Dep. priv. '; $r.='tva'; - $r.='code tva'; - $r.='Non Ded.'; + $r.='tva'; + $r.='non ded.'; $r.='tva nd'; $r.='tva d impot'; - $r.='prix'; + $r.='total htva'; + $r.='total tvac'; $r.=''; $object=new gestion_purchase($p_cn); @@ -303,6 +310,7 @@ function ShowOperationUser($p_cn,$p_jr_id,$p_mode=1) $tot_nd=0.0; $tot_tva_nd=0.0; $tot_tva_nd_recup=0.0; + $tot_dep_priv=0.0; $i=0; $i_march=0; foreach ($array as $row) { @@ -314,20 +322,24 @@ function ShowOperationUser($p_cn,$p_jr_id,$p_mode=1) $tot_tva_nd+=$row->qp_nd_tva; $tot_tva_nd_recup+=$row->qp_nd_tva_recup; $tot_amount+=$row->qp_price; + $tot_dep_priv+=$row->qp_dep_priv; // $hid_jid=new widget("hidden","","p_jid_".$row->j_id,$row->j_id); $r.=($i%2==0)?"":''; $i++; $pu=0.0; - if ( $row->qp_price != 0.0 && $row->qp_price != 0 ) $pu=round($row->qp_price/$row->qp_quantite,2); + if ( $row->qp_price != 0.0 && $row->qp_price != 0 ) + $pu=round(($row->qp_nd_amount+$row->qp_price)/$row->qp_quantite,2); $r.=' '.$fiche->strAttribut(ATTR_DEF_NAME).''; $r.=''.$pu.''; $r.=''.$row->qp_quantite.''; + $r.=''.$row->qp_dep_priv.''; $r.=''.$row->qp_vat.''; - $r.=''.$row->qp_vat_code.''; - $r.=''.$row->qp_nd_amount.''; $r.=''.$row->tva_label.''; + $r.=''.$row->qp_nd_amount.''; + $r.=''.$row->qp_nd_tva.''; $r.=''.$row->qp_nd_tva_recup.''; - $r.=''.$row->qp_price.''; + $r.=''.sprintf("% 12.2f",$row->qp_price).''; + $r.=''.sprintf("% 12.2f",$row->qp_vat+$row->qp_nd_amount+$row->qp_nd_tva+$row->qp_nd_tva_recup+$row->qp_price).''; //-- add ca // @@ -347,26 +359,36 @@ function ShowOperationUser($p_cn,$p_jr_id,$p_mode=1) 'Total HTVA'. ''.sprintf('% 12.2f',$tot_amount)."". ""; + if ( $tot_tva != 0 ) $r.=''. 'Total TVA'. ''.sprintf('%12.2f',$tot_tva) ."". ""; + if ( $tot_nd !=0 ) $r.=''. 'Total nd '. ''.sprintf('%12.2f',$tot_nd)."". ""; + if ( $tot_tva_nd !=0 ) $r.=''. 'Total tva nd'. ''.sprintf('%12.2f',$tot_tva_nd)."". ""; + if ( $tot_tva_nd_recup !=0 ) $r.=''. 'Total tva nd recup. par impot'. ''.sprintf('%12.2f',$tot_tva_nd_recup)."". ""; + if ( $tot_dep_priv !=0 ) + $r.=''. + 'Total tva nd recup. par impot'. + ''.sprintf('%12.2f',$tot_dep_priv)."". + ""; + $r.=''. 'Total '. - ''.sprintf('%12.2f',$tot_amount+$tot_tva)."". + ''.sprintf('%12.2f',$tot_dep_priv+$tot_amount+$tot_tva+$tot_tva_nd_recup+$tot_nd+$tot_tva_nd)."". ""; $r.= ''; @@ -464,11 +486,31 @@ function ShowOperationUser($p_cn,$p_jr_id,$p_mode=1) //doc if ( $p_mode ==1 && $content['jr_pj_name'] != "") $r.='Effacer Pj '; - $r.="".sprintf('%s', + $r.="".sprintf('%s', $content['jr_id'], $content['jr_grpt_id'], + $_REQUEST['PHPSESSID'], $content['jr_pj_name']).""; $r.=""; + if ( $content['jrn_def_type'] == 'VEN' ) { + /* count the number of additionnal info */ + $acc_jrn_info=new Acc_Jrn_Info($p_cn); + $acc_jrn_info->set_jrn_id($p_jr_id); + + /* if additional info > 0 show them */ + if ( $acc_jrn_info->count() > 0 ) { + $array=$acc_jrn_info->load_all(); + foreach ($array as $row) { + if ( strpos($row->id_type,'BON_COMMANDE') ===0) { + $r.="Num bon de commande : ".$row->ji_value.'
'; + } + if ( strpos($row->id_type,'OTHER') ===0) { + $r.="Autre info : ".$row->ji_value.'
'; + } + + } + } + } $r.="
"; if ( $p_mode == 1 ) { $r.= ""; diff --git a/include/poste.inc.php b/include/poste.inc.php index eed35d007..02e756c7b 100644 --- a/include/poste.inc.php +++ b/include/poste.inc.php @@ -37,7 +37,7 @@ if ( isset( $_POST['confirm_mod'] ) ) $object=new parm_code($cn); $all=$object->LoadAll(); -echo '
'; +echo '
'; echo '
'; for ($i=0;$i'; @@ -58,7 +58,7 @@ echo ""; // modifie if ( isset ($_POST['mod'] )) { - echo '
'; + echo '
'; echo "Voulez-vous vraiment modifier ?"; echo ''; @@ -75,4 +75,4 @@ if ( isset ($_POST['mod'] )) echo ""; echo "
"; -} \ No newline at end of file +} diff --git a/include/postgres.php b/include/postgres.php index 1f7954d87..688cc9a39 100644 --- a/include/postgres.php +++ b/include/postgres.php @@ -98,7 +98,7 @@ function DbConnect($p_db=-1,$p_type='dossier') { $phpcompta_user=phpcompta_user; $password=phpcompta_password; $port=phpcompta_psql_port; - ob_start(); + ob_start(); $a=pg_connect("dbname=$l_dossier host=127.0.0.1 user='$phpcompta_user' password='$password' port=$port"); diff --git a/include/pref.inc.php b/include/pref.inc.php index 0c5919637..2e0156c70 100644 --- a/include/pref.inc.php +++ b/include/pref.inc.php @@ -21,6 +21,8 @@ /*!\brief this file is always included and then executed * it permits to change the user preferences */ +require_once('class_widget.php'); +require_once('class_user.php'); echo '
'; @@ -92,14 +94,30 @@ $disp_style.=""; update_global_pref('TOPMENU',$_POST['topmenu']); +} +$topmenu=new widget('select'); +$topmenu->name='topmenu'; +$topmenu->selected=$_SESSION['g_topmenu']; +$array=array( + array('value'=>'TEXT','label'=>'Texte'), + array('value'=>'SELECT','label'=>'Menu deroulant') + ); +$topmenu->value=$array; +echo '

Style de menu

'; +echo ''; +echo '
'; +echo $topmenu->IOValue(); +echo widget::submit('sub_topmenu','Sauver'); +echo ''; +echo '
'; // Si utilise un dossier alors propose de changer // la periode par defaut -if ( ! isset ($_REQUEST['gDossier']) ) - { - echo ''; - } -else +if ( isset ($_REQUEST['gDossier']) ) { include_once("preference.php"); @@ -132,7 +150,10 @@ else
+

Taille des pages

@@ -156,9 +177,13 @@ else
+'; + } + -"; ?> diff --git a/include/stock_inc.php b/include/stock_inc.php index 4421c619c..7c7d0ebeb 100644 --- a/include/stock_inc.php +++ b/include/stock_inc.php @@ -21,7 +21,7 @@ /*! \file * \brief Function for managing the stock */ - +require_once('class_fiche.php'); /*! ************************************************** @@ -123,7 +123,7 @@ $sql="select distinct f_id,av_text join jnt_fic_att_value using (f_id ) join attr_value using (jft_id) where - ad_id=".ATTR_DEF_NAME." + ad_id=".ATTR_DEF_STOCK." and sg_code='$p_sg_code' "; // Execute @@ -134,7 +134,8 @@ $sql="select distinct f_id,av_text for ( $i=0; $i<$M;$i++) { $r=pg_fetch_array($Res,$i); $a['f_id']=$r['f_id']; - $a['av_text']=$r['av_text']; + $fiche=new Fiche($p_cn,$r['f_id']); + $a['av_text']=$fiche->getName(); $result[$i]=$a; } diff --git a/include/supplier.inc.php b/include/supplier.inc.php index 991454f90..5a362af81 100644 --- a/include/supplier.inc.php +++ b/include/supplier.inc.php @@ -46,8 +46,7 @@ if ( isset ($_POST['delete']) ) // Add card if ( $sub_action=="insert" ) { - $retour=sprintf('', - urldecode($_REQUEST['url'])); + $retour=widget::button_href("Retour", urldecode($_REQUEST['url'])); $supplier=new Supplier($cn); $supplier->Save($_REQUEST['fd_id']); @@ -75,8 +74,7 @@ if ( $sub_action == "" ) //Display a blank card if ( $sub_action=="blank") { - $retour=sprintf('', - "commercial.php?p_action=fournisseur&".dossier::get()); + $retour=widget::button_href('Retour','commercial.php?p_action=fournisseur&'.dossier::get()); echo '
'; echo $retour; @@ -85,10 +83,11 @@ if ( $sub_action=="blank") echo ''; echo ''; echo ''; - echo ''; echo dossier::hidden(); echo $c->blank($_GET['fd_id']); echo ''; + echo ''; + echo ''; echo $retour; echo '
'; @@ -114,7 +113,6 @@ if ( $sub_action == "list" )
- +
@@ -148,8 +147,8 @@ if ( $sub_action == 'detail' ) $f_id=$_REQUEST['f_id']; echo '
'; $sup=new Supplier($cn,$f_id); - $retour=sprintf('', - urldecode($_REQUEST['url'])); + $retour=widget::button_href("Retour", urldecode($_REQUEST['url'])); + echo $retour; echo '
'; echo $sup->Display(false); diff --git a/include/tva.inc.php b/include/tva.inc.php index dc44a8e26..e864c8a11 100644 --- a/include/tva.inc.php +++ b/include/tva.inc.php @@ -255,6 +255,7 @@ if ( ! isset ($_POST['add'])
'; } +} + echo '
'; ?> diff --git a/include/user_action_ach.php b/include/user_action_ach.php index e8d60ef92..bbf136722 100644 --- a/include/user_action_ach.php +++ b/include/user_action_ach.php @@ -69,7 +69,7 @@ if ( $action=="use_opd" ) { echo $hid->IOValue("jrn_type","ACH"); if ($op->count() != 0 ) - echo widget::submit('use_opd','Utilisez une op.prédéfinie'); + echo widget::submit('use_opd','Utilisez une op.prédéfinie'); echo $op->show_button(); echo ''; @@ -118,7 +118,7 @@ if ( $action == 'new' ) { echo $hid->IOValue("jrn_type","ACH"); if ($op->count() != 0 ) - echo widget::submit('use_opd','Utilisez une op.prédéfinie'); + echo widget::submit('use_opd','Utilisez une op.prédéfinie'); echo $op->show_button(); echo ''; @@ -202,7 +202,7 @@ if ( $action == 'new' ) { list($internal,$comment)=RecordSell($cn,$_POST,$User,$_GET['p_jrn']); // submit button in the form - $submit='

Opération '.$internal.'

'; + $submit='

Opération '.$internal.'

'; $r=FormAchView($cn,$_GET['p_jrn'],$User->get_periode(),$_POST,"",$nb_number,false); echo '
'; echo $submit; diff --git a/include/user_action_fin.php b/include/user_action_fin.php index 16e14771b..640ceb51f 100644 --- a/include/user_action_fin.php +++ b/include/user_action_fin.php @@ -273,8 +273,8 @@ if ( $action == 'solde' ) { $vir_interne=new parm_code($cn,'VIREMENT_INTERNE'); $accountSql="select distinct pcm_val::text,pcm_lib from tmp_pcmn - where pcm_val like '".$banque->p_value."%' or pcm_val like '".$vir_interne->p_value."%' - or pcm_val like '".$caisse->p_value."%' + 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 '
'; diff --git a/include/user_common.php b/include/user_common.php index f82db5902..bbae4ad21 100644 --- a/include/user_common.php +++ b/include/user_common.php @@ -129,6 +129,30 @@ echo_debug('user_common.php',__LINE__,"ComputeTotalVat $a_fiche $a_quant $a_pric //variable containing the nd part // used when a card has both special rule for vat $nd1=0; + + $base=$a_price[$idx]*$a_vat['tva_rate']*$a_quant[$idx]; + $nd_amount3=0; + // if a part is not deductible then reduce vat_amount + $nd3=GetFicheAttribut($p_cn,$a_fiche[$idx],ATTR_DEF_DEP_PRIV); + if ( $nd3 != null && strlen(trim($nd3)) != 0 && $nd3 != 0 ) + { + // if tva amount is given we do not compute it + if ( $a_vat_amount != null && + $a_vat_amount[$idx] != 0 ) { + $nd_amount3=round($a_vat_amount[$idx]*$nd3,2); + $a_vat_amount[$idx]-=$nd_amount3; + } + else + $nd_amount3=round($a_price[$idx]*$a_vat['tva_rate']*$a_quant[$idx]*$nd3,2); + + $vat_amount=$vat_amount-$nd_amount3; + + $base=$base*$nd3; + // when using both vat, their sum cannot exceed 1, if = 1 then vat = 0 + $flag=false; + } + + // if a part is not deductible then reduce vat_amount $nd=GetFicheAttribut($p_cn,$a_fiche[$idx],ATTR_DEF_TVA_NON_DEDUCTIBLE); if ( $nd != null && strlen(trim($nd)) != 0 && $nd != 0 ) @@ -136,9 +160,9 @@ echo_debug('user_common.php',__LINE__,"ComputeTotalVat $a_fiche $a_quant $a_pric // if tva amount is given we do not compute it if ( $a_vat_amount != null && $a_vat_amount[$idx] != 0 ) - $nd_amount=round($vat_amount*$nd,2); + $nd_amount=round($a_vat_amount[$idx]*$nd,2); else - $nd_amount=round($a_price[$idx]*$a_vat['tva_rate']*$a_quant[$idx]*$nd,2); + $nd_amount=round($base*$nd,2); // problem with round @@ -159,7 +183,7 @@ echo_debug('user_common.php',__LINE__,"ComputeTotalVat $a_fiche $a_quant $a_pric $a_vat_amount[$idx] != 0 ) $nd_amount2=round($a_vat_amount[$idx]*$nd,2); else - $nd_amount2=round($a_price[$idx]*$a_vat['tva_rate']*$a_quant[$idx]*$nd,2); + $nd_amount2=round($base*$nd,2); $vat_amount=$vat_amount-$nd_amount2; // when using both vat, their sum cannot exceed 1, if = 1 then vat = 0 @@ -438,7 +462,7 @@ $sort_echeance=" $image_ascEch $sql_fin="("; $or=""; foreach ($a_parm_code as $code) { - $sql_fin.="$or j_poste like '".$code['p_value']."%'"; + $sql_fin.="$or j_poste::text like '".$code['p_value']."%'"; $or=" or "; } $sql_fin.=")"; @@ -545,7 +569,7 @@ $sort_echeance=" $image_ascEch $l_poste=FormatString($l_poste); if ( $l_poste != null ) { $sql.=$l_and." jr_grpt_id in (select j_grpt - from jrnx where j_poste like '$l_poste' ) "; + from jrnx where j_poste::text like '$l_poste' ) "; $l_and=" and "; } // Quick Code @@ -729,10 +753,11 @@ $sort_echeance=" $image_ascEch if ( $row['jr_pj_name'] != "") { $image=''; - $r.="".sprintf('%s', + $r.="".sprintf('%s', $p_jrn, $row['jr_grpt_id'], - $str_dossier, + $str_dossier, + $_REQUEST['PHPSESSID'], $image) .""; } diff --git a/include/user_form_ach.php b/include/user_form_ach.php index 0b11a47be..4c5533627 100644 --- a/include/user_form_ach.php +++ b/include/user_form_ach.php @@ -492,7 +492,7 @@ function form_verify_input($p_cn,$p_jrn,$p_periode,$p_array,$p_number) $per->set_jrn($p_jrn); $per->set_periode($p_periode); - // Periode fermé + // Periode ferme if ( $per->is_open() == 0) { $msg="Cette periode est fermee pour ce journal"; @@ -833,6 +833,8 @@ function RecordSell($p_cn,$p_array,$p_user,$p_jrn) $aNd_amount[$i]=0.0; $aTva_ded_impot[$i]=0.0; $aTva_ded_impot_recup[$i]=0.0; + $aDep_priv[$i]=0.0; + $poste=GetFicheAttribut($p_cn,$a_good[$i],ATTR_DEF_ACCOUNT); @@ -840,26 +842,51 @@ function RecordSell($p_cn,$p_array,$p_user,$p_jrn) if ( $a_price[$i]*$a_quant[$i] == 0 ) continue; $amount=$a_price[$i]*$a_quant[$i]; - //We don't compute vat if it's given - $lvat=($a_vat_amount[$i]==0)?ComputeVat($p_cn,$a_good[$i],$a_quant[$i],$a_price[$i], $a_vat_good[$i],$a_vat_amount[$i] ):$a_vat_amount[$i]; - + //We don't compute vat if it's given + $lvat=($a_vat_amount[$i]==0)?ComputeVat($p_cn,$a_good[$i],$a_quant[$i],$a_price[$i], $a_vat_good[$i],$a_vat_amount[$i] ):$a_vat_amount[$i]; + //---------------------------------------------------------------------- // Put the non deductible part into a special account $non_dedu=GetFicheAttribut($p_cn,$a_good[$i],ATTR_DEF_DEPENSE_NON_DEDUCTIBLE); echo_debug('user_form_ach.php',__LINE__,"value non ded : $non_dedu"); if ( $non_dedu != null && strlen(trim($non_dedu)) != 0) - { - // if vat if given we use it to compute ND - $nd_amount=($a_vat_amount[$i]==0)?round($a_quant[$i]*$a_price[$i]*$non_dedu,2):round($a_vat_amount*$non_dedu,2); - - // save it - echo_debug('user_form_ach.php',__LINE__,"InsertJrnx($p_cn,'d',$p_user->id,$p_jrn,'6740',$e_date,round($nd_amount,2),$seq,$periode);"); - $dna=new parm_code($p_cn,'DNA'); - $j_id=InsertJrnx($p_cn,'d',$p_user->id,$p_jrn,$dna->p_value,$e_date,round($nd_amount,2),$seq,$periode); - $amount=$amount-$nd_amount; - - // save the ND in an array (for the easy view) - $aNd_amount[$i]=$nd_amount; - } + { + // this doens't concern the vat + $nd_amount=round($a_quant[$i]*$a_price[$i]*$non_dedu,2); + // save it + echo_debug('user_form_ach.php',__LINE__,"InsertJrnx($p_cn,'d',$p_user->id,$p_jrn,'6740',$e_date,round($nd_amount,2),$seq,$periode);"); + $dna=new parm_code($p_cn,'DNA'); + $j_id=InsertJrnx($p_cn,'d',$p_user->id,$p_jrn,$dna->p_value,$e_date,round($nd_amount,2),$seq,$periode); + $amount=$amount-$nd_amount; + + // save the ND in an array (for the easy view) + $aNd_amount[$i]=$nd_amount; + } + //---------------------------------------------------------------------- + // Put the non deductible part into a special account + $non_dedu=GetFicheAttribut($p_cn,$a_good[$i],ATTR_DEF_DEP_PRIV); + echo_debug('user_form_ach.php',__LINE__,"value non ded : $non_dedu"); + if ( $non_dedu != null && strlen(trim($non_dedu)) != 0) + { + // Remove also the vat + $nd_amount=round($a_quant[$i]*$a_price[$i]*$non_dedu,2); + $tva_nd=round($lvat*$non_dedu,2); + $nd_amount+=$tva_nd; + + // save it + $dna=new parm_code($p_cn,'DEP_PRIV'); + $j_id=InsertJrnx($p_cn,'d',$p_user->id,$p_jrn,$dna->p_value,$e_date,round($nd_amount,2),$seq,$periode); + + // modify sum + $amount=$amount-$nd_amount+$tva_nd; + $lvat-=$tva_nd; + + $sum_tva_nd+=$tva_nd; + + // save the ND in an array (for the easy view) + $aDep_priv[$i]=$nd_amount; + } + + //---------------------------------------------------------------------- // Put the non deductible part into a special account $non_dedu=GetFicheAttribut($p_cn,$a_good[$i],ATTR_DEF_TVA_NON_DEDUCTIBLE); echo_debug('user_form_ach.php',__LINE__,"TVA value non ded : $non_dedu"); @@ -877,27 +904,27 @@ function RecordSell($p_cn,$p_array,$p_user,$p_jrn) $j_id=InsertJrnx($p_cn,'d',$p_user->id,$p_jrn,$tva_dna->p_value,$e_date,round($ded_vat,2),$seq,$periode); } - + //---------------------------------------------------------------------- // Put the non deductible part into a special account $non_dedu=GetFicheAttribut($p_cn,$a_good[$i],ATTR_DEF_TVA_NON_DEDUCTIBLE_RECUP); echo_debug('user_form_ach.php',__LINE__,"TVA value non ded : $non_dedu"); if ( $non_dedu != null && strlen(trim($non_dedu)) != 0 ) - { - - $ded_vat=($lvat != null )?$lvat*$non_dedu:0; - - $sum_tva_nd+=round($ded_vat,2); - $aTva_ded_impot_recup[$i]=round($ded_vat,2); - - // Save it - $tva_ded_impot=new parm_code($p_cn,'TVA_DED_IMPOT'); - echo_debug('user_form_ach.php',__LINE__, - "InsertJrnx($p_cn,'d',$p_user->id,$p_jrn,".$tva_ded_impot->p_value.",$e_date,round($ded_vat,2),$seq,$periode);"); - - $j_id=InsertJrnx($p_cn,'d',$p_user->id,$p_jrn,$tva_ded_impot->p_value,$e_date,round($ded_vat,2),$seq,$periode); - } + { + $ded_vat=($lvat != null )?$lvat*$non_dedu:0; + + $sum_tva_nd+=round($ded_vat,2); + $aTva_ded_impot_recup[$i]=round($ded_vat,2); + + // Save it + $tva_ded_impot=new parm_code($p_cn,'TVA_DED_IMPOT'); + echo_debug('user_form_ach.php',__LINE__, + "InsertJrnx($p_cn,'d',$p_user->id,$p_jrn,".$tva_ded_impot->p_value.",$e_date,round($ded_vat,2),$seq,$periode);"); + + $j_id=InsertJrnx($p_cn,'d',$p_user->id,$p_jrn,$tva_ded_impot->p_value,$e_date,round($ded_vat,2),$seq,$periode); + } + //---------------------------------------------------------------------- @@ -905,7 +932,7 @@ function RecordSell($p_cn,$p_array,$p_user,$p_jrn) echo_debug('user_form_ach.php',__LINE__,"InsertJrnx($p_cn,'d',$p_user->id,$p_jrn,$poste,$e_date,round($amount,2),$seq,$periode);"); $j_id=InsertJrnx($p_cn,'d',$p_user->id,$p_jrn,$poste,$e_date,round($amount,2),$seq,$periode,$a_good[$i]); - /* \brief if the quantity is < 0 then the stock increase (return of + /*! \brief if the quantity is < 0 then the stock increase (return of * material) */ $nNeg=($a_quant[$i]<0)?-1:1; @@ -924,53 +951,56 @@ function RecordSell($p_cn,$p_array,$p_user,$p_jrn) $op->oa_description=$comm; $op->save_form_plan($_POST,$i); } - //--------------------------------------------------------- - // insert into quant_purchase - //--------------------------------------------------------- - - echo_debug(__FILE__.":".__LINE__,"a_vat = ",$a_vat); - // echo_debug(__FILE__.":".__LINE__."a_vat[$i] =",$a_vat[$i]); - //!\note - // $a_vat_good[$i] contains the tva_id - // $a_vat_amount[$i] contains the amount of vat - $vat_code=$a_vat_good[$i]; - $computed_vat=$lvat-$aNd_amount[$i]-$aTva_ded_impot[$i]-$aTva_ded_impot_recup[$i]; - $qp_vat=($vat_code==-1)?0:$computed_vat; - - echo_debug('form_ach',__LINE__,"Insert into insert_quant_purchase"); - $r=ExecSql($p_cn,"select insert_quant_purchase ". - "('".$internal."'". - ",".$j_id. - ",'".$a_good[$i]."'". - ",".$a_quant[$i].",". - round($amount,2). - ",".$qp_vat. - ",".$vat_code. - ",".$aNd_amount[$i]. - ",".$aTva_ded_impot[$i]. - ",".$aTva_ded_impot_recup[$i]. - ",'".$e_client."')"); - - + //--------------------------------------------------------- + // insert into quant_purchase + //--------------------------------------------------------- + + echo_debug(__FILE__.":".__LINE__,"a_vat = ",$a_vat); + // echo_debug(__FILE__.":".__LINE__."a_vat[$i] =",$a_vat[$i]); + //!\note + // $a_vat_good[$i] contains the tva_id + // $a_vat_amount[$i] contains the amount of vat + $vat_code=$a_vat_good[$i]; + // $computed_vat=$lvat-$aNd_amount[$i]-$aTva_ded_impot[$i]-$aTva_ded_impot_recup[$i]; + $computed_vat=$lvat-$aTva_ded_impot[$i]-$aTva_ded_impot_recup[$i]; + $qp_vat=($vat_code==-1)?0:$computed_vat; + + echo_debug('form_ach',__LINE__,"Insert into insert_quant_purchase"); + $r=ExecSql($p_cn,"select insert_quant_purchase ". + "('".$internal."'". + ",".$j_id. + ",'".$a_good[$i]."'". + ",".$a_quant[$i].",". + round($amount,2). + ",".$qp_vat. + ",".$vat_code. + ",".$aNd_amount[$i]. + ",".$aTva_ded_impot[$i]. + ",".$aTva_ded_impot_recup[$i]. + ",".$aDep_priv[$i]. + ",'".$e_client."')"); + + } // end loop - - // set up internal code for quant_purchase - + + // set up internal code for quant_purchase + // Insert Vat $sum_tva=0.0; if ( $a_vat != null ) // no vat { - echo_debug('user_form_ach',__LINE__,'a_vat = '.var_export($a_vat,true)); - foreach ($a_vat as $tva_id => $e_tva_amount ) - { - echo_debug('user_form_ach',__LINE__," tva_amount = $e_tva_amount tva_id=$tva_id"); - $poste=GetTvaPoste($p_cn,$tva_id,'d'); - if ($e_tva_amount == 0 ) continue; - echo_debug('user_form_ach',__LINE__,"InsertJrnx($p_cn,'d',$p_user->id,$p_jrn,$poste,$e_date,round($e_tva_amount,2),$seq,$periode);"); - $r=InsertJrnx($p_cn,'d',$p_user->id,$p_jrn,$poste,$e_date,round($e_tva_amount,2),$seq,$periode); - $sum_tva+=round($e_tva_amount,2); - } + echo_debug('user_form_ach',__LINE__,'a_vat = '.var_export($a_vat,true)); + foreach ($a_vat as $tva_id => $e_tva_amount ) + { + echo_debug('user_form_ach',__LINE__," tva_amount = $e_tva_amount tva_id=$tva_id"); + if ($e_tva_amount == 0 ) continue; + + $poste=GetTvaPoste($p_cn,$tva_id,'d'); + + $r=InsertJrnx($p_cn,'d',$p_user->id,$p_jrn,$poste,$e_date,round($e_tva_amount,2),$seq,$periode); + $sum_tva+=round($e_tva_amount,2); + } } echo_debug('user_form_ach.php',__LINE__,"echeance = $e_ech"); echo_debug('user_form_ach.php',__LINE__,"sum_tva = $sum_tva"); @@ -984,14 +1014,14 @@ function RecordSell($p_cn,$p_array,$p_user,$p_jrn) $r=InsertJrnx($p_cn,'c',$p_user->id,$p_jrn,$poste,$e_date,round($amount_jrn+$sum_tva+$sum_tva_nd,2),$seq, $periode,$e_client); - + $r=InsertJrn($p_cn,$e_date,$e_ech,$p_jrn,"--",$seq,$periode); // Set Internal code and Comment - $Res=ExecSql($p_cn,"update jrn set jr_internal='".$internal."' where ". + $Res=ExecSql($p_cn,"update jrn set jr_internal='".$internal."' where ". " jr_grpt_id = ".$seq); - + $comment=(FormatString($e_comm) == null )?$internal." Fournisseur : ".GetFicheName($p_cn,$e_client):FormatString($e_comm); // Update and set the invoice's comment @@ -999,14 +1029,14 @@ function RecordSell($p_cn,$p_array,$p_user,$p_jrn) if ( isset ($_FILES)) save_upload_document($p_cn,$seq); - // Save the operation - if ( isset($_POST['opd_save']) && $_POST['opd_save']=='on' ){ - echo_debug(__FILE__.':'.__LINE__.'- ','save opd'); - $opd=new Pre_op_ach($p_cn); - $opd->get_post(); - $opd->save(); + // Save the operation + if ( isset($_POST['opd_save']) && $_POST['opd_save']=='on' ){ + echo_debug(__FILE__.':'.__LINE__.'- ','save opd'); + $opd=new Pre_op_ach($p_cn); + $opd->get_post(); + $opd->save(); echo_debug(__FILE__.':'.__LINE__.'- ',"opd = ",$opd); - } + } } catch (Exception $e) { echo ''. 'Erreur dans l\'enregistrement '. diff --git a/include/user_form_ven.php b/include/user_form_ven.php index d7bc0297c..ed9cc17d4 100644 --- a/include/user_form_ven.php +++ b/include/user_form_ven.php @@ -235,7 +235,7 @@ function FormVenInput($p_cn,$p_jrn,$p_periode,$p_array=null,$pview_only=true,$p_ $Quantity->size=9; //$r.=InputType("","TEXT","e_quant".$i,$quant,$pview_only); $r.=$Quantity->IOValue("e_quant".$i,$quant); - + $r.=""; } @@ -336,8 +336,8 @@ function form_verify_input($p_cn,$p_jrn,$p_periode,$p_array,$p_number) // compare hidden value and computed if ( round($ca_amount-$hidden_amount,2) != 0 ) { - $msg="Montant CA est différent total marchandise"; - $msg.="montant encodé $ca_amount marchandise $hidden_amount"; + $msg="Montant CA est different total marchandise"; + $msg.="montant encode $ca_amount marchandise $hidden_amount"; echo ""; return null; @@ -644,15 +644,19 @@ function FormVenteView ($p_cn,$p_jrn,$p_periode,$p_array,$p_number,$p_doc='form' if ( CountSql($p_cn, "select md_id,md_name from document_modele where md_type=4") > 0 ) { - $r.='Générer une facture '; - // We propose to generate the invoice and some template - $doc_gen=new widget("select"); - $doc_gen->name="gen_doc"; - $doc_gen->value=make_array($p_cn, - "select md_id,md_name from document_modele where md_type=4"); - $r.=$doc_gen->IOValue(); - - $r.="
"; + $r.='
Génération de facture'; + $obj=new widget('TEXT'); + $r.='Numero de bon de commande : '.$obj->IOValue('bon_comm').'
'; + $r.='Autre information : '.$obj->IOValue('other_info').'
'; + + $r.='Générer une facture '; + // We propose to generate the invoice and some template + $doc_gen=new widget("select"); + $doc_gen->name="gen_doc"; + $doc_gen->value=make_array($p_cn, + "select md_id,md_name from document_modele where md_type=4"); + $r.=$doc_gen->IOValue().'
'; + $r.="
"; } } @@ -756,7 +760,7 @@ function RecordInvoice($p_cn,$p_array,$p_user,$p_jrn) // Compute the j_grpt $seq=NextSequence($p_cn,'s_grpt'); -$oJrn=new Acc_Ledger($p_cn,$p_jrn); + $oJrn=new Acc_Ledger($p_cn,$p_jrn); $internal=$oJrn->compute_internal_code($seq); echo_debug(__FILE__,__LINE__,"Dossier is ".dossier::id()); diff --git a/include/user_menu.php b/include/user_menu.php index 9f9ba1859..53c8854ea 100644 --- a/include/user_menu.php +++ b/include/user_menu.php @@ -192,26 +192,7 @@ function ShowMenuCompta($p_high="") $result=ShowItem($p_array,'H',"mtitle","mtitle",$default,' width="100%"'); $str_dossier=dossier::get(); $r=""; - /* - $r.='
'; - $r.="

Comptabilité ".dossier::name()."

"; - $r.='
'; - $r.='
'; - $r.=' - - - - - - - - - - -
'; - */ - // $r.='
'; - $r.=menu_tool(""); + $r.=menu_tool("compta"); $r.='
'; $r.=$result; $r.='
'; @@ -822,15 +803,32 @@ function ShowMenuImport(){ echo ""; } - +/*!\brief show the top menu to access the different modules in top + * \param $p_from from which module this function is called + * \return string +*/ function menu_tool($p_from) { + + if ( ! isset ($_REQUEST['gDossier'])) + return "" ; $r=""; +$r.=''; + + $r.= '
'; $r.= '
'; $r.= "

Commercial ".dossier::name()."

"; $r.= '
'; $r.= '
'; - + if ( $from == 'compta') $view='E'; + else $view='S'; + $agent=$_SERVER['HTTP_USER_AGENT']; $amodule=array( array('value'=>'pref','label'=>'Preference'), @@ -842,20 +840,47 @@ function menu_tool($p_from) { array('value'=>'home','label'=>'Accueil'), array('value'=>'logout','label'=>'Sortir') ); + if ( $_SESSION['g_topmenu'] == 'SELECT' ) { + $gDossier=dossier::id(); + $r.= '
'; + $w=new widget('select'); + $w->name='m'; + $w->value=$amodule; + $r.= ''; + $r.= ''; + $r.= dossier::hidden(); + $r.= ''; + $r.= '
'; - $gDossier=dossier::id(); - $r.= ''; - $w=new widget('select'); - $w->name='m'; - $w->value=$amodule; - $r.= ''; - $r.= ''; - $r.= dossier::hidden(); - $r.= ''; - $r.= '
'; - $r.= ''. - 'Recheche'.$w->IOValue().''.widget::submit('','Acces Direct').'
'; - $r.= ''; - $r.= ''; + $search="openRecherche('".$_REQUEST['PHPSESSID']."','".$gDossier."','".$view."');"; + $r.=''; + $r.='
'.$w->IOValue().''.widget::submit('','Acces Direct').'
'; + $r.= ''; + $r.= '
'; + } + if ( $_SESSION['g_topmenu'] == 'TEXT' ) { + $gDossier=dossier::id(); + $r.= ''; + foreach($amodule as $col ) { + $url="control.php?".dossier::get()."&m=".$col['value']; + if ( $p_from==$col['value']) { + $r.= ''; + + } else { + $r.= ''; + } + + } + $r.=''; + $r.= '
'; + $r.= ''. + 'Recheche'. + ''.$col['label'].''. + ''. + ''.$col['label'].''. + '
'; + $r.= '
'; + } + $r.= '
'; return $r; } diff --git a/scripts/cleanup.sh b/scripts/cleanup.sh index 7dde70fb9..e31397a22 100755 --- a/scripts/cleanup.sh +++ b/scripts/cleanup.sh @@ -1,6 +1,6 @@ #!/bin/bash # clean all phpcompta related DB. -DOMAIN="f31" +DOMAIN="beta_" export PGPASSWORD="dany" export PGUSER="phpcompta" export PGHOST=localhost diff --git a/sql/upgrade.sql b/sql/upgrade.sql index e2e6d36c9..a33282acc 100644 --- a/sql/upgrade.sql +++ b/sql/upgrade.sql @@ -1,720 +1,48 @@ begin; -alter table import_tmp add n_montant numeric(20,4); -update import_tmp set n_montant=to_number(montant,'999999999.99'); -alter table import_tmp drop montant; -alter table import_tmp rename n_montant to montant; --- alter table import_tmp alter montant type numeric(20,4); -alter table import_tmp alter montant set default 0; -alter table import_tmp alter montant set not null; -alter table import_tmp alter code set not null; -alter table import_tmp alter date_exec set not null; -alter table import_tmp alter date_valeur set not null; -COMMENT ON TABLE import_tmp IS 'Table temporaire pour l''importation des banques en format CSV'; -COMMENT ON COLUMN import_tmp.status IS 'Status w waiting, d delete t transfert'; +-- insert into parm_code values ('DEP_PRIV',4890,'Depense à charge du gérant'); +-- insert into attr_def values (31,'Depense à charge du gérant (partie privée)'); +-- alter table quant_purchase add qp_dep_priv numeric(20,4) default 0.0; - -alter table poste_analytique add ga_id varchar (10); - - -CREATE or replace FUNCTION t_document_validate() RETURNS "trigger" +CREATE FUNCTION insert_quant_purchase(p_internal text, p_j_id numeric, p_fiche character varying, p_quant numeric, p_price numeric, p_vat numeric, p_vat_code integer, p_nd_amount numeric, p_nd_tva numeric, p_nd_tva_recup numeric,p_dep_priv numeric , p_client character varying) RETURNS void AS $$ declare - lText text; - modified document%ROWTYPE; + fid_client integer; + fid_good integer; begin - modified:=NEW; - modified.d_filename:=replace(NEW.d_filename,' ','_'); - return modified; + select f_id into fid_client from + attr_value join jnt_fic_att_value using (jft_id) where ad_id=23 and av_text=upper(p_client); + select f_id into fid_good from + attr_value join jnt_fic_att_value using (jft_id) where ad_id=23 and av_text=upper(p_fiche); + insert into quant_purchase + (qp_internal, + j_id, + qp_fiche, + qp_quantite, + qp_price, + qp_vat, + qp_vat_code, + qp_nd_amount, + qp_nd_tva, + qp_nd_tva_recup, + qp_supplier, + qp_dep_priv) + values + (p_internal, + p_j_id, + fid_good, + p_quant, + p_price, + p_vat, + p_vat_code, + p_nd_amount, + p_nd_tva, + p_nd_tva_recup, + fid_client, + p_dep_priv); + return; end; -$$ + $$ LANGUAGE plpgsql; - -CREATE or replace FUNCTION t_document_type_insert() RETURNS "trigger" - AS $$ -declare -nCounter integer; - BEGIN -select count(*) into nCounter from pg_class where relname='seq_doc_type_'||NEW.dt_id; -if nCounter = 0 then - execute 'create sequence seq_doc_type_'||NEW.dt_id; -end if; - RETURN NEW; - END; -$$ - LANGUAGE plpgsql; - -CREATE or replace FUNCTION t_document_modele_validate() RETURNS "trigger" - AS $$ -declare - lText text; - modified document_modele%ROWTYPE; -begin - modified:=NEW; - - modified.md_filename:=replace(NEW.md_filename,' ','_'); - return modified; -end; -$$ - LANGUAGE plpgsql; - - -CREATE TABLE groupe_analytique -( - ga_id varchar(10) NOT NULL, - pa_id int, - ga_description text, - CONSTRAINT pk_ga_id PRIMARY KEY (ga_id) -) ; - - -CREATE OR REPLACE FUNCTION group_analytic_ins_upd() - RETURNS "trigger" AS -$BODY$ -declare -name text; -begin -name:=upper(NEW.ga_id); -name:=trim(name); -name:=replace(name,' ',''); -NEW.ga_id:=name; -return NEW; -end;$BODY$ - LANGUAGE 'plpgsql' VOLATILE; - -CREATE OR REPLACE FUNCTION group_analytique_del() - RETURNS "trigger" AS -$BODY$ -begin -update poste_analytique set ga_id=null -where ga_id=OLD.ga_id; -return OLD; -end;$BODY$ - LANGUAGE 'plpgsql' VOLATILE; - -CREATE OR REPLACE FUNCTION poste_analytique_ins_upd() - RETURNS "trigger" AS -$BODY$declare -name text; -rCount record; - -begin -name:=upper(NEW.po_name); -name:=trim(name); -name:=replace(name,' ',''); -NEW.po_name:=name; - -if NEW.ga_id is NULL then -return NEW; -end if; - -if length(trim(NEW.ga_id)) = 0 then - NEW.ga_id:=NULL; - return NEW; -end if; -perform 'select ga_id from groupe_analytique where ga_id='||NEW.ga_id; -if NOT FOUND then - raise exception' Inexistent Group Analytic %',NEW.ga_id; -end if; -return NEW; -end;$BODY$ - LANGUAGE 'plpgsql' VOLATILE; - -CREATE OR REPLACE FUNCTION plan_analytic_ins_upd() - RETURNS "trigger" AS -$BODY$ -declare - name text; -begin - name:=upper(NEW.pa_name); - name:=trim(name); - name:=replace(name,' ',''); - NEW.pa_name:=name; -return NEW; -end; -$BODY$ - LANGUAGE 'plpgsql' VOLATILE; - -CREATE TRIGGER t_poste_analytique_ins_upd - BEFORE INSERT OR UPDATE - ON poste_analytique - FOR EACH ROW - EXECUTE PROCEDURE poste_analytique_ins_upd(); - -CREATE TRIGGER t_plan_analytique_ins_upd - BEFORE INSERT OR UPDATE - ON plan_analytique - FOR EACH ROW - EXECUTE PROCEDURE plan_analytic_ins_upd(); - -CREATE TRIGGER t_group_analytic_del - before DELETE - ON groupe_analytique - FOR EACH ROW - EXECUTE PROCEDURE group_analytique_del(); - -CREATE TRIGGER t_group_analytic_ins_upd - BEFORE INSERT OR UPDATE - ON groupe_analytique - FOR EACH ROW - EXECUTE PROCEDURE group_analytic_ins_upd(); - - -drop TRIGGER t_upper_pa_name on plan_analytique; -drop TRIGGER t_upper_po_name on poste_analytique; -drop function upper_pa_name(); -drop function upper_po_name(); - -CREATE TABLE bud_hypothese -( - bh_id int4 NOT NULL, - bh_name text NOT NULL, - bh_saldo numeric(20,4) DEFAULT 0, - bh_description text, - pa_id int4, - CONSTRAINT pk_bud_hypo PRIMARY KEY (bh_id), - CONSTRAINT fk_bud_hypo_pa_id FOREIGN KEY (pa_id) - REFERENCES plan_analytique (pa_id) MATCH SIMPLE - ON UPDATE CASCADE ON DELETE CASCADE -) -WITHOUT OIDS; - -create sequence seq_bud_hypothese_bh_id; - -alter table bud_hypothese alter bh_id set default nextval('seq_bud_hypothese_bh_id'); - --- --- Name: bud_card; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace: --- - -CREATE TABLE bud_card ( - bc_id integer NOT NULL, - bc_code character varying(10) NOT NULL, - bc_description text, - bc_price_unit numeric(20,4) DEFAULT 0.0 NOT NULL, - bc_unit character varying(20), - bh_id integer -); --- --- Name: TABLE bud_card; Type: COMMENT; Schema: public; Owner: phpcompta --- - -COMMENT ON TABLE bud_card IS 'card for budget module'; - - --- --- Name: COLUMN bud_card.bh_id; Type: COMMENT; Schema: public; Owner: phpcompta --- - -COMMENT ON COLUMN bud_card.bh_id IS 'fk to bud_hypothese'; - - --- --- Name: bud_card_bc_id_seq; Type: SEQUENCE; Schema: public; Owner: phpcompta --- - -CREATE SEQUENCE bud_card_bc_id_seq - INCREMENT BY 1 - NO MAXVALUE - NO MINVALUE - CACHE 1; - - -ALTER TABLE public.bud_card_bc_id_seq OWNER TO phpcompta; - --- --- Name: bud_card_bc_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: phpcompta --- - -ALTER SEQUENCE bud_card_bc_id_seq OWNED BY bud_card.bc_id; - - --- --- Name: bc_id; Type: DEFAULT; Schema: public; Owner: phpcompta --- - -ALTER TABLE bud_card ALTER COLUMN bc_id SET DEFAULT nextval('bud_card_bc_id_seq'::regclass); - - --- --- Name: pk_bud_card_bc_id; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace: --- - -ALTER TABLE ONLY bud_card - ADD CONSTRAINT pk_bud_card_bc_id PRIMARY KEY (bc_id); - - --- --- Name: uq_bud_card_bc_code; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace: --- - -ALTER TABLE ONLY bud_card - ADD CONSTRAINT uq_bud_card_bc_code_bh_id UNIQUE (bc_code,bh_id); - -ALTER TABLE bud_card ADD CONSTRAINT fk_bud_hypo_bh_id FOREIGN KEY (bh_id) REFERENCES bud_hypothese (bh_id) - ON UPDATE CASCADE ON DELETE CASCADE; -CREATE INDEX fki_bud_hypo_bh_id ON bud_card(bh_id); -ALTER TABLE bud_card ALTER COLUMN bh_id SET NOT NULL; - - - --- --- Name: bud_detail; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace: --- - -CREATE TABLE bud_detail ( - bd_id integer NOT NULL, - po_id integer, - bc_id integer, - bh_id integer, - pcm_val poste_comptable -); - - -ALTER TABLE public.bud_detail OWNER TO phpcompta; - --- --- Name: TABLE bud_detail; Type: COMMENT; Schema: public; Owner: phpcompta --- - -COMMENT ON TABLE bud_detail IS 'Detail for card '; - - --- --- Name: COLUMN bud_detail.bd_id; Type: COMMENT; Schema: public; Owner: phpcompta --- - -COMMENT ON COLUMN bud_detail.bd_id IS 'primary key'; - - --- --- Name: COLUMN bud_detail.po_id; Type: COMMENT; Schema: public; Owner: phpcompta --- - -COMMENT ON COLUMN bud_detail.po_id IS 'FK to poste_analytique'; - - --- --- Name: COLUMN bud_detail.bc_id; Type: COMMENT; Schema: public; Owner: phpcompta --- - -COMMENT ON COLUMN bud_detail.bc_id IS 'fk to bud_card'; - - --- --- Name: COLUMN bud_detail.pcm_val; Type: COMMENT; Schema: public; Owner: phpcompta --- - -COMMENT ON COLUMN bud_detail.pcm_val IS 'fk to tmp_pcmn'; - - --- --- Name: bud_detail_bd_id_seq; Type: SEQUENCE; Schema: public; Owner: phpcompta --- - -CREATE SEQUENCE bud_detail_bd_id_seq - INCREMENT BY 1 - NO MAXVALUE - NO MINVALUE - CACHE 1; - - -ALTER TABLE public.bud_detail_bd_id_seq OWNER TO phpcompta; - --- --- Name: bud_detail_bd_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: phpcompta --- - -ALTER SEQUENCE bud_detail_bd_id_seq OWNED BY bud_detail.bd_id; - - --- --- Name: bd_id; Type: DEFAULT; Schema: public; Owner: phpcompta --- - -ALTER TABLE bud_detail ALTER COLUMN bd_id SET DEFAULT nextval('bud_detail_bd_id_seq'::regclass); - - --- --- Name: pk_bud_detail; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace: --- - -ALTER TABLE ONLY bud_detail - ADD CONSTRAINT pk_bud_detail PRIMARY KEY (bd_id); - - --- --- Name: fki_bud_card; Type: INDEX; Schema: public; Owner: phpcompta; Tablespace: --- - -CREATE INDEX fki_bud_card ON bud_detail USING btree (bc_id); - - --- --- Name: fki_tmp_pcmn; Type: INDEX; Schema: public; Owner: phpcompta; Tablespace: --- - -CREATE INDEX fki_tmp_pcmn ON bud_detail USING btree (pcm_val); - - --- --- Name: fk_bud_card; Type: FK CONSTRAINT; Schema: public; Owner: phpcompta --- - -ALTER TABLE ONLY bud_detail - ADD CONSTRAINT fk_bud_card FOREIGN KEY (bc_id) REFERENCES bud_card(bc_id) ON UPDATE CASCADE ON DELETE CASCADE;; - -ALTER TABLE ONLY bud_detail - add constraint fk_bud_hypothese_not_null FOREIGN KEY (bh_id) REFERENCES bud_hypothese(bh_id) ON UPDATE CASCADE ON DELETE CASCADE;; - - --- --- Name: fk_tmp_pcmn; Type: FK CONSTRAINT; Schema: public; Owner: phpcompta --- - -ALTER TABLE ONLY bud_detail - ADD CONSTRAINT fk_tmp_pcmn FOREIGN KEY (pcm_val) REFERENCES tmp_pcmn(pcm_val) ON UPDATE CASCADE ON DELETE CASCADE; --- --- Name: bud_detail_periode; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace: --- - -CREATE TABLE bud_detail_periode ( - bdp_id integer NOT NULL, - bdp_amount numeric(20,4) DEFAULT 0.0, - p_id integer NOT NULL, - bd_id integer -); - - -ALTER TABLE public.bud_detail_periode OWNER TO phpcompta; - --- --- Name: TABLE bud_detail_periode; Type: COMMENT; Schema: public; Owner: phpcompta --- - -COMMENT ON TABLE bud_detail_periode IS 'Module budget detail by periode'; - - --- --- Name: COLUMN bud_detail_periode.p_id; Type: COMMENT; Schema: public; Owner: phpcompta --- - -COMMENT ON COLUMN bud_detail_periode.p_id IS 'fk to parm_periode'; - - --- --- Name: COLUMN bud_detail_periode.bd_id; Type: COMMENT; Schema: public; Owner: phpcompta --- - -COMMENT ON COLUMN bud_detail_periode.bd_id IS 'fk to bud_detail'; - - --- --- Name: bud_detail_periode_bdp_id_seq; Type: SEQUENCE; Schema: public; Owner: phpcompta --- - -CREATE SEQUENCE bud_detail_periode_bdp_id_seq - START WITH 1 - INCREMENT BY 1 - NO MAXVALUE - NO MINVALUE - CACHE 1; - - -ALTER TABLE public.bud_detail_periode_bdp_id_seq OWNER TO phpcompta; - --- --- Name: bud_detail_periode_bdp_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: phpcompta --- - -ALTER SEQUENCE bud_detail_periode_bdp_id_seq OWNED BY bud_detail_periode.bdp_id; - - --- --- Name: bdp_id; Type: DEFAULT; Schema: public; Owner: phpcompta --- - -ALTER TABLE bud_detail_periode ALTER COLUMN bdp_id SET DEFAULT nextval('bud_detail_periode_bdp_id_seq'::regclass); - - --- --- Name: pk_budget_detail_period; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace: --- - -ALTER TABLE ONLY bud_detail_periode - ADD CONSTRAINT pk_budget_detail_period PRIMARY KEY (bdp_id); - - --- --- Name: fk_bud_detail_bd_id; Type: FK CONSTRAINT; Schema: public; Owner: phpcompta --- - -ALTER TABLE ONLY bud_detail_periode - ADD CONSTRAINT fk_bud_detail_bd_id FOREIGN KEY (bd_id) REFERENCES bud_detail(bd_id) ON UPDATE CASCADE ON DELETE CASCADE; - - --- --- Name: fk_parm_periode; Type: FK CONSTRAINT; Schema: public; Owner: phpcompta --- - -ALTER TABLE ONLY bud_detail_periode - ADD CONSTRAINT fk_parm_periode FOREIGN KEY (p_id) REFERENCES parm_periode(p_id) ON UPDATE CASCADE ON DELETE CASCADE; - - - -CREATE OR REPLACE FUNCTION bud_detail_ins_upd() - RETURNS "trigger" AS -$BODY$declare -mline bud_detail%ROWTYPE; -begin -mline:=NEW; -if mline.po_id = -1 then - mline.po_id:=NULL; -end if; -return mline; -end;$BODY$ - LANGUAGE 'plpgsql' VOLATILE; - - -CREATE OR REPLACE FUNCTION bud_card_ins_upd() - RETURNS "trigger" AS -$BODY$declare - sCode text; -begin - -sCode:=trim(upper(NEW.bc_code)); -sCode:=replace(sCode,' ','_'); -sCode:=substr(sCode,1,10); -NEW.bc_code:=sCode; -return NEW; -end;$BODY$ - LANGUAGE 'plpgsql' VOLATILE; -ALTER FUNCTION bud_card_ins_upd() OWNER TO phpcompta; - --- --- Name: t_bud_card_ins_up; Type: TRIGGER; Schema: public; Owner: phpcompta --- - -CREATE TRIGGER t_bud_card_ins_up - BEFORE INSERT OR UPDATE ON bud_card - FOR EACH ROW - EXECUTE PROCEDURE bud_card_ins_upd(); - - --- --- Name: bud_hypothese_bh_id; Type: FK CONSTRAINT; Schema: public; Owner: phpcompta --- - -ALTER TABLE ONLY bud_card - ADD CONSTRAINT bud_hypothese_bh_id FOREIGN KEY (bh_id) REFERENCES bud_hypothese(bh_id) ON UPDATE CASCADE ON DELETE CASCADE; - - -CREATE TRIGGER t_bud_detail_ins_upd - BEFORE INSERT OR UPDATE - ON bud_detail - FOR EACH ROW - EXECUTE PROCEDURE bud_detail_ins_upd(); - - - -CREATE TABLE jrn_periode -( - jrn_def_id int4 NOT NULL, - p_id int4 NOT NULL, - status text, - CONSTRAINT jrn_periode_pk PRIMARY KEY (jrn_def_id, p_id), - CONSTRAINT jrn_per_jrn_def_id FOREIGN KEY (jrn_def_id) - REFERENCES jrn_def (jrn_def_id) MATCH SIMPLE - ON UPDATE CASCADE ON DELETE CASCADE, - CONSTRAINT jrn_periode_p_id FOREIGN KEY (p_id) - REFERENCES parm_periode (p_id) MATCH SIMPLE - ON UPDATE CASCADE ON DELETE CASCADE -); - -insert into jrn_periode(p_id,jrn_def_id,status) select p_id,jrn_def_id, - case when p_central='t' then 'CE' - when p_closed='t' then 'CL' - else 'OP' - end -from -parm_periode cross join jrn_def; - -CREATE OR REPLACE FUNCTION jrn_def_add() - RETURNS "trigger" AS -$BODY$begin -execute 'insert into jrn_periode(p_id,jrn_def_id,status) select p_id,'||NEW.jrn_def_id||', - case when p_central=true then ''CE'' - when p_closed=true then ''CL'' - else ''OP'' - end -from -parm_periode '; -return NEW; -end;$BODY$ - LANGUAGE 'plpgsql' VOLATILE; - -CREATE TRIGGER t_jrn_def_add_periode - AFTER INSERT - ON jrn_def - FOR EACH ROW - EXECUTE PROCEDURE jrn_def_add(); - -CREATE OR REPLACE FUNCTION jrn_check_periode() - RETURNS "trigger" AS -$BODY$ -declare -bClosed bool; -str_status text; -begin - -select p_closed into bClosed from parm_periode - where p_id=NEW.jr_tech_per; - -if bClosed = true then - raise exception 'Periode fermee'; -end if; - -select status into str_status from jrn_periode - where p_id =NEW.jr_tech_per and jrn_def_id=NEW.jr_def_id; - -if str_status <> 'OP' then - raise exception 'Periode fermee'; -end if; - -return NEW; -end;$BODY$ - LANGUAGE 'plpgsql' VOLATILE; - - -CREATE TRIGGER t_check_jrn - BEFORE INSERT OR DELETE - ON jrn - FOR EACH ROW - EXECUTE PROCEDURE jrn_check_periode(); - -drop TRIGGER tr_jrn_check_balance on jrn; - -CREATE OR REPLACE FUNCTION jrn_def_delete() - RETURNS "trigger" AS -$BODY$ -declare -nb numeric; -begin -select count(*) into nb from jrn where jr_def_id=OLD.jrn_def_id; - -if nb <> 0 then - raise exception 'EFFACEMENT INTERDIT: JOURNAL UTILISE'; -end if; -return OLD; -end;$BODY$ - LANGUAGE 'plpgsql' VOLATILE; - - -CREATE TRIGGER t_jrn_def_delete - BEFORE DELETE - ON jrn_def - FOR EACH ROW - EXECUTE PROCEDURE jrn_def_delete(); - -CREATE OR REPLACE FUNCTION proc_check_balance() - RETURNS "trigger" AS -$BODY$ -declare - diff numeric; - tt integer; -begin - if TG_OP = 'INSERT' or TG_OP='UPDATE' then - tt=NEW.jr_grpt_id; - diff:=check_balance(tt); - if diff != 0 then - raise exception 'balance error %',diff ; - end if; - return NEW; - end if; -end; -$BODY$ - LANGUAGE 'plpgsql' VOLATILE; - -CREATE TRIGGER t_check_balance - AFTER INSERT OR UPDATE - ON jrn - FOR EACH ROW - EXECUTE PROCEDURE proc_check_balance(); - -INSERT INTO "action" (ac_id, ac_description) VALUES (60, 'Module Budget'); -alter table tmp_pcmn add column pcm_type text; -ALTER TABLE tmp_pcmn ALTER COLUMN pcm_type set default NULL; - - -CREATE TABLE parm_poste ( - p_value poste_comptable NOT NULL, - p_type text NOT NULL -); - - --- --- Name: TABLE parm_poste; Type: COMMENT; Schema: public; Owner: postgres --- - -COMMENT ON TABLE parm_poste IS 'Contains data for finding is the type of the account (asset)'; - - --- --- Name: parm_poste_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: --- - -ALTER TABLE ONLY parm_poste - ADD CONSTRAINT parm_poste_pkey PRIMARY KEY (p_value); - - - -CREATE OR REPLACE FUNCTION find_pcm_type(pp_value "numeric") - RETURNS text AS -$BODY$ -declare - str_type text; - str_value text; - n_value numeric; - nLength integer; -begin - str_value:=trim(to_char(pp_value,'99999999999999999999999999999')); - nLength:=length(str_value); - while nLength > 0 loop - n_value:=to_number(str_value,'99999999999999999999999999999'); - select into str_type p_type from parm_poste where p_value=n_value; - if FOUND then - return str_type; - end if; - nLength:=nLength-1; - str_value:=substring(str_value from 1 for nLength); - end loop; -return 'CON'; -end; -$BODY$ - LANGUAGE 'plpgsql' VOLATILE; - -CREATE OR REPLACE FUNCTION tmp_pcmn_ins() - RETURNS "trigger" AS -$BODY$ -declare - r_record tmp_pcmn%ROWTYPE; -begin -r_record=NEW; -if length(trim(r_record.pcm_type))=0 or r_record.pcm_type is NULL then - r_record.pcm_type:=find_pcm_type(NEW.pcm_val); - return r_record; -end if; -return NEW; -end; -$BODY$ - LANGUAGE 'plpgsql' VOLATILE; - -CREATE TRIGGER t_tmp_pcmn_ins - BEFORE INSERT - ON tmp_pcmn - FOR EACH ROW - EXECUTE PROCEDURE tmp_pcmn_ins(); - -update tmp_pcmn set pcm_type=find_pcm_type(pcm_val); -commit; +commit;