feat: add profit field to transactions
This commit is contained in:
parent
4339e58e6a
commit
64a4860df0
3 changed files with 15 additions and 10 deletions
|
|
@ -24,6 +24,13 @@ function addNames (txs) {
|
|||
})
|
||||
}
|
||||
|
||||
function addProfits (txs) {
|
||||
return _.map(it => {
|
||||
const profit = getProfit(it).toString()
|
||||
return _.set('profit', profit, it)
|
||||
}, txs)
|
||||
}
|
||||
|
||||
const camelize = _.mapKeys(_.camelCase)
|
||||
|
||||
function batch (
|
||||
|
|
@ -42,7 +49,7 @@ function batch (
|
|||
excludeTestingCustomers = false,
|
||||
simplified = false
|
||||
) {
|
||||
const packager = _.flow(_.flatten, _.orderBy(_.property('created'), ['desc']), _.map(camelize), addNames)
|
||||
const packager = _.flow(_.flatten, _.orderBy(_.property('created'), ['desc']), _.map(camelize), addProfits, addNames)
|
||||
|
||||
const cashInSql = `SELECT 'cashIn' AS tx_class, txs.*,
|
||||
c.phone AS customer_phone,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue