Add numeric accounts as property to lib, redistribute floating point errors for each account in overhead allocation

This commit is contained in:
Piv
2023-03-09 22:28:05 +10:30
parent 5603ccfd25
commit 568a66c6cf
4 changed files with 35 additions and 5 deletions

View File

@@ -13,6 +13,8 @@ struct MoveMoney: View {
@State private var document: CsvDocument?
@State private var lines: String?
@State private var rules: String?
@State private var costCentres: String?
@State private var accounts: String?
var body: some View {
VStack {
FileButtonSelector(label: "Select Rules File") { result in
@@ -21,6 +23,12 @@ struct MoveMoney: View {
FileButtonSelector(label: "Select Lines File") { result in
lines = result
}
FileButtonSelector(label: "Select Cost Centres File") { result in
costCentres = result
}
FileButtonSelector(label: "Select Accounts File") { result in
accounts = result
}
Button {
move_money()
} label: {
@@ -43,7 +51,7 @@ struct MoveMoney: View {
func move_money() {
DispatchQueue.global(qos: .userInitiated).async {
// Run move money
let result = move_money_from_text(rules, lines, true)
let result = move_money_from_text(rules, lines, accounts, costCentres, false)
DispatchQueue.main.async {
document = CsvDocument(data: String(cString: result!))

View File

@@ -55,7 +55,7 @@ struct OverheadAllocation: View {
func allocate_overheads() {
DispatchQueue.global(qos: .userInitiated).async {
// Run move money
let result = allocate_overheads_from_text(lines, accounts, allocationStatistics, areas, costCentres, accountType);
let result = allocate_overheads_from_text(lines, accounts, allocationStatistics, areas, costCentres, accountType, false);
DispatchQueue.main.async {
document = CsvDocument(data: String(cString: result!))