From f2cbfd77d3b4694324f6e3b66fdc2dc3fd536739 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sun, 13 Nov 2011 17:28:49 +0000 Subject: [PATCH] Ajout PU pour detail ach & ven ajout ajax pour direct form --- html/direct.php | 19 +++++ include/dashboard.inc.php | 12 --- include/template/dashboard.php | 106 ++++++------------------- include/template/ledger_detail_ach.php | 5 +- include/template/ledger_detail_ven.php | 45 ++++++----- include/template/module.php | 4 +- sql/ajax-direct-form.sql | 63 +++++++++++---- sql/upgrade.sql | 1 + 8 files changed, 122 insertions(+), 133 deletions(-) create mode 100644 html/direct.php diff --git a/html/direct.php b/html/direct.php new file mode 100644 index 000000000..4c6b54044 --- /dev/null +++ b/html/direct.php @@ -0,0 +1,19 @@ +Check(); +$user->check_dossier($_GET['gDossier']); +$res=$cn->exec_sql("select code,description from get_profile_menu($1) where code ~* $2 limit 8",array($user->login,$_POST['acs'])); +$nb=Database::num_row($res); + echo ""; +?> diff --git a/include/dashboard.inc.php b/include/dashboard.inc.php index 4df605a12..81e53cca6 100644 --- a/include/dashboard.inc.php +++ b/include/dashboard.inc.php @@ -17,18 +17,6 @@ global $g_user; /* others report */ $cal=new Calendar(); $cal->get_preference(); -$Ledger=new Acc_Ledger($cn,0); -$last_ledger=array(); -if ( $g_user->check_action(GESTION)==1) - { - $Operation=new Follow_Up($cn); - $last_ledger=$Ledger->get_last(10); - $last_operation=$Operation->get_last(10); - } -else - { - $last_operation=array(); - } ob_start(); require_once('template/dashboard.php'); $ret=ob_get_contents(); diff --git a/include/template/dashboard.php b/include/template/dashboard.php index c28662f38..27855958c 100644 --- a/include/template/dashboard.php +++ b/include/template/dashboard.php @@ -1,10 +1,11 @@ -
+
+
display(); ?>
-
+ load_all(); -echo '
'; -echo '
'; +?> +
+ + +id='p_date_todo'; $wTitle=new IText('p_title'); $wDesc=new ITextArea('p_desc'); $wDesc->heigh=5; $wDesc->width=40; +echo h2info("Note"); echo _("Date")." ".$wDate->input().'
'; echo _("Titre")." ".$wTitle->input().'
'; echo _("Description")."
".$wDesc->input().'
'; @@ -36,13 +43,14 @@ echo dossier::hidden(); echo HtmlInput::hidden('tl_id',0); echo HtmlInput::submit('save_todo_list',_('Sauve'),'onClick="$(\'add_todo_list\').hide();return true;"'); echo HtmlInput::button('hide',_('Annuler'),'onClick="$(\'add_todo_list\').hide();return true;"'); -echo ''; -echo '
'; - -echo '
'; -echo '
'._('Pense-Bête').''; - +?> + +
+
+
' +
+'; @@ -69,8 +77,11 @@ if ( ! empty ($array) ) { } echo ''; } -echo '
'; -echo '
'; +?> + +
+
+exist() == false ) { } if ( $report != 0 ) { - echo '
'; echo '
'.$rapport->get_name().''; $exercice=$g_user->get_exercice(); if ( $exercice == 0 ) { @@ -110,80 +120,10 @@ if ( $report != 0 ) { echo '
'; echo '
'; } else { - echo '
'; echo '
'._('Aucun rapport défini').''; echo ''._('Cliquez ici pour mettre à jour vos préférences').''; echo '
'; - echo '
'; } ?> -
-
-
- - - - - > - - - - - - - - - -
- - - - - - - - - -
- -
-
- - -
-
- - - - -> - - - - - - - -
- - - - -'; ?> - - - - -
-
-
- -
diff --git a/include/template/ledger_detail_ach.php b/include/template/ledger_detail_ach.php index 150e82948..42d23790a 100644 --- a/include/template/ledger_detail_ach.php +++ b/include/template/ledger_detail_ach.php @@ -37,7 +37,7 @@ $bk=new Fiche($cn,$obj->det->array[0]['qp_supplier']); echo td(_('Fournisseur')); - $view_history= sprintf('%s', + $view_history= sprintf('%s', $bk->id, $gDossier, $bk->get_quick_code()); echo td(h($bk->getName())).td($view_history);; ?> @@ -99,6 +99,7 @@ if ( $owner->MY_TVA_USE == 'Y') { } else { echo th(''); } +echo th(_('Prix/Un.'), 'style="text-align:right"'); echo th(_('Quantité'), 'style="text-align:right"'); echo th(_('Non ded'), 'style="text-align:right"'); @@ -138,6 +139,8 @@ echo ''; } $row.=td($fiche->strAttribut(ATTR_DEF_NAME)); $row.=td($sym_tva,'style="text-align:center"'); + $pu=bcdiv($q['qp_price'],$q['qp_quantite']); + $row.=td(nbm($pu),'class="num"'); $row.=td(nbm($q['qp_quantite']),'class="num"'); $no_ded=bcadd($q['qp_dep_priv'],$q['qp_nd_amount']); diff --git a/include/template/ledger_detail_ven.php b/include/template/ledger_detail_ven.php index d33f5f78c..8ebbeab55 100644 --- a/include/template/ledger_detail_ven.php +++ b/include/template/ledger_detail_ven.php @@ -18,7 +18,7 @@ $date=new IDate('p_date'); $date->value=format_date($obj->det->jr_date); echo td('Date').td($date->input()); - + ?> @@ -28,15 +28,15 @@ $date_ech=new IDate('p_ech'); $date_ech->value=format_date($obj->det->jr_ech); echo td('Echeance').td($date_ech->input()); - + ?> - + det->array[0]['qs_client']); echo td(_('Client')); - + $view_history= sprintf('%s', $bk->id, $gDossier, $bk->get_quick_code()); echo td(h($bk->getName())).td($view_history);; @@ -45,7 +45,7 @@ - value=$obj->det->jr_pj_number; echo td(_('Pièce')).td($itext->input()); @@ -53,13 +53,13 @@ - value=$obj->det->jr_comment; $itext->size=40; echo td(_('Libellé')).td($itext->input(),' colspan="2" '); - - + + ?> @@ -80,7 +80,7 @@ $inote->value=$obj->det->note; echo $inote->input(); ?> - + @@ -95,16 +95,17 @@ $total_htva=0;$total_tvac=0; echo th(_('Quick Code')); echo th(_('Description')); +echo th(_('Prix/Un'), 'style="text-align:right"'); +echo th(_('Quantité'), 'style="text-align:right"'); if ( $owner->MY_TVA_USE == 'Y') echo th(_('Taux TVA'), 'style="text-align:right"'); -else +else echo th(''); -echo th(_('Quantité'), 'style="text-align:right"'); if ( $owner->MY_TVA_USE == 'Y') { echo th(_('HTVA'), 'style="text-align:right"'); echo th(_('TVA'), 'style="text-align:right"'); echo th(_('TVAC'), 'style="text-align:right"'); -} else +} else echo th(_('Total'), 'style="text-align:right"'); if ($owner->MY_ANALYTIC != 'nu' && $div == 'popup'){ @@ -118,17 +119,20 @@ if ( $owner->MY_TVA_USE == 'Y') { echo Anc_Plan::hidden($a_anc); } -echo ''; +echo ''; for ($e=0;$edet->array);$e++) { - $row=''; + $row=''; $q=$obj->det->array[$e]; $fiche=new Fiche($cn,$q['qs_fiche']); - $view_history= sprintf('%s', + $view_history= sprintf('%s', $fiche->id, $gDossier, $fiche->strAttribut(ATTR_DEF_QUICKCODE)); $row=td($view_history); $row.=td($fiche->strAttribut(ATTR_DEF_NAME)); $sym_tva=''; + $pu=bcdiv($q['qs_price'],$q['qs_quantite']); + $row.=td(nbm($pu),'class="num"'); + $row.=td(nbm($q['qs_quantite']),'class="num"'); if ( $owner->MY_TVA_USE=='Y') { /* retrieve TVA symbol */ $tva=new Acc_Tva($cn,$q['qs_vat_code']); @@ -139,7 +143,6 @@ echo ''; $row.=td($sym_tva,'style="text-align:center"'); - $row.=td(nbm($q['qs_quantite']),'class="num"'); $htva=$q['qs_price']; $row.=td(nbm($htva),'class="num"'); $tvac=bcadd($htva,$q['qs_vat']); @@ -159,9 +162,9 @@ echo ''; echo HtmlInput::hidden('op[]',$anc_op->j_id); /* compute total price */ bcscale(2); - + $row.=$anc_op->display_table(1,$htva,$div); - + } else { $row.=td(''); } @@ -188,7 +191,7 @@ echo tr($row); -label='Cacher'; $ib->javascript="g('detail_".$div."').style.display='none';g('a".$div."').style.display='block';"; echo $ib->input(); - } else + } else echo '
'; $detail=new Acc_Misc($cn,$obj->jr_id); @@ -233,7 +236,7 @@ echo ''; $row.=td($view_history); if ( $q['j_qcode'] !='') { - // nom de la fiche + // nom de la fiche $ff=new Fiche($cn); $ff->get_by_qcode( $q['j_qcode']); $row.=td($ff->strAttribut(h(ATTR_DEF_NAME))); diff --git a/include/template/module.php b/include/template/module.php index 590a5295f..3e1dd79cf 100644 --- a/include/template/module.php +++ b/include/template/module.php @@ -21,11 +21,11 @@ if ( $cn->get_value("select count(*) from profile join profile_user using (p_id) $direct=new IText('ac'); $direct->style='class="direct"'; $direct->value=''; - $direct->size=(strlen($direct->value)<10)?10:strlen($direct->value); + $direct->size=20; echo $direct->input(); $gDossier=dossier::id(); ?> -
+
diff --git a/sql/ajax-direct-form.sql b/sql/ajax-direct-form.sql index e8f6dc9c6..90b7f20fe 100644 --- a/sql/ajax-direct-form.sql +++ b/sql/ajax-direct-form.sql @@ -1,19 +1,55 @@ --- Function: comptaproc.get_pcm_tree(account_type) - -DROP FUNCTION comptaproc.get_menu_tree(text); - -CREATE OR REPLACE FUNCTION comptaproc.get_menu_tree(p_code text) - RETURNS SETOF text AS +create type menu_tree as (code text,description text); + +create or replace function comptaproc.get_profile_menu(login text) +returns setof menu_tree +as $BODY$ declare - i record; - e RECORD; + a menu_tree; + e menu_tree; begin - for i in select me_code from profile_menu where me_code_dep=p_code - loop +for a in select me_code,me_description from v_all_menu where user_name=login + and me_code_dep is null and me_type <> 'PR' and me_type <>'SP' +loop + return next a; + + for e in select * from get_menu_tree(a.code,login) + loop + return next e; + end loop; + + end loop; +return; +end; +$BODY$ language plpgsql; + + + + +CREATE OR REPLACE FUNCTION comptaproc.get_menu_tree(p_code text,login text) + RETURNS SETOF menu_tree AS +$BODY$ +declare + i menu_tree; + e menu_tree; + a text; + x v_all_menu%ROWTYPE; +begin + for x in select * from v_all_menu where me_code_dep=p_code::text and user_name=login::text + loop + if x.me_code_dep is not null then + i.code := x.me_code_dep||'/'||x.me_code; + else + i.code := x.me_code; + end if; + + i.description := x.me_description; + return next i; - for e in select get_pcm_tree from get_menu_tree(i) + + for e in select * from get_menu_tree(x.me_code,login) loop + e.code:=x.me_code_dep||'/'||e.code; return next e; end loop; @@ -21,6 +57,5 @@ begin return; end; $BODY$ - LANGUAGE plpgsql VOLATILE - COST 100 - ROWS 1000; + LANGUAGE plpgsql; + diff --git a/sql/upgrade.sql b/sql/upgrade.sql index d23731c63..fc3a05a2d 100644 --- a/sql/upgrade.sql +++ b/sql/upgrade.sql @@ -22,6 +22,7 @@ script SQL to run \i account_add.sql \i object-6.0.sql \i extension.sql +\i ajax-direct-form.sql -- for account repository \i change_account_repo.sql \i style-epad.sql