diff --git a/database/getContracts.js b/database/getContracts.js index 3416725e..6f4002ec 100644 --- a/database/getContracts.js +++ b/database/getContracts.js @@ -1,4 +1,4 @@ -import { dateIntegerToString, dateStringToInteger, timeIntegerToString } from '@cityssm/utils-datetime'; +import { dateIntegerToString, dateStringToInteger, timeIntegerToPeriodString, timeIntegerToString } from '@cityssm/utils-datetime'; import sqlite from 'better-sqlite3'; import { getConfigProperty } from '../helpers/config.helpers.js'; import { sunriseDB } from '../helpers/database.helpers.js'; @@ -11,6 +11,7 @@ export default async function getContracts(filters, options, connectedDatabase) const database = connectedDatabase ?? sqlite(sunriseDB); database.function('userFn_dateIntegerToString', dateIntegerToString); database.function('userFn_timeIntegerToString', timeIntegerToString); + database.function('userFn_timeIntegerToPeriodString', timeIntegerToPeriodString); const { sqlParameters, sqlWhereClause } = buildWhereClause(filters); let count = typeof options.limit === 'string' ? Number.parseInt(options.limit, 10) @@ -40,7 +41,10 @@ export default async function getContracts(filters, options, connectedDatabase) o.funeralHomeId, o.funeralDirectorName, f.funeralHomeName, o.funeralDate, userFn_dateIntegerToString(o.funeralDate) as funeralDateString, - o.funeralTime, userFn_timeIntegerToString(o.funeralTime) as funeralTimeString, + o.funeralTime, + userFn_timeIntegerToString(o.funeralTime) as funeralTimeString, + userFn_timeIntegerToPeriodString(o.funeralTime) as funeralTimePeriodString, + o.directionOfArrival, o.committalTypeId, c.committalType from Contracts o left join ContractTypes t on o.contractTypeId = t.contractTypeId diff --git a/database/getContracts.ts b/database/getContracts.ts index 29e3b41f..8464e048 100644 --- a/database/getContracts.ts +++ b/database/getContracts.ts @@ -2,6 +2,7 @@ import { type DateString, dateIntegerToString, dateStringToInteger, + timeIntegerToPeriodString, timeIntegerToString } from '@cityssm/utils-datetime' import sqlite from 'better-sqlite3' @@ -60,6 +61,8 @@ export default async function getContracts( database.function('userFn_dateIntegerToString', dateIntegerToString) database.function('userFn_timeIntegerToString', timeIntegerToString) + database.function( + 'userFn_timeIntegerToPeriodString', timeIntegerToPeriodString) const { sqlParameters, sqlWhereClause } = buildWhereClause(filters) @@ -101,7 +104,10 @@ export default async function getContracts( o.funeralHomeId, o.funeralDirectorName, f.funeralHomeName, o.funeralDate, userFn_dateIntegerToString(o.funeralDate) as funeralDateString, - o.funeralTime, userFn_timeIntegerToString(o.funeralTime) as funeralTimeString, + o.funeralTime, + userFn_timeIntegerToString(o.funeralTime) as funeralTimeString, + userFn_timeIntegerToPeriodString(o.funeralTime) as funeralTimePeriodString, + o.directionOfArrival, o.committalTypeId, c.committalType from Contracts o left join ContractTypes t on o.contractTypeId = t.contractTypeId diff --git a/views/workOrder-view.ejs b/views/workOrder-view.ejs index da4e92b0..755f7a0a 100644 --- a/views/workOrder-view.ejs +++ b/views/workOrder-view.ejs @@ -140,7 +140,7 @@