Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 4860-route.index_downloadZip
This commit is contained in:
commit
f7b314daf4
29
CHANGELOG.md
29
CHANGELOG.md
|
@ -5,20 +5,31 @@ All notable changes to this project will be documented in this file.
|
|||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [2302.01] - 2023-01-12
|
||||
## [2304.01] - 2023-02-09
|
||||
|
||||
### Added
|
||||
- [General](Inicio) Permite recuperar la contraseña
|
||||
- [Ticket](Opciones) Subir albarán a Docuware
|
||||
- [Ticket](Opciones) Enviar correo con PDF de Docuware
|
||||
- [Artículo](Datos Básicos) Añadido campo Unidades/Caja
|
||||
-
|
||||
|
||||
### Changed
|
||||
- [Reclamaciones](Descriptor) Cambiado el campo Agencia por Zona
|
||||
- [Tickets](Líneas preparadas) Actualizada sección para que sea más visual
|
||||
-
|
||||
|
||||
### Fixed
|
||||
- [General] Al utilizar el traductor de Google se descuadraban los iconos
|
||||
-
|
||||
|
||||
## [2302.01] - 2023-01-26
|
||||
|
||||
### Added
|
||||
- (General -> Inicio) Permite recuperar la contraseña
|
||||
- (Tickets -> Opciones) Subir albarán a Docuware
|
||||
- (Tickets -> Opciones) Enviar correo con PDF de Docuware
|
||||
- (Artículos -> Datos Básicos) Añadido campo Unidades/Caja
|
||||
|
||||
### Changed
|
||||
- (Reclamaciones -> Descriptor) Cambiado el campo Agencia por Zona
|
||||
- (Tickets -> Líneas preparadas) Actualizada sección para que sea más visual
|
||||
|
||||
### Fixed
|
||||
- (General) Al utilizar el traductor de Google se descuadraban los iconos
|
||||
|
||||
### Removed
|
||||
- [Tickets](Control clientes) Eliminada sección
|
||||
- (Tickets -> Control clientes) Eliminada sección
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
const {Report} = require('vn-print');
|
||||
|
||||
module.exports = Self => {
|
||||
Self.remoteMethodCtx('previousLabel', {
|
||||
description: 'Returns the previa label pdf',
|
||||
accessType: 'READ',
|
||||
accepts: [
|
||||
{
|
||||
arg: 'id',
|
||||
type: 'number',
|
||||
required: true,
|
||||
description: 'The item id',
|
||||
http: {source: 'path'}
|
||||
}],
|
||||
returns: [
|
||||
{
|
||||
arg: 'body',
|
||||
type: 'file',
|
||||
root: true
|
||||
}, {
|
||||
arg: 'Content-Type',
|
||||
type: 'String',
|
||||
http: {target: 'header'}
|
||||
}, {
|
||||
arg: 'Content-Disposition',
|
||||
type: 'String',
|
||||
http: {target: 'header'}
|
||||
}
|
||||
],
|
||||
http: {
|
||||
path: '/:id/previousLabel',
|
||||
verb: 'GET'
|
||||
}
|
||||
});
|
||||
|
||||
Self.previousLabel = async(ctx, id) => {
|
||||
const args = Object.assign({}, ctx.args);
|
||||
const params = {lang: ctx.req.getLocale()};
|
||||
|
||||
delete args.ctx;
|
||||
for (const param in args)
|
||||
params[param] = args[param];
|
||||
|
||||
const report = new Report('previa-label', params);
|
||||
const stream = await report.toPdfStream();
|
||||
|
||||
return [stream, 'application/pdf', `filename="previa-${id}.pdf"`];
|
||||
};
|
||||
};
|
|
@ -36,19 +36,26 @@ module.exports = Self => {
|
|||
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 AND ote.type = 'R'
|
||||
GROUP BY ote.thread_id
|
||||
SELECT sub2.thread_id, sub2.type, sub2.updated, sub2.created
|
||||
FROM (
|
||||
SELECT ote.thread_id, ote.created, ote.updated, ote.type
|
||||
FROM osticket.ost_thread_entry ote
|
||||
WHERE ote.staff_id
|
||||
ORDER BY ote.id DESC
|
||||
LIMIT 10000000000000000000) sub2
|
||||
GROUP BY sub2.thread_id
|
||||
) sub ON sub.thread_id = ot2.id
|
||||
WHERE ot.isanswered
|
||||
AND ots.state = ?
|
||||
AND IF(sub.updated > sub.created, sub.updated, sub.created) < DATE_SUB(CURDATE(), INTERVAL ? DAY)`;
|
||||
AND ots.id IN (?)
|
||||
AND sub.type = 'R'
|
||||
AND IF(sub.updated > sub.created, sub.updated, sub.created) < DATE_SUB(CURDATE(), INTERVAL ? DAY);`;
|
||||
|
||||
const ticketsId = [];
|
||||
const statusIdToClose = config.oldStatus.split(',');
|
||||
|
||||
con.connect(err => {
|
||||
if (err) throw err;
|
||||
con.query(sql, [config.oldStatus, config.day],
|
||||
con.query(sql, [statusIdToClose, config.day],
|
||||
(err, results) => {
|
||||
if (err) throw err;
|
||||
for (const result of results)
|
||||
|
|
|
@ -3,4 +3,5 @@ module.exports = Self => {
|
|||
require('../methods/collection/newCollection')(Self);
|
||||
require('../methods/collection/getSectors')(Self);
|
||||
require('../methods/collection/setSaleQuantity')(Self);
|
||||
require('../methods/collection/previousLabel')(Self);
|
||||
};
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
UPDATE `vn`.`collection`
|
||||
SET sectorFk=1
|
||||
WHERE id=1;
|
|
@ -0,0 +1,5 @@
|
|||
UPDATE `vn`.`osTicketConfig`
|
||||
SET oldStatus='1,6'
|
||||
WHERE id=0;
|
||||
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
ALTER TABLE `vn`.`itemPackingType` ADD isActive BOOLEAN NOT NULL;
|
||||
UPDATE `vn`.`itemPackingType` SET isActive = 0 WHERE code IN ('P', 'F');
|
||||
UPDATE `vn`.`itemPackingType` SET isActive = 1 WHERE code IN ('V', 'H');
|
|
@ -0,0 +1,6 @@
|
|||
ALTER TABLE `vn`.`workerTimeControlConfig` ADD teleworkingStart INT NULL COMMENT 'Hora comienzo jornada de los teletrabajdores expresada en segundos';
|
||||
ALTER TABLE `vn`.`workerTimeControlConfig` ADD teleworkingStartBreakTime INT NULL COMMENT 'Hora comienzo descanso de los teletrabjadores expresada en segundos';
|
||||
|
||||
UPDATE `vn`.`workerTimeControlConfig`
|
||||
SET `teleworkingStart`=28800, `teleworkingStartBreakTime`=32400
|
||||
WHERE `id`=1;
|
|
@ -1215,7 +1215,7 @@ INSERT INTO `vn`.`tag`(`id`, `code`, `name`, `isFree`, `isQuantitatif`, `sourceT
|
|||
(7, NULL, 'Ancho de la base', 1, 1, NULL, 'mm',NULL, NULL),
|
||||
(23, 'stems', 'Tallos', 1, 1, NULL, NULL, NULL, 'stems'),
|
||||
(27, NULL, 'Longitud(cm)', 1, 1, NULL, 'cm', NULL, NULL),
|
||||
(36, NULL, 'Proveedor', 1, 0, NULL, NULL, NULL, NULL),
|
||||
(36, 'producer', 'Proveedor', 1, 0, NULL, NULL, NULL, 'producer'),
|
||||
(56, NULL, 'Genero', 1, 0, NULL, NULL, NULL, NULL),
|
||||
(58, NULL, 'Variedad', 1, 0, NULL, NULL, NULL, NULL),
|
||||
(67, 'category', 'Categoria', 1, 0, NULL, NULL, NULL, NULL),
|
||||
|
@ -2667,9 +2667,9 @@ INSERT INTO `vn`.`sectorCollectionSaleGroup` (`sectorCollectionFk`, `saleGroupFk
|
|||
VALUES
|
||||
(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`, `teleworkingStart`, `teleworkingStartBreakTime`)
|
||||
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, 28800, 32400);
|
||||
|
||||
INSERT INTO `vn`.`host` (`id`, `code`, `description`, `warehouseFk`, `bankFk`)
|
||||
VALUES
|
||||
|
@ -2741,7 +2741,7 @@ INSERT INTO `vn`.`ticketLog` (`originFk`, userFk, `action`, changedModel, oldIns
|
|||
|
||||
INSERT INTO `vn`.`osTicketConfig` (`id`, `host`, `user`, `password`, `oldStatus`, `newStatusId`, `day`, `comment`, `hostDb`, `userDb`, `passwordDb`, `portDb`, `responseType`, `fromEmailId`, `replyTo`)
|
||||
VALUES
|
||||
(0, 'http://localhost:56596/scp', 'ostadmin', 'Admin1', 'open', 3, 60, 'Este CAU se ha cerrado automáticamente. Si el problema persiste responda a este mensaje.', 'localhost', 'osticket', 'osticket', 40003, 'reply', 1, 'all');
|
||||
(0, 'http://localhost:56596/scp', 'ostadmin', 'Admin1', '1,6', 3, 60, 'Este CAU se ha cerrado automáticamente. Si el problema persiste responda a este mensaje.', 'localhost', 'osticket', 'osticket', 40003, 'reply', 1, 'all');
|
||||
|
||||
INSERT INTO `vn`.`mdbApp` (`app`, `baselineBranchFk`, `userFk`, `locked`)
|
||||
VALUES
|
||||
|
|
|
@ -36,13 +36,13 @@
|
|||
ng-if="$ctrl.isAgricultural()"
|
||||
ng-click="$ctrl.showPdfInvoice()"
|
||||
translate>
|
||||
Show agricultural invoice as PDF
|
||||
Show agricultural receipt as PDF
|
||||
</vn-item>
|
||||
<vn-item
|
||||
ng-if="$ctrl.isAgricultural()"
|
||||
ng-click="sendPdfConfirmation.show({email: $ctrl.entity.supplierContact[0].email})"
|
||||
translate>
|
||||
Send agricultural invoice as PDF
|
||||
Send agricultural receipt as PDF
|
||||
</vn-item>
|
||||
</slot-menu>
|
||||
<slot-body>
|
||||
|
|
|
@ -19,6 +19,6 @@ To book: Contabilizar
|
|||
Total amount: Total importe
|
||||
Total net: Total neto
|
||||
Total stems: Total tallos
|
||||
Show agricultural invoice as PDF: Ver factura agrícola como PDF
|
||||
Send agricultural invoice as PDF: Enviar factura agrícola como PDF
|
||||
New InvoiceIn: Nueva Factura
|
||||
Show agricultural receipt as PDF: Ver recibo agrícola como PDF
|
||||
Send agricultural receipt as PDF: Enviar recibo agrícola como PDF
|
||||
New InvoiceIn: Nueva Factura
|
||||
|
|
|
@ -13,6 +13,9 @@
|
|||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"isActive":{
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"acls": [
|
||||
|
@ -23,4 +26,4 @@
|
|||
"permission": "ALLOW"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,10 @@ class Controller extends SearchPanel {
|
|||
|
||||
getItemPackingTypes() {
|
||||
let itemPackingTypes = [];
|
||||
this.$http.get('ItemPackingTypes').then(res => {
|
||||
const filter = {
|
||||
where: {isActive: true}
|
||||
};
|
||||
this.$http.get('ItemPackingTypes', {filter}).then(res => {
|
||||
for (let ipt of res.data) {
|
||||
itemPackingTypes.push({
|
||||
code: ipt.code,
|
||||
|
|
|
@ -39,6 +39,7 @@ export default class Controller extends Section {
|
|||
field: 'ipt',
|
||||
autocomplete: {
|
||||
url: 'ItemPackingTypes',
|
||||
where: `{isActive: true}`,
|
||||
showField: 'description',
|
||||
valueField: 'code'
|
||||
}
|
||||
|
@ -47,6 +48,7 @@ export default class Controller extends Section {
|
|||
field: 'futureIpt',
|
||||
autocomplete: {
|
||||
url: 'ItemPackingTypes',
|
||||
where: `{isActive: true}`,
|
||||
showField: 'description',
|
||||
valueField: 'code'
|
||||
}
|
||||
|
|
|
@ -25,7 +25,10 @@ class Controller extends SearchPanel {
|
|||
|
||||
getItemPackingTypes() {
|
||||
let itemPackingTypes = [];
|
||||
this.$http.get('ItemPackingTypes').then(res => {
|
||||
const filter = {
|
||||
where: {isActive: true}
|
||||
};
|
||||
this.$http.get('ItemPackingTypes', {filter}).then(res => {
|
||||
for (let ipt of res.data) {
|
||||
itemPackingTypes.push({
|
||||
description: this.$t(ipt.description),
|
||||
|
|
|
@ -134,7 +134,7 @@
|
|||
{{::ticket.shipped | date: 'dd/MM/yyyy HH:mm'}}
|
||||
</span>
|
||||
</td>
|
||||
<td>{{::ticket.ipt}}</td>
|
||||
<td>{{::ticket.ipt | dashIfEmpty}}</td>
|
||||
<td>
|
||||
<span
|
||||
class="chip {{$ctrl.stateColor(ticket.state)}}">
|
||||
|
@ -155,7 +155,7 @@
|
|||
{{::ticket.futureShipped | date: 'dd/MM/yyyy HH:mm'}}
|
||||
</span>
|
||||
</td>
|
||||
<td>{{::ticket.futureIpt}}</td>
|
||||
<td>{{::ticket.futureIpt | dashIfEmpty}}</td>
|
||||
<td>
|
||||
<span
|
||||
class="chip {{$ctrl.stateColor(ticket.futureState)}}">
|
||||
|
|
|
@ -34,6 +34,7 @@ export default class Controller extends Section {
|
|||
field: 'ipt',
|
||||
autocomplete: {
|
||||
url: 'ItemPackingTypes',
|
||||
where: `{isActive: true}`,
|
||||
showField: 'description',
|
||||
valueField: 'code'
|
||||
}
|
||||
|
@ -42,6 +43,7 @@ export default class Controller extends Section {
|
|||
field: 'futureIpt',
|
||||
autocomplete: {
|
||||
url: 'ItemPackingTypes',
|
||||
where: `{isActive: true}`,
|
||||
showField: 'description',
|
||||
valueField: 'code'
|
||||
}
|
||||
|
|
|
@ -32,94 +32,87 @@ module.exports = Self => {
|
|||
const models = Self.app.models;
|
||||
const conn = Self.dataSource.connector;
|
||||
const args = ctx.args;
|
||||
const $t = ctx.req.__; // $translate
|
||||
let tx;
|
||||
const myOptions = {};
|
||||
|
||||
if (typeof options == 'object')
|
||||
Object.assign(myOptions, options);
|
||||
|
||||
if (!myOptions.transaction) {
|
||||
tx = await Self.beginTransaction({});
|
||||
myOptions.transaction = tx;
|
||||
}
|
||||
|
||||
const stmts = [];
|
||||
let stmt;
|
||||
|
||||
try {
|
||||
if (!args.week || !args.year) {
|
||||
const from = new Date();
|
||||
const to = new Date();
|
||||
if (!args.week || !args.year) {
|
||||
const from = new Date();
|
||||
const to = new Date();
|
||||
|
||||
const time = await models.Time.findOne({
|
||||
where: {
|
||||
dated: {between: [from.setDate(from.getDate() - 10), to.setDate(to.getDate() - 4)]}
|
||||
},
|
||||
order: 'week ASC'
|
||||
}, myOptions);
|
||||
const time = await models.Time.findOne({
|
||||
where: {
|
||||
dated: {between: [from.setDate(from.getDate() - 10), to.setDate(to.getDate() - 4)]}
|
||||
},
|
||||
order: 'week ASC'
|
||||
}, myOptions);
|
||||
|
||||
args.week = time.week;
|
||||
args.year = time.year;
|
||||
}
|
||||
args.week = time.week;
|
||||
args.year = time.year;
|
||||
}
|
||||
|
||||
const started = getStartDateOfWeekNumber(args.week, args.year);
|
||||
started.setHours(0, 0, 0, 0);
|
||||
const started = getStartDateOfWeekNumber(args.week, args.year);
|
||||
started.setHours(0, 0, 0, 0);
|
||||
|
||||
const ended = new Date(started);
|
||||
ended.setDate(started.getDate() + 6);
|
||||
ended.setHours(23, 59, 59, 999);
|
||||
const ended = new Date(started);
|
||||
ended.setDate(started.getDate() + 6);
|
||||
ended.setHours(23, 59, 59, 999);
|
||||
|
||||
stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.timeControlCalculate');
|
||||
stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.timeBusinessCalculate');
|
||||
stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.timeControlCalculate');
|
||||
stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.timeBusinessCalculate');
|
||||
|
||||
if (args.workerId) {
|
||||
await models.WorkerTimeControl.destroyAll({
|
||||
userFk: args.workerId,
|
||||
timed: {between: [started, ended]},
|
||||
isSendMail: true
|
||||
}, myOptions);
|
||||
if (args.workerId) {
|
||||
await models.WorkerTimeControl.destroyAll({
|
||||
userFk: args.workerId,
|
||||
timed: {between: [started, ended]},
|
||||
isSendMail: true
|
||||
}, myOptions);
|
||||
|
||||
const where = {
|
||||
workerFk: args.workerId,
|
||||
year: args.year,
|
||||
week: args.week
|
||||
};
|
||||
await models.WorkerTimeControlMail.updateAll(where, {
|
||||
updated: new Date(), state: 'SENDED'
|
||||
}, myOptions);
|
||||
const where = {
|
||||
workerFk: args.workerId,
|
||||
year: args.year,
|
||||
week: args.week
|
||||
};
|
||||
await models.WorkerTimeControlMail.updateAll(where, {
|
||||
updated: new Date(), state: 'SENDED'
|
||||
}, myOptions);
|
||||
|
||||
stmt = new ParameterizedSQL(
|
||||
`CALL vn.timeControl_calculateByUser(?, ?, ?)
|
||||
stmt = new ParameterizedSQL(
|
||||
`CALL vn.timeControl_calculateByUser(?, ?, ?)
|
||||
`, [args.workerId, started, ended]);
|
||||
stmts.push(stmt);
|
||||
stmts.push(stmt);
|
||||
|
||||
stmt = new ParameterizedSQL(
|
||||
`CALL vn.timeBusiness_calculateByUser(?, ?, ?)
|
||||
stmt = new ParameterizedSQL(
|
||||
`CALL vn.timeBusiness_calculateByUser(?, ?, ?)
|
||||
`, [args.workerId, started, ended]);
|
||||
stmts.push(stmt);
|
||||
} else {
|
||||
await models.WorkerTimeControl.destroyAll({
|
||||
timed: {between: [started, ended]},
|
||||
isSendMail: true
|
||||
}, myOptions);
|
||||
stmts.push(stmt);
|
||||
} else {
|
||||
await models.WorkerTimeControl.destroyAll({
|
||||
timed: {between: [started, ended]},
|
||||
isSendMail: true
|
||||
}, myOptions);
|
||||
|
||||
const where = {
|
||||
year: args.year,
|
||||
week: args.week
|
||||
};
|
||||
await models.WorkerTimeControlMail.updateAll(where, {
|
||||
updated: new Date(), state: 'SENDED'
|
||||
}, myOptions);
|
||||
const where = {
|
||||
year: args.year,
|
||||
week: args.week
|
||||
};
|
||||
await models.WorkerTimeControlMail.updateAll(where, {
|
||||
updated: new Date(), state: 'SENDED'
|
||||
}, myOptions);
|
||||
|
||||
stmt = new ParameterizedSQL(`CALL vn.timeControl_calculateAll(?, ?)`, [started, ended]);
|
||||
stmts.push(stmt);
|
||||
stmt = new ParameterizedSQL(`CALL vn.timeControl_calculateAll(?, ?)`, [started, ended]);
|
||||
stmts.push(stmt);
|
||||
|
||||
stmt = new ParameterizedSQL(`CALL vn.timeBusiness_calculateAll(?, ?)`, [started, ended]);
|
||||
stmts.push(stmt);
|
||||
}
|
||||
stmt = new ParameterizedSQL(`CALL vn.timeBusiness_calculateAll(?, ?)`, [started, ended]);
|
||||
stmts.push(stmt);
|
||||
}
|
||||
|
||||
stmt = new ParameterizedSQL(`
|
||||
stmt = new ParameterizedSQL(`
|
||||
SELECT CONCAT(u.name, '@verdnatura.es') receiver,
|
||||
u.id workerFk,
|
||||
tb.dated,
|
||||
|
@ -154,25 +147,33 @@ module.exports = Self => {
|
|||
AND w.businessFk
|
||||
ORDER BY u.id, tb.dated
|
||||
`, [args.workerId]);
|
||||
const index = stmts.push(stmt) - 1;
|
||||
const index = stmts.push(stmt) - 1;
|
||||
|
||||
const sql = ParameterizedSQL.join(stmts, ';');
|
||||
const days = await conn.executeStmt(sql, myOptions);
|
||||
stmts.push('DROP TEMPORARY TABLE tmp.timeControlCalculate');
|
||||
stmts.push('DROP TEMPORARY TABLE tmp.timeBusinessCalculate');
|
||||
|
||||
let previousWorkerFk = days[index][0].workerFk;
|
||||
let previousReceiver = days[index][0].receiver;
|
||||
const sql = ParameterizedSQL.join(stmts, ';');
|
||||
const days = await conn.executeStmt(sql, myOptions);
|
||||
|
||||
const workerTimeControlConfig = await models.WorkerTimeControlConfig.findOne(null, myOptions);
|
||||
let previousWorkerFk = days[index][0].workerFk;
|
||||
let previousReceiver = days[index][0].receiver;
|
||||
|
||||
for (let day of days[index]) {
|
||||
const workerTimeControlConfig = await models.WorkerTimeControlConfig.findOne(null, myOptions);
|
||||
|
||||
for (let day of days[index]) {
|
||||
if (!myOptions.transaction) {
|
||||
tx = await Self.beginTransaction({});
|
||||
myOptions.transaction = tx;
|
||||
}
|
||||
try {
|
||||
workerFk = day.workerFk;
|
||||
if (day.timeWorkDecimal > 0 && day.timeWorkedDecimal == null
|
||||
&& (day.permissionRate ? day.permissionRate : true)) {
|
||||
&& (day.permissionRate == null ? true : day.permissionRate)) {
|
||||
if (day.timeTable == null) {
|
||||
const timed = new Date(day.dated);
|
||||
await models.WorkerTimeControl.create({
|
||||
userFk: day.workerFk,
|
||||
timed: timed.setHours(8),
|
||||
timed: timed.setHours(workerTimeControlConfig.teleworkingStart / 3600),
|
||||
manual: true,
|
||||
direction: 'in',
|
||||
isSendMail: true
|
||||
|
@ -181,7 +182,7 @@ module.exports = Self => {
|
|||
if (day.timeWorkDecimal >= workerTimeControlConfig.timeToBreakTime / 3600) {
|
||||
await models.WorkerTimeControl.create({
|
||||
userFk: day.workerFk,
|
||||
timed: timed.setHours(9),
|
||||
timed: timed.setHours(workerTimeControlConfig.teleworkingStartBreakTime / 3600),
|
||||
manual: true,
|
||||
direction: 'middle',
|
||||
isSendMail: true
|
||||
|
@ -189,7 +190,10 @@ module.exports = Self => {
|
|||
|
||||
await models.WorkerTimeControl.create({
|
||||
userFk: day.workerFk,
|
||||
timed: timed.setHours(9, 20),
|
||||
timed: timed.setHours(
|
||||
workerTimeControlConfig.teleworkingStartBreakTime / 3600,
|
||||
workerTimeControlConfig.breakTime / 60
|
||||
),
|
||||
manual: true,
|
||||
direction: 'middle',
|
||||
isSendMail: true
|
||||
|
@ -199,7 +203,11 @@ module.exports = Self => {
|
|||
const [hoursWork, minutesWork, secondsWork] = getTime(day.timeWorkSexagesimal);
|
||||
await models.WorkerTimeControl.create({
|
||||
userFk: day.workerFk,
|
||||
timed: timed.setHours(8 + hoursWork, minutesWork, secondsWork),
|
||||
timed: timed.setHours(
|
||||
workerTimeControlConfig.teleworkingStart / 3600 + hoursWork,
|
||||
minutesWork,
|
||||
secondsWork
|
||||
),
|
||||
manual: true,
|
||||
direction: 'out',
|
||||
isSendMail: true
|
||||
|
@ -307,7 +315,7 @@ module.exports = Self => {
|
|||
}, myOptions);
|
||||
|
||||
if (firstWorkerTimeControl)
|
||||
firstWorkerTimeControl.updateAttribute('direction', 'in', myOptions);
|
||||
await firstWorkerTimeControl.updateAttribute('direction', 'in', myOptions);
|
||||
|
||||
const lastWorkerTimeControl = await models.WorkerTimeControl.findOne({
|
||||
where: {
|
||||
|
@ -318,7 +326,7 @@ module.exports = Self => {
|
|||
}, myOptions);
|
||||
|
||||
if (lastWorkerTimeControl)
|
||||
lastWorkerTimeControl.updateAttribute('direction', 'out', myOptions);
|
||||
await lastWorkerTimeControl.updateAttribute('direction', 'out', myOptions);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -339,15 +347,18 @@ module.exports = Self => {
|
|||
previousWorkerFk = day.workerFk;
|
||||
previousReceiver = day.receiver;
|
||||
}
|
||||
|
||||
if (tx) {
|
||||
await tx.commit();
|
||||
delete myOptions.transaction;
|
||||
}
|
||||
} catch (e) {
|
||||
if (tx) await tx.rollback();
|
||||
throw e;
|
||||
}
|
||||
|
||||
if (tx) await tx.commit();
|
||||
|
||||
return true;
|
||||
} catch (e) {
|
||||
if (tx) await tx.rollback();
|
||||
throw e;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
function getStartDateOfWeekNumber(week, year) {
|
||||
|
|
|
@ -10,7 +10,6 @@ describe('workerTimeControl sendMail()', () => {
|
|||
const ctx = {req: activeCtx, args: {}};
|
||||
|
||||
it('should fill time control of a worker without records in Journey and with rest', async() => {
|
||||
pending('https://redmine.verdnatura.es/issues/4903');
|
||||
const tx = await models.WorkerTimeControl.beginTransaction({});
|
||||
|
||||
try {
|
||||
|
@ -35,7 +34,6 @@ describe('workerTimeControl sendMail()', () => {
|
|||
});
|
||||
|
||||
it('should fill time control of a worker without records in Journey and without rest', async() => {
|
||||
pending('https://redmine.verdnatura.es/issues/4903');
|
||||
const workdayOf20Hours = 3;
|
||||
const tx = await models.WorkerTimeControl.beginTransaction({});
|
||||
|
||||
|
@ -63,7 +61,6 @@ describe('workerTimeControl sendMail()', () => {
|
|||
});
|
||||
|
||||
it('should fill time control of a worker with records in Journey and with rest', async() => {
|
||||
pending('https://redmine.verdnatura.es/issues/4903');
|
||||
const tx = await models.WorkerTimeControl.beginTransaction({});
|
||||
|
||||
try {
|
||||
|
@ -95,7 +92,6 @@ describe('workerTimeControl sendMail()', () => {
|
|||
});
|
||||
|
||||
it('should fill time control of a worker with records in Journey and without rest', async() => {
|
||||
pending('https://redmine.verdnatura.es/issues/4903');
|
||||
const tx = await models.WorkerTimeControl.beginTransaction({});
|
||||
|
||||
try {
|
||||
|
|
|
@ -2,7 +2,7 @@ const {Email} = require('vn-print');
|
|||
|
||||
module.exports = Self => {
|
||||
Self.remoteMethodCtx('weeklyHourRecordEmail', {
|
||||
description: 'Sends the buyer waste email',
|
||||
description: 'Sends the weekly hour record',
|
||||
accessType: 'WRITE',
|
||||
accepts: [
|
||||
{
|
||||
|
|
|
@ -11,8 +11,17 @@
|
|||
"id": true,
|
||||
"type": "number"
|
||||
},
|
||||
"breakTime": {
|
||||
"type": "number"
|
||||
},
|
||||
"timeToBreakTime": {
|
||||
"type": "number"
|
||||
},
|
||||
"teleworkingStart": {
|
||||
"type": "number"
|
||||
},
|
||||
"teleworkingStartBreakTime": {
|
||||
"type": "number"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "salix-back",
|
||||
"version": "9.0.0",
|
||||
"version": "230401",
|
||||
"author": "Verdnatura Levante SL",
|
||||
"description": "Salix backend",
|
||||
"license": "GPL-3.0",
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,5 @@
|
|||
subject: Your agricultural invoice
|
||||
title: Your agricultural invoice
|
||||
subject: Your agricultural receipt
|
||||
title: Your agricultural receipt
|
||||
dear: Dear supplier
|
||||
description: Attached you can find agricultural receipt generated from your last deliveries. Please return a signed and stamped copy to our administration department.
|
||||
conclusion: Thanks for your attention!
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
subject: Tu factura agrícola
|
||||
title: Tu factura agrícola
|
||||
subject: Tu recibo agrícola
|
||||
title: Tu recibo agrícola
|
||||
dear: Estimado proveedor
|
||||
description: Adjunto puede encontrar recibo agrícola generado de sus últimas entregas. Por favor, devuelva una copia firmada y sellada a nuestro de departamento de administración.
|
||||
conclusion: ¡Gracias por tu atención!
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
subject: Votre facture agricole
|
||||
title: Votre facture agricole
|
||||
subject: Votre reçu agricole
|
||||
title: Votre reçu agricole
|
||||
dear: Cher Fournisseur
|
||||
description: Vous trouverez en pièce jointe le reçu agricole généré à partir de vos dernières livraisons. Veuillez retourner une copie signée et tamponnée à notre service administratif.
|
||||
conclusion: Merci pour votre attention!
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
subject: A sua fatura agrícola
|
||||
title: A sua fatura agrícola
|
||||
subject: A sua recibo agrícola
|
||||
title: A sua recibo agrícola
|
||||
dear: Caro Fornecedor
|
||||
description: Em anexo encontra-se o recibo agrícola gerado a partir das suas últimas entregas. Por favor, devolva uma cópia assinada e carimbada ao nosso departamento de administração.
|
||||
conclusion: Obrigado pela atenção.
|
||||
|
|
|
@ -3,9 +3,12 @@ SELECT
|
|||
i.name,
|
||||
i.stems,
|
||||
i.size,
|
||||
b.packing
|
||||
b.packing,
|
||||
p.name as 'producer'
|
||||
FROM vn.item i
|
||||
JOIN cache.last_buy clb ON clb.item_id = i.id
|
||||
JOIN vn.buy b ON b.id = clb.buy_id
|
||||
JOIN vn.entry e ON e.id = b.entryFk
|
||||
JOIN vn.producer p ON p.id = i.producerFk
|
||||
|
||||
WHERE i.id = ? AND clb.warehouse_id = ?
|
|
@ -0,0 +1,12 @@
|
|||
const Stylesheet = require(`vn-print/core/stylesheet`);
|
||||
|
||||
const path = require('path');
|
||||
const vnPrintPath = path.resolve('print');
|
||||
|
||||
module.exports = new Stylesheet([
|
||||
`${vnPrintPath}/common/css/spacing.css`,
|
||||
`${vnPrintPath}/common/css/misc.css`,
|
||||
`${vnPrintPath}/common/css/layout.css`,
|
||||
`${vnPrintPath}/common/css/report.css`,
|
||||
`${__dirname}/style.css`])
|
||||
.mergeStyles();
|
|
@ -0,0 +1,85 @@
|
|||
* {
|
||||
box-sizing: border-box;
|
||||
padding-right: 1%;
|
||||
}
|
||||
.label {
|
||||
font-size: 1.2em;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
}
|
||||
.barcode {
|
||||
float: left;
|
||||
width: 40%;
|
||||
}
|
||||
.barcode h1 {
|
||||
text-align: center;
|
||||
font-size: 1.8em;
|
||||
margin: 0 0 10px 0
|
||||
}
|
||||
.barcode .image {
|
||||
text-align: center
|
||||
}
|
||||
.barcode .image img {
|
||||
width: 170px
|
||||
}
|
||||
.data {
|
||||
float: left;
|
||||
width: 60%;
|
||||
}
|
||||
.data .header {
|
||||
background-color: #000;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
margin-bottom: 25px;
|
||||
text-align: right;
|
||||
font-size: 1.2em;
|
||||
padding: 0.2em;
|
||||
color: #FFF
|
||||
}
|
||||
.data .sector,
|
||||
.data .producer {
|
||||
text-transform: uppercase;
|
||||
text-align: right;
|
||||
font-size: 1.5em;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
}
|
||||
.data .sector-sm {
|
||||
text-transform: uppercase;
|
||||
text-align: right;
|
||||
font-size: 1.2em;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
}
|
||||
.data .producer {
|
||||
text-justify: inter-character;
|
||||
}
|
||||
.data .details {
|
||||
border-top: 4px solid #000;
|
||||
padding-top: 2px;
|
||||
}
|
||||
.data .details .package {
|
||||
padding-right: 5px;
|
||||
float: left;
|
||||
width: 50%;
|
||||
}
|
||||
.package .packing,
|
||||
.package .dated,
|
||||
.package .labelNumber {
|
||||
text-align: right
|
||||
}
|
||||
.package .packing {
|
||||
font-size: 1.8em;
|
||||
font-weight: 400
|
||||
}
|
||||
.data .details .size {
|
||||
background-color: #000;
|
||||
text-align: center;
|
||||
font-size: 3em;
|
||||
padding: 0.2em 0;
|
||||
float: left;
|
||||
width: 50%;
|
||||
color: #FFF
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
previous: PREVIOUS
|
||||
report: Report
|
|
@ -0,0 +1,2 @@
|
|||
previous: PREVIA
|
||||
report: Ticket
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"width": "10.4cm",
|
||||
"height": "4.8cm",
|
||||
"margin": {
|
||||
"top": "0cm",
|
||||
"right": "0cm",
|
||||
"bottom": "0cm",
|
||||
"left": "0cm"
|
||||
},
|
||||
"printBackground": true
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
<DOCTYPE html>
|
||||
<body>
|
||||
<div class="label">
|
||||
<div class="barcode">
|
||||
<h1>{{previa.saleGroupFk}}</h1>
|
||||
<div class="image">
|
||||
<img v-bind:src="barcode" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="data">
|
||||
<div class="header">{{ $t('previous') }}</div>
|
||||
<div v-if="sector.description.length > 16" class="sector-sm">
|
||||
{{sector.description}}
|
||||
</div>
|
||||
<div v-else class="sector">{{sector.description}}</div>
|
||||
<div class="producer">{{ $t('report') }}#{{previa.ticketFk}}</div>
|
||||
<div class="details">
|
||||
<div class="package">
|
||||
<div class="packing">{{previa.itemPackingTypeFk}}</div>
|
||||
<div class="dated">{{previa.shippingHour}}:{{previa.shippingMinute}}</div>
|
||||
</div>
|
||||
<div class="size">{{previa.items}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
|
@ -0,0 +1,42 @@
|
|||
const Component = require(`vn-print/core/component`);
|
||||
const reportBody = new Component('report-body');
|
||||
const qrcode = require('qrcode');
|
||||
const UserError = require('vn-loopback/util/user-error');
|
||||
|
||||
module.exports = {
|
||||
name: 'previa-label',
|
||||
async serverPrefetch() {
|
||||
this.previa = await this.fetchPrevia(this.id);
|
||||
this.sector = await this.fetchSector(this.id);
|
||||
this.barcode = await this.getBarcodeBase64(this.id);
|
||||
|
||||
if (this.previa)
|
||||
this.previa = this.previa[0];
|
||||
|
||||
if (!this.sector)
|
||||
throw new UserError('Something went wrong - no sector found');
|
||||
},
|
||||
methods: {
|
||||
fetchPrevia(id) {
|
||||
return this.findOneFromDef('previa', [id]);
|
||||
},
|
||||
getBarcodeBase64(id) {
|
||||
const data = String(id);
|
||||
|
||||
return qrcode.toDataURL(data, {margin: 0});
|
||||
},
|
||||
fetchSector(id) {
|
||||
return this.findOneFromDef('sector', [id]);
|
||||
}
|
||||
},
|
||||
components: {
|
||||
'report-body': reportBody.build()
|
||||
},
|
||||
props: {
|
||||
id: {
|
||||
type: Number,
|
||||
required: true,
|
||||
description: 'The saleGroupFk id'
|
||||
},
|
||||
}
|
||||
};
|
|
@ -0,0 +1 @@
|
|||
CALL vn.previousSticker_get(?)
|
|
@ -0,0 +1,4 @@
|
|||
SELECT s.description
|
||||
FROM vn.saleGroup sg
|
||||
JOIN vn.sector s ON sg.sectorFk = s.id
|
||||
WHERE sg.id = ?
|
Loading…
Reference in New Issue