7489-testToMaster #2515
|
@ -180,5 +180,11 @@
|
||||||
},
|
},
|
||||||
"ProductionConfig": {
|
"ProductionConfig": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
|
"AgencyLog": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
|
"AgencyWorkCenter": {
|
||||||
|
"dataSource": "vn"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"name": "AgencyLog",
|
||||||
|
"base": "Log",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "agencyLog"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
const UserError = require('vn-loopback/util/user-error');
|
||||||
|
module.exports = Self => {
|
||||||
|
Self.rewriteDbError(function(err) {
|
||||||
|
if (err.code === 'ER_DUP_ENTRY')
|
||||||
|
return new UserError(`This workCenter is already assigned to this agency`);
|
||||||
|
return err;
|
||||||
|
});
|
||||||
|
};
|
|
@ -0,0 +1,41 @@
|
||||||
|
{
|
||||||
|
"name": "AgencyWorkCenter",
|
||||||
|
"base": "VnModel",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "agencyWorkCenter"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"id": true,
|
||||||
|
"type": "number",
|
||||||
|
"forceId": false
|
||||||
|
},
|
||||||
|
"agencyFk": {
|
||||||
|
"type": "number",
|
||||||
|
"required": false
|
||||||
|
},
|
||||||
|
"workCenterFk": {
|
||||||
|
"type": "number",
|
||||||
|
"required": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"relations": {
|
||||||
|
"agency": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "WorkCenter",
|
||||||
|
"foreignKey": "agencyFk"
|
||||||
|
},
|
||||||
|
"workCenter": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "WorkCenter",
|
||||||
|
"foreignKey": "workCenterFk"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"scope": {
|
||||||
|
"include":{
|
||||||
|
"relation": "workCenter"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -3788,3 +3788,6 @@ INSERT INTO `vn`.`accountReconciliationConfig`(currencyFk, warehouseFk)
|
||||||
INSERT INTO vn.workerTeam(id, team, workerFk)
|
INSERT INTO vn.workerTeam(id, team, workerFk)
|
||||||
VALUES
|
VALUES
|
||||||
(8, 1, 19);
|
(8, 1, 19);
|
||||||
|
|
||||||
|
INSERT INTO vn.workCenter (id, name, payrollCenterFk, counter, warehouseFk, street, geoFk, deliveryManAdjustment)
|
||||||
|
VALUES(100, 'workCenterOne', 1, NULL, 1, 'gotham', NULL, NULL);
|
|
@ -0,0 +1,8 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`agency_beforeInsert`
|
||||||
|
BEFORE INSERT ON `agency`
|
||||||
|
FOR EACH ROW
|
||||||
|
BEGIN
|
||||||
|
SET NEW.editorFk = account.myUser_getId();
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -0,0 +1,24 @@
|
||||||
|
-- vn.agencyLog definition
|
||||||
|
ALTER TABLE vn.agency ADD IF NOT EXISTS editorFk int(10) unsigned DEFAULT NULL NULL;
|
||||||
|
|
||||||
|
ALTER TABLE vn.agency ADD CONSTRAINT agency_user_FK FOREIGN KEY (editorFk) REFERENCES `account`.`user`(id);
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `vn`.`agencyLog` (
|
||||||
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`originFk` smallint(5) unsigned DEFAULT NULL,
|
||||||
|
`userFk` int(10) unsigned DEFAULT NULL,
|
||||||
|
`action` set('insert','update','delete','select') NOT NULL,
|
||||||
|
`creationDate` timestamp NULL DEFAULT current_timestamp(),
|
||||||
|
`description` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
|
||||||
|
`changedModel` enum('agency','agencyMode') NOT NULL DEFAULT 'agency',
|
||||||
|
`oldInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`oldInstance`)),
|
||||||
|
`newInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`newInstance`)),
|
||||||
|
`changedModelId` int(11) NOT NULL,
|
||||||
|
`changedModelValue` varchar(45) DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `logAgencyUserFk` (`userFk`),
|
||||||
|
KEY `agencyLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`),
|
||||||
|
KEY `agencyLog_originFk` (`originFk`,`creationDate`),
|
||||||
|
CONSTRAINT `agencyOriginFk` FOREIGN KEY (`originFk`) REFERENCES `agency` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||||
|
CONSTRAINT `agencyUserFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
|
|
@ -0,0 +1,18 @@
|
||||||
|
CREATE TABLE IF NOT EXISTS `vn`.`agencyWorkCenter` (
|
||||||
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`agencyFk` smallint(5) unsigned NOT NULL,
|
||||||
|
`workCenterFk` int(11) NOT NULL,
|
||||||
|
`editorFk` int(10) unsigned DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `agencyWorkCenter_unique` (`agencyFk`,`workCenterFk`),
|
||||||
|
KEY `agencyWorkCenter_workCenter_FK` (`workCenterFk`),
|
||||||
|
KEY `agencyWorkCenter_user_FK` (`editorFk`),
|
||||||
|
CONSTRAINT `agencyWorkCenter_agency_FK` FOREIGN KEY (`agencyFk`) REFERENCES `agency` (`id`) ON DELETE CASCADE,
|
||||||
|
CONSTRAINT `agencyWorkCenter_user_FK` FOREIGN KEY (`editorFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||||
|
CONSTRAINT `agencyWorkCenter_workCenter_FK` FOREIGN KEY (`workCenterFk`) REFERENCES `workCenter` (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #4988';
|
||||||
|
|
||||||
|
INSERT INTO vn.agencyWorkCenter (agencyFk, workCenterFk)
|
||||||
|
SELECT id, workCenterFk
|
||||||
|
FROM vn.agency
|
||||||
|
WHERE workCenterFk IS NOT NULL;
|
|
@ -0,0 +1,19 @@
|
||||||
|
-- Place your SQL code here
|
||||||
|
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
|
||||||
|
VALUES ('AgencyLog','*','READ','ALLOW','ROLE','employee');
|
||||||
|
|
||||||
|
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
|
||||||
|
VALUES ('AgencyWorkCenter','*','READ','ALLOW','ROLE','employee');
|
||||||
|
|
||||||
|
INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId)
|
||||||
|
VALUES('AgencyMode', '*', 'READ', 'ALLOW', 'ROLE', 'employee');
|
||||||
|
|
||||||
|
INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId)
|
||||||
|
VALUES('Agency', '*', 'READ', 'ALLOW', 'ROLE', 'employee');
|
||||||
|
|
||||||
|
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
|
||||||
|
VALUES ('Agency','*','WRITE','ALLOW','ROLE','deliveryAssistant');
|
||||||
|
|
||||||
|
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
|
||||||
|
VALUES ('AgencyWorkCenter','*','WRITE','ALLOW','ROLE','deliveryAssistant');
|
||||||
|
|
|
@ -354,6 +354,7 @@
|
||||||
"They're not your subordinate": "No es tu subordinado/a.",
|
"They're not your subordinate": "No es tu subordinado/a.",
|
||||||
"No results found": "No se han encontrado resultados",
|
"No results found": "No se han encontrado resultados",
|
||||||
"InvoiceIn is already booked": "La factura recibida está contabilizada",
|
"InvoiceIn is already booked": "La factura recibida está contabilizada",
|
||||||
|
"This workCenter is already assigned to this agency": "Este centro de trabajo ya está asignado a esta agencia",
|
||||||
"Select ticket or client": "Elija un ticket o un client",
|
"Select ticket or client": "Elija un ticket o un client",
|
||||||
"It was not able to create the invoice": "No se pudo crear la factura"
|
"It was not able to create the invoice": "No se pudo crear la factura"
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,22 @@
|
||||||
"name": {
|
"name": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"required": false
|
"required": false
|
||||||
|
},
|
||||||
|
"warehouseFk": {
|
||||||
|
"type": "number",
|
||||||
|
"required": false
|
||||||
|
},
|
||||||
|
"isOwn": {
|
||||||
|
"type": "boolean",
|
||||||
|
"required": false
|
||||||
|
},
|
||||||
|
"workCenterFk": {
|
||||||
|
"type": "number",
|
||||||
|
"required": false
|
||||||
|
},
|
||||||
|
"isAnyVolumeAllowed": {
|
||||||
|
"type": "boolean",
|
||||||
|
"required": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"relations": {
|
"relations": {
|
||||||
|
@ -22,6 +38,16 @@
|
||||||
"type": "hasOne",
|
"type": "hasOne",
|
||||||
"model": "SupplierAgencyTerm",
|
"model": "SupplierAgencyTerm",
|
||||||
"foreignKey": "agencyFk"
|
"foreignKey": "agencyFk"
|
||||||
}
|
},
|
||||||
|
"warehouse": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "Warehouse",
|
||||||
|
"foreignKey": "warehouseFk"
|
||||||
|
},
|
||||||
|
"workCenter": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "WorkCenter",
|
||||||
|
"foreignKey": "workCenterFk"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,4 +17,9 @@ h2 {
|
||||||
|
|
||||||
.description strong {
|
.description strong {
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.black {
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,3 +6,4 @@ SELECT
|
||||||
FROM vn.entry e
|
FROM vn.entry e
|
||||||
JOIN vn.travel t ON t.id = e.travelFk
|
JOIN vn.travel t ON t.id = e.travelFk
|
||||||
WHERE e.supplierFk = ? AND DATE(t.shipped) BETWEEN ? AND ?
|
WHERE e.supplierFk = ? AND DATE(t.shipped) BETWEEN ? AND ?
|
||||||
|
ORDER BY t.shipped DESC;
|
||||||
|
|
|
@ -37,7 +37,10 @@
|
||||||
</div>
|
</div>
|
||||||
<div v-for="entry in entries" v-if="entry.buys">
|
<div v-for="entry in entries" v-if="entry.buys">
|
||||||
<h2>
|
<h2>
|
||||||
<span>{{$t('entry')}} {{entry.id}}</span>
|
<span>
|
||||||
|
<span>{{$t('entry')}}</span>
|
||||||
|
<span class="black"> {{entry.id}}</span>
|
||||||
|
</span>
|
||||||
<span>{{$t('dated')}} {{formatDate(entry.shipped, '%d-%m-%Y')}}</span>
|
<span>{{$t('dated')}} {{formatDate(entry.shipped, '%d-%m-%Y')}}</span>
|
||||||
<span class="pull-right">{{$t('reference')}} {{entry.reference}}</span>
|
<span class="pull-right">{{$t('reference')}} {{entry.reference}}</span>
|
||||||
</h2>
|
</h2>
|
||||||
|
@ -67,6 +70,13 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
<table>
|
||||||
|
<tr class="font bold no-page-break">
|
||||||
|
<td>{{$t('total')}}</td>
|
||||||
|
<td class="number">{{total.price | currency('EUR', $i18n.locale)}}</td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<template v-slot:footer>
|
<template v-slot:footer>
|
||||||
|
|
|
@ -7,7 +7,7 @@ module.exports = {
|
||||||
this.supplier = await this.findOneFromDef('supplier', [this.id]);
|
this.supplier = await this.findOneFromDef('supplier', [this.id]);
|
||||||
this.checkMainEntity(this.supplier);
|
this.checkMainEntity(this.supplier);
|
||||||
let entries = await this.rawSqlFromDef('entries', [this.id, this.from, this.to]);
|
let entries = await this.rawSqlFromDef('entries', [this.id, this.from, this.to]);
|
||||||
|
this.total = {quantity: 0, price: 0};
|
||||||
const entriesId = [];
|
const entriesId = [];
|
||||||
|
|
||||||
for (let entry of entries)
|
for (let entry of entries)
|
||||||
|
@ -23,7 +23,8 @@ module.exports = {
|
||||||
const entry = entriesMap.get(buy.entryFk);
|
const entry = entriesMap.get(buy.entryFk);
|
||||||
if (entry) {
|
if (entry) {
|
||||||
if (!entry.buys) entry.buys = [];
|
if (!entry.buys) entry.buys = [];
|
||||||
|
this.total.quantity = this.total.quantity + buy.quantity;
|
||||||
|
this.total.price = this.total.price + (buy.price * buy.quantity);
|
||||||
entry.buys.push(buy);
|
entry.buys.push(buy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue