add balance report
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,4 +1,5 @@
|
|||||||
/vendor
|
/vendor
|
||||||
|
/balance-report
|
||||||
/template/templates_c
|
/template/templates_c
|
||||||
php_errors.log
|
php_errors.log
|
||||||
/_developer
|
/_developer
|
||||||
|
|||||||
@@ -272,6 +272,14 @@ class page {
|
|||||||
# EDZÉSLISTA EXPORTÁLÁSA
|
# EDZÉSLISTA EXPORTÁLÁSA
|
||||||
include('include_export_trainings.php');
|
include('include_export_trainings.php');
|
||||||
break;
|
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':
|
case 'set_credit_to_zero':
|
||||||
# HITELALKALOM NULLÁZÁS
|
# HITELALKALOM NULLÁZÁS
|
||||||
include('include_set_credit_to_zero.php');
|
include('include_set_credit_to_zero.php');
|
||||||
|
|||||||
25
_include/include_download_report.php
Normal file
25
_include/include_download_report.php
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
# REPORT DOWNLOAD
|
||||||
|
|
||||||
|
if ($this->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);
|
||||||
|
|
||||||
|
?>
|
||||||
21
_include/include_export_balance.php
Normal file
21
_include/include_export_balance.php
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$trainingAssocArray = $sql->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);
|
||||||
Reference in New Issue
Block a user