Merge branch 'dev' into 4797-lilium-worker-notifications
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
commit
29b5c7cc5a
|
@ -8,13 +8,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
## [2304.01] - 2023-02-09
|
## [2304.01] - 2023-02-09
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
- (Rutas) Al descargar varias facturas se comprime en un zip
|
||||||
- (Trabajadores -> Nuevo trabajador) Nueva sección
|
- (Trabajadores -> Nuevo trabajador) Nueva sección
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
-
|
-
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
-
|
- (Artículos -> Etiquetas) Permite intercambiar la relevancia entre dos etiquetas.
|
||||||
|
|
||||||
|
|
||||||
## [2302.01] - 2023-01-26
|
## [2302.01] - 2023-01-26
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||||
|
VALUES
|
||||||
|
('Tag', 'onSubmit', 'WRITE', 'ALLOW', 'ROLE', 'employee');
|
|
@ -147,28 +147,17 @@ export default class CrudModel extends ModelProxy {
|
||||||
this.moreRows = null;
|
this.moreRows = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
getChanges() {
|
||||||
* Saves current changes on the server.
|
if (!this.isChanged) return null;
|
||||||
*
|
|
||||||
* @return {Promise} The save request promise
|
|
||||||
*/
|
|
||||||
save() {
|
|
||||||
if (!this.isChanged)
|
|
||||||
return this.$q.resolve();
|
|
||||||
|
|
||||||
let deletes = [];
|
const deletes = [];
|
||||||
let updates = [];
|
const updates = [];
|
||||||
let creates = [];
|
const creates = [];
|
||||||
let orgDeletes = [];
|
|
||||||
let orgUpdates = [];
|
|
||||||
let orgCreates = [];
|
|
||||||
|
|
||||||
let pk = this.primaryKey;
|
const pk = this.primaryKey;
|
||||||
|
|
||||||
for (let row of this.removed) {
|
for (let row of this.removed)
|
||||||
deletes.push(row.$orgRow[pk]);
|
deletes.push(row.$orgRow[pk]);
|
||||||
orgDeletes.push(row);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let row of this.data) {
|
for (let row of this.data) {
|
||||||
if (row.$isNew) {
|
if (row.$isNew) {
|
||||||
|
@ -178,7 +167,6 @@ export default class CrudModel extends ModelProxy {
|
||||||
data[prop] = row[prop];
|
data[prop] = row[prop];
|
||||||
}
|
}
|
||||||
creates.push(row);
|
creates.push(row);
|
||||||
orgCreates.push(row);
|
|
||||||
} else if (row.$oldData) {
|
} else if (row.$oldData) {
|
||||||
let data = {};
|
let data = {};
|
||||||
for (let prop in row.$oldData)
|
for (let prop in row.$oldData)
|
||||||
|
@ -187,28 +175,38 @@ export default class CrudModel extends ModelProxy {
|
||||||
data,
|
data,
|
||||||
where: {[pk]: row.$orgRow[pk]}
|
where: {[pk]: row.$orgRow[pk]}
|
||||||
});
|
});
|
||||||
orgUpdates.push(row);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let changes = {deletes, updates, creates};
|
const changes = {deletes, updates, creates};
|
||||||
|
|
||||||
for (let prop in changes) {
|
for (let prop in changes) {
|
||||||
if (changes[prop].length === 0)
|
if (changes[prop].length === 0)
|
||||||
changes[prop] = undefined;
|
changes[prop] = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!changes)
|
return changes;
|
||||||
return this.$q.resolve();
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Saves current changes on the server.
|
||||||
|
*
|
||||||
|
* @return {Promise} The save request promise
|
||||||
|
*/
|
||||||
|
save() {
|
||||||
|
const pk = this.primaryKey;
|
||||||
|
const changes = this.getChanges();
|
||||||
|
if (!changes) return this.$q.resolve();
|
||||||
|
|
||||||
|
const creates = changes.creates || [];
|
||||||
let url = this.saveUrl ? this.saveUrl : `${this._url}/crud`;
|
let url = this.saveUrl ? this.saveUrl : `${this._url}/crud`;
|
||||||
return this.$http.post(url, changes)
|
return this.$http.post(url, changes)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
const created = res.data;
|
const created = res.data;
|
||||||
|
|
||||||
// Apply new data to created instances
|
// Apply new data to created instances
|
||||||
for (let i = 0; i < orgCreates.length; i++) {
|
for (let i = 0; i < creates.length; i++) {
|
||||||
const row = orgCreates[i];
|
const row = creates[i];
|
||||||
row[pk] = created[i][pk];
|
row[pk] = created[i][pk];
|
||||||
|
|
||||||
for (let prop in row) {
|
for (let prop in row) {
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
module.exports = class NotFoundError extends Error {
|
||||||
|
constructor(message = 'Not found', code = 'NOT_FOUND', ...translateArgs) {
|
||||||
|
super(message);
|
||||||
|
this.name = 'NotFoundError';
|
||||||
|
this.statusCode = 404;
|
||||||
|
this.code = code;
|
||||||
|
this.translateArgs = translateArgs;
|
||||||
|
}
|
||||||
|
};
|
|
@ -19,10 +19,26 @@ class Controller extends ModuleCard {
|
||||||
}, {
|
}, {
|
||||||
relation: 'ticket',
|
relation: 'ticket',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['zoneFk'],
|
fields: ['zoneFk', 'addressFk'],
|
||||||
include: {
|
include: [
|
||||||
relation: 'zone'
|
{
|
||||||
}
|
relation: 'zone',
|
||||||
|
scope: {
|
||||||
|
fields: ['name']
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
relation: 'address',
|
||||||
|
scope: {
|
||||||
|
fields: ['provinceFk'],
|
||||||
|
include: {
|
||||||
|
relation: 'province',
|
||||||
|
scope: {
|
||||||
|
fields: ['name']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}]
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
relation: 'claimState',
|
relation: 'claimState',
|
||||||
|
|
|
@ -55,9 +55,13 @@
|
||||||
<span
|
<span
|
||||||
ng-click="zoneDescriptor.show($event, $ctrl.claim.ticket.zoneFk)"
|
ng-click="zoneDescriptor.show($event, $ctrl.claim.ticket.zoneFk)"
|
||||||
class="link">
|
class="link">
|
||||||
{{$ctrl.claim.ticket.zoneFk}}
|
{{$ctrl.claim.ticket.zone.name}}
|
||||||
</span>
|
</span>
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
|
<vn-label-value
|
||||||
|
label="Province"
|
||||||
|
value="{{$ctrl.claim.ticket.address.province.name}}">
|
||||||
|
</vn-label-value>
|
||||||
<vn-label-value
|
<vn-label-value
|
||||||
label="Ticket">
|
label="Ticket">
|
||||||
<span
|
<span
|
||||||
|
|
|
@ -0,0 +1,93 @@
|
||||||
|
|
||||||
|
module.exports = function(Self) {
|
||||||
|
Self.remoteMethodCtx('onSubmit', {
|
||||||
|
description: 'Save model changes',
|
||||||
|
accessType: 'WRITE',
|
||||||
|
accepts: [
|
||||||
|
{
|
||||||
|
arg: 'creates',
|
||||||
|
type: ['object'],
|
||||||
|
description: 'The itemTags records to create'
|
||||||
|
}, {
|
||||||
|
arg: 'deletes',
|
||||||
|
type: ['number'],
|
||||||
|
description: 'The itemTags ids to delete'
|
||||||
|
}, {
|
||||||
|
arg: 'updates',
|
||||||
|
type: ['object'],
|
||||||
|
description: 'The itemTags records to update'
|
||||||
|
}, {
|
||||||
|
arg: 'maxPriority',
|
||||||
|
type: 'number',
|
||||||
|
description: 'The maxPriority value'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
returns: {
|
||||||
|
root: true,
|
||||||
|
type: 'object'
|
||||||
|
},
|
||||||
|
http: {
|
||||||
|
verb: 'PATCH',
|
||||||
|
path: '/onSubmit'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Self.onSubmit = async(ctx, options) => {
|
||||||
|
const models = Self.app.models;
|
||||||
|
const args = ctx.args;
|
||||||
|
let tx;
|
||||||
|
const myOptions = {};
|
||||||
|
|
||||||
|
if (typeof options == 'object')
|
||||||
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
|
if (!myOptions.transaction) {
|
||||||
|
tx = await Self.beginTransaction({});
|
||||||
|
myOptions.transaction = tx;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const promises = [];
|
||||||
|
|
||||||
|
if (args.deletes) {
|
||||||
|
for (const itemTagId of args.deletes) {
|
||||||
|
const itemTagDeleted = models.ItemTag.destroyById(itemTagId, myOptions);
|
||||||
|
promises.push(itemTagDeleted);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.updates) {
|
||||||
|
for (const row of args.updates) {
|
||||||
|
if (row.data.priority) {
|
||||||
|
const itemTag = await models.ItemTag.findById(row.where.id, null, myOptions);
|
||||||
|
const itemTagUpdatedPriority = itemTag.updateAttributes({
|
||||||
|
priority: row.data.priority + args.maxPriority
|
||||||
|
}, myOptions);
|
||||||
|
promises.push(itemTagUpdatedPriority);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (const row of args.updates) {
|
||||||
|
const itemTag = await models.ItemTag.findById(row.where.id, null, myOptions);
|
||||||
|
const itemTagUpdated = itemTag.updateAttributes(row.data, myOptions);
|
||||||
|
promises.push(itemTagUpdated);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.creates) {
|
||||||
|
for (const itemTag of args.creates) {
|
||||||
|
const newItemTag = models.ItemTag.create(itemTag, myOptions);
|
||||||
|
promises.push(newItemTag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const resolvedPromises = await Promise.all(promises);
|
||||||
|
|
||||||
|
if (tx) await tx.commit();
|
||||||
|
|
||||||
|
return resolvedPromises;
|
||||||
|
} catch (e) {
|
||||||
|
if (tx) await tx.rollback();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
|
@ -0,0 +1,100 @@
|
||||||
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
|
||||||
|
describe('tag onSubmit()', () => {
|
||||||
|
it('should delete a tag', async() => {
|
||||||
|
const tx = await models.Item.beginTransaction({});
|
||||||
|
const options = {transaction: tx};
|
||||||
|
|
||||||
|
try {
|
||||||
|
const deletes = [40];
|
||||||
|
const ctx = {
|
||||||
|
args: {
|
||||||
|
deletes: deletes
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const result = await models.Tag.onSubmit(ctx, options);
|
||||||
|
|
||||||
|
expect(result.length).toEqual(1);
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should update a tag', async() => {
|
||||||
|
const tx = await models.Item.beginTransaction({});
|
||||||
|
const options = {transaction: tx};
|
||||||
|
|
||||||
|
try {
|
||||||
|
const updates = [{data: {value: 'Container Test'}, where: {id: 36}}];
|
||||||
|
const ctx = {
|
||||||
|
args: {
|
||||||
|
updates: updates
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const result = await models.Tag.onSubmit(ctx, options);
|
||||||
|
|
||||||
|
expect(result.length).toEqual(1);
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create a tag', async() => {
|
||||||
|
const tx = await models.Item.beginTransaction({});
|
||||||
|
const options = {transaction: tx};
|
||||||
|
|
||||||
|
try {
|
||||||
|
const creates = [{
|
||||||
|
'itemFk': '6',
|
||||||
|
'priority': 8,
|
||||||
|
'$orgIndex': null,
|
||||||
|
'$oldData': null,
|
||||||
|
'$isNew': true,
|
||||||
|
'tagFk': 3,
|
||||||
|
'value': 'madera'
|
||||||
|
}];
|
||||||
|
const ctx = {
|
||||||
|
args: {
|
||||||
|
creates: creates
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const result = await models.Tag.onSubmit(ctx, options);
|
||||||
|
|
||||||
|
expect(result.length).toEqual(1);
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should swap priority for two tags', async() => {
|
||||||
|
const tx = await models.Item.beginTransaction({});
|
||||||
|
const options = {transaction: tx};
|
||||||
|
|
||||||
|
try {
|
||||||
|
const updates = [
|
||||||
|
{data: {priority: 2}, where: {id: 36}},
|
||||||
|
{data: {priority: 1}, where: {id: 37}}
|
||||||
|
];
|
||||||
|
const ctx = {
|
||||||
|
args: {
|
||||||
|
updates: updates,
|
||||||
|
maxPriority: 7,
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const result = await models.Tag.onSubmit(ctx, options);
|
||||||
|
|
||||||
|
expect(result.length).toEqual(4);
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
|
@ -1,3 +1,4 @@
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
require('../methods/tag/filterValue')(Self);
|
require('../methods/tag/filterValue')(Self);
|
||||||
|
require('../methods/tag/onSubmit')(Self);
|
||||||
};
|
};
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
data="tags"
|
data="tags"
|
||||||
auto-load="true">
|
auto-load="true">
|
||||||
</vn-crud-model>
|
</vn-crud-model>
|
||||||
<form name="form" ng-submit="$ctrl.onSubmit()" class="vn-w-md">
|
<form name="form" class="vn-w-md">
|
||||||
<vn-card class="vn-pa-lg">
|
<vn-card class="vn-pa-lg">
|
||||||
<vn-horizontal ng-repeat="itemTag in $ctrl.itemTags">
|
<vn-horizontal ng-repeat="itemTag in $ctrl.itemTags">
|
||||||
<vn-autocomplete vn-two vn-id="tag" vn-focus
|
<vn-autocomplete vn-two vn-id="tag" vn-focus
|
||||||
|
@ -74,8 +74,9 @@
|
||||||
</vn-card>
|
</vn-card>
|
||||||
<vn-button-bar>
|
<vn-button-bar>
|
||||||
<vn-submit
|
<vn-submit
|
||||||
|
ng-click="$ctrl.onSubmit()"
|
||||||
disabled="!watcher.dataChanged()"
|
disabled="!watcher.dataChanged()"
|
||||||
label="Save">
|
label="Save">
|
||||||
</vn-submit>
|
</vn-submit>
|
||||||
</vn-button-bar>
|
</vn-button-bar>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -29,11 +29,17 @@ class Controller extends Section {
|
||||||
}
|
}
|
||||||
|
|
||||||
onSubmit() {
|
onSubmit() {
|
||||||
this.$.watcher.check();
|
const changes = this.$.model.getChanges();
|
||||||
this.$.model.save().then(() => {
|
const data = {
|
||||||
|
creates: changes.creates,
|
||||||
|
deletes: changes.deletes,
|
||||||
|
updates: changes.updates,
|
||||||
|
maxPriority: this.getHighestPriority()
|
||||||
|
};
|
||||||
|
this.$http.patch(`Tags/onSubmit`, data).then(() => {
|
||||||
|
this.$.model.refresh();
|
||||||
this.$.watcher.notifySaved();
|
this.$.watcher.notifySaved();
|
||||||
this.$.watcher.updateOriginalData();
|
this.$.watcher.updateOriginalData();
|
||||||
this.card.reload();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,7 +157,7 @@ class Controller extends Section {
|
||||||
* Apply order to model
|
* Apply order to model
|
||||||
*/
|
*/
|
||||||
applyOrder() {
|
applyOrder() {
|
||||||
if (this.typeId || this.tagGroups.length > 0)
|
if (this.typeId || this.tagGroups.length > 0 || this.itemName)
|
||||||
this.$.model.addFilter(null, {orderBy: this.getOrderBy()});
|
this.$.model.addFilter(null, {orderBy: this.getOrderBy()});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,62 @@
|
||||||
|
const JSZip = require('jszip');
|
||||||
|
|
||||||
|
module.exports = Self => {
|
||||||
|
Self.remoteMethodCtx('downloadZip', {
|
||||||
|
description: 'Download a zip file with multiple routes pdfs',
|
||||||
|
accessType: 'READ',
|
||||||
|
accepts: [
|
||||||
|
{
|
||||||
|
arg: 'id',
|
||||||
|
type: 'string',
|
||||||
|
description: 'The routes ids',
|
||||||
|
}
|
||||||
|
],
|
||||||
|
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: '/downloadZip',
|
||||||
|
verb: 'GET'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Self.downloadZip = async function(ctx, id, options) {
|
||||||
|
const models = Self.app.models;
|
||||||
|
const myOptions = {};
|
||||||
|
const zip = new JSZip();
|
||||||
|
|
||||||
|
if (typeof options == 'object')
|
||||||
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
|
const ids = id.split(',');
|
||||||
|
for (let id of ids) {
|
||||||
|
ctx.args.id = id;
|
||||||
|
const routePdf = await models.Route.driverRoutePdf(ctx, id);
|
||||||
|
const fileName = extractFileName(routePdf[2]);
|
||||||
|
const body = routePdf[0];
|
||||||
|
|
||||||
|
zip.file(fileName, body);
|
||||||
|
}
|
||||||
|
|
||||||
|
const stream = zip.generateNodeStream({streamFiles: true});
|
||||||
|
|
||||||
|
return [stream, 'application/zip', `filename="download.zip"`];
|
||||||
|
};
|
||||||
|
|
||||||
|
function extractFileName(str) {
|
||||||
|
const matches = str.match(/"(.*?)"/);
|
||||||
|
return matches ? matches[1] : str;
|
||||||
|
}
|
||||||
|
};
|
|
@ -13,6 +13,7 @@ module.exports = Self => {
|
||||||
require('../methods/route/driverRoutePdf')(Self);
|
require('../methods/route/driverRoutePdf')(Self);
|
||||||
require('../methods/route/driverRouteEmail')(Self);
|
require('../methods/route/driverRouteEmail')(Self);
|
||||||
require('../methods/route/sendSms')(Self);
|
require('../methods/route/sendSms')(Self);
|
||||||
|
require('../methods/route/downloadZip')(Self);
|
||||||
|
|
||||||
Self.validate('kmStart', validateDistance, {
|
Self.validate('kmStart', validateDistance, {
|
||||||
message: 'Distance must be lesser than 1000'
|
message: 'Distance must be lesser than 1000'
|
||||||
|
|
|
@ -34,12 +34,22 @@ export default class Controller extends Section {
|
||||||
}
|
}
|
||||||
|
|
||||||
showRouteReport() {
|
showRouteReport() {
|
||||||
const routes = [];
|
const routesIds = [];
|
||||||
for (let route of this.checked)
|
for (let route of this.checked)
|
||||||
routes.push(route.id);
|
routesIds.push(route.id);
|
||||||
const routesId = routes.join(',');
|
const stringRoutesIds = routesIds.join(',');
|
||||||
|
|
||||||
this.vnReport.show(`Routes/${routesId}/driver-route-pdf`);
|
if (this.checked.length <= 1) {
|
||||||
|
const url = `api/Routes/${stringRoutesIds}/driver-route-pdf?access_token=${this.vnToken.token}`;
|
||||||
|
window.open(url, '_blank');
|
||||||
|
} else {
|
||||||
|
const serializedParams = this.$httpParamSerializer({
|
||||||
|
access_token: this.vnToken.token,
|
||||||
|
id: stringRoutesIds
|
||||||
|
});
|
||||||
|
const url = `api/Routes/downloadZip?${serializedParams}`;
|
||||||
|
window.open(url, '_blank');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
openClonationDialog() {
|
openClonationDialog() {
|
||||||
|
|
|
@ -44,17 +44,15 @@ describe('Component vnRouteIndex', () => {
|
||||||
|
|
||||||
describe('showRouteReport()', () => {
|
describe('showRouteReport()', () => {
|
||||||
it('should call to the vnReport show method', () => {
|
it('should call to the vnReport show method', () => {
|
||||||
controller.vnReport.show = jest.fn();
|
jest.spyOn(window, 'open').mockReturnThis();
|
||||||
|
|
||||||
const data = controller.$.model.data;
|
const data = controller.$.model.data;
|
||||||
data[0].checked = true;
|
data[0].checked = true;
|
||||||
data[2].checked = true;
|
data[2].checked = true;
|
||||||
|
|
||||||
const routeIds = '1,3';
|
|
||||||
|
|
||||||
controller.showRouteReport();
|
controller.showRouteReport();
|
||||||
|
|
||||||
expect(controller.vnReport.show).toHaveBeenCalledWith(`Routes/${routeIds}/driver-route-pdf`);
|
expect(window.open).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"module": "shelving",
|
"module": "shelving",
|
||||||
"name": "Shelvings",
|
"name": "Shelvings",
|
||||||
"icon" : "contact_support",
|
"icon" : "icon-inventory",
|
||||||
"dependencies": ["worker"],
|
"dependencies": ["worker"],
|
||||||
"validations" : true,
|
"validations" : true,
|
||||||
"menus": {
|
"menus": {
|
||||||
"main": [
|
"main": [
|
||||||
{"state": "shelving.index", "icon": "contact_support"}
|
{"state": "shelving.index", "icon": "icon-inventory"}
|
||||||
],
|
],
|
||||||
"card": [
|
"card": [
|
||||||
{"state": "shelving.card.basicData", "icon": "settings"},
|
{"state": "shelving.card.basicData", "icon": "settings"},
|
||||||
|
@ -20,7 +20,7 @@
|
||||||
"abstract": true,
|
"abstract": true,
|
||||||
"component": "vn-shelving",
|
"component": "vn-shelving",
|
||||||
"description": "Shelvings"
|
"description": "Shelvings"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"url": "/index?q",
|
"url": "/index?q",
|
||||||
"state": "shelving.index",
|
"state": "shelving.index",
|
||||||
|
@ -32,13 +32,13 @@
|
||||||
"state": "shelving.create",
|
"state": "shelving.create",
|
||||||
"component": "vn-shelving-create",
|
"component": "vn-shelving-create",
|
||||||
"description": "New shelving"
|
"description": "New shelving"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"url": "/:id",
|
"url": "/:id",
|
||||||
"state": "shelving.card",
|
"state": "shelving.card",
|
||||||
"abstract": true,
|
"abstract": true,
|
||||||
"component": "vn-shelving-card"
|
"component": "vn-shelving-card"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"url": "/summary",
|
"url": "/summary",
|
||||||
"state": "shelving.card.summary",
|
"state": "shelving.card.summary",
|
||||||
|
@ -47,7 +47,7 @@
|
||||||
"params": {
|
"params": {
|
||||||
"shelving": "$ctrl.shelving"
|
"shelving": "$ctrl.shelving"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"url": "/basic-data",
|
"url": "/basic-data",
|
||||||
"state": "shelving.card.basicData",
|
"state": "shelving.card.basicData",
|
||||||
|
@ -56,7 +56,7 @@
|
||||||
"params": {
|
"params": {
|
||||||
"shelving": "$ctrl.shelving"
|
"shelving": "$ctrl.shelving"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"url" : "/log",
|
"url" : "/log",
|
||||||
"state": "shelving.card.log",
|
"state": "shelving.card.log",
|
||||||
|
@ -64,4 +64,4 @@
|
||||||
"description": "Log"
|
"description": "Log"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ module.exports = Self => {
|
||||||
st.originalQuantity,
|
st.originalQuantity,
|
||||||
st.created,
|
st.created,
|
||||||
st.workerFk,
|
st.workerFk,
|
||||||
u.nickname userNickname,
|
u.name,
|
||||||
ste.name AS state
|
ste.name AS state
|
||||||
FROM saleTracking st
|
FROM saleTracking st
|
||||||
JOIN sale s ON s.id = st.saleFk
|
JOIN sale s ON s.id = st.saleFk
|
||||||
|
@ -48,24 +48,6 @@ module.exports = Self => {
|
||||||
|
|
||||||
const trackings = await Self.rawStmt(stmt, myOptions);
|
const trackings = await Self.rawStmt(stmt, myOptions);
|
||||||
|
|
||||||
const salesFilter = {
|
|
||||||
include: [
|
|
||||||
{
|
|
||||||
relation: 'item'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
where: {ticketFk: filter.where.ticketFk}
|
|
||||||
};
|
|
||||||
|
|
||||||
const sales = await Self.app.models.Sale.find(salesFilter, myOptions);
|
|
||||||
|
|
||||||
for (const tracking of trackings) {
|
|
||||||
for (const sale of sales) {
|
|
||||||
if (tracking.itemFk == sale.itemFk)
|
|
||||||
tracking.item = sale.item();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return trackings;
|
return trackings;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -30,12 +30,12 @@
|
||||||
<span class="chip {{$ctrl.chipIsControled(sale.preparingList.isControled)}} vn-mx-xs" vn-tooltip="is controled"></span>
|
<span class="chip {{$ctrl.chipIsControled(sale.preparingList.isControled)}} vn-mx-xs" vn-tooltip="is controled"></span>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
<vn-td number>
|
<vn-td number>
|
||||||
<span
|
<span
|
||||||
ng-click="$ctrl.showItemDescriptor($event, sale)"
|
ng-click="itemDescriptor.show($event, sale.item.id)"
|
||||||
class="link">
|
class="link">
|
||||||
{{::sale.itemFk | zeroFill:6}}
|
{{::sale.item.id}}
|
||||||
</span>
|
</span>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
<vn-td vn-fetched-tags>
|
<vn-td vn-fetched-tags>
|
||||||
<div>
|
<div>
|
||||||
<vn-one title="{{::sale.item.name}}">{{::sale.item.name}}</vn-one>
|
<vn-one title="{{::sale.item.name}}">{{::sale.item.name}}</vn-one>
|
||||||
|
@ -96,27 +96,23 @@
|
||||||
</vn-tr>
|
</vn-tr>
|
||||||
</vn-thead>
|
</vn-thead>
|
||||||
<vn-tbody>
|
<vn-tbody>
|
||||||
<vn-tr ng-repeat="sale in saleTrackings">
|
<vn-tr ng-repeat="saleTracking in saleTrackings">
|
||||||
<vn-td number>{{::sale.quantity}}</vn-td>
|
<vn-td number>{{::saleTracking.quantity}}</vn-td>
|
||||||
<vn-td number>{{::sale.originalQuantity}}</vn-td>
|
<vn-td number>{{::saleTracking.originalQuantity}}</vn-td>
|
||||||
<vn-td expand>
|
<vn-td expand>
|
||||||
<span
|
<span
|
||||||
class="link"
|
class="link"
|
||||||
ng-click="workerDescriptor.show($event, sale.workerFk)">
|
ng-click="workerDescriptor.show($event, saleTracking.workerFk)">
|
||||||
{{::sale.userNickname | dashIfEmpty}}
|
{{::saleTracking.name | dashIfEmpty}}
|
||||||
</span>
|
</span>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
<vn-td shrink>{{::sale.state}}</vn-td>
|
<vn-td shrink>{{::saleTracking.state}}</vn-td>
|
||||||
<vn-td expand>{{::sale.created | date: 'dd/MM/yyyy HH:mm'}}</vn-td>
|
<vn-td expand>{{::saleTracking.created | date: 'dd/MM/yyyy HH:mm'}}</vn-td>
|
||||||
</vn-tr>
|
</vn-tr>
|
||||||
</vn-tbody>
|
</vn-tbody>
|
||||||
</vn-table>
|
</vn-table>
|
||||||
</vn-card>
|
</vn-card>
|
||||||
</vn-data-viewer>
|
</vn-data-viewer>
|
||||||
<vn-item-descriptor-popover
|
|
||||||
vn-id="item-descriptor"
|
|
||||||
warehouse-fk="$ctrl.ticket.warehouseFk">
|
|
||||||
</vn-item-descriptor-popover>
|
|
||||||
<vn-worker-descriptor-popover
|
<vn-worker-descriptor-popover
|
||||||
vn-id="worker-descriptor">
|
vn-id="worker-descriptor">
|
||||||
</vn-worker-descriptor-popover>
|
</vn-worker-descriptor-popover>
|
||||||
|
|
|
@ -45,14 +45,14 @@ class Controller extends Section {
|
||||||
btnThree: {
|
btnThree: {
|
||||||
icon: 'icon-transaction',
|
icon: 'icon-transaction',
|
||||||
state: `item.card.diary({
|
state: `item.card.diary({
|
||||||
id: ${sale.itemFk},
|
id: ${sale.item.id},
|
||||||
warehouseFk: ${this.ticket.warehouseFk},
|
warehouseFk: ${this.ticket.warehouseFk},
|
||||||
lineFk: ${sale.id}
|
lineFk: ${sale.id}
|
||||||
})`,
|
})`,
|
||||||
tooltip: 'Item diary'
|
tooltip: 'Item diary'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
this.$.itemDescriptor.show(event.target, sale.itemFk);
|
this.$.itemDescriptor.show(event.target, sale.item.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
chipHasSaleGroupDetail(hasSaleGroupDetail) {
|
chipHasSaleGroupDetail(hasSaleGroupDetail) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "salix-back",
|
"name": "salix-back",
|
||||||
"version": "230401",
|
"version": "23.04.01",
|
||||||
"author": "Verdnatura Levante SL",
|
"author": "Verdnatura Levante SL",
|
||||||
"description": "Salix backend",
|
"description": "Salix backend",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
const Component = require(`vn-print/core/component`);
|
||||||
|
const reportHeader = new Component('report-header');
|
||||||
|
const reportFooter = new Component('report-footer');
|
||||||
|
const reportBody = new Component('report-body');
|
||||||
|
const NotFoundError = require('vn-loopback/util/not-found-error');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
components: {
|
||||||
|
'report-body': reportBody.build(),
|
||||||
|
'report-header': reportHeader.build(),
|
||||||
|
'report-footer': reportFooter.build()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
checkMainEntity: function(entity) {
|
||||||
|
if (entity == null)
|
||||||
|
throw new NotFoundError();
|
||||||
|
},
|
||||||
|
formatDate: function(date, format) {
|
||||||
|
const filters = this.$options.filters;
|
||||||
|
return filters.date(date, format);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
|
@ -3,7 +3,7 @@
|
||||||
<div class="grid-block">
|
<div class="grid-block">
|
||||||
<div class="columns">
|
<div class="columns">
|
||||||
<div class="size50">
|
<div class="size50">
|
||||||
<p style="text-align: right">{{$t('Place')}} {{currentDate()}}</p>
|
<p style="text-align: right">{{$t('Place')}} {{formatDate(new Date(), '%d-%m-%Y')}}</p>
|
||||||
<h3 style="text-align: center; margin-top: 8%">{{$t('Compensation') | uppercase}}</h3>
|
<h3 style="text-align: center; margin-top: 8%">{{$t('Compensation') | uppercase}}</h3>
|
||||||
<p style="margin-top: 8%">{{$t('In one hand')}}:</p>
|
<p style="margin-top: 8%">{{$t('In one hand')}}:</p>
|
||||||
<p style="text-align: justify">
|
<p style="text-align: justify">
|
||||||
|
@ -17,7 +17,7 @@
|
||||||
</p>
|
</p>
|
||||||
<h4 style="text-align: center; margin-top: 10%">{{$t('Agree') | uppercase}}</h4>
|
<h4 style="text-align: center; margin-top: 10%">{{$t('Agree') | uppercase}}</h4>
|
||||||
<p style="margin-top: 8%; text-align: justify">
|
<p style="margin-top: 8%; text-align: justify">
|
||||||
{{$t('Date')}} {{client.payed | date('%d-%m-%Y')}} {{$t('Compensate')}} {{client.amountPaid}} €
|
{{$t('Date')}} {{formatDate(client.payed, '%d-%m-%Y')}} {{$t('Compensate')}} {{client.amountPaid}} €
|
||||||
{{$t('From client')}} {{client.name}} {{$t('Toclient')}} {{company.name}}.
|
{{$t('From client')}} {{client.name}} {{$t('Toclient')}} {{company.name}}.
|
||||||
</p>
|
</p>
|
||||||
<p style="margin-top: 8%">
|
<p style="margin-top: 8%">
|
||||||
|
|
|
@ -1,28 +1,12 @@
|
||||||
const Component = require(`vn-print/core/component`);
|
const vnReport = require('../../../core/mixins/vn-report.js');
|
||||||
const reportBody = new Component('report-body');
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'balance-compensation',
|
name: 'balance-compensation',
|
||||||
|
mixins: [vnReport],
|
||||||
async serverPrefetch() {
|
async serverPrefetch() {
|
||||||
this.client = await this.fetchClient(this.id);
|
this.client = await this.findOneFromDef('client', [this.id]);
|
||||||
this.company = await this.fetchCompany(this.id);
|
this.checkMainEntity(this.client);
|
||||||
},
|
this.company = await this.findOneFromDef('company', [this.id]);
|
||||||
methods: {
|
|
||||||
fetchClient(id) {
|
|
||||||
return this.findOneFromDef('client', [id]);
|
|
||||||
},
|
|
||||||
fetchCompany(id) {
|
|
||||||
return this.findOneFromDef('company', [id]);
|
|
||||||
},
|
|
||||||
|
|
||||||
currentDate() {
|
|
||||||
const current = new Date();
|
|
||||||
const date = `${current.getDate()}/${current.getMonth() + 1}/${current.getFullYear()}`;
|
|
||||||
return date;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
components: {
|
|
||||||
'report-body': reportBody.build()
|
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
id: {
|
id: {
|
||||||
|
|
|
@ -13,11 +13,11 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="font gray">{{$t('From')}}</td>
|
<td class="font gray">{{$t('From')}}</td>
|
||||||
<th>{{from | date('%d-%m-%Y')}}</th>
|
<th>{{formatDate(from, '%d-%m-%Y')}}</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="font gray">{{$t('To')}}</td>
|
<td class="font gray">{{$t('To')}}</td>
|
||||||
<th>{{to | date('%d-%m-%Y')}}</th>
|
<th>{{formatDate(to, '%d-%m-%Y')}}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -1,27 +1,12 @@
|
||||||
const Component = require(`vn-print/core/component`);
|
const vnReport = require('../../../core/mixins/vn-report.js');
|
||||||
const reportBody = new Component('report-body');
|
|
||||||
const reportFooter = new Component('report-footer');
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'campaign-metrics',
|
name: 'campaign-metrics',
|
||||||
|
mixins: [vnReport],
|
||||||
async serverPrefetch() {
|
async serverPrefetch() {
|
||||||
this.client = await this.fetchClient(this.id);
|
this.client = await this.findOneFromDef('client', [this.id]);
|
||||||
this.sales = await this.fetchSales(this.id, this.from, this.to);
|
this.checkMainEntity(this.client);
|
||||||
|
this.sales = await this.rawSqlFromDef('sales', [this.id, this.from, this.to]);
|
||||||
if (!this.client)
|
|
||||||
throw new Error('Something went wrong');
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
fetchClient(id) {
|
|
||||||
return this.findOneFromDef('client', [id]);
|
|
||||||
},
|
|
||||||
fetchSales(id, from, to) {
|
|
||||||
return this.rawSqlFromDef('sales', [id, from, to]);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
components: {
|
|
||||||
'report-body': reportBody.build(),
|
|
||||||
'report-footer': reportFooter.build()
|
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
id: {
|
id: {
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="font gray uppercase">{{$t('date')}}</td>
|
<td class="font gray uppercase">{{$t('date')}}</td>
|
||||||
<th>{{dated}}</th>
|
<th>{{formatDate(new Date(), '%d-%m-%Y')}}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -1,34 +1,12 @@
|
||||||
const Component = require(`vn-print/core/component`);
|
const vnReport = require('../../../core/mixins/vn-report.js');
|
||||||
const reportBody = new Component('report-body');
|
|
||||||
const reportFooter = new Component('report-footer');
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'claim-pickup-order',
|
name: 'claim-pickup-order',
|
||||||
|
mixins: [vnReport],
|
||||||
async serverPrefetch() {
|
async serverPrefetch() {
|
||||||
this.client = await this.fetchClient(this.id);
|
this.client = await this.findOneFromDef('client', [this.id]);
|
||||||
this.sales = await this.fetchSales(this.id);
|
this.checkMainEntity(this.client);
|
||||||
|
this.sales = await this.rawSqlFromDef('sales', [this.id]);
|
||||||
if (!this.client)
|
|
||||||
throw new Error('Something went wrong');
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
dated: function() {
|
|
||||||
const filters = this.$options.filters;
|
|
||||||
|
|
||||||
return filters.date(new Date(), '%d-%m-%Y');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
fetchClient(id) {
|
|
||||||
return this.findOneFromDef('client', [id]);
|
|
||||||
},
|
|
||||||
fetchSales(id) {
|
|
||||||
return this.rawSqlFromDef('sales', [id]);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
components: {
|
|
||||||
'report-body': reportBody.build(),
|
|
||||||
'report-footer': reportFooter.build()
|
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
id: {
|
id: {
|
||||||
|
@ -36,5 +14,5 @@ module.exports = {
|
||||||
required: true,
|
required: true,
|
||||||
description: 'The claim id'
|
description: 'The claim id'
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="font gray uppercase">{{$t('date')}}</td>
|
<td class="font gray uppercase">{{$t('date')}}</td>
|
||||||
<th>{{dated}}</th>
|
<th>{{formatDate(new Date(), '%d-%m-%Y');}}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
@ -44,7 +44,7 @@
|
||||||
</thead>
|
</thead>
|
||||||
<tbody v-for="sale in sales" :key="sale.id">
|
<tbody v-for="sale in sales" :key="sale.id">
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{sale.issued | date('%d-%m-%Y')}}</td>
|
<td>{{formatDate(sale.issued, '%d-%m-%Y');}}</td>
|
||||||
<td>{{sale.ref}}</td>
|
<td>{{sale.ref}}</td>
|
||||||
<td class="number">{{sale.debtOut}}</td>
|
<td class="number">{{sale.debtOut}}</td>
|
||||||
<td class="number">{{sale.debtIn}}</td>
|
<td class="number">{{sale.debtIn}}</td>
|
||||||
|
|
|
@ -1,44 +1,18 @@
|
||||||
const Component = require(`vn-print/core/component`);
|
const vnReport = require('../../../core/mixins/vn-report.js');
|
||||||
const reportBody = new Component('report-body');
|
|
||||||
const reportFooter = new Component('report-footer');
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'client-debt-statement',
|
name: 'client-debt-statement',
|
||||||
|
mixins: [vnReport],
|
||||||
async serverPrefetch() {
|
async serverPrefetch() {
|
||||||
this.client = await this.fetchClient(this.id);
|
this.client = await this.findOneFromDef('client', [this.id]);
|
||||||
this.sales = await this.fetchSales(this.id, this.from);
|
this.checkMainEntity(this.client);
|
||||||
|
this.sales = await this.rawSqlFromDef('sales',
|
||||||
if (!this.client)
|
[this.from, this.id, this.from, this.id, this.from, this.id, this.from, this.id, this.from, this.id]);
|
||||||
throw new Error('Something went wrong');
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
dated: function() {
|
|
||||||
const filters = this.$options.filters;
|
|
||||||
|
|
||||||
return filters.date(new Date(), '%d-%m-%Y');
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {totalBalance: 0.00};
|
return {totalBalance: 0.00};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
fetchClient(id) {
|
|
||||||
return this.findOneFromDef('client', [id]);
|
|
||||||
},
|
|
||||||
fetchSales(id, from) {
|
|
||||||
return this.rawSqlFromDef('sales', [
|
|
||||||
from,
|
|
||||||
id,
|
|
||||||
from,
|
|
||||||
id,
|
|
||||||
from,
|
|
||||||
id,
|
|
||||||
from,
|
|
||||||
id,
|
|
||||||
from,
|
|
||||||
id
|
|
||||||
]);
|
|
||||||
},
|
|
||||||
getBalance(sale) {
|
getBalance(sale) {
|
||||||
if (sale.debtOut)
|
if (sale.debtOut)
|
||||||
this.totalBalance += parseFloat(sale.debtOut);
|
this.totalBalance += parseFloat(sale.debtOut);
|
||||||
|
@ -63,10 +37,6 @@ module.exports = {
|
||||||
return debtIn.toFixed(2);
|
return debtIn.toFixed(2);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
components: {
|
|
||||||
'report-body': reportBody.build(),
|
|
||||||
'report-footer': reportFooter.build()
|
|
||||||
},
|
|
||||||
props: {
|
props: {
|
||||||
id: {
|
id: {
|
||||||
type: Number,
|
type: Number,
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
const Component = require(`vn-print/core/component`);
|
|
||||||
const reportBody = new Component('report-body');
|
|
||||||
const jsBarcode = require('jsbarcode');
|
const jsBarcode = require('jsbarcode');
|
||||||
const {DOMImplementation, XMLSerializer} = require('xmldom');
|
const {DOMImplementation, XMLSerializer} = require('xmldom');
|
||||||
const UserError = require('vn-loopback/util/user-error');
|
const vnReport = require('../../../core/mixins/vn-report.js');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'collection-label',
|
name: 'collection-label',
|
||||||
|
mixins: [vnReport],
|
||||||
props: {
|
props: {
|
||||||
id: {
|
id: {
|
||||||
type: Number,
|
type: Number,
|
||||||
|
@ -30,8 +29,7 @@ module.exports = {
|
||||||
ticketIds = [this.id];
|
ticketIds = [this.id];
|
||||||
|
|
||||||
this.labelsData = await this.rawSqlFromDef('labelsData', [ticketIds]);
|
this.labelsData = await this.rawSqlFromDef('labelsData', [ticketIds]);
|
||||||
if (!this.labelsData.length)
|
this.checkMainEntity(this.labelsData);
|
||||||
throw new UserError('Empty data source');
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getBarcode(id) {
|
getBarcode(id) {
|
||||||
|
@ -62,7 +60,4 @@ module.exports = {
|
||||||
return value;
|
return value;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
components: {
|
|
||||||
'report-body': reportBody.build()
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -159,6 +159,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<template v-slot:footer>
|
<template v-slot:footer>
|
||||||
<report-footer id="pageFooter" v-bind:left-text="dated" v-bind="$props"> </report-footer>
|
<report-footer id="pageFooter" v-bind:left-text="formatDate(new Date(), '%d-%m-%Y')" v-bind="$props"> </report-footer>
|
||||||
</template>
|
</template>
|
||||||
</report-body>
|
</report-body>
|
||||||
|
|
|
@ -1,20 +1,7 @@
|
||||||
const Component = require(`vn-print/core/component`);
|
const vnReport = require('../../../core/mixins/vn-report.js');
|
||||||
const reportBody = new Component('report-body')
|
|
||||||
const reportFooter = new Component('report-footer');
|
|
||||||
|
|
||||||
const rptCreditRequest = {
|
module.exports = {
|
||||||
name: 'credit-request',
|
name: 'credit-request',
|
||||||
computed: {
|
mixins: [vnReport],
|
||||||
dated: function() {
|
|
||||||
const filters = this.$options.filters;
|
|
||||||
|
|
||||||
return filters.date(new Date(), '%d-%m-%Y');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
components: {
|
|
||||||
'report-body': reportBody.build(),
|
|
||||||
'report-footer': reportFooter.build()
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = rptCreditRequest;
|
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="font gray uppercase">{{$t('date')}}</td>
|
<td class="font gray uppercase">{{$t('date')}}</td>
|
||||||
<th>{{ticket.shipped | date('%d-%m-%Y')}}</th>
|
<th>{{formatDate(ticket.shipped, '%d-%m-%Y')}}</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="font gray uppercase">{{$t('packages')}}</td>
|
<td class="font gray uppercase">{{$t('packages')}}</td>
|
||||||
|
@ -231,7 +231,7 @@
|
||||||
<div class="header">{{$t('digitalSignature')}}</div>
|
<div class="header">{{$t('digitalSignature')}}</div>
|
||||||
<div class="body centered">
|
<div class="body centered">
|
||||||
<img v-bind:src="dmsPath" />
|
<img v-bind:src="dmsPath" />
|
||||||
<div>{{signature.created | date('%d-%m-%Y')}}</div>
|
<div>{{formatDate(signature.created, '%d-%m-%Y')}}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,25 +1,21 @@
|
||||||
const config = require(`vn-print/core/config`);
|
const config = require(`vn-print/core/config`);
|
||||||
const Component = require(`vn-print/core/component`);
|
const vnReport = require('../../../core/mixins/vn-report.js');
|
||||||
const reportBody = new Component('report-body');
|
|
||||||
const reportHeader = new Component('report-header');
|
|
||||||
const reportFooter = new Component('report-footer');
|
|
||||||
const md5 = require('md5');
|
const md5 = require('md5');
|
||||||
const fs = require('fs-extra');
|
const fs = require('fs-extra');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'delivery-note',
|
name: 'delivery-note',
|
||||||
|
mixins: [vnReport],
|
||||||
async serverPrefetch() {
|
async serverPrefetch() {
|
||||||
this.client = await this.fetchClient(this.id);
|
this.ticket = await this.findOneFromDef('ticket', [this.id]);
|
||||||
this.ticket = await this.fetchTicket(this.id);
|
this.checkMainEntity(this.ticket);
|
||||||
this.sales = await this.fetchSales(this.id);
|
this.client = await this.findOneFromDef('client', [this.id]);
|
||||||
this.address = await this.fetchAddress(this.id);
|
this.sales = await this.rawSqlFromDef('sales', [this.id]);
|
||||||
this.services = await this.fetchServices(this.id);
|
this.address = await this.findOneFromDef(`address`, [this.id]);
|
||||||
this.taxes = await this.fetchTaxes(this.id);
|
this.services = await this.rawSqlFromDef('services', [this.id]);
|
||||||
this.packagings = await this.fetchPackagings(this.id);
|
this.taxes = await this.rawSqlFromDef('taxes', [this.id]);
|
||||||
this.signature = await this.fetchSignature(this.id);
|
this.packagings = await this.rawSqlFromDef('packagings', [this.id]);
|
||||||
|
this.signature = await this.findOneFromDef('signature', [this.id]);
|
||||||
if (!this.ticket)
|
|
||||||
throw new Error('Something went wrong');
|
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {totalBalance: 0.00};
|
return {totalBalance: 0.00};
|
||||||
|
@ -61,31 +57,6 @@ module.exports = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
fetchClient(id) {
|
|
||||||
return this.findOneFromDef('client', [id]);
|
|
||||||
},
|
|
||||||
fetchTicket(id) {
|
|
||||||
return this.findOneFromDef('ticket', [id]);
|
|
||||||
},
|
|
||||||
fetchAddress(id) {
|
|
||||||
return this.findOneFromDef(`address`, [id]);
|
|
||||||
},
|
|
||||||
fetchSignature(id) {
|
|
||||||
return this.findOneFromDef('signature', [id]);
|
|
||||||
},
|
|
||||||
fetchTaxes(id) {
|
|
||||||
return this.findOneFromDef(`taxes`, [id]);
|
|
||||||
},
|
|
||||||
fetchSales(id) {
|
|
||||||
return this.rawSqlFromDef('sales', [id]);
|
|
||||||
},
|
|
||||||
fetchPackagings(id) {
|
|
||||||
return this.rawSqlFromDef('packagings', [id]);
|
|
||||||
},
|
|
||||||
fetchServices(id) {
|
|
||||||
return this.rawSqlFromDef('services', [id]);
|
|
||||||
},
|
|
||||||
|
|
||||||
getSubTotal() {
|
getSubTotal() {
|
||||||
let subTotal = 0.00;
|
let subTotal = 0.00;
|
||||||
this.sales.forEach(sale => {
|
this.sales.forEach(sale => {
|
||||||
|
@ -125,11 +96,6 @@ module.exports = {
|
||||||
).join(', ');
|
).join(', ');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
|
||||||
'report-body': reportBody.build(),
|
|
||||||
'report-header': reportHeader.build(),
|
|
||||||
'report-footer': reportFooter.build()
|
|
||||||
},
|
|
||||||
props: {
|
props: {
|
||||||
id: {
|
id: {
|
||||||
type: Number,
|
type: Number,
|
||||||
|
|
|
@ -16,13 +16,13 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="font gray align-right">{{$t('date')}}</th>
|
<th class="font gray align-right">{{$t('date')}}</th>
|
||||||
<td>{{route.created | date('%d-%m-%Y')}}</td>
|
<td>{{formatDate(route.created, '%d-%m-%Y')}}</td>
|
||||||
<th class="font gray align-right">{{$t('vehicle')}}</th>
|
<th class="font gray align-right">{{$t('vehicle')}}</th>
|
||||||
<td>{{route.vehicleTradeMark}} {{route.vehicleModel}}</td>
|
<td>{{route.vehicleTradeMark}} {{route.vehicleModel}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="font gray align-right">{{$t('time')}}</th>
|
<th class="font gray align-right">{{$t('time')}}</th>
|
||||||
<td>{{route.time | date('%H:%M')}}</td>
|
<td>{{formatDate(route.time, '%H:%M')}}</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td>{{route.plateNumber}}</td>
|
<td>{{route.plateNumber}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
const Component = require(`vn-print/core/component`);
|
const vnReport = require('../../../core/mixins/vn-report.js');
|
||||||
const reportBody = new Component('report-body');
|
|
||||||
const reportFooter = new Component('report-footer');
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'driver-route',
|
name: 'driver-route',
|
||||||
|
mixins: [vnReport],
|
||||||
async serverPrefetch() {
|
async serverPrefetch() {
|
||||||
let ids = this.id;
|
let ids = this.id;
|
||||||
|
|
||||||
|
@ -11,8 +10,8 @@ module.exports = {
|
||||||
if (hasMultipleRoutes)
|
if (hasMultipleRoutes)
|
||||||
ids = this.id.split(',');
|
ids = this.id.split(',');
|
||||||
|
|
||||||
const routes = await this.fetchRoutes(ids);
|
const routes = await this.rawSqlFromDef('routes', [ids]);
|
||||||
const tickets = await this.fetchTickets(ids);
|
const tickets = await this.rawSqlFromDef('tickets', [ids, ids]);
|
||||||
|
|
||||||
const map = new Map();
|
const map = new Map();
|
||||||
|
|
||||||
|
@ -27,20 +26,7 @@ module.exports = {
|
||||||
|
|
||||||
this.routes = routes;
|
this.routes = routes;
|
||||||
|
|
||||||
if (!this.routes)
|
this.checkMainEntity(this.routes);
|
||||||
throw new Error('Something went wrong');
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
fetchRoutes(ids) {
|
|
||||||
return this.rawSqlFromDef('routes', [ids]);
|
|
||||||
},
|
|
||||||
fetchTickets(ids) {
|
|
||||||
return this.rawSqlFromDef('tickets', [ids, ids]);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
components: {
|
|
||||||
'report-body': reportBody.build(),
|
|
||||||
'report-footer': reportFooter.build()
|
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
id: {
|
id: {
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="font gray uppercase">{{$t('date')}}</td>
|
<td class="font gray uppercase">{{$t('date')}}</td>
|
||||||
<th>{{entry.landed | date('%d-%m-%Y')}}</th>
|
<th>{{formatDate(entry.landed,'%d-%m-%Y')}}</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="font gray uppercase">{{$t('ref')}}</td>
|
<td class="font gray uppercase">{{$t('ref')}}</td>
|
||||||
|
|
|
@ -1,31 +1,18 @@
|
||||||
const Component = require(`vn-print/core/component`);
|
const vnReport = require('../../../core/mixins/vn-report.js');
|
||||||
const reportBody = new Component('report-body');
|
|
||||||
const reportHeader = new Component('report-header');
|
|
||||||
const reportFooter = new Component('report-footer');
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'entry-order',
|
name: 'entry-order',
|
||||||
|
mixins: [vnReport],
|
||||||
async serverPrefetch() {
|
async serverPrefetch() {
|
||||||
this.supplier = await this.fetchSupplier(this.id);
|
this.entry = await this.findOneFromDef('entry', [this.id]);
|
||||||
this.entry = await this.fetchEntry(this.id);
|
this.checkMainEntity(this.entry);
|
||||||
this.buys = await this.fetchBuys(this.id);
|
this.supplier = await this.findOneFromDef('supplier', [this.id]);
|
||||||
|
this.buys = await this.rawSqlFromDef('buys', [this.id]);
|
||||||
if (!this.entry)
|
|
||||||
throw new Error('Something went wrong');
|
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {totalBalance: 0.00};
|
return {totalBalance: 0.00};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
fetchSupplier(id) {
|
|
||||||
return this.findOneFromDef('supplier', [id]);
|
|
||||||
},
|
|
||||||
fetchEntry(id) {
|
|
||||||
return this.findOneFromDef('entry', [id]);
|
|
||||||
},
|
|
||||||
fetchBuys(id) {
|
|
||||||
return this.rawSqlFromDef('buys', [id]);
|
|
||||||
},
|
|
||||||
getTotal() {
|
getTotal() {
|
||||||
let total = 0.00;
|
let total = 0.00;
|
||||||
this.buys.forEach(buy => {
|
this.buys.forEach(buy => {
|
||||||
|
@ -35,11 +22,6 @@ module.exports = {
|
||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
|
||||||
'report-body': reportBody.build(),
|
|
||||||
'report-header': reportHeader.build(),
|
|
||||||
'report-footer': reportFooter.build()
|
|
||||||
},
|
|
||||||
props: {
|
props: {
|
||||||
id: {
|
id: {
|
||||||
type: Number,
|
type: Number,
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
const Component = require(`vn-print/core/component`);
|
const vnReport = require('../../../core/mixins/vn-report.js');
|
||||||
const reportBody = new Component('report-body');
|
|
||||||
const jsBarcode = require('jsbarcode');
|
const jsBarcode = require('jsbarcode');
|
||||||
const {DOMImplementation, XMLSerializer} = require('xmldom');
|
const {DOMImplementation, XMLSerializer} = require('xmldom');
|
||||||
const UserError = require('vn-loopback/util/user-error');
|
|
||||||
const qrcode = require('qrcode');
|
const qrcode = require('qrcode');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'expedition-pallet-label',
|
name: 'expedition-pallet-label',
|
||||||
|
mixins: [vnReport],
|
||||||
props: {
|
props: {
|
||||||
id: {
|
id: {
|
||||||
type: Number,
|
type: Number,
|
||||||
|
@ -33,8 +32,7 @@ module.exports = {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.QR = await this.getQR(QRdata);
|
this.QR = await this.getQR(QRdata);
|
||||||
if (!this.labelsData.length)
|
this.checkMainEntity(this.labelsData);
|
||||||
throw new UserError('Empty data source');
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getQR(id) {
|
getQR(id) {
|
||||||
|
@ -56,7 +54,4 @@ module.exports = {
|
||||||
return xmlSerializer.serializeToString(svgNode);
|
return xmlSerializer.serializeToString(svgNode);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
components: {
|
|
||||||
'report-body': reportBody.build()
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<div class="grid-block">
|
<div class="grid-block">
|
||||||
<h1 class="title centered uppercase">{{$t('title')}}</h1>
|
<h1 class="title centered uppercase">{{$t('title')}}</h1>
|
||||||
<p>{{$t('toAttention')}}</p>
|
<p>{{$t('toAttention')}}</p>
|
||||||
<p v-html="$t('declaration', [invoice.ref, issued])"></p>
|
<p v-html="$t('declaration', [invoice.ref, formatDate(invoice.issued, '%d-%m-%Y')])"></p>
|
||||||
<p>
|
<p>
|
||||||
<ul>
|
<ul>
|
||||||
<li v-for="responsibility in $t('responsibilities')">
|
<li v-for="responsibility in $t('responsibilities')">
|
||||||
|
@ -32,4 +32,4 @@
|
||||||
<template v-slot:footer>
|
<template v-slot:footer>
|
||||||
<report-footer id="pageFooter" v-bind:left-text="$t('invoice', [invoice.ref])" v-bind="$props"></report-footer>
|
<report-footer id="pageFooter" v-bind:left-text="$t('invoice', [invoice.ref])" v-bind="$props"></report-footer>
|
||||||
</template>
|
</template>
|
||||||
</report-body>
|
</report-body>
|
||||||
|
|
|
@ -1,33 +1,13 @@
|
||||||
const Component = require(`vn-print/core/component`);
|
const vnReport = require('../../../core/mixins/vn-report.js');
|
||||||
const reportBody = new Component('report-body');
|
|
||||||
const reportFooter = new Component('report-footer');
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'exportation',
|
name: 'exportation',
|
||||||
|
mixins: [vnReport],
|
||||||
async serverPrefetch() {
|
async serverPrefetch() {
|
||||||
this.invoice = await this.fetchInvoice(this.reference);
|
this.invoice = await this.findOneFromDef('invoice', [this.reference]);
|
||||||
|
this.checkMainEntity(this.invoice);
|
||||||
if (!this.invoice)
|
|
||||||
throw new Error('Something went wrong');
|
|
||||||
|
|
||||||
this.company = await this.findOneFromDef('company', [this.invoice.companyFk]);
|
this.company = await this.findOneFromDef('company', [this.invoice.companyFk]);
|
||||||
},
|
},
|
||||||
methods: {
|
|
||||||
fetchInvoice(reference) {
|
|
||||||
return this.findOneFromDef('invoice', [reference]);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
issued: function() {
|
|
||||||
const filters = this.$options.filters;
|
|
||||||
|
|
||||||
return filters.date(this.invoice.issued, '%d-%m-%Y');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
components: {
|
|
||||||
'report-body': reportBody.build(),
|
|
||||||
'report-footer': reportFooter.build()
|
|
||||||
},
|
|
||||||
props: {
|
props: {
|
||||||
reference: {
|
reference: {
|
||||||
type: Number,
|
type: Number,
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="font gray align-right">{{$t('shipped')}}</th>
|
<th class="font gray align-right">{{$t('shipped')}}</th>
|
||||||
<td>{{travel.shipped | date('%d-%m-%Y')}}</td>
|
<td>{{formatDate(travel.shipped, '%d-%m-%Y')}}</td>
|
||||||
<th class="font gray align-right">{{$t('physicalKg')}}</th>
|
<th class="font gray align-right">{{$t('physicalKg')}}</th>
|
||||||
<td>{{travel.loadedKg | number($i18n.locale)}}</td>
|
<td>{{travel.loadedKg | number($i18n.locale)}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -62,6 +62,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<template v-slot:footer>
|
<template v-slot:footer>
|
||||||
<report-footer id="pageFooter" v-bind:left-text="dated" v-bind="$props"></report-footer>
|
<report-footer id="pageFooter" v-bind:left-text="formatDate(new Date(), '%d-%m-%Y')" v-bind="$props"></report-footer>
|
||||||
</template>
|
</template>
|
||||||
</report-body>
|
</report-body>
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
const Component = require(`vn-print/core/component`);
|
const vnReport = require('../../../core/mixins/vn-report.js');
|
||||||
const reportBody = new Component('report-body');
|
|
||||||
const reportFooter = new Component('report-footer');
|
|
||||||
const db = require(`vn-print/core/database`);
|
const db = require(`vn-print/core/database`);
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'extra-community',
|
name: 'extra-community',
|
||||||
|
mixins: [vnReport],
|
||||||
async serverPrefetch() {
|
async serverPrefetch() {
|
||||||
this.filters = this.$options.filters;
|
|
||||||
const args = {
|
const args = {
|
||||||
landedTo: this.landedEnd,
|
landedTo: this.landedEnd,
|
||||||
shippedFrom: this.shippedStart,
|
shippedFrom: this.shippedStart,
|
||||||
|
@ -21,8 +19,9 @@ module.exports = {
|
||||||
};
|
};
|
||||||
|
|
||||||
const travels = await this.fetchTravels(args);
|
const travels = await this.fetchTravels(args);
|
||||||
|
this.checkMainEntity(travels);
|
||||||
const travelIds = travels.map(travel => travel.id);
|
const travelIds = travels.map(travel => travel.id);
|
||||||
const entries = await this.fetchEntries(travelIds);
|
const entries = await this.rawSqlFromDef('entries', [travelIds]);
|
||||||
|
|
||||||
const map = new Map();
|
const map = new Map();
|
||||||
for (let travel of travels)
|
for (let travel of travels)
|
||||||
|
@ -35,23 +34,15 @@ module.exports = {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.travels = travels;
|
this.travels = travels;
|
||||||
|
|
||||||
if (!this.travels)
|
|
||||||
throw new Error('Something went wrong');
|
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
dated: function() {
|
|
||||||
return this.filters.date(new Date(), '%d-%m-%Y');
|
|
||||||
},
|
|
||||||
landedEnd: function() {
|
landedEnd: function() {
|
||||||
if (!this.landedTo) return;
|
if (!this.landedTo) return;
|
||||||
|
return formatDate(this.landedTo, '%Y-%m-%d');
|
||||||
return this.filters.date(this.landedTo, '%Y-%m-%d');
|
|
||||||
},
|
},
|
||||||
shippedStart: function() {
|
shippedStart: function() {
|
||||||
if (!this.shippedFrom) return;
|
if (!this.shippedFrom) return;
|
||||||
|
return formatDate(this.shippedFrom, '%Y-%m-%d');
|
||||||
return this.filters.date(this.shippedFrom, '%Y-%m-%d');
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -83,25 +74,17 @@ module.exports = {
|
||||||
query = db.merge(query, where);
|
query = db.merge(query, where);
|
||||||
query = db.merge(query, 'GROUP BY t.id');
|
query = db.merge(query, 'GROUP BY t.id');
|
||||||
query = db.merge(query, `
|
query = db.merge(query, `
|
||||||
ORDER BY
|
ORDER BY
|
||||||
shipped ASC,
|
shipped ASC,
|
||||||
landed ASC,
|
landed ASC,
|
||||||
travelFk,
|
travelFk,
|
||||||
loadPriority,
|
loadPriority,
|
||||||
agencyModeFk,
|
agencyModeFk,
|
||||||
evaNotes
|
evaNotes
|
||||||
`);
|
`);
|
||||||
|
|
||||||
return this.rawSql(query);
|
return this.rawSql(query);
|
||||||
},
|
},
|
||||||
|
|
||||||
fetchEntries(travelIds) {
|
|
||||||
return this.rawSqlFromDef('entries', [travelIds]);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
components: {
|
|
||||||
'report-body': reportBody.build(),
|
|
||||||
'report-footer': reportFooter.build()
|
|
||||||
},
|
},
|
||||||
props: [
|
props: [
|
||||||
'landedTo',
|
'landedTo',
|
||||||
|
|
|
@ -1,23 +1,12 @@
|
||||||
const Component = require(`vn-print/core/component`);
|
const vnReport = require('../../../core/mixins/vn-report.js');
|
||||||
const reportBody = new Component('report-body');
|
|
||||||
const reportFooter = new Component('report-footer');
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'incoterms-authorization',
|
name: 'incoterms-authorization',
|
||||||
|
mixins: [vnReport],
|
||||||
async serverPrefetch() {
|
async serverPrefetch() {
|
||||||
this.client = await this.findOneFromDef('client', [this.id]);
|
this.client = await this.findOneFromDef('client', [this.id]);
|
||||||
|
this.checkMainEntity(this.client);
|
||||||
this.company = await this.findOneFromDef('company', [this.companyId]);
|
this.company = await this.findOneFromDef('company', [this.companyId]);
|
||||||
if (!this.client)
|
|
||||||
throw new Error('Something went wrong');
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
issued: function() {
|
|
||||||
return new Date();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
components: {
|
|
||||||
'report-body': reportBody.build(),
|
|
||||||
'report-footer': reportFooter.build()
|
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
id: {
|
id: {
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="font gray uppercase">{{$t('date')}}</td>
|
<td class="font gray uppercase">{{$t('date')}}</td>
|
||||||
<th>{{invoice.issued | date('%d-%m-%Y')}}</th>
|
<th>{{formatDate(invoice.issued, '%d-%m-%Y')}}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -1,34 +1,13 @@
|
||||||
const Component = require(`vn-print/core/component`);
|
const vnReport = require('../../../core/mixins/vn-report.js');
|
||||||
const reportBody = new Component('report-body');
|
|
||||||
const reportHeader = new Component('report-header');
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'invoice-incoterms',
|
name: 'invoice-incoterms',
|
||||||
|
mixins: [vnReport],
|
||||||
async serverPrefetch() {
|
async serverPrefetch() {
|
||||||
this.invoice = await this.fetchInvoice(this.reference);
|
this.invoice = await this.findOneFromDef('invoice', [this.reference]);
|
||||||
this.client = await this.fetchClient(this.reference);
|
this.checkMainEntity(this.invoice);
|
||||||
this.incoterms = await this.fetchIncoterms(this.reference);
|
this.client = await this.findOneFromDef('client', [this.reference]);
|
||||||
|
this.incoterms = await this.findOneFromDef('incoterms', [this.reference, this.reference, this.reference]);
|
||||||
if (!this.invoice)
|
|
||||||
throw new Error('Something went wrong');
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
fetchInvoice(reference) {
|
|
||||||
return this.findOneFromDef('invoice', [reference]);
|
|
||||||
},
|
|
||||||
fetchClient(reference) {
|
|
||||||
return this.findOneFromDef('client', [reference]);
|
|
||||||
},
|
|
||||||
fetchIncoterms(reference) {
|
|
||||||
return this.findOneFromDef('incoterms', [reference, reference, reference]);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
components: {
|
|
||||||
'report-body': reportBody.build(),
|
|
||||||
'report-header': reportHeader.build()
|
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
reference: {
|
reference: {
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="font gray uppercase">{{$t('date')}}</td>
|
<td class="font gray uppercase">{{$t('date')}}</td>
|
||||||
<th>{{invoice.issued | date('%d-%m-%Y')}}</th>
|
<th>{{formatDate(invoice.issued, '%d-%m-%Y')}}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
@ -53,7 +53,7 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr v-for="row in rectified">
|
<tr v-for="row in rectified">
|
||||||
<td>{{row.ref}}</td>
|
<td>{{row.ref}}</td>
|
||||||
<td>{{row.issued | date}}</td>
|
<td>{{formatDate(row.issued, '%d-%m-%Y')}}</td>
|
||||||
<td class="number">{{row.amount | currency('EUR', $i18n.locale)}}</td>
|
<td class="number">{{row.amount | currency('EUR', $i18n.locale)}}</td>
|
||||||
<td width="50%">{{row.description}}</td>
|
<td width="50%">{{row.description}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -75,7 +75,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="pull-left">
|
<div class="pull-left">
|
||||||
<div class="field rectangle">
|
<div class="field rectangle">
|
||||||
<span>{{ticket.shipped | date}}</span>
|
<span>{{formatDate(ticket.shipped, '%d-%m-%Y')}}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<span id="nickname" class="pull-right">
|
<span id="nickname" class="pull-right">
|
||||||
|
|
|
@ -1,22 +1,21 @@
|
||||||
const Component = require(`vn-print/core/component`);
|
|
||||||
const Report = require(`vn-print/core/report`);
|
const Report = require(`vn-print/core/report`);
|
||||||
const reportBody = new Component('report-body');
|
const vnReport = require('../../../core/mixins/vn-report.js');
|
||||||
const reportHeader = new Component('report-header');
|
|
||||||
const reportFooter = new Component('report-footer');
|
|
||||||
const invoiceIncoterms = new Report('invoice-incoterms');
|
const invoiceIncoterms = new Report('invoice-incoterms');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'invoice',
|
name: 'invoice',
|
||||||
|
mixins: [vnReport],
|
||||||
async serverPrefetch() {
|
async serverPrefetch() {
|
||||||
this.invoice = await this.fetchInvoice(this.reference);
|
this.invoice = await this.findOneFromDef('invoice', [this.reference]);
|
||||||
this.client = await this.fetchClient(this.reference);
|
this.checkMainEntity(this.invoice);
|
||||||
this.taxes = await this.fetchTaxes(this.reference);
|
this.client = await this.findOneFromDef('client', [this.reference]);
|
||||||
this.intrastat = await this.fetchIntrastat(this.reference);
|
this.taxes = await this.rawSqlFromDef(`taxes`, [this.reference]);
|
||||||
this.rectified = await this.fetchRectified(this.reference);
|
this.intrastat = await this.rawSqlFromDef(`intrastat`, [this.reference, this.reference, this.reference]);
|
||||||
this.hasIncoterms = await this.fetchHasIncoterms(this.reference);
|
this.rectified = await this.rawSqlFromDef(`rectified`, [this.reference]);
|
||||||
|
this.hasIncoterms = await this.findValueFromDef(`hasIncoterms`, [this.reference]);
|
||||||
|
|
||||||
const tickets = await this.fetchTickets(this.reference);
|
const tickets = await this.rawSqlFromDef('tickets', [this.reference]);
|
||||||
const sales = await this.fetchSales(this.reference);
|
const sales = await this.rawSqlFromDef('sales', [this.reference, this.reference]);
|
||||||
|
|
||||||
const map = new Map();
|
const map = new Map();
|
||||||
|
|
||||||
|
@ -33,9 +32,6 @@ module.exports = {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.tickets = tickets;
|
this.tickets = tickets;
|
||||||
|
|
||||||
if (!this.invoice)
|
|
||||||
throw new Error('Something went wrong');
|
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {totalBalance: 0.00};
|
return {totalBalance: 0.00};
|
||||||
|
@ -66,30 +62,6 @@ module.exports = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
fetchInvoice(reference) {
|
|
||||||
return this.findOneFromDef('invoice', [reference]);
|
|
||||||
},
|
|
||||||
fetchClient(reference) {
|
|
||||||
return this.findOneFromDef('client', [reference]);
|
|
||||||
},
|
|
||||||
fetchTickets(reference) {
|
|
||||||
return this.rawSqlFromDef('tickets', [reference]);
|
|
||||||
},
|
|
||||||
fetchSales(reference) {
|
|
||||||
return this.rawSqlFromDef('sales', [reference, reference]);
|
|
||||||
},
|
|
||||||
fetchTaxes(reference) {
|
|
||||||
return this.rawSqlFromDef(`taxes`, [reference]);
|
|
||||||
},
|
|
||||||
fetchIntrastat(reference) {
|
|
||||||
return this.rawSqlFromDef(`intrastat`, [reference, reference, reference]);
|
|
||||||
},
|
|
||||||
fetchRectified(reference) {
|
|
||||||
return this.rawSqlFromDef(`rectified`, [reference]);
|
|
||||||
},
|
|
||||||
fetchHasIncoterms(reference) {
|
|
||||||
return this.findValueFromDef(`hasIncoterms`, [reference]);
|
|
||||||
},
|
|
||||||
saleImport(sale) {
|
saleImport(sale) {
|
||||||
const price = sale.quantity * sale.price;
|
const price = sale.quantity * sale.price;
|
||||||
|
|
||||||
|
@ -111,9 +83,6 @@ module.exports = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
'report-body': reportBody.build(),
|
|
||||||
'report-header': reportHeader.build(),
|
|
||||||
'report-footer': reportFooter.build(),
|
|
||||||
'invoice-incoterms': invoiceIncoterms.build()
|
'invoice-incoterms': invoiceIncoterms.build()
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="font gray uppercase">{{$t('date')}}</td>
|
<td class="font gray uppercase">{{$t('date')}}</td>
|
||||||
<th>{{invoice.created | date('%d-%m-%Y')}}</th>
|
<th>{{formatDate(invoice.created, '%d-%m-%Y')}}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
@ -54,7 +54,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="pull-left">
|
<div class="pull-left">
|
||||||
<div class="field rectangle">
|
<div class="field rectangle">
|
||||||
<span>{{entry.landed | date}}</span>
|
<span>{{formatDate(entry.landed, '%d-%m-%Y')}}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<span id="nickname" class="pull-right">
|
<span id="nickname" class="pull-right">
|
||||||
|
|
|
@ -1,15 +1,14 @@
|
||||||
const Component = require(`vn-print/core/component`);
|
const vnReport = require('../../../core/mixins/vn-report.js');
|
||||||
const reportBody = new Component('report-body');
|
|
||||||
const reportHeader = new Component('report-header');
|
|
||||||
const reportFooter = new Component('report-footer');
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'invoiceIn',
|
name: 'invoiceIn',
|
||||||
|
mixins: [vnReport],
|
||||||
async serverPrefetch() {
|
async serverPrefetch() {
|
||||||
this.invoice = await this.fetchInvoice(this.id);
|
this.invoice = await this.findOneFromDef('invoice', [this.id]);
|
||||||
|
this.checkMainEntity(this.invoice);
|
||||||
this.taxes = await this.fetchTaxes(this.id);
|
this.taxes = await this.fetchTaxes(this.id);
|
||||||
|
|
||||||
let defaultTax = await this.fetchDefaultTax();
|
let defaultTax = await this.findOneFromDef('defaultTax');
|
||||||
|
|
||||||
if (defaultTax) {
|
if (defaultTax) {
|
||||||
defaultTax = Object.assign(defaultTax, {
|
defaultTax = Object.assign(defaultTax, {
|
||||||
|
@ -19,11 +18,8 @@ module.exports = {
|
||||||
this.taxes.push(defaultTax);
|
this.taxes.push(defaultTax);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.invoice)
|
const entries = await this.rawSqlFromDef('entry', [this.id]);
|
||||||
throw new Error('Something went wrong');
|
const buys = await this.rawSqlFromDef('buy', [this.id]);
|
||||||
|
|
||||||
const entries = await this.fetchEntry(this.id);
|
|
||||||
const buys = await this.fetchBuy(this.id);
|
|
||||||
|
|
||||||
const map = new Map();
|
const map = new Map();
|
||||||
|
|
||||||
|
@ -41,21 +37,7 @@ module.exports = {
|
||||||
|
|
||||||
this.entries = entries;
|
this.entries = entries;
|
||||||
},
|
},
|
||||||
computed: {
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
fetchInvoice(id) {
|
|
||||||
return this.findOneFromDef('invoice', [id]);
|
|
||||||
},
|
|
||||||
fetchEntry(id) {
|
|
||||||
return this.rawSqlFromDef('entry', [id]);
|
|
||||||
},
|
|
||||||
fetchBuy(id) {
|
|
||||||
return this.rawSqlFromDef('buy', [id]);
|
|
||||||
},
|
|
||||||
fetchDefaultTax() {
|
|
||||||
return this.findOneFromDef('defaultTax');
|
|
||||||
},
|
|
||||||
async fetchTaxes(id) {
|
async fetchTaxes(id) {
|
||||||
const taxes = await this.rawSqlFromDef(`taxes`, [id]);
|
const taxes = await this.rawSqlFromDef(`taxes`, [id]);
|
||||||
return this.taxVat(taxes);
|
return this.taxVat(taxes);
|
||||||
|
@ -95,11 +77,6 @@ module.exports = {
|
||||||
return base + vat;
|
return base + vat;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
|
||||||
'report-body': reportBody.build(),
|
|
||||||
'report-header': reportHeader.build(),
|
|
||||||
'report-footer': reportFooter.build(),
|
|
||||||
},
|
|
||||||
props: {
|
props: {
|
||||||
id: {
|
id: {
|
||||||
type: Number,
|
type: Number,
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
<div class="details">
|
<div class="details">
|
||||||
<div class="package">
|
<div class="package">
|
||||||
<div class="packing">{{packing()}}</div>
|
<div class="packing">{{packing()}}</div>
|
||||||
<div class="dated">{{dated}}</div>
|
<div class="dated">{{formatDate(new Date(), '%W/%d')}}</div>
|
||||||
<div class="labelNumber">{{labelPage}}</div>
|
<div class="labelNumber">{{labelPage}}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="size">{{item.size}}</div>
|
<div class="size">{{item.size}}</div>
|
||||||
|
|
|
@ -1,24 +1,17 @@
|
||||||
const Component = require(`vn-print/core/component`);
|
const vnReport = require('../../../core/mixins/vn-report.js');
|
||||||
const reportBody = new Component('report-body');
|
|
||||||
const qrcode = require('qrcode');
|
const qrcode = require('qrcode');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'item-label',
|
name: 'item-label',
|
||||||
|
mixins: [vnReport],
|
||||||
async serverPrefetch() {
|
async serverPrefetch() {
|
||||||
this.item = await this.fetchItem(this.id, this.warehouseId);
|
this.item = await this.findOneFromDef('item', [this.id, this.warehouseId]);
|
||||||
|
this.checkMainEntity(this.item);
|
||||||
this.tags = await this.fetchItemTags(this.id);
|
this.tags = await this.fetchItemTags(this.id);
|
||||||
this.barcode = await this.getBarcodeBase64(this.id);
|
this.barcode = await this.getBarcodeBase64(this.id);
|
||||||
|
|
||||||
if (!this.item)
|
|
||||||
throw new Error('Something went wrong');
|
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
dated() {
|
|
||||||
const filters = this.$options.filters;
|
|
||||||
|
|
||||||
return filters.date(new Date(), '%W/%d');
|
|
||||||
},
|
|
||||||
labelPage() {
|
labelPage() {
|
||||||
const labelNumber = this.labelNumber ? this.labelNumber : 1;
|
const labelNumber = this.labelNumber ? this.labelNumber : 1;
|
||||||
const totalLabels = this.totalLabels ? this.totalLabels : 1;
|
const totalLabels = this.totalLabels ? this.totalLabels : 1;
|
||||||
|
@ -27,9 +20,6 @@ module.exports = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
fetchItem(id, warehouseId) {
|
|
||||||
return this.findOneFromDef('item', [id, warehouseId]);
|
|
||||||
},
|
|
||||||
fetchItemTags(id) {
|
fetchItemTags(id) {
|
||||||
return this.rawSqlFromDef('itemTags', [id]).then(rows => {
|
return this.rawSqlFromDef('itemTags', [id]).then(rows => {
|
||||||
const tags = {};
|
const tags = {};
|
||||||
|
@ -48,9 +38,6 @@ module.exports = {
|
||||||
return `${this.item.packing}x${stems}`;
|
return `${this.item.packing}x${stems}`;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
|
||||||
'report-body': reportBody.build()
|
|
||||||
},
|
|
||||||
props: {
|
props: {
|
||||||
id: {
|
id: {
|
||||||
type: Number,
|
type: Number,
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="font gray uppercase">{{$t('date')}}</td>
|
<td class="font gray uppercase">{{$t('date')}}</td>
|
||||||
<th>{{dated}}</th>
|
<th>{{formatDate(new Date(), '%d-%m-%Y')}}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
@ -44,7 +44,7 @@
|
||||||
</thead>
|
</thead>
|
||||||
<tbody v-for="sale in sales" :key="sale.id">
|
<tbody v-for="sale in sales" :key="sale.id">
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{sale.issued | date('%d-%m-%Y')}}</td>
|
<td>{{formatDate(sale.issued, '%d-%m-%Y')}}</td>
|
||||||
<td>{{sale.ref}}</td>
|
<td>{{sale.ref}}</td>
|
||||||
<td class="number">{{sale.debtOut}}</td>
|
<td class="number">{{sale.debtOut}}</td>
|
||||||
<td class="number">{{sale.debtIn}}</td>
|
<td class="number">{{sale.debtIn}}</td>
|
||||||
|
|
|
@ -1,36 +1,17 @@
|
||||||
const Component = require(`vn-print/core/component`);
|
const vnReport = require('../../../core/mixins/vn-report.js');
|
||||||
const reportBody = new Component('report-body');
|
|
||||||
const reportFooter = new Component('report-footer');
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'letter-debtor',
|
name: 'letter-debtor',
|
||||||
|
mixins: [vnReport],
|
||||||
async serverPrefetch() {
|
async serverPrefetch() {
|
||||||
this.client = await this.fetchClient(this.id);
|
this.client = await this.findOneFromDef('client', [this.id]);
|
||||||
this.sales = await this.fetchSales(this.id, this.companyId);
|
this.checkMainEntity(this.client);
|
||||||
|
this.sales = await this.findOneFromDef('sales', [this.id, this.companyId]);
|
||||||
if (!this.client)
|
|
||||||
throw new Error('Something went wrong');
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
dated: function() {
|
|
||||||
const filters = this.$options.filters;
|
|
||||||
|
|
||||||
return filters.date(new Date(), '%d-%m-%Y');
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {totalBalance: 0.00};
|
return {totalBalance: 0.00};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
fetchClient(id) {
|
|
||||||
return this.findOneFromDef('client', [id]);
|
|
||||||
},
|
|
||||||
fetchSales(id, companyId) {
|
|
||||||
return this.findOneFromDef('sales', [
|
|
||||||
id,
|
|
||||||
companyId
|
|
||||||
]);
|
|
||||||
},
|
|
||||||
getBalance(sale) {
|
getBalance(sale) {
|
||||||
if (sale.debtOut)
|
if (sale.debtOut)
|
||||||
this.totalBalance += parseFloat(sale.debtOut);
|
this.totalBalance += parseFloat(sale.debtOut);
|
||||||
|
@ -57,10 +38,6 @@ module.exports = {
|
||||||
return debtIn.toFixed(2);
|
return debtIn.toFixed(2);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
components: {
|
|
||||||
'report-body': reportBody.build(),
|
|
||||||
'report-footer': reportFooter.build()
|
|
||||||
},
|
|
||||||
props: {
|
props: {
|
||||||
id: {
|
id: {
|
||||||
type: Number,
|
type: Number,
|
||||||
|
|
|
@ -1,36 +1,24 @@
|
||||||
const Component = require(`vn-print/core/component`);
|
const vnReport = require('../../../core/mixins/vn-report.js');
|
||||||
const reportBody = new Component('report-body');
|
|
||||||
const qrcode = require('qrcode');
|
const qrcode = require('qrcode');
|
||||||
const UserError = require('vn-loopback/util/user-error');
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'previa-label',
|
name: 'previa-label',
|
||||||
|
mixins: [vnReport],
|
||||||
async serverPrefetch() {
|
async serverPrefetch() {
|
||||||
this.previa = await this.fetchPrevia(this.id);
|
this.sector = await this.findOneFromDef('sector', [this.id]);
|
||||||
this.sector = await this.fetchSector(this.id);
|
this.checkMainEntity(this.sector);
|
||||||
|
this.previa = await this.findOneFromDef('previa', [this.id]);
|
||||||
this.barcode = await this.getBarcodeBase64(this.id);
|
this.barcode = await this.getBarcodeBase64(this.id);
|
||||||
|
|
||||||
if (this.previa)
|
if (this.previa)
|
||||||
this.previa = this.previa[0];
|
this.previa = this.previa[0];
|
||||||
|
|
||||||
if (!this.sector)
|
|
||||||
throw new UserError('Something went wrong - no sector found');
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
fetchPrevia(id) {
|
|
||||||
return this.findOneFromDef('previa', [id]);
|
|
||||||
},
|
|
||||||
getBarcodeBase64(id) {
|
getBarcodeBase64(id) {
|
||||||
const data = String(id);
|
const data = String(id);
|
||||||
|
|
||||||
return qrcode.toDataURL(data, {margin: 0});
|
return qrcode.toDataURL(data, {margin: 0});
|
||||||
},
|
},
|
||||||
fetchSector(id) {
|
|
||||||
return this.findOneFromDef('sector', [id]);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
components: {
|
|
||||||
'report-body': reportBody.build()
|
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
id: {
|
id: {
|
||||||
|
|
|
@ -1,27 +1,12 @@
|
||||||
const Component = require(`vn-print/core/component`);
|
const vnReport = require('../../../core/mixins/vn-report.js');
|
||||||
const reportBody = new Component('report-body');
|
|
||||||
const reportFooter = new Component('report-footer');
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'receipt',
|
name: 'receipt',
|
||||||
|
mixins: [vnReport],
|
||||||
async serverPrefetch() {
|
async serverPrefetch() {
|
||||||
this.client = await this.fetchClient(this.id);
|
this.receipt = await this.findOneFromDef('receipt', [this.id]);
|
||||||
this.receipt = await this.fetchReceipt(this.id);
|
this.checkMainEntity(this.receipt);
|
||||||
|
this.client = await this.findOneFromDef('client', [this.id]);
|
||||||
if (!this.receipt)
|
|
||||||
throw new Error('Something went wrong');
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
fetchClient(id) {
|
|
||||||
return this.findOneFromDef('client', [id]);
|
|
||||||
},
|
|
||||||
fetchReceipt(id) {
|
|
||||||
return this.findOneFromDef('receipt', [id]);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
components: {
|
|
||||||
'report-body': reportBody.build(),
|
|
||||||
'report-footer': reportFooter.build()
|
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
id: {
|
id: {
|
||||||
|
|
|
@ -147,7 +147,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{$t('client.signLocation')}}</td>
|
<td>{{$t('client.signLocation')}}</td>
|
||||||
<th>{{dated}}, {{client.province}}</th>
|
<th>{{formatDate(new Date(), '%d-%m-%Y')}}, {{client.province}}</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{$t('client.sign')}}</td>
|
<td>{{$t('client.sign')}}</td>
|
||||||
|
|
|
@ -1,44 +1,12 @@
|
||||||
const Component = require(`vn-print/core/component`);
|
const vnReport = require('../../../core/mixins/vn-report.js');
|
||||||
const reportBody = new Component('report-body');
|
|
||||||
const reportHeader = new Component('report-header');
|
|
||||||
const reportFooter = new Component('report-footer');
|
|
||||||
|
|
||||||
const rptSepaCore = {
|
module.exports = {
|
||||||
name: 'sepa-core',
|
name: 'sepa-core',
|
||||||
|
mixins: [vnReport],
|
||||||
async serverPrefetch() {
|
async serverPrefetch() {
|
||||||
this.client = await this.fetchClient(this.id, this.companyId);
|
this.client = await this.findOneFromDef('client', [this.companyId, this.companyId, this.id]);
|
||||||
this.supplier = await this.fetchSupplier(this.id, this.companyId);
|
this.checkMainEntity(this.client);
|
||||||
|
this.supplier = await this.findOneFromDef('supplier', [this.companyId, this.companyId, this.id]);
|
||||||
if (!this.client)
|
|
||||||
throw new Error('Something went wrong');
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
dated: function() {
|
|
||||||
const filters = this.$options.filters;
|
|
||||||
|
|
||||||
return filters.date(new Date(), '%d-%m-%Y');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
fetchClient(id, companyId) {
|
|
||||||
return this.findOneFromDef('client', [
|
|
||||||
companyId,
|
|
||||||
companyId,
|
|
||||||
id
|
|
||||||
]);
|
|
||||||
},
|
|
||||||
fetchSupplier(id, companyId) {
|
|
||||||
return this.findOneFromDef('supplier', [
|
|
||||||
companyId,
|
|
||||||
companyId,
|
|
||||||
id
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
components: {
|
|
||||||
'report-body': reportBody.build(),
|
|
||||||
'report-header': reportHeader.build(),
|
|
||||||
'report-footer': reportFooter.build()
|
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
id: {
|
id: {
|
||||||
|
@ -52,5 +20,3 @@ const rptSepaCore = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = rptSepaCore;
|
|
||||||
|
|
|
@ -13,11 +13,11 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="font gray">{{$t('From')}}</td>
|
<td class="font gray">{{$t('From')}}</td>
|
||||||
<th>{{from | date('%d-%m-%Y')}}</th>
|
<th>{{formatDate(from, '%d-%m-%Y')}}</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="font gray">{{$t('To')}}</td>
|
<td class="font gray">{{$t('To')}}</td>
|
||||||
<th>{{to | date('%d-%m-%Y')}}</th>
|
<th>{{formatDate(to, '%d-%m-%Y')}}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
@ -38,7 +38,7 @@
|
||||||
<div v-for="entry in entries" v-if="entry.buys">
|
<div v-for="entry in entries" v-if="entry.buys">
|
||||||
<h2>
|
<h2>
|
||||||
<span>{{$t('entry')}} {{entry.id}}</span>
|
<span>{{$t('entry')}} {{entry.id}}</span>
|
||||||
<span>{{$t('dated')}} {{entry.shipped | date('%d-%m-%Y')}}</span>
|
<span>{{$t('dated')}} {{formatDate(entry.shipped, '%d-%m-%Y')}}</span>
|
||||||
<span class="pull-right">{{$t('reference')}} {{entry.reference}}</span>
|
<span class="pull-right">{{$t('reference')}} {{entry.reference}}</span>
|
||||||
</h2>
|
</h2>
|
||||||
<table class="column-oriented repeatable">
|
<table class="column-oriented repeatable">
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
const Component = require(`vn-print/core/component`);
|
const vnReport = require('../../../core/mixins/vn-report.js');
|
||||||
const reportBody = new Component('report-body');
|
|
||||||
const reportFooter = new Component('report-footer');
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'supplier-campaign-metrics',
|
name: 'supplier-campaign-metrics',
|
||||||
|
mixins: [vnReport],
|
||||||
async serverPrefetch() {
|
async serverPrefetch() {
|
||||||
this.supplier = await this.fetchSupplier(this.id);
|
this.supplier = await this.findOneFromDef('supplier', [this.id]);
|
||||||
let entries = await this.fetchEntries(this.id, this.from, this.to);
|
this.checkMainEntity(this.supplier);
|
||||||
|
let entries = await this.rawSqlFromDef('entries', [this.id, this.from, this.to]);
|
||||||
|
|
||||||
const entriesId = [];
|
const entriesId = [];
|
||||||
|
|
||||||
for (let entry of entries)
|
for (let entry of entries)
|
||||||
entriesId.push(entry.id);
|
entriesId.push(entry.id);
|
||||||
|
|
||||||
const buys = await this.fetchBuys(entriesId);
|
const buys = await this.rawSqlFromDef('buys', [entriesId]);
|
||||||
|
|
||||||
const entriesMap = new Map();
|
const entriesMap = new Map();
|
||||||
for (let entry of entries)
|
for (let entry of entries)
|
||||||
|
@ -29,23 +29,6 @@ module.exports = {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.entries = entries;
|
this.entries = entries;
|
||||||
if (!this.supplier)
|
|
||||||
throw new Error('Something went wrong');
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
fetchSupplier(supplierId) {
|
|
||||||
return this.findOneFromDef('supplier', [supplierId]);
|
|
||||||
},
|
|
||||||
fetchEntries(supplierId, from, to) {
|
|
||||||
return this.rawSqlFromDef('entries', [supplierId, from, to]);
|
|
||||||
},
|
|
||||||
fetchBuys(entriesId) {
|
|
||||||
return this.rawSqlFromDef('buys', [entriesId]);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
components: {
|
|
||||||
'report-body': reportBody.build(),
|
|
||||||
'report-footer': reportFooter.build()
|
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
id: {
|
id: {
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{vehicleEvent.numberPlate}}</td>
|
<td>{{vehicleEvent.numberPlate}}</td>
|
||||||
<td>{{vehicleEvent.description}}</td>
|
<td>{{vehicleEvent.description}}</td>
|
||||||
<td>{{vehicleEvent.finished | date('%d-%m-%Y')}}</td>
|
<td>{{formatDate(vehicleEvent.finished, '%d-%m-%Y')}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -1,21 +1,10 @@
|
||||||
const Component = require(`vn-print/core/component`);
|
const vnReport = require('../../../core/mixins/vn-report.js');
|
||||||
const reportBody = new Component('report-body');
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'vehicle-event-expired',
|
name: 'vehicle-event-expired',
|
||||||
|
mixins: [vnReport],
|
||||||
async serverPrefetch() {
|
async serverPrefetch() {
|
||||||
this.vehicleEvents = await this.fetchVehicleEvent(this.eventIds);
|
this.vehicleEvents = await this.rawSqlFromDef('vehicleEvents', [this.eventIds]);
|
||||||
|
this.checkMainEntity(this.vehicleEvents);
|
||||||
if (!this.vehicleEvents)
|
|
||||||
throw new Error('Something went wrong');
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
fetchVehicleEvent(vehicleEventIds) {
|
|
||||||
return this.rawSqlFromDef('vehicleEvents', [vehicleEventIds]);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
components: {
|
|
||||||
'report-body': reportBody.build()
|
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
eventIds: {
|
eventIds: {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<report-body v-bind="$props">
|
<report-body v-bind="$props">
|
||||||
<div class="text">{{zone.agencyName}}</div>
|
<div class="text">{{zone.agencyName}}</div>
|
||||||
<div class="text">{{zone.id}}</div>
|
<div class="text">{{zone.id}}</div>
|
||||||
<div class="text">{{zone.plateNumber}} {{zone.time | date('%H:%M')}}</div>
|
<div class="text">{{zone.plateNumber}} {{formatDate(zone.time, '%H:%M')}}</div>
|
||||||
</report-body>
|
</report-body>
|
||||||
|
|
|
@ -1,21 +1,11 @@
|
||||||
const Component = require(`vn-print/core/component`);
|
const vnReport = require('../../../core/mixins/vn-report.js');
|
||||||
const reportBody = new Component('report-body');
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'zone',
|
name: 'zone',
|
||||||
|
mixins: [vnReport],
|
||||||
async serverPrefetch() {
|
async serverPrefetch() {
|
||||||
this.zone = await this.fetchZone(this.id);
|
this.zone = await this.findOneFromDef('zone', [this.id]);
|
||||||
|
this.checkMainEntity(this.zone);
|
||||||
if (!this.zone)
|
|
||||||
throw new Error('Something went wrong');
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
fetchZone(id) {
|
|
||||||
return this.findOneFromDef('zone', [id]);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
components: {
|
|
||||||
'report-body': reportBody.build()
|
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
id: {
|
id: {
|
||||||
|
|
Loading…
Reference in New Issue