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

export class AccountingSearchService {

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

  async getAccountingSearch(database, id, username) {
    const sql = `
      SELECT 
        actseq,
        actnum,
        acttyp,
        ${database}.translatedtl('ACTTYP', acttyp) as acttypnam,
        ${database}.translatedtl_multi(ARRAY['ACTCAT_INC', 'ACTCAT_EXP'], actcat) as actcatnam,
        actqty,
        actcmt,
        actacpdtm
      FROM ${database}.actmst
      WHERE actnum = $1
      `
    const params = [id]
    const result = await this.generalService.executeQueryParam(database, sql, params);
    return result
  }
}