diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index b7197d1db..c08938f04 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -3207,7 +3207,7 @@ UPDATE vn.department SET workerFk = null; INSERT INTO vn.packaging - VALUES('--', 2745600.00, 100.00, 120.00, 220.00, 0.00, 1, '2001-01-01 00:00:00.000', NULL, NULL, NULL, 0.00, 16, 0.00, 0, NULL, 0.00, NULL, NULL, 0, NULL, 0, 0,0,1); + VALUES('--', 2745600.00, 100.00, 120.00, 220.00, 0.00, 1, '2001-01-01 00:00:00.000', NULL, NULL, NULL, 0.00, 16, 0.00, 0, NULL, 0.00, NULL, NULL, 0, NULL, 0, 0,0,1,0); INSERT IGNORE INTO vn.intrastat diff --git a/db/routines/vn2008/views/Cubos.sql b/db/routines/vn2008/views/Cubos.sql index 1b23af4fc..7ca82e66e 100644 --- a/db/routines/vn2008/views/Cubos.sql +++ b/db/routines/vn2008/views/Cubos.sql @@ -18,5 +18,6 @@ AS SELECT `p`.`id` AS `Id_Cubo`, `p`.`base` AS `Base`, `p`.`isBox` AS `box`, `p`.`returnCost` AS `costeRetorno`, - `p`.`isActive` AS `isActive` + `p`.`isActive` AS `isActive`, + `p`.`flippingCost` AS `flippingCost` FROM `vn`.`packaging` `p` diff --git a/db/routines/vn2008/views/awb.sql b/db/routines/vn2008/views/awb.sql index 010596288..a32571888 100644 --- a/db/routines/vn2008/views/awb.sql +++ b/db/routines/vn2008/views/awb.sql @@ -29,5 +29,6 @@ AS SELECT `a`.`id` AS `id`, `a`.`invoiceInPaletizedFk` AS `invoiceInPaletizedFk`, `a`.`observation` AS `observation`, `a`.`hasFreightPrepaid` AS `hasFreightPrepaid`, - `a`.`propertyNumber` AS `propertyNumber` + `a`.`propertyNumber` AS `propertyNumber`, + `a`.`costPerKg` AS `costPerKg` FROM `vn`.`awb` `a` diff --git a/db/versions/11076-blueChico/00-firstScript.sql b/db/versions/11076-blueChico/00-firstScript.sql new file mode 100644 index 000000000..75fdc0c56 --- /dev/null +++ b/db/versions/11076-blueChico/00-firstScript.sql @@ -0,0 +1,27 @@ +ALTER TABLE vn.business +ADD CONSTRAINT `business_companyCodeFk` FOREIGN KEY (`companyCodeFk`) REFERENCES `company` (`code`) ON DELETE CASCADE ON UPDATE CASCADE; + +-- Auto-generated SQL script. Actual values for binary/complex data types may differ - what you see is the default string representation of values. +INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId) + VALUES ('BusinessReasonEnd','find','*','ALLOW','ROLE','hr'); +INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId) + VALUES ('CalendarType','find','*','ALLOW','ROLE','hr'); +INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId) + VALUES ('OccupationCode','find','*','ALLOW','ROLE','hr'); +INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId) + VALUES ('BusinessReasonEnd','find','*','ALLOW','ROLE','hr'); +INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId) + VALUES ('WorkerBusinessProfessionalCategory','find','*','ALLOW','ROLE','hr'); +INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId) + VALUES ('WorkerBusinessAgreement','find','*','ALLOW','ROLE','hr'); +INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId) + VALUES ('WorkerBusinessType','find','*','ALLOW','ROLE','hr'); +INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId) + VALUES ('PayrollCategory','find','*','ALLOW','ROLE','hr'); +INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId) + VALUES ('Worker','__get__business','*','ALLOW','ROLE','hr'); +INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId) + VALUES ('Worker','__create__business','*','ALLOW','ROLE','hr'); +INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId) + VALUES ('Business','crud','*','ALLOW','ROLE','hr'); + diff --git a/db/versions/11429-brownBamboo/00-firstScript.sql b/db/versions/11429-brownBamboo/00-firstScript.sql new file mode 100644 index 000000000..726856e76 --- /dev/null +++ b/db/versions/11429-brownBamboo/00-firstScript.sql @@ -0,0 +1,2 @@ +ALTER TABLE `vn`.`awb` + ADD COLUMN `costPerKg` DECIMAL(10, 2) UNSIGNED DEFAULT NULL COMMENT 'Tarifa que indica a cuanto cuesta el kilo en ese vuelo'; \ No newline at end of file diff --git a/modules/client/back/methods/client/filter.js b/modules/client/back/methods/client/filter.js index 7df973f19..c217b2a86 100644 --- a/modules/client/back/methods/client/filter.js +++ b/modules/client/back/methods/client/filter.js @@ -158,10 +158,12 @@ module.exports = Self => { a.provinceFk AS provinceAddressFk, p.name AS province, u.id AS salesPersonFk, - u.name AS salesPerson + u.name AS salesPerson, + co.name AS country FROM client c LEFT JOIN account.user u ON u.id = c.salesPersonFk LEFT JOIN province p ON p.id = c.provinceFk + LEFT JOIN country co ON co.id = c.countryFk JOIN address a ON a.clientFk = c.id ` ); diff --git a/modules/client/back/model-config.json b/modules/client/back/model-config.json index e6690ee5f..67a61b8b5 100644 --- a/modules/client/back/model-config.json +++ b/modules/client/back/model-config.json @@ -139,5 +139,23 @@ }, "Xdiario": { "dataSource": "vn" + }, + "BusinessReasonEnd": { + "dataSource": "vn" + }, + "OccupationCode": { + "dataSource": "vn" + }, + "WorkerBusinessProfessionalCategory": { + "dataSource": "vn" + }, + "CalendarType": { + "dataSource": "vn" + }, + "WorkerBusinessType": { + "dataSource": "vn" + }, + "PayrollCategory": { + "dataSource": "vn" } } diff --git a/modules/client/back/models/business-reason-end.json b/modules/client/back/models/business-reason-end.json new file mode 100644 index 000000000..54a632bea --- /dev/null +++ b/modules/client/back/models/business-reason-end.json @@ -0,0 +1,17 @@ +{ + "name": "BusinessReasonEnd", + "base": "VnModel", + "options": { + "mysql": { + "table": "businessReasonEnd" + } + }, + "properties": { + "id": { + "type": "number" + }, + "reason": { + "type": "string" + } + } +} diff --git a/modules/client/back/models/business.json b/modules/client/back/models/business.json index 58e989ae0..dc6cd0bcd 100644 --- a/modules/client/back/models/business.json +++ b/modules/client/back/models/business.json @@ -13,6 +13,63 @@ }, "workcenterFk" : { "type": "number" + }, + "companyCodeFk" : { + "type": "string" + }, + "started" : { + "type": "date" + }, + "ended" : { + "type": "date" + }, + "workerBusiness" : { + "type": "string" + }, + "reasonEndFk" : { + "type": "number" + }, + "payedHolidays" : { + "type": "number" + }, + "occupationCodeFk" : { + "type": "string" + }, + "workerFk" : { + "type": "number" + }, + "notes" : { + "type": "string" + }, + "departmentFk": { + "type": "string" + }, + "workerBusinessProfessionalCategoryFk": { + "type": "number" + }, + "calendarTypeFk": { + "type": "string" + }, + "isHourlyLabor": { + "type": "boolean" + }, + "rate": { + "type": "number" + }, + "workerBusinessCategoryFk": { + "type": "number" + }, + "workerBusinessTypeFk": { + "type": "number" + }, + "amount": { + "type": "number" + }, + "workerBusinessAgreementFk": { + "type": "number" + }, + "basicSalary": { + "type": "number" } }, "relations": { @@ -25,6 +82,59 @@ "type": "belongsTo", "model": "Department", "foreignKey": "departmentFk" + }, + "workCenter": { + "type": "belongsTo", + "model": "WorkCenter", + "foreignKey": "workcenterFk" + }, + "companyCode": { + "type": "belongsTo", + "model": "Company", + "foreignKey": "companyCodeFk", + "primaryKey": "code" + }, + "reasonEnd": { + "type": "belongsTo", + "model": "BusinessReasonEnd", + "foreignKey": "reasonEndFk" + }, + "occupationCode": { + "type": "belongsTo", + "model": "OccupationCode", + "foreignKey":"occupationCodeFk", + "primaryKey": "code" + }, + "payrollCategory": { + "type": "belongsTo", + "model": "PayrollCategory", + "foreignKey":"workerBusinessCategoryFk" + }, + "workerBusinessProfessionalCategory": { + "type": "belongsTo", + "model": "WorkerBusinessProfessionalCategory", + "foreignKey": "workerBusinessProfessionalCategoryFk" + }, + "calendarType": { + "type": "belongsTo", + "model": "CalendarType", + "foreignKey": "calendarTypeFk" + }, + "workerBusinessCategory": { + "type": "belongsTo", + "model": "WorkerBusinessCategory", + "foreignKey": "workerBusinessCategoryFk" + }, + "workerBusinessType": { + "type": "belongsTo", + "model": "WorkerBusinessType", + "foreignKey": "workerBusinessTypeFk" + }, + "workerBusinessAgreement": { + "type": "belongsTo", + "model": "WorkerBusinessAgreement", + "foreignKey": "workerBusinessAgreementFk" } + } } diff --git a/modules/client/back/models/calendar-type.json b/modules/client/back/models/calendar-type.json new file mode 100644 index 000000000..742aaed94 --- /dev/null +++ b/modules/client/back/models/calendar-type.json @@ -0,0 +1,21 @@ +{ + "name": "CalendarType", + "base": "VnModel", + "options": { + "mysql": { + "table": "calendarType" + } + }, + "properties": { + "id": { + "type": "number" + }, + "description": { + "type": "string" + }, + "hoursWeek": { + "type": "number" + }, + "isPartial": "number" + } +} diff --git a/modules/client/back/models/occupation-code.json b/modules/client/back/models/occupation-code.json new file mode 100644 index 000000000..e40eaf2fe --- /dev/null +++ b/modules/client/back/models/occupation-code.json @@ -0,0 +1,18 @@ +{ + "name": "OccupationCode", + "base": "VnModel", + "options": { + "mysql": { + "table": "occupationCode" + } + }, + "properties": { + "code": { + "type": "string", + "id": true + }, + "name": { + "type": "string" + } + } +} diff --git a/modules/client/back/models/payroll-categories.json b/modules/client/back/models/payroll-categories.json new file mode 100644 index 000000000..ca3431ba9 --- /dev/null +++ b/modules/client/back/models/payroll-categories.json @@ -0,0 +1,20 @@ +{ + "name": "PayrollCategory", + "base": "VnModel", + "options": { + "mysql": { + "table": "payrollCategories" + } + }, + "properties": { + "id": { + "type": "number" + }, + "description": { + "type": "string" + }, + "rate": { + "type": "number" + } + } +} diff --git a/modules/client/back/models/professional-category.json b/modules/client/back/models/professional-category.json new file mode 100644 index 000000000..5f812a704 --- /dev/null +++ b/modules/client/back/models/professional-category.json @@ -0,0 +1,20 @@ +{ + "name": "WorkerBusinessProfessionalCategory", + "base": "VnModel", + "options": { + "mysql": { + "table": "professionalCategory" + } + }, + "properties": { + "id": { + "type": "number" + }, + "description": { + "type": "string" + }, + "code": { + "type": "string" + } + } +} diff --git a/modules/client/back/models/worker-business-agreement.json b/modules/client/back/models/worker-business-agreement.json new file mode 100644 index 000000000..bd62b2aa3 --- /dev/null +++ b/modules/client/back/models/worker-business-agreement.json @@ -0,0 +1,29 @@ +{ + "name": "WorkerBusinessAgreement", + "base": "VnModel", + "options": { + "mysql": { + "table": "workerBusinessAgreement" + } + }, + "properties": { + "id": { + "type": "number" + }, + "name": { + "type": "string" + }, + "monthHolidays": { + "type": "number" + }, + "yearsHours": { + "type": "number" + }, + "started": { + "type": "date" + }, + "ended": { + "type": "date" + } + } +} diff --git a/modules/client/back/models/worker-business-type.json b/modules/client/back/models/worker-business-type.json new file mode 100644 index 000000000..648ce3fd2 --- /dev/null +++ b/modules/client/back/models/worker-business-type.json @@ -0,0 +1,27 @@ +{ + "name": "WorkerBusinessType", + "base": "VnModel", + "options": { + "mysql": { + "table": "workerBusinessType" + } + }, + "properties": { + "id": { + "type": "number", + "id": true + }, + "name": { + "type": "string" + }, + "isFullTime": { + "type": "number" + }, + "isPermanent": { + "type": "number" + }, + "hasHolidayEntitlement": { + "type": "number" + } + } +} diff --git a/modules/worker/back/models/worker.json b/modules/worker/back/models/worker.json index 705851963..346c70d56 100644 --- a/modules/worker/back/models/worker.json +++ b/modules/worker/back/models/worker.json @@ -75,6 +75,9 @@ }, "isSsDiscounted": { "type": "boolean" + }, + "businessFk": { + "type": "number" } }, "relations": { @@ -103,6 +106,11 @@ "model": "WorkerDepartment", "foreignKey": "id" }, + "currentBusiness": { + "type": "belongsTo", + "model": "Business", + "foreignKey": "businessFk" + }, "collegues": { "type": "hasMany", "model": "WorkerTeamCollegues", @@ -113,6 +121,11 @@ "model": "Locker", "foreignKey": "workerFk" }, + "business": { + "type": "hasMany", + "model": "Business", + "foreignKey": "workerFk" + }, "medicalReview": { "type": "hasMany", "model": "MedicalReview", @@ -259,12 +272,36 @@ "relation": "department", "scope": { "fields": [ - "name" + "id" ] } } } }, + { + "relation": "business", + "scope": { + "fields": [ + "id", + "started", + "ended", + "reasonEndFk", + "departmentFk", + "workerBusinessProfessionalCategoryFk" + ], + "include": [ + { + "relation": "reasonEnd", + "scope": { + "fields": [ + "id", + "reason" + ] + } + } + ] + } + }, { "relation": "boss", "scope": { @@ -312,7 +349,8 @@ "educationLevelFk", "originCountryFk", "maritalStatus", - "SSN" + "SSN", + "businessFk" ], "include": [ { @@ -323,6 +361,48 @@ "phone" ] } + }, + { + "relation": "currentBusiness", + "scope": { + "fields": [ + "id", + "started", + "ended", + "reasonEndFk", + "departmentFk", + "workerBusinessProfessionalCategoryFk" + ], + "include": [ + { + "relation": "reasonEnd", + "scope": { + "fields": [ + "id", + "reason" + ] + } + }, + { + "relation": "department", + "scope": { + "fields": [ + "id", + "name" + ] + } + }, + { + "relation": "workerBusinessProfessionalCategory", + "scope": { + "fields": [ + "id", + "description" + ] + } + } + ] + } } ] }