parent
f440a35df7
commit
62efb70542
|
|
@ -1,2 +1,2 @@
|
|||
import type { BurialSiteType } from '../types/record.types.js';
|
||||
export default function getBurialSiteTypes(): BurialSiteType[];
|
||||
export default function getBurialSiteTypes(includeDeleted?: boolean): BurialSiteType[];
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@ import sqlite from 'better-sqlite3';
|
|||
import { sunriseDB } from '../helpers/database.helpers.js';
|
||||
import getBurialSiteTypeFields from './getBurialSiteTypeFields.js';
|
||||
import { updateRecordOrderNumber } from './updateRecordOrderNumber.js';
|
||||
export default function getBurialSiteTypes() {
|
||||
export default function getBurialSiteTypes(includeDeleted = false) {
|
||||
const database = sqlite(sunriseDB);
|
||||
const burialSiteTypes = database
|
||||
.prepare(`select burialSiteTypeId, burialSiteType, orderNumber
|
||||
from BurialSiteTypes
|
||||
where recordDelete_timeMillis is null
|
||||
${includeDeleted ? '' : ' where recordDelete_timeMillis is null '}
|
||||
order by orderNumber, burialSiteType`)
|
||||
.all();
|
||||
let expectedOrderNumber = -1;
|
||||
|
|
|
|||
|
|
@ -6,14 +6,16 @@ import type { BurialSiteType } from '../types/record.types.js'
|
|||
import getBurialSiteTypeFields from './getBurialSiteTypeFields.js'
|
||||
import { updateRecordOrderNumber } from './updateRecordOrderNumber.js'
|
||||
|
||||
export default function getBurialSiteTypes(): BurialSiteType[] {
|
||||
export default function getBurialSiteTypes(
|
||||
includeDeleted = false
|
||||
): BurialSiteType[] {
|
||||
const database = sqlite(sunriseDB)
|
||||
|
||||
const burialSiteTypes = database
|
||||
.prepare(
|
||||
`select burialSiteTypeId, burialSiteType, orderNumber
|
||||
from BurialSiteTypes
|
||||
where recordDelete_timeMillis is null
|
||||
${includeDeleted ? '' : ' where recordDelete_timeMillis is null '}
|
||||
order by orderNumber, burialSiteType`
|
||||
)
|
||||
.all() as BurialSiteType[]
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
import type { CommittalType } from '../types/record.types.js';
|
||||
export default function getCommittalTypes(): CommittalType[];
|
||||
export default function getCommittalTypes(includeDeleted?: boolean): CommittalType[];
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
import sqlite from 'better-sqlite3';
|
||||
import { sunriseDB } from '../helpers/database.helpers.js';
|
||||
import { updateRecordOrderNumber } from './updateRecordOrderNumber.js';
|
||||
export default function getCommittalTypes() {
|
||||
export default function getCommittalTypes(includeDeleted = false) {
|
||||
const database = sqlite(sunriseDB);
|
||||
const committalTypes = database
|
||||
.prepare(`select committalTypeId, committalTypeKey, committalType, orderNumber
|
||||
from CommittalTypes
|
||||
where recordDelete_timeMillis is null
|
||||
${includeDeleted ? '' : ' where recordDelete_timeMillis is null '}
|
||||
order by orderNumber, committalType, committalTypeId`)
|
||||
.all();
|
||||
let expectedOrderNumber = -1;
|
||||
|
|
|
|||
|
|
@ -5,14 +5,16 @@ import type { CommittalType } from '../types/record.types.js'
|
|||
|
||||
import { updateRecordOrderNumber } from './updateRecordOrderNumber.js'
|
||||
|
||||
export default function getCommittalTypes(): CommittalType[] {
|
||||
export default function getCommittalTypes(
|
||||
includeDeleted = false
|
||||
): CommittalType[] {
|
||||
const database = sqlite(sunriseDB)
|
||||
|
||||
const committalTypes = database
|
||||
.prepare(
|
||||
`select committalTypeId, committalTypeKey, committalType, orderNumber
|
||||
from CommittalTypes
|
||||
where recordDelete_timeMillis is null
|
||||
${includeDeleted ? '' : ' where recordDelete_timeMillis is null '}
|
||||
order by orderNumber, committalType, committalTypeId`
|
||||
)
|
||||
.all() as CommittalType[]
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
import type { IntermentContainerType } from '../types/record.types.js';
|
||||
export default function getIntermentContainerTypes(): IntermentContainerType[];
|
||||
export default function getIntermentContainerTypes(includeDeleted?: boolean): IntermentContainerType[];
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
import sqlite from 'better-sqlite3';
|
||||
import { sunriseDB } from '../helpers/database.helpers.js';
|
||||
import { updateRecordOrderNumber } from './updateRecordOrderNumber.js';
|
||||
export default function getIntermentContainerTypes() {
|
||||
export default function getIntermentContainerTypes(includeDeleted = false) {
|
||||
const database = sqlite(sunriseDB);
|
||||
const containerTypes = database
|
||||
.prepare(`select intermentContainerTypeId, intermentContainerType, intermentContainerTypeKey,
|
||||
isCremationType, orderNumber
|
||||
from IntermentContainerTypes
|
||||
where recordDelete_timeMillis is null
|
||||
${includeDeleted ? '' : ' where recordDelete_timeMillis is null '}
|
||||
order by isCremationType, orderNumber, intermentContainerType, intermentContainerTypeId`)
|
||||
.all();
|
||||
let expectedOrderNumber = -1;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,9 @@ import type { IntermentContainerType } from '../types/record.types.js'
|
|||
|
||||
import { updateRecordOrderNumber } from './updateRecordOrderNumber.js'
|
||||
|
||||
export default function getIntermentContainerTypes(): IntermentContainerType[] {
|
||||
export default function getIntermentContainerTypes(
|
||||
includeDeleted = false
|
||||
): IntermentContainerType[] {
|
||||
const database = sqlite(sunriseDB)
|
||||
|
||||
const containerTypes = database
|
||||
|
|
@ -13,7 +15,7 @@ export default function getIntermentContainerTypes(): IntermentContainerType[] {
|
|||
`select intermentContainerTypeId, intermentContainerType, intermentContainerTypeKey,
|
||||
isCremationType, orderNumber
|
||||
from IntermentContainerTypes
|
||||
where recordDelete_timeMillis is null
|
||||
${includeDeleted ? '' : ' where recordDelete_timeMillis is null '}
|
||||
order by isCremationType, orderNumber, intermentContainerType, intermentContainerTypeId`
|
||||
)
|
||||
.all() as IntermentContainerType[]
|
||||
|
|
|
|||
|
|
@ -1,16 +1,10 @@
|
|||
import * as cacheFunctions from '../../helpers/functions.cache.js';
|
||||
const inGroundBurialSiteTypeId = (await cacheFunctions.getBurialSiteTypesByBurialSiteType('In-Ground Grave'))
|
||||
.burialSiteTypeId;
|
||||
const columbariumBurialSiteTypeId = (await cacheFunctions.getBurialSiteTypesByBurialSiteType('Columbarium'))
|
||||
.burialSiteTypeId;
|
||||
const cremationBurialSiteTypeId = (await cacheFunctions.getBurialSiteTypesByBurialSiteType('Crematorium'))
|
||||
.burialSiteTypeId;
|
||||
const mausoleumBurialSiteTypeId = (await cacheFunctions.getBurialSiteTypesByBurialSiteType('Mausoleum'))
|
||||
.burialSiteTypeId;
|
||||
const nicheWallBurialSiteTypeId = (await cacheFunctions.getBurialSiteTypesByBurialSiteType('Niche Wall'))
|
||||
.burialSiteTypeId;
|
||||
const urnGardenBurialSiteTypeId = (await cacheFunctions.getBurialSiteTypesByBurialSiteType('Urn Garden'))
|
||||
.burialSiteTypeId;
|
||||
const inGroundBurialSiteTypeId = cacheFunctions.getBurialSiteTypesByBurialSiteType('In-Ground Grave').burialSiteTypeId;
|
||||
const columbariumBurialSiteTypeId = cacheFunctions.getBurialSiteTypesByBurialSiteType('Columbarium').burialSiteTypeId;
|
||||
const cremationBurialSiteTypeId = cacheFunctions.getBurialSiteTypesByBurialSiteType('Crematorium').burialSiteTypeId;
|
||||
const mausoleumBurialSiteTypeId = cacheFunctions.getBurialSiteTypesByBurialSiteType('Mausoleum').burialSiteTypeId;
|
||||
const nicheWallBurialSiteTypeId = cacheFunctions.getBurialSiteTypesByBurialSiteType('Niche Wall').burialSiteTypeId;
|
||||
const urnGardenBurialSiteTypeId = cacheFunctions.getBurialSiteTypesByBurialSiteType('Urn Garden').burialSiteTypeId;
|
||||
export function getBurialSiteTypeId(cemeteryKey) {
|
||||
switch (cemeteryKey) {
|
||||
case '00': {
|
||||
|
|
|
|||
|
|
@ -1,24 +1,30 @@
|
|||
import * as cacheFunctions from '../../helpers/functions.cache.js'
|
||||
|
||||
const inGroundBurialSiteTypeId =
|
||||
(await cacheFunctions.getBurialSiteTypesByBurialSiteType('In-Ground Grave'))!
|
||||
.burialSiteTypeId
|
||||
cacheFunctions.getBurialSiteTypesByBurialSiteType(
|
||||
'In-Ground Grave'
|
||||
)!.burialSiteTypeId
|
||||
|
||||
const columbariumBurialSiteTypeId =
|
||||
(await cacheFunctions.getBurialSiteTypesByBurialSiteType('Columbarium'))!
|
||||
.burialSiteTypeId
|
||||
cacheFunctions.getBurialSiteTypesByBurialSiteType(
|
||||
'Columbarium'
|
||||
)!.burialSiteTypeId
|
||||
const cremationBurialSiteTypeId =
|
||||
(await cacheFunctions.getBurialSiteTypesByBurialSiteType('Crematorium'))!
|
||||
.burialSiteTypeId
|
||||
cacheFunctions.getBurialSiteTypesByBurialSiteType(
|
||||
'Crematorium'
|
||||
)!.burialSiteTypeId
|
||||
const mausoleumBurialSiteTypeId =
|
||||
(await cacheFunctions.getBurialSiteTypesByBurialSiteType('Mausoleum'))!
|
||||
.burialSiteTypeId
|
||||
cacheFunctions.getBurialSiteTypesByBurialSiteType(
|
||||
'Mausoleum'
|
||||
)!.burialSiteTypeId
|
||||
const nicheWallBurialSiteTypeId =
|
||||
(await cacheFunctions.getBurialSiteTypesByBurialSiteType('Niche Wall'))!
|
||||
.burialSiteTypeId
|
||||
cacheFunctions.getBurialSiteTypesByBurialSiteType(
|
||||
'Niche Wall'
|
||||
)!.burialSiteTypeId
|
||||
const urnGardenBurialSiteTypeId =
|
||||
(await cacheFunctions.getBurialSiteTypesByBurialSiteType('Urn Garden'))!
|
||||
.burialSiteTypeId
|
||||
cacheFunctions.getBurialSiteTypesByBurialSiteType(
|
||||
'Urn Garden'
|
||||
)!.burialSiteTypeId
|
||||
|
||||
export function getBurialSiteTypeId(cemeteryKey: string): number {
|
||||
switch (cemeteryKey) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import addCommittalType from '../../database/addCommittalType.js';
|
||||
import getCommittalTypes from '../../database/getCommittalTypes.js';
|
||||
let committalTypes = getCommittalTypes();
|
||||
let committalTypes = getCommittalTypes(true);
|
||||
export function getCommittalTypeIdByKey(committalTypeKey, user) {
|
||||
const committalType = committalTypes.find((committalType) => committalType.committalTypeKey === committalTypeKey);
|
||||
if (committalType === undefined) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import addCommittalType from '../../database/addCommittalType.js'
|
||||
import getCommittalTypes from '../../database/getCommittalTypes.js'
|
||||
|
||||
let committalTypes = getCommittalTypes()
|
||||
let committalTypes = getCommittalTypes(true)
|
||||
|
||||
export function getCommittalTypeIdByKey(
|
||||
committalTypeKey: string,
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ export function getIntermentContainerTypeIdByKey(intermentContainerTypeKey, user
|
|||
intermentContainerTypeKey,
|
||||
intermentContainerType: intermentContainerTypeKey
|
||||
}, user);
|
||||
intermentContainerTypes = getIntermentContainerTypes();
|
||||
intermentContainerTypes = getIntermentContainerTypes(true);
|
||||
return intermentContainerTypeId;
|
||||
}
|
||||
return intermentContainerType.intermentContainerTypeId;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ export function getIntermentContainerTypeIdByKey(
|
|||
user
|
||||
)
|
||||
|
||||
intermentContainerTypes = getIntermentContainerTypes()
|
||||
intermentContainerTypes = getIntermentContainerTypes(true)
|
||||
|
||||
return intermentContainerTypeId
|
||||
}
|
||||
|
|
|
|||
|
|
@ -388,10 +388,7 @@ async function importFromMasterCSV(): Promise<void> {
|
|||
const intermentContainerTypeId =
|
||||
intermentContainerTypeKey === ''
|
||||
? ''
|
||||
: getIntermentContainerTypeIdByKey(
|
||||
intermentContainerTypeKey,
|
||||
user
|
||||
)
|
||||
: getIntermentContainerTypeIdByKey(intermentContainerTypeKey, user)
|
||||
|
||||
deceasedContractId = addContract(
|
||||
{
|
||||
|
|
@ -649,6 +646,7 @@ async function importFromPrepaidCSV(): Promise<void> {
|
|||
contractId,
|
||||
feeId: getFeeIdByFeeDescription('CMPP_FEE_GRAV_SD', user),
|
||||
quantity: 1,
|
||||
|
||||
feeAmount: prepaidRow.CMPP_FEE_GRAV_SD,
|
||||
taxAmount: prepaidRow.CMPP_GST_GRAV_SD
|
||||
},
|
||||
|
|
@ -662,6 +660,7 @@ async function importFromPrepaidCSV(): Promise<void> {
|
|||
contractId,
|
||||
feeId: getFeeIdByFeeDescription('CMPP_FEE_GRAV_DD', user),
|
||||
quantity: 1,
|
||||
|
||||
feeAmount: prepaidRow.CMPP_FEE_GRAV_DD,
|
||||
taxAmount: prepaidRow.CMPP_GST_GRAV_DD
|
||||
},
|
||||
|
|
@ -675,6 +674,7 @@ async function importFromPrepaidCSV(): Promise<void> {
|
|||
contractId,
|
||||
feeId: getFeeIdByFeeDescription('CMPP_FEE_CHAP_SD', user),
|
||||
quantity: 1,
|
||||
|
||||
feeAmount: prepaidRow.CMPP_FEE_CHAP_SD,
|
||||
taxAmount: prepaidRow.CMPP_GST_CHAP_SD
|
||||
},
|
||||
|
|
@ -688,6 +688,7 @@ async function importFromPrepaidCSV(): Promise<void> {
|
|||
contractId,
|
||||
feeId: getFeeIdByFeeDescription('CMPP_FEE_CHAP_DD', user),
|
||||
quantity: 1,
|
||||
|
||||
feeAmount: prepaidRow.CMPP_FEE_CHAP_DD,
|
||||
taxAmount: prepaidRow.CMPP_GST_CHAP_DD
|
||||
},
|
||||
|
|
@ -701,6 +702,7 @@ async function importFromPrepaidCSV(): Promise<void> {
|
|||
contractId,
|
||||
feeId: getFeeIdByFeeDescription('CMPP_FEE_ENTOMBMENT', user),
|
||||
quantity: 1,
|
||||
|
||||
feeAmount: prepaidRow.CMPP_FEE_ENTOMBMENT,
|
||||
taxAmount: prepaidRow.CMPP_GST_ENTOMBMENT
|
||||
},
|
||||
|
|
@ -714,6 +716,7 @@ async function importFromPrepaidCSV(): Promise<void> {
|
|||
contractId,
|
||||
feeId: getFeeIdByFeeDescription('CMPP_FEE_CREM', user),
|
||||
quantity: 1,
|
||||
|
||||
feeAmount: prepaidRow.CMPP_FEE_CREM,
|
||||
taxAmount: prepaidRow.CMPP_GST_CREM
|
||||
},
|
||||
|
|
@ -727,6 +730,7 @@ async function importFromPrepaidCSV(): Promise<void> {
|
|||
contractId,
|
||||
feeId: getFeeIdByFeeDescription('CMPP_FEE_NICHE', user),
|
||||
quantity: 1,
|
||||
|
||||
feeAmount: prepaidRow.CMPP_FEE_NICHE,
|
||||
taxAmount: prepaidRow.CMPP_GST_NICHE
|
||||
},
|
||||
|
|
@ -741,11 +745,9 @@ async function importFromPrepaidCSV(): Promise<void> {
|
|||
await addContractFee(
|
||||
{
|
||||
contractId,
|
||||
feeId: getFeeIdByFeeDescription(
|
||||
'CMPP_FEE_DISINTERMENT',
|
||||
user
|
||||
),
|
||||
feeId: getFeeIdByFeeDescription('CMPP_FEE_DISINTERMENT', user),
|
||||
quantity: 1,
|
||||
|
||||
feeAmount: prepaidRow.CMPP_FEE_DISINTERMENT,
|
||||
taxAmount: prepaidRow.CMPP_GST_DISINTERMENT
|
||||
},
|
||||
|
|
@ -794,6 +796,7 @@ async function importFromPrepaidCSV(): Promise<void> {
|
|||
addContractComment(
|
||||
{
|
||||
contractId,
|
||||
|
||||
commentDateString: contractStartDateString,
|
||||
comment: prepaidRow.CMPP_REMARK1
|
||||
},
|
||||
|
|
@ -805,6 +808,7 @@ async function importFromPrepaidCSV(): Promise<void> {
|
|||
addContractComment(
|
||||
{
|
||||
contractId,
|
||||
|
||||
commentDateString: contractStartDateString,
|
||||
comment: prepaidRow.CMPP_REMARK2
|
||||
},
|
||||
|
|
@ -992,10 +996,7 @@ async function importFromWorkOrderCSV(): Promise<void> {
|
|||
const intermentContainerTypeId =
|
||||
intermentContainerTypeKey === ''
|
||||
? ''
|
||||
: getIntermentContainerTypeIdByKey(
|
||||
intermentContainerTypeKey,
|
||||
user
|
||||
)
|
||||
: getIntermentContainerTypeIdByKey(intermentContainerTypeKey, user)
|
||||
|
||||
const contractId = addContract(
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue