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
|
||||
auto-load="true"
|
||||
url="InvoiceCorrectionTypes"
|
||||
|
@ -211,15 +199,14 @@
|
|||
vn-one
|
||||
vn-id="cplusRectificationType"
|
||||
required="true"
|
||||
data="cplusRectificationTypes"
|
||||
data="$ctrl.cplusRectificationTypes"
|
||||
show-field="description"
|
||||
value-field="id"
|
||||
ng-model="$ctrl.cplusRectificationType"
|
||||
ng-init="$ctrl.cplusRectificationType = (cplusRectificationTypes.length > 0 ? cplusRectificationTypes[1].id : null)"
|
||||
search-function="{or: [{id: $search}, {description: {like: '%'+ $search +'%'}}]}"
|
||||
label="Rectificative type">
|
||||
<tpl-item>
|
||||
{{::description}}
|
||||
{{ ::description}}
|
||||
</tpl-item>
|
||||
</vn-autocomplete>
|
||||
</vn-horizontal>
|
||||
|
@ -227,13 +214,12 @@
|
|||
<vn-autocomplete
|
||||
vn-one
|
||||
vn-id="siiTypeInvoiceOut"
|
||||
data="siiTypeInvoiceOuts"
|
||||
data="$ctrl.siiTypeInvoiceOuts"
|
||||
show-field="description"
|
||||
value-field="id"
|
||||
fields="['id','code','description']"
|
||||
required="true"
|
||||
ng-model="$ctrl.siiTypeInvoiceOut"
|
||||
ng-init="$ctrl.siiTypeInvoiceOut = (siiTypeInvoiceOuts.length > 0 ? siiTypeInvoiceOuts[3].id : null)"
|
||||
label="Class">
|
||||
<tpl-item>
|
||||
{{::code}} - {{::description}}
|
||||
|
|
|
@ -8,6 +8,16 @@ class Controller extends Section {
|
|||
this.vnReport = vnReport;
|
||||
this.vnEmail = vnEmail;
|
||||
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() {
|
||||
|
@ -149,23 +159,20 @@ class Controller extends Section {
|
|||
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 => {
|
||||
const clientData = response.data;
|
||||
const hasToInvoiceByAddress = clientData.hasToInvoiceByAddress;
|
||||
|
||||
jon marked this conversation as resolved
Outdated
|
||||
if (this.checked && hasToInvoiceByAddress) {
|
||||
if (window.confirm('El cliente destino tiene marcado facturar por consignatario, ¿desea continuar?'))
|
||||
transferInvoiceRequest();
|
||||
} else
|
||||
transferInvoiceRequest();
|
||||
if (!window.confirm('El cliente destino tiene marcado facturar por consignatario, ¿desea continuar?'))
|
||||
return;
|
||||
}
|
||||
|
||||
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