Service - CommerceAccounting Purchase
Overview
Handle purchases in one service, becuase some Accounting entries include the full amount, some break up according to purchaseLineItems.
Repository
...
Object Schemas
- Additional Information
- Per Service Schemas
{
objectType: "comAccPurchaseLink",
canDelete: false,
belongTo: {
serviceTag: "ComAccLink",
objectType: "comAccLink"
},
addOnDataStructure: [],
storageResources: {
"dynamo": {
"storageType": "dynamoDB",
"tableName": "comAccPurchaseLink",
}
},
fieldNames: {
// probably have two dynamo tables, one identified by purchaseId, one by journalId
},
identifiers: [
{
// see above note
}
]
}
- one purchaseId may link to multiple journalIds, purchase value and inventory adjustment entries
- maintains a link between purchaseId and journalIds, so can adjust if changes made to purchase
Relationships
...
flowSchemas
purchaseCreated
- when creating a purchase, iterate purchaseLineItems to decide which journal entries are created
- accountsPayable accountId will need to come from Service - CommerceAccounting Vendor
Purchase Value
- the total purchase value has journal entry for all the below:
- (credit)accountsPayable(Liability)
- The other side (debit) is broken up depending on lineItem type
- For expenses value an entry is entered into the below
- Maybe classify expenses and have different accounts depending on classification
- (debit)expense(Expense)
- Goods:
- (debit)inventory(Asset)
- Intangible Goods:
- (debit)expense(Expense)
- Services:
- (debit)expense(Expense)
- Assets:
- (debit)inventoryAsset(Asset)
- Intangible Assets have:
- (debit)inventoryIntangibleAsset(Asset)
- all debit side may have:
- (debit)vatReceivable(Asset)
purchaseChange
- make adjustment to journal entries when purchaseLineItemId changes
- perhaps handling removal of purchase/journal entries, or creation of new entries
- basically re-calculate all entries and check against existing