fixes #4859 export_db #1200

Merged
joan merged 16 commits from 4859-export_db into dev 2022-12-15 07:21:04 +00:00
20 changed files with 32415 additions and 35556 deletions

View File

@ -0,0 +1 @@
ALTER TABLE `vn`.`entry` DROP COLUMN `ref`;

File diff suppressed because one or more lines are too long

View File

@ -60,7 +60,7 @@ INSERT INTO `vn`.`educationLevel` (`id`, `name`)
INSERT INTO `vn`.`worker`(`id`,`code`, `firstName`, `lastName`, `userFk`, `bossFk`)
SELECT id,UPPER(LPAD(role, 3, '0')), name, name, id, 9
FROM `vn`.`user`;
FROM `account`.`user`;
UPDATE `vn`.`worker` SET bossFk = NULL WHERE id = 20;
UPDATE `vn`.`worker` SET bossFk = 20 WHERE id = 1 OR id = 9;
@ -105,20 +105,8 @@ INSERT INTO `account`.`mailForward`(`account`, `forwardTo`)
VALUES
(1, 'employee@domain.local');
INSERT INTO `vn`.`printer` (`id`, `name`, `path`, `isLabeler`)
VALUES
(1, 'printer1', 'path1', 0),
(2, 'printer2', 'path2', 1);
INSERT INTO `vn`.`worker`(`id`, `code`, `firstName`, `lastName`, `userFk`,`bossFk`, `phone`, `sectorFk`, `labelerFk`)
VALUES
(1106, 'LGN', 'David Charles', 'Haller', 1106, 19, 432978106, NULL, NULL),
(1107, 'ANT', 'Hank' , 'Pym' , 1107, 19, 432978107, NULL, 1),
(1108, 'DCX', 'Charles' , 'Xavier', 1108, 19, 432978108, 1, NULL),
(1109, 'HLK', 'Bruce' , 'Banner', 1109, 19, 432978109, 1, 2),
(1110, 'JJJ', 'Jessica' , 'Jones' , 1110, 19, 432978110, 2, 1);
INSERT INTO `vn`.`currency`(`id`, `code`, `name`, `ratio`)
VALUES
(1, 'EUR', 'Euro', 1),
@ -159,6 +147,19 @@ INSERT INTO `vn`.`sector`(`id`, `description`, `warehouseFk`, `isPreviousPrepare
(1, 'First sector', 1, 1, 'FIRST'),
(2, 'Second sector', 2, 0, 'SECOND');
INSERT INTO `vn`.`printer` (`id`, `name`, `path`, `isLabeler`, `sectorFk`)
VALUES
(1, 'printer1', 'path1', 0, 1),
(2, 'printer2', 'path2', 1, 1);
INSERT INTO `vn`.`worker`(`id`, `code`, `firstName`, `lastName`, `userFk`,`bossFk`, `phone`, `sectorFk`, `labelerFk`)
VALUES
(1106, 'LGN', 'David Charles', 'Haller', 1106, 19, 432978106, NULL, NULL),
(1107, 'ANT', 'Hank' , 'Pym' , 1107, 19, 432978107, NULL, NULL),
(1108, 'DCX', 'Charles' , 'Xavier', 1108, 19, 432978108, 1, NULL),
(1109, 'HLK', 'Bruce' , 'Banner', 1109, 19, 432978109, 1, NULL),
(1110, 'JJJ', 'Jessica' , 'Jones' , 1110, 19, 432978110, 2, NULL);
INSERT INTO `vn`.`parking` (`id`, `column`, `row`, `sectorFk`, `code`, `pickingOrder`)
VALUES
('1', 700, '01', 1, '700-01', 70001),
@ -216,18 +217,18 @@ INSERT INTO `vn`.`deliveryMethod`(`id`, `code`, `description`)
(3, 'PICKUP', 'Recogida'),
(4, 'OTHER', 'Otros');
INSERT INTO `vn`.`agency`(`id`, `name`, `warehouseFk`, `bankFk__`, `warehouseAliasFk`)
INSERT INTO `vn`.`agency`(`id`, `name`, `warehouseFk`, `warehouseAliasFk`)
VALUES
(1, 'inhouse pickup' , 1, 1, 1),
(2, 'Super-Man delivery' , 1, 1, 1),
(3, 'Teleportation device' , 1, 1, 1),
(4, 'Entanglement' , 1, 1, 1),
(5, 'Quantum break device' , 1, 1, 1),
(6, 'Walking' , 1, 1, 1),
(7, 'Gotham247' , 1, 1, 1),
(8, 'Gotham247Expensive' , 1, 1, 1),
(9, 'Refund' , 1, 1, 1),
(10, 'Other agency' , 1, 1, 1);
(1, 'inhouse pickup' , 1, 1),
(2, 'Super-Man delivery' , 1, 1),
(3, 'Teleportation device' , 1, 1),
(4, 'Entanglement' , 1, 1),
(5, 'Quantum break device' , 1, 1),
(6, 'Walking' , 1, 1),
(7, 'Gotham247' , 1, 1),
(8, 'Gotham247Expensive' , 1, 1),
(9, 'Refund' , 1, 1),
(10, 'Other agency' , 1, 1);
UPDATE `vn`.`agencyMode` SET `id` = 1 WHERE `name` = 'inhouse pickup';
UPDATE `vn`.`agencyMode` SET `id` = 2 WHERE `name` = 'Super-Man delivery';
@ -1132,11 +1133,11 @@ INSERT INTO `vn`.`saleComponent`(`saleFk`, `componentFk`, `value`)
(32, 36, -92.324),
(32, 39, 0.994);
INSERT INTO `vn`.`itemShelving` (`itemFk`, `shelvingFk`, `shelve`, `visible`, `grouping`, `packing`, `userFk`)
INSERT INTO `vn`.`itemShelving` (`itemFk`, `shelvingFk`, `visible`, `grouping`, `packing`, `userFk`)
VALUES
(2, 'GVC', 'A', 1, 1, 1, 1106),
(4, 'HEJ', 'A', 1, 1, 1, 1106),
(1, 'UXN', 'A', 2, 12, 12, 1106);
(2, 'GVC', 1, 1, 1, 1106),
(4, 'HEJ', 1, 1, 1, 1106),
(1, 'UXN', 2, 12, 12, 1106);
INSERT INTO `vn`.`itemShelvingSale` (`itemShelvingFk`, `saleFk`, `quantity`, `created`, `userFk`)
VALUES
@ -1377,16 +1378,16 @@ INSERT INTO `vn`.`travel`(`id`,`shipped`, `landed`, `warehouseInFk`, `warehouseO
(7, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 4, 1, 50.00, 500, 'seventh travel', 2, 1),
(8, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 1, 1, 50.00, 500, 'eight travel', 1, 2);
INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed`, `companyFk`, `ref`,`isExcludedFromAvailable`, `isRaid`, `notes`, `evaNotes`)
INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed`, `companyFk`, `invoiceNumber`, `reference`, `isExcludedFromAvailable`, `isRaid`, `notes`, `evaNotes`)
VALUES
(1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 1, 442, 'Movement 1', 0, 0, '', ''),
(2, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 442, 'Movement 2', 0, 0, 'this is the note two', 'observation two'),
(3, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 0, 442, 'Movement 3', 0, 0, 'this is the note three', 'observation three'),
(4, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 69, 'Movement 4', 0, 0, 'this is the note four', 'observation four'),
(5, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 0, 442, 'Movement 5', 0, 0, 'this is the note five', 'observation five'),
(6, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 6, 0, 442, 'Movement 6', 0, 0, 'this is the note six', 'observation six'),
(7, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'Movement 7', 0, 0, 'this is the note seven', 'observation seven'),
(8, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'Movement 8', 1, 1, '', '');
(1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 1, 442, 'IN2001', 'Movement 1', 0, 0, '', ''),
(2, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 442, 'IN2002', 'Movement 2', 0, 0, 'this is the note two', 'observation two'),
(3, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 0, 442, 'IN2003', 'Movement 3', 0, 0, 'this is the note three', 'observation three'),
(4, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 69, 'IN2004', 'Movement 4', 0, 0, 'this is the note four', 'observation four'),
(5, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 0, 442, 'IN2005', 'Movement 5', 0, 0, 'this is the note five', 'observation five'),
(6, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 6, 0, 442, 'IN2006', 'Movement 6', 0, 0, 'this is the note six', 'observation six'),
(7, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2007', 'Movement 7', 0, 0, 'this is the note seven', 'observation seven'),
(8, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2008', 'Movement 8', 1, 1, '', '');
INSERT INTO `bs`.`waste`(`buyer`, `year`, `week`, `family`, `itemFk`, `itemTypeFk`, `saleTotal`, `saleWaste`, `rate`)
VALUES
@ -1406,23 +1407,23 @@ INSERT INTO `bs`.`waste`(`buyer`, `year`, `week`, `family`, `itemFk`, `itemTypeF
('HankPym', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 'Miscellaneous Accessories', 6, 1, '186', '0', '0.0'),
('HankPym', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 'Adhesives', 7, 1, '277', '0', '0.0');
INSERT INTO `vn`.`buy`(`id`,`entryFk`,`itemFk`,`buyingValue`,`quantity`,`packageFk`,`stickers`,`freightValue`,`packageValue`,`comissionValue`,`packing`,`grouping`,`groupingMode`,`location`,`price1`,`price2`,`price3`,`producer`,`printedStickers`,`isChecked`,`isIgnored`,`weight`, `created`)
INSERT INTO `vn`.`buy`(`id`,`entryFk`,`itemFk`,`buyingValue`,`quantity`,`packageFk`,`stickers`,`freightValue`,`packageValue`,`comissionValue`,`packing`,`grouping`,`groupingMode`,`location`,`price1`,`price2`,`price3`, `printedStickers`,`isChecked`,`isIgnored`,`weight`, `created`)
VALUES
(1, 1, 1, 50, 5000, 4, 1, 1.500, 1.500, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, NULL, 0, 1, 0, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH)),
(2, 2, 1, 50, 100, 4, 1, 1.500, 1.500, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, NULL, 0, 1, 0, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)),
(3, 3, 1, 50, 100, 4, 1, 1.500, 1.500, 0.000, 1, 1, 0, NULL, 0.00, 99.6, 99.4, NULL, 0, 1, 0, 1, util.VN_CURDATE()),
(4, 2, 2, 5, 450, 3, 1, 1.000, 1.000, 0.000, 10, 10, 0, NULL, 0.00, 7.30, 7.00, NULL, 0, 1, 0, 2.5, util.VN_CURDATE()),
(5, 3, 3, 55, 500, 5, 1, 1.000, 1.000, 0.000, 1, 1, 0, NULL, 0.00, 78.3, 75.6, NULL, 0, 1, 0, 2.5, util.VN_CURDATE()),
(6, 4, 8, 50, 1000, 4, 1, 1.000, 1.000, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, NULL, 0, 1, 0, 2.5, util.VN_CURDATE()),
(7, 4, 9, 20, 1000, 3, 1, 0.500, 0.500, 0.000, 10, 10, 1, NULL, 0.00, 30.50, 29.00, NULL, 0, 1, 0, 2.5, util.VN_CURDATE()),
(8, 4, 4, 1.25, 1000, 3, 1, 0.500, 0.500, 0.000, 10, 10, 1, NULL, 0.00, 1.75, 1.67, NULL, 0, 1, 0, 2.5, util.VN_CURDATE()),
(9, 4, 4, 1.25, 1000, 3, 1, 0.500, 0.500, 0.000, 10, 10, 1, NULL, 0.00, 1.75, 1.67, NULL, 0, 1, 0, 4, util.VN_CURDATE()),
(10, 5, 1, 50, 10, 4, 1, 2.500, 2.500, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, NULL, 0, 1, 0, 4, util.VN_CURDATE()),
(11, 5, 4, 1.25, 10, 3, 1, 2.500, 2.500, 0.000, 10, 10, 1, NULL, 0.00, 1.75, 1.67, NULL, 0, 1, 0, 4, util.VN_CURDATE()),
(12, 6, 4, 1.25, 0, 3, 1, 2.500, 2.500, 0.000, 10, 10, 1, NULL, 0.00, 1.75, 1.67, NULL, 0, 1, 0, 4, util.VN_CURDATE()),
(13, 7, 1, 50, 0, 3, 1, 2.000, 2.000, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, NULL, 0, 1, 0, 4, util.VN_CURDATE()),
(14, 7, 2, 5, 0, 3, 1, 2.000, 2.000, 0.000, 10, 10, 1, NULL, 0.00, 7.30, 7.00, NULL, 0, 1, 0, 4, util.VN_CURDATE()),
(15, 7, 4, 1.25, 0, 3, 1, 2.000, 2.000, 0.000, 10, 10, 1, NULL, 0.00, 1.75, 1.67, NULL, 0, 1, 0, 4, util.VN_CURDATE());
(1, 1, 1, 50, 5000, 4, 1, 1.500, 1.500, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, 0, 1, 0, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH)),
(2, 2, 1, 50, 100, 4, 1, 1.500, 1.500, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, 0, 1, 0, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)),
(3, 3, 1, 50, 100, 4, 1, 1.500, 1.500, 0.000, 1, 1, 0, NULL, 0.00, 99.6, 99.4, 0, 1, 0, 1, util.VN_CURDATE()),
(4, 2, 2, 5, 450, 3, 1, 1.000, 1.000, 0.000, 10, 10, 0, NULL, 0.00, 7.30, 7.00, 0, 1, 0, 2.5, util.VN_CURDATE()),
(5, 3, 3, 55, 500, 5, 1, 1.000, 1.000, 0.000, 1, 1, 0, NULL, 0.00, 78.3, 75.6, 0, 1, 0, 2.5, util.VN_CURDATE()),
(6, 4, 8, 50, 1000, 4, 1, 1.000, 1.000, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, 0, 1, 0, 2.5, util.VN_CURDATE()),
(7, 4, 9, 20, 1000, 3, 1, 0.500, 0.500, 0.000, 10, 10, 1, NULL, 0.00, 30.50, 29.00, 0, 1, 0, 2.5, util.VN_CURDATE()),
(8, 4, 4, 1.25, 1000, 3, 1, 0.500, 0.500, 0.000, 10, 10, 1, NULL, 0.00, 1.75, 1.67, 0, 1, 0, 2.5, util.VN_CURDATE()),
(9, 4, 4, 1.25, 1000, 3, 1, 0.500, 0.500, 0.000, 10, 10, 1, NULL, 0.00, 1.75, 1.67, 0, 1, 0, 4, util.VN_CURDATE()),
(10, 5, 1, 50, 10, 4, 1, 2.500, 2.500, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, 0, 1, 0, 4, util.VN_CURDATE()),
(11, 5, 4, 1.25, 10, 3, 1, 2.500, 2.500, 0.000, 10, 10, 1, NULL, 0.00, 1.75, 1.67, 0, 1, 0, 4, util.VN_CURDATE()),
(12, 6, 4, 1.25, 0, 3, 1, 2.500, 2.500, 0.000, 10, 10, 1, NULL, 0.00, 1.75, 1.67, 0, 1, 0, 4, util.VN_CURDATE()),
(13, 7, 1, 50, 0, 3, 1, 2.000, 2.000, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, 0, 1, 0, 4, util.VN_CURDATE()),
(14, 7, 2, 5, 0, 3, 1, 2.000, 2.000, 0.000, 10, 10, 1, NULL, 0.00, 7.30, 7.00, 0, 1, 0, 4, util.VN_CURDATE()),
(15, 7, 4, 1.25, 0, 3, 1, 2.000, 2.000, 0.000, 10, 10, 1, NULL, 0.00, 1.75, 1.67, 0, 1, 0, 4, util.VN_CURDATE());
INSERT INTO `hedera`.`order`(`id`, `date_send`, `customer_id`, `delivery_method_id`, `agency_id`, `address_id`, `company_id`, `note`, `source_app`, `confirmed`,`total`, `date_make`, `first_row_stamp`, `confirm_date`)
VALUES
@ -1951,30 +1952,34 @@ INSERT INTO `vn`.`workerBusinessType` (`id`, `name`, `isFullTime`, `isPermanent`
(100, 'INDEFINIDO A TIEMPO COMPLETO', 1, 1, 1),
(109, 'CONVERSION DE TEMPORAL EN INDEFINIDO T.COMPLETO', 1, 1, 1);
INSERT INTO `vn`.`businessCategory` (`id`, `description`, `rate`)
VALUES
(1, 'basic employee', 1);
UPDATE `vn`.`business` b
SET `rate` = 7,
`workerBusinessCategoryFk` = 12,
`workerBusinessCategoryFk` = 1,
`workerBusinessTypeFk` = 100,
`amount` = 900.50
WHERE b.id = 1;
UPDATE `vn`.`business` b
SET `rate` = 7,
`workerBusinessCategoryFk` = 12,
`workerBusinessCategoryFk` = 1,
`workerBusinessTypeFk` = 100,
`amount` = 1263.03
WHERE b.id = 1106;
UPDATE `vn`.`business` b
SET `rate` = 7,
`workerBusinessCategoryFk` = 12,
`workerBusinessCategoryFk` = 1,
`workerBusinessTypeFk` = 100,
`amount` = 2000
WHERE b.id = 1107;
UPDATE `vn`.`business` b
SET `rate` = 7,
`workerBusinessCategoryFk` = 12,
`workerBusinessCategoryFk` = 1,
`workerBusinessTypeFk` = 100,
`amount` = 1500
WHERE b.id = 1108;
@ -2731,4 +2736,13 @@ INSERT INTO `vn`.`osTicketConfig` (`id`, `host`, `user`, `password`, `oldStatus`
INSERT INTO `vn`.`ticketLog` (`id`, `originFk`, `userFk`, `action`, `changedModel`, `oldInstance`, `newInstance`, `changedModelId`)
VALUES
(1, 1, 9, 'insert', 'Ticket', '{}', '{"clientFk":1, "nickname": "Bat cave"}', 1);
(1, 1, 9, 'insert', 'Ticket', '{}', '{"clientFk":1, "nickname": "Bat cave"}', 1);
INSERT INTO `salix`.`url` (`appName`, `environment`, `url`)
VALUES
('lilium', 'dev', 'http://localhost:8080/#/'),
('salix', 'dev', 'http://localhost:5000/#!/');
INSERT INTO `vn`.`payDemDetail` (`id`, `detail`)
VALUES
(1, 1);

File diff suppressed because it is too large Load Diff

View File

@ -41,6 +41,7 @@ dump_tables ${TABLES[@]}
TABLES=(
vn
agencyTermConfig
alertLevel
bookingPlanner
businessType

View File

@ -6,7 +6,6 @@ SCHEMAS=(
cache
edi
hedera
nst
pbx
postgresql
sage
@ -104,4 +103,4 @@ mysqldump \
| sed 's/\bLOCALTIME\b/util.VN_NOW/ig' \
| sed 's/\bLOCALTIMESTAMP\b/util.VN_NOW/ig' \
| sed 's/ AUTO_INCREMENT=[0-9]* //g' \
> dump/structure.sql
> dump/structure.sql

View File

@ -154,8 +154,8 @@ module.exports = Self => {
e.id,
e.supplierFk,
e.dated,
e.ref reference,
e.ref invoiceNumber,
e.reference,
e.invoiceNumber,
e.isBooked,
e.isExcludedFromAvailable,
e.notes,

View File

@ -19,16 +19,10 @@
"type": "date"
},
"reference": {
"type": "string",
"mysql": {
"columnName": "ref"
}
"type": "string"
},
"invoiceNumber": {
"type": "string",
"mysql": {
"columnName": "ref"
}
"type": "string"
},
"isBooked": {
"type": "boolean"

View File

@ -16,7 +16,6 @@ describe('AgencyTerm createInvoiceIn()', () => {
];
it('should make an invoiceIn', async() => {
pending('Include after #3638 export database');
const tx = await models.AgencyTerm.beginTransaction({});
const options = {transaction: tx};

View File

@ -89,12 +89,12 @@ module.exports = Self => {
ENGINE = MEMORY
SELECT
e.id,
e.ref,
e.invoiceNumber,
e.supplierFk,
t.shipped
FROM vn.entry e
JOIN vn.travel t ON t.id = e.travelFk
JOIN buy b ON b.id = b.entryFk
JOIN buy b ON e.id = b.entryFk
Review

Era este JOIN lo que fea que anara lentisim en test/produccio, i dua 2 anys funcionant mal

Era este JOIN lo que fea que anara lentisim en test/produccio, i dua 2 anys funcionant mal
JOIN item i ON i.id = b.itemFk
JOIN itemType it ON it.id = i.typeFk`);
stmt.merge(conn.makeWhere(filter.where));
@ -104,7 +104,7 @@ module.exports = Self => {
const entriesIndex = stmts.push('SELECT * FROM tmp.entry') - 1;
stmt = new ParameterizedSQL(
`SELECT
`SELECT
b.id AS buyId,
b.itemFk,
b.entryFk,

View File

@ -11,7 +11,7 @@ describe('supplier consumption() filter', () => {
};
const result = await app.models.Supplier.consumption(ctx, filter);
expect(result.length).toEqual(6);
expect(result.length).toEqual(5);
});
it('should return a list of entries from the item id 1 and supplier 1', async() => {

View File

@ -31,8 +31,8 @@
</vn-button>
</vn-tool-bar>
</section>
<vn-table model="model"
ng-repeat="entry in entries"
<vn-table model="model"
ng-repeat="entry in entries"
ng-if="entry.buys">
<vn-thead>
<vn-tr>
@ -40,8 +40,8 @@
<vn-td>{{::entry.id}}</vn-td>
<vn-th field="data">Date</vn-th>
<vn-td>{{::entry.shipped | date: 'dd/MM/yyyy'}}</vn-td>
<vn-th field="ref">Reference</vn-th>
<vn-td vn-tooltip="{{::entry.ref}}">{{::entry.ref}}</vn-td>
<vn-th field="invoiceNumber">Reference</vn-th>
<vn-td vn-tooltip="{{::entry.invoiceNumber}}">{{::entry.invoiceNumber}}</vn-td>
</vn-tr>
alexm marked this conversation as resolved Outdated

tarda mucho en calcular

tarda mucho en calcular
</vn-thead>
<vn-tbody>
@ -83,8 +83,8 @@
</vn-table>
</vn-card>
</vn-data-viewer>
<vn-confirm
vn-id="confirm"
<vn-confirm
vn-id="confirm"
question="Please, confirm"
message="The consumption report will be sent"
on-accept="$ctrl.sendEmail()">

View File

@ -1,3 +1,2 @@
Total entry: Total entrada
This supplier doesn't have a contact with an email address: Este proveedor no tiene ningún contacto con una dirección de email
This supplier doesn't have a contact with an email address: Este proveedor no tiene ningún contacto con una dirección de email

View File

@ -159,7 +159,8 @@ module.exports = Self => {
`SELECT
e.id,
e.travelFk,
e.ref,
e.reference,
e.invoiceNumber,
e.loadPriority,
s.id AS supplierFk,
s.name AS supplierName,
@ -168,7 +169,7 @@ module.exports = Self => {
e.notes,
CAST(SUM(b.weight * b.stickers) AS DECIMAL(10,0)) as loadedkg,
CAST(SUM(vc.aerealVolumetricDensity * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000) AS DECIMAL(10,0)) as volumeKg
FROM tmp.travel tr
FROM tmp.travel tr
JOIN entry e ON e.travelFk = tr.id
JOIN buy b ON b.entryFk = e.id
JOIN packaging pkg ON pkg.id = b.packageFk

View File

@ -1,4 +1,4 @@
/* eslint max-len: ["error", { "code": 150 }]*/
const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
module.exports = Self => {
Self.remoteMethod('getEntries', {
@ -25,27 +25,34 @@ module.exports = Self => {
let stmt;
stmt = new ParameterizedSQL(`
SELECT e.travelFk, e.id, e.isConfirmed, e.ref, e.notes, e.evaNotes AS observation,
s.name AS supplierName,
CAST((SUM(IF(p.volume > 0,p.volume,p.width * p.depth * IF(p.height, p.height, i.size + pconfig.upperGap))
* b.stickers)/1000000)/((pcc.width*pcc.depth*pcc.height)/1000000) AS DECIMAL(10,2)) cc,
CAST((SUM(IF(p.volume > 0,p.volume,p.width * p.depth * IF(p.height, p.height, i.size + pconfig.upperGap))
* b.stickers)/1000000)/((ppallet.width*ppallet.depth*ppallet.height)/1000000) AS DECIMAL(10,2)) pallet,
CAST((SUM(IF(p.volume > 0,p.volume,p.width * p.depth * IF(p.height, p.height, i.size + pconfig.upperGap))
* b.stickers)/1000000) AS DECIMAL(10,2)) m3,
TRUNCATE(SUM(b.stickers)/(COUNT( b.id) / COUNT( DISTINCT b.id)),0) hb,
CAST(SUM(b.freightValue*b.quantity) AS DECIMAL(10,2)) freightValue,
CAST(SUM(b.packageValue*b.quantity) AS DECIMAL(10,2)) packageValue
SELECT
e.travelFk,
e.id,
e.isConfirmed,
e.invoiceNumber,
e.reference,
e.notes,
e.evaNotes AS observation,
s.name AS supplierName,
CAST((SUM(IF(p.volume > 0,p.volume,p.width * p.depth * IF(p.height, p.height, i.size + pconfig.upperGap))
* b.stickers)/1000000)/((pcc.width*pcc.depth*pcc.height)/1000000) AS DECIMAL(10,2)) cc,
CAST((SUM(IF(p.volume > 0,p.volume,p.width * p.depth * IF(p.height, p.height, i.size + pconfig.upperGap))
* b.stickers)/1000000)/((ppallet.width*ppallet.depth*ppallet.height)/1000000) AS DECIMAL(10,2)) pallet,
CAST((SUM(IF(p.volume > 0,p.volume,p.width * p.depth * IF(p.height, p.height, i.size + pconfig.upperGap))
* b.stickers)/1000000) AS DECIMAL(10,2)) m3,
TRUNCATE(SUM(b.stickers)/(COUNT( b.id) / COUNT( DISTINCT b.id)),0) hb,
CAST(SUM(b.freightValue*b.quantity) AS DECIMAL(10,2)) freightValue,
CAST(SUM(b.packageValue*b.quantity) AS DECIMAL(10,2)) packageValue
FROM vn.travel t
LEFT JOIN vn.entry e ON t.id = e.travelFk
LEFT JOIN vn.entry e ON t.id = e.travelFk
LEFT JOIN vn.buy b ON b.entryFk = e.id
LEFT JOIN vn.supplier s ON e.supplierFk = s.id
LEFT JOIN vn.supplier s ON e.supplierFk = s.id
JOIN vn.item i ON i.id = b.itemFk
LEFT JOIN vn.packaging p ON p.id = b.packageFk
JOIN vn.packaging pcc ON pcc.id = 'cc'
JOIN vn.packaging ppallet ON ppallet.id = 'pallet 100'
JOIN vn.packagingConfig pconfig
WHERE t.id = ?
WHERE t.id = ?
GROUP BY e.id;`, [
id
]);

View File

@ -1,28 +1,34 @@
const app = require('vn-loopback/server/server');
const models = require('vn-loopback/server/server').models;
describe('travel getEntries()', () => {
const travelId = 1;
it('should check the response contains the id', async() => {
const entries = await app.models.Travel.getEntries(travelId);
const entries = await models.Travel.getEntries(travelId);
expect(entries.length).toEqual(1);
expect(entries[0].id).toEqual(1);
});
it('should check the response contains the travelFk', async() => {
const entries = await app.models.Travel.getEntries(travelId);
const entries = await models.Travel.getEntries(travelId);
expect(entries[0].travelFk).toEqual(1);
});
it('should check the response contains the ref', async() => {
const entries = await app.models.Travel.getEntries(travelId);
it('should check the response contains the reference', async() => {
const entries = await models.Travel.getEntries(travelId);
expect(entries[0].ref).toEqual('Movement 1');
expect(entries[0].reference).toEqual('Movement 1');
});
it('should check the response contains the invoiceNumber', async() => {
const entries = await models.Travel.getEntries(travelId);
expect(entries[0].invoiceNumber).toEqual('IN2001');
});
it('should check the response contains the m3', async() => {
const entries = await app.models.Travel.getEntries(travelId);
const entries = await models.Travel.getEntries(travelId);
expect(entries[0].m3).toEqual(0.22);
});

View File

@ -1,6 +1,6 @@
<vn-card class="summary">
<h5>
<a
<a
ng-if="::$ctrl.travelData.id"
vn-tooltip="Go to the travel"
ui-sref="travel.card.summary({id: {{::$ctrl.travelData.id}}})"
@ -13,15 +13,15 @@
<vn-horizontal>
<vn-one>
<vn-label-value
label="Shipped"
label="Shipped"
value="{{$ctrl.travelData.shipped | date: 'dd/MM/yyyy'}}">
</vn-label-value>
<vn-label-value
label="Warehouse Out"
label="Warehouse Out"
value="{{$ctrl.travelData.warehouseOut.name}}">
</vn-label-value>
<vn-check
label="Delivered"
label="Delivered"
ng-model="$ctrl.travelData.isDelivered"
disabled="true">
</vn-check>
@ -36,7 +36,7 @@
value="{{$ctrl.travelData.warehouseIn.name}}">
</vn-label-value>
<vn-check
label="Received"
label="Received"
ng-model="$ctrl.travelData.isReceived"
disabled="true">
</vn-check>
@ -80,7 +80,7 @@
<vn-tbody>
<vn-tr ng-repeat="entry in $ctrl.entries">
<vn-td shrink>
<vn-check
<vn-check
ng-model="entry.isConfirmed"
disabled="true">
</vn-check>
@ -99,7 +99,7 @@
<vn-td shrink>{{entry.cc}}</vn-td>
<vn-td shrink>{{entry.pallet}}</vn-td>
<vn-td shrink>{{entry.m3}}</vn-td>
<vn-td shrink>
<vn-td shrink>
<vn-icon
ng-if="entry.notes.length"
vn-tooltip="{{entry.notes}}"
@ -134,13 +134,13 @@
</vn-auto>
<vn-auto ng-if="$ctrl.travelThermographs.length != 0">
<h4 ng-show="$ctrl.isBuyer">
<a
<a
ui-sref="travel.card.thermograph.index({id:$ctrl.travelData.id})"
target="_self">
<span translate vn-tooltip="Go to">Thermograph</span>
</a>
</h4>
<h4
<h4
translate
ng-show="!$ctrl.isBuyer">
Thermograph
@ -168,6 +168,6 @@
</vn-auto>
</vn-horizontal>
</vn-card>
<vn-entry-descriptor-popover
<vn-entry-descriptor-popover
vn-id="entryDescriptor">
</vn-entry-descriptor-popover>
</vn-entry-descriptor-popover>

View File

@ -410,6 +410,8 @@ describe('workerTimeControl add/delete timeEntry()', () => {
describe('12h rest', () => {
it('should throw an error when the 12h rest is not fulfilled yet', async() => {
pending('https://redmine.verdnatura.es/issues/4707');
activeCtx.accessToken.userId = salesBossId;
const workerId = hankPymId;

40058
package-lock.json generated

File diff suppressed because it is too large Load Diff