Added functions to call sql from def
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
fbab7aebcf
commit
4d25fe88cf
|
@ -1,3 +1,2 @@
|
|||
Invoice out: Facturas
|
||||
invoiceOut: factura
|
||||
InvoiceOut: Facturas
|
||||
Search invoices by reference: Buscar facturas por referencia
|
|
@ -22,7 +22,7 @@
|
|||
"url": "/index?q",
|
||||
"state": "invoiceOut.index",
|
||||
"component": "vn-invoice-out-index",
|
||||
"description": "Invoice out"
|
||||
"description": "InvoiceOut"
|
||||
},
|
||||
{
|
||||
"url": "/summary",
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
const mysql = require('mysql2/promise');
|
||||
const config = require('./config.js');
|
||||
const fs = require('fs-extra');
|
||||
const path = require('path');
|
||||
|
||||
module.exports = {
|
||||
init() {
|
||||
|
@ -10,6 +12,7 @@ module.exports = {
|
|||
});
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Makes a query from a raw sql
|
||||
* @param {String} query - The raw SQL query
|
||||
|
@ -22,6 +25,22 @@ module.exports = {
|
|||
return rows;
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Makes a query from a SQL file
|
||||
* @param {String} queryName - The SQL file name
|
||||
* @param {Object} params - Parameterized values
|
||||
* @param {Object} dirname - Referenced path
|
||||
*
|
||||
* @return {Object} - Result promise
|
||||
*/
|
||||
rawSqlFromDef(queryName, params, dirname = '.') {
|
||||
const sqlPath = path.join(dirname, 'sql', `${queryName}.sql`);
|
||||
const query = fs.readFileSync(sqlPath, 'utf8');
|
||||
|
||||
return this.rawSql(query, params);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the first row from a given raw sql
|
||||
* @param {String} query - The raw SQL query
|
||||
|
@ -32,6 +51,20 @@ module.exports = {
|
|||
findOne(query, params) {
|
||||
return this.rawSql(query, params).then(([row]) => row);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the first row from a given SQL file
|
||||
* @param {String} queryName - The SQL file name
|
||||
* @param {Object} params - Parameterized values
|
||||
* @param {Object} dirname - Referenced path
|
||||
*
|
||||
* @return {Object} - Result promise
|
||||
*/
|
||||
findOneFromDef(queryName, params, dirname) {
|
||||
return this.rawSqlFromDef(queryName, params, dirname)
|
||||
.then(([row]) => row);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the first property from a given raw sql
|
||||
* @param {String} query - The raw SQL query
|
||||
|
@ -44,7 +77,42 @@ module.exports = {
|
|||
return Object.values(row)[0];
|
||||
});
|
||||
},
|
||||
findFromDef() {
|
||||
|
||||
/**
|
||||
* Returns the first property from a given SQL file
|
||||
* @param {String} queryName - The SQL file name
|
||||
* @param {Object} params - Parameterized values
|
||||
* @param {Object} dirname - Referenced path
|
||||
*
|
||||
* @return {Object} - Result promise
|
||||
*/
|
||||
findValueFromDef(queryName, params, dirname) {
|
||||
return this.findOneFromDef(queryName, params, dirname).then(row => {
|
||||
return Object.values(row)[0];
|
||||
});
|
||||
},
|
||||
|
||||
getCaller() {
|
||||
let originalFunc = Error.prepareStackTrace;
|
||||
let callerfile;
|
||||
try {
|
||||
const err = new Error();
|
||||
|
||||
Error.prepareStackTrace = function(err, stack) {
|
||||
return stack;
|
||||
};
|
||||
|
||||
const currentfile = err.stack.shift().getFileName();
|
||||
|
||||
while (err.stack.length) {
|
||||
callerfile = err.stack.shift().getFileName();
|
||||
|
||||
if (currentfile !== callerfile) break;
|
||||
}
|
||||
} catch (e) {}
|
||||
|
||||
Error.prepareStackTrace = originalFunc;
|
||||
|
||||
return path.dirname(callerfile);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -10,18 +10,7 @@ module.exports = {
|
|||
},
|
||||
methods: {
|
||||
fetchClient(clientId) {
|
||||
return db.findOne(`
|
||||
SELECT
|
||||
c.id,
|
||||
u.name AS userName,
|
||||
CONCAT(w.lastName, ' ', w.firstName) salesPersonName,
|
||||
w.phone AS salesPersonPhone,
|
||||
CONCAT(wu.name, '@verdnatura.es') AS salesPersonEmail
|
||||
FROM client c
|
||||
JOIN account.user u ON u.id = c.id
|
||||
LEFT JOIN worker w ON w.id = c.salesPersonFk
|
||||
LEFT JOIN account.user wu ON wu.id = w.userFk
|
||||
WHERE c.id = ?`, [clientId]);
|
||||
return db.findOneFromDef('client', [clientId], __dirname);
|
||||
},
|
||||
},
|
||||
components: {
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
SELECT
|
||||
c.id,
|
||||
u.name AS userName,
|
||||
CONCAT(w.lastName, ' ', w.firstName) salesPersonName,
|
||||
w.phone AS salesPersonPhone,
|
||||
CONCAT(wu.name, '@verdnatura.es') AS salesPersonEmail
|
||||
FROM client c
|
||||
JOIN account.user u ON u.id = c.id
|
||||
LEFT JOIN worker w ON w.id = c.salesPersonFk
|
||||
LEFT JOIN account.user wu ON wu.id = w.userFk
|
||||
WHERE c.id = ?
|
|
@ -18,17 +18,7 @@ module.exports = {
|
|||
},
|
||||
methods: {
|
||||
fetchDebtor(clientId, companyId) {
|
||||
return db.findOne(`
|
||||
SELECT
|
||||
c.dueDay,
|
||||
c.iban,
|
||||
sa.iban,
|
||||
be.name AS bankName
|
||||
FROM client c
|
||||
JOIN company AS cny
|
||||
JOIN supplierAccount AS sa ON sa.id = cny.supplierAccountFk
|
||||
JOIN bankEntity be ON be.id = sa.bankEntityFk
|
||||
WHERE c.id = ? AND cny.id = ?`, [clientId, companyId]);
|
||||
return db.findOneFromDef('client', [clientId, companyId], __dirname);
|
||||
}
|
||||
},
|
||||
components: {
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
SELECT
|
||||
c.dueDay,
|
||||
c.iban,
|
||||
sa.iban,
|
||||
be.name AS bankName
|
||||
FROM client c
|
||||
JOIN company AS cny
|
||||
JOIN supplierAccount AS sa ON sa.id = cny.supplierAccountFk
|
||||
JOIN bankEntity be ON be.id = sa.bankEntityFk
|
||||
WHERE c.id = ? AND cny.id = ?`
|
|
@ -18,17 +18,7 @@ module.exports = {
|
|||
},
|
||||
methods: {
|
||||
fetchDebtor(clientId, companyId) {
|
||||
return db.findOne(`
|
||||
SELECT
|
||||
c.dueDay,
|
||||
c.iban,
|
||||
sa.iban,
|
||||
be.name AS bankName
|
||||
FROM client c
|
||||
JOIN company AS cny
|
||||
JOIN supplierAccount AS sa ON sa.id = cny.supplierAccountFk
|
||||
JOIN bankEntity be ON be.id = sa.bankEntityFk
|
||||
WHERE c.id = ? AND cny.id = ?`, [clientId, companyId]);
|
||||
return db.findOneFromDef('client', [clientId, companyId], __dirname);
|
||||
}
|
||||
},
|
||||
components: {
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
SELECT
|
||||
c.dueDay,
|
||||
c.iban,
|
||||
sa.iban,
|
||||
be.name AS bankName
|
||||
FROM client c
|
||||
JOIN company AS cny
|
||||
JOIN supplierAccount AS sa ON sa.id = cny.supplierAccountFk
|
||||
JOIN bankEntity be ON be.id = sa.bankEntityFk
|
||||
WHERE c.id = ? AND cny.id = ?
|
|
@ -18,15 +18,7 @@ module.exports = {
|
|||
},
|
||||
methods: {
|
||||
fetchPayMethod(clientId) {
|
||||
return db.findOne(
|
||||
`SELECT
|
||||
c.dueDay,
|
||||
c.iban,
|
||||
pm.name,
|
||||
pm.code
|
||||
FROM client c
|
||||
JOIN payMethod pm ON pm.id = c.payMethodFk
|
||||
WHERE c.id = :clientId`, {clientId: clientId});
|
||||
return db.findOneFromDef('payMethod', {clientId: clientId}, __dirname);
|
||||
}
|
||||
},
|
||||
components: {
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
SELECT
|
||||
c.dueDay,
|
||||
c.iban,
|
||||
pm.name,
|
||||
pm.code
|
||||
FROM client c
|
||||
JOIN payMethod pm ON pm.id = c.payMethodFk
|
||||
WHERE c.id = :clientId
|
|
@ -15,20 +15,7 @@ module.exports = {
|
|||
},
|
||||
methods: {
|
||||
fetchClient(clientId) {
|
||||
return db.findOne(`
|
||||
SELECT
|
||||
c.id,
|
||||
u.lang locale,
|
||||
u.name AS userName,
|
||||
c.email recipient,
|
||||
CONCAT(w.lastName, ' ', w.firstName) salesPersonName,
|
||||
w.phone AS salesPersonPhone,
|
||||
CONCAT(wu.name, '@verdnatura.es') AS salesPersonEmail
|
||||
FROM client c
|
||||
JOIN account.user u ON u.id = c.id
|
||||
LEFT JOIN worker w ON w.id = c.salesPersonFk
|
||||
LEFT JOIN account.user wu ON wu.id = w.userFk
|
||||
WHERE c.id = ?`, [clientId]);
|
||||
return db.findOneFromDef('client', [clientId], __dirname);
|
||||
}
|
||||
},
|
||||
components: {
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
SELECT
|
||||
c.id,
|
||||
u.name AS userName,
|
||||
c.email recipient,
|
||||
CONCAT(w.lastName, ' ', w.firstName) salesPersonName,
|
||||
w.phone AS salesPersonPhone,
|
||||
CONCAT(wu.name, '@verdnatura.es') AS salesPersonEmail
|
||||
FROM client c
|
||||
JOIN account.user u ON u.id = c.id
|
||||
LEFT JOIN worker w ON w.id = c.salesPersonFk
|
||||
LEFT JOIN account.user wu ON wu.id = w.userFk
|
||||
WHERE c.id = ?
|
|
@ -14,44 +14,10 @@ module.exports = {
|
|||
},
|
||||
methods: {
|
||||
fetchClient(clientId) {
|
||||
return db.findOne(
|
||||
`SELECT
|
||||
c.street,
|
||||
c.socialName,
|
||||
c.city,
|
||||
c.postcode,
|
||||
c.id,
|
||||
c.name AS clientName,
|
||||
p.name AS province,
|
||||
co.country
|
||||
FROM client c
|
||||
JOIN province p ON c.provinceFk = p.id
|
||||
JOIN country co ON c.countryFk = co.id
|
||||
WHERE
|
||||
c.id = ?`, [clientId]);
|
||||
return db.findOneFromDef('client', [clientId], __dirname);
|
||||
},
|
||||
fetchSales(clientId, from, to) {
|
||||
return db.rawSql(
|
||||
`SELECT
|
||||
SUM(s.quantity) AS subtotal,
|
||||
s.itemFk,
|
||||
s.concept,
|
||||
i.subName,
|
||||
i.tag5,
|
||||
i.value5,
|
||||
i.tag6,
|
||||
i.value6,
|
||||
i.tag7,
|
||||
i.value7
|
||||
FROM sale s
|
||||
JOIN ticket t ON t.id = s.ticketFk
|
||||
JOIN item i ON i.id = s.itemFk
|
||||
JOIN itemType it ON it.id = i.typeFk
|
||||
WHERE
|
||||
t.clientFk = ? AND it.isPackaging = FALSE
|
||||
AND DATE(t.shipped) BETWEEN ? AND ?
|
||||
GROUP BY s.itemFk
|
||||
ORDER BY i.typeFk , i.name`, [clientId, from, to]);
|
||||
return db.rawSqlFromDef('sales', [clientId, from, to], __dirname);
|
||||
},
|
||||
},
|
||||
components: {
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
SELECT
|
||||
c.street,
|
||||
c.socialName,
|
||||
c.city,
|
||||
c.postcode,
|
||||
c.id,
|
||||
c.name AS clientName,
|
||||
p.name AS province,
|
||||
co.country
|
||||
FROM client c
|
||||
JOIN province p ON c.provinceFk = p.id
|
||||
JOIN country co ON c.countryFk = co.id
|
||||
WHERE c.id = ?
|
|
@ -0,0 +1,20 @@
|
|||
SELECT
|
||||
SUM(s.quantity) AS subtotal,
|
||||
s.itemFk,
|
||||
s.concept,
|
||||
i.subName,
|
||||
i.tag5,
|
||||
i.value5,
|
||||
i.tag6,
|
||||
i.value6,
|
||||
i.tag7,
|
||||
i.value7
|
||||
FROM sale s
|
||||
JOIN ticket t ON t.id = s.ticketFk
|
||||
JOIN item i ON i.id = s.itemFk
|
||||
JOIN itemType it ON it.id = i.typeFk
|
||||
WHERE
|
||||
t.clientFk = ? AND it.isPackaging = FALSE
|
||||
AND DATE(t.shipped) BETWEEN ? AND ?
|
||||
GROUP BY s.itemFk
|
||||
ORDER BY i.typeFk , i.name
|
|
@ -21,37 +21,10 @@ module.exports = {
|
|||
},
|
||||
methods: {
|
||||
fetchClient(claimId) {
|
||||
return db.findOne(
|
||||
`SELECT
|
||||
c.id,
|
||||
c.socialName,
|
||||
c.name,
|
||||
c.fi,
|
||||
a.city,
|
||||
a.postalCode,
|
||||
a.street,
|
||||
a.nickname,
|
||||
p.name AS province,
|
||||
ct.country
|
||||
FROM claim cl
|
||||
JOIN client c ON c.id = cl.clientFk
|
||||
JOIN account.user u ON u.id = c.id
|
||||
JOIN country ct ON ct.id = c.countryFk
|
||||
JOIN ticket t ON t.id = cl.ticketFk
|
||||
JOIN address a ON a.id = t.addressFk
|
||||
LEFT JOIN province p ON p.id = c.provinceFk
|
||||
WHERE cl.id = ?`, [claimId]);
|
||||
return db.findOneFromDef('client', [claimId], __dirname);
|
||||
},
|
||||
fetchSales(claimId) {
|
||||
return db.rawSql(
|
||||
`SELECT
|
||||
s.id,
|
||||
s.quantity,
|
||||
s.concept,
|
||||
cb.quantity claimQuantity
|
||||
FROM claimBeginning cb
|
||||
JOIN sale s ON s.id = cb.saleFk
|
||||
WHERE cb.claimFk = ?`, [claimId]);
|
||||
return db.rawSqlFromDef('sales', [claimId], __dirname);
|
||||
},
|
||||
},
|
||||
components: {
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
SELECT
|
||||
c.id,
|
||||
c.socialName,
|
||||
c.name,
|
||||
c.fi,
|
||||
a.city,
|
||||
a.postalCode,
|
||||
a.street,
|
||||
a.nickname,
|
||||
p.name AS province,
|
||||
ct.country
|
||||
FROM claim cl
|
||||
JOIN client c ON c.id = cl.clientFk
|
||||
JOIN account.user u ON u.id = c.id
|
||||
JOIN country ct ON ct.id = c.countryFk
|
||||
JOIN ticket t ON t.id = cl.ticketFk
|
||||
JOIN address a ON a.id = t.addressFk
|
||||
LEFT JOIN province p ON p.id = c.provinceFk
|
||||
WHERE cl.id = ?
|
|
@ -0,0 +1,8 @@
|
|||
SELECT
|
||||
s.id,
|
||||
s.quantity,
|
||||
s.concept,
|
||||
cb.quantity claimQuantity
|
||||
FROM claimBeginning cb
|
||||
JOIN sale s ON s.id = cb.saleFk
|
||||
WHERE cb.claimFk = ?
|
|
@ -16,4 +16,8 @@
|
|||
h3 {
|
||||
font-weight: 100;
|
||||
color: #555
|
||||
}
|
||||
|
||||
.ticket-info {
|
||||
font-size: 20px
|
||||
}
|
|
@ -16,7 +16,7 @@
|
|||
<div class="size50">
|
||||
<div class="size75">
|
||||
<h1 class="title uppercase">{{$t('title')}}</h1>
|
||||
<table class="row-oriented">
|
||||
<table class="row-oriented ticket-info">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="font gray uppercase">{{$t('clientId')}}</td>
|
||||
|
|
|
@ -42,132 +42,30 @@ module.exports = {
|
|||
},
|
||||
methods: {
|
||||
fetchClient(ticketId) {
|
||||
return db.findOne(
|
||||
`SELECT
|
||||
c.id,
|
||||
c.socialName,
|
||||
c.street,
|
||||
c.fi
|
||||
FROM ticket t
|
||||
JOIN client c ON c.id = t.clientFk
|
||||
WHERE t.id = ?`, [ticketId]);
|
||||
return db.findOneFromDef('getClient', [ticketId], __dirname);
|
||||
},
|
||||
fetchTicket(ticketId) {
|
||||
return db.findOne(
|
||||
`SELECT
|
||||
t.id,
|
||||
t.shipped,
|
||||
c.code companyCode
|
||||
FROM ticket t
|
||||
JOIN company c ON c.id = t.companyFk
|
||||
WHERE t.id = ?`, [ticketId]);
|
||||
return db.findOneFromDef('getTicket', [ticketId], __dirname);
|
||||
},
|
||||
fetchAddress(ticketId) {
|
||||
return db.findOne(
|
||||
`SELECT
|
||||
a.nickname,
|
||||
a.street,
|
||||
a.postalCode,
|
||||
a.city,
|
||||
p.name province
|
||||
FROM ticket t
|
||||
JOIN address a ON a.clientFk = t.clientFk
|
||||
AND a.id = t.addressFk
|
||||
LEFT JOIN province p ON p.id = a.provinceFk
|
||||
WHERE t.id = ?`, [ticketId]);
|
||||
},
|
||||
|
||||
fetchSales(ticketId) {
|
||||
return db.rawSql(
|
||||
`SELECT
|
||||
s.id,
|
||||
s.itemFk,
|
||||
s.concept,
|
||||
s.quantity,
|
||||
s.price,
|
||||
s.price - SUM(IF(ctr.id = 6,
|
||||
sc.value,
|
||||
0)) netPrice,
|
||||
s.discount,
|
||||
i.size,
|
||||
i.stems,
|
||||
i.category,
|
||||
it.id itemTypeId,
|
||||
o.code AS origin,
|
||||
i.inkFk,
|
||||
s.ticketFk,
|
||||
tcl.code vatType,
|
||||
ibwg.ediBotanic, ppa.denomination, pp.number passportNumber,
|
||||
be.isProtectedZone, c.code AS countryCode,
|
||||
i.tag5, i.value5,
|
||||
i.tag6, i.value6, i.tag7, i.value7
|
||||
FROM vn.sale s
|
||||
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
|
||||
LEFT JOIN component cr ON cr.id = sc.componentFk
|
||||
LEFT JOIN componentType ctr ON ctr.id = cr.typeFk
|
||||
LEFT JOIN item i ON i.id = s.itemFk
|
||||
LEFT JOIN ticket t ON t.id = s.ticketFk
|
||||
LEFT JOIN origin o ON o.id = i.originFk
|
||||
LEFT JOIN country c ON c.id = o.countryFk
|
||||
LEFT JOIN supplier sp ON sp.id = t.companyFk
|
||||
LEFT JOIN itemType it ON it.id = i.typeFk
|
||||
LEFT JOIN itemTaxCountry itc ON itc.itemFk = i.id
|
||||
AND itc.countryFk = sp.countryFk
|
||||
LEFT JOIN taxClass tcl ON tcl.id = itc.taxClassFk
|
||||
LEFT JOIN plantpassport pp ON pp.producerFk = i.producerFk
|
||||
LEFT JOIN plantpassportAuthority ppa ON ppa.id = pp.plantpassportAuthorityFk
|
||||
LEFT JOIN itemBotanicalWithGenus ibwg ON ibwg.itemFk = i.id
|
||||
LEFT JOIN botanicExport be ON be.restriction = 'pasaporte fitosanitario'
|
||||
LEFT JOIN ediGenus eg ON eg.id = be.ediGenusFk
|
||||
LEFT JOIN ediSpecie es ON es.id = be.ediSpecieFk
|
||||
AND ibwg.ediBotanic LIKE CONCAT(
|
||||
IFNULL(eg.latinGenusName, ''),
|
||||
IF(es.latinSpeciesName > '',
|
||||
CONCAT(' ', es.latinSpeciesName), ''),
|
||||
'%')
|
||||
WHERE s.ticketFk = ?
|
||||
GROUP BY s.id
|
||||
ORDER BY (it.isPackaging), s.concept, s.itemFk`, [ticketId]);
|
||||
},
|
||||
fetchTaxes(ticketId) {
|
||||
return db.rawSql(`CALL vn.ticketGetTaxAdd(?)`, [ticketId]).then(rows => {
|
||||
return rows[0];
|
||||
});
|
||||
},
|
||||
fetchPackagings(ticketId) {
|
||||
return db.rawSql(
|
||||
`SELECT
|
||||
tp.quantity,
|
||||
i.name,
|
||||
p.itemFk
|
||||
FROM ticketPackaging tp
|
||||
JOIN packaging p ON p.id = tp.packagingFk
|
||||
JOIN item i ON i.id = p.itemFk
|
||||
WHERE tp.ticketFk = ?
|
||||
ORDER BY itemFk`, [ticketId]);
|
||||
},
|
||||
fetchServices(ticketId) {
|
||||
return db.rawSql(
|
||||
`SELECT
|
||||
tc.description taxDescription,
|
||||
ts.description,
|
||||
ts.quantity,
|
||||
ts.price
|
||||
FROM ticketService ts
|
||||
JOIN taxClass tc ON tc.id = ts.taxClassFk
|
||||
WHERE ts.ticketFk = ?`, [ticketId]);
|
||||
return db.findOneFromDef(`getAddress`, [ticketId], __dirname);
|
||||
},
|
||||
fetchSignature(ticketId) {
|
||||
return db.findOne(
|
||||
`SELECT
|
||||
d.id,
|
||||
d.created
|
||||
FROM ticket t
|
||||
JOIN ticketDms dt ON dt.ticketFk = t.id
|
||||
JOIN dms d ON d.id = dt.dmsFk
|
||||
AND d.file LIKE '%.png'
|
||||
WHERE t.id = ?`, [ticketId]);
|
||||
return db.findOneFromDef('getSignature', [ticketId], __dirname);
|
||||
},
|
||||
fetchTaxes(ticketId) {
|
||||
return db.findOneFromDef(`getTaxes`, [ticketId], __dirname);
|
||||
},
|
||||
fetchSales(ticketId) {
|
||||
return db.rawSqlFromDef('getSales', [ticketId], __dirname);
|
||||
},
|
||||
fetchPackagings(ticketId) {
|
||||
return db.rawSqlFromDef('getPackagings', [ticketId], __dirname);
|
||||
},
|
||||
fetchServices(ticketId) {
|
||||
return db.rawSqlFromDef('getServices', [ticketId], __dirname);
|
||||
},
|
||||
|
||||
getSubTotal() {
|
||||
let subTotal = 0.00;
|
||||
this.sales.forEach(sale => {
|
||||
|
@ -194,7 +92,7 @@ module.exports = {
|
|||
},
|
||||
getTotal() {
|
||||
return this.getTotalBase() + this.getTotalTax();
|
||||
},
|
||||
}
|
||||
},
|
||||
components: {
|
||||
'report-header': reportHeader.build(),
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
SELECT
|
||||
a.nickname,
|
||||
a.street,
|
||||
a.postalCode,
|
||||
a.city,
|
||||
p.name province
|
||||
FROM ticket t
|
||||
JOIN address a ON a.clientFk = t.clientFk
|
||||
AND a.id = t.addressFk
|
||||
LEFT JOIN province p ON p.id = a.provinceFk
|
||||
WHERE t.id = ?
|
|
@ -0,0 +1,8 @@
|
|||
SELECT
|
||||
c.id,
|
||||
c.socialName,
|
||||
c.street,
|
||||
c.fi
|
||||
FROM ticket t
|
||||
JOIN client c ON c.id = t.clientFk
|
||||
WHERE t.id = ?
|
|
@ -0,0 +1,9 @@
|
|||
SELECT
|
||||
tp.quantity,
|
||||
i.name,
|
||||
p.itemFk
|
||||
FROM ticketPackaging tp
|
||||
JOIN packaging p ON p.id = tp.packagingFk
|
||||
JOIN item i ON i.id = p.itemFk
|
||||
WHERE tp.ticketFk = ?
|
||||
ORDER BY itemFk
|
|
@ -0,0 +1,53 @@
|
|||
SELECT
|
||||
s.id,
|
||||
s.itemFk,
|
||||
s.concept,
|
||||
s.quantity,
|
||||
s.price,
|
||||
s.price - SUM(IF(ctr.id = 6, sc.value, 0)) netPrice,
|
||||
s.discount,
|
||||
i.size,
|
||||
i.stems,
|
||||
i.category,
|
||||
it.id itemTypeId,
|
||||
o.code AS origin,
|
||||
i.inkFk,
|
||||
s.ticketFk,
|
||||
tcl.code vatType,
|
||||
ibwg.ediBotanic,
|
||||
ppa.denomination,
|
||||
pp.number passportNumber,
|
||||
be.isProtectedZone, c.code AS countryCode,
|
||||
i.tag5,
|
||||
i.value5,
|
||||
i.tag6,
|
||||
i.value6,
|
||||
i.tag7,
|
||||
i.value7
|
||||
FROM vn.sale s
|
||||
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
|
||||
LEFT JOIN component cr ON cr.id = sc.componentFk
|
||||
LEFT JOIN componentType ctr ON ctr.id = cr.typeFk
|
||||
LEFT JOIN item i ON i.id = s.itemFk
|
||||
LEFT JOIN ticket t ON t.id = s.ticketFk
|
||||
LEFT JOIN origin o ON o.id = i.originFk
|
||||
LEFT JOIN country c ON c.id = o.countryFk
|
||||
LEFT JOIN supplier sp ON sp.id = t.companyFk
|
||||
LEFT JOIN itemType it ON it.id = i.typeFk
|
||||
LEFT JOIN itemTaxCountry itc ON itc.itemFk = i.id
|
||||
AND itc.countryFk = sp.countryFk
|
||||
LEFT JOIN taxClass tcl ON tcl.id = itc.taxClassFk
|
||||
LEFT JOIN plantpassport pp ON pp.producerFk = i.producerFk
|
||||
LEFT JOIN plantpassportAuthority ppa ON ppa.id = pp.plantpassportAuthorityFk
|
||||
LEFT JOIN itemBotanicalWithGenus ibwg ON ibwg.itemFk = i.id
|
||||
LEFT JOIN botanicExport be ON be.restriction = 'pasaporte fitosanitario'
|
||||
LEFT JOIN ediGenus eg ON eg.id = be.ediGenusFk
|
||||
LEFT JOIN ediSpecie es ON es.id = be.ediSpecieFk
|
||||
AND ibwg.ediBotanic LIKE CONCAT(
|
||||
IFNULL(eg.latinGenusName, ''),
|
||||
IF(es.latinSpeciesName > '',
|
||||
CONCAT(' ', es.latinSpeciesName), ''),
|
||||
'%')
|
||||
WHERE s.ticketFk = ?
|
||||
GROUP BY s.id
|
||||
ORDER BY (it.isPackaging), s.concept, s.itemFk
|
|
@ -0,0 +1,8 @@
|
|||
SELECT
|
||||
tc.description taxDescription,
|
||||
ts.description,
|
||||
ts.quantity,
|
||||
ts.price
|
||||
FROM ticketService ts
|
||||
JOIN taxClass tc ON tc.id = ts.taxClassFk
|
||||
WHERE ts.ticketFk = ?
|
|
@ -0,0 +1,8 @@
|
|||
SELECT
|
||||
d.id,
|
||||
d.created
|
||||
FROM ticket t
|
||||
JOIN ticketDms dt ON dt.ticketFk = t.id
|
||||
JOIN dms d ON d.id = dt.dmsFk
|
||||
AND d.file LIKE '%.png'
|
||||
WHERE t.id = ?
|
|
@ -0,0 +1 @@
|
|||
CALL vn.ticketGetTaxAdd(?)
|
|
@ -0,0 +1,7 @@
|
|||
SELECT
|
||||
t.id,
|
||||
t.shipped,
|
||||
c.code companyCode
|
||||
FROM ticket t
|
||||
JOIN company c ON c.id = t.companyFk
|
||||
WHERE t.id = ?
|
|
@ -28,60 +28,10 @@ module.exports = {
|
|||
},
|
||||
methods: {
|
||||
fetchRoutes(routesId) {
|
||||
return db.rawSql(
|
||||
`SELECT
|
||||
r.id,
|
||||
r.m3,
|
||||
r.created,
|
||||
r.time,
|
||||
u.nickName userNickName,
|
||||
v.tradeMark vehicleTradeMark,
|
||||
v.model vehicleModel,
|
||||
v.numberPlate plateNumber,
|
||||
am.name agencyName
|
||||
FROM route r
|
||||
LEFT JOIN vehicle v ON v.id = r.vehicleFk
|
||||
LEFT JOIN worker w ON w.id = r.workerFk
|
||||
LEFT JOIN account.user u ON u.id = w.userFk
|
||||
LEFT JOIN agencyMode am ON am.id = r.agencyModeFk
|
||||
WHERE r.id IN(:routesId)`, {routesId});
|
||||
return db.rawSqlFromDef('routes', {routesId}, __dirname);
|
||||
},
|
||||
fetchTickets(routesId) {
|
||||
return db.rawSql(
|
||||
`SELECT
|
||||
t.nickname addressName,
|
||||
t.packages,
|
||||
t.priority,
|
||||
t.id,
|
||||
t.clientFk,
|
||||
t.companyFk,
|
||||
t.routeFk,
|
||||
if(a.phone, a.phone, c.phone) AS phone,
|
||||
if(a.mobile, a.mobile, c.mobile) AS mobile,
|
||||
wh.name warehouseName,
|
||||
a.city,
|
||||
a.street,
|
||||
a.postalCode,
|
||||
LPAD(a.id, 5, '0') AS addressFk,
|
||||
p.name province,
|
||||
0 AS import,
|
||||
am.name ticketAgency,
|
||||
tob.description,
|
||||
s.shipFk,
|
||||
u.nickName salesPersonName
|
||||
FROM route r
|
||||
LEFT JOIN ticket t ON t.routeFk = r.id
|
||||
LEFT JOIN address a ON a.id = t.addressFk
|
||||
LEFT JOIN client c ON c.id = t.clientFk
|
||||
LEFT JOIN worker w ON w.id = client_getSalesPerson(t.clientFk, CURDATE())
|
||||
LEFT JOIN account.user u ON u.id = w.userFk
|
||||
LEFT JOIN ticketObservation tob ON tob.ticketFk = t.id AND tob.observationTypeFk = 3
|
||||
LEFT JOIN province p ON a.provinceFk = p.id
|
||||
LEFT JOIN warehouse wh ON wh.id = t.warehouseFk
|
||||
LEFT JOIN agencyMode am ON am.id = t.agencyModeFk
|
||||
LEFT JOIN stowaway s ON s.id = t.id
|
||||
WHERE r.id IN(:routesId)
|
||||
ORDER BY t.priority, t.id`, {routesId});
|
||||
return db.rawSqlFromDef('tickets', {routesId}, __dirname);
|
||||
}
|
||||
},
|
||||
components: {
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
SELECT
|
||||
r.id,
|
||||
r.m3,
|
||||
r.created,
|
||||
r.time,
|
||||
u.nickName userNickName,
|
||||
v.tradeMark vehicleTradeMark,
|
||||
v.model vehicleModel,
|
||||
v.numberPlate plateNumber,
|
||||
am.name agencyName
|
||||
FROM route r
|
||||
LEFT JOIN vehicle v ON v.id = r.vehicleFk
|
||||
LEFT JOIN worker w ON w.id = r.workerFk
|
||||
LEFT JOIN account.user u ON u.id = w.userFk
|
||||
LEFT JOIN agencyMode am ON am.id = r.agencyModeFk
|
||||
WHERE r.id IN(:routesId)
|
|
@ -0,0 +1,34 @@
|
|||
SELECT
|
||||
t.nickname addressName,
|
||||
t.packages,
|
||||
t.priority,
|
||||
t.id,
|
||||
t.clientFk,
|
||||
t.companyFk,
|
||||
t.routeFk,
|
||||
if(a.phone, a.phone, c.phone) AS phone,
|
||||
if(a.mobile, a.mobile, c.mobile) AS mobile,
|
||||
wh.name warehouseName,
|
||||
a.city,
|
||||
a.street,
|
||||
a.postalCode,
|
||||
LPAD(a.id, 5, '0') AS addressFk,
|
||||
p.name province,
|
||||
0 AS import,
|
||||
am.name ticketAgency,
|
||||
tob.description,
|
||||
s.shipFk,
|
||||
u.nickName salesPersonName
|
||||
FROM route r
|
||||
LEFT JOIN ticket t ON t.routeFk = r.id
|
||||
LEFT JOIN address a ON a.id = t.addressFk
|
||||
LEFT JOIN client c ON c.id = t.clientFk
|
||||
LEFT JOIN worker w ON w.id = client_getSalesPerson(t.clientFk, CURDATE())
|
||||
LEFT JOIN account.user u ON u.id = w.userFk
|
||||
LEFT JOIN ticketObservation tob ON tob.ticketFk = t.id AND tob.observationTypeFk = 3
|
||||
LEFT JOIN province p ON a.provinceFk = p.id
|
||||
LEFT JOIN warehouse wh ON wh.id = t.warehouseFk
|
||||
LEFT JOIN agencyMode am ON am.id = t.agencyModeFk
|
||||
LEFT JOIN stowaway s ON s.id = t.id
|
||||
WHERE r.id IN(:routesId)
|
||||
ORDER BY t.priority, t.id
|
|
@ -18,50 +18,13 @@ module.exports = {
|
|||
},
|
||||
methods: {
|
||||
fetchSupplier(entryId) {
|
||||
return db.findOne(
|
||||
`SELECT
|
||||
s.name,
|
||||
s.street,
|
||||
s.nif,
|
||||
s.postCode,
|
||||
s.city,
|
||||
p.name province
|
||||
FROM supplier s
|
||||
JOIN entry e ON e.supplierFk = s.id
|
||||
LEFT JOIN province p ON p.id = s.provinceFk
|
||||
WHERE e.id = ?`, [entryId]);
|
||||
return db.findOneFromDef('supplier', [entryId], __dirname);
|
||||
},
|
||||
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]);
|
||||
return db.findOneFromDef('entry', [entryId], __dirname);
|
||||
},
|
||||
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]);
|
||||
return db.rawSqlFromDef('buys', [entryId], __dirname);
|
||||
},
|
||||
getTotal() {
|
||||
let total = 0.00;
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
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 = ?
|
|
@ -0,0 +1,10 @@
|
|||
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 = ?
|
|
@ -0,0 +1,11 @@
|
|||
SELECT
|
||||
s.name,
|
||||
s.street,
|
||||
s.nif,
|
||||
s.postCode,
|
||||
s.city,
|
||||
p.name province
|
||||
FROM supplier s
|
||||
JOIN entry e ON e.supplierFk = s.id
|
||||
LEFT JOIN province p ON p.id = s.provinceFk
|
||||
WHERE e.id = ?
|
|
@ -30,26 +30,10 @@ module.exports = {
|
|||
},
|
||||
methods: {
|
||||
fetchItem(id, warehouseId) {
|
||||
return db.findOne(
|
||||
`SELECT
|
||||
i.id,
|
||||
i.name,
|
||||
i.stems,
|
||||
i.size,
|
||||
b.packing
|
||||
FROM vn.item i
|
||||
JOIN cache.last_buy clb ON clb.item_id = i.id
|
||||
JOIN vn.buy b ON b.id = clb.buy_id
|
||||
JOIN vn.entry e ON e.id = b.entryFk
|
||||
WHERE i.id = ? AND clb.warehouse_id = ?`, [id, warehouseId]);
|
||||
return db.findOneFromDef('item', [id, warehouseId], __dirname);
|
||||
},
|
||||
fetchItemTags(itemId) {
|
||||
return db.rawSql(
|
||||
`SELECT t.code, t.name, it.value
|
||||
FROM vn.itemTag it
|
||||
JOIN vn.tag t ON t.id = it.tagFk
|
||||
WHERE it.itemFk = ?
|
||||
`, [itemId]).then(rows => {
|
||||
return db.rawSqlFromDef('itemTags', [itemId], __dirname).then(rows => {
|
||||
const tags = {};
|
||||
rows.forEach(row => tags[row.code] = row.value);
|
||||
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
SELECT
|
||||
i.id,
|
||||
i.name,
|
||||
i.stems,
|
||||
i.size,
|
||||
b.packing
|
||||
FROM vn.item i
|
||||
JOIN cache.last_buy clb ON clb.item_id = i.id
|
||||
JOIN vn.buy b ON b.id = clb.buy_id
|
||||
JOIN vn.entry e ON e.id = b.entryFk
|
||||
WHERE i.id = ? AND clb.warehouse_id = ?
|
|
@ -0,0 +1,4 @@
|
|||
SELECT t.code, t.name, it.value
|
||||
FROM vn.itemTag it
|
||||
JOIN vn.tag t ON t.id = it.tagFk
|
||||
WHERE it.itemFk = ?
|
|
@ -24,29 +24,13 @@ module.exports = {
|
|||
},
|
||||
methods: {
|
||||
fetchClient(clientId) {
|
||||
return db.findOne(
|
||||
`SELECT
|
||||
c.id,
|
||||
c.socialName,
|
||||
c.street,
|
||||
c.postcode,
|
||||
c.city,
|
||||
c.fi,
|
||||
p.name AS province,
|
||||
ct.country
|
||||
FROM client c
|
||||
JOIN country ct ON ct.id = c.countryFk
|
||||
LEFT JOIN province p ON p.id = c.provinceFk
|
||||
WHERE c.id = ?`, [clientId]);
|
||||
return db.findOneFromDef('client', [clientId], __dirname);
|
||||
},
|
||||
fetchSales(clientId, companyId) {
|
||||
return db.rawSql(
|
||||
`CALL vn.clientGetDebtDiary(:clientId, :companyId)`, {
|
||||
clientId: clientId,
|
||||
companyId: companyId,
|
||||
}).then(rows => {
|
||||
return rows[0];
|
||||
});
|
||||
return db.findOneFromDef('sales', {
|
||||
clientId: clientId,
|
||||
companyId: companyId,
|
||||
}, __dirname);
|
||||
},
|
||||
getBalance(sale) {
|
||||
if (sale.debtOut)
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
SELECT
|
||||
c.id,
|
||||
c.socialName,
|
||||
c.street,
|
||||
c.postcode,
|
||||
c.city,
|
||||
c.fi,
|
||||
p.name AS province,
|
||||
ct.country
|
||||
FROM client c
|
||||
JOIN country ct ON ct.id = c.countryFk
|
||||
LEFT JOIN province p ON p.id = c.provinceFk
|
||||
WHERE c.id = ?
|
|
@ -0,0 +1 @@
|
|||
CALL vn.clientGetDebtDiary(:clientId, :companyId)
|
|
@ -14,27 +14,10 @@ module.exports = {
|
|||
},
|
||||
methods: {
|
||||
fetchClient(receiptId) {
|
||||
return db.findOne(
|
||||
`SELECT
|
||||
c.id,
|
||||
c.socialName,
|
||||
u.lang locale
|
||||
FROM receipt r
|
||||
JOIN client c ON c.id = r.clientFk
|
||||
JOIN account.user u ON u.id = c.id
|
||||
WHERE r.id = ?`, [receiptId]);
|
||||
return db.findOneFromDef('client', [receiptId], __dirname);
|
||||
},
|
||||
fetchReceipt(receiptId) {
|
||||
return db.findOne(
|
||||
`SELECT
|
||||
r.id,
|
||||
r.amountPaid,
|
||||
r.amountUnpaid,
|
||||
r.payed,
|
||||
r.companyFk
|
||||
FROM receipt r
|
||||
JOIN client c ON c.id = r.clientFk
|
||||
WHERE r.id = ?`, [receiptId]);
|
||||
return db.findOneFromDef('receipt', [receiptId], __dirname);
|
||||
}
|
||||
},
|
||||
components: {
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
SELECT
|
||||
c.id,
|
||||
c.socialName,
|
||||
u.lang locale
|
||||
FROM receipt r
|
||||
JOIN client c ON c.id = r.clientFk
|
||||
JOIN account.user u ON u.id = c.id
|
||||
WHERE r.id = ?
|
|
@ -0,0 +1,9 @@
|
|||
SELECT
|
||||
r.id,
|
||||
r.amountPaid,
|
||||
r.amountUnpaid,
|
||||
r.payed,
|
||||
r.companyFk
|
||||
FROM receipt r
|
||||
JOIN client c ON c.id = r.clientFk
|
||||
WHERE r.id = ?
|
|
@ -21,46 +21,10 @@ const rptSepaCore = {
|
|||
},
|
||||
methods: {
|
||||
fetchClient(clientId, companyId) {
|
||||
return db.findOne(
|
||||
`SELECT
|
||||
c.id,
|
||||
m.code mandateCode,
|
||||
c.socialName,
|
||||
c.street,
|
||||
c.postcode,
|
||||
c.city,
|
||||
c.fi,
|
||||
p.name AS province,
|
||||
ct.country,
|
||||
ct.code AS countryCode,
|
||||
ct.ibanLength AS ibanLength
|
||||
FROM client c
|
||||
JOIN country ct ON ct.id = c.countryFk
|
||||
LEFT JOIN mandate m ON m.clientFk = c.id
|
||||
AND m.companyFk = :companyId AND m.finished IS NULL
|
||||
LEFT JOIN province p ON p.id = c.provinceFk
|
||||
WHERE (m.companyFk = :companyId OR m.companyFk IS NULL) AND c.id = :clientId
|
||||
ORDER BY m.created DESC LIMIT 1`, {companyId, clientId});
|
||||
return db.findOneFromDef('client', {companyId, clientId}, __dirname);
|
||||
},
|
||||
fetchSupplier(clientId, companyId) {
|
||||
return db.findOne(
|
||||
`SELECT
|
||||
m.code mandateCode,
|
||||
s.name,
|
||||
s.street,
|
||||
sc.country,
|
||||
s.postCode,
|
||||
s.city,
|
||||
sp.name province
|
||||
FROM client c
|
||||
LEFT JOIN mandate m ON m.clientFk = c.id
|
||||
AND m.companyFk = :companyId AND m.finished IS NULL
|
||||
LEFT JOIN supplier s ON s.id = m.companyFk
|
||||
LEFT JOIN country sc ON sc.id = s.countryFk
|
||||
LEFT JOIN province sp ON sp.id = s.provinceFk
|
||||
LEFT JOIN province p ON p.id = c.provinceFk
|
||||
WHERE (m.companyFk = :companyId OR m.companyFk IS NULL) AND c.id = :clientId
|
||||
ORDER BY m.created DESC LIMIT 1`, {companyId, clientId});
|
||||
return db.findOneFromDef('supplier', {companyId, clientId}, __dirname);
|
||||
}
|
||||
},
|
||||
components: {
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
SELECT
|
||||
c.id,
|
||||
m.code mandateCode,
|
||||
c.socialName,
|
||||
c.street,
|
||||
c.postcode,
|
||||
c.city,
|
||||
c.fi,
|
||||
p.name AS province,
|
||||
ct.country,
|
||||
ct.code AS countryCode,
|
||||
ct.ibanLength AS ibanLength
|
||||
FROM client c
|
||||
JOIN country ct ON ct.id = c.countryFk
|
||||
LEFT JOIN mandate m ON m.clientFk = c.id
|
||||
AND m.companyFk = :companyId AND m.finished IS NULL
|
||||
LEFT JOIN province p ON p.id = c.provinceFk
|
||||
WHERE (m.companyFk = :companyId OR m.companyFk IS NULL) AND c.id = :clientId
|
||||
ORDER BY m.created DESC LIMIT 1
|
|
@ -0,0 +1,17 @@
|
|||
SELECT
|
||||
m.code mandateCode,
|
||||
s.name,
|
||||
s.street,
|
||||
sc.country,
|
||||
s.postCode,
|
||||
s.city,
|
||||
sp.name province
|
||||
FROM client c
|
||||
LEFT JOIN mandate m ON m.clientFk = c.id
|
||||
AND m.companyFk = :companyId AND m.finished IS NULL
|
||||
LEFT JOIN supplier s ON s.id = m.companyFk
|
||||
LEFT JOIN country sc ON sc.id = s.countryFk
|
||||
LEFT JOIN province sp ON sp.id = s.provinceFk
|
||||
LEFT JOIN province p ON p.id = c.provinceFk
|
||||
WHERE (m.companyFk = :companyId OR m.companyFk IS NULL) AND c.id = :clientId
|
||||
ORDER BY m.created DESC LIMIT 1
|
|
@ -0,0 +1,9 @@
|
|||
SELECT
|
||||
r.id,
|
||||
r.time,
|
||||
am.name agencyName,
|
||||
v.numberPlate plateNumber
|
||||
FROM route r
|
||||
JOIN agencyMode am ON am.id = r.agencyModeFk
|
||||
JOIN vehicle v ON v.id = r.vehicleFk
|
||||
WHERE r.id = :routeId
|
|
@ -10,16 +10,7 @@ module.exports = {
|
|||
},
|
||||
methods: {
|
||||
fetchZone(routeId) {
|
||||
return db.findOne(
|
||||
`SELECT
|
||||
r.id,
|
||||
r.time,
|
||||
am.name agencyName,
|
||||
v.numberPlate plateNumber
|
||||
FROM route r
|
||||
JOIN agencyMode am ON am.id = r.agencyModeFk
|
||||
JOIN vehicle v ON v.id = r.vehicleFk
|
||||
WHERE r.id = :routeId`, {routeId});
|
||||
return db.findOneFromDef('zone', {routeId}, __dirname);
|
||||
}
|
||||
},
|
||||
props: {
|
||||
|
|
Loading…
Reference in New Issue