mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 13:50:31 +00:00
fix: inventory item detail bug.
This commit is contained in:
@@ -700,7 +700,7 @@ class CashFlowStatement extends FinancialSheet implements ICashFlowStatement {
|
|||||||
sections,
|
sections,
|
||||||
this.isAccountLeafNoneZero.bind(this),
|
this.isAccountLeafNoneZero.bind(this),
|
||||||
MAP_CONFIG
|
MAP_CONFIG
|
||||||
);
|
) || [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -713,7 +713,7 @@ class CashFlowStatement extends FinancialSheet implements ICashFlowStatement {
|
|||||||
sections,
|
sections,
|
||||||
this.isAccountsSectionHasChildren.bind(this),
|
this.isAccountsSectionHasChildren.bind(this),
|
||||||
MAP_CONFIG
|
MAP_CONFIG
|
||||||
);
|
) || [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -268,8 +268,11 @@ export default class InventoryDetails extends FinancialSheet {
|
|||||||
)[] {
|
)[] {
|
||||||
const transactions = this.getItemTransactions(item);
|
const transactions = this.getItemTransactions(item);
|
||||||
const openingValuation = this.getItemOpeingValuation(item);
|
const openingValuation = this.getItemOpeingValuation(item);
|
||||||
const closingValuation = this.getItemClosingValuation(item, transactions);
|
const closingValuation = this.getItemClosingValuation(
|
||||||
|
item,
|
||||||
|
transactions,
|
||||||
|
openingValuation
|
||||||
|
);
|
||||||
const hasTransactions = transactions.length > 0;
|
const hasTransactions = transactions.length > 0;
|
||||||
const isItemHasOpeningBalance = this.isItemHasOpeningBalance(item.id);
|
const isItemHasOpeningBalance = this.isItemHasOpeningBalance(item.id);
|
||||||
|
|
||||||
@@ -314,17 +317,21 @@ export default class InventoryDetails extends FinancialSheet {
|
|||||||
*/
|
*/
|
||||||
private getItemClosingValuation(
|
private getItemClosingValuation(
|
||||||
item: IItem,
|
item: IItem,
|
||||||
transactions: IInventoryDetailsItemTransaction[]
|
transactions: IInventoryDetailsItemTransaction[],
|
||||||
|
openingValuation: IInventoryDetailsOpening
|
||||||
): IInventoryDetailsOpening {
|
): IInventoryDetailsOpening {
|
||||||
const value = sumBy(transactions, 'valueMovement.number');
|
const value = sumBy(transactions, 'valueMovement.number');
|
||||||
const quantity = sumBy(transactions, 'quantityMovement.number');
|
const quantity = sumBy(transactions, 'quantityMovement.number');
|
||||||
const profitMargin = sumBy(transactions, 'profitMargin.number');
|
const profitMargin = sumBy(transactions, 'profitMargin.number');
|
||||||
|
|
||||||
|
const closingQuantity = quantity + openingValuation.quantity.number;
|
||||||
|
const closingValue = value + openingValuation.value.number;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
nodeType: INodeTypes.CLOSING_ENTRY,
|
nodeType: INodeTypes.CLOSING_ENTRY,
|
||||||
date: this.getDateMeta(this.query.toDate),
|
date: this.getDateMeta(this.query.toDate),
|
||||||
quantity: this.getTotalNumberMeta(quantity),
|
quantity: this.getTotalNumberMeta(closingQuantity),
|
||||||
value: this.getTotalNumberMeta(value),
|
value: this.getTotalNumberMeta(closingValue),
|
||||||
profitMargin: this.getTotalNumberMeta(profitMargin),
|
profitMargin: this.getTotalNumberMeta(profitMargin),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -385,7 +392,12 @@ export default class InventoryDetails extends FinancialSheet {
|
|||||||
* @returns {IInventoryDetailsItem[]}
|
* @returns {IInventoryDetailsItem[]}
|
||||||
*/
|
*/
|
||||||
private filterItemsNodes(items: IInventoryDetailsItem[]) {
|
private filterItemsNodes(items: IInventoryDetailsItem[]) {
|
||||||
return filterDeep(items, this.isFilterNode.bind(this), MAP_CONFIG);
|
const filtered = filterDeep(
|
||||||
|
items,
|
||||||
|
this.isFilterNode.bind(this),
|
||||||
|
MAP_CONFIG
|
||||||
|
);
|
||||||
|
return defaultTo(filtered, []);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user