mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 06:40:31 +00:00
feat(server): wip tax rate on sale invoice service
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import { ItemEntry } from "@/models";
|
||||
import { sumBy } from "lodash";
|
||||
import { Service } from "typedi";
|
||||
|
||||
|
||||
@Service()
|
||||
export class ItemEntriesTaxTransactions {
|
||||
/**
|
||||
*
|
||||
* @param model
|
||||
* @returns
|
||||
*/
|
||||
public assocTaxAmountWithheldFromEntries(model: any) {
|
||||
const entries = model.entries.map((entry) => ItemEntry.fromJson(entry));
|
||||
const taxAmountWithheld = sumBy(entries, 'taxAmount');
|
||||
|
||||
if (taxAmountWithheld) {
|
||||
model.taxAmountWithheld = taxAmountWithheld;
|
||||
}
|
||||
return model;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user