Iβm working on an accounting program, and I want to be able to have a function or macro that adds new account values to my dataframe, or another form that works as a CSV, XLSX or Database.
Accounts = Dict(
# A Dictionary of all my accounts
## List of Accounts and Starting Balance
# Chequing
"Chequing" => [0], #replace with balance as of Jan 1, 2019
#Assets
"Accounts Reciveable" => [0], #replace with balance as of Jan 1, 2019
#Debts
"Accounts Payable" =>[0])
spreadsheet = DataFrame(
Date=["Jan 1, 2000"], #start of the new year
chequing=[0],
accounts_reciveable=Accounts["Accounts Reciveable"],
#Debts
#Debts--Credit when owed payment, Debit when recive payment
accounts_payable= Accounts["Accounts Payable"])
macro transaction(
Journal_Entry,
newdate,
newdebit,
debit_amount,
newcredit,
credit_amount,
new_memo)
ex=quote
if $credit_amount != $debit_amount
"Error--Debit and Credit must match"
else
push!(spreadsheet,(defaultRow...,
Accounts["Chequing"]=
0,
Accounts["Wages"] = $debit_amount,
Accounts["Personal"]= $credit_amount,
Date=$newdate,
memo=$new_memo
))
#figure out how to delete this row, and get around repeat variables
# I might have to save each transaction to the spreadsheet, at this stage
end
if $credit_amount == $debit_amount
$Journal_Entry=DataFrame(
EntryDate=[$newdate,"","",""],
Credited_Accounts=["", $newcredit,"",""],
Debited_Accounts=["","",$newdebit,""],
Credit=[0,$credit_amount,0,0],
Debit=[0,0,$debit_amount,0],
Balance=[0,0,0,0])
end
end
esc(ex)
end
@transaction(JE3,"Jan 1, 2019", "Wages", 1000, "Chequing", 1000,"this is a test")
How do I get this to work?