AppliGeneralLedger.create_journal_entry
— Functioncreate_journal_entry(::String, ::String, ::String, ::Int64, ::Int64, ::Float64, ::Float64, ::Float64, ::String)::JournalEntry
It creates a general ledger `JournalEntry.`
.
Example
julia> entry = create_journal_entry("20200700", "APPLI", "A1001", 1300, 8000, 1000.0, 0.0, 210.0, "LS")
JournalEntry("20200700", 3, 2020-03-03T13:25:29.277, "APPLI", "A1001", 1300, 8000, 1000.0, 0.0, 210.0, "LS")
AppliGeneralLedger.process
— Functionprocess(entries::Array{JournalEntry, 1}, path_journal="./journal.txt", path_ledger="./ledger.txt", )
It adds a JournalEntry
to the file path_journal,
converts it into Record
's, and adds them to the file path_ledger.
@see also read_from_file
Example
julia> include("./src/infrastructure/infrastructure.jl")
process (generic function with 1 method)
julia> entry1 = create_journal_entry("20200700", "APPLI", "A1001", 1300, 8000, 1000.0, 0.0, 210.0, "LS")
JournalEntry("20200700", 3, 2020-03-03T13:31:07.953, "APPLI", "A1001", 1300, 8000, 1000.0, 0.0, 210.0, "LS")
julia> entry2 = create_journal_entry("20201500", "PRG", "A1002", 1300, 8000, 1000.0, 0.0, 210.0, "LS")
JournalEntry("20201500", 3, 2020-03-03T13:31:07.955, "PRG", "A1002", 1300, 8000, 1000.0, 0.0, 210.0, "LS")
julia> process([entry1, entry2])
AppliGeneralLedger.read_from_file
— Functionfunction read_from_file(path::String)::Array{Any, 1}
It reads (structured) data back from a file.
Example
julia> include("./src/infrastructure/infrastructure.jl")
process (generic function with 1 method)
julia> entry1 = create_journal_entry("20200700", "APPLI", "A1001", 1300, 8000, 1000.0, 0.0, 210.0, "LS")
JournalEntry("20200700", 3, 2020-03-03T13:32:46.7, "APPLI", "A1001", 1300, 8000, 1000.0, 0.0, 210.0, "LS")
julia> entry2 = create_journal_entry("20201500", "PRG", "A1002", 1300, 8000, 1000.0, 0.0, 210.0, "LS")
JournalEntry("20201500", 3, 2020-03-03T13:32:46.702, "PRG", "A1002", 1300, 8000, 1000.0, 0.0, 210.0, "LS")
julia> process([entry1, entry2])
julia> r = read_from_file("./test_journal.txt")
2-element Array{Any,1}:
JournalEntry("20200700", 3, 2020-03-03T13:32:46.7, "APPLI", "A1001", 1300, 8000, 1000.0, 0.0, 210.0, "LS")
JournalEntry("20201500", 3, 2020-03-03T13:32:46.702, "PRG", "A1002", 1300, 8000, 1000.0, 0.0, 210.0, "LS")
AppliGeneralLedger.add_to_file
— Functionadd_to_file(path::String, data::Array{T, 1} where T <: Any)
Adds an object to a file.
Example
julia> struct Person
name:: String
end
julia> donald = Person("Donald Duck")
Person("Donald Duck")
julia> add_to_file("./persons.txt", [donald])
julia> read_from_file("./persons.txt")
1-element Array{Any,1}:
Person("Donald Duck")
AppliGeneralLedger.create_account
— Functioncreate_account(::String, ::String, ::String)::Account
Example
julia> account = create_account("8000", "Sales", "")
Account("8000", "Sales", "")
AppliGeneralLedger.create_record_from
— Functioncreate_record_from(entry::JournalEntry)::Record
It creates a general ledger Record
from a JournalEntry.
@see also add_to_file
, read_from_file
Example
julia> entry = create_journal_entry("20200700", "APPLI", "A1001", 1300, 8000, 1000.0, 0.0, 210.0, "LS")
JournalEntry("20200700", 3, 2020-03-03T13:28:14.696, "APPLI", "A1001", 1300, 8000, 1000.0, 0.0, 210.0, "LS")
julia> record_from = create_record_from(entry)
Record("20200700", 1300, 2020-03-03T13:28:14.696, "APPLI", "A1001", 1210.0, 0.0, "LS")
julia> add_to_file("./test_ledger.txt", [record_from])
AppliGeneralLedger.create_record_to
— Functioncreate_record_to(::JournalEntry)::Record
It creates a general ledger Record
from a JournalEntry.
@see also add_to_file
Example
julia> entry = create_journal_entry("20200700", "APPLI", "A1001", 1300, 8000, 1000.0, 0.0, 210.0, "LS")
JournalEntry("20200700", 3, 2020-03-03T13:28:54.701, "APPLI", "A1001", 1300, 8000, 1000.0, 0.0, 210.0, "LS")
julia> record_to = create_record_to(entry)
Record("20200700", 8000, 2020-03-03T13:28:54.701, "APPLI", "A1001", 0.0, 1000.0, "LS")
julia> add_to_file("./test_ledger.txt", [record_to])
AppliGeneralLedger.create_record_vat
— Functioncreate_record_vat(::JournalEntry, ::Int)::Record
It creates a general ledger Record
from a JournalEntry.
@see also add_to_file
Example
julia> entry = create_journal_entry("20200700", "APPLI", "A1001", 1300, 8000, 1000.0, 0.0, 210.0, "LS")
JournalEntry("20200700", 3, 2020-03-03T13:29:41.847, "APPLI", "A1001", 1300, 8000, 1000.0, 0.0, 210.0, "LS")
julia> record_vat = create_record_vat(entry, 4000)
Record("20200700", 4000, 2020-03-03T13:29:41.847, "APPLI", "A1001", 0.0, 210.0, "LS")
julia> add_to_file("./test_ledger.txt", [record_vat])