79 lines
1.8 KiB
PHP
79 lines
1.8 KiB
PHP
#!/usr/bin/php
|
|
<?php
|
|
|
|
//require 'vendor/autoload.php';
|
|
require("../../config/config.php");
|
|
|
|
define('FRONKDB_SQLDEBUG',false);
|
|
error_reporting(E_ALL & ~(E_NOTICE | E_STRICT | E_DEPRECATED));
|
|
|
|
require_once(LIBDIR."/mvcfronk/mfRouter/mfRouter.php");
|
|
require_once(LIBDIR."/mvcfronk/mfBase/mfBaseModel.php");
|
|
require_once(LIBDIR."/mvcfronk/mfBase/mfBaseController.php");
|
|
|
|
$me = new User(1);
|
|
|
|
$folder = __DIR__."/files/";
|
|
$csvname = "tt-rech-export-bmd-2024-07-09_19-42-04.csv";
|
|
$filename = $folder.$csvname;
|
|
|
|
$db = FronkDB::singleton();
|
|
$log = mfLoghandler::singleton();
|
|
|
|
$input = fopen($filename, "r");
|
|
|
|
$i = 0;
|
|
$l = 0;
|
|
while($csv = fgetcsv($input, false, ";")) {
|
|
$l++;
|
|
if($l == 1) continue;
|
|
|
|
if(!trim($csv[1])) {
|
|
continue;
|
|
}
|
|
|
|
$fibu_account_number = trim($csv[1]);
|
|
$text = trim($csv[11]);
|
|
$iban = strtoupper(trim($csv[13]));
|
|
$bic = strtoupper(trim($csv[14]));
|
|
|
|
if(!$iban || !$bic) continue;
|
|
|
|
$customer_number = false;
|
|
|
|
$m = [];
|
|
if(preg_match('/\[(\d+)\]/', $text, $m)) {
|
|
if(count($m)) {
|
|
$customer_number = $m[1];
|
|
}
|
|
}
|
|
|
|
if(!$customer_number) {
|
|
die("Konnte Kundennummer nicht extrahieren\n");
|
|
}
|
|
|
|
/*if(in_array($customer_number, [3171])) {
|
|
continue;
|
|
}
|
|
echo "$customer_number\n";
|
|
*/
|
|
$ivt_customer = new IvtCustomer($customer_number);
|
|
if(!$ivt_customer->id) {
|
|
die("Kunde $customer_number nicht im ivt gefunden\n");
|
|
}
|
|
|
|
|
|
$ivt_iban = strtoupper(str_replace(" ","", $ivt_customer->IBAN));
|
|
$ivt_bic = strtoupper(str_replace(" ","", $ivt_customer->BIC));
|
|
|
|
if($ivt_iban != $iban) {
|
|
echo "$customer_number | iban: $iban <> $ivt_iban\n";
|
|
}
|
|
if($ivt_bic != $bic) {
|
|
echo "$customer_number | bic: $bic <> $ivt_bic\n";
|
|
}
|
|
|
|
$i++;
|
|
}
|
|
|
|
echo "\n$i Zeilen verarbeitet\n"; |