SALES PD FIN CALCULATIONS
This commit is contained in:
parent
d6d2b0b0dd
commit
5cb09cfe0b
@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -220,9 +220,14 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
<tr>
|
||||
<th colspan="7">Particulars of Financials as per books of Accounts</th>
|
||||
<?php
|
||||
//print_r($section5[0]);die();
|
||||
|
||||
$sales_pd_created_date = date('Y-m-d',strtotime($master[0]['createdon']));
|
||||
$last_four_finyrs = MYUTIL::getFinYears($sales_pd_created_date,1);
|
||||
$ordered_finyrs_data = MYUTIL::reOrderFinYrsData($section5,$last_four_finyrs);
|
||||
|
||||
//print_r($section5);die();
|
||||
$totol = 0;
|
||||
foreach ($section5 as $fy_key => $fy_value)
|
||||
foreach ($ordered_finyrs_data as $fy_key => $fy_value)
|
||||
{
|
||||
if(is_numeric($fy_key))
|
||||
{
|
||||
@ -239,7 +244,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
<td colspan="7">Sales / Revenue (Rs) </td>
|
||||
<?php
|
||||
|
||||
foreach ($section5 as $fy_key => $fy_value)
|
||||
foreach ($ordered_finyrs_data as $fy_key => $fy_value)
|
||||
{
|
||||
if(is_numeric($fy_key))
|
||||
{
|
||||
@ -252,7 +257,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
<td colspan="7" >Net Profit / (Net Loss) (Rs) </td>
|
||||
<?php
|
||||
|
||||
foreach ($section5 as $fy_key => $fy_value)
|
||||
foreach ($ordered_finyrs_data as $fy_key => $fy_value)
|
||||
{
|
||||
if(is_numeric($fy_key))
|
||||
{
|
||||
@ -266,7 +271,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
<?php
|
||||
|
||||
|
||||
foreach ($section5 as $fy_key => $fy_value)
|
||||
foreach ($ordered_finyrs_data as $fy_key => $fy_value)
|
||||
{
|
||||
if(is_numeric($fy_key))
|
||||
{
|
||||
@ -280,7 +285,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
<?php
|
||||
|
||||
$pre_year_sales = 0;
|
||||
foreach ($section5 as $fy_key => $fy_value)
|
||||
foreach ($ordered_finyrs_data as $fy_key => $fy_value)
|
||||
{
|
||||
if(is_numeric($fy_key))
|
||||
{
|
||||
@ -309,7 +314,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
<?php
|
||||
|
||||
$pre_year_net_profit = 0;
|
||||
foreach ($section5 as $fy_key => $fy_value)
|
||||
foreach ($ordered_finyrs_data as $fy_key => $fy_value)
|
||||
{
|
||||
if(is_numeric($fy_key))
|
||||
{
|
||||
@ -333,7 +338,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
<?php
|
||||
|
||||
$pre_year_net_pro_loss_per = 0;
|
||||
foreach ($section5 as $fy_key => $fy_value)
|
||||
foreach ($ordered_finyrs_data as $fy_key => $fy_value)
|
||||
{
|
||||
if(is_numeric($fy_key))
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user