diff --git a/_class/class_user_kid.php b/_class/class_user_kid.php index 93ad3b1..cf34634 100644 --- a/_class/class_user_kid.php +++ b/_class/class_user_kid.php @@ -38,6 +38,7 @@ class user_kid extends user_parent { private $user_official_age_category; private $user_contact; private $user_other; + private $user_balance_transfer; private $user_deleted; public function set_uk_id($_uid) { @@ -263,6 +264,12 @@ class user_kid extends user_parent { public function get_uk_balance() { return $this->user_balance; } + public function set_uk_balance_transfer($_balance_transfer) { + $this->user_balance_transfer = $_balance_transfer; + } + public function get_uk_balance_transfer() { + return $this->user_balance_transfer; + } public function is_logged_in() { //leellenőrzi cookie alapján h be vagyunk-e jelentkezve //JAVÍTVA: adja vissza az adattag igazságértékét @@ -476,14 +483,29 @@ class user_kid extends user_parent { global $sql; //kezdetben 0 - $balance = 0; + if (is_object($_user_obj)) { + if (null == $_user_obj->get_uk_balance_transfer()) { + $balance = 0; + } + else { + $balance = $_user_obj->get_uk_balance_transfer(); + } + } + else { + if (null == $this->get_uk_balance_transfer()) { + $balance = 0; + } + else { + $balance = $this->get_uk_balance_transfer(); + } + } foreach ($_de_obj_array as $i => $_de) { //minden lépésben az balance-t be kell állítani az előző lépésben updatelt balance-ra if (isset($_de_obj_array[$i-1])) { $_de->set_de_balance($_de_obj_array[$i-1]->get_de_balance()); } if ($_de->get_de_type() == 'training') { - //ha edzés, akkor -1000 levonás, kivéve, ha kedvezményes: + //ha edzés, akkor -1200 levonás, kivéve, ha kedvezményes: //1-nél több edzés / nap //8-nál több edzés / hónap //első két alkalom egyike @@ -498,13 +520,18 @@ class user_kid extends user_parent { //TODO: ha van már havi 8+ akk ne nézze a duplázót! if ($_de->get_de_first_two() > 0) $_de->set_de_discount_id(1); if ($_de->get_de_training_per_day() > 1) $_de->set_de_discount_id(3); - if ($_de->get_de_training_per_month() > 8) $_de->set_de_discount_id(2); + if ($_de->get_de_training_per_month() > 10) $_de->set_de_discount_id(2); } else { - //$balance -= 1000; - $_de->set_de_transaction(-1000); //beállítjuk, mennyivel csökken az egyenleg - $_de->set_de_balance($_de->get_de_balance()+$_de->get_de_transaction()); //beállítjuk az új egyenleget - //echo $_de->get_de_date() . " minusz 1000

"; + //$balance -= 1200; + $_de->set_de_transaction(-1200); //beállítjuk, mennyivel csökken az egyenleg + if (0 == $i) { + $_de->set_de_balance($balance+$_de->get_de_transaction()); //beállítjuk az új egyenleget + } + else { + $_de->set_de_balance($_de->get_de_balance()+$_de->get_de_transaction()); //beállítjuk az új egyenleget + } + //echo $_de->get_de_date() . " minusz 1200

"; } } elseif ($_de->get_de_type() == 'money_deposit') { diff --git a/_include/include_diary.php b/_include/include_diary.php index 5a4dec6..b308c98 100644 --- a/_include/include_diary.php +++ b/_include/include_diary.php @@ -128,12 +128,23 @@ order by object_date ASC; } - //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); + + //itt csak hivatkozással adjuk át a tömböt, a calculate_balance kiszámolja, belerakja és visszadja + $user->calculate_balance($de_array, $user); + //lekérjük az áthozatot, és felvesszük entryként + $balance_transfer = $user->get_uk_balance_transfer(); + if (null == $balance_transfer) { + $balance_transfer = 0; + } + $de_array = array_reverse($de_array); - $smarty->assign('actions', $de_array); + //$de_array[] = $first_entry; + //var_dump($de_array); + //var_dump($de_array); + //$smarty->assign('actions', $actions); + $smarty->assign('actions', $de_array); + $smarty->assign('balance_transfer', $balance_transfer); + //$smarty->assign('balance', $balance); $smarty->display('user_diary.tpl'); diff --git a/_include/include_stats.php b/_include/include_stats.php index 4a27b1c..5c160a8 100644 --- a/_include/include_stats.php +++ b/_include/include_stats.php @@ -20,15 +20,22 @@ if ($this->is_id()) { $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"; + $cash_previous_query = "SELECT setv_int FROM setting_value JOIN setting on set_id = setv_setting_set_id WHERE set_name = 'Áthozat (kp)';"; + $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"; + $transfer_previous_query = "SELECT setv_int FROM setting_value JOIN setting on set_id = setv_setting_set_id WHERE set_name = 'Áthozat (utalás)';"; + $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); + $cash_previous = $sql->single_variable($cash_previous_query); + $transfer_previous = $sql->single_variable($transfer_previous_query); + $balance_query = " select (select @@ -43,6 +50,8 @@ if ($this->is_id()) { $balance = $sql->single_variable($balance_query); + $smarty->assign('cash_previous',$cash_previous); + $smarty->assign('transfer_previous',$transfer_previous); $smarty->assign('in_cash',$in_cash); $smarty->assign('out_cash',$out_cash); $smarty->assign('in_transfer',$in_transfer); diff --git a/template/templates/diary_report.tpl b/template/templates/diary_report.tpl index 6afcc02..317431c 100644 --- a/template/templates/diary_report.tpl +++ b/template/templates/diary_report.tpl @@ -2,10 +2,7 @@ {foreach $resi as $key_ => $resii} {if $resii->get_de_training()|is_a:'training'} - {$key}
- {$resii->get_de_training()->get_tr_date()}
- {$resii->get_de_training()->get_tr_type_name_by_id()}
- {$resii->get_de_training()->get_tr_duration()} perc
+ {$key};{$resii->get_de_training()->get_tr_date()};{$resii->get_de_training()->get_tr_id()};{$resii->get_de_training()->get_tr_type_name_by_id()};{$resii->get_de_training()->get_tr_duration()} perc; {if $resii->get_de_has_discount()} {if $resii->get_de_discount_id() == 1} Próba kedvezmény
@@ -16,7 +13,7 @@ {/if} {else} - Fizetős
+ Fizetős
{/if} {/if} diff --git a/template/templates/setting_data_edit.tpl b/template/templates/setting_data_edit.tpl index ccdc81d..267ca8a 100644 --- a/template/templates/setting_data_edit.tpl +++ b/template/templates/setting_data_edit.tpl @@ -75,6 +75,28 @@ {/foreach} + {elseif $setting->get_setv_setting()->get_set_setting_type_st_id() == 4} +
+
+ + + + +
+
+ + +
+
+ + +
+
+ +
+
+
+
{/if} diff --git a/template/templates/stat_balance.tpl b/template/templates/stat_balance.tpl index ec513af..2122355 100644 --- a/template/templates/stat_balance.tpl +++ b/template/templates/stat_balance.tpl @@ -15,7 +15,11 @@
- Készpénz egyenleg: {($in_cash - $out_cash)|number_format:0:'':' '} Ft + Készpénz áthozat: {$cash_previous|number_format:0:'':' '} Ft +
+
+ + Készpénz egyenleg: {($in_cash - $out_cash + $cash_previous)|number_format:0:'':' '} Ft
@@ -32,7 +36,11 @@
- Utalás egyenleg: {($in_transfer - $out_transfer)|number_format:0:'':' '} Ft + Utalás áthozat: {$transfer_previous|number_format:0:'':' '} Ft +
+
+ + Utalás egyenleg: {($in_transfer - $out_transfer + $transfer_previous)|number_format:0:'':' '} Ft
@@ -41,7 +49,7 @@
- Egyenleg: {(($in_cash + $in_transfer)-($out_cash + $out_transfer))|number_format:0:'':' '} Ft + Egyenleg: {(($in_cash + $in_transfer)-($out_cash + $out_transfer) + $cash_previous + $transfer_previous)|number_format:0:'':' '} Ft
diff --git a/template/templates/user_data_create.tpl b/template/templates/user_data_create.tpl index 1485d67..d15aee0 100644 --- a/template/templates/user_data_create.tpl +++ b/template/templates/user_data_create.tpl @@ -5,7 +5,7 @@
- +
@@ -33,7 +33,7 @@
- +
@@ -68,7 +68,7 @@
- +
Kéz:
@@ -85,8 +85,8 @@
- - + +
@@ -136,7 +136,7 @@
- +
@@ -181,6 +181,11 @@
+
+ +
+
+
@@ -248,7 +253,7 @@
- +
@@ -256,7 +261,7 @@
-
+
@@ -264,14 +269,14 @@

- +
- +
@@ -290,4 +295,4 @@ $('#uk_school_sc_id').change(function() { $(".add_school").toggle(this.value == 'null'); }); - \ No newline at end of file + diff --git a/template/templates/user_data_edit.tpl b/template/templates/user_data_edit.tpl index a4f5ec8..dd3dcd5 100644 --- a/template/templates/user_data_edit.tpl +++ b/template/templates/user_data_edit.tpl @@ -11,7 +11,7 @@
- +
@@ -39,7 +39,7 @@
- +
@@ -73,7 +73,7 @@
- +
Kéz:
@@ -90,8 +90,8 @@
- - + +
@@ -126,6 +126,10 @@
+
+ +
+
@@ -162,7 +166,7 @@
- +
@@ -221,7 +225,7 @@
- +
@@ -257,8 +261,8 @@
- - + +
@@ -273,15 +277,15 @@
-
- +
+
- +
@@ -328,7 +332,7 @@ $("#parent_1_phone").val(pdata[1]); $("#parent_1_email").val(pdata[0]); $("#parent_1_facebook").val(pdata[2]); - + } }); }); @@ -351,9 +355,9 @@ $("#parent_2_phone").val(pdata[1]); $("#parent_2_email").val(pdata[0]); $("#parent_2_facebook").val(pdata[2]); - + } }); }); - \ No newline at end of file + diff --git a/template/templates/user_diary.tpl b/template/templates/user_diary.tpl index 1b7b72a..b15c137 100644 --- a/template/templates/user_diary.tpl +++ b/template/templates/user_diary.tpl @@ -134,6 +134,11 @@ {/if} {if $action@last} +
+
+ Áthozat: {$balance_transfer} Ft +
+