0
0
Fork 0

Merge pull request '#7897 - Merge master into test' (!668) from master into test

Reviewed-on: verdnatura/salix-front#668
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
Reviewed-by: Carlos Andrés <carlosap@verdnatura.es>
This commit is contained in:
Carlos Andrés 2024-09-04 14:28:54 +00:00
commit 3e6710404b
25 changed files with 418 additions and 328 deletions

View File

@ -1,3 +1,120 @@
# Version 24.36 - 2024-09-03
### Added 🆕
- Cesta → Se añaden notas
- Trabajadore → Se puede modificar la foto
- General → Recuperar y restaurar contraseña
### Changed 📦
- (General) Modificado filtro lateral
### Fixed 🛠️
- Cesta → Mejoras varias
- Reclamaciones → Mejoras varias
- Usuarios → Mejoras varias
# Version 24.34 - 2024-08-20
### Added 🆕
## Changed 📦
- General → Trabajadores: Migrado de Salix a Lilium
## Fixed 🛠️
- Artículos → General: Arreglados fallos de interfaz
- Fact. Recibidas → General: Arreglados fallos de interfaz
- Trabajadores → General: Arreglados fallos de interfaz
- Usuarios → General: Arreglados fallos de interfaz
- chore: #6900 order params by:jorgep
- chore: refs #6900 drop console log by:jorgep
- chore: refs #6900 drop vnCurrency by:jorgep
- chore: refs #6900 fix e2e tests by:jorgep
- chore: refs #6900 mv rectificative logic by:jorgep
- chore: refs #6900 responsive code by:jorgep
- chore: refs #7283 drop array types by:jorgep
- chore: refs #7283 drop import by:jorgep
- chore: refs #7283 fix e2e logout by:jorgep
- chore: refs #7283 update VnAvatar title handling by:jorgep
- chore: refs #7323 fix test by:jorgep
- chore: refs #7323 remove unused import by:jorgep
- chore: refs #7323drop commented code by:jorgep
- feat(VnCard): use props searchbar by:alexm
- feat(customer): improve basicData to balance by:alexm
- feat(customer_balance): refs #6943 add functionality from salix by:alexm
- feat(customer_balance): refs #6943 translations by:alexm
- feat: refs #6130 husky commitLint config by:pablone
- feat: refs #6130 husky hooks by:pablone
- feat: refs #6900 add InvoiceInSerial by:jorgep
- feat: refs #6900 add locale by:jorgep
- feat: refs #6900 use VnTable & sort filter fields by:jorgep
- feat: refs #7323 add flex-wrap by:jorgep
- feat: refs #7323 add my account" btn & fix models log selectable by:jorgep
- feat: refs #7323 improve test by:jorgep
### Changed 📦
- refactor(customer_log: use VnLog by:alexm
- refactor(customer_recovery): to vnTable by:alexm
- refactor(customer_webAccess): FormModel by:alexm
- refactor: refs #7283 update avatar size and color by:jorgep
### Fixed 🛠️
- chore: refs #6900 fix e2e tests by:jorgep
- chore: refs #7283 fix e2e logout by:jorgep
- chore: refs #7323 fix test by:jorgep
- feat: refs #7323 add my account" btn & fix models log selectable by:jorgep
- fix #7355 fix acls list by:carlossa
- fix(VnFilterPanel): emit userParams better by:alexm
- fix(claim_summary): url links (HEAD -> 7864_testToMaster_2434, origin/test, origin/7864_testToMaster_2434, test) by:alexm
- fix(customer_sms: fix reload by:alexm
- fix(twoFactor): unify code login and twoFactor by:alexm
- fix: VnCard VnSearchbar props by:alexm
- fix: accountMailAlias by:alexm
- fix: refs #6130 add commit lint modules by:pablone
- fix: refs #6130 pnpm-lock.yml by:pablone
- fix: refs #6900 improve loading by:jorgep
- fix: refs #6900 improve logic (origin/6900-addSerial) by:jorgep
- fix: refs #6900 improve logic by:jorgep
- fix: refs #6900 rectificative btn reactivity by:jorgep
- fix: refs #6900 use type number by:jorgep
- fix: refs #6900 vat & dueday by:jorgep
- fix: refs #6900 vat, dueday & intrastat by:jorgep
- fix: refs #6989 show entity name & default time from config table by:jorgep
- fix: refs #7283 basicData locale by:jorgep
- fix: refs #7283 itemLastEntries filter by:jorgep
- fix: refs #7283 itemTags & VnImg by:jorgep
- fix: refs #7283 locale by:jorgep
- fix: refs #7283 min-width vnImg by:jorgep
- fix: refs #7283 use vnAvatar & add optional zoom by:jorgep
- fix: refs #7283 userPanel pic by:jorgep
- fix: refs #7323 add department popup by:jorgep
- fix: refs #7323 add locale by:jorgep
- fix: refs #7323 css righ menu by:jorgep
- fix: refs #7323 data-key & add select by:jorgep
- fix: refs #7323 load all opts by:jorgep
- fix: refs #7323 righ menu bug by:jorgep
- fix: refs #7323 use global locale by:jorgep
- fix: refs #7323 use workerFilter (origin/7323-warmfix-fixErrors) by:jorgep
- fix: refs #7323 vnsubtoolbar css by:jorgep
- fix: refs #7323 wrong css by:jorgep
- refs #7355 fix Rol, alias by:carlossa
- refs #7355 fix accountAlias by:carlossa
- refs #7355 fix alias summary by:carlossa
- refs #7355 fix conflicts by:carlossa
- refs #7355 fix create Rol by:carlossa
- refs #7355 fix list by:carlossa
- refs #7355 fix lists redirects summary by:carlossa
- refs #7355 fix roles by:carlossa
- refs #7355 fix search exprBuilder by:carlossa
- refs #7355 fix vnTable by:carlos
# Version 24.32 - 2024-08-06 # Version 24.32 - 2024-08-06
### Added 🆕 ### Added 🆕

View File

@ -0,0 +1,50 @@
<script setup>
import { useI18n } from 'vue-i18n';
import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue';
import FormModelPopup from './FormModelPopup.vue';
const emit = defineEmits(['onDataSaved']);
const { t } = useI18n();
</script>
<template>
<FormModelPopup
url-create="Expenses"
model="Expense"
:title="t('New expense')"
:form-initial-data="{ id: null, isWithheld: false, name: null }"
@on-data-saved="emit('onDataSaved', $event)"
>
<template #form-inputs="{ data, validate }">
<VnRow>
<VnInput
:label="`${t('globals.code')}`"
v-model="data.id"
:required="true"
:rules="validate('expense.code')"
/>
<QCheckbox
dense
size="sm"
:label="`${t('It\'s a withholding')}`"
v-model="data.isWithheld"
:rules="validate('expense.isWithheld')"
/>
</VnRow>
<VnRow>
<VnInput
:label="`${t('globals.description')}`"
v-model="data.name"
:required="true"
:rules="validate('expense.description')"
/>
</VnRow>
</template>
</FormModelPopup>
</template>
<i18n>
es:
New expense: Nuevo gasto
It's a withholding: Es una retención
</i18n>

View File

@ -1,6 +1,6 @@
<script setup> <script setup>
import axios from 'axios'; import axios from 'axios';
import { onMounted, ref, reactive } from 'vue'; import { onMounted, watch, ref, reactive } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { QSeparator, useQuasar } from 'quasar'; import { QSeparator, useQuasar } from 'quasar';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
@ -29,6 +29,15 @@ onMounted(async () => {
getRoutes(); getRoutes();
}); });
watch(
() => route.matched,
() => {
items.value = [];
getRoutes();
},
{ deep: true }
);
function findMatches(search, item) { function findMatches(search, item) {
const matches = []; const matches = [];
function findRoute(search, item) { function findRoute(search, item) {

View File

@ -0,0 +1,10 @@
import { toCurrency } from 'src/filters';
export function getTotal(rows, key, opts = {}) {
const { currency, cb } = opts;
const total = rows.reduce((acc, row) => acc + +(cb ? cb(row) : row[key] || 0), 0);
return currency
? toCurrency(total, currency == 'default' ? undefined : currency)
: total;
}

View File

@ -256,6 +256,7 @@ globals:
recoverPassword: Recover password recoverPassword: Recover password
resetPassword: Reset password resetPassword: Reset password
serial: Serial serial: Serial
supplier: Supplier
created: Created created: Created
worker: Worker worker: Worker
now: Now now: Now
@ -746,56 +747,6 @@ parking:
searchBar: searchBar:
info: You can search by parking code info: You can search by parking code
label: Search parking... label: Search parking...
invoiceIn:
list:
ref: Reference
supplier: Supplier
supplierRef: Supplier ref.
serialNumber: Serial number
serial: Serial
file: File
issued: Issued
isBooked: Is booked
awb: AWB
amount: Amount
card:
issued: Issued
amount: Amount
client: Client
company: Company
customerCard: Customer card
ticketList: Ticket List
vat: Vat
dueDay: Due day
intrastat: Intrastat
summary:
supplier: Supplier
supplierRef: Supplier ref.
currency: Currency
docNumber: Doc number
issued: Expedition date
operated: Operation date
bookEntried: Entry date
bookedDate: Booked date
sage: Sage withholding
vat: Undeductible VAT
company: Company
booked: Booked
expense: Expense
taxableBase: Taxable base
rate: Rate
sageVat: Sage vat
sageTransaction: Sage transaction
dueDay: Date
bank: Bank
amount: Amount
foreignValue: Foreign value
dueTotal: Due day
noMatch: Do not match
code: Code
net: Net
stems: Stems
country: Country
order: order:
field: field:
salesPersonFk: Sales Person salesPersonFk: Sales Person

View File

@ -258,6 +258,7 @@ globals:
recoverPassword: Recuperar contraseña recoverPassword: Recuperar contraseña
resetPassword: Restablecer contraseña resetPassword: Restablecer contraseña
serial: Facturas por serie serial: Facturas por serie
supplier: Proveedor
created: Fecha creación created: Fecha creación
worker: Trabajador worker: Trabajador
now: Ahora now: Ahora
@ -790,54 +791,6 @@ parking:
searchBar: searchBar:
info: Puedes buscar por código de parking info: Puedes buscar por código de parking
label: Buscar parking... label: Buscar parking...
invoiceIn:
list:
ref: Referencia
supplier: Proveedor
supplierRef: Ref. proveedor
serialNumber: Num. serie
shortIssued: F. emisión
serial: Serie
file: Fichero
issued: Fecha emisión
isBooked: Conciliada
awb: AWB
amount: Importe
card:
issued: Fecha emisión
amount: Importe
client: Cliente
company: Empresa
customerCard: Ficha del cliente
ticketList: Listado de tickets
vat: Iva
dueDay: Fecha de vencimiento
summary:
supplier: Proveedor
supplierRef: Ref. proveedor
currency: Divisa
docNumber: Número documento
issued: Fecha de expedición
operated: Fecha operación
bookEntried: Fecha asiento
bookedDate: Fecha contable
sage: Retención sage
vat: Iva no deducible
company: Empresa
booked: Contabilizada
expense: Gasto
taxableBase: Base imp.
rate: Tasa
sageTransaction: Sage transación
dueDay: Fecha
bank: Caja
amount: Importe
foreignValue: Divisa
dueTotal: Vencimiento
code: Código
net: Neto
stems: Tallos
country: País
department: department:
pageTitles: pageTitles:
basicData: Basic data basicData: Basic data

View File

@ -223,6 +223,10 @@ async function onSubmit() {
autofocus autofocus
/> />
</VnRow> </VnRow>
<VnRow>
<VnInputDate :label="t('Entry date')" v-model="data.bookEntried" />
<VnInputDate :label="t('Accounted date')" v-model="data.booked" />
</VnRow>
<VnRow> <VnRow>
<VnSelect <VnSelect
:label="t('Undeductible VAT')" :label="t('Undeductible VAT')"
@ -285,10 +289,6 @@ async function onSubmit() {
</template> </template>
</VnInput> </VnInput>
</VnRow> </VnRow>
<VnRow>
<VnInputDate :label="t('Entry date')" v-model="data.bookEntried" />
<VnInputDate :label="t('Accounted date')" v-model="data.booked" />
</VnRow>
<VnRow> <VnRow>
<VnSelect <VnSelect
:label="t('Currency')" :label="t('Currency')"

View File

@ -3,6 +3,8 @@ import VnCard from 'components/common/VnCard.vue';
import InvoiceInDescriptor from './InvoiceInDescriptor.vue'; import InvoiceInDescriptor from './InvoiceInDescriptor.vue';
import InvoiceInFilter from '../InvoiceInFilter.vue'; import InvoiceInFilter from '../InvoiceInFilter.vue';
import InvoiceInSearchbar from '../InvoiceInSearchbar.vue'; import InvoiceInSearchbar from '../InvoiceInSearchbar.vue';
import { onBeforeRouteUpdate } from 'vue-router';
import { setRectificative } from '../composables/setRectificative';
const filter = { const filter = {
include: [ include: [
@ -20,6 +22,8 @@ const filter = {
{ relation: 'currency' }, { relation: 'currency' },
], ],
}; };
onBeforeRouteUpdate(async (to) => await setRectificative(to));
</script> </script>
<template> <template>
<VnCard <VnCard

View File

@ -356,10 +356,7 @@ const createInvoiceInCorrection = async () => {
<template #body="{ entity }"> <template #body="{ entity }">
<VnLv :label="t('invoiceIn.card.issued')" :value="toDate(entity.issued)" /> <VnLv :label="t('invoiceIn.card.issued')" :value="toDate(entity.issued)" />
<VnLv :label="t('invoiceIn.summary.booked')" :value="toDate(entity.booked)" /> <VnLv :label="t('invoiceIn.summary.booked')" :value="toDate(entity.booked)" />
<VnLv <VnLv :label="t('invoiceIn.card.amount')" :value="toCurrency(totalAmount)" />
:label="t('invoiceIn.card.amount')"
:value="toCurrency(totalAmount, entity.currency?.code)"
/>
<VnLv :label="t('invoiceIn.summary.supplier')"> <VnLv :label="t('invoiceIn.summary.supplier')">
<template #value> <template #value>
<span class="link"> <span class="link">

View File

@ -5,10 +5,10 @@ import { useI18n } from 'vue-i18n';
import axios from 'axios'; import axios from 'axios';
import { toDate } from 'src/filters'; import { toDate } from 'src/filters';
import { useArrayData } from 'src/composables/useArrayData'; import { useArrayData } from 'src/composables/useArrayData';
import { getTotal } from 'src/composables/getTotal';
import CrudModel from 'src/components/CrudModel.vue'; import CrudModel from 'src/components/CrudModel.vue';
import FetchData from 'src/components/FetchData.vue'; import FetchData from 'src/components/FetchData.vue';
import VnSelect from 'src/components/common/VnSelect.vue'; import VnSelect from 'src/components/common/VnSelect.vue';
import { toCurrency } from 'src/filters';
import useNotify from 'src/composables/useNotify.js'; import useNotify from 'src/composables/useNotify.js';
import VnInputDate from 'src/components/common/VnInputDate.vue'; import VnInputDate from 'src/components/common/VnInputDate.vue';
import VnInputNumber from 'src/components/common/VnInputNumber.vue'; import VnInputNumber from 'src/components/common/VnInputNumber.vue';
@ -71,7 +71,6 @@ async function insert() {
await invoiceInFormRef.value.reload(); await invoiceInFormRef.value.reload();
notify(t('globals.dataSaved'), 'positive'); notify(t('globals.dataSaved'), 'positive');
} }
const getTotalAmount = (rows) => rows.reduce((acc, { amount }) => acc + +amount, 0);
</script> </script>
<template> <template>
<FetchData <FetchData
@ -154,11 +153,17 @@ const getTotalAmount = (rows) => rows.reduce((acc, { amount }) => acc + +amount,
<QTd /> <QTd />
<QTd /> <QTd />
<QTd> <QTd>
{{ {{ getTotal(rows, 'amount', { currency: 'default' }) }}
toCurrency(getTotalAmount(rows), invoiceIn.currency.code) </QTd>
}} <QTd>
<template v-if="isNotEuro(invoiceIn.currency.code)">
{{
getTotal(rows, 'foreignValue', {
currency: invoiceIn.currency.code,
})
}}
</template>
</QTd> </QTd>
<QTd />
</QTr> </QTr>
</template> </template>
<template #item="props"> <template #item="props">

View File

@ -2,18 +2,15 @@
import { computed, ref } from 'vue'; import { computed, ref } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { toCurrency } from 'src/filters'; import { getTotal } from 'src/composables/getTotal';
import CrudModel from 'src/components/CrudModel.vue'; import CrudModel from 'src/components/CrudModel.vue';
import FetchData from 'src/components/FetchData.vue'; import FetchData from 'src/components/FetchData.vue';
import VnSelect from 'src/components/common/VnSelect.vue'; import VnSelect from 'src/components/common/VnSelect.vue';
import { useArrayData } from 'src/composables/useArrayData';
import VnInputNumber from 'src/components/common/VnInputNumber.vue'; import VnInputNumber from 'src/components/common/VnInputNumber.vue';
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
const arrayData = useArrayData();
const currency = computed(() => arrayData.store.data?.currency?.code);
const invoceInIntrastat = ref([]); const invoceInIntrastat = ref([]);
const rowsSelected = ref([]); const rowsSelected = ref([]);
const countries = ref([]); const countries = ref([]);
@ -72,9 +69,6 @@ const columns = computed(() => [
}, },
]); ]);
const getTotal = (data, key) =>
data.reduce((acc, cur) => acc + +String(cur[key] || 0).replace(',', '.'), 0);
const formatOpt = (row, { model, options }, prop) => { const formatOpt = (row, { model, options }, prop) => {
const obj = row[model]; const obj = row[model];
const option = options.find(({ id }) => id == obj); const option = options.find(({ id }) => id == obj);
@ -154,7 +148,7 @@ const formatOpt = (row, { model, options }, prop) => {
<QTd /> <QTd />
<QTd /> <QTd />
<QTd> <QTd>
{{ toCurrency(getTotal(rows, 'amount'), currency) }} {{ getTotal(rows, 'amount', { currency: 'default' }) }}
</QTd> </QTd>
<QTd> <QTd>
{{ getTotal(rows, 'net') }} {{ getTotal(rows, 'net') }}

View File

@ -35,7 +35,7 @@ const vatColumns = ref([
name: 'landed', name: 'landed',
label: 'invoiceIn.summary.taxableBase', label: 'invoiceIn.summary.taxableBase',
field: (row) => row.taxableBase, field: (row) => row.taxableBase,
format: (value) => toCurrency(value, currency.value), format: (value) => toCurrency(value),
sortable: true, sortable: true,
align: 'left', align: 'left',
}, },
@ -64,7 +64,7 @@ const vatColumns = ref([
name: 'rate', name: 'rate',
label: 'invoiceIn.summary.rate', label: 'invoiceIn.summary.rate',
field: (row) => taxRate(row.taxableBase, row.taxTypeSage?.rate), field: (row) => taxRate(row.taxableBase, row.taxTypeSage?.rate),
format: (value) => toCurrency(value, currency.value), format: (value) => toCurrency(value),
sortable: true, sortable: true,
align: 'left', align: 'left',
}, },
@ -72,7 +72,7 @@ const vatColumns = ref([
name: 'currency', name: 'currency',
label: 'invoiceIn.summary.currency', label: 'invoiceIn.summary.currency',
field: (row) => row.foreignValue, field: (row) => row.foreignValue,
format: (value) => value, format: (val) => val && toCurrency(val, currency.value),
sortable: true, sortable: true,
align: 'left', align: 'left',
}, },
@ -97,7 +97,7 @@ const dueDayColumns = ref([
name: 'amount', name: 'amount',
label: 'invoiceIn.summary.amount', label: 'invoiceIn.summary.amount',
field: (row) => row.amount, field: (row) => row.amount,
format: (value) => toCurrency(value, currency.value), format: (value) => toCurrency(value),
sortable: true, sortable: true,
align: 'left', align: 'left',
}, },
@ -105,7 +105,7 @@ const dueDayColumns = ref([
name: 'landed', name: 'landed',
label: 'invoiceIn.summary.foreignValue', label: 'invoiceIn.summary.foreignValue',
field: (row) => row.foreignValue, field: (row) => row.foreignValue,
format: (value) => value, format: (val) => val && toCurrency(val, currency.value),
sortable: true, sortable: true,
align: 'left', align: 'left',
}, },
@ -124,7 +124,7 @@ const intrastatColumns = ref([
{ {
name: 'amount', name: 'amount',
label: 'invoiceIn.summary.amount', label: 'invoiceIn.summary.amount',
field: (row) => toCurrency(row.amount, currency.value), field: (row) => toCurrency(row.amount),
sortable: true, sortable: true,
align: 'left', align: 'left',
}, },
@ -179,7 +179,6 @@ const getTotalTax = (tax) =>
const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`; const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
</script> </script>
<template> <template>
<CardSummary <CardSummary
data-key="InvoiceInSummary" data-key="InvoiceInSummary"
@ -229,10 +228,7 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
:label="t('invoiceIn.summary.currency')" :label="t('invoiceIn.summary.currency')"
:value="entity.currency?.code" :value="entity.currency?.code"
/> />
<VnLv <VnLv :label="t('invoiceIn.serial')" :value="`${entity.serial}`" />
:label="t('invoiceIn.summary.docNumber')"
:value="`${entity.serial}/${entity.serialNumber}`"
/>
</QCard> </QCard>
<QCard class="vn-one"> <QCard class="vn-one">
<QCardSection class="q-pa-none"> <QCardSection class="q-pa-none">
@ -293,12 +289,9 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
<QCardSection class="q-pa-none"> <QCardSection class="q-pa-none">
<VnLv <VnLv
:label="t('invoiceIn.summary.taxableBase')" :label="t('invoiceIn.summary.taxableBase')"
:value="toCurrency(entity.totals.totalTaxableBase, currency)" :value="toCurrency(entity.totals.totalTaxableBase)"
/>
<VnLv
label="Total"
:value="toCurrency(entity.totals.totalVat, currency)"
/> />
<VnLv label="Total" :value="toCurrency(entity.totals.totalVat)" />
<VnLv :label="t('invoiceIn.summary.dueTotal')"> <VnLv :label="t('invoiceIn.summary.dueTotal')">
<template #value> <template #value>
<QChip <QChip
@ -311,7 +304,7 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
: t('invoiceIn.summary.dueTotal') : t('invoiceIn.summary.dueTotal')
" "
> >
{{ toCurrency(entity.totals.totalDueDay, currency) }} {{ toCurrency(entity.totals.totalDueDay) }}
</QChip> </QChip>
</template> </template>
</VnLv> </VnLv>
@ -350,15 +343,17 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
<template #bottom-row> <template #bottom-row>
<QTr class="bg"> <QTr class="bg">
<QTd></QTd> <QTd></QTd>
<QTd>{{ toCurrency(entity.totals.totalTaxableBase) }}</QTd>
<QTd></QTd>
<QTd></QTd>
<QTd>{{ toCurrency(getTotalTax(entity.invoiceInTax)) }}</QTd>
<QTd>{{ <QTd>{{
toCurrency(entity.totals.totalTaxableBase, currency) entity.totals.totalTaxableBaseForeignValue &&
toCurrency(
entity.totals.totalTaxableBaseForeignValue,
currency
)
}}</QTd> }}</QTd>
<QTd></QTd>
<QTd></QTd>
<QTd>{{
toCurrency(getTotalTax(entity.invoiceInTax, currency))
}}</QTd>
<QTd></QTd>
</QTr> </QTr>
</template> </template>
</QTable> </QTable>
@ -384,9 +379,17 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
<QTd></QTd> <QTd></QTd>
<QTd></QTd> <QTd></QTd>
<QTd> <QTd>
{{ toCurrency(entity.totals.totalDueDay, currency) }} {{ toCurrency(entity.totals.totalDueDay) }}
</QTd>
<QTd>
{{
entity.totals.totalDueDayForeignValue &&
toCurrency(
entity.totals.totalDueDayForeignValue,
currency
)
}}
</QTd> </QTd>
<QTd></QTd>
</QTr> </QTr>
</template> </template>
</QTable> </QTable>
@ -421,7 +424,7 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
<template #bottom-row> <template #bottom-row>
<QTr class="bg"> <QTr class="bg">
<QTd></QTd> <QTd></QTd>
<QTd>{{ toCurrency(intrastatTotals.amount, currency) }}</QTd> <QTd>{{ toCurrency(intrastatTotals.amount) }}</QTd>
<QTd>{{ intrastatTotals.net }}</QTd> <QTd>{{ intrastatTotals.net }}</QTd>
<QTd>{{ intrastatTotals.stems }}</QTd> <QTd>{{ intrastatTotals.stems }}</QTd>
<QTd></QTd> <QTd></QTd>

View File

@ -2,18 +2,17 @@
import { ref, computed } from 'vue'; import { ref, computed } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useQuasar } from 'quasar';
import axios from 'axios';
import { useArrayData } from 'src/composables/useArrayData'; import { useArrayData } from 'src/composables/useArrayData';
import { getTotal } from 'src/composables/getTotal';
import { toCurrency } from 'src/filters'; import { toCurrency } from 'src/filters';
import FetchData from 'src/components/FetchData.vue'; import FetchData from 'src/components/FetchData.vue';
import VnSelect from 'src/components/common/VnSelect.vue'; import VnSelect from 'src/components/common/VnSelect.vue';
import CrudModel from 'src/components/CrudModel.vue'; import CrudModel from 'src/components/CrudModel.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnInputNumber from 'src/components/common/VnInputNumber.vue'; import VnInputNumber from 'src/components/common/VnInputNumber.vue';
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
import CreateNewExpenseForm from 'src/components/CreateNewExpenseForm.vue';
const { t } = useI18n(); const { t } = useI18n();
const quasar = useQuasar();
const arrayData = useArrayData(); const arrayData = useArrayData();
const invoiceIn = computed(() => arrayData.store.data); const invoiceIn = computed(() => arrayData.store.data);
@ -23,15 +22,7 @@ const expenses = ref([]);
const sageTaxTypes = ref([]); const sageTaxTypes = ref([]);
const sageTransactionTypes = ref([]); const sageTransactionTypes = ref([]);
const rowsSelected = ref([]); const rowsSelected = ref([]);
const newExpense = ref({
code: undefined,
isWithheld: false,
description: undefined,
});
const invoiceInFormRef = ref(); const invoiceInFormRef = ref();
const expensesRef = ref();
const newExpenseRef = ref();
defineProps({ defineProps({
actionIcon: { actionIcon: {
@ -56,7 +47,7 @@ const columns = computed(() => [
{ {
name: 'taxablebase', name: 'taxablebase',
label: t('Taxable base'), label: t('Taxable base'),
field: (row) => toCurrency(row.taxableBase, currency.value), field: (row) => row.taxableBase,
model: 'taxableBase', model: 'taxableBase',
sortable: true, sortable: true,
tabIndex: 2, tabIndex: 2,
@ -91,7 +82,7 @@ const columns = computed(() => [
label: t('Rate'), label: t('Rate'),
sortable: true, sortable: true,
tabIndex: 5, tabIndex: 5,
field: (row) => toCurrency(taxRate(row, row.taxTypeSageFk), currency.value), field: (row) => taxRate(row, row.taxTypeSageFk),
align: 'left', align: 'left',
}, },
{ {
@ -132,40 +123,6 @@ function taxRate(invoiceInTax) {
return (taxTypeSage / 100) * taxableBase; return (taxTypeSage / 100) * taxableBase;
} }
async function addExpense() {
try {
if (!newExpense.value.code) throw new Error(t(`The code can't be empty`));
if (isNaN(newExpense.value.code))
throw new Error(t(`The code have to be a number`));
if (!newExpense.value.description)
throw new Error(t(`The description can't be empty`));
const data = [
{
id: newExpense.value.code,
isWithheld: newExpense.value.isWithheld,
name: newExpense.value.description,
},
];
await axios.post(`Expenses`, data);
await expensesRef.value.fetch();
quasar.notify({
type: 'positive',
message: t('globals.dataSaved'),
});
newExpenseRef.value.hide();
} catch (error) {
quasar.notify({
type: 'negative',
message: t(`${error.message}`),
});
}
}
const getTotalTaxableBase = (rows) =>
rows.reduce((acc, { taxableBase }) => acc + +(taxableBase || 0), 0);
const getTotalRate = (rows) => rows.reduce((acc, cur) => acc + +taxRate(cur), 0);
const formatOpt = (row, { model, options }, prop) => { const formatOpt = (row, { model, options }, prop) => {
const obj = row[model]; const obj = row[model];
const option = options.find(({ id }) => id == obj); const option = options.find(({ id }) => id == obj);
@ -207,37 +164,25 @@ const formatOpt = (row, { model, options }, prop) => {
> >
<template #body-cell-expense="{ row, col }"> <template #body-cell-expense="{ row, col }">
<QTd> <QTd>
<VnSelect <VnSelectDialog
v-model="row[col.model]" v-model="row[col.model]"
:options="col.options" :options="col.options"
:option-value="col.optionValue" :option-value="col.optionValue"
:option-label="col.optionLabel" :option-label="col.optionLabel"
:filter-options="['id', 'name']" :filter-options="['id', 'name']"
:tooltip="t('Create a new expense')"
> >
<template #option="scope"> <template #option="scope">
<QItem v-bind="scope.itemProps"> <QItem v-bind="scope.itemProps">
{{ `${scope.opt.id}: ${scope.opt.name}` }} {{ `${scope.opt.id}: ${scope.opt.name}` }}
</QItem> </QItem>
</template> </template>
<template #append> <template #form>
<QIcon <CreateNewExpenseForm
name="close" @on-data-saved="$refs.expensesRef.fetch()"
@click.stop="value = null"
class="cursor-pointer"
size="xs"
/> />
<QIcon
@click.stop.prevent="newExpenseRef.show()"
:name="actionIcon"
size="xs"
class="default-icon"
>
<QTooltip>
{{ t('Create expense') }}
</QTooltip>
</QIcon>
</template> </template>
</VnSelect> </VnSelectDialog>
</QTd> </QTd>
</template> </template>
<template #body-cell-taxablebase="{ row }"> <template #body-cell-taxablebase="{ row }">
@ -324,12 +269,24 @@ const formatOpt = (row, { model, options }, prop) => {
<QTd /> <QTd />
<QTd /> <QTd />
<QTd> <QTd>
{{ toCurrency(getTotalTaxableBase(rows), currency) }} {{ getTotal(rows, 'taxableBase', { currency: 'default' }) }}
</QTd> </QTd>
<QTd /> <QTd />
<QTd /> <QTd />
<QTd> {{ toCurrency(getTotalRate(rows), currency) }}</QTd> <QTd>
<QTd /> {{
getTotal(rows, null, { cb: taxRate, currency: 'default' })
}}</QTd
>
<QTd>
<template v-if="isNotEuro(invoiceIn.currency.code)">
{{
getTotal(rows, 'foreignValue', {
currency: invoiceIn.currency.code,
})
}}
</template>
</QTd>
</QTr> </QTr>
</template> </template>
<template #item="props"> <template #item="props">
@ -341,7 +298,7 @@ const formatOpt = (row, { model, options }, prop) => {
<QSeparator /> <QSeparator />
<QList> <QList>
<QItem> <QItem>
<VnSelect <VnSelectDialog
:label="t('Expense')" :label="t('Expense')"
class="full-width" class="full-width"
v-model="props.row['expenseFk']" v-model="props.row['expenseFk']"
@ -349,13 +306,17 @@ const formatOpt = (row, { model, options }, prop) => {
option-value="id" option-value="id"
option-label="name" option-label="name"
:filter-options="['id', 'name']" :filter-options="['id', 'name']"
:tooltip="t('Create a new expense')"
> >
<template #option="scope"> <template #option="scope">
<QItem v-bind="scope.itemProps"> <QItem v-bind="scope.itemProps">
{{ `${scope.opt.id}: ${scope.opt.name}` }} {{ `${scope.opt.id}: ${scope.opt.name}` }}
</QItem> </QItem>
</template> </template>
</VnSelect> <template #form>
<CreateNewExpenseForm />
</template>
</VnSelectDialog>
</QItem> </QItem>
<QItem> <QItem>
<VnInputNumber <VnInputNumber
@ -442,44 +403,6 @@ const formatOpt = (row, { model, options }, prop) => {
</QTable> </QTable>
</template> </template>
</CrudModel> </CrudModel>
<QDialog ref="newExpenseRef">
<QCard>
<QCardSection class="q-pb-none">
<QItem class="q-pa-none">
<span class="text-primary text-h6 full-width">
<QIcon name="edit" class="q-mr-xs" />
{{ t('New expense') }}
</span>
<QBtn icon="close" flat round dense v-close-popup />
</QItem>
</QCardSection>
<QCardSection class="q-pt-none">
<QItem>
<VnInput
:label="`${t('Code')}*`"
v-model="newExpense.code"
:required="true"
/>
<QCheckbox
dense
size="sm"
:label="`${t('It\'s a withholding')}`"
v-model="newExpense.isWithheld"
/>
</QItem>
<QItem>
<VnInput
:label="`${t('Descripction')}*`"
v-model="newExpense.description"
/>
</QItem>
</QCardSection>
<QCardActions class="justify-end">
<QBtn flat :label="t('globals.close')" color="primary" v-close-popup />
<QBtn :label="t('globals.save')" color="primary" @click="addExpense" />
</QCardActions>
</QCard>
</QDialog>
<QPageSticky position="bottom-right" :offset="[25, 25]"> <QPageSticky position="bottom-right" :offset="[25, 25]">
<QBtn <QBtn
color="primary" color="primary"
@ -487,7 +410,9 @@ const formatOpt = (row, { model, options }, prop) => {
size="lg" size="lg"
round round
@click="invoiceInFormRef.insert()" @click="invoiceInFormRef.insert()"
/> >
<QTooltip>{{ t('Add tax') }}</QTooltip>
</QBtn>
</QPageSticky> </QPageSticky>
</template> </template>
@ -527,18 +452,11 @@ const formatOpt = (row, { model, options }, prop) => {
<i18n> <i18n>
es: es:
Expense: Gasto Expense: Gasto
Create expense: Crear gasto Create a new expense: Crear nuevo gasto
Add tax: Crear gasto Add tax: Crear gasto
Taxable base: Base imp. Taxable base: Base imp.
Sage tax: Sage iva Sage tax: Sage iva
Sage transaction: Sage transacción Sage transaction: Sage transacción
Rate: Tasa Rate: Tasa
Foreign value: Divisa Foreign value: Divisa
New expense: Nuevo gasto
Code: Código
It's a withholding: Es una retención
Descripction: Descripción
The code can't be empty: El código no puede estar vacío
The description can't be empty: La descripción no puede estar vacía
The code have to be a number: El código debe ser un número.
</i18n> </i18n>

View File

@ -28,6 +28,16 @@ const activities = ref([]);
</div> </div>
</template> </template>
<template #body="{ params, searchFn }"> <template #body="{ params, searchFn }">
<QItem>
<QItemSection>
<VnInputDate :label="t('From')" v-model="params.from" is-outlined />
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnInputDate :label="t('To')" v-model="params.to" is-outlined />
</QItemSection>
</QItem>
<QItem> <QItem>
<QItemSection> <QItemSection>
<VnSelect <VnSelect
@ -64,16 +74,6 @@ const activities = ref([]);
/> />
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem>
<QItemSection>
<VnInput
:label="t('params.serialNumber')"
v-model="params.serialNumber"
is-outlined
lazy-rules
/>
</QItemSection>
</QItem>
<QItem> <QItem>
<QItemSection> <QItemSection>
<VnInput <VnInput
@ -84,15 +84,6 @@ const activities = ref([]);
/> />
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem>
<QItemSection>
<VnInputDate
:label="t('Issued')"
v-model="params.issued"
is-outlined
/>
</QItemSection>
</QItem>
<QItem> <QItem>
<QItemSection> <QItemSection>
<VnInput <VnInput
@ -140,22 +131,6 @@ const activities = ref([]);
/> />
</QItemSection> </QItemSection>
</QItem> </QItem>
<QExpansionItem :label="t('More options')" expand-separator>
<QItem>
<QItemSection>
<VnInputDate
:label="t('From')"
v-model="params.from"
is-outlined
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnInputDate :label="t('To')" v-model="params.to" is-outlined />
</QItemSection>
</QItem>
</QExpansionItem>
</template> </template>
</VnFilterPanel> </VnFilterPanel>
</template> </template>
@ -179,6 +154,7 @@ en:
correctedFk: Rectified correctedFk: Rectified
issued: Issued issued: Issued
to: To to: To
from: From
awbCode: AWB awbCode: AWB
correctingFk: Rectificative correctingFk: Rectificative
supplierActivityFk: Supplier activity supplierActivityFk: Supplier activity
@ -201,6 +177,8 @@ es:
correctedFk: Rectificada correctedFk: Rectificada
correctingFk: Rectificativa correctingFk: Rectificativa
supplierActivityFk: Actividad proveedor supplierActivityFk: Actividad proveedor
from: Desde
to: Hasta
From: Desde From: Desde
To: Hasta To: Hasta
Amount: Importe Amount: Importe

View File

@ -47,12 +47,6 @@ const cols = computed(() => [
name: 'supplierRef', name: 'supplierRef',
label: t('invoiceIn.list.supplierRef'), label: t('invoiceIn.list.supplierRef'),
}, },
{
align: 'left',
name: 'serialNumber',
label: t('invoiceIn.list.serialNumber'),
},
{ {
align: 'left', align: 'left',
name: 'serial', name: 'serial',
@ -141,7 +135,7 @@ const cols = computed(() => [
v-model="data.supplierFk" v-model="data.supplierFk"
url="Suppliers" url="Suppliers"
:fields="['id', 'nickname']" :fields="['id', 'nickname']"
:label="t('Supplier')" :label="t('globals.supplier')"
option-value="id" option-value="id"
option-label="nickname" option-label="nickname"
:filter-options="['id', 'name']" :filter-options="['id', 'name']"
@ -162,7 +156,7 @@ const cols = computed(() => [
/> />
<VnSelect <VnSelect
url="Companies" url="Companies"
:label="t('Company')" :label="t('globals.company')"
:fields="['id', 'code']" :fields="['id', 'code']"
v-model="data.companyFk" v-model="data.companyFk"
option-value="id" option-value="id"

View File

@ -0,0 +1,14 @@
import axios from 'axios';
export async function setRectificative(route) {
const card = route.matched.find((route) => route.name === 'InvoiceInCard');
const corrective = card.children.find(
(route) => route.name === 'InvoiceInCorrective'
);
corrective.meta.hidden = !(
await axios.get('InvoiceInCorrections', {
params: { filter: { where: { correctingFk: route.params.id } } },
})
).data.length;
}

View File

@ -0,0 +1,49 @@
invoiceIn:
serial: Serial
list:
ref: Reference
supplier: Supplier
supplierRef: Supplier ref.
serial: Serial
file: File
issued: Issued
isBooked: Is booked
awb: AWB
amount: Amount
card:
issued: Issued
amount: Amount
client: Client
company: Company
customerCard: Customer card
ticketList: Ticket List
vat: Vat
dueDay: Due day
intrastat: Intrastat
summary:
supplier: Supplier
supplierRef: Supplier ref.
currency: Currency
issued: Expedition date
operated: Operation date
bookEntried: Entry date
bookedDate: Booked date
sage: Sage withholding
vat: Undeductible VAT
company: Company
booked: Booked
expense: Expense
taxableBase: Taxable base
rate: Rate
sageVat: Sage vat
sageTransaction: Sage transaction
dueDay: Date
bank: Bank
amount: Amount
foreignValue: Foreign value
dueTotal: Due day
noMatch: Do not match
code: Code
net: Net
stems: Stems
country: Country

View File

@ -0,0 +1,47 @@
invoiceIn:
serial: Serie
list:
ref: Referencia
supplier: Proveedor
supplierRef: Ref. proveedor
shortIssued: F. emisión
file: Fichero
issued: Fecha emisión
isBooked: Conciliada
awb: AWB
amount: Importe
card:
issued: Fecha emisión
amount: Importe
client: Cliente
company: Empresa
customerCard: Ficha del cliente
ticketList: Listado de tickets
vat: Iva
dueDay: Fecha de vencimiento
summary:
supplier: Proveedor
supplierRef: Ref. proveedor
currency: Divisa
docNumber: Número documento
issued: Fecha de expedición
operated: Fecha operación
bookEntried: Fecha asiento
bookedDate: Fecha contable
sage: Retención sage
vat: Iva no deducible
company: Empresa
booked: Contabilizada
expense: Gasto
taxableBase: Base imp.
rate: Tasa
sageTransaction: Sage transación
dueDay: Fecha
bank: Caja
amount: Importe
foreignValue: Divisa
dueTotal: Vencimiento
code: Código
net: Neto
stems: Tallos
country: País

View File

@ -176,7 +176,7 @@ const ticketsColumns = ref([
<QTd> <QTd>
<QBtn class="no-uppercase link" flat dense> <QBtn class="no-uppercase link" flat dense>
{{ value }} {{ value }}
<CustomerDescriptorProxy :id="row.id" /> <CustomerDescriptorProxy :id="row.clientFk" />
</QBtn> </QBtn>
</QTd> </QTd>
</template> </template>

View File

@ -205,7 +205,7 @@ watchEffect(selectedRows);
}, },
}" }"
v-model:selected="selectedRows" v-model:selected="selectedRows"
order="id DESC" order="issued DESC, id DESC"
:columns="columns" :columns="columns"
redirect="invoice-out" redirect="invoice-out"
auto-load auto-load

View File

@ -33,7 +33,6 @@ async function onSubmit() {
}; };
try { try {
console.log('newPassword: ', newPassword);
await axios.post( await axios.post(
'VnUsers/reset-password', 'VnUsers/reset-password',
{ newPassword: newPassword.value }, { newPassword: newPassword.value },

View File

@ -1,5 +1,5 @@
import { RouterView } from 'vue-router'; import { RouterView } from 'vue-router';
import { setRectificative } from 'src/pages/InvoiceIn/composables/setRectificative';
export default { export default {
path: '/invoice-in', path: '/invoice-in',
name: 'InvoiceIn', name: 'InvoiceIn',
@ -63,6 +63,10 @@ export default {
path: ':id', path: ':id',
component: () => import('src/pages/InvoiceIn/Card/InvoiceInCard.vue'), component: () => import('src/pages/InvoiceIn/Card/InvoiceInCard.vue'),
redirect: { name: 'InvoiceInSummary' }, redirect: { name: 'InvoiceInSummary' },
beforeEnter: async (to, from, next) => {
await setRectificative(to);
next();
},
children: [ children: [
{ {
name: 'InvoiceInSummary', name: 'InvoiceInSummary',

View File

@ -56,6 +56,7 @@ export const useNavigationStore = defineStore('navigationStore', () => {
function addMenuItem(module, route, parent) { function addMenuItem(module, route, parent) {
const { meta } = route; const { meta } = route;
let { menuChildren = null } = meta; let { menuChildren = null } = meta;
if (meta.hidden) return;
if (menuChildren) if (menuChildren)
menuChildren = menuChildren.map(({ name, title, icon }) => ({ menuChildren = menuChildren.map(({ name, title, icon }) => ({
name, name,

View File

@ -36,8 +36,7 @@ describe('InvoiceInBasicData', () => {
}); });
it('should throw an error creating a new dms if a file is not attached', () => { it('should throw an error creating a new dms if a file is not attached', () => {
cy.get(formInputs).eq(5).click(); cy.get(formInputs).eq(7).type('{selectall}{backspace}');
cy.get(formInputs).eq(5).type('{selectall}{backspace}');
cy.get(documentBtns).eq(0).click(); cy.get(documentBtns).eq(0).click();
cy.get(dialogActionBtns).eq(1).click(); cy.get(dialogActionBtns).eq(1).click();
cy.get('.q-notification__message').should( cy.get('.q-notification__message').should(

View File

@ -3,13 +3,14 @@ describe('InvoiceInVat', () => {
const thirdRow = 'tbody > :nth-child(3)'; const thirdRow = 'tbody > :nth-child(3)';
const firstLineVat = 'tbody > :nth-child(1) > :nth-child(4)'; const firstLineVat = 'tbody > :nth-child(1) > :nth-child(4)';
const dialogInputs = '.q-dialog label input'; const dialogInputs = '.q-dialog label input';
const dialogBtns = '.q-dialog button'; const addBtn = 'tbody tr:nth-child(1) td:nth-child(2) .--add-icon';
const acrossInput = 'tbody tr:nth-child(1) td:nth-child(2) .default-icon';
const randomInt = Math.floor(Math.random() * 100); const randomInt = Math.floor(Math.random() * 100);
beforeEach(() => { beforeEach(() => {
cy.login('developer'); cy.login('developer');
cy.visit(`/#/invoice-in/1/vat`); cy.visit(`/#/invoice-in/1/vat`);
cy.intercept('GET', '/api/InvoiceIns/1/getTotals').as('lastCall');
cy.wait('@lastCall');
}); });
it('should edit the sage iva', () => { it('should edit the sage iva', () => {
@ -26,22 +27,15 @@ describe('InvoiceInVat', () => {
}); });
it('should remove the first line', () => { it('should remove the first line', () => {
cy.removeRow(2); cy.removeRow(1);
});
it('should throw an error if there are fields undefined', () => {
cy.get(acrossInput).click();
cy.get(dialogBtns).eq(2).click();
cy.get('.q-notification__message').should('have.text', "The code can't be empty");
}); });
it('should correctly handle expense addition', () => { it('should correctly handle expense addition', () => {
cy.get(acrossInput).click(); cy.get(addBtn).click();
cy.get(dialogInputs).eq(0).type(randomInt); cy.get(dialogInputs).eq(0).type(randomInt);
cy.get(dialogInputs).eq(1).click();
cy.get(dialogInputs).eq(1).type('This is a dummy expense'); cy.get(dialogInputs).eq(1).type('This is a dummy expense');
cy.get(dialogBtns).eq(2).click(); cy.get('button[type="submit"]').click();
cy.get('.q-notification__message').should('have.text', 'Data saved'); cy.get('.q-notification__message').should('have.text', 'Data created');
}); });
}); });