-
Notifications
You must be signed in to change notification settings - Fork 2
/
trialbalance.html
342 lines (266 loc) · 9.42 KB
/
trialbalance.html
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" type="image/png" href="assets/img/favicon.ico">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>Fundamentals of Accounting</title>
<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' name='viewport' />
<meta name="viewport" content="width=device-width" />
<!-- Bootstrap core CSS -->
<link href="assets/css/bootstrap.min.css" rel="stylesheet" />
<!-- Animation library for notifications -->
<link href="assets/css/animate.min.css" rel="stylesheet"/>
<!-- Light Bootstrap Table core CSS -->
<link href="assets/css/light-bootstrap-dashboard.css" rel="stylesheet"/>
<!-- CSS for Demo Purpose, don't include it in your project -->
<link href="assets/css/demo.css" rel="stylesheet" />
<!-- Fonts and icons -->
<link href="assets/css/font_awesome_min.css" rel="stylesheet">
<link href='assets/fonts/google_fonts.css' rel='stylesheet' type='text/css'>
<link href="assets/css/pe-icon-7-stroke.css" rel="stylesheet" />
<script>
var creditSideTotal=0;;
var debitSideTotal=0;
var uniqueAcc=[];
var trialDebit=[];
var trialCredit=[];
var dc=[];
var cc=[];
var dm=[];
var cm=[];
var owner;
var date;
var total=0;
function calculateBalanceCD(acc,counter)
{
var x;
for(x=0;x<dc.length;x++)
{
if(dc[x]==acc)
{
creditSideTotal+=parseInt(dm[x]);
}
else if(cc[x]==acc)
{
debitSideTotal+=parseInt(cm[x]);
}
}
if(creditSideTotal>debitSideTotal)
{
trialCredit[counter]=parseInt(creditSideTotal)-parseInt(debitSideTotal);
trialDebit[counter]=0;
total+=parseInt(trialCredit[counter]);
}
else if(creditSideTotal<debitSideTotal)
{
trialDebit[counter]=parseInt(debitSideTotal)-parseInt(creditSideTotal);
trialCredit[counter]=0;
}
else
{
trialCredit[counter]=parseInt(creditSideTotal);
trialDebit[counter]=parseInt(debitSideTotal);
}
}
//-------------------------------------------------------------------------
function trialBalance()
{
var x,count,row;
var table = document.getElementById("trialBalanceTable");
document.getElementById("tableTitle").innerHTML=owner;
document.getElementById("tableSubTitle").innerHTML=date;
for(x=0;x<uniqueAcc.length;x++)
{
creditSideTotal=0;
debitSideTotal=0;
calculateBalanceCD(uniqueAcc[x],x);
count = document.getElementById("trialBalanceTable").getElementsByTagName("tr").length;
row = table.insertRow(count);
var cell1 = row.insertCell(0);
var cell2 = row.insertCell(1);
var cell3 = row.insertCell(2);
cell1.innerHTML = uniqueAcc[x];
cell2.innerHTML = trialDebit[x];
cell3.innerHTML = trialCredit[x];
}
count = document.getElementById("trialBalanceTable").getElementsByTagName("tr").length;
row = table.insertRow(count);
var cell1 = row.insertCell(0);
var cell2 = row.insertCell(1);
var cell3 = row.insertCell(2);
row = table.insertRow(count+1);
cell1 = row.insertCell(0);
cell2 = row.insertCell(1);
cell3 = row.insertCell(2);
cell1.innerHTML = "Total";
cell2.innerHTML = total;
cell3.innerHTML = total;
}
//---------------------------------------------------------------------
Array.prototype.contains = function(v) {
for(var i = 0; i < this.length; i++) {
if(this[i] === v) return true;
}
return false;
};
Array.prototype.unique = function() {
var arr = [];
for(var i = 0; i < this.length; i++) {
if(!arr.contains(this[i])) {
arr.push(this[i]);
}
}
return arr;
}
function uniqueAccounts()
{
var x=0;
var dup=[];
while(x<dc.length)
{
dup.push(dc[x]);
dup.push(cc[x]);
x++;
}
uniqueAcc=dup.unique();
}
//--------------------------------------------------------------------
function getData()
{
if (typeof(Storage) !== "undefined")
{
dm = JSON.parse(localStorage.getItem("dm"));
cm = JSON.parse(localStorage.getItem("cm"));
dc = JSON.parse(localStorage.getItem("dc"));
cc = JSON.parse(localStorage.getItem("cc"));
owner=localStorage.getItem("owner");
date=localStorage.getItem("date");
uniqueAccounts();
trialBalance();
} else {
//document.getElementById("").innerHTML = "Sorry, your browser does not support Web Storage...";
}
}
</script>
</head>
<body onload="getData();">
<div class="wrapper" >
<div class="sidebar" data-color="blue" data-image="assets/img/sidebar-5.jpg">
<!-- you can change the color of the sidebar using: data-color="blue | azure | green | orange | red | purple" -->
<div class="sidebar-wrapper">
<div class="logo">
<a href="https://usmanambalvi.000webhostapp.com" class="simple-text">
Usman Ashraf
</a>
</div>
<ul class="nav">
<li>
<a href="journal.html">
<i class="pe-7s-note2"></i>
<p>Journal</p>
</a>
</li>
<li>
<a href="ledger.html">
<i class="pe-7s-note2"></i>
<p>Ledger</p>
</a>
</li>
<li class="active">
<a href="trialbalance.html">
<i class="pe-7s-note2"></i>
<p>Trial Balance</p>
</a>
</li>
<li>
<a href="dashboard.html">
<i class="pe-7s-graph"></i>
<span onclick="transferData();"><p>Statistics</p></span>
</a>
</li>
</ul>
</div>
</div>
<div class="main-panel">
<nav class="navbar navbar-default navbar-fixed">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="#">Trial Balance</a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav navbar-right">
<li>
<a id="downloadTrialB" href="#">
Download
</a>
</li>
</ul>
</div>
</div>
</nav>
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="header">
<h4 class="title" id="tableTitle"></h4>
<p class="category" id="tableSubTitle"></p>
</div>
<div class="content table-responsive table-full-width">
<table class="table table-hover table-striped" id="trialBalanceTable">
<thead>
<th>Account Type</th>
<th>Debit (Rs)</th>
<th>Credit (Rs)</th>
</thead>
<tbody>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<footer class="footer">
<div class="container-fluid">
<nav class="pull-left">
<ul>
<li>
<a href="dashboard.html">
Home
</a>
</li>
<li>
<a href="https://asfand-portfolio.000webhostapp.com/">
Portfolio
</a>
</li>
</ul>
</nav>
</div>
</footer>
</div>
</div>
</body>
<!-- Core JS Files -->
<script src="assets/js/jquery-1.10.2.js" type="text/javascript"></script>
<script src="assets/js/bootstrap.min.js" type="text/javascript"></script>
<!-- Checkbox, Radio & Switch Plugins -->
<script src="assets/js/bootstrap-checkbox-radio-switch.js"></script>
<!-- Charts Plugin -->
<script src="assets/js/chartist.min.js"></script>
<!-- Notifications Plugin -->
<script src="assets/js/bootstrap-notify.js"></script>
<!-- Light Bootstrap Table Core javascript and methods for Demo purpose -->
<script src="assets/js/light-bootstrap-dashboard.js"></script>
<!-- Light Bootstrap Table DEMO methods, don't include it in your project! -->
<script src="assets/js/demo.js"></script>
</html>