7152-devToTest_2414 #2228

Merged
alexm merged 636 commits from 7152-devToTest_2414 into test 2024-03-28 08:26:34 +00:00
41 changed files with 376 additions and 191 deletions
Showing only changes of commit 54192c54ad - Show all commits

View File

@ -35,10 +35,17 @@ module.exports = Self => {
let html = `<strong>Motivo</strong>:<br/>${reason}<br/>`;
html += `<strong>Usuario</strong>:<br/>${ctx.req.accessToken.userId} ${emailUser.email}<br/>`;
delete additionalData.backError.config.headers.Authorization;
const httpRequest = JSON.parse(additionalData?.httpRequest);
if (httpRequest)
delete httpRequest.config.headers.Authorization;
additionalData.httpRequest = httpRequest;
for (const data in additionalData)
html += `<strong>${data}</strong>:<br/>${tryParse(additionalData[data])}<br/>`;
const subjectReason = JSON.parse(additionalData?.httpRequest)?.data?.error;
const subjectReason = httpRequest?.data?.error;
smtp.send({
to: `${config.app.reportEmail}, ${emailUser.email}`,
subject:

View File

@ -1 +0,0 @@
DELETE FROM `account`.`signInLog` where owner <> FALSE

View File

@ -0,0 +1,2 @@
DELETE FROM `account`.`signInLog` where owner <> FALSE;

View File

View File

@ -0,0 +1,14 @@
DELETE FROM salix.ACL
WHERE model = 'WorkerTimeControl'
AND property IN ('*','addTime');
INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId)
VALUES
('WorkerTimeControl', 'addTimeEntry', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
('WorkerTimeControl', 'deleteTimeEntry', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
('WorkerTimeControl', 'updateTimeEntry', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
('WorkerTimeControl', 'sendMail', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
('WorkerTimeControl', 'updateWorkerTimeControlMail', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
('WorkerTimeControl', 'weeklyHourRecordEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
('WorkerTimeControl', 'getMailStates', 'READ', 'ALLOW', 'ROLE', 'employee'),
('WorkerTimeControl', 'resendWeeklyHourEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee');

View File

@ -0,0 +1 @@
ALTER TABLE `vn`.`item` DROP COLUMN stars;

View File

@ -0,0 +1,74 @@
DELIMITER $$
$$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_canbePostponed`(vOriginDated DATE, vFutureDated DATE, vWarehouseFk INT)
BEGIN
/**
* Devuelve un listado de tickets susceptibles de fusionarse con otros tickets en el futuro
*
* @param vOriginDated Fecha en cuestión
* @param vFutureDated Fecha en el futuro a sondear
* @param vWarehouseFk Identificador de vn.warehouse
*/
CREATE OR REPLACE TEMPORARY TABLE tmp.filter
(INDEX (id))
SELECT sv.ticketFk id,
sub2.id futureId,
GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) ipt,
CAST(sum(litros) AS DECIMAL(10,0)) liters,
CAST(count(*) AS DECIMAL(10,0)) `lines`,
st.name state,
sub2.iptd futureIpt,
sub2.state futureState,
t.clientFk,
t.warehouseFk,
ts.alertLevel,
t.shipped,
t.totalWithVat,
sub2.shipped futureShipped,
t.workerFk,
st.code stateCode,
sub2.code futureStateCode,
st.classColor,
sub2.classColor futureClassColor
FROM vn.saleVolume sv
JOIN vn.sale s ON s.id = sv.saleFk
JOIN vn.item i ON i.id = s.itemFk
JOIN vn.ticket t ON t.id = sv.ticketFk
JOIN vn.address a ON a.id = t.addressFk
JOIN vn.province p ON p.id = a.provinceFk
JOIN vn.country c ON c.id = p.countryFk
JOIN vn.ticketState ts ON ts.ticketFk = t.id
JOIN vn.state st ON st.id = ts.stateFk
JOIN vn.alertLevel al ON al.id = ts.alertLevel
LEFT JOIN vn.ticketParking tp ON tp.ticketFk = t.id
LEFT JOIN (
SELECT *
FROM (
SELECT
t.addressFk,
t.id,
t.shipped,
st.name state,
st.code,
st.classColor,
GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) iptd
FROM vn.ticket t
JOIN vn.ticketState ts ON ts.ticketFk = t.id
JOIN vn.state st ON st.id = ts.stateFk
JOIN vn.sale s ON s.ticketFk = t.id
JOIN vn.item i ON i.id = s.itemFk
WHERE t.shipped BETWEEN vFutureDated
AND util.dayend(vFutureDated)
AND t.warehouseFk = vWarehouseFk
GROUP BY t.id
) sub
GROUP BY sub.addressFk
) sub2 ON sub2.addressFk = t.addressFk AND t.id != sub2.id
WHERE t.shipped BETWEEN vOriginDated AND util.dayend(vOriginDated)
AND t.warehouseFk = vWarehouseFk
AND al.code = 'FREE'
AND tp.ticketFk IS NULL
GROUP BY sv.ticketFk
HAVING futureId;
END$$
DELIMITER ;

View File

@ -0,0 +1,2 @@
ALTER TABLE vn.productionConfig ADD itemPreviousDefaultSize int NULL COMMENT 'Altura por defecto para los artículos de previa';
UPDATE IGNORE vn.productionConfig SET itemPreviousDefaultSize = 40 WHERE id = 1;

View File

@ -0,0 +1,2 @@
ALTER TABLE vn.invoiceOutConfig
ADD IF NOT EXISTS refLen TINYINT UNSIGNED DEFAULT 5 NOT NULL COMMENT 'Invoice reference identifier length';

View File

@ -4,17 +4,20 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`invoiceOut_beforeInse
FOR EACH ROW
BEGIN
/**
* Generates the next reference for the invoice serial. There cannot be gaps
* between identifiers of the same serial!
*
* Reference format:
* - 0: Serial [A-Z]
* - 1: Sage company id
* - 2-3: Last two digits of issued year
* - 4-8: Autoincrement identifier
**/
DECLARE vNewRef INT DEFAULT 0;
DECLARE vCompanyCode INT;
* {0} Invoice serial
* {1} The company code
* {2-3} Last two digits of issue year
* {4-$} Autoincrement identifier
*/
DECLARE vRef INT DEFAULT 0;
DECLARE vRefLen INT;
DECLARE vRefPrefix VARCHAR(255);
DECLARE vLastRef VARCHAR(255);
DECLARE vRefStr VARCHAR(255);
DECLARE vRefLen INT DEFAULT 5;
DECLARE vCompanyCode INT;
DECLARE vYearLen INT DEFAULT 2;
DECLARE vPrefixLen INT;
@ -23,36 +26,34 @@ BEGIN
WHERE id = NEW.companyFk;
IF vCompanyCode IS NULL THEN
CALL util.throw('sageCompanyNotDefined');
CALL util.throw('companyCodeNotDefined');
END IF;
SELECT MAX(i.ref) INTO vLastRef
FROM invoiceOut i
WHERE i.serial = NEW.serial
AND i.issued BETWEEN util.firstDayOfYear(NEW.issued) AND util.dayEnd(util.lastDayOfYear(NEW.issued))
AND i.issued BETWEEN util.firstDayOfYear(NEW.issued) AND util.lastDayOfYear(NEW.issued)
AND i.companyFk = NEW.companyFk;
IF vLastRef IS NOT NULL THEN
SET vPrefixLen = LENGTH(NEW.serial) + LENGTH(vCompanyCode) + vYearLen;
SET vRefLen = LENGTH(vLastRef) - vPrefixLen;
SET vRefStr = SUBSTRING(vLastRef, vPrefixLen + 1);
SET vNewRef = vRefStr + 1;
IF LENGTH(vNewRef) > vRefLen THEN
CALL util.throw('refLenExceeded');
END IF;
SET NEW.ref = CONCAT(
SUBSTRING(vLastRef, 1, vPrefixLen),
LPAD(vNewRef, LENGTH(vRefStr), '0')
);
SET vRefPrefix = LEFT(vLastRef, vPrefixLen);
SET vRef = RIGHT(vLastRef, vRefLen);
ELSE
SET NEW.ref = CONCAT(
SELECT refLen INTO vRefLen FROM invoiceOutConfig;
SET vRefPrefix = CONCAT(
NEW.serial,
vCompanyCode,
RIGHT(YEAR(NEW.issued), vYearLen),
LPAD(1, vRefLen, '0')
RIGHT(YEAR(NEW.issued), vYearLen)
);
END IF;
SET vRef = vRef + 1;
IF LENGTH(vRef) > vRefLen THEN
CALL util.throw('refIdLenExceeded');
END IF;
SET NEW.ref = CONCAT(vRefPrefix, LPAD(vRef, vRefLen, '0'));
END$$
DELIMITER ;

View File

@ -600,6 +600,9 @@ INSERT INTO `vn`.`taxArea` (`code`, `claveOperacionFactura`, `CodigoTransaccion`
('NATIONAL', 0, 1),
('WORLD', 2, 15);
INSERT INTO vn.invoiceOutConfig
SET parallelism = 8;
INSERT INTO `vn`.`invoiceOutSerial` (`code`, `description`, `isTaxed`, `taxAreaFk`, `isCEE`, `type`)
VALUES
('A', 'Global nacional', 1, 'NATIONAL', 0, 'global'),
@ -623,9 +626,6 @@ UPDATE `vn`.`invoiceOut` SET ref = 'T3333333' WHERE id = 3;
UPDATE `vn`.`invoiceOut` SET ref = 'T4444444' WHERE id = 4;
UPDATE `vn`.`invoiceOut` SET ref = 'A1111111' WHERE id = 5;
INSERT INTO vn.invoiceOutConfig
SET parallelism = 8;
INSERT INTO `vn`.`invoiceOutTax` (`invoiceOutFk`, `taxableBase`, `vat`, `pgcFk`)
VALUES
(1, 895.76, 89.58, 4722000010),
@ -929,25 +929,25 @@ INSERT INTO `vn`.`itemFamily`(`code`, `description`)
('VT', 'Sales');
INSERT INTO `vn`.`item`(`id`, `typeFk`, `stems`, `originFk`, `description`, `producerFk`, `intrastatFk`, `expenseFk`,
`comment`, `relevancy`, `image`, `subName`, `minPrice`, `stars`, `family`, `isFloramondo`, `genericFk`, `itemPackingTypeFk`, `hasMinPrice`, `packingShelve`, `weightByPiece`)
`comment`, `relevancy`, `image`, `subName`, `minPrice`, `family`, `isFloramondo`, `genericFk`, `itemPackingTypeFk`, `hasMinPrice`, `packingShelve`, `weightByPiece`)
VALUES
(1, 2, 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '1', NULL, 0, 1, 'EMB', 0, NULL, 'V', 0, 15,3),
(2, 2, 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '2', NULL, 0, 2, 'VT', 0, NULL, 'H', 0, 10,2),
(3, 1, 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '3', NULL, 0, 5, 'VT', 0, NULL, NULL, 0, 5,5),
(4, 1, 1, 1, 'Increases block', 1, 05080000, 4751000000, NULL, 0, '4', NULL, 0, 3, 'VT', 0, NULL, NULL, 0, NULL,NULL),
(5, 3, 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '5', NULL, 0, 3, 'VT', 0, NULL, NULL, 0, NULL,NULL),
(6, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '6', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL,NULL),
(7, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '7', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL,NULL),
(8, 2, 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '8', NULL, 0, 5, 'VT', 0, NULL, NULL, 0, NULL,NULL),
(9, 2, 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '9', NULL, 0, 4, 'VT', 1, NULL, NULL, 0, NULL,NULL),
(10, 1, 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '10', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL,NULL),
(11, 1, 1, 1, NULL, 1, 05080000, 4751000000, NULL, 0, '11', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL,NULL),
(12, 3, 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '12', NULL, 0, 3, 'VT', 0, NULL, NULL, 0, NULL,NULL),
(13, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '13', NULL, 1, 2, 'VT', 1, NULL, NULL, 1, NULL,NULL),
(14, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 4, 'VT', 1, NULL, NULL, 0, NULL,NULL),
(15, 4, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB', 0, NULL, NULL, 0, NULL,NULL),
(16, 6, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB', 0, NULL, NULL, 0, NULL,NULL),
(71, 6, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL);
(1, 2, 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '1', NULL, 0, 'EMB', 0, NULL, 'V', 0, 15,3),
(2, 2, 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '2', NULL, 0, 'VT', 0, NULL, 'H', 0, 10,2),
(3, 1, 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '3', NULL, 0, 'VT', 0, NULL, NULL, 0, 5,5),
(4, 1, 1, 1, 'Increases block', 1, 05080000, 4751000000, NULL, 0, '4', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL),
(5, 3, 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '5', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL),
(6, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '6', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL),
(7, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '7', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL),
(8, 2, 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '8', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL),
(9, 2, 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '9', NULL, 0, 'VT', 1, NULL, NULL, 0, NULL,NULL),
(10, 1, 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '10', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL),
(11, 1, 1, 1, NULL, 1, 05080000, 4751000000, NULL, 0, '11', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL),
(12, 3, 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '12', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL),
(13, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '13', NULL, 1, 'VT', 1, NULL, NULL, 1, NULL,NULL),
(14, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 'VT', 1, NULL, NULL, 0, NULL,NULL),
(15, 4, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 'EMB', 0, NULL, NULL, 0, NULL,NULL),
(16, 6, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 'EMB', 0, NULL, NULL, 0, NULL,NULL),
(71, 6, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL);
-- Update the taxClass after insert of the items
UPDATE `vn`.`itemTaxCountry` SET `taxClassFk` = 2

View File

@ -735,7 +735,7 @@ export default {
},
createStateView: {
state: 'vn-autocomplete[ng-model="$ctrl.stateFk"]',
worker: 'vn-worker-autocomplete[ng-model="$ctrl.workerFk"]',
worker: 'vn-worker-autocomplete[ng-model="$ctrl.userFk"]',
saveStateButton: `button[type=submit]`
},
claimsIndex: {

View File

@ -203,5 +203,6 @@
"Cannot past travels with entries": "Cannot past travels with entries",
"The notification subscription of this worker cant be modified": "The notification subscription of this worker cant be modified",
"It was not able to remove the next expeditions:": "It was not able to remove the next expeditions: {{expeditions}}",
"Incorrect pin": "Incorrect pin."
"Incorrect pin": "Incorrect pin.",
"The notification subscription of this worker cant be modified": "The notification subscription of this worker cant be modified"
}

View File

@ -112,7 +112,6 @@ module.exports = Self => {
i.value7,
i.tag8,
i.value8,
i.stars,
tci.price,
tci.available,
w.lastName,

View File

@ -37,11 +37,6 @@
value="{{::item.value7}}">
</vn-label-value>
</div>
<vn-horizontal>
<vn-one>
<vn-rating ng-if="::item.stars"
ng-model="::item.stars"/>
</vn-one>
<vn-horizontal
class="text-right text-caption alert vn-mr-xs"
ng-if="::item.minQuantity">
@ -54,7 +49,6 @@
</vn-one>
{{::item.minQuantity}}
</vn-horizontal>
</vn-horizontal>
<div class="footer">
<div class="price">
<vn-one>

View File

@ -17,18 +17,3 @@ columns:
agencyModeFk: agency
routeFk: route
zoneFk: zone
name: name
beachFk: beach
ticketPacked: tickets packed
ticketFree: tickets free
ticketProduction: tickets production
packages: packages
note: note
dated: dated
dockFk: dock
priority: priority
etd: etd
expeditionTruckFk: truck
m3boxes: m3 boxes
bufferFk: buffer
isPickingAllowed: is picking allowed

View File

@ -17,18 +17,3 @@ columns:
agencyModeFk: agencia
routeFk: ruta
zoneFk: zona
name: nombre
beachFk: playa
ticketPacked: tickets encajados
ticketFree: tickets libres
ticketProduction: tickets producción
packages: paquetes
note: nota
dated: fecha
dockFk: muelle
priority: prioridad
etd: etd
expeditionTruckFk: camión
m3boxes: m3 cajas
bufferFk: buffer
isPickingAllowed: está permitido recoger

View File

@ -0,0 +1,19 @@
name: routesMonitor
columns:
routeFk: route
name: name
beachFk: beach
ticketPacked: tickets packed
ticketFree: tickets free
ticketProduction: tickets production
packages: packages
note: note
dated: dated
dockFk: dock
m3: m3
priority: priority
etd: etd
expeditionTruckFk: truck
m3boxes: m3 boxes
bufferFk: buffer
isPickingAllowed: is picking allowed

View File

@ -0,0 +1,19 @@
name: monitorRutas
columns:
routeFk: ruta
name: nombre
beachFk: playa
ticketPacked: tickets encajados
ticketFree: tickets libres
ticketProduction: tickets producción
packages: paquetes
note: nota
dated: fecha
dockFk: muelle
m3: m3
priority: prioridad
etd: etd
expeditionTruckFk: camión
m3boxes: m3 cajas
bufferFk: buffer
isPickingAllowed: está permitido recoger

View File

@ -22,5 +22,8 @@
},
"Vehicle": {
"dataSource": "vn"
},
"RoutesMonitor": {
"dataSource": "vn"
}
}

View File

@ -0,0 +1,64 @@
{
"name": "RoutesMonitor",
"base": "VnModel",
"mixins": {
"Loggable": true
},
"options": {
"mysql": {
"table": "routesMonitor"
}
},
"properties": {
"routeFk": {
"type": "number",
"id": true,
"description": "Identifier"
},
"name": {
"type": "string"
},
"beachFk": {
"type": "number"
},
"ticketPacked": {
"type": "number"
},
"ticketFree": {
"type": "number"
},
"ticketProduction": {
"type": "number"
},
"packages": {
"type": "number"
},
"note": {
"type": "string"
},
"dated": {
"type": "date"
},
"dockFk": {
"type": "number"
},
"m3": {
"type": "number"
},
"priority": {
"type": "number"
},
"expeditionTruckFk": {
"type": "number"
},
"m3boxes": {
"type": "number"
},
"bufferFk": {
"type": "number"
},
"isPickingAllowed": {
"type": "boolean"
}
}
}

View File

@ -84,7 +84,7 @@ module.exports = Self => {
arg: 'filter',
type: 'object',
description: `Filter defining where, order, offset, and limit - must be a JSON-encoded string`
}
},
],
returns: {
type: ['object'],

View File

@ -61,6 +61,9 @@
<th field="liters">
<span translate>Liters</span>
</th>
<th field="totalWithVat">
<span translate>Import</span>
</th>
<th shrink field="lines">
<span translate>Available Lines</span>
</th>
@ -76,6 +79,7 @@
<th shrink field="futureState">
<span translate>State</span>
</th>
</tr>
</thead>
<tbody>
@ -148,6 +152,13 @@
</span>
</td>
<td>{{::ticket.liters}}</td>
<td>
<span
class="chip {{$ctrl.totalPriceColor(ticket.totalWithVat)}}"
title="{{$ctrl.totalPriceTitle(ticket.totalWithVat) | translate}}">
{{::(ticket.totalWithVat ? ticket.totalWithVat : 0) | currency: 'EUR': 2}}
</span>
</td>
<td>{{::ticket.lines}}</td>
<td separator>
<span

View File

@ -21,6 +21,9 @@ export default class Controller extends Section {
{
field: 'futureShipped',
searchable: false
}, {
field: 'totalWithVat',
searchable: false
},
{
field: 'state',
@ -130,6 +133,17 @@ export default class Controller extends Section {
this.vnApp.showSuccess(this.$t('Success'));
});
}
totalPriceColor(totalWithVat) {
return this.isLessThan50(totalWithVat) ? 'warning' : '';
}
totalPriceTitle(totalWithVat) {
return this.isLessThan50(totalWithVat) ? 'Less than 50€' : '';
}
isLessThan50(totalWithVat) {
return (parseInt(totalWithVat) > 0 && parseInt(totalWithVat) < 50);
}
exprBuilder(param, value) {
switch (param) {
@ -145,6 +159,8 @@ export default class Controller extends Section {
return {'ipt': {like: `%${value}%`}};
case 'futureIpt':
return {'futureIpt': {like: `%${value}%`}};
case 'totalWithVat':
return {'totalWithVat': value};
}
}
}

View File

@ -21,7 +21,7 @@
</vn-autocomplete>
<vn-worker-autocomplete
vn-one
ng-model="$ctrl.workerFk">
ng-model="$ctrl.userFk">
</vn-worker-autocomplete>
</vn-horizontal>
</vn-card>

View File

@ -17,19 +17,19 @@ class Controller extends Section {
set stateFk(value) {
this.params.stateFk = value;
this.isPickerDesignedState = this.getIsPickerDesignedState(value);
this.workerFk = window.localStorage.currentUserWorkerId;
this.userFk = window.localStorage.currentUserWorkerId;
}
get stateFk() {
return this.params.stateFk;
}
set workerFk(value) {
this.params.workerFk = value;
set userFk(value) {
this.params.userFk = value;
}
get workerFk() {
return this.params.workerFk;
get userFk() {
return this.params.userFk;
}
getPickerDesignedState() {

View File

@ -29,11 +29,11 @@ describe('Ticket', () => {
});
});
describe('workerFk setter', () => {
it('should set params.workerFk', () => {
controller.workerFk = 1;
describe('userFk setter', () => {
it('should set params.userFk', () => {
controller.userFk = 1;
expect(controller.params.workerFk).toEqual(1);
expect(controller.params.userFk).toEqual(1);
});
});

View File

@ -3,7 +3,7 @@ const UserError = require('vn-loopback/util/user-error');
module.exports = Self => {
Self.remoteMethodCtx('deleteTimeEntry', {
description: 'Deletes a manual time entry for a worker if the user role is above the worker',
accessType: 'READ',
accessType: 'WRITE',
accepts: [{
arg: 'id',
type: 'number',

View File

@ -15,7 +15,7 @@
<td id="outline" class="ellipsize">{{labelData.workerCode || '---'}}</td>
</tr>
<tr>
<td id="outline" class="ellipsize">{{labelCount || labelData.labelCount || 0}}</td>
<td id="outline" class="ellipsize">{{labelData.labelCount || 0}}</td>
</tr>
<tr>
<td id="outline" class="ellipsize">{{labelData.code == 'V' ? (labelData.size || 0) + 'cm' : (labelData.volume || 0) + 'm³'}}</td>

View File

@ -18,9 +18,9 @@ module.exports = {
}
},
async serverPrefetch() {
await this.rawSql('SET @hasPrevia := 0');
let ticketIds;
const res = await this.rawSqlFromDef('tickets', [this.id]);
if (res.length) {
ticketIds = [];
for (const row of res)

View File

@ -7,14 +7,16 @@ SELECT c.itemPackingTypeFk code,
cc.code color,
t.clientFk,
CAST(SUM(sv.volume) AS DECIMAL(5, 2)) volume,
MAX(i.`size`) `size`,
MAX(
IF(sgd.id, IFNULL(pc.itemPreviousDefaultSize, i.`size`), i.`size`)
) `size`,
w.code workerCode,
TIME_FORMAT(t.shipped, '%H:%i') shippedHour,
TIME_FORMAT(zo.`hour`, '%H:%i') zoneHour,
DATE_FORMAT(t.shipped, '%d/%m/%y') shipped,
tt.labelCount,
t.nickName,
COUNT(*) lineCount,
SUM(IF(sgd.id, IF(@hasPrevia, 0, @hasPrevia := 1), 1)) lineCount,
rm.routeFk
FROM vn.ticket t
JOIN vn.ticketCollection tc ON tc.ticketFk = t.id
@ -33,6 +35,8 @@ SELECT c.itemPackingTypeFk code,
LEFT JOIN vn.`zone` zo ON t.zoneFk = zo.id
LEFT JOIN vn.routesMonitor rm ON rm.routeFk = t.routeFk
LEFT JOIN vn.expeditionTruck et ON et.id = rm.expeditionTruckFk
LEFT JOIN vn.saleGroupDetail sgd ON sgd.saleFk = s.id
JOIN vn.productionConfig pc
WHERE t.id IN (?)
GROUP BY t.id
ORDER BY cc.`code`;
ORDER BY cc.`code`

View File

@ -7,7 +7,7 @@ module.exports = {
this.invoice = await this.findOneFromDef('invoice', [this.reference]);
this.checkMainEntity(this.invoice);
this.client = await this.findOneFromDef('client', [this.reference]);
this.incoterms = await this.findOneFromDef('incoterms', [this.reference, this.reference, this.reference]);
this.incoterms = await this.findOneFromDef('incoterms', [this.reference, this.reference, this.reference, this.reference]);
},
props: {
reference: {

View File

@ -1,13 +1,12 @@
SELECT
c.id,
c.socialName,
c.street AS postalAddress,
IF (ios.taxAreaFk IS NOT NULL, CONCAT(cty.code, c.fi), c.fi) fi,
CONCAT(c.postcode, ' - ', c.city) postcodeCity
FROM vn.invoiceOut io
JOIN vn.client c ON c.id = io.clientFk
JOIN vn.country cty ON cty.id = c.countryFk
LEFT JOIN vn.invoiceOutSerial ios ON ios.code = io.serial
AND ios.taxAreaFk = 'CEE'
LEFT JOIN ticket t ON t.refFk = io.ref
WHERE t.refFk = ?
SELECT c.id,
c.socialName,
c.street postalAddress,
IF (ios.taxAreaFk IS NOT NULL, CONCAT(cty.code, c.fi), c.fi) fi,
CONCAT(c.postcode, ' - ', c.city) postcodeCity
FROM vn.invoiceOut io
JOIN vn.client c ON c.id = io.clientFk
JOIN vn.country cty ON cty.id = c.countryFk
LEFT JOIN vn.invoiceOutSerial ios ON ios.code = io.serial
AND ios.taxAreaFk = 'CEE'
LEFT JOIN ticket t ON t.refFk = io.ref
WHERE t.refFk = ?

View File

@ -1,38 +1,14 @@
SELECT io.issued,
c.socialName,
c.street postalAddress,
c.fi,
io.clientFk,
c.postcode,
c.city,
io.companyFk,
io.ref,
tc.code,
s.concept,
s.quantity,
s.price,
s.discount,
s.ticketFk,
t.shipped,
t.refFk,
a.nickname,
s.itemFk,
s.id saleFk,
pm.name AS pmname,
sa.iban,
c.phone,
MAX(t.packages) packages,
SELECT pack.packages,
a.incotermsFk,
ic.name incotermsName ,
ic.name incotermsName,
t.weight,
t.observations,
ca.fiscalName customsAgentName,
ca.street customsAgentStreet,
ca.nif customsAgentNif,
ca.phone customsAgentPhone,
ca.email customsAgentEmail,
CAST(sub2.volume AS DECIMAL (10,2)) volume,
sub3.intrastat
CAST(vol.volume AS DECIMAL (10,2)) volume,
intr.intrastat
FROM vn.invoiceOut io
JOIN vn.supplier su ON su.id = io.companyFk
JOIN vn.client c ON c.id = io.clientFk
@ -42,26 +18,35 @@ SELECT io.issued,
LEFT JOIN vn.incoterms ic ON ic.code = a.incotermsFk
LEFT JOIN vn.customsAgent ca ON ca.id = a.customsAgentFk
JOIN vn.sale s ON s.ticketFk = t.id
JOIN (SELECT SUM(volume) volume
FROM vn.invoiceOut io
JOIN vn.ticket t ON t.refFk = io.ref
JOIN vn.saleVolume sv ON sv.ticketFk = t.id
WHERE t.refFk = ?
) sub2 ON TRUE
JOIN vn.itemTaxCountry itc ON itc.countryFk = su.countryFk AND itc.itemFk = s.itemFk
JOIN (
SELECT SUM(volume) volume, COUNT(*) packages
FROM vn.invoiceOut io
JOIN vn.ticket t ON t.refFk = io.ref
JOIN vn.saleVolume sv ON sv.ticketFk = t.id
WHERE t.refFk = ?
) vol
JOIN vn.itemTaxCountry itc ON itc.countryFk = su.countryFk
AND itc.itemFk = s.itemFk
JOIN vn.taxClass tc ON tc.id = itc.taxClassFk
JOIN vn.invoiceOutSerial ios ON ios.code = io.serial AND ios.taxAreaFk = 'WORLD'
JOIN vn.invoiceOutSerial ios ON ios.code = io.serial
AND ios.taxAreaFk = 'WORLD'
JOIN vn.country cty ON cty.id = c.countryFk
JOIN vn.payMethod pm ON pm.id = c .payMethodFk
JOIN vn.company co ON co.id=io.companyFk
JOIN vn.supplierAccount sa ON sa.id=co.supplierAccountFk
LEFT JOIN (SELECT GROUP_CONCAT(DISTINCT ir.description ORDER BY ir.description SEPARATOR '. ' ) as intrastat
FROM vn.ticket t
JOIN vn.invoiceOut io ON io.ref = t.refFk
JOIN vn.sale s ON t.id = s.ticketFk
JOIN vn.item i ON i.id = s.itemFk
JOIN vn.intrastat ir ON ir.id = i.intrastatFk
WHERE t.refFk = ?
)sub3 ON TRUE
WHERE t.refFk = ?
JOIN (
SELECT GROUP_CONCAT(DISTINCT ir.description ORDER BY ir.description SEPARATOR '. ' ) intrastat
FROM vn.ticket t
JOIN vn.invoiceOut io ON io.ref = t.refFk
JOIN vn.sale s ON t.id = s.ticketFk
JOIN vn.item i ON i.id = s.itemFk
JOIN vn.intrastat ir ON ir.id = i.intrastatFk
WHERE t.refFk = ?
) intr
JOIN (
SELECT SUM(packages) packages
FROM ticket
WHERE refFk = ?
) pack
WHERE t.refFk = ?
LIMIT 1

View File

@ -1,18 +1,17 @@
SELECT
io.id,
io.issued,
io.clientFk,
io.companyFk,
io.ref,
pm.code AS payMethodCode,
cny.code companyCode,
sa.iban,
ios.footNotes
FROM invoiceOut io
JOIN client c ON c.id = io.clientFk
JOIN payMethod pm ON pm.id = c.payMethodFk
JOIN company cny ON cny.id = io.companyFk
JOIN supplierAccount sa ON sa.id = cny.supplierAccountFk
LEFT JOIN invoiceOutSerial ios ON ios.code = io.serial
LEFT JOIN ticket t ON t.refFk = io.ref
WHERE t.refFk = ?
SELECT io.id,
io.issued,
io.clientFk,
io.companyFk,
io.ref,
pm.code payMethodCode,
cny.code companyCode,
sa.iban,
ios.footNotes
FROM invoiceOut io
JOIN client c ON c.id = io.clientFk
JOIN payMethod pm ON pm.id = c.payMethodFk
JOIN company cny ON cny.id = io.companyFk
JOIN supplierAccount sa ON sa.id = cny.supplierAccountFk
LEFT JOIN invoiceOutSerial ios ON ios.code = io.serial
LEFT JOIN ticket t ON t.refFk = io.ref
WHERE t.refFk = ?