sin toClientId
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
d73dab3454
commit
d5592d6a0f
|
@ -21,7 +21,8 @@ module.exports = Self => {
|
|||
{
|
||||
arg: 'toClientId',
|
||||
type: 'number',
|
||||
description: 'The maximum client id'
|
||||
description: 'The maximum client id',
|
||||
required: false
|
||||
},
|
||||
{
|
||||
arg: 'companyFk',
|
||||
|
@ -77,13 +78,10 @@ module.exports = Self => {
|
|||
|
||||
const minShipped = new Date();
|
||||
minShipped.setFullYear(minShipped.getFullYear() - 1);
|
||||
|
||||
if (args.fromClientId == args.toClientId) {
|
||||
minShipped.setFullYear(2021);
|
||||
minShipped.setMonth(1);
|
||||
minShipped.setDate(1);
|
||||
minShipped.setHours(0, 0, 0, 0);
|
||||
}
|
||||
minShipped.setMonth(1);
|
||||
minShipped.setDate(1);
|
||||
minShipped.setHours(0, 0, 0, 0);
|
||||
|
||||
|
||||
// Packaging liquidation
|
||||
const vIsAllInvoiceable = false;
|
||||
|
@ -200,11 +198,13 @@ module.exports = Self => {
|
|||
JOIN ticketPackaging tp ON t.id = tp.ticketFk
|
||||
JOIN client c ON c.id = t.clientFk
|
||||
WHERE t.shipped BETWEEN '2017-11-21' AND ?
|
||||
AND t.clientFk BETWEEN ? AND ?
|
||||
AND t.clientFk >= ?
|
||||
AND (t.clientFk <= ? OR ? IS NULL)
|
||||
AND c.isActive`;
|
||||
return models.InvoiceOut.rawSql(query, [
|
||||
args.maxShipped,
|
||||
args.fromClientId,
|
||||
args.toClientId,
|
||||
args.toClientId
|
||||
], options);
|
||||
}
|
||||
|
@ -233,15 +233,17 @@ module.exports = Self => {
|
|||
LEFT JOIN ticketService ts ON ts.ticketFk = t.id
|
||||
JOIN address a ON a.id = t.addressFk
|
||||
JOIN client c ON c.id = t.clientFk
|
||||
WHERE ISNULL(t.refFk) AND c.id BETWEEN ? AND ?
|
||||
WHERE ISNULL(t.refFk) AND c.id >= ?
|
||||
AND (t.clientFk <= ? OR ? IS NULL)
|
||||
AND t.shipped BETWEEN ? AND util.dayEnd(?)
|
||||
AND t.companyFk = ? AND c.hasToInvoice
|
||||
AND c.isTaxDataChecked
|
||||
AND c.isTaxDataChecked AND c.isActive
|
||||
GROUP BY c.id, IF(c.hasToInvoiceByAddress,a.id,TRUE) HAVING sumAmount > 0`;
|
||||
|
||||
return models.InvoiceOut.rawSql(query, [
|
||||
args.fromClientId,
|
||||
args.toClientId,
|
||||
args.toClientId,
|
||||
minShipped,
|
||||
args.maxShipped,
|
||||
args.companyFk
|
||||
|
|
|
@ -54,7 +54,7 @@ class Controller extends Dialog {
|
|||
if (!this.invoice.invoiceDate || !this.invoice.maxShipped)
|
||||
throw new Error('Invoice date and the max date should be filled');
|
||||
|
||||
if (!this.invoice.fromClientId || !this.invoice.toClientId)
|
||||
if (!this.invoice.fromClientId)
|
||||
throw new Error('Choose a valid clients range');
|
||||
|
||||
this.isInvoicing = true;
|
||||
|
|
Loading…
Reference in New Issue