Ajout PU pour detail ach & ven

ajout ajax pour direct form
This commit is contained in:
Dany De Bontridder 2011-11-13 17:28:49 +00:00
parent c16c32ca48
commit f2cbfd77d3
8 changed files with 122 additions and 133 deletions

19
html/direct.php Normal file
View file

@ -0,0 +1,19 @@
<?
require_once ("class_database.php");
require_once 'class_user.php';
$cn=new Database($_GET['gDossier']);
$user=new User($cn);
$user->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 "<ul>";
for ($i = 0;$i< $nb;$i++)
{
$row=Database::fetch_array($res,$i);
echo "<li>";
echo $row['code'];
echo '<span class="informal"> '.$row['description'].'</span></li>';
}
echo "</ul>";
?>

View file

@ -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();

View file

@ -1,10 +1,11 @@
<div style="float:left;width:42%">
<div>
<div style="float:left;width:50%">
<fieldset>
<legend><?=_('Calendrier')?>
</legend>
<?php echo $cal->display(); ?>
</fieldset>
</div>
<?php
/*
* Todo list
@ -21,14 +22,20 @@ if ( isset($_REQUEST['save_todo_list'])) {
}
$todo=new Todo_List($cn);
$array=$todo->load_all();
echo '<div id="add_todo_list" class="add_todo_list">';
echo '<form method="post">';
?>
<div id="add_todo_list" class="add_todo_list">
<script charset="utf8" type="text/javascript" language="javascript">
new Draggable($('add_todo_list'),{});
</script>
<form method="post">
<?php
$wDate=new IDate('p_date_todo');
$wDate->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().'<br>';
echo _("Titre")." ".$wTitle->input().'<br>';
echo _("Description")."<br>".$wDesc->input().'<br>';
@ -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 '</form>';
echo '</div>';
echo '<div style="float:left;width:27%;">';
echo '<fieldset> <legend>'._('Pense-Bête').'</legend>';
?>
</form>
</div>
</div>
<div style="float:left;width:50%">'
<fieldset> <legend><?=_('Pense-Bête')?></legend>
<?php
echo HtmlInput::button('add',_('Ajout'),'onClick="add_todo()"');
if ( ! empty ($array) ) {
echo '<table id="table_todo" width="100%">';
@ -69,8 +77,11 @@ if ( ! empty ($array) ) {
}
echo '</table>';
}
echo '</fieldset>';
echo '</div>';
?>
</fieldset>
</div>
<div style="clear:both"></div>
<?php
/*
* Mini Report
*/
@ -84,7 +95,6 @@ if ( $rapport->exist() == false ) {
}
if ( $report != 0 ) {
echo '<div style="float:left;width:30%">';
echo '<fieldset style="background-color:white"><legend>'.$rapport->get_name().'</legend>';
$exercice=$g_user->get_exercice();
if ( $exercice == 0 ) {
@ -110,80 +120,10 @@ if ( $report != 0 ) {
echo '</fieldset>';
echo '</div>';
} else {
echo '<div style="float:right;width:20%">';
echo '<fieldset style="background-color:white"><legend>'._('Aucun rapport défini').'</legend>';
echo '<a href="user_pref.php?'.dossier::get().'">'._('Cliquez ici pour mettre à jour vos préférences').'</a>';
echo '</fieldset>';
echo '</div>';
}
?>
<div style="float:left;clear:both;width:100%">
<div style="float:left;width:49%">
<fieldset>
<legend><?=_('Dernières opérations')?>
</legend>
<table width="100%">
<?php
for($i=0;$i<count($last_ledger);$i++):
if ( $i % 2 == 0 ) $odd='class="odd" '; else $odd='class="even" ';
?>
<tr <?=$odd?> >
<td>
<?=$last_ledger[$i]['jr_date_fmt']?>
</td>
<td>
<?=h(substr($last_ledger[$i]['jr_comment'],0,30))?>
</td>
<td>
<?=h(substr($last_ledger[$i]['jr_pj_number'],0,10))?>
</td>
<td style="text-align:right">
<?=nbm($last_ledger[$i]['jr_montant'])?>
</td>
<td>
<? echo $detail=HtmlInput::detail_op($last_ledger[$i]['jr_id'],$last_ledger[$i]['jr_internal']); ?>
</td>
</tr>
<? endfor;?>
</table>
</fieldset>
</div>
<div style="float:left;width:49%">
<fieldset>
<legend><?=_('Dernières actions')?>
</legend>
<table width="100%">
<?php
for($i=0;$i<count($last_operation);$i++):
if ( $i % 2 == 0 ) $odd='class="odd" '; else $odd='class="even" ';
?>
<tr <?=$odd?>>
<td>
<?=h($last_operation[$i]['ag_timestamp_fmt'])?>
</td>
<td>
<?=h($last_operation[$i]['vw_name'])?>
</td>
<td>
<? echo '<A HREF="commercial.php?'.dossier::get().'&p_action=suivi_courrier&sa=detail&ag_id='.$last_operation[$i]['ag_id'].'">'; ?>
<?=h(substr($last_operation[$i]['ag_title'],0,40))?>
</a>
</td>
<td>
<?=$last_operation[$i]['dt_value']?>
</tr>
<? endfor;?>
</table>
</fieldset>
</div>
</div>
</div>

View file

@ -37,7 +37,7 @@
$bk=new Fiche($cn,$obj->det->array[0]['qp_supplier']);
echo td(_('Fournisseur'));
$view_history= sprintf('<A class="detail" HREF="javascript:view_history_card(\'%s\',\'%s\')" >%s</A>',
$view_history= sprintf('<A class="line" HREF="javascript:view_history_card(\'%s\',\'%s\')" >%s</A>',
$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 '</tr>';
}
$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']);

View file

@ -18,7 +18,7 @@
$date=new IDate('p_date');
$date->value=format_date($obj->det->jr_date);
echo td('Date').td($date->input());
?>
</td>
</tr>
@ -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());
?>
</td>
</td>
<tr>
<td>
<?
$bk=new Fiche($cn,$obj->det->array[0]['qs_client']);
echo td(_('Client'));
$view_history= sprintf('<A class="detail" HREF="javascript:view_history_card(\'%s\',\'%s\')" >%s</A>',
$bk->id, $gDossier, $bk->get_quick_code());
echo td(h($bk->getName())).td($view_history);;
@ -45,7 +45,7 @@
</tr>
<tr>
<td>
<?
<?
$itext=new IText('npj');
$itext->value=$obj->det->jr_pj_number;
echo td(_('Pièce')).td($itext->input());
@ -53,13 +53,13 @@
</td>
<tr>
<td>
<?
<?
$itext=new IText('lib');
$itext->value=$obj->det->jr_comment;
$itext->size=40;
echo td(_('Libellé')).td($itext->input(),' colspan="2" ');
?>
</td>
</tr>
@ -80,7 +80,7 @@
$inote->value=$obj->det->note;
echo $inote->input();
?>
</td>
</tr>
</table>
@ -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 '</tr>';
echo '</tr>';
for ($e=0;$e<count($obj->det->array);$e++) {
$row='';
$row='';
$q=$obj->det->array[$e];
$fiche=new Fiche($cn,$q['qs_fiche']);
$view_history= sprintf('<A class="detail" HREF="javascript:view_history_card(\'%s\',\'%s\')" >%s</A>',
$view_history= sprintf('<A class="line" HREF="javascript:view_history_card(\'%s\',\'%s\')" >%s</A>',
$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 '</tr>';
$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 '</tr>';
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);
<legend>
<?=_('Ecritures comptables')?>
</legend>
<?
<?
/* if it is not in a popup, the details are hidden */
if ( $div != 'popup') {
$ib=new IButton ("a".$div);
@ -200,7 +203,7 @@ echo tr($row);
$ib->label='Cacher';
$ib->javascript="g('detail_".$div."').style.display='none';g('a".$div."').style.display='block';";
echo $ib->input();
} else
} else
echo '<div>';
$detail=new Acc_Misc($cn,$obj->jr_id);
@ -233,7 +236,7 @@ echo '</tr>';
$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)));

View file

@ -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();
?>
<div id="ac_choices" class="autocomplete" ></div>
<div id="ac_choices" class="autocomplete" style="width:150"></div>
<?
echo HtmlInput::submit('go','aller');
?>

View file

@ -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;

View file

@ -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