UNPKG

@cityssm/dynamics-gp

Version:

Read only inquiries into Microsoft Dynamics GP using a SQL Server connection.

28 lines (23 loc) 848 B
import { type mssql, connect } from '@cityssm/mssql-multi-pool' import type { GPInvoiceDocumentType } from './types.js' /** * Retrieves the invoice document types from the GP database. * @param mssqlConfig - The configuration for the SQL Server connection. * @returns A promise that resolves to an array of GPInvoiceDocumentType objects. */ export default async function _getInvoiceDocumentTypes( mssqlConfig: mssql.config ): Promise<GPInvoiceDocumentType[]> { const pool = await connect(mssqlConfig) const result = await pool.request().query<GPInvoiceDocumentType>(/* sql */ ` SELECT DOCTYPE AS invoiceDocumentType, rtrim(DOCTYABR) AS documentTypeAbbreviation, rtrim(DOCTYNAM) AS documentTypeName FROM IVC40101 ORDER BY DEX_ROW_ID `) return result.recordset }