Skip to content

Instantly share code, notes, and snippets.

@Asmody

Asmody/Doc.lsf Secret

Created October 14, 2019 12:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Asmody/e0207c14332b0abcf99839a712845a81 to your computer and use it in GitHub Desktop.
Save Asmody/e0207c14332b0abcf99839a712845a81 to your computer and use it in GitHub Desktop.
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