refs #5842 fix: recalcula invoiceDate cuando se cambia la company
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Vicent Llopis 2023-06-14 14:59:18 +02:00
parent 32a0955c1d
commit 7fa4eabf86
2 changed files with 22 additions and 15 deletions

View File

@ -118,7 +118,8 @@
label="Company" label="Company"
show-field="code" show-field="code"
value-field="id" value-field="id"
ng-model="$ctrl.companyFk"> ng-model="$ctrl.companyFk"
on-change="$ctrl.recalcInvoiceDate($ctrl.companyFk)">
</vn-autocomplete> </vn-autocomplete>
<vn-autocomplete <vn-autocomplete
url="Printers" url="Printers"

View File

@ -7,23 +7,29 @@ class Controller extends Section {
$onInit() { $onInit() {
const date = Date.vnNew(); const date = Date.vnNew();
Object.assign(this, { Object.assign(this, {
maxShipped: new Date(date.getFullYear(), date.getMonth(), 0), maxShipped: new Date(date.getFullYear(), date.getMonth(), 0),
clientsToInvoice: 'all', clientsToInvoice: 'all',
}); });
this.$http.get('UserConfigs/getUserConfig') this.$http.get('UserConfigs/getUserConfig')
.then(res => { .then(res => {
this.companyFk = res.data.companyFk; this.companyFk = res.data.companyFk;
const params = { this.recalcInvoiceDate(this.companyFk);
companyFk: this.companyFk });
}; }
return this.$http.get('InvoiceOuts/getInvoiceDate', {params});
}) recalcInvoiceDate(companyFk) {
.then(res => { const params = { companyFk: companyFk };
this.minInvoicingDate = res.data.issued ? new Date(res.data.issued) : null; this.fetchInvoiceDate(params);
this.invoiceDate = this.minInvoicingDate; }
});
} fetchInvoiceDate(params) {
this.$http.get('InvoiceOuts/getInvoiceDate', { params })
.then(res => {
this.minInvoicingDate = res.data.issued ? new Date(res.data.issued) : null;
this.invoiceDate = this.minInvoicingDate;
});
}
stopInvoicing() { stopInvoicing() {
this.status = 'stopping'; this.status = 'stopping';