2285 - Added closure paths #312
|
@ -11,4 +11,5 @@ npm-debug.log
|
||||||
datasources.*.json
|
datasources.*.json
|
||||||
print.*.json
|
print.*.json
|
||||||
db.json
|
db.json
|
||||||
junit.xml
|
junit.xml
|
||||||
|
.DS_Store
|
|
@ -8,6 +8,11 @@ RUN apt-get update \
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
gnupg2 \
|
gnupg2 \
|
||||||
libfontconfig \
|
libfontconfig \
|
||||||
|
&& apt-get -y install xvfb gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 \
|
||||||
|
libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 \
|
||||||
|
libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 \
|
||||||
|
libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 \
|
||||||
|
libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget \
|
||||||
&& curl -sL https://deb.nodesource.com/setup_12.x | bash - \
|
&& curl -sL https://deb.nodesource.com/setup_12.x | bash - \
|
||||||
&& apt-get install -y --no-install-recommends \
|
&& apt-get install -y --no-install-recommends \
|
||||||
nodejs \
|
nodejs \
|
||||||
|
|
|
@ -54,6 +54,10 @@ pipeline {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Test') {
|
stage('Test') {
|
||||||
|
when { not { anyOf {
|
||||||
|
branch 'test'
|
||||||
|
branch 'master'
|
||||||
|
}}}
|
||||||
environment {
|
environment {
|
||||||
NODE_ENV = ""
|
NODE_ENV = ""
|
||||||
}
|
}
|
||||||
|
@ -65,13 +69,13 @@ pipeline {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Backend') {
|
/* stage('Backend') {
|
||||||
steps {
|
steps {
|
||||||
nodejs('node-lts') {
|
nodejs('node-lts') {
|
||||||
sh 'gulp backTestOnce --ci'
|
sh 'gulp backTestOnce --ci'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Build') {
|
stage('Build') {
|
||||||
|
|
|
@ -13,8 +13,15 @@ Required applications.
|
||||||
|
|
||||||
You will need to install globally the following items.
|
You will need to install globally the following items.
|
||||||
```
|
```
|
||||||
# sudo npm install -g jest gulp-cli
|
$ sudo npm install -g jest gulp-cli
|
||||||
```
|
```
|
||||||
|
|
||||||
|
For the usage of jest --watch on macOs.
|
||||||
|
```
|
||||||
|
$ brew install watchman
|
||||||
|
```
|
||||||
|
* [watchman](https://facebook.github.io/watchman/)
|
||||||
|
|
||||||
## Linux Only Prerequisites
|
## Linux Only Prerequisites
|
||||||
|
|
||||||
Your user must be on the docker group to use it so you will need to run this command:
|
Your user must be on the docker group to use it so you will need to run this command:
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -2,6 +2,9 @@
|
||||||
"Account": {
|
"Account": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
"AccountingType": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
"Bank": {
|
"Bank": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
@ -26,6 +29,15 @@
|
||||||
"Delivery": {
|
"Delivery": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
"Image": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
|
"ImageCollection": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
|
"ImageCollectionSize": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
"Province": {
|
"Province": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
{
|
||||||
|
"name": "AccountingType",
|
||||||
|
"base": "VnModel",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "accountingType"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "Number",
|
||||||
|
"id": true,
|
||||||
|
"description": "Identifier"
|
||||||
|
},
|
||||||
|
"description": {
|
||||||
|
"type": "String",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"receiptDescription": {
|
||||||
|
"type": "String",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"acls": [{
|
||||||
|
"accessType": "READ",
|
||||||
|
"principalType": "ROLE",
|
||||||
|
"principalId": "$everyone",
|
||||||
|
"permission": "ALLOW"
|
||||||
|
}]
|
||||||
|
}
|
|
@ -2,39 +2,49 @@
|
||||||
"name": "Bank",
|
"name": "Bank",
|
||||||
"base": "VnModel",
|
"base": "VnModel",
|
||||||
"options": {
|
"options": {
|
||||||
"mysql": {
|
"mysql": {
|
||||||
"table": "bank"
|
"table": "bank"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"properties": {
|
"properties": {
|
||||||
"id": {
|
"id": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"id": true,
|
"id": true,
|
||||||
"description": "Identifier"
|
"description": "Identifier"
|
||||||
},
|
},
|
||||||
"bank": {
|
"bank": {
|
||||||
"type": "string",
|
"type": "String",
|
||||||
"required": true
|
"required": true
|
||||||
},
|
},
|
||||||
"account": {
|
"account": {
|
||||||
"type": "string",
|
"type": "String",
|
||||||
"required": true
|
"required": true
|
||||||
},
|
},
|
||||||
"cash": {
|
"accountingTypeFk": {
|
||||||
"type": "string",
|
"type": "Number",
|
||||||
"required": true
|
"required": true,
|
||||||
},
|
"mysql": {
|
||||||
"entityFk": {
|
"columnName": "cash"
|
||||||
"type": "string",
|
}
|
||||||
"required": true
|
},
|
||||||
},
|
"entityFk": {
|
||||||
"isActive": {
|
"type": "Number",
|
||||||
"type": "string",
|
"required": true
|
||||||
"required": true
|
},
|
||||||
},
|
"isActive": {
|
||||||
"currencyFk": {
|
"type": "Boolean",
|
||||||
"type": "string",
|
"required": true
|
||||||
"required": true
|
},
|
||||||
}
|
"currencyFk": {
|
||||||
|
"type": "Number",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"relations": {
|
||||||
|
"accountingType": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "AccountingType",
|
||||||
|
"foreignKey": "accountingTypeFk"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,44 @@
|
||||||
|
{
|
||||||
|
"name": "ImageCollectionSize",
|
||||||
|
"base": "VnModel",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "hedera.imageCollectionSize"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "Number",
|
||||||
|
"id": true,
|
||||||
|
"description": "Identifier"
|
||||||
|
},
|
||||||
|
"width": {
|
||||||
|
"type": "Number",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"height": {
|
||||||
|
"type": "Number",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"crop": {
|
||||||
|
"type": "Boolean",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"relations": {
|
||||||
|
"collection": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "ImageCollection",
|
||||||
|
"foreignKey": "collectionFk"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"acls": [
|
||||||
|
{
|
||||||
|
"accessType": "READ",
|
||||||
|
"principalType": "ROLE",
|
||||||
|
"principalId": "employee",
|
||||||
|
"permission": "ALLOW"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,57 @@
|
||||||
|
{
|
||||||
|
"name": "ImageCollection",
|
||||||
|
"base": "VnModel",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "hedera.imageCollection"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "Number",
|
||||||
|
"id": true,
|
||||||
|
"description": "Identifier"
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"type": "String",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"desc": {
|
||||||
|
"type": "String",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"maxWidth": {
|
||||||
|
"type": "Number",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"maxHeight": {
|
||||||
|
"type": "Number",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"model": {
|
||||||
|
"type": "String",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"property": {
|
||||||
|
"type": "String",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"relations": {
|
||||||
|
"sizes": {
|
||||||
|
"type": "hasMany",
|
||||||
|
"model": "ImageCollectionSize",
|
||||||
|
"foreignKey": "collectionFk",
|
||||||
|
"property": "id"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"acls": [
|
||||||
|
{
|
||||||
|
"accessType": "READ",
|
||||||
|
"principalType": "ROLE",
|
||||||
|
"principalId": "employee",
|
||||||
|
"permission": "ALLOW"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,103 @@
|
||||||
|
const fs = require('fs-extra');
|
||||||
|
const sharp = require('sharp');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
module.exports = Self => {
|
||||||
|
Self.getPath = function() {
|
||||||
|
return '/var/lib/salix/image';
|
||||||
|
};
|
||||||
|
|
||||||
|
Self.registerImage = async(collectionName, file, srcFilePath) => {
|
||||||
|
const models = Self.app.models;
|
||||||
|
const tx = await Self.beginTransaction({});
|
||||||
|
const myOptions = {transaction: tx};
|
||||||
|
|
||||||
|
try {
|
||||||
|
const collection = await models.ImageCollection.findOne({
|
||||||
|
fields: [
|
||||||
|
'id',
|
||||||
|
'name',
|
||||||
|
'maxWidth',
|
||||||
|
'maxHeight',
|
||||||
|
'model',
|
||||||
|
'property'
|
||||||
|
],
|
||||||
|
where: {name: collectionName},
|
||||||
|
include: {
|
||||||
|
relation: 'sizes',
|
||||||
|
scope: {
|
||||||
|
fields: ['width', 'height', 'crop']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, myOptions);
|
||||||
|
|
||||||
|
const fileName = file.split('.')[0];
|
||||||
|
const rootPath = Self.getPath();
|
||||||
|
const data = {
|
||||||
|
name: fileName,
|
||||||
|
collectionFk: collectionName
|
||||||
|
};
|
||||||
|
|
||||||
|
const newImage = await Self.upsertWithWhere(data, {
|
||||||
|
name: fileName,
|
||||||
|
collectionFk: collectionName,
|
||||||
|
updated: (new Date).getTime()
|
||||||
|
}, myOptions);
|
||||||
|
|
||||||
|
// Resizes and saves the image
|
||||||
|
const collectionDir = path.join(rootPath, collectionName);
|
||||||
|
const dstDir = path.join(collectionDir, 'full');
|
||||||
|
const dstFile = path.join(dstDir, file);
|
||||||
|
|
||||||
|
const resizeOpts = {
|
||||||
|
withoutEnlargement: true,
|
||||||
|
fit: 'inside'
|
||||||
|
};
|
||||||
|
|
||||||
|
await fs.mkdir(dstDir, {recursive: true});
|
||||||
|
await sharp(srcFilePath, {failOnError: false})
|
||||||
|
.resize(collection.maxWidth, collection.maxHeight, resizeOpts)
|
||||||
|
.png()
|
||||||
|
.toFile(dstFile);
|
||||||
|
|
||||||
|
const sizes = collection.sizes();
|
||||||
|
for (let size of sizes) {
|
||||||
|
const dstDir = path.join(collectionDir, `${size.width}x${size.height}`);
|
||||||
|
const dstFile = path.join(dstDir, file);
|
||||||
|
const resizeOpts = {
|
||||||
|
withoutEnlargement: true,
|
||||||
|
fit: size.crop ? 'cover' : 'inside'
|
||||||
|
};
|
||||||
|
|
||||||
|
await fs.mkdir(dstDir, {recursive: true});
|
||||||
|
await sharp(srcFilePath, {failOnError: false})
|
||||||
|
.resize(size.width, size.height, resizeOpts)
|
||||||
|
.png()
|
||||||
|
.toFile(dstFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
const model = models[collection.model];
|
||||||
|
|
||||||
|
if (!model)
|
||||||
|
throw new Error('Matching model not found');
|
||||||
|
|
||||||
|
const item = await model.findById(fileName, null, myOptions);
|
||||||
|
if (item) {
|
||||||
|
await item.updateAttribute(
|
||||||
|
collection.property,
|
||||||
|
fileName,
|
||||||
|
myOptions
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fs.existsSync(srcFilePath))
|
||||||
|
await fs.unlink(srcFilePath);
|
||||||
|
|
||||||
|
await tx.commit();
|
||||||
|
return newImage;
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
|
@ -0,0 +1,41 @@
|
||||||
|
{
|
||||||
|
"name": "Image",
|
||||||
|
"base": "VnModel",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "hedera.image"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "Number",
|
||||||
|
"id": true,
|
||||||
|
"description": "The id"
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"type": "String",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"collectionFk": {
|
||||||
|
"type": "String",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"updated": {
|
||||||
|
"type": "Number"
|
||||||
|
},
|
||||||
|
"nRefs": {
|
||||||
|
"type": "Number",
|
||||||
|
"required": true,
|
||||||
|
"default": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"acls": [
|
||||||
|
{
|
||||||
|
"accessType": "READ",
|
||||||
|
"principalType": "ROLE",
|
||||||
|
"principalId": "employee",
|
||||||
|
"permission": "ALLOW"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
|
@ -4,3 +4,4 @@ apps:
|
||||||
instances: 1
|
instances: 1
|
||||||
max_restarts: 3
|
max_restarts: 3
|
||||||
restart_delay: 15000
|
restart_delay: 15000
|
||||||
|
node_args: --tls-min-v1.0
|
||||||
|
|
|
@ -35,5 +35,5 @@ ENTRYPOINT ["docker-start.sh"]
|
||||||
|
|
||||||
CMD ["mysqld"]
|
CMD ["mysqld"]
|
||||||
|
|
||||||
#HEALTHCHECK --interval=5s --timeout=10s --retries=200 \
|
HEALTHCHECK --interval=5s --timeout=10s --retries=200 \
|
||||||
# CMD mysqladmin ping -h 127.0.0.1 -u root || exit 1
|
CMD mysqladmin ping -h 127.0.0.1 -u root || exit 1
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
|
||||||
VALUES
|
|
||||||
('WorkerDms', 'filter', 'READ', 'ALLOW', 'ROLE', 'employee'),
|
|
||||||
('WorkerDms', 'downloadFile', 'READ', 'ALLOW', 'ROLE', 'employee');
|
|
||||||
DELETE FROM `salix`.`ACL` WHERE (`id` = '205');
|
|
|
@ -1,119 +0,0 @@
|
||||||
USE `vn`;
|
|
||||||
DROP procedure IF EXISTS `zone_getEvents`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `vn`$$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `zone_getEvents`(
|
|
||||||
vGeoFk INT,
|
|
||||||
vAgencyModeFk INT)
|
|
||||||
BEGIN
|
|
||||||
/**
|
|
||||||
* Returns available events for the passed province/postcode and agency.
|
|
||||||
*
|
|
||||||
* @param vGeoFk The geo id
|
|
||||||
* @param vAgencyModeFk The agency mode id
|
|
||||||
*/
|
|
||||||
DECLARE vDeliveryMethodFk VARCHAR(255);
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tZone;
|
|
||||||
CREATE TEMPORARY TABLE tZone
|
|
||||||
(id INT PRIMARY KEY)
|
|
||||||
ENGINE = MEMORY;
|
|
||||||
|
|
||||||
SELECT dm.`code` INTO vDeliveryMethodFk
|
|
||||||
FROM agencyMode am
|
|
||||||
JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk
|
|
||||||
WHERE am.id = vAgencyModeFk;
|
|
||||||
|
|
||||||
IF vDeliveryMethodFk = 'PICKUP' THEN
|
|
||||||
INSERT INTO tZone
|
|
||||||
SELECT id
|
|
||||||
FROM zone
|
|
||||||
WHERE agencyModeFk = vAgencyModeFk;
|
|
||||||
ELSE
|
|
||||||
CALL zone_getFromGeo(vGeoFk);
|
|
||||||
|
|
||||||
IF vAgencyModeFk IS NOT NULL THEN
|
|
||||||
INSERT INTO tZone
|
|
||||||
SELECT t.id
|
|
||||||
FROM tmp.zone t
|
|
||||||
JOIN zone z ON z.id = t.id
|
|
||||||
WHERE z.agencyModeFk = vAgencyModeFk;
|
|
||||||
ELSE
|
|
||||||
INSERT INTO tZone
|
|
||||||
SELECT t.id
|
|
||||||
FROM tmp.zone t
|
|
||||||
JOIN zone z ON z.id = t.id
|
|
||||||
JOIN agencyMode am ON am.id = z.agencyModeFk
|
|
||||||
JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk
|
|
||||||
WHERE dm.`code` IN ('AGENCY', 'DELIVERY');
|
|
||||||
END IF;
|
|
||||||
DROP TEMPORARY TABLE tmp.zone;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
SELECT e.zoneFk, e.`type`, e.dated, e.`started`, e.`ended`, e.weekDays
|
|
||||||
FROM tZone t
|
|
||||||
JOIN zoneEvent e ON e.zoneFk = t.id;
|
|
||||||
|
|
||||||
SELECT e.zoneFk, e.dated
|
|
||||||
FROM tZone t
|
|
||||||
JOIN zoneExclusion e ON e.zoneFk = t.id;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tZone;
|
|
||||||
END$$
|
|
||||||
|
|
||||||
DELIMITER ;
|
|
||||||
|
|
||||||
USE `vn`;
|
|
||||||
DROP procedure IF EXISTS `zone_getEvents__`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `vn`$$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `zone_getEvents__`(
|
|
||||||
vProvinceFk INT,
|
|
||||||
vPostCode VARCHAR(255),
|
|
||||||
vAgencyModeFk INT)
|
|
||||||
BEGIN
|
|
||||||
/**
|
|
||||||
* Returns available events for the passed province/postcode and agency.
|
|
||||||
*
|
|
||||||
* @param vAgencyModeFk The agency mode id
|
|
||||||
* @param vProvinceFk The province id
|
|
||||||
* @param vPostCode The postcode or %NULL to use the province
|
|
||||||
*/
|
|
||||||
|
|
||||||
DECLARE vGeoFk INT;
|
|
||||||
|
|
||||||
IF vPostCode IS NOT NULL THEN
|
|
||||||
SELECT p.geoFk INTO vGeoFk
|
|
||||||
FROM postCode p
|
|
||||||
JOIN town t ON t.id = p.townFk
|
|
||||||
WHERE p.`code` = vPostCode
|
|
||||||
AND t.provinceFk = vProvinceFk;
|
|
||||||
ELSE
|
|
||||||
SELECT geoFk INTO vGeoFk
|
|
||||||
FROM province
|
|
||||||
WHERE id = vProvinceFk;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
CALL zone_getFromGeo(vGeoFk);
|
|
||||||
|
|
||||||
IF vAgencyModeFk IS NOT NULL THEN
|
|
||||||
DELETE t FROM tmp.zone t
|
|
||||||
JOIN zone z ON z.id = t.id
|
|
||||||
WHERE z.agencyModeFk != vAgencyModeFk;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
SELECT e.zoneFk, e.`type`, e.dated, e.`started`, e.`ended`, e.weekDays
|
|
||||||
FROM tmp.zone t
|
|
||||||
JOIN zoneEvent e ON e.zoneFk = t.id;
|
|
||||||
|
|
||||||
SELECT e.zoneFk, e.dated
|
|
||||||
FROM tmp.zone t
|
|
||||||
JOIN zoneExclusion e ON e.zoneFk = t.id;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tmp.zone;
|
|
||||||
END$$
|
|
||||||
|
|
||||||
DELIMITER ;
|
|
||||||
|
|
|
@ -1,87 +0,0 @@
|
||||||
USE `vn`;
|
|
||||||
DROP procedure IF EXISTS `zone_getWarehouse`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `vn`$$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `zone_getWarehouse`(vAddress INT, vLanded DATE, vWarehouse INT)
|
|
||||||
BEGIN
|
|
||||||
/**
|
|
||||||
* Devuelve el listado de agencias disponibles para la fecha,
|
|
||||||
* dirección y almacén pasados.
|
|
||||||
*
|
|
||||||
* @param vAddress
|
|
||||||
* @param vWarehouse warehouse
|
|
||||||
* @param vLanded Fecha de recogida
|
|
||||||
* @select Listado de agencias disponibles
|
|
||||||
*/
|
|
||||||
|
|
||||||
CALL zone_getFromGeo(address_getGeo(vAddress));
|
|
||||||
CALL zone_getOptionsForLanding(vLanded, FALSE);
|
|
||||||
|
|
||||||
SELECT am.id agencyModeFk,
|
|
||||||
am.name agencyMode,
|
|
||||||
am.description,
|
|
||||||
am.deliveryMethodFk,
|
|
||||||
TIMESTAMPADD(DAY, -zo.travelingDays, vLanded) shipped,
|
|
||||||
zw.warehouseFk,
|
|
||||||
z.id zoneFk
|
|
||||||
FROM tmp.zoneOption zo
|
|
||||||
JOIN zone z ON z.id = zo.zoneFk
|
|
||||||
JOIN agencyMode am ON am.id = z.agencyModeFk
|
|
||||||
JOIN zoneWarehouse zw ON zw.zoneFk = zo.zoneFk
|
|
||||||
WHERE zw.warehouseFk = vWarehouse
|
|
||||||
GROUP BY z.agencyModeFk
|
|
||||||
ORDER BY agencyMode;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE
|
|
||||||
tmp.zone,
|
|
||||||
tmp.zoneOption;
|
|
||||||
|
|
||||||
END$$
|
|
||||||
|
|
||||||
DELIMITER ;
|
|
||||||
|
|
||||||
USE `vn`;
|
|
||||||
DROP procedure IF EXISTS `zone_getWarehouse__`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `vn`$$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `zone_getWarehouse__`(vAddress INT, vLanded DATE, vWarehouse INT)
|
|
||||||
BEGIN
|
|
||||||
/**
|
|
||||||
* Devuelve el listado de agencias disponibles para la fecha,
|
|
||||||
* dirección y almacén pasados.
|
|
||||||
*
|
|
||||||
* @param vAddress
|
|
||||||
* @param vWarehouse warehouse
|
|
||||||
* @param vLanded Fecha de recogida
|
|
||||||
* @select Listado de agencias disponibles
|
|
||||||
*/
|
|
||||||
|
|
||||||
CALL zone_getFromGeo(address_getGeo(vAddress));
|
|
||||||
CALL zone_getOptionsForLanding(vLanded, FALSE);
|
|
||||||
|
|
||||||
SELECT am.id agencyModeFk,
|
|
||||||
am.name agencyMode,
|
|
||||||
am.description,
|
|
||||||
am.deliveryMethodFk,
|
|
||||||
TIMESTAMPADD(DAY, -zo.travelingDays, vLanded) shipped,
|
|
||||||
zw.warehouseFk,
|
|
||||||
z.id zoneFk
|
|
||||||
FROM tmp.zoneOption zo
|
|
||||||
JOIN zone z ON z.id = zo.zoneFk
|
|
||||||
JOIN agencyMode am ON am.id = z.agencyModeFk
|
|
||||||
JOIN zoneWarehouse zw ON zw.zoneFk = zo.zoneFk
|
|
||||||
WHERE zw.warehouseFk
|
|
||||||
GROUP BY z.agencyModeFk
|
|
||||||
ORDER BY agencyMode;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE
|
|
||||||
tmp.zone,
|
|
||||||
tmp.zoneOption;
|
|
||||||
|
|
||||||
END$$
|
|
||||||
|
|
||||||
DELIMITER ;
|
|
||||||
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
INSERT IGNORE INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('WorkerLog', '*', 'READ', 'ALLOW', 'ROLE', 'hr');
|
|
|
@ -1,2 +0,0 @@
|
||||||
ALTER TABLE `vn`.`claim`
|
|
||||||
ADD COLUMN `hasToPickUp` TINYINT(1) NOT NULL AFTER `ticketFk`;
|
|
|
@ -1,28 +0,0 @@
|
||||||
ALTER TABLE `vn`.`claimState`
|
|
||||||
DROP FOREIGN KEY `roleFgn`;
|
|
||||||
ALTER TABLE `vn`.`claimState`
|
|
||||||
ADD COLUMN `code` VARCHAR(45) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' NULL AFTER `id`,
|
|
||||||
CHANGE COLUMN `roleFk` `roleFk` INT(10) UNSIGNED NOT NULL DEFAULT '1' ;
|
|
||||||
ALTER TABLE `vn`.`claimState`
|
|
||||||
ADD CONSTRAINT `roleFgn`
|
|
||||||
FOREIGN KEY (`roleFk`)
|
|
||||||
REFERENCES `account`.`role` (`id`)
|
|
||||||
ON UPDATE CASCADE;
|
|
||||||
|
|
||||||
UPDATE `vn`.`claimState` SET `code` = 'pending' WHERE (`id` = '1');
|
|
||||||
UPDATE `vn`.`claimState` SET `code` = 'canceled' WHERE (`id` = '4');
|
|
||||||
UPDATE `vn`.`claimState` SET `code` = 'resolved' WHERE (`id` = '3');
|
|
||||||
UPDATE `vn`.`claimState` SET `code` = 'disputed' WHERE (`id` = '5');
|
|
||||||
UPDATE `vn`.`claimState` SET `code` = 'mana' WHERE (`id` = '6');
|
|
||||||
UPDATE `vn`.`claimState` SET `code` = 'managed' WHERE (`id` = '2');
|
|
||||||
|
|
||||||
ALTER TABLE `vn`.`claimState`
|
|
||||||
ADD COLUMN `priority` INT NOT NULL DEFAULT 1 AFTER `roleFk`;
|
|
||||||
|
|
||||||
UPDATE `vn`.`claimState` SET `priority` = '1' WHERE (`id` = '1');
|
|
||||||
UPDATE `vn`.`claimState` SET `priority` = '5' WHERE (`id` = '2');
|
|
||||||
UPDATE `vn`.`claimState` SET `priority` = '7' WHERE (`id` = '3');
|
|
||||||
UPDATE `vn`.`claimState` SET `priority` = '6' WHERE (`id` = '4');
|
|
||||||
UPDATE `vn`.`claimState` SET `priority` = '3' WHERE (`id` = '5');
|
|
||||||
UPDATE `vn`.`claimState` SET `priority` = '4' WHERE (`id` = '6');
|
|
||||||
UPDATE `vn`.`claimState` SET `priority` = '2' WHERE (`id` = '7');
|
|
|
@ -1,13 +0,0 @@
|
||||||
ALTER TABLE `vn`.`ticketWeekly`
|
|
||||||
ADD COLUMN `agencyModeFk` INT(11) NULL DEFAULT NULL AFTER `weekDay`,
|
|
||||||
ADD INDEX `agencyModeFk_idx` (`agencyModeFk` ASC);
|
|
||||||
|
|
||||||
ALTER TABLE `vn`.`ticketWeekly`
|
|
||||||
ADD CONSTRAINT `agencyModeFk`
|
|
||||||
FOREIGN KEY (`agencyModeFk`)
|
|
||||||
REFERENCES `vn`.`agencyMode` (`id`)
|
|
||||||
ON DELETE SET NULL
|
|
||||||
ON UPDATE CASCADE;
|
|
||||||
|
|
||||||
ALTER TABLE `vn`.`ticketWeekly`
|
|
||||||
CHANGE COLUMN `weekDay` `weekDay` TINYINT(1) NOT NULL COMMENT 'funcion de mysql Lunes = 0, Domingo = 6' ;
|
|
|
@ -1,130 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
USE `vn`$$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `ticket_cloneWeekly`(IN vWeek INT)
|
|
||||||
BEGIN
|
|
||||||
DECLARE vIsDone BOOL;
|
|
||||||
DECLARE vLanding DATE;
|
|
||||||
DECLARE vShipment DATE;
|
|
||||||
DECLARE vWarehouse INT;
|
|
||||||
DECLARE vTicket INT;
|
|
||||||
DECLARE vWeekDay INT;
|
|
||||||
DECLARE vClient INT;
|
|
||||||
DECLARE vEmpresa INT;
|
|
||||||
DECLARE vAddressFk INT;
|
|
||||||
DECLARE vAgencyModeFk INT;
|
|
||||||
DECLARE vNewTicket INT;
|
|
||||||
DECLARE vYear INT;
|
|
||||||
|
|
||||||
DECLARE rsTicket CURSOR FOR
|
|
||||||
SELECT tw.ticketFk, weekDay, t.clientFk, t.warehouseFk, t.companyFk, t.addressFk, tw.agencyModeFk
|
|
||||||
FROM ticketWeekly tw
|
|
||||||
JOIN ticket t ON tt.ticketFk = t.id;
|
|
||||||
|
|
||||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vIsDone = TRUE;
|
|
||||||
|
|
||||||
SET vYear = YEAR(CURDATE()) + IF(vWeek < WEEK(CURDATE()),1, 0);
|
|
||||||
|
|
||||||
OPEN rsTicket;
|
|
||||||
|
|
||||||
myLoop: LOOP
|
|
||||||
BEGIN
|
|
||||||
DECLARE vError TEXT;
|
|
||||||
DECLARE vSalesPersonEmail VARCHAR(150);
|
|
||||||
DECLARE vMailSent BOOL;
|
|
||||||
DECLARE vSubject VARCHAR(150);
|
|
||||||
DECLARE vMessage TEXT;
|
|
||||||
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
|
|
||||||
BEGIN
|
|
||||||
GET DIAGNOSTICS CONDITION 1
|
|
||||||
vError = MESSAGE_TEXT;
|
|
||||||
|
|
||||||
END;
|
|
||||||
|
|
||||||
SET vIsDone = FALSE;
|
|
||||||
FETCH rsTicket INTO vTicket, vWeekDay, vClient, vWarehouse, vEmpresa, vAddressFk, vAgencyModeFk;
|
|
||||||
|
|
||||||
IF vIsDone THEN
|
|
||||||
|
|
||||||
LEAVE myLoop;
|
|
||||||
END IF;
|
|
||||||
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 vn.ticket tOrig
|
|
||||||
JOIN vn.sale saleOrig ON tOrig.id = saleOrig.ticketFk
|
|
||||||
JOIN vn.saleCloned sc ON sc.saleOriginalFk = saleOrig.id
|
|
||||||
JOIN vn.sale saleClon ON saleClon.id = sc.saleClonedFk
|
|
||||||
JOIN vn.ticket tClon ON tClon.id = saleClon.ticketFk
|
|
||||||
WHERE tOrig.id = vTicket AND DATE(tClon.shipped) = vShipment) > 0
|
|
||||||
THEN
|
|
||||||
ITERATE myLoop;
|
|
||||||
END IF;
|
|
||||||
CALL vn.zone_getLanded(vShipment, vAddressFk, vAgencyModeFk, vWarehouse);
|
|
||||||
|
|
||||||
SELECT landed INTO vLanding from tmp.zoneGetLanded LIMIT 1;
|
|
||||||
|
|
||||||
CALL vn.ticketCreateWithoutZone(vClient, vShipment, vWarehouse, vEmpresa, vAddressFk, vAgencyModeFk, NULL, vLanding, account.userGetId(), vNewTicket);
|
|
||||||
|
|
||||||
IF (vLanding IS NULL) THEN
|
|
||||||
|
|
||||||
SELECT e.email INTO vSalesPersonEmail
|
|
||||||
FROM vn.client c
|
|
||||||
JOIN vn.worker sp ON sp.id = c.salesPersonFk
|
|
||||||
JOIN account.emailUser e ON e.userFk = sp.userFk
|
|
||||||
WHERE c.id = vClient;
|
|
||||||
|
|
||||||
SET vSubject = CONCAT('Turnos - No se ha podido clonar correctamente el ticket ', vTicket,
|
|
||||||
' para el dia: ', vShipment);
|
|
||||||
SET vMessage = CONCAT('No se ha podido clonar el ticket ', vTicket,
|
|
||||||
' para el dia: ', vShipment,
|
|
||||||
' porque no hay una zona de envío disponible. Se ha creado el ticket: ', vNewTicket,
|
|
||||||
' pero ha que revisar las fechas y la agencia');
|
|
||||||
|
|
||||||
SELECT COUNT(*) INTO vMailSent
|
|
||||||
FROM vn.mail
|
|
||||||
WHERE sender = vSalesPersonEmail
|
|
||||||
AND subject = vSubject;
|
|
||||||
|
|
||||||
IF NOT vMailSent THEN
|
|
||||||
INSERT INTO vn.mail (sender,`subject`,body)
|
|
||||||
VALUES (vSalesPersonEmail, vSubject, vMessage);
|
|
||||||
END IF;
|
|
||||||
CALL vn.ticketStateUpdate (vNewTicket, 'FIXING');
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
INSERT INTO vn.sale (ticketFk, itemFk, concept, quantity, price, discount, priceFixed, isPriceFixed)
|
|
||||||
SELECT vNewTicket, saleOrig.itemFk , saleOrig.concept , saleOrig.quantity, saleOrig.price , saleOrig.discount, saleOrig.priceFixed, saleOrig.isPriceFixed
|
|
||||||
FROM vn.ticket tOrig
|
|
||||||
JOIN vn.sale saleOrig ON tOrig.id = saleOrig.ticketFk
|
|
||||||
LEFT JOIN vn.saleCloned sc ON sc.saleOriginalFk = saleOrig.id
|
|
||||||
LEFT JOIN vn.sale saleClon ON saleClon.id = sc.saleClonedFk
|
|
||||||
LEFT JOIN vn.ticket tClon ON tClon.id = saleClon.ticketFk AND DATE(tClon.shipped) = vShipment
|
|
||||||
WHERE tOrig.id = vTicket AND saleClon.id IS NULL;
|
|
||||||
|
|
||||||
INSERT IGNORE INTO vn.saleCloned(saleOriginalFk, saleClonedFk)
|
|
||||||
SELECT saleOriginal.id, saleClon.id
|
|
||||||
FROM vn.sale saleOriginal
|
|
||||||
JOIN vn.sale saleClon ON saleOriginal.itemFk = saleClon.itemFk AND saleOriginal.quantity = saleClon.quantity
|
|
||||||
WHERE saleOriginal.ticketFk = vTicket AND saleClon.ticketFk = vNewTicket;
|
|
||||||
|
|
||||||
INSERT INTO ticketRequest (description, ordered, shipped, salesPersonCode, buyerCode, quantity, price,
|
|
||||||
itemFk ,clientFk, response, total, buyed, saleFk)
|
|
||||||
SELECT tr.description, tr.ordered, tr.shipped, tr.salesPersonCode, tr.buyerCode, tr.quantity, tr.price,
|
|
||||||
tr.itemFk, tr.clientFk, tr.response, tr.total, tr.buyed, tr.saleFk
|
|
||||||
FROM sale s JOIN ticketRequest tr ON tr.saleFk = s.id
|
|
||||||
JOIN sale s2 ON s.concept = s2.concept AND s.quantity = s2.quantity AND m.Id_Article = m2.Id_Article
|
|
||||||
WHERE s.ticketFk = vTicket AND s2.ticketFk = vNewTicket;
|
|
||||||
|
|
||||||
CALL vn.ticketCalculateClon(vNewTicket, vTicket);
|
|
||||||
END;
|
|
||||||
END LOOP;
|
|
||||||
|
|
||||||
CLOSE rsTicket;
|
|
||||||
|
|
||||||
END$$
|
|
||||||
|
|
||||||
DELIMITER ;
|
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
USE `util`;
|
|
||||||
DROP procedure IF EXISTS `time_createTable`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `util`$$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `time_createTable`(vStarted DATE, vEnded DATE)
|
|
||||||
BEGIN
|
|
||||||
DECLARE vCurrentDate DATE;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.time;
|
|
||||||
CREATE TEMPORARY TABLE tmp.time (dated DATE PRIMARY KEY) ENGINE = MEMORY;
|
|
||||||
SET vCurrentDate = vStarted;
|
|
||||||
WHILE vCurrentDate <= vEnded DO
|
|
||||||
INSERT INTO tmp.time (dated) VALUES (vCurrentDate);
|
|
||||||
SET vCurrentDate = DATE_ADD(vCurrentDate, INTERVAL 1 DAY);
|
|
||||||
END WHILE;
|
|
||||||
|
|
||||||
END$$
|
|
||||||
|
|
||||||
DELIMITER ;
|
|
|
@ -1,6 +0,0 @@
|
||||||
ALTER TABLE `vn`.`workerLog`
|
|
||||||
ADD COLUMN `changedModel` VARCHAR(45) NULL DEFAULT NULL AFTER `description`,
|
|
||||||
ADD COLUMN `oldInstance` TEXT NULL DEFAULT NULL AFTER `changedModel`,
|
|
||||||
ADD COLUMN `newInstance` TEXT NULL DEFAULT NULL AFTER `oldInstance`,
|
|
||||||
ADD COLUMN `changedModelId` INT(11) NULL DEFAULT NULL AFTER `newInstance`,
|
|
||||||
ADD COLUMN `changedModelValue` VARCHAR(45) NULL DEFAULT NULL AFTER `changedModelId`;
|
|
|
@ -1 +0,0 @@
|
||||||
UPDATE `vn`.`component` SET `code` = 'imbalance' WHERE (`id` = '36');
|
|
|
@ -1,6 +0,0 @@
|
||||||
UPDATE vn.ticketWeekly tw
|
|
||||||
JOIN vn.ticket t ON t.id = tw.ticketFk
|
|
||||||
JOIN vn.agencyMode am ON am.id = t.agencyModeFk
|
|
||||||
SET tw.agencyModeFk = t.agencyModeFk
|
|
||||||
WHERE am.name NOT LIKE '%turno%';
|
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
ALTER TABLE `vn`.`zoneConfig`
|
|
||||||
ADD COLUMN `forwardDays` INT(10) NOT NULL DEFAULT 7 COMMENT 'days forward to show zone_upcomingDeliveries' AFTER `scope`;
|
|
|
@ -1,148 +0,0 @@
|
||||||
USE `vn`;
|
|
||||||
DROP procedure IF EXISTS `catalog_calculate`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `vn`$$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `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 vWarehouseFk SMALLINT;
|
|
||||||
DECLARE vZoneFk INT;
|
|
||||||
DECLARE vDone BOOL;
|
|
||||||
DECLARE cTravelTree CURSOR FOR
|
|
||||||
SELECT zoneFk, 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
|
|
||||||
|
|
||||||
CALL vn.zone_getShipped (vLanded, vAddressFk, vAgencyModeFk, FALSE);
|
|
||||||
|
|
||||||
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',
|
|
||||||
`zoneFk` int(11) NOT NULL,
|
|
||||||
KEY `itemFk` (`itemFk`),
|
|
||||||
KEY `item_warehouse` (`itemFk`,`warehouseFk`) USING HASH
|
|
||||||
) ENGINE=MEMORY DEFAULT CHARSET=utf8;
|
|
||||||
|
|
||||||
CALL catalog_componentPrepare();
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketCalculateItem;
|
|
||||||
CREATE TEMPORARY TABLE tmp.ticketCalculateItem(
|
|
||||||
itemFk INT(11) NOT NULL,
|
|
||||||
available INT(11),
|
|
||||||
producer VARCHAR(50),
|
|
||||||
item VARCHAR(50),
|
|
||||||
size INT(10) UNSIGNED,
|
|
||||||
stems INT(11),
|
|
||||||
category VARCHAR(3),
|
|
||||||
inkFk VARCHAR(3),
|
|
||||||
image VARCHAR(50),
|
|
||||||
origin VARCHAR(3),
|
|
||||||
price DECIMAL(10,2),
|
|
||||||
priceKg DECIMAL(10,2),
|
|
||||||
KEY `itemFk` (`itemFk`)
|
|
||||||
) 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, zoneFk)
|
|
||||||
SELECT vWarehouseFk,
|
|
||||||
i.item_id,
|
|
||||||
IFNULL(i.available, 0),
|
|
||||||
bu.buyFk,
|
|
||||||
vZoneFk
|
|
||||||
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 i.available > 0;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tmp.buyUltimate;
|
|
||||||
|
|
||||||
CALL vn.catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk);
|
|
||||||
|
|
||||||
INSERT INTO tmp.ticketCalculateItem (
|
|
||||||
itemFk,
|
|
||||||
available,
|
|
||||||
producer,
|
|
||||||
item,
|
|
||||||
size,
|
|
||||||
stems,
|
|
||||||
category,
|
|
||||||
inkFk,
|
|
||||||
image,
|
|
||||||
origin,
|
|
||||||
price,
|
|
||||||
priceKg)
|
|
||||||
SELECT
|
|
||||||
tl.itemFk,
|
|
||||||
SUM(tl.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 tl
|
|
||||||
JOIN item i ON tl.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
|
|
||||||
WHERE warehouseFk = vWarehouseFk
|
|
||||||
GROUP BY itemFk
|
|
||||||
) bl ON bl.itemFk = tl.itemFk
|
|
||||||
WHERE tl.zoneFk = vZoneFk AND tl.warehouseFk = vWarehouseFk
|
|
||||||
GROUP BY tl.itemFk;
|
|
||||||
-- on duplicatekey update
|
|
||||||
|
|
||||||
END LOOP;
|
|
||||||
|
|
||||||
CLOSE cTravelTree;
|
|
||||||
|
|
||||||
END$$
|
|
||||||
|
|
||||||
DELIMITER ;
|
|
||||||
|
|
|
@ -1,262 +0,0 @@
|
||||||
USE `vn`;
|
|
||||||
DROP procedure IF EXISTS `catalog_componentCalculate`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `vn`$$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `catalog_componentCalculate`(
|
|
||||||
vZoneFk INT,
|
|
||||||
vAddressFk INT,
|
|
||||||
vShipped DATE,
|
|
||||||
vWarehouseFk INT)
|
|
||||||
proc: BEGIN
|
|
||||||
/**
|
|
||||||
* Calcula los componentes de los articulos de tmp.ticketLot
|
|
||||||
*
|
|
||||||
* @param vZoneFk para calcular el transporte
|
|
||||||
* @param vAddressFk Consignatario
|
|
||||||
* @param vShipped dia de salida del pedido
|
|
||||||
* @param tmp.ticketLot (warehouseFk, available, itemFk, buyFk, zoneFk)
|
|
||||||
*
|
|
||||||
* @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 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.weight / b.packing, NULL) weightGrouping
|
|
||||||
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, zw.warehouseFk
|
|
||||||
FROM priceFixed pf
|
|
||||||
JOIN zoneWarehouse zw ON zw.zoneFk = vZoneFk AND (zw.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
|
|
||||||
AND tl.zoneFk = vZoneFk AND tl.warehouseFk = vWarehouseFk;
|
|
||||||
|
|
||||||
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
|
|
||||||
JOIN tmp.ticketComponentCalculate tcc ON tcc.itemFk = tc.itemFk AND tcc.warehouseFk = tc.warehouseFk
|
|
||||||
GROUP BY tc.itemFk, warehouseFk;
|
|
||||||
|
|
||||||
INSERT INTO tmp.ticketComponent
|
|
||||||
SELECT tcb.warehouseFk, tcb.itemFk, vRecoveryComponent, ROUND(tcb.base * LEAST(cr.priceIncreasing, 0.25), 3)
|
|
||||||
FROM tmp.ticketComponentBase tcb
|
|
||||||
JOIN claimRatio cr ON cr.clientFk = vClientFk
|
|
||||||
WHERE cr.priceIncreasing > 0.009;
|
|
||||||
|
|
||||||
INSERT INTO tmp.ticketComponent
|
|
||||||
SELECT tcb.warehouseFk, tcb.itemFk, vManaAutoComponent, ROUND(base * (0.01 + wm.pricesModifierRate), 3) as manaAuto
|
|
||||||
FROM tmp.ticketComponentBase tcb
|
|
||||||
JOIN `client` c on c.id = vClientFk
|
|
||||||
JOIN workerMana wm ON c.salesPersonFk = wm.workerFk
|
|
||||||
WHERE wm.isPricesModifierActivated
|
|
||||||
HAVING manaAuto <> 0;
|
|
||||||
|
|
||||||
INSERT INTO tmp.ticketComponent
|
|
||||||
SELECT tcb.warehouseFk,
|
|
||||||
tcb.itemFk,
|
|
||||||
c.id,
|
|
||||||
GREATEST(IFNULL(ROUND(tcb.base * c.tax, 4), 0), tcc.minPrice - tcc.rate3)
|
|
||||||
FROM tmp.ticketComponentBase tcb
|
|
||||||
JOIN component c
|
|
||||||
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 c.id = vDiscountLastItemComponent AND c.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;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.zone;
|
|
||||||
CREATE TEMPORARY TABLE IF NOT EXISTS tmp.zone (INDEX (id))
|
|
||||||
ENGINE = MEMORY
|
|
||||||
SELECT vZoneFk id;
|
|
||||||
|
|
||||||
CALL zone_getOptionsForShipment(vShipped, TRUE);
|
|
||||||
|
|
||||||
INSERT INTO tmp.ticketComponent
|
|
||||||
SELECT tcc.warehouseFK,
|
|
||||||
tcc.itemFk,
|
|
||||||
vDeliveryComponent,
|
|
||||||
vGeneralInflationCoefficient
|
|
||||||
* ROUND((
|
|
||||||
i.compression
|
|
||||||
* ic.cm3
|
|
||||||
* IF(am.deliveryMethodFk = 1, (GREATEST(i.density, vMinimumDensityWeight) / vMinimumDensityWeight), 1)
|
|
||||||
* IFNULL((zo.price - zo.bonus)
|
|
||||||
* 1/*amz.inflation*/ , 50)) / vBoxVolume, 4
|
|
||||||
) cost
|
|
||||||
FROM tmp.ticketComponentCalculate tcc
|
|
||||||
JOIN item i ON i.id = tcc.itemFk
|
|
||||||
JOIN tmp.zoneOption zo ON zo.zoneFk = vZoneFk
|
|
||||||
JOIN zone z ON z.id = vZoneFk
|
|
||||||
JOIN agencyMode am ON am.id = z.agencyModeFk
|
|
||||||
LEFT JOIN itemCost ic ON ic.warehouseFk = tcc.warehouseFk
|
|
||||||
AND ic.itemFk = tcc.itemFk
|
|
||||||
HAVING cost <> 0;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tmp.zoneOption;
|
|
||||||
|
|
||||||
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 component c ON c.id = tcc.componentFk
|
|
||||||
JOIN specialPrice sp ON sp.clientFk = vClientFK AND sp.itemFk = tcc.itemFk
|
|
||||||
WHERE c.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, c.classRate
|
|
||||||
FROM tmp.ticketComponent tc
|
|
||||||
JOIN component c ON c.id = tc.componentFk
|
|
||||||
GROUP BY tc.itemFk, tc.warehouseFk, c.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)) / weightGrouping 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) / weightGrouping 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) / weightGrouping 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;
|
|
||||||
|
|
||||||
INSERT INTO tmp.ticketComponentPrice (warehouseFk, itemFk, rate, `grouping`, price, priceKg)
|
|
||||||
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 ;
|
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
USE `vn`;
|
|
||||||
DROP procedure IF EXISTS `catalog_componentPrepare`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `vn`$$
|
|
||||||
CREATE PROCEDURE `catalog_componentPrepare` ()
|
|
||||||
BEGIN
|
|
||||||
|
|
||||||
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 `fkItemWarehouseComponent` (`itemFk` ASC, `warehouseFk` ASC, `componentFk` ASC)
|
|
||||||
)ENGINE=MEMORY DEFAULT CHARSET=utf8;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentPrice;
|
|
||||||
CREATE TEMPORARY TABLE tmp.ticketComponentPrice (
|
|
||||||
`warehouseFk` INT UNSIGNED NOT NULL,
|
|
||||||
`itemFk` INT NOT NULL,
|
|
||||||
`rate` INT NOT NULL,
|
|
||||||
`grouping` INT UNSIGNED NOT NULL,
|
|
||||||
`price` DECIMAL(10,4) NOT NULL,
|
|
||||||
`priceKg` DECIMAL(10,4),
|
|
||||||
INDEX `itemWarehouse` USING BTREE (`itemFk` ASC, `warehouseFk` ASC),
|
|
||||||
UNIQUE `fkItemWarehouseRate` (`itemFk` ASC, `warehouseFk` ASC, `rate` ASC)
|
|
||||||
)ENGINE=MEMORY DEFAULT CHARSET=utf8;
|
|
||||||
END$$
|
|
||||||
|
|
||||||
DELIMITER ;
|
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
|
|
||||||
USE `vn`;
|
|
||||||
DROP procedure IF EXISTS `vn`.`catalog_componentPurge`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `vn`$$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `catalog_componentPurge`()
|
|
||||||
BEGIN
|
|
||||||
DROP TEMPORARY TABLE
|
|
||||||
tmp.ticketComponentPrice,
|
|
||||||
tmp.ticketComponent,
|
|
||||||
tmp.ticketLot;
|
|
||||||
END$$
|
|
||||||
|
|
||||||
DELIMITER ;
|
|
||||||
;
|
|
|
@ -1,250 +0,0 @@
|
||||||
USE `hedera`;
|
|
||||||
DROP procedure IF EXISTS `order_confirmWithUser`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `hedera`$$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `order_confirmWithUser`(IN `vOrder` INT, IN `vUserId` INT)
|
|
||||||
BEGIN
|
|
||||||
/**
|
|
||||||
* Confirms an order, creating each of its tickets on the corresponding
|
|
||||||
* date, store and user.
|
|
||||||
*
|
|
||||||
* @param vOrder The order identifier
|
|
||||||
* @param vUser The user identifier
|
|
||||||
*/
|
|
||||||
DECLARE vOk BOOL;
|
|
||||||
DECLARE vDone BOOL DEFAULT FALSE;
|
|
||||||
DECLARE vWarehouse INT;
|
|
||||||
DECLARE vShipment DATETIME;
|
|
||||||
DECLARE vTicket INT;
|
|
||||||
DECLARE vNotes VARCHAR(255);
|
|
||||||
DECLARE vItem INT;
|
|
||||||
DECLARE vConcept VARCHAR(30);
|
|
||||||
DECLARE vAmount INT;
|
|
||||||
DECLARE vPrice DECIMAL(10,2);
|
|
||||||
DECLARE vSale INT;
|
|
||||||
DECLARE vRate INT;
|
|
||||||
DECLARE vRowId INT;
|
|
||||||
DECLARE vDelivery DATE;
|
|
||||||
DECLARE vAddress INT;
|
|
||||||
DECLARE vIsConfirmed BOOL;
|
|
||||||
DECLARE vClientId INT;
|
|
||||||
DECLARE vCompanyId INT;
|
|
||||||
DECLARE vAgencyModeId INT;
|
|
||||||
DECLARE TICKET_FREE INT DEFAULT 2;
|
|
||||||
|
|
||||||
DECLARE cDates CURSOR FOR
|
|
||||||
SELECT zgs.shipped, r.warehouse_id
|
|
||||||
FROM `order` o
|
|
||||||
JOIN order_row r ON r.order_id = o.id
|
|
||||||
LEFT JOIN tmp.zoneGetShipped zgs ON zgs.warehouseFk = r.warehouse_id
|
|
||||||
WHERE o.id = vOrder AND r.amount != 0
|
|
||||||
GROUP BY r.warehouse_id;
|
|
||||||
|
|
||||||
DECLARE cRows CURSOR FOR
|
|
||||||
SELECT r.id, r.item_id, i.name, r.amount, r.price, r.rate
|
|
||||||
FROM order_row r
|
|
||||||
JOIN vn.item i ON i.id = r.item_id
|
|
||||||
WHERE r.amount != 0
|
|
||||||
AND r.warehouse_id = vWarehouse
|
|
||||||
AND r.order_id = vOrder
|
|
||||||
ORDER BY r.rate DESC;
|
|
||||||
|
|
||||||
DECLARE CONTINUE HANDLER FOR NOT FOUND
|
|
||||||
SET vDone = TRUE;
|
|
||||||
|
|
||||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
|
||||||
BEGIN
|
|
||||||
ROLLBACK;
|
|
||||||
RESIGNAL;
|
|
||||||
END;
|
|
||||||
|
|
||||||
-- Carga los datos del pedido
|
|
||||||
|
|
||||||
SELECT o.date_send, o.address_id, o.note,
|
|
||||||
o.confirmed, a.clientFk, o.company_id, o.agency_id
|
|
||||||
INTO vDelivery, vAddress, vNotes,
|
|
||||||
vIsConfirmed, vClientId, vCompanyId, vAgencyModeId
|
|
||||||
FROM hedera.`order` o
|
|
||||||
JOIN vn.address a ON a.id = o.address_id
|
|
||||||
WHERE o.id = vOrder;
|
|
||||||
|
|
||||||
-- Comprueba que el pedido no está confirmado
|
|
||||||
|
|
||||||
IF vIsConfirmed THEN
|
|
||||||
CALL util.throw ('ORDER_ALREADY_CONFIRMED');
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
-- Comprueba que el pedido no está vacío
|
|
||||||
|
|
||||||
SELECT COUNT(*) > 0 INTO vOk
|
|
||||||
FROM order_row WHERE order_id = vOrder AND amount > 0;
|
|
||||||
|
|
||||||
IF NOT vOk THEN
|
|
||||||
CALL util.throw ('ORDER_EMPTY');
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
-- Carga las fechas de salida de cada almacén
|
|
||||||
|
|
||||||
CALL vn.zone_getShipped (vDelivery, vAddress, vAgencyModeId, FALSE);
|
|
||||||
|
|
||||||
-- Trabajador que realiza la acción
|
|
||||||
|
|
||||||
IF vUserId IS NULL THEN
|
|
||||||
SELECT employeeFk INTO vUserId FROM orderConfig;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
-- Crea los tickets del pedido
|
|
||||||
|
|
||||||
START TRANSACTION;
|
|
||||||
|
|
||||||
OPEN cDates;
|
|
||||||
|
|
||||||
lDates:
|
|
||||||
LOOP
|
|
||||||
SET vTicket = NULL;
|
|
||||||
SET vDone = FALSE;
|
|
||||||
FETCH cDates INTO vShipment, vWarehouse;
|
|
||||||
|
|
||||||
IF vDone THEN
|
|
||||||
LEAVE lDates;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
-- Busca un ticket existente que coincida con los parametros
|
|
||||||
|
|
||||||
SELECT t.id INTO vTicket
|
|
||||||
FROM vn.ticket t
|
|
||||||
LEFT JOIN vn.ticketState tls on tls.ticket = t.id
|
|
||||||
JOIN `order` o
|
|
||||||
ON o.address_id = t.addressFk
|
|
||||||
AND vWarehouse = t.warehouseFk
|
|
||||||
AND o.agency_id = t.agencyModeFk
|
|
||||||
AND o.date_send = t.landed
|
|
||||||
AND vShipment = DATE(t.shipped)
|
|
||||||
WHERE o.id = vOrder
|
|
||||||
AND t.invoiceOutFk IS NULL
|
|
||||||
AND IFNULL(tls.alertLevel,0) = 0
|
|
||||||
AND t.clientFk <> 1118
|
|
||||||
LIMIT 1;
|
|
||||||
|
|
||||||
-- Crea el ticket en el caso de no existir uno adecuado
|
|
||||||
|
|
||||||
IF vTicket IS NULL
|
|
||||||
THEN
|
|
||||||
CALL vn.ticketCreateWithUser(
|
|
||||||
vClientId,
|
|
||||||
IFNULL(vShipment, CURDATE()),
|
|
||||||
vWarehouse,
|
|
||||||
vCompanyId,
|
|
||||||
vAddress,
|
|
||||||
vAgencyModeId,
|
|
||||||
NULL,
|
|
||||||
vDelivery,
|
|
||||||
vUserId,
|
|
||||||
vTicket
|
|
||||||
);
|
|
||||||
ELSE
|
|
||||||
INSERT INTO vncontrol.inter
|
|
||||||
SET Id_Ticket = vTicket,
|
|
||||||
Id_Trabajador = vUserId,
|
|
||||||
state_id = TICKET_FREE;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
INSERT IGNORE INTO vn.orderTicket
|
|
||||||
SET orderFk = vOrder,
|
|
||||||
ticketFk = vTicket;
|
|
||||||
|
|
||||||
-- Añade las notas
|
|
||||||
|
|
||||||
IF vNotes IS NOT NULL AND vNotes != ''
|
|
||||||
THEN
|
|
||||||
INSERT INTO vn.ticketObservation SET
|
|
||||||
ticketFk = vTicket,
|
|
||||||
observationTypeFk = 4 /* salesperson */ ,
|
|
||||||
`description` = vNotes
|
|
||||||
ON DUPLICATE KEY UPDATE
|
|
||||||
`description` = CONCAT(VALUES(`description`),'. ', `description`);
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
-- Añade los movimientos y sus componentes
|
|
||||||
|
|
||||||
OPEN cRows;
|
|
||||||
|
|
||||||
lRows:
|
|
||||||
LOOP
|
|
||||||
SET vDone = FALSE;
|
|
||||||
FETCH cRows INTO vRowId, vItem, vConcept, vAmount, vPrice, vRate;
|
|
||||||
|
|
||||||
IF vDone THEN
|
|
||||||
LEAVE lRows;
|
|
||||||
END IF;
|
|
||||||
SET vSale = NULL;
|
|
||||||
SELECT s.id INTO vSale
|
|
||||||
FROM vn.sale s
|
|
||||||
WHERE ticketFk = vTicket
|
|
||||||
AND price = vPrice
|
|
||||||
AND itemFk = vItem
|
|
||||||
LIMIT 1;
|
|
||||||
IF vSale THEN
|
|
||||||
UPDATE vn.sale
|
|
||||||
SET quantity = quantity + vAmount
|
|
||||||
WHERE id = vSale;
|
|
||||||
ELSE
|
|
||||||
INSERT INTO vn.sale
|
|
||||||
SET
|
|
||||||
itemFk = vItem,
|
|
||||||
ticketFk = vTicket,
|
|
||||||
concept = vConcept,
|
|
||||||
quantity = vAmount,
|
|
||||||
price = vPrice,
|
|
||||||
priceFixed = 0,
|
|
||||||
isPriceFixed = TRUE;
|
|
||||||
|
|
||||||
SET vSale = LAST_INSERT_ID();
|
|
||||||
|
|
||||||
INSERT INTO vn.saleComponent
|
|
||||||
(saleFk, componentFk, `value`)
|
|
||||||
SELECT vSale, cm.component_id, cm.price
|
|
||||||
FROM order_component cm
|
|
||||||
JOIN vn.component c ON c.id = cm.component_id
|
|
||||||
WHERE cm.order_row_id = vRowId
|
|
||||||
GROUP BY vSale, cm.component_id;
|
|
||||||
END IF;
|
|
||||||
UPDATE order_row SET Id_Movimiento = vSale
|
|
||||||
WHERE id = vRowId;
|
|
||||||
|
|
||||||
END LOOP;
|
|
||||||
|
|
||||||
CLOSE cRows;
|
|
||||||
|
|
||||||
-- Fija el coste
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tComponents;
|
|
||||||
CREATE TEMPORARY TABLE tComponents
|
|
||||||
(INDEX (saleFk))
|
|
||||||
ENGINE = MEMORY
|
|
||||||
SELECT SUM(sc.`value`) valueSum, sc.saleFk
|
|
||||||
FROM vn.saleComponent sc
|
|
||||||
JOIN vn.component c ON c.id = sc.componentFk
|
|
||||||
JOIN vn.componentType ct ON ct.id = c.typeFk AND ct.isBase
|
|
||||||
JOIN vn.sale s ON s.id = sc.saleFk
|
|
||||||
WHERE s.ticketFk = vTicket
|
|
||||||
GROUP BY sc.saleFk;
|
|
||||||
|
|
||||||
UPDATE vn.sale s
|
|
||||||
JOIN tComponents mc ON mc.saleFk = s.id
|
|
||||||
SET s.priceFixed = valueSum;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tComponents;
|
|
||||||
END LOOP;
|
|
||||||
|
|
||||||
CLOSE cDates;
|
|
||||||
|
|
||||||
DELETE FROM basketOrder WHERE orderFk = vOrder;
|
|
||||||
UPDATE `order` SET confirmed = TRUE, confirm_date = NOW()
|
|
||||||
WHERE id = vOrder;
|
|
||||||
|
|
||||||
COMMIT;
|
|
||||||
END$$
|
|
||||||
|
|
||||||
DELIMITER ;
|
|
|
@ -1,103 +0,0 @@
|
||||||
USE `vn`;
|
|
||||||
DROP procedure IF EXISTS `sale_calculateComponent`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `vn`$$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `sale_calculateComponent`(vSale INT, vOption INT)
|
|
||||||
proc: BEGIN
|
|
||||||
/**
|
|
||||||
* Actualiza los componentes
|
|
||||||
*
|
|
||||||
* @param vSale Delivery date
|
|
||||||
* @param vOption indica en que componente pone el descuadre, NULL en casos habituales
|
|
||||||
*/
|
|
||||||
DECLARE vShipped DATE;
|
|
||||||
DECLARE vWarehouseFk SMALLINT;
|
|
||||||
DECLARE vAgencyModeFk INT;
|
|
||||||
DECLARE vAddressFk INT;
|
|
||||||
DECLARE vTicketFk BIGINT;
|
|
||||||
DECLARE vItemFk BIGINT;
|
|
||||||
DECLARE vLanded DATE;
|
|
||||||
DECLARE vIsEditable BOOLEAN;
|
|
||||||
DECLARE vZoneFk INTEGER;
|
|
||||||
|
|
||||||
SELECT t.refFk IS NULL AND (IFNULL(ts.alertLevel, 0) = 0 OR s.price = 0),
|
|
||||||
s.ticketFk,
|
|
||||||
s.itemFk ,
|
|
||||||
t.zoneFk,
|
|
||||||
t.warehouseFk,
|
|
||||||
t.shipped,
|
|
||||||
t.addressFk,
|
|
||||||
t.agencyModeFk,
|
|
||||||
t.landed
|
|
||||||
INTO vIsEditable,
|
|
||||||
vTicketFk,
|
|
||||||
vItemFk,
|
|
||||||
vZoneFk,
|
|
||||||
vWarehouseFk,
|
|
||||||
vShipped,
|
|
||||||
vAddressFk,
|
|
||||||
vAgencyModeFk,
|
|
||||||
vLanded
|
|
||||||
FROM ticket t
|
|
||||||
JOIN sale s ON s.ticketFk = t.id
|
|
||||||
LEFT JOIN ticketState ts ON ts.ticketFk = t.id
|
|
||||||
WHERE s.id = vSale;
|
|
||||||
|
|
||||||
IF vLanded IS NULL OR vZoneFk IS NULL THEN
|
|
||||||
|
|
||||||
CALL zone_getLanded(vShipped, vAddressFk, vAgencyModeFk, vWarehouseFk);
|
|
||||||
|
|
||||||
IF (SELECT COUNT(*) FROM tmp.zoneGetLanded LIMIT 1) = 0 THEN
|
|
||||||
CALL util.throw('There is no zone for these parameters');
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
UPDATE ticket t
|
|
||||||
SET t.landed = (SELECT landed FROM tmp.zoneGetLanded LIMIT 1)
|
|
||||||
WHERE t.id = vTicketFk AND t.landed IS NULL;
|
|
||||||
|
|
||||||
IF vZoneFk IS NULL THEN
|
|
||||||
SELECT zoneFk INTO vZoneFk FROM tmp.zoneGetLanded LIMIT 1;
|
|
||||||
UPDATE ticket t
|
|
||||||
SET t.zoneFk = vZoneFk
|
|
||||||
WHERE t.id = vTicketFk AND t.zoneFk IS NULL;
|
|
||||||
END IF;
|
|
||||||
DROP TEMPORARY TABLE tmp.zoneGetLanded;
|
|
||||||
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
-- rellena la tabla buyUltimate con la ultima compra
|
|
||||||
CALL buyUltimate (vWarehouseFk, vShipped);
|
|
||||||
|
|
||||||
DELETE FROM tmp.buyUltimate WHERE itemFk != vItemFk;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot;
|
|
||||||
CREATE TEMPORARY TABLE tmp.ticketLot
|
|
||||||
SELECT vWarehouseFk warehouseFk, NULL available, vItemFk itemFk, buyFk, vZoneFk zoneFk
|
|
||||||
FROM tmp.buyUltimate
|
|
||||||
WHERE itemFk = vItemFk;
|
|
||||||
|
|
||||||
CALL catalog_componentPrepare();
|
|
||||||
CALL catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk);
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.sale;
|
|
||||||
CREATE TEMPORARY TABLE tmp.sale
|
|
||||||
(PRIMARY KEY (saleFk)) ENGINE = MEMORY
|
|
||||||
SELECT vSale saleFk,vWarehouseFk warehouseFk;
|
|
||||||
|
|
||||||
IF vOption IS NULL THEN
|
|
||||||
SET vOption = IF(vIsEditable, 1, 6);
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
CALL ticketComponentUpdateSale(vOption);
|
|
||||||
|
|
||||||
INSERT INTO ticketLog (originFk, userFk, `action`, description)
|
|
||||||
VALUES (vTicketFk, account.userGetId(), 'update', CONCAT('Bionizo linea id ', vSale));
|
|
||||||
|
|
||||||
CALL catalog_componentPurge();
|
|
||||||
DROP TEMPORARY TABLE tmp.buyUltimate;
|
|
||||||
DROP TEMPORARY TABLE tmp.sale;
|
|
||||||
END$$
|
|
||||||
|
|
||||||
DELIMITER ;
|
|
||||||
|
|
|
@ -1,93 +0,0 @@
|
||||||
USE `vn`;
|
|
||||||
DROP procedure IF EXISTS `ticketCalculateClon`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `vn`$$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `ticketCalculateClon`(IN vTicketNew INT, vTicketOld INT)
|
|
||||||
BEGIN
|
|
||||||
/*
|
|
||||||
* Recalcula los componentes un ticket clonado,
|
|
||||||
* las lineas a precio cero fuerza para que tengan precio, el resto lo respeta
|
|
||||||
* @param vTicketNew nuevo ticket clonado
|
|
||||||
* @param vTicketOld icket original, a partir del qual se clonara el nuevo
|
|
||||||
*/
|
|
||||||
DECLARE vShipped DATE;
|
|
||||||
DECLARE vClient INT;
|
|
||||||
DECLARE vWarehouse SMALLINT;
|
|
||||||
DECLARE vAgencyMode INT;
|
|
||||||
DECLARE vAddress INT;
|
|
||||||
DECLARE vLanded DATE;
|
|
||||||
DECLARE vAgency INT;
|
|
||||||
DECLARE vZoneFk 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, t.zoneFk
|
|
||||||
INTO vClient, vWarehouse, vShipped, vAddress, vAgencyMode, vLanded, vAgency, vZoneFk
|
|
||||||
FROM agencyMode a
|
|
||||||
JOIN ticket t ON t.agencyModeFk = a.id
|
|
||||||
WHERE t.id = vTicketNew;
|
|
||||||
|
|
||||||
IF vLanded IS NULL THEN
|
|
||||||
CALL zone_getLanded(vShipped, vAddress, vAgency, vWarehouse);
|
|
||||||
UPDATE ticket t
|
|
||||||
JOIN tmp.zoneGetLanded zgl ON t.warehouseFk = zgl.warehouseFk
|
|
||||||
SET t.landed = zgl.landed,
|
|
||||||
t.zone = zgl.zoneFk
|
|
||||||
WHERE t.id = vTicketNew;
|
|
||||||
|
|
||||||
SELECT zoneFk INTO vZoneFk FROM tmp.zoneGetLanded LIMIT 1;
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.zoneGetLanded;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
-- rellena la tabla tmp.buyUltimate con la ultima compra
|
|
||||||
CALL buyUltimate(vWarehouse, vShipped);
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot;
|
|
||||||
CREATE TEMPORARY TABLE tmp.ticketLot
|
|
||||||
SELECT vWarehouse warehouseFk, NULL available, s.itemFk, bu.buyFk, vZoneFk zoneFk
|
|
||||||
FROM sale s
|
|
||||||
LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk
|
|
||||||
WHERE s.ticketFk = vTicketOld GROUP BY s.itemFk;
|
|
||||||
|
|
||||||
CALL catalog_componentPrepare();
|
|
||||||
CALL catalog_componentCalculate(vZoneFk, vAddress, vAgencyMode, vWarehouse);
|
|
||||||
|
|
||||||
-- 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);
|
|
||||||
|
|
||||||
-- Log
|
|
||||||
CALL `logAdd`(vTicketNew, 'update', ' ticket' , 'Bioniza Ticket');
|
|
||||||
|
|
||||||
-- Limpieza
|
|
||||||
CALL catalog_componentPurge();
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS
|
|
||||||
tmp.buyUltimate,
|
|
||||||
tmp.sale,
|
|
||||||
tmp.zoneGetLanded;
|
|
||||||
|
|
||||||
END$$
|
|
||||||
|
|
||||||
DELIMITER ;
|
|
||||||
|
|
|
@ -1,61 +0,0 @@
|
||||||
USE `vn`;
|
|
||||||
DROP procedure IF EXISTS `ticketCalculateSaleForcePrice`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `vn`$$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `ticketCalculateSaleForcePrice`(IN vSale BIGINT)
|
|
||||||
proc: BEGIN
|
|
||||||
|
|
||||||
DECLARE vShipped DATE;
|
|
||||||
DECLARE vWarehouseFk SMALLINT;
|
|
||||||
DECLARE vAddressFk INT;
|
|
||||||
DECLARE vTicket BIGINT;
|
|
||||||
DECLARE vItem BIGINT;
|
|
||||||
DECLARE vZoneFk INT;
|
|
||||||
|
|
||||||
SELECT ticketFk, itemFk
|
|
||||||
INTO vTicket, vItem
|
|
||||||
FROM sale
|
|
||||||
WHERE id = vSale;
|
|
||||||
|
|
||||||
SELECT t.warehouseFk, DATE(t.shipped), t.addressFk, t.zoneFk
|
|
||||||
INTO vWarehouseFk, vShipped, vAddressFk, vZoneFk
|
|
||||||
FROM agencyMode a
|
|
||||||
JOIN ticket t ON t.agencyModeFk = a.id
|
|
||||||
WHERE t.id = vTicket;
|
|
||||||
|
|
||||||
IF vZoneFk IS NULL THEN
|
|
||||||
CALL util.throw('ticket without zone');
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
CALL buyUltimate (vWarehouseFk, vShipped);
|
|
||||||
|
|
||||||
DELETE FROM tmp.buyUltimate WHERE itemFk != vItem;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot;
|
|
||||||
CREATE TEMPORARY TABLE tmp.ticketLot
|
|
||||||
SELECT vWarehouseFk warehouseFk, NULL available, vItem itemFk, buyFk, vZoneFk zoneFk
|
|
||||||
FROM tmp.buyUltimate
|
|
||||||
WHERE itemFk = vItem;
|
|
||||||
|
|
||||||
CALL catalog_componentPrepare();
|
|
||||||
CALL catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk);
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.sale;
|
|
||||||
CREATE TEMPORARY TABLE tmp.sale
|
|
||||||
(PRIMARY KEY (saleFk)) ENGINE = MEMORY
|
|
||||||
SELECT vSale saleFk,vWarehouseFk warehouseFk;
|
|
||||||
|
|
||||||
CALL ticketComponentUpdateSale(1);
|
|
||||||
|
|
||||||
INSERT INTO vn.ticketLog (originFk, userFk, `action`, description)
|
|
||||||
VALUES (vTicket, account.userGetId(), 'update', CONCAT('Bionizo linea id ', vSale));
|
|
||||||
|
|
||||||
CALL catalog_componentPurge();
|
|
||||||
DROP TEMPORARY TABLE tmp.buyUltimate;
|
|
||||||
DROP TEMPORARY TABLE tmp.sale;
|
|
||||||
|
|
||||||
END$$
|
|
||||||
|
|
||||||
DELIMITER ;
|
|
||||||
|
|
|
@ -1,154 +0,0 @@
|
||||||
USE `vn`;
|
|
||||||
DROP procedure IF EXISTS `ticketComponentUpdateSale`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `vn`$$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `ticketComponentUpdateSale`(vOption INT)
|
|
||||||
BEGIN
|
|
||||||
/**
|
|
||||||
* A partir de la tabla tmp.sale, crea los Movimientos_componentes
|
|
||||||
* y modifica el campo Preu de la tabla Movimientos
|
|
||||||
*
|
|
||||||
* @param i_option integer tipo de actualizacion
|
|
||||||
* @param table tmp.sale tabla memory con el campo saleFk, warehouseFk
|
|
||||||
**/
|
|
||||||
DECLARE vComponentFk INT;
|
|
||||||
DECLARE vRenewComponents BOOLEAN;
|
|
||||||
DECLARE vKeepPrices BOOLEAN;
|
|
||||||
|
|
||||||
CASE vOption
|
|
||||||
WHEN 1 THEN
|
|
||||||
SET vRenewComponents = TRUE;
|
|
||||||
SET vKeepPrices = FALSE;
|
|
||||||
WHEN 2 THEN
|
|
||||||
SELECT id INTO vComponentFk FROM component WHERE `code` = 'debtCollection';
|
|
||||||
SET vRenewComponents = TRUE;
|
|
||||||
SET vKeepPrices = TRUE;
|
|
||||||
WHEN 3 THEN
|
|
||||||
SELECT id INTO vComponentFk FROM component WHERE `code` = 'mana';
|
|
||||||
SET vRenewComponents = TRUE;
|
|
||||||
SET vKeepPrices = TRUE;
|
|
||||||
WHEN 4 THEN
|
|
||||||
SELECT id INTO vComponentFk FROM component WHERE `code` = 'buyerDiscount';
|
|
||||||
SET vRenewComponents = TRUE;
|
|
||||||
SET vKeepPrices = TRUE;
|
|
||||||
/* WHEN 5 THEN
|
|
||||||
SET vComponentFk = 35;
|
|
||||||
SET vRenewComponents = TRUE;
|
|
||||||
SET vKeepPrices = TRUE;*/
|
|
||||||
WHEN 6 THEN
|
|
||||||
SELECT id INTO vComponentFk FROM component WHERE `code` = 'imbalance';
|
|
||||||
SET vRenewComponents = TRUE;
|
|
||||||
SET vKeepPrices = TRUE;
|
|
||||||
WHEN 7 THEN
|
|
||||||
REPLACE INTO saleComponent(saleFk, componentFk, value)
|
|
||||||
SELECT s.id, 28, ROUND(((s.price * (100 - s.discount) / 100) - SUM(IFNULL(sc.value, 0))) * 0.8, 3)
|
|
||||||
FROM sale s
|
|
||||||
JOIN tmp.sale tmps ON tmps.saleFk = s.id
|
|
||||||
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
|
|
||||||
AND sc.componentFk NOT IN (28, 29)
|
|
||||||
GROUP BY s.id;
|
|
||||||
|
|
||||||
REPLACE INTO saleComponent(saleFk, componentFk, value)
|
|
||||||
SELECT s.id, 29, ROUND(((s.price * (100 - s.discount) / 100) - SUM(IFNULL(sc.value, 0))) * 0.2, 3)
|
|
||||||
FROM sale s
|
|
||||||
JOIN tmp.sale tmps ON tmps.saleFk = s.id
|
|
||||||
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
|
|
||||||
AND sc.componentFk NOT IN (28, 29)
|
|
||||||
GROUP BY s.id;
|
|
||||||
|
|
||||||
SET vRenewComponents = FALSE;
|
|
||||||
SET vKeepPrices = FALSE;
|
|
||||||
WHEN 8 THEN
|
|
||||||
DELETE sc.*
|
|
||||||
FROM tmp.sale tmps JOIN saleComponent sc ON sc.saleFk = tmps.saleFk;
|
|
||||||
|
|
||||||
REPLACE INTO saleComponent(saleFk, componentFk, value)
|
|
||||||
SELECT s.id, 28, ROUND(((s.price * (100 - s.discount) / 100)), 3)
|
|
||||||
FROM sale s
|
|
||||||
JOIN tmp.sale tmps ON tmps.saleFk = s.id;
|
|
||||||
|
|
||||||
SET vRenewComponents = FALSE;
|
|
||||||
SET vKeepPrices = FALSE;
|
|
||||||
WHEN 9 THEN
|
|
||||||
SET vRenewComponents = TRUE;
|
|
||||||
SET vKeepPrices = TRUE;
|
|
||||||
END CASE;
|
|
||||||
|
|
||||||
IF vRenewComponents THEN
|
|
||||||
DELETE sc.*
|
|
||||||
FROM tmp.sale tmps
|
|
||||||
JOIN saleComponent sc ON sc.saleFk = tmps.saleFk
|
|
||||||
JOIN `component` c ON c.id = sc.componentFk
|
|
||||||
WHERE c.isRenewable;
|
|
||||||
|
|
||||||
REPLACE INTO saleComponent(saleFk, componentFk, value)
|
|
||||||
SELECT s.id, tc.componentFk, tc.cost
|
|
||||||
FROM sale s
|
|
||||||
JOIN tmp.sale tmps ON tmps.saleFk = s.id
|
|
||||||
JOIN tmp.ticketComponent tc ON tc.itemFk = s.itemFk AND tc.warehouseFk = tmps.warehouseFk
|
|
||||||
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
|
|
||||||
AND sc.componentFk = tc.componentFk
|
|
||||||
LEFT JOIN `component` c ON c.id = tc.componentFk
|
|
||||||
WHERE IF(sc.componentFk IS NULL AND NOT c.isRenewable, FALSE, TRUE);
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
IF vKeepPrices THEN
|
|
||||||
REPLACE INTO saleComponent(saleFk, componentFk, value)
|
|
||||||
SELECT s.id, vComponentFk, ROUND((s.price * (100 - s.discount) / 100) - SUM(sc.value), 3) dif
|
|
||||||
FROM sale s
|
|
||||||
JOIN tmp.sale tmps ON tmps.saleFk = s.id
|
|
||||||
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
|
|
||||||
WHERE sc.saleFk <> vComponentFk
|
|
||||||
GROUP BY s.id
|
|
||||||
HAVING dif <> 0;
|
|
||||||
ELSE
|
|
||||||
UPDATE sale s
|
|
||||||
JOIN item i on i.id = s.itemFk
|
|
||||||
JOIN itemType it on it.id = i.typeFk
|
|
||||||
JOIN (SELECT SUM(sc.value) sumValue, sc.saleFk
|
|
||||||
FROM saleComponent sc
|
|
||||||
JOIN tmp.sale tmps ON tmps.saleFk = sc.saleFk
|
|
||||||
GROUP BY sc.saleFk) sc ON sc.saleFk = s.id
|
|
||||||
SET s.price = sumValue
|
|
||||||
WHERE it.code != 'PRT' ;
|
|
||||||
|
|
||||||
REPLACE INTO saleComponent(saleFk, componentFk, value)
|
|
||||||
SELECT s.id, 21, ROUND((s.price * (100 - s.discount) / 100) - SUM(value), 3) saleValue
|
|
||||||
FROM sale s
|
|
||||||
JOIN tmp.sale tmps ON tmps.saleFk = s.id
|
|
||||||
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
|
|
||||||
WHERE sc.componentFk != 21
|
|
||||||
GROUP BY s.id
|
|
||||||
HAVING ROUND(saleValue, 4) <> 0;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
UPDATE sale s
|
|
||||||
JOIN (
|
|
||||||
SELECT SUM(sc.value) sumValue, sc.saleFk
|
|
||||||
FROM saleComponent sc
|
|
||||||
JOIN tmp.sale tmps ON tmps.saleFk = sc.saleFk
|
|
||||||
JOIN `component` c ON c.id = sc.componentFk
|
|
||||||
JOIN componentType ct on ct.id = c.typeFk AND ct.isBase
|
|
||||||
GROUP BY sc.saleFk) sc ON sc.saleFk = s.id
|
|
||||||
SET s.priceFixed = sumValue, s.isPriceFixed = 1;
|
|
||||||
|
|
||||||
DELETE sc.*
|
|
||||||
FROM saleComponent sc
|
|
||||||
JOIN tmp.sale tmps ON tmps.saleFk = sc.saleFk
|
|
||||||
JOIN sale s on s.id = sc.saleFk
|
|
||||||
JOIN item i ON i.id = s.itemFk
|
|
||||||
JOIN itemType it ON it.id = i.typeFk
|
|
||||||
WHERE it.code = 'PRT';
|
|
||||||
|
|
||||||
INSERT INTO saleComponent(saleFk, componentFk, value)
|
|
||||||
SELECT s.id, 15, s.price
|
|
||||||
FROM sale s
|
|
||||||
JOIN tmp.sale tmps ON tmps.saleFk = s.id
|
|
||||||
JOIN item i ON i.id = s.itemFK
|
|
||||||
JOIN itemType it ON it.id = i.typeFk
|
|
||||||
WHERE it.code = 'PRT' AND s.price > 0;
|
|
||||||
END$$
|
|
||||||
|
|
||||||
DELIMITER ;
|
|
||||||
|
|
|
@ -1,107 +0,0 @@
|
||||||
USE `vn`;
|
|
||||||
DROP procedure IF EXISTS `ticket_componentMakeUpdate`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `vn`$$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `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
|
|
||||||
/**
|
|
||||||
* Modifica en el ticket los campos que se le pasan por parámetro
|
|
||||||
* y cambia sus componentes
|
|
||||||
*
|
|
||||||
* @param vTicketFk Id del ticket a modificar
|
|
||||||
* @param vClientFk nuevo cliente
|
|
||||||
* @param vAgencyModeFk nueva agencia
|
|
||||||
* @param vAddressFk nuevo consignatario
|
|
||||||
* @param vZoneFk nueva zona
|
|
||||||
* @param vWarehouseFk nuevo almacen
|
|
||||||
* @param vCompanyFk nueva empresa
|
|
||||||
* @param vShipped nueva fecha del envio de mercancia
|
|
||||||
* @param vLanded nueva fecha de recepcion de mercancia
|
|
||||||
* @param vIsDeleted si se borra el ticket
|
|
||||||
* @param vHasToBeUnrouted si se le elimina la ruta al ticket
|
|
||||||
* @param vOption opcion para el case del proc ticketComponentUpdateSale
|
|
||||||
*/
|
|
||||||
DECLARE vPrice DECIMAL(10,2);
|
|
||||||
DECLARE vBonus DECIMAL(10,2);
|
|
||||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
|
||||||
BEGIN
|
|
||||||
ROLLBACK;
|
|
||||||
RESIGNAL;
|
|
||||||
END;
|
|
||||||
|
|
||||||
CALL ticket_componentPreview (vTicketFk, vLanded, vAddressFk, vZoneFk, vWarehouseFk);
|
|
||||||
|
|
||||||
START TRANSACTION;
|
|
||||||
|
|
||||||
IF (SELECT addressFk FROM ticket WHERE id = vTicketFk) <> vAddressFk THEN
|
|
||||||
|
|
||||||
UPDATE ticket t
|
|
||||||
JOIN address a ON a.id = vAddressFk
|
|
||||||
SET t.nickname = a.nickname
|
|
||||||
WHERE t.id = vTicketFk;
|
|
||||||
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
CALL zone_getShippedWarehouse(vlanded, vAddressFk, vAgencyModeFk);
|
|
||||||
|
|
||||||
SELECT zoneFk, price, bonus INTO vZoneFk, vPrice, vBonus
|
|
||||||
FROM tmp.zoneGetShipped
|
|
||||||
WHERE shipped = vShipped AND warehouseFk = vWarehouseFk LIMIT 1;
|
|
||||||
|
|
||||||
UPDATE ticket t
|
|
||||||
SET
|
|
||||||
t.clientFk = vClientFk,
|
|
||||||
t.agencyModeFk = vAgencyModeFk,
|
|
||||||
t.addressFk = vAddressFk,
|
|
||||||
t.zoneFk = vZoneFk,
|
|
||||||
t.zonePrice = vPrice,
|
|
||||||
t.zoneBonus = vBonus,
|
|
||||||
t.warehouseFk = vWarehouseFk,
|
|
||||||
t.companyFk = vCompanyFk,
|
|
||||||
t.landed = vLanded,
|
|
||||||
t.shipped = vShipped,
|
|
||||||
t.isDeleted = vIsDeleted
|
|
||||||
WHERE
|
|
||||||
t.id = vTicketFk;
|
|
||||||
|
|
||||||
IF vHasToBeUnrouted THEN
|
|
||||||
UPDATE ticket t SET t.routeFk = NULL
|
|
||||||
WHERE t.id = vTicketFk;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
IF vOption <> 8 THEN
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.sale;
|
|
||||||
CREATE TEMPORARY TABLE tmp.sale
|
|
||||||
(PRIMARY KEY (saleFk))
|
|
||||||
ENGINE = MEMORY
|
|
||||||
SELECT id AS saleFk, vWarehouseFk warehouseFk
|
|
||||||
FROM sale s WHERE s.ticketFk = vTicketFk;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponent;
|
|
||||||
CREATE TEMPORARY TABLE tmp.ticketComponent
|
|
||||||
SELECT * FROM tmp.ticketComponentPreview;
|
|
||||||
|
|
||||||
CALL ticketComponentUpdateSale (vOption);
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tmp.sale;
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponent;
|
|
||||||
END IF;
|
|
||||||
COMMIT;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tmp.zoneGetShipped, tmp.ticketComponentPreview;
|
|
||||||
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.ticketComponentPreview (warehouseFk, itemFk, componentFk, cost)
|
|
||||||
*/
|
|
||||||
DECLARE vHasDataChanged BOOL DEFAULT FALSE;
|
|
||||||
DECLARE vHasAddressChanged BOOL;
|
|
||||||
DECLARE vHasZoneChanged BOOL DEFAULT FALSE;
|
|
||||||
DECLARE vHasWarehouseChanged BOOL DEFAULT FALSE;
|
|
||||||
|
|
||||||
DECLARE vShipped DATE;
|
|
||||||
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,
|
|
||||||
vZoneFk zoneFk
|
|
||||||
FROM sale s
|
|
||||||
LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk
|
|
||||||
WHERE s.ticketFk = vTicketFk
|
|
||||||
GROUP BY bu.warehouseFk, bu.itemFk);
|
|
||||||
|
|
||||||
CALL catalog_componentPrepare();
|
|
||||||
CALL catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk);
|
|
||||||
|
|
||||||
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 `component` c ON c.id = sc.componentFk
|
|
||||||
WHERE s.ticketFk = vTicketFk
|
|
||||||
AND (c.isRenewable = FALSE
|
|
||||||
OR
|
|
||||||
(NOT vHasChangeAll
|
|
||||||
AND (NOT (c.typeFk <=> vAddressTypeRateFk
|
|
||||||
OR c.typeFk <=> vAgencyModeTypeRateFk))));
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentPreview;
|
|
||||||
CREATE TEMPORARY TABLE tmp.ticketComponentPreview
|
|
||||||
SELECT * FROM tmp.ticketComponent;
|
|
||||||
|
|
||||||
CALL catalog_componentPurge();
|
|
||||||
DROP TEMPORARY TABLE tmp.buyUltimate;
|
|
||||||
|
|
||||||
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,50 +0,0 @@
|
||||||
USE `vn`;
|
|
||||||
DROP procedure IF EXISTS `ticket_priceDifference`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `vn`$$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `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.ticketComponentPreview 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 `component` c ON c.id = tc.componentFk
|
|
||||||
WHERE t.id = vTicketFk
|
|
||||||
AND IF(sc.componentFk IS NULL
|
|
||||||
AND c.classRate IS NOT NULL, FALSE, TRUE)
|
|
||||||
GROUP BY s.id ORDER BY s.id;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tmp.ticketComponentPreview;
|
|
||||||
END$$
|
|
||||||
|
|
||||||
DELIMITER ;
|
|
||||||
|
|
|
@ -1,94 +0,0 @@
|
||||||
USE `vn`;
|
|
||||||
DROP procedure IF EXISTS `ticket_recalcComponents`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `vn`$$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `ticket_recalcComponents`(IN vTicketFk BIGINT, vIsTicketEditable BOOLEAN)
|
|
||||||
proc: BEGIN
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Este procedimiento recalcula los componentes de un ticket,
|
|
||||||
* eliminando los componentes existentes e insertandolos de nuevo
|
|
||||||
*
|
|
||||||
* @param vTicketFk Id del ticket
|
|
||||||
* @param vIsTicketEditable si no se quiere forzar llamar con NULL
|
|
||||||
*/
|
|
||||||
DECLARE vShipped DATE;
|
|
||||||
DECLARE vWarehouseFk SMALLINT;
|
|
||||||
DECLARE vAgencyModeFk INT;
|
|
||||||
DECLARE vAddressFk INT;
|
|
||||||
DECLARE vLanded DATE;
|
|
||||||
DECLARE vZoneFk INTEGER;
|
|
||||||
|
|
||||||
IF vIsTicketEditable IS NULL THEN
|
|
||||||
SELECT IFNULL(ts.alertLevel,0) = 0 AND IFNULL(t.refFk,'') = ''
|
|
||||||
INTO vIsTicketEditable
|
|
||||||
FROM ticket t LEFT JOIN ticketState ts ON t.id = ts.ticket
|
|
||||||
WHERE id = vTicketFk;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
SELECT t.warehouseFk,
|
|
||||||
t.shipped,
|
|
||||||
t.addressFk,
|
|
||||||
t.agencyModeFk,
|
|
||||||
t.landed,
|
|
||||||
t.zoneFk
|
|
||||||
INTO vWarehouseFk, vShipped, vAddressFk, vAgencyModeFk, vLanded, vZoneFk
|
|
||||||
FROM ticket t LEFT JOIN ticketState ts ON t.id = ts.ticket
|
|
||||||
WHERE t.id = vTicketFk;
|
|
||||||
|
|
||||||
IF vLanded IS NULL OR vZoneFk IS NULL THEN
|
|
||||||
|
|
||||||
CALL zone_getLanded(vShipped, vAddressFk, vAgencyModeFk, vWarehouseFk);
|
|
||||||
|
|
||||||
IF (SELECT COUNT(*) FROM tmp.zoneGetLanded LIMIT 1) = 0 THEN
|
|
||||||
CALL util.throw('There is no zone for these parameters');
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
UPDATE ticket t
|
|
||||||
SET t.landed = (SELECT landed FROM tmp.zoneGetLanded LIMIT 1)
|
|
||||||
WHERE t.id = vTicketFk AND t.landed IS NULL;
|
|
||||||
|
|
||||||
IF vZoneFk IS NULL THEN
|
|
||||||
SELECT zoneFk INTO vZoneFk FROM tmp.zoneGetLanded LIMIT 1;
|
|
||||||
UPDATE ticket t
|
|
||||||
SET t.zoneFk = vZoneFk
|
|
||||||
WHERE t.id = vTicketFk AND t.zoneFk IS NULL;
|
|
||||||
END IF;
|
|
||||||
DROP TEMPORARY TABLE tmp.zoneGetLanded;
|
|
||||||
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
-- rellena la tabla buyUltimate con la ultima compra
|
|
||||||
CALL buyUltimate (vWarehouseFk, vShipped);
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot;
|
|
||||||
CREATE TEMPORARY TABLE tmp.ticketLot
|
|
||||||
SELECT vWarehouseFk warehouseFk, NULL available,
|
|
||||||
s.itemFk, bu.buyFk, vZoneFk zoneFk
|
|
||||||
FROM sale s
|
|
||||||
LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk
|
|
||||||
WHERE s.ticketFk = vTicketFk
|
|
||||||
GROUP BY s.itemFk;
|
|
||||||
|
|
||||||
CALL catalog_componentPrepare();
|
|
||||||
CALL catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk);
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.sale;
|
|
||||||
CREATE TEMPORARY TABLE tmp.sale
|
|
||||||
(PRIMARY KEY (saleFk)) ENGINE = MEMORY
|
|
||||||
SELECT id saleFk, vWarehouseFk warehouseFk
|
|
||||||
FROM sale s
|
|
||||||
WHERE s.ticketFk = vTicketFk;
|
|
||||||
|
|
||||||
-- si el ticket esta facturado, respeta los precios
|
|
||||||
CALL ticketComponentUpdateSale(IF(vIsTicketEditable, 1, 6));
|
|
||||||
|
|
||||||
CALL catalog_componentPurge();
|
|
||||||
DROP TEMPORARY TABLE
|
|
||||||
tmp.buyUltimate,
|
|
||||||
tmp.sale;
|
|
||||||
END$$
|
|
||||||
|
|
||||||
DELIMITER ;
|
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
USE `vn`;
|
|
||||||
DROP procedure IF EXISTS `ticket_recalcComponentsForcePrice`;
|
|
|
@ -1,72 +0,0 @@
|
||||||
USE `vn`;
|
|
||||||
DROP procedure IF EXISTS `ticket_withoutComponents`;
|
|
||||||
DROP procedure IF EXISTS `ticket_checkNoComponents`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `vn`$$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `ticket_checkNoComponents`(vShippedFrom DATETIME, vShippedTo DATETIME)
|
|
||||||
BEGIN
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Comprueba que los tickets entre un rango de fechas tienen componentes
|
|
||||||
*
|
|
||||||
* @param vDatedFrom Id del ticket
|
|
||||||
* @param vIsTicketEditable si no se quiere forzar llamar con NULL
|
|
||||||
*/
|
|
||||||
DECLARE v_done BOOL DEFAULT FALSE;
|
|
||||||
DECLARE vSaleFk INTEGER;
|
|
||||||
DECLARE vCur CURSOR FOR
|
|
||||||
SELECT s.id
|
|
||||||
FROM ticket t
|
|
||||||
JOIN client clt ON clt.id = t.clientFk
|
|
||||||
JOIN sale s ON s.ticketFk = t.id
|
|
||||||
JOIN item i ON i.id = s.itemFk
|
|
||||||
JOIN itemType tp ON tp.id = i.typeFk
|
|
||||||
JOIN itemCategory ic ON ic.id = tp.categoryFk
|
|
||||||
LEFT JOIN tmp.coste c ON c.id = s.id
|
|
||||||
WHERE t.shipped >= vDatedFrom AND t.shipped <= vDatedTo
|
|
||||||
AND c.id IS NULL
|
|
||||||
AND clt.isActive != 0
|
|
||||||
AND ic.merchandise != 0
|
|
||||||
GROUP BY s.id;
|
|
||||||
|
|
||||||
DECLARE CONTINUE HANDLER FOR NOT FOUND
|
|
||||||
SET v_done = TRUE;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.coste;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.coste;
|
|
||||||
CREATE TEMPORARY TABLE tmp.coste
|
|
||||||
(primary key (id)) ENGINE = MEMORY
|
|
||||||
SELECT s.id
|
|
||||||
FROM ticket t
|
|
||||||
JOIN client clt ON clt.id = t.clientFk
|
|
||||||
JOIN sale s ON s.ticketFk = t.id
|
|
||||||
JOIN item i ON i.id = s.itemFk
|
|
||||||
JOIN itemType tp ON tp.id = i.typeFk
|
|
||||||
JOIN itemCategory ic ON ic.id = tp.categoryFk
|
|
||||||
JOIN saleComponent sc ON sc.saleFk = s.id
|
|
||||||
JOIN component c ON c.id = sc.componentFk
|
|
||||||
JOIN componentType ct ON ct.id = c.typeFk AND ct.id = 1
|
|
||||||
WHERE t.shipped >= vDatedFrom
|
|
||||||
AND ic.merchandise != 0;
|
|
||||||
|
|
||||||
OPEN vCur;
|
|
||||||
|
|
||||||
l: LOOP
|
|
||||||
SET v_done = FALSE;
|
|
||||||
FETCH vCur INTO vSaleFk;
|
|
||||||
|
|
||||||
IF v_done THEN
|
|
||||||
LEAVE l;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
CALL sale_calculateComponent(vSaleFk, 1);
|
|
||||||
END LOOP;
|
|
||||||
|
|
||||||
CLOSE vCur;
|
|
||||||
DROP TEMPORARY TABLE tmp.coste;
|
|
||||||
END$$
|
|
||||||
|
|
||||||
DELIMITER ;
|
|
||||||
|
|
|
@ -1,162 +0,0 @@
|
||||||
|
|
||||||
USE `edi`;
|
|
||||||
DROP procedure IF EXISTS `ekt_load`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `edi`$$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `ekt_load`(IN `vSelf` INT)
|
|
||||||
BEGIN
|
|
||||||
DECLARE vRef INT;
|
|
||||||
DECLARE vBuy INT;
|
|
||||||
DECLARE vItem INT;
|
|
||||||
DECLARE vQty INT;
|
|
||||||
DECLARE vPackage INT;
|
|
||||||
DECLARE vIsLot BOOLEAN;
|
|
||||||
DECLARE vForceToPacking INT DEFAULT 2;
|
|
||||||
|
|
||||||
-- Carga los datos necesarios del EKT
|
|
||||||
|
|
||||||
SELECT ref, qty, package INTO vRef, vQty, vPackage
|
|
||||||
FROM ekt e
|
|
||||||
LEFT JOIN item i ON e.ref = i.id
|
|
||||||
WHERE e.id = vSelf;
|
|
||||||
|
|
||||||
-- Inserta el cubo si no existe
|
|
||||||
|
|
||||||
IF vPackage = 800
|
|
||||||
THEN
|
|
||||||
SET vPackage = 800 + vQty;
|
|
||||||
|
|
||||||
INSERT IGNORE INTO vn2008.Cubos SET
|
|
||||||
Id_Cubo = vPackage,
|
|
||||||
x = 7200 / vQty,
|
|
||||||
y = 1;
|
|
||||||
ELSE
|
|
||||||
INSERT IGNORE INTO vn2008.Cubos (Id_Cubo, X, Y, Z)
|
|
||||||
SELECT bucket_id, ROUND(x_size/10), ROUND(y_size/10), ROUND(z_size/10)
|
|
||||||
FROM bucket WHERE bucket_id = vPackage;
|
|
||||||
|
|
||||||
IF ROW_COUNT() > 0
|
|
||||||
THEN
|
|
||||||
INSERT INTO vn2008.mail SET
|
|
||||||
`subject` = 'Cubo añadido',
|
|
||||||
`text` = CONCAT('Se ha añadido el cubo: ', vPackage),
|
|
||||||
`to` = 'ekt@verdnatura.es';
|
|
||||||
END IF;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
-- Intenta obtener el artículo en base a los atributos holandeses
|
|
||||||
|
|
||||||
INSERT IGNORE INTO item_track SET
|
|
||||||
item_id = vRef;
|
|
||||||
|
|
||||||
SELECT c.Id_Compra, c.Id_Article INTO vBuy, vItem
|
|
||||||
FROM vn2008.buy_edi e
|
|
||||||
JOIN item_track t ON t.item_id = e.ref
|
|
||||||
LEFT JOIN vn2008.buy_edi l ON l.ref = e.ref
|
|
||||||
LEFT JOIN vn2008.Compres c ON c.buy_edi_id = l.id
|
|
||||||
JOIN vn2008.config cfg
|
|
||||||
WHERE e.id = vSelf
|
|
||||||
AND l.id != vSelf
|
|
||||||
AND c.Id_Article != cfg.generic_item
|
|
||||||
AND IF(t.s1, l.s1 = e.s1, TRUE)
|
|
||||||
AND IF(t.s2, l.s2 = e.s2, TRUE)
|
|
||||||
AND IF(t.s3, l.s3 = e.s3, TRUE)
|
|
||||||
AND IF(t.s4, l.s4 = e.s4, TRUE)
|
|
||||||
AND IF(t.s5, l.s5 = e.s5, TRUE)
|
|
||||||
AND IF(t.s6, l.s6 = e.s6, TRUE)
|
|
||||||
AND IF(t.kop, l.kop = e.kop, TRUE)
|
|
||||||
AND IF(t.pac, l.pac = e.pac, TRUE)
|
|
||||||
AND IF(t.cat, l.cat = e.cat, TRUE)
|
|
||||||
AND IF(t.ori, l.ori = e.ori, TRUE)
|
|
||||||
AND IF(t.pro, l.pro = e.pro, TRUE)
|
|
||||||
AND IF(t.sub, l.sub = e.sub, TRUE)
|
|
||||||
AND IF(t.package, l.package = e.package, TRUE)
|
|
||||||
AND c.Id_Article < 170000
|
|
||||||
ORDER BY l.now DESC, c.Id_Compra ASC LIMIT 1;
|
|
||||||
|
|
||||||
-- Determina si el articulo se vende por lotes
|
|
||||||
|
|
||||||
IF vItem
|
|
||||||
THEN
|
|
||||||
SELECT COUNT(*) > 0 INTO vIsLot
|
|
||||||
FROM vn2008.Articles a
|
|
||||||
LEFT JOIN vn2008.Tipos t ON t.tipo_id = a.tipo_id
|
|
||||||
WHERE a.Id_Article = vItem
|
|
||||||
AND t.`transaction`;
|
|
||||||
|
|
||||||
-- Si el articulo se vende por lotes se inserta un nuevo artículo
|
|
||||||
|
|
||||||
IF vIsLot
|
|
||||||
THEN
|
|
||||||
INSERT INTO vn2008.Articles (
|
|
||||||
Article
|
|
||||||
,Medida
|
|
||||||
,Categoria
|
|
||||||
,Id_Origen
|
|
||||||
,iva_group_id
|
|
||||||
,Foto
|
|
||||||
,Color
|
|
||||||
,Codintrastat
|
|
||||||
,tipo_id
|
|
||||||
,Tallos
|
|
||||||
)
|
|
||||||
SELECT
|
|
||||||
i.`name`
|
|
||||||
,IFNULL(e.s1, e.pac)
|
|
||||||
,e.cat
|
|
||||||
,IFNULL(o.id, 17)
|
|
||||||
,IFNULL(a.iva_group_id, 1)
|
|
||||||
,a.Foto
|
|
||||||
,a.Color
|
|
||||||
,a.Codintrastat
|
|
||||||
,IFNULL(a.tipo_id, 10)
|
|
||||||
,IF(a.tipo_id = 15, 0, 1)
|
|
||||||
FROM vn2008.buy_edi e
|
|
||||||
LEFT JOIN item i ON i.id = e.ref
|
|
||||||
LEFT JOIN vn2008.Origen o ON o.Abreviatura = e.ori
|
|
||||||
LEFT JOIN vn2008.Articles a ON a.Id_Article = vItem
|
|
||||||
WHERE e.id = vSelf;
|
|
||||||
|
|
||||||
SET vItem = LAST_INSERT_ID();
|
|
||||||
END IF;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
-- Inserta la compra asociada al EKT
|
|
||||||
|
|
||||||
INSERT INTO vn2008.Compres
|
|
||||||
(
|
|
||||||
Id_Entrada
|
|
||||||
,buy_edi_id
|
|
||||||
,Costefijo
|
|
||||||
,Id_Article
|
|
||||||
,`grouping`
|
|
||||||
,caja
|
|
||||||
,Packing
|
|
||||||
,Cantidad
|
|
||||||
,Productor
|
|
||||||
,Etiquetas
|
|
||||||
,Id_Cubo
|
|
||||||
,`weight`
|
|
||||||
)
|
|
||||||
SELECT
|
|
||||||
cfg.edi_entry
|
|
||||||
,vSelf
|
|
||||||
,(@t := IF(a.Tallos, a.Tallos, 1)) * e.pri
|
|
||||||
,IFNULL(vItem, cfg.generic_item)
|
|
||||||
,IFNULL(c.`grouping`, e.pac)
|
|
||||||
,vForceToPacking
|
|
||||||
,@pac := e.pac / @t
|
|
||||||
,@pac * e.qty
|
|
||||||
,s.company_name
|
|
||||||
,e.qty
|
|
||||||
,IFNULL(c.Id_Cubo, e.package)
|
|
||||||
,a.density * (vn.item_getVolume(a.Id_Article, IFNULL(c.Id_Cubo, e.package)) / 1000000)
|
|
||||||
FROM vn2008.buy_edi e
|
|
||||||
LEFT JOIN vn2008.Compres c ON c.Id_Compra = vBuy
|
|
||||||
LEFT JOIN vn2008.Articles a ON a.Id_Article = c.Id_Article
|
|
||||||
LEFT JOIN supplier s ON e.pro = s.supplier_id
|
|
||||||
JOIN vn2008.config cfg
|
|
||||||
WHERE e.id = vSelf
|
|
||||||
LIMIT 1;
|
|
||||||
END
|
|
|
@ -1,130 +0,0 @@
|
||||||
DROP procedure IF EXISTS `vn`.`item_getBalance`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `vn`$$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `item_getBalance`(IN vItemId INT, IN vWarehouse INT)
|
|
||||||
BEGIN
|
|
||||||
DECLARE vDateInventory DATETIME;
|
|
||||||
DECLARE vCurdate DATE DEFAULT CURDATE();
|
|
||||||
DECLARE vDayEnd DATETIME DEFAULT util.dayEnd(vCurdate);
|
|
||||||
|
|
||||||
SELECT inventoried INTO vDateInventory FROM config;
|
|
||||||
SET @a = 0;
|
|
||||||
SET @currentLineFk = 0;
|
|
||||||
SET @shipped = '';
|
|
||||||
|
|
||||||
SELECT DATE(@shipped:= shipped) shipped,
|
|
||||||
alertLevel,
|
|
||||||
stateName,
|
|
||||||
origin,
|
|
||||||
reference,
|
|
||||||
clientFk,
|
|
||||||
name,
|
|
||||||
`in`,
|
|
||||||
`out`,
|
|
||||||
@a := @a + IFNULL(`in`,0) - IFNULL(`out`,0) as balance,
|
|
||||||
@currentLineFk := IF (@shipped < CURDATE()
|
|
||||||
OR (@shipped = CURDATE() AND (isPicked OR alertLevel >= 2)),
|
|
||||||
lineFk,@currentLineFk) lastPreparedLineFk,
|
|
||||||
isTicket,
|
|
||||||
lineFk,isPicked
|
|
||||||
FROM
|
|
||||||
( SELECT tr.landed as shipped,
|
|
||||||
b.quantity as `in`,
|
|
||||||
NULL as `out`,
|
|
||||||
al.alertLevel as alertLevel,
|
|
||||||
st.name AS stateName,
|
|
||||||
s.name as name,
|
|
||||||
e.ref as reference,
|
|
||||||
e.id as origin,
|
|
||||||
s.id as clientFk,
|
|
||||||
IF(al.alertLevel = 3, TRUE, FALSE) isPicked,
|
|
||||||
FALSE AS isTicket,
|
|
||||||
b.id lineFk,
|
|
||||||
NULL `order`
|
|
||||||
FROM buy b
|
|
||||||
JOIN entry e ON e.id = b.entryFk
|
|
||||||
JOIN travel tr ON tr.id = e.travelFk
|
|
||||||
JOIN supplier s ON s.id = e.supplierFk
|
|
||||||
JOIN alertLevel al ON al.alertLevel =
|
|
||||||
CASE
|
|
||||||
WHEN tr.shipped < CURDATE() THEN 3
|
|
||||||
WHEN tr.shipped = CURDATE() AND tr.isReceived = TRUE THEN 3
|
|
||||||
ELSE 0
|
|
||||||
END
|
|
||||||
JOIN state st ON st.code = al.code
|
|
||||||
WHERE tr.landed >= vDateInventory
|
|
||||||
AND vWarehouse = tr.warehouseInFk
|
|
||||||
AND b.itemFk = vItemId
|
|
||||||
AND e.isInventory = FALSE
|
|
||||||
AND e.isRaid = FALSE
|
|
||||||
UNION ALL
|
|
||||||
|
|
||||||
SELECT tr.shipped,
|
|
||||||
NULL as `in`,
|
|
||||||
b.quantity as `out`,
|
|
||||||
al.alertLevel as alertLevel,
|
|
||||||
st.name AS stateName,
|
|
||||||
s.name as name,
|
|
||||||
e.ref as reference,
|
|
||||||
e.id as origin,
|
|
||||||
s.id as clientFk,
|
|
||||||
IF(al.alertLevel = 3, TRUE, FALSE) isPicked,
|
|
||||||
FALSE AS isTicket,
|
|
||||||
b.id,
|
|
||||||
NULL `order`
|
|
||||||
FROM buy b
|
|
||||||
JOIN entry e ON e.id = b.entryFk
|
|
||||||
JOIN travel tr ON tr.id = e.travelFk
|
|
||||||
JOIN warehouse w ON w.id = tr.warehouseOutFk
|
|
||||||
JOIN supplier s ON s.id = e.supplierFk
|
|
||||||
JOIN alertLevel al ON al.alertLevel =
|
|
||||||
CASE
|
|
||||||
WHEN tr.shipped < CURDATE() THEN 3
|
|
||||||
WHEN tr.shipped = CURDATE() AND tr.isReceived = TRUE THEN 3
|
|
||||||
ELSE 0
|
|
||||||
END
|
|
||||||
JOIN state st ON st.code = al.code
|
|
||||||
WHERE tr.shipped >= vDateInventory
|
|
||||||
AND vWarehouse =tr.warehouseOutFk
|
|
||||||
AND s.id <> 4
|
|
||||||
AND b.itemFk = vItemId
|
|
||||||
AND e.isInventory = FALSE
|
|
||||||
AND w.isFeedStock = FALSE
|
|
||||||
AND e.isRaid = FALSE
|
|
||||||
UNION ALL
|
|
||||||
|
|
||||||
SELECT DATE(t.shipped),
|
|
||||||
NULL as `in`,
|
|
||||||
s.quantity as `out`,
|
|
||||||
al.alertLevel as alertLevel,
|
|
||||||
st.name AS stateName,
|
|
||||||
t.nickname as name,
|
|
||||||
t.refFk as reference,
|
|
||||||
t.id as origin,
|
|
||||||
t.clientFk,
|
|
||||||
stk.id as isPicked,
|
|
||||||
TRUE as isTicket,
|
|
||||||
s.id,
|
|
||||||
st.`order`
|
|
||||||
FROM sale s
|
|
||||||
JOIN ticket t ON t.id = s.ticketFk
|
|
||||||
LEFT JOIN ticketState ts ON ts.ticket = t.id
|
|
||||||
LEFT JOIN state st ON st.code = ts.code
|
|
||||||
JOIN client c ON c.id = t.clientFk
|
|
||||||
JOIN alertLevel al ON al.alertLevel =
|
|
||||||
CASE
|
|
||||||
WHEN t.shipped < curdate() THEN 3
|
|
||||||
WHEN t.shipped > util.dayEnd(curdate()) THEN 0
|
|
||||||
ELSE IFNULL(ts.alertLevel, 0)
|
|
||||||
END
|
|
||||||
LEFT JOIN state stPrep ON stPrep.`code` = 'PREPARED'
|
|
||||||
LEFT JOIN saleTracking stk ON stk.saleFk = s.id AND stk.stateFk = stPrep.id
|
|
||||||
WHERE t.shipped >= vDateInventory
|
|
||||||
AND s.itemFk = vItemId
|
|
||||||
AND vWarehouse =t.warehouseFk
|
|
||||||
ORDER BY shipped, alertLevel DESC, isTicket, `order` DESC, isPicked DESC, `in` DESC, `out` DESC
|
|
||||||
) AS itemDiary;
|
|
||||||
|
|
||||||
END$$
|
|
||||||
delimiter ;
|
|
|
@ -1,2 +0,0 @@
|
||||||
USE `vn`;
|
|
||||||
DROP procedure IF EXISTS `ticketCalculateSaleForcePrice2`;
|
|
|
@ -1,2 +0,0 @@
|
||||||
USE `vn`;
|
|
||||||
DROP procedure IF EXISTS `ticketCalculateSaleForcePrice`;
|
|
|
@ -1,68 +0,0 @@
|
||||||
USE `vn`;
|
|
||||||
DROP procedure IF EXISTS `ticketCalculateSale`;
|
|
||||||
DROP procedure IF EXISTS `ticketCalculateSale__`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `vn`$$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `ticketCalculateSale__`(IN vSale BIGINT)
|
|
||||||
proc: BEGIN
|
|
||||||
-- OBSOLETO USAR: sale_calculateComponent(vSale, NULL)
|
|
||||||
DECLARE vShipped DATE;
|
|
||||||
DECLARE vWarehouseFk SMALLINT;
|
|
||||||
DECLARE vAgencyModeFk INT;
|
|
||||||
DECLARE vAddressFk INT;
|
|
||||||
DECLARE vTicket BIGINT;
|
|
||||||
DECLARE vItem BIGINT;
|
|
||||||
DECLARE vLanded DATE;
|
|
||||||
DECLARE vTicketFree BOOLEAN DEFAULT TRUE;
|
|
||||||
DECLARE vZoneFk INTEGER;
|
|
||||||
|
|
||||||
SELECT NOT (t.refFk IS NOT NULL OR ts.alertLevel > 0) OR s.price = 0, s.ticketFk, s.itemFk , t.zoneFk
|
|
||||||
INTO vTicketFree, vTicket, vItem, vZoneFk
|
|
||||||
FROM vn.ticket t
|
|
||||||
JOIN vn.sale s ON s.ticketFk = t.id
|
|
||||||
LEFT JOIN vn.ticketState ts ON ts.ticketFk = t.id
|
|
||||||
WHERE s.id = vSale
|
|
||||||
LIMIT 1;
|
|
||||||
|
|
||||||
SELECT t.warehouseFk, DATE(t.shipped), t.addressFk, t.agencyModeFk, t.landed
|
|
||||||
INTO vWarehouseFk, vShipped, vAddressFk, vAgencyModeFk, vLanded
|
|
||||||
FROM agencyMode a
|
|
||||||
JOIN ticket t ON t.agencyModeFk = a.id
|
|
||||||
WHERE t.id = vTicket;
|
|
||||||
|
|
||||||
IF IFNULL(vZoneFk,0) = 0 THEN
|
|
||||||
CALL util.throw('ticket dont have zone');
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
CALL buyUltimate (vWarehouseFk, vShipped);
|
|
||||||
|
|
||||||
DELETE FROM tmp.buyUltimate WHERE itemFk != vItem;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot;
|
|
||||||
CREATE TEMPORARY TABLE tmp.ticketLot
|
|
||||||
SELECT vWarehouseFk warehouseFk, NULL available, vItem itemFk, buyFk, vZoneFk zoneFk
|
|
||||||
FROM tmp.buyUltimate
|
|
||||||
WHERE itemFk = vItem;
|
|
||||||
|
|
||||||
CALL vn.catalog_componentCalculate;
|
|
||||||
CALL catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk);
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.sale;
|
|
||||||
CREATE TEMPORARY TABLE tmp.sale
|
|
||||||
(PRIMARY KEY (saleFk)) ENGINE = MEMORY
|
|
||||||
SELECT vSale saleFk,vWarehouseFk warehouseFk;
|
|
||||||
|
|
||||||
CALL ticketComponentUpdateSale(IF(vTicketFree,1,6));
|
|
||||||
|
|
||||||
INSERT INTO vn.ticketLog (originFk, userFk, `action`, description)
|
|
||||||
VALUES (vTicket, account.userGetId(), 'update', CONCAT('Bionizo linea id ', vSale));
|
|
||||||
|
|
||||||
CALL catalog_componentPurge();
|
|
||||||
DROP TEMPORARY TABLE tmp.buyUltimate;
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.sale;
|
|
||||||
|
|
||||||
END$$
|
|
||||||
|
|
||||||
DELIMITER ;
|
|
||||||
|
|
|
@ -1,83 +0,0 @@
|
||||||
USE `vn`;
|
|
||||||
DROP procedure IF EXISTS `vn`.`ticket_componentUpdate`;
|
|
||||||
DROP procedure IF EXISTS `vn`.`ticket_componentUpdate__`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `vn`$$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `ticket_componentUpdate__`(
|
|
||||||
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
|
|
||||||
DECLARE vPrice DECIMAL(10,2);
|
|
||||||
DECLARE vBonus DECIMAL(10,2);
|
|
||||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
|
||||||
BEGIN
|
|
||||||
ROLLBACK;
|
|
||||||
RESIGNAL;
|
|
||||||
END;
|
|
||||||
|
|
||||||
START TRANSACTION;
|
|
||||||
|
|
||||||
IF (SELECT addressFk FROM ticket WHERE id = vTicketFk) <> vAddressFk THEN
|
|
||||||
|
|
||||||
UPDATE ticket t
|
|
||||||
JOIN address a ON a.id = vAddressFk
|
|
||||||
SET t.nickname = a.nickname
|
|
||||||
WHERE t.id = vTicketFk;
|
|
||||||
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
CALL vn.zone_getShippedWarehouse(vlanded, vAddressFk, vAgencyModeFk);
|
|
||||||
|
|
||||||
SELECT zoneFk, price, bonus INTO vZoneFk, vPrice, vBonus
|
|
||||||
FROM tmp.zoneGetShipped
|
|
||||||
WHERE shipped = vShipped AND warehouseFk = vWarehouseFk LIMIT 1;
|
|
||||||
|
|
||||||
UPDATE ticket t
|
|
||||||
SET
|
|
||||||
t.clientFk = vClientFk,
|
|
||||||
t.agencyModeFk = vAgencyModeFk,
|
|
||||||
t.addressFk = vAddressFk,
|
|
||||||
t.zoneFk = vZoneFk,
|
|
||||||
t.zonePrice = vPrice,
|
|
||||||
t.zoneBonus = vBonus,
|
|
||||||
t.warehouseFk = vWarehouseFk,
|
|
||||||
t.companyFk = vCompanyFk,
|
|
||||||
t.landed = vLanded,
|
|
||||||
t.shipped = vShipped,
|
|
||||||
t.isDeleted = vIsDeleted
|
|
||||||
WHERE
|
|
||||||
t.id = vTicketFk;
|
|
||||||
|
|
||||||
IF vHasToBeUnrouted THEN
|
|
||||||
UPDATE ticket t SET t.routeFk = NULL
|
|
||||||
WHERE t.id = vTicketFk;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
IF vOption <> 8 THEN
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.sale;
|
|
||||||
CREATE TEMPORARY TABLE tmp.sale
|
|
||||||
(PRIMARY KEY (saleFk))
|
|
||||||
ENGINE = MEMORY
|
|
||||||
SELECT id AS saleFk, vWarehouseFk warehouseFk
|
|
||||||
FROM sale s WHERE s.ticketFk = vTicketFk;
|
|
||||||
|
|
||||||
CALL ticketComponentUpdateSale (vOption);
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tmp.sale;
|
|
||||||
END IF;
|
|
||||||
COMMIT;
|
|
||||||
END$$
|
|
||||||
|
|
||||||
DELIMITER ;
|
|
||||||
;
|
|
|
@ -1,80 +0,0 @@
|
||||||
USE `vn`;
|
|
||||||
DROP procedure IF EXISTS `zone_upcomingDeliveries`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `vn`$$
|
|
||||||
CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_upcomingDeliveries`()
|
|
||||||
BEGIN
|
|
||||||
DECLARE vForwardDays INT;
|
|
||||||
|
|
||||||
SELECT forwardDays INTO vForwardDays FROM zoneConfig;
|
|
||||||
CALL util.time_createTable(CURDATE(), DATE_ADD(CURDATE(), INTERVAL vForwardDays DAY));
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tLandings;
|
|
||||||
CREATE TEMPORARY TABLE tLandings
|
|
||||||
(INDEX (eventFk))
|
|
||||||
ENGINE = MEMORY
|
|
||||||
SELECT e.id eventFk,
|
|
||||||
@travelingDays := IFNULL(e.travelingDays, z.travelingDays) travelingDays,
|
|
||||||
TIMESTAMPADD(DAY, @travelingDays, ti.dated) landed,
|
|
||||||
ti.dated shipped
|
|
||||||
FROM zone z
|
|
||||||
JOIN zoneEvent e ON e.zoneFk = z.id
|
|
||||||
JOIN tmp.time ti ON ti.dated BETWEEN curdate() AND TIMESTAMPADD(DAY, vForwardDays, curdate());
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.zoneOption;
|
|
||||||
CREATE TEMPORARY TABLE tmp.zoneOption
|
|
||||||
ENGINE = MEMORY
|
|
||||||
SELECT *
|
|
||||||
FROM (
|
|
||||||
SELECT z.id zoneFk,
|
|
||||||
TIME(IFNULL(e.`hour`, z.`hour`)) `hour`,
|
|
||||||
l.travelingDays,
|
|
||||||
IFNULL(e.price, z.price) price,
|
|
||||||
IFNULL(e.bonus, z.bonus) bonus,
|
|
||||||
l.landed,
|
|
||||||
l.shipped
|
|
||||||
FROM zone z
|
|
||||||
JOIN zoneEvent e ON e.zoneFk = z.id
|
|
||||||
JOIN tLandings l ON l.eventFk = e.id
|
|
||||||
WHERE (
|
|
||||||
e.`type` = 'day'
|
|
||||||
AND e.`dated` = l.landed
|
|
||||||
) OR (
|
|
||||||
e.`type` != 'day'
|
|
||||||
AND e.weekDays & (1 << WEEKDAY(l.landed))
|
|
||||||
AND (e.`started` IS NULL OR l.landed >= e.`started`)
|
|
||||||
AND (e.`ended` IS NULL OR l.landed <= e.`ended`)
|
|
||||||
)
|
|
||||||
ORDER BY
|
|
||||||
zoneFk,
|
|
||||||
CASE
|
|
||||||
WHEN e.`type` = 'day'
|
|
||||||
THEN 1
|
|
||||||
WHEN e.`type` = 'range'
|
|
||||||
THEN 2
|
|
||||||
ELSE 3
|
|
||||||
END
|
|
||||||
) t
|
|
||||||
GROUP BY zoneFk, landed;
|
|
||||||
|
|
||||||
DELETE t FROM tmp.zoneOption t
|
|
||||||
JOIN zoneExclusion e
|
|
||||||
ON e.zoneFk = t.zoneFk AND e.`dated` = t.landed;
|
|
||||||
|
|
||||||
SELECT MAX(zo.`hour`) `hour`, zg.`name`, zo.shipped
|
|
||||||
FROM tmp.zoneOption zo
|
|
||||||
JOIN `zone` z ON z.id = zo.zoneFk
|
|
||||||
JOIN agencyMode am ON am.id = z.agencyModeFk
|
|
||||||
JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk
|
|
||||||
JOIN zoneIncluded zi ON zi.zoneFk = z.id
|
|
||||||
JOIN zoneGeo zg ON zg.id = zi.geoFk AND zg.type = 'province'
|
|
||||||
WHERE dm.code = 'DELIVERY'
|
|
||||||
GROUP BY shipped, zg.`name`
|
|
||||||
ORDER BY shipped, zg.`name`;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tmp.time, tLandings;
|
|
||||||
END$$
|
|
||||||
|
|
||||||
DELIMITER ;
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
UPDATE `salix`.`ACL` SET `accessType`='WRITE' WHERE `id`='213';
|
|
||||||
|
|
||||||
INSERT IGNORE INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('CustomsAgent', '*', '*', 'ALLOW', 'ROLE', 'employee');
|
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
ALTER TABLE `vn`.`route`
|
|
||||||
DROP FOREIGN KEY `fk_route_1`;
|
|
||||||
ALTER TABLE `vn`.`route`
|
|
||||||
ADD CONSTRAINT `fk_route_1`
|
|
||||||
FOREIGN KEY (`zoneFk`)
|
|
||||||
REFERENCES `vn`.`zone` (`id`)
|
|
||||||
ON DELETE SET NULL
|
|
||||||
ON UPDATE CASCADE;
|
|
|
@ -1,99 +0,0 @@
|
||||||
|
|
||||||
DROP procedure IF EXISTS `vn`.`sale_calculateComponent`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`sale_calculateComponent`(vSale INT, vOption INT)
|
|
||||||
proc: BEGIN
|
|
||||||
/**
|
|
||||||
* Actualiza los componentes
|
|
||||||
*
|
|
||||||
* @param vSale Delivery date
|
|
||||||
* @param vOption indica en que componente pone el descuadre, NULL en casos habituales
|
|
||||||
*/
|
|
||||||
DECLARE vShipped DATE;
|
|
||||||
DECLARE vWarehouseFk SMALLINT;
|
|
||||||
DECLARE vAgencyModeFk INT;
|
|
||||||
DECLARE vAddressFk INT;
|
|
||||||
DECLARE vTicketFk BIGINT;
|
|
||||||
DECLARE vItemFk BIGINT;
|
|
||||||
DECLARE vLanded DATE;
|
|
||||||
DECLARE vIsEditable BOOLEAN;
|
|
||||||
DECLARE vZoneFk INTEGER;
|
|
||||||
|
|
||||||
SELECT t.refFk IS NULL AND (IFNULL(ts.alertLevel, 0) = 0 OR s.price = 0),
|
|
||||||
s.ticketFk,
|
|
||||||
s.itemFk ,
|
|
||||||
t.zoneFk,
|
|
||||||
t.warehouseFk,
|
|
||||||
t.shipped,
|
|
||||||
t.addressFk,
|
|
||||||
t.agencyModeFk,
|
|
||||||
t.landed
|
|
||||||
INTO vIsEditable,
|
|
||||||
vTicketFk,
|
|
||||||
vItemFk,
|
|
||||||
vZoneFk,
|
|
||||||
vWarehouseFk,
|
|
||||||
vShipped,
|
|
||||||
vAddressFk,
|
|
||||||
vAgencyModeFk,
|
|
||||||
vLanded
|
|
||||||
FROM ticket t
|
|
||||||
JOIN sale s ON s.ticketFk = t.id
|
|
||||||
LEFT JOIN ticketState ts ON ts.ticketFk = t.id
|
|
||||||
WHERE s.id = vSale;
|
|
||||||
|
|
||||||
IF vLanded IS NULL OR vZoneFk IS NULL THEN
|
|
||||||
|
|
||||||
CALL zone_getLanded(vShipped, vAddressFk, vAgencyModeFk, vWarehouseFk, TRUE);
|
|
||||||
|
|
||||||
IF (SELECT COUNT(*) FROM tmp.zoneGetLanded LIMIT 1) = 0 THEN
|
|
||||||
CALL util.throw('There is no zone for these parameters');
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
UPDATE ticket t
|
|
||||||
SET t.landed = (SELECT landed FROM tmp.zoneGetLanded LIMIT 1)
|
|
||||||
WHERE t.id = vTicketFk AND t.landed IS NULL;
|
|
||||||
|
|
||||||
IF vZoneFk IS NULL THEN
|
|
||||||
SELECT zoneFk INTO vZoneFk FROM tmp.zoneGetLanded LIMIT 1;
|
|
||||||
UPDATE ticket t
|
|
||||||
SET t.zoneFk = vZoneFk
|
|
||||||
WHERE t.id = vTicketFk AND t.zoneFk IS NULL;
|
|
||||||
END IF;
|
|
||||||
DROP TEMPORARY TABLE tmp.zoneGetLanded;
|
|
||||||
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
-- rellena la tabla buyUltimate con la ultima compra
|
|
||||||
CALL buyUltimate (vWarehouseFk, vShipped);
|
|
||||||
|
|
||||||
DELETE FROM tmp.buyUltimate WHERE itemFk != vItemFk;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot;
|
|
||||||
CREATE TEMPORARY TABLE tmp.ticketLot
|
|
||||||
SELECT vWarehouseFk warehouseFk, NULL available, vItemFk itemFk, buyFk, vZoneFk zoneFk
|
|
||||||
FROM tmp.buyUltimate
|
|
||||||
WHERE itemFk = vItemFk;
|
|
||||||
|
|
||||||
CALL catalog_componentPrepare();
|
|
||||||
CALL catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk);
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.sale;
|
|
||||||
CREATE TEMPORARY TABLE tmp.sale
|
|
||||||
(PRIMARY KEY (saleFk)) ENGINE = MEMORY
|
|
||||||
SELECT vSale saleFk,vWarehouseFk warehouseFk;
|
|
||||||
|
|
||||||
IF vOption IS NULL THEN
|
|
||||||
SET vOption = IF(vIsEditable, 1, 6);
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
CALL ticketComponentUpdateSale(vOption);
|
|
||||||
CALL catalog_componentPurge();
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tmp.buyUltimate;
|
|
||||||
DROP TEMPORARY TABLE tmp.sale;
|
|
||||||
END$$
|
|
||||||
|
|
||||||
DELIMITER ;
|
|
||||||
|
|
|
@ -1,93 +0,0 @@
|
||||||
USE `vn`;
|
|
||||||
DROP procedure IF EXISTS `ticketCalculateClon`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `vn`$$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `ticketCalculateClon`(IN vTicketNew INT, vTicketOld INT)
|
|
||||||
BEGIN
|
|
||||||
/*
|
|
||||||
* Recalcula los componentes un ticket clonado,
|
|
||||||
* las lineas a precio cero fuerza para que tengan precio, el resto lo respeta
|
|
||||||
* @param vTicketNew nuevo ticket clonado
|
|
||||||
* @param vTicketOld icket original, a partir del qual se clonara el nuevo
|
|
||||||
*/
|
|
||||||
DECLARE vShipped DATE;
|
|
||||||
DECLARE vClient INT;
|
|
||||||
DECLARE vWarehouse SMALLINT;
|
|
||||||
DECLARE vAgencyMode INT;
|
|
||||||
DECLARE vAddress INT;
|
|
||||||
DECLARE vLanded DATE;
|
|
||||||
DECLARE vAgency INT;
|
|
||||||
DECLARE vZoneFk 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, t.zoneFk
|
|
||||||
INTO vClient, vWarehouse, vShipped, vAddress, vAgencyMode, vLanded, vAgency, vZoneFk
|
|
||||||
FROM agencyMode a
|
|
||||||
JOIN ticket t ON t.agencyModeFk = a.id
|
|
||||||
WHERE t.id = vTicketNew;
|
|
||||||
|
|
||||||
IF vLanded IS NULL THEN
|
|
||||||
CALL zone_getLanded(vShipped, vAddress, vAgency, vWarehouse, TRUE);
|
|
||||||
UPDATE ticket t
|
|
||||||
JOIN tmp.zoneGetLanded zgl ON t.warehouseFk = zgl.warehouseFk
|
|
||||||
SET t.landed = zgl.landed,
|
|
||||||
t.zone = zgl.zoneFk
|
|
||||||
WHERE t.id = vTicketNew;
|
|
||||||
|
|
||||||
SELECT zoneFk INTO vZoneFk FROM tmp.zoneGetLanded LIMIT 1;
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.zoneGetLanded;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
-- rellena la tabla tmp.buyUltimate con la ultima compra
|
|
||||||
CALL buyUltimate(vWarehouse, vShipped);
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot;
|
|
||||||
CREATE TEMPORARY TABLE tmp.ticketLot
|
|
||||||
SELECT vWarehouse warehouseFk, NULL available, s.itemFk, bu.buyFk, vZoneFk zoneFk
|
|
||||||
FROM sale s
|
|
||||||
LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk
|
|
||||||
WHERE s.ticketFk = vTicketOld GROUP BY s.itemFk;
|
|
||||||
|
|
||||||
CALL catalog_componentPrepare();
|
|
||||||
CALL catalog_componentCalculate(vZoneFk, vAddress, vAgencyMode, vWarehouse);
|
|
||||||
|
|
||||||
-- 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);
|
|
||||||
|
|
||||||
-- Log
|
|
||||||
CALL `logAdd`(vTicketNew, 'update', ' ticket' , 'Bioniza Ticket');
|
|
||||||
|
|
||||||
-- Limpieza
|
|
||||||
CALL catalog_componentPurge();
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS
|
|
||||||
tmp.buyUltimate,
|
|
||||||
tmp.sale,
|
|
||||||
tmp.zoneGetLanded;
|
|
||||||
|
|
||||||
END$$
|
|
||||||
|
|
||||||
DELIMITER ;
|
|
||||||
|
|
|
@ -1,132 +0,0 @@
|
||||||
USE `vn`;
|
|
||||||
DROP procedure IF EXISTS `ticket_cloneWeekly`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `vn`$$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `ticket_cloneWeekly`(IN vWeek INT)
|
|
||||||
BEGIN
|
|
||||||
DECLARE vIsDone BOOL;
|
|
||||||
DECLARE vLanding DATE;
|
|
||||||
DECLARE vShipment DATE;
|
|
||||||
DECLARE vWarehouse INT;
|
|
||||||
DECLARE vTicket INT;
|
|
||||||
DECLARE vWeekDay INT;
|
|
||||||
DECLARE vClient INT;
|
|
||||||
DECLARE vEmpresa INT;
|
|
||||||
DECLARE vAddressFk INT;
|
|
||||||
DECLARE vAgencyModeFk INT;
|
|
||||||
DECLARE vNewTicket INT;
|
|
||||||
DECLARE vYear INT;
|
|
||||||
|
|
||||||
DECLARE rsTicket CURSOR FOR
|
|
||||||
SELECT tw.ticketFk, weekDay, t.clientFk, t.warehouseFk, t.companyFk, t.addressFk, tw.agencyModeFk
|
|
||||||
FROM ticketWeekly tw
|
|
||||||
JOIN ticket t ON tt.ticketFk = t.id;
|
|
||||||
|
|
||||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vIsDone = TRUE;
|
|
||||||
|
|
||||||
SET vYear = YEAR(CURDATE()) + IF(vWeek < WEEK(CURDATE()),1, 0);
|
|
||||||
|
|
||||||
OPEN rsTicket;
|
|
||||||
|
|
||||||
myLoop: LOOP
|
|
||||||
BEGIN
|
|
||||||
DECLARE vError TEXT;
|
|
||||||
DECLARE vSalesPersonEmail VARCHAR(150);
|
|
||||||
DECLARE vMailSent BOOL;
|
|
||||||
DECLARE vSubject VARCHAR(150);
|
|
||||||
DECLARE vMessage TEXT;
|
|
||||||
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
|
|
||||||
BEGIN
|
|
||||||
GET DIAGNOSTICS CONDITION 1
|
|
||||||
vError = MESSAGE_TEXT;
|
|
||||||
END;
|
|
||||||
|
|
||||||
SET vIsDone = FALSE;
|
|
||||||
FETCH rsTicket INTO vTicket, vWeekDay, vClient, vWarehouse, vEmpresa, vAddressFk, vAgencyModeFk;
|
|
||||||
|
|
||||||
IF vIsDone THEN
|
|
||||||
|
|
||||||
LEAVE myLoop;
|
|
||||||
END IF;
|
|
||||||
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 vn.ticket tOrig
|
|
||||||
JOIN vn.sale saleOrig ON tOrig.id = saleOrig.ticketFk
|
|
||||||
JOIN vn.saleCloned sc ON sc.saleOriginalFk = saleOrig.id
|
|
||||||
JOIN vn.sale saleClon ON saleClon.id = sc.saleClonedFk
|
|
||||||
JOIN vn.ticket tClon ON tClon.id = saleClon.ticketFk
|
|
||||||
WHERE tOrig.id = vTicket AND DATE(tClon.shipped) = vShipment) > 0
|
|
||||||
THEN
|
|
||||||
ITERATE myLoop;
|
|
||||||
END IF;
|
|
||||||
CALL vn.zone_getLanded(vShipment, vAddressFk, vAgencyModeFk, vWarehouse, TRUE);
|
|
||||||
|
|
||||||
SELECT landed INTO vLanding from tmp.zoneGetLanded LIMIT 1;
|
|
||||||
|
|
||||||
CALL vn.ticketCreateWithoutZone(vClient, vShipment, vWarehouse, vEmpresa, vAddressFk, vAgencyModeFk, NULL, vLanding, account.userGetId(), vNewTicket);
|
|
||||||
|
|
||||||
IF (vLanding IS NULL) THEN
|
|
||||||
|
|
||||||
SELECT e.email INTO vSalesPersonEmail
|
|
||||||
FROM vn.client c
|
|
||||||
JOIN vn.worker sp ON sp.id = c.salesPersonFk
|
|
||||||
JOIN account.emailUser e ON e.userFk = sp.userFk
|
|
||||||
WHERE c.id = vClient;
|
|
||||||
|
|
||||||
SET vSubject = CONCAT('Turnos - No se ha podido clonar correctamente el ticket ', vTicket,
|
|
||||||
' para el dia: ', vShipment);
|
|
||||||
SET vMessage = CONCAT('No se ha podido clonar el ticket ', vTicket,
|
|
||||||
' para el dia: ', vShipment,
|
|
||||||
' porque no hay una zona de envío disponible. Se ha creado el ticket: ', vNewTicket,
|
|
||||||
' pero ha que revisar las fechas y la agencia');
|
|
||||||
|
|
||||||
SELECT COUNT(*) INTO vMailSent
|
|
||||||
FROM vn.mail
|
|
||||||
WHERE sender = vSalesPersonEmail
|
|
||||||
AND subject = vSubject;
|
|
||||||
|
|
||||||
IF NOT vMailSent THEN
|
|
||||||
INSERT INTO vn.mail (sender,`subject`,body)
|
|
||||||
VALUES (vSalesPersonEmail, vSubject, vMessage);
|
|
||||||
END IF;
|
|
||||||
CALL vn.ticketStateUpdate (vNewTicket, 'FIXING');
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
INSERT INTO vn.sale (ticketFk, itemFk, concept, quantity, price, discount, priceFixed, isPriceFixed)
|
|
||||||
SELECT vNewTicket, saleOrig.itemFk , saleOrig.concept , saleOrig.quantity, saleOrig.price , saleOrig.discount, saleOrig.priceFixed, saleOrig.isPriceFixed
|
|
||||||
FROM vn.ticket tOrig
|
|
||||||
JOIN vn.sale saleOrig ON tOrig.id = saleOrig.ticketFk
|
|
||||||
LEFT JOIN vn.saleCloned sc ON sc.saleOriginalFk = saleOrig.id
|
|
||||||
LEFT JOIN vn.sale saleClon ON saleClon.id = sc.saleClonedFk
|
|
||||||
LEFT JOIN vn.ticket tClon ON tClon.id = saleClon.ticketFk AND DATE(tClon.shipped) = vShipment
|
|
||||||
WHERE tOrig.id = vTicket AND saleClon.id IS NULL;
|
|
||||||
|
|
||||||
INSERT IGNORE INTO vn.saleCloned(saleOriginalFk, saleClonedFk)
|
|
||||||
SELECT saleOriginal.id, saleClon.id
|
|
||||||
FROM vn.sale saleOriginal
|
|
||||||
JOIN vn.sale saleClon ON saleOriginal.itemFk = saleClon.itemFk AND saleOriginal.quantity = saleClon.quantity
|
|
||||||
WHERE saleOriginal.ticketFk = vTicket AND saleClon.ticketFk = vNewTicket;
|
|
||||||
|
|
||||||
INSERT INTO ticketRequest (description, ordered, shipped, salesPersonCode, buyerCode, quantity, price,
|
|
||||||
itemFk ,clientFk, response, total, buyed, saleFk)
|
|
||||||
SELECT tr.description, tr.ordered, tr.shipped, tr.salesPersonCode, tr.buyerCode, tr.quantity, tr.price,
|
|
||||||
tr.itemFk, tr.clientFk, tr.response, tr.total, tr.buyed, tr.saleFk
|
|
||||||
FROM sale s JOIN ticketRequest tr ON tr.saleFk = s.id
|
|
||||||
JOIN sale s2 ON s.concept = s2.concept AND s.quantity = s2.quantity AND m.Id_Article = m2.Id_Article
|
|
||||||
WHERE s.ticketFk = vTicket AND s2.ticketFk = vNewTicket;
|
|
||||||
|
|
||||||
CALL vn.ticketCalculateClon(vNewTicket, vTicket);
|
|
||||||
END;
|
|
||||||
END LOOP;
|
|
||||||
|
|
||||||
CLOSE rsTicket;
|
|
||||||
|
|
||||||
END$$
|
|
||||||
|
|
||||||
DELIMITER ;
|
|
||||||
|
|
|
@ -1,93 +0,0 @@
|
||||||
USE `vn`;
|
|
||||||
DROP procedure IF EXISTS `ticket_recalcComponents`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `vn`$$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `ticket_recalcComponents`(IN vTicketFk BIGINT, vIsTicketEditable BOOLEAN)
|
|
||||||
proc: BEGIN
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Este procedimiento recalcula los componentes de un ticket,
|
|
||||||
* eliminando los componentes existentes e insertandolos de nuevo
|
|
||||||
*
|
|
||||||
* @param vTicketFk Id del ticket
|
|
||||||
* @param vIsTicketEditable si no se quiere forzar llamar con NULL
|
|
||||||
*/
|
|
||||||
DECLARE vShipped DATE;
|
|
||||||
DECLARE vWarehouseFk SMALLINT;
|
|
||||||
DECLARE vAgencyModeFk INT;
|
|
||||||
DECLARE vAddressFk INT;
|
|
||||||
DECLARE vLanded DATE;
|
|
||||||
DECLARE vZoneFk INTEGER;
|
|
||||||
|
|
||||||
IF vIsTicketEditable IS NULL THEN
|
|
||||||
SELECT IFNULL(ts.alertLevel,0) = 0 AND IFNULL(t.refFk,'') = ''
|
|
||||||
INTO vIsTicketEditable
|
|
||||||
FROM ticket t LEFT JOIN ticketState ts ON t.id = ts.ticket
|
|
||||||
WHERE id = vTicketFk;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
SELECT t.warehouseFk,
|
|
||||||
t.shipped,
|
|
||||||
t.addressFk,
|
|
||||||
t.agencyModeFk,
|
|
||||||
t.landed,
|
|
||||||
t.zoneFk
|
|
||||||
INTO vWarehouseFk, vShipped, vAddressFk, vAgencyModeFk, vLanded, vZoneFk
|
|
||||||
FROM ticket t LEFT JOIN ticketState ts ON t.id = ts.ticket
|
|
||||||
WHERE t.id = vTicketFk;
|
|
||||||
|
|
||||||
IF vLanded IS NULL OR vZoneFk IS NULL THEN
|
|
||||||
|
|
||||||
CALL zone_getLanded(vShipped, vAddressFk, vAgencyModeFk, vWarehouseFk, TRUE);
|
|
||||||
|
|
||||||
IF (SELECT COUNT(*) FROM tmp.zoneGetLanded LIMIT 1) = 0 THEN
|
|
||||||
CALL util.throw('There is no zone for these parameters');
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
UPDATE ticket t
|
|
||||||
SET t.landed = (SELECT landed FROM tmp.zoneGetLanded LIMIT 1)
|
|
||||||
WHERE t.id = vTicketFk AND t.landed IS NULL;
|
|
||||||
|
|
||||||
IF vZoneFk IS NULL THEN
|
|
||||||
SELECT zoneFk INTO vZoneFk FROM tmp.zoneGetLanded LIMIT 1;
|
|
||||||
UPDATE ticket t
|
|
||||||
SET t.zoneFk = vZoneFk
|
|
||||||
WHERE t.id = vTicketFk AND t.zoneFk IS NULL;
|
|
||||||
END IF;
|
|
||||||
DROP TEMPORARY TABLE tmp.zoneGetLanded;
|
|
||||||
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
-- rellena la tabla buyUltimate con la ultima compra
|
|
||||||
CALL buyUltimate (vWarehouseFk, vShipped);
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot;
|
|
||||||
CREATE TEMPORARY TABLE tmp.ticketLot
|
|
||||||
SELECT vWarehouseFk warehouseFk, NULL available,
|
|
||||||
s.itemFk, bu.buyFk, vZoneFk zoneFk
|
|
||||||
FROM sale s
|
|
||||||
LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk
|
|
||||||
WHERE s.ticketFk = vTicketFk
|
|
||||||
GROUP BY s.itemFk;
|
|
||||||
|
|
||||||
CALL catalog_componentPrepare();
|
|
||||||
CALL catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk);
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.sale;
|
|
||||||
CREATE TEMPORARY TABLE tmp.sale
|
|
||||||
(PRIMARY KEY (saleFk)) ENGINE = MEMORY
|
|
||||||
SELECT id saleFk, vWarehouseFk warehouseFk
|
|
||||||
FROM sale s
|
|
||||||
WHERE s.ticketFk = vTicketFk;
|
|
||||||
|
|
||||||
-- si el ticket esta facturado, respeta los precios
|
|
||||||
CALL ticketComponentUpdateSale(IF(vIsTicketEditable, 1, 6));
|
|
||||||
|
|
||||||
CALL catalog_componentPurge();
|
|
||||||
DROP TEMPORARY TABLE
|
|
||||||
tmp.buyUltimate,
|
|
||||||
tmp.sale;
|
|
||||||
END$$
|
|
||||||
|
|
||||||
DELIMITER ;
|
|
|
@ -1,40 +0,0 @@
|
||||||
USE `vn`;
|
|
||||||
DROP procedure IF EXISTS `zone_getLanded`;
|
|
||||||
|
|
||||||
DELIMITER $$
|
|
||||||
USE `vn`$$
|
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `zone_getLanded`(vShipped DATE, vAddressFk INT, vAgencyModeFk INT, vWarehouseFk INT, vShowExpiredZones BOOLEAN)
|
|
||||||
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
|
|
||||||
* @param vWarehouseFk vWarehouseFk
|
|
||||||
* @table tmp.zoneGetLanded Datos de recepción
|
|
||||||
*/
|
|
||||||
|
|
||||||
CALL zone_getFromGeo(address_getGeo(vAddressFk));
|
|
||||||
CALL zone_getOptionsForShipment(vShipped, vShowExpiredZones);
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.zoneGetLanded;
|
|
||||||
CREATE TEMPORARY TABLE tmp.zoneGetLanded
|
|
||||||
ENGINE = MEMORY
|
|
||||||
SELECT vWarehouseFk warehouseFk,
|
|
||||||
TIMESTAMPADD(DAY,zo.travelingDays, vShipped) landed,
|
|
||||||
zo.zoneFk
|
|
||||||
FROM tmp.zoneOption zo
|
|
||||||
JOIN zone z ON z.id = zo.zoneFk
|
|
||||||
JOIN zoneWarehouse zw ON zw.zoneFk = z.id
|
|
||||||
WHERE agencyModeFk = vAgencyModeFk
|
|
||||||
AND zw.warehouseFk = vWarehouseFk;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE
|
|
||||||
tmp.zone,
|
|
||||||
tmp.zoneOption;
|
|
||||||
|
|
||||||
END$$
|
|
||||||
|
|
||||||
DELIMITER ;
|
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
UPDATE `salix`.`ACL` SET `model` = 'Calendar' WHERE (`id` = '155');
|
||||||
|
UPDATE `salix`.`ACL` SET `model` = 'Calendar' WHERE (`id` = '157');
|
|
@ -1,8 +1,10 @@
|
||||||
|
|
||||||
|
USE `vn`;
|
||||||
DROP procedure IF EXISTS `vn`.`itemLastEntries`;
|
DROP procedure IF EXISTS `vn`.`itemLastEntries`;
|
||||||
|
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`itemLastEntries`(IN `vItem` INT, IN `vDays` DATE)
|
USE `vn`$$
|
||||||
|
CREATE DEFINER=`root`@`%` PROCEDURE `itemLastEntries__`(IN `vItem` INT, IN `vDays` DATE)
|
||||||
BEGIN
|
BEGIN
|
||||||
SELECT
|
SELECT
|
||||||
w.id AS warehouseFk,
|
w.id AS warehouseFk,
|
||||||
|
@ -39,4 +41,4 @@ BEGIN
|
||||||
END$$
|
END$$
|
||||||
|
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
;
|
|
@ -0,0 +1,47 @@
|
||||||
|
USE `vn`;
|
||||||
|
CREATE
|
||||||
|
OR REPLACE ALGORITHM = UNDEFINED
|
||||||
|
DEFINER = `root`@`%`
|
||||||
|
SQL SECURITY DEFINER
|
||||||
|
VIEW `vn`.`zoneEstimatedDelivery` AS
|
||||||
|
SELECT
|
||||||
|
`t`.`zoneFk` AS `zoneFk`,
|
||||||
|
CAST((CURDATE() + INTERVAL ((HOUR(`zc`.`hour`) * 60) + MINUTE(`zc`.`hour`)) MINUTE)
|
||||||
|
AS TIME) AS `hourTheoretical`,
|
||||||
|
CAST(SUM(`sv`.`volume`) AS DECIMAL (5 , 1 )) AS `totalVolume`,
|
||||||
|
CAST(SUM(IF((`s`.`alertLevel` < 2),
|
||||||
|
`sv`.`volume`,
|
||||||
|
0))
|
||||||
|
AS DECIMAL (5 , 1 )) AS `remainingVolume`,
|
||||||
|
GREATEST(IFNULL(`lhp`.`m3`, 0),
|
||||||
|
IFNULL(`dl`.`minSpeed`, 0)) AS `speed`,
|
||||||
|
CAST((`zc`.`hour` + INTERVAL ((-(SUM(IF((`s`.`alertLevel` < 2),
|
||||||
|
`sv`.`volume`,
|
||||||
|
0))) * 60) / GREATEST(IFNULL(`lhp`.`m3`, 0),
|
||||||
|
IFNULL(`dl`.`minSpeed`, 0))) MINUTE)
|
||||||
|
AS TIME) AS `hourEffective`,
|
||||||
|
FLOOR(((-(SUM(IF((`s`.`alertLevel` < 2),
|
||||||
|
`sv`.`volume`,
|
||||||
|
0))) * 60) / GREATEST(IFNULL(`lhp`.`m3`, 0),
|
||||||
|
IFNULL(`dl`.`minSpeed`, 0)))) AS `minutesLess`,
|
||||||
|
CAST((`zc`.`hour` + INTERVAL ((-(SUM(IF((`s`.`alertLevel` < 2),
|
||||||
|
`sv`.`volume`,
|
||||||
|
0))) * 60) / GREATEST(IFNULL(`lhp`.`m3`, 0),
|
||||||
|
IFNULL(`dl`.`minSpeed`, 0))) MINUTE)
|
||||||
|
AS TIME) AS `etc`
|
||||||
|
FROM
|
||||||
|
((((((((`ticket` `t`
|
||||||
|
JOIN `ticketStateToday` `tst` ON ((`tst`.`ticket` = `t`.`id`)))
|
||||||
|
JOIN `state` `s` ON ((`s`.`id` = `tst`.`state`)))
|
||||||
|
JOIN `saleVolume` `sv` ON ((`sv`.`ticketFk` = `t`.`id`)))
|
||||||
|
LEFT JOIN `lastHourProduction` `lhp` ON ((`lhp`.`warehouseFk` = `t`.`warehouseFk`)))
|
||||||
|
JOIN `warehouse` `w` ON ((`w`.`id` = `t`.`warehouseFk`)))
|
||||||
|
JOIN `warehouseAlias` `wa` ON ((`wa`.`id` = `w`.`aliasFk`)))
|
||||||
|
LEFT JOIN `zoneClosure` `zc` ON (((`zc`.`zoneFk` = `t`.`zoneFk`)
|
||||||
|
AND (`zc`.`dated` = CURDATE()))))
|
||||||
|
LEFT JOIN `cache`.`departure_limit` `dl` ON (((`dl`.`warehouse_id` = `t`.`warehouseFk`)
|
||||||
|
AND (`dl`.`fecha` = CURDATE()))))
|
||||||
|
WHERE
|
||||||
|
((`wa`.`name` = 'Silla')
|
||||||
|
AND (CAST(`t`.`shipped` AS DATE) = CURDATE()))
|
||||||
|
GROUP BY `t`.`zoneFk`;
|
|
@ -0,0 +1,16 @@
|
||||||
|
CREATE
|
||||||
|
OR REPLACE ALGORITHM = UNDEFINED
|
||||||
|
DEFINER = `root`@`%`
|
||||||
|
SQL SECURITY DEFINER
|
||||||
|
VIEW `vn`.`zone_ETD` AS
|
||||||
|
SELECT
|
||||||
|
`zed`.`zoneFk` AS `zoneFk`,
|
||||||
|
`zed`.`hourTheoretical` AS `HoraTeórica`,
|
||||||
|
`zed`.`totalVolume` AS `volumenTotal`,
|
||||||
|
`zed`.`remainingVolume` AS `volumenPendiente`,
|
||||||
|
`zed`.`speed` AS `velocidad`,
|
||||||
|
`zed`.`hourEffective` AS `HoraPráctica`,
|
||||||
|
`zed`.`minutesLess` AS `minutesLess`,
|
||||||
|
`zed`.`etc` AS `etc`
|
||||||
|
FROM
|
||||||
|
`vn`.`zoneEstimatedDelivery` `zed`
|
|
@ -0,0 +1,2 @@
|
||||||
|
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||||
|
VALUES ('Buy', '*', '*', 'ALLOW', 'ROLE', 'buyer');
|
|
@ -0,0 +1,2 @@
|
||||||
|
ALTER TABLE `vn`.`accountingType`
|
||||||
|
ADD COLUMN `receiptDescription` VARCHAR(50) NULL COMMENT 'Descripción por defecto al crear nuevo recibo' AFTER `description`;
|
|
@ -0,0 +1,4 @@
|
||||||
|
/*
|
||||||
|
Hay una versión en salix que machacará toda esta función/procedimiento
|
||||||
|
avisa a ___ de los cambios que quieres hacer
|
||||||
|
*/
|
41
db/docker.js
41
db/docker.js
|
@ -39,7 +39,7 @@ module.exports = class Docker {
|
||||||
|
|
||||||
let runChown = process.platform != 'linux';
|
let runChown = process.platform != 'linux';
|
||||||
|
|
||||||
let container = await this.execP(`docker run --env RUN_CHOWN=${runChown} -d ${dockerArgs} salix-db`);
|
const container = await this.execP(`docker run --env RUN_CHOWN=${runChown} -d ${dockerArgs} salix-db`);
|
||||||
this.id = container.stdout;
|
this.id = container.stdout;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -53,7 +53,7 @@ module.exports = class Docker {
|
||||||
this.dbConf.port = netSettings.Ports['3306/tcp'][0]['HostPort'];
|
this.dbConf.port = netSettings.Ports['3306/tcp'][0]['HostPort'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (runChown) await this.wait();
|
await this.waitForHealthy();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (this.isRandom)
|
if (this.isRandom)
|
||||||
await this.rm();
|
await this.rm();
|
||||||
|
@ -88,6 +88,43 @@ module.exports = class Docker {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
waitForHealthy() {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
let interval = 100;
|
||||||
|
let elapsedTime = 0;
|
||||||
|
let maxInterval = 4 * 60 * 1000;
|
||||||
|
|
||||||
|
log('Waiting for MySQL init process...');
|
||||||
|
|
||||||
|
async function checker() {
|
||||||
|
elapsedTime += interval;
|
||||||
|
let status;
|
||||||
|
|
||||||
|
try {
|
||||||
|
let result = await this.execP(`docker inspect -f "{{.State.Health.Status}}" ${this.id}`);
|
||||||
|
status = result.stdout.trimEnd();
|
||||||
|
} catch (err) {
|
||||||
|
return reject(new Error(err.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (status == 'unhealthy')
|
||||||
|
return reject(new Error('Docker exited, please see the docker logs for more info'));
|
||||||
|
|
||||||
|
if (status == 'healthy') {
|
||||||
|
log('MySQL process ready.');
|
||||||
|
return resolve();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (elapsedTime >= maxInterval)
|
||||||
|
reject(new Error(`MySQL not initialized whithin ${elapsedTime / 1000} secs`));
|
||||||
|
else
|
||||||
|
setTimeout(bindedChecker, interval);
|
||||||
|
}
|
||||||
|
let bindedChecker = checker.bind(this);
|
||||||
|
bindedChecker();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
wait() {
|
wait() {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const mysql = require('mysql2');
|
const mysql = require('mysql2');
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -88,13 +88,18 @@ INSERT INTO `vn`.`country`(`id`, `country`, `isUeeMember`, `code`, `currencyFk`,
|
||||||
(19,'Francia', 1, 'FR', 1, 27),
|
(19,'Francia', 1, 'FR', 1, 27),
|
||||||
(30,'Canarias', 1, 'IC', 1, 24);
|
(30,'Canarias', 1, 'IC', 1, 24);
|
||||||
|
|
||||||
INSERT INTO `vn`.`warehouse`(`id`, `name`, `isComparative`, `isInventory`, `hasAvailable`, `isManaged`, `hasStowaway`, `hasDms`, `hasComission`)
|
INSERT INTO `vn`.`warehouseAlias`(`id`, `name`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 'Warehouse One', 1, 1, 1, 1, 1, 1, 1),
|
(1, 'Main Warehouse'),
|
||||||
(2, 'Warehouse Two', 1, 1, 1, 1, 0, 0, 1),
|
(2, 'Silla');
|
||||||
(3, 'Warehouse Three', 1, 1, 1, 1, 0, 0, 0),
|
|
||||||
(4, 'Warehouse Four', 1, 1, 1, 1, 0, 0, 0),
|
INSERT INTO `vn`.`warehouse`(`id`, `name`, `isComparative`, `isInventory`, `hasAvailable`, `isManaged`, `hasStowaway`, `hasDms`, `hasComission`, `aliasFk`)
|
||||||
(5, 'Warehouse Five', 1, 1, 1, 1, 0, 0, 0);
|
VALUES
|
||||||
|
(1, 'Warehouse One', 1, 1, 1, 1, 1, 1, 1, 2),
|
||||||
|
(2, 'Warehouse Two', 1, 1, 1, 1, 0, 0, 1, 2),
|
||||||
|
(3, 'Warehouse Three', 1, 1, 1, 1, 0, 0, 0, 2),
|
||||||
|
(4, 'Warehouse Four', 1, 1, 1, 1, 0, 0, 0, 2),
|
||||||
|
(5, 'Warehouse Five', 1, 1, 1, 1, 0, 0, 0, 2);
|
||||||
|
|
||||||
INSERT INTO `vn`.`sector`(`id`, `description`, `warehouseFk`, `isPreviousPreparedByPacking`, `code`, `pickingPlacement`, `path`)
|
INSERT INTO `vn`.`sector`(`id`, `description`, `warehouseFk`, `isPreviousPreparedByPacking`, `code`, `pickingPlacement`, `path`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -111,17 +116,13 @@ INSERT INTO `vn`.`shelving` (`code`, `parkingFk`, `isPrinted`, `priority`, `park
|
||||||
('GVC', '1', '0', '1', '0', '106'),
|
('GVC', '1', '0', '1', '0', '106'),
|
||||||
('HEJ', '2', '0', '1', '0', '106');
|
('HEJ', '2', '0', '1', '0', '106');
|
||||||
|
|
||||||
INSERT INTO `vn`.`warehouseAlias`(`id`, `name`)
|
INSERT INTO `vn`.`accountingType`(`id`, `description`, `receiptDescription`)
|
||||||
VALUES
|
|
||||||
(1, 'Main Warehouse');
|
|
||||||
|
|
||||||
INSERT INTO `vn`.`accountingType`(`id`, `description`)
|
|
||||||
VALUES
|
VALUES
|
||||||
(1, 'Digital money'),
|
(1, 'Digital money', ''),
|
||||||
(2, 'Cash'),
|
(2, 'Cash', 'Cash'),
|
||||||
(3, 'Card'),
|
(3, 'Card', 'Pay on receipt'),
|
||||||
(4, 'Stolen Money'),
|
(4, 'Stolen Money', ''),
|
||||||
(5, 'Miscellaneous');
|
(5, 'Miscellaneous', '');
|
||||||
|
|
||||||
INSERT INTO `vn`.`currency`(`id`, `code`, `name`, `ratio`)
|
INSERT INTO `vn`.`currency`(`id`, `code`, `name`, `ratio`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -132,8 +133,8 @@ INSERT INTO `vn`.`currency`(`id`, `code`, `name`, `ratio`)
|
||||||
|
|
||||||
INSERT INTO `vn`.`bank`(`id`, `bank`, `account`, `cash`, `entityFk`, `isActive`, `currencyFk`)
|
INSERT INTO `vn`.`bank`(`id`, `bank`, `account`, `cash`, `entityFk`, `isActive`, `currencyFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 'Pay on receipt', '0000000000', 4, 0, 1, 1),
|
(1, 'Pay on receipt', '0000000000', 3, 0, 1, 1),
|
||||||
(2, 'Cash', '1111111111', 1, 0, 1, 1);
|
(2, 'Cash', '1111111111', 2, 0, 1, 1);
|
||||||
|
|
||||||
INSERT INTO `vn`.`deliveryMethod`(`id`, `code`, `description`)
|
INSERT INTO `vn`.`deliveryMethod`(`id`, `code`, `description`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -510,7 +511,23 @@ INSERT INTO `vn`.`zoneWarehouse` (`id`, `zoneFk`, `warehouseFk`)
|
||||||
(11, 11, 5),
|
(11, 11, 5),
|
||||||
(12, 12, 4),
|
(12, 12, 4),
|
||||||
(13, 13, 5);
|
(13, 13, 5);
|
||||||
|
|
||||||
|
INSERT INTO `vn`.`zoneClosure` (`zoneFk`, `dated`, `hour`)
|
||||||
|
VALUES
|
||||||
|
(1, CURDATE(), '23:59'),
|
||||||
|
(2, CURDATE(), '23:59'),
|
||||||
|
(3, CURDATE(), '23:59'),
|
||||||
|
(4, CURDATE(), '23:59'),
|
||||||
|
(5, CURDATE(), '23:59'),
|
||||||
|
(6, CURDATE(), '23:59'),
|
||||||
|
(7, CURDATE(), '23:59'),
|
||||||
|
(8, CURDATE(), '23:59'),
|
||||||
|
(9, CURDATE(), '23:59'),
|
||||||
|
(10, CURDATE(), '23:59'),
|
||||||
|
(11, CURDATE(), '23:59'),
|
||||||
|
(12, CURDATE(), '23:59'),
|
||||||
|
(13, CURDATE(), '23:59');
|
||||||
|
|
||||||
INSERT INTO `vn`.`zoneConfig` (`scope`) VALUES ('1');
|
INSERT INTO `vn`.`zoneConfig` (`scope`) VALUES ('1');
|
||||||
|
|
||||||
INSERT INTO `vn`.`route`(`id`, `time`, `workerFk`, `created`, `vehicleFk`, `agencyModeFk`, `description`, `m3`, `cost`, `started`, `finished`, `zoneFk`)
|
INSERT INTO `vn`.`route`(`id`, `time`, `workerFk`, `created`, `vehicleFk`, `agencyModeFk`, `description`, `m3`, `cost`, `started`, `finished`, `zoneFk`)
|
||||||
|
@ -539,11 +556,11 @@ INSERT INTO `vn`.`ticket`(`id`, `priority`, `agencyModeFk`,`warehouseFk`,`routeF
|
||||||
(12, 1, 1, 1, 1, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 103, 'Phone Box', 123, NULL, 0, 1, CURDATE()),
|
(12, 1, 1, 1, 1, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 103, 'Phone Box', 123, NULL, 0, 1, CURDATE()),
|
||||||
(13, 1, 7, 1, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 103, 'Phone Box', 123, NULL, 0, 3, CURDATE()),
|
(13, 1, 7, 1, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 103, 'Phone Box', 123, NULL, 0, 3, CURDATE()),
|
||||||
(14, 1, 2, 1, NULL, CURDATE(), CURDATE(), 104, 'Malibu Point', 4, NULL, 0, 9, CURDATE()),
|
(14, 1, 2, 1, NULL, CURDATE(), CURDATE(), 104, 'Malibu Point', 4, NULL, 0, 9, CURDATE()),
|
||||||
(15, 1, 7, 1, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 105, 'Plastic Cell', 125, NULL, 0, 3, CURDATE()),
|
(15, 1, 7, 1, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 105, 'An incredibly long alias for testing purposes', 125, NULL, 0, 3, CURDATE()),
|
||||||
(16, 1, 7, 1, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 106, 'Many Places', 126, NULL, 0, 3, CURDATE()),
|
(16, 1, 7, 1, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 106, 'Many Places', 126, NULL, 0, 3, CURDATE()),
|
||||||
(17, 1, 7, 2, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 106, 'Many Places', 126, NULL, 0, 3, CURDATE()),
|
(17, 1, 7, 2, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 106, 'Many Places', 126, NULL, 0, 3, CURDATE()),
|
||||||
(18, 1, 4, 4, 4, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 108, 'Cerebro', 128, NULL, 0, 12, CURDATE()),
|
(18, 1, 4, 4, 4, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 108, 'Cerebro', 128, NULL, 0, 12, CURDATE()),
|
||||||
(19, 1, 5, 5, 3, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 109, 'Somewhere in Thailand', 129, NULL, 1, 13, CURDATE()),
|
(19, 1, 5, 5, NULL, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 109, 'Somewhere in Thailand', 129, NULL, 1, 13, CURDATE()),
|
||||||
(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)),
|
(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, 5, 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)),
|
(21, NULL, 5, 5, 5, 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, 5, 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)),
|
(22, NULL, 5, 5, 5, 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)),
|
||||||
|
@ -584,11 +601,11 @@ INSERT INTO `vn`.`ticketTracking`(`ticketFk`, `stateFk`, `workerFk`, `created`)
|
||||||
(12, 3, 19, NOW()),
|
(12, 3, 19, NOW()),
|
||||||
(13, 3, 19, NOW()),
|
(13, 3, 19, NOW()),
|
||||||
(14, 3, 19, NOW()),
|
(14, 3, 19, NOW()),
|
||||||
(15, 3, 19, NOW()),
|
(15, 2, 19, NOW()),
|
||||||
(16, 3, 19, NOW()),
|
(16, 3, 19, NOW()),
|
||||||
(17, 3, 19, NOW()),
|
(17, 2, 19, NOW()),
|
||||||
(18, 3, 19, NOW()),
|
(18, 2, 19, NOW()),
|
||||||
(19, 17, 19, NOW()),
|
(19, 2, 19, NOW()),
|
||||||
(20, 1, 19, DATE_ADD(NOW(), INTERVAL +1 MONTH)),
|
(20, 1, 19, DATE_ADD(NOW(), INTERVAL +1 MONTH)),
|
||||||
(21, 1, 19, DATE_ADD(NOW(), INTERVAL +1 MONTH)),
|
(21, 1, 19, DATE_ADD(NOW(), INTERVAL +1 MONTH)),
|
||||||
(22, 1, 19, DATE_ADD(NOW(), INTERVAL +1 MONTH)),
|
(22, 1, 19, DATE_ADD(NOW(), INTERVAL +1 MONTH)),
|
||||||
|
@ -716,25 +733,25 @@ INSERT INTO `vn`.`intrastat`(`id`, `description`, `taxClassFk`, `taxCodeFk`)
|
||||||
(05080000, 'Coral y materiales similares', 2, 2),
|
(05080000, 'Coral y materiales similares', 2, 2),
|
||||||
(06021010, 'Plantas vivas: Esqueje/injerto, Vid', 1, 1);
|
(06021010, 'Plantas vivas: Esqueje/injerto, Vid', 1, 1);
|
||||||
|
|
||||||
INSERT INTO `vn`.`item`(`id`, `typeFk`, `size`, `inkFk`, `stems`, `originFk`, `description`, `producerFk`, `intrastatFk`, `isOnOffer`, `expenceFk`, `isBargain`, `comment`, `relevancy`, `image`, `taxClassFk`, `subName`)
|
INSERT INTO `vn`.`item`(`id`, `typeFk`, `size`, `inkFk`, `stems`, `originFk`, `description`, `producerFk`, `intrastatFk`, `isOnOffer`, `expenceFk`, `isBargain`, `comment`, `relevancy`, `image`, `taxClassFk`, `subName`, `minPrice`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 2, 70, 'AMA', 1, 1, NULL, 1, 06021010, 0, 2000000000, 0, NULL, 0, 66540, 1, NULL),
|
(1, 2, 70, 'AMA', 1, 1, NULL, 1, 06021010, 0, 2000000000, 0, NULL, 0, 67, 1, NULL, 0),
|
||||||
(2, 2, 70, 'AZL', 1, 2, NULL, 1, 06021010, 0, 2000000000, 0, NULL, 0, 65540, 1, NULL),
|
(2, 2, 70, 'AZL', 1, 2, NULL, 1, 06021010, 0, 2000000000, 0, NULL, 0, 66, 1, NULL, 0),
|
||||||
(3, 1, 60, 'AMR', 1, 3, NULL, 1, 05080000, 0, 4751000000, 0, NULL, 0, 61692, 1, NULL),
|
(3, 1, 60, 'AMR', 1, 3, NULL, 1, 05080000, 0, 4751000000, 0, NULL, 0, 65, 1, NULL, 0),
|
||||||
(4, 1, 60, 'AMR', 1, 1, NULL, 1, 05080000, 1, 4751000000, 0, NULL, 0, 66090, 2, NULL),
|
(4, 1, 60, 'AMR', 1, 1, 'Increases block', 1, 05080000, 1, 4751000000, 0, NULL, 0, 69, 2, NULL, 0),
|
||||||
(5, 3, 30, 'GRE', 1, 2, NULL, 2, 06021010, 1, 4751000000, 0, NULL, 0, 67350, 2, NULL),
|
(5, 3, 30, 'GRE', 1, 2, NULL, 2, 06021010, 1, 4751000000, 0, NULL, 0, 74, 2, NULL, 0),
|
||||||
(6, 5, 30, 'GRE', 1, 2, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, 67350, 2, NULL),
|
(6, 5, 30, 'GRE', 1, 2, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, 62, 2, NULL, 0),
|
||||||
(7, 5, 90, 'AZL', 1, 2, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, 67350, 2, NULL),
|
(7, 5, 90, 'AZL', 1, 2, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, 64, 2, NULL, 0),
|
||||||
(8, 2, 70, 'AMA', 1, 1, NULL, 1, 06021010, 0, 2000000000, 0, NULL, 0, 66540, 1, NULL),
|
(8, 2, 70, 'AMA', 1, 1, NULL, 1, 06021010, 0, 2000000000, 0, NULL, 0, 75, 1, NULL, 0),
|
||||||
(9, 2, 70, 'AZL', 1, 2, NULL, 1, 06021010, 0, 2000000000, 0, NULL, 0, 65540, 1, NULL),
|
(9, 2, 70, 'AZL', 1, 2, NULL, 1, 06021010, 0, 2000000000, 0, NULL, 0, 76, 1, NULL, 0),
|
||||||
(10, 1, 60, 'AMR', 1, 3, NULL, 1, 05080000, 0, 4751000000, 0, NULL, 0, 61692, 1, NULL),
|
(10, 1, 60, 'AMR', 1, 3, NULL, 1, 05080000, 0, 4751000000, 0, NULL, 0, 77, 1, NULL, 0),
|
||||||
(11, 1, 60, 'AMR', 1, 1, NULL, 1, 05080000, 1, 4751000000, 0, NULL, 0, 66090, 2, NULL),
|
(11, 1, 60, 'AMR', 1, 1, NULL, 1, 05080000, 1, 4751000000, 0, NULL, 0, 78, 2, NULL, 0),
|
||||||
(12, 3, 30, 'GRE', 1, 2, NULL, 2, 06021010, 1, 4751000000, 0, NULL, 0, 67350, 2, NULL),
|
(12, 3, 30, 'GRE', 1, 2, NULL, 2, 06021010, 1, 4751000000, 0, NULL, 0, 82, 2, NULL, 0),
|
||||||
(13, 5, 30, 'GRE', 1, 2, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, 67350, 2, NULL),
|
(13, 5, 30, 'GRE', 1, 2, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, 83, 2, NULL, 0),
|
||||||
(14, 5, 90, 'AZL', 1, 2, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, 67350, 2, NULL),
|
(14, 5, 90, 'AZL', 1, 2, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, 84, 2, NULL, 0),
|
||||||
(15, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, 67350, 2, NULL),
|
(15, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, 67350, 2, NULL, 0),
|
||||||
(16, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, 67350, 2, NULL),
|
(16, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, 67350, 2, NULL, 0),
|
||||||
(71, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 1, 4751000000, 0, NULL, 0, 67350, 2, NULL);
|
(71, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 1, 4751000000, 0, NULL, 0, 88, 2, NULL, 0);
|
||||||
|
|
||||||
INSERT INTO `vn`.`expedition`(`id`, `agencyModeFk`, `ticketFk`, `isBox`, `created`, `itemFk`, `counter`, `checked`, `workerFk`)
|
INSERT INTO `vn`.`expedition`(`id`, `agencyModeFk`, `ticketFk`, `isBox`, `created`, `itemFk`, `counter`, `checked`, `workerFk`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -748,6 +765,26 @@ INSERT INTO `vn`.`expedition`(`id`, `agencyModeFk`, `ticketFk`, `isBox`, `create
|
||||||
(8, 3, 5, 71, DATE_ADD(CURDATE(), INTERVAL -4 MONTH), 1, 1, 1, 18),
|
(8, 3, 5, 71, DATE_ADD(CURDATE(), INTERVAL -4 MONTH), 1, 1, 1, 18),
|
||||||
(9, 3, 6, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 1, 1, 18),
|
(9, 3, 6, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 1, 1, 18),
|
||||||
(10, 7, 7, 71, CURDATE(), 1, 1, 1, 18);
|
(10, 7, 7, 71, CURDATE(), 1, 1, 1, 18);
|
||||||
|
|
||||||
|
INSERT INTO `vn`.`item`(`id`, `typeFk`, `size`, `inkFk`, `stems`, `originFk`, `description`, `producerFk`, `intrastatFk`, `isOnOffer`, `expenceFk`, `isBargain`, `comment`, `relevancy`, `image`, `taxClassFk`, `subName`)
|
||||||
|
VALUES
|
||||||
|
(1, 2, 70, 'AMA', 1, 1, NULL, 1, 06021010, 0, 2000000000, 0, NULL, 0, 67, 1, NULL),
|
||||||
|
(2, 2, 70, 'AZL', 1, 2, NULL, 1, 06021010, 0, 2000000000, 0, NULL, 0, 66, 1, NULL),
|
||||||
|
(3, 1, 60, 'AMR', 1, 3, NULL, 1, 05080000, 0, 4751000000, 0, NULL, 0, 65, 1, NULL),
|
||||||
|
(4, 1, 60, 'AMR', 1, 1, NULL, 1, 05080000, 1, 4751000000, 0, NULL, 0, 69, 2, NULL),
|
||||||
|
(5, 3, 30, 'GRE', 1, 2, NULL, 2, 06021010, 1, 4751000000, 0, NULL, 0, 74, 2, NULL),
|
||||||
|
(6, 5, 30, 'GRE', 1, 2, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, 62, 2, NULL),
|
||||||
|
(7, 5, 90, 'AZL', 1, 2, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, 64, 2, NULL),
|
||||||
|
(8, 2, 70, 'AMA', 1, 1, NULL, 1, 06021010, 0, 2000000000, 0, NULL, 0, 75, 1, NULL),
|
||||||
|
(9, 2, 70, 'AZL', 1, 2, NULL, 1, 06021010, 0, 2000000000, 0, NULL, 0, 76, 1, NULL),
|
||||||
|
(10, 1, 60, 'AMR', 1, 3, NULL, 1, 05080000, 0, 4751000000, 0, NULL, 0, 77, 1, NULL),
|
||||||
|
(11, 1, 60, 'AMR', 1, 1, NULL, 1, 05080000, 1, 4751000000, 0, NULL, 0, 78, 2, NULL),
|
||||||
|
(12, 3, 30, 'GRE', 1, 2, NULL, 2, 06021010, 1, 4751000000, 0, NULL, 0, 82, 2, NULL),
|
||||||
|
(13, 5, 30, 'GRE', 1, 2, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, 83, 2, NULL),
|
||||||
|
(14, 5, 90, 'AZL', 1, 2, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, 84, 2, NULL),
|
||||||
|
(15, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, 67350, 2, NULL),
|
||||||
|
(16, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 0, 4751000000, 0, NULL, 0, 67350, 2, NULL),
|
||||||
|
(71, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 1, 4751000000, 0, NULL, 0, 88, 2, NULL);
|
||||||
|
|
||||||
INSERT INTO `vn`.`packaging`(`id`, `volume`, `width`, `height`, `depth`, `isPackageReturnable`, `created`, `itemFk`, `price`)
|
INSERT INTO `vn`.`packaging`(`id`, `volume`, `width`, `height`, `depth`, `isPackageReturnable`, `created`, `itemFk`, `price`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -760,6 +797,19 @@ INSERT INTO `vn`.`packaging`(`id`, `volume`, `width`, `height`, `depth`, `isPack
|
||||||
('cc', 1640038.00, 56.00, 220.00, 128.00, 1, CURDATE(), 15, 90.00),
|
('cc', 1640038.00, 56.00, 220.00, 128.00, 1, CURDATE(), 15, 90.00),
|
||||||
('pallet 100', 2745600.00, 100.00, 220.00, 120.00, 1, CURDATE(), 16, 0.00);
|
('pallet 100', 2745600.00, 100.00, 220.00, 120.00, 1, CURDATE(), 16, 0.00);
|
||||||
|
|
||||||
|
INSERT INTO `vn`.`expedition`(`id`, `agencyModeFk`, `ticketFk`, `isBox`, `created`, `itemFk`, `counter`, `workerFk`, `packagingFk`)
|
||||||
|
VALUES
|
||||||
|
(1, 1, 1, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 1, 1, 1),
|
||||||
|
(2, 1, 1, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 2, 1, 1),
|
||||||
|
(3, 1, 1, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 2, 3, 1, 1),
|
||||||
|
(4, 1, 1, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 4, 4, 1, 1),
|
||||||
|
(5, 1, 2, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 1, 1, 1),
|
||||||
|
(6, 7, 3, 71, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), 1, 1, 1, 1),
|
||||||
|
(7, 2, 4, 71, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), 1, 1, 1, 1),
|
||||||
|
(8, 3, 5, 71, DATE_ADD(CURDATE(), INTERVAL -4 MONTH), 1, 1, 1, 1),
|
||||||
|
(9, 3, 6, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 1, 1, 1),
|
||||||
|
(10, 7, 7, 71, CURDATE(), 1, 1, 1, 1);
|
||||||
|
|
||||||
INSERT INTO `vn`.`ticketPackaging`(`id`, `ticketFk`, `packagingFk`, `quantity`, `created`, `pvp`)
|
INSERT INTO `vn`.`ticketPackaging`(`id`, `ticketFk`, `packagingFk`, `quantity`, `created`, `pvp`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 1, 2, 2, CURDATE(), NULL),
|
(1, 1, 2, 2, CURDATE(), NULL),
|
||||||
|
@ -1182,8 +1232,8 @@ INSERT INTO `vn`.`travel`(`id`,`shipped`, `landed`, `warehouseInFk`, `warehouseO
|
||||||
(4, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 2, 1, 50.00, 500, 'fourth travel', 0),
|
(4, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 2, 1, 50.00, 500, 'fourth travel', 0),
|
||||||
(5, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 3, 2, 1, 50.00, 500, 'fifth travel', 1),
|
(5, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 3, 2, 1, 50.00, 500, 'fifth travel', 1),
|
||||||
(6, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 4, 2, 1, 50.00, 500, 'sixth travel', 1),
|
(6, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 4, 2, 1, 50.00, 500, 'sixth travel', 1),
|
||||||
(7, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 5, 2, 1, 50.00, 500, 'seventh travel', 1),
|
(7, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 5, 2, 1, 50.00, 500, 'seventh travel', 2),
|
||||||
(8, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 5, 2, 1, 50.00, 500, 'eight travel', 1);
|
(8, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 5, 2, 1, 50.00, 500, 'eight travel', 1);
|
||||||
|
|
||||||
INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed`, `companyFk`, `ref`,`isInventory`, `isRaid`, `notes`, `evaNotes`)
|
INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed`, `companyFk`, `ref`,`isInventory`, `isRaid`, `notes`, `evaNotes`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -1216,48 +1266,48 @@ INSERT INTO `bs`.`waste`(`buyer`, `year`, `week`, `family`, `saleTotal`, `saleWa
|
||||||
('HankPym', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(CURDATE(), INTERVAL -1 WEEK), 1), 'Miscellaneous Accessories', '186', '0', '0.0'),
|
('HankPym', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(CURDATE(), INTERVAL -1 WEEK), 1), 'Miscellaneous Accessories', '186', '0', '0.0'),
|
||||||
('HankPym', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(CURDATE(), INTERVAL -1 WEEK), 1), 'Adhesives', '277', '0', '0.0');
|
('HankPym', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(CURDATE(), INTERVAL -1 WEEK), 1), 'Adhesives', '277', '0', '0.0');
|
||||||
|
|
||||||
INSERT INTO `vn`.`buy`(`id`,`entryFk`,`itemFk`,`buyingValue`,`quantity`,`packageFk`,`stickers`,`freightValue`,`packageValue`,`comissionValue`,`packing`,`grouping`,`groupingMode`,`location`,`price1`,`price2`,`price3`,`minPrice`,`producer`,`printedStickers`,`isChecked`,`isIgnored`,`weight`, `created`)
|
INSERT INTO `vn`.`buy`(`id`,`entryFk`,`itemFk`,`buyingValue`,`quantity`,`packageFk`,`stickers`,`freightValue`,`packageValue`,`comissionValue`,`packing`,`grouping`,`groupingMode`,`location`,`price1`,`price2`,`price3`,`producer`,`printedStickers`,`isChecked`,`isIgnored`,`weight`, `created`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 1, 1, 50, 5000, 4, 1, 1.500, 1.500, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, 0.00, NULL, 0, 1, 0, 1, DATE_ADD(CURDATE(), INTERVAL -2 MONTH)),
|
(1, 1, 1, 50, 5000, 4, 1, 1.500, 1.500, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, NULL, 0, 1, 0, 1, DATE_ADD(CURDATE(), INTERVAL -2 MONTH)),
|
||||||
(2, 2, 1, 50, 100, 4, 1, 1.500, 1.500, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, 0.00, NULL, 0, 1, 0, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
|
(2, 2, 1, 50, 100, 4, 1, 1.500, 1.500, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, NULL, 0, 1, 0, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
|
||||||
(3, 3, 1, 50, 100, 4, 1, 1.500, 1.500, 0.000, 1, 1, 0, NULL, 0.00, 99.6, 99.4, 0.00, NULL, 0, 1, 0, 1, CURDATE()),
|
(3, 3, 1, 50, 100, 4, 1, 1.500, 1.500, 0.000, 1, 1, 0, NULL, 0.00, 99.6, 99.4, NULL, 0, 1, 0, 1, CURDATE()),
|
||||||
(4, 2, 2, 5, 450, 3, 1, 1.000, 1.000, 0.000, 10, 10, 0, NULL, 0.00, 7.30, 7.00, 0.00, NULL, 0, 1, 0, 2.5, CURDATE()),
|
(4, 2, 2, 5, 450, 3, 1, 1.000, 1.000, 0.000, 10, 10, 0, NULL, 0.00, 7.30, 7.00, NULL, 0, 1, 0, 2.5, CURDATE()),
|
||||||
(5, 3, 3, 55, 500, 5, 1, 1.000, 1.000, 0.000, 1, 1, 0, NULL, 0.00, 78.3, 75.6, 0.00, NULL, 0, 1, 0, 2.5, CURDATE()),
|
(5, 3, 3, 55, 500, 5, 1, 1.000, 1.000, 0.000, 1, 1, 0, NULL, 0.00, 78.3, 75.6, NULL, 0, 1, 0, 2.5, CURDATE()),
|
||||||
(6, 4, 8, 50, 1000, 4, 1, 1.000, 1.000, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, 0.00, NULL, 0, 1, 0, 2.5, CURDATE()),
|
(6, 4, 8, 50, 1000, 4, 1, 1.000, 1.000, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, NULL, 0, 1, 0, 2.5, CURDATE()),
|
||||||
(7, 4, 9, 20, 1000, 3, 1, 0.500, 0.500, 0.000, 10, 10, 1, NULL, 0.00, 30.50, 29.00, 0.00, NULL, 0, 1, 0, 2.5, CURDATE()),
|
(7, 4, 9, 20, 1000, 3, 1, 0.500, 0.500, 0.000, 10, 10, 1, NULL, 0.00, 30.50, 29.00, NULL, 0, 1, 0, 2.5, CURDATE()),
|
||||||
(8, 4, 4, 1.25, 1000, 3, 1, 0.500, 0.500, 0.000, 10, 10, 1, NULL, 0.00, 1.75, 1.67, 0.00, NULL, 0, 1, 0, 2.5, CURDATE()),
|
(8, 4, 4, 1.25, 1000, 3, 1, 0.500, 0.500, 0.000, 10, 10, 1, NULL, 0.00, 1.75, 1.67, NULL, 0, 1, 0, 2.5, CURDATE()),
|
||||||
(9, 4, 4, 1.25, 1000, 3, 1, 0.500, 0.500, 0.000, 10, 10, 1, NULL, 0.00, 1.75, 1.67, 0.00, NULL, 0, 1, 0, 4, CURDATE()),
|
(9, 4, 4, 1.25, 1000, 3, 1, 0.500, 0.500, 0.000, 10, 10, 1, NULL, 0.00, 1.75, 1.67, NULL, 0, 1, 0, 4, CURDATE()),
|
||||||
(10, 5, 1, 50, 10, 4, 1, 2.500, 2.500, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, 0.00, NULL, 0, 1, 0, 4, CURDATE()),
|
(10, 5, 1, 50, 10, 4, 1, 2.500, 2.500, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, NULL, 0, 1, 0, 4, CURDATE()),
|
||||||
(11, 5, 4, 1.25, 10, 3, 1, 2.500, 2.500, 0.000, 10, 10, 1, NULL, 0.00, 1.75, 1.67, 0.00, NULL, 0, 1, 0, 4, CURDATE()),
|
(11, 5, 4, 1.25, 10, 3, 1, 2.500, 2.500, 0.000, 10, 10, 1, NULL, 0.00, 1.75, 1.67, NULL, 0, 1, 0, 4, CURDATE()),
|
||||||
(12, 6, 4, 1.25, 0, 3, 1, 2.500, 2.500, 0.000, 10, 10, 1, NULL, 0.00, 1.75, 1.67, 0.00, NULL, 0, 1, 0, 4, CURDATE()),
|
(12, 6, 4, 1.25, 0, 3, 1, 2.500, 2.500, 0.000, 10, 10, 1, NULL, 0.00, 1.75, 1.67, NULL, 0, 1, 0, 4, CURDATE()),
|
||||||
(13, 7, 1, 50, 0, 3, 1, 2.000, 2.000, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, 0.00, NULL, 0, 1, 0, 4, CURDATE()),
|
(13, 7, 1, 50, 0, 3, 1, 2.000, 2.000, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, NULL, 0, 1, 0, 4, CURDATE()),
|
||||||
(14, 7, 2, 5, 0, 3, 1, 2.000, 2.000, 0.000, 10, 10, 1, NULL, 0.00, 7.30, 7.00, 0.00, NULL, 0, 1, 0, 4, CURDATE()),
|
(14, 7, 2, 5, 0, 3, 1, 2.000, 2.000, 0.000, 10, 10, 1, NULL, 0.00, 7.30, 7.00, NULL, 0, 1, 0, 4, CURDATE()),
|
||||||
(15, 7, 4, 1.25, 0, 3, 1, 2.000, 2.000, 0.000, 10, 10, 1, NULL, 0.00, 1.75, 1.67, 0.00, NULL, 0, 1, 0, 4, CURDATE());
|
(15, 7, 4, 1.25, 0, 3, 1, 2.000, 2.000, 0.000, 10, 10, 1, NULL, 0.00, 1.75, 1.67, NULL, 0, 1, 0, 4, CURDATE());
|
||||||
|
|
||||||
INSERT INTO `hedera`.`order`(`id`, `date_send`, `customer_id`, `delivery_method_id`, `agency_id`, `address_id`, `company_id`, `note`, `source_app`, `confirmed`, `date_make`, `first_row_stamp`, `confirm_date`)
|
INSERT INTO `hedera`.`order`(`id`, `date_send`, `customer_id`, `delivery_method_id`, `agency_id`, `address_id`, `company_id`, `note`, `source_app`, `confirmed`,`total`, `date_make`, `first_row_stamp`, `confirm_date`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 101, 3, 1, 121, 442, NULL, 'TPV', 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
|
(1, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 101, 3, 1, 121, 442, NULL, 'TPV', 1,'155.89', DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
|
||||||
(2, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 104, 3, 1, 124, 442, NULL, 'WEB', 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
|
(2, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 104, 3, 1, 124, 442, NULL, 'WEB', 1,'100.10', DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
|
||||||
(3, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -2 MONTH), INTERVAL +1 DAY), 104, 1, 2, 124, 442, NULL, 'ANDROID', 1, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), DATE_ADD(CURDATE(), INTERVAL -2 MONTH), DATE_ADD(CURDATE(), INTERVAL -2 MONTH)),
|
(3, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -2 MONTH), INTERVAL +1 DAY), 104, 1, 2, 124, 442, NULL, 'ANDROID', 1,'107.25', DATE_ADD(CURDATE(), INTERVAL -2 MONTH), DATE_ADD(CURDATE(), INTERVAL -2 MONTH), DATE_ADD(CURDATE(), INTERVAL -2 MONTH)),
|
||||||
(4, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -3 MONTH), INTERVAL +1 DAY), 104, 1, 2, 124, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), DATE_ADD(CURDATE(), INTERVAL -3 MONTH), DATE_ADD(CURDATE(), INTERVAL -3 MONTH)),
|
(4, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -3 MONTH), INTERVAL +1 DAY), 104, 1, 2, 124, 442, NULL, 'SALIX', 1,'10.01', DATE_ADD(CURDATE(), INTERVAL -3 MONTH), DATE_ADD(CURDATE(), INTERVAL -3 MONTH), DATE_ADD(CURDATE(), INTERVAL -3 MONTH)),
|
||||||
(5, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -4 MONTH), INTERVAL +1 DAY), 104, 1, 3, 124, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -4 MONTH), DATE_ADD(CURDATE(), INTERVAL -4 MONTH), DATE_ADD(CURDATE(), INTERVAL -4 MONTH)),
|
(5, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -4 MONTH), INTERVAL +1 DAY), 104, 1, 3, 124, 442, NULL, 'SALIX', 1,'10.01', DATE_ADD(CURDATE(), INTERVAL -4 MONTH), DATE_ADD(CURDATE(), INTERVAL -4 MONTH), DATE_ADD(CURDATE(), INTERVAL -4 MONTH)),
|
||||||
(6, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 101, 1, 3, 1, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
|
(6, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 101, 1, 3, 1, 442, NULL, 'SALIX', 1,'10.01', DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
|
||||||
(7, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 101, 2, 7, 1, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
|
(7, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 101, 2, 7, 1, 442, NULL, 'SALIX', 0,'10.01', CURDATE(), CURDATE(), CURDATE()),
|
||||||
(8, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 101, 2, 7, 121, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
|
(8, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 101, 2, 7, 121, 442, NULL, 'SALIX', 0,'123.53', CURDATE(), CURDATE(), CURDATE()),
|
||||||
(9, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 104, 2, 7, 124, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
|
(9, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 104, 2, 7, 124, 442, NULL, 'SALIX', 0,'10.01', CURDATE(), CURDATE(), CURDATE()),
|
||||||
(10, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 102, 3, 1, 2, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
|
(10, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 102, 3, 1, 2, 442, NULL, 'SALIX', 0,'10.01', CURDATE(), CURDATE(), CURDATE()),
|
||||||
(11, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 102, 2, 7, 122, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
|
(11, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 102, 2, 7, 122, 442, NULL, 'SALIX', 0,'60.90', CURDATE(), CURDATE(), CURDATE()),
|
||||||
(12, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 103, 3, 1, 3, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
|
(12, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 103, 3, 1, 3, 442, NULL, 'SALIX', 0,'72.60', CURDATE(), CURDATE(), CURDATE()),
|
||||||
(13, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 103, 1, 2, 123, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
|
(13, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 103, 1, 2, 123, 442, NULL, 'SALIX', 0,'72.60', CURDATE(), CURDATE(), CURDATE()),
|
||||||
(14, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 104, 1, 2, 4, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
|
(14, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 104, 1, 2, 4, 442, NULL, 'SALIX', 0,'72.60', CURDATE(), CURDATE(), CURDATE()),
|
||||||
(15, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 105, 1, 3, 125, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
|
(15, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 105, 1, 3, 125, 442, NULL, 'SALIX', 0,'72.60', CURDATE(), CURDATE(), CURDATE()),
|
||||||
(16, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 106, 2, 7, 126, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
|
(16, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 106, 2, 7, 126, 442, NULL, 'SALIX', 0,'155.89', CURDATE(), CURDATE(), CURDATE()),
|
||||||
(17, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 107, 1, 4, 127, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
|
(17, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 107, 1, 4, 127, 442, NULL, 'SALIX', 0,'72.60', CURDATE(), CURDATE(), CURDATE()),
|
||||||
(18, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 108, 1, 4, 128, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
|
(18, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 108, 1, 4, 128, 442, NULL, 'SALIX', 0,'72.60', CURDATE(), CURDATE(), CURDATE()),
|
||||||
(19, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 109, 1, 5, 129, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
|
(19, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 109, 1, 5, 129, 442, NULL, 'SALIX', 0,'16.50', CURDATE(), CURDATE(), CURDATE()),
|
||||||
(20, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 109, 1, 5, 101, 442, NULL, 'SALIX', 0, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH)),
|
(20, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 109, 1, 5, 101, 442, NULL, 'SALIX', 0,'21.45', DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH)),
|
||||||
(21, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 109, 1, 5, 102, 442, NULL, 'SALIX', 0, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH)),
|
(21, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 109, 1, 5, 102, 442, NULL, 'SALIX', 0,'0.00', DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH)),
|
||||||
(22, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 109, 1, 5, 103, 442, NULL, 'SALIX', 0, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH));
|
(22, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 109, 1, 5, 103, 442, NULL, 'SALIX', 0,'148.50', DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH));
|
||||||
|
|
||||||
INSERT INTO `hedera`.`orderRow`(`id`, `orderFk`, `itemFk`, `warehouseFk`, `shipment`, `amount`, `price`, `rate`, `created`, `saleFk`)
|
INSERT INTO `hedera`.`orderRow`(`id`, `orderFk`, `itemFk`, `warehouseFk`, `shipment`, `amount`, `price`, `rate`, `created`, `saleFk`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -1455,6 +1505,9 @@ INSERT INTO `vn`.`clientContact`(`id`, `clientFk`, `name`, `phone`)
|
||||||
(3, 101, 'contact 3', 222333444),
|
(3, 101, 'contact 3', 222333444),
|
||||||
(4, 102, 'contact 1', 876543219);
|
(4, 102, 'contact 1', 876543219);
|
||||||
|
|
||||||
|
INSERT INTO `vn`.`workerManaExcluded`(`workerFk`)
|
||||||
|
VALUES
|
||||||
|
(9);
|
||||||
/*
|
/*
|
||||||
el mana de los trabajadores lo podemos poner a mano en la tabla si lo calculamos antes,
|
el mana de los trabajadores lo podemos poner a mano en la tabla si lo calculamos antes,
|
||||||
pero si hazemos alguna modificacion en alguna tabla que utiliza para calcularlo ya no seria correcto
|
pero si hazemos alguna modificacion en alguna tabla que utiliza para calcularlo ya no seria correcto
|
||||||
|
@ -1661,11 +1714,13 @@ INSERT INTO `vn`.`workCenterHoliday` (`workCenterFk`, `days`, `year`)
|
||||||
('1', '24.5', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 YEAR))),
|
('1', '24.5', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 YEAR))),
|
||||||
('5', '23', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 YEAR)));
|
('5', '23', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 YEAR)));
|
||||||
|
|
||||||
INSERT INTO `postgresql`.`calendar_state` (`calendar_state_id`, `type`, `rgb`, `code`)
|
INSERT INTO `postgresql`.`calendar_state` (`calendar_state_id`, `type`, `rgb`, `code`, `holidayEntitlementRate`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 'Holidays', '#FF4444', 'holiday'),
|
(1, 'Holidays', '#FF4444', 'holiday', 0),
|
||||||
(2, 'Leave of absence', '#C71585', 'absence'),
|
(2, 'Leave of absence', '#C71585', 'absence', 0),
|
||||||
(6, 'Half holiday', '#E65F00', 'halfHoliday');
|
(6, 'Half holiday', '#E65F00', 'halfHoliday', 0),
|
||||||
|
(20, 'Furlough', '#97B92F', 'furlough', 1),
|
||||||
|
(21, 'Furlough half day', '#778899', 'halfFurlough', 0.5);
|
||||||
|
|
||||||
INSERT INTO `postgresql`.`calendar_employee` (`business_id`, `calendar_state_id`, `date`)
|
INSERT INTO `postgresql`.`calendar_employee` (`business_id`, `calendar_state_id`, `date`)
|
||||||
VALUES
|
VALUES
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -80,7 +80,6 @@ IGNORETABLES=(
|
||||||
--ignore-table=vn.ticketRequest__
|
--ignore-table=vn.ticketRequest__
|
||||||
--ignore-table=vn.ticketToPrepare
|
--ignore-table=vn.ticketToPrepare
|
||||||
--ignore-table=vn.till__
|
--ignore-table=vn.till__
|
||||||
--ignore-table=vn.time
|
|
||||||
--ignore-table=vn.travelThermograph__
|
--ignore-table=vn.travelThermograph__
|
||||||
--ignore-table=vn.travel_cloneWeekly
|
--ignore-table=vn.travel_cloneWeekly
|
||||||
--ignore-table=vn.unary
|
--ignore-table=vn.unary
|
||||||
|
|
|
@ -28,6 +28,7 @@ services:
|
||||||
volumes:
|
volumes:
|
||||||
- /mnt/storage/pdfs:/var/lib/salix/pdfs
|
- /mnt/storage/pdfs:/var/lib/salix/pdfs
|
||||||
- /mnt/storage/dms:/var/lib/salix/dms
|
- /mnt/storage/dms:/var/lib/salix/dms
|
||||||
|
- /mnt/storage/image:/var/lib/salix/image
|
||||||
deploy:
|
deploy:
|
||||||
replicas: 6
|
replicas: 6
|
||||||
configs:
|
configs:
|
||||||
|
|
|
@ -558,7 +558,7 @@ let actions = {
|
||||||
}, selector);
|
}, selector);
|
||||||
},
|
},
|
||||||
|
|
||||||
closePopup: async function(selector) {
|
closePopup: async function() {
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
this.keyboard.press('Escape'),
|
this.keyboard.press('Escape'),
|
||||||
this.waitFor('.vn-popup', {hidden: true}),
|
this.waitFor('.vn-popup', {hidden: true}),
|
||||||
|
|
|
@ -189,8 +189,9 @@ export default {
|
||||||
newPaymentBank: '.vn-dialog.shown vn-autocomplete[ng-model="$ctrl.receipt.bankFk"]',
|
newPaymentBank: '.vn-dialog.shown vn-autocomplete[ng-model="$ctrl.receipt.bankFk"]',
|
||||||
newPaymentAmount: '.vn-dialog.shown vn-input-number[ng-model="$ctrl.receipt.amountPaid"]',
|
newPaymentAmount: '.vn-dialog.shown vn-input-number[ng-model="$ctrl.receipt.amountPaid"]',
|
||||||
saveButton: '.vn-dialog.shown [response="accept"]',
|
saveButton: '.vn-dialog.shown [response="accept"]',
|
||||||
firstBalanceLine: 'vn-client-balance-index vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(8)'
|
firstLineBalance: 'vn-client-balance-index vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(8)',
|
||||||
|
firstLineReference: 'vn-client-balance-index vn-tbody > vn-tr:nth-child(1) > vn-td-editable',
|
||||||
|
firstLineReferenceInput: 'vn-client-balance-index vn-tbody > vn-tr:nth-child(1) > vn-td-editable > div > field > vn-textfield'
|
||||||
},
|
},
|
||||||
webPayment: {
|
webPayment: {
|
||||||
confirmFirstPaymentButton: 'vn-client-web-payment vn-tr:nth-child(1) vn-icon-button[icon="done_all"]',
|
confirmFirstPaymentButton: 'vn-client-web-payment vn-tr:nth-child(1) vn-icon-button[icon="done_all"]',
|
||||||
|
@ -219,23 +220,23 @@ export default {
|
||||||
topbarSearch: 'vn-topbar',
|
topbarSearch: 'vn-topbar',
|
||||||
searchButton: 'vn-searchbar vn-icon[icon="search"]',
|
searchButton: 'vn-searchbar vn-icon[icon="search"]',
|
||||||
closeItemSummaryPreview: '.vn-popup.shown',
|
closeItemSummaryPreview: '.vn-popup.shown',
|
||||||
fieldsToShowButton: 'vn-item-index vn-table > div > div > vn-icon-button[icon="menu"]',
|
fieldsToShowButton: 'vn-item-index vn-table > div > div > vn-icon-button[icon="more_vert"]',
|
||||||
fieldsToShowForm: '.vn-dialog.shown form',
|
fieldsToShowForm: '.vn-popover.shown .content',
|
||||||
firstItemImage: 'vn-item-index vn-tbody > a:nth-child(1) > vn-td:nth-child(1) > img',
|
firstItemImage: 'vn-item-index vn-tbody > a:nth-child(1) > vn-td:nth-child(1) > img',
|
||||||
firstItemImageTd: 'vn-item-index vn-table a:nth-child(1) vn-td:nth-child(1)',
|
firstItemImageTd: 'vn-item-index vn-table a:nth-child(1) vn-td:nth-child(1)',
|
||||||
firstItemId: 'vn-item-index vn-tbody > a:nth-child(1) > vn-td:nth-child(2)',
|
firstItemId: 'vn-item-index vn-tbody > a:nth-child(1) > vn-td:nth-child(2)',
|
||||||
idCheckbox: '.vn-dialog.shown form vn-horizontal:nth-child(2) > vn-check',
|
idCheckbox: '.vn-popover.shown vn-horizontal:nth-child(1) > vn-check',
|
||||||
stemsCheckbox: '.vn-dialog.shown form vn-horizontal:nth-child(3) > vn-check',
|
stemsCheckbox: '.vn-popover.shown vn-horizontal:nth-child(2) > vn-check',
|
||||||
sizeCheckbox: '.vn-dialog.shown form vn-horizontal:nth-child(4) > vn-check',
|
sizeCheckbox: '.vn-popover.shown vn-horizontal:nth-child(3) > vn-check',
|
||||||
nicheCheckbox: '.vn-dialog.shown form vn-horizontal:nth-child(5) > vn-check',
|
nicheCheckbox: '.vn-popover.shown vn-horizontal:nth-child(4) > vn-check',
|
||||||
typeCheckbox: '.vn-dialog.shown form vn-horizontal:nth-child(6) > vn-check',
|
typeCheckbox: '.vn-popover.shown vn-horizontal:nth-child(5) > vn-check',
|
||||||
categoryCheckbox: '.vn-dialog.shown form vn-horizontal:nth-child(7) > vn-check',
|
categoryCheckbox: '.vn-popover.shown vn-horizontal:nth-child(6) > vn-check',
|
||||||
intrastadCheckbox: '.vn-dialog.shown form vn-horizontal:nth-child(8) > vn-check',
|
intrastadCheckbox: '.vn-popover.shown vn-horizontal:nth-child(7) > vn-check',
|
||||||
originCheckbox: '.vn-dialog.shown form vn-horizontal:nth-child(9) > vn-check',
|
originCheckbox: '.vn-popover.shown vn-horizontal:nth-child(8) > vn-check',
|
||||||
buyerCheckbox: '.vn-dialog.shown form vn-horizontal:nth-child(10) > vn-check',
|
buyerCheckbox: '.vn-popover.shown vn-horizontal:nth-child(9) > vn-check',
|
||||||
destinyCheckbox: '.vn-dialog.shown form vn-horizontal:nth-child(11) > vn-check',
|
destinyCheckbox: '.vn-popover.shown vn-horizontal:nth-child(10) > vn-check',
|
||||||
taxClassCheckbox: '.vn-dialog.shown form vn-horizontal:nth-child(12) > vn-check',
|
taxClassCheckbox: '.vn-popover.shown vn-horizontal:nth-child(11) > vn-check',
|
||||||
saveFieldsButton: '.vn-dialog.shown vn-horizontal:nth-child(16) > vn-button > button'
|
saveFieldsButton: '.vn-popover.shown vn-button[label="Save"] > button'
|
||||||
},
|
},
|
||||||
itemCreateView: {
|
itemCreateView: {
|
||||||
temporalName: 'vn-item-create vn-textfield[ng-model="$ctrl.item.provisionalName"]',
|
temporalName: 'vn-item-create vn-textfield[ng-model="$ctrl.item.provisionalName"]',
|
||||||
|
@ -371,7 +372,9 @@ export default {
|
||||||
ticketsIndex: {
|
ticketsIndex: {
|
||||||
openAdvancedSearchButton: 'vn-searchbar .append vn-icon[icon="arrow_drop_down"]',
|
openAdvancedSearchButton: 'vn-searchbar .append vn-icon[icon="arrow_drop_down"]',
|
||||||
advancedSearchInvoiceOut: 'vn-ticket-search-panel vn-textfield[ng-model="filter.refFk"]',
|
advancedSearchInvoiceOut: 'vn-ticket-search-panel vn-textfield[ng-model="filter.refFk"]',
|
||||||
newTicketButton: 'vn-ticket-index a',
|
advancedSearchDaysOnward: 'vn-ticket-search-panel vn-input-number[ng-model="filter.scopeDays"]',
|
||||||
|
advancedSearchButton: 'vn-ticket-search-panel button[type=submit]',
|
||||||
|
newTicketButton: 'vn-ticket-index a[ui-sref="ticket.create"]',
|
||||||
searchResult: 'vn-ticket-index vn-card > vn-table > div > vn-tbody > a.vn-tr',
|
searchResult: 'vn-ticket-index vn-card > vn-table > div > vn-tbody > a.vn-tr',
|
||||||
secondTicketCheckbox: 'vn-ticket-index vn-tbody > a:nth-child(2) > vn-td:nth-child(1) > vn-check',
|
secondTicketCheckbox: 'vn-ticket-index vn-tbody > a:nth-child(2) > vn-td:nth-child(1) > vn-check',
|
||||||
thirdTicketCheckbox: 'vn-ticket-index vn-tbody > a:nth-child(3) > vn-td:nth-child(1) > vn-check',
|
thirdTicketCheckbox: 'vn-ticket-index vn-tbody > a:nth-child(3) > vn-td:nth-child(1) > vn-check',
|
||||||
|
@ -383,7 +386,6 @@ export default {
|
||||||
searchWeeklyResult: 'vn-ticket-weekly-index vn-table vn-tbody > vn-tr',
|
searchWeeklyResult: 'vn-ticket-weekly-index vn-table vn-tbody > vn-tr',
|
||||||
searchResultDate: 'vn-ticket-summary [label=Landed] span',
|
searchResultDate: 'vn-ticket-summary [label=Landed] span',
|
||||||
topbarSearch: 'vn-searchbar',
|
topbarSearch: 'vn-searchbar',
|
||||||
advancedSearchButton: 'vn-ticket-search-panel button[type=submit]',
|
|
||||||
searchButton: 'vn-searchbar vn-icon[icon="search"]',
|
searchButton: 'vn-searchbar vn-icon[icon="search"]',
|
||||||
moreMenu: 'vn-ticket-index vn-icon-button[icon=more_vert]',
|
moreMenu: 'vn-ticket-index vn-icon-button[icon=more_vert]',
|
||||||
sixthWeeklyTicket: 'vn-ticket-weekly-index vn-table vn-tr:nth-child(6)',
|
sixthWeeklyTicket: 'vn-ticket-weekly-index vn-table vn-tr:nth-child(6)',
|
||||||
|
@ -401,8 +403,9 @@ export default {
|
||||||
createButton: `button[type=submit]`
|
createButton: `button[type=submit]`
|
||||||
},
|
},
|
||||||
ticketDescriptor: {
|
ticketDescriptor: {
|
||||||
idLabelValue: 'vn-ticket-descriptor vn-label-value[label="Id"]',
|
id: 'vn-descriptor-content div.top > div',
|
||||||
stateLabelValue: 'vn-ticket-descriptor vn-label-value[label="State"]',
|
stateLabelValue: 'vn-ticket-descriptor vn-label-value[label="State"]',
|
||||||
|
isDeletedIcon: 'vn-ticket-descriptor vn-icon[icon="icon-deletedTicket"]',
|
||||||
goBackToModuleIndexButton: 'vn-ticket-descriptor a[ui-sref="ticket.index"]',
|
goBackToModuleIndexButton: 'vn-ticket-descriptor a[ui-sref="ticket.index"]',
|
||||||
moreMenu: 'vn-ticket-descriptor vn-icon-button[icon=more_vert]',
|
moreMenu: 'vn-ticket-descriptor vn-icon-button[icon=more_vert]',
|
||||||
moreMenuAddStowaway: '.vn-menu [name="addStowaway"]',
|
moreMenuAddStowaway: '.vn-menu [name="addStowaway"]',
|
||||||
|
@ -445,20 +448,23 @@ export default {
|
||||||
savePackagesButton: `button[type=submit]`
|
savePackagesButton: `button[type=submit]`
|
||||||
},
|
},
|
||||||
ticketSales: {
|
ticketSales: {
|
||||||
|
setOk: 'vn-ticket-sale vn-tool-bar > vn-button[label="Ok"] > button',
|
||||||
saleButton: 'vn-left-menu a[ui-sref="ticket.card.sale"]',
|
saleButton: 'vn-left-menu a[ui-sref="ticket.card.sale"]',
|
||||||
saleLine: 'vn-table div > vn-tbody > vn-tr',
|
saleLine: 'vn-table div > vn-tbody > vn-tr',
|
||||||
saleDescriptorPopover: '.vn-popover.shown vn-item-descriptor',
|
saleDescriptorPopover: '.vn-popover.shown vn-item-descriptor',
|
||||||
saleDescriptorPopoverSummaryButton: '.vn-popover.shown vn-item-descriptor a[ui-sref="item.card.summary({id: $ctrl.item.id})"]',
|
saleDescriptorPopoverSummaryButton: '.vn-popover.shown vn-item-descriptor a[ui-sref="item.card.summary({id: $ctrl.descriptor.id})"]',
|
||||||
descriptorItemDiaryButton: '.vn-popover vn-item-descriptor vn-quick-link[icon="icon-transaction"] > a',
|
descriptorItemDiaryButton: '.vn-popover vn-item-descriptor vn-quick-link[icon="icon-transaction"] > a',
|
||||||
newItemFromCatalogButton: 'vn-ticket-sale vn-float-button[icon="add"]',
|
newItemFromCatalogButton: 'vn-ticket-sale vn-float-button[icon="add"]',
|
||||||
newItemButton: 'vn-ticket-sale vn-card vn-icon-button[icon="add_circle"]',
|
newItemButton: 'vn-ticket-sale vn-card vn-icon-button[icon="add_circle"]',
|
||||||
moreMenu: 'vn-ticket-sale vn-tool-bar > vn-button-menu[vn-id="more-button"] > div > button',
|
moreMenu: 'vn-ticket-sale vn-button[label="More"]',
|
||||||
moreMenuCreateClaim: '.vn-drop-down.shown li[name="Add claim"]',
|
moreMenuCreateClaim: 'vn-item[name="claim"]',
|
||||||
moreMenuReserve: '.vn-drop-down.shown li[name="Mark as reserved"]',
|
moreMenuReserve: 'vn-item[name="reserve"]',
|
||||||
moreMenuUnmarkReseved: '.vn-drop-down.shown li[name="Unmark as reserved"]',
|
moreMenuUnmarkReseved: 'vn-item[name="unreserve"]',
|
||||||
moreMenuUpdateDiscount: '.vn-drop-down.shown li[name="Update discount"]',
|
moreMenuUpdateDiscount: 'vn-item[name="discount"]',
|
||||||
|
moreMenuUpdateDiscountInput: 'vn-input-number[ng-model="$ctrl.edit.discount"] input',
|
||||||
transferQuantityInput: '.vn-popover.shown vn-table > div > vn-tbody > vn-tr > vn-td-editable > span > text',
|
transferQuantityInput: '.vn-popover.shown vn-table > div > vn-tbody > vn-tr > vn-td-editable > span > text',
|
||||||
transferQuantityCell: '.vn-popover.shown vn-table > div > vn-tbody > vn-tr > vn-td-editable',
|
transferQuantityCell: '.vn-popover.shown vn-table > div > vn-tbody > vn-tr > vn-td-editable',
|
||||||
|
firstSaleId: 'vn-ticket-sale vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(4) > span',
|
||||||
firstSaleClaimIcon: 'vn-ticket-sale vn-table vn-tbody > vn-tr:nth-child(1) vn-icon[icon="icon-claims"]',
|
firstSaleClaimIcon: 'vn-ticket-sale vn-table vn-tbody > vn-tr:nth-child(1) vn-icon[icon="icon-claims"]',
|
||||||
firstSaleDescriptorImage: '.vn-popover.shown vn-item-descriptor img',
|
firstSaleDescriptorImage: '.vn-popover.shown vn-item-descriptor img',
|
||||||
firstSaleText: 'vn-table div > vn-tbody > vn-tr:nth-child(1)',
|
firstSaleText: 'vn-table div > vn-tbody > vn-tr:nth-child(1)',
|
||||||
|
@ -468,9 +474,9 @@ export default {
|
||||||
firstSaleQuantityCell: 'vn-ticket-sale vn-tr:nth-child(1) > vn-td-editable:nth-child(5)',
|
firstSaleQuantityCell: 'vn-ticket-sale vn-tr:nth-child(1) > vn-td-editable:nth-child(5)',
|
||||||
firstSaleIdAutocomplete: 'vn-ticket-sale vn-table vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(4) > vn-autocomplete',
|
firstSaleIdAutocomplete: 'vn-ticket-sale vn-table vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(4) > vn-autocomplete',
|
||||||
firstSalePrice: 'vn-ticket-sale vn-table vn-tr:nth-child(1) > vn-td:nth-child(7) > span',
|
firstSalePrice: 'vn-ticket-sale vn-table vn-tr:nth-child(1) > vn-td:nth-child(7) > span',
|
||||||
firstSalePriceInput: '.vn-popover.shown [ng-model="$ctrl.editedPrice"]',
|
firstSalePriceInput: '.vn-popover.shown input[ng-model="$ctrl.field"]',
|
||||||
firstSaleDiscount: 'vn-ticket-sale vn-table vn-tr:nth-child(1) > vn-td:nth-child(8) > span',
|
firstSaleDiscount: 'vn-ticket-sale vn-table vn-tr:nth-child(1) > vn-td:nth-child(8) > span',
|
||||||
firstSaleDiscountInput: '.vn-popover.shown [ng-model="$ctrl.newDiscount"]',
|
firstSaleDiscountInput: '.vn-popover.shown [ng-model="$ctrl.field"]',
|
||||||
firstSaleImport: 'vn-ticket-sale:nth-child(1) vn-td:nth-child(9)',
|
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)',
|
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-fetched-tags section',
|
firstSaleColour: 'vn-ticket-sale vn-tr:nth-child(1) vn-fetched-tags section',
|
||||||
|
@ -486,20 +492,22 @@ export default {
|
||||||
secondSaleIdInput: 'vn-ticket-sale vn-table vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(4) > vn-autocomplete',
|
secondSaleIdInput: 'vn-ticket-sale vn-table vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(4) > vn-autocomplete',
|
||||||
secondSaleIdAutocomplete: 'vn-ticket-sale vn-table vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(4) > vn-autocomplete',
|
secondSaleIdAutocomplete: 'vn-ticket-sale vn-table 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',
|
secondSaleQuantity: 'vn-ticket-sale vn-table vn-tr:nth-child(2) vn-input-number',
|
||||||
|
secondSaleQuantityCell: 'vn-ticket-sale > div > vn-card > vn-table > div > vn-tbody > vn-tr:nth-child(2) > vn-td-editable:nth-child(5)',
|
||||||
secondSaleConceptCell: 'vn-ticket-sale vn-tbody > :nth-child(2) > :nth-child(6)',
|
secondSaleConceptCell: 'vn-ticket-sale vn-tbody > :nth-child(2) > :nth-child(6)',
|
||||||
secondSaleConceptInput: 'vn-ticket-sale vn-tbody > :nth-child(2) > vn-td-editable.ng-isolate-scope.selected vn-textfield',
|
secondSaleConceptInput: 'vn-ticket-sale vn-tbody > :nth-child(2) > vn-td-editable.ng-isolate-scope.selected vn-textfield',
|
||||||
totalImport: 'vn-ticket-sale > vn-vertical > vn-card > vn-vertical > vn-horizontal > vn-one > p:nth-child(3) > strong',
|
totalImport: 'vn-ticket-sale vn-one.taxes > p:nth-child(3) > strong',
|
||||||
selectAllSalesCheckbox: 'vn-ticket-sale vn-thead vn-check',
|
selectAllSalesCheckbox: 'vn-ticket-sale vn-thead vn-check',
|
||||||
secondSaleCheckbox: 'vn-ticket-sale vn-tr:nth-child(2) vn-check[ng-model="sale.checked"]',
|
secondSaleCheckbox: 'vn-ticket-sale vn-tr:nth-child(2) vn-check[ng-model="sale.checked"]',
|
||||||
thirdSaleCheckbox: 'vn-ticket-sale vn-tr:nth-child(3) vn-check[ng-model="sale.checked"]',
|
thirdSaleCheckbox: 'vn-ticket-sale vn-tr:nth-child(3) vn-check[ng-model="sale.checked"]',
|
||||||
deleteSaleButton: 'vn-ticket-sale vn-tool-bar > vn-button[icon="delete"]',
|
deleteSaleButton: 'vn-ticket-sale vn-tool-bar > vn-button[icon="delete"]',
|
||||||
transferSaleButton: 'vn-ticket-sale vn-tool-bar > vn-button[icon="call_split"]',
|
transferSaleButton: 'vn-ticket-sale vn-tool-bar > vn-button[icon="call_split"]',
|
||||||
moveToTicketInput: '.vn-popover.shown vn-textfield[ng-model="$ctrl.transfer.ticketId"]',
|
moveToTicketInput: 'form vn-input-number[ng-model="$ctrl.transfer.ticketId"] input',
|
||||||
moveToTicketButton: '.vn-popover.shown vn-icon[icon="arrow_forward_ios"]',
|
moveToTicketButton: '.vn-popover.shown vn-icon[icon="arrow_forward_ios"]',
|
||||||
moveToNewTicketButton: '.vn-popover.shown vn-button[label="New ticket"]',
|
moveToNewTicketButton: '.vn-popover.shown vn-button[label="New ticket"]',
|
||||||
acceptDeleteLineButton: '.vn-confirm.shown button[response=accept]',
|
acceptDeleteLineButton: '.vn-confirm.shown button[response=accept]',
|
||||||
acceptDeleteTicketButton: '.vn-confirm.shown button[response=accept]',
|
acceptDeleteTicketButton: '.vn-confirm.shown button[response=accept]',
|
||||||
stateMenuButton: 'vn-ticket-sale vn-tool-bar > vn-button-menu[label="State"]'
|
stateMenuButton: 'vn-ticket-sale vn-tool-bar > vn-button-menu[label="State"]',
|
||||||
|
stateMenuFixOption: ''
|
||||||
},
|
},
|
||||||
ticketTracking: {
|
ticketTracking: {
|
||||||
trackingButton: 'vn-left-menu a[ui-sref="ticket.card.tracking.index"]',
|
trackingButton: 'vn-left-menu a[ui-sref="ticket.card.tracking.index"]',
|
||||||
|
@ -538,6 +546,7 @@ export default {
|
||||||
logButton: 'vn-left-menu a[ui-sref="ticket.card.log"]',
|
logButton: 'vn-left-menu a[ui-sref="ticket.card.log"]',
|
||||||
changedBy: 'vn-ticket-log > vn-log vn-tr:nth-child(1) > vn-td:nth-child(2) > span',
|
changedBy: 'vn-ticket-log > vn-log vn-tr:nth-child(1) > vn-td:nth-child(2) > span',
|
||||||
actionTaken: 'vn-ticket-log > vn-log vn-td:nth-child(1) > div > div:nth-child(3) > span.value',
|
actionTaken: 'vn-ticket-log > vn-log vn-td:nth-child(1) > div > div:nth-child(3) > span.value',
|
||||||
|
changes: 'vn-ticket-log vn-data-viewer vn-tbody > vn-tr > vn-td:nth-child(7)',
|
||||||
id: 'vn-ticket-log > vn-log vn-td.before > vn-one:nth-child(1) > div > span.value'
|
id: 'vn-ticket-log > vn-log vn-td.before > vn-one:nth-child(1) > div > span.value'
|
||||||
},
|
},
|
||||||
ticketService: {
|
ticketService: {
|
||||||
|
@ -625,7 +634,7 @@ export default {
|
||||||
},
|
},
|
||||||
ordersIndex: {
|
ordersIndex: {
|
||||||
searchResult: 'vn-order-index vn-card > vn-table > div > vn-tbody > a.vn-tr',
|
searchResult: 'vn-order-index vn-card > vn-table > div > vn-tbody > a.vn-tr',
|
||||||
firstSearchResultTotal: 'vn-order-index vn-card > vn-table > div > vn-tbody vn-tr vn-td:nth-child(9)',
|
secondSearchResultTotal: 'vn-order-index vn-card > vn-table > div > vn-tbody vn-tr:nth-child(2) vn-td:nth-child(9)',
|
||||||
searchResultDate: 'vn-order-index vn-table vn-tbody > a:nth-child(1) > vn-td:nth-child(4)',
|
searchResultDate: 'vn-order-index vn-table vn-tbody > a:nth-child(1) > vn-td:nth-child(4)',
|
||||||
searchResultAddress: 'vn-order-index vn-table vn-tbody > a:nth-child(1) > vn-td:nth-child(6)',
|
searchResultAddress: 'vn-order-index vn-table vn-tbody > a:nth-child(1) > vn-td:nth-child(6)',
|
||||||
searchButton: 'vn-searchbar vn-icon[icon="search"]',
|
searchButton: 'vn-searchbar vn-icon[icon="search"]',
|
||||||
|
@ -682,7 +691,7 @@ export default {
|
||||||
confirmButton: '.vn-confirm.shown button[response="accept"]',
|
confirmButton: '.vn-confirm.shown button[response="accept"]',
|
||||||
},
|
},
|
||||||
routeIndex: {
|
routeIndex: {
|
||||||
addNewRouteButton: 'vn-route-index > a[ui-sref="route.create"]'
|
addNewRouteButton: 'vn-route-index a[ui-sref="route.create"]'
|
||||||
},
|
},
|
||||||
createRouteView: {
|
createRouteView: {
|
||||||
worker: 'vn-route-create vn-autocomplete[ng-model="$ctrl.route.workerFk"]',
|
worker: 'vn-route-create vn-autocomplete[ng-model="$ctrl.route.workerFk"]',
|
||||||
|
@ -797,6 +806,22 @@ export default {
|
||||||
navigateBackToIndex: 'vn-worker-descriptor [name="goToModuleIndex"]',
|
navigateBackToIndex: 'vn-worker-descriptor [name="goToModuleIndex"]',
|
||||||
acceptDeleteDialog: '.vn-confirm.shown button[response="accept"]'
|
acceptDeleteDialog: '.vn-confirm.shown button[response="accept"]'
|
||||||
},
|
},
|
||||||
|
workerCalendar: {
|
||||||
|
year: 'vn-worker-calendar vn-autocomplete[ng-model="$ctrl.year"]',
|
||||||
|
totalHolidaysUsed: 'vn-worker-calendar div.totalBox > div',
|
||||||
|
januaryThirtyFirst: 'vn-worker-calendar vn-calendar:nth-child(2) section:nth-child(33) > div',
|
||||||
|
marchTwentyThird: 'vn-worker-calendar vn-calendar:nth-child(4) section:nth-child(29) > div',
|
||||||
|
mayFourth: 'vn-worker-calendar vn-calendar:nth-child(6) section:nth-child(8) > div',
|
||||||
|
mayEighth: 'vn-worker-calendar vn-calendar:nth-child(6) section:nth-child(12) > div',
|
||||||
|
mayTwelfth: 'vn-worker-calendar vn-calendar:nth-child(6) section:nth-child(16) > div',
|
||||||
|
mayThirteenth: 'vn-worker-calendar vn-calendar:nth-child(6) section:nth-child(17) > div',
|
||||||
|
mayFourteenth: 'vn-worker-calendar vn-calendar:nth-child(6) section:nth-child(18) > div',
|
||||||
|
holidays: 'vn-worker-calendar > vn-side-menu div:nth-child(3) > vn-chip:nth-child(1)',
|
||||||
|
absence: 'vn-worker-calendar > vn-side-menu div:nth-child(3) > vn-chip:nth-child(2)',
|
||||||
|
halfHoliday: 'vn-worker-calendar > vn-side-menu div:nth-child(3) > vn-chip:nth-child(3)',
|
||||||
|
furlough: 'vn-worker-calendar > vn-side-menu div:nth-child(3) > vn-chip:nth-child(4)',
|
||||||
|
halfFurlough: 'vn-worker-calendar > vn-side-menu div:nth-child(3) > vn-chip:nth-child(5)',
|
||||||
|
},
|
||||||
invoiceOutIndex: {
|
invoiceOutIndex: {
|
||||||
topbarSearch: 'vn-searchbar',
|
topbarSearch: 'vn-searchbar',
|
||||||
searchButton: 'vn-searchbar vn-icon[icon="search"]',
|
searchButton: 'vn-searchbar vn-icon[icon="search"]',
|
||||||
|
@ -846,6 +871,13 @@ export default {
|
||||||
createdThermograph: 'vn-travel-thermograph-index vn-tbody > vn-tr',
|
createdThermograph: 'vn-travel-thermograph-index vn-tbody > vn-tr',
|
||||||
upload: 'vn-travel-thermograph-create button[type=submit]'
|
upload: 'vn-travel-thermograph-create button[type=submit]'
|
||||||
},
|
},
|
||||||
|
zoneIndex: {
|
||||||
|
searchResult: 'vn-zone-index a.vn-tr',
|
||||||
|
},
|
||||||
|
zoneDescriptor: {
|
||||||
|
menu: 'vn-zone-descriptor vn-icon-button[vn-popover="menu"]',
|
||||||
|
deleteZone: 'slot-menu vn-item[ng-click="$ctrl.onDelete()"]'
|
||||||
|
},
|
||||||
zoneBasicData: {
|
zoneBasicData: {
|
||||||
name: 'vn-zone-basic-data vn-textfield[ng-model="$ctrl.zone.name"]',
|
name: 'vn-zone-basic-data vn-textfield[ng-model="$ctrl.zone.name"]',
|
||||||
agency: 'vn-zone-basic-data vn-autocomplete[ng-model="$ctrl.zone.agencyModeFk"]',
|
agency: 'vn-zone-basic-data vn-autocomplete[ng-model="$ctrl.zone.agencyModeFk"]',
|
||||||
|
@ -864,8 +896,18 @@ export default {
|
||||||
confirmed: 'vn-entry-summary vn-check[label="Confirmed"]',
|
confirmed: 'vn-entry-summary vn-check[label="Confirmed"]',
|
||||||
},
|
},
|
||||||
entryDescriptor: {
|
entryDescriptor: {
|
||||||
agency: 'vn-entry-descriptor div.body vn-label-value:nth-child(2) span',
|
agency: 'vn-entry-descriptor div.body vn-label-value:nth-child(1) span',
|
||||||
travelsQuicklink: 'vn-entry-descriptor vn-quick-link[icon="local_airport"] > a',
|
travelsQuicklink: 'vn-entry-descriptor vn-quick-link[icon="local_airport"] > a',
|
||||||
entriesQuicklink: 'vn-entry-descriptor vn-quick-link[icon="icon-entry"] > a'
|
entriesQuicklink: 'vn-entry-descriptor vn-quick-link[icon="icon-entry"] > a'
|
||||||
|
},
|
||||||
|
entryLatestBuys: {
|
||||||
|
firstBuy: 'vn-entry-latest-buys vn-tbody > a:nth-child(1)',
|
||||||
|
allBuysCheckBox: 'vn-entry-latest-buys vn-thead vn-check',
|
||||||
|
secondBuyCheckBox: 'vn-entry-latest-buys a:nth-child(2) vn-check[ng-model="buy.checked"]',
|
||||||
|
editBuysButton: 'vn-entry-latest-buys vn-button[icon="edit"]',
|
||||||
|
fieldAutocomplete: 'vn-autocomplete[ng-model="$ctrl.editedColumn.field"]',
|
||||||
|
newValueInput: 'vn-textfield[ng-model="$ctrl.editedColumn.newValue"]',
|
||||||
|
latestBuysSectionButton: 'a[ui-sref="entry.latestBuys"]',
|
||||||
|
acceptEditBuysDialog: 'button[response="accept"]'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -17,6 +17,7 @@ describe('Client Add address path', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should click on the add new address button to access to the new address form`, async() => {
|
it(`should click on the add new address button to access to the new address form`, async() => {
|
||||||
|
await page.waitFor(500);
|
||||||
await page.waitToClick(selectors.clientAddresses.createAddress);
|
await page.waitToClick(selectors.clientAddresses.createAddress);
|
||||||
await page.waitForState('client.card.address.create');
|
await page.waitForState('client.card.address.create');
|
||||||
});
|
});
|
||||||
|
|
|
@ -39,4 +39,18 @@ describe('Client Edit web access path', () => {
|
||||||
|
|
||||||
expect(result).toEqual('Hulk');
|
expect(result).toEqual('Hulk');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it(`should navigate to the log section`, async() => {
|
||||||
|
await page.accessToSection('client.card.log');
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should confirm the log is showing the updated data for the client`, async() => {
|
||||||
|
let lastModificationPreviousValue = await page
|
||||||
|
.waitToGetProperty(selectors.clientLog.lastModificationPreviousValue, 'innerText');
|
||||||
|
let lastModificationCurrentValue = await page
|
||||||
|
.waitToGetProperty(selectors.clientLog.lastModificationCurrentValue, 'innerText');
|
||||||
|
|
||||||
|
expect(lastModificationPreviousValue).toEqual('name: BruceBanner active: true');
|
||||||
|
expect(lastModificationCurrentValue).toEqual('name: Hulk active: false');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -53,15 +53,28 @@ describe('Client balance path', () => {
|
||||||
expect(message.type).toBe('success');
|
expect(message.type).toBe('success');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should check balance is now 0 and the company is now VNL becouse the user local settings were removed', async() => {
|
it('should edit the 1st line reference', async() => {
|
||||||
|
await page.waitToClick(selectors.clientBalance.firstLineReference);
|
||||||
|
await page.write(selectors.clientBalance.firstLineReferenceInput, 'Miscellaneous payment');
|
||||||
|
await page.keyboard.press('Enter');
|
||||||
|
const message = await page.waitForSnackbar();
|
||||||
|
|
||||||
|
expect(message.type).toBe('success');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should check balance is now 0, the reference was saved and the company is now VNL becouse the user local settings were removed', async() => {
|
||||||
await page.waitForSpinnerLoad();
|
await page.waitForSpinnerLoad();
|
||||||
let company = await page
|
let company = await page
|
||||||
.waitToGetProperty(selectors.clientBalance.company, 'value');
|
.waitToGetProperty(selectors.clientBalance.company, 'value');
|
||||||
|
|
||||||
|
let reference = await page
|
||||||
|
.waitToGetProperty(selectors.clientBalance.firstLineReference, 'innerText');
|
||||||
|
|
||||||
let firstBalanceLine = await page
|
let firstBalanceLine = await page
|
||||||
.waitToGetProperty(selectors.clientBalance.firstBalanceLine, 'innerText');
|
.waitToGetProperty(selectors.clientBalance.firstLineBalance, 'innerText');
|
||||||
|
|
||||||
expect(company).toEqual('VNL');
|
expect(company).toEqual('VNL');
|
||||||
|
expect(reference).toEqual('Miscellaneous payment');
|
||||||
expect(firstBalanceLine).toContain('0.00');
|
expect(firstBalanceLine).toContain('0.00');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -76,7 +89,7 @@ describe('Client balance path', () => {
|
||||||
|
|
||||||
it('should check balance is now -100', async() => {
|
it('should check balance is now -100', async() => {
|
||||||
let result = await page
|
let result = await page
|
||||||
.waitToGetProperty(selectors.clientBalance.firstBalanceLine, 'innerText');
|
.waitToGetProperty(selectors.clientBalance.firstLineBalance, 'innerText');
|
||||||
|
|
||||||
expect(result).toContain('-€100.00');
|
expect(result).toContain('-€100.00');
|
||||||
});
|
});
|
||||||
|
@ -92,7 +105,7 @@ describe('Client balance path', () => {
|
||||||
|
|
||||||
it('should check balance is now 50', async() => {
|
it('should check balance is now 50', async() => {
|
||||||
let result = await page
|
let result = await page
|
||||||
.waitToGetProperty(selectors.clientBalance.firstBalanceLine, 'innerText');
|
.waitToGetProperty(selectors.clientBalance.firstLineBalance, 'innerText');
|
||||||
|
|
||||||
expect(result).toEqual('€50.00');
|
expect(result).toEqual('€50.00');
|
||||||
});
|
});
|
||||||
|
|
|
@ -0,0 +1,137 @@
|
||||||
|
import selectors from '../../helpers/selectors.js';
|
||||||
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
|
describe('Worker calendar path', () => {
|
||||||
|
let reasonableTimeBetweenClicks = 400;
|
||||||
|
let browser;
|
||||||
|
let page;
|
||||||
|
beforeAll(async() => {
|
||||||
|
browser = await getBrowser();
|
||||||
|
page = browser.page;
|
||||||
|
await page.loginAndModule('hr', 'worker');
|
||||||
|
await page.accessToSearchResult('Hank Pym');
|
||||||
|
await page.accessToSection('worker.card.calendar');
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async() => {
|
||||||
|
await browser.close();
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('as hr', () => {
|
||||||
|
it('should check 5 total holidays have been used so far before testing anything', async() => {
|
||||||
|
const result = await page.waitToGetProperty(selectors.workerCalendar.totalHolidaysUsed, 'innerText');
|
||||||
|
|
||||||
|
expect(result).toContain(' 5 ');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should set two days as holidays on the calendar', async() => {
|
||||||
|
await page.waitToClick(selectors.workerCalendar.holidays);
|
||||||
|
await page.waitFor(reasonableTimeBetweenClicks);
|
||||||
|
await page.waitToClick(selectors.workerCalendar.januaryThirtyFirst);
|
||||||
|
|
||||||
|
await page.waitFor(reasonableTimeBetweenClicks);
|
||||||
|
await page.waitToClick(selectors.workerCalendar.absence);
|
||||||
|
await page.waitFor(reasonableTimeBetweenClicks);
|
||||||
|
await page.waitToClick(selectors.workerCalendar.marchTwentyThird);
|
||||||
|
|
||||||
|
await page.waitFor(reasonableTimeBetweenClicks);
|
||||||
|
await page.waitToClick(selectors.workerCalendar.halfHoliday);
|
||||||
|
await page.waitFor(reasonableTimeBetweenClicks);
|
||||||
|
await page.waitToClick(selectors.workerCalendar.mayFourth);
|
||||||
|
|
||||||
|
await page.waitFor(reasonableTimeBetweenClicks);
|
||||||
|
await page.waitToClick(selectors.workerCalendar.furlough);
|
||||||
|
await page.waitFor(reasonableTimeBetweenClicks);
|
||||||
|
await page.waitToClick(selectors.workerCalendar.mayTwelfth);
|
||||||
|
await page.waitToClick(selectors.workerCalendar.mayThirteenth);
|
||||||
|
await page.waitToClick(selectors.workerCalendar.mayFourteenth);
|
||||||
|
|
||||||
|
await page.waitFor(reasonableTimeBetweenClicks);
|
||||||
|
await page.waitToClick(selectors.workerCalendar.halfFurlough);
|
||||||
|
await page.waitFor(reasonableTimeBetweenClicks);
|
||||||
|
await page.waitToClick(selectors.workerCalendar.mayEighth);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should check the total holidays increased by 1.5', async() => {
|
||||||
|
const result = await page.waitToGetProperty(selectors.workerCalendar.totalHolidaysUsed, 'innerText');
|
||||||
|
|
||||||
|
expect(result).toContain(' 6.5 ');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe(`as salesBoss`, () => {
|
||||||
|
it(`should log in and get to Hank's calendar`, async() => {
|
||||||
|
await page.loginAndModule('salesBoss', 'worker');
|
||||||
|
await page.accessToSearchResult('Hank Pym');
|
||||||
|
await page.accessToSection('worker.card.calendar');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should undo what was done here', async() => {
|
||||||
|
await page.waitFor(reasonableTimeBetweenClicks);
|
||||||
|
await page.waitToClick(selectors.workerCalendar.holidays);
|
||||||
|
await page.waitFor(reasonableTimeBetweenClicks);
|
||||||
|
await page.waitToClick(selectors.workerCalendar.januaryThirtyFirst);
|
||||||
|
|
||||||
|
await page.waitFor(reasonableTimeBetweenClicks);
|
||||||
|
await page.waitToClick(selectors.workerCalendar.absence);
|
||||||
|
await page.waitFor(reasonableTimeBetweenClicks);
|
||||||
|
await page.waitToClick(selectors.workerCalendar.marchTwentyThird);
|
||||||
|
|
||||||
|
await page.waitFor(reasonableTimeBetweenClicks);
|
||||||
|
await page.waitToClick(selectors.workerCalendar.halfHoliday);
|
||||||
|
await page.waitFor(reasonableTimeBetweenClicks);
|
||||||
|
await page.waitToClick(selectors.workerCalendar.mayFourth);
|
||||||
|
|
||||||
|
await page.waitFor(reasonableTimeBetweenClicks);
|
||||||
|
await page.waitToClick(selectors.workerCalendar.furlough);
|
||||||
|
await page.waitFor(reasonableTimeBetweenClicks);
|
||||||
|
await page.waitToClick(selectors.workerCalendar.mayTwelfth);
|
||||||
|
await page.waitToClick(selectors.workerCalendar.mayThirteenth);
|
||||||
|
await page.waitToClick(selectors.workerCalendar.mayFourteenth);
|
||||||
|
|
||||||
|
await page.waitFor(reasonableTimeBetweenClicks);
|
||||||
|
await page.waitToClick(selectors.workerCalendar.halfFurlough);
|
||||||
|
await page.waitFor(reasonableTimeBetweenClicks);
|
||||||
|
await page.waitToClick(selectors.workerCalendar.mayEighth);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should check the total holidays used are back to what it was', async() => {
|
||||||
|
const result = await page.waitToGetProperty(selectors.workerCalendar.totalHolidaysUsed, 'innerText');
|
||||||
|
|
||||||
|
expect(result).toContain(' 5 ');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe(`as Hank`, () => {
|
||||||
|
it(`should log in and get to his calendar`, async() => {
|
||||||
|
await page.loginAndModule('HankPym', 'worker');
|
||||||
|
await page.accessToSearchResult('Hank Pym');
|
||||||
|
await page.accessToSection('worker.card.calendar');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should make a futile attempt to add holidays', async() => {
|
||||||
|
await page.waitFor(reasonableTimeBetweenClicks);
|
||||||
|
await page.waitToClick(selectors.workerCalendar.holidays);
|
||||||
|
await page.waitFor(reasonableTimeBetweenClicks);
|
||||||
|
await page.waitToClick(selectors.workerCalendar.januaryThirtyFirst);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should check the total holidays used are now the initial ones', async() => {
|
||||||
|
const result = await page.waitToGetProperty(selectors.workerCalendar.totalHolidaysUsed, 'innerText');
|
||||||
|
|
||||||
|
expect(result).toContain(' 5 ');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should use the year selector to go to the previous year', async() => {
|
||||||
|
const date = new Date();
|
||||||
|
const lastYear = (date.getFullYear() - 1).toString();
|
||||||
|
|
||||||
|
await page.autocompleteSearch(selectors.workerCalendar.year, lastYear);
|
||||||
|
|
||||||
|
await page.waitFor(reasonableTimeBetweenClicks);
|
||||||
|
const result = await page.waitToGetProperty(selectors.workerCalendar.totalHolidaysUsed, 'innerText');
|
||||||
|
|
||||||
|
expect(result).toContain(' 0 ');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
|
@ -55,7 +55,7 @@ describe('Item index path', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should mark all unchecked boxes to leave the index as it was', async() => {
|
it('should mark all unchecked boxes to leave the index as it was', async() => {
|
||||||
await page.waitFor(3000); // otherwise the snackbar doesnt appear some times.
|
await page.waitFor(500); // otherwise the snackbar doesnt appear some times.
|
||||||
await page.waitToClick(selectors.itemsIndex.fieldsToShowButton);
|
await page.waitToClick(selectors.itemsIndex.fieldsToShowButton);
|
||||||
await page.waitToClick(selectors.itemsIndex.idCheckbox);
|
await page.waitToClick(selectors.itemsIndex.idCheckbox);
|
||||||
await page.waitToClick(selectors.itemsIndex.stemsCheckbox);
|
await page.waitToClick(selectors.itemsIndex.stemsCheckbox);
|
||||||
|
|
|
@ -46,7 +46,6 @@ describe('Item log path', () => {
|
||||||
it(`should search for the created item and navigate to it's log section`, async() => {
|
it(`should search for the created item and navigate to it's log section`, async() => {
|
||||||
await page.accessToSearchResult('Knowledge artifact');
|
await page.accessToSearchResult('Knowledge artifact');
|
||||||
await page.accessToSection('item.card.log');
|
await page.accessToSection('item.card.log');
|
||||||
await page.waitForState('item.card.log');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should confirm the log is showing 5 entries`, async() => {
|
it(`should confirm the log is showing 5 entries`, async() => {
|
||||||
|
|
|
@ -31,7 +31,7 @@ describe('Item request path', () => {
|
||||||
it('should the status of the request should now be accepted', async() => {
|
it('should the status of the request should now be accepted', async() => {
|
||||||
let status = await page.waitToGetProperty(selectors.itemRequest.firstRequestStatus, 'innerText');
|
let status = await page.waitToGetProperty(selectors.itemRequest.firstRequestStatus, 'innerText');
|
||||||
|
|
||||||
expect(status).toContain('Aceptada');
|
expect(status).toContain('Accepted');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should now click on the second declain request icon then type the reason', async() => {
|
it('should now click on the second declain request icon then type the reason', async() => {
|
||||||
|
@ -40,6 +40,6 @@ describe('Item request path', () => {
|
||||||
await page.respondToDialog('accept');
|
await page.respondToDialog('accept');
|
||||||
let status = await page.waitToGetProperty(selectors.itemRequest.firstRequestStatus, 'innerText');
|
let status = await page.waitToGetProperty(selectors.itemRequest.firstRequestStatus, 'innerText');
|
||||||
|
|
||||||
expect(status).toContain('Denegada');
|
expect(status).toContain('Denied');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -72,7 +72,8 @@ describe('Ticket List sale path', () => {
|
||||||
}, {}, selectors.ticketSales.secondSaleIdAutocomplete, searchValue);
|
}, {}, selectors.ticketSales.secondSaleIdAutocomplete, searchValue);
|
||||||
|
|
||||||
await page.keyboard.press('Enter');
|
await page.keyboard.press('Enter');
|
||||||
await page.write(selectors.ticketSales.secondSaleQuantity, '1');
|
await page.waitToClick(selectors.ticketSales.secondSaleQuantityCell);
|
||||||
|
await page.type(selectors.ticketSales.secondSaleQuantity, '1');
|
||||||
await page.keyboard.press('Enter');
|
await page.keyboard.press('Enter');
|
||||||
const message = await page.waitForSnackbar();
|
const message = await page.waitForSnackbar();
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
import selectors from '../../../helpers/selectors.js';
|
import selectors from '../../../helpers/selectors.js';
|
||||||
import getBrowser from '../../../helpers/puppeteer';
|
import getBrowser from '../../../helpers/puppeteer';
|
||||||
|
|
||||||
// #1632 [e2e] ticket.sale - Transferir líneas
|
describe('Ticket Edit sale path', () => {
|
||||||
xdescribe('Ticket Edit sale path', () => {
|
|
||||||
let browser;
|
let browser;
|
||||||
let page;
|
let page;
|
||||||
|
|
||||||
|
@ -10,7 +9,7 @@ xdescribe('Ticket Edit sale path', () => {
|
||||||
browser = await getBrowser();
|
browser = await getBrowser();
|
||||||
page = browser.page;
|
page = browser.page;
|
||||||
await page.loginAndModule('salesPerson', 'ticket');
|
await page.loginAndModule('salesPerson', 'ticket');
|
||||||
await page.accessToSearchResult(16);
|
await page.accessToSearchResult('16');
|
||||||
await page.accessToSection('ticket.card.sale');
|
await page.accessToSection('ticket.card.sale');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -20,29 +19,50 @@ xdescribe('Ticket Edit sale path', () => {
|
||||||
|
|
||||||
it(`should click on the first sale claim icon to navigate over there`, async() => {
|
it(`should click on the first sale claim icon to navigate over there`, async() => {
|
||||||
await page.waitToClick(selectors.ticketSales.firstSaleClaimIcon);
|
await page.waitToClick(selectors.ticketSales.firstSaleClaimIcon);
|
||||||
await page.wait(selectors.claimBasicData.claimState);
|
await page.waitForState('claim.card.basicData');
|
||||||
const url = await page.parsedUrl();
|
|
||||||
|
|
||||||
expect(url.hash).toEqual('#!/claim/2/basic-data');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should navigate to the tickets index', async() => {
|
it('should navigate to the tickets index', async() => {
|
||||||
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
|
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
|
||||||
await page.wait(selectors.globalItems.applicationsMenuVisible);
|
await page.wait(selectors.globalItems.applicationsMenuVisible);
|
||||||
await page.waitToClick(selectors.globalItems.ticketsButton);
|
await page.waitToClick(selectors.globalItems.ticketsButton);
|
||||||
await page.wait(selectors.ticketsIndex.topbarSearch);
|
await page.waitForState('ticket.index');
|
||||||
const url = await page.parsedUrl();
|
|
||||||
|
|
||||||
expect(url.hash).toEqual('#!/ticket/index');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should search for a ticket and then navigate to it's sales`, async() => {
|
it(`should search for a ticket and then navigate to it's sales`, async() => {
|
||||||
await page.accessToSearchResult(16);
|
await page.accessToSearchResult('16');
|
||||||
await page.accessToSection('ticket.card.sale');
|
await page.accessToSection('ticket.card.sale');
|
||||||
await page.waitForURL('/sale');
|
});
|
||||||
const url = await page.parsedUrl();
|
|
||||||
|
|
||||||
expect(url.hash).toContain('/sale');
|
it(`should set the ticket as libre`, async() => {
|
||||||
|
await page.waitToClick(selectors.ticketSales.stateMenuButton);
|
||||||
|
await page.write('body > div > div > div.content > div.filter.ng-scope > vn-textfield', 'libre');
|
||||||
|
await page.waitFor(500);
|
||||||
|
await page.keyboard.press('Enter');
|
||||||
|
const message = await page.waitForSnackbar();
|
||||||
|
|
||||||
|
expect(message.type).toBe('success');
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should check it's state is libre now`, async() => {
|
||||||
|
await page.waitForTextInElement(selectors.ticketDescriptor.stateLabelValue, 'Libre');
|
||||||
|
const result = await page.waitToGetProperty(selectors.ticketDescriptor.stateLabelValue, 'innerText');
|
||||||
|
|
||||||
|
expect(result).toEqual('State Libre');
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should set the ticket as OK`, async() => {
|
||||||
|
await page.waitToClick(selectors.ticketSales.setOk);
|
||||||
|
const message = await page.waitForSnackbar();
|
||||||
|
|
||||||
|
expect(message.type).toBe('success');
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should check it's state is OK now`, async() => {
|
||||||
|
await page.waitForTextInElement(selectors.ticketDescriptor.stateLabelValue, 'OK');
|
||||||
|
const result = await page.waitToGetProperty(selectors.ticketDescriptor.stateLabelValue, 'innerText');
|
||||||
|
|
||||||
|
expect(result).toEqual('State OK');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should check the zoomed image isn't present`, async() => {
|
it(`should check the zoomed image isn't present`, async() => {
|
||||||
|
@ -52,26 +72,20 @@ xdescribe('Ticket Edit sale path', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should click on the thumbnail image of the 1st sale and see the zoomed image`, async() => {
|
it(`should click on the thumbnail image of the 1st sale and see the zoomed image`, async() => {
|
||||||
await page.clickIfVisible(selectors.ticketSales.firstSaleThumbnailImage);
|
await page.waitToClick(selectors.ticketSales.firstSaleThumbnailImage);
|
||||||
const result = await page.countElement(selectors.ticketSales.firstSaleZoomedImage);
|
const result = await page.countElement(selectors.ticketSales.firstSaleZoomedImage);
|
||||||
|
|
||||||
expect(result).toEqual(1);
|
expect(result).toEqual(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should click on the zoomed image to close it`, async() => {
|
it(`should click on the zoomed image to close it`, async() => {
|
||||||
await page.clickIfVisible(selectors.ticketSales.firstSaleZoomedImage);
|
await page.waitToClick(selectors.ticketSales.firstSaleZoomedImage);
|
||||||
const result = await page.countElement(selectors.ticketSales.firstSaleZoomedImage);
|
const result = await page.countElement(selectors.ticketSales.firstSaleZoomedImage);
|
||||||
|
|
||||||
expect(result).toEqual(0);
|
expect(result).toEqual(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should confirm the item descriptor insnt visible yet`, async() => {
|
it(`should click on the first sale ID making now the item descriptor visible`, async() => {
|
||||||
const visible = await page.isVisible(selectors.ticketSales.saleDescriptorPopover);
|
|
||||||
|
|
||||||
expect(visible).toBeFalsy();
|
|
||||||
});
|
|
||||||
|
|
||||||
it(`should click on the first sale ID making the item descriptor visible`, async() => {
|
|
||||||
await page.waitToClick(selectors.ticketSales.firstSaleId);
|
await page.waitToClick(selectors.ticketSales.firstSaleId);
|
||||||
await page.waitImgLoad(selectors.ticketSales.firstSaleDescriptorImage);
|
await page.waitImgLoad(selectors.ticketSales.firstSaleDescriptorImage);
|
||||||
const visible = await page.isVisible(selectors.ticketSales.saleDescriptorPopover);
|
const visible = await page.isVisible(selectors.ticketSales.saleDescriptorPopover);
|
||||||
|
@ -80,14 +94,14 @@ xdescribe('Ticket Edit sale path', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should click on the descriptor image of the 1st sale and see the zoomed image`, async() => {
|
it(`should click on the descriptor image of the 1st sale and see the zoomed image`, async() => {
|
||||||
await page.clickIfVisible('vn-item-descriptor img');
|
await page.waitToClick('vn-item-descriptor img');
|
||||||
const result = await page.countElement(selectors.ticketSales.firstSaleZoomedImage);
|
const result = await page.countElement(selectors.ticketSales.firstSaleZoomedImage);
|
||||||
|
|
||||||
expect(result).toEqual(1);
|
expect(result).toEqual(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should now click on the zoomed image to close it`, async() => {
|
it(`should now click on the zoomed image to close it`, async() => {
|
||||||
await page.clickIfVisible(selectors.ticketSales.firstSaleZoomedImage);
|
await page.waitToClick(selectors.ticketSales.firstSaleZoomedImage);
|
||||||
const result = await page.countElement(selectors.ticketSales.firstSaleZoomedImage);
|
const result = await page.countElement(selectors.ticketSales.firstSaleZoomedImage);
|
||||||
|
|
||||||
expect(result).toEqual(0);
|
expect(result).toEqual(0);
|
||||||
|
@ -95,50 +109,46 @@ xdescribe('Ticket Edit sale path', () => {
|
||||||
|
|
||||||
it(`should click on the summary icon of the item-descriptor to access to the item summary`, async() => {
|
it(`should click on the summary icon of the item-descriptor to access to the item summary`, async() => {
|
||||||
await page.waitToClick(selectors.ticketSales.saleDescriptorPopoverSummaryButton);
|
await page.waitToClick(selectors.ticketSales.saleDescriptorPopoverSummaryButton);
|
||||||
await page.waitForURL('/summary');
|
await page.waitForState('item.card.summary');
|
||||||
const url = await page.parsedUrl();
|
|
||||||
|
|
||||||
expect(url.hash).toContain('/summary');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return to ticket sales section', async() => {
|
it('should return to ticket sales section', async() => {
|
||||||
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
|
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
|
||||||
await page.wait(selectors.globalItems.applicationsMenuVisible);
|
await page.wait(selectors.globalItems.applicationsMenuVisible);
|
||||||
await page.waitToClick(selectors.globalItems.ticketsButton);
|
await page.waitToClick(selectors.globalItems.ticketsButton);
|
||||||
await page.accessToSearchResult(16);
|
await page.accessToSearchResult('16');
|
||||||
await page.accessToSection('ticket.card.sale');
|
await page.accessToSection('ticket.card.sale');
|
||||||
await page.waitForURL('/sale');
|
|
||||||
const url = await page.parsedUrl();
|
|
||||||
|
|
||||||
expect(url.hash).toContain('/sale');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should try to add a higher quantity value and then receive an error', async() => {
|
it('should try to add a higher quantity value and then receive an error', async() => {
|
||||||
await page.focusElement(selectors.ticketSales.firstSaleQuantityCell);
|
await page.waitToClick(selectors.ticketSales.firstSaleQuantityCell);
|
||||||
await page.write(selectors.ticketSales.firstSaleQuantity, '11\u000d');
|
await page.type(selectors.ticketSales.firstSaleQuantity, '11\u000d');
|
||||||
const message = await page.waitForSnackbar();
|
const message = await page.waitForSnackbar();
|
||||||
|
|
||||||
expect(message.text).toBe('The new quantity should be smaller than the old one');
|
expect(message.text).toBe('The new quantity should be smaller than the old one');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should remove 1 from the first sale quantity', async() => {
|
it('should remove 1 from the first sale quantity', async() => {
|
||||||
await page.focusElement(selectors.ticketSales.firstSaleQuantityCell);
|
await page.waitFor(500);
|
||||||
await page.write(selectors.ticketSales.firstSaleQuantity, '9\u000d');
|
await page.waitToClick(selectors.ticketSales.firstSaleQuantityCell);
|
||||||
|
await page.waitFor(selectors.ticketSales.firstSaleQuantity);
|
||||||
|
await page.type(selectors.ticketSales.firstSaleQuantity, '9\u000d');
|
||||||
const message = await page.waitForSnackbar();
|
const message = await page.waitForSnackbar();
|
||||||
|
|
||||||
expect(message.type).toBe('success');
|
expect(message.type).toBe('success');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should update the price', async() => {
|
it('should update the price', async() => {
|
||||||
await page.waitToClick(`${selectors.ticketSales.firstSalePrice} > span`);
|
await page.waitToClick(selectors.ticketSales.firstSalePrice);
|
||||||
await page.write(selectors.ticketSales.firstSalePriceInput, '5\u000d');
|
await page.waitFor(selectors.ticketSales.firstSalePriceInput);
|
||||||
|
await page.type(selectors.ticketSales.firstSalePriceInput, '5\u000d');
|
||||||
const message = await page.waitForSnackbar();
|
const message = await page.waitForSnackbar();
|
||||||
|
|
||||||
expect(message.type).toBe('success');
|
expect(message.type).toBe('success');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm the price have been updated', async() => {
|
it('should confirm the price have been updated', async() => {
|
||||||
const result = await page.waitToGetProperty(`${selectors.ticketSales.firstSalePrice} span`, 'innerText');
|
const result = await page.waitToGetProperty(selectors.ticketSales.firstSalePrice, 'innerText');
|
||||||
|
|
||||||
expect(result).toContain('5.00');
|
expect(result).toContain('5.00');
|
||||||
});
|
});
|
||||||
|
@ -150,16 +160,17 @@ xdescribe('Ticket Edit sale path', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should update the discount', async() => {
|
it('should update the discount', async() => {
|
||||||
await page.waitToClick(`${selectors.ticketSales.firstSaleDiscount} > span`);
|
await page.waitToClick(selectors.ticketSales.firstSaleDiscount);
|
||||||
await page.write(selectors.ticketSales.firstSaleDiscountInput, '50\u000d');
|
await page.waitFor(selectors.ticketSales.firstSaleDiscountInput);
|
||||||
|
await page.type(selectors.ticketSales.firstSaleDiscountInput, '50\u000d');
|
||||||
const message = await page.waitForSnackbar();
|
const message = await page.waitForSnackbar();
|
||||||
|
|
||||||
expect(message.type).toBe('success');
|
expect(message.type).toBe('success');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm the discount have been updated', async() => {
|
it('should confirm the discount have been updated', async() => {
|
||||||
await page.waitForTextInElement(`${selectors.ticketSales.firstSaleDiscount} > span`, '50.00%');
|
await page.waitForTextInElement(selectors.ticketSales.firstSaleDiscount, '50.00%');
|
||||||
const result = await page.waitToGetProperty(`${selectors.ticketSales.firstSaleDiscount} > span`, 'innerText');
|
const result = await page.waitToGetProperty(selectors.ticketSales.firstSaleDiscount, 'innerText');
|
||||||
|
|
||||||
expect(result).toContain('50.00%');
|
expect(result).toContain('50.00%');
|
||||||
});
|
});
|
||||||
|
@ -175,54 +186,41 @@ xdescribe('Ticket Edit sale path', () => {
|
||||||
await page.waitToClick(selectors.ticketSales.thirdSaleCheckbox);
|
await page.waitToClick(selectors.ticketSales.thirdSaleCheckbox);
|
||||||
await page.waitToClick(selectors.ticketSales.moreMenu);
|
await page.waitToClick(selectors.ticketSales.moreMenu);
|
||||||
await page.waitToClick(selectors.ticketSales.moreMenuCreateClaim);
|
await page.waitToClick(selectors.ticketSales.moreMenuCreateClaim);
|
||||||
await page.wait(selectors.claimBasicData.claimState);
|
await page.waitForState('claim.card.basicData');
|
||||||
const url = await page.parsedUrl();
|
|
||||||
|
|
||||||
expect(url.hash).toContain('basic-data');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should click on the Claims button of the top bar menu', async() => {
|
it('should click on the Claims button of the top bar menu', async() => {
|
||||||
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
|
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
|
||||||
await page.wait(selectors.globalItems.applicationsMenuVisible);
|
await page.wait(selectors.globalItems.applicationsMenuVisible);
|
||||||
await page.waitToClick(selectors.globalItems.claimsButton);
|
await page.waitToClick(selectors.globalItems.claimsButton);
|
||||||
await page.wait(selectors.claimsIndex.searchClaimInput);
|
await page.waitForState('claim.index');
|
||||||
const url = await page.parsedUrl();
|
|
||||||
|
|
||||||
expect(url.hash).toEqual('#!/claim/index');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should search for the claim with id 4', async() => {
|
it('should search for the claim with id 4', async() => {
|
||||||
await page.write(selectors.claimsIndex.searchClaimInput, 4);
|
await page.accessToSearchResult('4');
|
||||||
await page.waitToClick(selectors.claimsIndex.searchButton);
|
await page.waitForState('claim.card.summary');
|
||||||
await page.waitForNumberOfElements(selectors.claimsIndex.searchResult, 1);
|
|
||||||
const result = await page.countElement(selectors.claimsIndex.searchResult);
|
|
||||||
|
|
||||||
expect(result).toEqual(1);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should click the Tickets button of the top bar menu', async() => {
|
it('should click the Tickets button of the top bar menu', async() => {
|
||||||
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
|
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
|
||||||
await page.wait(selectors.globalItems.applicationsMenuVisible);
|
await page.wait(selectors.globalItems.applicationsMenuVisible);
|
||||||
await page.waitToClick(selectors.globalItems.ticketsButton);
|
await page.waitToClick(selectors.globalItems.ticketsButton);
|
||||||
await page.wait(selectors.ticketsIndex.topbarSearch);
|
await page.waitForState('ticket.index');
|
||||||
const url = await page.parsedUrl();
|
|
||||||
|
|
||||||
expect(url.hash).toEqual('#!/ticket/index');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should search for a ticket then access to the sales section', async() => {
|
it('should search for a ticket then access to the sales section', async() => {
|
||||||
await page.accessToSearchResult(16);
|
await page.accessToSearchResult('16');
|
||||||
await page.accessToSection('ticket.card.sale');
|
await page.accessToSection('ticket.card.sale');
|
||||||
await page.waitForURL('/sale');
|
await page.wait(2000);
|
||||||
const url = await page.parsedUrl();
|
|
||||||
|
|
||||||
expect(url.hash).toContain('/sale');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should select the third sale and delete it', async() => {
|
it('should select the third sale and delete it', async() => {
|
||||||
await page.waitToClick(selectors.ticketSales.thirdSaleCheckbox);
|
await page.waitToClick(selectors.ticketSales.thirdSaleCheckbox);
|
||||||
|
await page.wait(2000);
|
||||||
await page.waitToClick(selectors.ticketSales.deleteSaleButton);
|
await page.waitToClick(selectors.ticketSales.deleteSaleButton);
|
||||||
|
await page.wait(2000);
|
||||||
await page.waitToClick(selectors.ticketSales.acceptDeleteLineButton);
|
await page.waitToClick(selectors.ticketSales.acceptDeleteLineButton);
|
||||||
|
await page.wait(2000);
|
||||||
await page.waitForSpinnerLoad();
|
await page.waitForSpinnerLoad();
|
||||||
const message = await page.waitForSnackbar();
|
const message = await page.waitForSnackbar();
|
||||||
|
|
||||||
|
@ -236,18 +234,15 @@ xdescribe('Ticket Edit sale path', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should select the second 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 targetTicketId = '12';
|
||||||
|
|
||||||
await page.waitToClick(selectors.ticketSales.secondSaleCheckbox);
|
await page.waitToClick(selectors.ticketSales.secondSaleCheckbox);
|
||||||
await page.waitToClick(selectors.ticketSales.transferSaleButton);
|
await page.waitToClick(selectors.ticketSales.transferSaleButton);
|
||||||
await page.focusElement(selectors.ticketSales.transferQuantityCell);
|
await page.waitToClick(selectors.ticketSales.transferQuantityCell);
|
||||||
await page.write(selectors.ticketSales.transferQuantityInput, '10\u000d');
|
await page.type(selectors.ticketSales.transferQuantityInput, '10\u000d');
|
||||||
await page.write(selectors.ticketSales.moveToTicketInput, targetTicketId);
|
await page.type(selectors.ticketSales.moveToTicketInput, targetTicketId);
|
||||||
await page.waitToClick(selectors.ticketSales.moveToTicketButton);
|
await page.waitToClick(selectors.ticketSales.moveToTicketButton);
|
||||||
await page.waitForURL(`ticket/${targetTicketId}/sale`);
|
await page.expectURL(`ticket/${targetTicketId}/sale`);
|
||||||
const result = await page.parsedUrl();
|
|
||||||
|
|
||||||
expect(result.hash).toContain(`ticket/${targetTicketId}/sale`);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm the transfered line is the correct one', async() => {
|
it('should confirm the transfered line is the correct one', async() => {
|
||||||
|
@ -265,12 +260,8 @@ xdescribe('Ticket Edit sale path', () => {
|
||||||
|
|
||||||
it('should go back to the original ticket sales section', async() => {
|
it('should go back to the original ticket sales section', async() => {
|
||||||
await page.waitToClick(selectors.ticketDescriptor.goBackToModuleIndexButton);
|
await page.waitToClick(selectors.ticketDescriptor.goBackToModuleIndexButton);
|
||||||
await page.accessToSearchResult(16);
|
await page.accessToSearchResult('16');
|
||||||
await page.accessToSection('ticket.card.sale');
|
await page.accessToSection('ticket.card.sale');
|
||||||
await page.waitForURL('/sale');
|
|
||||||
const url = await page.parsedUrl();
|
|
||||||
|
|
||||||
expect(url.hash).toContain('/sale');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should confirm the original ticket has still three lines`, async() => {
|
it(`should confirm the original ticket has still three lines`, async() => {
|
||||||
|
@ -288,25 +279,18 @@ xdescribe('Ticket Edit sale path', () => {
|
||||||
|
|
||||||
it('should go back to the receiver ticket sales section', async() => {
|
it('should go back to the receiver ticket sales section', async() => {
|
||||||
await page.waitToClick(selectors.ticketDescriptor.goBackToModuleIndexButton);
|
await page.waitToClick(selectors.ticketDescriptor.goBackToModuleIndexButton);
|
||||||
await page.accessToSearchResult(12);
|
await page.accessToSearchResult('12');
|
||||||
await page.accessToSection('ticket.card.sale');
|
await page.accessToSection('ticket.card.sale');
|
||||||
await page.waitForURL('/sale');
|
|
||||||
const url = await page.parsedUrl();
|
|
||||||
|
|
||||||
expect(url.hash).toContain('/sale');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should transfer the sale back to the original ticket', async() => {
|
it('should transfer the sale back to the original ticket', async() => {
|
||||||
const targetTicketId = 16;
|
const targetTicketId = '16';
|
||||||
|
|
||||||
await page.waitToClick(selectors.ticketSales.secondSaleCheckbox);
|
await page.waitToClick(selectors.ticketSales.secondSaleCheckbox);
|
||||||
await page.waitToClick(selectors.ticketSales.transferSaleButton);
|
await page.waitToClick(selectors.ticketSales.transferSaleButton);
|
||||||
await page.write(selectors.ticketSales.moveToTicketInput, targetTicketId);
|
await page.type(selectors.ticketSales.moveToTicketInput, targetTicketId);
|
||||||
await page.waitToClick(selectors.ticketSales.moveToTicketButton);
|
await page.waitToClick(selectors.ticketSales.moveToTicketButton);
|
||||||
await page.waitForURL(`ticket/${targetTicketId}/sale`);
|
await page.expectURL(`ticket/${targetTicketId}/sale`);
|
||||||
const result = await page.parsedUrl();
|
|
||||||
|
|
||||||
expect(result.hash).toContain(`ticket/${targetTicketId}/sale`);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm the original ticket received the line', async() => {
|
it('should confirm the original ticket received the line', async() => {
|
||||||
|
@ -321,35 +305,29 @@ xdescribe('Ticket Edit sale path', () => {
|
||||||
await page.waitToClick(selectors.ticketSales.firstSaleCheckbox);
|
await page.waitToClick(selectors.ticketSales.firstSaleCheckbox);
|
||||||
await page.waitToClick(selectors.ticketSales.transferSaleButton);
|
await page.waitToClick(selectors.ticketSales.transferSaleButton);
|
||||||
await page.waitToClick(selectors.ticketSales.moveToNewTicketButton);
|
await page.waitToClick(selectors.ticketSales.moveToNewTicketButton);
|
||||||
await page.waitToClick(selectors.ticketSales.acceptDeleteTicketButton);
|
|
||||||
const message = await page.waitForSnackbar();
|
const message = await page.waitForSnackbar();
|
||||||
|
|
||||||
expect(message.text).toBe(`You can't create a ticket for a inactive client`);
|
expect(message.text).toBe(`You can't create a ticket for a inactive client`);
|
||||||
|
|
||||||
|
await page.closePopup();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should go now to the ticket sales section of an active, not frozen client', async() => {
|
it('should go now to the ticket sales section of an active, not frozen client', async() => {
|
||||||
await page.waitToClick(selectors.ticketDescriptor.goBackToModuleIndexButton);
|
await page.waitToClick(selectors.ticketDescriptor.goBackToModuleIndexButton);
|
||||||
await page.accessToSearchResult(13);
|
await page.accessToSearchResult('13');
|
||||||
await page.accessToSection('ticket.card.sale');
|
await page.accessToSection('ticket.card.sale');
|
||||||
await page.waitForURL('/sale');
|
|
||||||
const url = await page.parsedUrl();
|
|
||||||
|
|
||||||
expect(url.hash).toContain('/sale');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should select all sales, tranfer them to a new ticket and delete the sender ticket as it would've been left empty`, async() => {
|
it(`should select all sales, tranfer them to a new ticket and delete the sender ticket as it would've been left empty`, async() => {
|
||||||
const senderTicketId = 13;
|
const senderTicketId = '13';
|
||||||
|
|
||||||
await page.waitToClick(selectors.ticketSales.selectAllSalesCheckbox);
|
await page.waitToClick(selectors.ticketSales.selectAllSalesCheckbox);
|
||||||
await page.waitToClick(selectors.ticketSales.transferSaleButton);
|
await page.waitToClick(selectors.ticketSales.transferSaleButton);
|
||||||
await page.waitToClick(selectors.ticketSales.moveToNewTicketButton);
|
await page.waitToClick(selectors.ticketSales.moveToNewTicketButton);
|
||||||
await page.waitToClick(selectors.ticketSales.acceptDeleteTicketButton);
|
await page.evaluate((selector, ticketId) => {
|
||||||
await page.wait((selector, ticketId) => {
|
return document.querySelector(selector).innerText.toLowerCase().indexOf(`#${ticketId}`) == -1;
|
||||||
return document.querySelector(selector).innerText.toLowerCase().indexOf(`${ticketId}`) == -1;
|
}, selectors.ticketDescriptor.id, senderTicketId);
|
||||||
}, selectors.ticketDescriptor.idLabelValue, senderTicketId);
|
await page.waitForState('ticket.card.sale');
|
||||||
const url = await page.parsedUrl();
|
|
||||||
|
|
||||||
expect(url.hash).toContain('/sale');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm the new ticket received the line', async() => {
|
it('should confirm the new ticket received the line', async() => {
|
||||||
|
@ -368,6 +346,7 @@ xdescribe('Ticket Edit sale path', () => {
|
||||||
await page.waitToClick(selectors.ticketSales.firstSaleCheckbox);
|
await page.waitToClick(selectors.ticketSales.firstSaleCheckbox);
|
||||||
await page.waitToClick(selectors.ticketSales.moreMenu);
|
await page.waitToClick(selectors.ticketSales.moreMenu);
|
||||||
await page.waitToClick(selectors.ticketSales.moreMenuReserve);
|
await page.waitToClick(selectors.ticketSales.moreMenuReserve);
|
||||||
|
await page.closePopup();
|
||||||
await page.waitForClassNotPresent(selectors.ticketSales.firstSaleReservedIcon, 'ng-hide');
|
await page.waitForClassNotPresent(selectors.ticketSales.firstSaleReservedIcon, 'ng-hide');
|
||||||
const result = await page.isVisible(selectors.ticketSales.firstSaleReservedIcon);
|
const result = await page.isVisible(selectors.ticketSales.firstSaleReservedIcon);
|
||||||
|
|
||||||
|
@ -384,10 +363,12 @@ xdescribe('Ticket Edit sale path', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should update all sales discount', async() => {
|
it('should update all sales discount', async() => {
|
||||||
|
await page.closePopup();
|
||||||
await page.waitToClick(selectors.ticketSales.moreMenu);
|
await page.waitToClick(selectors.ticketSales.moreMenu);
|
||||||
await page.waitToClick(selectors.ticketSales.moreMenuUpdateDiscount);
|
await page.waitToClick(selectors.ticketSales.moreMenuUpdateDiscount);
|
||||||
// .write(selectors.ticketSales.moreMenuUpdateDiscountInput, 100) can't find the selector on app (deleted the selector), menu option was removed?
|
await page.waitForSelector(selectors.ticketSales.moreMenuUpdateDiscountInput);
|
||||||
await page.write('body', '\u000d');
|
await page.type(selectors.ticketSales.moreMenuUpdateDiscountInput, '100');
|
||||||
|
await page.keyboard.press('Enter');
|
||||||
await page.waitForTextInElement(selectors.ticketSales.totalImport, '0.00');
|
await page.waitForTextInElement(selectors.ticketSales.totalImport, '0.00');
|
||||||
const result = await page.waitToGetProperty(selectors.ticketSales.totalImport, 'innerText');
|
const result = await page.waitToGetProperty(selectors.ticketSales.totalImport, 'innerText');
|
||||||
|
|
||||||
|
@ -396,75 +377,12 @@ xdescribe('Ticket Edit sale path', () => {
|
||||||
|
|
||||||
it('should log in as Production role and go to a target ticket summary', async() => {
|
it('should log in as Production role and go to a target ticket summary', async() => {
|
||||||
await page.loginAndModule('production', 'ticket');
|
await page.loginAndModule('production', 'ticket');
|
||||||
await page.accessToSearchResult(13);
|
await page.accessToSearchResult('13');
|
||||||
await page.waitForURL('/summary');
|
await page.waitForState('ticket.card.summary');
|
||||||
const url = await page.parsedUrl();
|
|
||||||
|
|
||||||
expect(url.hash).toContain('/summary');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should check it's state is deleted`, async() => {
|
it(`should check the ticket is deleted`, async() => {
|
||||||
const result = await page.waitToGetProperty(selectors.ticketDescriptor.stateLabelValue, 'innerText');
|
await page.waitForSelector(selectors.ticketDescriptor.isDeletedIcon);
|
||||||
|
await page.waitForClassPresent(selectors.ticketDescriptor.isDeletedIcon, 'bright');
|
||||||
expect(result).toEqual('State Eliminado');
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('when state is preparation and loged as Production', () => {
|
|
||||||
it(`should not be able to edit the sale price`, async() => {
|
|
||||||
await page.waitToClick(selectors.ticketDescriptor.goBackToModuleIndexButton);
|
|
||||||
await page.accessToSearchResult(8);
|
|
||||||
await page.accessToSection('ticket.card.sale');
|
|
||||||
await page.waitToClick(selectors.ticketSales.firstSalePrice);
|
|
||||||
const result = await page.exists(selectors.ticketSales.firstSalePriceInput);
|
|
||||||
|
|
||||||
expect(result).toBeFalsy();
|
|
||||||
});
|
|
||||||
|
|
||||||
it(`should not be able to edit the sale discount`, async() => {
|
|
||||||
await page.waitToClick(selectors.ticketSales.firstSaleDiscount);
|
|
||||||
const result = await page.exists(selectors.ticketSales.firstSaleDiscountInput);
|
|
||||||
|
|
||||||
expect(result).toBeFalsy();
|
|
||||||
});
|
|
||||||
|
|
||||||
it(`should not be able to edit the sale state`, async() => {
|
|
||||||
await page.waitToClick(selectors.ticketSales.stateMenuButton);
|
|
||||||
const result = await page.exists(selectors.ticketSales.stateMenuOptions);
|
|
||||||
|
|
||||||
expect(result).toBeFalsy();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should log in as salesPerson then go to the sales of a target ticket', async() => {
|
|
||||||
await page.loginAndModule('salesPerson', 'ticket');
|
|
||||||
await page.accessToSearchResult(8);
|
|
||||||
await page.accessToSection('ticket.card.sale');
|
|
||||||
await page.waitForURL('/sale');
|
|
||||||
const url = await page.parsedUrl();
|
|
||||||
|
|
||||||
expect(url.hash).toContain('/sale');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('when state is preparation and loged as salesPerson', () => {
|
|
||||||
it(`shouldn't be able to edit the sale price`, async() => {
|
|
||||||
await page.waitToClick(selectors.ticketSales.firstSalePrice);
|
|
||||||
const result = await page.exists(selectors.ticketSales.firstSalePriceInput);
|
|
||||||
|
|
||||||
expect(result).toBeFalsy();
|
|
||||||
});
|
|
||||||
|
|
||||||
it(`should be able to edit the sale discount`, async() => {
|
|
||||||
await page.waitToClick(selectors.ticketSales.firstSaleDiscount);
|
|
||||||
const result = await page.exists(selectors.ticketSales.firstSaleDiscountInput);
|
|
||||||
|
|
||||||
expect(result).toBeFalsy();
|
|
||||||
});
|
|
||||||
|
|
||||||
it(`should not be able to edit the sale state`, async() => {
|
|
||||||
await page.waitToClick(selectors.ticketSales.stateMenuButton);
|
|
||||||
const result = await page.exists(selectors.ticketSales.stateMenuOptions);
|
|
||||||
|
|
||||||
expect(result).toBeFalsy();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -48,6 +48,7 @@ describe('Ticket Create new tracking state path', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should now access to the create state view by clicking the create floating button', async() => {
|
it('should now access to the create state view by clicking the create floating button', async() => {
|
||||||
|
await page.waitFor('.vn-popup', {hidden: true}),
|
||||||
await page.waitToClick(selectors.ticketTracking.createStateButton);
|
await page.waitToClick(selectors.ticketTracking.createStateButton);
|
||||||
await page.waitForState('ticket.card.tracking.edit');
|
await page.waitForState('ticket.card.tracking.edit');
|
||||||
});
|
});
|
||||||
|
|
|
@ -18,6 +18,7 @@ describe('Ticket purchase request path', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should add a new request', async() => {
|
it('should add a new request', async() => {
|
||||||
|
await page.waitFor(500);
|
||||||
await page.waitToClick(selectors.ticketRequests.addRequestButton);
|
await page.waitToClick(selectors.ticketRequests.addRequestButton);
|
||||||
await page.write(selectors.ticketRequests.descriptionInput, 'New stuff');
|
await page.write(selectors.ticketRequests.descriptionInput, 'New stuff');
|
||||||
await page.write(selectors.ticketRequests.quantity, '9');
|
await page.write(selectors.ticketRequests.quantity, '9');
|
||||||
|
|
|
@ -58,7 +58,7 @@ describe('Ticket Summary path', () => {
|
||||||
expect(result).toContain('000002');
|
expect(result).toContain('000002');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should click on the first sale ID making the item descriptor visible`, async() => {
|
it(`should click on the first sale ID to make the item descriptor visible`, async() => {
|
||||||
await page.waitToClick(selectors.ticketSummary.firstSaleItemId);
|
await page.waitToClick(selectors.ticketSummary.firstSaleItemId);
|
||||||
await page.waitImgLoad(selectors.ticketSummary.firstSaleDescriptorImage);
|
await page.waitImgLoad(selectors.ticketSummary.firstSaleDescriptorImage);
|
||||||
const visible = await page.isVisible(selectors.ticketSummary.itemDescriptorPopover);
|
const visible = await page.isVisible(selectors.ticketSummary.itemDescriptorPopover);
|
||||||
|
|
|
@ -19,7 +19,7 @@ describe('Ticket index payout path', () => {
|
||||||
await page.waitForState('ticket.index');
|
await page.waitForState('ticket.index');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should check three tickets 2 of a clinet and 1 of another', async() => {
|
it('should check the second ticket from a client and 1 of another', async() => {
|
||||||
await page.keyboard.press('Enter');
|
await page.keyboard.press('Enter');
|
||||||
await page.waitToClick(selectors.ticketsIndex.secondTicketCheckbox);
|
await page.waitToClick(selectors.ticketsIndex.secondTicketCheckbox);
|
||||||
await page.waitToClick(selectors.ticketsIndex.sixthTicketCheckbox);
|
await page.waitToClick(selectors.ticketsIndex.sixthTicketCheckbox);
|
||||||
|
|
|
@ -8,6 +8,7 @@ describe('Order summary path', () => {
|
||||||
browser = await getBrowser();
|
browser = await getBrowser();
|
||||||
page = browser.page;
|
page = browser.page;
|
||||||
await page.loginAndModule('employee', 'order');
|
await page.loginAndModule('employee', 'order');
|
||||||
|
await page.waitFor(2000);
|
||||||
await page.accessToSearchResult('16');
|
await page.accessToSearchResult('16');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ describe('Order lines', () => {
|
||||||
browser = await getBrowser();
|
browser = await getBrowser();
|
||||||
page = browser.page;
|
page = browser.page;
|
||||||
await page.loginAndModule('employee', 'order');
|
await page.loginAndModule('employee', 'order');
|
||||||
await page.accessToSearchResult('16');
|
await page.accessToSearchResult('8');
|
||||||
await page.accessToSection('order.card.line');
|
await page.accessToSection('order.card.line');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ describe('Order lines', () => {
|
||||||
const result = await page
|
const result = await page
|
||||||
.waitToGetProperty(selectors.orderLine.orderSubtotal, 'innerText');
|
.waitToGetProperty(selectors.orderLine.orderSubtotal, 'innerText');
|
||||||
|
|
||||||
expect(result).toContain('135.60');
|
expect(result).toContain('112.30');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should delete the first line in the order', async() => {
|
it('should delete the first line in the order', async() => {
|
||||||
|
@ -32,11 +32,11 @@ describe('Order lines', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm the order subtotal has changed', async() => {
|
it('should confirm the order subtotal has changed', async() => {
|
||||||
await page.waitForTextInElement(selectors.orderLine.orderSubtotal, '90.10');
|
await page.waitForTextInElement(selectors.orderLine.orderSubtotal, '92.80');
|
||||||
const result = await page
|
const result = await page
|
||||||
.waitToGetProperty(selectors.orderLine.orderSubtotal, 'innerText');
|
.waitToGetProperty(selectors.orderLine.orderSubtotal, 'innerText');
|
||||||
|
|
||||||
expect(result).toContain('90.10');
|
expect(result).toContain('92.80');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm the whole order and redirect to ticket index filtered by clientFk', async() => {
|
it('should confirm the whole order and redirect to ticket index filtered by clientFk', async() => {
|
||||||
|
|
|
@ -15,9 +15,9 @@ describe('Order Index', () => {
|
||||||
await browser.close();
|
await browser.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should check the first search result doesn't contain a total of 0€`, async() => {
|
it(`should check the second search result doesn't contain a total of 0€`, async() => {
|
||||||
await page.waitToClick(selectors.ordersIndex.searchButton);
|
await page.waitToClick(selectors.ordersIndex.searchButton);
|
||||||
const result = await page.waitToGetProperty(selectors.ordersIndex.firstSearchResultTotal, 'innerText');
|
const result = await page.waitToGetProperty(selectors.ordersIndex.secondSearchResultTotal, 'innerText');
|
||||||
|
|
||||||
expect(result).not.toContain('0.00');
|
expect(result).not.toContain('0.00');
|
||||||
});
|
});
|
||||||
|
@ -26,8 +26,8 @@ describe('Order Index', () => {
|
||||||
await page.waitToClick(selectors.ordersIndex.openAdvancedSearch);
|
await page.waitToClick(selectors.ordersIndex.openAdvancedSearch);
|
||||||
await page.waitToClick(selectors.ordersIndex.advancedSearchShowEmptyCheckbox);
|
await page.waitToClick(selectors.ordersIndex.advancedSearchShowEmptyCheckbox);
|
||||||
await page.waitToClick(selectors.ordersIndex.advancedSearchButton);
|
await page.waitToClick(selectors.ordersIndex.advancedSearchButton);
|
||||||
await page.waitForTextInElement(selectors.ordersIndex.firstSearchResultTotal, '0.00');
|
await page.waitForTextInElement(selectors.ordersIndex.secondSearchResultTotal, '0.00');
|
||||||
const result = await page.waitToGetProperty(selectors.ordersIndex.firstSearchResultTotal, 'innerText');
|
const result = await page.waitToGetProperty(selectors.ordersIndex.secondSearchResultTotal, 'innerText');
|
||||||
|
|
||||||
expect(result).toContain('0.00');
|
expect(result).toContain('0.00');
|
||||||
});
|
});
|
||||||
|
|
|
@ -17,6 +17,7 @@ describe('Route create path', () => {
|
||||||
|
|
||||||
describe('as employee', () => {
|
describe('as employee', () => {
|
||||||
it('should click on the add new route button and open the creation form', async() => {
|
it('should click on the add new route button and open the creation form', async() => {
|
||||||
|
await page.waitFor(500);
|
||||||
await page.waitToClick(selectors.routeIndex.addNewRouteButton);
|
await page.waitToClick(selectors.routeIndex.addNewRouteButton);
|
||||||
await page.waitForState('route.create');
|
await page.waitForState('route.create');
|
||||||
});
|
});
|
||||||
|
|
|
@ -18,6 +18,7 @@ describe('InvoiceOut descriptor path', () => {
|
||||||
describe('as Administrative', () => {
|
describe('as Administrative', () => {
|
||||||
it('should search for tickets with an specific invoiceOut', async() => {
|
it('should search for tickets with an specific invoiceOut', async() => {
|
||||||
await page.waitToClick(selectors.ticketsIndex.openAdvancedSearchButton);
|
await page.waitToClick(selectors.ticketsIndex.openAdvancedSearchButton);
|
||||||
|
await page.clearInput(selectors.ticketsIndex.advancedSearchDaysOnward);
|
||||||
await page.write(selectors.ticketsIndex.advancedSearchInvoiceOut, 'T2222222');
|
await page.write(selectors.ticketsIndex.advancedSearchInvoiceOut, 'T2222222');
|
||||||
await page.waitToClick(selectors.ticketsIndex.advancedSearchButton);
|
await page.waitToClick(selectors.ticketsIndex.advancedSearchButton);
|
||||||
await page.waitForState('ticket.card.summary');
|
await page.waitForState('ticket.card.summary');
|
||||||
|
@ -63,7 +64,7 @@ describe('InvoiceOut descriptor path', () => {
|
||||||
await page.waitForState('ticket.index');
|
await page.waitForState('ticket.index');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should search for tickets with an specific invoiceOut to find no results', async() => {
|
it('should search now for tickets with an specific invoiceOut to find no results', async() => {
|
||||||
await page.doSearch('T2222222');
|
await page.doSearch('T2222222');
|
||||||
const nResults = await page.countElement(selectors.ticketsIndex.searchResult);
|
const nResults = await page.countElement(selectors.ticketsIndex.searchResult);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
import selectors from '../../helpers/selectors.js';
|
||||||
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
|
describe('Zone descriptor path', () => {
|
||||||
|
let browser;
|
||||||
|
let page;
|
||||||
|
|
||||||
|
beforeAll(async() => {
|
||||||
|
browser = await getBrowser();
|
||||||
|
page = browser.page;
|
||||||
|
await page.loginAndModule('deliveryBoss', 'zone');
|
||||||
|
await page.accessToSearchResult('13');
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async() => {
|
||||||
|
await browser.close();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should eliminate the zone using the descriptor option', async() => {
|
||||||
|
await page.waitToClick(selectors.zoneDescriptor.menu);
|
||||||
|
await page.waitToClick(selectors.zoneDescriptor.deleteZone);
|
||||||
|
await page.respondToDialog('accept');
|
||||||
|
await page.waitForState('zone.index');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should search for the deleted zone to find no results', async() => {
|
||||||
|
await page.doSearch('13');
|
||||||
|
const count = await page.countElement(selectors.zoneIndex.searchResult);
|
||||||
|
|
||||||
|
expect(count).toEqual(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should check the ticket whom lost the zone and see evidence on the logs', async() => {
|
||||||
|
await page.waitToClick(selectors.globalItems.homeButton);
|
||||||
|
await page.selectModule('ticket');
|
||||||
|
await page.accessToSearchResult('20');
|
||||||
|
await page.accessToSection('ticket.card.log');
|
||||||
|
const lastChanges = await page.waitToGetProperty(selectors.ticketLog.changes, 'innerText');
|
||||||
|
|
||||||
|
expect(lastChanges).toContain('Arreglar');
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,46 @@
|
||||||
|
import selectors from '../../helpers/selectors.js';
|
||||||
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
|
describe('Entry lastest buys path', () => {
|
||||||
|
let browser;
|
||||||
|
let page;
|
||||||
|
|
||||||
|
beforeAll(async() => {
|
||||||
|
browser = await getBrowser();
|
||||||
|
page = browser.page;
|
||||||
|
await page.loginAndModule('buyer', 'entry');
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async() => {
|
||||||
|
await browser.close();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should access the latest buys seccion and search not seeing the edit buys button yet', async() => {
|
||||||
|
await page.waitToClick(selectors.entryLatestBuys.latestBuysSectionButton);
|
||||||
|
await page.waitFor(250);
|
||||||
|
await page.keyboard.press('Enter');
|
||||||
|
await page.waitForSelector(selectors.entryLatestBuys.editBuysButton, {visible: false});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should select all lines but one and then check the edit buys button appears', async() => {
|
||||||
|
await page.waitToClick(selectors.entryLatestBuys.allBuysCheckBox);
|
||||||
|
await page.waitToClick(selectors.entryLatestBuys.secondBuyCheckBox);
|
||||||
|
await page.waitForSelector(selectors.entryLatestBuys.editBuysButton, {visible: true});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should open the edit dialog', async() => {
|
||||||
|
await page.waitToClick(selectors.entryLatestBuys.editBuysButton);
|
||||||
|
await page.waitForSelector(selectors.entryLatestBuys.fieldAutocomplete, {visible: true});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should search for the "Description" field and type a new description for the items in each selected buy', async() => {
|
||||||
|
await page.autocompleteSearch(selectors.entryLatestBuys.fieldAutocomplete, 'Description');
|
||||||
|
await page.write(selectors.entryLatestBuys.newValueInput, 'Crafted item');
|
||||||
|
await page.waitToClick(selectors.entryLatestBuys.acceptEditBuysDialog);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should navigate to the entry.buy section by clicking one of the buys', async() => {
|
||||||
|
await page.waitToClick(selectors.entryLatestBuys.firstBuy);
|
||||||
|
await page.waitForState('entry.card.buy');
|
||||||
|
});
|
||||||
|
});
|
|
@ -214,7 +214,7 @@ export default class ArrayModel extends ModelProxy {
|
||||||
}
|
}
|
||||||
ArrayModel.$inject = ['$q', '$filter', '$element', '$scope'];
|
ArrayModel.$inject = ['$q', '$filter', '$element', '$scope'];
|
||||||
|
|
||||||
ngModule.component('vnArrayModel', {
|
ngModule.vnComponent('vnArrayModel', {
|
||||||
controller: ArrayModel,
|
controller: ArrayModel,
|
||||||
bindings: {
|
bindings: {
|
||||||
orgData: '<?',
|
orgData: '<?',
|
||||||
|
|
|
@ -192,7 +192,7 @@ export default class Autocomplete extends Field {
|
||||||
|
|
||||||
if (this.translateFields) {
|
if (this.translateFields) {
|
||||||
if (this.translateFields.indexOf(this.showField) > -1)
|
if (this.translateFields.indexOf(this.showField) > -1)
|
||||||
this.input.value = this.$translate.instant(display);
|
this.input.value = this.$t(display);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -135,7 +135,10 @@ export default class Calendar extends FormInput {
|
||||||
$days: [day],
|
$days: [day],
|
||||||
$type: 'day'
|
$type: 'day'
|
||||||
});
|
});
|
||||||
this.repaint();
|
|
||||||
|
// Repaint only if 'selection' event is not listening
|
||||||
|
if (!this.$events || this.$events && !this.$events['selection'])
|
||||||
|
this.repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -8,7 +8,7 @@ describe('Component vnChip', () => {
|
||||||
|
|
||||||
beforeEach(ngModule('vnCore'));
|
beforeEach(ngModule('vnCore'));
|
||||||
|
|
||||||
beforeEach(angular.mock.inject(($componentController, $rootScope) => {
|
beforeEach(inject(($componentController, $rootScope) => {
|
||||||
$scope = $rootScope.$new();
|
$scope = $rootScope.$new();
|
||||||
$element = angular.element(`<div>${template}</div>`);
|
$element = angular.element(`<div>${template}</div>`);
|
||||||
controller = $componentController('vnChip', {$element, $scope, $transclude: () => {}});
|
controller = $componentController('vnChip', {$element, $scope, $transclude: () => {}});
|
||||||
|
|
|
@ -67,13 +67,13 @@ export default class Contextmenu {
|
||||||
get cell() {
|
get cell() {
|
||||||
if (!this.target) return null;
|
if (!this.target) return null;
|
||||||
|
|
||||||
return this.target.closest('vn-td, .vn-td');
|
return this.target.closest('vn-td, .vn-td, vn-td-editable');
|
||||||
}
|
}
|
||||||
|
|
||||||
get cellIndex() {
|
get cellIndex() {
|
||||||
if (!this.row) return null;
|
if (!this.row) return null;
|
||||||
|
|
||||||
const cells = this.row.querySelectorAll('vn-td, .vn-td');
|
const cells = this.row.querySelectorAll('vn-td, .vn-td, vn-td-editable');
|
||||||
return Array.from(cells).findIndex(
|
return Array.from(cells).findIndex(
|
||||||
cellItem => cellItem == this.cell
|
cellItem => cellItem == this.cell
|
||||||
);
|
);
|
||||||
|
|
|
@ -272,7 +272,7 @@ export default class CrudModel extends ModelProxy {
|
||||||
}
|
}
|
||||||
CrudModel.$inject = ['$q', '$http', '$element', '$scope'];
|
CrudModel.$inject = ['$q', '$http', '$element', '$scope'];
|
||||||
|
|
||||||
ngModule.component('vnCrudModel', {
|
ngModule.vnComponent('vnCrudModel', {
|
||||||
controller: CrudModel,
|
controller: CrudModel,
|
||||||
bindings: {
|
bindings: {
|
||||||
orgData: '<?',
|
orgData: '<?',
|
||||||
|
|
|
@ -21,7 +21,7 @@ export default class DataViewer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ngModule.component('vnDataViewer', {
|
ngModule.vnComponent('vnDataViewer', {
|
||||||
template: require('./index.html'),
|
template: require('./index.html'),
|
||||||
transclude: true,
|
transclude: true,
|
||||||
controller: DataViewer,
|
controller: DataViewer,
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue