ini_set('include_path','.:../../include');
require_once('ac_common.php');
include_once('postgres.php');
include_once('class_jrn.php');
include_once('class_poste.php');
include_once('class_balance.php');
include_once('impress_inc.php');
// $cn=DbConnect(13);
// $a=new jrn($cn,3);
// echo $a->GetRowSimple(1,100,'on');
// exit();
echo "
isNumber
";
echo "isNumber('40%')".isNumber('40%')."
";
echo "isNumber('40')".isNumber('40')."
";
echo "isNumber('A')".isNumber('A')."
";
echo "isNumber('40.2')".isNumber('240000000099999999999')."
";
$a_poste=array("pmc_val"=>"400");
var_dump($a_poste);
exit();
// date
$nb_day=array(31,$fev,31,30,31,30,31,31,30,31,30,31);
$m=1;
$year=2007;
foreach ($nb_day as $day)
{
$p_start=sprintf("01-%d-%s",$m,$year);
$p_end=sprintf("%d-%d-%s",$day,$m,$year);
$m++;
echo $p_start." - ".$p_end.'
';
}
$cn=DbConnect(1);
echo ' Test GetRappelSimple
';
$a_Tva=GetArray($cn,"select tva_id,tva_label,tva_poste from tva_rate where tva_rate != 0.0000 order by tva_id");
$per_from=68;$jrn=3;$type='ACH';
$space=0;
foreach($a_Tva as $line_tva)
{
//initialize Amount TVA
$tmp1=$line_tva['tva_label'];
$rap_tva[$tmp1]=0.0;
if ( $space == 0 )
$col_tva=str_repeat(" ",6).$line_tva['tva_label'];
else
$col_tva.=str_repeat(" ",$space-strlen($line_tva['tva_label'])).$line_tva['tva_label'];
$space=9;
}
$htva=GetRappelSimple($cn,$jrn,$type,$per_from,$rap_tva);
echo "HTVA = $htva
";
var_dump($rap_tva);
echo "check sql_filter_per
";
$a=sql_filter_per($cn,'01.01.1999','01.01.1999','date','jr_tech_per');
echo $a."
";
$b= sql_filter_per($cn,'01.01.2000','01.11.2006','date','j_tech_per');
echo "Received $b
";
echo 'check getRow function
';
echo 'Check Jrn
';
$a=new jrn($cn,0); // grand livre
$b=$a->GetRow('1','9999','off');
echo 'class_jrn il y a '.count($b[0]).' données trouvée
';
$b=$a->GetRow('1','9999','on');
echo 'Class_jrn il y a '.sizeof($b[0]).' données Centralisees trouvée
';
echo ' $a->GetRowSimple
';
$per_from=67;$per_to=70;$jrn=3;
$c=0;
$ven=new jrn($cn,$jrn);
$b=$ven->GetRowSimple ( $per_from,$per_to,'off',-1,-1);
foreach ($b as $line) {
$c++;
print_r ($line);echo '
';}
foreach ($b as $line) {
echo $line['client']." htva : ".$line['HTVA']." tva ".$line['AMOUNT_TVA']." TVAC ".$line['TVAC']." inline ".$line['TVA_INLINE'];
$tot=(float) $line['HTVA']+(float)$line['AMOUNT_TVA']-$line['TVAC'];
if ( round($tot,8) == 0.0 )
print ' ok';
else {
print ' FAILED ';
echo "Diff = ".$tot." TVAC ".$line['TVAC']; }
echo '
';
}
echo "Il y a $c données trouvées par GetRowSimple ";
$s=sql_filter_per($cn,$per_from,$per_to,'p_id','jr_tech_per');
$count_rowS=GetArray($cn,"select count(*) as mcount from jrn where $s and jr_def_id=$jrn");
if ( $c != $count_rowS[0]['mcount'] ) {
echo "ERREUR : GetRowSimple ne renvoie pas le bon nombre de lignes GetRowSimple = $c Jrn = ".$count_rowS[0]['mcount']."
";
} else
echo "ok";
echo "Computing TVA
";
$a_Tva=GetArray($cn,"select tva_id,tva_label from tva_rate where tva_rate != 0.0000 order by tva_id");
$space=4;$col_tva="";
foreach($a_Tva as $line_tva)
{
//initialize Amount TVA
$tmp1=$line_tva['tva_id'];
$rap_tva[$tmp1]=0.0;
if ( $space == 0 )
$col_tva=str_repeat(" ",6).$line_tva['tva_label'];
else
$col_tva.=str_repeat(" ",$space-strlen($line_tva['tva_label'])).$line_tva['tva_label'];
$space=9;
}
foreach ($b as $row)
{
echo "Line "; var_dump ($row);echo "
";
foreach ($row['TVA'] as $line)
{
var_dump($line);echo "
";
$tva_id=$line[1][0];
$rap_tva[$tva_id]+=$line[1][2];
}
}
var_dump($rap_tva);
echo 'Poste->GetRow
';
$a=new poste($cn,4511); // grand livre
$b=$a->GetRow('1','9999');
echo 'class_poste il y a '.sizeof($b[0]).' données trouvée
';
$a=new Balance($cn,4519); // grand livre
$b=$a->GetRow('1','9999');
echo 'class_balance il y a '.sizeof($b).' données trouvée
';
echo_debug('Testing echo_debug');
echo_error('Testing echo_error');
?>