fee account

deepsource-autofix-76c6eb20
Dan Gowans 2023-06-20 09:29:08 -04:00
parent d946f8a323
commit 2422c86019
19 changed files with 131 additions and 43 deletions

View File

@ -40,7 +40,26 @@ const createStatements = [
`create table if not exists LotOccupancyComments (lotOccupancyCommentId integer not null primary key autoincrement, lotOccupancyId integer not null, lotOccupancyCommentDate integer not null check (lotOccupancyCommentDate > 0), lotOccupancyCommentTime integer not null check (lotOccupancyCommentTime >= 0), lotOccupancyComment text not null, ${recordColumns}, foreign key (lotOccupancyId) references LotOccupancies (lotOccupancyId))`,
'create index if not exists idx_lotoccupancycomments_datetime on LotOccupancyComments (lotOccupancyId, lotOccupancyCommentDate, lotOccupancyCommentTime)',
`create table if not exists FeeCategories (feeCategoryId integer not null primary key autoincrement, feeCategory varchar(100) not null, orderNumber smallint not null default 0, ${recordColumns})`,
`create table if not exists Fees (feeId integer not null primary key autoincrement, feeCategoryId integer not null, feeName varchar(100) not null, feeDescription text, occupancyTypeId integer, lotTypeId integer, includeQuantity boolean not null default 0, quantityUnit varchar(30), feeAmount decimal(8, 2), feeFunction varchar(100), taxAmount decimal(6, 2), taxPercentage decimal(5, 2), isRequired bit not null default 0, orderNumber smallint not null default 0, ${recordColumns}, foreign key (feeCategoryId) references FeeCategories (feeCategoryId), foreign key (occupancyTypeId) references OccupancyTypes (occupancyTypeId), foreign key (lotTypeId) references LotTypes (lotTypeId))`,
`create table if not exists Fees (
feeId integer not null primary key autoincrement,
feeCategoryId integer not null,
feeName varchar(100) not null,
feeDescription text,
feeAccount varchar(20),
occupancyTypeId integer,
lotTypeId integer,
includeQuantity boolean not null default 0,
quantityUnit varchar(30),
feeAmount decimal(8, 2),
feeFunction varchar(100),
taxAmount decimal(6, 2),
taxPercentage decimal(5, 2),
isRequired bit not null default 0,
orderNumber smallint not null default 0,
${recordColumns},
foreign key (feeCategoryId) references FeeCategories (feeCategoryId),
foreign key (occupancyTypeId) references OccupancyTypes (occupancyTypeId),
foreign key (lotTypeId) references LotTypes (lotTypeId))`,
'create index if not exists idx_fees_ordernumber on Fees (orderNumber, feeName)',
`create table if not exists LotOccupancyFees (lotOccupancyId integer not null, feeId integer not null, quantity decimal(4, 1) not null default 1, feeAmount decimal(8, 2) not null, taxAmount decmial(8, 2) not null, ${recordColumns}, primary key (lotOccupancyId, feeId), foreign key (lotOccupancyId) references LotOccupancies (lotOccupancyId), foreign key (feeId) references Fees (feeId)) without rowid`,
`create table if not exists LotOccupancyTransactions (lotOccupancyId integer not null, transactionIndex integer not null, transactionDate integer not null check (transactionDate > 0), transactionTime integer not null check (transactionTime >= 0), transactionAmount decimal(8, 2) not null, externalReceiptNumber varchar(100), transactionNote text, ${recordColumns}, primary key (lotOccupancyId, transactionIndex), foreign key (lotOccupancyId) references LotOccupancies (lotOccupancyId)) without rowid`,

View File

@ -53,7 +53,26 @@ const createStatements = [
// Fees and Transactions
`create table if not exists FeeCategories (feeCategoryId integer not null primary key autoincrement, feeCategory varchar(100) not null, orderNumber smallint not null default 0, ${recordColumns})`,
`create table if not exists Fees (feeId integer not null primary key autoincrement, feeCategoryId integer not null, feeName varchar(100) not null, feeDescription text, occupancyTypeId integer, lotTypeId integer, includeQuantity boolean not null default 0, quantityUnit varchar(30), feeAmount decimal(8, 2), feeFunction varchar(100), taxAmount decimal(6, 2), taxPercentage decimal(5, 2), isRequired bit not null default 0, orderNumber smallint not null default 0, ${recordColumns}, foreign key (feeCategoryId) references FeeCategories (feeCategoryId), foreign key (occupancyTypeId) references OccupancyTypes (occupancyTypeId), foreign key (lotTypeId) references LotTypes (lotTypeId))`,
`create table if not exists Fees (
feeId integer not null primary key autoincrement,
feeCategoryId integer not null,
feeName varchar(100) not null,
feeDescription text,
feeAccount varchar(20),
occupancyTypeId integer,
lotTypeId integer,
includeQuantity boolean not null default 0,
quantityUnit varchar(30),
feeAmount decimal(8, 2),
feeFunction varchar(100),
taxAmount decimal(6, 2),
taxPercentage decimal(5, 2),
isRequired bit not null default 0,
orderNumber smallint not null default 0,
${recordColumns},
foreign key (feeCategoryId) references FeeCategories (feeCategoryId),
foreign key (occupancyTypeId) references OccupancyTypes (occupancyTypeId),
foreign key (lotTypeId) references LotTypes (lotTypeId))`,
'create index if not exists idx_fees_ordernumber on Fees (orderNumber, feeName)',
`create table if not exists LotOccupancyFees (lotOccupancyId integer not null, feeId integer not null, quantity decimal(4, 1) not null default 1, feeAmount decimal(8, 2) not null, taxAmount decmial(8, 2) not null, ${recordColumns}, primary key (lotOccupancyId, feeId), foreign key (lotOccupancyId) references LotOccupancies (lotOccupancyId), foreign key (feeId) references Fees (feeId)) without rowid`,
`create table if not exists LotOccupancyTransactions (lotOccupancyId integer not null, transactionIndex integer not null, transactionDate integer not null check (transactionDate > 0), transactionTime integer not null check (transactionTime >= 0), transactionAmount decimal(8, 2) not null, externalReceiptNumber varchar(100), transactionNote text, ${recordColumns}, primary key (lotOccupancyId, transactionIndex), foreign key (lotOccupancyId) references LotOccupancies (lotOccupancyId)) without rowid`,

View File

@ -3,6 +3,7 @@ interface AddFeeForm {
feeCategoryId: string;
feeName: string;
feeDescription: string;
feeAccount: string;
occupancyTypeId: string;
lotTypeId: string;
feeAmount?: string;

View File

@ -5,7 +5,7 @@ export async function addFee(feeForm, requestSession) {
const result = database
.prepare(`insert into Fees (
feeCategoryId,
feeName, feeDescription,
feeName, feeDescription, feeAccount,
occupancyTypeId, lotTypeId,
feeAmount, feeFunction,
taxAmount, taxPercentage,
@ -13,8 +13,8 @@ export async function addFee(feeForm, requestSession) {
isRequired, orderNumber,
recordCreate_userName, recordCreate_timeMillis,
recordUpdate_userName, recordUpdate_timeMillis)
values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`)
.run(feeForm.feeCategoryId, feeForm.feeName, feeForm.feeDescription, feeForm.occupancyTypeId === '' ? undefined : feeForm.occupancyTypeId, feeForm.lotTypeId === '' ? undefined : feeForm.lotTypeId, feeForm.feeAmount ?? undefined, feeForm.feeFunction ?? undefined, feeForm.taxAmount ?? undefined, feeForm.taxPercentage ?? undefined, (feeForm.includeQuantity ?? '') === '' ? 0 : 1, feeForm.quantityUnit, (feeForm.isRequired ?? '') === '' ? 0 : 1, feeForm.orderNumber ?? -1, requestSession.user.userName, rightNowMillis, requestSession.user.userName, rightNowMillis);
values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`)
.run(feeForm.feeCategoryId, feeForm.feeName, feeForm.feeDescription, feeForm.feeAccount, feeForm.occupancyTypeId === '' ? undefined : feeForm.occupancyTypeId, feeForm.lotTypeId === '' ? undefined : feeForm.lotTypeId, feeForm.feeAmount ?? undefined, feeForm.feeFunction ?? undefined, feeForm.taxAmount ?? undefined, feeForm.taxPercentage ?? undefined, (feeForm.includeQuantity ?? '') === '' ? 0 : 1, feeForm.quantityUnit, (feeForm.isRequired ?? '') === '' ? 0 : 1, feeForm.orderNumber ?? -1, requestSession.user.userName, rightNowMillis, requestSession.user.userName, rightNowMillis);
database.release();
return result.lastInsertRowid;
}

View File

@ -8,6 +8,7 @@ interface AddFeeForm {
feeCategoryId: string
feeName: string
feeDescription: string
feeAccount: string
occupancyTypeId: string
lotTypeId: string
feeAmount?: string
@ -32,7 +33,7 @@ export async function addFee(
.prepare(
`insert into Fees (
feeCategoryId,
feeName, feeDescription,
feeName, feeDescription, feeAccount,
occupancyTypeId, lotTypeId,
feeAmount, feeFunction,
taxAmount, taxPercentage,
@ -40,12 +41,13 @@ export async function addFee(
isRequired, orderNumber,
recordCreate_userName, recordCreate_timeMillis,
recordUpdate_userName, recordUpdate_timeMillis)
values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`
values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`
)
.run(
feeForm.feeCategoryId,
feeForm.feeName,
feeForm.feeDescription,
feeForm.feeAccount,
feeForm.occupancyTypeId === '' ? undefined : feeForm.occupancyTypeId,
feeForm.lotTypeId === '' ? undefined : feeForm.lotTypeId,
feeForm.feeAmount ?? undefined,

View File

@ -4,7 +4,7 @@ export async function getFee(feeId, connectedDatabase) {
const fee = database
.prepare(`select f.feeId,
f.feeCategoryId, c.feeCategory,
f.feeName, f.feeDescription,
f.feeName, f.feeDescription, f.feeAccount,
f.occupancyTypeId, o.occupancyType,
f.lotTypeId, l.lotType,
ifnull(f.feeAmount, 0) as feeAmount, f.feeFunction,

View File

@ -13,7 +13,7 @@ export async function getFee(
.prepare(
`select f.feeId,
f.feeCategoryId, c.feeCategory,
f.feeName, f.feeDescription,
f.feeName, f.feeDescription, f.feeAccount,
f.occupancyTypeId, o.occupancyType,
f.lotTypeId, l.lotType,
ifnull(f.feeAmount, 0) as feeAmount, f.feeFunction,

View File

@ -15,7 +15,8 @@ export async function getFees(feeCategoryId, additionalFilters, connectedDatabas
sqlParameters.push(additionalFilters.lotTypeId);
}
const fees = database
.prepare(`select f.feeId, f.feeName, f.feeDescription,
.prepare(`select f.feeId,
f.feeName, f.feeDescription, f.feeAccount,
f.occupancyTypeId, o.occupancyType,
f.lotTypeId, l.lotType,
ifnull(f.feeAmount, 0) as feeAmount,

View File

@ -41,7 +41,8 @@ export async function getFees(
const fees = database
.prepare(
`select f.feeId, f.feeName, f.feeDescription,
`select f.feeId,
f.feeName, f.feeDescription, f.feeAccount,
f.occupancyTypeId, o.occupancyType,
f.lotTypeId, l.lotType,
ifnull(f.feeAmount, 0) as feeAmount,

View File

@ -4,6 +4,7 @@ interface UpdateFeeForm {
feeCategoryId: string;
feeName: string;
feeDescription: string;
feeAccount: string;
occupancyTypeId: string;
lotTypeId: string;
feeAmount?: string;

View File

@ -6,6 +6,7 @@ export async function updateFee(feeForm, requestSession) {
set feeCategoryId = ?,
feeName = ?,
feeDescription = ?,
feeAccount = ?,
occupancyTypeId = ?,
lotTypeId = ?,
feeAmount = ?,
@ -19,7 +20,7 @@ export async function updateFee(feeForm, requestSession) {
recordUpdate_timeMillis = ?
where recordDelete_timeMillis is null
and feeId = ?`)
.run(feeForm.feeCategoryId, feeForm.feeName, feeForm.feeDescription, feeForm.occupancyTypeId === '' ? undefined : feeForm.occupancyTypeId, feeForm.lotTypeId === '' ? undefined : feeForm.lotTypeId, feeForm.feeAmount === undefined || feeForm.feeAmount === ''
.run(feeForm.feeCategoryId, feeForm.feeName, feeForm.feeDescription, feeForm.feeAccount, feeForm.occupancyTypeId === '' ? undefined : feeForm.occupancyTypeId, feeForm.lotTypeId === '' ? undefined : feeForm.lotTypeId, feeForm.feeAmount === undefined || feeForm.feeAmount === ''
? 0
: feeForm.feeAmount, feeForm.feeFunction ?? undefined, feeForm.taxAmount ?? undefined, feeForm.taxPercentage ?? undefined, feeForm.includeQuantity === '' ? 0 : 1, feeForm.quantityUnit, feeForm.isRequired === '' ? 0 : 1, requestSession.user.userName, Date.now(), feeForm.feeId);
database.release();

View File

@ -7,6 +7,7 @@ interface UpdateFeeForm {
feeCategoryId: string
feeName: string
feeDescription: string
feeAccount: string
occupancyTypeId: string
lotTypeId: string
feeAmount?: string
@ -30,6 +31,7 @@ export async function updateFee(
set feeCategoryId = ?,
feeName = ?,
feeDescription = ?,
feeAccount = ?,
occupancyTypeId = ?,
lotTypeId = ?,
feeAmount = ?,
@ -48,6 +50,7 @@ export async function updateFee(
feeForm.feeCategoryId,
feeForm.feeName,
feeForm.feeDescription,
feeForm.feeAccount,
feeForm.occupancyTypeId === '' ? undefined : feeForm.occupancyTypeId,
feeForm.lotTypeId === '' ? undefined : feeForm.lotTypeId,
feeForm.feeAmount === undefined || feeForm.feeAmount === ''

View File

@ -515,7 +515,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
}
cityssm.openHtmlModal('adminFees-editFee', {
onshow(modalElement) {
var _a, _b, _c;
var _a, _b, _c, _d, _e, _f;
editModalElement = modalElement;
modalElement.querySelector('#feeEdit--feeId').value = fee.feeId.toString();
const feeCategoryElement = modalElement.querySelector('#feeEdit--feeCategoryId');
@ -529,8 +529,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
feeCategoryElement.append(optionElement);
}
;
modalElement.querySelector('#feeEdit--feeName').value = fee.feeName;
modalElement.querySelector('#feeEdit--feeDescription').value = fee.feeDescription;
modalElement.querySelector('#feeEdit--feeName').value = (_a = fee.feeName) !== null && _a !== void 0 ? _a : '';
modalElement.querySelector('#feeEdit--feeAccount').value = (_b = fee.feeAccount) !== null && _b !== void 0 ? _b : '';
modalElement.querySelector('#feeEdit--feeDescription').value = (_c = fee.feeDescription) !== null && _c !== void 0 ? _c : '';
const occupancyTypeElement = modalElement.querySelector('#feeEdit--occupancyTypeId');
for (const occupancyType of exports.occupancyTypes) {
const optionElement = document.createElement('option');
@ -565,13 +566,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
taxPercentageElement.addEventListener('keyup', toggleTaxFields);
toggleTaxFields();
const includeQuantityElement = modalElement.querySelector('#feeEdit--includeQuantity');
if ((_a = fee.includeQuantity) !== null && _a !== void 0 ? _a : false) {
if ((_d = fee.includeQuantity) !== null && _d !== void 0 ? _d : false) {
includeQuantityElement.value = '1';
}
includeQuantityElement.addEventListener('change', toggleQuantityFields);
modalElement.querySelector('#feeEdit--quantityUnit').value = (_b = fee.quantityUnit) !== null && _b !== void 0 ? _b : '';
modalElement.querySelector('#feeEdit--quantityUnit').value = (_e = fee.quantityUnit) !== null && _e !== void 0 ? _e : '';
toggleQuantityFields();
if ((_c = fee.isRequired) !== null && _c !== void 0 ? _c : false) {
if ((_f = fee.isRequired) !== null && _f !== void 0 ? _f : false) {
;
modalElement.querySelector('#feeEdit--isRequired').value = '1';
}

View File

@ -781,12 +781,15 @@ declare const bulmaJS: BulmaJS
;(
modalElement.querySelector('#feeEdit--feeName') as HTMLInputElement
).value = fee.feeName!
).value = fee.feeName ?? ''
;(
modalElement.querySelector('#feeEdit--feeAccount') as HTMLInputElement
).value = fee.feeAccount ?? ''
;(
modalElement.querySelector(
'#feeEdit--feeDescription'
) as HTMLTextAreaElement
).value = fee.feeDescription!
).value = fee.feeDescription ?? ''
const occupancyTypeElement = modalElement.querySelector(
'#feeEdit--occupancyTypeId'

View File

@ -23,17 +23,34 @@
</div>
</div>
</div>
<div class="field">
<label class="label" for="feeAdd--feeName">Fee Name</label>
<div class="control">
<input
class="input"
id="feeAdd--feeName"
name="feeName"
maxlength="100"
autocomplete="off"
required
/>
<div class="columns">
<div class="column">
<div class="field">
<label class="label" for="feeAdd--feeName">Fee Name</label>
<div class="control">
<input
class="input"
id="feeAdd--feeName"
name="feeName"
maxlength="100"
autocomplete="off"
required
/>
</div>
</div>
</div>
<div class="column">
<div class="field">
<label class="label" for="feeAdd--feeAccount">Fee Account</label>
<div class="control">
<input
class="input"
id="feeAdd--feeAccount"
name="feeAccount"
maxlength="20"
/>
</div>
</div>
</div>
</div>
<div class="field">

View File

@ -24,17 +24,34 @@
</div>
</div>
</div>
<div class="field">
<label class="label" for="feeEdit--feeName">Fee Name</label>
<div class="control">
<input
class="input"
id="feeEdit--feeName"
name="feeName"
maxlength="100"
autocomplete="off"
required
/>
<div class="columns">
<div class="column">
<div class="field">
<label class="label" for="feeEdit--feeName">Fee Name</label>
<div class="control">
<input
class="input"
id="feeEdit--feeName"
name="feeName"
maxlength="100"
autocomplete="off"
required
/>
</div>
</div>
</div>
<div class="column">
<div class="field">
<label class="label" for="feeEdit--feeAccount">Fee Account</label>
<div class="control">
<input
class="input"
id="feeEdit--feeAccount"
name="feeAccount"
maxlength="20"
/>
</div>
</div>
</div>
</div>
<div class="field">

File diff suppressed because one or more lines are too long

View File

@ -118,6 +118,7 @@ export interface Fee extends Record {
feeCategory?: string;
feeName?: string;
feeDescription?: string;
feeAccount?: string;
occupancyTypeId?: number;
occupancyType?: string;
lotTypeId?: number;

View File

@ -154,6 +154,7 @@ export interface Fee extends Record {
feeName?: string
feeDescription?: string
feeAccount?: string
occupancyTypeId?: number
occupancyType?: string