Changeset 710 for trunk/Modules
- Timestamp:
- Dec 29, 2014, 12:09:46 AM (10 years ago)
- Location:
- trunk/Modules
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Customer/Customer.php
r645 r710 35 35 'UserRel' => array('Type' => 'TUserCustomerRelListCustomer', 'Caption' => 'Přiřazení uživatelé', 'Default' => ''), 36 36 'ServiceRel' => array('Type' => 'TServiceCustomerRelListCustomer', 'Caption' => 'Placené služby', 'Default' => ''), 37 'Consumption' => array('Type' => 'TCustomerStock Item', 'Caption' => 'Spotřeba zařízení', 'Default' => ''),37 'Consumption' => array('Type' => 'TCustomerStockSerialNumber', 'Caption' => 'Spotřeba zařízení', 'Default' => ''), 38 38 ), 39 39 )); -
trunk/Modules/Finance/Consumption.php
r548 r710 17 17 while($Segment = $DbResult->fetch_assoc()) 18 18 { 19 $DbResult2 = $this->Database->query('SELECT SUM(Product.Consumption) AS Consumption FROM StockItem JOIN Product ON Product.Id = StockItem.Product WHERE (StockItem.Segment='.$Segment['Id'].') AND (StockItem.TimeElimination IS NULL)'); 19 $DbResult2 = $this->Database->query('SELECT SUM(Product.Consumption) AS Consumption FROM StockSerialNumber '. 20 'JOIN Product ON Product.Id = StockSerialNumber.Product WHERE (StockSerialNumber.Segment='.$Segment['Id'].') '. 21 'AND (StockSerialNumber.TimeElimination IS NULL)'); 20 22 $Row2 = $DbResult2->fetch_assoc(); 21 23 $CelkovaSpotreba = $CelkovaSpotreba + $Row2['Consumption']; -
trunk/Modules/Finance/Devices.php
r548 r710 17 17 $Output .= '<tr><td style="text-align: left" colspan="3"><strong>Segment: '.$Segment['Name'].' ('.$Segment['Users'].')</strong></td><td style="font-weight: Bold;" align="right">'.$Segment['Price'].'</td></tr>'; 18 18 $DbResult2 = $this->Database->query('SELECT Product.Consumption AS Consumption, Product.Name AS Name, '. 19 'Stock Item.BuyPrice AS Price, StockItem.TimeEnlistment AS Date '.20 'FROM Stock Item JOIN Product ON Product.Id = StockItem.Product WHERE (StockItem.Segment='.$Segment['Id'].') AND (StockItem.TimeElimination IS NULL)');19 'StockSerialNumber.BuyPrice AS Price, StockSerialNumber.TimeEnlistment AS Date '. 20 'FROM StockSerialNumber JOIN Product ON Product.Id = StockSerialNumber.Product WHERE (StockSerialNumber.Segment='.$Segment['Id'].') AND (StockSerialNumber.TimeElimination IS NULL)'); 21 21 while($Row = $DbResult2->fetch_assoc()) 22 22 { -
trunk/Modules/Finance/Finance.php
r709 r710 203 203 $Cash = $Cash[0]; 204 204 205 $DbResult2 = $this->Database->query('SELECT SUM(`Product`.`Consumption`) * `Stock Item`.`Amount` '.206 'FROM `Stock Item` JOIN `Product` ON `Product`.`Id` = `StockItem`.`Product` '.207 'WHERE (`Stock Item`.`Location` = '.$Member['Id'].') AND (`StockItem`.`TimeElimination` IS NULL)');205 $DbResult2 = $this->Database->query('SELECT SUM(`Product`.`Consumption`) * `StockSerialNumber`.`Amount` '. 206 'FROM `StockSerialNumber` JOIN `Product` ON `Product`.`Id` = `StockSerialNumber`.`Product` '. 207 'WHERE (`StockSerialNumber`.`Location` = '.$Member['Id'].') AND (`StockSerialNumber`.`TimeElimination` IS NULL)'); 208 208 $ConsumptionPlus = $DbResult2->fetch_row(); 209 209 $ConsumptionPlus = $ConsumptionPlus[0]; … … 265 265 $RowP2 = $DbResult2->fetch_array(); 266 266 267 $DbResult2 = $this->Database->query('SELECT SUM(`Product`.`BuyPrice`) * `Stock Item`.`Amount` AS `Price`, '.268 'SUM(`Product`.`Consumption`) * `Stock Item`.`Amount` AS `Consumption` '.269 'FROM `Stock Item` JOIN `Product` ON `Product`.`Id` = `StockItem`.`Product` '.270 'WHERE (`Stock Item`.`Segment`='.$NetworkSegment['Id'].') AND (`StockItem`.`TimeElimination` IS NULL)');267 $DbResult2 = $this->Database->query('SELECT SUM(`Product`.`BuyPrice`) * `StockSerialNumber`.`Amount` AS `Price`, '. 268 'SUM(`Product`.`Consumption`) * `StockSerialNumber`.`Amount` AS `Consumption` '. 269 'FROM `StockSerialNumber` JOIN `Product` ON `Product`.`Id` = `StockSerialNumber`.`Product` '. 270 'WHERE (`StockSerialNumber`.`Segment`='.$NetworkSegment['Id'].') AND (`StockSerialNumber`.`TimeElimination` IS NULL)'); 271 271 $Row2 = $DbResult2->fetch_array(); 272 272 $DbResult2 = $this->Database->query('SELECT COUNT(*) FROM Member WHERE NetworkSegment='.$NetworkSegment['Id']); -
trunk/Modules/Finance/Manage.php
r692 r710 231 231 232 232 // Celkovy prehled 233 $DbResult = $this->Database->query('SELECT SUM(Product.SellPrice) AS Price FROM Stock Item'.234 'JOIN Product ON Stock Item.Product = Product.Id WHERE (StockItem.TimeElimination IS NULL) AND (StockItem.Segment IS NOT NULL)');233 $DbResult = $this->Database->query('SELECT SUM(Product.SellPrice) AS Price FROM StockSerialNumber '. 234 'JOIN Product ON StockSerialNumber.Product = Product.Id WHERE (StockSerialNumber.TimeElimination IS NULL) AND (StockSerialNumber.Segment IS NOT NULL)'); 235 235 $Row = $DbResult->fetch_row(); 236 236 $TotalDeviceCost = $Row[0]; … … 252 252 $Output .= 'Stav pokladny: Členové('.$TotalMemberCash.')'; 253 253 254 $DbResult = $this->Database->query('SELECT SUM(Product.Consumption) AS Consumption FROM StockItem '. 255 'JOIN Product ON StockItem.Product = Product.Id WHERE (StockItem.TimeElimination IS NULL) AND (StockItem.Segment IS NOT NULL)'); 254 $DbResult = $this->Database->query('SELECT SUM(Product.Consumption) AS Consumption FROM StockSerialNumber '. 255 'JOIN Product ON StockSerialNumber.Product = Product.Id WHERE (StockSerialNumber.TimeElimination IS NULL) '. 256 'AND (StockSerialNumber.Segment IS NOT NULL)'); 256 257 $Row = $DbResult->fetch_row(); 257 258 $TotalConsumption = $Row[0]; -
trunk/Modules/Finance/Overview.php
r548 r710 56 56 $TotalGain = 0; 57 57 $TotalExpense = 0; 58 $DbResult = $this->Database->query('SELECT SUM(Product.Consumption) * Stock Item.Amount FROM StockItem'.59 'JOIN Product ON Product.Id=Stock Item.Product WHERE (StockItem.TimeElimination IS NULL)');58 $DbResult = $this->Database->query('SELECT SUM(Product.Consumption) * StockSerialNumber.Amount FROM StockSerialNumber '. 59 'JOIN Product ON Product.Id=StockSerialNumber.Product WHERE (StockSerialNumber.TimeElimination IS NULL)'); 60 60 $Row = $DbResult->fetch_array(); 61 61 $TotalConsumption = $this->System->Modules['Finance']->W2Kc($Row[0]); -
trunk/Modules/Finance/Zivnost.php
r627 r710 43 43 44 44 // SmallAssets 45 $DbResult = $this->Database->query('SELECT SUM(SellPrice) FROM Stock ItemWHERE (TimeEnlistment < "'.TimeToMysqlDateTime($StartTime).'") AND (TimeEnlistment != 0) AND ((TimeElimination > "'.TimeToMysqlDateTime($StartTime).'") OR (TimeElimination IS NULL))');45 $DbResult = $this->Database->query('SELECT SUM(SellPrice) FROM StockSerialNumber WHERE (TimeEnlistment < "'.TimeToMysqlDateTime($StartTime).'") AND (TimeEnlistment != 0) AND ((TimeElimination > "'.TimeToMysqlDateTime($StartTime).'") OR (TimeElimination IS NULL))'); 46 46 //$Output .= $Database->error; 47 47 $Row = $DbResult->fetch_array(); 48 48 $Balance['SmallAssets']['Start'] = $Row[0] + 0; 49 $DbResult = $this->Database->query('SELECT SUM(SellPrice) FROM Stock ItemWHERE (TimeEnlistment < "'.TimeToMysqlDateTime($EndTime).'") AND (TimeEnlistment != 0) AND ((TimeElimination > "'.TimeToMysqlDateTime($EndTime).'") OR (TimeElimination IS NULL))');49 $DbResult = $this->Database->query('SELECT SUM(SellPrice) FROM StockSerialNumber WHERE (TimeEnlistment < "'.TimeToMysqlDateTime($EndTime).'") AND (TimeEnlistment != 0) AND ((TimeElimination > "'.TimeToMysqlDateTime($EndTime).'") OR (TimeElimination IS NULL))'); 50 50 $Row = $DbResult->fetch_array(); 51 51 $Balance['SmallAssets']['End'] = $Row[0] + 0; … … 263 263 $Output .= '<table style="font-size: smaller;" border="1" cellspacing="0" cellpadding="3">'; 264 264 $Output .= '<tr><th>Název</th><th>Hodnota [Kč]</th><th>Datum zakoupení</th><th>Datum vyřezení</th></tr>'; 265 $DbResult = $this->Database->query('SELECT Product.Name AS Name, Stock Item.SellPrice AS Price, StockItem.TimeEnlistment AS TimeEnlistment, StockItem.TimeElimination AS TimeElimination '.266 'FROM Stock Item JOIN Product ON Product.Id = StockItem.Product '.265 $DbResult = $this->Database->query('SELECT Product.Name AS Name, StockSerialNumber.SellPrice AS Price, StockSerialNumber.TimeEnlistment AS TimeEnlistment, StockSerialNumber.TimeElimination AS TimeElimination '. 266 'FROM StockSerialNumber JOIN Product ON Product.Id = StockSerialNumber.Product '. 267 267 'WHERE (TimeElimination IS NOT NULL)'); 268 268 while($Row = $DbResult->fetch_array()) -
trunk/Modules/Stock/Stock.php
r679 r710 30 30 'Code' => array('Type' => 'String', 'Caption' => 'Kód', 'Default' => ''), 31 31 'UnitOfMeasure' => array('Type' => 'TUnitOfMeasure', 'Caption' => 'Měrná jednotka', 'Default' => '', 'Null' => true), 32 'Stock Items' => array('Type' => 'TStockItemListProduct', 'Caption' => 'Položky na skladě', 'Default' => '', 'Suffix' => 'ks'),32 'StockSerialNumbers' => array('Type' => 'TStockSerialNumberListProduct', 'Caption' => 'Položky na skladě', 'Default' => '', 'Suffix' => 'ks'), 33 33 'NetworkDevices' => array('Type' => 'TNetworkDeviceListProduct', 'Caption' => 'Síťová zařízení', 'Default' => ''), 34 34 ), 35 35 )); 36 $this->System->FormManager->RegisterClass('Stock Item', array(36 $this->System->FormManager->RegisterClass('StockSerialNumber', array( 37 37 'Title' => 'Skladové položky', 38 'Table' => 'Stock Item',38 'Table' => 'StockSerialNumber', 39 39 'DefaultSortColumn' => 'Id', 40 40 'Items' => array( … … 51 51 'Segment' => array('Type' => 'TNetworkSegment', 'Caption' => 'Úsek sítě', 'Default' => '', 'Null' => true), 52 52 'Info' => array('Type' => 'Text', 'Caption' => 'Informace', 'Default' => ''), 53 'Esemble' => array('Type' => 'TStock Item', 'Caption' => 'Celek', 'Default' => ''),54 'Parts' => array('Type' => 'TStock ItemListStockItem', 'Caption' => 'Části', 'Default' => ''),53 'Esemble' => array('Type' => 'TStockSerialNumber', 'Caption' => 'Celek', 'Default' => ''), 54 'Parts' => array('Type' => 'TStockSerialNumberListStockSerialNumber', 'Caption' => 'Části', 'Default' => ''), 55 55 ), 56 56 )); … … 62 62 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''), 63 63 'Location' => array('Type' => 'TMember', 'Caption' => 'Umístění', 'Default' => '', 'Null' => true), 64 'Items' => array('Type' => 'TStock ItemListStock', 'Caption' => 'Položky', 'Default' => ''),64 'Items' => array('Type' => 'TStockSerialNumberListStock', 'Caption' => 'Položky', 'Default' => ''), 65 65 'ItemsCount' => array('Type' => 'Integer', 'Caption' => 'Položek', 'Default' => '', 66 'ReadOnly' => true, 'SQL' => '(SELECT COUNT(*) FROM `Stock Item` WHERE '.67 '(`Stock Item`.`Stock`=#Id) AND (`StockItem`.`TimeElimination` IS NULL))'),66 'ReadOnly' => true, 'SQL' => '(SELECT COUNT(*) FROM `StockSerialNumber` WHERE '. 67 '(`StockSerialNumber`.`Stock`=#Id) AND (`StockSerialNumber`.`TimeElimination` IS NULL))'), 68 68 'TotalPrice' => array('Type' => 'Integer', 'Caption' => 'Celková cena', 'Default' => '', 69 'ReadOnly' => true, 'SQL' => '(SELECT SUM(`SellPrice`) FROM `Stock Item` WHERE '.70 '(`Stock Item`.`Stock`=#Id) AND (`StockItem`.`TimeElimination` IS NULL))', 'Suffix' => 'Kč'),69 'ReadOnly' => true, 'SQL' => '(SELECT SUM(`SellPrice`) FROM `StockSerialNumber` WHERE '. 70 '(`StockSerialNumber`.`Stock`=#Id) AND (`StockSerialNumber`.`TimeElimination` IS NULL))', 'Suffix' => 'Kč'), 71 71 ), 72 72 )); 73 $this->System->FormManager->RegisterClass('StockMove', array( 74 'Title' => 'Skladový pohyb', 75 'Table' => 'StockMove', 76 'DefaultSortColumn' => 'Time', 77 'Items' => array( 78 'DocumentLine' => array('Type' => 'TDocumentLine', 'Caption' => 'Dokladová řada', 'Default' => ''), 79 'BillCode' => array('Type' => 'String', 'Caption' => 'Označení', 'Default' => ''), 80 'Time' => array('Type' => 'DateTime', 'Caption' => 'Čas', 'Default' => ''), 81 'StockFrom' => array('Type' => 'TStock', 'Caption' => 'Zdrojový sklad', 'Default' => '', 'Null' => true), 82 'StockTo' => array('Type' => 'TStock', 'Caption' => 'Cílový sklad', 'Default' => '', 'Null' => true), 83 'File' => array('Type' => 'TFile', 'Caption' => 'Doklad', 'Default' => '', 'Null' => true), 84 'Price' => array('Type' => 'Float', 'Caption' => 'Cena', 'Default' => '', 85 'ReadOnly' => true, 'Suffix' => 'Kč', 'SQL' => '(SELECT SUM(`StockMoveItem`.`UnitPrice` * `StockMoveItem`.`Amount`) FROM `StockMoveItem` '. 86 'WHERE `StockMoveItem`.`StockMove`=#Id)'), 87 'Items' => array('Type' => 'TStockMoveItemListStockMove', 'Caption' => 'Položky', 'Default' => ''), 88 ), 89 'BeforeInsert' => array($this, 'BeforeInsertStockMove'), 90 )); 91 $this->System->FormManager->RegisterClass('StockMoveItem', array( 92 'Title' => 'Položka skladového pohybu', 93 'Table' => 'StockMoveItem', 94 'DefaultSortColumn' => 'Text', 95 'Items' => array( 96 'StockMove' => array('Type' => 'TStockMove', 'Caption' => 'Skladový pohyb', 'Default' => ''), 97 'Product' => array('Type' => 'TProduct', 'Caption' => 'Produkt', 'Default' => ''), 98 'Amount' => array('Type' => 'Integer', 'Caption' => 'Množství', 'Default' => '1'), 99 'Text' => array('Type' => 'String', 'Caption' => 'Text', 'Default' => ''), 100 'UnitPrice' => array('Type' => 'Integer', 'Caption' => 'Jednotková cena', 'Default' => '0', 'Suffix' => 'Kč'), 101 ), 102 )); 103 $this->System->FormManager->RegisterFormType('TStockMoveItemListStockMove', array( 104 'Type' => 'ManyToOne', 105 'Table' => 'StockMoveItem', 106 'Id' => 'Id', 107 'Ref' => 'StockMove', 108 'Filter' => '1', 109 )); 110 $this->System->FormManager->RegisterFormType('TStockMove', array( 111 'Type' => 'Reference', 112 'Table' => 'StockMove', 113 'Id' => 'Id', 114 'Name' => 'BillCode', 115 'Filter' => '1', 116 )); 117 } 118 119 function BeforeInsertStockMove($Form) 120 { 121 if(array_key_exists('Time', $Form->Values)) $Year = date("Y", $Form->Values['Time']); 122 else $Year = date("Y", $Form->Values['ValidFrom']); 123 $DocumentLine = $Form->Values['DocumentLine']; 124 $Form->Values['BillCode'] = $this->System->Modules['Finance']->GetNextDocumentLineNumber($DocumentLine, $Year); 125 return($Form->Values); 73 126 } 74 127 }
Note:
See TracChangeset
for help on using the changeset viewer.