function Report(transpack) {

    //constructor
    this.transpack = transpack;
    this.categories = Array();

    this.getReportData = function () {
        // fill up categories array with category objects
        // categories is taken from in-line JSON from DB
        var eThis = this;
                
        $(storage.categories).each(function () {
            
            var cat = new Category();
            cat.setId(this.id);
            cat.setName(this.category);
            cat.setDesc(this.desc);
            cat.setGroupId(this.group_id);
            cat.setTotalDays(eThis.transpack.getTotalDaysByTransactions());
            eThis.categories.push(cat);
        });

        // add transactions to the category objects
        $(this.transpack.transactions).each(function (i) {
            var cat = this;
            $(eThis.categories).each(function (j) {
                if (cat.category === this.getName()) {    
                    this.addTransaction(cat);
                    return false;
                }
            });
        });

        //special trick to sort the categories based on totalAmount
        $(this.categories).each(function () {
            this.makeSortable();
        });
        this.categories = $(this.categories).sort("totalAmount", "desc");

        // return data
        var data = {
            transpack: this.transpack,
            categories: this.categories
        };
        return data;
    };
}
