-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExecutiveSummary.php
105 lines (67 loc) · 1.78 KB
/
ExecutiveSummary.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<?php
error_reporting(0);
//error_reporting(E_ALL);
date_default_timezone_set('Asia/Singapore');
function ExecutiveSummary($dataarray,$userID)
{
// Intitlize all the variable
// print_r($dataarray);
try
{
$my_std_class = json_decode(json_encode($dataarray));
$data = $my_std_class;
//print_r($my_std_class);
$output_data='';
//echo $data->$data->Reports[0];
$output_data.='"'.$data->Reports[0]->ReportTitles[0].'","'.$data->Reports[0]->ReportTitles[1].'","'.$data->Reports[0]->ReportTitles[2].'"'."\n";
$col_count=0;
foreach ($data->Reports[0]->Rows as $SingleRow)
{
// header extarct
if($SingleRow->RowType=="Header")
{
//$output_data.='<tr>';
foreach($SingleRow->Cells as $cellVal)
{
$output_data.='"'.$cellVal->Value.'"'.",";
$col_count++;
}
$output_data.="\n";
}
// Body of the table
if($SingleRow->RowType=="Section")
{
$output_data.='"'.$SingleRow->Title.'"'."\n";
foreach($SingleRow->Rows as $rows)
{
//$output_data.='<tr>';
foreach($rows->Cells as $Cells)
{
$output_data.='"'.$Cells->Value.'"'.",";
}
$output_data.="\n";
}
}
}
//$output_data.='</table>';
//echo $output_data;
//echo $this->AccountID."<br> sdfsdsd ";
// $this->insert();
// Generate Datafile
// Create Html
$file_name="ExecutiveSummary.csv";
//rename($file_name,"STATEMENTS/".$file_name);
$fp=fopen("STATEMENTS/".$_SESSION['orgFolderName']."/".$file_name,'w');
fputs($fp,$output_data);
fclose($fp);
return $file_name;
//echo $output_data;
//return $this->collect();
//return true;
}
catch (Exception $e)
{
return "Error" ;
}
}
?>