Merge branch 'dev' into 4503-opcion-rocket
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Alexandre Riera 2022-12-20 06:55:11 +00:00
commit 0009f27462
21 changed files with 140 additions and 59 deletions

View File

@ -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);

View File

@ -2,7 +2,7 @@
"InvoiceIn": {
"dataSource": "vn"
},
"InvoiceInTax": {
"InvoiceInConfig": {
"dataSource": "vn"
},
"InvoiceInDueDay": {
@ -13,5 +13,8 @@
},
"InvoiceInLog": {
"dataSource": "vn"
},
"InvoiceInTax": {
"dataSource": "vn"
}
}

View File

@ -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"
}]
}

View File

@ -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

View File

@ -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', {

View File

@ -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;

View File

@ -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'));
});
}

View File

@ -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>

View File

@ -1,6 +1,6 @@
SELECT
e.id,
e.ref,
e.invoiceNumber,
e.notes,
c.code companyCode,
t.landed

View File

@ -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>

View File

@ -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,

View File

@ -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 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>

View File

@ -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);

View File

@ -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.

View File

@ -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.

View File

@ -0,0 +1,5 @@
SELECT
id,
retentionRate rate,
retentionName name
FROM invoiceInConfig;

View File

@ -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

View File

@ -1,5 +1,5 @@
SELECT
i.id,
i.supplierRef,
s.id supplierId,
i.created,
s.name,

View File

@ -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;

View File

@ -1,6 +1,6 @@
SELECT
e.id,
e.ref,
e.reference,
e.supplierFk,
t.shipped
FROM vn.entry e

View File

@ -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>