mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 04:10:32 +00:00
feat: sale invoice model tax attributes
This commit is contained in:
@@ -471,6 +471,15 @@ const castCommaListEnvVarToArray = (envVar: string): Array<string> => {
|
||||
return envVar ? envVar?.split(',')?.map(_.trim) : [];
|
||||
};
|
||||
|
||||
export const sortObjectKeysAlphabetically = (object) => {
|
||||
return Object.keys(object)
|
||||
.sort()
|
||||
.reduce((objEntries, key) => {
|
||||
objEntries[key] = object[key];
|
||||
return objEntries;
|
||||
}, {});
|
||||
};
|
||||
|
||||
export {
|
||||
templateRender,
|
||||
accumSum,
|
||||
@@ -503,5 +512,5 @@ export {
|
||||
mergeObjectsBykey,
|
||||
nestedArrayToFlatten,
|
||||
assocDepthLevelToObjectTree,
|
||||
castCommaListEnvVarToArray
|
||||
castCommaListEnvVarToArray,
|
||||
};
|
||||
|
||||
19
packages/server/src/utils/taxRate.ts
Normal file
19
packages/server/src/utils/taxRate.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Get inclusive tax amount.
|
||||
* @param {number} amount
|
||||
* @param {number} taxRate
|
||||
* @returns {number}
|
||||
*/
|
||||
export const getInclusiveTaxAmount = (amount: number, taxRate: number) => {
|
||||
return (amount * taxRate) / (100 + taxRate);
|
||||
};
|
||||
|
||||
/**
|
||||
* Get exclusive tax amount.
|
||||
* @param {number} amount
|
||||
* @param {number} taxRate
|
||||
* @returns {number}
|
||||
*/
|
||||
export const getExlusiveTaxAmount = (amount: number, taxRate: number) => {
|
||||
return (amount * taxRate) / 100;
|
||||
};
|
||||
Reference in New Issue
Block a user