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';
|
||||
|
||||
describe('InvoiceIn unbilled clients path', () => {
|
||||
describe('InvoiceIn negative bases path', () => {
|
||||
let browser;
|
||||
let page;
|
||||
const httpRequests = [];
|
||||
|
@ -9,18 +9,18 @@ describe('InvoiceIn unbilled clients path', () => {
|
|||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
page.on('request', req => {
|
||||
if (req.url().includes(`InvoiceIns/unbilledClients`))
|
||||
if (req.url().includes(`InvoiceIns/negativeBases`))
|
||||
httpRequests.push(req.url());
|
||||
});
|
||||
await page.loginAndModule('administrative', 'invoiceIn');
|
||||
await page.accessToSection('invoiceIn.unbilled-clients');
|
||||
await page.accessToSection('invoiceIn.negative-bases');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
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 =>
|
||||
req.includes(`from`) && req.includes(`to`));
|
||||
|
|
@ -2,8 +2,8 @@ const UserError = require('vn-loopback/util/user-error');
|
|||
const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
|
||||
|
||||
module.exports = Self => {
|
||||
Self.remoteMethodCtx('unbilledClients', {
|
||||
description: 'Find all unbilled clients',
|
||||
Self.remoteMethodCtx('negativeBases', {
|
||||
description: 'Find all negative bases',
|
||||
accessType: 'READ',
|
||||
accepts: [
|
||||
{
|
||||
|
@ -27,12 +27,12 @@ module.exports = Self => {
|
|||
root: true
|
||||
},
|
||||
http: {
|
||||
path: `/unbilledClients`,
|
||||
path: `/negativeBases`,
|
||||
verb: 'GET'
|
||||
}
|
||||
});
|
||||
|
||||
Self.unbilledClients = async(ctx, options) => {
|
||||
Self.negativeBases = async(ctx, options) => {
|
||||
const conn = Self.dataSource.connector;
|
||||
const args = ctx.args;
|
||||
|
||||
|
@ -99,14 +99,14 @@ module.exports = Self => {
|
|||
stmt.merge(conn.makeWhere(args.filter.where));
|
||||
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`);
|
||||
|
||||
const sql = ParameterizedSQL.join(stmts, ';');
|
||||
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');
|
||||
|
||||
module.exports = Self => {
|
||||
Self.remoteMethodCtx('unbilledClientsCsv', {
|
||||
description: 'Returns the unbilled clients as .csv',
|
||||
Self.remoteMethodCtx('negativeBasesCsv', {
|
||||
description: 'Returns the negative bases as .csv',
|
||||
accessType: 'READ',
|
||||
accepts: [{
|
||||
arg: 'unbilledClients',
|
||||
arg: 'negativeBases',
|
||||
type: ['object'],
|
||||
required: true
|
||||
},
|
||||
|
@ -35,19 +35,19 @@ module.exports = Self => {
|
|||
}
|
||||
],
|
||||
http: {
|
||||
path: '/unbilledClientsCsv',
|
||||
path: '/negativeBasesCsv',
|
||||
verb: 'GET'
|
||||
}
|
||||
});
|
||||
|
||||
Self.unbilledClientsCsv = async ctx => {
|
||||
Self.negativeBasesCsv = async ctx => {
|
||||
const args = ctx.args;
|
||||
const content = toCSV(args.unbilledClients);
|
||||
const content = toCSV(args.negativeBases);
|
||||
|
||||
return [
|
||||
content,
|
||||
'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;
|
||||
|
||||
describe('invoiceIn unbilledClients()', () => {
|
||||
it('should return all unbilled clients in a date range', async() => {
|
||||
describe('invoiceIn negativeBases()', () => {
|
||||
it('should return all negative bases in a date range', async() => {
|
||||
const tx = await models.InvoiceIn.beginTransaction({});
|
||||
const options = {transaction: tx};
|
||||
const ctx = {
|
||||
|
@ -13,7 +13,7 @@ describe('invoiceIn unbilledClients()', () => {
|
|||
};
|
||||
|
||||
try {
|
||||
const result = await models.InvoiceIn.unbilledClients(ctx, options);
|
||||
const result = await models.InvoiceIn.negativeBases(ctx, options);
|
||||
|
||||
expect(result.length).toBeGreaterThan(0);
|
||||
|
||||
|
@ -35,7 +35,7 @@ describe('invoiceIn unbilledClients()', () => {
|
|||
};
|
||||
|
||||
try {
|
||||
await models.InvoiceIn.unbilledClients(ctx, options);
|
||||
await models.InvoiceIn.negativeBases(ctx, options);
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
error = e;
|
|
@ -6,6 +6,6 @@ module.exports = Self => {
|
|||
require('../methods/invoice-in/getTotals')(Self);
|
||||
require('../methods/invoice-in/invoiceInPdf')(Self);
|
||||
require('../methods/invoice-in/invoiceInEmail')(Self);
|
||||
require('../methods/invoice-in/unbilledClients')(Self);
|
||||
require('../methods/invoice-in/unbilledClientsCsv')(Self);
|
||||
require('../methods/invoice-in/negativeBases')(Self);
|
||||
require('../methods/invoice-in/negativeBasesCsv')(Self);
|
||||
};
|
||||
|
|
|
@ -13,4 +13,4 @@ import './dueDay';
|
|||
import './intrastat';
|
||||
import './create';
|
||||
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
|
||||
Send agricultural receipt as PDF: Enviar recibo agrícola como PDF
|
||||
New InvoiceIn: Nueva Factura
|
||||
Unbilled clients: Clientes sin facturar
|
||||
Negative bases: Bases negativas
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<vn-crud-model
|
||||
vn-id="model"
|
||||
url="InvoiceIns/unbilledClients"
|
||||
url="InvoiceIns/negativeBases"
|
||||
auto-load="true"
|
||||
params="$ctrl.params">
|
||||
</vn-crud-model>
|
|
@ -68,8 +68,8 @@ export default class Controller extends Section {
|
|||
return result;
|
||||
}, {}));
|
||||
});
|
||||
this.vnReport.show('InvoiceIns/unbilledClientsCsv', {
|
||||
unbilledClients: data,
|
||||
this.vnReport.show('InvoiceIns/negativeBasesCsv', {
|
||||
negativeBases: data,
|
||||
from: this.params.from,
|
||||
to: this.params.to
|
||||
});
|
||||
|
@ -78,7 +78,7 @@ export default class Controller extends Section {
|
|||
|
||||
Controller.$inject = ['$element', '$scope', 'vnReport'];
|
||||
|
||||
ngModule.vnComponent('vnUnbilledClients', {
|
||||
ngModule.vnComponent('vnNegativeBases', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller
|
||||
});
|
|
@ -1,6 +1,6 @@
|
|||
@import "./variables";
|
||||
|
||||
vn-unbilled-clients {
|
||||
vn-negative-bases {
|
||||
vn-date-picker{
|
||||
padding-right: 5%;
|
||||
}
|
|
@ -10,7 +10,7 @@
|
|||
"menus": {
|
||||
"main": [
|
||||
{ "state": "invoiceIn.index", "icon": "icon-invoice-in"},
|
||||
{ "state": "invoiceIn.unbilled-clients", "icon": "person"}
|
||||
{ "state": "invoiceIn.negative-bases", "icon": "icon-ticket"}
|
||||
],
|
||||
"card": [
|
||||
{
|
||||
|
@ -53,10 +53,10 @@
|
|||
]
|
||||
},
|
||||
{
|
||||
"url": "/unbilled-clients",
|
||||
"state": "invoiceIn.unbilled-clients",
|
||||
"component": "vn-unbilled-clients",
|
||||
"description": "Unbilled clients",
|
||||
"url": "/negative-bases",
|
||||
"state": "invoiceIn.negative-bases",
|
||||
"component": "vn-negative-bases",
|
||||
"description": "Negative bases",
|
||||
"acl": [
|
||||
"administrative"
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue