(function () {
    BemsWebApplication.FmsMonthlyStoredReleaseStatusViewModel = function (data) {
        this.SiteId = ko.observable();
        this.BusinessFieldId = ko.observable();
        this.MaterialStoredId = ko.observable();
        this.MaterialId = ko.observable();
        this.MaterialCode = ko.observable();
        this.MaterialName = ko.observable();
        this.Unit = ko.observable();
        this.StoredCount = ko.observable();
        this.StoredUnitCost = ko.observable();
        this.StoredDate = ko.observable();
        this.ReleaseCount = ko.observable();
        this.ReleaseTotalCost = ko.observable();
        this.ReleaseDate = ko.observable();
        this.Year = ko.observable();
        this.Month = ko.observable();
        this.StockRemainCount = ko.observable();
        this.StockRemainAmount = ko.observable();
        this.Number = ko.observable();
        if (data)
            this.fromJS(data);
    };

    $.extend(BemsWebApplication.FmsMonthlyStoredReleaseStatusViewModel.prototype, {
        toJS: function () {
            return {
                SiteId: this.SiteId(),
                BusinessFieldId: this.BusinessFieldId(),
                MaterialStoredId: this.MaterialStoredId(),
                MaterialId: this.MaterialId(),
                MaterialCode: this.MaterialCode(),
                MaterialName: this.MaterialName(),
                Unit: this.Unit(),
                StoredCount: this.StoredCount(),
                StoredUnitCost: this.StoredUnitCost(),
                StoredDate: this.StoredDate(),
                ReleaseCount: this.ReleaseCount(),
                ReleaseTotalCost: this.ReleaseTotalCost(),
                ReleaseDate: this.ReleaseDate(),
                Year: this.Year(),
                Month: this.Month(),
                StockRemainCount: this.StockRemainCount(),
                StockRemainAmount: this.StockRemainAmount(),
                Number: this.Number(),
            };
        },

        fromJS: function (data) {
            if (data) {
                this.SiteId(data.SiteId);
                this.BusinessFieldId(data.BusinessFieldId);
                this.MaterialStoredId(data.MaterialStoredId);
                this.MaterialId(data.MaterialId);
                this.MaterialCode(data.MaterialCode);
                this.MaterialName(data.MaterialName);
                this.Unit(data.Unit);
                this.StoredCount(data.StoredCount);
                this.StoredUnitCost(data.StoredUnitCost);
                this.StoredDate(data.StoredDate);
                this.ReleaseCount(data.ReleaseCount);
                this.ReleaseTotalCost(data.ReleaseTotalCost);
                this.ReleaseDate(data.ReleaseDate);
                this.Year(data.Year);
                this.Month(data.Month);
                this.StockRemainCount(data.StockRemainCount);
                this.StockRemainAmount(data.StockRemainAmount);
                this.Number(data.Number);
            }
        }
    });
})();