Service - CommerceAccounting Purchase: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
| Line 60: | Line 60: | ||
// purchaseId, | // purchaseId, | ||
inputVatJournalId: { | inputVatJournalId: { | ||
type: "string", | |||
optionalOnCreate: true, | |||
canUpdate: true, | |||
storageResourceTags: ["dynamo"], | |||
}, | |||
lineItemJournalId: { | |||
type: "string", | type: "string", | ||
optionalOnCreate: true, | optionalOnCreate: true, | ||
| Line 96: | Line 102: | ||
// purchaseId, | // purchaseId, | ||
// purchaseLineItemId, | // purchaseLineItemId, | ||
// | // entryId // not sure want to record because multiple lineItems might be in the same entryId | ||
}, | }, | ||
identifiers: [ | identifiers: [ | ||
| Line 110: | Line 116: | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
* This table might not be needed becasue we do not create a journal entry per line item, we make a compound journal entry per purchase | |||
* Keep it for now so we can reconcile Commerce data matches ComAcc data | |||
== Relationships == | == Relationships == | ||
Revision as of 07:35, 6 May 2026
Overview
Handle links between purchases and Accounting records.
Repository
...
Object Schemas
- Additional Information
- Per Service Schemas
comAccPurchaseLink
{
objectType: "comAccPurchaseLink",
canDelete: false,
addOnDataStructure: [],
storageResources: {
"dynamo": {
"storageType": "dynamoDB",
"tableName": "comAccPurchaseLink",
}
},
fieldNames: {
// businessId,
// accountLinkTag // type of link: inputVAT|..
// accountId
},
identifiers: [
{
type: "partitionKey",
fieldName: "businessId",
},
{
type: "sortKey",
fieldName: "accountLinkTag"
},
]
}
- sets which Accounting accountId journal entries are added to
comAccPurchase
{
objectType: "comAccPurchase",
canDelete: false,
addOnDataStructure: [],
storageResources: {
"dynamo": {
"storageType": "dynamoDB",
"tableName": "comAccPurchase",
}
},
fieldNames: {
// businessId,
// purchaseId,
inputVatJournalId: {
type: "string",
optionalOnCreate: true,
canUpdate: true,
storageResourceTags: ["dynamo"],
},
lineItemJournalId: {
type: "string",
optionalOnCreate: true,
canUpdate: true,
storageResourceTags: ["dynamo"],
},
},
identifiers: [
{
type: "partitionKey",
fieldName: "businessId",
},
{
type: "sortKey",
fieldName: "purchaseId"
},
]
}
comAccPurchaseLineItem
{
objectType: "comAccPurchaseLineItem",
canDelete: false,
addOnDataStructure: [],
storageResources: {
"dynamo": {
"storageType": "dynamoDB",
"tableName": "comAccPurchaseLineItem",
}
},
fieldNames: {
// purchaseId,
// purchaseLineItemId,
// entryId // not sure want to record because multiple lineItems might be in the same entryId
},
identifiers: [
{
type: "partitionKey",
fieldName: "purchaseId"
},
{
type: "sortKey",
fieldName: "purchaseLineItemId"
},
]
}
- This table might not be needed becasue we do not create a journal entry per line item, we make a compound journal entry per purchase
- Keep it for now so we can reconcile Commerce data matches ComAcc data
Relationships
...
flowSchemas
createPurchase
- when creating a purchase, iterate purchaseLineItems to decide which journal entries are created
- accountsPayable accountId comes from Service - CommerceAccounting Vendor
- each purchaseLineItem checks it's type then finds accountId from coresponding comAcc service
Example request param from Commerce
{
belongToIdentifiers: {
businessId: "xxx"
},
purchaseId: "",
vendorId: "",
timestamp: 1111111,
purchaseCurrencyId: "",
inventoryLocationId: "", // required if have any inventory/?assets
purchaseLineItems: {
{purchaseLineItemId}: {
inventoryId: "",
inventoryTemplateId: "",
type: "", // inventory|expense|services|freight|salesTax|vatTax|other
subType: "", // inventory: goods|intangibleGoods|rawMaterial|asset|intangibleAsset, expense: pointInTime|overTime, services: pointInTime|overTime, freight: standard, order: standard
lineItemQuantity: 1,
lineItemUnitPrice: "2.00"
},
//...
}
}
updatePurchase
- make adjustment to journal entries when purchaseLineItemId changes
- handle removal of purchase/journal entries, or creation of new entries
- basically re-calculate all entries and check against existing
- each journalId must check Accounting that it's period/s are not locked, if locked return error, cannot make update