Merge branch '4700-split-tour' of https://gitea.verdnatura.es/verdnatura/salix into 3963-ticket-advance
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
commit
721123381c
|
@ -43,6 +43,9 @@ module.exports = Self => {
|
|||
if (!recipient)
|
||||
throw new Error(`Could not send message "${message}" to worker id ${recipientId} from user ${userId}`);
|
||||
|
||||
if (process.env.NODE_ENV == 'test')
|
||||
message = `[Test:Environment to user ${userId}] ` + message;
|
||||
|
||||
await models.Chat.create({
|
||||
senderFk: sender.id,
|
||||
recipient: `@${recipient.name}`,
|
||||
|
|
|
@ -12,14 +12,9 @@ BEGIN
|
|||
* @param vAuthorFk The notification author or %NULL if there is no author
|
||||
* @return The notification id
|
||||
*/
|
||||
DECLARE vNotificationFk INT;
|
||||
|
||||
SELECT id INTO vNotificationFk
|
||||
FROM `notification`
|
||||
WHERE `name` = vNotificationName;
|
||||
|
||||
INSERT INTO notificationQueue
|
||||
SET notificationFk = vNotificationFk,
|
||||
SET notificationFk = vNotificationName,
|
||||
params = vParams,
|
||||
authorFk = vAuthorFk;
|
||||
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
CREATE TABLE `vn`.`invoiceInConfig` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`retentionRate` int(3) NOT NULL,
|
||||
`retentionName` varchar(25) NOT NULL,
|
||||
`sageWithholdingFk` smallint(6) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
CONSTRAINT `invoiceInConfig_sageWithholdingFk` FOREIGN KEY (`sageWithholdingFk`) REFERENCES `sage`.`TiposRetencion`(`CodigoRetencion`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
|
||||
|
||||
INSERT INTO `vn`.`invoiceInConfig` (`id`, `retentionRate`, `retentionName`, `sageWithholdingFk`)
|
||||
VALUES
|
||||
(1, -2, 'Retención 2%', 2);
|
|
@ -0,0 +1,46 @@
|
|||
DROP TRIGGER IF EXISTS `vn`.`supplier_beforeUpdate`;
|
||||
USE `vn`;
|
||||
|
||||
DELIMITER $$
|
||||
$$
|
||||
CREATE DEFINER=`root`@`localhost` TRIGGER `vn`.`supplier_beforeUpdate`
|
||||
BEFORE UPDATE ON `supplier`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
DECLARE vHasChange BOOL;
|
||||
DECLARE vPayMethodChanged BOOL;
|
||||
DECLARE vPayMethodHasVerified BOOL;
|
||||
DECLARE vParams JSON;
|
||||
DECLARE vOldPayMethodName VARCHAR(20);
|
||||
DECLARE vNewPayMethodName VARCHAR(20);
|
||||
|
||||
SELECT hasVerified INTO vPayMethodHasVerified
|
||||
FROM payMethod
|
||||
WHERE id = NEW.payMethodFk;
|
||||
|
||||
SET vPayMethodChanged = NOT(NEW.payMethodFk <=> OLD.payMethodFk);
|
||||
|
||||
IF vPayMethodChanged THEN
|
||||
SELECT name INTO vOldPayMethodName
|
||||
FROM payMethod
|
||||
WHERE id = OLD.payMethodFk;
|
||||
SELECT name INTO vNewPayMethodName
|
||||
FROM payMethod
|
||||
WHERE id = NEW.payMethodFk;
|
||||
|
||||
SET vParams = JSON_OBJECT(
|
||||
'name', NEW.name,
|
||||
'oldPayMethod', vOldPayMethodName,
|
||||
'newPayMethod', vNewPayMethodName
|
||||
);
|
||||
SELECT util.notification_send('supplier-pay-method-update', vParams, NULL) INTO @id;
|
||||
END IF;
|
||||
|
||||
SET vHasChange = NOT(NEW.payDemFk <=> OLD.payDemFk AND NEW.payDay <=> OLD.payDay) OR vPayMethodChanged;
|
||||
|
||||
IF vHasChange AND vPayMethodHasVerified THEN
|
||||
SET NEW.isPayMethodChecked = FALSE;
|
||||
END IF;
|
||||
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -2691,7 +2691,8 @@ INSERT INTO `util`.`notificationConfig`
|
|||
|
||||
INSERT INTO `util`.`notification` (`id`, `name`, `description`)
|
||||
VALUES
|
||||
(1, 'print-email', 'notification fixture one');
|
||||
(1, 'print-email', 'notification fixture one'),
|
||||
(3, 'supplier-pay-method-update', 'A supplier pay method has been updated');
|
||||
|
||||
INSERT INTO `util`.`notificationAcl` (`notificationFk`, `roleFk`)
|
||||
VALUES
|
||||
|
@ -2748,3 +2749,4 @@ INSERT INTO `salix`.`url` (`appName`, `environment`, `url`)
|
|||
INSERT INTO `vn`.`payDemDetail` (`id`, `detail`)
|
||||
VALUES
|
||||
(1, 1);
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import selectors from '../../helpers/selectors';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Login path', async() => {
|
||||
// https://redmine.verdnatura.es/issues/4995 fix login
|
||||
xdescribe('RecoverPassword path', async() => {
|
||||
let browser;
|
||||
let page;
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<vn-layout
|
||||
ng-if="$ctrl.showLayout">
|
||||
</vn-layout>
|
||||
<vn-out-layout
|
||||
<ui-view
|
||||
name="login"
|
||||
ng-if="!$ctrl.showLayout">
|
||||
</vn-out-layout>
|
||||
</ui-view>
|
||||
<vn-snackbar vn-id="snackbar"></vn-snackbar>
|
||||
<vn-debug-info></vn-debug-info>
|
||||
|
|
|
@ -21,7 +21,7 @@ export default class App extends Component {
|
|||
|
||||
get showLayout() {
|
||||
const state = this.$state.current.name || this.$location.$$path.substring(1).replace('/', '.');
|
||||
const outLayout = ['login', 'recoverPassword', 'resetPassword'];
|
||||
const outLayout = ['login', 'recoverPassword', 'resetPassword', 'reset-password'];
|
||||
return state && !outLayout.some(ol => ol == state);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,27 +1,32 @@
|
|||
<vn-textfield
|
||||
label="User"
|
||||
ng-model="$ctrl.user"
|
||||
vn-id="userField"
|
||||
vn-focus>
|
||||
</vn-textfield>
|
||||
<vn-textfield
|
||||
label="Password"
|
||||
ng-model="$ctrl.password"
|
||||
type="password">
|
||||
</vn-textfield>
|
||||
<vn-check
|
||||
label="Do not close session"
|
||||
ng-model="$ctrl.remember"
|
||||
name="remember">
|
||||
</vn-check>
|
||||
<div class="footer">
|
||||
<vn-submit label="Enter" ng-click="$ctrl.submit()"></vn-submit>
|
||||
<div class="spinner-wrapper">
|
||||
<vn-spinner enable="$ctrl.loading"></vn-spinner>
|
||||
</div>
|
||||
<div class="vn-pt-lg">
|
||||
<a ui-sref="recoverPassword" translate>
|
||||
I do not remember my password
|
||||
</a>
|
||||
</div>
|
||||
<div class="box">
|
||||
<img src="./logo.svg"/>
|
||||
<form name="form" ng-submit="$ctrl.submit()">
|
||||
<vn-textfield
|
||||
label="User"
|
||||
ng-model="$ctrl.user"
|
||||
vn-id="userField"
|
||||
vn-focus>
|
||||
</vn-textfield>
|
||||
<vn-textfield
|
||||
label="Password"
|
||||
ng-model="$ctrl.password"
|
||||
type="password">
|
||||
</vn-textfield>
|
||||
<vn-check
|
||||
label="Do not close session"
|
||||
ng-model="$ctrl.remember"
|
||||
name="remember">
|
||||
</vn-check>
|
||||
<div class="footer">
|
||||
<vn-submit label="Enter" ng-click="$ctrl.submit()"></vn-submit>
|
||||
<div class="spinner-wrapper">
|
||||
<vn-spinner enable="$ctrl.loading"></vn-spinner>
|
||||
</div>
|
||||
<!--<div class="vn-pt-lg">
|
||||
<a ui-sref="recoverPassword" translate>
|
||||
I do not remember my password
|
||||
</a>
|
||||
</div>-->
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
@ -25,7 +25,7 @@ vn-recover-password{
|
|||
}
|
||||
}
|
||||
|
||||
vn-out-layout{
|
||||
vn-login{
|
||||
position: absolute;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
|
|
|
@ -9,7 +9,9 @@ function config($stateProvider, $urlRouterProvider) {
|
|||
.state('login', {
|
||||
url: '/login?continue',
|
||||
description: 'Login',
|
||||
template: '<vn-login></vn-login>'
|
||||
views: {
|
||||
'login': {template: '<vn-login></vn-login>'},
|
||||
}
|
||||
})
|
||||
.state('recoverPassword', {
|
||||
url: '/recover-password',
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"InvoiceIn": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"InvoiceInTax": {
|
||||
"InvoiceInConfig": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"InvoiceInDueDay": {
|
||||
|
@ -13,5 +13,8 @@
|
|||
},
|
||||
"InvoiceInLog": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"InvoiceInTax": {
|
||||
"dataSource": "vn"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
{
|
||||
"name": "InvoiceInConfig",
|
||||
"base": "VnModel",
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "invoiceInConfig"
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"id": true,
|
||||
"type": "number",
|
||||
"description": "Identifier"
|
||||
},
|
||||
"retentionRate": {
|
||||
"type": "number"
|
||||
},
|
||||
"retentionName": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
"sageWithholding": {
|
||||
"type": "belongsTo",
|
||||
"model": "SageWithholding",
|
||||
"foreignKey": "sageWithholdingFk"
|
||||
}
|
||||
},
|
||||
"acls": [{
|
||||
"accessType": "READ",
|
||||
"principalType": "ROLE",
|
||||
"principalId": "$everyone",
|
||||
"permission": "ALLOW"
|
||||
}]
|
||||
}
|
|
@ -1,3 +1,10 @@
|
|||
<vn-crud-model
|
||||
url="InvoiceInConfigs"
|
||||
data="$ctrl.config"
|
||||
filter="{fields: ['sageWithholdingFk']}"
|
||||
id-value="1"
|
||||
auto-load="true">
|
||||
</vn-crud-model>
|
||||
<vn-descriptor-content
|
||||
module="invoiceIn"
|
||||
description="$ctrl.invoiceIn.supplierRef"
|
||||
|
@ -26,13 +33,13 @@
|
|||
Clone Invoice
|
||||
</vn-item>
|
||||
<vn-item
|
||||
ng-if="false"
|
||||
ng-if="$ctrl.isAgricultural()"
|
||||
ng-click="$ctrl.showPdfInvoice()"
|
||||
translate>
|
||||
Show agricultural invoice as PDF
|
||||
</vn-item>
|
||||
<vn-item
|
||||
ng-if="false"
|
||||
ng-if="$ctrl.isAgricultural()"
|
||||
ng-click="sendPdfConfirmation.show({email: $ctrl.entity.supplierContact[0].email})"
|
||||
translate>
|
||||
Send agricultural invoice as PDF
|
||||
|
|
|
@ -110,6 +110,10 @@ class Controller extends Descriptor {
|
|||
recipientId: this.entity.supplier.id
|
||||
});
|
||||
}
|
||||
|
||||
isAgricultural() {
|
||||
return this.invoiceIn.supplier.sageWithholdingFk == this.config[0].sageWithholdingFk;
|
||||
}
|
||||
}
|
||||
|
||||
ngModule.vnComponent('vnInvoiceInDescriptor', {
|
||||
|
|
|
@ -13,6 +13,7 @@ describe('InvoiceOut downloadZip()', () => {
|
|||
};
|
||||
|
||||
it('should return part of link to dowloand the zip', async() => {
|
||||
pending('https://redmine.verdnatura.es/issues/4875');
|
||||
const tx = await models.InvoiceOut.beginTransaction({});
|
||||
|
||||
try {
|
||||
|
@ -30,7 +31,6 @@ describe('InvoiceOut downloadZip()', () => {
|
|||
});
|
||||
|
||||
it('should return an error if the size of the files is too large', async() => {
|
||||
pending('https://redmine.verdnatura.es/issues/4875');
|
||||
const tx = await models.InvoiceOut.beginTransaction({});
|
||||
|
||||
let error;
|
||||
|
|
|
@ -8,7 +8,6 @@ describe('loopback model Supplier', () => {
|
|||
beforeAll(async() => {
|
||||
supplierOne = await models.Supplier.findById(1);
|
||||
supplierTwo = await models.Supplier.findById(442);
|
||||
|
||||
const activeCtx = {
|
||||
accessToken: {userId: 9},
|
||||
http: {
|
||||
|
@ -23,71 +22,106 @@ describe('loopback model Supplier', () => {
|
|||
});
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await supplierOne.updateAttribute('payMethodFk', supplierOne.payMethodFk);
|
||||
await supplierTwo.updateAttribute('payMethodFk', supplierTwo.payMethodFk);
|
||||
});
|
||||
|
||||
describe('payMethodFk', () => {
|
||||
it('should throw an error when attempting to set an invalid payMethod id in the supplier', async() => {
|
||||
let error;
|
||||
const expectedError = 'You can not select this payment method without a registered bankery account';
|
||||
const supplier = await models.Supplier.findById(1);
|
||||
const tx = await models.Supplier.beginTransaction({});
|
||||
const options = {transaction: tx};
|
||||
|
||||
await supplier.updateAttribute('payMethodFk', 8)
|
||||
.catch(e => {
|
||||
error = e;
|
||||
try {
|
||||
let error;
|
||||
const expectedError = 'You can not select this payment method without a registered bankery account';
|
||||
|
||||
expect(error.message).toContain(expectedError);
|
||||
});
|
||||
await supplierOne.updateAttribute('payMethodFk', 8, options)
|
||||
.catch(e => {
|
||||
error = e;
|
||||
|
||||
expect(error).toBeDefined();
|
||||
expect(error.message).toContain(expectedError);
|
||||
});
|
||||
|
||||
expect(error).toBeDefined();
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
await tx.rollback();
|
||||
throw e;
|
||||
}
|
||||
});
|
||||
|
||||
it('should not throw if the payMethod id is valid', async() => {
|
||||
let error;
|
||||
const supplier = await models.Supplier.findById(442);
|
||||
await supplier.updateAttribute('payMethodFk', 4)
|
||||
.catch(e => {
|
||||
error = e;
|
||||
});
|
||||
const tx = await models.Supplier.beginTransaction({});
|
||||
const options = {transaction: tx};
|
||||
|
||||
expect(error).not.toBeDefined();
|
||||
try {
|
||||
let error;
|
||||
await supplierTwo.updateAttribute('payMethodFk', 4, options)
|
||||
.catch(e => {
|
||||
error = e;
|
||||
});
|
||||
|
||||
expect(error).not.toBeDefined();
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
await tx.rollback();
|
||||
throw e;
|
||||
}
|
||||
});
|
||||
|
||||
it('should have checked isPayMethodChecked for payMethod hasVerfified is false', async() => {
|
||||
const supplier = await models.Supplier.findById(442);
|
||||
await supplier.updateAttribute('isPayMethodChecked', true);
|
||||
await supplier.updateAttribute('payMethodFk', 5);
|
||||
const tx = await models.Supplier.beginTransaction({});
|
||||
const options = {transaction: tx};
|
||||
|
||||
const result = await models.Supplier.findById(442);
|
||||
try {
|
||||
await supplierTwo.updateAttribute('isPayMethodChecked', true, options);
|
||||
await supplierTwo.updateAttribute('payMethodFk', 5, options);
|
||||
|
||||
expect(result.isPayMethodChecked).toEqual(true);
|
||||
const result = await models.Supplier.findById(442, null, options);
|
||||
|
||||
expect(result.isPayMethodChecked).toEqual(true);
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
await tx.rollback();
|
||||
throw e;
|
||||
}
|
||||
});
|
||||
|
||||
it('should have unchecked isPayMethodChecked for payMethod hasVerfified is true', async() => {
|
||||
const supplier = await models.Supplier.findById(442);
|
||||
await supplier.updateAttribute('isPayMethodChecked', true);
|
||||
await supplier.updateAttribute('payMethodFk', 2);
|
||||
const tx = await models.Supplier.beginTransaction({});
|
||||
const options = {transaction: tx};
|
||||
|
||||
const result = await models.Supplier.findById(442);
|
||||
try {
|
||||
await supplierTwo.updateAttribute('isPayMethodChecked', true, options);
|
||||
await supplierTwo.updateAttribute('payMethodFk', 2, options);
|
||||
|
||||
expect(result.isPayMethodChecked).toEqual(false);
|
||||
const result = await models.Supplier.findById(442, null, options);
|
||||
|
||||
expect(result.isPayMethodChecked).toEqual(false);
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
await tx.rollback();
|
||||
throw e;
|
||||
}
|
||||
});
|
||||
|
||||
it('should have unchecked isPayMethodChecked for payDay and peyDemFk', async() => {
|
||||
const supplier = await models.Supplier.findById(442);
|
||||
const tx = await models.Supplier.beginTransaction({});
|
||||
const options = {transaction: tx};
|
||||
|
||||
await supplier.updateAttribute('isPayMethodChecked', true);
|
||||
await supplier.updateAttribute('payDay', 5);
|
||||
const firstResult = await models.Supplier.findById(442);
|
||||
try {
|
||||
await supplierTwo.updateAttribute('payMethodFk', 2, options);
|
||||
await supplierTwo.updateAttribute('isPayMethodChecked', true, options);
|
||||
await supplierTwo.updateAttribute('payDay', 5, options);
|
||||
const firstResult = await models.Supplier.findById(442, null, options);
|
||||
|
||||
await supplier.updateAttribute('isPayMethodChecked', true);
|
||||
await supplier.updateAttribute('payDemFk', 1);
|
||||
const secondResult = await models.Supplier.findById(442);
|
||||
await supplierTwo.updateAttribute('isPayMethodChecked', true, options);
|
||||
await supplierTwo.updateAttribute('payDemFk', 1, options);
|
||||
const secondResult = await models.Supplier.findById(442, null, options);
|
||||
|
||||
expect(firstResult.isPayMethodChecked).toEqual(false);
|
||||
expect(secondResult.isPayMethodChecked).toEqual(false);
|
||||
expect(firstResult.isPayMethodChecked).toEqual(false);
|
||||
expect(secondResult.isPayMethodChecked).toEqual(false);
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
await tx.rollback();
|
||||
throw e;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const models = require('vn-loopback/server/server').models;
|
||||
|
||||
describe('TicketFuture getTicketsFuture()', () => {
|
||||
describe('ticket getTicketsFuture()', () => {
|
||||
const today = new Date();
|
||||
today.setHours(0, 0, 0, 0);
|
||||
|
|
@ -33,7 +33,7 @@ module.exports = function(Self) {
|
|||
require('../methods/ticket/closeByTicket')(Self);
|
||||
require('../methods/ticket/closeByAgency')(Self);
|
||||
require('../methods/ticket/closeByRoute')(Self);
|
||||
require('../methods/ticket-future/getTicketsFuture')(Self);
|
||||
require('../methods/ticket/getTicketsFuture')(Self);
|
||||
require('../methods/ticket/merge')(Self);
|
||||
require('../methods/ticket/getTicketsAdvance')(Self);
|
||||
require('../methods/ticket/isRoleAdvanced')(Self);
|
||||
|
|
|
@ -256,7 +256,7 @@ class Controller extends Section {
|
|||
this.$http.post(`NotificationQueues`, {
|
||||
notificationFk: 'invoiceElectronic',
|
||||
authorFk: client.id,
|
||||
}).then(a => {
|
||||
}).then(() => {
|
||||
this.vnApp.showSuccess(this.$t('Invoice sent'));
|
||||
});
|
||||
}
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
const Stylesheet = require(`vn-print/core/stylesheet`);
|
||||
|
||||
const path = require('path');
|
||||
const vnPrintPath = path.resolve('print');
|
||||
|
||||
module.exports = new Stylesheet([
|
||||
`${vnPrintPath}/common/css/spacing.css`,
|
||||
`${vnPrintPath}/common/css/misc.css`,
|
||||
`${vnPrintPath}/common/css/layout.css`,
|
||||
`${vnPrintPath}/common/css/email.css`])
|
||||
.mergeStyles();
|
|
@ -0,0 +1,3 @@
|
|||
subject: Pay method updated
|
||||
title: Pay method updated
|
||||
description: The pay method of the supplier {0} has been updated from {1} to {2}
|
|
@ -0,0 +1,3 @@
|
|||
subject: Método de pago actualizado
|
||||
title: Método de pago actualizado
|
||||
description: Se ha actualizado el método de pago del proveedor {0} de {1} a {2}
|
|
@ -0,0 +1,8 @@
|
|||
<email-body v-bind="$props">
|
||||
<div class="grid-row">
|
||||
<div class="grid-block vn-pa-ml">
|
||||
<h1>{{ $t('title') }}</h1>
|
||||
<p v-html="$t('description', [name, oldPayMethod, newPayMethod])"></p>
|
||||
</div>
|
||||
</div>
|
||||
</email-body>
|
|
@ -0,0 +1,23 @@
|
|||
const Component = require(`vn-print/core/component`);
|
||||
const emailBody = new Component('email-body');
|
||||
|
||||
module.exports = {
|
||||
name: 'supplier-pay-method-update',
|
||||
components: {
|
||||
'email-body': emailBody.build(),
|
||||
},
|
||||
props: {
|
||||
name: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
oldPayMethod: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
newPayMethod: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
}
|
||||
};
|
|
@ -20,7 +20,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td class="font gray uppercase">{{$t('ref')}}</td>
|
||||
<th>{{entry.ref}}</th>
|
||||
<th>{{entry.invoiceNumber}}</th>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
SELECT
|
||||
e.id,
|
||||
e.ref,
|
||||
e.invoiceNumber,
|
||||
e.notes,
|
||||
c.code companyCode,
|
||||
t.landed
|
||||
FROM entry e
|
||||
JOIN travel t ON t.id = e.travelFk
|
||||
JOIN company c ON c.id = e.companyFk
|
||||
WHERE e.id = ?
|
||||
WHERE e.id = ?
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
<tbody>
|
||||
<tr v-for="entry in travel.entries">
|
||||
<td>{{entry.supplierName}}</td>
|
||||
<td>{{entry.ref}}</td>
|
||||
<td>{{entry.reference}}</td>
|
||||
<td class="number">{{entry.volumeKg | number($i18n.locale)}}</td>
|
||||
<td class="number">{{entry.loadedKg | number($i18n.locale)}}</td>
|
||||
<td class="number">{{entry.stickers}}</td>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
SELECT
|
||||
e.id,
|
||||
e.travelFk,
|
||||
e.ref,
|
||||
e.reference,
|
||||
s.name AS supplierName,
|
||||
SUM(b.stickers) AS stickers,
|
||||
CAST(SUM(b.weight * b.stickers) as DECIMAL(10,0)) as loadedKg,
|
||||
|
@ -15,4 +15,4 @@ SELECT
|
|||
JOIN supplier s ON s.id = e.supplierFk
|
||||
JOIN vn.volumeConfig vc
|
||||
WHERE t.id IN(?)
|
||||
GROUP BY e.id
|
||||
GROUP BY e.id
|
||||
|
|
|
@ -5,9 +5,8 @@
|
|||
<div class="grid-row">
|
||||
<div class="grid-block">
|
||||
<div class="columns vn-mb-lg">
|
||||
<div class="size50">
|
||||
<div class="size75 vn-mt-ml">
|
||||
<h1 class="title uppercase">{{$t('title')}}</h1>
|
||||
<div class="size75">
|
||||
<div class="size100 vn-mt-ml">
|
||||
<table class="row-oriented ticket-info">
|
||||
<tbody>
|
||||
<tr>
|
||||
|
@ -16,7 +15,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td class="font gray uppercase">{{$t('invoiceId')}}</td>
|
||||
<th>{{invoice.id}}</th>
|
||||
<th>{{invoice.supplierRef}}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="font gray uppercase">{{$t('date')}}</td>
|
||||
|
@ -26,7 +25,7 @@
|
|||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="size50">
|
||||
<div class="size25">
|
||||
<div class="panel">
|
||||
<div class="header">{{$t('invoiceData')}}</div>
|
||||
<div class="body">
|
||||
|
@ -43,7 +42,7 @@
|
|||
<div class="vn-mt-lg" v-for="entry in entries">
|
||||
<div class="table-title clearfix">
|
||||
<div class="pull-left">
|
||||
<h2>{{$t('invoiceId')}}</h2>
|
||||
<h2>{{$t('entry')}}</h2>
|
||||
</div>
|
||||
<div class="pull-left vn-mr-md">
|
||||
<div class="field rectangle">
|
||||
|
@ -64,7 +63,7 @@
|
|||
</div>
|
||||
<div class="pull-left">
|
||||
<div class="field rectangle">
|
||||
<span>{{entry.ref}}</span>
|
||||
<span>{{entry.reference}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</span>
|
||||
|
@ -82,7 +81,7 @@
|
|||
<tr>
|
||||
<td width="50%">{{buy.name}}</td>
|
||||
<td class="number">{{buy.quantity}}</td>
|
||||
<td class="number">{{buy.buyingValue}}</td>
|
||||
<td class="number">{{buy.buyingValue | currency('EUR', $i18n.locale)}}</td>
|
||||
<td class="number">{{buyImport(buy) | currency('EUR', $i18n.locale)}}</td>
|
||||
</tr>
|
||||
<tr class="description font light-gray">
|
||||
|
@ -103,27 +102,31 @@
|
|||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="columns vn-mt-xl">
|
||||
<div id="taxes" class="size50 pull-right no-page-break" v-if="taxes">
|
||||
<div id="signature" class="size50 pull-left no-page-break vn-pr-xs">
|
||||
<div class="panel">
|
||||
<div class="header">{{$t('payMethod')}}: {{invoice.payMethod}}</div>
|
||||
<div class="body">
|
||||
<div class="vn-mt-md">{{$t('signer.received')}}:</div>
|
||||
<div class="vn-my-md">{{$t('signer.signed')}}:</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="taxes" class="size50 pull-right no-page-break vn-pl-xs vn-mt-md" v-if="taxes">
|
||||
<table class="column-oriented">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="4">{{$t('taxBreakdown')}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<thead class="light">
|
||||
<tr>
|
||||
<th width="45%">{{$t('type')}}</th>
|
||||
<th width="25%" class="number">{{$t('taxBase')}}</th>
|
||||
<th>{{$t('tax')}}</th>
|
||||
<th class="number">{{$t('fee')}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="tax in taxes">
|
||||
<td width="45%">{{tax.name}}</td>
|
||||
<td width="25%" class="number">{{tax.taxableBase | currency('EUR', $i18n.locale)}}</td>
|
||||
<td>{{tax.rate | percentage}}</td>
|
||||
<td width="25%" class="number">{{tax.taxableBase | currency('EUR', $i18n.locale)}}
|
||||
</td>
|
||||
<td>{{(tax.rate / 100) | percentage}}</td>
|
||||
<td class="number">{{tax.vat | currency('EUR', $i18n.locale)}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
@ -150,28 +153,16 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="columns vn-mt-xl">
|
||||
<div class="size50 pull-left no-page-break">
|
||||
<div class="panel">
|
||||
<div class="header">{{$t('observations')}}</div>
|
||||
<div class="body">
|
||||
<div>{{$t('payMethod')}}</div>
|
||||
<div>{{invoice.payMethod}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="footer" class="vn-mt-xl">
|
||||
<h2 class="centered bold">{{$t('footer')}}</h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<template v-slot:footer>
|
||||
<report-footer
|
||||
id="pageFooter"
|
||||
v-bind:company-code="invoice.companyCode"
|
||||
v-bind:left-text="$t('invoiceId')"
|
||||
v-bind:center-text="invoice.name"
|
||||
v-bind="$props"
|
||||
>
|
||||
<report-footer id="pageFooter" v-bind:company-code="invoice.companyCode" v-bind:left-text="$t('invoiceId')"
|
||||
v-bind:center-text="invoice.name" v-bind="$props">
|
||||
</report-footer>
|
||||
</template>
|
||||
</report-body>
|
||||
|
|
|
@ -9,6 +9,16 @@ module.exports = {
|
|||
this.invoice = await this.fetchInvoice(this.id);
|
||||
this.taxes = await this.fetchTaxes(this.id);
|
||||
|
||||
let defaultTax = await this.fetchDefaultTax();
|
||||
|
||||
if (defaultTax) {
|
||||
defaultTax = Object.assign(defaultTax, {
|
||||
taxableBase: 0,
|
||||
vat: (this.taxTotal() * defaultTax.rate / 100)
|
||||
});
|
||||
this.taxes.push(defaultTax);
|
||||
}
|
||||
|
||||
if (!this.invoice)
|
||||
throw new Error('Something went wrong');
|
||||
|
||||
|
@ -43,6 +53,9 @@ module.exports = {
|
|||
fetchBuy(id) {
|
||||
return this.rawSqlFromDef('buy', [id]);
|
||||
},
|
||||
fetchDefaultTax() {
|
||||
return this.findOneFromDef('defaultTax');
|
||||
},
|
||||
async fetchTaxes(id) {
|
||||
const taxes = await this.rawSqlFromDef(`taxes`, [id]);
|
||||
return this.taxVat(taxes);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
reportName: invoice
|
||||
title: Agricultural invoice
|
||||
invoiceId: Agricultural invoice
|
||||
reportName: agricultural receip
|
||||
title: Agricultural receip
|
||||
invoiceId: Agricultural receip
|
||||
supplierId: Proveedor
|
||||
invoiceData: Invoice data
|
||||
reference: Reference
|
||||
|
@ -23,3 +23,8 @@ subtotal: Subtotal
|
|||
taxBreakdown: Tax breakdown
|
||||
observations: Observations
|
||||
payMethod: Pay method
|
||||
entry: Entry
|
||||
signer:
|
||||
received: Received
|
||||
signed: Signature
|
||||
footer: Passive subject covered by the special agrarian regime. Please send this duly signed and sealed copy. Thanks.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
reportName: factura
|
||||
title: Factura Agrícola
|
||||
invoiceId: Factura Agrícola
|
||||
reportName: recibo agrícola
|
||||
title: Recibo Agrícola
|
||||
invoiceId: Recibo Agrícola
|
||||
supplierId: Proveedor
|
||||
invoiceData: Datos de facturación
|
||||
reference: Referencia
|
||||
|
@ -23,3 +23,8 @@ subtotal: Subtotal
|
|||
taxBreakdown: Desglose impositivo
|
||||
observations: Observaciones
|
||||
payMethod: Método de pago
|
||||
entry: Entrada
|
||||
signer:
|
||||
received: Recibí
|
||||
signed: Firma y sello
|
||||
footer: Sujeto pasivo acogido al régimen especial agrario. Les rogamos remitan esta copia debidamente firmada y sellada. Gracias.
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
SELECT
|
||||
id,
|
||||
retentionRate rate,
|
||||
retentionName name
|
||||
FROM invoiceInConfig;
|
|
@ -1,7 +1,7 @@
|
|||
SELECT
|
||||
e.id,
|
||||
t.landed,
|
||||
e.ref
|
||||
e.reference
|
||||
FROM entry e
|
||||
JOIN invoiceIn i ON i.id = e.invoiceInFk
|
||||
JOIN travel t ON t.id = e.travelFk
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
SELECT
|
||||
i.id,
|
||||
i.supplierRef,
|
||||
s.id supplierId,
|
||||
i.created,
|
||||
s.name,
|
||||
|
|
|
@ -5,4 +5,5 @@ SELECT
|
|||
FROM invoiceIn ii
|
||||
JOIN invoiceInTax iit ON ii.id = iit.invoiceInFk
|
||||
JOIN sage.TiposIva ti ON ti.CodigoIva = iit.taxTypeSageFk
|
||||
WHERE ii.id = ?;
|
||||
WHERE ii.id = ?
|
||||
ORDER BY name DESC;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
SELECT
|
||||
e.id,
|
||||
e.ref,
|
||||
e.reference,
|
||||
e.supplierFk,
|
||||
t.shipped
|
||||
FROM vn.entry e
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
<h2>
|
||||
<span>{{$t('entry')}} {{entry.id}}</span>
|
||||
<span>{{$t('dated')}} {{entry.shipped | date('%d-%m-%Y')}}</span>
|
||||
<span class="pull-right">{{$t('reference')}} {{entry.ref}}</span>
|
||||
<span class="pull-right">{{$t('reference')}} {{entry.reference}}</span>
|
||||
</h2>
|
||||
<table class="column-oriented repeatable">
|
||||
<thead>
|
||||
|
|
Loading…
Reference in New Issue