UNPKG

@cityssm/dynamics-gp

Version:

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

24 lines (19 loc) 817 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>(`SELECT DOCTYPE as invoiceDocumentType, rtrim(DOCTYABR) as documentTypeAbbreviation, rtrim(DOCTYNAM) as documentTypeName FROM IVC40101 order by DEX_ROW_ID`) return result.recordset }