refs #5092 changed name to negative bases
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
700151b500
commit
87d0dc3cec
|
@ -0,0 +1,4 @@
|
||||||
|
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||||
|
VALUES
|
||||||
|
('InvoiceIn', 'negativeBases', 'READ', 'ALLOW', 'ROLE', 'administrative'),
|
||||||
|
('InvoiceIn', 'negativeBasesCsv', 'READ', 'ALLOW', 'ROLE', 'administrative');
|
|
@ -1,4 +0,0 @@
|
||||||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
|
||||||
VALUES
|
|
||||||
('InvoiceIn', 'unbilledClients', 'READ', 'ALLOW', 'ROLE', 'administrative'),
|
|
||||||
('InvoiceIn', 'unbilledClientsCsv', 'READ', 'ALLOW', 'ROLE', 'administrative');
|
|
|
@ -1,6 +1,6 @@
|
||||||
import getBrowser from '../../helpers/puppeteer';
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
describe('InvoiceIn unbilled clients path', () => {
|
describe('InvoiceIn negative bases path', () => {
|
||||||
let browser;
|
let browser;
|
||||||
let page;
|
let page;
|
||||||
const httpRequests = [];
|
const httpRequests = [];
|
||||||
|
@ -9,18 +9,18 @@ describe('InvoiceIn unbilled clients path', () => {
|
||||||
browser = await getBrowser();
|
browser = await getBrowser();
|
||||||
page = browser.page;
|
page = browser.page;
|
||||||
page.on('request', req => {
|
page.on('request', req => {
|
||||||
if (req.url().includes(`InvoiceIns/unbilledClients`))
|
if (req.url().includes(`InvoiceIns/negativeBases`))
|
||||||
httpRequests.push(req.url());
|
httpRequests.push(req.url());
|
||||||
});
|
});
|
||||||
await page.loginAndModule('administrative', 'invoiceIn');
|
await page.loginAndModule('administrative', 'invoiceIn');
|
||||||
await page.accessToSection('invoiceIn.unbilled-clients');
|
await page.accessToSection('invoiceIn.negative-bases');
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(async() => {
|
afterAll(async() => {
|
||||||
await browser.close();
|
await browser.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should show unbilled clients in a date range', async() => {
|
it('should show negative bases in a date range', async() => {
|
||||||
const request = httpRequests.find(req =>
|
const request = httpRequests.find(req =>
|
||||||
req.includes(`from`) && req.includes(`to`));
|
req.includes(`from`) && req.includes(`to`));
|
||||||
|
|
|
@ -2,8 +2,8 @@ const UserError = require('vn-loopback/util/user-error');
|
||||||
const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
|
const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
|
||||||
|
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
Self.remoteMethodCtx('unbilledClients', {
|
Self.remoteMethodCtx('negativeBases', {
|
||||||
description: 'Find all unbilled clients',
|
description: 'Find all negative bases',
|
||||||
accessType: 'READ',
|
accessType: 'READ',
|
||||||
accepts: [
|
accepts: [
|
||||||
{
|
{
|
||||||
|
@ -27,12 +27,12 @@ module.exports = Self => {
|
||||||
root: true
|
root: true
|
||||||
},
|
},
|
||||||
http: {
|
http: {
|
||||||
path: `/unbilledClients`,
|
path: `/negativeBases`,
|
||||||
verb: 'GET'
|
verb: 'GET'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.unbilledClients = async(ctx, options) => {
|
Self.negativeBases = async(ctx, options) => {
|
||||||
const conn = Self.dataSource.connector;
|
const conn = Self.dataSource.connector;
|
||||||
const args = ctx.args;
|
const args = ctx.args;
|
||||||
|
|
||||||
|
@ -99,14 +99,14 @@ module.exports = Self => {
|
||||||
stmt.merge(conn.makeWhere(args.filter.where));
|
stmt.merge(conn.makeWhere(args.filter.where));
|
||||||
stmt.merge(conn.makeOrderBy(args.filter.order));
|
stmt.merge(conn.makeOrderBy(args.filter.order));
|
||||||
|
|
||||||
const clientsIndex = stmts.push(stmt) - 1;
|
const negativeBasesIndex = stmts.push(stmt) - 1;
|
||||||
|
|
||||||
stmts.push(`DROP TEMPORARY TABLE tmp.filter, tmp.ticket, tmp.ticketTax, tmp.ticketAmount`);
|
stmts.push(`DROP TEMPORARY TABLE tmp.filter, tmp.ticket, tmp.ticketTax, tmp.ticketAmount`);
|
||||||
|
|
||||||
const sql = ParameterizedSQL.join(stmts, ';');
|
const sql = ParameterizedSQL.join(stmts, ';');
|
||||||
const result = await conn.executeStmt(sql, myOptions);
|
const result = await conn.executeStmt(sql, myOptions);
|
||||||
|
|
||||||
return clientsIndex === 0 ? result : result[clientsIndex];
|
return negativeBasesIndex === 0 ? result : result[negativeBasesIndex];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
const {toCSV} = require('vn-loopback/util/csv');
|
const {toCSV} = require('vn-loopback/util/csv');
|
||||||
|
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
Self.remoteMethodCtx('unbilledClientsCsv', {
|
Self.remoteMethodCtx('negativeBasesCsv', {
|
||||||
description: 'Returns the unbilled clients as .csv',
|
description: 'Returns the negative bases as .csv',
|
||||||
accessType: 'READ',
|
accessType: 'READ',
|
||||||
accepts: [{
|
accepts: [{
|
||||||
arg: 'unbilledClients',
|
arg: 'negativeBases',
|
||||||
type: ['object'],
|
type: ['object'],
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
|
@ -35,19 +35,19 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
http: {
|
http: {
|
||||||
path: '/unbilledClientsCsv',
|
path: '/negativeBasesCsv',
|
||||||
verb: 'GET'
|
verb: 'GET'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.unbilledClientsCsv = async ctx => {
|
Self.negativeBasesCsv = async ctx => {
|
||||||
const args = ctx.args;
|
const args = ctx.args;
|
||||||
const content = toCSV(args.unbilledClients);
|
const content = toCSV(args.negativeBases);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
content,
|
content,
|
||||||
'text/csv',
|
'text/csv',
|
||||||
`attachment; filename="unbilled-clients-${new Date(args.from).toLocaleDateString()}-${new Date(args.to).toLocaleDateString()}.csv"`
|
`attachment; filename="negative-bases-${new Date(args.from).toLocaleDateString()}-${new Date(args.to).toLocaleDateString()}.csv"`
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
|
@ -1,7 +1,7 @@
|
||||||
const models = require('vn-loopback/server/server').models;
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
|
||||||
describe('invoiceIn unbilledClients()', () => {
|
describe('invoiceIn negativeBases()', () => {
|
||||||
it('should return all unbilled clients in a date range', async() => {
|
it('should return all negative bases in a date range', async() => {
|
||||||
const tx = await models.InvoiceIn.beginTransaction({});
|
const tx = await models.InvoiceIn.beginTransaction({});
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
const ctx = {
|
const ctx = {
|
||||||
|
@ -13,7 +13,7 @@ describe('invoiceIn unbilledClients()', () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const result = await models.InvoiceIn.unbilledClients(ctx, options);
|
const result = await models.InvoiceIn.negativeBases(ctx, options);
|
||||||
|
|
||||||
expect(result.length).toBeGreaterThan(0);
|
expect(result.length).toBeGreaterThan(0);
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ describe('invoiceIn unbilledClients()', () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await models.InvoiceIn.unbilledClients(ctx, options);
|
await models.InvoiceIn.negativeBases(ctx, options);
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error = e;
|
error = e;
|
|
@ -6,6 +6,6 @@ module.exports = Self => {
|
||||||
require('../methods/invoice-in/getTotals')(Self);
|
require('../methods/invoice-in/getTotals')(Self);
|
||||||
require('../methods/invoice-in/invoiceInPdf')(Self);
|
require('../methods/invoice-in/invoiceInPdf')(Self);
|
||||||
require('../methods/invoice-in/invoiceInEmail')(Self);
|
require('../methods/invoice-in/invoiceInEmail')(Self);
|
||||||
require('../methods/invoice-in/unbilledClients')(Self);
|
require('../methods/invoice-in/negativeBases')(Self);
|
||||||
require('../methods/invoice-in/unbilledClientsCsv')(Self);
|
require('../methods/invoice-in/negativeBasesCsv')(Self);
|
||||||
};
|
};
|
||||||
|
|
|
@ -13,4 +13,4 @@ import './dueDay';
|
||||||
import './intrastat';
|
import './intrastat';
|
||||||
import './create';
|
import './create';
|
||||||
import './log';
|
import './log';
|
||||||
import './unbilled-clients';
|
import './negative-bases';
|
||||||
|
|
|
@ -22,4 +22,4 @@ Total stems: Total tallos
|
||||||
Show agricultural receipt as PDF: Ver recibo agrícola como PDF
|
Show agricultural receipt as PDF: Ver recibo agrícola como PDF
|
||||||
Send agricultural receipt as PDF: Enviar recibo agrícola como PDF
|
Send agricultural receipt as PDF: Enviar recibo agrícola como PDF
|
||||||
New InvoiceIn: Nueva Factura
|
New InvoiceIn: Nueva Factura
|
||||||
Unbilled clients: Clientes sin facturar
|
Negative bases: Bases negativas
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<vn-crud-model
|
<vn-crud-model
|
||||||
vn-id="model"
|
vn-id="model"
|
||||||
url="InvoiceIns/unbilledClients"
|
url="InvoiceIns/negativeBases"
|
||||||
auto-load="true"
|
auto-load="true"
|
||||||
params="$ctrl.params">
|
params="$ctrl.params">
|
||||||
</vn-crud-model>
|
</vn-crud-model>
|
|
@ -68,8 +68,8 @@ export default class Controller extends Section {
|
||||||
return result;
|
return result;
|
||||||
}, {}));
|
}, {}));
|
||||||
});
|
});
|
||||||
this.vnReport.show('InvoiceIns/unbilledClientsCsv', {
|
this.vnReport.show('InvoiceIns/negativeBasesCsv', {
|
||||||
unbilledClients: data,
|
negativeBases: data,
|
||||||
from: this.params.from,
|
from: this.params.from,
|
||||||
to: this.params.to
|
to: this.params.to
|
||||||
});
|
});
|
||||||
|
@ -78,7 +78,7 @@ export default class Controller extends Section {
|
||||||
|
|
||||||
Controller.$inject = ['$element', '$scope', 'vnReport'];
|
Controller.$inject = ['$element', '$scope', 'vnReport'];
|
||||||
|
|
||||||
ngModule.vnComponent('vnUnbilledClients', {
|
ngModule.vnComponent('vnNegativeBases', {
|
||||||
template: require('./index.html'),
|
template: require('./index.html'),
|
||||||
controller: Controller
|
controller: Controller
|
||||||
});
|
});
|
|
@ -1,6 +1,6 @@
|
||||||
@import "./variables";
|
@import "./variables";
|
||||||
|
|
||||||
vn-unbilled-clients {
|
vn-negative-bases {
|
||||||
vn-date-picker{
|
vn-date-picker{
|
||||||
padding-right: 5%;
|
padding-right: 5%;
|
||||||
}
|
}
|
|
@ -10,7 +10,7 @@
|
||||||
"menus": {
|
"menus": {
|
||||||
"main": [
|
"main": [
|
||||||
{ "state": "invoiceIn.index", "icon": "icon-invoice-in"},
|
{ "state": "invoiceIn.index", "icon": "icon-invoice-in"},
|
||||||
{ "state": "invoiceIn.unbilled-clients", "icon": "person"}
|
{ "state": "invoiceIn.negative-bases", "icon": "icon-ticket"}
|
||||||
],
|
],
|
||||||
"card": [
|
"card": [
|
||||||
{
|
{
|
||||||
|
@ -53,10 +53,10 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"url": "/unbilled-clients",
|
"url": "/negative-bases",
|
||||||
"state": "invoiceIn.unbilled-clients",
|
"state": "invoiceIn.negative-bases",
|
||||||
"component": "vn-unbilled-clients",
|
"component": "vn-negative-bases",
|
||||||
"description": "Unbilled clients",
|
"description": "Negative bases",
|
||||||
"acl": [
|
"acl": [
|
||||||
"administrative"
|
"administrative"
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in New Issue