-
Notifications
You must be signed in to change notification settings - Fork 14
/
11-add-accounts-to-chart-of-accounts.sql
68 lines (49 loc) · 1.63 KB
/
11-add-accounts-to-chart-of-accounts.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*
---------------------------------
Add Accounts to Chart of Accounts
---------------------------------
In this snippet we add Accounts to a Chart of Accounts.
For more details on LUSID providers, see this page:
https://support.lusid.com/knowledgebase/category/?id=CAT-01099
Prerequisite setup steps:
1. Setup a Chart of Accounts with the scope/code referenced below
*/
-- Step 1: Define some accounts
@@scope = select 'luminesce-examples';
@@code = select 'standardChartOfAccounts';
@accounts = values
-- Investments
('A0001-Investments', 'Asset'),
-- Cash, commitments
('A0002-Settled-Cash', 'Asset'),
-- Sales and purchases for settlement
('A0003-Sales-To-Settle', 'Asset'),
('A0004-Purchases-To-Settle', 'Asset'),
('A0005-Long-FX-To-Settle', 'Asset'),
('A0006-Short-FX-To-Settle', 'Asset'),
--Capital
('A0007-Capital', 'Capital'),
-- Gains and Losses
('A0008-Realised-Market-Gains', 'Income'),
('A0009-Realised-Fx-Gains', 'Income'),
('A0010-UnrealisedGains', 'Income'),
-- Subs, reds and accruals
('A0011-Accruals', 'Income'),
('A0012-Subscriptions', 'Asset'),
('A0013-Redemptions', 'Asset'),
-- Unknown catch alls
('A0101-Unknown-NA', 'Asset'),
('A0102-Unknown-PL', 'Revenue'),
('A0103-Unknown-CA', 'Capital');
@chartsOfAccountsAccounts = select
@@scope as ChartOfAccountsScope,
@@code as ChartOfAccountsCode,
column1 as AccountCode,
column1 as Description,
column2 as Type,
'Manual' as Control,
'Active' as Status
from @accounts;
-- Step 2: Assign Accounts onto a ChartOfAccount
select * from Lusid.ChartOfAccounts.Account.Writer
where ToWrite = @chartsOfAccountsAccounts;