-
Notifications
You must be signed in to change notification settings - Fork 2
[CCFPCM-378] Report First Page #76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| { | ||
| "program": "SBC", | ||
| "locations": [10], | ||
| "locations": [], | ||
| "period": { | ||
| "from": "2023-01-10", | ||
| "to": "2023-01-31" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,9 @@ | ||
| import { Logger, Module } from '@nestjs/common'; | ||
| import { ExcelexportService } from './excelexport.service'; | ||
| import { ExcelExportService } from './excelexport.service'; | ||
| import { S3ManagerService } from '../s3-manager/s3-manager.service'; | ||
|
|
||
| @Module({ | ||
| providers: [ExcelexportService, S3ManagerService, Logger], | ||
| exports: [ExcelexportService] | ||
| providers: [ExcelExportService, S3ManagerService, Logger], | ||
| exports: [ExcelExportService] | ||
| }) | ||
| export class ExcelexportModule {} | ||
| export class ExcelExportModule {} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,12 @@ | ||
| import { Inject, Injectable, Logger } from '@nestjs/common'; | ||
| import { format } from 'date-fns'; | ||
| import * as Excel from 'exceljs'; | ||
| import * as path from 'path'; | ||
| import { Stream } from 'stream'; | ||
| import { AppLogger } from '../logger/logger.service'; | ||
| import { S3ManagerService } from '../s3-manager/s3-manager.service'; | ||
| @Injectable() | ||
| export class ExcelexportService { | ||
| export class ExcelExportService { | ||
| private workbook: Excel.Workbook; | ||
|
|
||
| constructor( | ||
|
|
@@ -53,20 +54,60 @@ export class ExcelexportService { | |
| } | ||
| } | ||
|
|
||
| public generateWorkbook(title: string): void { | ||
| this.workbook.title = title; | ||
| this.workbook.created = new Date(format(new Date(), 'yyyy, MM, dd')); | ||
| } | ||
|
|
||
| public addSheet(name: string): void { | ||
| this.workbook.addWorksheet(name); | ||
| } | ||
|
|
||
| /* eslint-disable */ | ||
| public addHeader(sheetName: string, style: any): void { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. resolved? |
||
| const sheet = this.workbook.getWorksheet(sheetName); | ||
| sheet.insertRow(1, []); | ||
| const row = sheet.getRow(1); | ||
| row.addPageBreak(); | ||
| row.getCell('E').value = sheetName; | ||
chelsea-EYDS marked this conversation as resolved.
Show resolved
Hide resolved
chelsea-EYDS marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| row.getCell('E').style = style; | ||
| row.height = 20; | ||
| sheet.getRow(2).addPageBreak(); | ||
chelsea-EYDS marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| /*eslint-disable @typescript-eslint/no-unused-vars*/ | ||
| public addCellStyle( | ||
chelsea-EYDS marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| sheetName: string, | ||
| rowNumber: number, | ||
| style: Partial<Excel.Style> | ||
| ): void { | ||
| const sheet = this.workbook.getWorksheet(sheetName); | ||
|
|
||
| const row = sheet.getRow(rowNumber); | ||
| row.eachCell((cell, _colNumber) => { | ||
| sheet.getCell(cell.address).style = style; | ||
| }); | ||
| } | ||
|
|
||
| /*eslint-disable @typescript-eslint/no-explicit-any*/ | ||
| public addRow(sheetName: string, rowData: any[]): void { | ||
| public addRows(sheetName: string, rowData: any[], startIndex: number): void { | ||
| const sheet = this.workbook.getWorksheet(sheetName); | ||
| sheet.addRow(rowData); | ||
|
|
||
| rowData.forEach((row, index) => { | ||
| sheet.insertRow(index + startIndex, row.values); | ||
| sheet.getRow(index + startIndex).commit(); | ||
| if (row.style) { | ||
| this.addCellStyle(sheetName, index + startIndex, row.style); | ||
| } | ||
| }); | ||
|
|
||
| sheet.spliceRows(1, 0, new Array(3)); | ||
| } | ||
|
|
||
| /*eslint-disable @typescript-eslint/no-explicit-any*/ | ||
| public addColumn(sheetName: string, columnData: any[]): void { | ||
| public addColumns(sheetName: string, columnData: any[], style?: any): void { | ||
| const sheet = this.workbook.getWorksheet(sheetName); | ||
| sheet.columns.push({ header: 'New Column', key: 'newColumn', width: 20 }); | ||
| sheet.getColumn('newColumn').values = columnData; | ||
| sheet.columns = columnData; | ||
| sheet.columns.forEach((column) => (column.width = 20)); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| export const dailySummaryColumns = [ | ||
| { header: 'Program', key: 'program' }, | ||
| { header: 'Date', key: 'date' }, | ||
| { header: 'Location ID', key: 'location_id' }, | ||
| { header: 'Location', key: 'location_name' }, | ||
| { header: 'Total Payments', key: 'total_payments' }, | ||
| { header: 'Total Unmatched', key: 'total_unmatched_payments' }, | ||
| { header: '% Unmatched', key: 'percent_unmatched' }, | ||
| { header: 'Sum Of Payments', key: 'total_sum' } | ||
| ]; |

Uh oh!
There was an error while loading. Please reload this page.