Skip to content

Commit

Permalink
add transaction log report
Browse files Browse the repository at this point in the history
  • Loading branch information
dangowans committed Jun 15, 2022
1 parent 8eceed9 commit 26a8343
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 7 deletions.
10 changes: 7 additions & 3 deletions helpers/licencesDB/getReportData.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ export const getReportData = (reportName, reportParameters) => {
sql = "select * from LicenceTransactions";
break;
case "licenceTransactions-byDate":
let dateFilter = "";
if (reportParameters.transactionDateString && reportParameters.transactionDateString !== "") {
dateFilter = " and t.transactionDate = ?";
sqlParameters.push(dateTimeFunctions.dateStringToInteger(reportParameters.transactionDateString));
}
sql = "select" +
" c.licenceCategory as " + licenceCategory + "," +
" l.licenceNumber as " + licenceNumber + "," +
Expand All @@ -150,9 +155,8 @@ export const getReportData = (reportName, reportParameters) => {
" left join Licences l on t.licenceId = l.licenceId" +
" left join LicenceCategories c on l.licenceCategoryKey = c.licenceCategoryKey" +
" where t.recordDelete_timeMillis is null" +
" and t.transactionDate = ?" +
" order by t.transactionTime";
sqlParameters.push(dateTimeFunctions.dateStringToInteger(reportParameters.transactionDateString));
dateFilter +
" order by t.transactionDate, t.transactionTime";
break;
case "relatedLicences-all":
sql = "select * from RelatedLicences";
Expand Down
13 changes: 9 additions & 4 deletions helpers/licencesDB/getReportData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,13 @@ export const getReportData = (reportName: string, reportParameters?: ReportParam

case "licenceTransactions-byDate":

let dateFilter = "";

if (reportParameters.transactionDateString && reportParameters.transactionDateString !== "") {
dateFilter = " and t.transactionDate = ?";
sqlParameters.push(dateTimeFunctions.dateStringToInteger(reportParameters.transactionDateString as string));
}

sql = "select" +
" c.licenceCategory as " + licenceCategory + "," +
" l.licenceNumber as " + licenceNumber + "," +
Expand All @@ -217,10 +224,8 @@ export const getReportData = (reportName: string, reportParameters?: ReportParam
" left join Licences l on t.licenceId = l.licenceId" +
" left join LicenceCategories c on l.licenceCategoryKey = c.licenceCategoryKey" +
" where t.recordDelete_timeMillis is null" +
" and t.transactionDate = ?" +
" order by t.transactionTime";

sqlParameters.push(dateTimeFunctions.dateStringToInteger(reportParameters.transactionDateString as string));
dateFilter +
" order by t.transactionDate, t.transactionTime";

break;

Expand Down
10 changes: 10 additions & 0 deletions views/admin-yearEnd.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@
<p>After the refresh process, these <%= configFunctions.getProperty("settings.licenceAliasPlural").toLowerCase() %> will still exists, but will no longer be issued.</p>
</div>
</div>
<div class="media">
<div class="media-left" aria-hidden="true">
<i class="fas fa-fw fa-3x fa-file-csv" aria-hidden="true"></i>
</div>
<div class="media-content">
<h3 class="title is-4 is-marginless">
<a href="<%- urlPrefix %>/reports/licenceTransactions-byDate">Full Transaction Log</a>
</h3>
<p>After the refresh process, these transactions will be deleted.</p>
</div>
</div>
</div>
<div class="column">
Expand Down

0 comments on commit 26a8343

Please sign in to comment.