﻿// Subtotal class
var Subtotal = $.Class.create({
    initialize: function(encryptedId, name, total, interest, tax, endTotal, visible, lineItems, idSuffix) {
        this.encryptedId = encryptedId;
        this.name = name;
        this.total = total;
        this.interest = interest;
        this.tax = tax;
        this.endTotal = endTotal;
        this.visible = visible;
        this.lineItems = lineItems;
        this.idSuffix = idSuffix;
    },
    toString: function() {
        return this.name;
    }
});

var LineItem = $.Class.create({
    initialize: function(encryptedId, date, unit, unitCustom, quantity, description, unitPrice, total, interestRate, taxRate, interest, tax, interestDate, endTotal, idSuffix) {
        this.encryptedId = encryptedId;
        this.date = date;
        this.quantity = quantity;
        this.description = description;
        this.unitPrice = unitPrice;
        this.unit = unit;
        this.unitCustom = unitCustom;
        this.total = total;
        this.interestRate = interestRate;
        this.taxRate = taxRate;
        this.interest = interest;
        this.tax = tax;
        this.interestDate = interestDate;
        this.endTotal = endTotal;
        this.idSuffix = idSuffix;
        this.previous = null;
        this.dateArchived = null;
        this.historyItems = new Array();
    },
    toString: function() {
        return this.quantity;
    }
});

var Unit = $.Class.create({
    initialize: function(encryptedId, name) {
        this.encryptedId = encryptedId;
        this.name = name;
    }
});

String.prototype.blank = function() {
    return $.string(this).blank();
}

