parent
da99d82504
commit
7b8093c048
|
@ -18,7 +18,7 @@ import VnInput from 'components/common/VnInput.vue';
|
||||||
import VnSubToolbar from 'components/ui/VnSubToolbar.vue';
|
import VnSubToolbar from 'components/ui/VnSubToolbar.vue';
|
||||||
import VnFilter from 'components/VnTable/VnFilter.vue';
|
import VnFilter from 'components/VnTable/VnFilter.vue';
|
||||||
|
|
||||||
import CreateNewPayment from 'src/components/CreateNewPayment.vue';
|
import SupplierNewPayment from 'src/pages/Supplier/Card/SupplierNewPayment.vue';
|
||||||
import InvoiceOutDescriptorProxy from 'src/pages/InvoiceOut/Card/InvoiceOutDescriptorProxy.vue';
|
import InvoiceOutDescriptorProxy from 'src/pages/InvoiceOut/Card/InvoiceOutDescriptorProxy.vue';
|
||||||
|
|
||||||
const { openConfirmationModal } = useVnConfirm();
|
const { openConfirmationModal } = useVnConfirm();
|
||||||
|
@ -36,6 +36,7 @@ const supplierRisk = ref([]);
|
||||||
const tableRef = ref();
|
const tableRef = ref();
|
||||||
const companyId = ref();
|
const companyId = ref();
|
||||||
const companyUser = ref(user.value.companyFk);
|
const companyUser = ref(user.value.companyFk);
|
||||||
|
const bankUser = ref(user.value.localBankFk);
|
||||||
const balances = ref([]);
|
const balances = ref([]);
|
||||||
const vnFilterRef = ref({});
|
const vnFilterRef = ref({});
|
||||||
const filter = computed(() => {
|
const filter = computed(() => {
|
||||||
|
@ -200,11 +201,14 @@ async function onFetch(data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const showNewPaymentDialog = () => {
|
const showNewPaymentDialog = () => {
|
||||||
|
debugger;
|
||||||
quasar.dialog({
|
quasar.dialog({
|
||||||
component: CreateNewPayment,
|
component: SupplierNewPayment,
|
||||||
componentProps: {
|
componentProps: {
|
||||||
companyId: companyId.value,
|
companyId: companyId.value,
|
||||||
|
bankId: bankUser.value,
|
||||||
totalCredit: supplierRisk.value[0]?.amount,
|
totalCredit: supplierRisk.value[0]?.amount,
|
||||||
|
extraFields: ['currencyFk', 'orderBy'],
|
||||||
promise: () => tableRef.value.reload(),
|
promise: () => tableRef.value.reload(),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -241,7 +245,7 @@ const showBalancePdf = ({ id }) => {
|
||||||
<VnTable
|
<VnTable
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
data-key="CustomerBalance"
|
data-key="CustomerBalance"
|
||||||
url="Receipts/filter"
|
url="Suppliers/receipts"
|
||||||
search-url="balance"
|
search-url="balance"
|
||||||
:user-params="filter"
|
:user-params="filter"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
|
@ -305,6 +309,8 @@ es:
|
||||||
Company: Empresa
|
Company: Empresa
|
||||||
Total by company: Total por empresa
|
Total by company: Total por empresa
|
||||||
New payment: Añadir pago
|
New payment: Añadir pago
|
||||||
|
supplierNewpayment: Añadir pago de proveedor
|
||||||
|
clientNewpayment: Añadir pago de cliente
|
||||||
Date: Fecha
|
Date: Fecha
|
||||||
Creation date: Fecha de creación
|
Creation date: Fecha de creación
|
||||||
Employee: Empleado
|
Employee: Empleado
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { onBeforeMount, reactive, ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { getClientRisk } from 'src/composables/getRisk';
|
import { getSupplierRisk } from 'src/composables/getRisk';
|
||||||
import { useDialogPluginComponent } from 'quasar';
|
import { useDialogPluginComponent } from 'quasar';
|
||||||
|
|
||||||
import { usePrintService } from 'composables/usePrintService';
|
import { usePrintService } from 'composables/usePrintService';
|
||||||
|
@ -27,6 +27,10 @@ const $props = defineProps({
|
||||||
type: Number,
|
type: Number,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
bankId: {
|
||||||
|
type: Number,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
totalCredit: {
|
totalCredit: {
|
||||||
type: Number,
|
type: Number,
|
||||||
required: true,
|
required: true,
|
||||||
|
@ -35,13 +39,18 @@ const $props = defineProps({
|
||||||
type: Function,
|
type: Function,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
|
extraFields: {
|
||||||
|
type: [String],
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const currenciesOptions = ref([]);
|
||||||
const closeButton = ref(null);
|
const closeButton = ref(null);
|
||||||
const urlCreate = ref([]);
|
const urlCreate = ref([]);
|
||||||
const companyOptions = ref([]);
|
const companyOptions = ref([]);
|
||||||
const bankOptions = ref([]);
|
const bankOptions = ref([]);
|
||||||
const clientFindOne = ref([]);
|
const recordFindOne = ref([]);
|
||||||
const viewReceipt = ref();
|
const viewReceipt = ref();
|
||||||
const shouldSendEmail = ref(false);
|
const shouldSendEmail = ref(false);
|
||||||
const maxAmount = ref();
|
const maxAmount = ref();
|
||||||
|
@ -56,8 +65,8 @@ const filterBanks = {
|
||||||
limit: 30,
|
limit: 30,
|
||||||
};
|
};
|
||||||
|
|
||||||
const filterClientFindOne = {
|
const filterRecordFindOne = {
|
||||||
fields: ['email'],
|
fields: [],
|
||||||
where: {
|
where: {
|
||||||
id: route.params.id,
|
id: route.params.id,
|
||||||
},
|
},
|
||||||
|
@ -65,13 +74,15 @@ const filterClientFindOne = {
|
||||||
|
|
||||||
const initialData = reactive({
|
const initialData = reactive({
|
||||||
amountPaid: $props.totalCredit,
|
amountPaid: $props.totalCredit,
|
||||||
clientFk: route.params.id,
|
supplierFk: route.params.id,
|
||||||
companyFk: $props.companyId,
|
companyFk: $props.companyId,
|
||||||
email: clientFindOne.value.email,
|
bankFk: $props.bankId,
|
||||||
|
email: recordFindOne.value.email,
|
||||||
|
currencyFk: 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
onBeforeMount(() => {
|
onBeforeMount(() => {
|
||||||
urlCreate.value = `Clients/${route.params.id}/createReceipt`;
|
urlCreate.value = `Suppliers/${route.params.id}/createReceipt`;
|
||||||
});
|
});
|
||||||
|
|
||||||
function setPaymentType(accounting) {
|
function setPaymentType(accounting) {
|
||||||
|
@ -112,7 +123,7 @@ function onBeforeSave(data) {
|
||||||
return notify(t('Amount exceeded', { maxAmount: maxAmount.value }), 'negative');
|
return notify(t('Amount exceeded', { maxAmount: maxAmount.value }), 'negative');
|
||||||
|
|
||||||
if (isCash.value && shouldSendEmail.value && !data.email)
|
if (isCash.value && shouldSendEmail.value && !data.email)
|
||||||
return notify(t('There is no assigned email for this client'), 'negative');
|
return notify(t(`There is no assigned email for this supplier`), 'negative');
|
||||||
|
|
||||||
data.bankFk = data.bankFk.id;
|
data.bankFk = data.bankFk.id;
|
||||||
return data;
|
return data;
|
||||||
|
@ -153,12 +164,11 @@ async function accountShortToStandard({ target: { value } }) {
|
||||||
async function getAmountPaid() {
|
async function getAmountPaid() {
|
||||||
const filter = {
|
const filter = {
|
||||||
where: {
|
where: {
|
||||||
clientFk: route.params.id,
|
supplierFk: route.params.id,
|
||||||
companyFk: initialData.companyFk,
|
companyFk: initialData.companyFk,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
const { data } = await getSupplierRisk(filter);
|
||||||
const { data } = await getClientRisk(filter);
|
|
||||||
initialData.amountPaid = (data?.length && data[0].amount) || undefined;
|
initialData.amountPaid = (data?.length && data[0].amount) || undefined;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -177,10 +187,17 @@ async function getAmountPaid() {
|
||||||
url="Accountings"
|
url="Accountings"
|
||||||
/>
|
/>
|
||||||
<FetchData
|
<FetchData
|
||||||
:filter="filterClientFindOne"
|
:filter="filterRecordFindOne"
|
||||||
@on-fetch="({ email }) => (initialData.email = email)"
|
url="Suppliers/findOne"
|
||||||
|
auto-load
|
||||||
|
@on-fetch="({ email }) => (initialData.email = email)"
|
||||||
|
/>
|
||||||
|
<FetchData
|
||||||
|
url="Currencies"
|
||||||
|
:filter="{ fields: ['id', 'name'] }"
|
||||||
|
order="code"
|
||||||
|
@on-fetch="(data) => (currenciesOptions = data)"
|
||||||
auto-load
|
auto-load
|
||||||
url="Clients/findOne"
|
|
||||||
/>
|
/>
|
||||||
<FormModel
|
<FormModel
|
||||||
ref="formModelRef"
|
ref="formModelRef"
|
||||||
|
@ -194,9 +211,8 @@ async function getAmountPaid() {
|
||||||
<span ref="closeButton" class="row justify-end close-icon" v-close-popup>
|
<span ref="closeButton" class="row justify-end close-icon" v-close-popup>
|
||||||
<QIcon name="close" size="sm" />
|
<QIcon name="close" size="sm" />
|
||||||
</span>
|
</span>
|
||||||
|
{{ data }}
|
||||||
<h5 class="q-mt-none">{{ t('New payment') }}</h5>
|
<h5 class="q-mt-none">{{ t('New payment') }}</h5>
|
||||||
|
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnInputDate
|
<VnInputDate
|
||||||
:label="t('Date')"
|
:label="t('Date')"
|
||||||
|
@ -287,6 +303,33 @@ async function getAmountPaid() {
|
||||||
<QCheckbox v-model="shouldSendEmail" :label="t('Send email')" />
|
<QCheckbox v-model="shouldSendEmail" :label="t('Send email')" />
|
||||||
</VnRow>
|
</VnRow>
|
||||||
</div>
|
</div>
|
||||||
|
<VnRow>
|
||||||
|
<VnSelect
|
||||||
|
v-if="$props.extraFields.includes('orderBy')"
|
||||||
|
:label="t('Type')"
|
||||||
|
v-model="data.orderBy"
|
||||||
|
:options="['issued', ' bookEntried', ' booked', ' dueDate']"
|
||||||
|
option-value="id"
|
||||||
|
option-label="name"
|
||||||
|
hide-selected
|
||||||
|
/>
|
||||||
|
</VnRow>
|
||||||
|
<VnRow class="row">
|
||||||
|
<VnSelect
|
||||||
|
v-if="$props.extraFields.includes('currencyFk')"
|
||||||
|
:label="t('currencyFk')"
|
||||||
|
v-model="data.currencyFk"
|
||||||
|
:options="currenciesOptions"
|
||||||
|
option-value="id"
|
||||||
|
option-label="name"
|
||||||
|
hide-selected
|
||||||
|
/>
|
||||||
|
<VnInputNumber
|
||||||
|
v-if="data.currencyFk !== 1"
|
||||||
|
:label="t('Divisa')"
|
||||||
|
v-model="data.divisa"
|
||||||
|
/>
|
||||||
|
</VnRow>
|
||||||
<div class="q-mt-lg row justify-end">
|
<div class="q-mt-lg row justify-end">
|
||||||
<QBtn
|
<QBtn
|
||||||
:disabled="formModelRef.isLoading"
|
:disabled="formModelRef.isLoading"
|
||||||
|
@ -320,6 +363,8 @@ es:
|
||||||
Amount: Importe
|
Amount: Importe
|
||||||
Reference: Referencia
|
Reference: Referencia
|
||||||
Cash: Efectivo
|
Cash: Efectivo
|
||||||
|
currencyFk: Moneda
|
||||||
|
Type: Tipo
|
||||||
Delivered amount: Cantidad entregada
|
Delivered amount: Cantidad entregada
|
||||||
Amount to return: Cantidad a devolver
|
Amount to return: Cantidad a devolver
|
||||||
View recipt: Ver recibido
|
View recipt: Ver recibido
|
Loading…
Reference in New Issue