feat: refs #6739 transferInvoice new functionality #2412
|
@ -1,15 +1,3 @@
|
||||||
<vn-crud-model
|
|
||||||
auto-load="true"
|
|
||||||
url="CplusRectificationTypes"
|
|
||||||
data="cplusRectificationTypes"
|
|
||||||
order="description">
|
|
||||||
</vn-crud-model>
|
|
||||||
<vn-crud-model
|
|
||||||
auto-load="true"
|
|
||||||
url="SiiTypeInvoiceOuts"
|
|
||||||
data="siiTypeInvoiceOuts"
|
|
||||||
where="{code: {like: 'R%'}}">
|
|
||||||
</vn-crud-model>
|
|
||||||
<vn-crud-model
|
<vn-crud-model
|
||||||
auto-load="true"
|
auto-load="true"
|
||||||
url="InvoiceCorrectionTypes"
|
url="InvoiceCorrectionTypes"
|
||||||
|
@ -211,15 +199,14 @@
|
||||||
vn-one
|
vn-one
|
||||||
vn-id="cplusRectificationType"
|
vn-id="cplusRectificationType"
|
||||||
required="true"
|
required="true"
|
||||||
data="cplusRectificationTypes"
|
data="$ctrl.cplusRectificationTypes"
|
||||||
show-field="description"
|
show-field="description"
|
||||||
value-field="id"
|
value-field="id"
|
||||||
ng-model="$ctrl.cplusRectificationType"
|
ng-model="$ctrl.cplusRectificationType"
|
||||||
ng-init="$ctrl.cplusRectificationType = (cplusRectificationTypes.length > 0 ? cplusRectificationTypes[1].id : null)"
|
|
||||||
search-function="{or: [{id: $search}, {description: {like: '%'+ $search +'%'}}]}"
|
search-function="{or: [{id: $search}, {description: {like: '%'+ $search +'%'}}]}"
|
||||||
label="Rectificative type">
|
label="Rectificative type">
|
||||||
<tpl-item>
|
<tpl-item>
|
||||||
{{::description}}
|
{{ ::description}}
|
||||||
</tpl-item>
|
</tpl-item>
|
||||||
</vn-autocomplete>
|
</vn-autocomplete>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
|
@ -227,13 +214,12 @@
|
||||||
<vn-autocomplete
|
<vn-autocomplete
|
||||||
vn-one
|
vn-one
|
||||||
vn-id="siiTypeInvoiceOut"
|
vn-id="siiTypeInvoiceOut"
|
||||||
data="siiTypeInvoiceOuts"
|
data="$ctrl.siiTypeInvoiceOuts"
|
||||||
show-field="description"
|
show-field="description"
|
||||||
value-field="id"
|
value-field="id"
|
||||||
fields="['id','code','description']"
|
fields="['id','code','description']"
|
||||||
required="true"
|
required="true"
|
||||||
ng-model="$ctrl.siiTypeInvoiceOut"
|
ng-model="$ctrl.siiTypeInvoiceOut"
|
||||||
ng-init="$ctrl.siiTypeInvoiceOut = (siiTypeInvoiceOuts.length > 0 ? siiTypeInvoiceOuts[3].id : null)"
|
|
||||||
label="Class">
|
label="Class">
|
||||||
<tpl-item>
|
<tpl-item>
|
||||||
{{::code}} - {{::description}}
|
{{::code}} - {{::description}}
|
||||||
|
|
|
@ -8,6 +8,16 @@ class Controller extends Section {
|
||||||
this.vnReport = vnReport;
|
this.vnReport = vnReport;
|
||||||
this.vnEmail = vnEmail;
|
this.vnEmail = vnEmail;
|
||||||
this.checked = true;
|
this.checked = true;
|
||||||
|
this.$http.get(`CplusRectificationTypes`, {filter: {order: 'description'}})
|
||||||
|
.then(res => {
|
||||||
|
this.cplusRectificationTypes = res.data;
|
||||||
|
this.cplusRectificationType = res.data.filter(type => type.description == 'I – Por diferencias')[0].id;
|
||||||
|
});
|
||||||
|
this.$http.get(`SiiTypeInvoiceOuts`, {filter: {where: {code: {like: 'R%'}}}})
|
||||||
|
.then(res => {
|
||||||
|
this.siiTypeInvoiceOuts = res.data;
|
||||||
|
this.siiTypeInvoiceOut = res.data.filter(type => type.code == 'R4')[0].id;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
get invoiceOut() {
|
get invoiceOut() {
|
||||||
|
@ -149,23 +159,20 @@ class Controller extends Section {
|
||||||
checked: this.checked
|
checked: this.checked
|
||||||
};
|
};
|
||||||
|
|
||||||
const transferInvoiceRequest = () => {
|
|
||||||
this.$http.post(`InvoiceOuts/transferInvoice`, params).then(res => {
|
|
||||||
const invoiceId = res.data;
|
|
||||||
this.vnApp.showSuccess(this.$t('Transferred invoice'));
|
|
||||||
this.$state.go('invoiceOut.card.summary', {id: invoiceId});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
this.$http.get(`Clients/${this.clientId}`).then(response => {
|
this.$http.get(`Clients/${this.clientId}`).then(response => {
|
||||||
const clientData = response.data;
|
const clientData = response.data;
|
||||||
const hasToInvoiceByAddress = clientData.hasToInvoiceByAddress;
|
const hasToInvoiceByAddress = clientData.hasToInvoiceByAddress;
|
||||||
|
|
||||||
jon marked this conversation as resolved
Outdated
|
|||||||
if (this.checked && hasToInvoiceByAddress) {
|
if (this.checked && hasToInvoiceByAddress) {
|
||||||
if (window.confirm('El cliente destino tiene marcado facturar por consignatario, ¿desea continuar?'))
|
if (!window.confirm('El cliente destino tiene marcado facturar por consignatario, ¿desea continuar?'))
|
||||||
transferInvoiceRequest();
|
return;
|
||||||
} else
|
}
|
||||||
transferInvoiceRequest();
|
|
||||||
|
this.$http.post(`InvoiceOuts/transferInvoice`, params).then(res => {
|
||||||
|
const invoiceId = res.data;
|
||||||
|
this.vnApp.showSuccess(this.$t('Transferred invoice'));
|
||||||
|
this.$state.go('invoiceOut.card.summary', {id: invoiceId});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
usar el negado para no llamar 2 veces a la funcion