Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 1772-campaign_metrics
This commit is contained in:
commit
58ee076524
|
@ -0,0 +1,132 @@
|
|||
DROP procedure IF EXISTS `vn`.`clonTravelComplete`;
|
||||
|
||||
DELIMITER $$
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`clonTravelComplete`(IN `vTravelFk` INT, IN `vDateStart` DATE, IN `vDateEnd` DATE, IN `vRef` VARCHAR(255))
|
||||
BEGIN
|
||||
|
||||
DECLARE vTravelNew INT;
|
||||
DECLARE vEntryNew INT;
|
||||
DECLARE vDone BIT DEFAULT 0;
|
||||
DECLARE vAuxEntryFk INT;
|
||||
DECLARE vRsEntry CURSOR FOR
|
||||
SELECT e.id
|
||||
FROM entry e
|
||||
JOIN travel t
|
||||
ON t.id = e.travelFk
|
||||
WHERE e.travelFk = vTravelFk;
|
||||
|
||||
DECLARE vRsBuy CURSOR FOR
|
||||
SELECT b.*
|
||||
FROM buy b
|
||||
JOIN entry e
|
||||
ON b.entryFk = e.id
|
||||
WHERE e.travelFk = vTravelNew and b.entryFk=entryNew
|
||||
ORDER BY e.id;
|
||||
|
||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = 1;
|
||||
|
||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||
BEGIN
|
||||
ROLLBACK;
|
||||
RESIGNAL;
|
||||
END;
|
||||
|
||||
START TRANSACTION;
|
||||
|
||||
INSERT INTO travel (shipped,landed, warehouseInFk, warehouseOutFk, agencyFk, ref, isDelivered, isReceived, m3, kg)
|
||||
SELECT vDateStart, vDateEnd,warehouseInFk, warehouseOutFk, agencyFk, vRef, isDelivered, isReceived, m3, kg
|
||||
FROM travel
|
||||
WHERE id = vTravelFk;
|
||||
|
||||
SET vTravelNew = LAST_INSERT_ID();
|
||||
SET vDone = 0;
|
||||
OPEN vRsEntry ;
|
||||
FETCH vRsEntry INTO vAuxEntryFk;
|
||||
|
||||
WHILE NOT vDone DO
|
||||
INSERT INTO entry (supplierFk,
|
||||
ref,
|
||||
isInventory,
|
||||
isConfirmed,
|
||||
isOrdered,
|
||||
isRaid,
|
||||
commission,
|
||||
created,
|
||||
evaNotes,
|
||||
travelFk,
|
||||
currencyFk,
|
||||
companyFk,
|
||||
gestDocFk,
|
||||
invoiceInFk)
|
||||
SELECT supplierFk,
|
||||
ref,
|
||||
isInventory,
|
||||
isConfirmed,
|
||||
isOrdered,
|
||||
isRaid,
|
||||
commission,
|
||||
created,
|
||||
evaNotes,
|
||||
vTravelNew,
|
||||
currencyFk,
|
||||
companyFk,
|
||||
gestDocFk,
|
||||
invoiceInFk
|
||||
FROM entry
|
||||
WHERE id = vAuxEntryFk;
|
||||
|
||||
SET vEntryNew = LAST_INSERT_ID();
|
||||
|
||||
|
||||
INSERT INTO buy (entryFk,
|
||||
itemFk,
|
||||
quantity,
|
||||
buyingValue,
|
||||
packageFk,
|
||||
stickers,
|
||||
freightValue,
|
||||
packageValue,
|
||||
comissionValue,
|
||||
packing,
|
||||
`grouping`,
|
||||
groupingMode,
|
||||
location,
|
||||
price1,
|
||||
price2,
|
||||
price3,
|
||||
minPrice,
|
||||
producer,
|
||||
printedStickers,
|
||||
isChecked)
|
||||
SELECT vEntryNew,
|
||||
itemFk,
|
||||
quantity,
|
||||
buyingValue,
|
||||
packageFk,
|
||||
stickers,
|
||||
freightValue,
|
||||
packageValue,
|
||||
comissionValue,
|
||||
packing,
|
||||
`grouping`,
|
||||
groupingMode,
|
||||
location,
|
||||
price1,
|
||||
price2,
|
||||
price3,
|
||||
minPrice,
|
||||
producer,
|
||||
printedStickers,
|
||||
isChecked
|
||||
FROM buy
|
||||
WHERE entryFk = vAuxEntryFk;
|
||||
|
||||
|
||||
FETCH vRsEntry INTO vAuxEntryFk;
|
||||
END WHILE;
|
||||
CLOSE vRsEntry;
|
||||
COMMIT;
|
||||
END$$
|
||||
|
||||
DELIMITER ;
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
|
||||
DELIMITER $$
|
||||
DROP TRIGGER IF EXISTS `vn`.`creditClassification_BEFORE_UPDATE` $$
|
||||
|
||||
|
||||
CREATE DEFINER=`root`@`%` TRIGGER `vn`.`creditClassification_beforeUpdate` BEFORE UPDATE ON `creditClassification` FOR EACH ROW
|
||||
BEGIN
|
||||
IF NEW.client <> OLD.client THEN
|
||||
CALL util.throw('NOT_ALLOWED_CHANGE_CLIENT');
|
||||
END IF;
|
||||
IF NEW.dateEnd IS NOT NULL AND OLD.dateEnd IS NULL THEN
|
||||
UPDATE `client` c
|
||||
SET creditInsurance = 0 WHERE c.id = NEW.client;
|
||||
END IF;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -0,0 +1,13 @@
|
|||
|
||||
DELIMITER $$
|
||||
|
||||
DROP TRIGGER IF EXISTS `vn`.`creditInsurance_AFTER_INSERT` $$
|
||||
|
||||
CREATE DEFINER=`root`@`%` TRIGGER `vn`.`creditInsurance_afterInsert` AFTER INSERT ON `creditInsurance` FOR EACH ROW
|
||||
BEGIN
|
||||
UPDATE `client` c
|
||||
JOIN vn.creditClassification cc ON cc.client = c.id
|
||||
SET creditInsurance = NEW.credit WHERE cc.id = NEW.creditClassification;
|
||||
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -0,0 +1,74 @@
|
|||
|
||||
DROP procedure IF EXISTS `vn`.`duaInvoiceInBooking`;
|
||||
|
||||
DELIMITER $$
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`duaInvoiceInBooking`(vDuaFk INT)
|
||||
BEGIN
|
||||
DECLARE done BOOL DEFAULT FALSE;
|
||||
DECLARE vInvoiceFk INT;
|
||||
DECLARE vASIEN BIGINT DEFAULT 0;
|
||||
DECLARE vCounter INT DEFAULT 0;
|
||||
|
||||
DECLARE rs CURSOR FOR
|
||||
SELECT e.invoiceInFk
|
||||
FROM entry e
|
||||
JOIN duaEntry de ON de.entryFk = e.id
|
||||
JOIN invoiceIn ii ON ii.id = e.invoiceInFk
|
||||
WHERE de.duaFk = vDuaFk
|
||||
AND de.customsValue
|
||||
AND ii.isBooked = FALSE;
|
||||
|
||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
|
||||
|
||||
OPEN rs;
|
||||
|
||||
UPDATE invoiceIn ii
|
||||
JOIN entry e ON e.invoiceInFk = ii.id
|
||||
JOIN duaEntry de ON de.entryFk = e.id
|
||||
JOIN dua d ON d.id = de.duaFk
|
||||
SET ii.isBooked = TRUE,
|
||||
ii.booked = IFNULL(ii.booked,d.booked),
|
||||
ii.operated = IFNULL(ii.operated,d.operated),
|
||||
ii.issued = IFNULL(ii.issued,d.issued),
|
||||
ii.bookEntried = IFNULL(ii.bookEntried,d.bookEntried),
|
||||
e.isConfirmed = TRUE
|
||||
WHERE d.id = vDuaFk;
|
||||
|
||||
SELECT IFNULL(ASIEN,0) INTO vASIEN
|
||||
FROM dua
|
||||
WHERE id = vDuaFk;
|
||||
|
||||
FETCH rs INTO vInvoiceFk;
|
||||
|
||||
WHILE NOT done DO
|
||||
|
||||
CALL invoiceInBookingMain(vInvoiceFk);
|
||||
|
||||
IF vCounter > 0 OR vASIEN > 0 THEN
|
||||
|
||||
UPDATE XDiario x
|
||||
JOIN config c ON c.ASIEN = x.ASIEN
|
||||
SET x.ASIEN = vASIEN;
|
||||
|
||||
ELSE
|
||||
|
||||
SELECT ASIEN INTO vASIEN FROM config;
|
||||
|
||||
END IF;
|
||||
|
||||
SET vCounter = vCounter + 1;
|
||||
|
||||
FETCH rs INTO vInvoiceFk;
|
||||
|
||||
END WHILE;
|
||||
|
||||
CLOSE rs;
|
||||
|
||||
UPDATE dua
|
||||
SET ASIEN = vASIEN
|
||||
WHERE id = vDuaFk;
|
||||
|
||||
END$$
|
||||
|
||||
DELIMITER ;
|
||||
|
|
@ -0,0 +1,149 @@
|
|||
DROP procedure IF EXISTS `vn`.`duaTaxBooking`;
|
||||
|
||||
DELIMITER $$
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`duaTaxBooking`(vDuaFk INT)
|
||||
BEGIN
|
||||
DECLARE vBookNumber INT;
|
||||
DECLARE vBookDated DATE;
|
||||
DECLARE vDiff DECIMAL(10,2);
|
||||
DECLARE vApunte BIGINT;
|
||||
|
||||
SELECT IFNULL(d.ASIEN,MAX(x.ASIEN) + 1 )
|
||||
INTO vBookNumber
|
||||
FROM XDiario x
|
||||
LEFT JOIN dua d ON d.id = vDuaFk ;
|
||||
|
||||
SELECT IFNULL(bookEntried, CURDATE()) INTO vBookDated
|
||||
FROM dua
|
||||
WHERE id = vDuaFk;
|
||||
|
||||
-- Apunte de la aduana
|
||||
|
||||
INSERT INTO XDiario(
|
||||
ASIEN,
|
||||
FECHA,
|
||||
SUBCTA,
|
||||
CONCEPTO,
|
||||
EUROHABER,
|
||||
SERIE,
|
||||
empresa_id,
|
||||
CLAVE,
|
||||
FACTURA)
|
||||
|
||||
SELECT
|
||||
vBookNumber,
|
||||
d.bookEntried,
|
||||
'4700000999',
|
||||
CONCAT('DUA ',d.code),
|
||||
sum(di.amount * tr.rate / 100) EUROHABER,
|
||||
'R',
|
||||
d.companyFk,
|
||||
vDuaFk,
|
||||
vDuaFk
|
||||
FROM duaIntrastat di
|
||||
JOIN intrastat ist ON ist.id = di.intrastatFk
|
||||
JOIN (SELECT rate, taxClassFk
|
||||
FROM
|
||||
(SELECT rate, taxClassFk
|
||||
FROM invoiceInTaxBookingAccount ta
|
||||
WHERE ta.effectived <= vBookDated
|
||||
ORDER BY ta.effectived DESC
|
||||
) tba
|
||||
GROUP BY taxClassFk
|
||||
) tr ON tr.taxClassFk = ist.taxClassFk
|
||||
JOIN dua d ON d.id = di.duaFk
|
||||
WHERE di.duaFk = vDuaFk;
|
||||
|
||||
-- Apuntes por tipo de IVA y proveedor
|
||||
|
||||
INSERT INTO XDiario(
|
||||
ASIEN,
|
||||
FECHA,
|
||||
SUBCTA,
|
||||
CONTRA,
|
||||
EURODEBE,
|
||||
BASEEURO,
|
||||
CONCEPTO,
|
||||
FACTURA,
|
||||
IVA,
|
||||
AUXILIAR,
|
||||
SERIE,
|
||||
FECHA_EX,
|
||||
FECHA_OP,
|
||||
FACTURAEX,
|
||||
NFACTICK,
|
||||
L340,
|
||||
LDIFADUAN,
|
||||
TIPOCLAVE,
|
||||
TIPOEXENCI,
|
||||
TIPONOSUJE,
|
||||
TIPOFACT,
|
||||
TIPORECTIF,
|
||||
TERIDNIF,
|
||||
TERNIF,
|
||||
TERNOM,
|
||||
empresa_id,
|
||||
FECREGCON
|
||||
)
|
||||
|
||||
SELECT
|
||||
vBookNumber ASIEN,
|
||||
vBookDated FECHA,
|
||||
tr.account SUBCTA,
|
||||
'4330002067' CONTRA,
|
||||
sum(dt.tax) EURODEBE,
|
||||
sum(dt.base) BASEEURO,
|
||||
CONCAT('DUA nº',d.code) CONCEPTO,
|
||||
d.id FACTURA,
|
||||
dt.rate IVA,
|
||||
'*' AUXILIAR,
|
||||
'D' SERIE,
|
||||
d.issued FECHA_EX,
|
||||
d.operated FECHA_OP,
|
||||
d.code FACTURAEX,
|
||||
1 NFACTICK,
|
||||
1 L340,
|
||||
TRUE LDIFADUAN,
|
||||
1 TIPOCLAVE,
|
||||
1 TIPOEXENCI,
|
||||
1 TIPONOSUJE,
|
||||
5 TIPOFACT,
|
||||
1 TIPORECTIF,
|
||||
IF(s.countryFk IN (30, 1), 1, 4) TERIDNIF,
|
||||
s.nif TERNIF,
|
||||
s.name TERNOM,
|
||||
d.companyFk,
|
||||
d.booked FECREGCON
|
||||
FROM duaTax dt
|
||||
JOIN dua d ON dt.duaFk = d.id
|
||||
JOIN (SELECT account, rate
|
||||
FROM
|
||||
(SELECT rate, account
|
||||
FROM invoiceInTaxBookingAccount ta
|
||||
WHERE ta.effectived <= vBookDated
|
||||
AND taxAreaFk = 'WORLD'
|
||||
ORDER BY ta.effectived DESC
|
||||
) tba
|
||||
GROUP BY rate
|
||||
) tr ON tr.rate = dt.rate
|
||||
JOIN supplier s ON s.id = d.companyFk
|
||||
WHERE d.id = vDuaFk
|
||||
GROUP BY dt.rate;
|
||||
|
||||
SELECT SUM(EURODEBE) -SUM(EUROHABER), MAX(id) INTO vDiff, vApunte
|
||||
FROM XDiario
|
||||
WHERE ASIEN = vBookNumber;
|
||||
|
||||
UPDATE XDiario
|
||||
SET BASEEURO = 100 * (EURODEBE - vDiff) / IVA,
|
||||
EURODEBE = EURODEBE - vDiff
|
||||
WHERE id = vApunte;
|
||||
|
||||
UPDATE dua
|
||||
SET ASIEN = vBookNumber
|
||||
WHERE id = vDuaFk;
|
||||
|
||||
END$$
|
||||
|
||||
DELIMITER ;
|
||||
|
|
@ -3,21 +3,36 @@ DROP procedure IF EXISTS `vn`.`rangeDateInfo`;
|
|||
DELIMITER $$
|
||||
CREATE PROCEDURE `vn`.`rangeDateInfo` (vStarted DATE, vEnded DATE)
|
||||
BEGIN
|
||||
/*
|
||||
/**
|
||||
* Crea una tabla temporal con las fechas
|
||||
* desde una fecha inicial a una final
|
||||
* @vStarted: fecha inicial
|
||||
* @vEnded: fecha final
|
||||
* @param vStarted fecha inicial
|
||||
* @param vEnded fecha final
|
||||
*/
|
||||
DECLARE vDated DATE DEFAULT vStarted;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.rangeDate;
|
||||
CREATE TEMPORARY TABLE tmp.rangeDate(
|
||||
dated DATE
|
||||
`dated` DATE,
|
||||
`period` INT,
|
||||
`month` INT,
|
||||
`year` INT,
|
||||
`day` INT,
|
||||
`week` INT,
|
||||
`yearMonth` INT
|
||||
)
|
||||
ENGINE = MEMORY;
|
||||
|
||||
WHILE vDated <= vEnded DO
|
||||
INSERT INTO tmp.rangeDate(dated) VALUES(vDated);
|
||||
INSERT INTO tmp.rangeDate
|
||||
SET `dated` = vDated,
|
||||
`period` = YEAR(vDated) * 100 + WEEK(vDated, 1),
|
||||
`month` = MONTH(vDated),
|
||||
`year` = YEAR(vDated),
|
||||
`day` = DAY(vDated),
|
||||
`week` = WEEK(vDated, 1),
|
||||
`yearMonth` = YEAR(vDated) * 100 + MONTH(vDated);
|
||||
|
||||
SET vDated = DATE_ADD(vDated, INTERVAL 1 DAY);
|
||||
END WHILE;
|
||||
END$$
|
||||
|
|
|
@ -89,6 +89,7 @@ BEGIN
|
|||
t.type = 'Festivo'
|
||||
WHERE t.type IS NULL;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.rangeDate;
|
||||
END$$
|
||||
|
||||
DELIMITER ;
|
||||
|
|
|
@ -36,7 +36,7 @@ UNLOCK TABLES;
|
|||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2019-11-22 8:14:41
|
||||
-- Dump completed on 2019-11-22 14:03:55
|
||||
USE `account`;
|
||||
-- MySQL dump 10.13 Distrib 5.7.28, for Linux (x86_64)
|
||||
--
|
||||
|
@ -94,7 +94,7 @@ UNLOCK TABLES;
|
|||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2019-11-22 8:14:41
|
||||
-- Dump completed on 2019-11-22 14:03:55
|
||||
USE `salix`;
|
||||
-- MySQL dump 10.13 Distrib 5.7.28, for Linux (x86_64)
|
||||
--
|
||||
|
@ -142,7 +142,7 @@ UNLOCK TABLES;
|
|||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2019-11-22 8:14:41
|
||||
-- Dump completed on 2019-11-22 14:03:55
|
||||
USE `vn`;
|
||||
-- MySQL dump 10.13 Distrib 5.7.28, for Linux (x86_64)
|
||||
--
|
||||
|
@ -310,7 +310,7 @@ UNLOCK TABLES;
|
|||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2019-11-22 8:14:41
|
||||
-- Dump completed on 2019-11-22 14:03:55
|
||||
USE `vn2008`;
|
||||
-- MySQL dump 10.13 Distrib 5.7.28, for Linux (x86_64)
|
||||
--
|
||||
|
@ -378,7 +378,7 @@ UNLOCK TABLES;
|
|||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2019-11-22 8:14:41
|
||||
-- Dump completed on 2019-11-22 14:03:55
|
||||
USE `bi`;
|
||||
-- MySQL dump 10.13 Distrib 5.7.28, for Linux (x86_64)
|
||||
--
|
||||
|
@ -426,7 +426,7 @@ UNLOCK TABLES;
|
|||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2019-11-22 8:14:42
|
||||
-- Dump completed on 2019-11-22 14:03:55
|
||||
USE `cache`;
|
||||
-- MySQL dump 10.13 Distrib 5.7.28, for Linux (x86_64)
|
||||
--
|
||||
|
@ -464,7 +464,7 @@ UNLOCK TABLES;
|
|||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2019-11-22 8:14:42
|
||||
-- Dump completed on 2019-11-22 14:03:55
|
||||
USE `hedera`;
|
||||
-- MySQL dump 10.13 Distrib 5.7.28, for Linux (x86_64)
|
||||
--
|
||||
|
@ -522,7 +522,7 @@ UNLOCK TABLES;
|
|||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2019-11-22 8:14:42
|
||||
-- Dump completed on 2019-11-22 14:03:55
|
||||
USE `postgresql`;
|
||||
-- MySQL dump 10.13 Distrib 5.7.28, for Linux (x86_64)
|
||||
--
|
||||
|
@ -610,4 +610,4 @@ UNLOCK TABLES;
|
|||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2019-11-22 8:14:42
|
||||
-- Dump completed on 2019-11-22 14:03:55
|
||||
|
|
|
@ -361,7 +361,7 @@ INSERT INTO `vn`.`creditInsurance`(`id`, `creditClassification`, `credit`, `crea
|
|||
(2, 2, 6000, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), NULL),
|
||||
(3, 3, 10000, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), NULL);
|
||||
|
||||
INSERT INTO `vn2008`.`empresa_grupo`(`empresa_grupo_id`, `grupo`)
|
||||
INSERT INTO `vn`.`companyGroup`(`id`, `code`)
|
||||
VALUES
|
||||
(1, 'Wayne Industries');
|
||||
|
||||
|
@ -1464,7 +1464,7 @@ INSERT INTO `vn`.`receipt`(`id`, `invoiceFk`, `amountPaid`, `amountUnpaid`, `pay
|
|||
(3, 'Cobro en efectivo', 300.00, 100.00, DATE_ADD(CURDATE(), INTERVAL -10 DAY), 9, 1, 102, DATE_ADD(CURDATE(), INTERVAL -10 DAY), 442, 0),
|
||||
(4, 'Cobro en efectivo', 400.00, -50.00, DATE_ADD(CURDATE(), INTERVAL -15 DAY), 9, 1, 103, DATE_ADD(CURDATE(), INTERVAL -15 DAY), 442, 0);
|
||||
|
||||
INSERT INTO `vn2008`.`workerTeam`(`id`, `team`, `user`)
|
||||
INSERT INTO `vn`.`workerTeam`(`id`, `team`, `workerFk`)
|
||||
VALUES
|
||||
(1, 1, 9),
|
||||
(2, 1, 18),
|
||||
|
@ -1956,4 +1956,3 @@ INSERT INTO `vn`.`userPhone`(`id`, `userFk`, `typeFk`, `phone`)
|
|||
INSERT INTO `vn`.`workerTimeControlParams` (`id`, `dayBreak`, `weekBreak`, `weekScope`, `dayWorkMax`, `dayStayMax`)
|
||||
VALUES
|
||||
(1, 43200, 129600, 734400, 43200, 50400);
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,8 +1,3 @@
|
|||
<vn-crud-model auto-load="true"
|
||||
url="Zones/{{$ctrl.$params.id}}/warehouses"
|
||||
include="{relation: 'warehouse'}"
|
||||
data="zoneWarehouses">
|
||||
</vn-crud-model>
|
||||
<vn-card class="summary">
|
||||
<h5>#{{$ctrl.summary.id}} - {{$ctrl.summary.name}}</h5>
|
||||
<vn-horizontal class="vn-pa-md">
|
||||
|
@ -34,14 +29,14 @@
|
|||
<vn-horizontal class="vn-pa-md">
|
||||
<vn-auto>
|
||||
<h4 translate>Warehouses</h4>
|
||||
<vn-table model="model">
|
||||
<vn-table model="model" auto-load="false">
|
||||
<vn-thead>
|
||||
<vn-tr>
|
||||
<vn-th>Name</vn-th>
|
||||
</vn-tr>
|
||||
</vn-thead>
|
||||
<vn-tbody>
|
||||
<vn-tr ng-repeat="zoneWarehouse in zoneWarehouses">
|
||||
<vn-tr ng-repeat="zoneWarehouse in $ctrl.zoneWarehouses">
|
||||
<vn-td>{{zoneWarehouse.warehouse.name}}</vn-td>
|
||||
</vn-tr>
|
||||
</vn-tbody>
|
||||
|
|
|
@ -2,6 +2,11 @@ import ngModule from '../module';
|
|||
import Component from 'core/lib/component';
|
||||
|
||||
class Controller extends Component {
|
||||
constructor($element, $, $httpParamSerializer) {
|
||||
super($element, $);
|
||||
|
||||
this.$httpParamSerializer = $httpParamSerializer;
|
||||
}
|
||||
get zone() {
|
||||
return this._zone;
|
||||
}
|
||||
|
@ -12,20 +17,44 @@ class Controller extends Component {
|
|||
if (!value) return;
|
||||
|
||||
this.getSummary();
|
||||
this.getWarehouses();
|
||||
}
|
||||
|
||||
getSummary() {
|
||||
let filter = {
|
||||
include: {relation: 'agencyMode', fields: ['name']},
|
||||
where: {id: this.zone.id}
|
||||
const params = {
|
||||
filter: {
|
||||
include: {
|
||||
relation: 'agencyMode',
|
||||
fields: ['name']
|
||||
},
|
||||
where: {
|
||||
id: this.zone.id
|
||||
}
|
||||
}
|
||||
};
|
||||
filter = encodeURIComponent(JSON.stringify((filter)));
|
||||
this.$http.get(`Zones/findOne?filter=${filter}`).then(res => {
|
||||
if (res && res.data)
|
||||
const serializedParams = this.$httpParamSerializer(params);
|
||||
this.$http.get(`Zones/findOne?${serializedParams}`).then(res => {
|
||||
this.summary = res.data;
|
||||
});
|
||||
}
|
||||
|
||||
getWarehouses() {
|
||||
const params = {
|
||||
filter: {
|
||||
include: {
|
||||
relation: 'warehouse',
|
||||
fields: ['name']
|
||||
}
|
||||
}
|
||||
};
|
||||
const serializedParams = this.$httpParamSerializer(params);
|
||||
this.$http.get(`Zones/${this.zone.id}/warehouses?${serializedParams}`).then(res => {
|
||||
this.zoneWarehouses = res.data;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Controller.$inject = ['$element', '$scope', '$httpParamSerializer'];
|
||||
|
||||
ngModule.component('vnZoneSummary', {
|
||||
template: require('./index.html'),
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
import './index';
|
||||
|
||||
describe('component vnZoneSummary', () => {
|
||||
let $element;
|
||||
let $scope;
|
||||
let controller;
|
||||
let $httpBackend;
|
||||
let $httpParamSerializer;
|
||||
|
||||
beforeEach(ngModule('agency'));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_, _$httpParamSerializer_) => {
|
||||
$httpBackend = _$httpBackend_;
|
||||
$httpParamSerializer = _$httpParamSerializer_;
|
||||
$scope = $rootScope.$new();
|
||||
$element = angular.element(`<vn-zone-summary></vn-zone-summary>`);
|
||||
controller = $componentController('vnZoneSummary', {$element, $scope});
|
||||
}));
|
||||
|
||||
describe('zone setter', () => {
|
||||
it('should set the zone and then call both getSummary() and getWarehouses()', () => {
|
||||
spyOn(controller, 'getSummary');
|
||||
spyOn(controller, 'getWarehouses');
|
||||
|
||||
controller.zone = {id: 1};
|
||||
|
||||
expect(controller.getSummary).toHaveBeenCalledWith();
|
||||
expect(controller.getWarehouses).toHaveBeenCalledWith();
|
||||
});
|
||||
});
|
||||
|
||||
describe('getSummary()', () => {
|
||||
it('should perform a get and then store data on the controller', () => {
|
||||
controller._zone = {id: 1};
|
||||
let params = {
|
||||
filter: {
|
||||
include: {
|
||||
relation: 'agencyMode',
|
||||
fields: ['name']
|
||||
},
|
||||
where: {
|
||||
id: controller._zone.id
|
||||
}
|
||||
}
|
||||
};
|
||||
const serializedParams = $httpParamSerializer(params);
|
||||
const query = `Zones/findOne?${serializedParams}`;
|
||||
$httpBackend.expectGET(query).respond({id: 1});
|
||||
controller.getSummary();
|
||||
$httpBackend.flush();
|
||||
|
||||
expect(controller.summary).toBeDefined();
|
||||
});
|
||||
});
|
||||
|
||||
xdescribe('getEntries()', () => {
|
||||
it('should call the getEntries method to get the entries data', () => {
|
||||
controller._travel = {id: 999};
|
||||
|
||||
const query = `/api/Travels/${controller._travel.id}/getEntries`;
|
||||
$httpBackend.expectGET(query).respond('I am the entries');
|
||||
controller.getEntries();
|
||||
$httpBackend.flush();
|
||||
|
||||
expect(controller.entries).toEqual('I am the entries');
|
||||
});
|
||||
});
|
||||
});
|
|
@ -18,8 +18,8 @@ class Controller {
|
|||
this._claim = value;
|
||||
|
||||
// Get DMS on summary load
|
||||
/* if (value)
|
||||
this.$.$applyAsync(() => this.loadDms()); */
|
||||
if (value)
|
||||
this.$.$applyAsync(() => this.loadDms());
|
||||
}
|
||||
|
||||
loadDms() {
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
</vn-crud-model>
|
||||
<vn-data-viewer model="model">
|
||||
<form name="form">
|
||||
<vn-card class="vn-pa-lg">
|
||||
<vn-tool-bar class="vn-mb-sm">
|
||||
<vn-card class="vn-pa-md">
|
||||
<vn-tool-bar>
|
||||
<vn-button
|
||||
icon="icon-wand"
|
||||
ng-click="$ctrl.guessPriority()"
|
||||
|
@ -18,14 +18,11 @@
|
|||
disabled="!$ctrl.isChecked"
|
||||
ng-click="$ctrl.goToBuscaman()"
|
||||
vn-tooltip="Open buscaman"
|
||||
tooltip-position="up"
|
||||
icon="icon-buscaman">
|
||||
</vn-button>
|
||||
</vn-tool-bar>
|
||||
<vn-icon-button
|
||||
vn-tooltip="Load more"
|
||||
ng-click="$ctrl.goToBuscaman()">
|
||||
</vn-icon-button>
|
||||
</vn-card>
|
||||
<vn-card class="vn-mt-md">
|
||||
<vn-table model="model" auto-load="false">
|
||||
<vn-thead>
|
||||
<vn-tr>
|
||||
|
@ -36,12 +33,12 @@
|
|||
</vn-th>
|
||||
<vn-th>Order</vn-th>
|
||||
<vn-th number>Ticket</vn-th>
|
||||
<vn-th>Client</vn-th>
|
||||
<vn-th number shrink>Packages</vn-th>
|
||||
<vn-th shrink>m³</vn-th>
|
||||
<vn-th shrink>Warehouse</vn-th>
|
||||
<vn-th expand>Postcode</vn-th>
|
||||
<vn-th>Street</vn-th>
|
||||
<vn-th expand>Client</vn-th>
|
||||
<vn-th number>Packages</vn-th>
|
||||
<vn-th number>m³</vn-th>
|
||||
<vn-th>Warehouse</vn-th>
|
||||
<vn-th>Postcode</vn-th>
|
||||
<vn-th expand>Street</vn-th>
|
||||
<vn-th shrink></vn-th>
|
||||
<vn-th shrink></vn-th>
|
||||
</vn-tr>
|
||||
|
@ -53,11 +50,12 @@
|
|||
ng-model="ticket.checked">
|
||||
</vn-check>
|
||||
</vn-td>
|
||||
<vn-td>
|
||||
<vn-td number>
|
||||
<vn-input-number
|
||||
on-change="$ctrl.setPriority(ticket.id, ticket.priority)"
|
||||
ng-model="ticket.priority"
|
||||
rule="Ticket">
|
||||
rule="Ticket"
|
||||
class="dense">
|
||||
</vn-input-number>
|
||||
</vn-td>
|
||||
<vn-td number>
|
||||
|
@ -74,10 +72,10 @@
|
|||
{{ticket.nickname}}
|
||||
</span>
|
||||
</vn-td>
|
||||
<vn-td number shrink>{{ticket.packages}}</vn-td>
|
||||
<vn-td shrink>{{ticket.volume}}</vn-td>
|
||||
<vn-td shrink>{{ticket.warehouse.name}}</vn-td>
|
||||
<vn-td number shrink>{{ticket.address.postalCode}}</vn-td>
|
||||
<vn-td number>{{ticket.packages}}</vn-td>
|
||||
<vn-td number>{{ticket.volume}}</vn-td>
|
||||
<vn-td expand>{{ticket.warehouse.name}}</vn-td>
|
||||
<vn-td>{{ticket.address.postalCode}}</vn-td>
|
||||
<vn-td expand title="{{ticket.address.street}}">{{ticket.address.street}}</vn-td>
|
||||
<vn-td shrink>
|
||||
<vn-icon-button
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import './index.js';
|
||||
|
||||
fdescribe('Ticket Component vnTicketDescriptor', () => {
|
||||
describe('Ticket Component vnTicketDescriptor', () => {
|
||||
let $httpParamSerializer;
|
||||
let $httpBackend;
|
||||
let controller;
|
||||
|
|
|
@ -9,21 +9,13 @@ export default class Controller {
|
|||
include: [
|
||||
{
|
||||
relation: 'agency',
|
||||
scope: {
|
||||
fields: ['name']
|
||||
}
|
||||
},
|
||||
{
|
||||
scope: {fields: ['name']}
|
||||
}, {
|
||||
relation: 'warehouseIn',
|
||||
scope: {
|
||||
fields: ['name']
|
||||
}
|
||||
},
|
||||
{
|
||||
scope: {fields: ['name']}
|
||||
}, {
|
||||
relation: 'warehouseOut',
|
||||
scope: {
|
||||
fields: ['name']
|
||||
}
|
||||
scope: {fields: ['name']}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
@ -35,10 +27,14 @@ export default class Controller {
|
|||
return {id: value};
|
||||
case 'ref':
|
||||
return {[param]: {regexp: value}};
|
||||
case 'shipped':
|
||||
case 'shippedFrom':
|
||||
return {shipped: {gte: value}};
|
||||
case 'shippedTo':
|
||||
return {shipped: {lte: value}};
|
||||
case 'landed':
|
||||
case 'landedFrom':
|
||||
return {landed: {gte: value}};
|
||||
case 'landedTo':
|
||||
return {landed: {lte: value}};
|
||||
case 'id':
|
||||
case 'agencyModeFk':
|
||||
case 'warehouseOutFk':
|
||||
|
|
|
@ -2,6 +2,10 @@
|
|||
Reference: Referencia
|
||||
Warehouse Out: Almacén salida
|
||||
Warehouse In: Almacén llegada
|
||||
Shipped from: Salida desde
|
||||
Shipped to: Salida hasta
|
||||
Landed from: Llegada desde
|
||||
Landed to: Llegada hasta
|
||||
Shipped: F. salida
|
||||
Landed: F. llegada
|
||||
Delivered: Enviado
|
||||
|
|
|
@ -38,13 +38,25 @@
|
|||
<vn-horizontal>
|
||||
<vn-date-picker
|
||||
vn-one
|
||||
label="Shipped"
|
||||
ng-model="filter.shipped">
|
||||
label="Shipped from"
|
||||
ng-model="filter.shippedFrom">
|
||||
</vn-date-picker>
|
||||
<vn-date-picker
|
||||
vn-one
|
||||
label="Landed"
|
||||
ng-model="filter.landed">
|
||||
label="Shipped to"
|
||||
ng-model="filter.shippedTo">
|
||||
</vn-date-picker>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-date-picker
|
||||
vn-one
|
||||
label="Landed from"
|
||||
ng-model="filter.landedFrom">
|
||||
</vn-date-picker>
|
||||
<vn-date-picker
|
||||
vn-one
|
||||
label="Landed to"
|
||||
ng-model="filter.landedTo">
|
||||
</vn-date-picker>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
|
|
Loading…
Reference in New Issue