mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 04:40:32 +00:00
feat(reports): inventory valuation report.
feat(reports): sales by items report. feat(reports): purchases by items report.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Model } from 'objection';
|
||||
import { Model, raw } from 'objection';
|
||||
import moment from 'moment';
|
||||
import TenantModel from 'models/TenantModel';
|
||||
|
||||
@@ -34,6 +34,22 @@ export default class InventoryTransaction extends TenantModel {
|
||||
query.where('date', '<=', toDate);
|
||||
}
|
||||
},
|
||||
|
||||
itemsTotals(builder) {
|
||||
builder.select('itemId');
|
||||
builder.sum('rate as rate');
|
||||
builder.sum('quantity as quantity');
|
||||
builder.select(raw('SUM(`QUANTITY` * `RATE`) as COST'));
|
||||
builder.groupBy('itemId');
|
||||
},
|
||||
|
||||
INDirection(builder) {
|
||||
builder.where('direction', 'IN');
|
||||
},
|
||||
|
||||
OUTDirection(builder) {
|
||||
builder.where('direction', 'OUT');
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user