Ignore:
Timestamp:
Jan 4, 2021, 9:55:40 PM (4 years ago)
Author:
chronos
Message:
  • Modified: More work on modules models initialization.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/Stock/Stock.php

    r887 r893  
    1212    $this->Description = 'Stock and products';
    1313    $this->Dependencies = array('User', 'Customer', 'Network');
     14  }
     15
     16  function GetModels(): array
     17  {
     18    return array('Product', 'StockSerialNumber', 'Stock', 'StockMoveGroup', 'StockMove', 'StockMoveItem',
     19      'StockItemHistory', 'StockMoveItemSerialRel');
    1420  }
    1521
     
    256262  }
    257263}
     264
     265class Product extends Model
     266{
     267  static function GetDesc(): ModelDesc
     268  {
     269    $Desc = new ModelDesc('Product');
     270    $Desc->AddReference('Manufacturer', 'Subject');
     271    $Desc->AddString('Code');
     272    $Desc->AddString('Name');
     273    $Desc->AddInteger('SellPrice');
     274    $Desc->AddInteger('BuyPrice');
     275    $Desc->AddInteger('VAT');
     276    $Desc->AddInteger('Consumption');
     277    $Desc->AddReference('Supplier', 'Subject');
     278    $Desc->AddReference('UnitOfMeasure', 'UnitOfMeasure');
     279    $Desc->AddInteger('StockMinCount');
     280    return $Desc;
     281  }
     282}
     283
     284class StockSerialNumber extends Model
     285{
     286  static function GetDesc(): ModelDesc
     287  {
     288    $Desc = new ModelDesc('StockSerialNumber');
     289    $Desc->AddReference('Stock', 'Stock');
     290    $Desc->AddReference('Product', 'Product');
     291    $Desc->AddDate('TimeEnlistment');
     292    $Desc->AddDate('TimeElimination');
     293    $Desc->AddInteger('SellPrice');
     294    $Desc->AddInteger('BuyPrice');
     295    $Desc->AddInteger('Amount');
     296    $Desc->AddString('SerialNumber');
     297    $Desc->AddString('RegNumber');
     298    $Desc->AddReference('Location', 'Member');
     299    $Desc->AddReference('Esemble', 'StockSerialNumber');
     300    return $Desc;
     301  }
     302}
     303
     304class Stock extends Model
     305{
     306  static function GetDesc(): ModelDesc
     307  {
     308    $Desc = new ModelDesc('Stock');
     309    $Desc->AddReference('Location', 'Member');
     310    return $Desc;
     311  }
     312}
     313
     314class StockMove extends Model
     315{
     316  static function GetDesc(): ModelDesc
     317  {
     318    $Desc = new ModelDesc('StockMove');
     319    $Desc->AddReference('Group', 'StockMoveGroup');
     320    $Desc->AddDateTime('Time');
     321    $Desc->AddReference('Stock', 'Stock');
     322    $Desc->AddReference('File', 'File');
     323    return $Desc;
     324  }
     325}
     326
     327class StockMoveItem extends Model
     328{
     329  static function GetDesc(): ModelDesc
     330  {
     331    $Desc = new ModelDesc('StockMoveItem');
     332    $Desc->AddReference('StockMove', 'StockMove');
     333    $Desc->AddReference('Product', 'Product');
     334    $Desc->AddInteger('UnitPrice');
     335    $Desc->AddInteger('Amount');
     336    return $Desc;
     337  }
     338}
     339
     340class StockMoveGroup extends Model
     341{
     342  static function GetDesc(): ModelDesc
     343  {
     344    $Desc = new ModelDesc('StockMoveGroup');
     345    $Desc->AddString('Name');
     346    $Desc->AddReference('DocumentLine', 'DocumentLine');
     347    $Desc->AddInteger('ValueSign');
     348    $Desc->AddInteger('Direction');
     349    return $Desc;
     350  }
     351}
     352
     353class StockItemHistory extends Model
     354{
     355  static function GetDesc(): ModelDesc
     356  {
     357    $Desc = new ModelDesc('StockItemHistory');
     358    $Desc->AddDateTime('Time');
     359    $Desc->AddReference('StockSerialNumber', 'StockSerialNumber');
     360    $Desc->AddText('Text');
     361    return $Desc;
     362  }
     363}
     364
     365class StockMoveItemSerialRel extends Model
     366{
     367  static function GetDesc(): ModelDesc
     368  {
     369    $Desc = new ModelDesc('StockMoveItemSerialRel');
     370    $Desc->AddReference('StockMoveItem', 'StockMoveItem');
     371    $Desc->AddReference('StockSerialNumber', 'StockSerialNumber');
     372    return $Desc;
     373  }
     374}
Note: See TracChangeset for help on using the changeset viewer.