Merge branch 'test' into dev
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
commit
04180bf8da
|
@ -1,26 +1,27 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`zone_getAddresses`(
|
||||
vSelf INT,
|
||||
vShipped DATE,
|
||||
vLanded DATE,
|
||||
vDepartmentFk INT
|
||||
)
|
||||
BEGIN
|
||||
/**
|
||||
* Devuelve un listado de todos los clientes activos
|
||||
* con consignatarios a los que se les puede
|
||||
* vender producto para esa zona.
|
||||
* entregar producto para esa zona.
|
||||
*
|
||||
* @param vSelf Id de zona
|
||||
* @param vShipped Fecha de envio
|
||||
* @param vDepartmentFk Id de departamento
|
||||
* @param vLanded Fecha de entrega
|
||||
* @param vDepartmentFk Id de departamento | NULL para mostrar todos
|
||||
* @return Un select
|
||||
*/
|
||||
CALL zone_getPostalCode(vSelf);
|
||||
|
||||
WITH clientWithTicket AS (
|
||||
SELECT clientFk
|
||||
SELECT DISTINCT clientFk
|
||||
FROM vn.ticket
|
||||
WHERE shipped BETWEEN vShipped AND util.dayEnd(vShipped)
|
||||
WHERE landed BETWEEN vLanded AND util.dayEnd(vLanded)
|
||||
AND NOT isDeleted
|
||||
)
|
||||
SELECT c.id,
|
||||
c.name,
|
||||
|
@ -30,7 +31,7 @@ BEGIN
|
|||
u.name username,
|
||||
aai.invoiced,
|
||||
cnb.lastShipped,
|
||||
cwt.clientFk
|
||||
IF(cwt.clientFk, TRUE, FALSE) hasTicket
|
||||
FROM vn.client c
|
||||
JOIN vn.worker w ON w.id = c.salesPersonFk
|
||||
JOIN vn.workerDepartment wd ON wd.workerFk = w.id
|
||||
|
@ -50,7 +51,7 @@ BEGIN
|
|||
AND c.isActive
|
||||
AND ct.code = 'normal'
|
||||
AND bt.code <> 'worker'
|
||||
AND (d.id = vDepartmentFk OR NOT vDepartmentFk)
|
||||
AND (d.id = vDepartmentFk OR vDepartmentFk IS NULL)
|
||||
GROUP BY c.id;
|
||||
|
||||
DROP TEMPORARY TABLE tmp.zoneNodes;
|
||||
|
|
|
@ -94,7 +94,7 @@ module.exports = Self => {
|
|||
AND r1.started = r2.maxStarted
|
||||
) r ON r.clientFk = c.id
|
||||
LEFT JOIN workerDepartment wd ON wd.workerFk = u.id
|
||||
JOIN department dp ON dp.id = wd.departmentFk
|
||||
LEFT JOIN department dp ON dp.id = wd.departmentFk
|
||||
WHERE
|
||||
d.created = ?
|
||||
AND d.amount > 0
|
||||
|
|
|
@ -19,6 +19,9 @@
|
|||
},
|
||||
"created": {
|
||||
"type": "date"
|
||||
},
|
||||
"workerFk": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
|
|
|
@ -74,7 +74,8 @@ module.exports = Self => {
|
|||
AND t.companyFk = ?
|
||||
AND NOT t.isDeleted
|
||||
GROUP BY IF(c.hasToInvoiceByAddress, a.id, c.id)
|
||||
HAVING SUM(t.totalWithVat) > 0;`;
|
||||
HAVING SUM(t.totalWithVat) > 0
|
||||
ORDER BY c.id`;
|
||||
|
||||
const addresses = await Self.rawSql(query, [
|
||||
minShipped,
|
||||
|
|
|
@ -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;
|
||||
|
@ -91,6 +90,11 @@ module.exports = Self => {
|
|||
arg: 'landed',
|
||||
type: 'date',
|
||||
description: 'The landed date'
|
||||
},
|
||||
{
|
||||
arg: 'awbFk',
|
||||
type: 'number',
|
||||
description: 'The awbFk id'
|
||||
}
|
||||
],
|
||||
returns: {
|
||||
|
@ -168,14 +172,17 @@ module.exports = Self => {
|
|||
t.totalEntries,
|
||||
t.isRaid,
|
||||
t.daysInForward,
|
||||
t.awbFk,
|
||||
am.name agencyModeName,
|
||||
a.code awbCode,
|
||||
win.name warehouseInName,
|
||||
wout.name warehouseOutName,
|
||||
cnt.code continent
|
||||
FROM vn.travel t
|
||||
JOIN vn.agencyMode am ON am.id = t.agencyModeFk
|
||||
JOIN vn.warehouse win ON win.id = t.warehouseInFk
|
||||
JOIN vn.warehouse wout ON wout.id = t.warehouseOutFk
|
||||
FROM travel t
|
||||
JOIN agencyMode am ON am.id = t.agencyModeFk
|
||||
JOIN warehouse win ON win.id = t.warehouseInFk
|
||||
JOIN warehouse wout ON wout.id = t.warehouseOutFk
|
||||
LEFT JOIN awb a ON a.id = t.awbFk
|
||||
JOIN warehouse wo ON wo.id = t.warehouseOutFk
|
||||
JOIN country c ON c.id = wo.countryFk
|
||||
LEFT JOIN continent cnt ON cnt.id = c.continentFk) AS t`
|
||||
|
|
Loading…
Reference in New Issue