Service - CommerceAccounting Sale: Difference between revisions

From Izara Wiki
Jump to navigation Jump to search
Mint (talk | contribs)
Line 86: Line 86:
"storageType": "dynamoDB",
"storageType": "dynamoDB",
"tableName": "comAccSaleLink",
"tableName": "comAccSaleLink",
}
},
        "myGraph": {
            "storageType": "graph",
            "graphServerTag": "GraphHandler"
        }
     },
     },
     fieldNames: {
     fieldNames: {

Revision as of 03:36, 10 August 2026

Overview

Handle sales in one service because some Accounting entries include the full amount, some break up according to saleLineItems.

Repository

...

Object Schemas

Additional Information
Per Service Schemas

comAccSaleLink

{
	objectType: "comAccSaleLink",
    generatedBy: "userGenerated",
	canDelete: false,
	belongTo: {
		serviceTag: "CommerceAccountingLink",
		objectType: "comAccLinkByBusiness"
	},
	addOnDataStructure: [],
	storageResources: {
        "myGraph":{
          "storageType": "graph",
          "graphServerTag": "GraphHandler"
        },
		"dynamo": {
			"storageType": "dynamoDB",
			"tableName": "comAccSaleLink",
		}
    },
    fieldNames: {
		businessId:{
			fromObjType:{
			  serviceTag: "CommerceAccountingLink",
			  objectType: "comAccLinkByBusiness" 
			},
        },
		organizationId: {
			fromObjType:{
			  serviceTag: "CommerceAccountingLink",
			  objectType: "comAccLinkByOrganization" 
			},
		},
        accountLinkTag:{   // type of link: ..
            type: "string",
			requriedOnCreate: true,
			storageResourceTags: ['myGraph', 'dynamo']
        }		
        accountId:{
            type: "string",
			requriedOnCreate: true,
			storageResourceTags: ['myGraph', 'dynamo']
        }
    },
    identifiers: [
		{
			type: "partitionKey",
			fieldNames: ["businessId", "organizationId"],
			name: "comAccLinkId",
		},
		{
			type: "sortKey",
			fieldName: "accountLinkTag"
		},
    ]
}
  • sets which Accounting accountId journal entries are added to
{
	objectType: "comAccSale",
    generatedBy: "systemGenerated",
	canDelete: false,
	belongTo: {
		serviceTag: "CommerceAccountingLink",
		objectType: "comAccLinkByBusiness"
	},
	addOnDataStructure: [],
	storageResources: {
		"dynamo": {
			"storageType": "dynamoDB",
			"tableName": "comAccSaleLink",
		},
        "myGraph": {
            "storageType": "graph",
            "graphServerTag": "GraphHandler"
        }
    },
    fieldNames: {
		// businessId,
		// organizationId,
		// saleId,

		// record lock eg: prefix: "updateSale"
		// updateSale_status: {requiredOnCreate: true}, // open|lock, 
		// updateSale_uniqueRequestId: {requiredOnCreate: true},
		// updateSale_timestamp: {requiredOnCreate: true},

		saleValueJournalId: {
			type: "string",
			optionalOnCreate: true,
			canUpdate: true,
			storageResourceTags: ["dynamo"],
		},
		inventoryAdjustJournalId: {
			type: "string",
			optionalOnCreate: true,
			canUpdate: true,
			storageResourceTags: ["dynamo"],
		},
    },
    identifiers: [
		{
			type: "partitionKey",
			fieldNames: ["businessId", "organizationId"],
			name: "comAccLinkId",
		},
		{
			type: "sortKey",
			fieldName: "saleId"
		},
    ]
}
  • one saleId links to two journalIds, sale value and inventory adjustment entries
  • maintains a link between saleId and journalIds, so can adjust if changes made to sale

Relationships

...

flowSchemas

saleCommitted

Sale Value

  • the total sale value has journal entry for all the below:
    1. (debit)accountsReceivable(Asset)
  • The other side (credit) is broken up depending on goods/service or assets
  • For goods value an entry is entered into the below
    1. (credit)goodsSale/serviceSale(Revenue)
  • Assets have:
    1. (credit)inventoryAsset(Asset)
    2. (debit)accumulatedDepreciation(Asset)
    3. (debit or credit)creditGainOnSale(Renenue)/debitLossOnSale(Expense)
  • Intangible Assets have:
    1. (credit)inventoryIntangibleAsset(Asset)
    2. (debit)accumulatedAmortization(Asset)
    3. (debit or credit)creditGainOnSale(Renenue)/debitLossOnSale(Expense)
  • all credit side may have:
    1. (credit)salesTaxPayable(Liability)
    2. (credit)vatPayable(liability)

Goods Sold

  • the total saleLineItem value for Inventory Goods has a journal entry for:
    1. (debit)cogsGoods(Expense)
    2. (credit)inventoryGoods(Asset)

Raw Material Sold

  • the total saleLineItem value for Inventory Raw Materials has a journal entry for:
    1. (debit)cogsRawMaterial(Expense)
    2. (credit)inventoryRawMaterial(Asset)

Assets Sold

  • might not have accumulatedDepreciation applied yet
  • if sold for same amount as original value then not have creditGainOnSale/debitLossOnSale
  • will need to query Accounting Assets service for depreciation amount
  • may need to query ComAcc Inventory service to find link between Commerce Asset and Accounting Asset, so can find depreciation

Services Sold

  • no additional entries required

Intangible Goods Sold

  • no additional entries required
  • entries same as physical Goods

Intangible Assets

  • same as an Asset, except use the term Amortization instead of Depreciation, which are functionally the same

saleChange

  • make adjustment to journal entries when saleLineItemId changes
  • perhaps handling removal of sale/journal entries, or creation of new entries
  • basically re-calculate all entries and check against existing

Working documents

CommerceAccounting Sale