-
Notifications
You must be signed in to change notification settings - Fork 0
/
recoupmentsHistory.html
801 lines (558 loc) · 27.7 KB
/
recoupmentsHistory.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
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<html>
<head><title>DC Recoupments History</title></head>
<body>
<!-- external libs from cdnjs -->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script>
<script type ="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/plotly.js/1.33.1/plotly-basic.min.js"></script>
<!-- script type="text/javascript" src="https://cdn.plot.ly/plotly-basic-latest.min.js"></script -->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/PapaParse/4.1.2/papaparse.min.js"></script>
<!-- script type="text/javascript" src="/contributionspaid/scripts/jquery.floatTHead.min.js"></script -->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/floatthead/2.2.1/jquery.floatThead.min.js"></script>
<!-- PivotTable.js libs from ../dist -->
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/pivottable/2.23.0/pivot.min.css">
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pivottable/2.23.0/pivot.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pivottable/2.23.0/d3_renderers.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pivottable/2.23.0/plotly_renderers.min.js"></script>
<script type="text/javascript" src='https://cdnjs.cloudflare.com/ajax/libs/pivottable/2.23.0/export_renderers.min.js'></script>
<!-- subtotal.js libs from ../dist -->
<!-- base href= "/flowerbot/contributionspaid/blob/main/" -->
<!-- base href= "/" -->
<script type="text/javascript" src="/contributionspaid/scripts/PivotJS-subtotal/subtotal.js"></script>
<link rel="stylesheet" type="text/css" href="/contributionspaid/scripts/PivotJS-subtotal/subtotal.css">
<!-- needed to dl as Excel -->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/2.0.0/FileSaver.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.16.9/xlsx.full.min.js"></script>
<style>
body {font-family: Verdana;}
p {
font-size: 10pt;
}
th.pvtRowLabel {
white-space: nowrap;
}
.ms-webpartPage-root {
border-spacing: 0px;
}
.desc {
padding-bottom: 10px;
width: 80vw;
}
.rotate {
height: 90px;/* fixed height . set fixed width to rotated elements */
width: 110px !important;/* a liitle less than parents height */
-webkit-transform: rotate(310deg);
-moz-transform: rotate(310deg);
-ms-transform: rotate(310deg);
-o-transform: rotate(310deg);
transform: rotate(310deg) translatex(-64%) translatey(56%);
transform-origin: top left;
margin-right: -73px;
}
#inclusions strong {
font-weight: 500;
color:lightseagreen;
}
/* extras for floating headers */
.floatThead-container {
overflow: hidden;
}
.pvtFilterBox {
z-index: 2001;
}
/* ************************* */
.pvtRowLabel {
font-weight: normal;
}
</style>
<script type="text/javascript">
debug = false;
var dataObj;
var config = {};
var configobject;
var configRows;
var configCols;
var configRenderer;
var hiddenAttributes = [];
var configInc = {};
var configIncDefault = {};
var configRowsDefault = ["Contribution Plan Number", "Contribution Plan Description", "Expenditure Description","Year"];
var configColsDefault = [];
var configIncDefault = {};
var configRendererDefault = "Row Heatmap";
var configRowsFull;
var configRowsRecoup = ["Contribution Plan Number", "Contribution Plan Description"];
var configColsRecoup = ["Year"];
var configIncRecoupType = [];
var configRowsPies = ["Expenditure Description"];
var configColsPies = ["Contribution Plan Number"];
var configRendererPies = "Multiple Pie Chart";
var configIncPies = {};
var storageTag = "-recHist"; // make these unique to each chart
var configRows;
var selectedASet = false;
// var amt = function(data,)
/*function fetchHeader(url, wch) {
try {
var req=new XMLHttpRequest();
req.open("HEAD", url, false);
req.send(null);
if(req.status== 200){
return req.getResponseHeader(wch);
}
else return false;
} catch(er) {
return er.message;
}
}*/
var fileNameAndPath = "data/RecoupmentsHistory.csv";
// FULL GITHUB PATH REQUIRED TO GET THE REAL 'SAVE DATE' FOR THE CSV
var gitHubPath = "https://api.github.com/repos/flowerbot/contributionspaid/commits?path=data/RecoupmentsHistory.csv&page=1&per_page=1"
var curPath = window.location.href;
const options = {
weekday: "long",
year: "numeric",
month: "long",
day: "numeric",
};
var client = new XMLHttpRequest();
if(curPath.indexOf("github")>=0) {
console.log("github:")
client.open("HEAD", gitHubPath, true);
} else {
console.log("notgithub:");
client.open("HEAD", fileNameAndPath);
}
client.onreadystatechange = function() {
// console.log("RS:",this.readyState);
if(this.readyState == 2) {
// console.log(client.getAllResponseHeaders());
// console.log(client.getResponseHeader("Last-Modified"));
var newDate = new Date(client.getResponseHeader("Last-Modified")).toLocaleDateString("en-AU", options);
var newTime = new Date(client.getResponseHeader("Last-Modified")).toLocaleTimeString("en-AU");
var dtString = newDate + " " + newTime;
// console.log("NEW daTE:", newDate, "; NEW TIME:", newTime);
// document.getElementById("fileDate").innerHTML = dtString;
}
}
client.send();
var fromXlOne = false;
/*
function ExcelDateToJSDate(serial) {
var utc_days = Math.floor(serial - 25569);
var utc_value = utc_days * 86400;
var date_info = new Date(utc_value * 1000);
var fractional_day = serial - Math.floor(serial) + 0.0000001;
var total_seconds = Math.floor(86400 * fractional_day);
var seconds = total_seconds % 60;
total_seconds -= seconds;
var hours = Math.floor(total_seconds / (60 * 60));
var minutes = Math.floor(total_seconds / 60) % 60;
return new Date(date_info.getFullYear(), date_info.getMonth(), date_info.getDate(), hours, minutes, seconds);
}
function getFileDate(path) {
fetch(path)
.then(response => response.blob())
.then(blob => {
const file = new File([blob], blob.name);
console.log(file.lastModifiedDate, file.lastModified);
document.getElementById("fileDate").innerHTML = file.lastModifiedDate;
return file.lastModifiedDate;
});
}*/
$(function(){
// getFileDate(fileNameAndPath);
/*
// CATCH THE SCROLL EVENT
// would normally be 'document' but this is especially for SharePoint:
var docBody = document.getElementById('s4-workspace');
docBody.addEventListener('scroll', function(e) {
// document.getElementById('showScroll').innerHTML = window.pageYOffset + 'px';
var $table = $('table.pvtTable');
$table.trigger('reflow');
});
*/
// for subototals
var dataClass = $.pivotUtilities.SubtotalPivotData;
var renderers = $.extend($.pivotUtilities.renderers,
$.pivotUtilities.plotly_renderers,
$.pivotUtilities.subtotal_renderers,
$.pivotUtilities.export_renderers);
var tpl = $.pivotUtilities.aggregatorTemplates;
var sum = $.pivotUtilities.aggregatorTemplates.sum;
var numberFormat = $.pivotUtilities.numberFormat;
var intFormat = numberFormat({digitsAfterDecimal: 0});
/* var aggregators = {
"Amount": function() {
return sum(intFormat)(["Amount"]);
} */
var amtSum = function() {
return sum(intFormat)(["Amount"]);
};
// "Balance": function() {return sum(["Balance"])},
// "Expected": function() { return sum(intFormat)(["Expected"])},
//}
var rendererOptions = {
//rendererOptions: {
table : {
/* clickCallback: function(e, value, filters, pivotData) {
var links = [];
pivotData.forEachMatchingRecord(filters,
function(record) { links.push(record.ProjectLink); });
if (window.confirm("Visit the project site at: "+ links[0] + " ?"))
{
var win = window.open(links[0], '_blank');
win.focus();
}
} */
},
//config["heatmap"] = {
heatmap: {
colorScaleGenerator: function(values) {
return d3.scale.linear()
// .domain(["1", "100000", "4000000", "9000000"])
// .domain([600000, 6000000])
.domain([-6000000, 0, 600000])
// .range(["#FFF", "#FF3D5A"])
// .range(["#FFF", "#9AFF3D", "#F7FF3D", "#FF3D5A"])
.range(["#9AFF3D", "#FFFFFF", "#FF0000"])
//}
}
},//;//,
};
savedConfig = localStorage.getItem('pivotdatakey'+storageTag);
if (localStorage.getItem("pivotdatarows"+storageTag) !== null) {
savedRows = localStorage.getItem('pivotdatarows'+storageTag);
console.log("savedRows:" + savedRows);
configRows = (savedRows) ? JSON.parse(savedRows) : configRowsDefault;
} else {
configRows = configRowsDefault;
}
if (localStorage.getItem("pivotdatacols"+storageTag) !== null) {
savedCols = localStorage.getItem('pivotdatacols'+storageTag);
// console.log("savedRows:" + savedRows);
configCols = (savedCols) ? JSON.parse(savedCols) : configColsDefault;
} else {
configCols = configColsDefault;
}
if (localStorage.getItem('pivotdatainc'+storageTag) !== null) {
configInc["Type"] = configIncRecoupType;
savedinclusions = localStorage.getItem('pivotdatainc'+storageTag);
configInc = (configInc) ? JSON.parse(savedinclusions) : configIncDefault;
} else {
// delete configInc["Type"];
configInc = configIncDefault;
}
if (localStorage.getItem('pivotrenderer'+storageTag) !== null) {
savedRenderer = localStorage.getItem('pivotrenderer' + storageTag);
configRenderer = (savedRenderer) ? JSON.parse(savedRenderer) : configRendererDefault;
} else {
configRenderer = configRendererDefault;
}
selectedASet = localStorage.getItem('selectSet'+storageTag);
//var config
if (savedConfig) { // If a saved state found in LocalStorage, then load it
console.log("found a config object");
configobject = JSON.parse(savedConfig); // Make it an object
configobject["renderers"] = renderers;
configobject["rendererOptions"] = rendererOptions;
configobject["dataClass"] = dataClass;
configobject["hiddenAttributes"] = hiddenAttributes;
if(selectedASet) {
delete configobject["rows"];
configobject["rows"] = configRows;
delete configobject["cols"];
configobject["cols"] = configCols;
delete configobject["rendererName"];
configobject["rendererName"] = configRenderer;
localStorage.removeItem("selectSet"+storageTag);
configobject["inclusions"]["Type"] = configIncRecoupType;
// configobject["inclusions"] = configInc; // don't know if its a good idea to reset it it every time or not
selectedASet = false;
} else {
// delete configobject["inclusions"]["Type"]; // revert to all vals
}
// console.log(JSON.stringify(configobject));
console.log(configobject);
configobject.onRefresh = function (config) {
console.log("save state called");
console.log(config);
var config_copy = JSON.parse(JSON.stringify(config));
//delete some values which are functions
delete config_copy["aggregators"];
delete config_copy["renderers"];
//delete some bulky default values
delete config_copy["rendererOptions"];
delete config_copy["localeStrings"];
/// config_copy["renderers"] = renderers;
var params = {};
/* params["Rows"] = config_copy["rows"];
params["Columns"] = config_copy["cols"];
params["Values"] = config_copy["vals"]; */
/* params["Aggregator"] = config_copy["aggregatorName"];
params["Renderer"] = config_copy["rendererName"]; */
// try {
// params["Inclusions"] = config_copy["inclusionsInfo"];
// document.getElementById("inclusions").innerHTML = param["Inclusions"];
// } catch (ex) {console.log("config_copy not found")};
try {
// params["Inclusions"] = config["inclusionsInfo"];
document.getElementById("inclusions").innerHTML = "<strong>Inclusions:</strong>" + JSON.stringify(config["inclusions"]) + " (Change the included Plan(s) below if required)";
} catch (ex) {console.log("inclusions not found")};
// params["Exclusions"] = config_copy["exclusions"];
//console.log(params)
/// config_copy["renderers"] = renderers;
$("#parameters").html(JSON.stringify(params, undefined, 2));
// $(".pvtColLabel").wrapInner("<div class='rotate'></div>");
// console.log(params["Inclusions"]) ;
localStorage.setItem('pivotdatakey'+storageTag, JSON.stringify(config_copy, undefined, 2)); // Add callback function for onRefresh
$(".pvtColLabel").wrapInner("<div class='rotate'></div>");
var $table = $('table.pvtTable');
console.log($table.closest('.wrapper'));
$table.floatThead({
scrollContainer: function($table){
return $table.closest('.wrapper');
},
position: 'auto',
floatTableClass: 'pivotBody',
autoReflow: true
});
btn = document.getElementById("toggleHideUIButton");
// toggleHide(btn);
}
} else {
// no config found, make it from scratch
configobject = {};
configobject["hiddenAttributes"] = hiddenAttributes;
configobject["inclusions"] = configInc; // {Plan:["19"]};
configobject["exclusions"] ={ Plan:["89","90","91","92","93","94","95","96", "97","98","99"], trainingProject:["true"]};
configobject["rows"] = configRows;
configobject["cols"] = configCols;
configobject["vals"] = ["Period Amt"];
configobject["aggregatorName"] = "Integer Sum";
// configobject["aggregator"] = ["Amount"];
// configobject["aggregators"] = {"Amount": ["Amount"] };
/* configobject["aggregators"] = {
"Amount": function() {
return sum(intFormat)(["Amount"]);
}
}*/
configobject["rendererName"] = "Row Heatmap";
configobject["renderers"] = renderers;
//configobject["filter"] = filterFun;
configobject["rendererOptions"] = rendererOptions;
configobject["dataClass"] = dataClass;
/* configobject["onRefresh"] = function(config) {
console.log(JSON.parse(JSON.stringify(config)));
console.log(config.cols[0]);
$(".pvtColLabel").wrapInner("<div class='rotate'></div>");
} */
try {
// params["Inclusions"] = config["inclusionsInfo"];
document.getElementById("inclusions").innerHTML = "<strong>Inclusions:</strong>" + JSON.stringify(configobject["inclusions"]) + " (Change the included Plan(s) below if required)";
} catch (ex) {console.log("inclusions not found")};
configobject.onRefresh = function (config) {
console.log("new state called");
var config_copy = JSON.parse(JSON.stringify(config));
//var config_copy = configobject;
//delete some values which are functions
delete config_copy["aggregators"];
delete config_copy["renderers"];
//delete some bulky default values
delete config_copy["rendererOptions"];
delete config_copy["localeStrings"];
var params = {};
try {
// params["Inclusions"] = config["inclusionsInfo"];
document.getElementById("inclusions").innerHTML = "<strong>Inclusions:</strong>" + JSON.stringify(config["inclusions"]) + " (Change the included Plan(s) below if required)";
} catch (ex) {console.log("inclusions not found")};
// add exclusions to params if necessary
localStorage.setItem('pivotdatakey'+storageTag, JSON.stringify(config_copy, undefined, 2)); // Add callback function for onRefresh
console.log(config_copy) ;
$(".pvtColLabel").wrapInner("<div class='rotate'></div>");
var $table = $('table.pvtTable');
console.log($table.closest('.wrapper'));
$table.floatThead({
scrollContainer: function($table){
return $table.closest('.wrapper');
},
position: 'auto',
floatTableClass: 'pivotBody',
autoReflow: true
});
btn = document.getElementById("toggleHideUIButton");
// toggleHide(btn);
}
}
Papa.parse(fileNameAndPath, {
download: true,
header: true,
skipEmptyLines: true,
complete: function(parsed){
// console.log(parsed.data[1][6]); // THIS SHOULD BE THE FILE DATE
console.log("Parsed:");
console.log(parsed.data);
const options = {
weekday: 'long',
year: 'numeric',
month: 'long',
day: 'numeric',
// hour: 'numeric',
// minute: 'numeric',
timeZoneName: 'short'
};
var fixedData = parsed.data;
// var curPath = window.location.href;
// var fileDate = "";
// var localDate = "";
//fileDate= ExcelDateToJSDate(parseFloat(fixedData[0].DataDate));
// localDate = getFileDate(fileNameAndPath);//new Date(fileDate).toLocaleDateString('en-au', options);
var dataLen = fixedData.length;
//document.getElementById("fileDate").innerHTML = localDate;
document.getElementById("progress").innerHTML = dataLen;
document.getElementById("progressTotal").innerHTML = dataLen;
$("#output").pivotUI(fixedData, configobject);
$(".pvtColLabel").wrapInner("<div class='rotate'></div>");
}
});
});
function dataExport() {
var myWindow = (window.open("", "", "width=600,height=600,scrollbars=1"));
var tableTxt = "";
var exportTableTxt = "";
var tableId = "dataExportTable";
var downloadLink;
var dataType = 'application/vnd.ms-excel';
var msgText = "<H2>JSON FORMAT:</H2><p>Save JSON to a text file, or copy it to a JSON viewer, like the one at <a href='https://jsongrid.com/json-grid'target='_blank'>jsongrid.com</a> </p>";
myWindow.document.title="Export ..";
myWindow.document.write(msgText + "<pre style='border:1px solid #dddddd;'>" + JSON.stringify(dataObj, null, " ")+"</pre>");
}
function sheetJSWorkBook(type, fn, dl) {
var $table = $('table.pvtTable');
$table.floatThead('destroy'); // put it back together (unfloat it) for the excel dl
var elt = document.getElementsByClassName('pvtTable')[0];
var wb = XLSX.utils.table_to_book(elt, {sheet:"SWD Data"});
wb.SheetNames.push("Inclusions");
var inc = document.getElementById("inclusions").innerHTML;
var tempTable = document.createElement("table");
tempTable.innerHTML = "<tr><td>"+inc + "</td></tr>";
var ws = XLSX.utils.table_to_sheet(tempTable);
wb.Sheets["Inclusions"] = ws;
fixHeader(); // float it again
return dl ?
XLSX.write(wb, {bookType:type, bookSST:true, type: 'base64'}) :
XLSX.writeFile(wb, fn || ('dcRecoupments.' + (type || 'xlsx')));
}
function revert() {
localStorage.clear();
location.reload();
}
function fixHeader() {
var $table = $('table.pvtTable');
$table.floatThead({
position: 'fixed',
});
}
function selectChange(el) {
console.log(el);
if(el.value.length >0) {
localStorage.setItem("selectSet"+storageTag,el.value);
} else {
localStorage.removeItem("selectSet"+storageTag);
}
if(el.value == "recOnly") {
configRowsFull = configobject["rows"];
//tmpRenderer = configobject["renderer"];
localStorage.setItem('pivotdatarows'+storageTag,JSON.stringify(configRowsRecoup, undefined, 2));
localStorage.setItem('pivotdatacols'+storageTag, JSON.stringify(configColsRecoup,undefined,2));
localStorage.setItem('pivotdatainc'+storageTag, JSON.stringify(configIncRecoupType,undefined,2));
//localStorage.setItem('pivotrenderer'+storageTag, JSON.stringify(configRendererDefault,undefined,2));
// localStorage.setItem('pivotdatafullrows',JSON.stringify(configRows, undefined, 2));
configRows = configRowsRecoup;
configCols = configColsRecoup;
configInc["Type"] = configIncRecoupType;
// configInc = configIncRecoup;
}
else
if(el.value == "Pies") {
configRowsFull = configobject["rows"];
localStorage.setItem('pivotdatarows'+storageTag,JSON.stringify(configRowsPies, undefined, 2));
localStorage.setItem('pivotdatacols'+storageTag, JSON.stringify(configColsPies,undefined,2));
localStorage.setItem('pivotdatainc'+storageTag, JSON.stringify(configIncPies,undefined,2));
localStorage.setItem('pivotrenderer'+storageTag, JSON.stringify(configRendererPies,undefined,2));
// localStorage.setItem('pivotdatainc'+storageTag, JSON.stringify(configIncRecoupType,undefined,2));
// localStorage.setItem('pivotdatafullrows',JSON.stringify(configRows, undefined, 2));
configRows = configRowsPies;
configCols = configColsPies;
// configInc["Type"] = configIncRecoupType;
} else
if(el.value == "all") {
configRows = (configRowsFull) ? configRowsFull : configRowsDefault;
localStorage.setItem('pivotdatarows'+storageTag,JSON.stringify(configRows, undefined, 2));
localStorage.setItem('pivotdatafullrows'+storageTag,JSON.stringify(configRowsFull, undefined, 2));
localStorage.removeItem('pivotdatacols'+storageTag);
localStorage.removeItem('pivotdatainc'+storageTag);
delete configInc["Type"];
}
location.reload();
}
function toggleHide(obj) {
// var mytable = $(".pvtUi");
//show_hide_column(1,true);
console.log(obj);
console.log("uiVisible:" + $(obj).attr("uiVisible"));
var uiVisible = $(obj).attr("uiVisible");
if(uiVisible == "true") {
$(".pvtAxisContainer").hide();
$(".pvtUiCell").hide();
$(obj).attr("uiVisible","false");
$(obj).attr("value","Show Chart Settings");
var $table = $('table.pvtTable');
$table.trigger('reflow');
} else {
$(".pvtAxisContainer").show();
$(".pvtUiCell").show();
$(obj).attr("uiVisible","true");
$(obj).attr("value","Hide Chart Settings");
var $table = $('table.pvtTable');
$table.trigger('reflow');
}
}
//this function stores pivatetable config to LocalStorage .. does it do anything?
function saveState(config) {
console.log("save state called");
var config_copy = JSON.parse(JSON.stringify(config));
try {
// params["Inclusions"] = config["inclusionsInfo"];
document.getElementById("inclusions").innerHTML = "<strong>Inclusions:</strong>" + JSON.stringify(config_copy["inclusions"]) + " (Change the included Plan(s) below if required)";
} catch (ex) {console.log("inclusions not found")};
//delete some values which are functions
//delete config_copy["aggregators"];
delete config_copy["renderers"];
//delete some bulky default values
// delete config_copy["rendererOptions"];
delete config_copy["localeStrings"];
localStorage.setItem('pivotdatakey'+storageTag, JSON.stringify(config_copy, undefined, 2));
}
</script>
<div class="desc"><p>Data Date: <span id='fileDate'></span>. Choose a saved set from the dropdown menu, or click 'Show Chart Settings' to change data and filters manually. <a href="http://tscps/prac/infrastructure/SitePages/DC%20Ledger%20Report%20-%20XLOne.aspx" target="_blank" title="Upload Excel File to update the data in this chart (Excel source: Paul Drew/Bryan Unwin)"><img src="/contributionspaid/images/excel.jpg" height="20" width="20" /></a>
</p>
<p>NB: Data missing for the following years: 2000-01, 2002-03, 2018-19, no details post 2020-21.</p>
<p id="progressHeading">Read <span id="progress">x</span> of <span id="progressTotal">xx</span> data rows. <span id="inclusions"></span></p>
<input type="button" value="Export JSON" onClick="dataExport()" />
<input type="button" value="Revert" onClick="revert()" title="click to clear saved settings and revert to defaults"/>
<input type="button" id="toggleHideUIButton" value="Hide Chart Settings" uiVisible="false" onclick="toggleHide(this)" title="Click to toggle hide/show chart settings" />
<select onchange="selectChange(this)">
<option value=""></option>
<option value="all">Show all default columns</option>
<option value="recOnly">Expenditure details</option>
<option value="Pies">Multiple Pies</option>
</select>
<input type="image" value="Visible to Excel" src="/contributionspaid/images/excel.jpg" onclick="sheetJSWorkBook('xlsx')" title="Click to download visiblet table as Excel file" />
<a href="https://flowerbot.github.io/contributionspaid/recoupments.html" target="_blank" title="escape SP">Source</a>
</div>
<div id="output"></div>
</body>
</html>