7489-testToMaster #2515

Merged
alexm merged 329 commits from 7489-testToMaster into master 2024-05-28 05:30:19 +00:00
2 changed files with 22 additions and 29 deletions
Showing only changes of commit 9d75ba0bc5 - Show all commits

View File

@ -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}}

View File

@ -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;
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});
});
});
}
}