#4226-remove-density #1066
|
@ -8,7 +8,7 @@ module.exports = Self => {
|
||||||
},
|
},
|
||||||
http: {
|
http: {
|
||||||
path: `/notifyIssues`,
|
path: `/notifyIssues`,
|
||||||
verb: 'GET'
|
verb: 'POST'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ module.exports = Self => {
|
||||||
},
|
},
|
||||||
http: {
|
http: {
|
||||||
path: `/sendQueued`,
|
path: `/sendQueued`,
|
||||||
verb: 'GET'
|
verb: 'POST'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,10 @@ const models = require('vn-loopback/server/server').models;
|
||||||
|
|
||||||
describe('ticket getCollection()', () => {
|
describe('ticket getCollection()', () => {
|
||||||
it('should return a list of collections', async() => {
|
it('should return a list of collections', async() => {
|
||||||
let ctx = {req: {accessToken: {userId: 1106}}};
|
let ctx = {req: {accessToken: {userId: 1107}}};
|
||||||
let response = await models.Collection.getCollection(ctx);
|
let response = await models.Collection.getCollection(ctx);
|
||||||
|
|
||||||
expect(response.length).toBeGreaterThan(0);
|
expect(response.length).toBeGreaterThan(0);
|
||||||
expect(response[0].collectionFk).toEqual(1);
|
expect(response[0].collectionFk).toEqual(3);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -12,7 +12,7 @@ module.exports = Self => {
|
||||||
},
|
},
|
||||||
http: {
|
http: {
|
||||||
path: `/deleteTrashFiles`,
|
path: `/deleteTrashFiles`,
|
||||||
verb: 'GET'
|
verb: 'POST'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -53,8 +53,12 @@ module.exports = Self => {
|
||||||
const pathHash = DmsContainer.getHash(dms.id);
|
const pathHash = DmsContainer.getHash(dms.id);
|
||||||
const dmsContainer = await DmsContainer.container(pathHash);
|
const dmsContainer = await DmsContainer.container(pathHash);
|
||||||
const dstFile = path.join(dmsContainer.client.root, pathHash, dms.file);
|
const dstFile = path.join(dmsContainer.client.root, pathHash, dms.file);
|
||||||
|
try {
|
||||||
|
await fs.unlink(dstFile);
|
||||||
|
} catch (err) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
const dstFolder = path.join(dmsContainer.client.root, pathHash);
|
const dstFolder = path.join(dmsContainer.client.root, pathHash);
|
||||||
await fs.unlink(dstFile);
|
|
||||||
try {
|
try {
|
||||||
await fs.rmdir(dstFolder);
|
await fs.rmdir(dstFolder);
|
||||||
await dms.destroy(myOptions);
|
await dms.destroy(myOptions);
|
||||||
|
|
|
@ -12,7 +12,7 @@ module.exports = Self => {
|
||||||
},
|
},
|
||||||
http: {
|
http: {
|
||||||
path: `/updateData`,
|
path: `/updateData`,
|
||||||
verb: 'GET'
|
verb: 'POST'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -20,83 +20,93 @@ module.exports = Self => {
|
||||||
const models = Self.app.models;
|
const models = Self.app.models;
|
||||||
|
|
||||||
// Get files checksum
|
// Get files checksum
|
||||||
const files = await Self.rawSql('SELECT name, checksum, keyValue FROM edi.fileConfig');
|
const tx = await Self.beginTransaction({});
|
||||||
|
|
||||||
const updatableFiles = [];
|
try {
|
||||||
for (const file of files) {
|
const options = {transaction: tx};
|
||||||
const fileChecksum = await getChecksum(file);
|
const files = await Self.rawSql('SELECT name, checksum, keyValue FROM edi.fileConfig', null, options);
|
||||||
|
|
||||||
if (file.checksum != fileChecksum) {
|
const updatableFiles = [];
|
||||||
updatableFiles.push({
|
for (const file of files) {
|
||||||
name: file.name,
|
const fileChecksum = await getChecksum(file);
|
||||||
checksum: fileChecksum
|
|
||||||
});
|
|
||||||
} else
|
|
||||||
console.debug(`File already updated, skipping...`);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (updatableFiles.length === 0)
|
if (file.checksum != fileChecksum) {
|
||||||
return false;
|
updatableFiles.push({
|
||||||
|
name: file.name,
|
||||||
// Download files
|
checksum: fileChecksum
|
||||||
const container = await models.TempContainer.container('edi');
|
});
|
||||||
const tempPath = path.join(container.client.root, container.name);
|
} else
|
||||||
|
console.debug(`File already updated, skipping...`);
|
||||||
let remoteFile;
|
|
||||||
let tempDir;
|
|
||||||
let tempFile;
|
|
||||||
|
|
||||||
const fileNames = updatableFiles.map(file => file.name);
|
|
||||||
|
|
||||||
const tables = await Self.rawSql(`
|
|
||||||
SELECT fileName, toTable, file
|
|
||||||
FROM edi.tableConfig
|
|
||||||
WHERE file IN (?)`, [fileNames]);
|
|
||||||
|
|
||||||
for (const table of tables) {
|
|
||||||
const fileName = table.file;
|
|
||||||
|
|
||||||
console.debug(`Downloading file ${fileName}...`);
|
|
||||||
|
|
||||||
remoteFile = `codes/${fileName}.ZIP`;
|
|
||||||
tempDir = `${tempPath}/${fileName}`;
|
|
||||||
tempFile = `${tempPath}/${fileName}.zip`;
|
|
||||||
|
|
||||||
try {
|
|
||||||
await fs.readFile(tempFile);
|
|
||||||
} catch (error) {
|
|
||||||
if (error.code === 'ENOENT') {
|
|
||||||
const downloadOutput = await downloadFile(remoteFile, tempFile);
|
|
||||||
if (downloadOutput.error)
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
console.debug(`Extracting file ${fileName}...`);
|
if (updatableFiles.length === 0)
|
||||||
await extractFile(tempFile, tempDir);
|
return false;
|
||||||
|
|
||||||
console.debug(`Updating table ${table.toTable}...`);
|
// Download files
|
||||||
await dumpData(tempDir, table);
|
const container = await models.TempContainer.container('edi');
|
||||||
}
|
const tempPath = path.join(container.client.root, container.name);
|
||||||
|
|
||||||
// Update files checksum
|
let remoteFile;
|
||||||
for (const file of updatableFiles) {
|
let tempDir;
|
||||||
await Self.rawSql(`
|
let tempFile;
|
||||||
UPDATE edi.fileConfig
|
|
||||||
SET checksum = ?
|
|
||||||
WHERE name = ?`,
|
|
||||||
[file.checksum, file.name]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clean files
|
const fileNames = updatableFiles.map(file => file.name);
|
||||||
try {
|
|
||||||
await fs.remove(tempPath);
|
const tables = await Self.rawSql(`
|
||||||
|
SELECT fileName, toTable, file
|
||||||
|
FROM edi.tableConfig
|
||||||
|
WHERE file IN (?)`, [fileNames], options);
|
||||||
|
|
||||||
|
for (const table of tables) {
|
||||||
|
const fileName = table.file;
|
||||||
|
|
||||||
|
remoteFile = `codes/${fileName}.ZIP`;
|
||||||
|
tempDir = `${tempPath}/${fileName}`;
|
||||||
|
tempFile = `${tempPath}/${fileName}.zip`;
|
||||||
|
|
||||||
|
try {
|
||||||
|
await fs.readFile(tempFile);
|
||||||
|
} catch (error) {
|
||||||
|
if (error.code === 'ENOENT') {
|
||||||
|
console.debug(`Downloading file ${fileName}...`);
|
||||||
|
const downloadOutput = await downloadFile(remoteFile, tempFile);
|
||||||
|
if (downloadOutput.error)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
await extractFile(fileName, tempFile, tempDir);
|
||||||
|
|
||||||
|
console.debug(`Updating table ${table.toTable}...`);
|
||||||
|
await dumpData(tempDir, table, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update files checksum
|
||||||
|
for (const file of updatableFiles) {
|
||||||
|
console.log(`Updating file ${file.name} checksum...`);
|
||||||
|
await Self.rawSql(`
|
||||||
|
UPDATE edi.fileConfig
|
||||||
|
SET checksum = ?
|
||||||
|
WHERE name = ?`,
|
||||||
|
[file.checksum, file.name], options);
|
||||||
|
}
|
||||||
|
|
||||||
|
await tx.commit();
|
||||||
|
|
||||||
|
// Clean files
|
||||||
|
try {
|
||||||
|
console.debug(`Cleaning files...`);
|
||||||
|
await fs.remove(tempPath);
|
||||||
|
} catch (error) {
|
||||||
|
if (error.code !== 'ENOENT')
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error.code !== 'ENOENT')
|
await tx.rollback();
|
||||||
throw e;
|
throw error;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let ftpClient;
|
let ftpClient;
|
||||||
|
@ -126,9 +136,9 @@ module.exports = Self => {
|
||||||
|
|
||||||
const response = await new Promise((resolve, reject) => {
|
const response = await new Promise((resolve, reject) => {
|
||||||
ftpClient.exec((err, response) => {
|
ftpClient.exec((err, response) => {
|
||||||
if (response.error) {
|
if (err || response.error) {
|
||||||
console.debug(`Error downloading checksum file... ${response.error}`);
|
console.debug(`Error downloading checksum file... ${response.error}`);
|
||||||
reject(err);
|
return reject(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
resolve(response);
|
resolve(response);
|
||||||
|
@ -159,9 +169,9 @@ module.exports = Self => {
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
ftpClient.exec((err, response) => {
|
ftpClient.exec((err, response) => {
|
||||||
if (response.error) {
|
if (err || response.error) {
|
||||||
console.debug(`Error downloading file... ${response.error}`);
|
console.debug(`Error downloading file... ${response.error}`);
|
||||||
reject(err);
|
return reject(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
resolve(response);
|
resolve(response);
|
||||||
|
@ -169,11 +179,12 @@ module.exports = Self => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function extractFile(tempFile, tempDir) {
|
async function extractFile(fileName, tempFile, tempDir) {
|
||||||
const JSZip = require('jszip');
|
const JSZip = require('jszip');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await fs.mkdir(tempDir);
|
await fs.mkdir(tempDir);
|
||||||
|
console.debug(`Extracting file ${fileName}...`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error.code !== 'EEXIST')
|
if (error.code !== 'EEXIST')
|
||||||
throw e;
|
throw e;
|
||||||
|
@ -196,66 +207,32 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function dumpData(tempDir, table) {
|
async function dumpData(tempDir, table, options) {
|
||||||
const toTable = table.toTable;
|
const toTable = table.toTable;
|
||||||
const baseName = table.fileName;
|
const baseName = table.fileName;
|
||||||
|
|
||||||
const firstEntry = entries[0];
|
console.log(`Emptying table ${toTable}...`);
|
||||||
const entryName = firstEntry.entryName;
|
const tableName = `edi.${toTable}`;
|
||||||
const startIndex = (entryName.length - 10);
|
await Self.rawSql(`DELETE FROM ??`, [tableName]);
|
||||||
const endIndex = (entryName.length - 4);
|
|
||||||
const dateString = entryName.substring(startIndex, endIndex);
|
|
||||||
|
|
||||||
const lastUpdated = new Date();
|
const dirFiles = await fs.readdir(tempDir);
|
||||||
|
const files = dirFiles.filter(file => file.startsWith(baseName));
|
||||||
|
|
||||||
let updated = null;
|
for (const file of files) {
|
||||||
if (file.updated) {
|
console.log(`Dumping data from file ${file}...`);
|
||||||
updated = new Date(file.updated);
|
|
||||||
updated.setHours(0, 0, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Format string date to a date object
|
const templatePath = path.join(__dirname, `./sql/${toTable}.sql`);
|
||||||
lastUpdated.setFullYear(`20${dateString.substring(4, 6)}`);
|
const sqlTemplate = await fs.readFile(templatePath, 'utf8');
|
||||||
lastUpdated.setMonth(parseInt(dateString.substring(2, 4)) - 1);
|
const filePath = path.join(tempDir, file);
|
||||||
lastUpdated.setDate(dateString.substring(0, 2));
|
|
||||||
lastUpdated.setHours(0, 0, 0, 0);
|
|
||||||
|
|
||||||
if (updated && lastUpdated <= updated) {
|
await Self.rawSql(sqlTemplate, [filePath], options);
|
||||||
console.debug(`Table ${toTable} already updated, skipping...`);
|
await Self.rawSql(`
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const tx = await Self.beginTransaction({});
|
|
||||||
|
|
||||||
try {
|
|
||||||
const options = {transaction: tx};
|
|
||||||
|
|
||||||
const tableName = `edi.${toTable}`;
|
|
||||||
await Self.rawSql(`DELETE FROM ??`, [tableName], options);
|
|
||||||
|
|
||||||
const dirFiles = await fs.readdir(tempDir);
|
|
||||||
const files = dirFiles.filter(file => file.startsWith(baseName));
|
|
||||||
|
|
||||||
for (const file of files) {
|
|
||||||
console.log(`Dumping data from file ${file}...`);
|
|
||||||
|
|
||||||
const templatePath = path.join(__dirname, `./sql/${toTable}.sql`);
|
|
||||||
const sqlTemplate = await fs.readFile(templatePath, 'utf8');
|
|
||||||
const filePath = path.join(tempDir, file);
|
|
||||||
|
|
||||||
await Self.rawSql(sqlTemplate, [filePath], options);
|
|
||||||
await Self.rawSql(`
|
|
||||||
UPDATE edi.tableConfig
|
UPDATE edi.tableConfig
|
||||||
SET updated = ?
|
SET updated = ?
|
||||||
WHERE fileName = ?
|
WHERE fileName = ?
|
||||||
`, [new Date(), baseName], options);
|
`, [new Date(), baseName], options);
|
||||||
}
|
|
||||||
|
|
||||||
tx.commit();
|
|
||||||
} catch (error) {
|
|
||||||
tx.rollback();
|
|
||||||
throw error;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(`Updated table ${toTable}\n`);
|
console.log(`Updated table ${toTable}\n`);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1,118 @@
|
||||||
|
const jsdom = require('jsdom');
|
||||||
|
const mysql = require('mysql');
|
||||||
|
|
||||||
|
module.exports = Self => {
|
||||||
|
Self.remoteMethodCtx('closeTicket', {
|
||||||
|
description: 'Close tickets without response from the user',
|
||||||
|
accessType: 'READ',
|
||||||
|
returns: {
|
||||||
|
type: 'Object',
|
||||||
|
root: true
|
||||||
|
},
|
||||||
|
http: {
|
||||||
|
path: `/closeTicket`,
|
||||||
|
verb: 'POST'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Self.closeTicket = async ctx => {
|
||||||
|
const models = Self.app.models;
|
||||||
|
const config = await models.OsTicketConfig.findOne();
|
||||||
|
const ostUri = `${config.host}/login.php`;
|
||||||
|
|
||||||
|
if (!config.user || !config.password || !config.userDb || !config.passwordDb)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
const con = mysql.createConnection({
|
||||||
|
host: `${config.hostDb}`,
|
||||||
|
user: `${config.userDb}`,
|
||||||
|
password: `${config.passwordDb}`,
|
||||||
|
port: `${config.portDb}`
|
||||||
|
});
|
||||||
|
|
||||||
|
const sql = `SELECT ot.ticket_id, ot.number
|
||||||
|
FROM osticket.ost_ticket ot
|
||||||
|
JOIN osticket.ost_ticket_status ots ON ots.id = ot.status_id
|
||||||
|
JOIN osticket.ost_thread ot2 ON ot2.object_id = ot.ticket_id AND ot2.object_type = 'T'
|
||||||
|
JOIN (
|
||||||
|
SELECT ote.thread_id, MAX(ote.created) created, MAX(ote.updated) updated
|
||||||
|
FROM osticket.ost_thread_entry ote
|
||||||
|
WHERE ote.staff_id != 0 AND ote.type = 'R'
|
||||||
|
GROUP BY ote.thread_id
|
||||||
|
) sub ON sub.thread_id = ot2.id
|
||||||
|
WHERE ot.isanswered = 1
|
||||||
|
AND ots.state = '${config.oldStatus}'
|
||||||
|
AND IF(sub.updated > sub.created, sub.updated, sub.created) < DATE_SUB(CURDATE(), INTERVAL ${config.day} DAY)`;
|
||||||
|
|
||||||
|
let ticketsId = [];
|
||||||
|
con.connect(err => {
|
||||||
|
if (err) throw err;
|
||||||
|
con.query(sql, (err, results) => {
|
||||||
|
if (err) throw err;
|
||||||
|
for (const result of results)
|
||||||
|
ticketsId.push(result.ticket_id);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
await requestToken();
|
||||||
|
|
||||||
|
async function requestToken() {
|
||||||
|
const response = await fetch(ostUri);
|
||||||
|
|
||||||
|
const result = response.headers.get('set-cookie');
|
||||||
|
const [firtHeader] = result.split(' ');
|
||||||
|
const firtCookie = firtHeader.substring(0, firtHeader.length - 1);
|
||||||
|
const body = await response.text();
|
||||||
|
const dom = new jsdom.JSDOM(body);
|
||||||
|
const token = dom.window.document.querySelector('[name="__CSRFToken__"]').value;
|
||||||
|
|
||||||
|
await login(token, firtCookie);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function login(token, firtCookie) {
|
||||||
|
const data = {
|
||||||
|
__CSRFToken__: token,
|
||||||
|
do: 'scplogin',
|
||||||
|
userid: config.user,
|
||||||
|
passwd: config.password,
|
||||||
|
ajax: 1
|
||||||
|
};
|
||||||
|
const params = {
|
||||||
|
method: 'POST',
|
||||||
|
body: new URLSearchParams(data),
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
|
||||||
|
'Cookie': firtCookie
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const response = await fetch(ostUri, params);
|
||||||
|
const result = response.headers.get('set-cookie');
|
||||||
|
const [firtHeader] = result.split(' ');
|
||||||
|
const secondCookie = firtHeader.substring(0, firtHeader.length - 1);
|
||||||
|
|
||||||
|
await close(token, secondCookie);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function close(token, secondCookie) {
|
||||||
|
for (const ticketId of ticketsId) {
|
||||||
|
const ostUri = `${config.host}/ajax.php/tickets/${ticketId}/status`;
|
||||||
|
const data = {
|
||||||
|
status_id: config.newStatusId,
|
||||||
|
comments: config.comment,
|
||||||
|
undefined: config.action
|
||||||
|
};
|
||||||
|
const params = {
|
||||||
|
method: 'POST',
|
||||||
|
body: new URLSearchParams(data),
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
|
||||||
|
'X-CSRFToken': token,
|
||||||
|
'Cookie': secondCookie
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return fetch(ostUri, params);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
|
@ -116,6 +116,9 @@
|
||||||
"OsTicket": {
|
"OsTicket": {
|
||||||
"dataSource": "osticket"
|
"dataSource": "osticket"
|
||||||
},
|
},
|
||||||
|
"OsTicketConfig": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
"Edi": {
|
"Edi": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
{
|
||||||
|
"name": "OsTicketConfig",
|
||||||
|
"base": "VnModel",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "osTicketConfig"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "number",
|
||||||
|
"id": true,
|
||||||
|
"description": "Identifier"
|
||||||
|
},
|
||||||
|
"host": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"user": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"password": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"oldStatus": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"newStatusId": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"action": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"day": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"comment": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"hostDb": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"userDb": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"passwordDb": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"portDb": {
|
||||||
|
"type": "number"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
module.exports = Self => {
|
||||||
|
require('../methods/osticket/closeTicket')(Self);
|
||||||
|
};
|
|
@ -0,0 +1,5 @@
|
||||||
|
ALTER TABLE `vn`.`itemType` CHANGE `transaction` transaction__ tinyint(4) DEFAULT 0 NOT NULL;
|
||||||
|
ALTER TABLE `vn`.`itemType` CHANGE location location__ varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL NULL;
|
||||||
|
ALTER TABLE `vn`.`itemType` CHANGE hasComponents hasComponents__ tinyint(1) DEFAULT 1 NOT NULL;
|
||||||
|
ALTER TABLE `vn`.`itemType` CHANGE warehouseFk warehouseFk__ smallint(6) unsigned DEFAULT 60 NOT NULL;
|
||||||
|
ALTER TABLE `vn`.`itemType` CHANGE compression compression__ decimal(5,2) DEFAULT 1.00 NULL;
|
|
@ -0,0 +1,3 @@
|
||||||
|
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||||
|
VALUES
|
||||||
|
('OsTicket', '*', '*', 'ALLOW', 'ROLE', 'employee');
|
|
@ -0,0 +1,3 @@
|
||||||
|
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||||
|
VALUES
|
||||||
|
('OsTicketConfig', '*', '*', 'ALLOW', 'ROLE', 'it');
|
|
@ -0,0 +1,20 @@
|
||||||
|
CREATE TABLE `vn`.`osTicketConfig` (
|
||||||
|
`id` int(11) NOT NULL,
|
||||||
|
`host` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
|
||||||
|
`user` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
|
||||||
|
`password` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
|
||||||
|
`oldStatus` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
|
||||||
|
`newStatusId` int(11) DEFAULT NULL,
|
||||||
|
`action` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
|
||||||
|
`day` int(11) DEFAULT NULL,
|
||||||
|
`comment` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
|
||||||
|
`hostDb` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
|
||||||
|
`userDb` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
|
||||||
|
`passwordDb` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
|
||||||
|
`portDb` int(11) DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
|
||||||
|
|
||||||
|
INSERT INTO `vn`.`osTicketConfig`(`id`, `host`, `user`, `password`, `oldStatus`, `newStatusId`, `action`, `day`, `comment`, `hostDb`, `userDb`, `passwordDb`, `portDb`)
|
||||||
|
VALUES
|
||||||
|
(0, 'https://cau.verdnatura.es/scp', NULL, NULL, 'open', 3, 'Cerrar', 60, 'Este CAU se ha cerrado automáticamente', NULL, NULL, NULL, NULL);
|
|
@ -0,0 +1,4 @@
|
||||||
|
INSERT INTO `salix`.`ACL` (model,property,accessType,permission,principalType,principalId)
|
||||||
|
VALUES ('Sector','*','READ','ALLOW','ROLE','employee');
|
||||||
|
INSERT INTO `salix`.`ACL` (model,property,accessType,permission,principalType,principalId)
|
||||||
|
VALUES ('Sector','*','WRITE','ALLOW','ROLE','employee');
|
|
@ -0,0 +1,100 @@
|
||||||
|
DROP TRIGGER IF EXISTS vn.sale_afterUpdate;
|
||||||
|
USE vn;
|
||||||
|
|
||||||
|
DELIMITER $$
|
||||||
|
$$
|
||||||
|
CREATE DEFINER=`root`@`localhost` TRIGGER `vn`.`sale_afterUpdate`
|
||||||
|
AFTER UPDATE ON `sale`
|
||||||
|
FOR EACH ROW
|
||||||
|
BEGIN
|
||||||
|
DECLARE vIsToSendMail BOOL;
|
||||||
|
DECLARE vPickedLines INT;
|
||||||
|
DECLARE vCollectionFk INT;
|
||||||
|
DECLARE vUserRole VARCHAR(255);
|
||||||
|
|
||||||
|
IF !(NEW.id <=> OLD.id)
|
||||||
|
OR !(NEW.ticketFk <=> OLD.ticketFk)
|
||||||
|
OR !(NEW.itemFk <=> OLD.itemFk)
|
||||||
|
OR !(NEW.quantity <=> OLD.quantity)
|
||||||
|
OR !(NEW.created <=> OLD.created)
|
||||||
|
OR !(NEW.isPicked <=> OLD.isPicked) THEN
|
||||||
|
CALL stock.log_add('sale', NEW.id, OLD.id);
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
IF !(NEW.price <=> OLD.price)
|
||||||
|
OR !(NEW.ticketFk <=> OLD.ticketFk)
|
||||||
|
OR !(NEW.itemFk <=> OLD.itemFk)
|
||||||
|
OR !(NEW.quantity <=> OLD.quantity)
|
||||||
|
OR !(NEW.discount <=> OLD.discount) THEN
|
||||||
|
CALL ticket_requestRecalc(NEW.ticketFk);
|
||||||
|
CALL ticket_requestRecalc(OLD.ticketFk);
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
IF !(OLD.ticketFk <=> NEW.ticketFk) THEN
|
||||||
|
UPDATE ticketRequest SET ticketFk = NEW.ticketFk
|
||||||
|
WHERE saleFk = NEW.id;
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
SELECT account.myUser_getName() INTO vUserRole;
|
||||||
|
SELECT account.user_getMysqlRole(vUserRole) INTO vUserRole;
|
||||||
|
|
||||||
|
IF !(OLD.quantity <=> NEW.quantity) THEN
|
||||||
|
SELECT COUNT(*) INTO vIsToSendMail
|
||||||
|
FROM vncontrol.inter i
|
||||||
|
JOIN vn.state s ON s.id = i.state_id
|
||||||
|
WHERE s.code='PACKED'
|
||||||
|
AND i.Id_Ticket = OLD.ticketFk
|
||||||
|
AND vUserRole IN ('salesPerson', 'salesTeamBoss')
|
||||||
|
LIMIT 1;
|
||||||
|
|
||||||
|
IF vIsToSendMail THEN
|
||||||
|
CALL vn.mail_insert('jefesventas@verdnatura.es',
|
||||||
|
'noreply@verdnatura.es',
|
||||||
|
CONCAT('Ticket ', OLD.ticketFk ,' modificada cantidad tras encajado'),
|
||||||
|
CONCAT('Ticket <a href="https://salix.verdnatura.es/#!/ticket/', OLD.ticketFk ,'/log">', OLD.ticketFk ,'</a>. <br>',
|
||||||
|
'Modificada la catidad de ', OLD.quantity, ' a ' , NEW.quantity,
|
||||||
|
' del artículo ', OLD.itemFk, ' tras estado encajado del ticket. <br>',
|
||||||
|
'Este email se ha generado automáticamente' )
|
||||||
|
);
|
||||||
|
END IF;
|
||||||
|
IF (OLD.quantity > NEW.quantity) THEN
|
||||||
|
INSERT INTO saleComponent(saleFk, componentFk, value)
|
||||||
|
SELECT NEW.id, cm.id, sc.value
|
||||||
|
FROM saleComponent sc
|
||||||
|
JOIN component cd ON cd.id = sc.componentFk
|
||||||
|
JOIN component cm ON cm.code = 'mana'
|
||||||
|
WHERE saleFk = NEW.id AND cd.code = 'lastUnitsDiscount'
|
||||||
|
ON DUPLICATE KEY UPDATE value = sc.value + VALUES(value);
|
||||||
|
|
||||||
|
DELETE sc.*
|
||||||
|
FROM vn.saleComponent sc
|
||||||
|
JOIN component c ON c.id = sc.componentFk
|
||||||
|
WHERE saleFk = NEW.id AND c.code = 'lastUnitsDiscount';
|
||||||
|
END IF;
|
||||||
|
INSERT IGNORE INTO `vn`.`routeRecalc` (`routeFk`)
|
||||||
|
SELECT r.id
|
||||||
|
FROM vn.sale s
|
||||||
|
JOIN vn.ticket t ON t.id = s.ticketFk
|
||||||
|
JOIN vn.route r ON r.id = t.routeFk
|
||||||
|
WHERE r.isOk = FALSE
|
||||||
|
AND s.id = NEW.id
|
||||||
|
AND r.created >= CURDATE()
|
||||||
|
GROUP BY r.id;
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
IF !(ABS(NEW.isPicked) <=> ABS(OLD.isPicked)) AND NEW.quantity > 0 THEN
|
||||||
|
|
||||||
|
UPDATE vn.collection c
|
||||||
|
JOIN vn.ticketCollection tc ON tc.collectionFk = c.id AND tc.ticketFk = NEW.ticketFk
|
||||||
|
SET c.salePickedCount = c.salePickedCount + IF(NEW.isPicked != 0, 1, -1);
|
||||||
|
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
IF !(NEW.quantity <=> OLD.quantity) AND (NEW.quantity = 0 OR OLD.quantity = 0) THEN
|
||||||
|
|
||||||
|
UPDATE vn.collection c
|
||||||
|
JOIN vn.ticketCollection tc ON tc.collectionFk = c.id AND tc.ticketFk = NEW.ticketFk
|
||||||
|
SET c.saleTotalCount = c.saleTotalCount + IF(OLD.quantity = 0, 1, -1);
|
||||||
|
END IF;
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
File diff suppressed because one or more lines are too long
|
@ -1,7 +1,7 @@
|
||||||
CREATE SCHEMA IF NOT EXISTS `vn2008`;
|
CREATE SCHEMA IF NOT EXISTS `vn2008`;
|
||||||
CREATE SCHEMA IF NOT EXISTS `tmp`;
|
CREATE SCHEMA IF NOT EXISTS `tmp`;
|
||||||
|
|
||||||
UPDATE `util`.`config`
|
UPDATE `util`.`config`
|
||||||
SET `environment`= 'test';
|
SET `environment`= 'test';
|
||||||
|
|
||||||
ALTER TABLE `vn`.`itemTaxCountry` AUTO_INCREMENT = 1;
|
ALTER TABLE `vn`.`itemTaxCountry` AUTO_INCREMENT = 1;
|
||||||
|
@ -9,11 +9,11 @@ ALTER TABLE `vn`.`address` AUTO_INCREMENT = 1;
|
||||||
ALTER TABLE `vn`.`zoneGeo` AUTO_INCREMENT = 1;
|
ALTER TABLE `vn`.`zoneGeo` AUTO_INCREMENT = 1;
|
||||||
ALTER TABLE `vn`.`ticket` AUTO_INCREMENT = 1;
|
ALTER TABLE `vn`.`ticket` AUTO_INCREMENT = 1;
|
||||||
|
|
||||||
INSERT INTO `salix`.`AccessToken` (`id`, `ttl`, `created`, `userId`)
|
INSERT INTO `salix`.`AccessToken` (`id`, `ttl`, `created`, `userId`)
|
||||||
VALUES
|
VALUES
|
||||||
('DEFAULT_TOKEN', '1209600', util.VN_CURDATE(), 66);
|
('DEFAULT_TOKEN', '1209600', util.VN_CURDATE(), 66);
|
||||||
|
|
||||||
INSERT INTO `vn`.`ticketConfig` (`id`, `scopeDays`)
|
INSERT INTO `vn`.`ticketConfig` (`id`, `scopeDays`)
|
||||||
VALUES
|
VALUES
|
||||||
('1', '6');
|
('1', '6');
|
||||||
|
|
||||||
|
@ -22,11 +22,11 @@ INSERT INTO `vn`.`bionicConfig` (`generalInflationCoeficient`, `minimumDensityVo
|
||||||
(1.30, 167.00, 138000, 71);
|
(1.30, 167.00, 138000, 71);
|
||||||
|
|
||||||
INSERT INTO `vn`.`chatConfig` (`host`, `api`)
|
INSERT INTO `vn`.`chatConfig` (`host`, `api`)
|
||||||
VALUES
|
VALUES
|
||||||
('https://chat.verdnatura.es', 'https://chat.verdnatura.es/api/v1');
|
('https://chat.verdnatura.es', 'https://chat.verdnatura.es/api/v1');
|
||||||
|
|
||||||
INSERT IGNORE INTO `vn`.`greugeConfig`(`id`, `freightPickUpPrice`)
|
INSERT IGNORE INTO `vn`.`greugeConfig`(`id`, `freightPickUpPrice`)
|
||||||
VALUES
|
VALUES
|
||||||
('1', '11');
|
('1', '11');
|
||||||
|
|
||||||
INSERT INTO `vn`.`packagingConfig`(`upperGap`)
|
INSERT INTO `vn`.`packagingConfig`(`upperGap`)
|
||||||
|
@ -52,11 +52,11 @@ INSERT INTO `account`.`account`(`id`)
|
||||||
INSERT INTO `vn`.`educationLevel` (`id`, `name`)
|
INSERT INTO `vn`.`educationLevel` (`id`, `name`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 'ESTUDIOS PRIMARIOS COMPLETOS'),
|
(1, 'ESTUDIOS PRIMARIOS COMPLETOS'),
|
||||||
(2, 'ENSEÑANZAS DE BACHILLERATO');
|
(2, 'ENSEÑANZAS DE BACHILLERATO');
|
||||||
|
|
||||||
INSERT INTO `vn`.`worker`(`id`,`code`, `firstName`, `lastName`, `userFk`, `bossFk`)
|
INSERT INTO `vn`.`worker`(`id`,`code`, `firstName`, `lastName`, `userFk`, `bossFk`)
|
||||||
SELECT id,UPPER(LPAD(role, 3, '0')), name, name, id, 9
|
SELECT id,UPPER(LPAD(role, 3, '0')), name, name, id, 9
|
||||||
FROM `vn`.`user`;
|
FROM `vn`.`user`;
|
||||||
|
|
||||||
UPDATE `vn`.`worker` SET bossFk = NULL WHERE id = 20;
|
UPDATE `vn`.`worker` SET bossFk = NULL WHERE id = 20;
|
||||||
UPDATE `vn`.`worker` SET bossFk = 20 WHERE id = 1 OR id = 9;
|
UPDATE `vn`.`worker` SET bossFk = 20 WHERE id = 1 OR id = 9;
|
||||||
|
@ -69,7 +69,7 @@ INSERT INTO `hedera`.`tpvConfig`(`id`, `currency`, `terminal`, `transactionType`
|
||||||
(1, 978, 1, 0, 2000, 9, 0);
|
(1, 978, 1, 0, 2000, 9, 0);
|
||||||
|
|
||||||
INSERT INTO `account`.`user`(`id`,`name`,`nickname`, `password`,`role`,`active`,`email`,`lang`, `image`)
|
INSERT INTO `account`.`user`(`id`,`name`,`nickname`, `password`,`role`,`active`,`email`,`lang`, `image`)
|
||||||
VALUES
|
VALUES
|
||||||
(1101, 'BruceWayne', 'Bruce Wayne', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'BruceWayne@mydomain.com', 'es', 'e7723f0b24ff05b32ed09d95196f2f29'),
|
(1101, 'BruceWayne', 'Bruce Wayne', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'BruceWayne@mydomain.com', 'es', 'e7723f0b24ff05b32ed09d95196f2f29'),
|
||||||
(1102, 'PetterParker', 'Petter Parker', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'PetterParker@mydomain.com', 'en', 'e7723f0b24ff05b32ed09d95196f2f29'),
|
(1102, 'PetterParker', 'Petter Parker', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'PetterParker@mydomain.com', 'en', 'e7723f0b24ff05b32ed09d95196f2f29'),
|
||||||
(1103, 'ClarkKent', 'Clark Kent', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'ClarkKent@mydomain.com', 'fr', 'e7723f0b24ff05b32ed09d95196f2f29'),
|
(1103, 'ClarkKent', 'Clark Kent', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'ClarkKent@mydomain.com', 'fr', 'e7723f0b24ff05b32ed09d95196f2f29'),
|
||||||
|
@ -113,7 +113,7 @@ INSERT INTO `vn`.`worker`(`id`, `code`, `firstName`, `lastName`, `userFk`,`bossF
|
||||||
(1107, 'ANT', 'Hank' , 'Pym' , 1107, 19, 432978107, NULL, 1),
|
(1107, 'ANT', 'Hank' , 'Pym' , 1107, 19, 432978107, NULL, 1),
|
||||||
(1108, 'DCX', 'Charles' , 'Xavier', 1108, 19, 432978108, 1, NULL),
|
(1108, 'DCX', 'Charles' , 'Xavier', 1108, 19, 432978108, 1, NULL),
|
||||||
(1109, 'HLK', 'Bruce' , 'Banner', 1109, 19, 432978109, 1, 2),
|
(1109, 'HLK', 'Bruce' , 'Banner', 1109, 19, 432978109, 1, 2),
|
||||||
(1110, 'JJJ', 'Jessica' , 'Jones' , 1110, 19, 432978110, 2, 1);
|
(1110, 'JJJ', 'Jessica' , 'Jones' , 1110, 19, 432978110, 2, 1);
|
||||||
|
|
||||||
INSERT INTO `vn`.`currency`(`id`, `code`, `name`, `ratio`)
|
INSERT INTO `vn`.`currency`(`id`, `code`, `name`, `ratio`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -123,7 +123,7 @@ INSERT INTO `vn`.`currency`(`id`, `code`, `name`, `ratio`)
|
||||||
(4, 'JPY', 'Yen Japones', 1);
|
(4, 'JPY', 'Yen Japones', 1);
|
||||||
|
|
||||||
INSERT INTO `vn`.`country`(`id`, `country`, `isUeeMember`, `code`, `currencyFk`, `ibanLength`, `continentFk`, `hasDailyInvoice`, `CEE`, `politicalCountryFk`)
|
INSERT INTO `vn`.`country`(`id`, `country`, `isUeeMember`, `code`, `currencyFk`, `ibanLength`, `continentFk`, `hasDailyInvoice`, `CEE`, `politicalCountryFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 'España', 1, 'ES', 1, 24, 4, 0, 1, 1),
|
(1, 'España', 1, 'ES', 1, 24, 4, 0, 1, 1),
|
||||||
(2, 'Italia', 1, 'IT', 1, 27, 4, 0, 1, 2),
|
(2, 'Italia', 1, 'IT', 1, 27, 4, 0, 1, 2),
|
||||||
(3, 'Alemania', 1, 'DE', 1, 22, 4, 0, 1, 3),
|
(3, 'Alemania', 1, 'DE', 1, 22, 4, 0, 1, 3),
|
||||||
|
@ -146,15 +146,17 @@ INSERT INTO `vn`.`warehouse`(`id`, `name`, `code`, `isComparative`, `isInventory
|
||||||
(3, 'Warehouse Three', NULL, 1, 1, 1, 1, 0, 0, 2, 1, 1),
|
(3, 'Warehouse Three', NULL, 1, 1, 1, 1, 0, 0, 2, 1, 1),
|
||||||
(4, 'Warehouse Four', NULL, 1, 1, 1, 1, 0, 0, 2, 1, 1),
|
(4, 'Warehouse Four', NULL, 1, 1, 1, 1, 0, 0, 2, 1, 1),
|
||||||
(5, 'Warehouse Five', NULL, 1, 1, 1, 1, 0, 0, 2, 1, 1),
|
(5, 'Warehouse Five', NULL, 1, 1, 1, 1, 0, 0, 2, 1, 1),
|
||||||
(13, 'Inventory', NULL, 1, 1, 1, 0, 0, 0, 2, 1, 0);
|
(13, 'Inventory', NULL, 1, 1, 1, 0, 0, 0, 2, 1, 0),
|
||||||
|
(60, 'Algemesi', NULL, 1, 1, 1, 0, 0, 0, 2, 1, 0);
|
||||||
|
|
||||||
|
|
||||||
INSERT INTO `vn`.`sector`(`id`, `description`, `warehouseFk`, `isPreviousPreparedByPacking`, `code`)
|
INSERT INTO `vn`.`sector`(`id`, `description`, `warehouseFk`, `isPreviousPreparedByPacking`, `code`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 'First sector', 1, 1, 'FIRST'),
|
(1, 'First sector', 1, 1, 'FIRST'),
|
||||||
(2, 'Second sector', 2, 0, 'SECOND');
|
(2, 'Second sector', 2, 0, 'SECOND');
|
||||||
|
|
||||||
INSERT INTO `vn`.`parking` (`id`, `column`, `row`, `sectorFk`, `code`, `pickingOrder`)
|
INSERT INTO `vn`.`parking` (`id`, `column`, `row`, `sectorFk`, `code`, `pickingOrder`)
|
||||||
VALUES
|
VALUES
|
||||||
('1', 700, '01', 1, '700-01', 70001),
|
('1', 700, '01', 1, '700-01', 70001),
|
||||||
('2', 700, '02', 2, '700-02', 70002),
|
('2', 700, '02', 2, '700-02', 70002),
|
||||||
('3', 100, '01', 1, '100-01', 1),
|
('3', 100, '01', 1, '100-01', 1),
|
||||||
|
@ -163,8 +165,8 @@ INSERT INTO `vn`.`parking` (`id`, `column`, `row`, `sectorFk`, `code`, `pickingO
|
||||||
(34965, 200, '02', 2, 'L-08-4', 21800),
|
(34965, 200, '02', 2, 'L-08-4', 21800),
|
||||||
(39096, 200, '03', 2, 'LR-02-3', 99999);
|
(39096, 200, '03', 2, 'LR-02-3', 99999);
|
||||||
|
|
||||||
INSERT INTO `vn`.`shelving` (`code`, `parkingFk`, `isPrinted`, `priority`, `userFk`, `isRecyclable`)
|
INSERT INTO `vn`.`shelving` (`code`, `parkingFk`, `isPrinted`, `priority`, `userFk`, `isRecyclable`)
|
||||||
VALUES
|
VALUES
|
||||||
('AA6', 34965, 1, 0, NULL, 0),
|
('AA6', 34965, 1, 0, NULL, 0),
|
||||||
('AA7', 34965, 1, 0, NULL, 0),
|
('AA7', 34965, 1, 0, NULL, 0),
|
||||||
('AA8', 34965, 1, 0, NULL, 0),
|
('AA8', 34965, 1, 0, NULL, 0),
|
||||||
|
@ -180,7 +182,7 @@ INSERT INTO `vn`.`shelving` (`code`, `parkingFk`, `isPrinted`, `priority`, `user
|
||||||
('UXN', 1, 0, 1, 1106, 1);
|
('UXN', 1, 0, 1, 1106, 1);
|
||||||
|
|
||||||
INSERT INTO `vn`.`accountingType`(`id`, `description`, `receiptDescription`,`code`, `maxAmount`, `daysInFuture`)
|
INSERT INTO `vn`.`accountingType`(`id`, `description`, `receiptDescription`,`code`, `maxAmount`, `daysInFuture`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 'CC and credit policies', 'Transfers', 'wireTransfer', NULL, 1),
|
(1, 'CC and credit policies', 'Transfers', 'wireTransfer', NULL, 1),
|
||||||
(2, 'Cash', 'Cash', 'cash', 1000, 0),
|
(2, 'Cash', 'Cash', 'cash', 1000, 0),
|
||||||
(3, 'Credit card', 'Credit Card', 'creditCard', NULL, 0),
|
(3, 'Credit card', 'Credit Card', 'creditCard', NULL, 0),
|
||||||
|
@ -195,8 +197,8 @@ INSERT INTO `vn`.`bankEntity`(`id`, `countryFk`, `name`, `bic`)
|
||||||
(128, 1, 'The Best Bank', 'BBKKESMMMMMM'),
|
(128, 1, 'The Best Bank', 'BBKKESMMMMMM'),
|
||||||
(2100, 1, 'Caixa Bank', 'CAIXESBB');
|
(2100, 1, 'Caixa Bank', 'CAIXESBB');
|
||||||
|
|
||||||
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', '5720000001', 3, 128, 1, 1),
|
(1, 'Pay on receipt', '5720000001', 3, 128, 1, 1),
|
||||||
(2, 'Cash', '5700000001', 2, 128, 1, 1),
|
(2, 'Cash', '5700000001', 2, 128, 1, 1),
|
||||||
(3, 'Compensation', '4000000000', 8, 128, 1, 1),
|
(3, 'Compensation', '4000000000', 8, 128, 1, 1),
|
||||||
|
@ -250,7 +252,7 @@ UPDATE `vn`.`agencyMode` SET `web` = 1, `reportMail` = 'no-reply@gothamcity.com'
|
||||||
UPDATE `vn`.`agencyMode` SET `code` = 'refund' WHERE `id` = 23;
|
UPDATE `vn`.`agencyMode` SET `code` = 'refund' WHERE `id` = 23;
|
||||||
|
|
||||||
INSERT INTO `vn`.`payMethod`(`id`,`code`, `name`, `graceDays`, `outstandingDebt`, `isIbanRequiredForClients`, `isIbanRequiredForSuppliers`, `hasVerified`)
|
INSERT INTO `vn`.`payMethod`(`id`,`code`, `name`, `graceDays`, `outstandingDebt`, `isIbanRequiredForClients`, `isIbanRequiredForSuppliers`, `hasVerified`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, NULL, 'PayMethod one', 0, 001, 0, 0, 0),
|
(1, NULL, 'PayMethod one', 0, 001, 0, 0, 0),
|
||||||
(2, NULL, 'PayMethod two', 10, 001, 0, 0, 1),
|
(2, NULL, 'PayMethod two', 10, 001, 0, 0, 1),
|
||||||
(3, 'compensation', 'PayMethod three', 0, 001, 0, 0, 0),
|
(3, 'compensation', 'PayMethod three', 0, 001, 0, 0, 0),
|
||||||
|
@ -259,7 +261,7 @@ INSERT INTO `vn`.`payMethod`(`id`,`code`, `name`, `graceDays`, `outstandingDebt
|
||||||
(8,'wireTransfer', 'WireTransfer', 5, 001, 1, 1, 0);
|
(8,'wireTransfer', 'WireTransfer', 5, 001, 1, 1, 0);
|
||||||
|
|
||||||
INSERT INTO `vn`.`payDem`(`id`, `payDem`)
|
INSERT INTO `vn`.`payDem`(`id`, `payDem`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 10),
|
(1, 10),
|
||||||
(2, 20);
|
(2, 20);
|
||||||
|
|
||||||
|
@ -288,7 +290,7 @@ INSERT INTO `vn`.`town`(`id`, `name`, `provinceFk`)
|
||||||
(5, 'Quito', 5);
|
(5, 'Quito', 5);
|
||||||
|
|
||||||
INSERT INTO `vn`.`postCode`(`code`, `townFk`, `geoFk`)
|
INSERT INTO `vn`.`postCode`(`code`, `townFk`, `geoFk`)
|
||||||
VALUES
|
VALUES
|
||||||
('46000', 1, 6),
|
('46000', 1, 6),
|
||||||
('46460', 2, 6),
|
('46460', 2, 6),
|
||||||
('46680', 3, 6),
|
('46680', 3, 6),
|
||||||
|
@ -529,7 +531,7 @@ INSERT INTO `vn`.`company`(`id`, `code`, `supplierAccountFk`, `workerManagerFk`,
|
||||||
(442 , 'VNL', 241, 30, 2 , 1, NULL, 2, 'VNL Company - Plant passport'),
|
(442 , 'VNL', 241, 30, 2 , 1, NULL, 2, 'VNL Company - Plant passport'),
|
||||||
(567 , 'VNH', NULL, 30, NULL, 4, NULL, 1, 'VNH Company - Plant passport'),
|
(567 , 'VNH', NULL, 30, NULL, 4, NULL, 1, 'VNH Company - Plant passport'),
|
||||||
(791 , 'FTH', NULL, 30, NULL, 3, '2015-11-30', 1, NULL),
|
(791 , 'FTH', NULL, 30, NULL, 3, '2015-11-30', 1, NULL),
|
||||||
(1381, 'ORN', NULL, 30, NULL, 7, NULL, 1, 'ORN Company - Plant passport');
|
(1381, 'ORN', NULL, 30, NULL, 7, NULL, 1, 'ORN Company - Plant passport');
|
||||||
|
|
||||||
INSERT INTO `vn`.`taxArea` (`code`, `claveOperacionFactura`, `CodigoTransaccion`)
|
INSERT INTO `vn`.`taxArea` (`code`, `claveOperacionFactura`, `CodigoTransaccion`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -550,7 +552,7 @@ INSERT INTO `vn`.`invoiceOutSerial` (`code`, `description`, `isTaxed`, `taxAreaF
|
||||||
INSERT INTO `vn`.`invoiceOut`(`id`, `serial`, `amount`, `issued`,`clientFk`, `created`, `companyFk`, `dued`, `booked`, `bankFk`, `hasPdf`)
|
INSERT INTO `vn`.`invoiceOut`(`id`, `serial`, `amount`, `issued`,`clientFk`, `created`, `companyFk`, `dued`, `booked`, `bankFk`, `hasPdf`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 'T', 1014.24, util.VN_CURDATE(), 1101, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0),
|
(1, 'T', 1014.24, util.VN_CURDATE(), 1101, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0),
|
||||||
(2, 'T', 121.36, util.VN_CURDATE(), 1102, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0),
|
(2, 'T', 121.36, util.VN_CURDATE(), 1102, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0),
|
||||||
(3, 'T', 8.88, util.VN_CURDATE(), 1103, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0),
|
(3, 'T', 8.88, util.VN_CURDATE(), 1103, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0),
|
||||||
(4, 'T', 8.88, util.VN_CURDATE(), 1103, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0),
|
(4, 'T', 8.88, util.VN_CURDATE(), 1103, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0),
|
||||||
(5, 'A', 8.88, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1103, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 442, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 0);
|
(5, 'A', 8.88, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1103, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 442, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 0);
|
||||||
|
@ -562,7 +564,7 @@ UPDATE `vn`.`invoiceOut` SET ref = 'T4444444' WHERE id = 4;
|
||||||
UPDATE `vn`.`invoiceOut` SET ref = 'A1111111' WHERE id = 5;
|
UPDATE `vn`.`invoiceOut` SET ref = 'A1111111' WHERE id = 5;
|
||||||
|
|
||||||
INSERT INTO `vn`.`invoiceOutTax` (`invoiceOutFk`, `taxableBase`, `vat`, `pgcFk`)
|
INSERT INTO `vn`.`invoiceOutTax` (`invoiceOutFk`, `taxableBase`, `vat`, `pgcFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 895.76, 89.58, 4722000010),
|
(1, 895.76, 89.58, 4722000010),
|
||||||
(1, 33.80, 7.10, 4722000021),
|
(1, 33.80, 7.10, 4722000021),
|
||||||
(2, 110.33, 11.03, 4770000010),
|
(2, 110.33, 11.03, 4770000010),
|
||||||
|
@ -581,7 +583,7 @@ INSERT INTO `vn`.`expence`(`id`, `name`, `isWithheld`)
|
||||||
(7001000000, 'Mercaderia', 0),
|
(7001000000, 'Mercaderia', 0),
|
||||||
(7050000000, 'Prestacion de servicios', 1);
|
(7050000000, 'Prestacion de servicios', 1);
|
||||||
|
|
||||||
|
|
||||||
INSERT INTO `vn`.`invoiceOutExpence`(`id`, `invoiceOutFk`, `amount`, `expenceFk`, `created`)
|
INSERT INTO `vn`.`invoiceOutExpence`(`id`, `invoiceOutFk`, `amount`, `expenceFk`, `created`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 1, 813.06, 2000000000, util.VN_CURDATE()),
|
(1, 1, 813.06, 2000000000, util.VN_CURDATE()),
|
||||||
|
@ -593,7 +595,7 @@ INSERT INTO `vn`.`invoiceOutExpence`(`id`, `invoiceOutFk`, `amount`, `expenceFk`
|
||||||
(7, 5, 8.07, 2000000000, util.VN_CURDATE());
|
(7, 5, 8.07, 2000000000, util.VN_CURDATE());
|
||||||
|
|
||||||
INSERT INTO `vn`.`zone` (`id`, `name`, `hour`, `agencyModeFk`, `travelingDays`, `price`, `bonus`, `itemMaxSize`)
|
INSERT INTO `vn`.`zone` (`id`, `name`, `hour`, `agencyModeFk`, `travelingDays`, `price`, `bonus`, `itemMaxSize`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 'Zone pickup A', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 1, 0, 0, 0, 100),
|
(1, 'Zone pickup A', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 1, 0, 0, 0, 100),
|
||||||
(2, 'Zone pickup B', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 1, 0, 0, 0, 100),
|
(2, 'Zone pickup B', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 1, 0, 0, 0, 100),
|
||||||
(3, 'Zone 247 A', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 7, 1, 2, 0, 100),
|
(3, 'Zone 247 A', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 7, 1, 2, 0, 100),
|
||||||
|
@ -609,7 +611,7 @@ INSERT INTO `vn`.`zone` (`id`, `name`, `hour`, `agencyModeFk`, `travelingDays`,
|
||||||
(13, 'Zone quantum break', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 5, 0, 0, 0, 100);
|
(13, 'Zone quantum break', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 5, 0, 0, 0, 100);
|
||||||
|
|
||||||
INSERT INTO `vn`.`zoneWarehouse` (`id`, `zoneFk`, `warehouseFk`)
|
INSERT INTO `vn`.`zoneWarehouse` (`id`, `zoneFk`, `warehouseFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 1, 1),
|
(1, 1, 1),
|
||||||
(2, 2, 2),
|
(2, 2, 2),
|
||||||
(3, 3, 1),
|
(3, 3, 1),
|
||||||
|
@ -625,7 +627,7 @@ INSERT INTO `vn`.`zoneWarehouse` (`id`, `zoneFk`, `warehouseFk`)
|
||||||
(13, 13, 5);
|
(13, 13, 5);
|
||||||
|
|
||||||
INSERT INTO `vn`.`zoneClosure` (`zoneFk`, `dated`, `hour`)
|
INSERT INTO `vn`.`zoneClosure` (`zoneFk`, `dated`, `hour`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, util.VN_CURDATE(), '23:59'),
|
(1, util.VN_CURDATE(), '23:59'),
|
||||||
(2, util.VN_CURDATE(), '23:59'),
|
(2, util.VN_CURDATE(), '23:59'),
|
||||||
(3, util.VN_CURDATE(), '23:59'),
|
(3, util.VN_CURDATE(), '23:59'),
|
||||||
|
@ -697,7 +699,7 @@ INSERT INTO `vn`.`ticketObservation`(`id`, `ticketFk`, `observationTypeFk`, `des
|
||||||
(11, 24, 4, 'Reclama ticket: 7'),
|
(11, 24, 4, 'Reclama ticket: 7'),
|
||||||
(12, 11, 3, 'Delivery after 10am');
|
(12, 11, 3, 'Delivery after 10am');
|
||||||
|
|
||||||
-- FIX for state hours on local, inter_afterInsert
|
-- FIX for state hours on local, inter_afterInsert
|
||||||
UPDATE vncontrol.inter SET odbc_date = DATE_ADD(util.VN_CURDATE(), INTERVAL -10 SECOND);
|
UPDATE vncontrol.inter SET odbc_date = DATE_ADD(util.VN_CURDATE(), INTERVAL -10 SECOND);
|
||||||
|
|
||||||
INSERT INTO `vn`.`ticketTracking`(`ticketFk`, `stateFk`, `workerFk`, `created`)
|
INSERT INTO `vn`.`ticketTracking`(`ticketFk`, `stateFk`, `workerFk`, `created`)
|
||||||
|
@ -793,16 +795,16 @@ INSERT INTO `vn`.`itemCategory`(`id`, `name`, `display`, `color`, `icon`, `code`
|
||||||
INSERT INTO `vn`.`temperature`(`code`, `name`, `description`)
|
INSERT INTO `vn`.`temperature`(`code`, `name`, `description`)
|
||||||
VALUES
|
VALUES
|
||||||
('warm', 'Warm', 'Warm'),
|
('warm', 'Warm', 'Warm'),
|
||||||
('cool', 'Cool', 'Cool');
|
('cool', 'Cool', 'Cool');
|
||||||
|
|
||||||
INSERT INTO `vn`.`itemType`(`id`, `code`, `name`, `categoryFk`, `warehouseFk`, `life`,`workerFk`, `isPackaging`, `temperatureFk`)
|
INSERT INTO `vn`.`itemType`(`id`, `code`, `name`, `categoryFk`, `life`, `workerFk`, `isPackaging`, `temperatureFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 'CRI', 'Crisantemo', 2, 1, 31, 35, 0, 'cool'),
|
(1, 'CRI', 'Crisantemo', 2, 31, 35, 0, 'cool'),
|
||||||
(2, 'ITG', 'Anthurium', 1, 1, 31, 35, 0, 'cool'),
|
(2, 'ITG', 'Anthurium', 1, 31, 35, 0, 'cool'),
|
||||||
(3, 'WPN', 'Paniculata', 2, 1, 31, 35, 0, 'cool'),
|
(3, 'WPN', 'Paniculata', 2, 31, 35, 0, 'cool'),
|
||||||
(4, 'PRT', 'Delivery ports', 3, 1, NULL, 35, 1, 'warm'),
|
(4, 'PRT', 'Delivery ports', 3, NULL, 35, 1, 'warm'),
|
||||||
(5, 'CON', 'Container', 3, 1, NULL, 35, 1, 'warm'),
|
(5, 'CON', 'Container', 3, NULL, 35, 1, 'warm'),
|
||||||
(6, 'ALS', 'Alstroemeria', 1, 1, 31, 16, 0, 'warm');
|
(6, 'ALS', 'Alstroemeria', 1, 31, 16, 0, 'warm');
|
||||||
|
|
||||||
INSERT INTO `vn`.`ink`(`id`, `name`, `picture`, `showOrder`, `hex`)
|
INSERT INTO `vn`.`ink`(`id`, `name`, `picture`, `showOrder`, `hex`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -847,7 +849,7 @@ INSERT INTO `vn`.`taxClassCode`(`taxClassFk`, `effectived`, `taxCodeFk`)
|
||||||
(1, util.VN_CURDATE(), 1),
|
(1, util.VN_CURDATE(), 1),
|
||||||
(1, util.VN_CURDATE(), 21),
|
(1, util.VN_CURDATE(), 21),
|
||||||
(2, util.VN_CURDATE(), 2);
|
(2, util.VN_CURDATE(), 2);
|
||||||
|
|
||||||
INSERT INTO `vn`.`intrastat`(`id`, `description`, `taxClassFk`, `taxCodeFk`)
|
INSERT INTO `vn`.`intrastat`(`id`, `description`, `taxClassFk`, `taxCodeFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(05080000, 'Coral y materiales similares', 2, 2),
|
(05080000, 'Coral y materiales similares', 2, 2),
|
||||||
|
@ -859,7 +861,7 @@ INSERT INTO `vn`.`itemFamily`(`code`, `description`)
|
||||||
('SER', 'Services'),
|
('SER', 'Services'),
|
||||||
('VT', 'Sales');
|
('VT', 'Sales');
|
||||||
|
|
||||||
INSERT INTO `vn`.`item`(`id`, `typeFk`, `size`, `inkFk`, `stems`, `originFk`, `description`, `producerFk`, `intrastatFk`, `expenceFk`,
|
INSERT INTO `vn`.`item`(`id`, `typeFk`, `size`, `inkFk`, `stems`, `originFk`, `description`, `producerFk`, `intrastatFk`, `expenceFk`,
|
||||||
`comment`, `relevancy`, `image`, `subName`, `minPrice`, `stars`, `family`, `isFloramondo`, `genericFk`, `itemPackingTypeFk`, `hasMinPrice`, `packingShelve`)
|
`comment`, `relevancy`, `image`, `subName`, `minPrice`, `stars`, `family`, `isFloramondo`, `genericFk`, `itemPackingTypeFk`, `hasMinPrice`, `packingShelve`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 2, 70, 'YEL', 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '1', NULL, 0, 1, 'VT', 0, NULL, 'V', 0, 15),
|
(1, 2, 70, 'YEL', 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '1', NULL, 0, 1, 'VT', 0, NULL, 'V', 0, 15),
|
||||||
|
@ -995,7 +997,7 @@ INSERT INTO `vn`.`saleComponent`(`saleFk`, `componentFk`, `value`)
|
||||||
(3, 39, 0.994),
|
(3, 39, 0.994),
|
||||||
(4, 28, 1.25),
|
(4, 28, 1.25),
|
||||||
(4, 29, 0.42),
|
(4, 29, 0.42),
|
||||||
(4, 39, 0.017),
|
(4, 39, 0.017),
|
||||||
(5, 17, 9.94),
|
(5, 17, 9.94),
|
||||||
(5, 28, 50),
|
(5, 28, 50),
|
||||||
(5, 29, 49.4),
|
(5, 29, 49.4),
|
||||||
|
@ -1017,8 +1019,8 @@ INSERT INTO `vn`.`saleComponent`(`saleFk`, `componentFk`, `value`)
|
||||||
(9, 15, 3.0949),
|
(9, 15, 3.0949),
|
||||||
(9, 21, 0.001),
|
(9, 21, 0.001),
|
||||||
(9, 28, 53),
|
(9, 28, 53),
|
||||||
(9, 29, 46.4),
|
(9, 29, 46.4),
|
||||||
(9, 39, 0.994),
|
(9, 39, 0.994),
|
||||||
(10, 15, 0.0199),
|
(10, 15, 0.0199),
|
||||||
(10, 28, 7),
|
(10, 28, 7),
|
||||||
(10, 29, 0),
|
(10, 29, 0),
|
||||||
|
@ -1117,14 +1119,14 @@ INSERT INTO `vn`.`saleComponent`(`saleFk`, `componentFk`, `value`)
|
||||||
(32, 36, -92.324),
|
(32, 36, -92.324),
|
||||||
(32, 39, 0.994);
|
(32, 39, 0.994);
|
||||||
|
|
||||||
INSERT INTO `vn`.`itemShelving` (`itemFk`, `shelvingFk`, `shelve`, `visible`, `grouping`, `packing`, `userFk`)
|
INSERT INTO `vn`.`itemShelving` (`itemFk`, `shelvingFk`, `shelve`, `visible`, `grouping`, `packing`, `userFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(2, 'GVC', 'A', 1, 1, 1, 1106),
|
(2, 'GVC', 'A', 1, 1, 1, 1106),
|
||||||
(4, 'HEJ', 'A', 1, 1, 1, 1106),
|
(4, 'HEJ', 'A', 1, 1, 1, 1106),
|
||||||
(1, 'UXN', 'A', 2, 12, 12, 1106);
|
(1, 'UXN', 'A', 2, 12, 12, 1106);
|
||||||
|
|
||||||
INSERT INTO `vn`.`itemShelvingSale` (`itemShelvingFk`, `saleFk`, `quantity`, `created`, `userFk`)
|
INSERT INTO `vn`.`itemShelvingSale` (`itemShelvingFk`, `saleFk`, `quantity`, `created`, `userFk`)
|
||||||
VALUES
|
VALUES
|
||||||
('1', '1', '1', '', '1106'),
|
('1', '1', '1', '', '1106'),
|
||||||
('2', '2', '5', '', '1106'),
|
('2', '2', '5', '', '1106'),
|
||||||
('1', '7', '1', '', '1106'),
|
('1', '7', '1', '', '1106'),
|
||||||
|
@ -1317,7 +1319,7 @@ INSERT INTO `vn`.`itemTypeTag`(`id`, `itemTypeFk`, `tagFk`, `priority`)
|
||||||
CALL `vn`.`itemRefreshTags`(NULL);
|
CALL `vn`.`itemRefreshTags`(NULL);
|
||||||
|
|
||||||
INSERT INTO `vn`.`itemLog` (`id`, `originFk`, `userFk`, `action`, `description`)
|
INSERT INTO `vn`.`itemLog` (`id`, `originFk`, `userFk`, `action`, `description`)
|
||||||
VALUES
|
VALUES
|
||||||
('1', '1', '1', 'insert', 'We made a change!');
|
('1', '1', '1', 'insert', 'We made a change!');
|
||||||
|
|
||||||
INSERT INTO `vn`.`recovery`(`id`, `clientFk`, `started`, `finished`, `amount`, `period`)
|
INSERT INTO `vn`.`recovery`(`id`, `clientFk`, `started`, `finished`, `amount`, `period`)
|
||||||
|
@ -1493,8 +1495,8 @@ INSERT INTO `hedera`.`orderRowComponent`(`rowFk`, `componentFk`, `price`)
|
||||||
(4, 21, -0.001),
|
(4, 21, -0.001),
|
||||||
(4, 28, 20.72),
|
(4, 28, 20.72),
|
||||||
(4, 29, -19.72),
|
(4, 29, -19.72),
|
||||||
(4, 37, 2),
|
(4, 37, 2),
|
||||||
(4, 39, 0.01),
|
(4, 39, 0.01),
|
||||||
(5, 15, 0.58),
|
(5, 15, 0.58),
|
||||||
(5, 23, 6.5),
|
(5, 23, 6.5),
|
||||||
(5, 28, 20.72),
|
(5, 28, 20.72),
|
||||||
|
@ -1713,7 +1715,7 @@ INSERT INTO `vn`.`workerManaExcluded`(`workerFk`)
|
||||||
La otra manera es poner el calculo con los 2 trabajadores que utilizamos ahora mismo para los tickets
|
La otra manera es poner el calculo con los 2 trabajadores que utilizamos ahora mismo para los tickets
|
||||||
*/
|
*/
|
||||||
|
|
||||||
call vn.manaSpellersRequery(19);
|
call vn.manaSpellersRequery(19);
|
||||||
call vn.manaSpellersRequery(18);
|
call vn.manaSpellersRequery(18);
|
||||||
|
|
||||||
INSERT INTO `vn`.`clientSample`(`id`, `clientFk`, `typeFk`, `created`, `workerFk`, `userFk`, `companyFk`)
|
INSERT INTO `vn`.`clientSample`(`id`, `clientFk`, `typeFk`, `created`, `workerFk`, `userFk`, `companyFk`)
|
||||||
|
@ -1763,11 +1765,6 @@ INSERT INTO `vn`.`claimDestination`(`id`, `description`, `addressFk`)
|
||||||
(4, 'Reclam.PRAG', 12),
|
(4, 'Reclam.PRAG', 12),
|
||||||
(5, 'Corregido', 11);
|
(5, 'Corregido', 11);
|
||||||
|
|
||||||
INSERT INTO `vn`.`claimResponsible`(`id`, `description`, `responsability`)
|
|
||||||
VALUES
|
|
||||||
(1, 'Buyers', 0),
|
|
||||||
(7, 'Quality', 0);
|
|
||||||
|
|
||||||
INSERT INTO `vn`.`claimDevelopment`(`id`, `claimFk`, `claimResponsibleFk`, `workerFk`, `claimReasonFk`, `claimResultFk`, `claimRedeliveryFk`, `claimDestinationFk`)
|
INSERT INTO `vn`.`claimDevelopment`(`id`, `claimFk`, `claimResponsibleFk`, `workerFk`, `claimReasonFk`, `claimResultFk`, `claimRedeliveryFk`, `claimDestinationFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 1, 1, 21, 1, 1, 2, 5),
|
(1, 1, 1, 21, 1, 1, 2, 5),
|
||||||
|
@ -1786,8 +1783,8 @@ INSERT INTO `hedera`.`tpvMerchant`(`id`, `description`, `companyFk`, `bankFk`, `
|
||||||
(1, 'Arkham Bank', 442, 1, 'h12387193H10238'),
|
(1, 'Arkham Bank', 442, 1, 'h12387193H10238'),
|
||||||
(2, 'NewYork Bank', 442, 1, '7981ugsgd1hsdad');
|
(2, 'NewYork Bank', 442, 1, '7981ugsgd1hsdad');
|
||||||
|
|
||||||
INSERT INTO `hedera`.`tpvTransaction`(`id`,`merchantFk`, `clientFk`,`receiptFk`, `amount`, `response`, `errorCode`, `status`, `created`)
|
INSERT INTO `hedera`.`tpvTransaction`(`id`,`merchantFk`, `clientFk`,`receiptFk`, `amount`, `response`, `errorCode`, `status`, `created`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 1, 1101, NULL, 2000, NULL, 'SIS0042', 'ok', util.VN_CURDATE()),
|
(1, 1, 1101, NULL, 2000, NULL, 'SIS0042', 'ok', util.VN_CURDATE()),
|
||||||
(2, 1, 1101, NULL, 1000, NULL, 'SIS0051', 'started', util.VN_CURDATE()),
|
(2, 1, 1101, NULL, 1000, NULL, 'SIS0051', 'started', util.VN_CURDATE()),
|
||||||
(3, 2, 1101, NULL, 7268, NULL, NULL, 'ok', util.VN_CURDATE()),
|
(3, 2, 1101, NULL, 7268, NULL, NULL, 'ok', util.VN_CURDATE()),
|
||||||
|
@ -1801,32 +1798,32 @@ INSERT INTO `vn`.`orderTicket`(`orderFk`, `ticketFk`)
|
||||||
(2, 2),
|
(2, 2),
|
||||||
(3, 3),
|
(3, 3),
|
||||||
(4, 4),
|
(4, 4),
|
||||||
(5, 5),
|
(5, 5),
|
||||||
(6, 6),
|
(6, 6),
|
||||||
(7, 7),
|
(7, 7),
|
||||||
(8, 8),
|
(8, 8),
|
||||||
(9, 9),
|
(9, 9),
|
||||||
(10, 10),
|
(10, 10),
|
||||||
(11, 11),
|
(11, 11),
|
||||||
(12, 12),
|
(12, 12),
|
||||||
(13, 13),
|
(13, 13),
|
||||||
(14, 14),
|
(14, 14),
|
||||||
(15, 15),
|
(15, 15),
|
||||||
(16, 16),
|
(16, 16),
|
||||||
(17, 17),
|
(17, 17),
|
||||||
(18, 18),
|
(18, 18),
|
||||||
(19, 19),
|
(19, 19),
|
||||||
(20, 20),
|
(20, 20),
|
||||||
(21, 21),
|
(21, 21),
|
||||||
(22, 22);
|
(22, 22);
|
||||||
|
|
||||||
INSERT INTO `vn`.`userConfig` (`userFk`, `warehouseFk`, `companyFk`)
|
INSERT INTO `vn`.`userConfig` (`userFk`, `warehouseFk`, `companyFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 1, 69),
|
(1, 1, 69),
|
||||||
(5, 1, 442),
|
(5, 1, 442),
|
||||||
(9, 1, 442),
|
(9, 1, 442),
|
||||||
(18, 3, 567);
|
(18, 3, 567);
|
||||||
|
|
||||||
INSERT INTO `vn`.`receipt`(`id`, `invoiceFk`, `amountPaid`, `payed`, `workerFk`, `bankFk`, `clientFk`, `created`, `companyFk`, `isConciliate`)
|
INSERT INTO `vn`.`receipt`(`id`, `invoiceFk`, `amountPaid`, `payed`, `workerFk`, `bankFk`, `clientFk`, `created`, `companyFk`, `isConciliate`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 'Cobro web', 100.50, util.VN_CURDATE(), 9, 1, 1101, util.VN_CURDATE(), 442, 1),
|
(1, 'Cobro web', 100.50, util.VN_CURDATE(), 9, 1, 1101, util.VN_CURDATE(), 442, 1),
|
||||||
|
@ -1875,59 +1872,47 @@ INSERT INTO `pbx`.`sip`(`user_id`, `extension`)
|
||||||
(5, 1102),
|
(5, 1102),
|
||||||
(9, 1201);
|
(9, 1201);
|
||||||
|
|
||||||
INSERT INTO `postgresql`.`profile`(`profile_id`, `workerFk`, `profile_type_id`)
|
DROP TEMPORARY TABLE IF EXISTS tmp.worker;
|
||||||
SELECT w.id, w.id, 1
|
CREATE TEMPORARY TABLE tmp.worker
|
||||||
FROM `vn`.`worker` `w`;
|
(PRIMARY KEY (id))
|
||||||
|
ENGINE = MEMORY
|
||||||
|
SELECT w.id, w.id as `workerFk`, 'VNL', CONCAT(YEAR(DATE_ADD(CURDATE(), INTERVAL -1 YEAR)), '-12-25'), CONCAT(YEAR(DATE_ADD(CURDATE(), INTERVAL +1 YEAR)), '-12-25'), CONCAT('E-46-', RPAD(CONCAT(w.id, 9), 8, w.id)), NULL as `notes`, NULL as `departmentFk`, 23, 1 as `workerBusinessProfessionalCategoryFk`, 1 as `calendarTypeFk`, 1 as `isHourlyLabor`, 1 as `workerBusinessAgreementFk`, 1 as `workcenterFk`
|
||||||
|
FROM `vn`.`worker` `w`;
|
||||||
|
|
||||||
INSERT INTO `postgresql`.`business`(`business_id`, `client_id`, `companyCodeFk`, `date_start`, `date_end`, `workerBusiness`, `reasonEndFk`)
|
INSERT INTO `vn`.`business`(`id`, `workerFk`, `companyCodeFk`, `started`, `ended`, `workerBusiness`, `reasonEndFk`, `notes`, `departmentFk`, `workerBusinessProfessionalCategoryFk`, `calendarTypeFk`, `isHourlyLabor`, `workerBusinessAgreementFk`, `workcenterFk`)
|
||||||
SELECT p.profile_id, p.profile_id, 'VNL', CONCAT(YEAR(DATE_ADD(CURDATE(), INTERVAL -1 YEAR)), '-12-25'), CONCAT(YEAR(DATE_ADD(CURDATE(), INTERVAL +1 YEAR)), '-01-25'), CONCAT('E-46-',RPAD(CONCAT(p.profile_id,9),8,p.profile_id)), NULL
|
SELECT * FROM tmp.worker;
|
||||||
FROM `postgresql`.`profile` `p`;
|
|
||||||
|
|
||||||
INSERT INTO `postgresql`.`business_labour`(`business_id`, `notes`, `department_id`, `professional_category_id`, `incentivo`, `calendar_labour_type_id`, `porhoras`, `labour_agreement_id`, `workcenter_id`)
|
DROP TEMPORARY TABLE IF EXISTS tmp.worker;
|
||||||
SELECT b.business_id, NULL, 23, 1, 0, 1, 1, 1, 1
|
CREATE TEMPORARY TABLE tmp.worker
|
||||||
FROM `postgresql`.`business` `b`;
|
(PRIMARY KEY (id))
|
||||||
|
ENGINE = MEMORY
|
||||||
|
SELECT '1111' as 'id', w.id as `workerFk`, 'VNL', CONCAT(YEAR(DATE_ADD(CURDATE(), INTERVAL -2 YEAR)), '-12-25'), CONCAT(YEAR(DATE_ADD(CURDATE(), INTERVAL -1 YEAR)), '-12-24'), CONCAT('E-46-', RPAD(CONCAT(w.id, 9), 8, w.id)), NULL as `notes`, NULL as `departmentFk`, 23, 1 as `workerBusinessProfessionalCategoryFk`, 1 as `calendarTypeFk`, 1 as `isHourlyLabor`, 1 as `workerBusinessAgreementFk`, 1 as `workcenterFk`
|
||||||
|
FROM `vn`.`worker` `w`
|
||||||
|
WHERE `w`.`id` = 1109;
|
||||||
|
|
||||||
INSERT INTO `postgresql`.`business` (`client_id`, `companyCodeFk`, `date_start`, `date_end`, `workerBusiness`, `reasonEndFk`)
|
INSERT INTO `vn`.`business` (`id`, `workerFk`, `companyCodeFk`, `started`, `ended`, `workerBusiness`, `reasonEndFk`, `notes`, `departmentFk`, `workerBusinessProfessionalCategoryFk`, `calendarTypeFk`, `isHourlyLabor`, `workerBusinessAgreementFk`, `workcenterFk`)
|
||||||
SELECT p.profile_id, 'VNL', CONCAT(YEAR(DATE_ADD(CURDATE(), INTERVAL -2 YEAR)), '-12-25'), CONCAT(YEAR(DATE_ADD(CURDATE(), INTERVAL -1 YEAR)), '-12-24'), CONCAT('E-46-',RPAD(CONCAT(p.profile_id,9),8,p.profile_id)), NULL
|
SELECT * FROM tmp.worker;
|
||||||
FROM `postgresql`.`profile` `p`
|
|
||||||
WHERE `p`.`profile_id` = 1109;
|
|
||||||
|
|
||||||
UPDATE `postgresql`.`business`
|
DROP TEMPORARY TABLE IF EXISTS tmp.worker;
|
||||||
|
|
||||||
|
UPDATE `vn`.`business`
|
||||||
SET `payedHolidays`= 8
|
SET `payedHolidays`= 8
|
||||||
WHERE `business_id`= 1106;
|
WHERE `id`= 1106;
|
||||||
|
|
||||||
INSERT INTO `postgresql`.`business_labour` (`business_id`, `notes`, `department_id`, `professional_category_id`, `incentivo`, `calendar_labour_type_id`, `porhoras`, `labour_agreement_id`, `workcenter_id`)
|
UPDATE `vn`.`business` b
|
||||||
VALUES
|
SET b.`workerBusinessProfessionalCategoryFk` = 31
|
||||||
(1111, NULL, 23, 1, 0.0, 1, 1, 1, 1);
|
WHERE b.`workerFk` = 1110;
|
||||||
|
|
||||||
UPDATE `postgresql`.`business_labour` bl
|
|
||||||
JOIN `postgresql`.`business` b ON b.business_id = bl.business_id
|
|
||||||
JOIN `postgresql`.`profile` pr ON pr.profile_id = b.client_id
|
|
||||||
SET bl.`professional_category_id` = 31
|
|
||||||
WHERE pr.`workerFk` = 1110;
|
|
||||||
|
|
||||||
UPDATE `postgresql`.`business_labour` bl
|
|
||||||
SET bl.`department_id` = 43
|
|
||||||
WHERE business_id IN(18, 19);
|
|
||||||
|
|
||||||
INSERT INTO `postgresql`.`media`(`media_id`, `media_type_id`, `value`, `sort`)
|
UPDATE `vn`.`business` b
|
||||||
VALUES
|
SET b.`departmentFk` = 43
|
||||||
(1, 10, 600123321, 0),
|
WHERE b.id IN(18, 19);
|
||||||
(2, 10, 700987987, 0);
|
|
||||||
|
|
||||||
INSERT INTO `postgresql`.`profile_media`(`profile_media_id`, `profile_id`, `media_id`)
|
|
||||||
VALUES
|
|
||||||
(1, 1106, 1),
|
|
||||||
(2, 1107, 2);
|
|
||||||
|
|
||||||
INSERT INTO `vn`.`workCenterHoliday` (`workCenterFk`, `days`, `year`)
|
INSERT INTO `vn`.`workCenterHoliday` (`workCenterFk`, `days`, `year`)
|
||||||
VALUES
|
VALUES
|
||||||
('1', '27.5', YEAR(util.VN_CURDATE())),
|
('1', '27.5', YEAR(util.VN_CURDATE())),
|
||||||
('5', '22', YEAR(util.VN_CURDATE())),
|
('5', '22', YEAR(util.VN_CURDATE())),
|
||||||
('1', '24.5', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR))),
|
('1', '24.5', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR))),
|
||||||
('5', '23', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR)));
|
('5', '23', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR)));
|
||||||
|
|
||||||
ALTER TABLE `postgresql`.`business_labour_payroll` DROP FOREIGN KEY `business_labour_payroll_cod_categoria`;
|
|
||||||
|
|
||||||
INSERT INTO `vn`.`workerBusinessType` (`id`, `name`, `isFullTime`, `isPermanent`, `hasHolidayEntitlement`)
|
INSERT INTO `vn`.`workerBusinessType` (`id`, `name`, `isFullTime`, `isPermanent`, `hasHolidayEntitlement`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -1935,24 +1920,45 @@ INSERT INTO `vn`.`workerBusinessType` (`id`, `name`, `isFullTime`, `isPermanent`
|
||||||
(100, 'INDEFINIDO A TIEMPO COMPLETO', 1, 1, 1),
|
(100, 'INDEFINIDO A TIEMPO COMPLETO', 1, 1, 1),
|
||||||
(109, 'CONVERSION DE TEMPORAL EN INDEFINIDO T.COMPLETO', 1, 1, 1);
|
(109, 'CONVERSION DE TEMPORAL EN INDEFINIDO T.COMPLETO', 1, 1, 1);
|
||||||
|
|
||||||
INSERT INTO `postgresql`.`business_labour_payroll` (`business_id`, `cod_tarifa`, `cod_categoria`, `cod_contrato`, `importepactado`)
|
UPDATE `vn`.`business` b
|
||||||
VALUES
|
SET `rate` = 7,
|
||||||
(1, 7, 12, 100, 900.50),
|
`workerBusinessCategoryFk` = 12,
|
||||||
(1106, 7, 12, 100, 1263.03),
|
`workerBusinessTypeFk` = 100,
|
||||||
(1107, 7, 12, 100, 2000),
|
`amount` = 900.50
|
||||||
(1108, 7, 12, 100, 1500);
|
WHERE b.id = 1;
|
||||||
|
|
||||||
|
UPDATE `vn`.`business` b
|
||||||
|
SET `rate` = 7,
|
||||||
|
`workerBusinessCategoryFk` = 12,
|
||||||
|
`workerBusinessTypeFk` = 100,
|
||||||
|
`amount` = 1263.03
|
||||||
|
WHERE b.id = 1106;
|
||||||
|
|
||||||
|
UPDATE `vn`.`business` b
|
||||||
|
SET `rate` = 7,
|
||||||
|
`workerBusinessCategoryFk` = 12,
|
||||||
|
`workerBusinessTypeFk` = 100,
|
||||||
|
`amount` = 2000
|
||||||
|
WHERE b.id = 1107;
|
||||||
|
|
||||||
|
UPDATE `vn`.`business` b
|
||||||
|
SET `rate` = 7,
|
||||||
|
`workerBusinessCategoryFk` = 12,
|
||||||
|
`workerBusinessTypeFk` = 100,
|
||||||
|
`amount` = 1500
|
||||||
|
WHERE b.id = 1108;
|
||||||
|
|
||||||
INSERT INTO `vn`.`absenceType` (`id`, `name`, `rgb`, `code`, `holidayEntitlementRate`, `discountRate`)
|
INSERT INTO `vn`.`absenceType` (`id`, `name`, `rgb`, `code`, `holidayEntitlementRate`, `discountRate`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 'Holidays', '#FF4444', 'holiday', 0, 0),
|
(1, 'Holidays', '#FF4444', 'holiday', 0, 0),
|
||||||
(2, 'Leave of absence', '#C71585', 'absence', 0, 1),
|
(2, 'Leave of absence', '#C71585', 'absence', 0, 1),
|
||||||
(6, 'Half holiday', '#E65F00', 'halfHoliday', 0, 0.5),
|
(6, 'Half holiday', '#E65F00', 'halfHoliday', 0, 0.5),
|
||||||
(15, 'Half Paid Leave', '#5151c0', 'halfPaidLeave', 0, 1),
|
(15, 'Half Paid Leave', '#5151c0', 'halfPaidLeave', 0, 1),
|
||||||
(20, 'Furlough', '#97B92F', 'furlough', 1, 1),
|
(20, 'Furlough', '#97B92F', 'furlough', 1, 1),
|
||||||
(21, 'Furlough half day', '#778899', 'halfFurlough', 0.5, 1);
|
(21, 'Furlough half day', '#778899', 'halfFurlough', 0.5, 1);
|
||||||
|
|
||||||
INSERT INTO `postgresql`.`calendar_employee` (`business_id`, `calendar_state_id`, `date`)
|
INSERT INTO `postgresql`.`calendar_employee` (`businessFk`, `calendar_state_id`, `date`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 6, IF(MONTH(util.VN_CURDATE()) = 12 AND DAY(util.VN_CURDATE()) > 10, DATE_ADD(util.VN_CURDATE(), INTERVAL -10 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 10 DAY))),
|
(1, 6, IF(MONTH(util.VN_CURDATE()) = 12 AND DAY(util.VN_CURDATE()) > 10, DATE_ADD(util.VN_CURDATE(), INTERVAL -10 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 10 DAY))),
|
||||||
(1106, 1, IF(MONTH(util.VN_CURDATE()) = 12 AND DAY(util.VN_CURDATE()) > 10, DATE_ADD(util.VN_CURDATE(), INTERVAL -10 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 10 DAY))),
|
(1106, 1, IF(MONTH(util.VN_CURDATE()) = 12 AND DAY(util.VN_CURDATE()) > 10, DATE_ADD(util.VN_CURDATE(), INTERVAL -10 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 10 DAY))),
|
||||||
(1106, 1, IF(MONTH(util.VN_CURDATE()) = 12 AND DAY(util.VN_CURDATE()) > 10, DATE_ADD(util.VN_CURDATE(), INTERVAL -11 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 11 DAY))),
|
(1106, 1, IF(MONTH(util.VN_CURDATE()) = 12 AND DAY(util.VN_CURDATE()) > 10, DATE_ADD(util.VN_CURDATE(), INTERVAL -11 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 11 DAY))),
|
||||||
|
@ -1970,8 +1976,8 @@ INSERT INTO `postgresql`.`calendar_employee` (`business_id`, `calendar_state_id`
|
||||||
(1107, 2, IF(MONTH(util.VN_CURDATE()) >= 1 AND DAY(util.VN_CURDATE()) > 20, DATE_ADD(util.VN_CURDATE(), INTERVAL -15 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 7 DAY))),
|
(1107, 2, IF(MONTH(util.VN_CURDATE()) >= 1 AND DAY(util.VN_CURDATE()) > 20, DATE_ADD(util.VN_CURDATE(), INTERVAL -15 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 7 DAY))),
|
||||||
(1107, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL - 16 DAY));
|
(1107, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL - 16 DAY));
|
||||||
|
|
||||||
INSERT INTO `vn`.`smsConfig` (`id`, `uri`, `title`, `apiKey`)
|
INSERT INTO `vn`.`smsConfig` (`id`, `uri`, `title`, `apiKey`)
|
||||||
VALUES
|
VALUES
|
||||||
('1', 'https://api.gateway360.com/api/3.0/sms/send', 'Verdnatura', '5715476da95b46d686a5a255e6459523');
|
('1', 'https://api.gateway360.com/api/3.0/sms/send', 'Verdnatura', '5715476da95b46d686a5a255e6459523');
|
||||||
|
|
||||||
INSERT INTO `vn`.`sharingClient`(`id`, `workerFk`, `started`, `ended`, `clientFk`)
|
INSERT INTO `vn`.`sharingClient`(`id`, `workerFk`, `started`, `ended`, `clientFk`)
|
||||||
|
@ -1987,37 +1993,37 @@ CALL `vn`.zoneGeo_calcTree(); -- this is an auto calculate for table vn.zoneGeo,
|
||||||
|
|
||||||
INSERT INTO `vn`.`zoneIncluded` (`zoneFk`, `geoFk`, `isIncluded`)
|
INSERT INTO `vn`.`zoneIncluded` (`zoneFk`, `geoFk`, `isIncluded`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 3, 0),
|
(1, 3, 0),
|
||||||
(1, 4, 0),
|
(1, 4, 0),
|
||||||
(1, 5, 0),
|
(1, 5, 0),
|
||||||
(1, 1, 1),
|
(1, 1, 1),
|
||||||
(2, 3, 0),
|
(2, 3, 0),
|
||||||
(2, 4, 0),
|
(2, 4, 0),
|
||||||
(2, 5, 0),
|
(2, 5, 0),
|
||||||
(2, 1, 1),
|
(2, 1, 1),
|
||||||
(3, 3, 0),
|
(3, 3, 0),
|
||||||
(3, 4, 0),
|
(3, 4, 0),
|
||||||
(3, 5, 0),
|
(3, 5, 0),
|
||||||
(3, 1, 1),
|
(3, 1, 1),
|
||||||
(4, 3, 0),
|
(4, 3, 0),
|
||||||
(4, 4, 0),
|
(4, 4, 0),
|
||||||
(4, 5, 0),
|
(4, 5, 0),
|
||||||
(4, 1, 1),
|
(4, 1, 1),
|
||||||
(5, 3, 1),
|
(5, 3, 1),
|
||||||
(5, 4, 0),
|
(5, 4, 0),
|
||||||
(5, 5, 1),
|
(5, 5, 1),
|
||||||
(5, 1, 1),
|
(5, 1, 1),
|
||||||
(6, 3, 1),
|
(6, 3, 1),
|
||||||
(6, 4, 0),
|
(6, 4, 0),
|
||||||
(6, 5, 1),
|
(6, 5, 1),
|
||||||
(6, 1, 1),
|
(6, 1, 1),
|
||||||
(7, 3, 0),
|
(7, 3, 0),
|
||||||
(7, 4, 0),
|
(7, 4, 0),
|
||||||
(7, 5, 0),
|
(7, 5, 0),
|
||||||
(7, 1, 1),
|
(7, 1, 1),
|
||||||
(8, 3, 0),
|
(8, 3, 0),
|
||||||
(8, 4, 0),
|
(8, 4, 0),
|
||||||
(8, 5, 0),
|
(8, 5, 0),
|
||||||
(8, 1, 1),
|
(8, 1, 1),
|
||||||
(10, 14, 1);
|
(10, 14, 1);
|
||||||
|
|
||||||
|
@ -2230,12 +2236,12 @@ INSERT INTO `vn`.`zoneEvent`(`zoneFk`, `type`, `dated`)
|
||||||
(7, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +6 DAY));
|
(7, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +6 DAY));
|
||||||
|
|
||||||
INSERT INTO `vn`.`zoneEvent`(`zoneFk`, `type`, `weekDays`)
|
INSERT INTO `vn`.`zoneEvent`(`zoneFk`, `type`, `weekDays`)
|
||||||
VALUES
|
VALUES
|
||||||
(8, 'indefinitely', 'mon,tue,wed,thu,fri,sat,sun'),
|
(8, 'indefinitely', 'mon,tue,wed,thu,fri,sat,sun'),
|
||||||
(10, 'indefinitely', 'mon,tue,wed,thu,fri,sat,sun');
|
(10, 'indefinitely', 'mon,tue,wed,thu,fri,sat,sun');
|
||||||
|
|
||||||
INSERT INTO `vn`.`zoneEvent`(`zoneFk`, `type`, `started`, `ended`)
|
INSERT INTO `vn`.`zoneEvent`(`zoneFk`, `type`, `started`, `ended`)
|
||||||
VALUES
|
VALUES
|
||||||
(9, 'range', DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR), DATE_ADD(util.VN_CURDATE(), INTERVAL +1 YEAR));
|
(9, 'range', DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR), DATE_ADD(util.VN_CURDATE(), INTERVAL +1 YEAR));
|
||||||
|
|
||||||
INSERT INTO `vn`.`workerTimeControl`(`userFk`, `timed`, `manual`, `direction`)
|
INSERT INTO `vn`.`workerTimeControl`(`userFk`, `timed`, `manual`, `direction`)
|
||||||
|
@ -2298,8 +2304,8 @@ INSERT INTO `vn`.`workerDocument`(`id`, `worker`, `document`,`isReadableByWorker
|
||||||
(1, 1106, 4, TRUE),
|
(1, 1106, 4, TRUE),
|
||||||
(2, 1107, 3, FALSE);
|
(2, 1107, 3, FALSE);
|
||||||
|
|
||||||
INSERT INTO `vn`.`device` (`sn`, `model`, `userFk`)
|
INSERT INTO `vn`.`device` (`sn`, `model`, `userFk`)
|
||||||
VALUES
|
VALUES
|
||||||
('aaa', 'android', '9');
|
('aaa', 'android', '9');
|
||||||
|
|
||||||
INSERT INTO `vn`.`queuePriority`(`id`, `priority`)
|
INSERT INTO `vn`.`queuePriority`(`id`, `priority`)
|
||||||
|
@ -2313,7 +2319,7 @@ INSERT INTO `vn`.`workerTimeControlParams` (`id`, `dayBreak`, `weekBreak`, `week
|
||||||
(1, 43200, 129600, 734400, 43200, 50400, 259200, 1296000, 36000);
|
(1, 43200, 129600, 734400, 43200, 50400, 259200, 1296000, 36000);
|
||||||
|
|
||||||
INSERT IGNORE INTO `vn`.`greugeConfig` (`id`, `freightPickUpPrice`) VALUES ('1', '11');
|
INSERT IGNORE INTO `vn`.`greugeConfig` (`id`, `freightPickUpPrice`) VALUES ('1', '11');
|
||||||
|
|
||||||
INSERT INTO `vn`.`thermograph`(`id`, `model`)
|
INSERT INTO `vn`.`thermograph`(`id`, `model`)
|
||||||
VALUES
|
VALUES
|
||||||
('TMM190901395', 'TEMPMATE'),
|
('TMM190901395', 'TEMPMATE'),
|
||||||
|
@ -2331,21 +2337,21 @@ INSERT INTO `vn`.`travelThermograph`(`thermographFk`, `created`, `warehouseFk`,
|
||||||
('138350-0', DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 1, 'WARM', NULL, 5),
|
('138350-0', DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 1, 'WARM', NULL, 5),
|
||||||
('138350-0', util.VN_CURDATE(), 1, NULL, 'COOL', NULL, NULL);
|
('138350-0', util.VN_CURDATE(), 1, NULL, 'COOL', NULL, NULL);
|
||||||
|
|
||||||
REPLACE INTO `vn`.`incoterms`(`code`, `name`)
|
REPLACE INTO `vn`.`incoterms`(`code`, `name`)
|
||||||
VALUES
|
VALUES
|
||||||
('FAS', 'Free Alongside Ship');
|
('FAS', 'Free Alongside Ship');
|
||||||
|
|
||||||
REPLACE INTO `vn`.`customsAgent`(`id`, `fiscalName`, `street`, `nif`, `phone`, `email`)
|
REPLACE INTO `vn`.`customsAgent`(`id`, `fiscalName`, `street`, `nif`, `phone`, `email`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 'Agent one', '1007 Mountain Drive, Gotham', 'N1111111111', '111111111', 'agentone@gotham.com'),
|
(1, 'Agent one', '1007 Mountain Drive, Gotham', 'N1111111111', '111111111', 'agentone@gotham.com'),
|
||||||
(2, 'Agent two', '1007 Mountain Drive, Gotham', 'N2222222222', '222222222', 'agenttwo@gotham.com');
|
(2, 'Agent two', '1007 Mountain Drive, Gotham', 'N2222222222', '222222222', 'agenttwo@gotham.com');
|
||||||
|
|
||||||
INSERT INTO `vn`.`tablet`(`uuid`, `name`, `place`, `macwifi`)
|
INSERT INTO `vn`.`tablet`(`uuid`, `name`, `place`, `macwifi`)
|
||||||
VALUES
|
VALUES
|
||||||
('1', 'TEST', 'ON THE FIXTURES', '0'),
|
('1', 'TEST', 'ON THE FIXTURES', '0'),
|
||||||
('2', 'DEV', 'OTHER TABLET', '0');
|
('2', 'DEV', 'OTHER TABLET', '0');
|
||||||
|
|
||||||
INSERT INTO `vn`.`tabletDepartment`(`tabletFk`, `departmentFk`)
|
INSERT INTO `vn`.`tabletDepartment`(`tabletFk`, `departmentFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 23),
|
(1, 23),
|
||||||
(2, 1);
|
(2, 1);
|
||||||
|
@ -2378,8 +2384,8 @@ INSERT INTO `vn`.`rate`(`dated`, `warehouseFk`, `rate0`, `rate1`, `rate2`, `rate
|
||||||
(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR), 1, 10, 15, 20, 25),
|
(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR), 1, 10, 15, 20, 25),
|
||||||
(util.VN_CURDATE(), 1, 12, 17, 22, 27);
|
(util.VN_CURDATE(), 1, 12, 17, 22, 27);
|
||||||
|
|
||||||
INSERT INTO `vn`.`awb` (id, code, package, weight, created, amount, transitoryFk, taxFk)
|
INSERT INTO `vn`.`awb` (id, code, package, weight, created, amount, transitoryFk, taxFk)
|
||||||
VALUES
|
VALUES
|
||||||
(1, '07546501420', 67, 671, util.VN_CURDATE(), 1761, 1, 1),
|
(1, '07546501420', 67, 671, util.VN_CURDATE(), 1761, 1, 1),
|
||||||
(2, '07546491421', 252, 2769, util.VN_CURDATE(), 5231, 1, 1),
|
(2, '07546491421', 252, 2769, util.VN_CURDATE(), 5231, 1, 1),
|
||||||
(3, '07546500823', 102, 1495, util.VN_CURDATE(), 3221, 1, 1),
|
(3, '07546500823', 102, 1495, util.VN_CURDATE(), 3221, 1, 1),
|
||||||
|
@ -2391,8 +2397,8 @@ INSERT INTO `vn`.`awb` (id, code, package, weight, created, amount, transitoryFk
|
||||||
(9, '99610289193', 302, 2972, util.VN_CURDATE(), 3871, 442, 1),
|
(9, '99610289193', 302, 2972, util.VN_CURDATE(), 3871, 442, 1),
|
||||||
(10, '07546500856', 185, 2364, util.VN_CURDATE(), 5321, 442, 1);
|
(10, '07546500856', 185, 2364, util.VN_CURDATE(), 5321, 442, 1);
|
||||||
|
|
||||||
INSERT INTO `vn`.`dua` (id, code, awbFk, issued, operated, booked, bookEntried, gestdocFk, customsValue, companyFk)
|
INSERT INTO `vn`.`dua` (id, code, awbFk, issued, operated, booked, bookEntried, gestdocFk, customsValue, companyFk)
|
||||||
VALUES
|
VALUES
|
||||||
(1, '19ES0028013A481523', 1, util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 1, 11276.95, 442),
|
(1, '19ES0028013A481523', 1, util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 1, 11276.95, 442),
|
||||||
(2, '21ES00280136115760', 2, util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 1376.20, 442),
|
(2, '21ES00280136115760', 2, util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 1376.20, 442),
|
||||||
(3, '19ES00280131956004', 3, util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 3, 14268.50, 442),
|
(3, '19ES00280131956004', 3, util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 3, 14268.50, 442),
|
||||||
|
@ -2439,25 +2445,25 @@ INSERT INTO `vn`.`duaInvoiceIn`(`id`, `duaFk`, `invoiceInFk`)
|
||||||
(4, 4, 4),
|
(4, 4, 4),
|
||||||
(5, 5, 5),
|
(5, 5, 5),
|
||||||
(6, 6, 6),
|
(6, 6, 6),
|
||||||
(7, 7, 7),
|
(7, 7, 7),
|
||||||
(8, 8, 8),
|
(8, 8, 8),
|
||||||
(9, 9, 9),
|
(9, 9, 9),
|
||||||
(10, 10, 10);
|
(10, 10, 10);
|
||||||
|
|
||||||
INSERT INTO `vn`.`invoiceInTax` (`invoiceInFk`, `taxableBase`, `expenceFk`, `foreignValue`, `taxTypeSageFk`, `transactionTypeSageFk`)
|
INSERT INTO `vn`.`invoiceInTax` (`invoiceInFk`, `taxableBase`, `expenceFk`, `foreignValue`, `taxTypeSageFk`, `transactionTypeSageFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 99.99, '2000000000', null, null, null),
|
(1, 99.99, '2000000000', NULL, NULL, NULL),
|
||||||
(2, 999.99, '2000000000', null, null, null),
|
(2, 999.99, '2000000000', NULL, NULL, NULL),
|
||||||
(3, 1000.50, '2000000000', null, null, null),
|
(3, 1000.50, '2000000000', NULL, NULL, NULL),
|
||||||
(4, 0.50, '2000000000', null, null, null),
|
(4, 0.50, '2000000000', NULL, NULL, NULL),
|
||||||
(5, 150.50, '2000000000', null, null, null),
|
(5, 150.50, '2000000000', NULL, NULL, NULL),
|
||||||
(1, 252.25, '4751000000', NULL, 7, 61),
|
(1, 252.25, '4751000000', NULL, 7, 61),
|
||||||
(2, 223.17, '6210000567', NULL, 8, 20),
|
(2, 223.17, '6210000567', NULL, 8, 20),
|
||||||
(3, 95.60, '7001000000', NULL, 8, 35),
|
(3, 95.60, '7001000000', NULL, 8, 35),
|
||||||
(4, 446.63, '7001000000', NULL, 6, 61),
|
(4, 446.63, '7001000000', NULL, 6, 61),
|
||||||
(5, 64.23, '6210000567', NULL, 8, 20),
|
(5, 64.23, '6210000567', NULL, 8, 20),
|
||||||
(6, 29.95, '7001000000', NULL, 7, 20),
|
(6, 29.95, '7001000000', NULL, 7, 20),
|
||||||
(7, 58.64, '6210000567', NULL, 8, 20);
|
(7, 58.64, '6210000567', NULL, 8, 20);
|
||||||
|
|
||||||
INSERT INTO `vn`.`invoiceInIntrastat` (`invoiceInFk`, `net`, `intrastatFk`, `amount`, `stems`, `countryFk`)
|
INSERT INTO `vn`.`invoiceInIntrastat` (`invoiceInFk`, `net`, `intrastatFk`, `amount`, `stems`, `countryFk`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -2465,7 +2471,7 @@ INSERT INTO `vn`.`invoiceInIntrastat` (`invoiceInFk`, `net`, `intrastatFk`, `amo
|
||||||
(1, 10, 6021010, 20.00, 205, 5),
|
(1, 10, 6021010, 20.00, 205, 5),
|
||||||
(2, 13.20, 5080000, 15.00, 580, 5),
|
(2, 13.20, 5080000, 15.00, 580, 5),
|
||||||
(2, 16.10, 6021010, 25.00, 80, 5);
|
(2, 16.10, 6021010, 25.00, 80, 5);
|
||||||
|
|
||||||
INSERT INTO `vn`.`ticketRecalc`(`ticketFk`)
|
INSERT INTO `vn`.`ticketRecalc`(`ticketFk`)
|
||||||
SELECT t.id
|
SELECT t.id
|
||||||
FROM vn.ticket t
|
FROM vn.ticket t
|
||||||
|
@ -2482,7 +2488,7 @@ INSERT INTO `vn`.`zoneAgencyMode`(`id`, `agencyModeFk`, `zoneFk`)
|
||||||
(4, 7, 1);
|
(4, 7, 1);
|
||||||
|
|
||||||
INSERT INTO `vn`.`expeditionTruck` (`id`, `ETD`, `description`)
|
INSERT INTO `vn`.`expeditionTruck` (`id`, `ETD`, `description`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, CONCAT(YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL +3 YEAR))), 'Best truck in fleet');
|
(1, CONCAT(YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL +3 YEAR))), 'Best truck in fleet');
|
||||||
|
|
||||||
INSERT INTO `vn`.`expeditionPallet` (`id`, `truckFk`, `built`, `position`, `isPrint`)
|
INSERT INTO `vn`.`expeditionPallet` (`id`, `truckFk`, `built`, `position`, `isPrint`)
|
||||||
|
@ -2490,7 +2496,7 @@ INSERT INTO `vn`.`expeditionPallet` (`id`, `truckFk`, `built`, `position`, `isPr
|
||||||
(1, 1, util.VN_CURDATE(), 1, 1);
|
(1, 1, util.VN_CURDATE(), 1, 1);
|
||||||
|
|
||||||
INSERT INTO `vn`.`expeditionScan` (`id`, `expeditionFk`, `scanned`, `palletFk`)
|
INSERT INTO `vn`.`expeditionScan` (`id`, `expeditionFk`, `scanned`, `palletFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 1, util.VN_CURDATE(), 1),
|
(1, 1, util.VN_CURDATE(), 1),
|
||||||
(2, 2, util.VN_CURDATE(), 1),
|
(2, 2, util.VN_CURDATE(), 1),
|
||||||
(3, 3, util.VN_CURDATE(), 1),
|
(3, 3, util.VN_CURDATE(), 1),
|
||||||
|
@ -2525,7 +2531,7 @@ UPDATE `vn`.`route`
|
||||||
INSERT INTO `bs`.`salesPerson` (`workerFk`, `year`, `month`, `portfolioWeight`)
|
INSERT INTO `bs`.`salesPerson` (`workerFk`, `year`, `month`, `portfolioWeight`)
|
||||||
VALUES
|
VALUES
|
||||||
(18, YEAR(util.VN_CURDATE()), MONTH(util.VN_CURDATE()), 807.23),
|
(18, YEAR(util.VN_CURDATE()), MONTH(util.VN_CURDATE()), 807.23),
|
||||||
(19, YEAR(util.VN_CURDATE()), MONTH(util.VN_CURDATE()), 34.40);
|
(19, YEAR(util.VN_CURDATE()), MONTH(util.VN_CURDATE()), 34.40);
|
||||||
|
|
||||||
INSERT INTO `bs`.`sale` (`saleFk`, `amount`, `dated`, `typeFk`, `clientFk`)
|
INSERT INTO `bs`.`sale` (`saleFk`, `amount`, `dated`, `typeFk`, `clientFk`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -2554,14 +2560,14 @@ INSERT INTO `vn`.`calendarHolidaysType` (`id`, `name`, `hexColour`)
|
||||||
INSERT INTO `vn`.`calendarHolidays` (`id`, `calendarHolidaysTypeFk`, `dated`, `calendarHolidaysNameFk`, `workCenterFk`)
|
INSERT INTO `vn`.`calendarHolidays` (`id`, `calendarHolidaysTypeFk`, `dated`, `calendarHolidaysNameFk`, `workCenterFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 1, CONCAT(YEAR(util.VN_CURDATE()), '-12-09'), 1, 1);
|
(1, 1, CONCAT(YEAR(util.VN_CURDATE()), '-12-09'), 1, 1);
|
||||||
|
|
||||||
INSERT INTO `vn`.`supplierAgencyTerm` (`agencyFk`, `supplierFk`, `minimumPackages`, `kmPrice`, `packagePrice`, `routePrice`, `minimumKm`, `minimumM3`, `m3Price`)
|
INSERT INTO `vn`.`supplierAgencyTerm` (`agencyFk`, `supplierFk`, `minimumPackages`, `kmPrice`, `packagePrice`, `routePrice`, `minimumKm`, `minimumM3`, `m3Price`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 1, 0, 0.00, 0.00, NULL, 0, 0.00, 23),
|
(1, 1, 0, 0.00, 0.00, NULL, 0, 0.00, 23),
|
||||||
(2, 1, 60, 0.00, 0.00, NULL, 0, 5.00, 33),
|
(2, 1, 60, 0.00, 0.00, NULL, 0, 5.00, 33),
|
||||||
(3, 2, 0, 15.00, 0.00, NULL, 0, 0.00, 0),
|
(3, 2, 0, 15.00, 0.00, NULL, 0, 0.00, 0),
|
||||||
(4, 2, 0, 20.00, 0.00, NULL, 0, 0.00, 0),
|
(4, 2, 0, 20.00, 0.00, NULL, 0, 0.00, 0),
|
||||||
(5, 442, 0, 0.00, 3.05, NULL, 0, 0.00, 0);
|
(5, 442, 0, 0.00, 3.05, NULL, 0, 0.00, 0);
|
||||||
|
|
||||||
INSERT INTO `vn`.`chat` (`senderFk`, `recipient`, `dated`, `checkUserStatus`, `message`, `status`, `attempts`)
|
INSERT INTO `vn`.`chat` (`senderFk`, `recipient`, `dated`, `checkUserStatus`, `message`, `status`, `attempts`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -2587,7 +2593,7 @@ INSERT INTO `vn`.`machineWorker` (`workerFk`, `machineFk`, `inTimed`, `outTimed`
|
||||||
(1106, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL +1 DAY));
|
(1106, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL +1 DAY));
|
||||||
|
|
||||||
INSERT INTO `vn`.`zoneExclusion` (`id`, `zoneFk`, `dated`, `created`, `userFk`)
|
INSERT INTO `vn`.`zoneExclusion` (`id`, `zoneFk`, `dated`, `created`, `userFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 1, DATE_ADD(CURDATE(), INTERVAL (IF(DAYOFWEEK(CURDATE())<=7, 7, 14) - DAYOFWEEK(util.VN_CURDATE())) DAY), util.VN_CURDATE(), 100),
|
(1, 1, DATE_ADD(CURDATE(), INTERVAL (IF(DAYOFWEEK(CURDATE())<=7, 7, 14) - DAYOFWEEK(util.VN_CURDATE())) DAY), util.VN_CURDATE(), 100),
|
||||||
(2, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL (IF(DAYOFWEEK(util.VN_CURDATE())<=8, 8, 15) - DAYOFWEEK(util.VN_CURDATE())) DAY), util.VN_CURDATE(), 100);
|
(2, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL (IF(DAYOFWEEK(util.VN_CURDATE())<=8, 8, 15) - DAYOFWEEK(util.VN_CURDATE())) DAY), util.VN_CURDATE(), 100);
|
||||||
|
|
||||||
|
@ -2625,11 +2631,23 @@ INSERT INTO `vn`.`sectorCollection` (`userFk`, `sectorFk`)
|
||||||
INSERT INTO `vn`.`sectorCollectionSaleGroup` (`sectorCollectionFk`, `saleGroupFk`)
|
INSERT INTO `vn`.`sectorCollectionSaleGroup` (`sectorCollectionFk`, `saleGroupFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 1);
|
(1, 1);
|
||||||
|
|
||||||
INSERT INTO `vn`.`workerTimeControlConfig` (`id`, `dayBreak`, `dayBreakDriver`, `shortWeekBreak`, `longWeekBreak`, `weekScope`, `mailPass`, `mailHost`, `mailSuccessFolder`, `mailErrorFolder`, `mailUser`, `minHoursToBreak`, `breakHours`, `hoursCompleteWeek`, `startNightlyHours`, `endNightlyHours`, `maxTimePerDay`, `breakTime`, `timeToBreakTime`, `dayMaxTime`, `shortWeekDays`, `longWeekDays`)
|
INSERT INTO `vn`.`workerTimeControlConfig` (`id`, `dayBreak`, `dayBreakDriver`, `shortWeekBreak`, `longWeekBreak`, `weekScope`, `mailPass`, `mailHost`, `mailSuccessFolder`, `mailErrorFolder`, `mailUser`, `minHoursToBreak`, `breakHours`, `hoursCompleteWeek`, `startNightlyHours`, `endNightlyHours`, `maxTimePerDay`, `breakTime`, `timeToBreakTime`, `dayMaxTime`, `shortWeekDays`, `longWeekDays`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 43200, 32400, 129600, 259200, 604800, '', '', 'Leidos.exito', 'Leidos.error', 'timeControl', 5.33, 0.33, 40, '22:00:00', '06:00:00', 57600, 1200, 18000, 57600, 6, 13);
|
(1, 43200, 32400, 129600, 259200, 604800, '', '', 'Leidos.exito', 'Leidos.error', 'timeControl', 5.33, 0.33, 40, '22:00:00', '06:00:00', 57600, 1200, 18000, 57600, 6, 13);
|
||||||
|
|
||||||
INSERT INTO `vn`.`routeConfig` (`id`, `defaultWorkCenterFk`)
|
INSERT INTO `vn`.`routeConfig` (`id`, `defaultWorkCenterFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 9);
|
(1, 9);
|
||||||
|
|
||||||
|
INSERT INTO `vn`.`productionConfig` (`isPreviousPreparationRequired`, `ticketPrintedMax`, `ticketTrolleyMax`, `rookieDays`, `notBuyingMonths`, `id`, `isZoneClosedByExpeditionActivated`, `maxNotReadyCollections`, `minTicketsToCloseZone`, `movingTicketDelRoute`, `defaultZone`, `defautlAgencyMode`, `hasUniqueCollectionTime`, `maxCollectionWithoutUser`, `pendingCollectionsOrder`, `pendingCollectionsAge`)
|
||||||
|
VALUES
|
||||||
|
(0, 8, 80, 0, 0, 1, 0, 15, 25, -1, 697, 1328, 0, 1, 8, 6);
|
||||||
|
|
||||||
|
INSERT INTO `vn`.`collection` (`id`, `created`, `workerFk`, `stateFk`, `itemPackingTypeFk`, `saleTotalCount`, `salePickedCount`, `trainFk`, `sectorFk`, `wagons`)
|
||||||
|
VALUES
|
||||||
|
(3, util.VN_NOW(), 1107, 5, NULL, 0, 0, 1, NULL, NULL);
|
||||||
|
|
||||||
|
INSERT INTO `vn`.`ticketCollection` (`ticketFk`, `collectionFk`, `created`, `level`, `wagon`, `smartTagFk`, `usedShelves`, `itemCount`, `liters`)
|
||||||
|
VALUES
|
||||||
|
(9, 3, util.VN_NOW(), NULL, 0, NULL, NULL, NULL, NULL);
|
||||||
|
|
28081
db/dump/structure.sql
28081
db/dump/structure.sql
File diff suppressed because it is too large
Load Diff
|
@ -239,7 +239,7 @@ xdescribe('worker workerTimeControl_check()', () => {
|
||||||
|
|
||||||
stmts.push('START TRANSACTION');
|
stmts.push('START TRANSACTION');
|
||||||
|
|
||||||
stmt = new ParameterizedSQL(`INSERT INTO postgresql.calendar_employee(business_id,calendar_state_id,date)
|
stmt = new ParameterizedSQL(`INSERT INTO postgresql.calendar_employee(businessFk,calendar_state_id,date)
|
||||||
VALUES
|
VALUES
|
||||||
(?,1,CURDATE())`, [
|
(?,1,CURDATE())`, [
|
||||||
workerId
|
workerId
|
||||||
|
@ -282,7 +282,7 @@ xdescribe('worker workerTimeControl_check()', () => {
|
||||||
|
|
||||||
stmts.push('START TRANSACTION');
|
stmts.push('START TRANSACTION');
|
||||||
|
|
||||||
stmt = new ParameterizedSQL(`UPDATE postgresql.business SET date_end=DATE_ADD(CURDATE(), INTERVAL -1 DAY) WHERE business_id=?`, [
|
stmt = new ParameterizedSQL(`UPDATE vn.business SET ended = DATE_ADD(CURDATE(), INTERVAL -1 DAY) WHERE id = ?`, [
|
||||||
workerId
|
workerId
|
||||||
]);
|
]);
|
||||||
stmts.push(stmt);
|
stmts.push(stmt);
|
||||||
|
|
|
@ -1014,9 +1014,9 @@ export default {
|
||||||
save: 'vn-travel-create vn-submit > button'
|
save: 'vn-travel-create vn-submit > button'
|
||||||
},
|
},
|
||||||
travelExtraCommunity: {
|
travelExtraCommunity: {
|
||||||
anySearchResult: 'vn-travel-extra-community > vn-data-viewer div > vn-tbody > vn-tr',
|
anySearchResult: 'vn-travel-extra-community > vn-card div > tbody > tr[ng-attr-id="{{::travel.id}}"]',
|
||||||
firstTravelReference: 'vn-travel-extra-community vn-tbody:nth-child(2) vn-td-editable[name="reference"]',
|
firstTravelReference: 'vn-travel-extra-community tbody:nth-child(2) vn-textfield[ng-model="travel.ref"]',
|
||||||
firstTravelLockedKg: 'vn-travel-extra-community vn-tbody:nth-child(2) vn-td-editable[name="lockedKg"]',
|
firstTravelLockedKg: 'vn-travel-extra-community tbody:nth-child(2) vn-input-number[ng-model="travel.kg"]',
|
||||||
removeContinentFilter: 'vn-searchbar > form > vn-textfield > div.container > div.prepend > prepend > div > span:nth-child(3) > vn-icon > i'
|
removeContinentFilter: 'vn-searchbar > form > vn-textfield > div.container > div.prepend > prepend > div > span:nth-child(3) > vn-icon > i'
|
||||||
},
|
},
|
||||||
travelBasicData: {
|
travelBasicData: {
|
||||||
|
|
|
@ -22,7 +22,7 @@ describe('InvoiceOut manual invoice path', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should create an invoice from a ticket', async() => {
|
it('should create an invoice from a ticket', async() => {
|
||||||
await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceTicket, '7');
|
await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceTicket, '15');
|
||||||
await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceSerial, 'Global nacional');
|
await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceSerial, 'Global nacional');
|
||||||
await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceTaxArea, 'national');
|
await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceTaxArea, 'national');
|
||||||
await page.waitToClick(selectors.invoiceOutIndex.saveInvoice);
|
await page.waitToClick(selectors.invoiceOutIndex.saveInvoice);
|
||||||
|
|
|
@ -19,18 +19,22 @@ describe('Travel extra community path', () => {
|
||||||
it('should edit the travel reference and the locked kilograms', async() => {
|
it('should edit the travel reference and the locked kilograms', async() => {
|
||||||
await page.waitToClick(selectors.travelExtraCommunity.removeContinentFilter);
|
await page.waitToClick(selectors.travelExtraCommunity.removeContinentFilter);
|
||||||
await page.waitForSpinnerLoad();
|
await page.waitForSpinnerLoad();
|
||||||
await page.writeOnEditableTD(selectors.travelExtraCommunity.firstTravelReference, 'edited reference');
|
await page.clearInput(selectors.travelExtraCommunity.firstTravelReference);
|
||||||
await page.waitForSpinnerLoad();
|
await page.write(selectors.travelExtraCommunity.firstTravelReference, 'edited reference');
|
||||||
await page.writeOnEditableTD(selectors.travelExtraCommunity.firstTravelLockedKg, '1500');
|
await page.clearInput(selectors.travelExtraCommunity.firstTravelLockedKg);
|
||||||
|
await page.write(selectors.travelExtraCommunity.firstTravelLockedKg, '1500');
|
||||||
|
const message = await page.waitForSnackbar();
|
||||||
|
|
||||||
|
expect(message.text).toContain('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should reload the index and confirm the reference and locked kg were edited', async() => {
|
it('should reload the index and confirm the reference and locked kg were edited', async() => {
|
||||||
await page.accessToSection('travel.index');
|
await page.accessToSection('travel.index');
|
||||||
await page.accessToSection('travel.extraCommunity');
|
await page.accessToSection('travel.extraCommunity');
|
||||||
await page.waitToClick(selectors.travelExtraCommunity.removeContinentFilter);
|
await page.waitToClick(selectors.travelExtraCommunity.removeContinentFilter);
|
||||||
await page.waitForTextInElement(selectors.travelExtraCommunity.firstTravelReference, 'edited reference');
|
|
||||||
const reference = await page.getProperty(selectors.travelExtraCommunity.firstTravelReference, 'innerText');
|
const reference = await page.waitToGetProperty(selectors.travelExtraCommunity.firstTravelReference, 'value');
|
||||||
const lockedKg = await page.getProperty(selectors.travelExtraCommunity.firstTravelLockedKg, 'innerText');
|
const lockedKg = await page.waitToGetProperty(selectors.travelExtraCommunity.firstTravelLockedKg, 'value');
|
||||||
|
|
||||||
expect(reference).toContain('edited reference');
|
expect(reference).toContain('edited reference');
|
||||||
expect(lockedKg).toContain(1500);
|
expect(lockedKg).toContain(1500);
|
||||||
|
|
|
@ -150,10 +150,12 @@ describe('Account create and basic data path', () => {
|
||||||
|
|
||||||
describe('Set password', () => {
|
describe('Set password', () => {
|
||||||
it('should set the password using the descriptor menu', async() => {
|
it('should set the password using the descriptor menu', async() => {
|
||||||
|
const newPassword = 'quantum.12345';
|
||||||
|
|
||||||
await page.waitToClick(selectors.accountDescriptor.menuButton);
|
await page.waitToClick(selectors.accountDescriptor.menuButton);
|
||||||
await page.waitToClick(selectors.accountDescriptor.setPassword);
|
await page.waitToClick(selectors.accountDescriptor.setPassword);
|
||||||
await page.write(selectors.accountDescriptor.newPassword, 'quantum.crypt0graphy');
|
await page.write(selectors.accountDescriptor.newPassword, newPassword);
|
||||||
await page.write(selectors.accountDescriptor.repeatPassword, 'quantum.crypt0graphy');
|
await page.write(selectors.accountDescriptor.repeatPassword, newPassword);
|
||||||
await page.waitToClick(selectors.accountDescriptor.acceptButton);
|
await page.waitToClick(selectors.accountDescriptor.acceptButton);
|
||||||
const message = await page.waitForSnackbar();
|
const message = await page.waitForSnackbar();
|
||||||
|
|
||||||
|
|
|
@ -10,9 +10,9 @@
|
||||||
<div ng-transclude="actions"></div>
|
<div ng-transclude="actions"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="actions-right">
|
<div class="actions-right">
|
||||||
<div class="totalRows" ng-if="$ctrl.model.data">
|
<div class="totalRows" ng-if="$ctrl.model.data">
|
||||||
{{model.data.length}}
|
{{model.data.length}}
|
||||||
<span translate>results</span>
|
<span translate>results</span>
|
||||||
</div>
|
</div>
|
||||||
<vn-button icon="search"
|
<vn-button icon="search"
|
||||||
ng-if="$ctrl.options.activeButtons.search"
|
ng-if="$ctrl.options.activeButtons.search"
|
||||||
|
@ -40,7 +40,8 @@
|
||||||
</vn-button>
|
</vn-button>
|
||||||
</div>
|
</div>
|
||||||
<vn-button icon="refresh"
|
<vn-button icon="refresh"
|
||||||
ng-click="$ctrl.model.refresh()"
|
ng-click="$ctrl.refresh()"
|
||||||
|
disabled="$ctrl.isRefreshing"
|
||||||
vn-tooltip="Refresh">
|
vn-tooltip="Refresh">
|
||||||
</vn-button>
|
</vn-button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -64,7 +65,7 @@
|
||||||
|
|
||||||
<vn-crud-model
|
<vn-crud-model
|
||||||
ng-if="$ctrl.viewConfigId"
|
ng-if="$ctrl.viewConfigId"
|
||||||
vn-id="userViewModel"
|
vn-id="userViewModel"
|
||||||
url="UserConfigViews"
|
url="UserConfigViews"
|
||||||
link="{tableCode: $ctrl.viewConfigId, userFk: $ctrl.currentUserId}"
|
link="{tableCode: $ctrl.viewConfigId, userFk: $ctrl.currentUserId}"
|
||||||
data="$ctrl.viewConfig"
|
data="$ctrl.viewConfig"
|
||||||
|
@ -75,9 +76,9 @@
|
||||||
<div class="smart-table-columns vn-pa-md vn-w-sm">
|
<div class="smart-table-columns vn-pa-md vn-w-sm">
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
<h6 translate style="margin:0">Shown columns</h6>
|
<h6 translate style="margin:0">Shown columns</h6>
|
||||||
<vn-icon
|
<vn-icon
|
||||||
vn-none
|
vn-none
|
||||||
icon="info"
|
icon="info"
|
||||||
color-marginal
|
color-marginal
|
||||||
vn-tooltip="Check the columns you want to see"/>
|
vn-tooltip="Check the columns you want to see"/>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
|
@ -101,4 +102,4 @@
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
</div>
|
</div>
|
||||||
</tpl-body>
|
</tpl-body>
|
||||||
</vn-popover>
|
</vn-popover>
|
||||||
|
|
|
@ -511,6 +511,12 @@ export default class SmartTable extends Component {
|
||||||
return this.model.save()
|
return this.model.save()
|
||||||
.then(() => this.vnApp.showSuccess(this.$t('Data saved!')));
|
.then(() => this.vnApp.showSuccess(this.$t('Data saved!')));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
refresh() {
|
||||||
|
this.isRefreshing = true;
|
||||||
|
this.model.refresh()
|
||||||
|
.then(() => this.isRefreshing = false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SmartTable.$inject = ['$element', '$scope', '$transclude'];
|
SmartTable.$inject = ['$element', '$scope', '$transclude'];
|
||||||
|
|
|
@ -130,5 +130,6 @@
|
||||||
"Descanso diario 12h.": "Daily rest 12h.",
|
"Descanso diario 12h.": "Daily rest 12h.",
|
||||||
"Fichadas impares": "Odd signs",
|
"Fichadas impares": "Odd signs",
|
||||||
"Descanso diario 9h.": "Daily rest 9h.",
|
"Descanso diario 9h.": "Daily rest 9h.",
|
||||||
"Descanso semanal 36h. / 72h.": "Weekly rest 36h. / 72h."
|
"Descanso semanal 36h. / 72h.": "Weekly rest 36h. / 72h.",
|
||||||
|
"Password does not meet requirements": "Password does not meet requirements"
|
||||||
}
|
}
|
|
@ -146,7 +146,7 @@
|
||||||
"Choose a date range or days forward": "Selecciona un rango de fechas o días en adelante",
|
"Choose a date range or days forward": "Selecciona un rango de fechas o días en adelante",
|
||||||
"ORDER_ALREADY_CONFIRMED": "ORDER_ALREADY_CONFIRMED",
|
"ORDER_ALREADY_CONFIRMED": "ORDER_ALREADY_CONFIRMED",
|
||||||
"Invalid password": "Invalid password",
|
"Invalid password": "Invalid password",
|
||||||
"Password does not meet requirements": "Password does not meet requirements",
|
"Password does not meet requirements": "La contraseña no cumple los requisitos",
|
||||||
"Role already assigned": "Role already assigned",
|
"Role already assigned": "Role already assigned",
|
||||||
"Invalid role name": "Invalid role name",
|
"Invalid role name": "Invalid role name",
|
||||||
"Role name must be written in camelCase": "Role name must be written in camelCase",
|
"Role name must be written in camelCase": "Role name must be written in camelCase",
|
||||||
|
@ -208,7 +208,7 @@
|
||||||
"Wasn't able to invoice the following clients": "No se han podido facturar los siguientes clientes",
|
"Wasn't able to invoice the following clients": "No se han podido facturar los siguientes clientes",
|
||||||
"Can't verify data unless the client has a business type": "No se puede verificar datos de un cliente que no tiene tipo de negocio",
|
"Can't verify data unless the client has a business type": "No se puede verificar datos de un cliente que no tiene tipo de negocio",
|
||||||
"You don't have enough privileges to set this credit amount": "No tienes suficientes privilegios para establecer esta cantidad de crédito",
|
"You don't have enough privileges to set this credit amount": "No tienes suficientes privilegios para establecer esta cantidad de crédito",
|
||||||
"You can't change the credit set to zero from a manager": "No puedes cambiar el cŕedito establecido a cero por un gerente",
|
"You can't change the credit set to zero from a financialBoss": "No puedes cambiar el cŕedito establecido a cero por un jefe de finanzas",
|
||||||
"Amounts do not match": "Las cantidades no coinciden",
|
"Amounts do not match": "Las cantidades no coinciden",
|
||||||
"The PDF document does not exists": "El documento PDF no existe. Prueba a regenerarlo desde la opción 'Regenerar PDF factura'",
|
"The PDF document does not exists": "El documento PDF no existe. Prueba a regenerarlo desde la opción 'Regenerar PDF factura'",
|
||||||
"The type of business must be filled in basic data": "El tipo de negocio debe estar rellenado en datos básicos",
|
"The type of business must be filled in basic data": "El tipo de negocio debe estar rellenado en datos básicos",
|
||||||
|
@ -233,4 +233,4 @@
|
||||||
"Descanso diario 12h.": "Descanso diario 12h.",
|
"Descanso diario 12h.": "Descanso diario 12h.",
|
||||||
"Descanso semanal 36h. / 72h.": "Descanso semanal 36h. / 72h.",
|
"Descanso semanal 36h. / 72h.": "Descanso semanal 36h. / 72h.",
|
||||||
"Dirección incorrecta": "Dirección incorrecta"
|
"Dirección incorrecta": "Dirección incorrecta"
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
url="Workers/activeWithRole"
|
url="Workers/activeWithRole"
|
||||||
search-function="{firstName: $search}"
|
search-function="{firstName: $search}"
|
||||||
value-field="id"
|
value-field="id"
|
||||||
where="{role: {inq: ['salesBoss', 'salesPerson', 'officeBoss']}}"
|
where="{role: {inq: ['salesTeamBoss', 'salesPerson', 'officeBoss']}}"
|
||||||
label="Salesperson">
|
label="Salesperson">
|
||||||
<tpl-item>{{firstName}} {{name}}</tpl-item>
|
<tpl-item>{{firstName}} {{name}}</tpl-item>
|
||||||
</vn-autocomplete>
|
</vn-autocomplete>
|
||||||
|
@ -38,7 +38,7 @@
|
||||||
url="Workers/activeWithRole"
|
url="Workers/activeWithRole"
|
||||||
search-function="{firstName: $search}"
|
search-function="{firstName: $search}"
|
||||||
value-field="id"
|
value-field="id"
|
||||||
where="{role: {inq: ['salesBoss', 'salesPerson']}}"
|
where="{role: {inq: ['salesTeamBoss', 'salesPerson']}}"
|
||||||
label="Attended by">
|
label="Attended by">
|
||||||
<tpl-item>{{firstName}} {{name}}</tpl-item>
|
<tpl-item>{{firstName}} {{name}}</tpl-item>
|
||||||
</vn-autocomplete>
|
</vn-autocomplete>
|
||||||
|
|
|
@ -402,8 +402,8 @@ module.exports = Self => {
|
||||||
const models = Self.app.models;
|
const models = Self.app.models;
|
||||||
const userId = ctx.options.accessToken.userId;
|
const userId = ctx.options.accessToken.userId;
|
||||||
|
|
||||||
const isManager = await models.Account.hasRole(userId, 'manager', ctx.options);
|
const isFinancialBoss = await models.Account.hasRole(userId, 'financialBoss', ctx.options);
|
||||||
if (!isManager) {
|
if (!isFinancialBoss) {
|
||||||
const lastCredit = await models.ClientCredit.findOne({
|
const lastCredit = await models.ClientCredit.findOne({
|
||||||
where: {
|
where: {
|
||||||
clientFk: finalState.id
|
clientFk: finalState.id
|
||||||
|
@ -413,10 +413,10 @@ module.exports = Self => {
|
||||||
|
|
||||||
const lastAmount = lastCredit && lastCredit.amount;
|
const lastAmount = lastCredit && lastCredit.amount;
|
||||||
const lastWorkerId = lastCredit && lastCredit.workerFk;
|
const lastWorkerId = lastCredit && lastCredit.workerFk;
|
||||||
const lastWorkerIsManager = await models.Account.hasRole(lastWorkerId, 'manager', ctx.options);
|
const lastWorkerIsFinancialBoss = await models.Account.hasRole(lastWorkerId, 'financialBoss', ctx.options);
|
||||||
|
|
||||||
if (lastAmount == 0 && lastWorkerIsManager)
|
if (lastAmount == 0 && lastWorkerIsFinancialBoss)
|
||||||
throw new UserError(`You can't change the credit set to zero from a manager`);
|
throw new UserError(`You can't change the credit set to zero from a financialBoss`);
|
||||||
|
|
||||||
const creditLimits = await models.ClientCreditLimit.find({
|
const creditLimits = await models.ClientCreditLimit.find({
|
||||||
fields: ['roleFk'],
|
fields: ['roleFk'],
|
||||||
|
|
|
@ -53,7 +53,7 @@ describe('Client Model', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('changeCredit()', () => {
|
describe('changeCredit()', () => {
|
||||||
it('should fail to change the credit as a salesAssistant set to zero by a manager', async() => {
|
it('should fail to change the credit as a salesAssistant set to zero by a financialBoss', async() => {
|
||||||
const tx = await models.Client.beginTransaction({});
|
const tx = await models.Client.beginTransaction({});
|
||||||
|
|
||||||
let error;
|
let error;
|
||||||
|
@ -62,7 +62,7 @@ describe('Client Model', () => {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
const context = {options};
|
const context = {options};
|
||||||
|
|
||||||
// Set credit to zero by a manager
|
// Set credit to zero by a financialBoss
|
||||||
const financialBoss = await models.Account.findOne({
|
const financialBoss = await models.Account.findOne({
|
||||||
where: {name: 'financialBoss'}
|
where: {name: 'financialBoss'}
|
||||||
}, options);
|
}, options);
|
||||||
|
@ -83,7 +83,7 @@ describe('Client Model', () => {
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
}
|
}
|
||||||
|
|
||||||
expect(error.message).toEqual(`You can't change the credit set to zero from a manager`);
|
expect(error.message).toEqual(`You can't change the credit set to zero from a financialBoss`);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should fail to change to a high credit amount as a salesAssistant', async() => {
|
it('should fail to change to a high credit amount as a salesAssistant', async() => {
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
<vn-autocomplete
|
<vn-autocomplete
|
||||||
vn-one
|
vn-one
|
||||||
label="Billing data"
|
label="Billing data"
|
||||||
vn-acl="salesAssistant"
|
vn-acl="salesAssistant, hr"
|
||||||
ng-model="$ctrl.client.payMethodFk"
|
ng-model="$ctrl.client.payMethodFk"
|
||||||
data="paymethods"
|
data="paymethods"
|
||||||
fields="['isIbanRequiredForClients']"
|
fields="['isIbanRequiredForClients']"
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
step="1"
|
step="1"
|
||||||
label="Due day"
|
label="Due day"
|
||||||
ng-model="$ctrl.client.dueDay"
|
ng-model="$ctrl.client.dueDay"
|
||||||
vn-acl="salesAssistant"
|
vn-acl="salesAssistant, hr"
|
||||||
rule>
|
rule>
|
||||||
</vn-input-number>
|
</vn-input-number>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
|
@ -39,7 +39,7 @@
|
||||||
ng-model="$ctrl.client.iban"
|
ng-model="$ctrl.client.iban"
|
||||||
rule
|
rule
|
||||||
on-change="$ctrl.autofillBic()"
|
on-change="$ctrl.autofillBic()"
|
||||||
vn-acl="salesAssistant">
|
vn-acl="salesAssistant, hr">
|
||||||
</vn-textfield>
|
</vn-textfield>
|
||||||
<vn-autocomplete
|
<vn-autocomplete
|
||||||
vn-one
|
vn-one
|
||||||
|
@ -52,7 +52,7 @@
|
||||||
search-function="{or: [{bic: {like: $search +'%'}}, {name: {like: '%'+ $search +'%'}}]}"
|
search-function="{or: [{bic: {like: $search +'%'}}, {name: {like: '%'+ $search +'%'}}]}"
|
||||||
value-field="id"
|
value-field="id"
|
||||||
show-field="bic"
|
show-field="bic"
|
||||||
vn-acl="salesAssistant"
|
vn-acl="salesAssistant, hr"
|
||||||
disabled="$ctrl.ibanCountry == 'ES'">
|
disabled="$ctrl.ibanCountry == 'ES'">
|
||||||
<tpl-item>{{bic}} {{name}}</tpl-item>
|
<tpl-item>{{bic}} {{name}}</tpl-item>
|
||||||
<append>
|
<append>
|
||||||
|
@ -61,7 +61,7 @@
|
||||||
icon="add_circle"
|
icon="add_circle"
|
||||||
vn-click-stop="bankEntity.show({countryFk: $ctrl.client.countryFk})"
|
vn-click-stop="bankEntity.show({countryFk: $ctrl.client.countryFk})"
|
||||||
vn-tooltip="New bank entity"
|
vn-tooltip="New bank entity"
|
||||||
vn-acl="salesAssistant">
|
vn-acl="salesAssistant, hr">
|
||||||
</vn-icon-button>
|
</vn-icon-button>
|
||||||
</append>
|
</append>
|
||||||
</vn-autocomplete>
|
</vn-autocomplete>
|
||||||
|
@ -71,19 +71,19 @@
|
||||||
vn-one
|
vn-one
|
||||||
label="Received LCR"
|
label="Received LCR"
|
||||||
ng-model="$ctrl.client.hasLcr"
|
ng-model="$ctrl.client.hasLcr"
|
||||||
vn-acl="salesAssistant">
|
vn-acl="salesAssistant, hr">
|
||||||
</vn-check>
|
</vn-check>
|
||||||
<vn-check
|
<vn-check
|
||||||
vn-one
|
vn-one
|
||||||
label="Received core VNL"
|
label="Received core VNL"
|
||||||
ng-model="$ctrl.client.hasCoreVnl"
|
ng-model="$ctrl.client.hasCoreVnl"
|
||||||
vn-acl="salesAssistant">
|
vn-acl="salesAssistant, hr">
|
||||||
</vn-check>
|
</vn-check>
|
||||||
<vn-check
|
<vn-check
|
||||||
vn-one
|
vn-one
|
||||||
label="Received B2B VNL"
|
label="Received B2B VNL"
|
||||||
ng-model="$ctrl.client.hasSepaVnl"
|
ng-model="$ctrl.client.hasSepaVnl"
|
||||||
vn-acl="salesAssistant">
|
vn-acl="salesAssistant, hr">
|
||||||
</vn-check>
|
</vn-check>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
</vn-card>
|
</vn-card>
|
||||||
|
|
|
@ -20,7 +20,7 @@ module.exports = Self => {
|
||||||
},
|
},
|
||||||
http: {
|
http: {
|
||||||
path: `/:id/importBuysPreview`,
|
path: `/:id/importBuysPreview`,
|
||||||
verb: 'GET'
|
verb: 'POST'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -148,6 +148,8 @@ module.exports = Self => {
|
||||||
stmt = new ParameterizedSQL(`CALL cache.visible_refresh(@calc_id, FALSE, ?)`, [warehouse.id]);
|
stmt = new ParameterizedSQL(`CALL cache.visible_refresh(@calc_id, FALSE, ?)`, [warehouse.id]);
|
||||||
stmts.push(stmt);
|
stmts.push(stmt);
|
||||||
|
|
||||||
|
const userConfig = await models.UserConfig.getUserConfig(ctx, myOptions);
|
||||||
|
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
date.setHours(0, 0, 0, 0);
|
date.setHours(0, 0, 0, 0);
|
||||||
stmt = new ParameterizedSQL(`
|
stmt = new ParameterizedSQL(`
|
||||||
|
@ -201,7 +203,7 @@ module.exports = Self => {
|
||||||
LEFT JOIN cache.visible v ON v.item_id = lb.item_id
|
LEFT JOIN cache.visible v ON v.item_id = lb.item_id
|
||||||
AND v.calc_id = @calc_id
|
AND v.calc_id = @calc_id
|
||||||
JOIN item i ON i.id = lb.item_id
|
JOIN item i ON i.id = lb.item_id
|
||||||
JOIN itemType it ON it.id = i.typeFk AND lb.warehouse_id = it.warehouseFk
|
JOIN itemType it ON it.id = i.typeFk AND lb.warehouse_id = ?
|
||||||
JOIN buy b ON b.id = lb.buy_id
|
JOIN buy b ON b.id = lb.buy_id
|
||||||
LEFT JOIN itemCategory ic ON ic.id = it.categoryFk
|
LEFT JOIN itemCategory ic ON ic.id = it.categoryFk
|
||||||
LEFT JOIN itemType t ON t.id = i.typeFk
|
LEFT JOIN itemType t ON t.id = i.typeFk
|
||||||
|
@ -209,7 +211,7 @@ module.exports = Self => {
|
||||||
LEFT JOIN origin ori ON ori.id = i.originFk
|
LEFT JOIN origin ori ON ori.id = i.originFk
|
||||||
LEFT JOIN entry e ON e.id = b.entryFk AND e.created >= DATE_SUB(? ,INTERVAL 1 YEAR)
|
LEFT JOIN entry e ON e.id = b.entryFk AND e.created >= DATE_SUB(? ,INTERVAL 1 YEAR)
|
||||||
LEFT JOIN supplier s ON s.id = e.supplierFk`
|
LEFT JOIN supplier s ON s.id = e.supplierFk`
|
||||||
, [date]);
|
, [userConfig.warehouseFk, date]);
|
||||||
|
|
||||||
if (ctx.args.tags) {
|
if (ctx.args.tags) {
|
||||||
let i = 1;
|
let i = 1;
|
||||||
|
|
|
@ -9,7 +9,8 @@ describe('Buy editLatestsBuys()', () => {
|
||||||
const ctx = {
|
const ctx = {
|
||||||
args: {
|
args: {
|
||||||
search: 'Ranged weapon longbow 2m'
|
search: 'Ranged weapon longbow 2m'
|
||||||
}
|
},
|
||||||
|
req: {accessToken: {userId: 1}}
|
||||||
};
|
};
|
||||||
|
|
||||||
const [original] = await models.Buy.latestBuysFilter(ctx, null, options);
|
const [original] = await models.Buy.latestBuysFilter(ctx, null, options);
|
||||||
|
@ -36,11 +37,12 @@ describe('Buy editLatestsBuys()', () => {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const filter = {typeFk: 1};
|
const filter = {'i.typeFk': 1};
|
||||||
const ctx = {
|
const ctx = {
|
||||||
args: {
|
args: {
|
||||||
filter: filter
|
filter: filter
|
||||||
}
|
},
|
||||||
|
req: {accessToken: {userId: 1}}
|
||||||
};
|
};
|
||||||
|
|
||||||
const field = 'size';
|
const field = 'size';
|
||||||
|
|
|
@ -9,7 +9,8 @@ describe('Entry latests buys filter()', () => {
|
||||||
const ctx = {
|
const ctx = {
|
||||||
args: {
|
args: {
|
||||||
search: 'Ranged weapon longbow 2m'
|
search: 'Ranged weapon longbow 2m'
|
||||||
}
|
},
|
||||||
|
req: {accessToken: {userId: 1}}
|
||||||
};
|
};
|
||||||
|
|
||||||
const results = await models.Buy.latestBuysFilter(ctx, options);
|
const results = await models.Buy.latestBuysFilter(ctx, options);
|
||||||
|
@ -33,7 +34,8 @@ describe('Entry latests buys filter()', () => {
|
||||||
const ctx = {
|
const ctx = {
|
||||||
args: {
|
args: {
|
||||||
id: 1
|
id: 1
|
||||||
}
|
},
|
||||||
|
req: {accessToken: {userId: 1}}
|
||||||
};
|
};
|
||||||
|
|
||||||
const results = await models.Buy.latestBuysFilter(ctx, options);
|
const results = await models.Buy.latestBuysFilter(ctx, options);
|
||||||
|
@ -57,7 +59,8 @@ describe('Entry latests buys filter()', () => {
|
||||||
tags: [
|
tags: [
|
||||||
{tagFk: 27, value: '2m'}
|
{tagFk: 27, value: '2m'}
|
||||||
]
|
]
|
||||||
}
|
},
|
||||||
|
req: {accessToken: {userId: 1}}
|
||||||
};
|
};
|
||||||
|
|
||||||
const results = await models.Buy.latestBuysFilter(ctx, options);
|
const results = await models.Buy.latestBuysFilter(ctx, options);
|
||||||
|
@ -79,7 +82,8 @@ describe('Entry latests buys filter()', () => {
|
||||||
const ctx = {
|
const ctx = {
|
||||||
args: {
|
args: {
|
||||||
categoryFk: 1
|
categoryFk: 1
|
||||||
}
|
},
|
||||||
|
req: {accessToken: {userId: 1}}
|
||||||
};
|
};
|
||||||
|
|
||||||
const results = await models.Buy.latestBuysFilter(ctx, options);
|
const results = await models.Buy.latestBuysFilter(ctx, options);
|
||||||
|
@ -101,7 +105,8 @@ describe('Entry latests buys filter()', () => {
|
||||||
const ctx = {
|
const ctx = {
|
||||||
args: {
|
args: {
|
||||||
typeFk: 2
|
typeFk: 2
|
||||||
}
|
},
|
||||||
|
req: {accessToken: {userId: 1}}
|
||||||
};
|
};
|
||||||
|
|
||||||
const results = await models.Buy.latestBuysFilter(ctx, options);
|
const results = await models.Buy.latestBuysFilter(ctx, options);
|
||||||
|
@ -123,7 +128,8 @@ describe('Entry latests buys filter()', () => {
|
||||||
const ctx = {
|
const ctx = {
|
||||||
args: {
|
args: {
|
||||||
active: true
|
active: true
|
||||||
}
|
},
|
||||||
|
req: {accessToken: {userId: 1}}
|
||||||
};
|
};
|
||||||
|
|
||||||
const results = await models.Buy.latestBuysFilter(ctx, options);
|
const results = await models.Buy.latestBuysFilter(ctx, options);
|
||||||
|
@ -145,7 +151,8 @@ describe('Entry latests buys filter()', () => {
|
||||||
const ctx = {
|
const ctx = {
|
||||||
args: {
|
args: {
|
||||||
active: false
|
active: false
|
||||||
}
|
},
|
||||||
|
req: {accessToken: {userId: 1}}
|
||||||
};
|
};
|
||||||
|
|
||||||
const results = await models.Buy.latestBuysFilter(ctx, options);
|
const results = await models.Buy.latestBuysFilter(ctx, options);
|
||||||
|
@ -167,7 +174,8 @@ describe('Entry latests buys filter()', () => {
|
||||||
const ctx = {
|
const ctx = {
|
||||||
args: {
|
args: {
|
||||||
visible: true
|
visible: true
|
||||||
}
|
},
|
||||||
|
req: {accessToken: {userId: 1}}
|
||||||
};
|
};
|
||||||
|
|
||||||
const results = await models.Buy.latestBuysFilter(ctx, options);
|
const results = await models.Buy.latestBuysFilter(ctx, options);
|
||||||
|
@ -189,7 +197,8 @@ describe('Entry latests buys filter()', () => {
|
||||||
const ctx = {
|
const ctx = {
|
||||||
args: {
|
args: {
|
||||||
visible: false
|
visible: false
|
||||||
}
|
},
|
||||||
|
req: {accessToken: {userId: 1}}
|
||||||
};
|
};
|
||||||
|
|
||||||
const results = await models.Buy.latestBuysFilter(ctx, options);
|
const results = await models.Buy.latestBuysFilter(ctx, options);
|
||||||
|
@ -211,7 +220,8 @@ describe('Entry latests buys filter()', () => {
|
||||||
const ctx = {
|
const ctx = {
|
||||||
args: {
|
args: {
|
||||||
floramondo: true
|
floramondo: true
|
||||||
}
|
},
|
||||||
|
req: {accessToken: {userId: 1}}
|
||||||
};
|
};
|
||||||
|
|
||||||
const results = await models.Buy.latestBuysFilter(ctx, options);
|
const results = await models.Buy.latestBuysFilter(ctx, options);
|
||||||
|
@ -233,7 +243,8 @@ describe('Entry latests buys filter()', () => {
|
||||||
const ctx = {
|
const ctx = {
|
||||||
args: {
|
args: {
|
||||||
floramondo: false
|
floramondo: false
|
||||||
}
|
},
|
||||||
|
req: {accessToken: {userId: 1}}
|
||||||
};
|
};
|
||||||
|
|
||||||
const results = await models.Buy.latestBuysFilter(ctx, options);
|
const results = await models.Buy.latestBuysFilter(ctx, options);
|
||||||
|
@ -255,7 +266,8 @@ describe('Entry latests buys filter()', () => {
|
||||||
const ctx = {
|
const ctx = {
|
||||||
args: {
|
args: {
|
||||||
salesPersonFk: 35
|
salesPersonFk: 35
|
||||||
}
|
},
|
||||||
|
req: {accessToken: {userId: 1}}
|
||||||
};
|
};
|
||||||
|
|
||||||
const results = await models.Buy.latestBuysFilter(ctx, options);
|
const results = await models.Buy.latestBuysFilter(ctx, options);
|
||||||
|
@ -277,7 +289,8 @@ describe('Entry latests buys filter()', () => {
|
||||||
const ctx = {
|
const ctx = {
|
||||||
args: {
|
args: {
|
||||||
description: 'Increases block'
|
description: 'Increases block'
|
||||||
}
|
},
|
||||||
|
req: {accessToken: {userId: 1}}
|
||||||
};
|
};
|
||||||
|
|
||||||
const results = await models.Buy.latestBuysFilter(ctx, options);
|
const results = await models.Buy.latestBuysFilter(ctx, options);
|
||||||
|
@ -299,7 +312,8 @@ describe('Entry latests buys filter()', () => {
|
||||||
const ctx = {
|
const ctx = {
|
||||||
args: {
|
args: {
|
||||||
supplierFk: 1
|
supplierFk: 1
|
||||||
}
|
},
|
||||||
|
req: {accessToken: {userId: 1}}
|
||||||
};
|
};
|
||||||
|
|
||||||
const results = await models.Buy.latestBuysFilter(ctx, options);
|
const results = await models.Buy.latestBuysFilter(ctx, options);
|
||||||
|
@ -328,7 +342,8 @@ describe('Entry latests buys filter()', () => {
|
||||||
args: {
|
args: {
|
||||||
from: from,
|
from: from,
|
||||||
to: to
|
to: to
|
||||||
}
|
},
|
||||||
|
req: {accessToken: {userId: 1}}
|
||||||
};
|
};
|
||||||
|
|
||||||
const results = await models.Buy.latestBuysFilter(ctx, options);
|
const results = await models.Buy.latestBuysFilter(ctx, options);
|
||||||
|
|
|
@ -58,7 +58,7 @@ class Controller extends Section {
|
||||||
fetchBuys(buys) {
|
fetchBuys(buys) {
|
||||||
const params = {buys};
|
const params = {buys};
|
||||||
const query = `Entries/${this.$params.id}/importBuysPreview`;
|
const query = `Entries/${this.$params.id}/importBuysPreview`;
|
||||||
this.$http.get(query, {params}).then(res => {
|
this.$http.post(query, params).then(res => {
|
||||||
this.import.buys = res.data;
|
this.import.buys = res.data;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,9 +111,8 @@ describe('Entry', () => {
|
||||||
'volume': 1125}
|
'volume': 1125}
|
||||||
];
|
];
|
||||||
|
|
||||||
const serializedParams = $httpParamSerializer({buys});
|
const query = `Entries/1/importBuysPreview`;
|
||||||
const query = `Entries/1/importBuysPreview?${serializedParams}`;
|
$httpBackend.expectPOST(query).respond(200, buys);
|
||||||
$httpBackend.expectGET(query).respond(200, buys);
|
|
||||||
controller.fetchBuys(buys);
|
controller.fetchBuys(buys);
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
order="itemFk DESC"
|
order="itemFk DESC"
|
||||||
limit="20"
|
limit="20"
|
||||||
data="$ctrl.buys"
|
data="$ctrl.buys"
|
||||||
|
on-data-change="$ctrl.reCheck()"
|
||||||
auto-load="true">
|
auto-load="true">
|
||||||
</vn-crud-model>
|
</vn-crud-model>
|
||||||
<vn-portal slot="topbar">
|
<vn-portal slot="topbar">
|
||||||
|
@ -21,7 +22,7 @@
|
||||||
<smart-table
|
<smart-table
|
||||||
model="model"
|
model="model"
|
||||||
view-config-id="latestBuys"
|
view-config-id="latestBuys"
|
||||||
options="$ctrl.smartTableOptions"
|
options="$ctrl.smartTableOptions"
|
||||||
expr-builder="$ctrl.exprBuilder(param, value)">
|
expr-builder="$ctrl.exprBuilder(param, value)">
|
||||||
<slot-table>
|
<slot-table>
|
||||||
<table>
|
<table>
|
||||||
|
@ -123,17 +124,18 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr ng-repeat="buy in $ctrl.buys"
|
<tr ng-repeat="buy in $ctrl.buys"
|
||||||
vn-anchor="::{
|
vn-anchor="::{
|
||||||
state: 'entry.card.buy.index',
|
state: 'entry.card.buy.index',
|
||||||
params: {id: {{::buy.entryFk}}}
|
params: {id: {{::buy.entryFk}}}
|
||||||
}">
|
}">
|
||||||
<td>
|
<td>
|
||||||
<vn-check
|
<vn-check
|
||||||
ng-model="buy.checked"
|
ng-model="buy.checked"
|
||||||
|
on-change="$ctrl.saveChecked(buy.id)"
|
||||||
vn-click-stop>
|
vn-click-stop>
|
||||||
</vn-check>
|
</vn-check>
|
||||||
</td>
|
</td>
|
||||||
<td >
|
<td >
|
||||||
<img
|
<img
|
||||||
ng-src="{{::$root.imagePath('catalog', '50x50', buy.itemFk)}}"
|
ng-src="{{::$root.imagePath('catalog', '50x50', buy.itemFk)}}"
|
||||||
zoom-image="{{::$root.imagePath('catalog', '1600x900', buy.itemFk)}}"
|
zoom-image="{{::$root.imagePath('catalog', '1600x900', buy.itemFk)}}"
|
||||||
vn-click-stop
|
vn-click-stop
|
||||||
|
@ -147,12 +149,12 @@
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td number>
|
<td number>
|
||||||
<vn-chip class="transparent" translate-attr="buy.groupingMode == 2 ? {title: 'Minimun amount'} : {title: 'Packing'}" ng-class="{'message': buy.groupingMode == 2}">
|
<vn-chip class="transparent" translate-attr="buy.groupingMode == 2 ? {title: 'Minimun amount'} : {title: 'Packing'}" ng-class="{'message': buy.groupingMode == 2}">
|
||||||
<span>{{::buy.packing | dashIfEmpty}}</span>
|
<span>{{::buy.packing | dashIfEmpty}}</span>
|
||||||
</vn-chip>
|
</vn-chip>
|
||||||
</td>
|
</td>
|
||||||
<td number>
|
<td number>
|
||||||
<vn-chip class="transparent" translate-attr="buy.groupingMode == 1 ? {title: 'Minimun amount'} : {title: 'Grouping'}" ng-class="{'message': buy.groupingMode == 1}">
|
<vn-chip class="transparent" translate-attr="buy.groupingMode == 1 ? {title: 'Minimun amount'} : {title: 'Grouping'}" ng-class="{'message': buy.groupingMode == 1}">
|
||||||
<span>{{::buy.grouping | dashIfEmpty}}</span>
|
<span>{{::buy.grouping | dashIfEmpty}}</span>
|
||||||
</vn-chip>
|
</vn-chip>
|
||||||
</td>
|
</td>
|
||||||
|
@ -186,7 +188,7 @@
|
||||||
<vn-check
|
<vn-check
|
||||||
disabled="true"
|
disabled="true"
|
||||||
ng-model="::buy.isActive">
|
ng-model="::buy.isActive">
|
||||||
</vn-check>
|
</vn-check>
|
||||||
</td>
|
</td>
|
||||||
<td>{{::buy.family}}</td>
|
<td>{{::buy.family}}</td>
|
||||||
<td>
|
<td>
|
||||||
|
@ -204,7 +206,7 @@
|
||||||
<vn-check
|
<vn-check
|
||||||
disabled="true"
|
disabled="true"
|
||||||
ng-model="::buy.isIgnored">
|
ng-model="::buy.isIgnored">
|
||||||
</vn-check>
|
</vn-check>
|
||||||
</td>
|
</td>
|
||||||
<td number>{{::buy.price2 | currency: 'EUR':2}}</td>
|
<td number>{{::buy.price2 | currency: 'EUR':2}}</td>
|
||||||
<td number>{{::buy.price3 | currency: 'EUR':2}}</td>
|
<td number>{{::buy.price3 | currency: 'EUR':2}}</td>
|
||||||
|
@ -231,7 +233,7 @@
|
||||||
</vn-button>
|
</vn-button>
|
||||||
</vn-vertical>
|
</vn-vertical>
|
||||||
</div>
|
</div>
|
||||||
<vn-dialog class="edit"
|
<vn-dialog class="edit"
|
||||||
vn-id="edit"
|
vn-id="edit"
|
||||||
on-accept="$ctrl.onEditAccept()"
|
on-accept="$ctrl.onEditAccept()"
|
||||||
on-close="$ctrl.editedColumn = null">
|
on-close="$ctrl.editedColumn = null">
|
||||||
|
|
|
@ -7,6 +7,7 @@ export default class Controller extends Section {
|
||||||
super($element, $);
|
super($element, $);
|
||||||
this.editedColumn;
|
this.editedColumn;
|
||||||
this.checkAll = false;
|
this.checkAll = false;
|
||||||
|
this.checkedBuys = [];
|
||||||
|
|
||||||
this.smartTableOptions = {
|
this.smartTableOptions = {
|
||||||
activeButtons: {
|
activeButtons: {
|
||||||
|
@ -139,6 +140,7 @@ export default class Controller extends Section {
|
||||||
|
|
||||||
uncheck() {
|
uncheck() {
|
||||||
this.checkAll = false;
|
this.checkAll = false;
|
||||||
|
this.checkedBuys = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
get totalChecked() {
|
get totalChecked() {
|
||||||
|
@ -148,6 +150,23 @@ export default class Controller extends Section {
|
||||||
return this.checked.length;
|
return this.checked.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
saveChecked(buyId) {
|
||||||
|
const index = this.checkedBuys.indexOf(buyId);
|
||||||
|
if (index !== -1)
|
||||||
|
return this.checkedBuys.splice(index, 1);
|
||||||
|
return this.checkedBuys.push(buyId);
|
||||||
|
}
|
||||||
|
|
||||||
|
reCheck() {
|
||||||
|
if (!this.$.model.data) return;
|
||||||
|
if (!this.checkedBuys.length) return;
|
||||||
|
|
||||||
|
this.$.model.data.forEach(buy => {
|
||||||
|
if (this.checkedBuys.includes(buy.id))
|
||||||
|
buy.checked = true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
onEditAccept() {
|
onEditAccept() {
|
||||||
const rowsToEdit = [];
|
const rowsToEdit = [];
|
||||||
for (let row of this.checked)
|
for (let row of this.checked)
|
||||||
|
|
|
@ -57,5 +57,44 @@ describe('Entry', () => {
|
||||||
expect(result.length).toEqual(0);
|
expect(result.length).toEqual(0);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('reCheck()', () => {
|
||||||
|
it(`should recheck buys`, () => {
|
||||||
|
controller.$.model.data = [
|
||||||
|
{checked: false, id: 1},
|
||||||
|
{checked: false, id: 2},
|
||||||
|
{checked: false, id: 3},
|
||||||
|
{checked: false, id: 4},
|
||||||
|
];
|
||||||
|
controller.checkedBuys = [1, 2];
|
||||||
|
|
||||||
|
controller.reCheck();
|
||||||
|
|
||||||
|
expect(controller.$.model.data[0].checked).toEqual(true);
|
||||||
|
expect(controller.$.model.data[1].checked).toEqual(true);
|
||||||
|
expect(controller.$.model.data[2].checked).toEqual(false);
|
||||||
|
expect(controller.$.model.data[3].checked).toEqual(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('saveChecked()', () => {
|
||||||
|
it(`should check buy`, () => {
|
||||||
|
const buyCheck = 3;
|
||||||
|
controller.checkedBuys = [1, 2];
|
||||||
|
|
||||||
|
controller.saveChecked(buyCheck);
|
||||||
|
|
||||||
|
expect(controller.checkedBuys[2]).toEqual(buyCheck);
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should uncheck buy`, () => {
|
||||||
|
const buyUncheck = 3;
|
||||||
|
controller.checkedBuys = [1, 2, 3];
|
||||||
|
|
||||||
|
controller.saveChecked(buyUncheck);
|
||||||
|
|
||||||
|
expect(controller.checkedBuys[2]).toEqual(undefined);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -12,7 +12,7 @@ module.exports = Self => {
|
||||||
},
|
},
|
||||||
http: {
|
http: {
|
||||||
path: `/downloadImages`,
|
path: `/downloadImages`,
|
||||||
verb: 'GET'
|
verb: 'POST'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -86,6 +86,7 @@ module.exports = Self => {
|
||||||
|
|
||||||
Self.filter = async(ctx, filter, options) => {
|
Self.filter = async(ctx, filter, options) => {
|
||||||
const conn = Self.dataSource.connector;
|
const conn = Self.dataSource.connector;
|
||||||
|
const models = Self.app.models;
|
||||||
const myOptions = {};
|
const myOptions = {};
|
||||||
|
|
||||||
if (typeof options == 'object')
|
if (typeof options == 'object')
|
||||||
|
@ -140,6 +141,8 @@ module.exports = Self => {
|
||||||
|
|
||||||
filter = mergeFilters(filter, {where});
|
filter = mergeFilters(filter, {where});
|
||||||
|
|
||||||
|
const userConfig = await models.UserConfig.getUserConfig(ctx, myOptions);
|
||||||
|
|
||||||
const stmts = [];
|
const stmts = [];
|
||||||
const stmt = new ParameterizedSQL(
|
const stmt = new ParameterizedSQL(
|
||||||
`SELECT
|
`SELECT
|
||||||
|
@ -179,11 +182,11 @@ module.exports = Self => {
|
||||||
LEFT JOIN intrastat intr ON intr.id = i.intrastatFk
|
LEFT JOIN intrastat intr ON intr.id = i.intrastatFk
|
||||||
LEFT JOIN producer pr ON pr.id = i.producerFk
|
LEFT JOIN producer pr ON pr.id = i.producerFk
|
||||||
LEFT JOIN origin ori ON ori.id = i.originFk
|
LEFT JOIN origin ori ON ori.id = i.originFk
|
||||||
LEFT JOIN cache.last_buy lb ON lb.item_id = i.id AND lb.warehouse_id = it.warehouseFk
|
LEFT JOIN cache.last_buy lb ON lb.item_id = i.id AND lb.warehouse_id = ?
|
||||||
LEFT JOIN buy b ON b.id = lb.buy_id
|
LEFT JOIN buy b ON b.id = lb.buy_id
|
||||||
LEFT JOIN entry e ON e.id = b.entryFk
|
LEFT JOIN entry e ON e.id = b.entryFk
|
||||||
LEFT JOIN supplier s ON s.id = e.supplierFk`
|
LEFT JOIN supplier s ON s.id = e.supplierFk`
|
||||||
);
|
, [userConfig.warehouseFk]);
|
||||||
|
|
||||||
if (ctx.args.tags) {
|
if (ctx.args.tags) {
|
||||||
let i = 1;
|
let i = 1;
|
||||||
|
|
|
@ -30,7 +30,7 @@ module.exports = Self => {
|
||||||
{
|
{
|
||||||
relation: 'itemType',
|
relation: 'itemType',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['id', 'name', 'workerFk', 'warehouseFk'],
|
fields: ['id', 'name', 'workerFk'],
|
||||||
include: [{
|
include: [{
|
||||||
relation: 'worker',
|
relation: 'worker',
|
||||||
scope: {
|
scope: {
|
||||||
|
|
|
@ -34,7 +34,7 @@ module.exports = Self => {
|
||||||
include: [
|
include: [
|
||||||
{relation: 'itemType',
|
{relation: 'itemType',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['id', 'name', 'workerFk', 'warehouseFk'],
|
fields: ['id', 'name', 'workerFk'],
|
||||||
include: [{
|
include: [{
|
||||||
relation: 'worker',
|
relation: 'worker',
|
||||||
scope: {
|
scope: {
|
||||||
|
|
|
@ -30,11 +30,24 @@ module.exports = Self => {
|
||||||
sum(ws.saleWaste) AS dwindle
|
sum(ws.saleWaste) AS dwindle
|
||||||
FROM bs.waste ws
|
FROM bs.waste ws
|
||||||
WHERE year = YEAR(TIMESTAMPADD(WEEK,-1, ?))
|
WHERE year = YEAR(TIMESTAMPADD(WEEK,-1, ?))
|
||||||
AND week = WEEK(TIMESTAMPADD(WEEK,-1, ?), 1)
|
AND week = WEEK(TIMESTAMPADD(WEEK,-1, ?), 1)
|
||||||
GROUP BY buyer, family
|
GROUP BY buyer, family
|
||||||
) sub
|
) sub
|
||||||
ORDER BY percentage DESC`, [date, date], myOptions);
|
ORDER BY percentage DESC`, [date, date], myOptions);
|
||||||
|
|
||||||
|
const wastesTotal = await Self.rawSql(`
|
||||||
|
SELECT *, 100 * dwindle / total AS percentage
|
||||||
|
FROM (
|
||||||
|
SELECT buyer,
|
||||||
|
sum(ws.saleTotal) AS total,
|
||||||
|
sum(ws.saleWaste) AS dwindle
|
||||||
|
FROM bs.waste ws
|
||||||
|
WHERE year = YEAR(TIMESTAMPADD(WEEK,-1, ?))
|
||||||
|
AND week = WEEK(TIMESTAMPADD(WEEK,-1, ?), 1)
|
||||||
|
GROUP BY buyer
|
||||||
|
) sub
|
||||||
|
ORDER BY percentage DESC`, [date, date], myOptions);
|
||||||
|
|
||||||
const details = [];
|
const details = [];
|
||||||
|
|
||||||
for (let waste of wastes) {
|
for (let waste of wastes) {
|
||||||
|
@ -55,6 +68,14 @@ module.exports = Self => {
|
||||||
buyerDetail.lines.push(waste);
|
buyerDetail.lines.push(waste);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (let waste of details) {
|
||||||
|
let buyerTotal = wastesTotal.find(totals => {
|
||||||
|
return waste.buyer == totals.buyer;
|
||||||
|
});
|
||||||
|
|
||||||
|
Object.assign(waste, buyerTotal);
|
||||||
|
}
|
||||||
|
|
||||||
return details;
|
return details;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -7,7 +7,7 @@ describe('item filter()', () => {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const filter = {};
|
const filter = {};
|
||||||
const ctx = {args: {filter: filter, search: 1}};
|
const ctx = {args: {filter: filter, search: 1}, req: {accessToken: {userId: 1}}};
|
||||||
const result = await models.Item.filter(ctx, filter, options);
|
const result = await models.Item.filter(ctx, filter, options);
|
||||||
|
|
||||||
expect(result.length).toEqual(1);
|
expect(result.length).toEqual(1);
|
||||||
|
@ -26,7 +26,7 @@ describe('item filter()', () => {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const filter = {};
|
const filter = {};
|
||||||
const ctx = {args: {filter: filter, search: 4444444444}};
|
const ctx = {args: {filter: filter, search: 4444444444}, req: {accessToken: {userId: 1}}};
|
||||||
const result = await models.Item.filter(ctx, filter, options);
|
const result = await models.Item.filter(ctx, filter, options);
|
||||||
|
|
||||||
expect(result.length).toEqual(1);
|
expect(result.length).toEqual(1);
|
||||||
|
@ -49,7 +49,7 @@ describe('item filter()', () => {
|
||||||
limit: 8
|
limit: 8
|
||||||
};
|
};
|
||||||
const tags = [{value: 'medical box', tagFk: 58}];
|
const tags = [{value: 'medical box', tagFk: 58}];
|
||||||
const ctx = {args: {filter: filter, typeFk: 5, tags: tags}};
|
const ctx = {args: {filter: filter, typeFk: 5, tags: tags}, req: {accessToken: {userId: 1}}};
|
||||||
const result = await models.Item.filter(ctx, filter, options);
|
const result = await models.Item.filter(ctx, filter, options);
|
||||||
|
|
||||||
expect(result.length).toEqual(2);
|
expect(result.length).toEqual(2);
|
||||||
|
@ -67,7 +67,7 @@ describe('item filter()', () => {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const filter = {};
|
const filter = {};
|
||||||
const ctx = {args: {filter: filter, isFloramondo: true}};
|
const ctx = {args: {filter: filter, isFloramondo: true}, req: {accessToken: {userId: 1}}};
|
||||||
const result = await models.Item.filter(ctx, filter, options);
|
const result = await models.Item.filter(ctx, filter, options);
|
||||||
|
|
||||||
expect(result.length).toEqual(3);
|
expect(result.length).toEqual(3);
|
||||||
|
@ -86,7 +86,7 @@ describe('item filter()', () => {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const filter = {};
|
const filter = {};
|
||||||
const ctx = {args: {filter: filter, buyerFk: 16}};
|
const ctx = {args: {filter: filter, buyerFk: 16}, req: {accessToken: {userId: 1}}};
|
||||||
const result = await models.Item.filter(ctx, filter, options);
|
const result = await models.Item.filter(ctx, filter, options);
|
||||||
|
|
||||||
expect(result.length).toEqual(2);
|
expect(result.length).toEqual(2);
|
||||||
|
@ -106,7 +106,7 @@ describe('item filter()', () => {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const filter = {};
|
const filter = {};
|
||||||
const ctx = {args: {filter: filter, supplierFk: 1}};
|
const ctx = {args: {filter: filter, supplierFk: 1}, req: {accessToken: {userId: 1}}};
|
||||||
const result = await models.Item.filter(ctx, filter, options);
|
const result = await models.Item.filter(ctx, filter, options);
|
||||||
|
|
||||||
expect(result.length).toEqual(2);
|
expect(result.length).toEqual(2);
|
||||||
|
|
|
@ -12,6 +12,7 @@ describe('Item getWasteByWorker()', () => {
|
||||||
const anyResult = result[Math.floor(Math.random() * Math.floor(length))];
|
const anyResult = result[Math.floor(Math.random() * Math.floor(length))];
|
||||||
|
|
||||||
expect(anyResult.buyer).toMatch(/(CharlesXavier|HankPym|DavidCharlesHaller)/);
|
expect(anyResult.buyer).toMatch(/(CharlesXavier|HankPym|DavidCharlesHaller)/);
|
||||||
|
expect(anyResult.total).toBeGreaterThanOrEqual(1000);
|
||||||
expect(anyResult.lines.length).toBeGreaterThanOrEqual(3);
|
expect(anyResult.lines.length).toBeGreaterThanOrEqual(3);
|
||||||
|
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
|
|
|
@ -34,11 +34,6 @@
|
||||||
"model": "Worker",
|
"model": "Worker",
|
||||||
"foreignKey": "workerFk"
|
"foreignKey": "workerFk"
|
||||||
},
|
},
|
||||||
"warehouse": {
|
|
||||||
"type": "belongsTo",
|
|
||||||
"model": "Warehouse",
|
|
||||||
"foreignKey": "warehouseFk"
|
|
||||||
},
|
|
||||||
"category": {
|
"category": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "ItemCategory",
|
"model": "ItemCategory",
|
||||||
|
|
|
@ -4,39 +4,46 @@
|
||||||
data="details">
|
data="details">
|
||||||
</vn-crud-model>
|
</vn-crud-model>
|
||||||
<vn-data-viewer model="model">
|
<vn-data-viewer model="model">
|
||||||
<section ng-repeat="detail in details" class="vn-pa-md">
|
<vn-card>
|
||||||
<vn-horizontal class="header">
|
<vn-table>
|
||||||
<h5><span translate>{{detail.buyer}}</span></h5>
|
<vn-thead>
|
||||||
<vn-none>
|
<vn-tr class="header">
|
||||||
<vn-icon
|
<vn-th class="waste-family">Buyer</vn-th>
|
||||||
ng-class="{'hidden': !$ctrl.wasteConfig[detail.buyer].hidden}"
|
<vn-th class="waste-family">Family</vn-th>
|
||||||
class="arrow pointer"
|
<vn-th number>Percentage</vn-th>
|
||||||
icon="keyboard_arrow_up"
|
<vn-th number>Dwindle</vn-th>
|
||||||
vn-tooltip="Minimize/Maximize"
|
<vn-th number>Total</vn-th>
|
||||||
ng-click="$ctrl.toggleHidePanel(detail)">
|
<vn-th shrink></vn-th>
|
||||||
</vn-icon>
|
</vn-tr>
|
||||||
</vn-none>
|
</vn-thead>
|
||||||
</vn-horizontal>
|
<vn-tbody ng-repeat="detail in details" class="vn-mb-md">
|
||||||
<vn-card ng-class="{'hidden': !$ctrl.wasteConfig[detail.buyer].hidden}">
|
<vn-tr class="header">
|
||||||
<vn-table>
|
<vn-td>{{::detail.buyer}}</vn-td>
|
||||||
<vn-thead>
|
<vn-td>{{::detail.family}}</vn-td>
|
||||||
<vn-tr>
|
<vn-td number>{{::(detail.percentage / 100) | percentage: 2}}</vn-td>
|
||||||
<vn-th class="waste-family">Family</vn-th>
|
<vn-td number>{{::detail.dwindle | currency: 'EUR'}}</vn-td>
|
||||||
<vn-th number>Percentage</vn-th>
|
<vn-td number>{{::detail.total | currency: 'EUR'}}</vn-td>
|
||||||
<vn-th number>Dwindle</vn-th>
|
<vn-td shrink>
|
||||||
<vn-th number>Total</vn-th>
|
<vn-icon-button
|
||||||
</vn-tr>
|
ng-class="{'hidden': !$ctrl.wasteConfig[detail.buyer].hidden}"
|
||||||
</vn-thead>
|
class="arrow pointer"
|
||||||
<vn-tbody>
|
icon="keyboard_arrow_up"
|
||||||
<a ng-repeat="waste in detail.lines" class="clickable vn-tr"
|
vn-tooltip="Minimize/Maximize"
|
||||||
ui-sref="item.waste.detail({buyer: waste.buyer, family: waste.family})">
|
ng-click="$ctrl.toggleHidePanel(detail)">
|
||||||
<vn-td class="waste-family">{{::waste.family}}</vn-td>
|
</vn-icon-button>
|
||||||
<vn-td number>{{::(waste.percentage / 100) | percentage: 2}}</vn-td>
|
</vn-td>
|
||||||
<vn-td number>{{::waste.dwindle | currency: 'EUR'}}</vn-td>
|
</vn-tr>
|
||||||
<vn-td number>{{::waste.total | currency: 'EUR'}}</vn-td>
|
<vn-tr ng-repeat="waste in detail.lines" class="clickable vn-tr"
|
||||||
</vn-tr>
|
ui-sref="item.waste.detail({buyer: waste.buyer, family: waste.family})"
|
||||||
</vn-tbody>
|
ng-class="{'hidden': !$ctrl.wasteConfig[detail.buyer].hidden}">
|
||||||
</vn-table>
|
<vn-td></vn-td>
|
||||||
</vn-card>
|
<vn-td>{{::waste.family}}</vn-td>
|
||||||
</section>
|
<vn-td number>{{::(waste.percentage / 100) | percentage: 2}}</vn-td>
|
||||||
</vn-data-viewer>
|
<vn-td number>{{::waste.dwindle | currency: 'EUR'}}</vn-td>
|
||||||
|
<vn-td number>{{::waste.total | currency: 'EUR'}}</vn-td>
|
||||||
|
<vn-td shrink></vn-td>
|
||||||
|
</vn-tr>
|
||||||
|
</vn-tbody>
|
||||||
|
</vn-table>
|
||||||
|
</vn-card>
|
||||||
|
</vn-data-viewer>
|
||||||
|
|
|
@ -5,20 +5,9 @@ vn-item-waste-index,
|
||||||
vn-item-waste-detail {
|
vn-item-waste-detail {
|
||||||
.header {
|
.header {
|
||||||
padding: 12px 0 5px 0;
|
padding: 12px 0 5px 0;
|
||||||
color: gray;
|
background-color: $color-bg;
|
||||||
font-size: 1.2rem;
|
font-size: 1.2rem;
|
||||||
border-bottom: $border;
|
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
|
|
||||||
& > vn-none > vn-icon {
|
|
||||||
@extend %clickable-light;
|
|
||||||
color: $color-button;
|
|
||||||
font-size: 1.4rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
vn-none > .arrow {
|
|
||||||
transition: transform 200ms;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vn-table vn-th.waste-family,
|
vn-table vn-th.waste-family,
|
||||||
|
@ -26,12 +15,13 @@ vn-item-waste-detail {
|
||||||
max-width: 64px;
|
max-width: 64px;
|
||||||
width: 64px
|
width: 64px
|
||||||
}
|
}
|
||||||
|
|
||||||
.hidden {
|
.hidden {
|
||||||
display: none;
|
display: none;
|
||||||
|
|
||||||
}
|
}
|
||||||
.header > vn-none > .arrow.hidden {
|
|
||||||
|
.arrow.hidden {
|
||||||
display: block;
|
display: block;
|
||||||
transform: rotate(180deg);
|
transform: rotate(180deg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -164,6 +164,10 @@ module.exports = Self => {
|
||||||
let stmt;
|
let stmt;
|
||||||
|
|
||||||
stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.filter');
|
stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.filter');
|
||||||
|
|
||||||
|
stmts.push(`SET @_optimizer_search_depth = @@optimizer_search_depth`);
|
||||||
|
stmts.push(`SET SESSION optimizer_search_depth = 0`);
|
||||||
|
|
||||||
stmt = new ParameterizedSQL(
|
stmt = new ParameterizedSQL(
|
||||||
`CREATE TEMPORARY TABLE tmp.filter
|
`CREATE TEMPORARY TABLE tmp.filter
|
||||||
(PRIMARY KEY (id))
|
(PRIMARY KEY (id))
|
||||||
|
@ -207,7 +211,7 @@ module.exports = Self => {
|
||||||
LEFT JOIN province p ON p.id = a.provinceFk
|
LEFT JOIN province p ON p.id = a.provinceFk
|
||||||
LEFT JOIN warehouse w ON w.id = t.warehouseFk
|
LEFT JOIN warehouse w ON w.id = t.warehouseFk
|
||||||
LEFT JOIN agencyMode am ON am.id = t.agencyModeFk
|
LEFT JOIN agencyMode am ON am.id = t.agencyModeFk
|
||||||
LEFT JOIN ticketState ts ON ts.ticketFk = t.id
|
STRAIGHT_JOIN ticketState ts ON ts.ticketFk = t.id
|
||||||
LEFT JOIN state st ON st.id = ts.stateFk
|
LEFT JOIN state st ON st.id = ts.stateFk
|
||||||
LEFT JOIN client c ON c.id = t.clientFk
|
LEFT JOIN client c ON c.id = t.clientFk
|
||||||
LEFT JOIN worker wk ON wk.id = c.salesPersonFk
|
LEFT JOIN worker wk ON wk.id = c.salesPersonFk
|
||||||
|
@ -224,10 +228,12 @@ module.exports = Self => {
|
||||||
stmt.merge(conn.makeWhere(filter.where));
|
stmt.merge(conn.makeWhere(filter.where));
|
||||||
stmts.push(stmt);
|
stmts.push(stmt);
|
||||||
|
|
||||||
|
stmts.push(`SET SESSION optimizer_search_depth = @_optimizer_search_depth`);
|
||||||
|
|
||||||
// Get client debt balance
|
// Get client debt balance
|
||||||
stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.clientGetDebt');
|
stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.clientGetDebt');
|
||||||
stmts.push(`
|
stmts.push(`
|
||||||
CREATE TEMPORARY TABLE tmp.clientGetDebt
|
CREATE TEMPORARY TABLE tmp.clientGetDebt
|
||||||
(PRIMARY KEY (clientFk))
|
(PRIMARY KEY (clientFk))
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
SELECT DISTINCT clientFk FROM tmp.filter`);
|
SELECT DISTINCT clientFk FROM tmp.filter`);
|
||||||
|
@ -238,7 +244,7 @@ module.exports = Self => {
|
||||||
|
|
||||||
stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.tickets');
|
stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.tickets');
|
||||||
stmt = new ParameterizedSQL(`
|
stmt = new ParameterizedSQL(`
|
||||||
CREATE TEMPORARY TABLE tmp.tickets
|
CREATE TEMPORARY TABLE tmp.tickets
|
||||||
(PRIMARY KEY (id))
|
(PRIMARY KEY (id))
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
SELECT f.*, r.risk AS debt
|
SELECT f.*, r.risk AS debt
|
||||||
|
@ -268,10 +274,10 @@ module.exports = Self => {
|
||||||
stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.sale_getProblems');
|
stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.sale_getProblems');
|
||||||
|
|
||||||
stmt = new ParameterizedSQL(`
|
stmt = new ParameterizedSQL(`
|
||||||
CREATE TEMPORARY TABLE tmp.sale_getProblems
|
CREATE TEMPORARY TABLE tmp.sale_getProblems
|
||||||
(INDEX (ticketFk))
|
(INDEX (ticketFk))
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
SELECT f.id ticketFk, f.clientFk, f.warehouseFk, f.shipped
|
SELECT f.id ticketFk, f.clientFk, f.warehouseFk, f.shipped
|
||||||
FROM tmp.filter f
|
FROM tmp.filter f
|
||||||
LEFT JOIN alertLevel al ON al.id = f.alertLevel
|
LEFT JOIN alertLevel al ON al.id = f.alertLevel
|
||||||
WHERE (al.code = 'FREE' OR f.alertLevel IS NULL)
|
WHERE (al.code = 'FREE' OR f.alertLevel IS NULL)
|
||||||
|
@ -377,7 +383,7 @@ module.exports = Self => {
|
||||||
const ticketsIndex = stmts.push(stmt) - 1;
|
const ticketsIndex = stmts.push(stmt) - 1;
|
||||||
|
|
||||||
stmts.push(
|
stmts.push(
|
||||||
`DROP TEMPORARY TABLE
|
`DROP TEMPORARY TABLE
|
||||||
tmp.filter,
|
tmp.filter,
|
||||||
tmp.ticket_problems,
|
tmp.ticket_problems,
|
||||||
tmp.sale_getProblems,
|
tmp.sale_getProblems,
|
||||||
|
|
|
@ -147,16 +147,12 @@ describe('SalesMonitor salesFilter()', () => {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
|
|
||||||
const ctx = {req: {accessToken: {userId: 9}}, args: {pending: false}};
|
const ctx = {req: {accessToken: {userId: 9}}, args: {pending: false}};
|
||||||
const filter = {};
|
const filter = {order: 'alertLevel ASC'};
|
||||||
const result = await models.SalesMonitor.salesFilter(ctx, filter, options);
|
const result = await models.SalesMonitor.salesFilter(ctx, filter, options);
|
||||||
const firstRow = result[0];
|
const firstRow = result[0];
|
||||||
const secondRow = result[1];
|
|
||||||
const thirdRow = result[2];
|
|
||||||
|
|
||||||
expect(result.length).toEqual(12);
|
expect(result.length).toEqual(12);
|
||||||
expect(firstRow.state).toEqual('Entregado');
|
expect(firstRow.alertLevel).not.toEqual(0);
|
||||||
expect(secondRow.state).toEqual('Entregado');
|
|
||||||
expect(thirdRow.state).toEqual('Entregado');
|
|
||||||
|
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
@ -50,8 +50,10 @@
|
||||||
},
|
},
|
||||||
"scope": {
|
"scope": {
|
||||||
"where": {
|
"where": {
|
||||||
"isActive": true
|
"isActive": {
|
||||||
}
|
"neq": false
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"acls": [
|
"acls": [
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,5 +7,8 @@
|
||||||
},
|
},
|
||||||
"ShelvingLog": {
|
"ShelvingLog": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
|
"Sector": {
|
||||||
|
"dataSource": "vn"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,72 @@
|
||||||
|
{
|
||||||
|
"name": "Sector",
|
||||||
|
"base": "VnModel",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "sector"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "number",
|
||||||
|
"id": true,
|
||||||
|
"description": "Identifier"
|
||||||
|
},
|
||||||
|
"description": {
|
||||||
|
"type": "string",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"warehouseFk": {
|
||||||
|
"type": "number",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"isPreviousPreparedByPacking": {
|
||||||
|
"type": "boolean",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"code": {
|
||||||
|
"type": "string",
|
||||||
|
"required": false
|
||||||
|
},
|
||||||
|
"isPreviousPrepared": {
|
||||||
|
"type": "boolean",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"isPackagingArea": {
|
||||||
|
"type": "boolean",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"reportFk": {
|
||||||
|
"type": "number",
|
||||||
|
"required": false
|
||||||
|
},
|
||||||
|
"sonFk": {
|
||||||
|
"type": "number",
|
||||||
|
"required": false
|
||||||
|
},
|
||||||
|
"isMain": {
|
||||||
|
"type": "boolean",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"itemPackingTypeFk": {
|
||||||
|
"type": "string",
|
||||||
|
"required": false
|
||||||
|
},
|
||||||
|
"workerFk": {
|
||||||
|
"type": "number",
|
||||||
|
"required": false
|
||||||
|
},
|
||||||
|
"printerFk": {
|
||||||
|
"type": "number",
|
||||||
|
"required": false
|
||||||
|
},
|
||||||
|
"isHideForPickers": {
|
||||||
|
"type": "boolean",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"isReserve": {
|
||||||
|
"type": "boolean",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,7 +1,6 @@
|
||||||
const models = require('vn-loopback/server/server').models;
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
|
||||||
// 4376
|
describe('ticket listPackaging()', () => {
|
||||||
xdescribe('ticket listPackaging()', () => {
|
|
||||||
it('should return the packaging', async() => {
|
it('should return the packaging', async() => {
|
||||||
const tx = await models.Packaging.beginTransaction({});
|
const tx = await models.Packaging.beginTransaction({});
|
||||||
|
|
||||||
|
|
|
@ -82,6 +82,9 @@ describe('ticket setDeleted()', () => {
|
||||||
ctx.req.__ = value => {
|
ctx.req.__ = value => {
|
||||||
return value;
|
return value;
|
||||||
};
|
};
|
||||||
|
const [ticketCollectionOld] = await models.Ticket.rawSql(
|
||||||
|
`SELECT COUNT(*) numberRows
|
||||||
|
FROM vn.ticketCollection`, [], options);
|
||||||
const ticketId = 23;
|
const ticketId = 23;
|
||||||
|
|
||||||
await models.Ticket.setDeleted(ctx, ticketId, options);
|
await models.Ticket.setDeleted(ctx, ticketId, options);
|
||||||
|
@ -90,7 +93,7 @@ describe('ticket setDeleted()', () => {
|
||||||
`SELECT COUNT(*) numberRows
|
`SELECT COUNT(*) numberRows
|
||||||
FROM vn.ticketCollection`, [], options);
|
FROM vn.ticketCollection`, [], options);
|
||||||
|
|
||||||
expect(ticketCollection.numberRows).toEqual(3);
|
expect(ticketCollection.numberRows).toBeLessThan(ticketCollectionOld.numberRows);
|
||||||
|
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
@ -128,7 +128,7 @@ module.exports = Self => {
|
||||||
w.name AS warehouseInFk,
|
w.name AS warehouseInFk,
|
||||||
w.name AS warehouseInName,
|
w.name AS warehouseInName,
|
||||||
SUM(b.stickers) AS stickers,
|
SUM(b.stickers) AS stickers,
|
||||||
s.id AS supplierFk,
|
s.id AS cargoSupplierFk,
|
||||||
s.nickname AS cargoSupplierNickname,
|
s.nickname AS cargoSupplierNickname,
|
||||||
CAST(SUM(b.weight * b.stickers) as DECIMAL(10,0)) as loadedKg,
|
CAST(SUM(b.weight * b.stickers) as DECIMAL(10,0)) as loadedKg,
|
||||||
CAST(SUM(vc.aerealVolumetricDensity * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000) as DECIMAL(10,0)) as volumeKg
|
CAST(SUM(vc.aerealVolumetricDensity * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000) as DECIMAL(10,0)) as volumeKg
|
||||||
|
@ -161,6 +161,7 @@ module.exports = Self => {
|
||||||
e.travelFk,
|
e.travelFk,
|
||||||
e.ref,
|
e.ref,
|
||||||
e.loadPriority,
|
e.loadPriority,
|
||||||
|
s.id AS supplierFk,
|
||||||
s.name AS supplierName,
|
s.name AS supplierName,
|
||||||
SUM(b.stickers) AS stickers,
|
SUM(b.stickers) AS stickers,
|
||||||
e.evaNotes,
|
e.evaNotes,
|
||||||
|
|
|
@ -50,15 +50,15 @@
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
<vn-autocomplete vn-one
|
<vn-autocomplete vn-one
|
||||||
label="Warehouse In"
|
label="Warehouse Out"
|
||||||
ng-model="filter.warehouseInFk"
|
ng-model="filter.warehouseOutFk"
|
||||||
url="Warehouses"
|
url="Warehouses"
|
||||||
show-field="name"
|
show-field="name"
|
||||||
value-field="id">
|
value-field="id">
|
||||||
</vn-autocomplete>
|
</vn-autocomplete>
|
||||||
<vn-autocomplete vn-one
|
<vn-autocomplete vn-one
|
||||||
label="Warehouse Out"
|
label="Warehouse In"
|
||||||
ng-model="filter.warehouseOutFk"
|
ng-model="filter.warehouseInFk"
|
||||||
url="Warehouses"
|
url="Warehouses"
|
||||||
show-field="name"
|
show-field="name"
|
||||||
value-field="id">
|
value-field="id">
|
||||||
|
@ -84,4 +84,4 @@
|
||||||
<vn-submit label="Search"></vn-submit>
|
<vn-submit label="Search"></vn-submit>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<vn-crud-model
|
<vn-crud-model
|
||||||
vn-id="model"
|
vn-id="model"
|
||||||
url="Travels/extraCommunityFilter"
|
url="Travels/extraCommunityFilter"
|
||||||
|
filter="::$ctrl.filter"
|
||||||
data="travels"
|
data="travels"
|
||||||
order="shipped ASC, landed ASC, travelFk, loadPriority, agencyModeFk, evaNotes"
|
order="shipped ASC, landed ASC, travelFk, loadPriority, agencyModeFk, evaNotes"
|
||||||
limit="20"
|
limit="20"
|
||||||
|
@ -18,112 +19,174 @@
|
||||||
model="model">
|
model="model">
|
||||||
</vn-searchbar>
|
</vn-searchbar>
|
||||||
</vn-portal>
|
</vn-portal>
|
||||||
<vn-data-viewer model="model" class="travel-list">
|
<vn-card class="travel-list scrollable">
|
||||||
<vn-card>
|
<smart-table
|
||||||
<section class="vn-pa-md">
|
model="model"
|
||||||
<vn-tool-bar class="vn-mb-md">
|
options="$ctrl.smartTableOptions">
|
||||||
<vn-button disabled="!$ctrl.hasDateRange"
|
<slot-actions>
|
||||||
icon="picture_as_pdf"
|
<section>
|
||||||
ng-click="$ctrl.showReport()"
|
<vn-tool-bar class="vn-mb-md">
|
||||||
vn-tooltip="Open as PDF">
|
<vn-button
|
||||||
</vn-button>
|
disabled="!$ctrl.hasDateRange"
|
||||||
</vn-tool-bar>
|
icon="picture_as_pdf"
|
||||||
<vn-table>
|
ng-click="$ctrl.showReport()"
|
||||||
<vn-thead>
|
vn-tooltip="Open as PDF">
|
||||||
<vn-tr>
|
</vn-button>
|
||||||
<vn-th shrink>Id</vn-th>
|
</vn-tool-bar>
|
||||||
<vn-th expand>Supplier</vn-th>
|
</section>
|
||||||
<vn-th expand>Freighter</vn-th>
|
</slot-actions>
|
||||||
<vn-th>Reference</vn-th>
|
<slot-table>
|
||||||
<vn-th number>Packages</vn-th>
|
<table>
|
||||||
<vn-th number>Bl. KG</vn-th>
|
<thead>
|
||||||
<vn-th number>Phy. KG</vn-th>
|
<tr>
|
||||||
<vn-th number>Vol. KG</vn-th>
|
<th field="id" shrink>
|
||||||
<vn-th expand translate-attr="{title: 'Warehouse Out'}">
|
<span translate>Id</span>
|
||||||
Wh. Out
|
</th>
|
||||||
</vn-th>
|
<th field="cargoSupplierFk" expand>
|
||||||
<vn-th expand>W. Shipped</vn-th>
|
<span translate>Supplier</span>
|
||||||
<vn-th expand translate-attr="{title: 'Warehouse In'}">
|
</th>
|
||||||
Wh. In
|
<th field="agencyModeFk" expand>
|
||||||
</vn-th>
|
<span translate>Agency</span>
|
||||||
<vn-th expand>W. Landed</vn-th>
|
</th>
|
||||||
</vn-tr>
|
<th field="ref">
|
||||||
</vn-thead>
|
<span translate>Reference</span>
|
||||||
<vn-tbody ng-repeat="travel in travels" class="vn-mb-md" vn-droppable="$ctrl.onDrop($event)" ng-attr-id="{{::travel.id}}">
|
</th>
|
||||||
<vn-tr class="header">
|
<th field="stickers" number>
|
||||||
<vn-td>
|
<span translate>Packages</span>
|
||||||
<span class="link"
|
</th>
|
||||||
|
<th field="kg" number>
|
||||||
|
<span translate>Bl. KG</span>
|
||||||
|
</th>
|
||||||
|
<th field="loadedKg" number>
|
||||||
|
<span translate>Phy. KG</span>
|
||||||
|
</th>
|
||||||
|
<th field="volumeKg" number>
|
||||||
|
<span translate>Vol. KG</span>
|
||||||
|
</th>
|
||||||
|
<th
|
||||||
|
field="warehouseOutFk"
|
||||||
|
translate-attr="{title: 'Warehouse Out'}">
|
||||||
|
<span translate>Wh. Out</span>
|
||||||
|
</th>
|
||||||
|
<th field="shipped">
|
||||||
|
<span translate>W. Shipped</span>
|
||||||
|
</th>
|
||||||
|
<th
|
||||||
|
field="warehouseInFk"
|
||||||
|
translate-attr="{title: 'Warehouse In'}">
|
||||||
|
<span translate>Wh. In</span>
|
||||||
|
</th>
|
||||||
|
<th field="landed">
|
||||||
|
<span translate>W. Landed</span>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody
|
||||||
|
ng-repeat="travel in travels"
|
||||||
|
class="vn-mb-md"
|
||||||
|
vn-droppable="$ctrl.onDrop($event)"
|
||||||
|
ng-attr-id="{{::travel.id}}"
|
||||||
|
vn-stop-click>
|
||||||
|
<tr
|
||||||
|
class="header"
|
||||||
|
vn-anchor="::{
|
||||||
|
state: 'travel.card.basicData',
|
||||||
|
params: {id: travel.id}
|
||||||
|
}">
|
||||||
|
<td vn-click-stop>
|
||||||
|
<span
|
||||||
|
class="link"
|
||||||
ng-click="travelDescriptor.show($event, travel.id)">
|
ng-click="travelDescriptor.show($event, travel.id)">
|
||||||
{{::travel.id}}
|
{{::travel.id}}
|
||||||
</span>
|
</span>
|
||||||
</vn-td>
|
</td>
|
||||||
<vn-td expand>{{::travel.agencyModeName}}</vn-td>
|
<td expand vn-click-stop>
|
||||||
<vn-td expand>{{::travel.cargoSupplierNickname}}</vn-td>
|
<span
|
||||||
<vn-td-editable name="reference" expand>
|
class="link"
|
||||||
<text>{{travel.ref}}</text>
|
ng-click="supplierDescriptor.show($event, travel.cargoSupplierFk)">
|
||||||
<field>
|
{{::travel.cargoSupplierNickname}}
|
||||||
<vn-textfield class="dense" vn-focus
|
</span>
|
||||||
ng-model="travel.ref"
|
</td>
|
||||||
on-change="$ctrl.save(travel.id, {ref: value})">
|
<td expand>{{::travel.agencyModeName}}</td>
|
||||||
</vn-textfield>
|
<td
|
||||||
</field>
|
name="reference"
|
||||||
</vn-td-editable>
|
expand
|
||||||
<vn-td number>{{::travel.stickers}}</vn-td>
|
vn-click-stop>
|
||||||
<vn-td-editable name="lockedKg" expand style="text-align: right">
|
<vn-textfield
|
||||||
<text number>{{travel.kg}}</text>
|
class="dense td-editable"
|
||||||
<field>
|
ng-model="travel.ref"
|
||||||
<vn-input-number class="dense" vn-focus
|
on-change="$ctrl.save(travel.id, {ref: value})">
|
||||||
ng-model="travel.kg"
|
</vn-textfield>
|
||||||
on-change="$ctrl.save(travel.id, {kg: value})"
|
</vn-icon>
|
||||||
min="0">
|
</td>
|
||||||
</vn-input-number>
|
<td number>{{::travel.stickers}}</td>
|
||||||
</field>
|
<td
|
||||||
</vn-td-editable>
|
name="lockedKg"
|
||||||
<vn-td number>{{::travel.loadedKg}}</vn-td>
|
expand
|
||||||
<vn-td number>{{::travel.volumeKg}}</vn-td>
|
vn-click-stop>
|
||||||
<vn-td expand>{{::travel.warehouseOutName}}</vn-td>
|
<vn-input-number
|
||||||
<vn-td expand>{{::travel.shipped | date: 'dd/MM/yyyy'}}</vn-td>
|
number
|
||||||
<vn-td expand>{{::travel.warehouseInName}}</vn-td>
|
class="td-editable number"
|
||||||
<vn-td expand>{{::travel.landed | date: 'dd/MM/yyyy'}}</vn-td>
|
ng-model="travel.kg"
|
||||||
</vn-tr>
|
on-change="$ctrl.save(travel.id, {kg: value})"
|
||||||
<a href="#" ng-repeat="entry in travel.entries" class="vn-tr" draggable
|
min="0">
|
||||||
|
</vn-input-number>
|
||||||
|
</td>
|
||||||
|
<td number>{{::travel.loadedKg}}</td>
|
||||||
|
<td number>{{::travel.volumeKg}}</td>
|
||||||
|
<td expand>{{::travel.warehouseOutName}}</td>
|
||||||
|
<td expand>{{::travel.shipped | date: 'dd/MM/yyyy'}}</td>
|
||||||
|
<td expand>{{::travel.warehouseInName}}</td>
|
||||||
|
<td expand>{{::travel.landed | date: 'dd/MM/yyyy'}}</td>
|
||||||
|
</tr>
|
||||||
|
<tr
|
||||||
|
ng-repeat="entry in travel.entries"
|
||||||
|
draggable
|
||||||
ng-attr-id="{{::entry.id}}"
|
ng-attr-id="{{::entry.id}}"
|
||||||
ng-click="$event.preventDefault()">
|
ng-click="$event.preventDefault()">
|
||||||
<vn-td>
|
<td>
|
||||||
<span class="link"
|
<span class="link"
|
||||||
ng-click="entryDescriptor.show($event, entry.id)">
|
ng-click="entryDescriptor.show($event, entry.id)">
|
||||||
{{::entry.id}}
|
{{::entry.id}}
|
||||||
</span>
|
</span>
|
||||||
</vn-td>
|
</td>
|
||||||
<vn-td>{{::entry.supplierName}}</vn-td>
|
<td>
|
||||||
<vn-td></vn-td>
|
<span
|
||||||
<vn-td expand>{{::entry.ref}}</vn-td>
|
class="link"
|
||||||
<vn-td number>{{::entry.stickers}}</vn-td>
|
ng-click="supplierDescriptor.show($event, entry.supplierFk)">
|
||||||
<vn-td number></vn-td>
|
{{::entry.supplierName}}
|
||||||
<vn-td number>{{::entry.loadedkg}}</vn-td>
|
</span>
|
||||||
<vn-td number>{{::entry.volumeKg}}</vn-td>
|
</td>
|
||||||
<vn-td>
|
<td></td>
|
||||||
|
<td expand>{{::entry.ref}}</td>
|
||||||
|
<td number>{{::entry.stickers}}</td>
|
||||||
|
<td number></td>
|
||||||
|
<td number>{{::entry.loadedkg}}</td>
|
||||||
|
<td number>{{::entry.volumeKg}}</td>
|
||||||
|
<td>
|
||||||
<span ng-if="::entry.notes" vn-tooltip="{{::entry.notes}}">
|
<span ng-if="::entry.notes" vn-tooltip="{{::entry.notes}}">
|
||||||
{{::entry.notes}}
|
{{::entry.notes}}
|
||||||
</span>
|
</span>
|
||||||
</vn-td>
|
</td>
|
||||||
<vn-td>
|
<td>
|
||||||
<span ng-if="::entry.evaNotes" vn-tooltip="{{::entry.evaNotes}}">
|
<span ng-if="::entry.evaNotes" vn-tooltip="{{::entry.evaNotes}}">
|
||||||
{{::entry.evaNotes}}
|
{{::entry.evaNotes}}
|
||||||
</span>
|
</span>
|
||||||
</vn-td>
|
</td>
|
||||||
<vn-td></vn-td>
|
<td></td>
|
||||||
<vn-td></vn-td>
|
<td></td>
|
||||||
</a>
|
</tr>
|
||||||
</vn-tbody>
|
</tbody>
|
||||||
</vn-table>
|
</table>
|
||||||
</section>
|
</slot-table>
|
||||||
</vn-card>
|
</smart-table>
|
||||||
</vn-data-viewer>
|
</vn-card>
|
||||||
<vn-travel-descriptor-popover
|
<vn-travel-descriptor-popover
|
||||||
vn-id="travelDescriptor">
|
vn-id="travelDescriptor">
|
||||||
</vn-travel-descriptor-popover>
|
</vn-travel-descriptor-popover>
|
||||||
<vn-entry-descriptor-popover
|
<vn-entry-descriptor-popover
|
||||||
vn-id="entryDescriptor">
|
vn-id="entryDescriptor">
|
||||||
</vn-entry-descriptor-popover>
|
</vn-entry-descriptor-popover>
|
||||||
|
<vn-supplier-descriptor-popover
|
||||||
|
vn-id="supplierDescriptor">
|
||||||
|
</vn-supplier-descriptor-popover>
|
||||||
|
|
|
@ -14,8 +14,15 @@ class Controller extends Section {
|
||||||
draggable.addEventListener('dragend',
|
draggable.addEventListener('dragend',
|
||||||
event => this.dragEnd(event));
|
event => this.dragEnd(event));
|
||||||
|
|
||||||
this.draggableElement = 'a[draggable]';
|
draggable.addEventListener('dragover',
|
||||||
this.droppableElement = 'vn-tbody[vn-droppable]';
|
event => this.dragOver(event));
|
||||||
|
draggable.addEventListener('dragenter',
|
||||||
|
event => this.dragEnter(event));
|
||||||
|
draggable.addEventListener('dragleave',
|
||||||
|
event => this.dragLeave(event));
|
||||||
|
|
||||||
|
this.draggableElement = 'tr[draggable]';
|
||||||
|
this.droppableElement = 'tbody[vn-droppable]';
|
||||||
|
|
||||||
const twoDays = 2;
|
const twoDays = 2;
|
||||||
const shippedFrom = new Date();
|
const shippedFrom = new Date();
|
||||||
|
@ -32,6 +39,8 @@ class Controller extends Section {
|
||||||
landedTo: landedTo,
|
landedTo: landedTo,
|
||||||
continent: 'AM'
|
continent: 'AM'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.smartTableOptions = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
get hasDateRange() {
|
get hasDateRange() {
|
||||||
|
@ -44,6 +53,15 @@ class Controller extends Section {
|
||||||
return hasLanded || hasShipped || hasContinent || hasWarehouseOut;
|
return hasLanded || hasShipped || hasContinent || hasWarehouseOut;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onDragInterval() {
|
||||||
|
if (this.dragClientY > 0 && this.dragClientY < 75)
|
||||||
|
this.$window.scrollTo(0, this.$window.scrollY - 10);
|
||||||
|
|
||||||
|
const maxHeight = window.screen.availHeight - (window.outerHeight - window.innerHeight);
|
||||||
|
if (this.dragClientY > maxHeight - 75 && this.dragClientY < maxHeight)
|
||||||
|
this.$window.scrollTo(0, this.$window.scrollY + 10);
|
||||||
|
}
|
||||||
|
|
||||||
findDraggable($event) {
|
findDraggable($event) {
|
||||||
const target = $event.target;
|
const target = $event.target;
|
||||||
const draggable = target.closest(this.draggableElement);
|
const draggable = target.closest(this.draggableElement);
|
||||||
|
@ -65,6 +83,7 @@ class Controller extends Section {
|
||||||
const id = parseInt(draggable.id);
|
const id = parseInt(draggable.id);
|
||||||
this.entryId = id;
|
this.entryId = id;
|
||||||
this.entry = draggable;
|
this.entry = draggable;
|
||||||
|
this.interval = setInterval(() => this.onDragInterval(), 50);
|
||||||
}
|
}
|
||||||
|
|
||||||
dragEnd($event) {
|
dragEnd($event) {
|
||||||
|
@ -72,6 +91,8 @@ class Controller extends Section {
|
||||||
draggable.classList.remove('dragging');
|
draggable.classList.remove('dragging');
|
||||||
this.entryId = null;
|
this.entryId = null;
|
||||||
this.entry = null;
|
this.entry = null;
|
||||||
|
|
||||||
|
clearInterval(this.interval);
|
||||||
}
|
}
|
||||||
|
|
||||||
onDrop($event) {
|
onDrop($event) {
|
||||||
|
@ -91,6 +112,37 @@ class Controller extends Section {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
undrop() {
|
||||||
|
if (!this.dropping) return;
|
||||||
|
this.dropping.classList.remove('dropping');
|
||||||
|
this.dropping = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
dragOver($event) {
|
||||||
|
this.dragClientY = $event.clientY;
|
||||||
|
$event.preventDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
dragEnter($event) {
|
||||||
|
let element = this.findDroppable($event);
|
||||||
|
if (element) this.dropCount++;
|
||||||
|
|
||||||
|
if (element != this.dropping) {
|
||||||
|
this.undrop();
|
||||||
|
if (element) element.classList.add('dropping');
|
||||||
|
this.dropping = element;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dragLeave($event) {
|
||||||
|
let element = this.findDroppable($event);
|
||||||
|
|
||||||
|
if (element) {
|
||||||
|
this.dropCount--;
|
||||||
|
if (this.dropCount == 0) this.undrop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
save(id, data) {
|
save(id, data) {
|
||||||
const endpoint = `Travels/${id}`;
|
const endpoint = `Travels/${id}`;
|
||||||
this.$http.patch(endpoint, data)
|
this.$http.patch(endpoint, data)
|
||||||
|
|
|
@ -27,7 +27,7 @@ describe('Travel Component vnTravelExtraCommunity', () => {
|
||||||
|
|
||||||
describe('findDraggable()', () => {
|
describe('findDraggable()', () => {
|
||||||
it('should find the draggable element', () => {
|
it('should find the draggable element', () => {
|
||||||
const draggable = document.createElement('a');
|
const draggable = document.createElement('tr');
|
||||||
draggable.setAttribute('draggable', true);
|
draggable.setAttribute('draggable', true);
|
||||||
|
|
||||||
const $event = new Event('dragstart');
|
const $event = new Event('dragstart');
|
||||||
|
@ -43,7 +43,7 @@ describe('Travel Component vnTravelExtraCommunity', () => {
|
||||||
|
|
||||||
describe('findDroppable()', () => {
|
describe('findDroppable()', () => {
|
||||||
it('should find the droppable element', () => {
|
it('should find the droppable element', () => {
|
||||||
const droppable = document.createElement('vn-tbody');
|
const droppable = document.createElement('tbody');
|
||||||
droppable.setAttribute('vn-droppable', true);
|
droppable.setAttribute('vn-droppable', true);
|
||||||
|
|
||||||
const $event = new Event('drop');
|
const $event = new Event('drop');
|
||||||
|
@ -58,9 +58,9 @@ describe('Travel Component vnTravelExtraCommunity', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('dragStart()', () => {
|
describe('dragStart()', () => {
|
||||||
it(`should add the class "dragging" to the draggable element
|
it(`should add the class "dragging" to the draggable element
|
||||||
and then set the entryId controller property`, () => {
|
and then set the entryId controller property`, () => {
|
||||||
const draggable = document.createElement('a');
|
const draggable = document.createElement('tr');
|
||||||
draggable.setAttribute('draggable', true);
|
draggable.setAttribute('draggable', true);
|
||||||
draggable.setAttribute('id', 3);
|
draggable.setAttribute('id', 3);
|
||||||
|
|
||||||
|
@ -78,9 +78,9 @@ describe('Travel Component vnTravelExtraCommunity', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('dragEnd()', () => {
|
describe('dragEnd()', () => {
|
||||||
it(`should remove the class "dragging" from the draggable element
|
it(`should remove the class "dragging" from the draggable element
|
||||||
and then set the entryId controller property to null`, () => {
|
and then set the entryId controller property to null`, () => {
|
||||||
const draggable = document.createElement('a');
|
const draggable = document.createElement('tr');
|
||||||
draggable.setAttribute('draggable', true);
|
draggable.setAttribute('draggable', true);
|
||||||
draggable.setAttribute('id', 3);
|
draggable.setAttribute('id', 3);
|
||||||
draggable.classList.add('dragging');
|
draggable.classList.add('dragging');
|
||||||
|
@ -100,13 +100,13 @@ describe('Travel Component vnTravelExtraCommunity', () => {
|
||||||
|
|
||||||
describe('onDrop()', () => {
|
describe('onDrop()', () => {
|
||||||
it('should make an HTTP patch query', () => {
|
it('should make an HTTP patch query', () => {
|
||||||
const droppable = document.createElement('vn-tbody');
|
const droppable = document.createElement('tbody');
|
||||||
droppable.setAttribute('vn-droppable', true);
|
droppable.setAttribute('vn-droppable', true);
|
||||||
droppable.setAttribute('id', 1);
|
droppable.setAttribute('id', 1);
|
||||||
|
|
||||||
jest.spyOn(controller, 'findDroppable').mockReturnValue(droppable);
|
jest.spyOn(controller, 'findDroppable').mockReturnValue(droppable);
|
||||||
|
|
||||||
const oldDroppable = document.createElement('vn-tbody');
|
const oldDroppable = document.createElement('tbody');
|
||||||
oldDroppable.setAttribute('vn-droppable', true);
|
oldDroppable.setAttribute('vn-droppable', true);
|
||||||
const entry = document.createElement('div');
|
const entry = document.createElement('div');
|
||||||
oldDroppable.appendChild(entry);
|
oldDroppable.appendChild(entry);
|
||||||
|
|
|
@ -15,41 +15,44 @@ vn-travel-extra-community {
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
vn-td-editable text {
|
table[vn-droppable] {
|
||||||
background-color: transparent;
|
|
||||||
padding: 0;
|
|
||||||
border: 0;
|
|
||||||
border-bottom: 1px dashed $color-active;
|
|
||||||
border-radius: 0;
|
|
||||||
color: $color-active
|
|
||||||
}
|
|
||||||
|
|
||||||
vn-td-editable:hover text:after {
|
|
||||||
font-family: 'Material Icons';
|
|
||||||
content: 'edit';
|
|
||||||
position: absolute;
|
|
||||||
right: -15px;
|
|
||||||
color: $color-spacer
|
|
||||||
}
|
|
||||||
|
|
||||||
vn-table[vn-droppable] {
|
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
a[draggable] {
|
tr[draggable] {
|
||||||
transition: all .5s;
|
transition: all .5s;
|
||||||
cursor: move;
|
cursor: move;
|
||||||
|
overflow: auto;
|
||||||
outline: 0;
|
outline: 0;
|
||||||
|
height: 65px;
|
||||||
|
pointer-events: fill;
|
||||||
|
user-select:all;
|
||||||
}
|
}
|
||||||
|
|
||||||
a[draggable]:hover {
|
tr[draggable] *::selection{
|
||||||
background-color: $color-hover-cd
|
background-color: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
a[draggable].dragging {
|
tr[draggable]:hover {
|
||||||
background-color: $color-success-light;
|
background-color: $color-hover-cd;
|
||||||
font-weight:bold
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
tr[draggable].dragging {
|
||||||
|
background-color: $color-primary-light;
|
||||||
|
color: $color-font-light;
|
||||||
|
font-weight:bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.td-editable{
|
||||||
|
input{
|
||||||
|
font-size: 1.25rem!important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.number *{
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ describe('Worker absences()', () => {
|
||||||
const worker = await app.models.WorkerLabour.findById(businessId, null, options);
|
const worker = await app.models.WorkerLabour.findById(businessId, null, options);
|
||||||
|
|
||||||
await app.models.WorkerLabour.rawSql(
|
await app.models.WorkerLabour.rawSql(
|
||||||
`UPDATE postgresql.business SET date_end = ? WHERE business_id = ?`,
|
`UPDATE vn.business SET ended = ? WHERE id = ?`,
|
||||||
[null, worker.businessFk], options);
|
[null, worker.businessFk], options);
|
||||||
|
|
||||||
const [absences] = await app.models.Calendar.absences(ctx, worker.id, businessId, year, options);
|
const [absences] = await app.models.Calendar.absences(ctx, worker.id, businessId, year, options);
|
||||||
|
@ -98,7 +98,7 @@ describe('Worker absences()', () => {
|
||||||
startingContract.setDate(1);
|
startingContract.setDate(1);
|
||||||
|
|
||||||
await app.models.WorkerLabour.rawSql(
|
await app.models.WorkerLabour.rawSql(
|
||||||
`UPDATE postgresql.business SET date_start = ?, date_end = ? WHERE business_id = ?`,
|
`UPDATE vn.business SET started = ?, ended = ? WHERE id = ?`,
|
||||||
[startingContract, yearEnd, contract.businessFk], options
|
[startingContract, yearEnd, contract.businessFk], options
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ module.exports = Self => {
|
||||||
},
|
},
|
||||||
http: {
|
http: {
|
||||||
path: `/checkInbox`,
|
path: `/checkInbox`,
|
||||||
verb: 'GET'
|
verb: 'POST'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -58,8 +58,8 @@ module.exports = Self => {
|
||||||
emailBody = bufferCopy.toUpperCase().trim();
|
emailBody = bufferCopy.toUpperCase().trim();
|
||||||
|
|
||||||
const bodyPositionOK = emailBody.match(/\bOK\b/i);
|
const bodyPositionOK = emailBody.match(/\bOK\b/i);
|
||||||
|
const bodyPositionIndex = (bodyPositionOK.index == 0 || bodyPositionOK.index == 122);
|
||||||
if (bodyPositionOK != null && (bodyPositionOK.index == 0 || bodyPositionOK.index == 122))
|
if (bodyPositionOK != null && bodyPositionIndex)
|
||||||
isEmailOk = true;
|
isEmailOk = true;
|
||||||
else
|
else
|
||||||
isEmailOk = false;
|
isEmailOk = false;
|
||||||
|
|
|
@ -65,9 +65,9 @@ module.exports = Self => {
|
||||||
if (args.dated < labour.started || (labour.ended != null && args.dated > labour.ended))
|
if (args.dated < labour.started || (labour.ended != null && args.dated > labour.ended))
|
||||||
throw new UserError(`The contract was not active during the selected date`);
|
throw new UserError(`The contract was not active during the selected date`);
|
||||||
|
|
||||||
query = `SELECT *
|
query = `SELECT *
|
||||||
FROM vn.workerTimeControl
|
FROM vn.workerTimeControl
|
||||||
WHERE userFk = ? AND timed BETWEEN DATE(?) AND CONCAT(DATE(?), ' 23:59:59')
|
WHERE userFk = ? AND timed BETWEEN DATE(?) AND CONCAT(DATE(?), ' 23:59:59')
|
||||||
LIMIT 1;`;
|
LIMIT 1;`;
|
||||||
const [hasHoursRecorded] = await Self.rawSql(query, [id, args.dated, args.dated]);
|
const [hasHoursRecorded] = await Self.rawSql(query, [id, args.dated, args.dated]);
|
||||||
|
|
||||||
|
@ -85,12 +85,11 @@ module.exports = Self => {
|
||||||
date.setHours(0, 0, 0, 0);
|
date.setHours(0, 0, 0, 0);
|
||||||
const [result] = await Self.rawSql(
|
const [result] = await Self.rawSql(
|
||||||
`SELECT COUNT(*) halfHolidayCounter
|
`SELECT COUNT(*) halfHolidayCounter
|
||||||
FROM vn.calendar c
|
FROM vn.calendar c
|
||||||
JOIN postgresql.business b ON b.business_id = c.businessFk
|
JOIN vn.business b ON b.id = c.businessFk
|
||||||
JOIN postgresql.profile p ON p.profile_id = b.client_id
|
WHERE c.dayOffTypeFk = 6
|
||||||
WHERE c.dayOffTypeFk = 6
|
AND b.workerFk = ?
|
||||||
AND p.workerFk = ?
|
AND c.dated BETWEEN util.firstDayOfYear(?)
|
||||||
AND c.dated BETWEEN util.firstDayOfYear(?)
|
|
||||||
AND LAST_DAY(DATE_ADD(?, INTERVAL 12 - MONTH(?) MONTH))`, [id, date, now, now]);
|
AND LAST_DAY(DATE_ADD(?, INTERVAL 12 - MONTH(?) MONTH))`, [id, date, now, now]);
|
||||||
|
|
||||||
const hasHalfHoliday = result.halfHolidayCounter > 0;
|
const hasHalfHoliday = result.halfHolidayCounter > 0;
|
||||||
|
|
|
@ -20,9 +20,6 @@
|
||||||
"EducationLevel": {
|
"EducationLevel": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
"Sector": {
|
|
||||||
"dataSource": "vn"
|
|
||||||
},
|
|
||||||
"WorkCenter": {
|
"WorkCenter": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
{
|
|
||||||
"name": "Sector",
|
|
||||||
"base": "VnModel",
|
|
||||||
"options": {
|
|
||||||
"mysql": {
|
|
||||||
"table": "sector"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"properties": {
|
|
||||||
"id": {
|
|
||||||
"type": "number",
|
|
||||||
"id": true,
|
|
||||||
"description": "Identifier"
|
|
||||||
},
|
|
||||||
"description": {
|
|
||||||
"type": "string",
|
|
||||||
"required": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,6 +1,10 @@
|
||||||
{
|
{
|
||||||
"name": "ZoneExclusion",
|
"name": "ZoneExclusion",
|
||||||
"base": "VnModel",
|
"base": "Loggable",
|
||||||
|
"log": {
|
||||||
|
"model":"ZoneLog",
|
||||||
|
"relation": "zone"
|
||||||
|
},
|
||||||
"options": {
|
"options": {
|
||||||
"mysql": {
|
"mysql": {
|
||||||
"table": "zoneExclusion"
|
"table": "zoneExclusion"
|
||||||
|
|
|
@ -91,7 +91,7 @@
|
||||||
</vn-data-viewer>
|
</vn-data-viewer>
|
||||||
</vn-side-menu>
|
</vn-side-menu>
|
||||||
<vn-float-button
|
<vn-float-button
|
||||||
ng-click="$ctrl.create('weekday')"
|
ng-click="$ctrl.createInclusion('weekday')"
|
||||||
icon="add"
|
icon="add"
|
||||||
vn-tooltip="Add event"
|
vn-tooltip="Add event"
|
||||||
vn-bind="+"
|
vn-bind="+"
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
"i18n": "^0.8.4",
|
"i18n": "^0.8.4",
|
||||||
"image-type": "^4.1.0",
|
"image-type": "^4.1.0",
|
||||||
"imap": "^0.8.19",
|
"imap": "^0.8.19",
|
||||||
|
"jsdom": "^16.7.0",
|
||||||
"jszip": "^3.10.0",
|
"jszip": "^3.10.0",
|
||||||
"ldapjs": "^2.2.0",
|
"ldapjs": "^2.2.0",
|
||||||
"loopback": "^3.26.0",
|
"loopback": "^3.26.0",
|
||||||
|
|
|
@ -3,13 +3,22 @@ const closure = require('./closure');
|
||||||
|
|
||||||
module.exports = async function(request, response, next) {
|
module.exports = async function(request, response, next) {
|
||||||
try {
|
try {
|
||||||
const reqArgs = request.query;
|
const reqArgs = request.body;
|
||||||
if (!reqArgs.to)
|
|
||||||
throw new Error('The argument to is required');
|
|
||||||
|
|
||||||
response.status(200).json({
|
let toDate = new Date();
|
||||||
message: 'Success'
|
toDate.setDate(toDate.getDate() - 1);
|
||||||
});
|
|
||||||
|
if (reqArgs.to) toDate = reqArgs.to;
|
||||||
|
|
||||||
|
const todayMinDate = new Date();
|
||||||
|
minDate.setHours(0, 0, 0, 0);
|
||||||
|
|
||||||
|
const todayMaxDate = new Date();
|
||||||
|
maxDate.setHours(23, 59, 59, 59);
|
||||||
|
|
||||||
|
// Prevent closure for current day
|
||||||
|
if (toDate >= todayMinDate && toDate <= todayMaxDate)
|
||||||
|
throw new Error('You cannot close tickets for today');
|
||||||
|
|
||||||
const tickets = await db.rawSql(`
|
const tickets = await db.rawSql(`
|
||||||
SELECT
|
SELECT
|
||||||
|
@ -36,7 +45,7 @@ module.exports = async function(request, response, next) {
|
||||||
AND DATE(t.shipped) BETWEEN DATE_ADD(?, INTERVAL -2 DAY)
|
AND DATE(t.shipped) BETWEEN DATE_ADD(?, INTERVAL -2 DAY)
|
||||||
AND util.dayEnd(?)
|
AND util.dayEnd(?)
|
||||||
AND t.refFk IS NULL
|
AND t.refFk IS NULL
|
||||||
GROUP BY t.id`, [reqArgs.to, reqArgs.to]);
|
GROUP BY t.id`, [toDate, toDate]);
|
||||||
|
|
||||||
await closure.start(tickets, response.locals);
|
await closure.start(tickets, response.locals);
|
||||||
|
|
||||||
|
@ -52,7 +61,11 @@ module.exports = async function(request, response, next) {
|
||||||
AND util.dayEnd(?)
|
AND util.dayEnd(?)
|
||||||
AND al.code NOT IN('DELIVERED','PACKED')
|
AND al.code NOT IN('DELIVERED','PACKED')
|
||||||
AND t.routeFk
|
AND t.routeFk
|
||||||
AND z.name LIKE '%MADRID%'`, [reqArgs.to, reqArgs.to]);
|
AND z.name LIKE '%MADRID%'`, [toDate, toDate]);
|
||||||
|
|
||||||
|
response.status(200).json({
|
||||||
|
message: 'Success'
|
||||||
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
next(error);
|
next(error);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ const closure = require('./closure');
|
||||||
|
|
||||||
module.exports = async function(request, response, next) {
|
module.exports = async function(request, response, next) {
|
||||||
try {
|
try {
|
||||||
const reqArgs = request.query;
|
const reqArgs = request.body;
|
||||||
|
|
||||||
if (!reqArgs.agencyModeId)
|
if (!reqArgs.agencyModeId)
|
||||||
throw new Error('The argument agencyModeId is required');
|
throw new Error('The argument agencyModeId is required');
|
||||||
|
@ -14,10 +14,6 @@ module.exports = async function(request, response, next) {
|
||||||
if (!reqArgs.to)
|
if (!reqArgs.to)
|
||||||
throw new Error('The argument to is required');
|
throw new Error('The argument to is required');
|
||||||
|
|
||||||
response.status(200).json({
|
|
||||||
message: 'Success'
|
|
||||||
});
|
|
||||||
|
|
||||||
const agencyIds = reqArgs.agencyModeId.split(',');
|
const agencyIds = reqArgs.agencyModeId.split(',');
|
||||||
const tickets = await db.rawSql(`
|
const tickets = await db.rawSql(`
|
||||||
SELECT
|
SELECT
|
||||||
|
@ -53,6 +49,10 @@ module.exports = async function(request, response, next) {
|
||||||
]);
|
]);
|
||||||
|
|
||||||
await closure.start(tickets, response.locals);
|
await closure.start(tickets, response.locals);
|
||||||
|
|
||||||
|
response.status(200).json({
|
||||||
|
message: 'Success'
|
||||||
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
next(error);
|
next(error);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,15 +4,11 @@ const closure = require('./closure');
|
||||||
|
|
||||||
module.exports = async function(request, response, next) {
|
module.exports = async function(request, response, next) {
|
||||||
try {
|
try {
|
||||||
const reqArgs = request.query;
|
const reqArgs = request.body;
|
||||||
|
|
||||||
if (!reqArgs.routeId)
|
if (!reqArgs.routeId)
|
||||||
throw new Error('The argument routeId is required');
|
throw new Error('The argument routeId is required');
|
||||||
|
|
||||||
response.status(200).json({
|
|
||||||
message: 'Success'
|
|
||||||
});
|
|
||||||
|
|
||||||
const tickets = await db.rawSql(`
|
const tickets = await db.rawSql(`
|
||||||
SELECT
|
SELECT
|
||||||
t.id,
|
t.id,
|
||||||
|
@ -56,6 +52,10 @@ module.exports = async function(request, response, next) {
|
||||||
const email = new Email('driver-route', args);
|
const email = new Email('driver-route', args);
|
||||||
await email.send();
|
await email.send();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
response.status(200).json({
|
||||||
|
message: 'Success'
|
||||||
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
next(error);
|
next(error);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,15 +3,11 @@ const closure = require('./closure');
|
||||||
|
|
||||||
module.exports = async function(request, response, next) {
|
module.exports = async function(request, response, next) {
|
||||||
try {
|
try {
|
||||||
const reqArgs = request.query;
|
const reqArgs = request.body;
|
||||||
|
|
||||||
if (!reqArgs.ticketId)
|
if (!reqArgs.ticketId)
|
||||||
throw new Error('The argument ticketId is required');
|
throw new Error('The argument ticketId is required');
|
||||||
|
|
||||||
response.status(200).json({
|
|
||||||
message: 'Success'
|
|
||||||
});
|
|
||||||
|
|
||||||
const tickets = await db.rawSql(`
|
const tickets = await db.rawSql(`
|
||||||
SELECT
|
SELECT
|
||||||
t.id,
|
t.id,
|
||||||
|
@ -38,6 +34,10 @@ module.exports = async function(request, response, next) {
|
||||||
GROUP BY e.ticketFk`, [reqArgs.ticketId]);
|
GROUP BY e.ticketFk`, [reqArgs.ticketId]);
|
||||||
|
|
||||||
await closure.start(tickets, response.locals);
|
await closure.start(tickets, response.locals);
|
||||||
|
|
||||||
|
response.status(200).json({
|
||||||
|
message: 'Success'
|
||||||
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
next(error);
|
next(error);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
const express = require('express');
|
const express = require('express');
|
||||||
const router = new express.Router();
|
const router = new express.Router();
|
||||||
|
|
||||||
router.get('/all', require('./closeAll'));
|
router.post('/all', require('./closeAll'));
|
||||||
router.get('/by-ticket', require('./closeByTicket'));
|
router.post('/by-ticket', require('./closeByTicket'));
|
||||||
router.get('/by-agency', require('./closeByAgency'));
|
router.post('/by-agency', require('./closeByAgency'));
|
||||||
router.get('/by-route', require('./closeByRoute'));
|
router.post('/by-route', require('./closeByRoute'));
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
|
|
@ -5,6 +5,7 @@ SELECT
|
||||||
be.name AS bankName
|
be.name AS bankName
|
||||||
FROM client c
|
FROM client c
|
||||||
JOIN company AS cny
|
JOIN company AS cny
|
||||||
JOIN supplierAccount AS sa ON sa.id = cny.supplierAccountFk
|
JOIN supplierAccount AS sa ON
|
||||||
|
IF (ct.code = 'PT', sa.id = 907, sa.id = cny.supplierAccountFk)
|
||||||
JOIN bankEntity be ON be.id = sa.bankEntityFk
|
JOIN bankEntity be ON be.id = sa.bankEntityFk
|
||||||
WHERE c.id = ? AND cny.id = ?
|
WHERE c.id = ? AND cny.id = ?
|
|
@ -5,6 +5,7 @@ SELECT
|
||||||
be.name AS bankName
|
be.name AS bankName
|
||||||
FROM client c
|
FROM client c
|
||||||
JOIN company AS cny
|
JOIN company AS cny
|
||||||
JOIN supplierAccount AS sa ON sa.id = cny.supplierAccountFk
|
JOIN supplierAccount AS sa ON
|
||||||
|
IF (ct.code = 'PT', sa.id = 907, sa.id = cny.supplierAccountFk)
|
||||||
JOIN bankEntity be ON be.id = sa.bankEntityFk
|
JOIN bankEntity be ON be.id = sa.bankEntityFk
|
||||||
WHERE c.id = ? AND cny.id = ?
|
WHERE c.id = ? AND cny.id = ?
|
|
@ -0,0 +1,9 @@
|
||||||
|
const Stylesheet = require(`${appPath}/core/stylesheet`);
|
||||||
|
|
||||||
|
module.exports = new Stylesheet([
|
||||||
|
`${appPath}/common/css/spacing.css`,
|
||||||
|
`${appPath}/common/css/misc.css`,
|
||||||
|
`${appPath}/common/css/layout.css`,
|
||||||
|
`${appPath}/common/css/report.css`,
|
||||||
|
`${__dirname}/style.css`])
|
||||||
|
.mergeStyles();
|
|
@ -0,0 +1,19 @@
|
||||||
|
.column-oriented {
|
||||||
|
margin-top: 50px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bottom-line > tr {
|
||||||
|
border-bottom: 1px solid #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bottom-line tr:nth-last-child() {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-info {
|
||||||
|
font-size: 20px
|
||||||
|
}
|
||||||
|
|
||||||
|
.description strong {
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
title: Expiración Tarjetas Vehículos
|
||||||
|
Plate: Matrícula
|
||||||
|
Concept: Concepto
|
||||||
|
expirationDate: Fecha caducidad
|
|
@ -0,0 +1,7 @@
|
||||||
|
SELECT
|
||||||
|
v.numberPlate,
|
||||||
|
ve.description,
|
||||||
|
ve.finished
|
||||||
|
FROM vehicleEvent ve
|
||||||
|
JOIN vehicle v ON v.id = ve.vehicleFk
|
||||||
|
WHERE ve.id IN (?)
|
|
@ -0,0 +1,39 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html v-bind:lang="$i18n.locale">
|
||||||
|
<body>
|
||||||
|
<table class="grid">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<!-- Header block -->
|
||||||
|
<report-header v-bind="$props"></report-header>
|
||||||
|
<!-- Block -->
|
||||||
|
<div class="grid-row">
|
||||||
|
<div class="grid-block">
|
||||||
|
<div class="content">
|
||||||
|
<h1 class="title centered uppercase">{{$t('title')}}</h1>
|
||||||
|
</div>
|
||||||
|
<table class="column-oriented">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>{{$t('Plate')}}</th>
|
||||||
|
<th>{{$t('Concept')}}</th>
|
||||||
|
<th>{{$t('expirationDate')}}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody v-for="vehicleEvent in vehicleEvents">
|
||||||
|
<tr>
|
||||||
|
<td>{{vehicleEvent.numberPlate}}</td>
|
||||||
|
<td>{{vehicleEvent.description}}</td>
|
||||||
|
<td>{{vehicleEvent.finished | date('%d-%m-%Y')}}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,28 @@
|
||||||
|
const Component = require(`${appPath}/core/component`);
|
||||||
|
const reportHeader = new Component('report-header');
|
||||||
|
const reportFooter = new Component('report-footer');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: 'vehicle-event-expired',
|
||||||
|
async serverPrefetch() {
|
||||||
|
this.vehicleEvents = await this.fetchVehicleEvent(this.eventIds);
|
||||||
|
|
||||||
|
if (!this.vehicleEvents)
|
||||||
|
throw new Error('Something went wrong');
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
fetchVehicleEvent(vehicleEventIds) {
|
||||||
|
return this.rawSqlFromDef('vehicleEvents', [vehicleEventIds]);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
'report-header': reportHeader.build(),
|
||||||
|
'report-footer': reportFooter.build()
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
eventIds: {
|
||||||
|
type: [Array],
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
Loading…
Reference in New Issue