Add reconcilied operation

This commit is contained in:
Dany De Bontridder 2013-10-19 20:22:02 +00:00
parent cbf262e25a
commit d9bdc14234
3 changed files with 39 additions and 3 deletions

View file

@ -135,7 +135,7 @@ if ( $_GET['p_simple'] == 0 )
}
exit;
}
else if ($_GET['p_simple'] == 0)
else if ($_GET['p_simple'] == 1)
{
$Row=$Jrn->get_rowSimple($_GET['from_periode'],
$_GET['to_periode'],
@ -183,6 +183,8 @@ else if ($_GET['p_simple'] == 0)
//-----------------------------------------------------
if ( $jrn_type=='ACH' || $jrn_type=='VEN')
{
$cn->prepare('reconcile_date',"select to_char(jr_date,'DD.MM.YY') as str_date,* from jrn where jr_id in (select jra_concerned from jrn_rapt where jr_id = $1 union all select jr_id from jrn_rapt where jra_concerned=$1)");
$own=new Own($cn);
$col_tva="";
@ -194,7 +196,7 @@ else if ($_GET['p_simple'] == 0)
$col_tva.='"Tva '.$line_tva['tva_label'].'";';
}
}
echo '"Date";"operation";"Client/Fourn.";"Commentaire";"inter.";"HTVA";privé;DNA;tva non ded.;'.$col_tva.'"TVAC"'."\n\r";
echo '"Date";"operation";"Client/Fourn.";"Commentaire";"inter.";"HTVA";privé;DNA;tva non ded.;opérations liées'.$col_tva.'"TVAC"'."\n\r";
foreach ($Row as $line)
{
printf('"%s";"%s";"%s";"%s";"%s";%s;%s;%s;%s;',
@ -233,6 +235,18 @@ else if ($_GET['p_simple'] == 0)
}
}
echo nb ($line['TVAC']);
/**
* Retrieve payment if any
*/
$ret_reconcile=$cn->execute('reconcile_date',array($line['jr_id']));
$max=Database::num_row($ret_reconcile);
if ($max > 0) {
$sep=";";
for ($e=0;$e<$max;$e++) {
$row=Database::fetch_array($ret_reconcile, $e);
echo $sep.$row['str_date'].'; '. $row['jr_internal'];
}
}
printf("\r\n");
}

View file

@ -52,7 +52,7 @@ $dstart->value=(isset($_REQUEST['p_start']))?$_REQUEST['p_start']:$start;
$dend=new IDate('p_end');
$dend->value=(isset($_REQUEST['p_end']))?$_REQUEST['p_end']:$end;
echo "Depuis ".$dstart->input()." jusque ".$dend->input();
echo "Opérations entre ".$dstart->input()." jusque ".$dend->input();
echo '<ol style="list-style-type:none;">';
$radio->selected=($choice==0)?true:false;

View file

@ -9,6 +9,7 @@
<th style="text-align:right">Privé</th>
<th style="text-align:right">DNA</th>
<th style="text-align:right">TVA ND</th>
<?php
$col_tva="";
@ -23,11 +24,18 @@ $col_tva="";
echo $col_tva;
?>
<th style="text-align:right">TVAC</th>
<th>Opérations rapprochées</th>
</tr>
<?php
$i = 0;
$cn->prepare('reconcile_date','select * from jrn where jr_id in (select jra_concerned from jrn_rapt where jr_id = $1 union all select jr_id from jrn_rapt where jra_concerned=$1)');
foreach ($Row as $line) {
$i++;
/*
* Get date of reconcile operation
*/
$ret_reconcile=$cn->execute('reconcile_date',array($line['jr_id']));
$class = ($i % 2 == 0) ? ' class="even" ' : ' class="odd" ';
echo "<tr $class>";
echo "<TD>" . smaller_date($line['date']) . "</TD>";
@ -68,6 +76,20 @@ foreach ($Row as $line) {
}
}
echo '<td class="num">'.$line['TVAC'].'</td>';
/*
* If reconcile print them
*/
echo '<td>';
$max=Database::num_row($ret_reconcile);
if ($max > 0) {
$sep="";
for ($e=0;$e<$max;$e++) {
$row=Database::fetch_array($ret_reconcile, $e);
echo $sep.HtmlInput::detail_op($row['jr_id'],$row['jr_date'].' '. $row['jr_internal']);
$sep=' ,';
}
}
echo '</td>';
echo "</tr>";
}
?>