<?php
//include('../../xcrud/xcrud.php');
//header('Content-Type: text/html; charset=' . Xcrud_config::$mbencoding);
//$db = Xcrud_db::get_instance();
//include('../src/Smalot/PdfParser/Parser.php');
/*
$parser = new \Smalot\PdfParser\Parser();
$pdf = $parser->parseFile('Document1_pdfcreator.pdf');
$text = $pdf->getText();
echo "dssd".$text;*/
echo "";
 


/*
define('CSV_PATH','/'); // specify CSV file path
$path = "csv";
$files = array_diff(scandir($path), array('..', '.'));
//print_r($files);
foreach($files as $key => $csv_file){
    //$csv_file = "info.CSV"; // Name of your CSV file
    //if($csv_file > ""){echo "here";}else{echo "nope";}
    $csv_key = $_POST['id'];
   // $csv_file = $_POST['name'];
    if(isset($csv_key) AND $key == $csv_key){
      $csv_file = $path."/".$csv_file;
      $csvfile = fopen($csv_file, 'r');
    // $theData = fgets($csvfile);
   //  print_r($theData);
        $i = 0;
        while (!feof($csvfile))
        {
          $csv_data[] = fgets($csvfile, 1024);
          // echo $csv_data[$i];
          $csv_array = explode(";", $csv_data[$i]);
          // print_r($csv_array);
          if($csv_array[0] > ""){
            $insert_csv = array();
            $created=date("Y-m-d H:i:s", strtotime($csv_array[0]) );
            $datum=date("Y-m-d", strtotime($csv_array[1]) );
          } else {
            $created ="0000-00-00 00:00:00";
            $datum = "0000-00-00";
          }
          $insert_csv = array(
              'created' =>'',
              'datum' =>'',
              'umsatzart' =>'',
              'comment' =>'',
              'cost' =>'',
              'maincategorie' =>'',
              'subcategorie' =>''
            );
          $insert_csv['created'] = $created;
          $insert_csv['datum'] = $datum;
          $insert_csv['umsatzart'] = $csv_array[2];
          $insert_csv['comment'] = $csv_array[3];
          $insert_csv['cost'] = $csv_array[4];
          if(isset($csv_array[9]) AND $csv_array[9] > ''){
            if (strpos($csv_array[8], '/ ') !== false) {
              $slash = explode("/ ",$csv_array[9]);
              $insert_csv['maincategorie'] = $slash[0];
              $insert_csv['subcategorie'] = substr($csv_array[9], strpos($csv_array[9], "/ ") + 1);
            } else {
              $insert_csv['maincategorie'] = $csv_array[9];
              $insert_csv['subcategorie'] ="";
            }
          } 
         //$query_check = "SELECT * FROM ktsgkbank WHERE created LIKE '".$created."' AND datum LIKE '".$datum."' AND umsatzart LIKE '".$csv_array[2]."' AND cost LIKE '".$csv_array[4]."' ";
          $query_insert = "REPLACE INTO ktsgkbank(created,datum,umsatzart,comment,cost,maincategorie,subcategorie)VALUES('".$insert_csv['created']."','".$insert_csv['datum']."','".$insert_csv['umsatzart']."','".$insert_csv['comment']."','".$insert_csv['cost']."','".$insert_csv['maincategorie']."','".$insert_csv['subcategorie']."')";
           //print_r($insert_csv);
         // $n=mysql_query($query_insert, $connect );
         $n= $db->query($query_insert);
          // echo "ok<br>";
          //echo $i."<br>";
          //echo "-------------------------------------------------------------<br><br>";
          $i++; 
        }
       fclose($csvfile);
       // echo "File data successfully imported to database!!";
    }
}
*/
    
//mysql_close($connect); // closing connection
?>
