svn+ssh://ns352270.ovh.net/svn/phpcompta/tags/rel601 ........ r4810 | danydb | 2012-04-24 20:55:23 +0200 (Tue, 24 Apr 2012) | 3 lines Removed merge tracking for "svnmerge" for svn+ssh://danydb@ns352270.ovh.net/svn/phpcompta/tags/rel600 ........ r4813 | danydb | 2012-04-24 20:58:20 +0200 (Tue, 24 Apr 2012) | 1 line change SQL ........ r4814 | danydb | 2012-04-24 21:33:02 +0200 (Tue, 24 Apr 2012) | 2 lines Fix bug predefined operation for misc ledger ........ r4815 | danydb | 2012-04-24 21:33:27 +0200 (Tue, 24 Apr 2012) | 3 lines Fix bug predefined operation for misc ledger Fix bug for check_balance (null value) ........ r4816 | danydb | 2012-04-24 21:51:04 +0200 (Tue, 24 Apr 2012) | 1 line fix bug : rounded value ........ r4817 | danydb | 2012-05-01 16:49:39 +0200 (Tue, 01 May 2012) | 2 lines #569 réécriture des menus fournisseur, client et adm ........ r4818 | danydb | 2012-05-01 16:51:35 +0200 (Tue, 01 May 2012) | 2 lines #568: Impossible d'ajouter une fiche BANQUE dans ADM ........ r4819 | danydb | 2012-05-01 16:53:12 +0200 (Tue, 01 May 2012) | 2 lines #570: Ajout d'un menu contact ........ r4820 | danydb | 2012-05-01 16:53:46 +0200 (Tue, 01 May 2012) | 1 line cosmetic : message d'erreur quand on veut ajouter une fiche dans catégorie non existante ........ r4821 | danydb | 2012-05-01 18:38:34 +0200 (Tue, 01 May 2012) | 1 line code : dead code ........
52 lines
1.3 KiB
PL/PgSQL
52 lines
1.3 KiB
PL/PgSQL
CREATE OR REPLACE FUNCTION comptaproc.check_balance(p_grpt integer)
|
|
RETURNS numeric AS
|
|
$BODY$
|
|
declare
|
|
amount_jrnx_debit numeric;
|
|
amount_jrnx_credit numeric;
|
|
amount_jrn numeric;
|
|
begin
|
|
select coalesce(sum (j_montant),0) into amount_jrnx_credit
|
|
from jrnx
|
|
where
|
|
j_grpt=p_grpt
|
|
and j_debit=false;
|
|
|
|
select coalesce(sum (j_montant),0) into amount_jrnx_debit
|
|
from jrnx
|
|
where
|
|
j_grpt=p_grpt
|
|
and j_debit=true;
|
|
|
|
select coalesce(jr_montant,0) into amount_jrn
|
|
from jrn
|
|
where
|
|
jr_grpt_id=p_grpt;
|
|
|
|
if ( amount_jrnx_debit != amount_jrnx_credit )
|
|
then
|
|
return abs(amount_jrnx_debit-amount_jrnx_credit);
|
|
end if;
|
|
if ( amount_jrn != amount_jrnx_credit)
|
|
then
|
|
return -1*abs(amount_jrn - amount_jrnx_credit);
|
|
end if;
|
|
return 0;
|
|
end;
|
|
$BODY$
|
|
LANGUAGE plpgsql;
|
|
|
|
update op_predef set od_direct='t' where od_jrn_type='ODS';
|
|
|
|
INSERT INTO menu_ref(
|
|
me_code, me_menu, me_file, me_url, me_description, me_parameter,
|
|
me_javascript, me_type)
|
|
VALUES ('BK', 'Banque', 'bank.inc.php', null, 'Information Banque', null,null,'ME');
|
|
|
|
INSERT INTO profile_menu(
|
|
me_code, me_code_dep, p_id, p_order, p_type_display, pm_default)
|
|
VALUES ('BK', 'GESTION', 1, 4, 'E', 0);
|
|
INSERT INTO profile_menu(
|
|
me_code, me_code_dep, p_id, p_order, p_type_display, pm_default)
|
|
VALUES ('BK', 'GESTION', 2, 4, 'E', 0);
|
|
|