Merge
This commit is contained in:
commit
91b5ad5a3e
|
@ -1,3 +1,4 @@
|
|||
coverage
|
||||
node_modules
|
||||
dist/*
|
||||
e2e/dms/*/
|
||||
|
|
|
@ -68,11 +68,10 @@ pipeline {
|
|||
environment {
|
||||
NODE_ENV = ""
|
||||
FIREFOX_BIN = "/opt/firefox/firefox-bin"
|
||||
DB_HOST = "${env.DOCKER_HOST_2}"
|
||||
}
|
||||
steps {
|
||||
nodejs('node-lts') {
|
||||
sh 'karma start --junit'
|
||||
// sh 'karma start --junit'
|
||||
sh 'gulp backTestDockerOnce --junit --random --run-chown'
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ $ gulp docker
|
|||
|
||||
For client-side unit tests run from project's root.
|
||||
```
|
||||
$ karma start
|
||||
$ jest
|
||||
```
|
||||
|
||||
For server-side unit tests run from project's root.
|
||||
|
@ -73,6 +73,6 @@ $ gulp e2e
|
|||
* [loopback](https://loopback.io/)
|
||||
* [docker](https://www.docker.com/)
|
||||
* [gulp.js](https://gulpjs.com/)
|
||||
* [Karma](https://karma-runner.github.io/)
|
||||
* [jest](https://jestjs.io/)
|
||||
* [Jasmine](https://jasmine.github.io/)
|
||||
* [Nightmare](http://www.nightmarejs.org/)
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
module.exports = {
|
||||
presets: [
|
||||
'@babel/preset-env',
|
||||
],
|
||||
};
|
|
@ -8,7 +8,7 @@ module.exports = Self => {
|
|||
{
|
||||
arg: 'id',
|
||||
type: 'Number',
|
||||
description: 'Document id',
|
||||
description: 'The document id',
|
||||
http: {source: 'path'}
|
||||
}
|
||||
],
|
||||
|
|
|
@ -19,8 +19,8 @@ module.exports = Self => {
|
|||
next();
|
||||
});
|
||||
|
||||
Self.remoteMethod('getCurrentUserName', {
|
||||
description: 'Gets the current user name',
|
||||
Self.remoteMethod('getCurrentUserData', {
|
||||
description: 'Gets the current user data',
|
||||
accepts: [
|
||||
{
|
||||
arg: 'context',
|
||||
|
@ -31,21 +31,22 @@ module.exports = Self => {
|
|||
}
|
||||
],
|
||||
returns: {
|
||||
type: 'string',
|
||||
type: 'object',
|
||||
root: true
|
||||
},
|
||||
http: {
|
||||
verb: 'GET',
|
||||
path: '/getCurrentUserName'
|
||||
path: '/getCurrentUserData'
|
||||
}
|
||||
});
|
||||
|
||||
Self.getCurrentUserName = async function(ctx) {
|
||||
Self.getCurrentUserData = async function(ctx) {
|
||||
let filter = {fields: ['name']};
|
||||
let userId = ctx.req.accessToken.userId;
|
||||
let account = await Self.findById(userId, filter);
|
||||
let worker = await Self.app.models.Worker.findOne({where: {userFk: userId}, fields: ['id']});
|
||||
|
||||
return account.name;
|
||||
return {accountName: account.name, workerId: worker.id};
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -21,6 +21,9 @@
|
|||
},
|
||||
"isManaged":{
|
||||
"type": "boolean"
|
||||
},
|
||||
"hasStowaway":{
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"acls": [
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
CREATE
|
||||
OR REPLACE ALGORITHM = UNDEFINED
|
||||
DEFINER = `root`@`%`
|
||||
SQL SECURITY DEFINER
|
||||
VIEW `vn`.`invoiceOut` AS
|
||||
SELECT
|
||||
`f`.`factura_id` AS `id`,
|
||||
`f`.`Id_Factura` AS `ref`,
|
||||
`f`.`Serie` AS `serial`,
|
||||
`f`.`Fecha` AS `issued`,
|
||||
`f`.`Importe` AS `amount`,
|
||||
`f`.`Id_Cliente` AS `clientFk`,
|
||||
`f`.`odbc_date` AS `created`,
|
||||
`f`.`empresa_id` AS `companyFk`,
|
||||
`f`.`Vencimiento` AS `dued`,
|
||||
`f`.`booked` AS `booked`,
|
||||
`f`.`Id_Banco` AS `bankFk`,
|
||||
`f`.`cplusInvoiceType477Fk` AS `cplusInvoiceType477Fk`,
|
||||
`f`.`cplusTaxBreakFk` AS `cplusTaxBreakFk`,
|
||||
`f`.`cplusSubjectOpFk` AS `cplusSubjectOpFk`,
|
||||
`f`.`cplusTrascendency477Fk` AS `cplusTrascendency477Fk`,
|
||||
`f`.`pdf` AS `hasPdf`
|
||||
FROM
|
||||
`vn2008`.`Facturas` `f`;
|
|
@ -1,60 +0,0 @@
|
|||
DROP procedure IF EXISTS `vn`.`invoiceOutAgain`;
|
||||
|
||||
DELIMITER $$
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`invoiceOutAgain`(IN vInvoiceRef VARCHAR(15), vTaxArea VARCHAR(25))
|
||||
BEGIN
|
||||
|
||||
/* Para tickets ya facturados, vuelve a repetir el proceso de facturación.
|
||||
*
|
||||
* @param vInvoiceFk Numero de factura
|
||||
* @param vTaxArea Numero de factura
|
||||
*/
|
||||
|
||||
DECLARE vInvoiceFk INT;
|
||||
DECLARE vCountry INT;
|
||||
DECLARE vTaxArea VARCHAR(15);
|
||||
DECLARE vSpainCountryCode INT DEFAULT 1;
|
||||
|
||||
SELECT id INTO vInvoiceFk
|
||||
FROM invoiceOut
|
||||
WHERE ref = vInvoiceRef;
|
||||
|
||||
UPDATE invoiceOut
|
||||
SET hasPdf = 0
|
||||
WHERE id = vInvoiceFk;
|
||||
|
||||
SELECT s.countryFk INTO vCountry
|
||||
FROM supplier s
|
||||
JOIN invoiceOut io ON io.companyFk = s.id
|
||||
WHERE io.id = vInvoiceFk;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS ticketToInvoice;
|
||||
|
||||
CREATE TEMPORARY TABLE ticketToInvoice
|
||||
SELECT id
|
||||
FROM ticket
|
||||
WHERE refFk = vInvoiceRef;
|
||||
|
||||
CALL invoiceExpenceMake(vInvoiceFk);
|
||||
|
||||
CALL invoiceTaxMake(vInvoiceFk,vTaxArea);
|
||||
|
||||
UPDATE invoiceOut io
|
||||
JOIN (
|
||||
SELECT SUM(amount) AS total
|
||||
FROM invoiceOutExpence
|
||||
WHERE invoiceOutFk = vInvoiceFk
|
||||
) base
|
||||
JOIN (
|
||||
SELECT SUM(vat) AS total
|
||||
FROM invoiceOutTax
|
||||
WHERE invoiceOutFk = vInvoiceFk
|
||||
) vat
|
||||
SET io.amount = base.total + vat.total
|
||||
WHERE io.id = vInvoiceFk;
|
||||
|
||||
CALL vn.invoiceOutBooking(vInvoiceFk);
|
||||
|
||||
END$$
|
||||
|
||||
DELIMITER ;
|
|
@ -1,38 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`ticket_componentMakeUpdate`(
|
||||
vTicketFk INT,
|
||||
vClientFk INT,
|
||||
vAgencyModeFk INT,
|
||||
vAddressFk INT,
|
||||
vZoneFk INT,
|
||||
vWarehouseFk TINYINT,
|
||||
vCompanyFk SMALLINT,
|
||||
vShipped DATETIME,
|
||||
vLanded DATE,
|
||||
vIsDeleted BOOLEAN,
|
||||
vHasToBeUnrouted BOOLEAN,
|
||||
vOption INT)
|
||||
BEGIN
|
||||
|
||||
CALL vn.ticket_componentPreview (vTicketFk, vLanded, vAddressFk, vZoneFk, vWarehouseFk);
|
||||
CALL vn.ticket_componentUpdate (
|
||||
vTicketFk,
|
||||
vClientFk,
|
||||
vAgencyModeFk,
|
||||
vAddressFk,
|
||||
vZoneFk,
|
||||
vWarehouseFk,
|
||||
vCompanyFk,
|
||||
vShipped,
|
||||
vLanded,
|
||||
vIsDeleted,
|
||||
vHasToBeUnrouted,
|
||||
vOption
|
||||
);
|
||||
|
||||
DROP TEMPORARY TABLE
|
||||
tmp.ticketComponent,
|
||||
tmp.ticketComponentPrice;
|
||||
END$$
|
||||
|
||||
DELIMITER ;
|
|
@ -1,111 +0,0 @@
|
|||
USE `vn`;
|
||||
DROP procedure IF EXISTS `ticket_componentPreview`;
|
||||
|
||||
DELIMITER $$
|
||||
USE `vn`$$
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `ticket_componentPreview`(
|
||||
vTicketFk INT,
|
||||
vLanded DATE,
|
||||
vAddressFk INT,
|
||||
vZoneFk INT,
|
||||
vWarehouseFk SMALLINT)
|
||||
BEGIN
|
||||
/**
|
||||
* Calcula los componentes de los articulos de un ticket
|
||||
*
|
||||
* @param vTicketFk id del ticket
|
||||
* @param vLanded nueva fecha de entrega
|
||||
* @param vAddressFk nuevo consignatario
|
||||
* @param vZoneFk nueva zona
|
||||
* @param vWarehouseFk nuevo warehouse
|
||||
*
|
||||
* @return tmp.ticketComponent (warehouseFk, itemFk, componentFk, cost)
|
||||
*/
|
||||
DECLARE vShipped DATE;
|
||||
DECLARE vBuyOrderItem INT DEFAULT 100;
|
||||
|
||||
DECLARE vHasDataChanged BOOL DEFAULT FALSE;
|
||||
DECLARE vHasAddressChanged BOOL;
|
||||
DECLARE vHasZoneChanged BOOL DEFAULT FALSE;
|
||||
DECLARE vHasWarehouseChanged BOOL DEFAULT FALSE;
|
||||
|
||||
DECLARE vAddressTypeRateFk INT DEFAULT NULL;
|
||||
DECLARE vAgencyModeTypeRateFk INT DEFAULT NULL;
|
||||
|
||||
DECLARE vHasChangeAll BOOL DEFAULT FALSE;
|
||||
|
||||
SELECT DATE(landed) <> vLanded,
|
||||
addressFk <> vAddressFk,
|
||||
zoneFk <> vZoneFk,
|
||||
warehouseFk <> vWarehouseFk
|
||||
INTO
|
||||
vHasDataChanged,
|
||||
vHasAddressChanged,
|
||||
vHasZoneChanged,
|
||||
vHasWarehouseChanged
|
||||
FROM vn.ticket t
|
||||
WHERE t.id = vTicketFk;
|
||||
|
||||
IF vHasDataChanged OR vHasWarehouseChanged THEN
|
||||
SET vHasChangeAll = TRUE;
|
||||
END IF;
|
||||
|
||||
IF vHasAddressChanged THEN
|
||||
SET vAddressTypeRateFk = 5;
|
||||
END IF;
|
||||
|
||||
IF vHasZoneChanged THEN
|
||||
SET vAgencyModeTypeRateFk = 6;
|
||||
END IF;
|
||||
|
||||
SELECT TIMESTAMPADD(DAY, -travelingDays, vLanded) INTO vShipped
|
||||
FROM zone
|
||||
WHERE id = vZoneFk;
|
||||
|
||||
CALL buyUltimate(vWarehouseFk, vShipped);
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot;
|
||||
CREATE TEMPORARY TABLE tmp.ticketLot ENGINE = MEMORY (
|
||||
SELECT
|
||||
vWarehouseFk AS warehouseFk,
|
||||
NULL AS available,
|
||||
s.itemFk,
|
||||
bu.buyFk
|
||||
FROM sale s
|
||||
LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk
|
||||
WHERE s.ticketFk = vTicketFk
|
||||
AND s.itemFk != vBuyOrderItem
|
||||
GROUP BY bu.warehouseFk, bu.itemFk);
|
||||
|
||||
CALL catalog_componentCalculate(vZoneFk, vAddressFk, vShipped);
|
||||
|
||||
REPLACE INTO tmp.ticketComponent (warehouseFk, itemFk, componentFk, cost)
|
||||
SELECT t.warehouseFk, s.itemFk, sc.componentFk, sc.value
|
||||
FROM saleComponent sc
|
||||
JOIN sale s ON s.id = sc.saleFk
|
||||
JOIN ticket t ON t.id = s.ticketFk
|
||||
JOIN componentRate cr ON cr.id = sc.componentFk
|
||||
WHERE s.ticketFk = vTicketFk
|
||||
AND (cr.isRenewable = FALSE
|
||||
OR
|
||||
(NOT vHasChangeAll
|
||||
AND (NOT (cr.componentTypeRate <=> vAddressTypeRateFk
|
||||
OR cr.componentTypeRate <=> vAgencyModeTypeRateFk))));
|
||||
|
||||
SET @shipped = vShipped;
|
||||
|
||||
DROP TEMPORARY TABLE
|
||||
tmp.buyUltimate,
|
||||
tmp.ticketLot;
|
||||
|
||||
IF vShipped IS NULL THEN
|
||||
CALL util.throw('NO_ZONE_AVAILABLE');
|
||||
END IF;
|
||||
|
||||
IF vShipped < CURDATE() THEN
|
||||
CALL util.throw('ERROR_PAST_SHIPMENT');
|
||||
END IF;
|
||||
END$$
|
||||
|
||||
DELIMITER ;
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
DROP procedure IF EXISTS `vn`.`ticket_priceDifference`;
|
||||
|
||||
DELIMITER $$
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`ticket_priceDifference`(
|
||||
vTicketFk INT,
|
||||
vLanded DATE,
|
||||
vAddressFk INT,
|
||||
vZoneFk INT,
|
||||
vWarehouseFk INT)
|
||||
BEGIN
|
||||
/**
|
||||
* Devuelve las diferencias de precio
|
||||
* de los movimientos de un ticket.
|
||||
*
|
||||
* @param vTicketFk Id del ticket
|
||||
* @param vLanded Fecha de recepcion
|
||||
* @param vAddressFk Id del consignatario
|
||||
* @param vZoneFk Id de la zona
|
||||
* @param vWarehouseFk Id del almacén
|
||||
*/
|
||||
CALL vn.ticket_componentPreview(vTicketFk, vLanded, vAddressFk, vZoneFk, vWarehouseFk);
|
||||
|
||||
SELECT s.itemFk,
|
||||
i.name,
|
||||
i.size,
|
||||
i.category,
|
||||
IFNULL(s.quantity, 0) AS quantity,
|
||||
IFNULL(s.price, 0) AS price,
|
||||
ROUND(SUM(tc.cost), 2) AS newPrice,
|
||||
s.quantity * (s.price - ROUND(SUM(tc.cost), 2)) difference,
|
||||
s.id AS saleFk
|
||||
FROM sale s
|
||||
JOIN item i ON i.id = s.itemFk
|
||||
JOIN ticket t ON t.id = s.ticketFk
|
||||
LEFT JOIN tmp.ticketComponent tc ON tc.itemFk = s.itemFk
|
||||
AND tc.warehouseFk = t.warehouseFk
|
||||
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
|
||||
AND sc.componentFk = tc.componentFk
|
||||
LEFT JOIN componentRate cr ON cr.id = tc.componentFk
|
||||
WHERE
|
||||
t.id = vTicketFk
|
||||
AND IF(sc.componentFk IS NULL
|
||||
AND cr.classRate IS NOT NULL, FALSE, TRUE)
|
||||
GROUP BY s.id ORDER BY s.id;
|
||||
|
||||
DROP TEMPORARY TABLE
|
||||
tmp.ticketComponent,
|
||||
tmp.ticketComponentPrice;
|
||||
END$$
|
||||
|
||||
DELIMITER ;
|
||||
|
|
@ -1,147 +0,0 @@
|
|||
DROP procedure IF EXISTS `cache`.`available_refresh`;
|
||||
|
||||
DELIMITER $$
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `cache`.`available_refresh`(OUT `vCalc` INT, IN `vRefresh` INT, IN `vWarehouse` INT, IN `vDate` DATE)
|
||||
proc: BEGIN
|
||||
DECLARE vStartDate DATE;
|
||||
DECLARE vEndDate DATETIME;
|
||||
DECLARE vReserveDate DATETIME;
|
||||
DECLARE vParams CHAR(100);
|
||||
DECLARE vInventoryDate DATE;
|
||||
|
||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||
BEGIN
|
||||
CALL cache_calc_unlock (vCalc);
|
||||
RESIGNAL;
|
||||
END;
|
||||
|
||||
IF vDate < CURDATE() THEN
|
||||
LEAVE proc;
|
||||
END IF;
|
||||
|
||||
CALL vn2008.item_stock (vWarehouse, vDate, NULL);
|
||||
|
||||
SET vParams = CONCAT_WS('/', vWarehouse, vDate);
|
||||
CALL cache_calc_start (vCalc, vRefresh, 'available', vParams);
|
||||
|
||||
IF !vRefresh THEN
|
||||
LEAVE proc;
|
||||
END IF;
|
||||
|
||||
-- Calcula algunos parámetros necesarios
|
||||
|
||||
SET vStartDate = TIMESTAMP(vDate, '00:00:00');
|
||||
SET vEndDate = TIMESTAMP(TIMESTAMPADD(DAY, 4, vDate), '23:59:59');
|
||||
|
||||
SELECT FechaInventario INTO vInventoryDate FROM vn2008.tblContadores;
|
||||
|
||||
SELECT SUBTIME(NOW(), reserveTime) INTO vReserveDate
|
||||
FROM hedera.orderConfig;
|
||||
|
||||
-- Calcula el ultimo dia de vida para cada producto
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS item_range;
|
||||
CREATE TEMPORARY TABLE item_range
|
||||
(PRIMARY KEY (item_id))
|
||||
ENGINE = MEMORY
|
||||
SELECT c.item_id, IF(t.life IS NULL, NULL,
|
||||
TIMESTAMP(TIMESTAMPADD(DAY, t.life, c.landing), '23:59:59')) AS date_end
|
||||
FROM (
|
||||
SELECT c.Id_Article item_id, MAX(landing) landing
|
||||
FROM vn2008.Compres c
|
||||
JOIN vn2008.Entradas e ON c.Id_Entrada = e.Id_Entrada
|
||||
JOIN vn2008.travel t ON t.id = e.travel_id
|
||||
JOIN vn2008.warehouse w ON w.id = t.warehouse_id
|
||||
WHERE t.landing BETWEEN vInventoryDate AND vStartDate
|
||||
AND t.warehouse_id = vWarehouse
|
||||
AND NOT e.Inventario
|
||||
AND NOT e.Redada
|
||||
GROUP BY Id_Article
|
||||
) c
|
||||
JOIN vn2008.Articles a ON a.Id_Article = c.item_id
|
||||
JOIN vn2008.Tipos t ON t.tipo_id = a.tipo_id
|
||||
HAVING date_end >= vStartDate OR date_end IS NULL;
|
||||
|
||||
-- Replica la tabla item_range para poder usarla varias veces en la misma consulta
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS item_range_copy1;
|
||||
CREATE TEMPORARY TABLE item_range_copy1 LIKE item_range;
|
||||
INSERT INTO item_range_copy1
|
||||
SELECT * FROM item_range;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS item_range_copy2;
|
||||
CREATE TEMPORARY TABLE item_range_copy2 LIKE item_range;
|
||||
INSERT INTO item_range_copy2
|
||||
SELECT * FROM item_range;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS item_range_copy3;
|
||||
CREATE TEMPORARY TABLE item_range_copy3 LIKE item_range;
|
||||
INSERT INTO item_range_copy3
|
||||
SELECT * FROM item_range;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS item_range_copy4;
|
||||
CREATE TEMPORARY TABLE item_range_copy4 LIKE item_range;
|
||||
INSERT INTO item_range_copy4
|
||||
SELECT * FROM item_range;
|
||||
|
||||
-- Calcula el ATP
|
||||
|
||||
DELETE FROM available WHERE calc_id = vCalc;
|
||||
|
||||
INSERT INTO available (calc_id, item_id, available)
|
||||
SELECT vCalc, t.item_id, SUM(stock) amount FROM (
|
||||
SELECT ti.item_id, stock
|
||||
FROM vn2008.tmp_item ti
|
||||
JOIN item_range ir ON ir.item_id = ti.item_id
|
||||
UNION ALL
|
||||
SELECT t.item_id, minacum(dt, amount, vDate) AS available FROM (
|
||||
SELECT item_id, DATE(dat) dt, SUM(amount) amount FROM (
|
||||
SELECT i.item_id, i.dat, i.amount
|
||||
FROM vn2008.item_out i
|
||||
JOIN item_range_copy1 ir ON ir.item_id = i.item_id
|
||||
WHERE i.dat >= vStartDate
|
||||
AND (ir.date_end IS NULL OR i.dat <= ir.date_end)
|
||||
AND i.warehouse_id = vWarehouse
|
||||
UNION ALL
|
||||
SELECT i.item_id, i.dat, i.amount
|
||||
FROM vn2008.item_entry_in i
|
||||
JOIN item_range_copy2 ir ON ir.item_id = i.item_id
|
||||
WHERE i.dat >= vStartDate
|
||||
AND (ir.date_end IS NULL OR i.dat <= ir.date_end)
|
||||
AND i.warehouse_id = vWarehouse
|
||||
UNION ALL
|
||||
SELECT i.item_id, i.dat, i.amount
|
||||
FROM vn2008.item_entry_out i
|
||||
JOIN item_range_copy3 ir ON ir.item_id = i.item_id
|
||||
WHERE i.dat >= vStartDate
|
||||
AND (ir.date_end IS NULL OR i.dat <= ir.date_end)
|
||||
AND i.warehouse_id = vWarehouse
|
||||
UNION ALL
|
||||
SELECT r.item_id, r.shipment, -r.amount
|
||||
FROM hedera.order_row r
|
||||
JOIN hedera.`order` o ON o.id = r.order_id
|
||||
JOIN item_range_copy4 ir ON ir.item_id = r.item_id
|
||||
WHERE r.shipment >= vStartDate
|
||||
AND (ir.date_end IS NULL OR r.shipment <= ir.date_end)
|
||||
AND r.warehouse_id = vWarehouse
|
||||
AND r.created >= vReserveDate
|
||||
AND NOT o.confirmed
|
||||
) t
|
||||
GROUP BY item_id, dt
|
||||
) t
|
||||
GROUP BY t.item_id
|
||||
) t GROUP BY t.item_id;
|
||||
|
||||
DROP TEMPORARY TABLE
|
||||
vn2008.tmp_item
|
||||
,item_range
|
||||
,item_range_copy1
|
||||
,item_range_copy2
|
||||
,item_range_copy3
|
||||
,item_range_copy4;
|
||||
|
||||
CALL cache_calc_end (vCalc);
|
||||
END$$
|
||||
|
||||
DELIMITER ;
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
ALTER TABLE `postgresql`.`calendar_state`
|
||||
ADD COLUMN `code` VARCHAR(45) NULL AFTER `permissionRate`;
|
||||
|
||||
UPDATE `postgresql`.`calendar_state` SET `code` = 'holiday' WHERE `calendar_state_id` = 1;
|
||||
UPDATE `postgresql`.`calendar_state` SET `code` = 'halfHoliday' WHERE `calendar_state_id` = 6;
|
|
@ -1,12 +0,0 @@
|
|||
CREATE
|
||||
OR REPLACE ALGORITHM = UNDEFINED
|
||||
DEFINER = `root`@`%`
|
||||
SQL SECURITY DEFINER
|
||||
VIEW `vn`.`absenceType` AS
|
||||
SELECT
|
||||
`cs`.`calendar_state_id` AS `id`,
|
||||
`cs`.`type` AS `name`,
|
||||
`cs`.`rgb` AS `rgb`,
|
||||
`cs`.`code` AS `code`
|
||||
FROM
|
||||
`postgresql`.`calendar_state` `cs`;
|
|
@ -1,12 +0,0 @@
|
|||
DROP VIEW IF EXISTS `vn`.`queuePriority` ;
|
||||
|
||||
CREATE
|
||||
OR REPLACE ALGORITHM = UNDEFINED
|
||||
DEFINER = `root`@`%`
|
||||
SQL SECURITY DEFINER
|
||||
VIEW `vn`.`queuePriority` AS
|
||||
SELECT
|
||||
`p`.`Id_Prioridad` AS `id`,
|
||||
`p`.`Prioridad` AS `priority`
|
||||
FROM
|
||||
`vn2008`.`Prioridades` `p`;
|
|
@ -0,0 +1,6 @@
|
|||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||
VALUES
|
||||
('Dms', '*', 'READ', 'ALLOW', 'ROLE', 'employee'),
|
||||
('ClaimDms', 'removeFile', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
|
||||
('ClaimDms', '*', 'READ', 'ALLOW', 'ROLE', 'employee'),
|
||||
('Claim', 'uploadFile', 'WRITE', 'ALLOW', 'ROLE', 'employee');
|
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE `vn`.`claimLog`
|
||||
CHANGE COLUMN `id` `id` INT(11) NOT NULL AUTO_INCREMENT ;
|
|
@ -0,0 +1,14 @@
|
|||
DROP TRIGGER IF EXISTS `vn2008`.`ticket_afterUpdate`;
|
||||
|
||||
DELIMITER $$
|
||||
CREATE DEFINER=`root`@`%` TRIGGER `vn2008`.`ticket_afterUpdate`
|
||||
AFTER UPDATE ON `Tickets`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
IF !(NEW.Id_Ticket <=> OLD.Id_Ticket)
|
||||
OR !(NEW.warehouse_id <=> OLD.warehouse_id)
|
||||
OR !(NEW.Fecha <=> OLD.Fecha) THEN
|
||||
CALL stock.log_add('ticket', NEW.Id_Ticket, OLD.Id_Ticket);
|
||||
END IF;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -0,0 +1,2 @@
|
|||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||
VALUES ('Sale', 'updateConcept', 'WRITE', 'ALLOW', 'ROLE', 'employee');
|
|
@ -0,0 +1,117 @@
|
|||
DROP procedure IF EXISTS `vn`.`catalog_calculate`;
|
||||
|
||||
DELIMITER $$
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`catalog_calculate`(
|
||||
vLanded DATE,
|
||||
vAddressFk INT,
|
||||
vAgencyModeFk INT)
|
||||
proc: BEGIN
|
||||
/**
|
||||
* Calcula los articulos disponibles y sus precios
|
||||
*
|
||||
* @table tmp.item(itemFk) Listado de artículos a calcular
|
||||
* @param vLanded Fecha de recepcion de mercancia
|
||||
* @param vAddressFk Id del consignatario
|
||||
* @param vAgencyModeFk Id de la agencia
|
||||
* @return tmp.ticketCalculateItem(itemFk, available, producer,
|
||||
* item, size, stems, category, inkFk, image, origin, price)
|
||||
* @return tmp.ticketLot(warehouseFk, itemFk, available, buyFk)
|
||||
* @return tmp.ticketComponent
|
||||
* @return tmp.ticketComponentPrice
|
||||
* @return tmp.zoneGetShipped
|
||||
|
||||
**/
|
||||
|
||||
DECLARE vAvailableCalc INT;
|
||||
DECLARE vShipped DATE;
|
||||
DECLARE vClient INT;
|
||||
DECLARE vWarehouseFk SMALLINT;
|
||||
DECLARE vZoneFk INT;
|
||||
DECLARE vDone BOOL;
|
||||
DECLARE cTravelTree CURSOR FOR
|
||||
SELECT id, warehouseFk, shipped FROM tmp.zoneGetShipped;
|
||||
|
||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
||||
|
||||
-- Establece los almacenes y las fechas que van a entrar al disponible
|
||||
|
||||
SELECT clientFk INTO vClient
|
||||
FROM address WHERE id = vAddressFk;
|
||||
|
||||
CALL vn.zoneGetShippedWarehouse(vLanded, vAddressFk, vAgencyModeFk);
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot;
|
||||
CREATE TEMPORARY TABLE tmp.ticketLot(
|
||||
`warehouseFk` smallint(5) unsigned NOT NULL,
|
||||
`itemFk` int(11) NOT NULL,
|
||||
`available` double DEFAULT NULL,
|
||||
`buyFk` int(11) DEFAULT NULL,
|
||||
`fix` tinyint(3) unsigned DEFAULT '0',
|
||||
KEY `itemFk` (`itemFk`),
|
||||
KEY `item_warehouse` (`itemFk`,`warehouseFk`) USING HASH
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=utf8;
|
||||
|
||||
OPEN cTravelTree;
|
||||
|
||||
l: LOOP
|
||||
SET vDone = FALSE;
|
||||
FETCH cTravelTree INTO vZoneFk, vWarehouseFk, vShipped;
|
||||
|
||||
IF vDone THEN
|
||||
LEAVE l;
|
||||
END IF;
|
||||
|
||||
CALL `cache`.available_refresh (vAvailableCalc, FALSE, vWarehouseFk, vShipped);
|
||||
CALL buyUltimate (vWarehouseFk, vShipped);
|
||||
|
||||
INSERT INTO tmp.ticketLot (warehouseFk, itemFk, available, buyFk)
|
||||
SELECT vWarehouseFk,
|
||||
i.item_id,
|
||||
IFNULL(i.available, 0),
|
||||
bu.buyFk
|
||||
FROM `cache`.available i
|
||||
JOIN tmp.item br ON br.itemFk = i.item_id
|
||||
LEFT JOIN item it ON it.id = i.item_id
|
||||
LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = i.item_id
|
||||
WHERE i.calc_id = vAvailableCalc
|
||||
AND it.id != 100
|
||||
AND i.available > 0;
|
||||
|
||||
DROP TEMPORARY TABLE tmp.buyUltimate;
|
||||
END LOOP;
|
||||
|
||||
CLOSE cTravelTree;
|
||||
|
||||
CALL vn.catalog_componentCalculate(vZoneFk, vAddressFk, vShipped);
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketCalculateItem;
|
||||
CREATE TEMPORARY TABLE tmp.ticketCalculateItem
|
||||
ENGINE = MEMORY
|
||||
SELECT
|
||||
b.itemFk,
|
||||
SUM(b.available) available,
|
||||
p.name producer,
|
||||
i.name item,
|
||||
i.size size,
|
||||
i.stems,
|
||||
i.category,
|
||||
i.inkFk,
|
||||
i.image,
|
||||
o.code origin,
|
||||
bl.price,
|
||||
bl.priceKg
|
||||
FROM tmp.ticketLot b
|
||||
JOIN item i ON b.itemFk = i.id
|
||||
LEFT JOIN producer p ON p.id = i.producerFk AND p.isVisible
|
||||
JOIN origin o ON o.id = i.originFk
|
||||
JOIN (
|
||||
SELECT MIN(price) price, itemFk, priceKg
|
||||
FROM tmp.ticketComponentPrice
|
||||
GROUP BY itemFk
|
||||
) bl ON bl.itemFk = b.itemFk
|
||||
GROUP BY b.itemFk;
|
||||
|
||||
END$$
|
||||
|
||||
DELIMITER ;
|
||||
|
|
@ -0,0 +1,258 @@
|
|||
|
||||
DROP procedure IF EXISTS `vn`.`catalog_componentCalculate`;
|
||||
|
||||
DELIMITER $$
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`catalog_componentCalculate`(
|
||||
vZoneFk INT,
|
||||
vAddressFk INT,
|
||||
vShipped DATE)
|
||||
proc: BEGIN
|
||||
/**
|
||||
* Calcula los componentes de los articulos de tmp.ticketLot
|
||||
*
|
||||
* @param vZoneFk para calcular el transporte
|
||||
* @param vAgencyModeFk Id del modo de agencia
|
||||
* @param tmp.ticketLot (warehouseFk,available,itemFk,buyFk)
|
||||
*
|
||||
* @return tmp.ticketComponent(itemFk, warehouseFk, available, rate2, rate3, minPrice,
|
||||
* packing, grouping, groupingMode, buyFk, typeFk)
|
||||
* @return tmp.ticketComponentPrice (warehouseFk, itemFk, rate, grouping, price)
|
||||
*/
|
||||
|
||||
DECLARE vClientFk INT;
|
||||
DECLARE vGeneralInflationCoefficient INT DEFAULT 1;
|
||||
DECLARE vMinimumDensityWeight INT DEFAULT 167;
|
||||
DECLARE vBoxFreightItem INT DEFAULT 71;
|
||||
DECLARE vBoxVolume BIGINT; -- DEFAULT 138000;
|
||||
DECLARE vSpecialPriceComponent INT DEFAULT 10;
|
||||
DECLARE vDeliveryComponent INT DEFAULT 15;
|
||||
DECLARE vRecoveryComponent INT DEFAULT 17;
|
||||
DECLARE vSellByPacketComponent INT DEFAULT 22;
|
||||
DECLARE vBuyValueComponent INT DEFAULT 28;
|
||||
DECLARE vMarginComponent INT DEFAULT 29;
|
||||
DECLARE vDiscountLastItemComponent INT DEFAULT 32;
|
||||
DECLARE vExtraBaggedComponent INT DEFAULT 38;
|
||||
DECLARE vManaAutoComponent INT DEFAULT 39;
|
||||
|
||||
SELECT volume INTO vBoxVolume
|
||||
FROM vn.packaging
|
||||
WHERE id = '94';
|
||||
|
||||
SELECT clientFk INTO vClientFK
|
||||
FROM address
|
||||
WHERE id = vAddressFk;
|
||||
|
||||
SET @rate2 := 0;
|
||||
SET @rate3 := 0;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentCalculate;
|
||||
CREATE TEMPORARY TABLE tmp.ticketComponentCalculate
|
||||
(PRIMARY KEY (itemFk, warehouseFk))
|
||||
ENGINE = MEMORY
|
||||
SELECT
|
||||
tl.itemFk, tl.warehouseFk, tl.available,
|
||||
IF((@rate2 := IFNULL(pf.rate2, b.price2)) < i.minPrice AND i.hasMinPrice, i.minPrice, @rate2) * 1.0 rate2,
|
||||
IF((@rate3 := IFNULL(pf.rate3, b.price3)) < i.minPrice AND i.hasMinPrice, i.minPrice, @rate3) * 1.0 rate3,
|
||||
IFNULL(pf.rate3, 0) AS minPrice,
|
||||
IFNULL(pf.packing, b.packing) packing,
|
||||
IFNULL(pf.`grouping`, b.`grouping`) grouping,
|
||||
ABS(IFNULL(pf.box, b.groupingMode)) groupingMode,
|
||||
tl.buyFk,
|
||||
i.typeFk,
|
||||
IF(i.hasKgPrice,(b.packing * b.weight) / 1000, NULL) weightPacking
|
||||
FROM tmp.ticketLot tl
|
||||
JOIN buy b ON b.id = tl.buyFk
|
||||
JOIN item i ON i.id = tl.itemFk
|
||||
JOIN itemType it ON it.id = i.typeFk
|
||||
LEFT JOIN itemCategory ic ON ic.id = it.categoryFk
|
||||
LEFT JOIN specialPrice sp ON sp.itemFk = i.id AND sp.clientFk = vClientFk
|
||||
LEFT JOIN (
|
||||
SELECT * FROM (
|
||||
SELECT pf.itemFk, pf.`grouping`, pf.packing, pf.box, pf.rate2, pf.rate3, z.warehouseFk
|
||||
FROM priceFixed pf
|
||||
JOIN zone z ON z.warehouseFk = pf.warehouseFk OR pf.warehouseFk = 0
|
||||
WHERE vShipped BETWEEN pf.started AND pf.ended ORDER BY pf.itemFk, pf.warehouseFk DESC
|
||||
) tpf
|
||||
GROUP BY tpf.itemFk, tpf.warehouseFk
|
||||
) pf ON pf.itemFk = tl.itemFk AND pf.warehouseFk = tl.warehouseFk
|
||||
WHERE b.buyingValue + b.freightValue + b.packageValue + b.comissionValue > 0.01 AND ic.display <> 0;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponent;
|
||||
CREATE TEMPORARY TABLE tmp.ticketComponent (
|
||||
`warehouseFk` INT UNSIGNED NOT NULL,
|
||||
`itemFk` INT NOT NULL,
|
||||
`componentFk` INT UNSIGNED NOT NULL,
|
||||
`cost` DECIMAL(10,4) NOT NULL,
|
||||
INDEX `itemWarehouse` USING BTREE (`itemFk` ASC, `warehouseFk` ASC),
|
||||
UNIQUE INDEX `itemWarehouseComponent` (`itemFk` ASC, `warehouseFk` ASC, `componentFk` ASC));
|
||||
|
||||
INSERT INTO tmp.ticketComponent (warehouseFk, itemFk, componentFk, cost)
|
||||
SELECT
|
||||
tcc.warehouseFk,
|
||||
tcc.itemFk,
|
||||
vBuyValueComponent,
|
||||
b.buyingValue + b.freightValue + b.packageValue + b.comissionValue
|
||||
FROM tmp.ticketComponentCalculate tcc
|
||||
JOIN buy b ON b.id = tcc.buyFk;
|
||||
|
||||
INSERT INTO tmp.ticketComponent (warehouseFk, itemFk, componentFk, cost)
|
||||
SELECT
|
||||
tcc.warehouseFk,
|
||||
tcc.itemFk,
|
||||
vMarginComponent,
|
||||
tcc.rate3 - b.buyingValue - b.freightValue - b.packageValue - b.comissionValue
|
||||
FROM tmp.ticketComponentCalculate tcc
|
||||
JOIN buy b ON b.id = tcc.buyFk;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentBase;
|
||||
CREATE TEMPORARY TABLE tmp.ticketComponentBase ENGINE = MEMORY
|
||||
SELECT tc.itemFk, ROUND(SUM(tc.cost), 4) AS base, tc.warehouseFk
|
||||
FROM tmp.ticketComponent tc
|
||||
GROUP BY tc.itemFk, warehouseFk;
|
||||
|
||||
INSERT INTO tmp.ticketComponent
|
||||
SELECT tcb.warehouseFk, tcb.itemFk, vRecoveryComponent, ROUND(tcb.base * LEAST(cr.recobro, 0.25), 3)
|
||||
FROM tmp.ticketComponentBase tcb
|
||||
JOIN bi.claims_ratio cr ON cr.Id_Cliente = vClientFk
|
||||
WHERE cr.recobro > 0.009;
|
||||
|
||||
INSERT INTO tmp.ticketComponent
|
||||
SELECT tcb.warehouseFk, tcb.itemFk, vManaAutoComponent, ROUND(base * (0.01 + prices_modifier_rate), 3) as manaAuto
|
||||
FROM tmp.ticketComponentBase tcb
|
||||
JOIN `client` c on c.id = vClientFk
|
||||
JOIN bs.mana_spellers ms ON c.salesPersonFk = ms.Id_Trabajador
|
||||
WHERE ms.prices_modifier_activated
|
||||
HAVING manaAuto <> 0;
|
||||
|
||||
INSERT INTO tmp.ticketComponent
|
||||
SELECT tcb.warehouseFk,
|
||||
tcb.itemFk,
|
||||
cr.id,
|
||||
GREATEST(IFNULL(ROUND(tcb.base * cr.tax, 4), 0), tcc.minPrice - tcc.rate3)
|
||||
FROM tmp.ticketComponentBase tcb
|
||||
JOIN componentRate cr
|
||||
JOIN tmp.ticketComponentCalculate tcc ON tcc.itemFk = tcb.itemFk AND tcc.warehouseFk = tcb.warehouseFk
|
||||
LEFT JOIN specialPrice sp ON sp.clientFk = vClientFk AND sp.itemFk = tcc.itemFk
|
||||
WHERE cr.id = vDiscountLastItemComponent AND cr.tax <> 0 AND tcc.minPrice < tcc.rate3 AND sp.value IS NULL;
|
||||
|
||||
INSERT INTO tmp.ticketComponent
|
||||
SELECT tcc.warehouseFk, tcc.itemFk, vSellByPacketComponent, tcc.rate2 - tcc.rate3
|
||||
FROM tmp.ticketComponentCalculate tcc
|
||||
JOIN buy b ON b.id = tcc.buyFk
|
||||
LEFT JOIN specialPrice sp ON sp.clientFk = vClientFk AND sp.itemFk = tcc.itemFk
|
||||
WHERE sp.value IS NULL;
|
||||
|
||||
INSERT INTO tmp.ticketComponent
|
||||
SELECT tcc.warehouseFK,
|
||||
tcc.itemFk,
|
||||
vDeliveryComponent,
|
||||
vGeneralInflationCoefficient
|
||||
* ROUND((
|
||||
i.compression
|
||||
* r.cm3
|
||||
* IF(am.deliveryMethodFk = 1, (GREATEST(i.density, vMinimumDensityWeight) / vMinimumDensityWeight), 1)
|
||||
* IFNULL((z.price - z.bonus)
|
||||
* 1/*amz.inflation*/ , 50)) / vBoxVolume, 4
|
||||
) cost
|
||||
FROM tmp.ticketComponentCalculate tcc
|
||||
JOIN item i ON i.id = tcc.itemFk
|
||||
JOIN zone z ON z.id = vZoneFk
|
||||
JOIN agencyMode am ON am.id = z.agencyModeFk
|
||||
LEFT JOIN bi.rotacion r ON r.warehouse_id = tcc.warehouseFk
|
||||
AND r.Id_Article = tcc.itemFk
|
||||
HAVING cost <> 0;
|
||||
|
||||
IF (SELECT COUNT(*) FROM vn.addressForPackaging WHERE addressFk = vAddressFk) THEN
|
||||
INSERT INTO tmp.ticketComponent
|
||||
SELECT tcc.warehouseFk, b.itemFk, vExtraBaggedComponent, ap.packagingValue cost
|
||||
FROM tmp.ticketComponentCalculate tcc
|
||||
JOIN vn.addressForPackaging ap
|
||||
WHERE ap.addressFk = vAddressFk;
|
||||
END IF;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentCopy;
|
||||
CREATE TEMPORARY TABLE tmp.ticketComponentCopy ENGINE = MEMORY
|
||||
SELECT * FROM tmp.ticketComponent;
|
||||
|
||||
INSERT INTO tmp.ticketComponent
|
||||
SELECT tcc.warehouseFk,
|
||||
tcc.itemFk,
|
||||
vSpecialPriceComponent,
|
||||
sp.value - SUM(tcc.cost) sumCost
|
||||
FROM tmp.ticketComponentCopy tcc
|
||||
JOIN componentRate cr ON cr.id = tcc.componentFk
|
||||
JOIN specialPrice sp ON sp.clientFk = vClientFK AND sp.itemFk = tcc.itemFk
|
||||
WHERE cr.classRate IS NULL
|
||||
GROUP BY tcc.itemFk, tcc.warehouseFk
|
||||
HAVING ABS(sumCost) > 0.001;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentSum;
|
||||
CREATE TEMPORARY TABLE tmp.ticketComponentSum
|
||||
(INDEX (itemFk, warehouseFk))
|
||||
ENGINE = MEMORY
|
||||
SELECT SUM(cost) sumCost, tc.itemFk, tc.warehouseFk, cr.classRate
|
||||
FROM tmp.ticketComponent tc
|
||||
JOIN componentRate cr ON cr.id = tc.componentFk
|
||||
GROUP BY tc.itemFk, tc.warehouseFk, cr.classRate;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentRate;
|
||||
CREATE TEMPORARY TABLE tmp.ticketComponentRate ENGINE = MEMORY
|
||||
SELECT tcc.warehouseFk,
|
||||
tcc.itemFk,
|
||||
1 rate,
|
||||
IF(tcc.groupingMode = 1, tcc.`grouping`, 1) grouping,
|
||||
CAST(SUM(tcs.sumCost) AS DECIMAL(10,2)) price,
|
||||
CAST(SUM(tcs.sumCost) AS DECIMAL(10,2)) / weightPacking priceKg
|
||||
FROM tmp.ticketComponentCalculate tcc
|
||||
JOIN tmp.ticketComponentSum tcs ON tcs.itemFk = tcc.itemFk
|
||||
AND tcs.warehouseFk = tcc.warehouseFk
|
||||
WHERE IFNULL(tcs.classRate, 1) = 1
|
||||
AND tcc.groupingMode < 2 AND (tcc.packing > tcc.`grouping` or tcc.groupingMode = 0)
|
||||
GROUP BY tcs.warehouseFk, tcs.itemFk;
|
||||
|
||||
INSERT INTO tmp.ticketComponentRate (warehouseFk, itemFk, rate, grouping, price, priceKg)
|
||||
SELECT
|
||||
tcc.warehouseFk,
|
||||
tcc.itemFk,
|
||||
2 rate,
|
||||
tcc.packing grouping,
|
||||
SUM(tcs.sumCost) price,
|
||||
SUM(tcs.sumCost) / weightPacking priceKg
|
||||
FROM tmp.ticketComponentCalculate tcc
|
||||
JOIN tmp.ticketComponentSum tcs ON tcs.itemFk = tcc.itemFk
|
||||
AND tcs.warehouseFk = tcc.warehouseFk
|
||||
WHERE tcc.available IS NULL OR (IFNULL(tcs.classRate, 2) = 2
|
||||
AND tcc.packing > 0 AND tcc.available >= tcc.packing)
|
||||
GROUP BY tcs.warehouseFk, tcs.itemFk;
|
||||
|
||||
INSERT INTO tmp.ticketComponentRate (warehouseFk, itemFk, rate, grouping, price, priceKg)
|
||||
SELECT
|
||||
tcc.warehouseFk,
|
||||
tcc.itemFk,
|
||||
3 rate,
|
||||
tcc.available grouping,
|
||||
SUM(tcs.sumCost) price,
|
||||
SUM(tcs.sumCost) / weightPacking priceKg
|
||||
FROM tmp.ticketComponentCalculate tcc
|
||||
JOIN tmp.ticketComponentSum tcs ON tcs.itemFk = tcc.itemFk
|
||||
AND tcs.warehouseFk = tcc.warehouseFk
|
||||
WHERE IFNULL(tcs.classRate, 3) = 3
|
||||
GROUP BY tcs.warehouseFk, tcs.itemFk;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentPrice;
|
||||
CREATE TEMPORARY TABLE tmp.ticketComponentPrice ENGINE = MEMORY
|
||||
SELECT * FROM (
|
||||
SELECT * FROM tmp.ticketComponentRate ORDER BY price
|
||||
) t
|
||||
GROUP BY itemFk, warehouseFk, `grouping`;
|
||||
|
||||
DROP TEMPORARY TABLE
|
||||
tmp.ticketComponentCalculate,
|
||||
tmp.ticketComponentSum,
|
||||
tmp.ticketComponentBase,
|
||||
tmp.ticketComponentRate,
|
||||
tmp.ticketComponentCopy;
|
||||
END$$
|
||||
|
||||
DELIMITER ;
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE `vn2008`.`Movimientos_componentes`
|
||||
CHANGE COLUMN `Valor` `Valor` DECIMAL(10,4) NOT NULL ;
|
|
@ -0,0 +1,16 @@
|
|||
USE `vn`;
|
||||
DROP procedure IF EXISTS `ticketCalculate`;
|
||||
|
||||
DELIMITER $$
|
||||
USE `vn`$$
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `ticketCalculate`(
|
||||
vLanded DATE,
|
||||
vAddressFk INT,
|
||||
vAgencyModeFk INT)
|
||||
proc: BEGIN
|
||||
-- OBSOLETO utilizar catalog_calculate
|
||||
CALL vn.catalog_calculate(vLanded, vAddressFk, vAgencyModeFk);
|
||||
END$$
|
||||
|
||||
DELIMITER ;
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
ALTER TABLE `vn2008`.`warehouse`
|
||||
ADD COLUMN `hasStowaway` TINYINT(1) NOT NULL DEFAULT 0 AFTER `hasConfectionTeam`;
|
||||
|
||||
|
||||
UPDATE `vn2008`.`warehouse` SET `hasStowaway` = '1' WHERE (`id` = '1');
|
||||
|
||||
|
||||
|
||||
CREATE
|
||||
OR REPLACE ALGORITHM = UNDEFINED
|
||||
DEFINER = `root`@`%`
|
||||
SQL SECURITY DEFINER
|
||||
VIEW `vn`.`warehouse` AS
|
||||
SELECT
|
||||
`t`.`id` AS `id`,
|
||||
`t`.`name` AS `name`,
|
||||
`t`.`inventario` AS `isInventory`,
|
||||
`t`.`fuente` AS `isFeedStock`,
|
||||
`t`.`is_comparative` AS `isComparative`,
|
||||
`t`.`comisionantes` AS `hasComission`,
|
||||
`t`.`reserve` AS `hasAvailable`,
|
||||
`t`.`isManaged` AS `isManaged`,
|
||||
`t`.`tpv` AS `isForTicket`,
|
||||
`t`.`hasStowaway` AS `hasStowaway`
|
||||
FROM
|
||||
`vn2008`.`warehouse` `t`;
|
|
@ -0,0 +1,47 @@
|
|||
DROP procedure IF EXISTS `vn`.`zoneGetLanded`;
|
||||
|
||||
DELIMITER $$
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`zoneGetLanded`(vShipped DATE, vAddressFk INT, vAgencyModeFk INT, vWarehouseFk INT)
|
||||
BEGIN
|
||||
/**
|
||||
* Devuelve una tabla temporal con el dia de recepcion para vShipped.
|
||||
*
|
||||
* @param vShipped Fecha de preparacion de mercancia
|
||||
* @param vAddressFk Id de consignatario, %NULL para recogida
|
||||
* @param vAgencyModeFk Id agencia
|
||||
* @table tmp.zoneGetLanded Datos de recepción
|
||||
*/
|
||||
DECLARE vPostalCode varchar(10);
|
||||
|
||||
SELECT postalCode INTO vPostalCode
|
||||
FROM address WHERE id = vAddressFk;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.zoneGetLanded;
|
||||
CREATE TEMPORARY TABLE tmp.zoneGetLanded
|
||||
ENGINE = MEMORY
|
||||
SELECT
|
||||
id zoneFk,
|
||||
vShipped shipped,
|
||||
delivered landed,
|
||||
vWarehouseFk warehouseFk,
|
||||
agencyModeFk,
|
||||
isIncluded
|
||||
FROM (
|
||||
SELECT zi.isIncluded, zc.delivered, z.id, z.agencyModeFk
|
||||
FROM vn.zoneGeo zgSon
|
||||
JOIN vn.zoneGeo zgFather ON zgSon.lft BETWEEN zgFather.lft AND zgFather.rgt
|
||||
JOIN zoneIncluded zi ON zi.geoFk = zgFather.id
|
||||
JOIN zone z ON z.id = zi.zoneFk
|
||||
JOIN zoneCalendar zc ON zc.zoneFk = z.id
|
||||
WHERE zgSon.`name` LIKE vPostalCode
|
||||
AND zc.delivered = TIMESTAMPADD(DAY,z.travelingDays, vShipped)
|
||||
AND IF(vShipped = CURDATE(), hour(now()) < hour(z.`hour`),TRUE)
|
||||
AND z.agencyModeFk = vAgencyModeFk
|
||||
AND z.warehouseFk = vWarehouseFk
|
||||
ORDER BY zgFather.depth DESC) t
|
||||
GROUP BY zoneFk
|
||||
HAVING isIncluded > 0
|
||||
LIMIT 1;
|
||||
END$$
|
||||
|
||||
DELIMITER ;
|
|
@ -0,0 +1,47 @@
|
|||
DROP procedure IF EXISTS `vn`.`zoneGetShipped`;
|
||||
|
||||
DELIMITER $$
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`zoneGetShipped`(vLanded DATE, vAddressFk INT, vAgencyModeFk INT, vWarehouseFk INT)
|
||||
BEGIN
|
||||
/**
|
||||
* Devuelve la mínima fecha de envía para cada warehouse
|
||||
*
|
||||
* @param vLanded La fecha de recepcion
|
||||
* @param vAddressFk Id del consignatario
|
||||
* @param vAgencyModeFk Id de la agencia
|
||||
* @return tmp.zoneGetShipped
|
||||
*/
|
||||
|
||||
DECLARE vPostalCode varchar(10);
|
||||
|
||||
SELECT postalCode INTO vPostalCode
|
||||
FROM address WHERE id = vAddressFk;
|
||||
|
||||
SELECT * FROM (
|
||||
SELECT * FROM (
|
||||
SELECT z.id zoneFk,
|
||||
TIMESTAMPADD(DAY,-z.travelingDays, vLanded) shipped,
|
||||
vLanded landed,
|
||||
vWarehouseFk warehouseFk,
|
||||
z.agencyModeFk,
|
||||
zi.isIncluded
|
||||
FROM zoneGeo zgSon
|
||||
JOIN zoneGeo zgFather ON zgSon.lft BETWEEN zgFather.lft AND zgFather.rgt
|
||||
JOIN zoneIncluded zi ON zi.geoFk = zgFather.id
|
||||
JOIN zone z ON z.id = zi.zoneFk
|
||||
JOIN zoneCalendar zc ON zc.zoneFk = z.id
|
||||
WHERE zgSon.`name` LIKE vPostalCode
|
||||
AND zc.delivered = vLanded
|
||||
AND z.agencyModeFk = vAgencyModeFk
|
||||
AND z.warehouseFk = vWarehouseFk
|
||||
AND IF(TIMESTAMPADD(DAY,-z.travelingDays, vLanded) = CURDATE(), hour(now()) < hour(z.`hour`),TRUE)
|
||||
ORDER BY z.id, zgFather.depth DESC, isIncluded DESC) t
|
||||
GROUP BY zoneFk
|
||||
HAVING isIncluded > 0
|
||||
ORDER BY shipped)
|
||||
t
|
||||
GROUP BY agencyModeFk;
|
||||
END$$
|
||||
|
||||
DELIMITER ;
|
||||
|
File diff suppressed because one or more lines are too long
|
@ -1,12 +1,13 @@
|
|||
ALTER TABLE `vn`.`itemTaxCountry` AUTO_INCREMENT = 1;
|
||||
ALTER TABLE `vn2008`.`Consignatarios` AUTO_INCREMENT = 1;
|
||||
ALTER TABLE `vn`.`zoneGeo` AUTO_INCREMENT = 1;
|
||||
|
||||
INSERT INTO `vn`.`ticketConfig` (`id`, `scopeDays`)
|
||||
VALUES
|
||||
VALUES
|
||||
('1', '6');
|
||||
|
||||
INSERT INTO `account`.`mailConfig` (`id`, `domain`)
|
||||
VALUES
|
||||
INSERT INTO `account`.`mailConfig` (`id`, `domain`)
|
||||
VALUES
|
||||
('1', 'verdnatura.es');
|
||||
|
||||
INSERT INTO `account`.`user`(`id`,`name`, `nickname`, `password`,`role`,`active`,`email`, `lang`)
|
||||
|
@ -56,13 +57,13 @@ INSERT INTO `vn`.`country`(`id`, `country`, `isUeeMember`, `code`, `currencyFk`,
|
|||
(19,'Francia', 1, 'FR', 1, 25),
|
||||
(30,'Canarias', 1, 'IC', 1, 22);
|
||||
|
||||
INSERT INTO `vn`.`warehouse`(`id`, `name`, `isComparative`, `isInventory`, `hasAvailable`, `isManaged`)
|
||||
INSERT INTO `vn`.`warehouse`(`id`, `name`, `isComparative`, `isInventory`, `hasAvailable`, `isManaged`, `hasStowaway`)
|
||||
VALUES
|
||||
(1, 'Warehouse One', 1, 1, 1, 1),
|
||||
(2, 'Warehouse Two', 1, 1, 1, 1),
|
||||
(3, 'Warehouse Three', 1, 1, 1, 1),
|
||||
(4, 'Warehouse Four', 1, 1, 1, 1),
|
||||
(5, 'Warehouse Five', 1, 1, 1, 1);
|
||||
(1, 'Warehouse One', 1, 1, 1, 1, 1),
|
||||
(2, 'Warehouse Two', 1, 1, 1, 1, 0),
|
||||
(3, 'Warehouse Three', 1, 1, 1, 1, 0),
|
||||
(4, 'Warehouse Four', 1, 1, 1, 1, 0),
|
||||
(5, 'Warehouse Five', 1, 1, 1, 1, 0);
|
||||
|
||||
INSERT INTO `vn`.`warehouseAlias`(`id`, `name`)
|
||||
VALUES
|
||||
|
@ -76,6 +77,13 @@ INSERT INTO `vn`.`accountingType`(`id`, `description`)
|
|||
(4, 'Stolen Money'),
|
||||
(5, 'Miscellaneous');
|
||||
|
||||
INSERT INTO `vn`.`currency`(`id`, `code`, `name`, `ratio`)
|
||||
VALUES
|
||||
(1, 'EUR', 'Euro', 1),
|
||||
(2, 'USD', 'Dollar USA', 1.4),
|
||||
(3, 'GBP', 'Libra', 1),
|
||||
(4, 'JPY', 'Yen Japones', 1);
|
||||
|
||||
INSERT INTO `vn`.`bank`(`id`, `bank`, `account`, `cash`, `entityFk`, `isActive`, `currencyFk`)
|
||||
VALUES
|
||||
(1, 'Pay on receipt', '0000000000', 4, 0, 1, 1),
|
||||
|
@ -133,19 +141,13 @@ INSERT INTO `vn`.`payDem`(`id`, `payDem`)
|
|||
(1, 10),
|
||||
(2, 20);
|
||||
|
||||
INSERT INTO `vn2008`.`zones`(`zone_id`, `name`, `printingOrder`)
|
||||
VALUES
|
||||
(1, 'zone one', 1),
|
||||
(2, 'zone two', 2),
|
||||
(3, 'zone three', 3);
|
||||
|
||||
INSERT INTO `vn`.`province`(`id`, `name`, `countryFk`, `warehouseFk`, `zoneFk`)
|
||||
INSERT INTO `vn`.`province`(`id`, `name`, `countryFk`, `warehouseFk`)
|
||||
VALUES
|
||||
(1, 'Province one', 1, NULL, 1),
|
||||
(2, 'Province two', 1, NULL, 2),
|
||||
(3, 'Province three', 1, NULL, 3),
|
||||
(4, 'Province four', 1, NULL, 2),
|
||||
(5, 'Province five', 1, NULL, 1);
|
||||
(1, 'Province one', 1, NULL),
|
||||
(2, 'Province two', 1, NULL),
|
||||
(3, 'Province three', 1, NULL),
|
||||
(4, 'Province four', 1, NULL),
|
||||
(5, 'Province five', 1, NULL);
|
||||
|
||||
INSERT INTO `vn`.`town`(`id`, `name`, `provinceFk`)
|
||||
VALUES
|
||||
|
@ -154,12 +156,12 @@ INSERT INTO `vn`.`town`(`id`, `name`, `provinceFk`)
|
|||
(3, 'Algemesi', 1),
|
||||
(4, 'Alzira', 1);
|
||||
|
||||
INSERT INTO `vn`.`postCode`(`code`, `townFk`)
|
||||
INSERT INTO `vn`.`postCode`(`code`, `townFk`, `geoFk`)
|
||||
VALUES
|
||||
('46000', 1),
|
||||
('46460', 2),
|
||||
('46680', 3),
|
||||
('46600', 4);
|
||||
('46000', 1, 6),
|
||||
('46460', 2, 6),
|
||||
('46680', 3, 6),
|
||||
('46600', 4, 7);
|
||||
|
||||
INSERT INTO `vn`.`clientType`(`id`, `code`, `type`)
|
||||
VALUES
|
||||
|
@ -168,10 +170,6 @@ INSERT INTO `vn`.`clientType`(`id`, `code`, `type`)
|
|||
(3, 'handMaking', 'Confección'),
|
||||
(4, 'loses', 'Mermas');
|
||||
|
||||
INSERT INTO `vn`.`city`(`id`, `name`, `provinceFk`)
|
||||
VALUES
|
||||
(1, 'Gotham', 1);
|
||||
|
||||
INSERT INTO `vn`.`cplusTerIdNif`(`id`, `description`)
|
||||
VALUES
|
||||
(1, 'NIF');
|
||||
|
@ -187,12 +185,12 @@ INSERT INTO `vn`.`contactChannel`(`id`, `name`)
|
|||
INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city`,`postcode`,`phone`,`mobile`,`fax`,`isRelevant`,`email`,`iban`,`dueDay`,`accountingAccount`,`isEqualizated`,`provinceFk`,`hasToInvoice`,`credit`,`countryFk`,`isActive`,`gestdocFk`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`,`clientTypeFk`,`mailAddress`,`cplusTerIdNifFk`,`hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`eypbc`)
|
||||
VALUES
|
||||
(101, 'Bruce Wayne', '84612325V', 'Batman', 'Alfred', '1007 Mountain Drive, Gotham', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1),
|
||||
(102, 'Petter Parker', '87945234L', 'Spider-Man', 'Aunt May', '20 Ingram Street', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1),
|
||||
(103, 'Clark Kent', '06815934E', 'Super-Man', 'lois lane', '344 Clinton Street', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 0, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1),
|
||||
(104, 'Tony Stark', '06089160W', 'Iron-Man', 'Pepper Potts', '10880 Malibu Point', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1),
|
||||
(102, 'Petter Parker', '87945234L', 'Spider man', 'Aunt May', '20 Ingram Street', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1),
|
||||
(103, 'Clark Kent', '06815934E', 'Super man', 'lois lane', '344 Clinton Street', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 0, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1),
|
||||
(104, 'Tony Stark', '06089160W', 'Iron man', 'Pepper Potts', '10880 Malibu Point', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1),
|
||||
(105, 'Max Eisenhardt', '251628698', 'Magneto', 'Rogue', 'Unknown Whereabouts', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 18, 0, 1),
|
||||
(106, 'DavidCharlesHaller', '53136686Q', 'Legion', 'Charles Xavier', 'Evil hideout', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'DavidCharlesHaller@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 19, 0, 1),
|
||||
(107, 'Hank Pym', '09854837G', 'Ant-Man', 'Hawk', 'Anthill', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 0, 0, NULL, 0, 0, 19, 0, 1),
|
||||
(107, 'Hank Pym', '09854837G', 'Ant man', 'Hawk', 'Anthill', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 0, 0, NULL, 0, 0, 19, 0, 1),
|
||||
(108, 'Charles Xavier', '22641921P', 'Professor X', 'Beast', '3800 Victory Pkwy, Cincinnati, OH 45207, USA', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'CharlesXavier@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 19, 0, 1),
|
||||
(109, 'Bruce Banner', '16104829E', 'Hulk', 'Black widow', 'Somewhere in New York', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'BruceBanner@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 0, 0, NULL, 0, 0, 19, 0, 1),
|
||||
(110, 'Jessica Jones', '58282869H', 'Jessica Jones', 'Luke Cage', 'NYCC 2015 Poster', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'JessicaJones@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 0, 0, NULL, 0, 0, NULL, 0, 1),
|
||||
|
@ -397,12 +395,24 @@ UPDATE `vn`.`invoiceOut` SET ref = 'A1111111' WHERE id = 5;
|
|||
|
||||
INSERT INTO `vn`.`invoiceOutTax` (`invoiceOutFk`, `taxableBase`, `vat`, `pgcFk`)
|
||||
VALUES
|
||||
(1, 895.76, 89.58, 4722000010),
|
||||
(1, 33.80, 7.10, 4722000021),
|
||||
(2, 110.33, 11.03, 4770000010),
|
||||
(3, 8.07, 0.81, 4770000010),
|
||||
(4, 8.07, 0.81, 4770000010),
|
||||
(5, 8.07, 0.81, 4770000010);
|
||||
(1, 895.76, 89.58, 4722000010),
|
||||
(1, 33.80, 7.10, 4722000021),
|
||||
(2, 110.33, 11.03, 4770000010),
|
||||
(3, 8.07, 0.81, 4770000010),
|
||||
(4, 8.07, 0.81, 4770000010),
|
||||
(5, 8.07, 0.81, 4770000010);
|
||||
|
||||
INSERT INTO `vn`.`expence`(`id`, `taxTypeFk`, `name`, `isWithheld`)
|
||||
VALUES
|
||||
(2000000000, 1, 'Inmovilizado pendiente', 0),
|
||||
(2000000000, 3, 'Compra de bienes de inmovilizado', 0),
|
||||
(4751000000, 0, 'Retenciones', 1),
|
||||
(4751000000, 1, 'Retenciones', 1),
|
||||
(4751000000, 6, 'Retencion', 0),
|
||||
(6210000567, 0, 'Alquiler VNH', 0),
|
||||
(7001000000, 1, 'Mercaderia', 0);
|
||||
|
||||
|
||||
|
||||
INSERT INTO `vn`.`invoiceOutExpence`(`id`, `invoiceOutFk`, `amount`, `expenceFk`, `created`)
|
||||
VALUES
|
||||
|
@ -427,7 +437,7 @@ INSERT INTO `vn`.`invoiceOutSerial` (`code`, `description`, `isTaxed`, `taxAreaF
|
|||
('T', 'Española rapida', 1, 'NATIONAL', 0),
|
||||
('V', 'Intracomunitaria global', 0, 'CEE', 1);
|
||||
|
||||
INSERT INTO `vn`.`zone` (`id`, `name`, `hour`, `warehouseFk`, `agencyModeFk`, `travelingDays`, `price`, `bonus`)
|
||||
INSERT INTO `vn`.`zone` (`id`, `name`, `hour`, `warehouseFk`, `agencyModeFk`, `travelingDays`, `price`, `bonus`)
|
||||
VALUES
|
||||
(1, 'Zone pickup A', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 1, 1, 0, 0, 0),
|
||||
(2, 'Zone pickup B', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 2, 1, 0, 0, 0),
|
||||
|
@ -435,8 +445,8 @@ INSERT INTO `vn`.`zone` (`id`, `name`, `hour`, `warehouseFk`, `agencyModeFk`, `t
|
|||
(4, 'Zone 247 B', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 2, 7, 1, 2, 0),
|
||||
(5, 'Zone expensive A', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 1, 8, 1, 1000, 0),
|
||||
(6, 'Zone expensive B', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 2, 8, 1, 1000, 0),
|
||||
(7, 'Zone refund', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 1, 10, 0, 0, 0),
|
||||
(8, 'Zone others', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 1, 23, 0, 0, 0),
|
||||
(7, 'Zone refund', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 1, 23, 0, 0, 0),
|
||||
(8, 'Zone others', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 1, 10, 0, 0, 0),
|
||||
(9, 'Zone superMan', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 1, 2, 0, 0, 0),
|
||||
(10, 'Zone teleportation', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 3, 3, 0, 0, 0),
|
||||
(11, 'Zone pickup C', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 5, 1, 0, 0, 0),
|
||||
|
@ -467,8 +477,8 @@ INSERT INTO `vn`.`ticket`(`id`, `priority`, `agencyModeFk`,`warehouseFk`,`routeF
|
|||
(20, 1, 5, 5, 3, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 109, 'Somewhere in Thailand', 129, NULL, 0, 13, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)),
|
||||
(21, NULL, 5, 5, NULL, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 109, 'Somewhere in Holland', 102, NULL, 0, 13, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)),
|
||||
(22, NULL, 5, 5, NULL, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 109, 'Somewhere in Japan', 103, NULL, 0, 13, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)),
|
||||
(23, NULL, 23, 1, NULL, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 101, 'address 21', 121, NULL, 0, 8, CURDATE()),
|
||||
(24 ,NULL, 23, 1, NULL, CURDATE(), CURDATE(), 101, 'Bruce Wayne', 1, NULL, 0, 8, CURDATE());
|
||||
(23, NULL, 10, 1, NULL, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 101, 'address 21', 121, NULL, 0, 8, CURDATE()),
|
||||
(24 ,NULL, 10, 1, NULL, CURDATE(), CURDATE(), 101, 'Bruce Wayne', 1, NULL, 0, 8, CURDATE());
|
||||
|
||||
INSERT INTO `vn`.`ticketObservation`(`id`, `ticketFk`, `observationTypeFk`, `description`)
|
||||
VALUES
|
||||
|
@ -674,7 +684,7 @@ INSERT INTO `vn`.`sale`(`id`, `itemFk`, `ticketFk`, `concept`, `quantity`, `pric
|
|||
(4, 4, 1, 'Melee weapon heavy shield 1x0.5m', 20, 1.69, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
|
||||
(5, 1, 2, 'Ranged weapon longbow 2m', 1, 110.33, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
|
||||
(6, 1, 3, 'Ranged weapon longbow 2m', 1, 110.33, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -2 MONTH)),
|
||||
(7, 2, 11, 'Melee weapon combat fist 15cm', 15, 7.43, 0, 0, 0, CURDATE()),
|
||||
(7, 2, 11, 'Melee weapon combat fist 15cm', 15, 7.44, 0, 0, 0, CURDATE()),
|
||||
(8, 4, 11, 'Melee weapon heavy shield 1x0.5m', 10, 1.79, 0, 0, 0, CURDATE()),
|
||||
(9, 1, 16, 'Ranged weapon longbow 2m', 1, 103.49, 0, 0, 0, CURDATE()),
|
||||
(10, 2, 16, 'Melee weapon combat fist 15cm', 10, 7.08, 0, 0, 0, CURDATE()),
|
||||
|
@ -728,7 +738,7 @@ INSERT INTO `vn`.`saleComponent`(`saleFk`, `componentFk`, `value`)
|
|||
(6, 28, 50),
|
||||
(6, 29, 49.4),
|
||||
(6, 39, 0.994),
|
||||
(7, 15, 0.0114),
|
||||
(7, 15, 0.0199),
|
||||
(7, 17, 0.35),
|
||||
(7, 28, 5),
|
||||
(7, 29, 2),
|
||||
|
@ -1057,7 +1067,7 @@ INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `companyFk`,
|
|||
INSERT INTO `bi`.`claims_ratio`(`id_Cliente`, `Consumo`, `Reclamaciones`, `Ratio`, `recobro`, `inflacion`)
|
||||
VALUES
|
||||
(101, 500, NULL, 0.00, 0.00, 1.00),
|
||||
(102, 1000, 2.00, 0.01, 0.05, 1.00),
|
||||
(102, 1000, 2.00, 0.01, 0.05, 1.00),
|
||||
(103, 2000, 0.00, 0.00, 0.02, 1.00),
|
||||
(104, 2500, 150.00, 0.02, 0.10, 1.00);
|
||||
|
||||
|
@ -1066,10 +1076,10 @@ INSERT INTO `vn`.`buy`(`id`,`entryFk`,`itemFk`,`buyingValue`,`quantity`,`package
|
|||
(1, 1, 1, 50, 5000, 4, 1, 0.000, 0.000, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, 0.00, NULL, 0, 1, 0, DATE_ADD(CURDATE(), INTERVAL -2 MONTH)),
|
||||
(2, 2, 1, 50, 100, 4, 1, 0.000, 0.000, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, 0.00, NULL, 0, 1, 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
|
||||
(3, 3, 1, 50, 100, 4, 1, 0.000, 0.000, 0.000, 1, 1, 0, NULL, 0.00, 99.6, 99.4, 0.00, NULL, 0, 1, 0, CURDATE()),
|
||||
(4, 2, 2, 5, 450, 1, 1, 0.000, 0.000, 0.000, 10, 10, 0, NULL, 0.00, 7.30, 7.00, 0.00, NULL, 0, 1, 0, CURDATE()),
|
||||
(4, 2, 2, 5, 450, 3, 1, 0.000, 0.000, 0.000, 10, 10, 0, NULL, 0.00, 7.30, 7.00, 0.00, NULL, 0, 1, 0, CURDATE()),
|
||||
(5, 3, 3, 55, 500, 5, 1, 0.000, 0.000, 0.000, 1, 1, 0, NULL, 0.00, 78.3, 75.6, 0.00, NULL, 0, 1, 0, CURDATE()),
|
||||
(6, 4, 8, 50, 1000, 4, 1, 0.000, 0.000, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, 0.00, NULL, 0, 1, 0, CURDATE()),
|
||||
(7, 4, 9, 20, 1000, 1, 1, 0.000, 0.000, 0.000, 10, 10, 1, NULL, 0.00, 30.50, 29.00, 0.00, NULL, 0, 1, 0, CURDATE()),
|
||||
(7, 4, 9, 20, 1000, 3, 1, 0.000, 0.000, 0.000, 10, 10, 1, NULL, 0.00, 30.50, 29.00, 0.00, NULL, 0, 1, 0, CURDATE()),
|
||||
(8, 4, 4, 1.25, 1000, 3, 1, 0.000, 0.000, 0.000, 10, 10, 1, NULL, 0.00, 1.75, 1.67, 0.00, NULL, 0, 1, 0, CURDATE()),
|
||||
(9, 4, 4, 1.25, 1000, 3, 1, 0.000, 0.000, 0.000, 10, 10, 1, NULL, 0.00, 1.75, 1.67, 0.00, NULL, 0, 1, 0, CURDATE()),
|
||||
(10, 5, 1, 50, 10, 4, 1, 0.000, 0.000, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, 0.00, NULL, 0, 1, 0, CURDATE()),
|
||||
|
@ -1083,14 +1093,6 @@ INSERT INTO `vn2008`.`tblContadores`(`id`,`FechaInventario`)
|
|||
VALUES
|
||||
(1,DATE_ADD(CURDATE(),INTERVAL -1 MONTH));
|
||||
|
||||
INSERT INTO `vn2008`.`Estados` (`Id_Estado`, `Estado`)
|
||||
VALUES
|
||||
('1', 'En Espera');
|
||||
|
||||
INSERT INTO `vn2008`.`Informes` (`Id_Informe`, `Informe`)
|
||||
VALUES
|
||||
('30', 'Generar factura PDF');
|
||||
|
||||
INSERT INTO `vn`.`deliveryMethod`(`id`, `code`, `description`)
|
||||
VALUES
|
||||
(1, 'AGENCY', 'Agencia'),
|
||||
|
@ -1509,7 +1511,7 @@ INSERT INTO `vn`.`workCenter` (`id`, `name`, `warehouseFk`)
|
|||
('1', 'Silla', '1'),
|
||||
('5', 'Madrid', '5');
|
||||
|
||||
INSERT INTO `vn2008`.`workcenter_holiday` (`workcenter_id`, `day`, `year`)
|
||||
INSERT INTO `vn`.`workCenterHoliday` (`workCenterFk`, `days`, `year`)
|
||||
VALUES
|
||||
('1', '27.5', YEAR(CURDATE())),
|
||||
('5', '22', YEAR(CURDATE())),
|
||||
|
@ -1552,40 +1554,42 @@ INSERT INTO `vn`.`sharingCart`(`id`, `workerFk`, `started`, `ended`, `workerSubs
|
|||
VALUES
|
||||
(1, 18, DATE_ADD(CURDATE(), INTERVAL -5 DAY), DATE_ADD(CURDATE(), INTERVAL +15 DAY), 19, DATE_ADD(CURDATE(), INTERVAL -5 DAY));
|
||||
|
||||
CALL `vn`.zoneGeo_calcTree(); -- this is an auto calculate for table vn.zoneGeo, columns: path,lft,rgt,depth,sons
|
||||
|
||||
INSERT INTO `vn`.`zoneIncluded` (`zoneFk`, `geoFk`, `isIncluded`)
|
||||
VALUES
|
||||
(1, 3, 0),
|
||||
(1, 4, 0),
|
||||
(1, 5, 0),
|
||||
(1, 2, 1),
|
||||
(1, 1, 1),
|
||||
(2, 3, 0),
|
||||
(2, 4, 0),
|
||||
(2, 5, 0),
|
||||
(2, 2, 1),
|
||||
(2, 1, 1),
|
||||
(3, 3, 0),
|
||||
(3, 4, 0),
|
||||
(3, 5, 0),
|
||||
(3, 2, 1),
|
||||
(3, 1, 1),
|
||||
(4, 3, 0),
|
||||
(4, 4, 0),
|
||||
(4, 5, 0),
|
||||
(4, 2, 1),
|
||||
(4, 1, 1),
|
||||
(5, 3, 1),
|
||||
(5, 4, 0),
|
||||
(5, 5, 1),
|
||||
(5, 2, 1),
|
||||
(5, 1, 1),
|
||||
(6, 3, 1),
|
||||
(6, 4, 0),
|
||||
(6, 5, 1),
|
||||
(6, 2, 1),
|
||||
(6, 1, 1),
|
||||
(7, 3, 0),
|
||||
(7, 4, 0),
|
||||
(7, 5, 0),
|
||||
(7, 2, 1),
|
||||
(7, 1, 1),
|
||||
(8, 3, 0),
|
||||
(8, 4, 0),
|
||||
(8, 5, 0),
|
||||
(8, 2, 1);
|
||||
(8, 1, 1);
|
||||
|
||||
INSERT INTO `vn`.`zoneCalendar`(`zoneFk`, `delivered`)
|
||||
VALUES
|
||||
|
@ -1829,13 +1833,14 @@ INSERT INTO `vn`.`dmsType`(`id`, `name`, `path`, `readRoleFk`, `writeRoleFk`, `c
|
|||
(16, 'Logistica', 'logistica', NULL, NULL, 'logistics'),
|
||||
(17, 'cmr', 'cmr', NULL, NULL, 'cmr'),
|
||||
(18, 'dua', 'dua', NULL, NULL, 'dua'),
|
||||
(19, 'inmovilizado', 'inmovilizado', NULL, NULL, 'fixedAssets');
|
||||
(19, 'inmovilizado', 'inmovilizado', NULL, NULL, 'fixedAssets'),
|
||||
(20, 'Reclamación', 'reclamacion', 1, 1, 'claim');
|
||||
|
||||
INSERT INTO `vn`.`dms`(`id`, `dmsTypeFk`, `file`, `contentType`, `workerFk`, `warehouseFk`, `companyFk`, `hardCopyNumber`, `hasFile`, `reference`, `description`, `created`)
|
||||
VALUES
|
||||
(1, 14, '1.txt', 'text/plain', 5, 1, 442, NULL, FALSE, 'Ticket:11', 'Ticket:11 dms for the ticket', CURDATE()),
|
||||
(2, 5, '2.txt', 'text/plain', 5, 1, 442, 1, TRUE, 'Client:101', 'Client:101 dms for the client', CURDATE()),
|
||||
(3, 5, '3.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'Client: 101', 'Client:101 readme', CURDATE());
|
||||
(1, 14, '1.txt', 'text/plain', 5, 1, 442, NULL, FALSE, 'Ticket:11', 'Ticket:11 dms for the ticket', CURDATE()),
|
||||
(2, 5, '2.txt', 'text/plain', 5, 1, 442, 1, TRUE, 'Client:104', 'Client:104 dms for the client', CURDATE()),
|
||||
(3, 5, '3.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'Client: 104', 'Client:104 readme', CURDATE());
|
||||
|
||||
INSERT INTO `vn`.`ticketDms`(`ticketFk`, `dmsFk`)
|
||||
VALUES
|
||||
|
@ -1843,8 +1848,8 @@ INSERT INTO `vn`.`ticketDms`(`ticketFk`, `dmsFk`)
|
|||
|
||||
INSERT INTO `vn`.`clientDms`(`clientFk`, `dmsFk`)
|
||||
VALUES
|
||||
(101, 2),
|
||||
(101, 3);
|
||||
(104, 2),
|
||||
(104, 3);
|
||||
|
||||
INSERT INTO `vn`.`device` (`sn`, `model`, `userFk`)
|
||||
VALUES
|
||||
|
|
14402
db/dump/structure.sql
14402
db/dump/structure.sql
File diff suppressed because it is too large
Load Diff
|
@ -41,7 +41,10 @@ TABLES=(
|
|||
cplusTaxBreak
|
||||
pgc
|
||||
tag
|
||||
zoneGeo
|
||||
claimResponsible
|
||||
claimReason
|
||||
claimRedelivery
|
||||
claimResult
|
||||
)
|
||||
dump_tables ${TABLES[@]}
|
||||
|
||||
|
@ -50,21 +53,14 @@ TABLES=(
|
|||
accion_dits
|
||||
bionic_updating_options
|
||||
businessReasonEnd
|
||||
cl_con
|
||||
cl_res
|
||||
cl_dev
|
||||
cl_mot
|
||||
container
|
||||
department
|
||||
escritos
|
||||
Gastos
|
||||
Grupos
|
||||
iva_group_codigo
|
||||
Monedas
|
||||
state
|
||||
tarifa_componentes
|
||||
tarifa_componentes_series
|
||||
Tintas
|
||||
)
|
||||
dump_tables ${TABLES[@]}
|
||||
|
||||
|
|
|
@ -1,559 +0,0 @@
|
|||
|
||||
-- ticketCalculateClon-----------------------------------------------------------------------
|
||||
USE `vn`;
|
||||
DROP procedure IF EXISTS `ticketCalculateClon`;
|
||||
|
||||
DELIMITER $$
|
||||
USE `vn`$$
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `ticketCalculateClon`(IN vTicketNew INT, vTicketOld INT)
|
||||
BEGIN
|
||||
/*
|
||||
* @vTicketNew id del nuevo ticket clonado
|
||||
* @vTicketOld id ticket original, a partir del qual se clonara el nuevo
|
||||
* Este procedimiento "rebioniza" una linea, eliminando los componentes existentes e insertandolos de nuevo
|
||||
*/
|
||||
DECLARE vShipped DATE;
|
||||
DECLARE vClient INT;
|
||||
DECLARE vWarehouse SMALLINT;
|
||||
DECLARE vAgencyMode INT;
|
||||
DECLARE vAddress INT;
|
||||
DECLARE vLanded DATE;
|
||||
DECLARE vAgency INT;
|
||||
|
||||
REPLACE INTO orderTicket(orderFk,ticketFk)
|
||||
SELECT orderFk, vTicketNew
|
||||
FROM orderTicket
|
||||
WHERE ticketFk = vTicketOld;
|
||||
|
||||
SELECT t.clientFk , t.warehouseFk, date(t.shipped), t.addressFk, t.agencyModeFk, t.landed, a.agencyFk
|
||||
INTO vClient, vWarehouse, vShipped, vAddress, vAgencyMode, vLanded, vAgency
|
||||
FROM vn.agencyMode a
|
||||
JOIN vn.ticket t ON t.agencyModeFk = a.id
|
||||
WHERE t.id = vTicketNew;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.agencyHourGetShipped;
|
||||
CREATE TEMPORARY TABLE tmp.agencyHourGetShipped ENGINE = MEMORY
|
||||
SELECT vWarehouse warehouseFk, vShipped shipped, vLanded landed;
|
||||
|
||||
CALL buyUltimate(vWarehouse, vShipped); -- rellena la tabla tmp.buyUltimate con la ultima compra
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot;
|
||||
CREATE TEMPORARY TABLE tmp.ticketLot
|
||||
SELECT vWarehouse warehouseFk,NULL available,s.itemFk, bu.buyFk
|
||||
FROM sale s
|
||||
LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk
|
||||
WHERE s.ticketFk = vTicketOld GROUP BY s.itemFk;
|
||||
|
||||
CALL ticketComponentCalculate(vAddress,vAgencyMode);
|
||||
|
||||
-- Bionizamos lineas con Preu = 0
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.sale;
|
||||
CREATE TEMPORARY TABLE tmp.sale
|
||||
(PRIMARY KEY (saleFk)) ENGINE = MEMORY
|
||||
SELECT s.id saleFk, vWarehouse warehouseFk
|
||||
FROM sale s
|
||||
JOIN ticket t on t.id = s.ticketFk WHERE s.ticketFk = vTicketNew AND s.price = 0;
|
||||
|
||||
CALL ticketComponentUpdateSale(1);
|
||||
|
||||
-- Bionizamos lineas con Preu > 0
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.sale;
|
||||
CREATE TEMPORARY TABLE tmp.sale
|
||||
(PRIMARY KEY (saleFk)) ENGINE = MEMORY
|
||||
SELECT s.id saleFk, vWarehouse warehouseFk
|
||||
FROM sale s
|
||||
JOIN ticket t on t.id = s.ticketFk WHERE s.ticketFk = vTicketNew
|
||||
AND s.price > 0;
|
||||
|
||||
CALL ticketComponentUpdateSale(6);
|
||||
|
||||
IF vLanded IS NULL THEN
|
||||
CALL zoneGetLanded(vShipped, vAddress, vAgency,vWarehouse);
|
||||
UPDATE ticket t
|
||||
JOIN tmp.zoneGetLanded zgl ON t.warehouseFk = zgl.warehouseFk
|
||||
SET t.landed = zgl.landed
|
||||
WHERE t.id = vTicketNew;
|
||||
END IF;
|
||||
|
||||
-- Log
|
||||
CALL `logAdd`(vTicketNew, 'update', ' ticket' , 'Bioniza Ticket');
|
||||
|
||||
-- Limpieza
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.buyUltimate;
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.sale;
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot;
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.zoneGetLanded;
|
||||
END$$
|
||||
|
||||
DELIMITER ;
|
||||
|
||||
DROP VIEW IF EXISTS `vn`.`agencyWeekDayBonus` ;
|
||||
USE `vn`;
|
||||
CREATE
|
||||
OR REPLACE ALGORITHM = UNDEFINED
|
||||
DEFINER = `root`@`%`
|
||||
SQL SECURITY DEFINER
|
||||
VIEW `vn`.`agencyWeekDayBonusKk` AS
|
||||
SELECT
|
||||
`a`.`id` AS `id`,
|
||||
`a`.`warehouse_id` AS `warehouseFk`,
|
||||
`a`.`agency_id` AS `agencyFk`,
|
||||
`a`.`weekDay` AS `weekDay`,
|
||||
`a`.`zona` AS `zone`,
|
||||
`a`.`bonus` AS `bonus`
|
||||
FROM
|
||||
`vn2008`.`agency_weekday_bonus` `a`;
|
||||
|
||||
ALTER TABLE `vn2008`.`agency_weekday_bonus`
|
||||
RENAME TO `vn2008`.`agency_weekday_bonusKk` ;
|
||||
|
||||
ALTER TABLE `vn2008`.`preparation_percentage`
|
||||
RENAME TO `vn2008`.`preparation_percentageKk` ;
|
||||
|
||||
DROP VIEW IF EXISTS `vn`.`preparationPercentage` ;
|
||||
USE `vn`;
|
||||
CREATE
|
||||
OR REPLACE ALGORITHM = UNDEFINED
|
||||
DEFINER = `root`@`%`
|
||||
SQL SECURITY DEFINER
|
||||
VIEW `vn`.`preparationPercentageKk` AS
|
||||
SELECT
|
||||
`p`.`week_day` AS `weekDay`,
|
||||
`p`.`warehouse_id` AS `warehouseFk`,
|
||||
`p`.`percentage` AS `percentage`
|
||||
FROM
|
||||
`vn2008`.`preparation_percentage` `p`;
|
||||
|
||||
-- clonWeeklyTickets-----------------------------------------------------------------------
|
||||
USE `vn2008`;
|
||||
DROP procedure IF EXISTS `clonWeeklyTickets`;
|
||||
|
||||
DELIMITER $$
|
||||
USE `vn2008`$$
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `clonWeeklyTickets`(IN vWeek INT)
|
||||
BEGIN
|
||||
DECLARE done BIT DEFAULT 0;
|
||||
DECLARE vLanding DATE;
|
||||
DECLARE vShipment DATE;
|
||||
DECLARE vWarehouse INT;
|
||||
DECLARE vTicket INT;
|
||||
DECLARE vWeekDay INT;
|
||||
DECLARE vClient INT;
|
||||
DECLARE vEmpresa INT;
|
||||
DECLARE vConsignatario INT;
|
||||
DECLARE vAgencia INT;
|
||||
DECLARE vNewTicket INT;
|
||||
DECLARE vYear INT;
|
||||
|
||||
DECLARE rsTicket CURSOR FOR
|
||||
SELECT tt.Id_Ticket, weekDay, Id_Cliente, warehouse_id, empresa_id, Id_Consigna, Id_Agencia
|
||||
FROM Tickets_turno tt
|
||||
JOIN Tickets t ON tt.Id_Ticket = t.Id_Ticket;
|
||||
|
||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
|
||||
|
||||
SET done = 0;
|
||||
SET vYear = YEAR(CURDATE()) + IF(vWeek < WEEK(CURDATE()),1, 0);
|
||||
|
||||
OPEN rsTicket;
|
||||
|
||||
FETCH rsTicket INTO vTicket, vWeekDay, vClient, vWarehouse, vEmpresa, vConsignatario, vAgencia;
|
||||
|
||||
WHILE NOT done DO
|
||||
|
||||
SELECT date INTO vShipment
|
||||
FROM time
|
||||
WHERE year = vYear AND week = vWeek
|
||||
AND WEEKDAY(date) = vWeekDay;
|
||||
|
||||
-- busca si el ticket ya ha sido clonado
|
||||
IF (select count(*) FROM Tickets t JOIN ticket_observation tob ON t.Id_Ticket = tob.Id_Ticket
|
||||
WHERE Id_Consigna = vConsignatario AND Fecha = vShipment AND tob.text LIKE CONCAT('%',vTicket,'%')) = 0
|
||||
THEN
|
||||
|
||||
IF (SELECT COUNT(*) FROM Agencias WHERE Id_Agencia = vAgencia AND Agencia LIKE '%turno%') THEN
|
||||
SET vAgencia = NULL;
|
||||
END IF;
|
||||
|
||||
CALL vn.ticketCreate(vClient, vShipment, vWarehouse, vEmpresa, vConsignatario, vAgencia, NULL, vLanding, vNewTicket);
|
||||
|
||||
INSERT INTO Movimientos (Id_Ticket, Id_Article, Concepte, Cantidad, Preu, Descuento, CostFixat, PrecioFijado)
|
||||
SELECT vNewTicket, Id_Article, Concepte, Cantidad, Preu, Descuento, CostFixat, PrecioFijado
|
||||
FROM Movimientos WHERE Id_Ticket = vTicket;
|
||||
|
||||
INSERT INTO Ordenes (orden,datorden,datticket,codvendedor,codcomprador,cantidad,preciomax,preu,id_article,id_cliente,comentario,
|
||||
ok, total,datcompra,ko,id_movimiento)
|
||||
SELECT o.orden,o.datorden,vShipment,o.codvendedor,o.codcomprador,o.cantidad,o.preciomax,o.preu,o.id_article,o.id_cliente,o.comentario,
|
||||
o.ok, o.total,o.datcompra,o.ko,m2.Id_Movimiento
|
||||
FROM Movimientos m JOIN Ordenes o ON o.Id_Movimiento = m.Id_Movimiento
|
||||
JOIN Movimientos m2 ON m.Concepte = m2.Concepte AND m.Cantidad = m2.Cantidad AND m.Id_Article = m2.Id_Article
|
||||
WHERE m.Id_Ticket = vTicket AND m2.Id_Ticket = vNewTicket;
|
||||
|
||||
INSERT INTO ticket_observation(Id_Ticket,observation_type_id,text) VALUES(vNewTicket,4,CONCAT('turno desde ticket: ',vTicket))
|
||||
ON DUPLICATE KEY UPDATE text = CONCAT(ticket_observation.text,VALUES(text),' ');
|
||||
|
||||
INSERT INTO ticket_observation(Id_Ticket,observation_type_id,text) VALUES(vNewTicket,1,'ATENCION: Contiene lineas de TURNO')
|
||||
ON DUPLICATE KEY UPDATE text = CONCAT(ticket_observation.text,VALUES(text),' ');
|
||||
|
||||
CALL vn.ticketCalculateClon(vNewTicket, vTicket);
|
||||
END IF;
|
||||
FETCH rsTicket INTO vTicket, vWeekDay, vClient, vWarehouse, vEmpresa, vConsignatario, vAgencia;
|
||||
|
||||
END WHILE;
|
||||
|
||||
CLOSE rsTicket;
|
||||
|
||||
END$$
|
||||
|
||||
DELIMITER ;
|
||||
|
||||
|
||||
-- ticketComponentCalculate-----------------------------------------------------------------------
|
||||
|
||||
USE `vn`;
|
||||
DROP procedure IF EXISTS `ticketComponentCalculate`;
|
||||
|
||||
DELIMITER $$
|
||||
USE `vn`$$
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `ticketComponentCalculate`(
|
||||
vAddressFk INT,
|
||||
vAgencyModeFk INT)
|
||||
proc: BEGIN
|
||||
/**
|
||||
* Calcula los componentes de un ticket
|
||||
*
|
||||
* @param vAddressFk Id del consignatario
|
||||
* @param vAgencyModeFk Id del modo de agencia
|
||||
* @return tmp.ticketComponent, tmp.ticketComponentPrice
|
||||
*/
|
||||
|
||||
DECLARE vClientFk INT;
|
||||
DECLARE vGeneralInflationCoefficient INT DEFAULT 1;
|
||||
DECLARE vMinimumDensityWeight INT DEFAULT 167;
|
||||
DECLARE vBoxFreightItem INT DEFAULT 71;
|
||||
DECLARE vBoxVolume BIGINT; -- DEFAULT 138000;
|
||||
DECLARE vSpecialPriceComponent INT DEFAULT 10;
|
||||
DECLARE vDeliveryComponent INT DEFAULT 15;
|
||||
DECLARE vRecoveryComponent INT DEFAULT 17;
|
||||
DECLARE vSellByPacketComponent INT DEFAULT 22;
|
||||
DECLARE vBuyValueComponent INT DEFAULT 28;
|
||||
DECLARE vMarginComponent INT DEFAULT 29;
|
||||
DECLARE vDiscountLastItemComponent INT DEFAULT 32;
|
||||
DECLARE vExtraBaggedComponent INT DEFAULT 38;
|
||||
DECLARE vManaAutoComponent INT DEFAULT 39;
|
||||
|
||||
|
||||
SELECT volume INTO vBoxVolume
|
||||
FROM vn.packaging
|
||||
WHERE id = '94';
|
||||
|
||||
SELECT clientFk INTO vClientFK
|
||||
FROM address
|
||||
WHERE id = vAddressFk;
|
||||
|
||||
SET @rate2 := 0;
|
||||
SET @rate3 := 0;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentCalculate;
|
||||
CREATE TEMPORARY TABLE tmp.ticketComponentCalculate
|
||||
(PRIMARY KEY (itemFk, warehouseFk))
|
||||
ENGINE = MEMORY
|
||||
SELECT
|
||||
tl.itemFk, tl.warehouseFk, tl.available,
|
||||
IF((@rate2 := IFNULL(pf.rate2, b.price2)) < i.minPrice AND i.hasMinPrice, i.minPrice, @rate2) * 1.0 rate2,
|
||||
IF((@rate3 := IFNULL(pf.rate3, b.price3)) < i.minPrice AND i.hasMinPrice, i.minPrice, @rate3) * 1.0 rate3,
|
||||
IFNULL(pf.rate3, 0) AS minPrice,
|
||||
IFNULL(pf.packing, b.packing) packing,
|
||||
IFNULL(pf.grouping, b.grouping) grouping,
|
||||
ABS(IFNULL(pf.box, b.groupingMode)) groupingMode,
|
||||
tl.buyFk, i.typeFk
|
||||
FROM tmp.ticketLot tl
|
||||
JOIN buy b ON b.id = tl.buyFk
|
||||
JOIN item i ON i.id = tl.itemFk
|
||||
JOIN itemType it ON it.id = i.typeFk
|
||||
LEFT JOIN itemCategory ic ON ic.id = it.categoryFk
|
||||
LEFT JOIN specialPrice sp ON sp.itemFk = i.id AND sp.clientFk = vClientFk
|
||||
LEFT JOIN (
|
||||
SELECT * FROM (
|
||||
SELECT pf.itemFk, pf.grouping, pf.packing, pf.box, pf.rate2, pf.rate3, aho.warehouseFk
|
||||
FROM priceFixed pf
|
||||
JOIN tmp.agencyHourGetShipped aho ON pf.warehouseFk = aho.warehouseFk OR pf.warehouseFk = 0
|
||||
WHERE aho.shipped BETWEEN pf.started AND pf.ended ORDER BY pf.itemFk, pf.warehouseFk DESC
|
||||
) tpf
|
||||
GROUP BY tpf.itemFk, tpf.warehouseFk
|
||||
) pf ON pf.itemFk = tl.itemFk AND pf.warehouseFk = tl.warehouseFk
|
||||
WHERE b.buyingValue + b.freightValue + b.packageValue + b.comissionValue > 0.01 AND ic.display <> 0;
|
||||
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponent;
|
||||
CREATE TEMPORARY TABLE tmp.ticketComponent (
|
||||
`warehouseFk` INT UNSIGNED NOT NULL,
|
||||
`itemFk` INT NOT NULL,
|
||||
`componentFk` INT UNSIGNED NOT NULL,
|
||||
`cost` DECIMAL(10,4) NOT NULL,
|
||||
INDEX `itemWarehouse` USING BTREE (`itemFk` ASC, `warehouseFk` ASC),
|
||||
UNIQUE INDEX `itemWarehouseComponent` (`itemFk` ASC, `warehouseFk` ASC, `componentFk` ASC));
|
||||
|
||||
|
||||
|
||||
INSERT INTO tmp.ticketComponent (warehouseFk, itemFk, componentFk, cost)
|
||||
SELECT
|
||||
tcc.warehouseFk,
|
||||
tcc.itemFk,
|
||||
vBuyValueComponent,
|
||||
b.buyingValue + b.freightValue + b.packageValue + b.comissionValue
|
||||
FROM tmp.ticketComponentCalculate tcc
|
||||
JOIN buy b ON b.id = tcc.buyFk;
|
||||
|
||||
INSERT INTO tmp.ticketComponent (warehouseFk, itemFk, componentFk, cost)
|
||||
SELECT
|
||||
tcc.warehouseFk,
|
||||
tcc.itemFk,
|
||||
vMarginComponent,
|
||||
tcc.rate3 - b.buyingValue - b.freightValue - b.packageValue - b.comissionValue
|
||||
FROM tmp.ticketComponentCalculate tcc
|
||||
JOIN buy b ON b.id = tcc.buyFk;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentBase;
|
||||
CREATE TEMPORARY TABLE tmp.ticketComponentBase ENGINE = MEMORY
|
||||
SELECT tc.itemFk, ROUND(SUM(tc.cost), 4) AS base, tc.warehouseFk
|
||||
FROM tmp.ticketComponent tc
|
||||
GROUP BY tc.itemFk, warehouseFk;
|
||||
|
||||
INSERT INTO tmp.ticketComponent
|
||||
SELECT tcb.warehouseFk, tcb.itemFk, vRecoveryComponent, ROUND(tcb.base * LEAST(cr.recobro, 0.25), 3)
|
||||
FROM tmp.ticketComponentBase tcb
|
||||
JOIN bi.claims_ratio cr ON cr.Id_Cliente = vClientFk
|
||||
WHERE cr.recobro > 0.009;
|
||||
|
||||
INSERT INTO tmp.ticketComponent
|
||||
SELECT tcb.warehouseFk, tcb.itemFk, vManaAutoComponent, ROUND(base * (0.01 + prices_modifier_rate), 3) as manaAuto
|
||||
FROM tmp.ticketComponentBase tcb
|
||||
JOIN `client` c on c.id = vClientFk
|
||||
JOIN bs.mana_spellers ms ON c.salesPersonFk = ms.Id_Trabajador
|
||||
WHERE ms.prices_modifier_activated
|
||||
HAVING manaAuto <> 0;
|
||||
|
||||
INSERT INTO tmp.ticketComponent
|
||||
SELECT
|
||||
tcb.warehouseFk,
|
||||
tcb.itemFk,
|
||||
cr.id,
|
||||
GREATEST(IFNULL(ROUND(tcb.base * cr.tax, 4), 0), tcc.minPrice - tcc.rate3)
|
||||
FROM tmp.ticketComponentBase tcb
|
||||
JOIN componentRate cr
|
||||
JOIN tmp.ticketComponentCalculate tcc ON tcc.itemFk = tcb.itemFk AND tcc.warehouseFk = tcb.warehouseFk
|
||||
LEFT JOIN specialPrice sp ON sp.clientFk = vClientFk AND sp.itemFk = tcc.itemFk
|
||||
WHERE cr.id = vDiscountLastItemComponent AND cr.tax <> 0 AND tcc.minPrice < tcc.rate3 AND sp.value IS NULL;
|
||||
|
||||
INSERT INTO tmp.ticketComponent
|
||||
SELECT tcc.warehouseFk, tcc.itemFk, vSellByPacketComponent, tcc.rate2 - tcc.rate3
|
||||
FROM tmp.ticketComponentCalculate tcc
|
||||
JOIN buy b ON b.id = tcc.buyFk
|
||||
LEFT JOIN specialPrice sp ON sp.clientFk = vClientFk AND sp.itemFk = tcc.itemFk
|
||||
WHERE sp.value IS NULL;
|
||||
|
||||
INSERT INTO tmp.ticketComponent
|
||||
SELECT
|
||||
tcc.warehouseFK,
|
||||
tcc.itemFk,
|
||||
vDeliveryComponent,
|
||||
vGeneralInflationCoefficient
|
||||
* ROUND((
|
||||
i.compression
|
||||
* r.cm3
|
||||
* IF(am.deliveryMethodFk = 1, (GREATEST(i.density, vMinimumDensityWeight) / vMinimumDensityWeight), 1)
|
||||
* IFNULL(amz.price
|
||||
* amz.inflation, 50)) / vBoxVolume, 4
|
||||
) cost
|
||||
FROM tmp.ticketComponentCalculate tcc
|
||||
JOIN item i ON i.id = tcc.itemFk
|
||||
JOIN agencyMode am ON am.id = vAgencyModeFk
|
||||
JOIN `address` a ON a.id = vAddressFk
|
||||
JOIN agencyProvince ap ON ap.agencyFk = am.agencyFk
|
||||
AND ap.warehouseFk = tcc.warehouseFk AND ap.provinceFk = a.provinceFk
|
||||
JOIN agencyModeZone amz ON amz.agencyModeFk = vAgencyModeFk
|
||||
AND amz.zone = ap.zone AND amz.itemFk = 71 AND amz.warehouseFk = tcc.warehouseFk
|
||||
LEFT JOIN bi.rotacion r ON r.warehouse_id = tcc.warehouseFk
|
||||
AND r.Id_Article = tcc.itemFk
|
||||
HAVING cost <> 0;
|
||||
|
||||
IF (SELECT COUNT(*) FROM vn.addressForPackaging WHERE addressFk = vAddressFk) THEN
|
||||
INSERT INTO tmp.ticketComponent
|
||||
SELECT tcc.warehouseFk, b.itemFk, vExtraBaggedComponent, ap.packagingValue cost
|
||||
FROM tmp.ticketComponentCalculate tcc
|
||||
JOIN vn.addressForPackaging ap
|
||||
WHERE ap.addressFk = vAddressFk;
|
||||
END IF;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentCopy;
|
||||
CREATE TEMPORARY TABLE tmp.ticketComponentCopy ENGINE = MEMORY
|
||||
SELECT * FROM tmp.ticketComponent;
|
||||
|
||||
INSERT INTO tmp.ticketComponent
|
||||
SELECT
|
||||
tcc.warehouseFk,
|
||||
tcc.itemFk,
|
||||
vSpecialPriceComponent,
|
||||
sp.value - SUM(tcc.cost) sumCost
|
||||
FROM tmp.ticketComponentCopy tcc
|
||||
JOIN componentRate cr ON cr.id = tcc.componentFk
|
||||
JOIN specialPrice sp ON sp.clientFk = vClientFK AND sp.itemFk = tcc.itemFk
|
||||
WHERE cr.classRate IS NULL
|
||||
GROUP BY tcc.itemFk, tcc.warehouseFk
|
||||
HAVING ABS(sumCost) > 0.001;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentSum;
|
||||
CREATE TEMPORARY TABLE tmp.ticketComponentSum
|
||||
(INDEX (itemFk, warehouseFk))
|
||||
ENGINE = MEMORY
|
||||
SELECT SUM(cost) sumCost, tc.itemFk, tc.warehouseFk, cr.classRate
|
||||
FROM tmp.ticketComponent tc
|
||||
JOIN componentRate cr ON cr.id = tc.componentFk
|
||||
GROUP BY tc.itemFk, tc.warehouseFk, cr.classRate;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentRate;
|
||||
CREATE TEMPORARY TABLE tmp.ticketComponentRate ENGINE = MEMORY
|
||||
SELECT
|
||||
tcc.warehouseFk,
|
||||
tcc.itemFk,
|
||||
1 rate,
|
||||
IF(tcc.groupingMode = 1, tcc.grouping, 1) grouping,
|
||||
SUM(tcs.sumCost) price
|
||||
FROM tmp.ticketComponentCalculate tcc
|
||||
JOIN tmp.ticketComponentSum tcs ON tcs.itemFk = tcc.itemFk
|
||||
AND tcs.warehouseFk = tcc.warehouseFk
|
||||
WHERE IFNULL(tcs.classRate, 1) = 1
|
||||
AND tcc.groupingMode < 2 AND (tcc.packing > tcc.grouping or tcc.groupingMode = 0)
|
||||
GROUP BY tcs.warehouseFk, tcs.itemFk;
|
||||
|
||||
INSERT INTO tmp.ticketComponentRate (warehouseFk, itemFk, rate, grouping, price)
|
||||
SELECT
|
||||
tcc.warehouseFk,
|
||||
tcc.itemFk,
|
||||
2 rate,
|
||||
tcc.packing grouping,
|
||||
SUM(tcs.sumCost) price
|
||||
FROM tmp.ticketComponentCalculate tcc
|
||||
JOIN tmp.ticketComponentSum tcs ON tcs.itemFk = tcc.itemFk
|
||||
AND tcs.warehouseFk = tcc.warehouseFk
|
||||
WHERE tcc.available IS NULL OR (IFNULL(tcs.classRate, 2) = 2
|
||||
AND tcc.packing > 0 AND tcc.available >= tcc.packing)
|
||||
GROUP BY tcs.warehouseFk, tcs.itemFk;
|
||||
|
||||
INSERT INTO tmp.ticketComponentRate (warehouseFk, itemFk, rate, grouping, price)
|
||||
SELECT
|
||||
tcc.warehouseFk,
|
||||
tcc.itemFk,
|
||||
3 rate,
|
||||
tcc.available grouping,
|
||||
SUM(tcs.sumCost) price
|
||||
FROM tmp.ticketComponentCalculate tcc
|
||||
JOIN tmp.ticketComponentSum tcs ON tcs.itemFk = tcc.itemFk
|
||||
AND tcs.warehouseFk = tcc.warehouseFk
|
||||
WHERE IFNULL(tcs.classRate, 3) = 3
|
||||
GROUP BY tcs.warehouseFk, tcs.itemFk;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentPrice;
|
||||
CREATE TEMPORARY TABLE tmp.ticketComponentPrice ENGINE = MEMORY
|
||||
SELECT * FROM (
|
||||
SELECT * FROM tmp.ticketComponentRate ORDER BY price
|
||||
) t
|
||||
GROUP BY itemFk, warehouseFk, grouping;
|
||||
|
||||
DROP TEMPORARY TABLE
|
||||
tmp.ticketComponentCalculate,
|
||||
tmp.ticketComponentSum,
|
||||
tmp.ticketComponentBase,
|
||||
tmp.ticketComponentRate,
|
||||
tmp.ticketComponentCopy;
|
||||
END$$
|
||||
|
||||
DELIMITER ;
|
||||
|
||||
-- bionic_calc_clon-----------------------------------------------------------------------
|
||||
|
||||
|
||||
USE `vn2008`;
|
||||
DROP procedure IF EXISTS `vn2008`.`bionic_calc_clon`;
|
||||
|
||||
DELIMITER $$
|
||||
USE `vn2008`$$
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `bionic_calc_clonKk`(IN v_ticket BIGINT)
|
||||
BEGIN
|
||||
|
||||
/*
|
||||
* DEPRECATED vn.ticketCalculateClon
|
||||
*
|
||||
Este procedimiento "rebioniza" una linea, eliminando los componentes existentes e insertandolos de nuevo
|
||||
*/
|
||||
DECLARE v_shipment DATE;
|
||||
DECLARE v_customer INT;
|
||||
DECLARE v_wh SMALLINT;
|
||||
DECLARE v_agencia INT;
|
||||
DECLARE v_consigna INT;
|
||||
DECLARE v_landing DATE;
|
||||
DECLARE v_agency INT;
|
||||
|
||||
REPLACE order_Tickets(order_id,Id_Ticket) VALUES(48, v_ticket);
|
||||
|
||||
SELECT t.Id_Cliente , t.warehouse_id, date(t.Fecha), t.Id_Consigna, t.Id_Agencia, t.landing, a.agency_id
|
||||
INTO v_customer, v_wh, v_shipment, v_consigna, v_agencia, v_landing, v_agency
|
||||
FROM vn2008.Agencias a
|
||||
JOIN vn2008.Tickets t ON t.Id_Agencia = a.Id_Agencia
|
||||
WHERE t.Id_Ticket = v_ticket;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.agencyHourGetShipped;
|
||||
CREATE TEMPORARY TABLE tmp.agencyHourGetShipped ENGINE = MEMORY
|
||||
SELECT v_wh warehouseFk, v_shipment shipped, v_landing landed;
|
||||
|
||||
CALL item_last_buy_ (v_wh, v_shipment); -- rellena la tabla t_item_last_buy con la ultima compra
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.bionic_lot;
|
||||
CREATE TEMPORARY TABLE tmp.bionic_lot
|
||||
SELECT v_wh warehouse_id,NULL available,
|
||||
m.Id_Article item_id,ilb.buy_id
|
||||
FROM Movimientos m
|
||||
LEFT JOIN t_item_last_buy ilb ON ilb.item_id = m.Id_Article
|
||||
WHERE m.Id_Ticket = v_ticket GROUP BY m.Id_Article;
|
||||
|
||||
CALL bionic_calc_component(v_consigna,v_agencia);
|
||||
|
||||
-- Bionizamos lineas con Preu = 0
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.movement;
|
||||
CREATE TEMPORARY TABLE tmp.movement
|
||||
(PRIMARY KEY (Id_Movimiento)) ENGINE = MEMORY
|
||||
SELECT Id_Movimiento, v_wh warehouse_id FROM Movimientos m
|
||||
JOIN Tickets t on t.Id_Ticket = m.Id_Ticket WHERE m.Id_Ticket = v_ticket AND Preu = 0;
|
||||
|
||||
CALL bionic_movement_update(1);
|
||||
|
||||
-- Bionizamos lineas con Preu > 0
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.movement;
|
||||
CREATE TEMPORARY TABLE tmp.movement
|
||||
(PRIMARY KEY (Id_Movimiento)) ENGINE = MEMORY
|
||||
SELECT Id_Movimiento, v_wh warehouse_id FROM Movimientos m
|
||||
JOIN Tickets t on t.Id_Ticket = m.Id_Ticket WHERE m.Id_Ticket = v_ticket AND Preu > 0;
|
||||
CALL bionic_movement_update(6);
|
||||
|
||||
IF v_landing IS NULL THEN
|
||||
CALL travel_tree_shipment(v_shipment, v_consigna, v_agency,v_wh);
|
||||
UPDATE Tickets t
|
||||
JOIN travel_tree_shipment tts ON t.warehouse_id = tts.warehouse_id
|
||||
SET t.landing = tts.landing
|
||||
WHERE Id_Ticket = v_ticket;
|
||||
END IF;
|
||||
|
||||
-- Log
|
||||
call Ditacio(v_ticket
|
||||
,'Bioniza Ticket'
|
||||
,'T'
|
||||
, 20
|
||||
, 'proc bionic_calc_clon'
|
||||
, NULL);
|
||||
|
||||
-- Limpieza
|
||||
DROP TEMPORARY TABLE t_item_last_buy;
|
||||
END$$
|
||||
|
||||
DELIMITER ;
|
|
@ -1,241 +0,0 @@
|
|||
-- zoneGetAgency-----------------------------------------------------------------------
|
||||
|
||||
USE `vn`;
|
||||
DROP procedure IF EXISTS `zoneGetAgency`;
|
||||
|
||||
DELIMITER $$
|
||||
USE `vn`$$
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `zoneGetAgency`(vAddress INT, vLanded DATE)
|
||||
BEGIN
|
||||
/**
|
||||
* Devuelve el listado de agencias disponibles para la fecha
|
||||
* y dirección pasadas.
|
||||
*
|
||||
* @param vAddress Id de dirección de envío, %NULL si es recogida
|
||||
* @param vDate Fecha de recogida
|
||||
* @select Listado de agencias disponibles
|
||||
*/
|
||||
|
||||
DECLARE vPostalCode varchar(10);
|
||||
|
||||
SELECT postalCode INTO vPostalCode
|
||||
FROM address WHERE id = vAddress;
|
||||
|
||||
SELECT * FROM (
|
||||
SELECT am.id agencyModeFk,
|
||||
am.name agencyMode,
|
||||
am.description,
|
||||
am.deliveryMethodFk,
|
||||
TIMESTAMPADD(DAY,-z.travelingDays, vLanded) shipped,
|
||||
zi.isIncluded
|
||||
FROM zoneGeo zgSon
|
||||
JOIN zoneGeo zgFather ON zgSon.lft BETWEEN zgFather.lft AND zgFather.rgt
|
||||
JOIN zoneIncluded zi ON zi.geoFk = zgFather.id
|
||||
JOIN zone z ON z.id = zi.zoneFk
|
||||
JOIN zoneCalendar zc ON zc.zoneFk = z.id
|
||||
JOIN agencyMode am ON am.id = z.agencyModeFk
|
||||
WHERE zgSon.`name` LIKE vPostalCode
|
||||
AND zc.delivered = vLanded
|
||||
AND IF(TIMESTAMPADD(DAY,-z.travelingDays, vLanded) = CURDATE(), hour(now()) < hour(z.`hour`),TRUE)
|
||||
ORDER BY zgFather.depth DESC) t
|
||||
GROUP BY agencyModeFk
|
||||
HAVING isIncluded > 0;
|
||||
|
||||
END$$
|
||||
|
||||
DELIMITER ;
|
||||
-- zoneGetFirstShipped-----------------------------------------------------------------------
|
||||
|
||||
|
||||
USE `vn`;
|
||||
DROP procedure IF EXISTS `zoneGetFirstShipped`;
|
||||
|
||||
DELIMITER $$
|
||||
USE `vn`$$
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `zoneGetFirstShipped`(vAgencyModeFk INT, vAddress INT, vWarehouseFk INT)
|
||||
BEGIN
|
||||
/**
|
||||
* Devuelve la primera fecha de envio disponible para una agencia en una direccion y un warehouse
|
||||
*
|
||||
* @param vAgencyMode id de la agencia en vn.agencyMode
|
||||
* @param vAddress id de la direccion
|
||||
* @param vWarehouse id del warehouse
|
||||
* @return vShipped la primera fecha disponible y vLanded la fecha de llegada/recojida
|
||||
*/
|
||||
DECLARE vPostalCode varchar(10);
|
||||
|
||||
SELECT postalCode INTO vPostalCode
|
||||
FROM address WHERE id = vAddress;
|
||||
|
||||
SELECT * FROM (
|
||||
SELECT TIMESTAMPADD(DAY,-z.travelingDays, zc.delivered) shipped,
|
||||
zc.delivered landed
|
||||
FROM zoneGeo zgSon
|
||||
JOIN zoneGeo zgFather ON zgSon.lft BETWEEN zgFather.lft AND zgFather.rgt
|
||||
JOIN zoneIncluded zi ON zi.geoFk = zgFather.id
|
||||
JOIN zone z ON z.id = zi.zoneFk
|
||||
JOIN zoneCalendar zc ON zc.zoneFk = z.id
|
||||
WHERE zgSon.`name` LIKE vPostalCode
|
||||
AND z.agencyModeFk = vAgencyModeFk
|
||||
AND z.warehouseFk = vWarehouseFk
|
||||
AND IF(TIMESTAMPADD(DAY,-z.travelingDays, zc.delivered) = CURDATE(), hour(now()) < hour(z.`hour`),TRUE)
|
||||
ORDER BY landed ASC, zgFather.depth DESC) t
|
||||
HAVING isIncluded > 0 LIMIT 1;
|
||||
END$$
|
||||
|
||||
DELIMITER ;
|
||||
-- zoneGetLanded-----------------------------------------------------------------------
|
||||
|
||||
|
||||
USE `vn`;
|
||||
DROP procedure IF EXISTS `zoneGetLanded`;
|
||||
|
||||
DELIMITER $$
|
||||
USE `vn`$$
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `zoneGetLanded`(vShipped DATE, vAddress INT, vAgencyMode INT, vWarehouse INT)
|
||||
BEGIN
|
||||
/**
|
||||
* Devuelve una tabla temporal con el dia de recepcion para vShipped.
|
||||
*
|
||||
* @param vShipped Fecha de preparacion de mercancia
|
||||
* @param vAddress Id de consignatario, %NULL para recogida
|
||||
* @param vAgencyMode Id agencia
|
||||
* @table tmp.zoneGetLanded Datos de recepción
|
||||
*/
|
||||
|
||||
DECLARE vPostalCode varchar(10);
|
||||
|
||||
SELECT postalCode INTO vPostalCode
|
||||
FROM address WHERE id = vAddress;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.zoneGetLanded;
|
||||
CREATE TEMPORARY TABLE tmp.zoneGetLanded
|
||||
ENGINE = MEMORY
|
||||
SELECT vWarehouse warehouseFk,delivered landed, isIncluded FROM (
|
||||
SELECT zi.*, zc.delivered
|
||||
FROM vn.zoneGeo zgSon
|
||||
JOIN vn.zoneGeo zgFather ON zgSon.lft BETWEEN zgFather.lft AND zgFather.rgt
|
||||
JOIN zoneIncluded zi ON zi.geoFk = zgFather.id
|
||||
JOIN zone z ON z.id = zi.zoneFk
|
||||
JOIN zoneCalendar zc ON zc.zoneFk = z.id
|
||||
WHERE zgSon.`name` LIKE vPostalCode
|
||||
AND zc.delivered = TIMESTAMPADD(DAY,z.travelingDays, vShipped)
|
||||
AND IF(vShipped = CURDATE(), hour(now()) < hour(z.`hour`),TRUE)
|
||||
AND z.agencyModeFk = vAgencyMode
|
||||
ORDER BY zgFather.depth DESC) t
|
||||
GROUP BY zoneFk
|
||||
HAVING isIncluded > 0
|
||||
LIMIT 1;
|
||||
END$$
|
||||
|
||||
DELIMITER ;
|
||||
-- zoneGetShipped-----------------------------------------------------------------------
|
||||
|
||||
|
||||
USE `vn`;
|
||||
DROP procedure IF EXISTS `zoneGetShipped`;
|
||||
|
||||
DELIMITER $$
|
||||
USE `vn`$$
|
||||
DROP procedure IF EXISTS `zoneGetShipped`;
|
||||
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `zoneGetShipped`(vLanded DATE, vAddressFk INT, vAgencyModeFk INT, vWarehouseFk INT)
|
||||
BEGIN
|
||||
/**
|
||||
* Devuelve la mínima fecha de envía para cada warehouse
|
||||
*
|
||||
* @param vLanded La fecha de recepcion
|
||||
* @param vAddressFk Id del consignatario
|
||||
* @param vAgencyModeFk Id de la agencia
|
||||
* @return tmp.zoneGetShipped
|
||||
*/
|
||||
|
||||
DECLARE vPostalCode varchar(10);
|
||||
|
||||
SELECT postalCode INTO vPostalCode
|
||||
FROM address WHERE id = vAddressFk;
|
||||
|
||||
SELECT * FROM (
|
||||
SELECT z.id,
|
||||
TIMESTAMPADD(DAY,-z.travelingDays, vLanded) shipped,
|
||||
vLanded landed,
|
||||
zi.isIncluded
|
||||
FROM zoneGeo zgSon
|
||||
JOIN zoneGeo zgFather ON zgSon.lft BETWEEN zgFather.lft AND zgFather.rgt
|
||||
JOIN zoneIncluded zi ON zi.geoFk = zgFather.id
|
||||
JOIN zone z ON z.id = zi.zoneFk
|
||||
JOIN zoneCalendar zc ON zc.zoneFk = z.id
|
||||
WHERE zgSon.`name` LIKE vPostalCode
|
||||
AND zc.delivered = vLanded
|
||||
AND z.agencyModeFk = vAgencyModeFk
|
||||
AND z.warehouseFk = vWarehouseFk
|
||||
AND IF(TIMESTAMPADD(DAY,-z.travelingDays, vLanded) = CURDATE(), hour(now()) < hour(z.`hour`),TRUE)
|
||||
ORDER BY z.id, landed ASC, zgFather.depth DESC) t
|
||||
GROUP BY id
|
||||
HAVING isIncluded > 0;
|
||||
END$$
|
||||
|
||||
DELIMITER ;
|
||||
|
||||
-- zoneGetWarehouse-----------------------------------------------------------------------
|
||||
|
||||
USE `vn`;
|
||||
DROP procedure IF EXISTS `zoneGetWarehouse`;
|
||||
|
||||
DELIMITER $$
|
||||
USE `vn`$$
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `zoneGetWarehouse`(vAddress INT, vLanded DATE, vWarehouse INT)
|
||||
BEGIN
|
||||
/**
|
||||
* Devuelve el listado de agencias disponibles para la fecha,
|
||||
* dirección y warehouse pasadas
|
||||
*
|
||||
* @param vAddress
|
||||
* @param vWarehouse warehouse
|
||||
* @param vLanded Fecha de recogida
|
||||
* @select Listado de agencias disponibles
|
||||
*/
|
||||
DECLARE vPostalCode varchar(10);
|
||||
|
||||
SELECT postalCode INTO vPostalCode
|
||||
FROM address WHERE id = vAddress;
|
||||
|
||||
SELECT * FROM (
|
||||
SELECT am.id,
|
||||
am.name agencyMode,
|
||||
am.description,
|
||||
am.deliveryMethodFk,
|
||||
TIMESTAMPADD(DAY,-z.travelingDays, vLanded) shipped,
|
||||
z.warehouseFk,
|
||||
zi.isIncluded
|
||||
FROM zoneGeo zgSon
|
||||
JOIN zoneGeo zgFather ON zgSon.lft BETWEEN zgFather.lft AND zgFather.rgt
|
||||
JOIN zoneIncluded zi ON zi.geoFk = zgFather.id
|
||||
JOIN zone z ON z.id = zi.zoneFk
|
||||
JOIN zoneCalendar zc ON zc.zoneFk = z.id
|
||||
JOIN agencyMode am ON am.id = z.agencyModeFk
|
||||
WHERE zgSon.`name` LIKE vPostalCode
|
||||
AND delivered = vLanded
|
||||
AND z.warehouseFk = vWarehouse
|
||||
AND IF(TIMESTAMPADD(DAY,-z.travelingDays, vLanded) = CURDATE(), hour(now()) < hour(z.`hour`),TRUE)
|
||||
ORDER BY zgFather.depth DESC) t
|
||||
GROUP BY id
|
||||
HAVING isIncluded > 0;
|
||||
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
||||
-- VIEW `vn`.`item`-----------------------------------------------------------------------
|
||||
|
||||
CREATE OR REPLACE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `vn`.`item` AS select `t`.`Id_Article` AS `id`,`t`.`Article` AS `name`,`t`.`tipo_id` AS `typeFk`,`t`.`Medida` AS `size`,`t`.`Color` AS `inkFk`,`t`.`Categoria` AS `category`,`t`.`Tallos` AS `stems`,`t`.`id_origen` AS `originFk`,`t`.`description` AS `description`,`t`.`producer_id` AS `producerFk`,`t`.`Codintrastat` AS `intrastatFk`,`t`.`offer` AS `isOnOffer`,`t`.`caja` AS `box`,`t`.`expenceFk` AS `expenceFk`,`t`.`bargain` AS `isBargain`,`t`.`comments` AS `comment`,`t`.`relevancy` AS `relevancy`,`t`.`Foto` AS `image`,`t`.`generic` AS `generic`,`t`.`density` AS `density`,`t`.`iva_group_id` AS `taxClassFk`,`t`.`PVP` AS `minPrice`,`t`.`Min` AS `hasMinPrice`,`t`.`isActive` AS `isActive`,`t`.`longName` AS `longName`,`t`.`subName` AS `subName`,`t`.`tag5` AS `tag5`,`t`.`value5` AS `value5`,`t`.`tag6` AS `tag6`,`t`.`value6` AS `value6`,`t`.`tag7` AS `tag7`,`t`.`value7` AS `value7`,`t`.`tag8` AS `tag8`,`t`.`value8` AS `value8`,`t`.`tag9` AS `tag9`,`t`.`value9` AS `value9`,`t`.`tag10` AS `tag10`,`t`.`value10` AS `value10`,`t`.`minimum` AS `minimum`,`t`.`upToDown` AS `upToDown`,`t`.`compression` AS `compression` from `vn2008`.`Articles` `t`;
|
||||
|
||||
-- TABLE `vn`.`zone`-----------------------------------------------------------------------
|
||||
|
||||
ALTER TABLE `vn`.`zone`
|
||||
ADD COLUMN `isVolumetric` TINYINT(1) NULL DEFAULT 0 AFTER `bonus`;
|
||||
|
||||
-- TABLE `vn`.`zone`-----------------------------------------------------------------------
|
||||
|
||||
ALTER TABLE `vn`.`zoneGeo`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
;
|
|
@ -14,9 +14,10 @@ module.exports = function createNightmare(width = 1280, height = 720) {
|
|||
}).viewport(width, height);
|
||||
|
||||
nightmare.on('console', (type, message, ...args) => {
|
||||
if (type === 'error')
|
||||
if (type === 'error') {
|
||||
console[type](message, ...args);
|
||||
throw new Error(message);
|
||||
else
|
||||
} else
|
||||
console[type](message, ...args);
|
||||
});
|
||||
|
||||
|
|
|
@ -106,10 +106,10 @@ export default {
|
|||
agencyAutocomplete: 'vn-autocomplete[field="$ctrl.address.agencyModeFk"]',
|
||||
phoneInput: `${components.vnTextfield}[name="phone"]`,
|
||||
mobileInput: `${components.vnTextfield}[name="mobile"]`,
|
||||
defaultAddress: 'vn-client-address-index vn-horizontal:nth-child(1) div[name="street"]',
|
||||
secondMakeDefaultStar: 'vn-client-address-index vn-card vn-horizontal:nth-child(2) vn-icon-button[icon="star_border"]',
|
||||
firstEditButton: 'vn-client-address-index vn-icon-button[icon="edit"]',
|
||||
secondEditButton: 'vn-client-address-index vn-horizontal:nth-child(2) vn-icon-button[icon="edit"]',
|
||||
defaultAddress: 'vn-client-address-index div:nth-child(1) div[name="street"]',
|
||||
secondMakeDefaultStar: 'vn-client-address-index vn-card div:nth-child(2) vn-icon-button[icon="star_border"]',
|
||||
firstEditAddress: 'vn-client-address-index div:nth-child(1) > a',
|
||||
secondEditAddress: 'vn-client-address-index div:nth-child(2) > a',
|
||||
activeCheckbox: 'vn-check[label="Enabled"] md-checkbox',
|
||||
equalizationTaxCheckbox: 'vn-client-address-edit vn-check[label="Is equalizated"] md-checkbox',
|
||||
firstObservationTypeAutocomplete: 'vn-client-address-edit [name=observations] :nth-child(1) [field="observation.observationTypeFk"]',
|
||||
|
@ -174,6 +174,12 @@ export default {
|
|||
confirmFirstPaymentButton: 'vn-client-web-payment vn-tr:nth-child(1) vn-icon-button[icon="done_all"]',
|
||||
firstPaymentConfirmed: 'vn-client-web-payment vn-tr:nth-child(1) vn-icon[icon="check"][aria-hidden="false"]'
|
||||
},
|
||||
dms: {
|
||||
deleteFileButton: 'vn-client-dms-index vn-table vn-tr:nth-child(1) vn-icon-button[icon="delete"]',
|
||||
firstDocWorker: 'vn-client-dms-index vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(8) > span',
|
||||
firstDocWorkerDescriptor: 'vn-client-dms-index > vn-worker-descriptor-popover > vn-popover',
|
||||
acceptDeleteButton: 'vn-client-dms-index > vn-confirm button[response="ACCEPT"]'
|
||||
},
|
||||
itemsIndex: {
|
||||
searchIcon: 'vn-item-index vn-searchbar vn-icon[icon="search"]',
|
||||
createItemButton: `${components.vnFloatButton}`,
|
||||
|
@ -231,6 +237,7 @@ export default {
|
|||
expenceAutocomplete: 'vn-autocomplete[field="$ctrl.item.expenceFk"]',
|
||||
longNameInput: 'vn-textfield[field="$ctrl.item.longName"] input',
|
||||
isActiveCheckbox: 'vn-check[label="Active"] md-checkbox',
|
||||
priceInKgCheckbox: 'vn-check[label="Price in kg"] md-checkbox',
|
||||
submitBasicDataButton: `${components.vnSubmit}`
|
||||
},
|
||||
itemTags: {
|
||||
|
@ -320,16 +327,20 @@ export default {
|
|||
advancedSearchInvoiceOut: 'vn-ticket-index vn-searchbar vn-ticket-search-panel vn-textfield[model="filter.refFk"] input',
|
||||
newTicketButton: 'vn-ticket-index > a',
|
||||
searchResult: 'vn-ticket-index vn-card > div > vn-table > div > vn-tbody > a.vn-tr',
|
||||
searchWeeklyResult: 'vn-ticket-weekly-index vn-table vn-tbody > vn-tr',
|
||||
searchResultDate: 'vn-ticket-index vn-table vn-tbody > a:nth-child(1) > vn-td:nth-child(5)',
|
||||
searchTicketInput: `vn-ticket-index ${components.vnTextfield}`,
|
||||
searchWeeklyTicketInput: `vn-ticket-weekly-index ${components.vnTextfield}`,
|
||||
searchWeeklyClearInput: 'vn-ticket-weekly-index vn-searchbar i[class="material-icons clear"]',
|
||||
advancedSearchButton: 'vn-ticket-index vn-searchbar > vn-popover vn-ticket-search-panel vn-submit[label="Search"] input',
|
||||
searchButton: 'vn-ticket-index vn-searchbar vn-icon[icon="search"]',
|
||||
searchWeeklyButton: 'vn-ticket-weekly-index vn-searchbar vn-icon[icon="search"]',
|
||||
moreMenu: 'vn-ticket-index vn-icon-menu[vn-id="more-button"] > div > vn-icon',
|
||||
moreMenuTurns: 'vn-ticket-index vn-icon-menu vn-drop-down > vn-popover li:nth-child(2)',
|
||||
sixthWeeklyTicketTurn: 'vn-ticket-weekly vn-table vn-tr:nth-child(6) vn-autocomplete[field="weekly.weekDay"] input',
|
||||
weeklyTicket: 'vn-ticket-weekly vn-table > div > vn-tbody > vn-tr',
|
||||
sixthWeeklyTicketDeleteIcon: 'vn-ticket-weekly vn-tr:nth-child(6) vn-icon-button[icon="delete"]',
|
||||
acceptDeleteTurn: 'vn-ticket-weekly > vn-confirm[vn-id="deleteWeekly"] button[response="ACCEPT"]'
|
||||
moreMenuWeeklyTickets: 'vn-ticket-index vn-icon-menu vn-drop-down > vn-popover li:nth-child(2)',
|
||||
sixthWeeklyTicket: 'vn-ticket-weekly-index vn-table vn-tr:nth-child(6) vn-autocomplete[field="weekly.weekDay"] input',
|
||||
weeklyTicket: 'vn-ticket-weekly-index vn-table > div > vn-tbody > vn-tr',
|
||||
firstWeeklyTicketDeleteIcon: 'vn-ticket-weekly-index vn-tr:nth-child(1) vn-icon-button[icon="delete"]',
|
||||
acceptDeleteTurn: 'vn-ticket-weekly-index > vn-confirm[vn-id="deleteWeekly"] button[response="ACCEPT"]'
|
||||
},
|
||||
createTicketView: {
|
||||
clientAutocomplete: 'vn-ticket-create vn-autocomplete[field="$ctrl.clientFk"]',
|
||||
|
@ -349,12 +360,16 @@ export default {
|
|||
moreMenuAddToTurn: 'vn-ticket-descriptor vn-drop-down > vn-popover ul > li[name="Add turn"]',
|
||||
moreMenuDeleteTicket: 'vn-ticket-descriptor vn-drop-down > vn-popover ul > li[name="Delete ticket"]',
|
||||
moreMenuMakeInvoice: 'vn-ticket-descriptor vn-drop-down > vn-popover ul > li[name="Make invoice"]',
|
||||
moreMenuChangeShippedHour: 'vn-ticket-descriptor vn-drop-down > vn-popover ul > li[name="Change shipped hour"]',
|
||||
changeShippedHourInput: 'vn-ticket-descriptor > vn-dialog.ng-isolate-scope.vn-dialog.shown vn-input-time input',
|
||||
addStowawayDialogFirstTicket: 'vn-ticket-descriptor > vn-add-stowaway > vn-dialog vn-table vn-tbody vn-tr',
|
||||
shipButton: 'vn-ticket-descriptor > div > div.body > div.quicklinks vn-icon[icon="icon-stowaway"]',
|
||||
thursdayButton: 'vn-ticket-descriptor > vn-dialog > div > form > div.body > tpl-body > div > vn-tool-bar > vn-button:nth-child(4)',
|
||||
saturdayButton: 'vn-ticket-descriptor > vn-dialog > div > form > div.body > tpl-body > div > vn-tool-bar > vn-button:nth-child(6)',
|
||||
closeStowawayDialog: 'vn-ticket-descriptor > vn-add-stowaway > vn-dialog > div > button[class="close"]',
|
||||
acceptDeleteButton: 'vn-ticket-descriptor button[response="ACCEPT"]',
|
||||
acceptChangeHourButton: 'vn-ticket-descriptor vn-dialog[vn-id="changeShippedDialog"] button[response="ACCEPT"]',
|
||||
descriptorDeliveryDate: 'vn-ticket-descriptor > div > div.body > div.attributes > vn-label-value:nth-child(6) > section > span',
|
||||
acceptInvoiceOutButton: 'vn-ticket-descriptor vn-confirm[vn-id="makeInvoiceConfirmation"] button[response="ACCEPT"]',
|
||||
acceptDeleteStowawayButton: 'vn-ticket-descriptor > vn-remove-stowaway button[response="ACCEPT"]'
|
||||
},
|
||||
|
@ -386,13 +401,16 @@ export default {
|
|||
saleDescriptorPopover: 'vn-ticket-sale vn-item-descriptor-popover > vn-popover',
|
||||
saleDescriptorPopoverSummaryButton: 'vn-item-descriptor-popover a[ui-sref="item.card.summary({id: $ctrl.item.id})"]',
|
||||
descriptorItemDiaryButton: 'vn-item-descriptor .quicklinks.ng-scope > vn-horizontal > a > vn-icon > i',
|
||||
newItemButton: 'vn-float-button[icon="add"]',
|
||||
newItemFromCatalogButton: 'vn-ticket-sale vn-float-button[icon="add"]',
|
||||
newItemButton: 'vn-ticket-sale > vn-vertical > vn-card > div > vn-vertical > vn-one > vn-icon-button > button > vn-icon > i',
|
||||
moreMenu: 'vn-ticket-sale vn-tool-bar > vn-button-menu[vn-id="more-button"] > div > button',
|
||||
moreMenuCreateClaim: 'vn-ticket-sale vn-tool-bar > vn-button-menu[vn-id="more-button"] vn-drop-down > vn-popover ul > li[name="Add claim"]',
|
||||
moreMenuReserve: 'vn-ticket-sale vn-tool-bar > vn-button-menu[vn-id="more-button"] vn-drop-down > vn-popover ul > li[name="Mark as reserved"]',
|
||||
moreMenuUnmarkReseved: 'vn-ticket-sale vn-tool-bar > vn-button-menu[vn-id="more-button"] vn-drop-down > vn-popover ul > li[name="Unmark as reserved"]',
|
||||
moreMenuUpdateDiscount: 'vn-ticket-sale vn-tool-bar > vn-button-menu[vn-id="more-button"] vn-drop-down > vn-popover ul > li[name="Update discount"]',
|
||||
moreMenuUpdateDiscountInput: 'vn-ticket-sale vn-dialog form vn-ticket-sale-edit-discount vn-input-number[model="$ctrl.newDiscount"] input',
|
||||
transferQuantityInput: 'vn-ticket-sale vn-popover.transfer.ng-isolate-scope.vn-popover.shown vn-table > div > vn-tbody > vn-tr > vn-td-editable > span > text',
|
||||
transferQuantityCell: 'vn-ticket-sale vn-popover.transfer.ng-isolate-scope.vn-popover.shown vn-table > div > vn-tbody > vn-tr > vn-td-editable',
|
||||
firstSaleClaimIcon: 'vn-ticket-sale vn-table vn-tbody > vn-tr:nth-child(1) vn-icon[icon="icon-claims"]',
|
||||
firstSaleDescriptorImage: 'vn-ticket-sale vn-item-descriptor-popover > vn-popover vn-item-descriptor img',
|
||||
firstSaleText: 'vn-table div > vn-tbody > vn-tr:nth-child(1)',
|
||||
|
@ -401,28 +419,37 @@ export default {
|
|||
firstSaleQuantity: 'vn-input-number[model="sale.quantity"]:nth-child(1) input',
|
||||
firstSaleQuantityCell: 'vn-ticket-sale vn-tr:nth-child(1) > vn-td-editable:nth-child(5)',
|
||||
firstSaleQuantityClearInput: 'vn-textfield[model="sale.quantity"] div.suffix > i',
|
||||
firstSaleID: 'vn-ticket-sale:nth-child(1) vn-td-editable:nth-child(4) text > span',
|
||||
firstSalePrice: 'vn-ticket-sale:nth-child(1) vn-tr:nth-child(1) > vn-td:nth-child(7)',
|
||||
firstSaleIdInput: 'body > vn-app > div > ui-view > vn-ticket-card > vn-main-block > div > vn-ticket-sale > vn-vertical > vn-card > div > vn-vertical > vn-table > div > vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(4) > vn-autocomplete > div > div > input',
|
||||
firstSaleIdAutocomplete: 'vn-ticket-sale > vn-vertical > vn-card > div > vn-vertical > vn-table > div > vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(4) > vn-autocomplete',
|
||||
idAutocompleteFirstResult: 'vn-ticket-sale > vn-vertical > vn-card > div > vn-vertical > vn-table > div > vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(4) > vn-autocomplete > vn-drop-down > vn-popover > div > div.content > div > div.list > ul > li',
|
||||
firstSalePrice: 'vn-ticket-sale vn-table vn-tr:nth-child(1) > vn-td:nth-child(7) > span',
|
||||
firstSalePriceInput: 'vn-ticket-sale:nth-child(1) vn-popover.edit.dialog-summary.ng-isolate-scope.vn-popover.shown vn-input-number input',
|
||||
firstSaleDiscount: 'vn-ticket-sale:nth-child(1) vn-td:nth-child(8)',
|
||||
firstSaleDiscount: 'vn-ticket-sale vn-table vn-tr:nth-child(1) > vn-td:nth-child(8) > span',
|
||||
firstSaleDiscountInput: 'vn-ticket-sale:nth-child(1) vn-ticket-sale-edit-discount vn-input-number input',
|
||||
firstSaleImport: 'vn-ticket-sale:nth-child(1) vn-td:nth-child(9)',
|
||||
firstSaleReservedIcon: 'vn-ticket-sale vn-tr:nth-child(1) > vn-td:nth-child(2) > vn-icon:nth-child(3)',
|
||||
firstSaleColour: 'vn-ticket-sale vn-tr:nth-child(1) vn-td-editable:nth-child(6) section:nth-child(1)',
|
||||
firstSaleColour: 'vn-tr:nth-child(1) vn-fetched-tags section',
|
||||
firstSaleLength: 'vn-ticket-sale vn-tr:nth-child(1) vn-td-editable:nth-child(6) section:nth-child(3)',
|
||||
firstSaleCheckbox: 'vn-ticket-sale vn-tr:nth-child(1) vn-check[field="sale.checked"] md-checkbox',
|
||||
secondSaleColour: 'vn-ticket-sale vn-tr:nth-child(2) vn-td:nth-child(6) section:nth-child(5)',
|
||||
secondSaleColour: 'vn-tr:nth-child(2) vn-fetched-tags section',
|
||||
secondSalePrice: 'vn-ticket-sale vn-tr:nth-child(2) vn-td:nth-child(7) > span',
|
||||
secondSaleDiscount: 'vn-ticket-sale vn-tr:nth-child(2) vn-td:nth-child(8)',
|
||||
secondSaleImport: 'vn-ticket-sale vn-tr:nth-child(2) vn-td:nth-child(9)',
|
||||
secondSaleText: 'vn-table div > vn-tbody > vn-tr:nth-child(2)',
|
||||
secondSaleId: 'vn-ticket-sale:nth-child(2) vn-td-editable:nth-child(4) text > span',
|
||||
secondSaleIdCell: 'vn-ticket-sale vn-tr:nth-child(2) > vn-td-editable:nth-child(4)',
|
||||
secondSaleIdInput: 'body > vn-app > div > ui-view > vn-ticket-card > vn-main-block > div > vn-ticket-sale > vn-vertical > vn-card > div > vn-vertical > vn-table > div > vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(4) > vn-autocomplete > div > div > input',
|
||||
secondSaleIdAutocomplete: 'vn-ticket-sale > vn-vertical > vn-card > div > vn-vertical > vn-table > div > vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(4) > vn-autocomplete',
|
||||
secondSaleQuantity: 'vn-ticket-sale vn-table vn-tr:nth-child(2) vn-input-number input',
|
||||
secondSaleConceptCell: 'vn-ticket-sale vn-table > div > vn-tbody > vn-tr:nth-child(2) > vn-td-editable:nth-child(6)',
|
||||
secondSaleConceptInput: 'vn-ticket-sale vn-table vn-tr:nth-child(2) > vn-td-editable.ng-isolate-scope.selected vn-textfield input',
|
||||
totalImport: 'vn-ticket-sale > vn-vertical > vn-card > div > vn-vertical > vn-horizontal > vn-one > p:nth-child(3) > strong',
|
||||
selectAllSalesCheckbox: 'vn-ticket-sale vn-thead vn-check md-checkbox',
|
||||
secondSaleCheckbox: 'vn-ticket-sale vn-tr:nth-child(2) vn-check[field="sale.checked"] md-checkbox',
|
||||
thirdSaleCheckbox: 'vn-ticket-sale vn-tr:nth-child(3) vn-check[field="sale.checked"] md-checkbox',
|
||||
deleteSaleButton: 'vn-ticket-sale vn-tool-bar > vn-button[icon="delete"]',
|
||||
transferSaleButton: 'vn-ticket-sale vn-tool-bar > vn-button[icon="call_split"]',
|
||||
moveToTicketInput: 'vn-ticket-sale vn-popover.transfer vn-textfield[model="$ctrl.receiverTicketId"] input',
|
||||
moveToTicketInput: 'vn-ticket-sale vn-popover.transfer vn-textfield[model="$ctrl.transfer.ticketId"] input',
|
||||
moveToTicketInputClearButton: 'vn-popover.shown i[title="Clear"]',
|
||||
moveToTicketButton: 'vn-ticket-sale vn-popover.transfer vn-icon[icon="arrow_forward_ios"]',
|
||||
moveToNewTicketButton: 'vn-ticket-sale vn-popover.transfer vn-button[label="New ticket"]',
|
||||
|
@ -520,7 +547,7 @@ export default {
|
|||
saveButton: `${components.vnSubmit}`
|
||||
},
|
||||
claimDetail: {
|
||||
secondItemDiscount: 'vn-claim-detail > vn-vertical > vn-card > div > vn-vertical > vn-table > div > vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(7) > span',
|
||||
secondItemDiscount: 'vn-claim-detail > vn-vertical > vn-card > div > vn-vertical > vn-table > div > vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(6) > span',
|
||||
discountInput: 'vn-claim-detail vn-popover vn-input-number[model="$ctrl.newDiscount"] > div > div > div.infix > input',
|
||||
discoutPopoverMana: 'vn-claim-detail > vn-popover > div > div.content > div > vn-horizontal > h5',
|
||||
addItemButton: 'vn-claim-detail a vn-float-button',
|
||||
|
@ -528,7 +555,7 @@ export default {
|
|||
claimDetailLine: 'vn-claim-detail > vn-vertical > vn-card > div > vn-vertical > vn-table > div > vn-tbody > vn-tr',
|
||||
firstItemQuantityInput: 'vn-claim-detail vn-tr:nth-child(1) vn-input-number[model="saleClaimed.quantity"] input',
|
||||
totalClaimed: 'vn-claim-detail > vn-vertical > vn-card > div > vn-vertical > vn-horizontal > div > vn-label-value:nth-child(2) > section > span',
|
||||
secondItemDeleteButton: 'vn-claim-detail > vn-vertical > vn-card > div > vn-vertical > vn-table > div > vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(9) > vn-icon-button > button > vn-icon > i'
|
||||
secondItemDeleteButton: 'vn-claim-detail > vn-vertical > vn-card > div > vn-vertical > vn-table > div > vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(8) > vn-icon-button > button > vn-icon > i'
|
||||
},
|
||||
claimDevelopment: {
|
||||
addDevelopmentButton: 'vn-claim-development > vn-vertical > vn-card > div > vn-vertical > vn-one > vn-icon-button > button > vn-icon',
|
||||
|
@ -562,6 +589,10 @@ export default {
|
|||
searchButton: 'vn-order-index vn-searchbar vn-icon[icon="search"]',
|
||||
createOrderButton: `${components.vnFloatButton}`,
|
||||
},
|
||||
orderDescriptor: {
|
||||
returnToModuleIndexButton: 'vn-order-descriptor a[ui-sref="order.index"]',
|
||||
acceptNavigationButton: 'vn-order-basic-data vn-confirm button[response=ACCEPT]'
|
||||
},
|
||||
createOrderView: {
|
||||
clientAutocomplete: 'vn-autocomplete[label="Client"]',
|
||||
addressAutocomplete: 'vn-autocomplete[label="Address"]',
|
||||
|
@ -588,7 +619,8 @@ export default {
|
|||
addressAutocomplete: 'vn-autocomplete[label="Address"]',
|
||||
agencyAutocomplete: 'vn-autocomplete[label="Agency"]',
|
||||
observationInput: 'vn-textarea[label="Observation"] textarea',
|
||||
saveButton: `${components.vnSubmit}`
|
||||
saveButton: `${components.vnSubmit}`,
|
||||
acceptButton: 'vn-order-basic-data vn-confirm[vn-id="confirm"] button[response="ACCEPT"]'
|
||||
},
|
||||
orderLine: {
|
||||
orderSubtotal: 'vn-order-line vn-horizontal.header p:nth-child(1)',
|
||||
|
|
|
@ -14,7 +14,7 @@ describe('Client Edit fiscalData path', () => {
|
|||
// Confirms all addresses have EQtax false for future propagation test step 1
|
||||
it(`should click on the 1st edit icon to check EQtax isnt checked`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientAddresses.firstEditButton)
|
||||
.waitToClick(selectors.clientAddresses.firstEditAddress)
|
||||
.checkboxState(selectors.clientAddresses.equalizationTaxCheckbox);
|
||||
|
||||
expect(result).toBe('unchecked');
|
||||
|
@ -24,7 +24,7 @@ describe('Client Edit fiscalData path', () => {
|
|||
it(`should go back to addresses then select the second one and confirm the EQtax isnt checked`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientAddresses.addressesButton)
|
||||
.waitToClick(selectors.clientAddresses.secondEditButton)
|
||||
.waitToClick(selectors.clientAddresses.secondEditAddress)
|
||||
.checkboxState(selectors.clientAddresses.equalizationTaxCheckbox);
|
||||
|
||||
expect(result).toBe('unchecked');
|
||||
|
@ -62,7 +62,7 @@ describe('Client Edit fiscalData path', () => {
|
|||
const result = await nightmare
|
||||
.wait(selectors.clientFiscalData.socialNameInput)
|
||||
.clearInput(selectors.clientFiscalData.socialNameInput)
|
||||
.write(selectors.clientFiscalData.socialNameInput, 'SMASH!')
|
||||
.write(selectors.clientFiscalData.socialNameInput, 'SMASH')
|
||||
.clearInput(selectors.clientFiscalData.fiscalIdInput)
|
||||
.write(selectors.clientFiscalData.fiscalIdInput, 'INVALID!')
|
||||
.clearInput(selectors.clientFiscalData.addressInput)
|
||||
|
@ -139,7 +139,7 @@ describe('Client Edit fiscalData path', () => {
|
|||
// confirm all addresses have now EQtax checked step 2
|
||||
it(`should click on the 1st edit icon to confirm EQtax is checked`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientAddresses.firstEditButton)
|
||||
.waitToClick(selectors.clientAddresses.firstEditAddress)
|
||||
.checkboxState(selectors.clientAddresses.equalizationTaxCheckbox);
|
||||
|
||||
expect(result).toBe('checked');
|
||||
|
@ -149,7 +149,7 @@ describe('Client Edit fiscalData path', () => {
|
|||
it(`should go back to addresses then select the second one and confirm the EQtax is checked`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientAddresses.addressesButton)
|
||||
.waitToClick(selectors.clientAddresses.secondEditButton)
|
||||
.waitToClick(selectors.clientAddresses.secondEditAddress)
|
||||
.checkboxState(selectors.clientAddresses.equalizationTaxCheckbox);
|
||||
|
||||
expect(result).toBe('checked');
|
||||
|
@ -179,7 +179,7 @@ describe('Client Edit fiscalData path', () => {
|
|||
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
||||
.waitToGetProperty(selectors.clientFiscalData.socialNameInput, 'value');
|
||||
|
||||
expect(result).toEqual('SMASH!');
|
||||
expect(result).toEqual('SMASH');
|
||||
});
|
||||
|
||||
it('should confirm the fiscal id have been edited', async() => {
|
||||
|
@ -294,7 +294,7 @@ describe('Client Edit fiscalData path', () => {
|
|||
// confirm invoice by address checkbox gets checked if the EQtax differs between addresses step 2
|
||||
it(`should click on the 1st edit icon to access the address details and uncheck EQtax checkbox`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientAddresses.firstEditButton)
|
||||
.waitToClick(selectors.clientAddresses.firstEditAddress)
|
||||
.waitToClick(selectors.clientAddresses.equalizationTaxCheckbox)
|
||||
.waitToClick(selectors.clientAddresses.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
|
|
|
@ -72,7 +72,7 @@ describe('Client Add address path', () => {
|
|||
|
||||
it(`should click on the addresses button confirm the new address exists and it's the default one`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientAddresses.addressesButton)
|
||||
// .waitToClick(selectors.clientAddresses.addressesButton)
|
||||
.waitToGetProperty(selectors.clientAddresses.defaultAddress, 'innerText');
|
||||
|
||||
expect(result).toContain('320 Park Avenue New York');
|
||||
|
@ -90,7 +90,7 @@ describe('Client Add address path', () => {
|
|||
it(`should click on the edit icon of the default address`, async() => {
|
||||
const url = await nightmare
|
||||
.waitForTextInElement(selectors.clientAddresses.defaultAddress, 'Somewhere in Thailand')
|
||||
.waitToClick(selectors.clientAddresses.firstEditButton)
|
||||
.waitToClick(selectors.clientAddresses.firstEditAddress)
|
||||
.waitForURL('/edit')
|
||||
.parsedUrl();
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ describe('Client add address notes path', () => {
|
|||
it(`should click on the edit icon of the default address`, async() => {
|
||||
const url = await nightmare
|
||||
.waitForTextInElement(selectors.clientAddresses.defaultAddress, '20 Ingram Street')
|
||||
.waitToClick(selectors.clientAddresses.firstEditButton)
|
||||
.waitToClick(selectors.clientAddresses.firstEditAddress)
|
||||
.waitForURL('/edit')
|
||||
.parsedUrl();
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ describe('Client lock verified data path', () => {
|
|||
const result = await nightmare
|
||||
.wait(selectors.clientFiscalData.socialNameInput)
|
||||
.clearInput(selectors.clientFiscalData.socialNameInput)
|
||||
.write(selectors.clientFiscalData.socialNameInput, 'Ant-Man and the Wasp')
|
||||
.write(selectors.clientFiscalData.socialNameInput, 'Ant man and the Wasp')
|
||||
.waitToClick(selectors.clientFiscalData.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
|
||||
|
@ -94,7 +94,7 @@ describe('Client lock verified data path', () => {
|
|||
.reloadSection('client.card.fiscalData')
|
||||
.waitToGetProperty(selectors.clientFiscalData.socialNameInput, 'value');
|
||||
|
||||
expect(result).toEqual('Ant-Man and the Wasp');
|
||||
expect(result).toEqual('Ant man and the Wasp');
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -188,7 +188,7 @@ describe('Client lock verified data path', () => {
|
|||
.wait(selectors.clientFiscalData.socialNameInput)
|
||||
.evaluate(selector => {
|
||||
return document.querySelector(selector).disabled;
|
||||
}, 'vn-textfield[field="$ctrl.client.socialName"] > div');
|
||||
}, 'vn-textfield[model="$ctrl.client.socialName"] > div');
|
||||
|
||||
expect(result).toBeFalsy();
|
||||
});
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
|
||||
describe('Client DMS', () => {
|
||||
const nightmare = createNightmare();
|
||||
|
||||
describe('as salesPerson', () => {
|
||||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('salesPerson', 'client')
|
||||
.accessToSearchResult('Tony Stark')
|
||||
.accessToSection('client.card.dms.index');
|
||||
});
|
||||
|
||||
it('should delete de first file', async() => {
|
||||
let result = await nightmare
|
||||
.waitToClick(selectors.dms.deleteFileButton)
|
||||
.waitToClick(selectors.dms.acceptDeleteButton)
|
||||
.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it(`should click on the first document line worker name making the descriptor visible`, async() => {
|
||||
const visible = await nightmare
|
||||
.waitToClick(selectors.dms.firstDocWorker)
|
||||
.waitForClassPresent(selectors.dms.firstDocWorkerDescriptor, 'shown')
|
||||
.isVisible(selectors.dms.firstDocWorkerDescriptor);
|
||||
|
||||
expect(visible).toBeTruthy();
|
||||
});
|
||||
});
|
||||
});
|
|
@ -11,6 +11,7 @@ describe('Item summary path', () => {
|
|||
|
||||
it('should search for an item', async() => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.itemsIndex.searchItemInput)
|
||||
.write(selectors.itemsIndex.searchItemInput, 'Ranged weapon longbow 2m')
|
||||
.waitToClick(selectors.itemsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
|
||||
|
|
|
@ -31,6 +31,7 @@ describe('Item Edit basic data path', () => {
|
|||
.clearInput(selectors.itemBasicData.longNameInput)
|
||||
.write(selectors.itemBasicData.longNameInput, 'RS Rose of Purity')
|
||||
.waitToClick(selectors.itemBasicData.isActiveCheckbox)
|
||||
.waitToClick(selectors.itemBasicData.priceInKgCheckbox)
|
||||
.waitToClick(selectors.itemBasicData.submitBasicDataButton)
|
||||
.waitForLastSnackbar();
|
||||
|
||||
|
@ -93,4 +94,11 @@ describe('Item Edit basic data path', () => {
|
|||
|
||||
expect(result).toBe('unchecked');
|
||||
});
|
||||
|
||||
it('should confirm the priceInKg checkbox is checked', async() => {
|
||||
const result = await nightmare
|
||||
.checkboxState(selectors.itemBasicData.priceInKgCheckbox);
|
||||
|
||||
expect(result).toBe('checked');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
|
||||
describe('Item edit tax path', () => {
|
||||
// #1702 Autocomplete no siempre refresca al cancelar formulario
|
||||
xdescribe('Item edit tax path', () => {
|
||||
const nightmare = createNightmare();
|
||||
|
||||
beforeAll(() => {
|
||||
|
|
|
@ -11,6 +11,7 @@ describe('Item Create/Clone path', () => {
|
|||
|
||||
it(`should search for the item Infinity Gauntlet to confirm it isn't created yet`, async() => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.itemsIndex.searchItemInput)
|
||||
.write(selectors.itemsIndex.searchItemInput, 'Infinity Gauntlet')
|
||||
.waitToClick(selectors.itemsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 0)
|
||||
|
@ -95,6 +96,7 @@ describe('Item Create/Clone path', () => {
|
|||
|
||||
it(`should search for the item Infinity Gauntlet`, async() => {
|
||||
const result = await nightmare
|
||||
.clearInput(selectors.itemsIndex.searchItemInput)
|
||||
.write(selectors.itemsIndex.searchItemInput, 'Infinity Gauntlet')
|
||||
.waitToClick(selectors.itemsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
|
||||
|
@ -117,6 +119,7 @@ describe('Item Create/Clone path', () => {
|
|||
it('should search for the item Infinity Gauntlet and find two', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.itemTags.goToItemIndexButton)
|
||||
.clearInput(selectors.itemsIndex.searchItemInput)
|
||||
.write(selectors.itemsIndex.searchItemInput, 'Infinity Gauntlet')
|
||||
.waitToClick(selectors.itemsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 2)
|
||||
|
|
|
@ -11,6 +11,7 @@ describe('Item regularize path', () => {
|
|||
|
||||
it('should edit the user local warehouse', async() => {
|
||||
let result = await nightmare
|
||||
.waitForSpinnerLoad()
|
||||
.waitToClick(selectors.globalItems.userMenuButton)
|
||||
.autocompleteSearch(selectors.globalItems.userLocalWarehouse, 'Warehouse Four')
|
||||
.waitForLastSnackbar();
|
||||
|
@ -28,6 +29,7 @@ describe('Item regularize path', () => {
|
|||
|
||||
it('should search for the item', async() => {
|
||||
const resultCount = await nightmare
|
||||
.clearInput(selectors.itemsIndex.searchItemInput)
|
||||
.write(selectors.itemsIndex.searchItemInput, 'Ranged weapon pistol 9mm')
|
||||
.waitToClick(selectors.itemsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
|
||||
|
@ -133,6 +135,7 @@ describe('Item regularize path', () => {
|
|||
|
||||
it('should search for the item once again', async() => {
|
||||
const resultCount = await nightmare
|
||||
.clearInput(selectors.itemsIndex.searchItemInput)
|
||||
.write(selectors.itemsIndex.searchItemInput, 'Ranged weapon pistol 9mm')
|
||||
.waitToClick(selectors.itemsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
|
||||
|
|
|
@ -0,0 +1,104 @@
|
|||
import selectors from '../../../helpers/selectors.js';
|
||||
import createNightmare from '../../../helpers/nightmare';
|
||||
|
||||
describe('Ticket List sale path', () => {
|
||||
const nightmare = createNightmare();
|
||||
|
||||
beforeAll(() => {
|
||||
return nightmare
|
||||
.loginAndModule('employee', 'ticket')
|
||||
.accessToSearchResult(13)
|
||||
.accessToSection('ticket.card.sale');
|
||||
});
|
||||
|
||||
it('should confirm the first ticket sale contains the colour', async() => {
|
||||
const value = await nightmare
|
||||
.waitToGetProperty(selectors.ticketSales.firstSaleColour, 'innerText');
|
||||
|
||||
expect(value).toContain('Black');
|
||||
});
|
||||
|
||||
it('should confirm the first sale contains the price', async() => {
|
||||
const value = await nightmare
|
||||
.waitToGetProperty(selectors.ticketSales.firstSalePrice, 'innerText');
|
||||
|
||||
expect(value).toContain('1.72');
|
||||
});
|
||||
|
||||
it('should confirm the first sale contains the discount', async() => {
|
||||
const value = await nightmare
|
||||
.waitToGetProperty(selectors.ticketSales.firstSaleDiscount, 'innerText');
|
||||
|
||||
expect(value).toContain('0 %');
|
||||
});
|
||||
|
||||
it('should confirm the first sale contains the total import', async() => {
|
||||
const value = await nightmare
|
||||
.waitToGetProperty(selectors.ticketSales.firstSaleImport, 'innerText');
|
||||
|
||||
expect(value).toContain('34.40');
|
||||
});
|
||||
|
||||
it('should add an empty item to the sale list', async() => {
|
||||
const sales = await nightmare
|
||||
.waitToClick(selectors.ticketSales.newItemButton)
|
||||
.countElement(selectors.ticketSales.saleLine);
|
||||
|
||||
expect(sales).toEqual(2);
|
||||
});
|
||||
|
||||
it('should select a valid item to be added as the second item in the sales list', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.ticketSales.secondSaleIdInput)
|
||||
.write(selectors.ticketSales.secondSaleIdAutocomplete, 'Melee weapon heavy shield 1x0.5m')
|
||||
.waitToClick(selectors.ticketSales.idAutocompleteFirstResult)
|
||||
.write(selectors.ticketSales.secondSaleQuantity, '1\u000d')
|
||||
.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should update the description of the new sale', async() => {
|
||||
const result = await nightmare
|
||||
.focusElement(selectors.ticketSales.secondSaleConceptCell)
|
||||
.write(selectors.ticketSales.secondSaleConceptInput, 'Aegis of Valor\u000d')
|
||||
.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should add a third empty item to the sale list', async() => {
|
||||
const sales = await nightmare
|
||||
.waitToClick(selectors.ticketSales.newItemButton)
|
||||
.countElement(selectors.ticketSales.saleLine);
|
||||
|
||||
expect(sales).toEqual(3);
|
||||
});
|
||||
|
||||
it('should select the 2nd and 3th item and delete both', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.ticketSales.secondSaleCheckbox)
|
||||
.waitToClick(selectors.ticketSales.thirdSaleCheckbox)
|
||||
.waitToClick(selectors.ticketSales.deleteSaleButton)
|
||||
.waitToClick(selectors.ticketSales.acceptDeleteLineButton)
|
||||
.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it(`should verify there's only 1 single line remaining`, async() => {
|
||||
const sales = await nightmare
|
||||
.countElement(selectors.ticketSales.saleLine);
|
||||
|
||||
expect(sales).toEqual(1);
|
||||
});
|
||||
|
||||
it('should navigate to the catalog by pressing the new item button', async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.ticketSales.newItemFromCatalogButton)
|
||||
.waitForURL('/catalog')
|
||||
.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/catalog');
|
||||
});
|
||||
});
|
|
@ -1,7 +1,8 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
import selectors from '../../../helpers/selectors.js';
|
||||
import createNightmare from '../../../helpers/nightmare';
|
||||
|
||||
describe('Ticket Edit sale path', () => {
|
||||
// #1632 [e2e] ticket.sale - Transferir líneas
|
||||
xdescribe('Ticket Edit sale path', () => {
|
||||
const nightmare = createNightmare();
|
||||
|
||||
beforeAll(() => {
|
||||
|
@ -74,7 +75,7 @@ describe('Ticket Edit sale path', () => {
|
|||
|
||||
it(`should click on the first sale ID making the item descriptor visible`, async() => {
|
||||
const visible = await nightmare
|
||||
.waitToClick(selectors.ticketSales.firstSaleID)
|
||||
.waitToClick(selectors.ticketSales.firstSaleId)
|
||||
.waitImgLoad(selectors.ticketSales.firstSaleDescriptorImage)
|
||||
.isVisible(selectors.ticketSales.saleDescriptorPopover);
|
||||
|
||||
|
@ -257,12 +258,14 @@ describe('Ticket Edit sale path', () => {
|
|||
expect(result).toEqual(3);
|
||||
});
|
||||
|
||||
it('should select the third sale and transfer it to a valid ticket', async() => {
|
||||
it('should select the second sale and transfer it to a valid ticket', async() => {
|
||||
const targetTicketId = 12;
|
||||
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.ticketSales.thirdSaleCheckbox)
|
||||
.waitToClick(selectors.ticketSales.secondSaleCheckbox)
|
||||
.waitToClick(selectors.ticketSales.transferSaleButton)
|
||||
.focusElement(selectors.ticketSales.transferQuantityCell)
|
||||
.write(selectors.ticketSales.transferQuantityInput, '10\u000d')
|
||||
.write(selectors.ticketSales.moveToTicketInput, targetTicketId)
|
||||
.waitToClick(selectors.ticketSales.moveToTicketButton)
|
||||
.waitForURL(`ticket/${targetTicketId}/sale`)
|
||||
|
@ -276,7 +279,14 @@ describe('Ticket Edit sale path', () => {
|
|||
.wait(selectors.ticketSales.secondSaleText)
|
||||
.waitToGetProperty(selectors.ticketSales.secondSaleText, 'innerText');
|
||||
|
||||
expect(result).toContain(`Ranged weapon longbow 2m`);
|
||||
expect(result).toContain(`Melee weapon heavy shield`);
|
||||
});
|
||||
|
||||
it('should confirm the transfered quantity is the correct one', async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(selectors.ticketSales.secondSaleQuantityCell, 'innerText');
|
||||
|
||||
expect(result).toContain('10');
|
||||
});
|
||||
|
||||
it('should go back to the original ticket sales section', async() => {
|
||||
|
@ -290,12 +300,19 @@ describe('Ticket Edit sale path', () => {
|
|||
expect(url.hash).toContain('/sale');
|
||||
});
|
||||
|
||||
it(`should confirm the original ticket has only two lines now`, async() => {
|
||||
it(`should confirm the original ticket has still three lines`, async() => {
|
||||
const result = await nightmare
|
||||
.wait(selectors.ticketSales.saleLine)
|
||||
.countElement(selectors.ticketSales.saleLine);
|
||||
|
||||
expect(result).toEqual(2);
|
||||
expect(result).toEqual(3);
|
||||
});
|
||||
|
||||
it(`should confirm the second sale quantity is now half of it's original value after the transfer`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(selectors.ticketSales.secondSaleQuantityCell, 'innerText');
|
||||
|
||||
expect(result).toContain('10');
|
||||
});
|
||||
|
||||
it('should go back to the receiver ticket sales section', async() => {
|
||||
|
@ -324,11 +341,12 @@ describe('Ticket Edit sale path', () => {
|
|||
});
|
||||
|
||||
it('should confirm the original ticket received the line', async() => {
|
||||
const expectedLines = 4;
|
||||
const result = await nightmare
|
||||
.waitForNumberOfElements(selectors.ticketSales.saleLine, 3)
|
||||
.waitForNumberOfElements(selectors.ticketSales.saleLine, expectedLines)
|
||||
.countElement(selectors.ticketSales.saleLine);
|
||||
|
||||
expect(result).toEqual(3);
|
||||
expect(result).toEqual(expectedLines);
|
||||
});
|
||||
|
||||
it(`should throw an error when attempting to create a ticket for an inactive client`, async() => {
|
||||
|
@ -357,7 +375,7 @@ describe('Ticket Edit sale path', () => {
|
|||
const senderTicketId = 13;
|
||||
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.ticketSales.firstSaleCheckbox)
|
||||
.waitToClick(selectors.ticketSales.selectAllSalesCheckbox)
|
||||
.waitToClick(selectors.ticketSales.transferSaleButton)
|
||||
.waitToClick(selectors.ticketSales.moveToNewTicketButton)
|
||||
.waitToClick(selectors.ticketSales.acceptDeleteTicketButton)
|
|
@ -1,57 +0,0 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
|
||||
describe('Ticket List sale path', () => {
|
||||
const nightmare = createNightmare();
|
||||
|
||||
beforeAll(() => {
|
||||
return nightmare
|
||||
.loginAndModule('employee', 'ticket')
|
||||
.accessToSearchResult(12)
|
||||
.accessToSection('ticket.card.sale');
|
||||
});
|
||||
|
||||
it('should confirm the first ticket sale contains the colour', async() => {
|
||||
const value = await nightmare
|
||||
.waitToGetProperty(selectors.ticketSales.firstSaleColour, 'innerText');
|
||||
|
||||
expect(value).toContain('Black');
|
||||
});
|
||||
|
||||
it('should confirm the first ticket sale contains the lenght', async() => {
|
||||
const value = await nightmare
|
||||
.waitToGetProperty(selectors.ticketSales.firstSaleText, 'innerText');
|
||||
|
||||
expect(value).toContain('1');
|
||||
});
|
||||
|
||||
it('should confirm the first ticket sale contains the price', async() => {
|
||||
const value = await nightmare
|
||||
.waitToGetProperty(selectors.ticketSales.firstSalePrice, 'innerText');
|
||||
|
||||
expect(value).toContain('1.72');
|
||||
});
|
||||
|
||||
it('should confirm the first ticket sale contains the discount', async() => {
|
||||
const value = await nightmare
|
||||
.waitToGetProperty(selectors.ticketSales.firstSaleDiscount, 'innerText');
|
||||
|
||||
expect(value).toContain('0 %');
|
||||
});
|
||||
|
||||
it('should confirm the first ticket sale contains the total import', async() => {
|
||||
const value = await nightmare
|
||||
.waitToGetProperty(selectors.ticketSales.firstSaleImport, 'innerText');
|
||||
|
||||
expect(value).toContain('34.40');
|
||||
});
|
||||
|
||||
it('should navigate to the catalog by pressing the new item button', async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.ticketSales.newItemButton)
|
||||
.waitForURL('/catalog')
|
||||
.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/catalog');
|
||||
});
|
||||
});
|
|
@ -30,17 +30,6 @@ describe('Ticket Create new tracking state path', () => {
|
|||
expect(result).toEqual('State cannot be blank');
|
||||
});
|
||||
|
||||
it(`should attempt create a new state then clear and save it`, async() => {
|
||||
let result = await nightmare
|
||||
.autocompleteSearch(selectors.createStateView.stateAutocomplete, '¿Fecha?')
|
||||
.waitToClick(selectors.createStateView.clearStateInputButton)
|
||||
.waitToClick(selectors.createStateView.saveStateButton)
|
||||
.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('State cannot be blank');
|
||||
});
|
||||
|
||||
|
||||
it(`should create a new state`, async() => {
|
||||
let result = await nightmare
|
||||
.autocompleteSearch(selectors.createStateView.stateAutocomplete, '¿Fecha?')
|
||||
|
@ -77,18 +66,16 @@ describe('Ticket Create new tracking state path', () => {
|
|||
expect(result).toEqual(`You don't have enough privileges`);
|
||||
});
|
||||
|
||||
it(`should attempt to create an state for the type salesPerson has rights but fail as worker is blank`, async() => {
|
||||
it(`should make sure the worker gets autocomplete uppon selecting the assigned state`, async() => {
|
||||
let result = await nightmare
|
||||
.autocompleteSearch(selectors.createStateView.stateAutocomplete, 'asignado')
|
||||
.waitToClick(selectors.createStateView.saveStateButton)
|
||||
.waitForLastSnackbar();
|
||||
.waitToGetProperty(`${selectors.createStateView.workerAutocomplete} input`, 'value');
|
||||
|
||||
expect(result).toEqual(`Worker cannot be blank`);
|
||||
expect(result).toEqual('salesPersonNick');
|
||||
});
|
||||
|
||||
it(`should create a new state with all it's data`, async() => {
|
||||
it(`should succesfully create a valid state`, async() => {
|
||||
let result = await nightmare
|
||||
.autocompleteSearch(selectors.createStateView.workerAutocomplete, 'replenisher')
|
||||
.waitToClick(selectors.createStateView.saveStateButton)
|
||||
.waitForLastSnackbar();
|
||||
|
||||
|
|
|
@ -11,10 +11,58 @@ describe('Ticket Edit basic data path', () => {
|
|||
.accessToSection('ticket.card.basicData.stepOne');
|
||||
});
|
||||
|
||||
it(`should edit the ticket agency then click next`, async() => {
|
||||
it(`should confirm the zone autocomplete is disabled unless your role is productionBoss`, async() => {
|
||||
const disabled = await nightmare
|
||||
.wait(selectors.ticketBasicData.zoneAutocomplete)
|
||||
.evaluate(selector => {
|
||||
return document.querySelector(selector).disabled;
|
||||
}, `${selectors.ticketBasicData.zoneAutocomplete} input`);
|
||||
|
||||
expect(disabled).toBeTruthy();
|
||||
});
|
||||
|
||||
it(`should now log as productionBoss to perform the rest of the tests`, async() => {
|
||||
await nightmare
|
||||
.loginAndModule('productionBoss', 'ticket')
|
||||
.accessToSearchResult(11)
|
||||
.accessToSection('ticket.card.basicData.stepOne');
|
||||
});
|
||||
|
||||
it(`should confirm the zone autocomplete is enabled for the role productionBoss`, async() => {
|
||||
const disabled = await nightmare
|
||||
.wait(selectors.ticketBasicData.zoneAutocomplete)
|
||||
.evaluate(selector => {
|
||||
return document.querySelector(selector).disabled;
|
||||
}, `${selectors.ticketBasicData.zoneAutocomplete} input`);
|
||||
|
||||
expect(disabled).toBeFalsy();
|
||||
});
|
||||
|
||||
it(`should check the zone is for Silla247`, async() => {
|
||||
let zone = await nightmare
|
||||
.waitToGetProperty(`${selectors.ticketBasicData.zoneAutocomplete} input`, 'value');
|
||||
|
||||
expect(zone).toContain('Zone 247 A');
|
||||
});
|
||||
|
||||
it(`should edit the ticket agency then check there are no zones for it`, async() => {
|
||||
let zone = await nightmare
|
||||
.autocompleteSearch(selectors.ticketBasicData.agencyAutocomplete, 'Entanglement')
|
||||
.getProperty(`${selectors.ticketBasicData.zoneAutocomplete} input`, 'value');
|
||||
|
||||
expect(zone.length).toEqual(0);
|
||||
});
|
||||
|
||||
it(`should edit the ticket zone then check the agency is for the new zone`, async() => {
|
||||
let zone = await nightmare
|
||||
.autocompleteSearch(selectors.ticketBasicData.zoneAutocomplete, 'Zone expensive A')
|
||||
.waitToGetProperty(`${selectors.ticketBasicData.agencyAutocomplete} input`, 'value');
|
||||
|
||||
expect(zone).toContain('Silla247Expensive');
|
||||
});
|
||||
|
||||
it(`should click next`, async() => {
|
||||
let url = await nightmare
|
||||
.autocompleteSearch(selectors.ticketBasicData.agencyAutocomplete, 'Silla247Expensive')
|
||||
.waitToGetProperty(`${selectors.ticketBasicData.zoneAutocomplete} input`, 'value')
|
||||
.waitToClick(selectors.ticketBasicData.nextStepButton)
|
||||
.waitForURL('data/step-two')
|
||||
.parsedUrl();
|
||||
|
@ -26,7 +74,7 @@ describe('Ticket Edit basic data path', () => {
|
|||
const result = await nightmare
|
||||
.waitToGetProperty(selectors.ticketBasicData.stepTwoTotalPriceDif, 'innerText');
|
||||
|
||||
expect(result).toContain('-€184.25');
|
||||
expect(result).toContain('-€248.00');
|
||||
});
|
||||
|
||||
it(`should then click next to move on to step three`, async() => {
|
||||
|
|
|
@ -9,10 +9,10 @@ describe('Ticket descriptor path', () => {
|
|||
.loginAndModule('employee', 'ticket');
|
||||
});
|
||||
|
||||
it('should count the mount of tickets in the turns section', async() => {
|
||||
it('should count the amount of tickets in the turns section', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.ticketsIndex.moreMenu)
|
||||
.waitToClick(selectors.ticketsIndex.moreMenuTurns)
|
||||
.waitToClick(selectors.ticketsIndex.moreMenuWeeklyTickets)
|
||||
.wait(selectors.ticketsIndex.weeklyTicket)
|
||||
.countElement(selectors.ticketsIndex.weeklyTicket);
|
||||
|
||||
|
@ -32,7 +32,7 @@ describe('Ticket descriptor path', () => {
|
|||
|
||||
it('should search for the ticket 11', async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.ticketsIndex.searchTicketInput, 'id:11')
|
||||
.write(selectors.ticketsIndex.searchTicketInput, 11)
|
||||
.waitToClick(selectors.ticketsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
||||
.countElement(selectors.ticketsIndex.searchResult);
|
||||
|
@ -73,8 +73,8 @@ describe('Ticket descriptor path', () => {
|
|||
it('should confirm the ticket 11 was added on thursday', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.ticketsIndex.moreMenu)
|
||||
.waitToClick(selectors.ticketsIndex.moreMenuTurns)
|
||||
.waitToGetProperty(selectors.ticketsIndex.sixthWeeklyTicketTurn, 'value');
|
||||
.waitToClick(selectors.ticketsIndex.moreMenuWeeklyTickets)
|
||||
.waitToGetProperty(selectors.ticketsIndex.sixthWeeklyTicket, 'value');
|
||||
|
||||
expect(result).toEqual('Thursday');
|
||||
});
|
||||
|
@ -92,7 +92,7 @@ describe('Ticket descriptor path', () => {
|
|||
|
||||
it('should now search for the ticket 11', async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.ticketsIndex.searchTicketInput, 'id:11')
|
||||
.write(selectors.ticketsIndex.searchTicketInput, 11)
|
||||
.waitToClick(selectors.ticketsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
||||
.countElement(selectors.ticketsIndex.searchResult);
|
||||
|
@ -133,17 +133,25 @@ describe('Ticket descriptor path', () => {
|
|||
it('should confirm the ticket 11 was added on saturday', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.ticketsIndex.moreMenu)
|
||||
.waitToClick(selectors.ticketsIndex.moreMenuTurns)
|
||||
.waitToGetProperty(selectors.ticketsIndex.sixthWeeklyTicketTurn, 'value');
|
||||
.waitToClick(selectors.ticketsIndex.moreMenuWeeklyTickets)
|
||||
.waitToGetProperty(selectors.ticketsIndex.sixthWeeklyTicket, 'value');
|
||||
|
||||
expect(result).toEqual('Saturday');
|
||||
});
|
||||
|
||||
// Test #1450 here
|
||||
it('should now search for the weekly ticket 11', async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.ticketsIndex.searchWeeklyTicketInput, 11)
|
||||
.waitToClick(selectors.ticketsIndex.searchWeeklyButton)
|
||||
.waitForNumberOfElements(selectors.ticketsIndex.searchWeeklyResult, 1)
|
||||
.countElement(selectors.ticketsIndex.searchWeeklyResult);
|
||||
|
||||
expect(result).toEqual(1);
|
||||
});
|
||||
|
||||
it('should delete the weekly ticket 11', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.ticketsIndex.sixthWeeklyTicketDeleteIcon)
|
||||
.waitToClick(selectors.ticketsIndex.firstWeeklyTicketDeleteIcon)
|
||||
.waitToClick(selectors.ticketsIndex.acceptDeleteTurn)
|
||||
.waitForLastSnackbar();
|
||||
|
||||
|
@ -152,7 +160,10 @@ describe('Ticket descriptor path', () => {
|
|||
|
||||
it('should confirm the sixth weekly ticket was deleted', async() => {
|
||||
const result = await nightmare
|
||||
.countElement(selectors.ticketsIndex.weeklyTicket);
|
||||
.waitToClick('vn-ticket-weekly-index vn-searchbar i[class="material-icons clear"]')
|
||||
.waitToClick(selectors.ticketsIndex.searchWeeklyButton)
|
||||
.waitForNumberOfElements(selectors.ticketsIndex.searchWeeklyResult, 5)
|
||||
.countElement(selectors.ticketsIndex.searchWeeklyResult);
|
||||
|
||||
expect(result).toEqual(5);
|
||||
});
|
|
@ -42,18 +42,18 @@ describe('Ticket diary path', () => {
|
|||
expect(url.hash).toContain('/diary');
|
||||
});
|
||||
|
||||
it(`should check the second line id is marked as counter`, async() => {
|
||||
it(`should check the second line id is marked as message`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(selectors.itemDiary.secondTicketId, 'className');
|
||||
|
||||
expect(result).toContain('counter');
|
||||
expect(result).toContain('message');
|
||||
});
|
||||
|
||||
it(`should check the third line balance is marked as counter`, async() => {
|
||||
it(`should check the third line balance is marked as message`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(`${selectors.itemDiary.fourthBalance} > span`, 'className');
|
||||
|
||||
expect(result).toContain('counter');
|
||||
expect(result).toContain('message');
|
||||
});
|
||||
|
||||
it(`should change to the warehouse two and check there are sales marked as negative balance`, async() => {
|
||||
|
|
|
@ -30,6 +30,33 @@ describe('Ticket descriptor path', () => {
|
|||
expect(url.hash).toContain('/summary');
|
||||
});
|
||||
|
||||
it('should open the change shipped hours dialog by using the more menu option', async() => {
|
||||
const visible = await nightmare
|
||||
.waitToClick(selectors.ticketDescriptor.moreMenu)
|
||||
.waitToClick(selectors.ticketDescriptor.moreMenuChangeShippedHour)
|
||||
.wait(selectors.ticketDescriptor.changeShippedHourInput)
|
||||
.isVisible(selectors.ticketDescriptor.changeShippedHourInput);
|
||||
|
||||
|
||||
expect(visible).toBeTruthy();
|
||||
});
|
||||
|
||||
it(`should update the shipped hour`, async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.ticketDescriptor.changeShippedHourInput, '0815')
|
||||
.waitToClick(selectors.ticketDescriptor.acceptChangeHourButton)
|
||||
.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Shipped hour updated');
|
||||
});
|
||||
|
||||
it(`should confirm the ticket descriptor shows the correct shipping hour`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(selectors.ticketDescriptor.descriptorDeliveryDate, 'innerText');
|
||||
|
||||
expect(result).toContain('08:15');
|
||||
});
|
||||
|
||||
it('should delete the ticket using the descriptor more menu', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.ticketDescriptor.moreMenu)
|
||||
|
@ -83,6 +110,7 @@ describe('Ticket descriptor path', () => {
|
|||
|
||||
it('should open the add stowaway dialog', async() => {
|
||||
const isVisible = await nightmare
|
||||
.waitForSpinnerLoad()
|
||||
.waitToClick(selectors.ticketDescriptor.moreMenu)
|
||||
.waitToClick(selectors.ticketDescriptor.moreMenuAddStowaway)
|
||||
.wait(selectors.ticketDescriptor.addStowawayDialogFirstTicket)
|
||||
|
|
|
@ -69,14 +69,6 @@ describe('Ticket Summary path', () => {
|
|||
expect(exists).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should click on the SET OK button and throw a privileges error', async() => {
|
||||
let result = await nightmare
|
||||
.waitToClick(selectors.ticketSummary.setOk)
|
||||
.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual(`You don't have enough privileges`);
|
||||
});
|
||||
|
||||
it('should log in as production then navigate to the summary of the same ticket', async() => {
|
||||
let url = await nightmare
|
||||
.loginAndModule('production', 'ticket')
|
||||
|
|
|
@ -7,7 +7,7 @@ describe('Claim action path', () => {
|
|||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('administrative', 'claim')
|
||||
.accessToSearchResult(4)
|
||||
.accessToSearchResult(2)
|
||||
.accessToSection('claim.card.action');
|
||||
});
|
||||
|
||||
|
|
|
@ -28,8 +28,8 @@ describe('Order edit basic data path', () => {
|
|||
it('should now navigate to order index', async() => {
|
||||
const orderId = 16;
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.globalItems.returnToModuleIndexButton)
|
||||
.waitToClick(selectors.globalItems.acceptButton)
|
||||
.waitToClick(selectors.orderDescriptor.returnToModuleIndexButton)
|
||||
.waitToClick(selectors.orderDescriptor.acceptNavigationButton)
|
||||
.wait(selectors.ordersIndex.createOrderButton)
|
||||
.accessToSearchResult(orderId)
|
||||
.accessToSection('order.card.basicData')
|
||||
|
@ -53,7 +53,7 @@ describe('Order edit basic data path', () => {
|
|||
it('should navigate to the order index and click the new order button', async() => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.globalItems.returnToModuleIndexButton)
|
||||
.waitToClick(selectors.globalItems.acceptButton)
|
||||
.waitToClick(selectors.orderBasicData.acceptButton)
|
||||
.waitToClick(selectors.ordersIndex.createOrderButton)
|
||||
.waitForURL('#!/order/create')
|
||||
.parsedUrl();
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
module.exports = '';
|
|
@ -7,10 +7,10 @@ import './style.scss';
|
|||
/**
|
||||
* Input with option selector.
|
||||
*
|
||||
* @property {String} valueField The data field name that should be shown
|
||||
* @property {String} showFiled The data field name that should be used as value
|
||||
* @property {String} showFiled The data field name that should be shown
|
||||
* @property {String} valueField The data field name that should be used as value
|
||||
* @property {Array} data Static data for the autocomplete
|
||||
* @property {Object} intialData A initial data to avoid the server request used to get the selection
|
||||
* @property {Object} intialData An initial data to avoid the server request used to get the selection
|
||||
* @property {Boolean} multiple Wether to allow multiple selection
|
||||
* @property {Object} selection Current object selected
|
||||
*
|
||||
|
|
|
@ -3,7 +3,9 @@ describe('Component vnAutocomplete', () => {
|
|||
let controller;
|
||||
let data = {id: 1, name: 'Bruce Wayne'};
|
||||
|
||||
beforeEach(ngModule('vnCore'));
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
|
||||
beforeEach(inject(($compile, $rootScope) => {
|
||||
$element = $compile(`<vn-autocomplete></vn-autocomplete>`)($rootScope);
|
||||
|
|
|
@ -2,7 +2,9 @@ describe('Component vnButtonMenu', () => {
|
|||
let controller;
|
||||
let $element;
|
||||
|
||||
beforeEach(ngModule('vnCore'));
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
|
||||
beforeEach(inject(($compile, $rootScope) => {
|
||||
$element = $compile(`<vn-icon-menu></vn-icon-menu>`)($rootScope);
|
||||
|
|
|
@ -81,7 +81,7 @@ export default class Calendar extends Component {
|
|||
this.events.push(event);
|
||||
});
|
||||
|
||||
if (value.length && this.defaultDate) {
|
||||
if (this.defaultDate) {
|
||||
this.repaint();
|
||||
this.checkSize();
|
||||
}
|
||||
|
|
|
@ -2,7 +2,9 @@ describe('Component vnCalendar', () => {
|
|||
let controller;
|
||||
let $element;
|
||||
|
||||
beforeEach(ngModule('vnCore'));
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
|
||||
beforeEach(inject(($compile, $rootScope) => {
|
||||
$element = $compile(`<vn-calendar></vn-calendar`)($rootScope);
|
||||
|
|
|
@ -2,7 +2,9 @@ describe('Component vnCheck', () => {
|
|||
let controller;
|
||||
let $element;
|
||||
|
||||
beforeEach(ngModule('vnCore'));
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
|
||||
beforeEach(inject(($compile, $rootScope) => {
|
||||
$element = $compile(`<vn-check></vn-check`)($rootScope);
|
||||
|
|
|
@ -6,7 +6,9 @@ describe('Component vnChip', () => {
|
|||
let $scope;
|
||||
let controller;
|
||||
|
||||
beforeEach(ngModule('vnCore'));
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, $rootScope) => {
|
||||
$scope = $rootScope.$new();
|
||||
|
|
|
@ -5,13 +5,12 @@ describe('Component vnDatePicker', () => {
|
|||
let today = new Date();
|
||||
today.setHours(0, 0, 0, 0);
|
||||
|
||||
beforeEach(ngModule('vnCore'));
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
|
||||
beforeEach(angular.mock.inject($componentController => {
|
||||
beforeEach(angular.mock.inject(($componentController, $translate) => {
|
||||
$attrs = {};
|
||||
$translate = {use: () => {
|
||||
return 'es';
|
||||
}};
|
||||
$element = angular.element(`<vn-date-picker><div><input type="text" class="mdl-textfield__input" name="MyName" ng-disabled="$ctrl.disabled" rule=""></input></div></vn-date-picker>`);
|
||||
controller = $componentController('vnDatePicker', {$element, $attrs, $translate});
|
||||
}));
|
||||
|
|
|
@ -2,7 +2,9 @@ describe('Component vnDialog', () => {
|
|||
let $element;
|
||||
let controller;
|
||||
|
||||
beforeEach(ngModule('vnCore'));
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
|
||||
beforeEach(angular.mock.inject($componentController => {
|
||||
$element = angular.element('<vn-dialog></vn-dialog>');
|
||||
|
|
|
@ -2,7 +2,9 @@ describe('Component vnDropDown', () => {
|
|||
let $element;
|
||||
let controller;
|
||||
|
||||
beforeEach(ngModule('vnCore'));
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
|
||||
beforeEach(inject(($compile, $rootScope, $document) => {
|
||||
$element = $compile(`<vn-drop-down></vn-drop-down>`)($rootScope);
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
<button type="button" ng-disabled="{{$ctrl.disabled}}">
|
||||
<button type="button" ng-disabled="$ctrl.disabled">
|
||||
<vn-icon icon="{{::$ctrl.icon}}">
|
||||
</button>
|
|
@ -45,4 +45,4 @@ import './input-file';
|
|||
import './treeview';
|
||||
import './treeview/child';
|
||||
import './calendar';
|
||||
|
||||
import './scroll-up/scroll-up';
|
||||
|
|
|
@ -18,7 +18,10 @@
|
|||
ng-blur="$ctrl.hasFocus = false"
|
||||
tabindex="{{$ctrl.input.tabindex}}"
|
||||
accept="{{$ctrl.accept}}"/>
|
||||
<label class="label" translate>{{$ctrl.label}}</label>
|
||||
<label class="label">
|
||||
<span translate>{{::$ctrl.label}}</span>
|
||||
<span translate ng-show="::$ctrl.required">*</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="underline"></div>
|
||||
<div class="selected underline"></div>
|
||||
|
|
|
@ -122,6 +122,7 @@ ngModule.component('vnInputFile', {
|
|||
name: '@?',
|
||||
disabled: '<?',
|
||||
multiple: '<?',
|
||||
required: '@?',
|
||||
accept: '@?',
|
||||
rule: '@?',
|
||||
files: '=model',
|
||||
|
|
|
@ -7,12 +7,14 @@ describe('Component vnInputFile', () => {
|
|||
let $element;
|
||||
let controller;
|
||||
|
||||
beforeEach(ngModule('vnCore'));
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, $rootScope) => {
|
||||
$scope = $rootScope.$new();
|
||||
$attrs = {};
|
||||
$element = angular.element('<div><input type="file"><div class="infix"><div class="rightIcons"></div></div>');
|
||||
$attrs = {field: '$ctrl.dms.file'};
|
||||
$element = angular.element('<vn-input-file label="File" field="$ctrl.dms.file"><input type="file"><div class="infix"><div class="rightIcons"></div></vn-input-file>');
|
||||
controller = $componentController('vnInputFile', {$element, $scope, $attrs, $timeout, $transclude: () => {}});
|
||||
controller.input = $element[0].querySelector('input');
|
||||
controller.validate = () => {};
|
||||
|
|
|
@ -7,12 +7,14 @@ describe('Component vnInputNumber', () => {
|
|||
let $element;
|
||||
let controller;
|
||||
|
||||
beforeEach(ngModule('vnCore'));
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, $rootScope) => {
|
||||
$scope = $rootScope.$new();
|
||||
$attrs = {};
|
||||
$element = angular.element('<div><input type="number"><div class="infix"><div class="rightIcons"></div></div>');
|
||||
$attrs = {field: '$ctrl.client.socialName'};
|
||||
$element = angular.element('<vn-input-number label="SocialName" field="$ctrl.client.socialName"><input type="number"><div class="infix"><div class="rightIcons"></div></vn-input-number>');
|
||||
controller = $componentController('vnInputNumber', {$element, $scope, $attrs, $timeout, $transclude: () => {}});
|
||||
controller.input = $element[0].querySelector('input');
|
||||
controller.validate = () => {};
|
||||
|
|
|
@ -45,6 +45,8 @@ export default class InputTime extends Input {
|
|||
this.element.classList.add('not-empty');
|
||||
else
|
||||
this.element.classList.remove('not-empty');
|
||||
|
||||
this.validateValue();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -83,7 +85,7 @@ export default class InputTime extends Input {
|
|||
* Gets min step value
|
||||
*/
|
||||
get step() {
|
||||
return this.input.step;
|
||||
return parseInt(this.input.step);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -111,6 +113,66 @@ export default class InputTime extends Input {
|
|||
|
||||
return date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns native validation message
|
||||
*/
|
||||
get validationError() {
|
||||
return this.input.validationMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates a valid input value
|
||||
*
|
||||
* @return {Boolean} - True if has a valid value
|
||||
*/
|
||||
hasValidValue() {
|
||||
return this.input.checkValidity();
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the input element
|
||||
* if has a validation error
|
||||
*/
|
||||
validateValue() {
|
||||
if (!this.hasValidValue()) {
|
||||
this.hideError();
|
||||
this.showError();
|
||||
} else
|
||||
this.hideError();
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the input validation error
|
||||
*/
|
||||
showError() {
|
||||
const infixElement = this.element.querySelector('.infix');
|
||||
const infixClassList = infixElement.classList;
|
||||
|
||||
const errorSpan = document.createElement('span');
|
||||
errorSpan.className = 'mdl-textfield__error';
|
||||
|
||||
const errorText = document.createTextNode(this.validationError);
|
||||
|
||||
errorSpan.append(errorText);
|
||||
infixElement.append(errorSpan);
|
||||
|
||||
infixClassList.add('validated', 'invalid');
|
||||
}
|
||||
|
||||
/**
|
||||
* Hides the input validation error
|
||||
*/
|
||||
hideError() {
|
||||
const infixElement = this.element.querySelector('.infix');
|
||||
const infixClassList = infixElement.classList;
|
||||
const errorElement = this.element.querySelector('.infix span.mdl-textfield__error');
|
||||
|
||||
if (errorElement)
|
||||
errorElement.remove();
|
||||
|
||||
infixClassList.remove('validated', 'invalid');
|
||||
}
|
||||
}
|
||||
|
||||
InputTime.$inject = ['$element', '$scope', '$attrs', 'vnTemplate', '$transclude'];
|
||||
|
|
|
@ -1,28 +1,31 @@
|
|||
import './index.js';
|
||||
|
||||
describe('Component vnInputNumber', () => {
|
||||
describe('Component vnInputTime', () => {
|
||||
let $scope;
|
||||
let $attrs;
|
||||
let $timeout;
|
||||
let $element;
|
||||
let controller;
|
||||
|
||||
beforeEach(ngModule('vnCore'));
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, $rootScope) => {
|
||||
$scope = $rootScope.$new();
|
||||
$attrs = {};
|
||||
$element = angular.element('<div><input><div class="infix invalid validated"><div class="rightIcons"></div></div>');
|
||||
controller = $componentController('vnInputNumber', {$element, $scope, $attrs, $timeout, $transclude: () => {}});
|
||||
$attrs = {field: '$ctrl.zone.hour'};
|
||||
$element = angular.element('<vn-input-time label="Hour" field="$ctrl.zone.hour"><input><div class="infix invalid validated"><div class="rightIcons"></div></vn-input-time>');
|
||||
controller = $componentController('vnInputTime', {$element, $scope, $attrs, $timeout, $transclude: () => {}});
|
||||
}));
|
||||
|
||||
describe('value() setter', () => {
|
||||
it(`should set _value to a given value, add the class not-empty and remove invalid and validated`, () => {
|
||||
controller.value = 'pepino';
|
||||
const today = new Date();
|
||||
controller.value = today;
|
||||
let classes = controller.element.classList.toString();
|
||||
|
||||
expect(classes).toContain('not-empty');
|
||||
expect(controller._value).toEqual('pepino');
|
||||
expect(controller._value).toEqual(today);
|
||||
|
||||
classes = controller.element.querySelector('.infix').classList.toString();
|
||||
|
||||
|
@ -40,15 +43,15 @@ describe('Component vnInputNumber', () => {
|
|||
|
||||
describe('step() setter/getter', () => {
|
||||
it(`should set input.step to a given value`, () => {
|
||||
controller.step = 50;
|
||||
controller.step = 2;
|
||||
|
||||
expect(controller.input.step).toEqual('50');
|
||||
expect(controller.input.step).toEqual('2');
|
||||
});
|
||||
|
||||
it(`should return a number`, () => {
|
||||
controller.step = 50;
|
||||
controller.step = 2;
|
||||
|
||||
expect(controller.step).toEqual(50);
|
||||
expect(controller.step).toEqual(2);
|
||||
expect(typeof controller.step).toEqual('number');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -3,7 +3,7 @@ import Input from '../../lib/input';
|
|||
import './style.scss';
|
||||
|
||||
/**
|
||||
* Draw checkbox with a drop-down and multi options
|
||||
* Multicheck component for checking all form instances at once
|
||||
* @param {SmallInt} checkAll Primary input-check state: 0 -> uncheck, 1 -> checked
|
||||
* @param {Array} data List of options shown in drop-down
|
||||
* @param {Array} models Elements to check / unCheck
|
||||
|
|
|
@ -5,7 +5,9 @@ describe('Component vnMultiCheck', () => {
|
|||
let controller;
|
||||
let $element;
|
||||
|
||||
beforeEach(ngModule('vnCore'));
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
|
||||
beforeEach(angular.mock.inject($componentController => {
|
||||
$element = angular.element(`<div class="shown"></div>`);
|
||||
|
|
|
@ -4,7 +4,9 @@ describe('Component vnPaging', () => {
|
|||
let $scope;
|
||||
let controller;
|
||||
|
||||
beforeEach(ngModule('vnCore'));
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, $rootScope) => {
|
||||
$scope = $rootScope.$new();
|
||||
|
|
|
@ -73,6 +73,24 @@ export default class Popover extends Component {
|
|||
if (this._shown) return;
|
||||
|
||||
if (parent) this.parent = parent;
|
||||
|
||||
let isDescriptorMoreMenu = parent && parent.attributes[0].nodeValue == 'more-button';
|
||||
let leftMenu = this.document.querySelector('div[class="menu left"]');
|
||||
if (isDescriptorMoreMenu && leftMenu) {
|
||||
let leftMenuWidth = leftMenu.offsetWidth;
|
||||
let descriptorDiv = this.document.querySelector('vn-side-menu div');
|
||||
|
||||
let descriptorWidth = descriptorDiv.offsetWidth;
|
||||
this.scrollbarWidth = leftMenuWidth - descriptorWidth;
|
||||
let newWidth = leftMenuWidth - this.scrollbarWidth;
|
||||
|
||||
leftMenu.style.overflow = 'hidden';
|
||||
leftMenu.style.minWidth = `${newWidth}px`;
|
||||
leftMenu.style.width = `${newWidth}px`;
|
||||
|
||||
this.restoreOverflow = true;
|
||||
}
|
||||
|
||||
this._shown = true;
|
||||
this.element.style.display = 'block';
|
||||
this.$timeout.cancel(this.showTimeout);
|
||||
|
@ -96,6 +114,16 @@ export default class Popover extends Component {
|
|||
hide() {
|
||||
if (!this._shown) return;
|
||||
|
||||
if (this.restoreOverflow) {
|
||||
const leftMenu = this.document.querySelector('div[class="menu left"]');
|
||||
let leftMenuWidth = parseInt(leftMenu.style.width);
|
||||
let newWidth = leftMenuWidth + this.scrollbarWidth;
|
||||
leftMenu.style.overflow = 'auto';
|
||||
leftMenu.style.minWidth = `${newWidth}px`;
|
||||
leftMenu.style.width = `${newWidth}px`;
|
||||
|
||||
this.restoreOverflow = false;
|
||||
}
|
||||
this._shown = false;
|
||||
this.$element.removeClass('shown');
|
||||
this.$timeout.cancel(this.showTimeout);
|
||||
|
|
|
@ -4,7 +4,9 @@ describe('Component vnPopover', () => {
|
|||
let $parent;
|
||||
let controller;
|
||||
|
||||
beforeEach(ngModule('vnCore'));
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
|
||||
beforeEach(inject(($compile, $rootScope, $document) => {
|
||||
$element = $compile(`<vn-popover>test</vn-popover>`)($rootScope);
|
||||
|
@ -37,7 +39,8 @@ describe('Component vnPopover', () => {
|
|||
expect(controller.emit).not.toHaveBeenCalledWith('open');
|
||||
});
|
||||
|
||||
it(`should check that popover is visible into the screen`, () => {
|
||||
//#1615 migrar karma a jest (this doesn't work anymore, needs fixing)
|
||||
xit(`should check that popover is visible into the screen`, () => {
|
||||
$parent.css({
|
||||
backgroundColor: 'red',
|
||||
position: 'absolute',
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<button class="mdl-button mdl-js-button mdl-button--fab mdl-button--mini-fab mdl-js-ripple-effect mdl-button--colored"
|
||||
ng-click="$ctrl.goUp()"
|
||||
vn-tooltip="Go up">
|
||||
<vn-icon icon="keyboard_arrow_up"></vn-icon>
|
||||
</button>
|
|
@ -0,0 +1,34 @@
|
|||
import ngModule from '../../module';
|
||||
import Component from '../../lib/component';
|
||||
import './style.scss';
|
||||
|
||||
export default class Controller extends Component {
|
||||
constructor($element, $scope, $window) {
|
||||
super($element, $scope);
|
||||
this.$window = $window;
|
||||
|
||||
$window.addEventListener('scroll', () => {
|
||||
if ($window.scrollY > 0)
|
||||
$element[0].style.display = 'block';
|
||||
else
|
||||
$element[0].style.display = 'none';
|
||||
});
|
||||
}
|
||||
|
||||
goUp() {
|
||||
this.$window.scrollTo(0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
Controller.$inject = ['$element', '$scope', '$window'];
|
||||
|
||||
ngModule.component('vnScrollUp', {
|
||||
template: require('./scroll-up.html'),
|
||||
controller: Controller,
|
||||
bindings: {
|
||||
field: '=?',
|
||||
options: '<?',
|
||||
disabled: '<?',
|
||||
checked: '<?'
|
||||
}
|
||||
});
|
|
@ -0,0 +1,6 @@
|
|||
vn-scroll-up {
|
||||
top: 5em;
|
||||
right: 2.5em;
|
||||
display: none;
|
||||
position: fixed;
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`Component vnSearchbar doSearch() should define searchString, call onSearch and the model applyFilter method 1`] = `"function search() { [native code] } 0:i 1:d 2:: 3:( ) 4:1 5:2 6:3 7:4 8:5 9:6"`;
|
||||
|
||||
exports[`Component vnSearchbar onPanelSubmit() should hide the popover, and set the filter as it wasn't defined 1`] = `Object {}`;
|
||||
|
||||
exports[`Component vnSearchbar onPanelSubmit() should hide the popover, compact the filter 1`] = `
|
||||
Object {
|
||||
"id": 999,
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Component vnSearchbar onSubmit() should define the controller's filter 1`] = `
|
||||
Object {
|
||||
"search": "id: 999",
|
||||
}
|
||||
`;
|
|
@ -22,13 +22,12 @@ export default class Controller extends Component {
|
|||
this.$element = $element;
|
||||
this.$compile = $compile;
|
||||
this.$state = $state;
|
||||
this.$scope = $scope;
|
||||
this.$ = $scope;
|
||||
let criteria = {to: this.$state.current.name};
|
||||
this.deregisterCallback = $transitions.onSuccess(criteria,
|
||||
() => this.onStateChange());
|
||||
|
||||
this._filter = null;
|
||||
this.searchString = '';
|
||||
this.autoLoad = false;
|
||||
}
|
||||
|
||||
|
@ -52,12 +51,18 @@ export default class Controller extends Component {
|
|||
if (this.$state.params.q) {
|
||||
try {
|
||||
this._filter = JSON.parse(this.$state.params.q);
|
||||
} catch (e) {}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
this.doSearch();
|
||||
}
|
||||
|
||||
get shownFilter() {
|
||||
return this._filter != null ? this._filter : this.suggestedFilter;
|
||||
}
|
||||
|
||||
openPanel(event) {
|
||||
if (event.defaultPrevented) return;
|
||||
event.preventDefault();
|
||||
|
@ -65,7 +70,8 @@ export default class Controller extends Component {
|
|||
this.$panelScope = this.$.$new();
|
||||
this.$panel = this.$compile(`<${this.panel}/>`)(this.$panelScope);
|
||||
let panel = this.$panel.isolateScope().$ctrl;
|
||||
panel.filter = this._filter;
|
||||
if (this.shownFilter)
|
||||
panel.filter = JSON.parse(JSON.stringify(this.shownFilter));
|
||||
panel.onSubmit = filter => this.onPanelSubmit(filter);
|
||||
|
||||
this.$.popover.parent = this.element;
|
||||
|
@ -94,13 +100,12 @@ export default class Controller extends Component {
|
|||
}
|
||||
|
||||
doSearch() {
|
||||
let filter = this._filter;
|
||||
this.searchString = this.getStringFromObject(this.shownFilter);
|
||||
|
||||
let filter = this._filter;
|
||||
if (filter == null && this.autoload)
|
||||
filter = {};
|
||||
|
||||
this.searchString = this.getStringFromObject(filter);
|
||||
|
||||
if (this.onSearch)
|
||||
this.onSearch({$params: filter});
|
||||
|
||||
|
@ -214,6 +219,7 @@ ngModule.component('vnSearchbar', {
|
|||
template: require('./searchbar.html'),
|
||||
bindings: {
|
||||
filter: '<?',
|
||||
suggestedFilter: '<?',
|
||||
onSearch: '&?',
|
||||
panel: '@',
|
||||
model: '<?',
|
||||
|
|
|
@ -4,13 +4,17 @@ describe('Component vnSearchbar', () => {
|
|||
let controller;
|
||||
let $element;
|
||||
let $state;
|
||||
let $scope;
|
||||
|
||||
beforeEach(ngModule('vnCore'));
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, _$state_) => {
|
||||
beforeEach(angular.mock.inject(($componentController, _$state_, $rootScope, $compile) => {
|
||||
$scope = $rootScope.$new();
|
||||
$state = _$state_;
|
||||
$element = angular.element(`<div></div>`);
|
||||
controller = $componentController('vnSearchbar', {$element, $state});
|
||||
$element = angular.element(`<vn-textfield><input></input></vn-textfield>`);
|
||||
controller = $componentController('vnSearchbar', {$element, $state, $scope, $compile});
|
||||
controller.panel = 'vn-client-search-panel';
|
||||
}));
|
||||
|
||||
|
@ -34,6 +38,38 @@ describe('Component vnSearchbar', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('onStateChange()', () => {
|
||||
it(`should set a formated _filter in the controller`, () => {
|
||||
spyOn(controller, 'doSearch');
|
||||
Object.assign(controller.$state.params, {q: '{"id": 999}'});
|
||||
|
||||
controller.onStateChange();
|
||||
|
||||
expect(controller._filter).toEqual({id: 999});
|
||||
expect(controller.doSearch).toHaveBeenCalledWith();
|
||||
});
|
||||
});
|
||||
|
||||
describe('shownFilter() getter', () => {
|
||||
it(`should return the _filter if not NULL`, () => {
|
||||
controller.filter = '{"id": 999}';
|
||||
|
||||
let shownFilter = controller.shownFilter;
|
||||
|
||||
expect(shownFilter).toEqual(controller._filter);
|
||||
expect(shownFilter).not.toEqual(controller.suggestedFilter);
|
||||
});
|
||||
|
||||
it(`should return the suggested filter if filter is NULL`, () => {
|
||||
controller.suggestedFilter = '{"id": 888}';
|
||||
|
||||
let shownFilter = controller.shownFilter;
|
||||
|
||||
expect(shownFilter).not.toEqual(controller._filter);
|
||||
expect(shownFilter).toEqual(controller.suggestedFilter);
|
||||
});
|
||||
});
|
||||
|
||||
describe('filter() setter', () => {
|
||||
it(`should call $state.go() to replace the current state location instead of creating a new one`, () => {
|
||||
controller._filter = {};
|
||||
|
@ -57,6 +93,83 @@ describe('Component vnSearchbar', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('onPopoverClose()', () => {
|
||||
it(`should get rid of $panel and $panelScope`, () => {
|
||||
controller.$panel = {
|
||||
I: 'should disappear',
|
||||
remove: () => {}
|
||||
};
|
||||
|
||||
controller.$panelScope = {$destroy: jasmine.createSpy('$destroy')};
|
||||
|
||||
controller.onPopoverClose();
|
||||
|
||||
expect(controller.$panelScope.$destroy).toHaveBeenCalledWith();
|
||||
expect(controller.$panel).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe('onPanelSubmit()', () => {
|
||||
it(`should hide the popover, and set the filter as it wasn't defined`, () => {
|
||||
controller.$.popover = {hide: jasmine.createSpy('hide')};
|
||||
const filter = undefined;
|
||||
|
||||
controller.onPanelSubmit(filter);
|
||||
|
||||
expect(controller.filter).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it(`should hide the popover, compact the filter`, () => {
|
||||
controller.$.popover = {hide: jasmine.createSpy('hide')};
|
||||
const filter = {id: 999, thisKeyShouldBePurged: null};
|
||||
|
||||
controller.onPanelSubmit(filter);
|
||||
|
||||
expect(controller.filter).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
||||
describe('onSubmit()', () => {
|
||||
it(`should define the controller's filter`, () => {
|
||||
controller.searchString = 'id: 999';
|
||||
controller.onSubmit();
|
||||
|
||||
expect(controller.filter).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
||||
describe('doSearch()', () => {
|
||||
it(`should define searchString, call onSearch and the model applyFilter method`, () => {
|
||||
controller._filter = 'id: 123456';
|
||||
controller.autoload = true;
|
||||
controller.onSearch = jasmine.createSpy('onSearch');
|
||||
controller.model = {applyFilter: jasmine.createSpy('applyFilter')};
|
||||
controller.paramBuilder = jasmine.createSpy('paramBuilder').and.returnValue({'param': `${controller._filter}`});
|
||||
|
||||
|
||||
controller.doSearch();
|
||||
|
||||
expect(controller.searchString).toMatchSnapshot();
|
||||
expect(controller.onSearch).toHaveBeenCalledWith({'$params': `${controller._filter}`});
|
||||
expect(controller.model.applyFilter).toHaveBeenCalledWith(jasmine.any(Object), jasmine.any(Object));
|
||||
});
|
||||
|
||||
it(`should define searchString, call onSearch and the model clear method`, () => {
|
||||
controller._filter = null;
|
||||
controller.autoload = false;
|
||||
controller.onSearch = jasmine.createSpy('onSearch');
|
||||
controller.model = {clear: jasmine.createSpy('clear')};
|
||||
controller.paramBuilder = jasmine.createSpy('paramBuilder').and.returnValue({'param': `${controller._filter}`});
|
||||
|
||||
|
||||
controller.doSearch();
|
||||
|
||||
expect(controller.searchString).toEqual('');
|
||||
expect(controller.onSearch).toHaveBeenCalledWith({'$params': null});
|
||||
expect(controller.model.clear).toHaveBeenCalledWith();
|
||||
});
|
||||
});
|
||||
|
||||
describe('getObjectFromString()', () => {
|
||||
it(`should return a formated object based on the string received for basic search`, () => {
|
||||
let result = controller.getObjectFromString('Bruce Wayne');
|
||||
|
|
|
@ -5,7 +5,9 @@ describe('Component vnSpinner', () => {
|
|||
let $element;
|
||||
let controller;
|
||||
|
||||
beforeEach(ngModule('vnCore'));
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, $rootScope) => {
|
||||
$scope = $rootScope.$new();
|
||||
|
|
|
@ -4,7 +4,9 @@ describe('Component vnStepControl', () => {
|
|||
let controller;
|
||||
let $state;
|
||||
|
||||
beforeEach(ngModule('vnCore'));
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, _$state_) => {
|
||||
$state = _$state_;
|
||||
|
|
|
@ -5,7 +5,9 @@ describe('Component vnTable', () => {
|
|||
let $element;
|
||||
let controller;
|
||||
|
||||
beforeEach(ngModule('vnCore'));
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, $rootScope) => {
|
||||
$scope = $rootScope.$new();
|
||||
|
|
|
@ -118,7 +118,7 @@ vn-table {
|
|||
}
|
||||
& > vn-td .chip {
|
||||
padding: .3em;
|
||||
border-radius: .3em;
|
||||
border-radius: .3em
|
||||
}
|
||||
|
||||
& > vn-td .chip.notice {
|
||||
|
@ -141,6 +141,11 @@ vn-table {
|
|||
background-color: $color-alert-medium;
|
||||
}
|
||||
|
||||
& > vn-td .chip.message {
|
||||
color: $color-font-dark;
|
||||
background-color: $color-bg-dark
|
||||
}
|
||||
|
||||
& > vn-td vn-icon-menu {
|
||||
display: inline-block;
|
||||
color: $color-main;
|
||||
|
|
|
@ -6,11 +6,13 @@ describe('Component vnTextarea', () => {
|
|||
let $element;
|
||||
let controller;
|
||||
|
||||
beforeEach(ngModule('vnCore'));
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, $rootScope) => {
|
||||
$scope = $rootScope.$new();
|
||||
$attrs = {};
|
||||
$attrs = {field: '$ctrl.claim.observation'};
|
||||
$element = angular.element('<vn-textarea vn-three label="Observation" field="$ctrl.claim.observation" rows="9"><textarea></vn-textarea>');
|
||||
$element[0].firstChild.MaterialTextfield = {updateClasses_: () => {}};
|
||||
controller = $componentController('vnTextarea', {$scope, $element, $attrs});
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
tabindex="{{$ctrl.input.tabindex}}"/>
|
||||
<label class="label">
|
||||
<span translate>{{::$ctrl.label}}</span>
|
||||
<span translate vn-tooltip="Required" ng-show="::$ctrl.required">*</span>
|
||||
<span translate ng-show="::$ctrl.required">*</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="underline"></div>
|
||||
|
|
|
@ -7,12 +7,14 @@ describe('Component vnTextfield', () => {
|
|||
let $element;
|
||||
let controller;
|
||||
|
||||
beforeEach(ngModule('vnCore'));
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, $rootScope) => {
|
||||
$scope = $rootScope.$new();
|
||||
$attrs = {};
|
||||
$element = angular.element('<div><input><div class="leftIcons"><div class="rightIcons"></div></div>');
|
||||
$attrs = {field: '$ctrl.client.phone'};
|
||||
$element = angular.element('<vn-textfield label="Phone" field="$ctrl.client.phone"><input><div class="leftIcons"><div class="rightIcons"></div></vn-textfield>');
|
||||
controller = $componentController('vnTextfield', {$scope, $element, $attrs, $timeout, $transclude: () => {}});
|
||||
}));
|
||||
|
||||
|
|
|
@ -5,7 +5,9 @@ describe('Component vnTh', () => {
|
|||
let controller;
|
||||
let $element;
|
||||
|
||||
beforeEach(ngModule('vnCore'));
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
|
||||
beforeEach(angular.mock.inject($componentController => {
|
||||
$element = angular.element(`<div>${template}</div>`);
|
||||
|
|
|
@ -1,18 +1,21 @@
|
|||
import './tooltip';
|
||||
|
||||
describe('Component vnTooltip', () => {
|
||||
// #1615 migrar karma a jest
|
||||
xdescribe('Component vnTooltip', () => {
|
||||
let $element;
|
||||
let controller;
|
||||
let $parent;
|
||||
let element;
|
||||
let window;
|
||||
|
||||
beforeEach(ngModule('vnCore'));
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
|
||||
beforeEach(inject(($compile, $rootScope, $document) => {
|
||||
$element = $compile(`<vn-tooltip class="text">test</span></vn-tooltip>`)($rootScope);
|
||||
beforeEach(inject(($componentController, $compile, $templateRequest, $document) => {
|
||||
$element = angular.element(`<vn-tooltip class="text">test</span></vn-tooltip>`);
|
||||
$document.find('body').append($element);
|
||||
controller = $element.controller('vnTooltip');
|
||||
controller = $componentController('vnTooltip', {$document, $compile, $templateRequest, $element});
|
||||
element = $element[0];
|
||||
window = controller.window;
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ export default class Watcher extends Component {
|
|||
throw new Error('URL parameter ommitted');
|
||||
}
|
||||
|
||||
$onChanges(changes) {
|
||||
$onChanges() {
|
||||
if (this.data)
|
||||
this.updateOriginalData();
|
||||
}
|
||||
|
@ -222,6 +222,15 @@ export default class Watcher extends Component {
|
|||
this.setPristine();
|
||||
}
|
||||
|
||||
loadOriginalData() {
|
||||
Object.keys(this.data).forEach(key => {
|
||||
delete this.data[key];
|
||||
});
|
||||
|
||||
this.data = Object.assign(this.data, this.orgData);
|
||||
this.setPristine();
|
||||
}
|
||||
|
||||
copyInNewObject(data) {
|
||||
let newCopy = {};
|
||||
if (data && typeof data === 'object') {
|
||||
|
|
|
@ -10,7 +10,9 @@ describe('Component vnWatcher', () => {
|
|||
let $attrs;
|
||||
let $q;
|
||||
|
||||
beforeEach(ngModule('vnCore'));
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_, _$state_, _$q_) => {
|
||||
$scope = $rootScope.$new();
|
||||
|
@ -247,4 +249,14 @@ describe('Component vnWatcher', () => {
|
|||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe(`loadOriginalData()`, () => {
|
||||
it(`should iterate over the current data object, delete all properties then assign the ones from original data`, () => {
|
||||
controller.data = {name: 'Bruce'};
|
||||
controller.orgData = {name: 'Batman'};
|
||||
controller.loadOriginalData();
|
||||
|
||||
expect(controller.data).toEqual(controller.orgData);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -4,7 +4,9 @@ describe('Directive acl', () => {
|
|||
let compile;
|
||||
let $timeout;
|
||||
|
||||
beforeEach(ngModule('vnCore'));
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
|
||||
compile = (hasPermissions, _element) => {
|
||||
inject(($compile, $rootScope, aclService, _$timeout_) => {
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
describe('Directive bind', () => {
|
||||
let compile;
|
||||
|
||||
beforeEach(ngModule('vnCore'));
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
|
||||
compile = html => {
|
||||
inject(($compile, $rootScope) => {
|
||||
|
|
|
@ -5,7 +5,9 @@ describe('Directive dialog', () => {
|
|||
let compile;
|
||||
let controller;
|
||||
|
||||
beforeEach(ngModule('vnCore'));
|
||||
beforeEach(angular.mock.module('vnCore', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
|
||||
compile = _element => {
|
||||
inject(($compile, $rootScope) => {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue