|
|
@ -68,6 +68,7 @@ if ($action=='load') |
|
|
|
// Parse data from CSV file line by line
|
|
|
|
// Parse data from CSV file line by line
|
|
|
|
$i=0; |
|
|
|
$myfile = fopen("log.txt", "w"); |
|
|
|
while (($getData = fgetcsv($csvFile, 10000, ";")) !== FALSE) |
|
|
|
{ |
|
|
|
//pour le md5 on ne tient pas compte du Solde du sens et du libellé de l'activité
|
|
|
@ -83,14 +84,18 @@ if ($action=='load') |
|
|
|
$getData[3]=trim($getData[3]); |
|
|
|
$getData[4]=trim($getData[4]); |
|
|
|
$getData[6]=trim($getData[6]); |
|
|
|
$getData[7]=trim($getData[7]); |
|
|
|
$getData[8]=trim($getData[8]); |
|
|
|
$getData[7]=strval(trim($getData[7])); |
|
|
|
$getData[8]=strval(trim($getData[8])); |
|
|
|
|
|
|
|
|
|
|
|
$getData[11]=trim($getData[11]); |
|
|
|
//echo(serialize($getData));
|
|
|
|
//echo '<br>';
|
|
|
|
//exit;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$checkmd5=hash('md5',serialize($getData)); |
|
|
|
|
|
|
|
fwrite($myfile, serialize($getData).'$checkmd5'.PHP_EOL); |
|
|
|
|
|
|
|
// Get row data
|
|
|
|
$code_JNL = $getData[2]; |
|
|
|
$date_piece = $getData[4]; |
|
|
@ -160,6 +165,7 @@ if ($action=='load') |
|
|
|
} |
|
|
|
|
|
|
|
// Close opened CSV file
|
|
|
|
fclose($myfile); |
|
|
|
fclose($csvFile); |
|
|
|
if ($i>0) |
|
|
|
{ |
|
|
@ -260,7 +266,7 @@ elseif ($action=='update_checkmd5') |
|
|
|
$data = array(); |
|
|
|
if (mysqli_num_rows($result) > 0) { |
|
|
|
|
|
|
|
|
|
|
|
$myfile = fopen("log.txt", "w"); |
|
|
|
while ($row = mysqli_fetch_assoc($result)) { |
|
|
|
|
|
|
|
//$row2=$row;
|
|
|
@ -270,14 +276,28 @@ elseif ($action=='update_checkmd5') |
|
|
|
$row2[3]=trim($row["No_piece"]); |
|
|
|
$row2[4]=trim($row["date_piece"]); |
|
|
|
$row2[6]=trim($row["lib_mouvement"]); |
|
|
|
$row2[7]=trim($row["debit"]); |
|
|
|
$row2[8]=trim($row["credit"]); |
|
|
|
if ($row["credit"]<0) |
|
|
|
{ |
|
|
|
|
|
|
|
$row2[7]=trim(str_replace('-','',strval($row["credit"]))); |
|
|
|
$row2[8]=''; |
|
|
|
//echo $row["credit"].'==>'.$row2[7].'<br>';
|
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
$row2[7]=''; |
|
|
|
$row2[8]=strval($row["credit"]); |
|
|
|
|
|
|
|
} |
|
|
|
//echo $row["credit"].'==>debit='.$row2[7].' credit='.$row2[8].'<br>';
|
|
|
|
|
|
|
|
$row2[11]=trim($row["code_activite"]); |
|
|
|
|
|
|
|
|
|
|
|
//echo(serialize($row2));
|
|
|
|
//echo '<br>';
|
|
|
|
|
|
|
|
$checkmd5=hash('md5',serialize($row2)); |
|
|
|
fwrite($myfile, serialize($row2).$checkmd5.PHP_EOL); |
|
|
|
$query="update importation_data_aidimpact set checkmd5='".$checkmd5."' where idt=".$row["idt"].";"; |
|
|
|
$result2=mysqli_query($conn, $query); |
|
|
|
|
|
|
@ -303,6 +323,9 @@ elseif ($action=='update_checkmd5') |
|
|
|
$res=mysqli_query($conn, $query); |
|
|
|
$num=mysqli_num_rows($res); |
|
|
|
echo '<br>'.$num; |
|
|
|
// Close opened CSV file
|
|
|
|
fclose($myfile); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
else |
|
|
|