-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBankStatement.php
114 lines (72 loc) · 1.93 KB
/
BankStatement.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
106
107
108
109
110
111
112
113
114
<?php
error_reporting(0);
//error_reporting(E_ALL);
date_default_timezone_set('Asia/Singapore');
function BankStatement($dataarray,$userID)
{
// Intitlize all the variable
// print_r($dataarray);
try
{
$output_data='';
for($i=0;$i<count($dataarray);$i++)
{
$my_std_class = json_decode(json_encode($dataarray[$i]));
$data = $my_std_class;
//print_r($my_std_class);
//echo $data->$data->Reports[0];
$output_data.='"'.$data->Reports[0]->ReportTitles[0].'","'.$data->Reports[0]->ReportTitles[1].'","'.$data->Reports[0]->ReportTitles[2].'","'.$data->Reports[0]->ReportTitles[3].'"'."\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";
}
}
}
/// Add space
$output_data.="\n\n\n\n";
}
//$output_data.='</table>';
//echo $output_data;
//echo $this->AccountID."<br> sdfsdsd ";
// $this->insert();
// Generate Datafile
// Create Html
$file_name="BankStatement.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" ;
}
}
?>