diff --git a/.gitignore b/.gitignore index edd1a3b..6bfc51f 100755 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,12 @@ /vendor +/balance-report /template/templates_c php_errors.log /_developer /jQuery /ckeditor /backup/* -!/backup/.gitkeep +!/backup/.gitkeep /.idea/* *.bak .htaccess diff --git a/_class/class_page.php b/_class/class_page.php index 6cdc666..1abc585 100644 --- a/_class/class_page.php +++ b/_class/class_page.php @@ -272,6 +272,14 @@ class page { # EDZÉSLISTA EXPORTÁLÁSA include('include_export_trainings.php'); break; + case 'export_balance': + # EGYENLEG LISTA EXPORTÁLÁSA + include('include_export_balance.php'); + break; + case 'download_report': + # EGYENLEG LISTA LETÖLTÉSE + include('include_download_report.php'); + break; case 'set_credit_to_zero': # HITELALKALOM NULLÁZÁS include('include_set_credit_to_zero.php'); diff --git a/_include/include_download_report.php b/_include/include_download_report.php new file mode 100644 index 0000000..533b10c --- /dev/null +++ b/_include/include_download_report.php @@ -0,0 +1,25 @@ +is_id()) { + + if (!file_exists("./balance-report/{$this->get_id()}.csv")) { + return; + } + + header('Content-type: application/csv'); + header("Content-disposition: attachment; filename=\"".$this->get_id().".csv\""); + ob_clean(); + flush(); + readfile("./balance-report/{$this->get_id()}.csv"); +} + +else { + # NEM LEHET +} + +exit(1); + +?> diff --git a/_include/include_export_balance.php b/_include/include_export_balance.php new file mode 100644 index 0000000..d988b85 --- /dev/null +++ b/_include/include_export_balance.php @@ -0,0 +1,21 @@ +assoc_array(" + SELECT uk_name, uk_balance + FROM user_kid + WHERE uk_deleted = 0 AND uk_is_active = 1 + ORDER BY uk_name ASC; +"); + + +$file_name = date("Y-m") . ".csv"; +$path = 'balance-report/'; +touch($path.$file_name); + +$file = fopen($path.$file_name, "w"); + +foreach ($trainingAssocArray as $key => $row) { + fputcsv($file, $row, ';'); +} + +fclose($file);