This commit is contained in:
parent
0b4a6874d1
commit
c46e15c8e4
|
@ -1,4 +1,4 @@
|
|||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||
VALUES
|
||||
('InvoiceIn', 'unbilledTickets', 'READ', 'ALLOW', 'ROLE', 'administrative'),
|
||||
('InvoiceIn', 'unbilledTicketsCsv', 'READ', 'ALLOW', 'ROLE', 'administrative');
|
||||
('InvoiceIn', 'unbilledClients', 'READ', 'ALLOW', 'ROLE', 'administrative'),
|
||||
('InvoiceIn', 'unbilledClientsCsv', 'READ', 'ALLOW', 'ROLE', 'administrative');
|
|
@ -1,6 +1,6 @@
|
|||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('InvoiceIn unbilled tickets path', () => {
|
||||
describe('InvoiceIn unbilled clients path', () => {
|
||||
let browser;
|
||||
let page;
|
||||
const httpRequests = [];
|
||||
|
@ -9,18 +9,18 @@ describe('InvoiceIn unbilled tickets path', () => {
|
|||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
page.on('request', req => {
|
||||
if (req.url().includes(`InvoiceIns/unbilledTickets`))
|
||||
if (req.url().includes(`InvoiceIns/unbilledClients`))
|
||||
httpRequests.push(req.url());
|
||||
});
|
||||
await page.loginAndModule('administrative', 'invoiceIn');
|
||||
await page.accessToSection('invoiceIn.unbilled-tickets');
|
||||
await page.accessToSection('invoiceIn.unbilled-clients');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should show unbilled tickets in a date range', async() => {
|
||||
it('should show unbilled clients in a date range', async() => {
|
||||
const request = httpRequests.find(req =>
|
||||
req.includes(`from`) && req.includes(`to`));
|
||||
|
|
@ -64,4 +64,3 @@ Compensation Account: Cuenta para compensar
|
|||
Amount to return: Cantidad a devolver
|
||||
Delivered amount: Cantidad entregada
|
||||
Unpaid: Impagado
|
||||
Unbilled tickets: Tickets sin facturar
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const models = require('vn-loopback/server/server').models;
|
||||
|
||||
describe('invoiceIn unbilledTickets()', () => {
|
||||
it('should return all unbilled tickets in a date range', async() => {
|
||||
describe('invoiceIn unbilledClients()', () => {
|
||||
it('should return all unbilled clients in a date range', async() => {
|
||||
const tx = await models.InvoiceIn.beginTransaction({});
|
||||
const options = {transaction: tx};
|
||||
const ctx = {
|
||||
|
@ -13,7 +13,7 @@ describe('invoiceIn unbilledTickets()', () => {
|
|||
};
|
||||
|
||||
try {
|
||||
const result = await models.InvoiceIn.unbilledTickets(ctx, options);
|
||||
const result = await models.InvoiceIn.unbilledClients(ctx, options);
|
||||
|
||||
expect(result.length).toBeGreaterThan(0);
|
||||
|
||||
|
@ -35,7 +35,7 @@ describe('invoiceIn unbilledTickets()', () => {
|
|||
};
|
||||
|
||||
try {
|
||||
await models.InvoiceIn.unbilledTickets(ctx, options);
|
||||
await models.InvoiceIn.unbilledClients(ctx, options);
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
error = e;
|
|
@ -2,8 +2,8 @@ const UserError = require('vn-loopback/util/user-error');
|
|||
const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
|
||||
|
||||
module.exports = Self => {
|
||||
Self.remoteMethodCtx('unbilledTickets', {
|
||||
description: 'Find all unbilled tickets',
|
||||
Self.remoteMethodCtx('unbilledClients', {
|
||||
description: 'Find all unbilled clients',
|
||||
accessType: 'READ',
|
||||
accepts: [
|
||||
{
|
||||
|
@ -27,12 +27,12 @@ module.exports = Self => {
|
|||
root: true
|
||||
},
|
||||
http: {
|
||||
path: `/unbilledTickets`,
|
||||
path: `/unbilledClients`,
|
||||
verb: 'GET'
|
||||
}
|
||||
});
|
||||
|
||||
Self.unbilledTickets = async(ctx, options) => {
|
||||
Self.unbilledClients = 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 ticketsIndex = stmts.push(stmt) - 1;
|
||||
const clientsIndex = 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 ticketsIndex === 0 ? result : result[ticketsIndex];
|
||||
return clientsIndex === 0 ? result : result[clientsIndex];
|
||||
};
|
||||
};
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
const {toCSV} = require('vn-loopback/util/csv');
|
||||
|
||||
module.exports = Self => {
|
||||
Self.remoteMethodCtx('unbilledTicketsCsv', {
|
||||
description: 'Returns the unbilled tickets as .csv',
|
||||
Self.remoteMethodCtx('unbilledClientsCsv', {
|
||||
description: 'Returns the unbilled clients as .csv',
|
||||
accessType: 'READ',
|
||||
accepts: [{
|
||||
arg: 'unbilledTickets',
|
||||
arg: 'unbilledClients',
|
||||
type: ['object'],
|
||||
required: true
|
||||
},
|
||||
|
@ -35,19 +35,19 @@ module.exports = Self => {
|
|||
}
|
||||
],
|
||||
http: {
|
||||
path: '/unbilledTicketsCsv',
|
||||
path: '/unbilledClientsCsv',
|
||||
verb: 'GET'
|
||||
}
|
||||
});
|
||||
|
||||
Self.unbilledTicketsCsv = async ctx => {
|
||||
Self.unbilledClientsCsv = async ctx => {
|
||||
const args = ctx.args;
|
||||
const content = toCSV(args.unbilledTickets);
|
||||
const content = toCSV(args.unbilledClients);
|
||||
|
||||
return [
|
||||
content,
|
||||
'text/csv',
|
||||
`attachment; filename="unbilled-tickets-${new Date(args.from).toLocaleDateString()}-${new Date(args.to).toLocaleDateString()}.csv"`
|
||||
`attachment; filename="unbilled-clients-${new Date(args.from).toLocaleDateString()}-${new Date(args.to).toLocaleDateString()}.csv"`
|
||||
];
|
||||
};
|
||||
};
|
|
@ -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/unbilledTickets')(Self);
|
||||
require('../methods/invoice-in/unbilledTicketsCsv')(Self);
|
||||
require('../methods/invoice-in/unbilledClients')(Self);
|
||||
require('../methods/invoice-in/unbilledClientsCsv')(Self);
|
||||
};
|
||||
|
|
|
@ -13,4 +13,4 @@ import './dueDay';
|
|||
import './intrastat';
|
||||
import './create';
|
||||
import './log';
|
||||
import './unbilled-tickets';
|
||||
import './unbilled-clients';
|
||||
|
|
|
@ -22,3 +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
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
"menus": {
|
||||
"main": [
|
||||
{ "state": "invoiceIn.index", "icon": "icon-invoice-in"},
|
||||
{ "state": "invoiceIn.unbilled-tickets", "icon": "icon-ticket"}
|
||||
{ "state": "invoiceIn.unbilled-clients", "icon": "person"}
|
||||
],
|
||||
"card": [
|
||||
{
|
||||
|
@ -53,10 +53,10 @@
|
|||
]
|
||||
},
|
||||
{
|
||||
"url": "/unbilled-tickets",
|
||||
"state": "invoiceIn.unbilled-tickets",
|
||||
"component": "vn-unbilled-tickets",
|
||||
"description": "Unbilled tickets",
|
||||
"url": "/unbilled-clients",
|
||||
"state": "invoiceIn.unbilled-clients",
|
||||
"component": "vn-unbilled-clients",
|
||||
"description": "Unbilled clients",
|
||||
"acl": [
|
||||
"administrative"
|
||||
]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<vn-crud-model
|
||||
vn-id="model"
|
||||
url="InvoiceIns/unbilledTickets"
|
||||
url="InvoiceIns/unbilledClients"
|
||||
auto-load="true"
|
||||
params="$ctrl.params">
|
||||
</vn-crud-model>
|
||||
|
@ -74,34 +74,34 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="ticket in model.data">
|
||||
<td>{{ticket.company | dashIfEmpty}}</td>
|
||||
<td>{{ticket.country | dashIfEmpty}}</td>
|
||||
<td>{{ticket.clientId | dashIfEmpty}}</td>
|
||||
<td>{{ticket.clientSocialName | dashIfEmpty}}</td>
|
||||
<td>{{ticket.amount | currency: 'EUR':2 | dashIfEmpty}}</td>
|
||||
<td>{{ticket.taxableBase | dashIfEmpty}}</td>
|
||||
<td>{{ticket.ticketFk | dashIfEmpty}}</td>
|
||||
<tr ng-repeat="client in model.data">
|
||||
<td>{{client.company | dashIfEmpty}}</td>
|
||||
<td>{{client.country | dashIfEmpty}}</td>
|
||||
<td>{{client.clientId | dashIfEmpty}}</td>
|
||||
<td>{{client.clientSocialName | dashIfEmpty}}</td>
|
||||
<td>{{client.amount | currency: 'EUR':2 | dashIfEmpty}}</td>
|
||||
<td>{{client.taxableBase | dashIfEmpty}}</td>
|
||||
<td>{{client.ticketFk | dashIfEmpty}}</td>
|
||||
<td center>
|
||||
<vn-check
|
||||
disabled="true"
|
||||
ng-model="ticket.isActive">
|
||||
ng-model="client.isActive">
|
||||
</vn-check>
|
||||
</td>
|
||||
<td center>
|
||||
<vn-check
|
||||
disabled="true"
|
||||
ng-model="ticket.hasToInvoice">
|
||||
ng-model="client.hasToInvoice">
|
||||
</vn-check>
|
||||
</td>
|
||||
<td center>
|
||||
<vn-check
|
||||
disabled="true"
|
||||
ng-model="ticket.isTaxDataChecked">
|
||||
ng-model="client.isTaxDataChecked">
|
||||
</vn-check>
|
||||
</td>
|
||||
<td>{{ticket.comercialId | dashIfEmpty}}</td>
|
||||
<td>{{ticket.comercialName | dashIfEmpty}}</td>
|
||||
<td>{{client.comercialId | dashIfEmpty}}</td>
|
||||
<td>{{client.comercialName | dashIfEmpty}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
|
@ -70,8 +70,8 @@ export default class Controller extends Section {
|
|||
return result;
|
||||
}, {}));
|
||||
});
|
||||
this.vnReport.show('InvoiceIns/unbilledTicketsCsv', {
|
||||
unbilledTickets: data,
|
||||
this.vnReport.show('InvoiceIns/unbilledClientsCsv', {
|
||||
unbilledClients: data,
|
||||
from: this.params.from,
|
||||
to: this.params.to
|
||||
});
|
||||
|
@ -80,7 +80,7 @@ export default class Controller extends Section {
|
|||
|
||||
Controller.$inject = ['$element', '$scope', 'vnReport'];
|
||||
|
||||
ngModule.vnComponent('vnUnbilledTickets', {
|
||||
ngModule.vnComponent('vnUnbilledClients', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller
|
||||
});
|
|
@ -1,6 +1,6 @@
|
|||
@import "./variables";
|
||||
|
||||
vn-unbilled-tickets {
|
||||
vn-unbilled-clients {
|
||||
vn-date-picker{
|
||||
padding-right: 5%;
|
||||
}
|
Loading…
Reference in New Issue