import { GeneralService } from '../share/generalservice.js'

export class AccountingAddService {

  constructor() {
    this.generalService = new GeneralService()
  }

  async getAccountingAdd(database, number) {
    const sql = `
      SELECT 
        actseq,
        actnum
      FROM ${database}.actmst
      WHERE actnum = $1
    `

    const params = [number]
    const result = await this.generalService.executeQueryParam(database, sql, params);
    return result
  }

  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
  }
}