(function() { BemsWebApplication.FmsMaterialStoredViewModel = function(data) { this.SiteId = ko.observable(); this.BusinessFieldId = ko.observable(); this.StoredDate = ko.observable(); this.MaterialStoredId = ko.observable(); this.PurchaseOrderId = ko.observable(); this.WarehouseId = ko.observable(); this.MaterialId = ko.observable(); this.StoredCount = ko.observable(); this.RemainStoredCount = ko.observable(); this.UnitCost = ko.observable(); this.StockCount = ko.observable(); this.Note = ko.observable(); this.StoredUserId = ko.observable(); this.ApprovalDate = ko.observable(); this.ApprovalUserId = ko.observable(); this.IsApproval = ko.observable(); this.LocationInWarehouse = ko.observable(); if(data) this.fromJS(data); }; $.extend(BemsWebApplication.FmsMaterialStoredViewModel.prototype, { toJS: function() { return { SiteId: this.SiteId(), BusinessFieldId: this.BusinessFieldId(), StoredDate: this.StoredDate(), MaterialStoredId: this.MaterialStoredId(), PurchaseOrderId: this.PurchaseOrderId(), WarehouseId: this.WarehouseId(), MaterialId: this.MaterialId(), StoredCount: this.StoredCount(), RemainStoredCount: this.RemainStoredCount(), UnitCost: this.UnitCost(), StockCount: this.StockCount(), Note: this.Note(), StoredUserId: this.StoredUserId(), ApprovalDate: this.ApprovalDate(), ApprovalUserId: this.ApprovalUserId(), IsApproval: this.IsApproval(), LocationInWarehouse: this.LocationInWarehouse(), }; }, fromJS: function(data) { if(data) { this.SiteId(data.SiteId); this.StoredDate(data.StoredDate); this.MaterialStoredId(data.MaterialStoredId); this.PurchaseOrderId(data.PurchaseOrderId); this.BusinessFieldId(data.BusinessFieldId); this.WarehouseId(data.WarehouseId); this.MaterialId(data.MaterialId); this.StoredCount(data.StoredCount); this.RemainStoredCount(data.RemainStoredCount); this.UnitCost(data.UnitCost); this.StockCount(data.StockCount); this.Note(data.Note); this.StoredUserId(data.StoredUserId); this.ApprovalDate(data.ApprovalDate); this.ApprovalUserId(data.ApprovalUserId); this.IsApproval(data.IsApproval); this.LocationInWarehouse(data.LocationInWarehouse); } } }); })();