scheduler-node-models 1.0.158 → 1.0.160

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scheduler-node-models",
3
- "version": "1.0.158",
3
+ "version": "1.0.160",
4
4
  "main": "index.js",
5
5
  "types": "index.d.ts",
6
6
  "files": [
@@ -48,4 +48,5 @@ export declare class LeaveReport extends Report {
48
48
  * @returns the numeric value for the last row of this employee's section
49
49
  */
50
50
  employeePTOHolidaySection(sheet: Worksheet, emp: Employee, row: number, year: number, showHoliday: boolean): number;
51
+ createMonthlyListing(workbook: Workbook, year: number, bAll?: boolean): void;
51
52
  }
@@ -62,6 +62,8 @@ class LeaveReport extends general_1.Report {
62
62
  workbook.created = new Date();
63
63
  this.createStyles();
64
64
  this.createLeaveListing(workbook, start.getFullYear(), this.holidays.length > 0);
65
+ this.createMonthlyListing(workbook, start.getFullYear(), true);
66
+ this.createMonthlyListing(workbook, start.getFullYear(), false);
65
67
  return workbook;
66
68
  }
67
69
  /**
@@ -154,7 +156,7 @@ class LeaveReport extends general_1.Report {
154
156
  },
155
157
  views: [{
156
158
  state: 'frozen',
157
- ySplit: 2
159
+ ySplit: 1
158
160
  }]
159
161
  });
160
162
  let extendWidth = 3;
@@ -180,16 +182,16 @@ class LeaveReport extends general_1.Report {
180
182
  sheet.getColumn(1).width = 4.5;
181
183
  sheet.getColumn(2).width = 13;
182
184
  sheet.getColumn(3).width = 30;
183
- sheet.getColumn(4).width = 7;
184
- sheet.getColumn(5).width = 30;
185
- sheet.getColumn(6).width = 7;
185
+ sheet.getColumn(4).width = 13;
186
+ sheet.getColumn(5).width = 19;
187
+ sheet.getColumn(6).width = 19;
186
188
  sheet.getColumn(7).width = 7;
187
189
  sheet.getColumn(8).width = 7;
188
190
  sheet.getColumn(9).width = 7;
189
191
  }
190
192
  else {
191
- sheet.getColumn(1).width = 30;
192
- sheet.getColumn(2).width = 7;
193
+ sheet.getColumn(1).width = 19;
194
+ sheet.getColumn(2).width = 19;
193
195
  sheet.getColumn(3).width = 7;
194
196
  sheet.getColumn(4).width = 7;
195
197
  sheet.getColumn(5).width = 7;
@@ -659,5 +661,95 @@ class LeaveReport extends general_1.Report {
659
661
  this.setCell(sheet, this.getCellID(col + 4, row + 1), this.getCellID(col + 4, row + 1), style, balance);
660
662
  return row + 2;
661
663
  }
664
+ createMonthlyListing(workbook, year, bAll) {
665
+ let sheetLabel = `${year} Monthly`;
666
+ if (!bAll) {
667
+ sheetLabel += ' (Minimum)';
668
+ }
669
+ const sheet = workbook.addWorksheet(sheetLabel, {
670
+ pageSetup: {
671
+ paperSize: undefined,
672
+ orientation: 'landscape',
673
+ fitToHeight: 1,
674
+ fitToWidth: 1,
675
+ blackAndWhite: false,
676
+ fitToPage: true,
677
+ showGridLines: false,
678
+ horizontalCentered: true,
679
+ verticalCentered: true
680
+ },
681
+ properties: {
682
+ defaultRowHeight: 20,
683
+ defaultColWidth: 4,
684
+ outlineLevelCol: 0
685
+ },
686
+ views: [{
687
+ state: 'frozen',
688
+ ySplit: 4
689
+ }]
690
+ });
691
+ const formatter = new Intl.DateTimeFormat('en-US', {
692
+ month: '2-digit',
693
+ day: '2-digit',
694
+ year: 'numeric'
695
+ });
696
+ const now = new Date();
697
+ // add current as of reference
698
+ let style = {
699
+ fill: this.fills.get('asof'),
700
+ font: this.fonts.get("white12"),
701
+ alignment: this.alignments.get("center"),
702
+ border: this.borders.get("blackthin")
703
+ };
704
+ this.setCell(sheet, this.getCellID(0, 1), this.getCellID(3, 1), style, formatter.format(now));
705
+ let text = `${year} PTO/HOL Quick Reference (${(bAll) ? 'FULL' : 'MINIMUM'})`;
706
+ style = {
707
+ fill: this.fills.get('white'),
708
+ font: this.fonts.get('bold14'),
709
+ alignment: this.alignments.get('center'),
710
+ border: undefined
711
+ };
712
+ this.setCell(sheet, this.getCellID(4, 1), this.getCellID(33, 1), style, text);
713
+ // set column widths
714
+ sheet.getColumn(1).width = 2;
715
+ sheet.getColumn(2).width = 20;
716
+ for (let c = 3; c <= 33; c++) {
717
+ sheet.getColumn(c).width = 4;
718
+ }
719
+ for (let c = 34; c <= 36; c++) {
720
+ sheet.getColumn(c).width = 7;
721
+ }
722
+ // add leave legend codes
723
+ let col = 2;
724
+ let row = 2;
725
+ this.workcodes.forEach(wc => {
726
+ if (wc.isLeave) {
727
+ if (col > 33) {
728
+ col = 2;
729
+ row++;
730
+ }
731
+ style = {
732
+ fill: { type: 'pattern', pattern: 'solid', fgColor: { argb: `ff${wc.backcolor}` } },
733
+ font: { bold: true, size: 12, color: { argb: `ff${wc.textcolor}` } },
734
+ alignment: this.alignments.get('center'),
735
+ border: this.borders.get('blackthin')
736
+ };
737
+ this.setCell(sheet, this.getCellID(col, row), this.getCellID(col, row), style, '');
738
+ style = {
739
+ fill: { type: 'pattern', pattern: 'solid', fgColor: { argb: `ffffffff` } },
740
+ font: { bold: true, size: 12, color: { argb: `ff000000` } },
741
+ alignment: this.alignments.get('center'),
742
+ border: {
743
+ top: undefined,
744
+ left: undefined,
745
+ bottom: { style: 'thin', color: { argb: 'ff000000' } },
746
+ right: undefined
747
+ }
748
+ };
749
+ this.setCell(sheet, this.getCellID(col + 1, row), this.getCellID(col + 5, row), style, wc.title);
750
+ col += 6;
751
+ }
752
+ });
753
+ }
662
754
  }
663
755
  exports.LeaveReport = LeaveReport;