report entry-order
This commit is contained in:
parent
a03788317b
commit
aecfe2b8a9
|
@ -35,7 +35,7 @@ INSERT INTO `vn`.`packagingConfig`(`upperGap`)
|
||||||
UPDATE `account`.`role` SET id = 100 WHERE id = 0;
|
UPDATE `account`.`role` SET id = 100 WHERE id = 0;
|
||||||
|
|
||||||
INSERT INTO `account`.`user`(`id`,`name`, `nickname`, `password`,`role`,`active`,`email`, `lang`)
|
INSERT INTO `account`.`user`(`id`,`name`, `nickname`, `password`,`role`,`active`,`email`, `lang`)
|
||||||
SELECT id, name, CONCAT(name, 'Nick'),MD5('nightmare'), id, 1, CONCAT(name, '@mydomain.com'), 'EN'
|
SELECT id, name, CONCAT(name, 'Nick'),MD5('nightmare'), id, 1, CONCAT(name, '@mydomain.com'), 'en'
|
||||||
FROM `account`.`role` WHERE id <> 20
|
FROM `account`.`role` WHERE id <> 20
|
||||||
ORDER BY id;
|
ORDER BY id;
|
||||||
|
|
||||||
|
@ -55,18 +55,18 @@ INSERT INTO `hedera`.`tpvConfig`(`id`, `currency`, `terminal`, `transactionType`
|
||||||
|
|
||||||
INSERT INTO `account`.`user`(`id`,`name`,`nickname`, `password`,`role`,`active`,`email`,`lang`)
|
INSERT INTO `account`.`user`(`id`,`name`,`nickname`, `password`,`role`,`active`,`email`,`lang`)
|
||||||
VALUES
|
VALUES
|
||||||
(101, 'BruceWayne', 'Bruce Wayne', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'BruceWayne@mydomain.com', 'ES'),
|
(101, 'BruceWayne', 'Bruce Wayne', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'BruceWayne@mydomain.com', 'es'),
|
||||||
(102, 'PetterParker', 'Petter Parker', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'PetterParker@mydomain.com', 'EN'),
|
(102, 'PetterParker', 'Petter Parker', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'PetterParker@mydomain.com', 'en'),
|
||||||
(103, 'ClarkKent', 'Clark Kent', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'ClarkKent@mydomain.com', 'FR'),
|
(103, 'ClarkKent', 'Clark Kent', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'ClarkKent@mydomain.com', 'fr'),
|
||||||
(104, 'TonyStark', 'Tony Stark', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'TonyStark@mydomain.com', 'ES'),
|
(104, 'TonyStark', 'Tony Stark', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'TonyStark@mydomain.com', 'es'),
|
||||||
(105, 'MaxEisenhardt', 'Max Eisenhardt', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'MaxEisenhardt@mydomain.com', 'PT'),
|
(105, 'MaxEisenhardt', 'Max Eisenhardt', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'MaxEisenhardt@mydomain.com', 'pt'),
|
||||||
(106, 'DavidCharlesHaller', 'David Charles Haller', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'DavidCharlesHaller@mydomain.com', 'EN'),
|
(106, 'DavidCharlesHaller', 'David Charles Haller', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'DavidCharlesHaller@mydomain.com', 'en'),
|
||||||
(107, 'HankPym', 'Hank Pym', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'HankPym@mydomain.com', 'EN'),
|
(107, 'HankPym', 'Hank Pym', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'HankPym@mydomain.com', 'en'),
|
||||||
(108, 'CharlesXavier', 'Charles Xavier', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'CharlesXavier@mydomain.com', 'EN'),
|
(108, 'CharlesXavier', 'Charles Xavier', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'CharlesXavier@mydomain.com', 'en'),
|
||||||
(109, 'BruceBanner', 'Bruce Banner', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'BruceBanner@mydomain.com', 'EN'),
|
(109, 'BruceBanner', 'Bruce Banner', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'BruceBanner@mydomain.com', 'en'),
|
||||||
(110, 'JessicaJones', 'Jessica Jones', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'JessicaJones@mydomain.com', 'EN'),
|
(110, 'JessicaJones', 'Jessica Jones', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'JessicaJones@mydomain.com', 'en'),
|
||||||
(111, 'Missing', 'Missing', 'ac754a330530832ba1bf7687f577da91', 2, 0, NULL, 'EN'),
|
(111, 'Missing', 'Missing', 'ac754a330530832ba1bf7687f577da91', 2, 0, NULL, 'en'),
|
||||||
(112, 'Trash', 'Trash', 'ac754a330530832ba1bf7687f577da91', 2, 0, NULL, 'EN');
|
(112, 'Trash', 'Trash', 'ac754a330530832ba1bf7687f577da91', 2, 0, NULL, 'en');
|
||||||
|
|
||||||
INSERT INTO `vn`.`worker`(`id`, `code`, `firstName`, `lastName`, `userFk`,`bossFk`, `phone`)
|
INSERT INTO `vn`.`worker`(`id`, `code`, `firstName`, `lastName`, `userFk`,`bossFk`, `phone`)
|
||||||
VALUES
|
VALUES
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
const Stylesheet = require(`${appPath}/core/stylesheet`);
|
||||||
|
|
||||||
|
module.exports = new Stylesheet([
|
||||||
|
`${appPath}/common/css/spacing.css`,
|
||||||
|
`${appPath}/common/css/misc.css`,
|
||||||
|
`${appPath}/common/css/layout.css`,
|
||||||
|
`${appPath}/common/css/report.css`,
|
||||||
|
`${__dirname}/style.css`])
|
||||||
|
.mergeStyles();
|
|
@ -0,0 +1,6 @@
|
||||||
|
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
font-weight: 100;
|
||||||
|
color: #555
|
||||||
|
}
|
|
@ -0,0 +1,140 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html v-bind:lang="locale">
|
||||||
|
<body>
|
||||||
|
<table class="grid">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<!-- Header block -->
|
||||||
|
<div class="grid-row">
|
||||||
|
<div class="grid-block">
|
||||||
|
<report-header v-bind="$props"
|
||||||
|
v-bind:company-code="entry.companyCode">
|
||||||
|
</report-header>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- Block -->
|
||||||
|
<div class="grid-row">
|
||||||
|
<div class="grid-block">
|
||||||
|
<div class="columns">
|
||||||
|
<div class="size50">
|
||||||
|
<div class="size75">
|
||||||
|
<div class="body">
|
||||||
|
<h1 class="title uppercase">{{$t('title')}}</h1>
|
||||||
|
<table class="row-oriented">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td class="font gray uppercase">{{$t('entryId')}}</td>
|
||||||
|
<th>{{entry.id}}</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="font gray uppercase">{{$t('date')}}</td>
|
||||||
|
<th>{{entry.landed | date('%d-%m-%Y')}}</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="font gray uppercase">{{$t('ref')}}</td>
|
||||||
|
<th>{{entry.ref}}</th>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="size50">
|
||||||
|
<div class="panel">
|
||||||
|
<div class="header">{{$t('supplierData')}}</div>
|
||||||
|
<div class="body">
|
||||||
|
<h3 class="uppercase">{{supplier.name}}</h3>
|
||||||
|
<div>
|
||||||
|
{{supplier.street}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Buy block -->
|
||||||
|
<table class="column-oriented">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<td class="number">{{$t('boxes')}}</td>
|
||||||
|
<td class="number">{{$t('packing')}}</td>
|
||||||
|
<td>{{$t('concept')}}</td>
|
||||||
|
<td class="number">{{$t('quantity')}}</td>
|
||||||
|
<td class="number">{{$t('price')}}</td>
|
||||||
|
<td class="number">{{$t('amount')}}</td>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<template v-for="buy in buys">
|
||||||
|
<tr class="font bold">
|
||||||
|
<td class="number">{{buy.box}}</td>
|
||||||
|
<td class="number">{{buy.packing}}</td>
|
||||||
|
<td>{{buy.itemName}}</td>
|
||||||
|
<td class="number">{{buy.quantity}}</td>
|
||||||
|
<td class="number">{{buy.buyingValue | currency('EUR', locale)}}</td>
|
||||||
|
<td class="number">{{buy.buyingValue * buy.quantity | currency('EUR', locale)}}</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="description">
|
||||||
|
<td colspan="2" class="centered">
|
||||||
|
<div v-if="buy.value5">
|
||||||
|
<strong class="font gray">{{buy.tag5}}</strong>
|
||||||
|
<span>{{buy.value5}}</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td colspan="2" class="centered">
|
||||||
|
<div v-if="buy.value6">
|
||||||
|
<strong class="font gray">{{buy.tag6}}</strong>
|
||||||
|
<span>{{buy.value6}}</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td colspan="2" class="centered">
|
||||||
|
<div v-if="buy.value7">
|
||||||
|
<strong class="font gray">{{buy.tag7}}</strong>
|
||||||
|
<span>{{buy.value7}}</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</template>
|
||||||
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<td colspan="5">
|
||||||
|
<span class="pull-right">{{$t('total')}}</span>
|
||||||
|
</td>
|
||||||
|
<td class="number">{{getTotal() | currency('EUR', locale)}}</td>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
|
</table>
|
||||||
|
<!-- End of buy block -->
|
||||||
|
<div class="columns">
|
||||||
|
<div class="size50">
|
||||||
|
<div id="notes" class="panel" v-if="entry.notes">
|
||||||
|
<div class="body">
|
||||||
|
<h3>{{$t('notes')}}</h3>
|
||||||
|
<div>
|
||||||
|
{{entry.notes}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- Footer block -->
|
||||||
|
<div class="grid-row">
|
||||||
|
<div class="grid-block">
|
||||||
|
<report-footer id="pageFooter"
|
||||||
|
v-bind:left-text="$t('entry', [entry.id])"
|
||||||
|
v-bind:company-code="entry.companyCode"
|
||||||
|
v-bind:center-text="supplier.name"
|
||||||
|
v-bind:="$props">
|
||||||
|
</report-footer>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,80 @@
|
||||||
|
const db = require(`${appPath}/core/database`);
|
||||||
|
const Component = require(`${appPath}/core/component`);
|
||||||
|
const reportHeader = new Component('report-header');
|
||||||
|
const reportFooter = new Component('report-footer');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: 'entry-order',
|
||||||
|
async serverPrefetch() {
|
||||||
|
this.supplier = await this.fetchSupplier(this.entryId);
|
||||||
|
this.entry = await this.fetchEntry(this.entryId);
|
||||||
|
this.buys = await this.fetchBuys(this.entryId);
|
||||||
|
|
||||||
|
if (!this.entry)
|
||||||
|
throw new Error('Something went wrong');
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {totalBalance: 0.00};
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
fetchSupplier(entryId) {
|
||||||
|
return db.findOne(
|
||||||
|
`SELECT
|
||||||
|
s.name,
|
||||||
|
s.street
|
||||||
|
FROM supplier s
|
||||||
|
JOIN entry e ON e.supplierFk = s.id
|
||||||
|
WHERE e.id = ?`, [entryId]);
|
||||||
|
},
|
||||||
|
fetchEntry(entryId) {
|
||||||
|
return db.findOne(
|
||||||
|
`SELECT
|
||||||
|
e.id,
|
||||||
|
e.ref,
|
||||||
|
e.notes,
|
||||||
|
c.code companyCode,
|
||||||
|
t.landed
|
||||||
|
FROM entry e
|
||||||
|
JOIN travel t ON t.id = e.travelFk
|
||||||
|
JOIN company c ON c.id = e.companyFk
|
||||||
|
WHERE e.id = ?`, [entryId]);
|
||||||
|
},
|
||||||
|
fetchBuys(entryId) {
|
||||||
|
return db.rawSql(
|
||||||
|
`SELECT
|
||||||
|
b.itemFk,
|
||||||
|
b.quantity,
|
||||||
|
b.buyingValue,
|
||||||
|
b.stickers box,
|
||||||
|
b.packing,
|
||||||
|
i.name itemName,
|
||||||
|
i.tag5,
|
||||||
|
i.value5,
|
||||||
|
i.tag6,
|
||||||
|
i.value6,
|
||||||
|
i.tag7,
|
||||||
|
i.value7
|
||||||
|
FROM buy b
|
||||||
|
JOIN item i ON i.id = b.itemFk
|
||||||
|
WHERE b.entryFk = ?`, [entryId]);
|
||||||
|
},
|
||||||
|
getTotal() {
|
||||||
|
let total = 0.00;
|
||||||
|
this.buys.forEach(buy => {
|
||||||
|
total += buy.quantity * buy.buyingValue;
|
||||||
|
});
|
||||||
|
|
||||||
|
return total;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
'report-header': reportHeader.build(),
|
||||||
|
'report-footer': reportFooter.build()
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
entryId: {
|
||||||
|
type: String,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
|
@ -0,0 +1,16 @@
|
||||||
|
title: Pedido
|
||||||
|
supplierName: Proveedor
|
||||||
|
supplierStreet: Dirección
|
||||||
|
entryId: Pedido nº
|
||||||
|
date: Fecha
|
||||||
|
ref: Referencia
|
||||||
|
boxes: Cajas
|
||||||
|
packing: U/C
|
||||||
|
quantity: Cantidad
|
||||||
|
price: Precio
|
||||||
|
amount: Importe
|
||||||
|
concept: Descripción
|
||||||
|
total: Total
|
||||||
|
entry: Entrada {0}
|
||||||
|
supplierData: Datos del proveedor
|
||||||
|
notes: Notas
|
Loading…
Reference in New Issue