Service - CommerceAccounting Purchase: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
= Overview = | = Overview = | ||
Handle purchases | Handle links between purchases and Accounting records. | ||
= Repository = | = Repository = | ||
| Line 9: | Line 9: | ||
= Object Schemas = | = Object Schemas = | ||
; Additional Information: [[Per Service Schemas]] | ; Additional Information: [[Per Service Schemas]] | ||
== comAccPurchaseLink == | |||
<syntaxhighlight lang="JavaScript"> | <syntaxhighlight lang="JavaScript"> | ||
| Line 16: | Line 18: | ||
belongTo: { | belongTo: { | ||
serviceTag: "ComAccLink", | serviceTag: "ComAccLink", | ||
objectType: " | objectType: "comAccLinkByBusiness" | ||
}, | }, | ||
addOnDataStructure: [], | addOnDataStructure: [], | ||
| Line 26: | Line 28: | ||
}, | }, | ||
fieldNames: { | fieldNames: { | ||
// | // businessId, | ||
// accountLinkTag // type of link: inputVAT|.. | |||
// accountId | |||
}, | }, | ||
identifiers: [ | identifiers: [ | ||
{ | { | ||
/ | type: "partitionKey", | ||
fieldName: "businessId", | |||
}, | |||
{ | |||
type: "sortKey", | |||
fieldName: "accountLinkTag" | |||
}, | |||
] | |||
} | |||
</syntaxhighlight> | |||
* sets which Accounting accountId journal entries are added to | |||
== comAccPurchase == | |||
<syntaxhighlight lang="JavaScript"> | |||
{ | |||
objectType: "comAccPurchase", | |||
canDelete: false, | |||
belongTo: { | |||
serviceTag: "ComAccLink", | |||
objectType: "comAccLinkByBusiness" | |||
}, | |||
addOnDataStructure: [], | |||
storageResources: { | |||
"dynamo": { | |||
"storageType": "dynamoDB", | |||
"tableName": "comAccPurchase", | |||
} | } | ||
}, | |||
fieldNames: { | |||
// businessId, | |||
// purchaseId, | |||
inputVatJournalId: { | |||
type: "string", | |||
optionalOnCreate: true, | |||
canUpdate: true, | |||
storageResourceTags: ["dynamo"], | |||
}, | |||
}, | |||
identifiers: [ | |||
{ | |||
type: "partitionKey", | |||
fieldName: "businessId", | |||
}, | |||
{ | |||
type: "sortKey", | |||
fieldName: "purchaseId" | |||
}, | |||
] | ] | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== comAccPurchaseLineItem == | |||
<syntaxhighlight lang="JavaScript"> | |||
{ | |||
objectType: "comAccPurchaseLineItem", | |||
canDelete: false, | |||
belongTo: { | |||
serviceTag: "ComAccLink", | |||
objectType: "comAccLinkByBusiness" | |||
}, | |||
addOnDataStructure: [], | |||
storageResources: { | |||
"dynamo": { | |||
"storageType": "dynamoDB", | |||
"tableName": "comAccPurchaseLineItem", | |||
} | |||
}, | |||
fieldNames: { | |||
// purchaseId, | |||
// purchaseLineItemId, | |||
// journalId | |||
}, | |||
identifiers: [ | |||
{ | |||
type: "partitionKey", | |||
fieldName: "purchaseId" | |||
}, | |||
{ | |||
type: "sortKey", | |||
fieldName: "purchaseLineItemId" | |||
}, | |||
] | |||
} | |||
</syntaxhighlight> | |||
== Relationships == | == Relationships == | ||
| Line 46: | Line 129: | ||
= flowSchemas = | = flowSchemas = | ||
== | == createPurchase == | ||
* when creating a purchase, iterate purchaseLineItems to decide which journal entries are created | * when creating a purchase, iterate purchaseLineItems to decide which journal entries are created | ||
* accountsPayable accountId | * 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 === | ||
<syntaxhighlight lang="JavaScript"> | |||
{ | |||
belongToIdentifiers: { | |||
businessId: "xxx" | |||
}, | |||
purchaseId: "", | |||
vendorId: "", | |||
purchaseCurrencyId: "", | |||
purchaseLineItems: { | |||
{purchaseLineItemId}: { | |||
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" | |||
}, | |||
//... | |||
} | |||
} | |||
</syntaxhighlight> | |||
== purchaseChange == | == purchaseChange == | ||
* make adjustment to journal entries when purchaseLineItemId changes | * 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 | * basically re-calculate all entries and check against existing | ||
Revision as of 13:43, 16 April 2026
Overview
Handle links between purchases and Accounting records.
Repository
...
Object Schemas
- Additional Information
- Per Service Schemas
comAccPurchaseLink
{
objectType: "comAccPurchaseLink",
canDelete: false,
belongTo: {
serviceTag: "ComAccLink",
objectType: "comAccLinkByBusiness"
},
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,
belongTo: {
serviceTag: "ComAccLink",
objectType: "comAccLinkByBusiness"
},
addOnDataStructure: [],
storageResources: {
"dynamo": {
"storageType": "dynamoDB",
"tableName": "comAccPurchase",
}
},
fieldNames: {
// businessId,
// purchaseId,
inputVatJournalId: {
type: "string",
optionalOnCreate: true,
canUpdate: true,
storageResourceTags: ["dynamo"],
},
},
identifiers: [
{
type: "partitionKey",
fieldName: "businessId",
},
{
type: "sortKey",
fieldName: "purchaseId"
},
]
}
comAccPurchaseLineItem
{
objectType: "comAccPurchaseLineItem",
canDelete: false,
belongTo: {
serviceTag: "ComAccLink",
objectType: "comAccLinkByBusiness"
},
addOnDataStructure: [],
storageResources: {
"dynamo": {
"storageType": "dynamoDB",
"tableName": "comAccPurchaseLineItem",
}
},
fieldNames: {
// purchaseId,
// purchaseLineItemId,
// journalId
},
identifiers: [
{
type: "partitionKey",
fieldName: "purchaseId"
},
{
type: "sortKey",
fieldName: "purchaseLineItemId"
},
]
}
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: "",
purchaseCurrencyId: "",
purchaseLineItems: {
{purchaseLineItemId}: {
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"
},
//...
}
}
purchaseChange
- 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