-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ability to add multiple fees as a group
alter table FeeCategories add isGroupedFee bit not null default 0
- Loading branch information
Showing
42 changed files
with
687 additions
and
231 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export interface AddFeeCategoryForm { | ||
feeCategory: string; | ||
isGroupedFee?: '1'; | ||
orderNumber?: number; | ||
} | ||
export default function addFeeCategory(feeCategoryForm: AddFeeCategoryForm, user: User): Promise<number>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { acquireConnection } from './pool.js'; | ||
export default async function addFeeCategory(feeCategoryForm, user) { | ||
const database = await acquireConnection(); | ||
const rightNowMillis = Date.now(); | ||
const result = database | ||
.prepare(`insert into FeeCategories ( | ||
feeCategory, | ||
isGroupedFee, orderNumber, | ||
recordCreate_userName, recordCreate_timeMillis, | ||
recordUpdate_userName, recordUpdate_timeMillis) | ||
values (?, ?, ?, ?, ?, ?, ?)`) | ||
.run(feeCategoryForm.feeCategory, (feeCategoryForm.isGroupedFee ?? '') === '1' ? 1 : 0, feeCategoryForm.orderNumber ?? -1, user.userName, rightNowMillis, user.userName, rightNowMillis); | ||
database.release(); | ||
return result.lastInsertRowid; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { acquireConnection } from './pool.js' | ||
|
||
export interface AddFeeCategoryForm { | ||
feeCategory: string | ||
isGroupedFee?: '1' | ||
orderNumber?: number | ||
} | ||
|
||
export default async function addFeeCategory( | ||
feeCategoryForm: AddFeeCategoryForm, | ||
user: User | ||
): Promise<number> { | ||
const database = await acquireConnection() | ||
|
||
const rightNowMillis = Date.now() | ||
|
||
const result = database | ||
.prepare( | ||
`insert into FeeCategories ( | ||
feeCategory, | ||
isGroupedFee, orderNumber, | ||
recordCreate_userName, recordCreate_timeMillis, | ||
recordUpdate_userName, recordUpdate_timeMillis) | ||
values (?, ?, ?, ?, ?, ?, ?)` | ||
) | ||
.run( | ||
feeCategoryForm.feeCategory, | ||
(feeCategoryForm.isGroupedFee ?? '') === '1' ? 1 : 0, | ||
feeCategoryForm.orderNumber ?? -1, | ||
user.userName, | ||
rightNowMillis, | ||
user.userName, | ||
rightNowMillis | ||
) | ||
|
||
database.release() | ||
|
||
return result.lastInsertRowid as number | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
import { type PoolConnection } from 'better-sqlite-pool'; | ||
export interface AddLotOccupancyFeeForm { | ||
lotOccupancyId: number | string; | ||
feeId: number | string; | ||
quantity: number | string; | ||
feeAmount?: number | string; | ||
taxAmount?: number | string; | ||
} | ||
export default function addLotOccupancyFee(lotOccupancyFeeForm: AddLotOccupancyFeeForm, user: User): Promise<boolean>; | ||
export default function addLotOccupancyFee(lotOccupancyFeeForm: AddLotOccupancyFeeForm, user: User, connectedDatabase?: PoolConnection): Promise<boolean>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.