Changeset 802 for trunk/Modules/Stock/Stock.php
- Timestamp:
- Feb 23, 2016, 4:44:03 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Stock/Stock.php
r800 r802 16 16 function DoStart() 17 17 { 18 global $Config; 19 18 20 $this->System->FormManager->RegisterClass('Product', array( 19 21 'Title' => 'Produkty', … … 21 23 'DefaultSortColumn' => 'Name', 22 24 'Items' => array( 25 'Manufacturer' => array('Type' => 'TSubject', 'Caption' => 'Výrobce', 'Default' => '', 'Null' => true), 26 'Code' => array('Type' => 'String', 'Caption' => 'Kód', 'Default' => ''), 23 27 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''), 24 28 'SellPrice' => array('Type' => 'Integer', 'Caption' => 'Prodejní cena', 'Default' => '0', 'Suffix' => 'Kč'), … … 27 31 'Consumption' => array('Type' => 'Integer', 'Caption' => 'Spotřeba', 'Default' => '', 'Suffix' => 'Watt'), 28 32 'Supplier' => array('Type' => 'TSubject', 'Caption' => 'Dodavatel', 'Default' => '', 'Null' => true), 29 'Manufacturer' => array('Type' => 'TSubject', 'Caption' => 'Výrobce', 'Default' => '', 'Null' => true),30 'Code' => array('Type' => 'String', 'Caption' => 'Kód', 'Default' => ''),31 33 'UnitOfMeasure' => array('Type' => 'TUnitOfMeasure', 'Caption' => 'Měrná jednotka', 'Default' => '', 'Null' => true), 32 34 'StockSerialNumbers' => array('Type' => 'TStockSerialNumberListProduct', 'Caption' => 'Položky na skladě', 'Default' => '', 'Suffix' => 'ks'), … … 79 81 'DefaultSortColumn' => 'Time', 80 82 'Items' => array( 81 ' DocumentLine' => array('Type' => 'TDocumentLine', 'Caption' => 'Dokladová řada', 'Default' => ''),82 'BillCode' => array('Type' => ' String', 'Caption' => 'Označení', 'Default' => ''),83 'Group' => array('Type' => 'TStockMoveGroup', 'Caption' => 'Skupina', 'Default' => ''), 84 'BillCode' => array('Type' => 'TDocumentLineCode', 'Caption' => 'Označení', 'Default' => '', 'ReadOnly' => true), 83 85 'Time' => array('Type' => 'DateTime', 'Caption' => 'Čas', 'Default' => ''), 84 'StockFrom' => array('Type' => 'TStock', 'Caption' => 'Zdrojový sklad', 'Default' => '', 'Null' => true), 85 'StockTo' => array('Type' => 'TStock', 'Caption' => 'Cílový sklad', 'Default' => '', 'Null' => true), 86 'Stock' => array('Type' => 'TStock', 'Caption' => 'Sklad', 'Default' => '', 'Null' => true), 86 87 'File' => array('Type' => 'TFile', 'Caption' => 'Doklad', 'Default' => '', 'Null' => true), 87 88 'Price' => array('Type' => 'Float', 'Caption' => 'Cena', 'Default' => '', … … 91 92 ), 92 93 'BeforeInsert' => array($this, 'BeforeInsertStockMove'), 93 )); 94 $this->System->FormManager->RegisterClass('StockMoveUnion', array( 95 'Title' => 'Skladový pohyb', 96 'BaseTable' => 'StockMove', 97 'DefaultSortColumn' => 'Time', 98 'SQL' => '(SELECT *, -1 AS `Direction`, `StockFrom` AS `Stock`, `StockTo` AS `StockOther` FROM `StockMove`) '. 99 'UNION (SELECT *, 1 AS `Direction`, `StockTo` AS `Stock`, `StockFrom` AS `StockOther` FROM `StockMove`)', 100 'Items' => array( 101 'DocumentLine' => array('Type' => 'TDocumentLine', 'Caption' => 'Dokladová řada', 'Default' => ''), 102 'BillCode' => array('Type' => 'String', 'Caption' => 'Označení', 'Default' => ''), 103 'Time' => array('Type' => 'DateTime', 'Caption' => 'Čas', 'Default' => ''), 104 'Stock' => array('Type' => 'TStock', 'Caption' => 'První sklad', 'Default' => '', 'Null' => true), 105 'StockOther' => array('Type' => 'TStock', 'Caption' => 'Druhý sklad', 'Default' => '', 'Null' => true), 106 'File' => array('Type' => 'TFile', 'Caption' => 'Doklad', 'Default' => '', 'Null' => true), 107 'Price' => array('Type' => 'Float', 'Caption' => 'Cena', 'Default' => '', 108 'ReadOnly' => true, 'Suffix' => 'Kč', 'SQL' => '(SELECT `TX`.`Direction` * SUM(`StockMoveItem`.`UnitPrice` * `StockMoveItem`.`Amount`) FROM `StockMoveItem` '. 109 'WHERE `StockMoveItem`.`StockMove`=#Id)'), 110 'Items' => array('Type' => 'TStockMoveItemListStockMove', 'Caption' => 'Položky', 'Default' => ''), 111 ), 112 'BeforeInsert' => array($this, 'BeforeInsertStockMove'), 94 //'AfterInsert' => array($this, 'AfterInsertStockMove'), 95 //'BeforeModify' => array($this, 'BeforeModifyStockMove'), 113 96 )); 114 97 $this->System->FormManager->RegisterClass('StockMoveItem', array( 115 98 'Title' => 'Položka skladového pohybu', 116 99 'Table' => 'StockMoveItem', 117 'DefaultSortColumn' => ' Text',100 'DefaultSortColumn' => 'Product', 118 101 'Items' => array( 119 102 'StockMove' => array('Type' => 'TStockMove', 'Caption' => 'Skladový pohyb', 'Default' => ''), 120 103 'Product' => array('Type' => 'TProduct', 'Caption' => 'Produkt', 'Default' => ''), 104 'UnitPrice' => array('Type' => 'Integer', 'Caption' => 'Jednotková cena', 'Default' => '0', 'Suffix' => 'Kč'), 121 105 'Amount' => array('Type' => 'Integer', 'Caption' => 'Množství', 'Default' => '1'), 122 'Text' => array('Type' => 'String', 'Caption' => 'Text', 'Default' => ''), 123 'UnitPrice' => array('Type' => 'Integer', 'Caption' => 'Jednotková cena', 'Default' => '0', 'Suffix' => 'Kč'), 106 'Total' => array('Type' => 'Integer', 'Caption' => 'Celkem', 'Default' => '', 'Suffix' => 'Kč', 107 'ReadOnly' => true, 'SQL' => 'ROUND(`UnitPrice` * `Amount`, '.$Config['Finance']['Rounding'].')'), 108 ), 109 )); 110 $this->System->FormManager->RegisterClass('StockMoveGroup', array( 111 'Title' => 'Skupina skladových pohybů', 112 'Table' => 'StockMoveGroup', 113 'Items' => array( 114 'Name' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => '0'), 115 'DocumentLine' => array('Type' => 'TDocumentLine', 'Caption' => 'Dokladová řada', 'Default' => '0'), 116 'ValueSign' => array('Type' => 'TFinanceValueSign', 'Caption' => 'Znaménko hodnoty', 'Default' => '0'), 117 'Direction' => array('Type' => 'TFinanceDirection', 'Caption' => 'Směr', 'Default' => '0'), 118 'Items' => array('Type' => 'TStockMoveListGroup', 'Caption' => 'Operace', 'Default' => ''), 124 119 ), 125 120 )); … … 148 143 'Filter' => '1', 149 144 )); 145 $this->System->FormManager->RegisterFormType('TStockMoveListGroup', array( 146 'Type' => 'ManyToOne', 147 'Table' => 'StockMove', 148 'Id' => 'Id', 149 'Ref' => 'Group', 150 'Filter' => '1', 151 )); 150 152 $this->System->FormManager->RegisterFormType('TStockMoveStock', array( 151 153 'Type' => 'ManyToOne', 152 'Table' => 'StockMove Union',154 'Table' => 'StockMove', 153 155 'Id' => 'Id', 154 156 'Ref' => 'Stock', … … 159 161 'Table' => 'StockMove', 160 162 'Id' => 'Id', 161 'Name' => ' BillCode',163 'Name' => '(SELECT `DocumentLineCode`.`Name` FROM `DocumentLineCode` WHERE `Id`=`StockMove`.`BillCode`)', 162 164 'Filter' => '1', 163 165 )); … … 172 174 'Type' => 'Reference', 173 175 'Table' => 'Stock', 176 'Id' => 'Id', 177 'Name' => 'Name', 178 'Filter' => '1', 179 )); 180 $this->System->FormManager->RegisterFormType('TStockMoveGroup', array( 181 'Type' => 'Reference', 182 'Table' => 'StockMoveGroup', 174 183 'Id' => 'Id', 175 184 'Name' => 'Name', … … 196 205 if(array_key_exists('Time', $Form->Values)) $Year = date("Y", $Form->Values['Time']); 197 206 else $Year = date("Y", $Form->Values['ValidFrom']); 198 $ DocumentLine = $Form->Values['DocumentLine'];199 $Form->Values['BillCode'] = $this->System->Modules['Finance']->GetNextDocumentLineNumber ($DocumentLine, $Year);207 $Group = $this->System->Modules['Finance']->GetFinanceGroupById($Form->Values['Group'], 'StockMoveGroup'); 208 $Form->Values['BillCode'] = $this->System->Modules['Finance']->GetNextDocumentLineNumberId($Group['DocumentLine'], $Year); 200 209 return($Form->Values); 201 210 }
Note:
See TracChangeset
for help on using the changeset viewer.