Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | import { CountryTax } from './country_tax.js';
import { Entity } from '../entity.js';
import { Cart } from './cart.js';
import { Discount } from './discount.js';
import { Invoice } from './invoice.js';
import { Job } from './job.js';
export class Item extends Entity {
protected static resourceName = 'items';
protected static singularName = 'item';
protected static pluralName = 'items';
@Item.property({type: Date})
public archived?: Date | null;
@Item.property()
public code?: string;
@Item.property()
public id?: number;
@Item.property({type: Number})
public quantity?: number | null;
@Item.property()
public description?: string;
@Item.property()
public cost?: number;
@Item.property({type: Number})
public taxAmount?: number | null;
@Item.property({type: "Cart"})
public cart?: Cart | null;
@Item.property({type: "Discount"})
public discount?: Discount | null;
@Item.property({type: "Invoice"})
public invoice?: Invoice | null;
@Item.property({type: "Job"})
public job?: Job | null;
@Item.property({type: CountryTax})
public taxType?: CountryTax | null;
public totalCost = () => {
Iif (this.quantity === undefined) {
throw 'quantity is undefined, did you forget to embed it?';
}
Iif (this.cost === undefined) {
throw 'cost is undefined, did you forget to embed it?';
}
const quantity = this.quantity === null ? 0 : this.quantity;
return quantity * this.cost;
};
}
|