fix: cashout detection on cash cassette wizard
fix: cashbox wizard onContinue data fix: cashbox batch creation query feat: cashbox batch creation flow on UI
This commit is contained in:
parent
e05e44f468
commit
482e1afc3a
5 changed files with 45 additions and 11 deletions
|
|
@ -1,8 +1,10 @@
|
|||
const db = require('./db')
|
||||
const _ = require('lodash/fp')
|
||||
const uuid = require('uuid')
|
||||
|
||||
function createCashboxBatch (rec) {
|
||||
const sql = 'INSERT INTO cashbox_batches (device_id, created) VALUES ($1, now()) RETURNING *'
|
||||
function createCashboxBatch (deviceId) {
|
||||
console.log('herererere')
|
||||
const sql = `INSERT INTO cashbox_batches (id, device_id, created, operation_type) VALUES ($1, $2, now(), 'cash-in-empty') RETURNING *`
|
||||
const sql2 = `
|
||||
UPDATE bills SET cashbox_batch_id=$1
|
||||
FROM cash_in_txs
|
||||
|
|
@ -11,7 +13,7 @@ function createCashboxBatch (rec) {
|
|||
bills.cashbox_batch_id IS NULL
|
||||
`
|
||||
return db.tx(async t => {
|
||||
const newBatch = await t.oneOrNone(sql, [rec.deviceId])
|
||||
const newBatch = await t.oneOrNone(sql, [uuid.v4(), deviceId])
|
||||
return t.oneOrNone(sql2, [newBatch.id, newBatch.device_id])
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue