salix/print/templates/reports/scan-expedition-pallet-label/scan-expedition-pallet-labe...

41 lines
1.0 KiB
JavaScript
Executable File

const UserError = require('vn-loopback/util/user-error');
const moment = require('moment');
module.exports = {
name: 'scan-expedition-pallet-label',
async serverPrefetch() {
this.date = Date.vnNew();
this.buys = await this.rawSqlFromDef('buy', [this.copies || 1, this.id]);
if (!this.buys.length) throw new UserError(`Empty data source`);
this.qr = await this.getQr(this.buys[0].buyFk);
this.date = moment(this.date).format('WW/DD');
},
methods: {
formatNumber(number) {
return new Intl.NumberFormat('es-ES', {maximumFractionDigits: 0}).format(number);
}
},
props: {
id: {
type: Number,
required: true,
description: 'The item id'
},
warehouseId: {
type: Number
},
packing: {
type: Number
},
copies: {
type: Number
},
userId: {
type: Number
},
typeId: {
type: String
}
}
};