task #0000813: plan comptable - quick code

Visible dans le popup quand on remplit les fiches et dans CFGPCMN
This commit is contained in:
Dany De Bontridder 2013-05-11 17:18:19 +00:00
parent 482b179a65
commit d350f8476b
4 changed files with 42 additions and 7 deletions

View file

@ -99,8 +99,9 @@ case "sf":
$r.='</form>';
$sql="select pcm_val,pcm_lib,pcm_val_parent,pcm_type ".
" from tmp_pcmn ";
$sql="
select pcm_val,pcm_lib,array_to_string(array_agg(j_qcode) , ',') as acode
from tmp_pcmn left join vw_poste_qcode on (j_poste=pcm_val) ";
$sep=" where ";
/* build the sql stmt */
if ( isset($j) && $j > 0 && isNumber($j))
@ -121,7 +122,7 @@ case "sf":
$sql.=sprintf(" $sep ( pcm_val::text like '%s%%' or pcm_lib::text ilike '%%%s%%') ",
$q,$q);
}
$sql.=' order by pcm_val::text limit 50';
$sql.=' group by pcm_val,pcm_lib,pcm_val_parent, pcm_type order by pcm_val::text limit 50';
if ( isset($q) && strlen(trim($q))> 0 )
{
$array=$cn->get_array($sql);

View file

@ -75,7 +75,7 @@ function search_poste(obj)
sx=document.body.scrollTop+60;
}
var div_style="z-index:15;top:"+sx;
var div_style="top:"+sx;
removeDiv('search_account');
add_div({id:'search_account',cssclass:'inner_box',html:loading(),style:div_style,drag:true});

View file

@ -239,7 +239,9 @@ if ( isset ( $_POST["Ajout"] ) )
}
}
$Ret=$cn->exec_sql("select pcm_val,pcm_lib,pcm_val_parent,pcm_type from tmp_pcmn where substr(pcm_val::text,1,1)='".$_SESSION['g_start']."' order by pcm_val::text");
$Ret=$cn->exec_sql("select pcm_val,pcm_lib,pcm_val_parent,pcm_type,array_to_string(array_agg(j_qcode) , ',') as acode
from tmp_pcmn left join vw_poste_qcode on (j_poste=pcm_val) where substr(pcm_val::text,1,1)='".$_SESSION['g_start']."'".
" group by pcm_val,pcm_lib,pcm_val_parent, pcm_type order by pcm_val::text");
$MaxRow=Database::num_row($Ret);
?>
@ -256,11 +258,13 @@ echo dossier::hidden();
<TH> Libellé </TH>
<TH> Poste comptable Parent </TH>
<TH> Type </TH>
<TH> Fiche</TH>
</TR>
<?php
$line=new Acc_Account($cn);
<?php
$line=new Acc_Account($cn);
echo $line->form(false);
?>
<td></td>
<TD>
<INPUT TYPE="SUBMIT" class="button" Value="Ajout" Name="Ajout">
</TD>
@ -301,6 +305,20 @@ for ($i=0; $i <$MaxRow; $i++)
echo $A['pcm_type'];
echo "</TD>";
echo $td;
if ( strlen($A['acode']) >0 ) {
if (strpos($A['acode'], ",") >0 ) {
$det_qcode= split(",", $A['acode']);
echo '<ul style="paddding:0;margin:0;padding-left:0;list-style-type:none;padding-start-value:0">';
for ($e=0;$e<count($det_qcode);$e++) {
echo '<li style="padding-start-value:0">'.HtmlInput::card_detail($det_qcode[$e]).'</li>';
}
echo '</ol>';
} else {
echo HtmlInput::card_detail($A['acode']);
}
}
echo '</td>';
echo $td;
printf ('<A href="?ac='.$_REQUEST['ac'].'&l=%s&action=del&%s">Efface</A>',$A['pcm_val'],$str_dossier);

View file

@ -16,6 +16,22 @@
<?=$array[$i]['pcm_lib']?>
</span>
</td>
<td>
<?php
if ( strlen($array[$i]['acode']) >0 ) {
if (strpos($array[$i]['acode'], ",") >0 ) {
$det_qcode= split(",", $array[$i]['acode']);
$sep="";
for ($e=0;$e<count($det_qcode);$e++) {
echo $sep.HtmlInput::card_detail($det_qcode[$e]);
$sep=" , ";
}
} else {
echo HtmlInput::card_detail($array[$i]['acode']);
}
}
?>
</td>
</tr>