@@ -15,7 +18,9 @@
}
@media screen and (max-width: 800px) {
.vn-row {
- flex-direction: column;
+ &:not(.wrap) {
+ flex-direction: column;
+ }
}
}
diff --git a/src/composables/getTotal.js b/src/composables/getTotal.js
new file mode 100644
index 000000000..41c4330c4
--- /dev/null
+++ b/src/composables/getTotal.js
@@ -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;
+}
diff --git a/src/composables/useAcl.js b/src/composables/useAcl.js
index 46aaa3c25..ede359186 100644
--- a/src/composables/useAcl.js
+++ b/src/composables/useAcl.js
@@ -16,13 +16,18 @@ export function useAcl() {
state.setAcls(acls);
}
- function hasAny(model, prop, accessType) {
- const acls = state.getAcls().value[model];
- if (acls)
- return ['*', prop].some((key) => {
- const acl = acls[key];
- return acl && (acl['*'] || acl[accessType]);
- });
+ function hasAny(acls) {
+ for (const acl of acls) {
+ let { model, props, accessType } = acl;
+ const modelAcls = state.getAcls().value[model];
+ Array.isArray(props) || (props = [props]);
+ if (modelAcls)
+ return ['*', ...props].some((key) => {
+ const acl = modelAcls[key];
+ return acl && (acl['*'] || acl[accessType]);
+ });
+ }
+ return false;
}
return {
diff --git a/src/css/app.scss b/src/css/app.scss
index 357c9ecdb..ecffd576c 100644
--- a/src/css/app.scss
+++ b/src/css/app.scss
@@ -37,6 +37,10 @@ a {
.link {
color: $color-link;
cursor: pointer;
+
+ &--white {
+ color: white;
+ }
}
.tx-color-link {
diff --git a/src/i18n/locale/en.yml b/src/i18n/locale/en.yml
index 52fc73f2f..da86399af 100644
--- a/src/i18n/locale/en.yml
+++ b/src/i18n/locale/en.yml
@@ -40,6 +40,8 @@ globals:
noChanges: No changes to save
changesToSave: You have changes pending to save
confirmRemove: You are about to delete this row. Are you sure?
+ rowWillBeRemoved: This row will be removed
+ sureToContinue: Are you sure you want to continue?
rowAdded: Row added
rowRemoved: Row removed
pleaseWait: Please wait...
@@ -96,6 +98,7 @@ globals:
to: To
notes: Notes
refresh: Refresh
+ weight: Weight
pageTitles:
logIn: Login
summary: Summary
@@ -261,6 +264,7 @@ globals:
clientsActionsMonitor: Clients and actions
serial: Serial
medical: Mutual
+ supplier: Supplier
created: Created
worker: Worker
now: Now
@@ -753,56 +757,6 @@ parking:
searchBar:
info: You can search by parking code
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:
field:
salesPersonFk: Sales Person
@@ -1298,6 +1252,7 @@ components:
active: Is active
visible: Is visible
floramondo: Is floramondo
+ showBadDates: Show future items
userPanel:
copyToken: Token copied to clipboard
settings: Settings
diff --git a/src/i18n/locale/es.yml b/src/i18n/locale/es.yml
index ad018b5cd..5e8efff1e 100644
--- a/src/i18n/locale/es.yml
+++ b/src/i18n/locale/es.yml
@@ -39,6 +39,8 @@ globals:
noChanges: Sin cambios que guardar
changesToSave: Tienes cambios pendientes de guardar
confirmRemove: Vas a eliminar este registro. ¿Continuar?
+ rowWillBeRemoved: Esta linea se eliminará
+ sureToContinue: ¿Seguro que quieres continuar?
rowAdded: Fila añadida
rowRemoved: Fila eliminada
pleaseWait: Por favor espera...
@@ -98,6 +100,7 @@ globals:
to: Hasta
notes: Notas
refresh: Actualizar
+ weight: Peso
pageTitles:
logIn: Inicio de sesión
summary: Resumen
@@ -265,6 +268,7 @@ globals:
clientsActionsMonitor: Clientes y acciones
serial: Facturas por serie
medical: Mutua
+ supplier: Proveedor
created: Fecha creación
worker: Trabajador
now: Ahora
@@ -799,54 +803,6 @@ parking:
searchBar:
info: Puedes buscar por código de 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:
pageTitles:
basicData: Basic data
@@ -1278,6 +1234,7 @@ components:
active: Activo
visible: Visible
floramondo: Floramondo
+ showBadDates: Ver items a futuro
userPanel:
copyToken: Token copiado al portapapeles
settings: Configuración
diff --git a/src/pages/Account/AccountConnections.vue b/src/pages/Account/AccountConnections.vue
index 4d3450665..057745831 100644
--- a/src/pages/Account/AccountConnections.vue
+++ b/src/pages/Account/AccountConnections.vue
@@ -27,15 +27,15 @@ const filter = {
order: 'created DESC',
};
-const urlPath = 'AccessTokens';
+const urlPath = 'VnTokens';
const refresh = () => paginateRef.value.fetch();
const navigate = (id) => router.push({ name: 'AccountSummary', params: { id } });
-const killSession = async (id) => {
+const killSession = async ({ userId, created }) => {
try {
- await axios.delete(`${urlPath}/${id}`);
+ await axios.post(`${urlPath}/killSession`, { userId, created });
paginateRef.value.fetch();
notify(t('Session killed'), 'positive');
} catch (error) {
@@ -84,7 +84,7 @@ const killSession = async (id) => {
openConfirmationModal(
t('Session will be killed'),
t('Are you sure you want to continue?'),
- () => killSession(row.id)
+ () => killSession(row)
)
"
outline
diff --git a/src/pages/Customer/Card/CustomerBalance.vue b/src/pages/Customer/Card/CustomerBalance.vue
index 548a67b0b..95f5f0981 100644
--- a/src/pages/Customer/Card/CustomerBalance.vue
+++ b/src/pages/Customer/Card/CustomerBalance.vue
@@ -2,7 +2,7 @@
import { computed, onBeforeMount, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
-import { useRole } from 'src/composables/useRole';
+import { useAcl } from 'src/composables/useAcl';
import axios from 'axios';
import { useQuasar } from 'quasar';
@@ -24,7 +24,7 @@ import InvoiceOutDescriptorProxy from 'src/pages/InvoiceOut/Card/InvoiceOutDescr
const { openConfirmationModal } = useVnConfirm();
const { sendEmail } = usePrintService();
const { t } = useI18n();
-const { hasAny } = useRole();
+const { hasAny } = useAcl();
const session = useSession();
const tokenMultimedia = session.getTokenMultimedia();
@@ -284,7 +284,9 @@ const showBalancePdf = ({ id }) => {
>
diff --git a/src/pages/Customer/Card/CustomerBillingData.vue b/src/pages/Customer/Card/CustomerBillingData.vue
index b01dc4523..495b871df 100644
--- a/src/pages/Customer/Card/CustomerBillingData.vue
+++ b/src/pages/Customer/Card/CustomerBillingData.vue
@@ -70,7 +70,7 @@ const getBankEntities = (data, formData) => {
handleLocation(data, location)"
/>
diff --git a/src/pages/Customer/CustomerCreate.vue b/src/pages/Customer/CustomerCreate.vue
index 041c92d17..79da63283 100644
--- a/src/pages/Customer/CustomerCreate.vue
+++ b/src/pages/Customer/CustomerCreate.vue
@@ -86,7 +86,7 @@ function handleLocation(data, location) {
handleLocation(data, location)"
>
diff --git a/src/pages/Customer/CustomerList.vue b/src/pages/Customer/CustomerList.vue
index 0dc7f09be..a38f8d1a8 100644
--- a/src/pages/Customer/CustomerList.vue
+++ b/src/pages/Customer/CustomerList.vue
@@ -412,7 +412,7 @@ function handleLocation(data, location) {
>
handleLocation(data, location)"
/>
diff --git a/src/pages/Customer/components/CustomerAddressCreate.vue b/src/pages/Customer/components/CustomerAddressCreate.vue
index 30e4b21d0..88204cbaa 100644
--- a/src/pages/Customer/components/CustomerAddressCreate.vue
+++ b/src/pages/Customer/components/CustomerAddressCreate.vue
@@ -92,7 +92,7 @@ function handleLocation(data, location) {
handleLocation(data, location)"
/>
diff --git a/src/pages/Customer/components/CustomerAddressEdit.vue b/src/pages/Customer/components/CustomerAddressEdit.vue
index 7a4c44014..0be7e475a 100644
--- a/src/pages/Customer/components/CustomerAddressEdit.vue
+++ b/src/pages/Customer/components/CustomerAddressEdit.vue
@@ -176,7 +176,7 @@ function handleLocation(data, location) {
handleLocation(data, location)"
>
diff --git a/src/pages/Customer/components/CustomerSamplesCreate.vue b/src/pages/Customer/components/CustomerSamplesCreate.vue
index 0470dc176..79f4fe449 100644
--- a/src/pages/Customer/components/CustomerSamplesCreate.vue
+++ b/src/pages/Customer/components/CustomerSamplesCreate.vue
@@ -4,6 +4,7 @@ import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router';
import axios from 'axios';
+import { usePrintService } from 'composables/usePrintService';
import { useQuasar } from 'quasar';
import { useState } from 'src/composables/useState';
@@ -27,7 +28,7 @@ const router = useRouter();
const state = useState();
const user = state.getUser();
const stateStore = useStateStore();
-
+const { sendEmail } = usePrintService();
const client = ref({});
const hasChanged = ref(false);
const isLoading = ref(false);
@@ -156,22 +157,33 @@ const onSubmit = async () => {
}
};
-const onDataSaved = async ({
- addressId,
- companyFk,
- companyId,
- from,
- recipient,
- replyTo,
-}) => {
- await axios.post(`Clients/${route.params.id}/incoterms-authorization-email`, {
- addressId,
- companyFk,
- companyId,
- from,
- recipient,
- replyTo,
- });
+const getSamples = async () => {
+ try {
+ const filter = { where: { id: initialData.typeFk } };
+ let { data } = await axios.get('Samples', {
+ params: { filter: JSON.stringify(filter) },
+ });
+ return data[0];
+ } catch (error) {
+ notify('errors.create', 'negative');
+ }
+};
+
+getSamples();
+const onDataSaved = async () => {
+ try {
+ const params = {
+ recipientId: initialData.recipientId,
+ recipient: initialData.recipient,
+ replyTo: initialData.replyTo,
+ };
+ setParams(params);
+ const samplesData = await getSamples();
+ const path = `${samplesData.model}/${route.params.id}/${samplesData.code}-email`;
+ await sendEmail(path, params);
+ } catch (error) {
+ notify('errors.create', 'negative');
+ }
toCustomerSamples();
};
diff --git a/src/pages/Dashboard/DashboardMain.vue b/src/pages/Dashboard/DashboardMain.vue
index 6da39ce25..a339120e2 100644
--- a/src/pages/Dashboard/DashboardMain.vue
+++ b/src/pages/Dashboard/DashboardMain.vue
@@ -55,6 +55,15 @@ const pinnedModules = computed(() => navigation.getPinnedModules());
>
{{ t(item.title) }}
+
+ {{ '(' + item.keyBinding + ')' }}
+
+ {{
+ 'Ctrl + Alt + ' +
+ item.keyBinding.toUpperCase()
+ }}
+
+
diff --git a/src/pages/Entry/Card/EntryBuys.vue b/src/pages/Entry/Card/EntryBuys.vue
index e9a9ab815..ff89faada 100644
--- a/src/pages/Entry/Card/EntryBuys.vue
+++ b/src/pages/Entry/Card/EntryBuys.vue
@@ -26,7 +26,6 @@ const { notify } = useNotify();
const rowsSelected = ref([]);
const entryBuysPaginateRef = ref(null);
-const packagingsOptions = ref(null);
const originalRowDataCopy = ref(null);
const getInputEvents = (colField, props) => {
@@ -66,7 +65,10 @@ const tableColumnComponents = computed(() => ({
'map-options': true,
'use-input': true,
'hide-selected': true,
- options: packagingsOptions.value,
+ url: 'Packagings',
+ fields: ['id'],
+ where: { freightItemFk: true },
+ 'sort-by': 'id ASC',
dense: true,
},
event: getInputEvents,
@@ -304,13 +306,6 @@ const lockIconType = (groupingMode, mode) => {
- (packagingsOptions = data)"
- />
diff --git a/src/pages/InvoiceIn/Card/InvoiceInBasicData.vue b/src/pages/InvoiceIn/Card/InvoiceInBasicData.vue
index ede9af825..045517a3f 100644
--- a/src/pages/InvoiceIn/Card/InvoiceInBasicData.vue
+++ b/src/pages/InvoiceIn/Card/InvoiceInBasicData.vue
@@ -223,6 +223,10 @@ async function onSubmit() {
autofocus
/>
+
+
+
+
-
-
-
-
await setRectificative(to));
hasAny(['administrative']);
+const canEditProp = (props) =>
+ hasAny([{ model: 'InvoiceIn', props, accessType: 'WRITE' }]);
const isAgricultural = () => {
if (!config.value) return false;
@@ -283,7 +284,7 @@ const createInvoiceInCorrection = async () => {
{
{
{
{{ t('Delete invoice') }}
{
-
+
diff --git a/src/pages/InvoiceIn/Card/InvoiceInDueDay.vue b/src/pages/InvoiceIn/Card/InvoiceInDueDay.vue
index 62beb88ad..1593ea1be 100644
--- a/src/pages/InvoiceIn/Card/InvoiceInDueDay.vue
+++ b/src/pages/InvoiceIn/Card/InvoiceInDueDay.vue
@@ -5,10 +5,10 @@ import { useI18n } from 'vue-i18n';
import axios from 'axios';
import { toDate } from 'src/filters';
import { useArrayData } from 'src/composables/useArrayData';
+import { getTotal } from 'src/composables/getTotal';
import CrudModel from 'src/components/CrudModel.vue';
import FetchData from 'src/components/FetchData.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
-import { toCurrency } from 'src/filters';
import useNotify from 'src/composables/useNotify.js';
import VnInputDate from 'src/components/common/VnInputDate.vue';
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
@@ -72,7 +72,6 @@ async function insert() {
await invoiceInFormRef.value.reload();
notify(t('globals.dataSaved'), 'positive');
}
-const getTotalAmount = (rows) => rows.reduce((acc, { amount }) => acc + +amount, 0);
rows.reduce((acc, { amount }) => acc + +amount,
- {{ toCurrency(getTotalAmount(rows), currency) }}
+ {{ getTotal(rows, 'amount', { currency: 'default' }) }}
+
+
+
+ {{
+ getTotal(rows, 'foreignValue', {
+ currency: invoiceIn.currency.code,
+ })
+ }}
+
-
diff --git a/src/pages/InvoiceIn/Card/InvoiceInIntrastat.vue b/src/pages/InvoiceIn/Card/InvoiceInIntrastat.vue
index 481698832..717f30b7f 100644
--- a/src/pages/InvoiceIn/Card/InvoiceInIntrastat.vue
+++ b/src/pages/InvoiceIn/Card/InvoiceInIntrastat.vue
@@ -2,18 +2,15 @@
import { computed, ref } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
-import { toCurrency } from 'src/filters';
+import { getTotal } from 'src/composables/getTotal';
import CrudModel from 'src/components/CrudModel.vue';
import FetchData from 'src/components/FetchData.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
-import { useArrayData } from 'src/composables/useArrayData';
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
const { t } = useI18n();
const route = useRoute();
-const arrayData = useArrayData();
-const currency = computed(() => arrayData.store.data?.currency?.code);
const invoceInIntrastat = ref([]);
const rowsSelected = 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 obj = row[model];
const option = options.find(({ id }) => id == obj);
@@ -154,7 +148,7 @@ const formatOpt = (row, { model, options }, prop) => {
- {{ toCurrency(getTotal(rows, 'amount'), currency) }}
+ {{ getTotal(rows, 'amount', { currency: 'default' }) }}
{{ getTotal(rows, 'net') }}
diff --git a/src/pages/InvoiceIn/Card/InvoiceInSummary.vue b/src/pages/InvoiceIn/Card/InvoiceInSummary.vue
index 644b472e2..bf2e7db48 100644
--- a/src/pages/InvoiceIn/Card/InvoiceInSummary.vue
+++ b/src/pages/InvoiceIn/Card/InvoiceInSummary.vue
@@ -35,7 +35,7 @@ const vatColumns = ref([
name: 'landed',
label: 'invoiceIn.summary.taxableBase',
field: (row) => row.taxableBase,
- format: (value) => toCurrency(value, currency.value),
+ format: (value) => toCurrency(value),
sortable: true,
align: 'left',
},
@@ -64,7 +64,7 @@ const vatColumns = ref([
name: 'rate',
label: 'invoiceIn.summary.rate',
field: (row) => taxRate(row.taxableBase, row.taxTypeSage?.rate),
- format: (value) => toCurrency(value, currency.value),
+ format: (value) => toCurrency(value),
sortable: true,
align: 'left',
},
@@ -72,7 +72,7 @@ const vatColumns = ref([
name: 'currency',
label: 'invoiceIn.summary.currency',
field: (row) => row.foreignValue,
- format: (value) => value,
+ format: (val) => val && toCurrency(val, currency.value),
sortable: true,
align: 'left',
},
@@ -97,7 +97,7 @@ const dueDayColumns = ref([
name: 'amount',
label: 'invoiceIn.summary.amount',
field: (row) => row.amount,
- format: (value) => toCurrency(value, currency.value),
+ format: (value) => toCurrency(value),
sortable: true,
align: 'left',
},
@@ -105,7 +105,7 @@ const dueDayColumns = ref([
name: 'landed',
label: 'invoiceIn.summary.foreignValue',
field: (row) => row.foreignValue,
- format: (value) => value,
+ format: (val) => val && toCurrency(val, currency.value),
sortable: true,
align: 'left',
},
@@ -124,7 +124,7 @@ const intrastatColumns = ref([
{
name: 'amount',
label: 'invoiceIn.summary.amount',
- field: (row) => toCurrency(row.amount, currency.value),
+ field: (row) => toCurrency(row.amount),
sortable: true,
align: 'left',
},
@@ -179,7 +179,6 @@ const getTotalTax = (tax) =>
const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
-
`#/invoice-in/${entityId.value}/${param}`;
:label="t('invoiceIn.summary.currency')"
:value="entity.currency?.code"
/>
-
+
@@ -293,12 +289,9 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
-
+
`#/invoice-in/${entityId.value}/${param}`;
: t('invoiceIn.summary.dueTotal')
"
>
- {{ toCurrency(entity.totals.totalDueDay, currency) }}
+ {{ toCurrency(entity.totals.totalDueDay) }}
@@ -350,15 +343,17 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
+ {{ toCurrency(entity.totals.totalTaxableBase) }}
+
+
+ {{ toCurrency(getTotalTax(entity.invoiceInTax)) }}
{{
- toCurrency(entity.totals.totalTaxableBase, currency)
+ entity.totals.totalTaxableBaseForeignValue &&
+ toCurrency(
+ entity.totals.totalTaxableBaseForeignValue,
+ currency
+ )
}}
-
-
- {{
- toCurrency(getTotalTax(entity.invoiceInTax, currency))
- }}
-
@@ -384,9 +379,17 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
- {{ toCurrency(entity.totals.totalDueDay, currency) }}
+ {{ toCurrency(entity.totals.totalDueDay) }}
+
+
+ {{
+ entity.totals.totalDueDayForeignValue &&
+ toCurrency(
+ entity.totals.totalDueDayForeignValue,
+ currency
+ )
+ }}
-
@@ -421,7 +424,7 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
- {{ toCurrency(intrastatTotals.amount, currency) }}
+ {{ toCurrency(intrastatTotals.amount) }}
{{ intrastatTotals.net }}
{{ intrastatTotals.stems }}
diff --git a/src/pages/InvoiceIn/Card/InvoiceInVat.vue b/src/pages/InvoiceIn/Card/InvoiceInVat.vue
index 34b0b64bd..d44880937 100644
--- a/src/pages/InvoiceIn/Card/InvoiceInVat.vue
+++ b/src/pages/InvoiceIn/Card/InvoiceInVat.vue
@@ -2,18 +2,17 @@
import { ref, computed } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
-import { useQuasar } from 'quasar';
-import axios from 'axios';
import { useArrayData } from 'src/composables/useArrayData';
+import { getTotal } from 'src/composables/getTotal';
import { toCurrency } from 'src/filters';
import FetchData from 'src/components/FetchData.vue';
import VnSelect from 'src/components/common/VnSelect.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 VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
+import CreateNewExpenseForm from 'src/components/CreateNewExpenseForm.vue';
const { t } = useI18n();
-const quasar = useQuasar();
const arrayData = useArrayData();
const invoiceIn = computed(() => arrayData.store.data);
@@ -23,15 +22,7 @@ const expenses = ref([]);
const sageTaxTypes = ref([]);
const sageTransactionTypes = ref([]);
const rowsSelected = ref([]);
-const newExpense = ref({
- code: undefined,
- isWithheld: false,
- description: undefined,
-});
-
const invoiceInFormRef = ref();
-const expensesRef = ref();
-const newExpenseRef = ref();
defineProps({
actionIcon: {
@@ -56,7 +47,7 @@ const columns = computed(() => [
{
name: 'taxablebase',
label: t('Taxable base'),
- field: (row) => toCurrency(row.taxableBase, currency.value),
+ field: (row) => row.taxableBase,
model: 'taxableBase',
sortable: true,
tabIndex: 2,
@@ -91,7 +82,7 @@ const columns = computed(() => [
label: t('Rate'),
sortable: true,
tabIndex: 5,
- field: (row) => toCurrency(taxRate(row, row.taxTypeSageFk), currency.value),
+ field: (row) => taxRate(row, row.taxTypeSageFk),
align: 'left',
},
{
@@ -132,40 +123,6 @@ function taxRate(invoiceInTax) {
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 obj = row[model];
const option = options.find(({ id }) => id == obj);
@@ -207,37 +164,25 @@ const formatOpt = (row, { model, options }, prop) => {
>
-
{{ `${scope.opt.id}: ${scope.opt.name}` }}
-
-
+
-
-
- {{ t('Create expense') }}
-
-
-
+
@@ -325,12 +270,24 @@ const formatOpt = (row, { model, options }, prop) => {
- {{ toCurrency(getTotalTaxableBase(rows), currency) }}
+ {{ getTotal(rows, 'taxableBase', { currency: 'default' }) }}
- {{ toCurrency(getTotalRate(rows), currency) }}
-
+
+ {{
+ getTotal(rows, null, { cb: taxRate, currency: 'default' })
+ }}
+
+
+ {{
+ getTotal(rows, 'foreignValue', {
+ currency: invoiceIn.currency.code,
+ })
+ }}
+
+
@@ -342,7 +299,7 @@ const formatOpt = (row, { model, options }, prop) => {
- {
option-value="id"
option-label="name"
:filter-options="['id', 'name']"
+ :tooltip="t('Create a new expense')"
>
{{ `${scope.opt.id}: ${scope.opt.name}` }}
-
+
+
+
+
{
-
-
-
-
-
-
- {{ t('New expense') }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{
size="lg"
round
@click="invoiceInFormRef.insert()"
- />
+ >
+ {{ t('Add tax') }}
+
@@ -524,18 +449,11 @@ const formatOpt = (row, { model, options }, prop) => {
es:
Expense: Gasto
- Create expense: Crear gasto
+ Create a new expense: Crear nuevo gasto
Add tax: Crear gasto
Taxable base: Base imp.
Sage tax: Sage iva
Sage transaction: Sage transacción
Rate: Tasa
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.
diff --git a/src/pages/InvoiceIn/InvoiceInFilter.vue b/src/pages/InvoiceIn/InvoiceInFilter.vue
index 2f87c2b2e..bf4e023a9 100644
--- a/src/pages/InvoiceIn/InvoiceInFilter.vue
+++ b/src/pages/InvoiceIn/InvoiceInFilter.vue
@@ -28,6 +28,16 @@ const activities = ref([]);