2025-11-18 10:12:52 +07:00
|
|
|
import { GeneralService } from '../share/generalservice.js'
|
|
|
|
|
|
|
|
|
|
export class AccountingAddService {
|
|
|
|
|
|
|
|
|
|
constructor() {
|
|
|
|
|
this.generalService = new GeneralService()
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-19 15:06:20 +07:00
|
|
|
async getAccountingAdd(database, number) {
|
2025-11-18 10:12:52 +07:00
|
|
|
const sql = `
|
|
|
|
|
SELECT
|
|
|
|
|
actseq,
|
2025-11-19 15:06:20 +07:00
|
|
|
actnum
|
2025-11-18 10:12:52 +07:00
|
|
|
FROM ${database}.actmst
|
2025-11-19 15:06:20 +07:00
|
|
|
WHERE actnum = $1
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
const params = [number]
|
|
|
|
|
const result = await this.generalService.executeQueryParam(database, sql, params);
|
|
|
|
|
return result
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-21 15:00:37 +07:00
|
|
|
// async getLatestAccountingSeq(database) {
|
|
|
|
|
// const sql = `
|
|
|
|
|
// SELECT
|
|
|
|
|
// actseq
|
|
|
|
|
// FROM ${database}.actmst
|
|
|
|
|
// WHERE actseq=(SELECT max(actseq) FROM ${database}.actmst)
|
|
|
|
|
// `
|
|
|
|
|
|
|
|
|
|
// const params = []
|
|
|
|
|
// const result = await this.generalService.executeQueryParam(database, sql, params);
|
|
|
|
|
// return result
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
async genNum(database) {
|
2025-11-19 15:06:20 +07:00
|
|
|
const sql = `
|
|
|
|
|
SELECT
|
2025-11-21 15:00:37 +07:00
|
|
|
MAX(actseq) as max_seq
|
2025-11-19 15:06:20 +07:00
|
|
|
FROM ${database}.actmst
|
|
|
|
|
`
|
|
|
|
|
const params = []
|
2025-11-21 15:00:37 +07:00
|
|
|
const aryResult = await this.generalService.executeQueryParam(database, sql, params);
|
|
|
|
|
|
|
|
|
|
const lastSeq = aryResult[0]?.max_seq || 0;
|
|
|
|
|
|
|
|
|
|
return lastSeq + 1;
|
2025-11-18 10:12:52 +07:00
|
|
|
}
|
|
|
|
|
}
|