Skip to content
Permalink
Browse files
Testing create ledger account
  • Loading branch information
Anh3h committed Nov 18, 2019
1 parent c09dd20 commit 6c57ddac6a089a8c79440fd8f19643eadbe77933
Showing 2 changed files with 97 additions and 0 deletions.
@@ -0,0 +1,55 @@
parentIdentifier,identifier,description,type,show
,1000,"Income",REVENUE,true
1000,1100,"Income from Loans",REVENUE,true
1000,1200,"Investment Income",REVENUE,true
1000,1300,"Fees and Charges",REVENUE,true
1000,1400,"Gain (Loss) on Sale of Loans",REVENUE,true
1000,1500,"Miscellaneous Income",REVENUE,true
1000,1600,"Service Income on Loans",REVENUE,true
1000,1700,"Trading Profits & Losses",REVENUE,true
,2000,"Expenses",EXPENSE,true
2000,2100,"Employee Compensation",EXPENSE,true
2000,2200,"Employee Benefits",EXPENSE,true
2000,2300,"Travel and Conference Expenses",EXPENSE,true
2000,2400,"Association Dues",EXPENSE,true
2000,2500,"Office Occupancy Expenses",EXPENSE,true
2000,2600,"Office Operations Expenses",EXPENSE,true
2000,2700,"Educational and Promotional Expenses",EXPENSE,true
2000,2800,"Loan Servicing Expenses",EXPENSE,true
2000,2900,"Professional and Outside Services",EXPENSE,true
2000,3000,"Provision for Loan Losses",EXPENSE,true
2000,3100,"Member Insurance",EXPENSE,true
2000,3220,"Federal Operating Fee",EXPENSE,true
2000,3300,"Cash Over and Short",EXPENSE,true
2000,3400,"Interest on Borrowed Money",EXPENSE,true
2000,3550,"Annual Meeting Expenses",EXPENSE,true
2000,3700,"Miscellaneous Operating Expenses",EXPENSE,true
2000,3800,"Interest (Dividend) Expense",EXPENSE,true
,7000,"Assets",ASSET,true
7000,7010,"Loans to Members",ASSET,true
7000,7020,"Lines of Credit to Members",ASSET,true
7000,7030,"Real Estate Loans",ASSET,true
7000,7100,"Other Loans",ASSET,true
7000,7200,"Other Receivables",ASSET,true
7000,7300,"Cash Accounts",ASSET,true
7300,7310,"Bank account one",ASSET,true
7300,7311,"Bank account two",ASSET,true
7300,7350,"Change Fund",ASSET,true
7000,7400,"Investments",ASSET,true
7400,7420,"Federal Agency Securities",ASSET,true
7000,7500,"Investments—Investment Allowance",ASSET,true
7000,7600,"Prepaid Expenses and Deferred Charges",ASSET,true
7000,7700,"Fixed Assets",ASSET,true
7000,7800,"Accrued Income",ASSET,true
7000,7900,"Other Assets",ASSET,true
,8000,"Accounts Payable",LIABILITY,true
8000,8100,"Accounts Payable",LIABILITY,true
8000,8200,"Interest Payable",LIABILITY,true
8000,8400,"Taxes Payable",LIABILITY,true
8000,8500,"Accrued Expenses",LIABILITY,true
,9000,"Equity",EQUITY,true
9000,9100,"Member Savings",EQUITY,true
9000,9300,"Reserves",EQUITY,true
9000,9400,"Undivided Earnings",EQUITY,true
9000,9550,"Donated Equity",EQUITY,true
9000,9560,"Net Income (Loss)",EQUITY,true
@@ -261,6 +261,48 @@ function set-application-permission-enabled-for-user {
echo "Enabled permission, $permission for service $service"
}

function create_chart_of_accounts {
local ledger_file="ledgers.csv"
local accounts_file="accounts.csv"
local tenant="$1"
local user="$2"

while IFS="," read -r parent_id id description ledger_type show; do
if [ parent_id = "" ]; then
create_ledger $tenant $user $id $description $ledger_type $show
else
echo "It's a child"
fi

done < "$ledger_file"
}

function create_ledger {
local tenant
local user
local id
local description
local ledger_type
local show

curl -H "Content-Type: application/json" -H "User: ${users}" -H "Authorization: ${ACCESS_TOKEN}" -H "X-Tenant-Identifier: $tenant" \
--data '{
"type": "'"$ledger_type"'",
"identifier": "'"$id"'",
"name": "'"$id"'",
"description": "'"$description"'",
"parentLedgerIdentifier": "",
"subLedgers": [],
"totalValue": 0,
"createdOn": "",
"createdBy": "",
"lastModifiedOn": "",
"lastModifiedBy": "",
"showAccountsInChart": '$show'
}' \
${ACCOUNTING_URL}/ledgers
}

init-variables
auto-seshat
create-application "$IDENTITY_MS_NAME" "" "$MS_VENDOR" "$IDENTITY_URL"

0 comments on commit 6c57dda

Please sign in to comment.