principio 1146

This commit is contained in:
Javi Gallego 2019-02-15 16:04:24 +01:00
parent 00c7f28baf
commit 2b4f5984cc
4 changed files with 21 additions and 7 deletions

View File

@ -60,15 +60,15 @@ module.exports = Self => {
}; };
[item] = await Self.app.models.Item.find(filter); [item] = await Self.app.models.Item.find(filter);
// Visible Avaible // Visible Available
let query = ` let query = `
CALL vn.getItemVisibleAvailable(?,curdate(),?,?)`; CALL vn.getItemVisibleAvailable(?,curdate(),?,?)`;
let options = [item.id, item.itemType().warehouseFk, false]; let options = [item.id, item.itemType().warehouseFk, false];
let [res] = await Self.rawSql(query, options); let [res] = await Self.rawSql(query, options);
item.available = res[0].available ? res[0].available : '-'; item.available = res[0].available;
item.visible = res[0].visible ? res[0].visible : '-'; item.visible = res[0].visible;
return item; return item;
}; };

View File

@ -28,7 +28,7 @@ module.exports = Self => {
} }
}); });
Self.regularize = async (ctx, itemFk, quantity, warehouseFk) => { Self.regularize = async(ctx, itemFk, quantity, warehouseFk) => {
const userId = ctx.req.accessToken.userId; const userId = ctx.req.accessToken.userId;
const models = Self.app.models; const models = Self.app.models;

View File

@ -25,7 +25,6 @@ class Controller {
if (value) if (value)
this._warehouseFk = value; this._warehouseFk = value;
} }
get warehouseFk() { get warehouseFk() {
if (!this._warehouseFk) if (!this._warehouseFk)
this._warehouseFk = parseInt(window.localStorage.defaultWarehouseFk); this._warehouseFk = parseInt(window.localStorage.defaultWarehouseFk);
@ -33,6 +32,20 @@ class Controller {
return this._warehouseFk; return this._warehouseFk;
} }
set item(value) {
this._item = value
this.avai = null
visible null
if (!this.item)
this._warehouseFk = parseInt(window.localStorage.defaultWarehouseFk);
llamar availabe
return this._warehouseFk;
}
get item(){
return this._item;
}
onMoreChange(callback) { onMoreChange(callback) {
callback.call(this); callback.call(this);
} }
@ -57,6 +70,7 @@ class Controller {
warehouseFk: this.warehouseFk warehouseFk: this.warehouseFk
}).then(res => { }).then(res => {
this.vnApp.showSuccess(this.$translate.instant('Data saved!')); this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
this.card.reload();
}); });
} }
} }

View File

@ -35,14 +35,14 @@
<vn-tbody> <vn-tbody>
<vn-tr <vn-tr
ng-class="::{ ng-class="::{
'isToday': $ctrl.isToday(sale.date),
'isIn': sale.in, 'isIn': sale.in,
'balanceNegative': sale.balance < 0}" 'balanceNegative': sale.balance < 0}"
ng-repeat="sale in sales" ng-repeat="sale in sales"
vn-repeat-last vn-repeat-last
on-last="$ctrl.scrollToLine()"> on-last="$ctrl.scrollToLine()">
<vn-td> <vn-td>
<span class="chip date"> <span class="chip"
ng-class="::{warning: $ctrl.isToday(sale.date)}">
{{::sale.date | date:'dd/MM/yyyy' }} {{::sale.date | date:'dd/MM/yyyy' }}
</span> </span>
</vn-td> </vn-td>