7226-testToMaster_2416 #2320
|
@ -10,3 +10,4 @@ print.*.json
|
|||
db.json
|
||||
junit.xml
|
||||
.DS_Store
|
||||
storage
|
|
@ -30,7 +30,7 @@ module.exports = Self => {
|
|||
path: `/:id/downloadFile`,
|
||||
verb: 'GET'
|
||||
},
|
||||
accessScopes: ['read:multimedia']
|
||||
// accessScopes: ['read:multimedia']
|
||||
});
|
||||
|
||||
Self.downloadFile = async function(ctx, id) {
|
||||
|
|
|
@ -43,7 +43,7 @@ module.exports = Self => {
|
|||
path: `/:id/download`,
|
||||
verb: 'GET'
|
||||
},
|
||||
accessScopes: ['read:multimedia']
|
||||
// accessScopes: ['read:multimedia']
|
||||
});
|
||||
|
||||
Self.download = async function(id, fileCabinet, filter) {
|
||||
|
|
|
@ -48,7 +48,7 @@ module.exports = Self => {
|
|||
path: `/:collection/:size/:id/download`,
|
||||
verb: 'GET'
|
||||
},
|
||||
accessScopes: ['read:multimedia']
|
||||
// accessScopes: ['read:multimedia']
|
||||
});
|
||||
|
||||
Self.download = async function(ctx, collection, size, id) {
|
||||
|
|
|
@ -7,9 +7,8 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `vn`.`clientsDisable`
|
|||
DO BEGIN
|
||||
UPDATE account.user u
|
||||
JOIN client c ON c.id = u.id
|
||||
JOIN clientType ct ON ct.id = c.typeFk
|
||||
SET u.active = FALSE
|
||||
WHERE ct.code = 'normal'
|
||||
WHERE c.typeFk = 'normal'
|
||||
AND u.id NOT IN (
|
||||
SELECT DISTINCT c.id
|
||||
FROM client c
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
DELIMITER $$
|
||||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`collection_assign`(
|
||||
vUserFk INT,
|
||||
OUT vCollectionFk INT
|
||||
)
|
||||
)
|
||||
proc:BEGIN
|
||||
/**
|
||||
* Comprueba si existen colecciones libres que se ajustan
|
||||
|
@ -15,6 +15,13 @@ proc:BEGIN
|
|||
DECLARE vHasTooMuchCollections BOOL;
|
||||
DECLARE vLockTime INT DEFAULT 15;
|
||||
|
||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||
BEGIN
|
||||
DO RELEASE_LOCK('collection_assign');
|
||||
|
||||
RESIGNAL;
|
||||
END;
|
||||
|
||||
-- Si hay colecciones sin terminar, sale del proceso
|
||||
CALL collection_get(vUserFk);
|
||||
|
||||
|
@ -84,5 +91,5 @@ proc:BEGIN
|
|||
WHERE id = vCollectionFk;
|
||||
|
||||
DO RELEASE_LOCK('collection_assign');
|
||||
END$$
|
||||
DELIMITER ;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -219,9 +219,11 @@ proc:BEGIN
|
|||
UPDATE tmp.productionBuffer pb
|
||||
JOIN (
|
||||
SELECT SUM(litros) liters,
|
||||
@lines:= COUNT(*) + @lines `lines`,
|
||||
@lines:= COUNT(*) + @lines,
|
||||
COUNT(*) `lines`,
|
||||
MAX(i.`size`) height,
|
||||
@volume := SUM(sv.volume) + @volume volume
|
||||
@volume := SUM(sv.volume) + @volume,
|
||||
SUM(sv.volume) volume
|
||||
FROM saleVolume sv
|
||||
JOIN sale s ON s.id = sv.saleFk
|
||||
JOIN item i ON i.id = s.itemFk
|
||||
|
|
|
@ -33,6 +33,7 @@ BEGIN
|
|||
ii.operated = IFNULL(ii.operated,d.operated),
|
||||
ii.issued = IFNULL(ii.issued,d.issued),
|
||||
ii.bookEntried = IFNULL(ii.bookEntried,d.bookEntried),
|
||||
e.isBooked = TRUE,
|
||||
e.isConfirmed = TRUE
|
||||
WHERE d.id = vDuaFk;
|
||||
|
||||
|
|
|
@ -60,7 +60,11 @@ BEGIN
|
|||
(i.value8 <=> its.value8) match8,
|
||||
a.available,
|
||||
IFNULL(ip.counter, 0) `counter`,
|
||||
IF(b.groupingMode = 1, b.grouping, b.packing) minQuantity,
|
||||
CASE
|
||||
WHEN b.groupingMode = 1 THEN b.grouping
|
||||
WHEN b.groupingMode = 2 THEN b.packing
|
||||
ELSE 1
|
||||
END AS minQuantity,
|
||||
iss.visible located
|
||||
FROM vn.item i
|
||||
JOIN cache.available a ON a.item_id = i.id
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
DELIMITER $$
|
||||
$$
|
||||
CREATE OR REPLACE PROCEDURE vn.sale_boxPickingPrint(
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE vn.sale_boxPickingPrint(
|
||||
IN vPrinterFk INT,
|
||||
IN vSaleFk INT,
|
||||
IN vPacking INT,
|
||||
IN vSectorFk INT,
|
||||
IN vUserFk INT,
|
||||
IN vPackagingFk INT,
|
||||
IN vPackagingFk VARCHAR(10),
|
||||
IN vPackingSiteFk INT)
|
||||
BEGIN
|
||||
/** Splits a line of sale to a different ticket and prints the transport sticker
|
||||
|
@ -61,6 +61,8 @@ BEGIN
|
|||
|
||||
w1: WHILE vQuantity >= vPacking DO
|
||||
|
||||
SET vQuantity = vQuantity - vPacking;
|
||||
|
||||
SET vItemShelvingFk = NULL;
|
||||
|
||||
SELECT sub.id
|
||||
|
@ -191,7 +193,7 @@ w1: WHILE vQuantity >= vPacking DO
|
|||
ELSE
|
||||
UPDATE itemShelvingSale
|
||||
SET saleFk = vNewSaleFk
|
||||
WHERE id = vItemShelvingSaleFk;
|
||||
WHERE id = vItemShelvingSaleFk;
|
||||
END IF;
|
||||
ELSE
|
||||
INSERT INTO sale(ticketFk, itemFk, concept, quantity, discount, price)
|
||||
|
@ -209,6 +211,7 @@ w1: WHILE vQuantity >= vPacking DO
|
|||
UPDATE itemShelvingSale
|
||||
SET saleFk = vNewSaleFk
|
||||
WHERE id = vItemShelvingSaleFk;
|
||||
|
||||
END IF;
|
||||
|
||||
INSERT IGNORE INTO saleTracking(saleFk, isChecked, workerFk, stateFk)
|
||||
|
@ -235,7 +238,7 @@ w1: WHILE vQuantity >= vPacking DO
|
|||
)
|
||||
SELECT vAgencyModeFk,
|
||||
vNewTicketFk,
|
||||
i.id,
|
||||
pc.defaultFreightItemFk,
|
||||
vUserFk,
|
||||
vPackagingFk,
|
||||
ps.code,
|
||||
|
@ -246,9 +249,8 @@ w1: WHILE vQuantity >= vPacking DO
|
|||
NOW()
|
||||
FROM packingSite ps
|
||||
JOIN host h ON h.id = ps.hostFk
|
||||
JOIN item i ON i.name = 'Shipping cost'
|
||||
WHERE ps.id = vPackingSiteFk
|
||||
LIMIT 1;
|
||||
JOIN productionConfig pc
|
||||
WHERE ps.id = vPackingSiteFk;
|
||||
|
||||
SET vExpeditionFk = LAST_INSERT_ID();
|
||||
|
||||
|
@ -277,6 +279,7 @@ w1: WHILE vQuantity >= vPacking DO
|
|||
DELETE FROM sale
|
||||
WHERE quantity = 0
|
||||
AND id = vSaleFk;
|
||||
|
||||
END WHILE;
|
||||
|
||||
END$$
|
|
@ -0,0 +1,2 @@
|
|||
-- Place your SQL code here
|
||||
ALTER TABLE vn.productionConfig ADD defaultFreightItemFk INT UNSIGNED DEFAULT 71 NOT NULL COMMENT 'Default value for expedition table';
|
|
@ -0,0 +1 @@
|
|||
CREATE INDEX expeditionLog_action_IDX USING BTREE ON srt.expeditionLog (`action`);
|
|
@ -0,0 +1 @@
|
|||
CREATE INDEX expeditionLog_expeditionFk_IDX USING BTREE ON srt.expeditionLog (expeditionFk);
|
|
@ -59,7 +59,8 @@ export default class Token {
|
|||
|
||||
getStorage(storage) {
|
||||
this.token = storage.getItem('vnToken');
|
||||
this.tokenMultimedia = storage.getItem('vnTokenMultimedia');
|
||||
// Cambio realizado temporalmente
|
||||
this.tokenMultimedia = this.token; // storage.getItem('vnTokenMultimedia');
|
||||
if (!this.token) return;
|
||||
const created = storage.getItem('vnTokenCreated');
|
||||
this.created = created && new Date(created);
|
||||
|
|
|
@ -117,6 +117,21 @@
|
|||
"video/mp4"
|
||||
]
|
||||
},
|
||||
"supplierStorage": {
|
||||
"name": "supplierStorage",
|
||||
"connector": "loopback-component-storage",
|
||||
"provider": "filesystem",
|
||||
"root": "./storage/dms",
|
||||
"maxFileSize": "31457280",
|
||||
"allowedContentTypes": [
|
||||
"image/png",
|
||||
"image/jpeg",
|
||||
"image/jpg",
|
||||
"image/webp",
|
||||
"video/mp4",
|
||||
"application/pdf"
|
||||
]
|
||||
},
|
||||
"accessStorage": {
|
||||
"name": "accessStorage",
|
||||
"connector": "loopback-component-storage",
|
||||
|
|
|
@ -35,7 +35,7 @@ module.exports = Self => {
|
|||
path: '/:id/claim-pickup-pdf',
|
||||
verb: 'GET'
|
||||
},
|
||||
accessScopes: ['read:multimedia']
|
||||
//accessScopes: ['read:multimedia']
|
||||
});
|
||||
|
||||
Self.claimPickupPdf = (ctx, id) => Self.printReport(ctx, id, 'claim-pickup-order');
|
||||
|
|
|
@ -33,7 +33,7 @@ module.exports = Self => {
|
|||
path: `/:id/downloadFile`,
|
||||
verb: 'GET'
|
||||
},
|
||||
accessScopes: ['read:multimedia']
|
||||
//accessScopes: ['read:multimedia']
|
||||
});
|
||||
|
||||
Self.downloadFile = async function(ctx, id) {
|
||||
|
|
|
@ -96,9 +96,9 @@ module.exports = Self => {
|
|||
// When claimState has been changed
|
||||
if (args.claimStateFk) {
|
||||
const newState = await models.ClaimState.findById(args.claimStateFk, null, myOptions);
|
||||
await notifyStateChange(ctx, salesPerson.id, claim, newState.code);
|
||||
await notifyStateChange(ctx, salesPerson.id, claim, newState.description);
|
||||
if (newState.code == 'canceled')
|
||||
await notifyStateChange(ctx, claim.workerFk, claim, newState.code);
|
||||
await notifyStateChange(ctx, claim.workerFk, claim, newState.description);
|
||||
}
|
||||
|
||||
if (tx) await tx.commit();
|
||||
|
|
|
@ -46,7 +46,7 @@ module.exports = Self => {
|
|||
path: '/:id/campaign-metrics-pdf',
|
||||
verb: 'GET'
|
||||
},
|
||||
accessScopes: ['read:multimedia']
|
||||
//accessScopes: ['read:multimedia']
|
||||
});
|
||||
|
||||
Self.campaignMetricsPdf = (ctx, id) => Self.printReport(ctx, id, 'campaign-metrics');
|
||||
|
|
|
@ -34,7 +34,7 @@ module.exports = Self => {
|
|||
path: '/:id/entry-order-pdf',
|
||||
verb: 'GET'
|
||||
},
|
||||
accessScopes: ['read:multimedia']
|
||||
//accessScopes: ['read:multimedia']
|
||||
});
|
||||
|
||||
Self.entryOrderPdf = (ctx, id) => Self.printReport(ctx, id, 'entry-order');
|
||||
|
|
|
@ -32,7 +32,7 @@ module.exports = Self => {
|
|||
path: '/:id/download',
|
||||
verb: 'GET'
|
||||
},
|
||||
accessScopes: ['read:multimedia']
|
||||
// accessScopes: ['read:multimedia']
|
||||
});
|
||||
|
||||
Self.download = async function(ctx, id, options) {
|
||||
|
|
|
@ -32,7 +32,7 @@ module.exports = Self => {
|
|||
path: '/downloadZip',
|
||||
verb: 'GET'
|
||||
},
|
||||
accessScopes: ['read:multimedia']
|
||||
// accessScopes: ['read:multimedia']
|
||||
});
|
||||
|
||||
Self.downloadZip = async function(ctx, ids, options) {
|
||||
|
|
|
@ -35,7 +35,7 @@ module.exports = Self => {
|
|||
path: '/:reference/exportation-pdf',
|
||||
verb: 'GET'
|
||||
},
|
||||
accessScopes: ['read:multimedia']
|
||||
// accessScopes: ['read:multimedia']
|
||||
});
|
||||
|
||||
Self.exportationPdf = (ctx, reference) => Self.printReport(ctx, reference, 'exportation');
|
||||
|
|
|
@ -38,7 +38,7 @@ module.exports = Self => {
|
|||
path: '/:reference/invoice-csv',
|
||||
verb: 'GET'
|
||||
},
|
||||
accessScopes: ['read:multimedia']
|
||||
// accessScopes: ['read:multimedia']
|
||||
});
|
||||
|
||||
Self.invoiceCsv = async reference => {
|
||||
|
|
|
@ -40,7 +40,7 @@ module.exports = Self => {
|
|||
path: '/negativeBasesCsv',
|
||||
verb: 'GET'
|
||||
},
|
||||
accessScopes: ['read:multimedia']
|
||||
// accessScopes: ['read:multimedia']
|
||||
});
|
||||
|
||||
Self.negativeBasesCsv = async(ctx, options) => {
|
||||
|
|
|
@ -11,7 +11,7 @@ module.exports = Self => {
|
|||
path: `/download`,
|
||||
verb: 'POST',
|
||||
},
|
||||
accessScopes: ['read:multimedia']
|
||||
//accessScopes: ['read:multimedia']
|
||||
});
|
||||
|
||||
Self.download = async() => {
|
||||
|
|
|
@ -30,7 +30,7 @@ module.exports = Self => {
|
|||
path: '/downloadCmrsZip',
|
||||
verb: 'GET'
|
||||
},
|
||||
accessScopes: ['read:multimedia']
|
||||
//accessScopes: ['read:multimedia']
|
||||
});
|
||||
|
||||
Self.downloadCmrsZip = async function(ctx, ids, options) {
|
||||
|
|
|
@ -30,7 +30,7 @@ module.exports = Self => {
|
|||
path: '/downloadZip',
|
||||
verb: 'GET'
|
||||
},
|
||||
accessScopes: ['read:multimedia']
|
||||
//accessScopes: ['read:multimedia']
|
||||
});
|
||||
|
||||
Self.downloadZip = async function(ctx, id, options) {
|
||||
|
|
|
@ -35,7 +35,7 @@ module.exports = Self => {
|
|||
path: '/:id/driver-route-pdf',
|
||||
verb: 'GET'
|
||||
},
|
||||
accessScopes: ['read:multimedia']
|
||||
//accessScopes: ['read:multimedia']
|
||||
|
||||
});
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ module.exports = Self => {
|
|||
path: '/:id/campaign-metrics-pdf',
|
||||
verb: 'GET'
|
||||
},
|
||||
accessScopes: ['read:multimedia']
|
||||
// accessScopes: ['read:multimedia']
|
||||
});
|
||||
|
||||
Self.campaignMetricsPdf = (ctx, id) => Self.printReport(ctx, id, 'supplier-campaign-metrics');
|
||||
|
|
|
@ -8,6 +8,9 @@
|
|||
"SupplierDms": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"SupplierContainer": {
|
||||
"dataSource": "supplierStorage"
|
||||
},
|
||||
"SupplierAddress": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
|
|
|
@ -35,6 +35,6 @@ module.exports = Self => {
|
|||
WHERE tc.ticketFk = ? AND s.order < s2.id
|
||||
LIMIT 1;`,
|
||||
[ticketFk], myOptions);
|
||||
return result.length > 0 && result[0]['ticketFk'] > 0;
|
||||
return result[0]?.ticketFk > 0 && result[0].ticketFk;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -27,7 +27,7 @@ describe('ticketCollection hasUncheckedTicket()', () => {
|
|||
}, myOptions);
|
||||
const result = await models.TicketCollection.hasUncheckedTicket(ticketFk, myOptions);
|
||||
|
||||
expect(result).toBe(true);
|
||||
expect(result).toBeTruthy();
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
await tx.rollback();
|
||||
|
|
|
@ -147,6 +147,10 @@ module.exports = async function(ctx, Self, tickets, reqArgs = {}) {
|
|||
);
|
||||
}
|
||||
} catch (error) {
|
||||
await Self.rawSql(`
|
||||
INSERT INTO util.debug (variable, value)
|
||||
VALUES ('invoicingTicketError', ?)
|
||||
`, [ticket.id + ' - ' + error]);
|
||||
// Domain not found
|
||||
if (error.responseCode == 450) return invalidEmail(ticket);
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ module.exports = Self => {
|
|||
path: '/:id/delivery-note-csv',
|
||||
verb: 'GET'
|
||||
},
|
||||
accessScopes: ['read:multimedia']
|
||||
//accessScopes: ['read:multimedia']
|
||||
});
|
||||
|
||||
Self.deliveryNoteCsv = async id => {
|
||||
|
|
|
@ -42,7 +42,7 @@ module.exports = Self => {
|
|||
path: '/:id/delivery-note-pdf',
|
||||
verb: 'GET'
|
||||
},
|
||||
accessScopes: ['read:multimedia']
|
||||
//accessScopes: ['read:multimedia']
|
||||
});
|
||||
|
||||
Self.deliveryNotePdf = (ctx, id) => Self.printReport(ctx, id, 'delivery-note');
|
||||
|
|
|
@ -79,7 +79,7 @@ module.exports = Self => {
|
|||
path: '/extra-community-pdf',
|
||||
verb: 'GET'
|
||||
},
|
||||
accessScopes: ['read:multimedia']
|
||||
//accessScopes: ['read:multimedia']
|
||||
});
|
||||
|
||||
Self.extraCommunityPdf = ctx => Self.printReport(ctx, null, 'extra-community');
|
||||
|
|
|
@ -30,7 +30,7 @@ module.exports = Self => {
|
|||
path: `/:id/downloadFile`,
|
||||
verb: 'GET'
|
||||
},
|
||||
accessScopes: ['read:multimedia']
|
||||
//accessScopes: ['read:multimedia']
|
||||
});
|
||||
|
||||
Self.downloadFile = async function(ctx, id) {
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="zone in zoneCollisions">
|
||||
<tr v-for="zone in zones" v-bind:key="zone.zoneFk">
|
||||
<td>{{ zone.zn.name }}</td>
|
||||
<td>{{ zone.zoneFk }}</td>
|
||||
<td>{{ zone.z.price }}</td>
|
||||
|
|
|
@ -8,5 +8,10 @@ module.exports = {
|
|||
},
|
||||
props: {
|
||||
zoneCollisions: {type: Array, required: true}
|
||||
},
|
||||
computed: {
|
||||
zones() {
|
||||
return JSON.parse(this.zoneCollisions);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
td{
|
||||
overflow: hidden;
|
||||
max-width: 100px;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
h1 {
|
||||
text-align: center;
|
||||
}
|
||||
|
|
|
@ -1,19 +1,18 @@
|
|||
SELECT
|
||||
r.id,
|
||||
r.m3,
|
||||
r.created,
|
||||
r.time,
|
||||
u.nickName userNickName,
|
||||
v.tradeMark vehicleTradeMark,
|
||||
v.model vehicleModel,
|
||||
v.numberPlate plateNumber,
|
||||
IFNULL(s.name, am.name) AS 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.id
|
||||
LEFT JOIN agencyMode am ON am.id = r.agencyModeFk
|
||||
LEFT JOIN agency a ON a.id = am.agencyFk
|
||||
LEFT JOIN supplierAgencyTerm sa ON sa.agencyFk = a.id
|
||||
LEFT JOIN supplier s ON s.id = sa.supplierFk
|
||||
WHERE r.id IN(?)
|
||||
SELECT r.id,
|
||||
r.m3,
|
||||
r.created,
|
||||
r.time,
|
||||
u.nickName userNickName,
|
||||
v.tradeMark vehicleTradeMark,
|
||||
v.model vehicleModel,
|
||||
v.numberPlate plateNumber,
|
||||
IFNULL(s.name, 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.id
|
||||
LEFT JOIN agencyMode am ON am.id = r.agencyModeFk
|
||||
LEFT JOIN agency a ON a.id = am.agencyFk
|
||||
LEFT JOIN supplierAgencyTerm sa ON sa.agencyFk = a.id
|
||||
LEFT JOIN supplier s ON s.id = sa.supplierFk
|
||||
WHERE r.id IN(?)
|
||||
|
|
|
@ -1,43 +1,42 @@
|
|||
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,
|
||||
u.nickName salesPersonName,
|
||||
ipkg.itemPackingTypes
|
||||
FROM route r
|
||||
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.id
|
||||
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 (
|
||||
SELECT t.id AS ticketFk,
|
||||
GROUP_CONCAT(DISTINCT(i.itemPackingTypeFk)) AS itemPackingTypes
|
||||
FROM route r
|
||||
JOIN ticket t ON t.routeFk = r.id
|
||||
JOIN sale s ON s.ticketFk = t.id
|
||||
JOIN item i ON i.id = s.itemFk
|
||||
WHERE r.id IN (?)
|
||||
GROUP BY t.id
|
||||
) ipkg ON ipkg.ticketFk = t.id
|
||||
WHERE r.id IN (?)
|
||||
ORDER BY t.priority, t.id;
|
||||
SELECT t.nickname addressName,
|
||||
t.packages,
|
||||
t.priority,
|
||||
t.id,
|
||||
t.clientFk,
|
||||
t.companyFk,
|
||||
t.routeFk,
|
||||
if(a.phone, a.phone, c.phone) phone,
|
||||
if(a.mobile, a.mobile, c.mobile) mobile,
|
||||
wh.name warehouseName,
|
||||
a.city,
|
||||
a.street,
|
||||
a.postalCode,
|
||||
LPAD(a.id, 5, '0') addressFk,
|
||||
p.name province,
|
||||
0 import,
|
||||
am.name ticketAgency,
|
||||
tob.description,
|
||||
u.nickName salesPersonName,
|
||||
ipkg.itemPackingTypes
|
||||
FROM route r
|
||||
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.id
|
||||
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 (
|
||||
SELECT t.id AS ticketFk,
|
||||
GROUP_CONCAT(DISTINCT(i.itemPackingTypeFk)) AS itemPackingTypes
|
||||
FROM route r
|
||||
JOIN ticket t ON t.routeFk = r.id
|
||||
JOIN sale s ON s.ticketFk = t.id
|
||||
JOIN item i ON i.id = s.itemFk
|
||||
WHERE r.id IN (?)
|
||||
GROUP BY t.id
|
||||
) ipkg ON ipkg.ticketFk = t.id
|
||||
WHERE r.id IN (?)
|
||||
ORDER BY t.priority, t.id;
|
Loading…
Reference in New Issue