#7936 improve InvoiceIn #1004
|
@ -1,9 +1,8 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed } from 'vue';
|
import { ref, computed, capitalize } from 'vue';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useArrayData } from 'src/composables/useArrayData';
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
import { useCapitalize } from 'src/composables/useCapitalize';
|
|
||||||
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';
|
||||||
|
@ -31,7 +30,7 @@ const columns = computed(() => [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'type',
|
name: 'type',
|
||||||
label: useCapitalize(t('globals.type')),
|
label: capitalize(t('globals.type')),
|
||||||
field: (row) => row.cplusRectificationTypeFk,
|
field: (row) => row.cplusRectificationTypeFk,
|
||||||
options: cplusRectificationTypes.value,
|
options: cplusRectificationTypes.value,
|
||||||
model: 'cplusRectificationTypeFk',
|
model: 'cplusRectificationTypeFk',
|
||||||
|
@ -43,10 +42,10 @@ const columns = computed(() => [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'class',
|
name: 'class',
|
||||||
label: useCapitalize(t('globals.class')),
|
label: capitalize(t('globals.class')),
|
||||||
field: (row) => row.siiTypeInvoiceOutFk,
|
field: (row) => row.siiTypeInvoiceInFk,
|
||||||
options: siiTypeInvoiceOuts.value,
|
options: siiTypeInvoiceIns.value,
|
||||||
model: 'siiTypeInvoiceOutFk',
|
model: 'siiTypeInvoiceInFk',
|
||||||
optionValue: 'id',
|
optionValue: 'id',
|
||||||
optionLabel: 'code',
|
optionLabel: 'code',
|
||||||
sortable: true,
|
sortable: true,
|
||||||
|
@ -55,7 +54,7 @@ const columns = computed(() => [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'reason',
|
name: 'reason',
|
||||||
label: useCapitalize(t('globals.reason')),
|
label: capitalize(t('globals.reason')),
|
||||||
field: (row) => row.invoiceCorrectionTypeFk,
|
field: (row) => row.invoiceCorrectionTypeFk,
|
||||||
options: invoiceCorrectionTypes.value,
|
options: invoiceCorrectionTypes.value,
|
||||||
model: 'invoiceCorrectionTypeFk',
|
model: 'invoiceCorrectionTypeFk',
|
||||||
|
@ -67,9 +66,8 @@ const columns = computed(() => [
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
const cplusRectificationTypes = ref([]);
|
const cplusRectificationTypes = ref([]);
|
||||||
const siiTypeInvoiceOuts = ref([]);
|
const siiTypeInvoiceIns = ref([]);
|
||||||
const invoiceCorrectionTypes = ref([]);
|
const invoiceCorrectionTypes = ref([]);
|
||||||
const rowsSelected = ref([]);
|
|
||||||
|
|
||||||
const requiredFieldRule = (val) => val || t('globals.requiredField');
|
const requiredFieldRule = (val) => val || t('globals.requiredField');
|
||||||
|
|
||||||
|
@ -82,9 +80,9 @@ const onSave = (data) => data.deletes && push(`/invoice-in/${invoiceId}/summary`
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
<FetchData
|
<FetchData
|
||||||
url="SiiTypeInvoiceOuts"
|
url="SiiTypeInvoiceIns"
|
||||||
:where="{ code: { like: 'R%' } }"
|
:where="{ code: { like: 'R%' } }"
|
||||||
@on-fetch="(data) => (siiTypeInvoiceOuts = data)"
|
@on-fetch="(data) => (siiTypeInvoiceIns = data)"
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
<FetchData
|
<FetchData
|
||||||
|
@ -99,17 +97,15 @@ const onSave = (data) => data.deletes && push(`/invoice-in/${invoiceId}/summary`
|
||||||
url="InvoiceInCorrections"
|
url="InvoiceInCorrections"
|
||||||
:filter="filter"
|
:filter="filter"
|
||||||
auto-load
|
auto-load
|
||||||
v-model:selected="rowsSelected"
|
|
||||||
primary-key="correctingFk"
|
primary-key="correctingFk"
|
||||||
@save-changes="onSave"
|
@save-changes="onSave"
|
||||||
|
:default-remove="false"
|
||||||
>
|
>
|
||||||
<template #body="{ rows }">
|
<template #body="{ rows }">
|
||||||
<QTable
|
<QTable
|
||||||
v-model:selected="rowsSelected"
|
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:rows="rows"
|
:rows="rows"
|
||||||
row-key="$index"
|
row-key="$index"
|
||||||
selection="single"
|
|
||||||
:grid="$q.screen.lt.sm"
|
:grid="$q.screen.lt.sm"
|
||||||
:pagination="{ rowsPerPage: 0 }"
|
:pagination="{ rowsPerPage: 0 }"
|
||||||
>
|
>
|
||||||
|
@ -121,8 +117,17 @@ const onSave = (data) => data.deletes && push(`/invoice-in/${invoiceId}/summary`
|
||||||
:options="col.options"
|
:options="col.options"
|
||||||
:option-value="col.optionValue"
|
:option-value="col.optionValue"
|
||||||
:option-label="col.optionLabel"
|
:option-label="col.optionLabel"
|
||||||
:readonly="row.invoiceIn.isBooked"
|
:disable="row.invoiceIn.isBooked"
|
||||||
/>
|
:filter-options="['description']"
|
||||||
|
>
|
||||||
|
<template #option="{ opt }">
|
||||||
|
<QItem>
|
||||||
|
<QItemSection>
|
||||||
|
<QItemLabel>{{ opt.description }}</QItemLabel>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
</template>
|
||||||
|
</VnSelect>
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
<template #body-cell-class="{ row, col }">
|
<template #body-cell-class="{ row, col }">
|
||||||
|
@ -134,8 +139,20 @@ const onSave = (data) => data.deletes && push(`/invoice-in/${invoiceId}/summary`
|
||||||
:option-value="col.optionValue"
|
:option-value="col.optionValue"
|
||||||
:option-label="col.optionLabel"
|
:option-label="col.optionLabel"
|
||||||
:rules="[requiredFieldRule]"
|
:rules="[requiredFieldRule]"
|
||||||
:readonly="row.invoiceIn.isBooked"
|
:filter-options="['code', 'description']"
|
||||||
/>
|
:disable="row.invoiceIn.isBooked"
|
||||||
|
>
|
||||||
|
<template #option="{ opt }">
|
||||||
|
<QItem>
|
||||||
|
<QItemSection>
|
||||||
|
<QItemLabel
|
||||||
|
>{{ opt.code }} -
|
||||||
|
{{ opt.description }}</QItemLabel
|
||||||
|
>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
</template>
|
||||||
|
</VnSelect>
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
<template #body-cell-reason="{ row, col }">
|
<template #body-cell-reason="{ row, col }">
|
||||||
|
@ -147,7 +164,7 @@ const onSave = (data) => data.deletes && push(`/invoice-in/${invoiceId}/summary`
|
||||||
:option-value="col.optionValue"
|
:option-value="col.optionValue"
|
||||||
:option-label="col.optionLabel"
|
:option-label="col.optionLabel"
|
||||||
:rules="[requiredFieldRule]"
|
:rules="[requiredFieldRule]"
|
||||||
:readonly="row.invoiceIn.isBooked"
|
:disable="row.invoiceIn.isBooked"
|
||||||
/>
|
/>
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
|
@ -155,7 +172,6 @@ const onSave = (data) => data.deletes && push(`/invoice-in/${invoiceId}/summary`
|
||||||
</template>
|
</template>
|
||||||
</CrudModel>
|
</CrudModel>
|
||||||
</template>
|
</template>
|
||||||
<style lang="scss" scoped></style>
|
|
||||||
<i18n>
|
<i18n>
|
||||||
es:
|
es:
|
||||||
Original invoice: Factura origen
|
Original invoice: Factura origen
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, reactive, computed, onBeforeMount } from 'vue';
|
import { ref, reactive, computed, onBeforeMount, capitalize } from 'vue';
|
||||||
import { useRouter, onBeforeRouteUpdate } from 'vue-router';
|
import { useRouter, onBeforeRouteUpdate } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
|
@ -15,7 +15,6 @@ import FetchData from 'src/components/FetchData.vue';
|
||||||
import SendEmailDialog from 'components/common/SendEmailDialog.vue';
|
import SendEmailDialog from 'components/common/SendEmailDialog.vue';
|
||||||
import VnConfirm from 'src/components/ui/VnConfirm.vue';
|
import VnConfirm from 'src/components/ui/VnConfirm.vue';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
import { useCapitalize } from 'src/composables/useCapitalize';
|
|
||||||
import SupplierDescriptorProxy from 'src/pages/Supplier/Card/SupplierDescriptorProxy.vue';
|
import SupplierDescriptorProxy from 'src/pages/Supplier/Card/SupplierDescriptorProxy.vue';
|
||||||
import InvoiceInToBook from '../InvoiceInToBook.vue';
|
import InvoiceInToBook from '../InvoiceInToBook.vue';
|
||||||
|
|
||||||
|
@ -37,7 +36,7 @@ const totalAmount = ref();
|
||||||
const currentAction = ref();
|
const currentAction = ref();
|
||||||
const config = ref();
|
const config = ref();
|
||||||
const cplusRectificationTypes = ref([]);
|
const cplusRectificationTypes = ref([]);
|
||||||
const siiTypeInvoiceOuts = ref([]);
|
const siiTypeInvoiceIns = ref([]);
|
||||||
const invoiceCorrectionTypes = ref([]);
|
const invoiceCorrectionTypes = ref([]);
|
||||||
const actions = {
|
const actions = {
|
||||||
unbook: {
|
unbook: {
|
||||||
|
@ -119,7 +118,7 @@ const routes = reactive({
|
||||||
const correctionFormData = reactive({
|
const correctionFormData = reactive({
|
||||||
invoiceReason: 2,
|
invoiceReason: 2,
|
||||||
invoiceType: 2,
|
invoiceType: 2,
|
||||||
invoiceClass: 6,
|
invoiceClass: 8,
|
||||||
});
|
});
|
||||||
const isNotFilled = computed(() => Object.values(correctionFormData).includes(null));
|
const isNotFilled = computed(() => Object.values(correctionFormData).includes(null));
|
||||||
|
|
||||||
|
@ -262,9 +261,9 @@ const createInvoiceInCorrection = async () => {
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
<FetchData
|
<FetchData
|
||||||
url="SiiTypeInvoiceOuts"
|
url="siiTypeInvoiceIns"
|
||||||
:where="{ code: { like: 'R%' } }"
|
:where="{ code: { like: 'R%' } }"
|
||||||
@on-fetch="(data) => (siiTypeInvoiceOuts = data)"
|
@on-fetch="(data) => (siiTypeInvoiceIns = data)"
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
<FetchData
|
<FetchData
|
||||||
|
@ -438,9 +437,9 @@ const createInvoiceInCorrection = async () => {
|
||||||
readonly
|
readonly
|
||||||
/>
|
/>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="`${useCapitalize(t('globals.class'))}`"
|
:label="`${capitalize(t('globals.class'))}`"
|
||||||
v-model="correctionFormData.invoiceClass"
|
v-model="correctionFormData.invoiceClass"
|
||||||
:options="siiTypeInvoiceOuts"
|
:options="siiTypeInvoiceIns"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
option-label="code"
|
option-label="code"
|
||||||
:required="true"
|
:required="true"
|
||||||
|
@ -448,15 +447,27 @@ const createInvoiceInCorrection = async () => {
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="`${useCapitalize(t('globals.type'))}`"
|
:label="`${capitalize(t('globals.type'))}`"
|
||||||
v-model="correctionFormData.invoiceType"
|
v-model="correctionFormData.invoiceType"
|
||||||
:options="cplusRectificationTypes"
|
:options="cplusRectificationTypes"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
option-label="description"
|
option-label="description"
|
||||||
:required="true"
|
:required="true"
|
||||||
/>
|
>
|
||||||
|
<template #option="{ opt }">
|
||||||
|
<QItem>
|
||||||
|
<QItemSection>
|
||||||
|
<QItemLabel
|
||||||
|
>{{ opt.code }} -
|
||||||
|
{{ opt.description }}</QItemLabel
|
||||||
|
>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
<div></div>
|
||||||
|
</template>
|
||||||
|
</VnSelect>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="`${useCapitalize(t('globals.reason'))}`"
|
:label="`${capitalize(t('globals.reason'))}`"
|
||||||
v-model="correctionFormData.invoiceReason"
|
v-model="correctionFormData.invoiceReason"
|
||||||
:options="invoiceCorrectionTypes"
|
:options="invoiceCorrectionTypes"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
|
|
Loading…
Reference in New Issue