Table ArticleTotal
Table that contains the total in stock. Replaces the StockTotal view and FStockTotal procedure. Calculated from InvDetail.id_Quantity and OutOrderDetail.od_Quantity.
DDL
create sequence seqArticleTotal as bigint start with 1;
create table ArticleTotal (
atID pointer not null default next value for seqArticleTotal,
atCreatedOn datetime not null default sysdatetime(),
atCreatedByFK pointer not null,
atChangedOn datetime not null default sysdatetime(),
atChangedByFK pointer not NULL,
atArticleFK pointer not null,
atLocationFK pointer not null,
atQuantity amount not null,
CONSTRAINT pkArticleTotal PRIMARY key (atID)
);
create unique index udxArticleTotal on ArticleTotal(atArticleFK, atLocationFK);
alter table ArticleTotal add constraint fkArticleTotalArticle foreign key (atArticleFK) references Article(aID);
alter table ArticleTotal add constraint fkArticleTotalLocation foreign key (atLocationFK) references Location(lID);
Default Data
Mapping
None. It is a calculated table.