creada seccion invoiceInTax
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Javi Gallego 2021-06-09 10:20:18 +02:00
parent 8878a2280a
commit acf03959f5
8 changed files with 166 additions and 62 deletions

View File

@ -1,12 +1,12 @@
{
"name": "InvoiceIn",
"name": "InvoiceInTax",
"base": "Loggable",
"log": {
"model": "InvoiceInLog"
},
"options": {
"mysql": {
"table": "invoiceIn"
"table": "invoiceInTax"
}
},
"properties": {
@ -21,6 +21,12 @@
"foreignValue": {
"type": "number"
},
"expenseFk": {
"type": "number",
"mysql": {
"columnName": "expenceFk"
}
},
"created": {
"type": "date"
}
@ -36,14 +42,14 @@
"model": "InvoiceIn",
"foreignKey": "invoiceInFk"
},
"expence": {
"expense": {
"type": "belongsTo",
"model": "Expence",
"foreignKey": "expenceFk"
"model": "Expense",
"foreignKey": "expenseFk"
},
"tiposIva": {
"taxTypeSage": {
"type": "belongsTo",
"model": "TiposIva",
"model": "TaxTypeSage",
"foreignKey": "taxTypeSageFk"
},
"transactionTypeSage": {

View File

@ -1,30 +0,0 @@
{
"name": "SageIvaType",
"options": {
"mysql": {
"table": "sage.TiposIva"
}
},
"properties": {
"id": {
"id": true,
"type": "Number",
"description": "Identifier",
"mysql": {
"columnName": "CodigoIva"
}
},
"description": {
"type": "string",
"mysql": {
"columnName": "Iva"
}
},
"rate": {
"type": "number",
"mysql": {
"columnName": "PorcentajeIva"
}
}
}
}

View File

@ -1,24 +0,0 @@
{
"name": "sageTransactionType",
"options": {
"mysql": {
"table": "sage.TiposTransacciones"
}
},
"properties": {
"id": {
"id": true,
"type": "Number",
"description": "Identifier",
"mysql": {
"columnName": "CodigoTransaccion"
}
},
"description": {
"type": "string",
"mysql": {
"columnName": "Transaccion"
}
}
}
}

View File

@ -8,4 +8,5 @@ import './descriptor';
import './descriptor-popover';
import './summary';
import './basic-data';
import './tax';
import './log';

View File

@ -2,4 +2,9 @@ InvoiceIn: Facturas recibidas
Search invoices in by reference: Buscar facturas recibidas por referencia
Entries list: Listado de entradas
Invoice list: Listado de entradas
InvoiceIn deleted: Factura eliminada
InvoiceIn deleted: Factura eliminada
Remove tax: Quitar iva
Add tax: Añadir iva
taxable base: bi
sage tax: sage iva
sage transaction: sage transaccion

View File

@ -13,6 +13,10 @@
"state": "invoiceIn.card.basicData",
"icon": "settings"
},
{
"state": "invoiceIn.card.tax",
"icon": "contact_support"
},
{
"state": "invoiceIn.card.log",
"icon": "history"
@ -60,6 +64,16 @@
},
"acl": ["administrative"]
},
{
"url": "/tax",
"state": "invoiceIn.card.tax",
"component": "vn-invoice-in-tax",
"description": "Tax",
"params": {
"invoice-in": "$ctrl.invoiceIn"
},
"acl": ["administrative"]
},
{
"url": "/log",
"state": "invoiceIn.card.log",

View File

@ -0,0 +1,98 @@
<vn-crud-model
vn-id="model"
url="InvoiceInTaxes"
fields="['id', 'invoiceInFk', 'taxableBase', 'expenseFk', 'foreignValue','taxTypeSageFk','transactionTypeSageFk']"
link="{invoiceInFk: $ctrl.$params.id}"
data="$ctrl.taxes"
auto-load="true">
</vn-crud-model>
<vn-crud-model
url="SageTaxTypes"
data="sageTaxTypes"
auto-load="true">
</vn-crud-model>
<vn-crud-model
url="Expenses"
data="expenses"
auto-load="true">
</vn-crud-model>
<vn-crud-model
url="SageTransactionTypes"
data="sageTransactionType"
auto-load="true">
</vn-crud-model>
<vn-watcher
vn-id="watcher"
data="$ctrl.invoiceInTax"
form="form">
</vn-watcher>
<form name="form" ng-submit="$ctrl.onSubmit()" class="vn-w-xl">
<vn-card class="vn-pa-lg">
<vn-horizontal ng-repeat="invoiceInTax in $ctrl.taxes">
<vn-autocomplete vn-two vn-id="expense" vn-focus
label="Expense"
ng-model="invoiceInTax.expenseFk"
data="expenses"
show-field="id"
rule>
<tpl-item>{{id}}: {{name}}</tpl-item>
</vn-autocomplete>
<vn-input-number vn-one
type="number"
label="taxable base"
ng-model="invoiceInTax.taxableBase"
rule>
</vn-input-number>
<vn-autocomplete vn-two
label="sage tax"
ng-model="invoiceInTax.taxTypeSageFk"
data="sageTaxTypes"
show-field="vat"
search-function="{or: [{id: $search}, {vat: {like: '%'+ $search +'%'}}]}"
rule>
<tpl-item>{{id}}: {{vat}}</tpl-item>
</vn-autocomplete>
<vn-autocomplete vn-two
label="sage transaction"
ng-model="invoiceInTax.transactionTypeSageFk"
data="sageTransactionType"
show-field="transaction"
search-function="{or: [{id: $search}, {transaction: {like: '%'+ $search +'%'}}]}"
rule>
<tpl-item>{{id}}: {{transaction}}</tpl-item>
</vn-autocomplete>
<vn-input-number vn-one disabled="true"
type="number"
label="total">
</vn-input-number>
<vn-input-number vn-one
type="number"
label="foreignValue"
ng-model="invoiceInTax.foreignValue"
rule>
</vn-input-number>
<vn-none>
<vn-icon-button
vn-tooltip="Remove tax"
icon="delete"
ng-click="model.remove($index)"
tabindex="-1">
</vn-icon-button>
</vn-none>
</vn-horizontal>
<vn-one>
<vn-icon-button
vn-bind="+"
vn-tooltip="Add tax"
icon="add_circle"
ng-click="$ctrl.add()">
</vn-icon-button>
</vn-one>
</vn-card>
<vn-button-bar>
<vn-submit
disabled="!watcher.dataChanged()"
label="Save">
</vn-submit>
</vn-button-bar>
</form>

View File

@ -0,0 +1,34 @@
import ngModule from '../module';
import Section from 'salix/components/section';
class Controller extends Section {
constructor($element, $) {
super($element, $);
}
add() {
this.$.model.insert({
invoiceIn: this.$params.id,
expenseFk: 6000000001
});
}
onSubmit() {
this.$.watcher.check();
this.$.model.save().then(() => {
this.$.watcher.notifySaved();
this.$.watcher.updateOriginalData();
this.card.reload();
});
}
}
ngModule.vnComponent('vnInvoiceInTax', {
template: require('./index.html'),
controller: Controller,
require: {
card: '^vnInvoiceInCard'
},
bindings: {
invoiceIn: '<'
}
});