diff --git a/_class/class_money_income.php b/_class/class_money_income.php index 619ab8e..0000aca 100644 --- a/_class/class_money_income.php +++ b/_class/class_money_income.php @@ -8,7 +8,10 @@ class money_income { private $mi_sum; private $mi_mic_id = null; private $mi_mic = null; - private $mi_payment_type; + private $mi_payment_type; // id + + private $mi_payment_type_obj; // guess what? object! + private $mi_deleted; @@ -40,6 +43,10 @@ class money_income { $this->mi_payment_type = $_payment_type; } + public function set_mi_payment_type_pt_obj($_payment_type) { + $this->mi_payment_type_obj = $_payment_type; + } + public function set_mi_deleted($_item) { $this->mi_deleted = $_item; } @@ -78,6 +85,10 @@ class money_income { return $this->mi_payment_type; } + public function get_mi_payment_type_pt_obj() { + return $this->mi_payment_type_obj; + } + public function get_mi_deleted() { return $this->mi_deleted; } @@ -95,10 +106,10 @@ class money_income { $new_mic->set_mic_data_by_id($value); $this->set_mi_mic($new_mic); } - if ($field == "mi_payment_type") { + if ($field == "mi_payment_type_pt_id") { $new_pt = new payment_type(); $new_pt->set_pt_data_by_id($value); - $this->set_mi_payment_type_pt_id($new_pt); + $this->set_mi_payment_type_pt_obj($new_pt); } } diff --git a/_class/class_user_kid.php b/_class/class_user_kid.php index 9ca31bd..9283fb0 100644 --- a/_class/class_user_kid.php +++ b/_class/class_user_kid.php @@ -456,14 +456,6 @@ class user_kid extends user_parent { if (!isset($_user_value_array['uk_is_active'])) $_user_value_array['uk_is_active'] = 0; if (!isset($_user_value_array['uk_lease'])) $_user_value_array['uk_lease'] = 0; - $l_ids = array(); - if (isset($_user_value_array['level']) && is_array($_user_value_array['level'])) { - foreach ($_user_value_array['level'] as $key => $l_id) { - $l_ids[] = $l_id; - } - unset($_user_value_array['level']); - } - $kidId = $sql->insert_into('user_kid', $_user_value_array); /* @@ -478,16 +470,6 @@ class user_kid extends user_parent { } */ - if (!empty($l_ids)) { - foreach ($l_ids as $key => $l_id) { - $sql->insert_into('user_kid_lease', array( - 'ukl_user_kid_uk_id' => $kidId, - 'ukl_lease_l_id' => $l_id, - ) - ); - } - } - return $kidId; } @@ -568,25 +550,6 @@ class user_kid extends user_parent { if (!isset($_user_value_array['uk_balance_expires'])) $_user_value_array['uk_balance_expires'] = 0; if (!isset($_user_value_array['uk_lease'])) $_user_value_array['uk_lease'] = 0; - $l_ids = array(); - if (isset($_user_value_array['level']) && is_array($_user_value_array['level'])) { - foreach ($_user_value_array['level'] as $key => $l_id) { - $l_ids[] = $l_id; - } - unset($_user_value_array['level']); - } - - $sql->execute_query("DELETE FROM user_kid_lease WHERE ukl_user_kid_uk_id = {$_user_id}"); - if (!empty($l_ids)) { - foreach ($l_ids as $key => $l_id) { - $sql->insert_into('user_kid_lease', array( - 'ukl_user_kid_uk_id' => $_user_id, - 'ukl_lease_l_id' => $l_id, - ) - ); - } - } - $sql->update_table('user_kid', $_user_value_array, array('uk_id' => $_user_id)); } diff --git a/_css/default.css b/_css/default.css index 797f691..42e6537 100644 --- a/_css/default.css +++ b/_css/default.css @@ -216,12 +216,19 @@ a.addbutton.noti { min-width: 90px; } +.list_item table.money td.kid-name { + width: 210px; +} + +.list_item table.money td.lease-name { + width: 225px; +} + .list_item table.money td.date { text-align: right; padding-right: 25px; } - .list_item table.money td.no_mobile_show { display: none; } @@ -428,7 +435,7 @@ table.email.log tr:hover { .date_separator img { width: 20px; - float: right; + height: 13px; margin-top: 4px; margin-right: 10px; border: 0; diff --git a/_include/include_create.php b/_include/include_create.php index df5c045..7962fa0 100644 --- a/_include/include_create.php +++ b/_include/include_create.php @@ -35,16 +35,12 @@ switch ($this->get_id()) { //training type array //$tt_assoc_array = $sql->assoc_array("SELECT * FROM training_type WHERE trt_deleted = 0 ORDER by trt_name ASC;"); - //lease assoc array - $l_assoc_array = $sql->assoc_array("SELECT * FROM lease WHERE l_deleted = 0 ORDER BY l_name ASC;"); - $smarty->assign('region_assoc_array', $region_assoc_array); $smarty->assign('shirt_size_assoc_array', $shirt_size_assoc_array); $smarty->assign('school_assoc_array', $schools); $smarty->assign('school_city_assoc_array', $school_cities); $smarty->assign('parent_assoc_array', $parent_assoc_array); //$smarty->assign('tt_assoc_array', $tt_assoc_array); - $smarty->assign('l_assoc_array', $l_assoc_array); $smarty->assign('today', date("Y-m-d")); $smarty->display('user_data_create.tpl'); diff --git a/_include/include_members.php b/_include/include_members.php index a45b683..a7f22a0 100644 --- a/_include/include_members.php +++ b/_include/include_members.php @@ -37,9 +37,6 @@ if ($this->is_id()) { //training type array //$tt_assoc_array = $sql->assoc_array("SELECT * FROM training_type WHERE trt_deleted = 0 ORDER by trt_name ASC;"); - - //lease assoc array - $l_assoc_array = $sql->assoc_array("SELECT * FROM lease WHERE l_deleted = 0 ORDER BY l_name ASC;"); //smarty thingz $smarty->assign('school_assoc_array', $schools); @@ -49,7 +46,6 @@ if ($this->is_id()) { $smarty->assign('shirt_size_assoc_array', $shirt_size_assoc_array); $smarty->assign('parent_assoc_array', $parent_assoc_array); //$smarty->assign('tt_assoc_array', $tt_assoc_array); - $smarty->assign('l_assoc_array', $l_assoc_array); $smarty->display('user_data_'.$tpl.'.tpl'); } else { diff --git a/_include/include_money_deposit.php b/_include/include_money_deposit.php index df38bb8..9796945 100644 --- a/_include/include_money_deposit.php +++ b/_include/include_money_deposit.php @@ -37,7 +37,7 @@ if ($this->is_id()) { } else { # BEFIZETÉS LISTA - $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_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 LIMIT 5;"; $mod_array = array(); $mod_assoc_array = $sql->assoc_array($mod_query); diff --git a/_include/include_presence.php b/_include/include_presence.php index 97122a3..0811cc7 100644 --- a/_include/include_presence.php +++ b/_include/include_presence.php @@ -72,7 +72,7 @@ if ($this->is_id()) { $exeptions[] = $user->get_uk_id(); } - /* + $rest_user_query = " SELECT uk_id @@ -93,44 +93,7 @@ if ($this->is_id()) { GROUP BY uk_id ORDER BY uk_name; "; - */ - $rest_user_query = " - SELECT - * - FROM - (SELECT DISTINCT - uk_id, uk_name - FROM - user_kid - -- LEFT JOIN user_kid_training_type ON uktt_user_kid_uk_id = uk_id - LEFT JOIN user_kid_lease ON ukl_user_kid_uk_id = uk_id - LEFT JOIN lease_training_type ON ltt_lease_l_id = ukl_lease_l_id - WHERE - (uk_deleted = 0 AND uk_is_active = 1) - AND (ltt_training_type_trt_id = {$training->get_tr_training_type_trt_id()} - OR uk_lease = 0) UNION SELECT DISTINCT - uk_id, uk_name - FROM - user_kid - LEFT JOIN money_deposit ON mod_user_kid_uk_id = uk_id - AND mod_expire_date > NOW() - AND mod_deleted = 0 - LEFT JOIN lease ON l_id = mod_lease_l_id - LEFT JOIN lease_training_type ON ltt_lease_l_id = l_id - WHERE - uk_deleted = 0 AND uk_is_active = 1 - AND ((uk_lease = 1 AND mod_id IS NOT NULL - AND ltt_training_type_trt_id = {$training->get_tr_training_type_trt_id()}) - OR (uk_lease = 0 AND mod_lease_l_id IS NULL)) UNION SELECT DISTINCT - uk_id, uk_name - FROM - presence - JOIN user_kid ON pr_user_kid_uk_id = uk_id - WHERE - pr_training_tr_id = {$training->get_tr_id()}) AS res - ORDER BY uk_name - ; - "; + //var_dump($rest_user_query); $rest_user_assoc_array = $sql->assoc_array($rest_user_query); diff --git a/event_handler.php b/event_handler.php index d266ca1..640f03b 100644 --- a/event_handler.php +++ b/event_handler.php @@ -303,7 +303,7 @@ if (isset($_POST['action'])) { // új befizetés létrehozása $sets_date = (isset($_POST['mod_sets_expire_date']) && $_POST['mod_sets_expire_date']) ? $_POST['mod_sets_expire_date'] : false; - $new_mod_id = money_deposit::create_money_deposit($_POST['mod_user_kid_uk_id'], $_POST['mod_date'], $_POST['mod_sum'], $_POST['mod_lease_l_id'], $_POST['mod_expire_date'], 1, $sets_date); + $new_mod_id = money_deposit::create_money_deposit($_POST['mod_user_kid_uk_id'], $_POST['mod_date'], $_POST['mod_sum'], $_POST['mod_lease_l_id'], $_POST['mod_expire_date'], $_POST['mod_payment_type'], $sets_date); $tmp_user = new user_kid(); $tmp_user->set_user_data_by_id($_POST['mod_user_kid_uk_id']); log::register('new_money_deposit', $tmp_user->get_uk_name().': '.$_POST['mod_sum'].' Ft ('.$_POST['mod_date'].')'); @@ -318,7 +318,7 @@ if (isset($_POST['action'])) { break; case 'money_deposit_update': // befizetés módosítás - money_deposit::update_money_deposit($_POST['mod_date'], $_POST['mod_sum'], $_POST['mod_id'], 1, $_POST['mi_id']); + money_deposit::update_money_deposit($_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']); $tmp_user->update_balance(); diff --git a/template/templates/money_deposit.tpl b/template/templates/money_deposit.tpl index 991a7f0..668508c 100644 --- a/template/templates/money_deposit.tpl +++ b/template/templates/money_deposit.tpl @@ -7,7 +7,7 @@ -
+
{foreach $mod_array as $mod} {if !$mod@first && $mod_array[$mod@index]->get_mod_money_income()->get_mi_date()|substr:5:2 != $mod_array[$mod@index-1]->get_mod_money_income()->get_mi_date()|substr:5:2} @@ -15,12 +15,21 @@ {/if} {if $mod@first || $mod_array[$mod@index]->get_mod_money_income()->get_mi_date()|substr:5:2 != $mod_array[$mod@index-1]->get_mod_money_income()->get_mi_date()|substr:5:2} - {$mod_array[$mod@index]->get_mod_money_income()->get_mi_date()|substr:0:4}. - {$months[$mod_array[$mod@index]->get_mod_money_income()->get_mi_date()|substr:5:2]} - - {assign var="sum" value=money_deposit::get_month_mod_sum($mod_array[$mod@index]->get_mod_money_income()->get_mi_date()|substr:0:4, $mod_array[$mod@index]->get_mod_money_income()->get_mi_date()|substr:5:2)} - {if sum != null}{$sum|number_format:0:'':' '}{else}0{/if} Ft - +
+
+
+ {$mod_array[$mod@index]->get_mod_money_income()->get_mi_date()|substr:0:4}. + {$months[$mod_array[$mod@index]->get_mod_money_income()->get_mi_date()|substr:5:2]} +
+
Bérlettípus
+
Befizetés módja
+
+
+ {assign var="sum" value=money_deposit::get_month_mod_sum($mod_array[$mod@index]->get_mod_money_income()->get_mi_date()|substr:0:4, $mod_array[$mod@index]->get_mod_money_income()->get_mi_date()|substr:5:2)} +
{if sum != null}{$sum|number_format:0:'':' '}{else}0{/if} Ft
+ +
+
{/if} @@ -35,9 +44,11 @@ {/if} - + {$mod->get_mod_user_kid()->get_uk_name()} {if $mod->is_expired()}(Lejárt: {$mod->get_mod_expire_date()}){/if} + {$mod->get_mod_lease_l_id()->get_l_name()} + {$mod->get_mod_money_income()->get_mi_payment_type_pt_obj()->get_pt_name()} {$mod->get_mod_money_income()->get_mi_date(true)} diff --git a/template/templates/money_deposit_create.tpl b/template/templates/money_deposit_create.tpl index 49bd38c..a706ba0 100644 --- a/template/templates/money_deposit_create.tpl +++ b/template/templates/money_deposit_create.tpl @@ -50,6 +50,19 @@
+
+ +
+ +
+
+
diff --git a/template/templates/money_deposit_update.tpl b/template/templates/money_deposit_update.tpl index 7ed7584..76c923b 100644 --- a/template/templates/money_deposit_update.tpl +++ b/template/templates/money_deposit_update.tpl @@ -19,19 +19,6 @@
- {*
- -
- -
-
*} -
@@ -56,6 +43,19 @@
+
+ +
+ +
+
+
{$mod->get_mod_expire_date()}
diff --git a/template/templates/user_data_create.tpl b/template/templates/user_data_create.tpl index 1defdd8..93b8d6d 100644 --- a/template/templates/user_data_create.tpl +++ b/template/templates/user_data_create.tpl @@ -95,17 +95,6 @@ {/foreach}
*} -
- - {foreach $l_assoc_array as $l} -
- - {$l['l_name']} -
- {/foreach} -
- -
diff --git a/template/templates/user_data_edit.tpl b/template/templates/user_data_edit.tpl index f8ab1fb..700bae7 100644 --- a/template/templates/user_data_edit.tpl +++ b/template/templates/user_data_edit.tpl @@ -130,17 +130,6 @@ {/foreach}
*} -
- - {foreach $l_assoc_array as $l} -
- - {$l['l_name']} -
- {/foreach} -
- -