Merge branch 'master' into hotfix-6899invoiceOut
gitea/salix/pipeline/pr-master This commit looks good
Details
gitea/salix/pipeline/pr-master This commit looks good
Details
This commit is contained in:
commit
7d1e3b6751
|
@ -54,7 +54,9 @@ proc:BEGIN
|
|||
WHERE shipped BETWEEN vCreated AND util.dayEnd(vCreated)
|
||||
AND clientFk = vClientFk
|
||||
AND addressFk = vAddressFk
|
||||
AND warehouseFk = vWarehouseFk;
|
||||
AND warehouseFk = vWarehouseFk
|
||||
AND nickname = 'CAJAS AUTOCONSUMO'
|
||||
LIMIT 1;
|
||||
|
||||
IF vTicketFk IS NULL AND vAction = 'add' THEN
|
||||
INSERT INTO ticket(clientFk, warehouseFk, shipped, nickname, addressFk)
|
||||
|
|
|
@ -88,6 +88,11 @@ module.exports = Self => {
|
|||
arg: 'alertLevel',
|
||||
type: 'number',
|
||||
description: `The alert level of the tickets`
|
||||
},
|
||||
{
|
||||
arg: 'countryFk',
|
||||
type: 'number',
|
||||
description: 'The country id filter'
|
||||
}
|
||||
],
|
||||
returns: {
|
||||
|
@ -182,6 +187,7 @@ module.exports = Self => {
|
|||
t.totalWithVat,
|
||||
io.id invoiceOutId,
|
||||
a.provinceFk,
|
||||
p.countryFk,
|
||||
p.name province,
|
||||
w.name warehouse,
|
||||
am.name agencyMode,
|
||||
|
@ -360,6 +366,7 @@ module.exports = Self => {
|
|||
}
|
||||
case 'agencyModeFk':
|
||||
case 'warehouseFk':
|
||||
case 'countryFk':
|
||||
param = `f.${param}`;
|
||||
return {[param]: value};
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
|
||||
const buildFilter = require('vn-loopback/util/filter').buildFilter;
|
||||
const mergeFilters = require('vn-loopback/util/filter').mergeFilters;
|
||||
|
@ -112,45 +111,42 @@ module.exports = Self => {
|
|||
let stmt;
|
||||
stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.travel');
|
||||
stmt = new ParameterizedSQL(
|
||||
`CREATE TEMPORARY TABLE tmp.travel
|
||||
`CREATE TEMPORARY TABLE tmp.travel
|
||||
(INDEX (id))
|
||||
ENGINE = MEMORY
|
||||
SELECT
|
||||
t.id,
|
||||
SELECT t.id,
|
||||
t.ref,
|
||||
t.shipped,
|
||||
t.landed,
|
||||
t.kg,
|
||||
am.id AS agencyModeFk,
|
||||
am.name AS agencyModeName,
|
||||
wo.id AS warehouseOutFk,
|
||||
wo.name AS warehouseOutName,
|
||||
w.name AS warehouseInFk,
|
||||
w.name AS warehouseInName,
|
||||
SUM(b.stickers) AS stickers,
|
||||
s.id AS cargoSupplierFk,
|
||||
s.nickname AS cargoSupplierNickname,
|
||||
s.name AS supplierName,
|
||||
CAST(SUM(b.weight * b.stickers) as DECIMAL(10,0)) as loadedKg,
|
||||
am.id agencyModeFk,
|
||||
am.name agencyModeName,
|
||||
wo.id warehouseOutFk,
|
||||
wo.name warehouseOutName,
|
||||
w.name warehouseInFk,
|
||||
w.name warehouseInName,
|
||||
SUM(b.stickers) stickers,
|
||||
s.id cargoSupplierFk,
|
||||
s.nickname cargoSupplierNickname,
|
||||
s.name supplierName,
|
||||
CAST(SUM(b.weight * b.stickers) AS DECIMAL(10,0)) loadedKg,
|
||||
CAST(
|
||||
SUM(
|
||||
vc.aerealVolumetricDensity *
|
||||
b.stickers *
|
||||
IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000
|
||||
) as DECIMAL(10,0)
|
||||
) as volumeKg,
|
||||
GREATEST(
|
||||
CAST(SUM(b.weight * b.stickers) AS INT),
|
||||
CAST(
|
||||
) AS DECIMAL(10,0)
|
||||
) volumeKg,
|
||||
CAST(
|
||||
GREATEST(
|
||||
SUM(b.weight * b.stickers) ,
|
||||
SUM(vc.aerealVolumetricDensity *
|
||||
b.stickers *
|
||||
IF(pkg.volume,
|
||||
pkg.volume,
|
||||
pkg.width * pkg.depth * pkg.height
|
||||
) / 1000000
|
||||
) AS INT
|
||||
)
|
||||
/ t.kg * 100, 0) percentageKg
|
||||
IF(pkg.volume,
|
||||
pkg.volume,
|
||||
pkg.width * pkg.depth * pkg.height) / 1000000)
|
||||
) / t.kg * 100 AS INT
|
||||
) percentageKg
|
||||
FROM travel t
|
||||
LEFT JOIN supplier s ON s.id = t.cargoSupplierFk
|
||||
LEFT JOIN entry e ON e.travelFk = t.id
|
||||
|
|
Loading…
Reference in New Issue