diff --git a/_class/class_money_deposit.php b/_class/class_money_deposit.php
index d45d171..d2cdd3d 100644
--- a/_class/class_money_deposit.php
+++ b/_class/class_money_deposit.php
@@ -8,9 +8,8 @@ class money_deposit {
private $mod_id;
private $mod_user_kid_uk_id; //ID
private $mod_user_kid; //OBJECT
- private $mod_date;
- private $mod_sum;
- private $mod_payment_type;
+ private $mod_money_income_mi_id; //ID
+ private $mod_money_income; //OBJECT
private $mod_deleted;
public function set_mod_id($_id) {
@@ -25,16 +24,12 @@ class money_deposit {
$this->mod_user_kid = $_user_kid;
}
- public function set_mod_date($_date) {
- $this->mod_date = $_date;
+ public function set_mod_money_income_mi_id($_money_income_mi_id) {
+ $this->mod_money_income_mi_id = $_money_income_mi_id;
}
- public function set_mod_sum($_sum) {
- $this->mod_sum = $_sum;
- }
-
- public function set_mod_payment_type_pt_id($_payment_type) {
- $this->mod_payment_type = $_payment_type;
+ public function set_mod_money_income($_money_income) {
+ $this->mod_money_income = $_money_income;
}
public function set_mod_deleted($_deleted) {
@@ -53,32 +48,12 @@ class money_deposit {
return $this->mod_user_kid;
}
- public function get_mod_payment_type_pt_id() {
- return $this->mod_payment_type;
+ public function get_mod_money_income_mi_id() {
+ return $this->mod_money_income_mi_id;
}
-
- public function get_mod_date($_formatted = false) {
- return !$_formatted ? $this->mod_date : date("Y. m. d.", strtotime($this->mod_date));
- }
-
- public function get_mod_date_day() {
- $day = date("d", strtotime($this->mod_date));
- if (substr($day, 0, 1) == '0') return substr($day, 1, 1);
- return date("d", strtotime($this->mod_date));
- }
-
- public function get_mod_date_day_of_week() {
- return date("w", strtotime($this->mod_date));
- }
-
- public function get_mod_sum($formatted = null) {
- if (!$formatted) {
- return $this->mod_sum;
- }
- else {
- return number_format($this->mod_sum, 0, '', ' ');
- }
+ public function get_mod_money_income() {
+ return $this->mod_money_income;
}
public function get_mod_deleted() {
@@ -98,37 +73,48 @@ class money_deposit {
$new_user->set_user_data_by_id($value);
$this->set_mod_user_kid($new_user);
}
- if ($field == "mod_payment_type") {
- $new_pt = new payment_type();
- $new_pt->set_pt_data_by_id($value);
- $this->set_mod_payment_type_pt_id($new_pt);
+ if ($field == "mod_money_income_mi_id") {
+ $new_mi = new money_income();
+ $new_mi->set_mi_data_by_id($value);
+ $this->set_mod_money_income($new_mi);
}
-
}
-
}
public static function create_money_deposit($_user_id, $_date, $_sum, $_pt) {
global $sql;
- return $sql->insert_into('money_deposit', array(
- 'mod_user_kid_uk_id' => $_user_id,
- 'mod_date' => $_date,
- 'mod_payment_type_pt_id' => $_pt,
- 'mod_sum' => $_sum
+
+ $income_id = $sql->insert_into('money_income', array(
+ 'mi_date' => $_date,
+ 'mi_payment_type_pt_id' => $_pt,
+ 'mi_sum' => $_sum,
+ 'mi_item' => 'Edzésdíj',
+ 'mi_money_income_category_mic_id' => 4,
)
);
+
+ return $sql->insert_into('money_deposit', array(
+ 'mod_user_kid_uk_id' => $_user_id,
+ 'mod_money_income_mi_id' => $income_id,
+ ));
}
- public static function update_money_deposit($_user_id, $_date, $_sum, $_mod_id, $_pt) {
+ public static function update_money_deposit($_user_id, $_date, $_sum, $_mod_id, $_pt, $_mi_id) {
global $sql;
+ $sql->update_table('money_income', array(
+ //'mod_user_kid_uk_id' => $_user_id,
+ 'mi_date' => $_date,
+ 'mi_payment_type_pt_id' => $_pt,
+ 'mi_sum' => $_sum
+ ), array(
+ 'mi_id' => $_mi_id
+ ));
+
$sql->update_table('money_deposit', array(
'mod_user_kid_uk_id' => $_user_id,
- 'mod_date' => $_date,
- 'mod_payment_type_pt_id' => $_pt,
- 'mod_sum' => $_sum
), array(
'mod_id' => $_mod_id
- ));
+ ));
}
diff --git a/_class/class_money_expense.php b/_class/class_money_expense.php
index 84558e7..bc6f5d3 100644
--- a/_class/class_money_expense.php
+++ b/_class/class_money_expense.php
@@ -10,6 +10,7 @@ class money_expense {
private $mox_sum;
private $mox_moxc_id = null;
private $mox_moxc = null;
+ private $mox_payment_type;
private $mox_deleted;
@@ -45,6 +46,9 @@ class money_expense {
$this->mox_coach = $_item;
}
+ public function set_mox_payment_type_pt_id($_payment_type) {
+ $this->mox_payment_type = $_payment_type;
+ }
public function set_mox_deleted($_item) {
$this->mox_deleted = $_item;
@@ -54,6 +58,10 @@ class money_expense {
return $this->mox_id;
}
+ public function get_mox_payment_type_pt_id() {
+ return $this->mox_payment_type;
+ }
+
public function get_mox_user_coach_ua_id() {
return $this->mox_user_coach_ua_id;
}
@@ -64,7 +72,7 @@ class money_expense {
public function get_mox_date_day() {
$day = date("d", strtotime($this->mox_date));
- if (substr($day, 0, 1) == '0') return substr($day, 1, 1);
+ if (substr($day, 0, 1) == '0') return substr($day, 1, 1);
return date("d", strtotime($this->mox_date));
}
@@ -125,11 +133,17 @@ class money_expense {
$new_user->set_user_data_by_id($value);
$this->set_mox_coach($new_user);
}
+
+ if ($field == "mox_payment_type") {
+ $new_pt = new payment_type();
+ $new_pt->set_pt_data_by_id($value);
+ $this->set_mox_payment_type_pt_id($new_pt);
+ }
}
}
- public static function create_money_expense($_name, $_date, $_item, $_sum, $_moxc_id) {
+ public static function create_money_expense($_name, $_date, $_item, $_sum, $_moxc_id, $_pt) {
global $sql;
return $sql->insert_into('money_expense', array(
@@ -137,19 +151,21 @@ class money_expense {
'mox_date' => $_date,
'mox_item' => $_item,
'mox_sum' => $_sum,
+ 'mox_payment_type_pt_id' => $_pt,
'mox_money_expense_category_moxc_id' => $_moxc_id
));
}
- public static function update_money_expense($_name, $_date, $_item, $_sum, $_moxc_id, $_id) {
+ public static function update_money_expense($_name, $_date, $_item, $_sum, $_moxc_id, $_id, $_pt) {
global $sql;
- $sql->update_table('money_expense',
+ $sql->update_table('money_expense',
array(
'mox_user_coach_ua_id' => (empty($_name)?'null':self::name_to_ua_id($_name)),
'mox_date' => $_date,
'mox_item' => $_item,
'mox_sum' => $_sum,
+ 'mox_payment_type_pt_id' => $_pt,
'mox_money_expense_category_moxc_id' => $_moxc_id
),
array(
@@ -162,4 +178,4 @@ class money_expense {
}
-?>
\ No newline at end of file
+?>
diff --git a/_class/class_money_income.php b/_class/class_money_income.php
new file mode 100644
index 0000000..619ab8e
--- /dev/null
+++ b/_class/class_money_income.php
@@ -0,0 +1,140 @@
+mi_id = $_item;
+ }
+
+ public function set_mi_date($_item) {
+ $this->mi_date = $_item;
+ }
+
+ public function set_mi_item($_item) {
+ $this->mi_item = $_item;
+ }
+
+ public function set_mi_sum($_item) {
+ $this->mi_sum = $_item;
+ }
+
+ public function set_mi_money_income_category_mic_id($_item) {
+ $this->mi_mic_id = $_item;
+ }
+
+ public function set_mi_mic($_item) {
+ $this->mi_mic = $_item;
+ }
+
+ public function set_mi_payment_type_pt_id($_payment_type) {
+ $this->mi_payment_type = $_payment_type;
+ }
+
+ public function set_mi_deleted($_item) {
+ $this->mi_deleted = $_item;
+ }
+
+ public function get_mi_id() {
+ return $this->mi_id;
+ }
+
+ public function get_mi_date($_formatted = false) {
+ return !$_formatted ? $this->mi_date : date("Y. m. d.", strtotime($this->mi_date));
+ }
+
+ public function get_mi_date_day() {
+ $day = date("d", strtotime($this->mi_date));
+ if (substr($day, 0, 1) == '0') return substr($day, 1, 1);
+ return date("d", strtotime($this->mi_date));
+ }
+
+ public function get_mi_item() {
+ return $this->mi_item;
+ }
+
+ public function get_mi_sum() {
+ return $this->mi_sum;
+ }
+
+ public function get_mi_mic() {
+ return $this->mi_mic;
+ }
+
+ public function get_mi_money_income_category_mic_id() {
+ return $this->mi_mic_id;
+ }
+
+ public function get_mi_payment_type_pt_id() {
+ return $this->mi_payment_type;
+ }
+
+ public function get_mi_deleted() {
+ return $this->mi_deleted;
+ }
+
+ public function set_mi_data_by_id($_id) {
+ global $sql;
+ $set_data_assoc_array = $sql->assoc_array("select * from money_income where mi_id = " . $_id);
+ $set_data_array = $set_data_assoc_array[0];
+ foreach ($set_data_array as $field => $value) {
+ $function_name = "set_" . $field;
+ $this->$function_name($value); //alapadatok beállítása
+
+ if ($field == 'mi_money_income_category_mic_id' && $value != null) {
+ $new_mic = new money_income_category();
+ $new_mic->set_mic_data_by_id($value);
+ $this->set_mi_mic($new_mic);
+ }
+ if ($field == "mi_payment_type") {
+ $new_pt = new payment_type();
+ $new_pt->set_pt_data_by_id($value);
+ $this->set_mi_payment_type_pt_id($new_pt);
+ }
+ }
+
+ }
+
+ public static function create_money_income($_date, $_item, $_sum, $_mic_id, $_pt) {
+ global $sql;
+
+ return $sql->insert_into('money_income', array(
+ 'mi_date' => $_date,
+ 'mi_item' => $_item,
+ 'mi_sum' => $_sum,
+ 'mi_money_income_category_mic_id' => $_mic_id,
+ 'mi_payment_type_pt_id' => $_pt
+ ));
+ }
+
+ public static function update_money_income($_date, $_item, $_sum, $_mic_id, $_id, $_pt) {
+ global $sql;
+
+ $sql->update_table('money_income',
+ array(
+ 'mi_date' => $_date,
+ 'mi_item' => $_item,
+ 'mi_sum' => $_sum,
+ 'mi_money_income_category_mic_id' => $_mic_id,
+ 'mi_payment_type_pt_id' => $_pt
+ ),
+ array(
+ 'mi_id' => $_id
+ )
+
+
+ );
+ }
+}
+
+
+?>
diff --git a/_class/class_money_income_category.php b/_class/class_money_income_category.php
new file mode 100644
index 0000000..27cd7c7
--- /dev/null
+++ b/_class/class_money_income_category.php
@@ -0,0 +1,59 @@
+mic_id = $_item;
+ }
+
+ public function set_mic_name($_item) {
+ $this->mic_name = $_item;
+ }
+
+ public function set_mic_deleted($_item) {
+ $this->mic_deleted = $_item;
+ }
+
+ public function get_mic_id() {
+ return $this->mic_id;
+ }
+
+ public function get_mic_name() {
+ return $this->mic_name;
+ }
+
+ public function get_mic_deleted() {
+ return $this->mic_deleted;
+ }
+
+ public function set_mic_data_by_id($_id) {
+ global $sql;
+ $set_data_assoc_array = $sql->assoc_array("select * from money_income_category where mic_id = " . $_id);
+ $set_data_array = $set_data_assoc_array[0];
+ foreach ($set_data_array as $field => $value) {
+ $function_name = "set_" . $field;
+ $this->$function_name($value); //alapadatok beállítása
+
+ }
+
+ }
+
+ public static function create_money_income_category($_name) {
+ global $sql;
+
+ return $sql->insert_into('money_income_category', array('mic_name' => $_name));
+ }
+
+ public static function update_money_income_category($_name, $_id) {
+ global $sql;
+
+ $sql->update_table('money_income_category', array('mic_name' => $_name), array('mic_id' => $_id));
+ }
+
+}
+
+
+?>
diff --git a/_class/class_page.php b/_class/class_page.php
old mode 100755
new mode 100644
index f8e9c66..e799ba5
--- a/_class/class_page.php
+++ b/_class/class_page.php
@@ -9,10 +9,10 @@
class page {
-
+
private $page = null;
private $subpage = null;
- private $id = null;
+ private $id = null;
function __construct() {
if (isset($_GET['page'])) $this->set_page($_GET['page']);
@@ -48,7 +48,7 @@ class page {
$menu_assoc_array = $sql->assoc_array($menus_query);
$smarty->assign('menus', $menu_assoc_array);
}
-
+
$smarty->assign('page', $this->get_page());
$smarty->display('nav.tpl');
}
@@ -142,16 +142,16 @@ class page {
break;
case 'log':
# NAPLÓ
- include('include_log.php');
+ include('include_log.php');
break;
case 'money_deposit':
# BEFIZETÉSEK
- include('include_money_deposit.php');
+ include('include_money_deposit.php');
break;
case 'lock_training':
# EDZÉS ZÁROLÁS, FELOLDÁS
include('include_lock_training.php');
- break;
+ break;
case 'view_deposit':
# BEFIZETÉSEK / USER
include('include_view_deposit.php');
@@ -164,6 +164,14 @@ class page {
# KIADÁS KATEGÓRIÁK
include('include_money_expense_category.php');
break;
+ case 'money_income_category':
+ # BEVÉTEL KATEGÓRIÁK
+ include('include_money_income_category.php');
+ break;
+ case 'money_income':
+ # BEVÉTELEK
+ include('include_money_income.php');
+ break;
case 'money_update':
# FRISSÍTÉS
include('include_money_update.php');
@@ -181,15 +189,15 @@ class page {
break;
case 'download_backup':
# BIZTONSÁGI MENTÉS LETÖLTÉS
- include('include_download_backup.php');
+ include('include_download_backup.php');
break;
case 'camps':
# TÁBOROK
- include('include_camps.php');
+ include('include_camps.php');
break;
case 'camp_types':
# TÁBOR TÍPUSOK
- include('include_camp_types.php');
+ include('include_camp_types.php');
break;
case 'camp_shirt_type':
# TÁBOR PÓLÓ TÍPUSOK
@@ -201,27 +209,27 @@ class page {
break;
case 'deny_apply':
# TÁBOR JELENTKEZÉS ELUTASÍTÁSA
- include('include_deny_apply.php');
+ include('include_deny_apply.php');
break;
case 'remove_apply':
# TÁBOR JELENTKEZÉS ELTÁVOLÍTÁSA A LISTÁBÓL
- include('include_remove_apply.php');
+ include('include_remove_apply.php');
break;
case 'apply':
# TÁBORI JELENTKEZŐ ADATAINAK MEGTEKINTÉSE
- include('include_apply.php');
+ include('include_apply.php');
break;
case 'camp_user':
# táborvezetők
- include('include_user_camp_leader.php');
+ include('include_user_camp_leader.php');
break;
case 'camp_details':
# turnusok
- include('include_camp_details.php');
+ include('include_camp_details.php');
break;
case 'user_groups':
# csoportok
- include('include_user_groups.php');
+ include('include_user_groups.php');
break;
case 'delete_training_type':
# EDZÉS TÍPUS TÖRLÉS
@@ -259,6 +267,14 @@ class page {
# BEFIZETÉS TÖRLÉS
include('include_delete_money_expense.php');
break;
+ case 'delete_money_income_category':
+ # BEVÉTEL KATEGÓRIA TÖRLÉS
+ include('include_delete_money_income_category.php');
+ break;
+ case 'delete_money_income':
+ # BEVÉTEL TÖRLÉS
+ include('include_delete_money_income.php');
+ break;
case 'delete_backup':
# MENTÉS TÖRLÉS
include('include_delete_backup.php');
@@ -283,6 +299,9 @@ class page {
# CSOPORT TÖRLÉS
include('include_delete_user_group.php');
break;
+ case 'diary_report':
+ include('include_diary_report.php');
+ break;
case 'logout':
# kijelentkezés
$from = "admin";
@@ -304,15 +323,15 @@ class page {
case 'logout':
# kijelentkezés
$from = "view";
- include('include_logout.php');
+ include('include_logout.php');
break;
case 'overview':
# áttekintő oldal adatokkal
- include('include_overview.php');
+ include('include_overview.php');
break;
case 'diary':
# napló, edzéslista
- include('include_diary.php');
+ include('include_diary.php');
break;
case 'information':
# információk
@@ -328,11 +347,11 @@ class page {
switch ($this->get_subpage()) {
case 'overview':
# áttekintő oldal adatokkal
- include('include_overview.php');
+ include('include_overview.php');
break;
case 'diary':
# napló, edzéslista
- include('include_diary.php');
+ include('include_diary.php');
break;
case 'information':
# információk
@@ -348,12 +367,12 @@ class page {
switch ($this->get_subpage()) {
case 'diary':
# napló, edzéslista
- include('include_coach_diary.php');
+ include('include_coach_diary.php');
break;
case 'logout':
# kijelentkezés
$from = "coach";
- include('include_logout.php');
+ include('include_logout.php');
break;
default:
include('include_coach_diary.php');
@@ -365,7 +384,7 @@ class page {
switch ($this->get_subpage()) {
case 'diary':
# napló, edzéslista
- include('include_coach_diary.php');
+ include('include_coach_diary.php');
break;
default:
include('include_coach_diary.php');
@@ -377,15 +396,15 @@ class page {
switch ($this->get_subpage()) {
case 'informaciok':
# tábori információk
- include('include_camp_information.php');
+ include('include_camp_information.php');
break;
case 'jelentkezes':
# jelentkezés
- include('include_camp_apply.php');
+ include('include_camp_apply.php');
break;
case 'jelentkezesek':
# jelentkezések
- include('include_camp_applies.php');
+ include('include_camp_applies.php');
break;
case 'move_next':
# továbblépés mentés nélkül
@@ -394,11 +413,11 @@ class page {
case 'logout':
# kijelentkezés
$from = "tabor";
- include('include_logout.php');
+ include('include_logout.php');
break;
case 'delete_apply':
# jelentkezés törlése
- include('include_delete_apply.php');
+ include('include_delete_apply.php');
break;
default:
include('include_camp_information.php');
@@ -410,11 +429,11 @@ class page {
switch ($this->get_subpage()) {
case 'taborok':
# turnusok
- include('include_camp_details.php');
+ include('include_camp_details.php');
break;
case 'jelentkezes':
# turnusok
- include('include_apply.php');
+ include('include_apply.php');
break;
case 'logout':
# kijelentkezés
@@ -494,4 +513,4 @@ class page {
-?>
\ No newline at end of file
+?>
diff --git a/_class/class_sql.php b/_class/class_sql.php
old mode 100755
new mode 100644
index a92db84..17f0207
--- a/_class/class_sql.php
+++ b/_class/class_sql.php
@@ -86,76 +86,76 @@ class sql extends mysqli {
}
function export_database($tables=false, $backup_name=false )
- {
+ {
$name = "badminton_coach";
$this->query("SET NAMES 'utf8'");
- $queryTables = $this->query('SHOW TABLES');
- while($row = $queryTables->fetch_row())
- {
- $target_tables[] = $row[0];
- }
- if($tables !== false)
- {
- $target_tables = array_intersect( $target_tables, $tables);
+ $queryTables = $this->query('SHOW TABLES');
+ while($row = $queryTables->fetch_row())
+ {
+ $target_tables[] = $row[0];
+ }
+ if($tables !== false)
+ {
+ $target_tables = array_intersect( $target_tables, $tables);
}
foreach($target_tables as $table)
{
- $result = $this->query('SELECT * FROM '.$table);
- $fields_amount = $result->field_count;
- $rows_num=$this->affected_rows;
- $res = $this->query('SHOW CREATE TABLE '.$table);
+ $result = $this->query('SELECT * FROM '.$table);
+ $fields_amount = $result->field_count;
+ $rows_num=$this->affected_rows;
+ $res = $this->query('SHOW CREATE TABLE '.$table);
$TableMLine = $res->fetch_row();
$content = (!isset($content) ? '' : $content) . "\n\n".$TableMLine[1].";\n\n";
- for ($i = 0, $st_counter = 0; $i < $fields_amount; $i++, $st_counter=0)
+ for ($i = 0, $st_counter = 0; $i < $fields_amount; $i++, $st_counter=0)
{
- while($row = $result->fetch_row())
+ while($row = $result->fetch_row())
{ //when started (and every after 100 command cycle):
- if ($st_counter%100 == 0 || $st_counter == 0 )
+ if ($st_counter%100 == 0 || $st_counter == 0 )
{
$content .= "\nINSERT INTO ".$table." VALUES";
}
$content .= "\n(";
- for($j=0; $j<$fields_amount; $j++)
- {
- $row[$j] = str_replace("\n","\\n", addslashes($row[$j]) );
+ for($j=0; $j<$fields_amount; $j++)
+ {
+ $row[$j] = str_replace("\n","\\n", addslashes($row[$j]) );
if (isset($row[$j]))
{
- $content .= '"'.$row[$j].'"' ;
+ $content .= '"'.$row[$j].'"' ;
}
- else
- {
+ else
+ {
$content .= '""';
- }
+ }
if ($j<($fields_amount-1))
{
$content.= ',';
- }
+ }
}
$content .=")";
//every after 100 command cycle [or at last line] ....p.s. but should be inserted 1 cycle eariler
- if ( (($st_counter+1)%100==0 && $st_counter!=0) || $st_counter+1==$rows_num)
- {
+ if ( (($st_counter+1)%100==0 && $st_counter!=0) || $st_counter+1==$rows_num)
+ {
$content .= ";";
- }
- else
+ }
+ else
{
$content .= ",";
- }
+ }
$st_counter=$st_counter+1;
}
} $content .="\n\n\n";
}
//$backup_name = $backup_name ? $backup_name : $name."___(".date('H-i-s')."_".date('d-m-Y').")__rand".rand(1,11111111).".sql";
$backup_name = $backup_name ? $backup_name : $name.".sql";
- //header('Content-Type: application/octet-stream');
- //header("Content-Transfer-Encoding: Binary");
- //header("Content-disposition: attachment; filename=\"".$backup_name."\"");
+ //header('Content-Type: application/octet-stream');
+ //header("Content-Transfer-Encoding: Binary");
+ //header("Content-disposition: attachment; filename=\"".$backup_name."\"");
return $content;
}
}
-?>
\ No newline at end of file
+?>
diff --git a/_class/class_user_kid.php b/_class/class_user_kid.php
index a727a0d..93ad3b1 100644
--- a/_class/class_user_kid.php
+++ b/_class/class_user_kid.php
@@ -468,7 +468,7 @@ class user_kid extends user_parent {
$sql->update_table('user_kid', $_user_value_array, array('uk_id' => $_user_id));
}
- public function calculate_balance(&$_de_obj_array, $_user_obj = null) {
+ public function calculate_balance(&$_de_obj_array, $_user_obj = null, $update = true) {
//kiszámolja az egyenleget a diary entry-k alapján, amik tömbben érkeznek
//a tömbben feltölti a pénzmozgást, és minden lépésben befrissíti az egyenleget
//az update-elt tömböt adja vissza
@@ -508,17 +508,17 @@ class user_kid extends user_parent {
}
}
elseif ($_de->get_de_type() == 'money_deposit') {
- $_de->set_de_transaction($_de->get_de_money_deposit()->get_mod_sum());
+ $_de->set_de_transaction($_de->get_de_money_deposit()->get_mod_money_income()->get_mi_sum());
$_de->set_de_balance($_de->get_de_balance()+$_de->get_de_transaction());
//$balance += $_de->get_de_money_deposit()->get_mod_sum();
//echo $_de->get_de_date() . " plussz " . $_de->get_de_money_deposit()->get_mod_sum() . "
";
}
}
-
-
- if (isset($_de)) $sql->update_table('user_kid', (array('uk_balance' => $_de->get_de_balance())), array('uk_id' => (is_object($_user_obj)?$_user_obj->get_uk_id():$this->get_uk_id())), false);
- else $sql->update_table('user_kid', (array('uk_balance' => 0)), array('uk_id' => (is_object($_user_obj)?$_user_obj->get_uk_id():$this->get_uk_id())), false);
+ if ($update) {
+ if (isset($_de)) $sql->update_table('user_kid', (array('uk_balance' => $_de->get_de_balance())), array('uk_id' => (is_object($_user_obj)?$_user_obj->get_uk_id():$this->get_uk_id())), false);
+ else $sql->update_table('user_kid', (array('uk_balance' => 0)), array('uk_id' => (is_object($_user_obj)?$_user_obj->get_uk_id():$this->get_uk_id())), false);
+ }
return $_de_obj_array;
}
diff --git a/_image/income.png b/_image/income.png
new file mode 100644
index 0000000..1041b1a
Binary files /dev/null and b/_image/income.png differ
diff --git a/_include/include_create.php b/_include/include_create.php
old mode 100755
new mode 100644
index 203e844..f0b0b66
--- a/_include/include_create.php
+++ b/_include/include_create.php
@@ -133,6 +133,9 @@ switch ($this->get_id()) {
$moxc_array[] = $new_moxc;
}
+ $pt_assoc_array = $sql->assoc_array('SELECT * FROM payment_type ORDER BY pt_id ASC;');
+
+ $smarty->assign('pt_assoc_array', $pt_assoc_array);
$smarty->assign('moxc_array', $moxc_array);
$smarty->display('money_expense_create.tpl');
break;
@@ -140,6 +143,26 @@ switch ($this->get_id()) {
# ÚJ KIADÁS KATEGÓRIA
$smarty->display('money_expense_category_create.tpl');
break;
+ case 'money_income_category':
+ # ÚJ BEVÉTEL KATEGÓRIA
+ $smarty->display('money_income_category_create.tpl');
+ break;
+ case 'money_income':
+ # ÚJ KIADÁS
+ $mic_assoc_array = $sql->assoc_array('SELECT * FROM money_income_category WHERE mic_deleted = 0 AND mic_id != 4 ORDER BY mic_name ASC;');
+ $mic_array = array();
+ foreach ($mic_assoc_array as $key => $mic) {
+ $new_mic = new money_income_category();
+ $new_mic->set_mic_data_by_id($mic['mic_id']);
+ $mic_array[] = $new_mic;
+ }
+
+ $pt_assoc_array = $sql->assoc_array('SELECT * FROM payment_type ORDER BY pt_id ASC;');
+
+ $smarty->assign('pt_assoc_array', $pt_assoc_array);
+ $smarty->assign('mic_array', $mic_array);
+ $smarty->display('money_income_create.tpl');
+ break;
case 'backup':
# BACKUP
//létrehozzá, és hozzáfűzi az ID-t a dátumhoz
diff --git a/_include/include_delete_money_deposit.php b/_include/include_delete_money_deposit.php
index 6667180..9b176a0 100644
--- a/_include/include_delete_money_deposit.php
+++ b/_include/include_delete_money_deposit.php
@@ -1,13 +1,14 @@
is_id()) {
- $sql->update_table('money_deposit', array('mod_deleted' => 1), array('mod_id' => $this->get_id()));
- $new_mod = new money_deposit();
- $new_mod->set_mod_data_by_id($this->get_id());
+ $sql->update_table('money_deposit', array('mod_deleted' => 1), array('mod_id' => $this->get_id()));
+ $new_mod = new money_deposit();
+ $new_mod->set_mod_data_by_id($this->get_id());
+ $sql->update_table('money_income', array('mi_deleted' => 1), array('mi_id' => $new_mod->get_mod_money_income_mi_id()));
//log::register('update_money_deposit', $tmp_user->get_uk_name() . ': ' . $_POST['mod_sum']. ' Ft (' . $_POST['mod_date'] . ')');
- log::register('delete_money_deposit', $new_mod->get_mod_user_kid()->get_uk_name() . ': ' . $new_mod->get_mod_sum() . ' Ft (' . $new_mod->get_mod_date() . ')');
+ log::register('delete_money_deposit', $new_mod->get_mod_user_kid()->get_uk_name() . ': ' . $new_mod->get_mod_money_income()->get_mi_sum() . ' Ft (' . $new_mod->get_mod_money_income()->get_mi_date() . ')');
header("Location: /admin/money_deposit");
}
-?>
\ No newline at end of file
+?>
diff --git a/_include/include_delete_money_income.php b/_include/include_delete_money_income.php
new file mode 100644
index 0000000..0035ac6
--- /dev/null
+++ b/_include/include_delete_money_income.php
@@ -0,0 +1,12 @@
+is_id()) {
+ $sql->update_table('money_income', array('mi_deleted' => 1), array('mi_id' => $this->get_id()));
+ $mi = new money_income();
+ $mi->set_mi_data_by_id($this->get_id());
+ log::register('delete_mi', $mi->get_mi_item() . ": " . $mi->get_mi_sum() . " Ft");
+ header("Location: /admin/money_income");
+}
+
+
+?>
diff --git a/_include/include_delete_money_income_category.php b/_include/include_delete_money_income_category.php
new file mode 100644
index 0000000..f83f0f2
--- /dev/null
+++ b/_include/include_delete_money_income_category.php
@@ -0,0 +1,18 @@
+is_id()) {
+ $sql->update_table('money_income_category', array('mic_deleted' => 1), array('mic_id' => $this->get_id()));
+ log::register('delete_mic', $this->get_id());
+
+ //akiknek ez a mic_id van beállítva, azoknál null-ra állítjuk
+ $mi_query = "SELECT mi_id FROM money_income WHERE mi_money_income_category_mic_id = " . $this->get_id();
+ $mi_assoc_array = $sql->assoc_array($mi_query);
+ foreach ($mi_assoc_array as $uk_id) {
+ $sql->update_table('money_income', array('mi_money_income_category_mic_id' => 'null'), array('mi_id' => $uk_id['mi_id']));
+ }
+
+ header("Location: /admin/money_income_category");
+}
+
+
+?>
diff --git a/_include/include_diary.php b/_include/include_diary.php
index 66c9d23..5a4dec6 100644
--- a/_include/include_diary.php
+++ b/_include/include_diary.php
@@ -3,11 +3,11 @@
$action_list_query = "
- SELECT
+ SELECT
object_id,
timestamp(object_date) as object_date,
object_type,
- (SELECT
+ (SELECT
count(distinct date(tr_date))
FROM
presence
@@ -18,12 +18,12 @@
AND MONTH(tr_date) = MONTH(object_date)
AND tr_date <= object_date
AND pr_user_kid_uk_id = ".$user->get_uk_id()."
- AND tr_date > (select
+ AND tr_date > (select
if(max(trd) is null,
'1900-01-01',
max(trd))
from
- (select
+ (select
tr_date trd
from
presence
@@ -31,7 +31,7 @@
join user_kid ON uk_id = pr_user_kid_uk_id
where
pr_user_kid_uk_id = ".$user->get_uk_id()."
- and tr_date >= (SELECT
+ and tr_date >= (SELECT
tr_date
from
presence
@@ -44,7 +44,7 @@
limit 1)
order by tr_date ASC
limit 2) as elso_ket_edzes)) as 'training_per_month',
- (SELECT
+ (SELECT
count(pr_id)
FROM
presence
@@ -54,12 +54,12 @@
DATE(tr_date) = DATE(object_date)
AND tr_date <= object_date
AND pr_user_kid_uk_id = ".$user->get_uk_id().") as 'training_per_day',
- (select
+ (select
if(sum(if(trd = object_date, 1, 0)) > 0,
1,
0)
from
- (select
+ (select
tr_date trd
from
presence
@@ -67,7 +67,7 @@
join user_kid ON uk_id = pr_user_kid_uk_id
where
pr_user_kid_uk_id = ".$user->get_uk_id()."
- and tr_date >= (SELECT
+ and tr_date >= (SELECT
tr_date
from
presence
@@ -81,7 +81,7 @@
order by tr_date ASC
limit 2) elso2edzes) as 'first_two'
FROM
- ((SELECT
+ ((SELECT
pr_training_tr_id as object_id,
timestamp(tr_date) as object_date,
if(pr_training_tr_id is not null, 'training', null) as object_type
@@ -90,12 +90,14 @@ FROM
JOIN training ON tr_id = pr_training_tr_id
WHERE
pr_user_kid_uk_id = ".$user->get_uk_id()."
- AND tr_deleted = 0) UNION (SELECT
+ AND tr_deleted = 0) UNION (SELECT
mod_id,
- timestamp(mod_date),
+ timestamp(mi_date),
if(mod_id is not null, 'money_deposit', null) as object_type
FROM
money_deposit
+ JOIN
+ money_income ON mi_id = mod_money_income_mi_id
WHERE
mod_user_kid_uk_id = ".$user->get_uk_id()."
and mod_deleted = 0)) actions
@@ -134,7 +136,7 @@ order by object_date ASC;
$smarty->assign('actions', $de_array);
//$smarty->assign('balance', $balance);
$smarty->display('user_diary.tpl');
-
-?>
\ No newline at end of file
+
+?>
diff --git a/_include/include_diary_report.php b/_include/include_diary_report.php
new file mode 100644
index 0000000..0dbb91f
--- /dev/null
+++ b/_include/include_diary_report.php
@@ -0,0 +1,158 @@
+assoc_array($users_q);
+
+foreach ($users as $key => $user) {
+ # code...
+
+
+ $action_list_query = "
+ SELECT
+ object_id,
+ timestamp(object_date) as object_date,
+ object_type,
+ (SELECT
+ count(distinct date(tr_date))
+ FROM
+ presence
+ JOIN
+ training ON tr_id = pr_training_tr_id
+ WHERE
+ YEAR(tr_date) = YEAR(object_date)
+ AND MONTH(tr_date) = MONTH(object_date)
+ AND tr_date <= object_date
+ AND pr_user_kid_uk_id = ".$user['uk_id']."
+ AND tr_date > (select
+ if(max(trd) is null,
+ '1900-01-01',
+ max(trd))
+ from
+ (select
+ tr_date trd
+ from
+ presence
+ join training ON tr_id = pr_training_tr_id
+ join user_kid ON uk_id = pr_user_kid_uk_id
+ where
+ pr_user_kid_uk_id = ".$user['uk_id']."
+ and tr_date >= (SELECT
+ tr_date
+ from
+ presence
+ join training ON tr_id = pr_training_tr_id
+ join user_kid ON uk_id = pr_user_kid_uk_id
+ where
+ pr_user_kid_uk_id = ".$user['uk_id']."
+ and date(tr_date) = uk_first_training
+ ORDER BY tr_date ASC
+ limit 1)
+ order by tr_date ASC
+ limit 2) as elso_ket_edzes)) as 'training_per_month',
+ (SELECT
+ count(pr_id)
+ FROM
+ presence
+ JOIN
+ training ON tr_id = pr_training_tr_id
+ WHERE
+ DATE(tr_date) = DATE(object_date)
+ AND tr_date <= object_date
+ AND pr_user_kid_uk_id = ".$user['uk_id'].") as 'training_per_day',
+ (select
+ if(sum(if(trd = object_date, 1, 0)) > 0,
+ 1,
+ 0)
+ from
+ (select
+ tr_date trd
+ from
+ presence
+ join training ON tr_id = pr_training_tr_id
+ join user_kid ON uk_id = pr_user_kid_uk_id
+ where
+ pr_user_kid_uk_id = ".$user['uk_id']."
+ and tr_date >= (SELECT
+ tr_date
+ from
+ presence
+ join training ON tr_id = pr_training_tr_id
+ join user_kid ON uk_id = pr_user_kid_uk_id
+ where
+ pr_user_kid_uk_id = ".$user['uk_id']."
+ and date(tr_date) = uk_first_training
+ ORDER BY tr_date ASC
+ limit 1)
+ order by tr_date ASC
+ limit 2) elso2edzes) as 'first_two'
+FROM
+ ((SELECT
+ pr_training_tr_id as object_id,
+ timestamp(tr_date) as object_date,
+ if(pr_training_tr_id is not null, 'training', null) as object_type
+ FROM
+ presence
+ JOIN training ON tr_id = pr_training_tr_id
+ WHERE
+ pr_user_kid_uk_id = ".$user['uk_id']."
+ AND tr_deleted = 0) UNION (SELECT
+ mod_id,
+ timestamp(mi_date),
+ if(mod_id is not null, 'money_deposit', null) as object_type
+ FROM
+ money_deposit
+ JOIN
+ money_income ON mi_id = mod_money_income_mi_id
+ WHERE
+ mod_user_kid_uk_id = ".$user['uk_id']."
+ and mod_deleted = 0)) actions
+order by object_date ASC;
+ ";
+
+ $action_assoc_array = $sql->assoc_array($action_list_query);
+
+ $actions = array();
+ $de_array = array();
+ foreach ($action_assoc_array as $action) {
+
+ if ($action['object_type'] == 'training') {
+ $new_training = new training;
+ $new_training->set_training_data_by_id($action['object_id']);
+ //$actions[] = $new_training;
+ $new_diary_entry = new diary_entry($action['object_id'], $action['object_date'], $action['object_type'], $action['training_per_month'], $action['training_per_day'], $action['first_two'], $new_training);
+ }
+ elseif ($action['object_type'] == 'money_deposit') {
+ $new_mod = new money_deposit;
+ $new_mod->set_mod_data_by_id($action['object_id']);
+ //$actions[] = $new_mod;
+ $new_diary_entry = new diary_entry($action['object_id'], $action['object_date'], $action['object_type'], $action['training_per_month'], $action['training_per_day'], $action['first_two'], null, $new_mod);
+ }
+
+ $de_array[] = $new_diary_entry;
+
+ //var_dump($de_array);
+
+ }
+ $user_obj = new user_kid();
+ $user_obj->set_user_data_by_id($user['uk_id']);
+ $user_obj->calculate_balance($de_array, $user_obj, false);
+ $res[$user['uk_name']] = $de_array;
+}
+
+
+
+ //itt csak hivatkozással adjuk át a tömböt, a calculate_balance kiszámolja, belerakja és visszadja
+ //$user->calculate_balance($de_array, $user);
+ //var_dump($de_array);
+ //$smarty->assign('actions', $actions);
+ $de_array = array_reverse($de_array);
+ $smarty->assign('actions', $de_array);
+ $smarty->assign('res', $res);
+ //$smarty->assign('balance', $balance);
+
+ //$smarty->display('user_diary.tpl');
+ $smarty->display('diary_report.tpl');
+
+
+
+?>
diff --git a/_include/include_money_deposit.php b/_include/include_money_deposit.php
index e260d3b..ccc1c83 100644
--- a/_include/include_money_deposit.php
+++ b/_include/include_money_deposit.php
@@ -32,7 +32,7 @@ if ($this->is_id()) {
}
else {
# BEFIZETÉS LISTA
- $mod_query = "SELECT * FROM money_deposit WHERE mod_deleted = 0 ORDER BY mod_date DESC, mod_id DESC;";
+ $mod_query = "SELECT * FROM money_deposit JOIN money_income ON mod_money_income_mi_id = mi_id WHERE mod_deleted = 0 ORDER BY mi_date DESC, mi_id DESC;";
$mod_array = array();
$mod_assoc_array = $sql->assoc_array($mod_query);
diff --git a/_include/include_money_expense.php b/_include/include_money_expense.php
index 020bc48..6f871a0 100644
--- a/_include/include_money_expense.php
+++ b/_include/include_money_expense.php
@@ -9,7 +9,7 @@
if ($this->is_id()) {
# ADOTT KIADÁS ADATINAK MEGTEKINTÉSE/MÓDOSÍTÁSA
-
+
$new_mox = new money_expense();
$new_mox->set_mox_data_by_id($this->get_id());
@@ -21,14 +21,16 @@ if ($this->is_id()) {
$new_moxc = new money_expense_category();
$new_moxc->set_moxc_data_by_id($mox['moxc_id']);
$moxc_array[] = $new_moxc;
- }
+ }
+
+ $pt_assoc_array = $sql->assoc_array('SELECT * FROM payment_type ORDER BY pt_id ASC;');
$smarty->assign("moxc_array", $moxc_array);
-
+ $smarty->assign('pt_assoc_array', $pt_assoc_array);
$smarty->assign("mox", $new_mox);
$smarty->display("money_expense_data_edit.tpl");
-
+
}
else {
# KIADÁS LISTA
@@ -40,11 +42,11 @@ else {
$new_mox = new money_expense();
$new_mox->set_mox_data_by_id($mod['mox_id']);
$mox_array[] = $new_mox;
- }
+ }
$smarty->assign("mox_array", $mox_array);
$smarty->display("money_expense.tpl");
}
-?>
\ No newline at end of file
+?>
diff --git a/_include/include_money_expense_category.php b/_include/include_money_expense_category.php
index 3b9d745..ee3aaa1 100644
--- a/_include/include_money_expense_category.php
+++ b/_include/include_money_expense_category.php
@@ -1,24 +1,24 @@
is_id()) {
- # ADOTT KIADÁS KATEGÓRIA ADATINAK MEGTEKINTÉSE/MÓDOSÍTÁSA
+ # ADOTT BEVÉTEL KATEGÓRIA ADATINAK MEGTEKINTÉSE/MÓDOSÍTÁSA
$new_moxc = new money_expense_category();
$new_moxc->set_moxc_data_by_id($this->get_id());
$smarty->assign("moxc", $new_moxc);
- $smarty->display("money_expense_category_data_edit.tpl");
-
+ $smarty->display("money_expense_category_data_edit.tpl");
+
}
else {
- # KIADÁS KATEGÓRIA LISTA
+ # BEVÉTEL KATEGÓRIA LISTA
$moxc_query = "SELECT * FROM money_expense_category WHERE moxc_deleted = 0 ORDER BY moxc_name ASC;";
$moxc_array = array();
$moxc_assoc_array = $sql->assoc_array($moxc_query);
@@ -27,11 +27,11 @@ else {
$new_moxc = new money_expense_category();
$new_moxc->set_moxc_data_by_id($mox['moxc_id']);
$moxc_array[] = $new_moxc;
- }
+ }
$smarty->assign("moxc_assoc_array", $moxc_array);
$smarty->display("money_expense_category.tpl");
}
-?>
\ No newline at end of file
+?>
diff --git a/_include/include_money_income.php b/_include/include_money_income.php
new file mode 100644
index 0000000..8546cde
--- /dev/null
+++ b/_include/include_money_income.php
@@ -0,0 +1,52 @@
+is_id()) {
+ # ADOTT BEVÉTEL ADATINAK MEGTEKINTÉSE/MÓDOSÍTÁSA
+
+ $new_mi = new money_income();
+ $new_mi->set_mi_data_by_id($this->get_id());
+
+ $mic_query = "SELECT * FROM money_income_category WHERE mic_deleted = 0 AND mic_id != 4 ORDER BY mic_name ASC;";
+ $mic_array = array();
+ $mic_assoc_array = $sql->assoc_array($mic_query);
+
+ foreach ($mic_assoc_array as $mi) {
+ $new_mic = new money_income_category();
+ $new_mic->set_mic_data_by_id($mi['mic_id']);
+ $mic_array[] = $new_mic;
+ }
+
+ $pt_assoc_array = $sql->assoc_array('SELECT * FROM payment_type ORDER BY pt_id ASC;');
+
+
+ $smarty->assign("mic_array", $mic_array);
+ $smarty->assign('pt_assoc_array', $pt_assoc_array);
+ $smarty->assign("mi", $new_mi);
+ $smarty->display("money_income_data_edit.tpl");
+
+}
+else {
+ # BEVÉTEL LISTA
+ $mi_query = "SELECT * FROM money_income WHERE mi_deleted = 0 AND mi_money_income_category_mic_id != 4 ORDER BY mi_date DESC, mi_id DESC;";
+ $mi_array = array();
+ $mi_assoc_array = $sql->assoc_array($mi_query);
+
+ foreach ($mi_assoc_array as $mod) {
+ $new_mi = new money_income();
+ $new_mi->set_mi_data_by_id($mod['mi_id']);
+ $mi_array[] = $new_mi;
+ }
+
+ $smarty->assign("mi_array", $mi_array);
+ $smarty->display("money_income.tpl");
+
+}
+
+?>
diff --git a/_include/include_money_income_category.php b/_include/include_money_income_category.php
new file mode 100644
index 0000000..f6ad6d7
--- /dev/null
+++ b/_include/include_money_income_category.php
@@ -0,0 +1,37 @@
+is_id()) {
+ # ADOTT BEVÉTEL KATEGÓRIA ADATINAK MEGTEKINTÉSE/MÓDOSÍTÁSA
+
+ $new_mic = new money_income_category();
+ $new_mic->set_mic_data_by_id($this->get_id());
+
+ $smarty->assign("mic", $new_mic);
+ $smarty->display("money_income_category_data_edit.tpl");
+
+}
+else {
+ # BEVÉTEL KATEGÓRIA LISTA
+ $mic_query = "SELECT * FROM money_income_category WHERE mic_deleted = 0 AND mic_id != 4 ORDER BY mic_name ASC;";
+ $mic_array = array();
+ $mic_assoc_array = $sql->assoc_array($mic_query);
+
+ foreach ($mic_assoc_array as $mi) {
+ $new_mic = new money_income_category();
+ $new_mic->set_mic_data_by_id($mi['mic_id']);
+ $mic_array[] = $new_mic;
+ }
+
+ $smarty->assign("mic_assoc_array", $mic_array);
+ $smarty->display("money_income_category.tpl");
+
+}
+
+?>
diff --git a/_include/include_stats.php b/_include/include_stats.php
index 223b386..4a27b1c 100644
--- a/_include/include_stats.php
+++ b/_include/include_stats.php
@@ -10,12 +10,31 @@ if ($this->is_id()) {
# todo: stat_group-ok és stat_value-k
if (1 == $this->get_id()) {
+ /* adatok:
+ bevétel kp + utalás
+ kiadás kp + utalás
+ összebevétel
+ összkiadás
+ totál balance
+ */
+ $in_cash_query = "SELECT sum(mi_sum) FROM money_income WHERE mi_deleted = 0 AND mi_payment_type_pt_id = 1";
+ $in_transfer_query = "SELECT sum(mi_sum) FROM money_income WHERE mi_deleted = 0 AND mi_payment_type_pt_id = 2";
+
+ $out_cash_query = "SELECT sum(mox_sum) FROM money_expense WHERE mox_deleted = 0 AND mox_payment_type_pt_id = 1";
+ $out_transfer_query = "SELECT sum(mox_sum) FROM money_expense WHERE mox_deleted = 0 AND mox_payment_type_pt_id = 2";
+
+ $in_cash = $sql->single_variable($in_cash_query);
+ $out_cash = $sql->single_variable($out_cash_query);
+
+ $in_transfer = $sql->single_variable($in_transfer_query);
+ $out_transfer = $sql->single_variable($out_transfer_query);
+
$balance_query = "
- select
- (select
- sum(mod_sum)
+ select
+ (select
+ sum(mi_sum)
from
- money_deposit where mod_deleted = 0) - (select
+ money_income where mi_deleted = 0) - (select
sum(mox_sum)
from
money_expense where mox_deleted = 0) as diff
@@ -24,6 +43,10 @@ if ($this->is_id()) {
$balance = $sql->single_variable($balance_query);
+ $smarty->assign('in_cash',$in_cash);
+ $smarty->assign('out_cash',$out_cash);
+ $smarty->assign('in_transfer',$in_transfer);
+ $smarty->assign('out_transfer',$out_transfer);
$smarty->assign('balance',$balance);
$smarty->display('stat_balance.tpl');
}
@@ -31,7 +54,7 @@ if ($this->is_id()) {
}
else {
-
+
# STAT LISTA
$stat_query = "SELECT * FROM statistics WHERE stat_deleted = 0 ORDER BY stat_order ASC;";
@@ -46,11 +69,11 @@ else {
$smarty->assign('stats',$stats);
$smarty->display('stat_list.tpl');
-
+
}
-?>
\ No newline at end of file
+?>
diff --git a/event_handler.php b/event_handler.php
index 1982306..0959625 100644
--- a/event_handler.php
+++ b/event_handler.php
@@ -304,36 +304,60 @@ if (isset($_POST['action'])) {
break;
case 'money_deposit_update':
# befizetés módosítás
- money_deposit::update_money_deposit($_POST['mod_user_kid_uk_id'], $_POST['mod_date'], $_POST['mod_sum'], $_POST['mod_id'], $_POST['mod_payment_type']);
+ money_deposit::update_money_deposit($_POST['mod_user_kid_uk_id'], $_POST['mod_date'], $_POST['mod_sum'], $_POST['mod_id'], $_POST['mod_payment_type'], $_POST['mi_id']);
$tmp_user = new user_kid();
$tmp_user->set_user_data_by_id($_POST['mod_user_kid_uk_id']);
log::register('update_money_deposit', $tmp_user->get_uk_name() . ': ' . $_POST['mod_sum']. ' Ft (' . $_POST['mod_date'] . ')');
header("Location: /admin/money_deposit");
break;
case 'moxc_create':
- # befizetés kategória létrehozása
+ # kiadás kategória létrehozása
$new_moxc_id = money_expense_category::create_money_expense_category($_POST['moxc_name']);
log::register('new_moxc', $new_moxc_id);
header("Location: /admin/money_expense_category");
break;
case 'moxc_update':
- # befizetés kategória módosítása
+ # kiadás kategória módosítása
money_expense_category::update_money_expense_category($_POST['moxc_name'], $_POST['moxc_id']);
log::register('update_moxc', $_POST['moxc_id']);
header("Location: /admin/money_expense_category");
break;
case 'mox_create':
- # befizetés létrehozása
- $new_mox_id = money_expense::create_money_expense($_POST['mox_name'], $_POST['mox_date'], $_POST['mox_item'], $_POST['mox_sum'], $_POST['mox_moxc_id']);
+ # kiadás létrehozása
+ $new_mox_id = money_expense::create_money_expense($_POST['mox_name'], $_POST['mox_date'], $_POST['mox_item'], $_POST['mox_sum'], $_POST['mox_moxc_id'], $_POST['mox_payment_type']);
log::register('new_mox', $_POST['mox_item'] . ": " . $_POST['mox_sum'] . " Ft");
header("Location: /admin/money_expense");
break;
case 'mox_update':
- # befizetés módosítása
- money_expense::update_money_expense($_POST['mox_name'], $_POST['mox_date'], $_POST['mox_item'], $_POST['mox_sum'], $_POST['mox_moxc_id'], $_POST['mox_id']);
+ # kiadás módosítása
+ money_expense::update_money_expense($_POST['mox_name'], $_POST['mox_date'], $_POST['mox_item'], $_POST['mox_sum'], $_POST['mox_moxc_id'], $_POST['mox_id'], $_POST['mox_payment_type']);
log::register('update_mox', $_POST['mox_item'] . ": " . $_POST['mox_sum'] . " Ft");
header("Location: /admin/money_expense");
break;
+ case 'mic_create':
+ # bevétel kategória létrehozása
+ $new_mic_id = money_income_category::create_money_income_category($_POST['mic_name']);
+ log::register('new_mic', $new_mic_id);
+ header("Location: /admin/money_income_category");
+ break;
+ case 'mi_create':
+ # bevétel létrehozása
+ $new_mi_id = money_income::create_money_income($_POST['mi_date'], $_POST['mi_item'], $_POST['mi_sum'], $_POST['mi_mic_id'], $_POST['mi_payment_type']);
+ log::register('new_mi', $_POST['mi_item'] . ": " . $_POST['mi_sum'] . " Ft");
+ header("Location: /admin/money_income");
+ break;
+ case 'mic_update':
+ # bevétel kategória módosítása
+ money_income_category::update_money_income_category($_POST['mic_name'], $_POST['mic_id']);
+ log::register('update_mic', $_POST['mic_id']);
+ header("Location: /admin/money_income_category");
+ break;
+ case 'mi_update':
+ # bevétel módosítása
+ money_income::update_money_income($_POST['mi_date'], $_POST['mi_item'], $_POST['mi_sum'], $_POST['mi_mic_id'], $_POST['mi_id'], $_POST['mi_payment_type']);
+ log::register('update_mi', $_POST['mi_item'] . ": " . $_POST['mi_sum'] . " Ft");
+ header("Location: /admin/money_income");
+ break;
case 'settings_data_edit':
$sql->update_table('setting_value',
array(
@@ -381,6 +405,7 @@ if (isset($_POST['action'])) {
camp::create_camp($_POST['camp_city'], $_POST['camp_from'], $_POST['camp_to'], $_POST['camp_leader'], $_POST['camp_helpers'], (!empty($_POST['camp_is_open'])?1:0), $_POST['camp_camp_type_ct_id'], $shuttles, $accoms);
log::register('new_camp', $_POST['camp_from'] . " (" . $_POST['camp_city'] . ")");
+ header("Location: /admin/camps");
break;
case 'camp_update':
# tábor módosítás
diff --git a/index.php b/index.php
index 64929cd..a775481 100644
--- a/index.php
+++ b/index.php
@@ -10,6 +10,7 @@ setlocale(LC_ALL, 'hu_HU');
?>
-
- {if $mod->get_mod_payment_type_pt_id() == 1}
+ {if $mod->get_mod_money_income()->get_mi_payment_type_pt_id() == 1}
{else}
@@ -35,10 +35,10 @@
{$mod->get_mod_user_kid()->get_uk_name()}
|
- {$mod->get_mod_date(true)} + {$mod->get_mod_money_income()->get_mi_date(true)} | - {$mod->get_mod_sum()|number_format:0:'':' '} Ft + {$mod->get_mod_money_income()->get_mi_sum()|number_format:0:'':' '} Ft |