#6930 FIX Show report and File.getPath #2215
|
@ -14,7 +14,7 @@ class File {
|
|||
*/
|
||||
getPath(dmsUrl) {
|
||||
const serializedParams = this.$httpParamSerializer({
|
||||
access_token: this.vnToken.token
|
||||
access_token: this.vnToken.tokenMultimedia
|
||||
});
|
||||
|
||||
return `${dmsUrl}?${serializedParams}`;
|
||||
|
|
|
@ -15,7 +15,7 @@ class Report {
|
|||
*/
|
||||
show(path, params) {
|
||||
params = Object.assign({
|
||||
access_token: this.vnToken.token
|
||||
access_token: this.vnToken.tokenMultimedia
|
||||
}, params);
|
||||
const serializedParams = this.$httpParamSerializer(params);
|
||||
const query = serializedParams ? `?${serializedParams}` : '';
|
||||
|
|
|
@ -34,7 +34,8 @@ module.exports = Self => {
|
|||
http: {
|
||||
path: '/:id/claim-pickup-pdf',
|
||||
verb: 'GET'
|
||||
}
|
||||
},
|
||||
accessScopes: ['read:multimedia']
|
||||
});
|
||||
|
||||
Self.claimPickupPdf = (ctx, id) => Self.printReport(ctx, id, 'claim-pickup-order');
|
||||
|
|
|
@ -45,7 +45,8 @@ module.exports = Self => {
|
|||
http: {
|
||||
path: '/:id/campaign-metrics-pdf',
|
||||
verb: 'GET'
|
||||
}
|
||||
},
|
||||
accessScopes: ['read:multimedia']
|
||||
});
|
||||
|
||||
Self.campaignMetricsPdf = (ctx, id) => Self.printReport(ctx, id, 'campaign-metrics');
|
||||
|
|
|
@ -33,7 +33,8 @@ module.exports = Self => {
|
|||
http: {
|
||||
path: '/:id/entry-order-pdf',
|
||||
verb: 'GET'
|
||||
}
|
||||
},
|
||||
accessScopes: ['read:multimedia']
|
||||
});
|
||||
|
||||
Self.entryOrderPdf = (ctx, id) => Self.printReport(ctx, id, 'entry-order');
|
||||
|
|
|
@ -34,7 +34,8 @@ module.exports = Self => {
|
|||
http: {
|
||||
path: '/:reference/exportation-pdf',
|
||||
verb: 'GET'
|
||||
}
|
||||
},
|
||||
accessScopes: ['read:multimedia']
|
||||
});
|
||||
|
||||
Self.exportationPdf = (ctx, reference) => Self.printReport(ctx, reference, 'exportation');
|
||||
|
|
|
@ -37,23 +37,24 @@ module.exports = Self => {
|
|||
http: {
|
||||
path: '/:reference/invoice-csv',
|
||||
verb: 'GET'
|
||||
}
|
||||
},
|
||||
accessScopes: ['read:multimedia']
|
||||
});
|
||||
|
||||
Self.invoiceCsv = async reference => {
|
||||
const sales = await Self.rawSql(`
|
||||
SELECT io.ref Invoice,
|
||||
io.issued InvoiceDate,
|
||||
s.ticketFk Ticket,
|
||||
s.itemFk Item,
|
||||
s.concept Description,
|
||||
i.size,
|
||||
s.ticketFk Ticket,
|
||||
s.itemFk Item,
|
||||
s.concept Description,
|
||||
i.size,
|
||||
i.subName Producer,
|
||||
s.quantity Quantity,
|
||||
s.price Price,
|
||||
s.discount Discount,
|
||||
s.created Created,
|
||||
tc.code Taxcode,
|
||||
s.quantity Quantity,
|
||||
s.price Price,
|
||||
s.discount Discount,
|
||||
s.created Created,
|
||||
tc.code Taxcode,
|
||||
tc.description TaxDescription,
|
||||
i.tag5,
|
||||
i.value5,
|
||||
|
@ -67,14 +68,14 @@ module.exports = Self => {
|
|||
i.value9,
|
||||
i.tag10,
|
||||
i.value10
|
||||
FROM sale s
|
||||
JOIN ticket t ON t.id = s.ticketFk
|
||||
JOIN item i ON i.id = s.itemFk
|
||||
JOIN supplier s2 ON s2.id = t.companyFk
|
||||
JOIN itemTaxCountry itc ON itc.itemFk = i.id
|
||||
AND itc.countryFk = s2.countryFk
|
||||
JOIN taxClass tc ON tc.id = itc.taxClassFk
|
||||
JOIN invoiceOut io ON io.ref = t.refFk
|
||||
FROM sale s
|
||||
JOIN ticket t ON t.id = s.ticketFk
|
||||
JOIN item i ON i.id = s.itemFk
|
||||
JOIN supplier s2 ON s2.id = t.companyFk
|
||||
JOIN itemTaxCountry itc ON itc.itemFk = i.id
|
||||
AND itc.countryFk = s2.countryFk
|
||||
JOIN taxClass tc ON tc.id = itc.taxClassFk
|
||||
JOIN invoiceOut io ON io.ref = t.refFk
|
||||
WHERE t.refFk = ?
|
||||
ORDER BY s.ticketFk, s.created`, [reference]);
|
||||
|
||||
|
|
|
@ -39,7 +39,8 @@ module.exports = Self => {
|
|||
http: {
|
||||
path: '/negativeBasesCsv',
|
||||
verb: 'GET'
|
||||
}
|
||||
},
|
||||
accessScopes: ['read:multimedia']
|
||||
});
|
||||
|
||||
Self.negativeBasesCsv = async(ctx, options) => {
|
||||
|
|
|
@ -44,7 +44,8 @@ module.exports = Self => {
|
|||
http: {
|
||||
path: '/:id/campaign-metrics-pdf',
|
||||
verb: 'GET'
|
||||
}
|
||||
},
|
||||
accessScopes: ['read:multimedia']
|
||||
});
|
||||
|
||||
Self.campaignMetricsPdf = (ctx, id) => Self.printReport(ctx, id, 'supplier-campaign-metrics');
|
||||
|
|
|
@ -37,23 +37,24 @@ module.exports = Self => {
|
|||
http: {
|
||||
path: '/:id/delivery-note-csv',
|
||||
verb: 'GET'
|
||||
}
|
||||
},
|
||||
accessScopes: ['read:multimedia']
|
||||
});
|
||||
|
||||
Self.deliveryNoteCsv = async id => {
|
||||
const sales = await Self.rawSql(`
|
||||
SELECT io.ref Invoice,
|
||||
io.issued InvoiceDate,
|
||||
s.ticketFk Ticket,
|
||||
s.itemFk Item,
|
||||
s.concept Description,
|
||||
i.size,
|
||||
s.ticketFk Ticket,
|
||||
s.itemFk Item,
|
||||
s.concept Description,
|
||||
i.size,
|
||||
i.subName Producer,
|
||||
s.quantity Quantity,
|
||||
s.price Price,
|
||||
s.discount Discount,
|
||||
s.created Created,
|
||||
tc.code Taxcode,
|
||||
s.quantity Quantity,
|
||||
s.price Price,
|
||||
s.discount Discount,
|
||||
s.created Created,
|
||||
tc.code Taxcode,
|
||||
tc.description TaxDescription,
|
||||
i.tag5,
|
||||
i.value5,
|
||||
|
@ -67,14 +68,14 @@ module.exports = Self => {
|
|||
i.value9,
|
||||
i.tag10,
|
||||
i.value10
|
||||
FROM vn.sale s
|
||||
JOIN vn.ticket t ON t.id = s.ticketFk
|
||||
JOIN vn.item i ON i.id = s.itemFk
|
||||
JOIN vn.supplier s2 ON s2.id = t.companyFk
|
||||
JOIN vn.itemTaxCountry itc ON itc.itemFk = i.id
|
||||
AND itc.countryFk = s2.countryFk
|
||||
JOIN vn.taxClass tc ON tc.id = itc.taxClassFk
|
||||
LEFT JOIN vn.invoiceOut io ON io.id = t.refFk
|
||||
FROM vn.sale s
|
||||
JOIN vn.ticket t ON t.id = s.ticketFk
|
||||
JOIN vn.item i ON i.id = s.itemFk
|
||||
JOIN vn.supplier s2 ON s2.id = t.companyFk
|
||||
JOIN vn.itemTaxCountry itc ON itc.itemFk = i.id
|
||||
AND itc.countryFk = s2.countryFk
|
||||
JOIN vn.taxClass tc ON tc.id = itc.taxClassFk
|
||||
LEFT JOIN vn.invoiceOut io ON io.id = t.refFk
|
||||
WHERE s.ticketFk = ?
|
||||
ORDER BY s.ticketFk, s.created`, [id]);
|
||||
const content = toCSV(sales);
|
||||
|
|
|
@ -41,7 +41,8 @@ module.exports = Self => {
|
|||
http: {
|
||||
path: '/:id/delivery-note-pdf',
|
||||
verb: 'GET'
|
||||
}
|
||||
},
|
||||
accessScopes: ['read:multimedia']
|
||||
});
|
||||
|
||||
Self.deliveryNotePdf = (ctx, id) => Self.printReport(ctx, id, 'delivery-note');
|
||||
|
|
|
@ -78,7 +78,8 @@ module.exports = Self => {
|
|||
http: {
|
||||
path: '/extra-community-pdf',
|
||||
verb: 'GET'
|
||||
}
|
||||
},
|
||||
accessScopes: ['read:multimedia']
|
||||
});
|
||||
|
||||
Self.extraCommunityPdf = ctx => Self.printReport(ctx, null, 'extra-community');
|
||||
|
|
|
@ -144,7 +144,7 @@ class Controller extends Section {
|
|||
const currentFilter = this.$.model.currentFilter;
|
||||
|
||||
return Object.assign({
|
||||
authorization: this.vnToken.token,
|
||||
authorization: this.vnToken.tokenMultimedia,
|
||||
filter: currentFilter
|
||||
}, userParams);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue