diff --git a/api/application/helpers/myutil_helper.php b/api/application/helpers/myutil_helper.php index 0fbf8868..147c8f12 100644 --- a/api/application/helpers/myutil_helper.php +++ b/api/application/helpers/myutil_helper.php @@ -210,7 +210,55 @@ class MYUTIL return $array[$key]; } } - } + } + + //generate finance year by give date (date format : Y-m-d) + //second param 1 means for sales PD + public static function getFinYears($sales_pd_created_date,$flag = null) + { + $sales_pd_created_date = explode('-',$sales_pd_created_date); + $year = $sales_pd_created_date[0]; + $month = $sales_pd_created_date[1]; + + if($flag == 1)//sales pd + { + if($month < 4) + { + $cur_finyr_start = ($year-1);$cur_finyr_end = ($year); + } + else + { + $cur_finyr_start = ($year);$cur_finyr_end = ($year+1); + } + $fin_yr_array = array(); + for($i = 4;$i >=1;$i--) + { + array_push($fin_yr_array, (($cur_finyr_start-$i).'-'.($cur_finyr_end-$i))); + } + return $fin_yr_array; + } + + + + } + + public static function reOrderFinYrsData($section5,$last_four_finyrs) + { + $ordered_fy_data = array(); + foreach ($last_four_finyrs as $fin_key => $fin_yr) + { + foreach ($section5 as $key => $value) + { + if(is_numeric($key) && !strcasecmp($fin_yr, $value['fy'])) + { + array_push($ordered_fy_data, $value); + unset($section5[$key]); + } + + } + } + return $ordered_fy_data; + } } diff --git a/api/application/views/sale_pd_templates/MWISE.php b/api/application/views/sale_pd_templates/MWISE.php index e43f757d..a5015af3 100644 --- a/api/application/views/sale_pd_templates/MWISE.php +++ b/api/application/views/sale_pd_templates/MWISE.php @@ -220,9 +220,14 @@ defined('BASEPATH') OR exit('No direct script access allowed');