Excel desktop POC: direct SQL via VBA, safe mode launcher

- GLAccountsExcelApi.bas: RefreshGLApi reads Setup!B6:B9 directly,
  calls PostgreSQL via ADODB without sheet.Evaluate or live UDF formulas
- Connection string pointed to vps107.geneva.hosting / postgres
- GL_Accounts_Client_Template.xlsx: fixed formula text cell refs (B6 not B7)
- Ouvrir_Excel_SafeMode.bat: launches Excel /safe with template to bypass
  print spooler freeze (splwow64 deadlock on edit mode entry)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-29 01:13:04 +02:00
parent 3c4261ccf6
commit 242406588c
5 changed files with 246 additions and 35 deletions

View File

@@ -7,6 +7,8 @@
-- - GetAccountAbbr
-- - GetAccountName
-- - GetAccountContact
-- - GetAccountContactCode
-- - GetAccountContactName
--
-- Design notes:
-- - PostgreSQL lowercases function names; VBA calls these SQL functions.
@@ -233,3 +235,43 @@ as $$
and gl.posting_status = 'posted'
and coalesce(gl.party_code, gl.party_name) is not null
$$;
create or replace function excel_api.get_account_contact_code(
p_company_key text,
p_account_code text,
p_currency_iso text,
p_value_date date)
returns text
language sql
stable
as $$
select nullif(string_agg(distinct coalesce(gl.party_code, gl.party_name),
', ' order by coalesce(gl.party_code, gl.party_name)), '')
from excel_api.gl_account_lines gl
where excel_api.company_matches(gl.company_key, p_company_key)
and gl.account_code = p_account_code
and excel_api.currency_matches(gl.transaction_currency_id, p_currency_iso)
and gl.posting_date <= p_value_date
and gl.posting_status = 'posted'
and coalesce(gl.party_code, gl.party_name) is not null
$$;
create or replace function excel_api.get_account_contact_name(
p_company_key text,
p_account_code text,
p_currency_iso text,
p_value_date date)
returns text
language sql
stable
as $$
select nullif(string_agg(distinct coalesce(gl.party_name, gl.party_code),
', ' order by coalesce(gl.party_name, gl.party_code)), '')
from excel_api.gl_account_lines gl
where excel_api.company_matches(gl.company_key, p_company_key)
and gl.account_code = p_account_code
and excel_api.currency_matches(gl.transaction_currency_id, p_currency_iso)
and gl.posting_date <= p_value_date
and gl.posting_status = 'posted'
and coalesce(gl.party_name, gl.party_code) is not null
$$;