Skip to content

Instantly share code, notes, and snippets.

@Asmody

Asmody/Doc.lsf Secret

Created Oct 14, 2019
Embed
What would you like to do?
MODULE Doc;
CLASS ItemType {
product,
goods,
service
}
CLASS DocType {
PI,
SI
}
CLASS Item;
name = DATA STRING[100] (Item) IN base;
type = DATA ItemType (Item);
CLASS Department;
name = DATA STRING[100] (Department) IN base;
CLASS Stock;
name = DATA STRING[100] (Stock) IN base;
department = DATA Department (Stock);
balance = DATA INTEGER (Item, Stock);
CLASS Doc;
date = DATA DATETIME (Doc) NONULL;
active = DATA BOOLEAN (Doc);
type = DATA DocType (Doc) NONULL;
stock = DATA Stock (Doc) NONULL;
deptStock (Doc doc) = department(stock(doc));
storeName 'Склад' (Doc doc) = name(stock(doc));
deptStockName 'Подразделение склада' (Doc doc) = name(deptStock(doc));
CLASS DocLine;
doc = DATA Doc (DocLine) NONULL;
item = DATA Item (DocLine) NONULL;
itemName (DocLine docLine) = name(item(docLine));
itemType (DocLine docLine) = type(item(docLine));
quantity = DATA INTEGER (DocLine);
CONSTRAINT quantity(DocLine docLine) <= 0
OR (type(doc(docLine))==DocType.SI AND quantity(docLine) >= balance(item(docLine), stock(doc(docLine))))
MESSAGE 'Неверное количество';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.