Changeset 715
- Timestamp:
- Jan 1, 2015, 2:18:20 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 deleted
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Application/Version.php
r711 r715 1 1 <?php 2 2 3 $Revision = 71 1; // Subversion revision4 $DatabaseRevision = 71 0; // SQL structure revision5 $ReleaseTime = strtotime('201 4-12-29');3 $Revision = 715; // Subversion revision 4 $DatabaseRevision = 715; // SQL structure revision 5 $ReleaseTime = strtotime('2015-01-01'); -
trunk/Common/Setup/Updates.php
r710 r715 993 993 "VALUES (NULL , 'Skladové pohyby', ".$DbRow['Id'].", '".$ActionId."', '1');"); 994 994 } 995 } 996 997 function UpdateTo715($Manager) 998 { 999 $Manager->Execute('ALTER TABLE `StockSerialNumber` DROP FOREIGN KEY `StockSerialNumber_ibfk_6`;'); 1000 $Manager->Execute('ALTER TABLE `StockSerialNumber` DROP `Segment`'); 1001 $Manager->Execute('ALTER TABLE `Member` DROP `NetworkSegment`'); 1002 $Manager->Execute('DROP TABLE `NetworkSegment`'); 995 1003 } 996 1004 … … 1048 1056 696 => array('Revision' => 697, 'Function' => 'UpdateTo697'), 1049 1057 697 => array('Revision' => 707, 'Function' => 'UpdateTo707'), 1050 7 07 => array('Revision' => 710, 'Function' => 'UpdateTo710'),1058 710 => array('Revision' => 715, 'Function' => 'UpdateTo715'), 1051 1059 )); 1052 1060 } -
trunk/Modules/Customer/Customer.php
r711 r715 29 29 'BillingPeriodNext' => array('Type' => 'TFinanceBillingPeriod', 'Caption' => 'Fakturační období příští', 'Default' => ''), 30 30 'BillingPeriodLastDate' => array('Type' => 'Date', 'Caption' => 'Datum poslední fakturace', 'Default' => ''), 31 'NetworkSegment' => array('Type' => 'TNetworkSegment', 'Caption' => 'Úsek sítě', 'Default' => '', 'Null' => true),32 31 'Blocked' => array('Type' => 'Boolean', 'Caption' => 'Blokování', 'Default' => '0'), 33 32 'PayDay' => array('Type' => 'Integer', 'Caption' => 'Den placení', 'Default' => '0', 'Suffix' => 'den'), -
trunk/Modules/Finance/Finance.php
r713 r715 2 2 3 3 include_once(dirname(__FILE__).'/Overview.php'); 4 include_once(dirname(__FILE__).'/Consumption.php');5 include_once(dirname(__FILE__).'/Devices.php');6 4 include_once(dirname(__FILE__).'/Bill.php'); 7 5 include_once(dirname(__FILE__).'/Services.php'); … … 34 32 var $SpeedReserve; 35 33 var $BaseSpeedElement; 36 var $TotalConsumption;37 34 var $UserIdNetwork = 46; 38 35 var $BaseTariffPrice; … … 143 140 $this->SpravaUsers = $this->PayingUsers; 144 141 145 $DbResult = $this->Database->query('SELECT SUM(`Consumption`) FROM `NetworkSegment`');146 $TotalConsumption = $DbResult->fetch_array();147 $this->TotalConsumption = $TotalConsumption[0];148 149 142 $DbResult = $this->Database->query('SELECT SUM(`MemberPayment`.`MonthlyInternet`) AS `MonthlyInternet`, '. 150 143 'SUM(`MemberPayment`.`MonthlyTotal`) AS `MonthlyTotal` '. … … 208 201 $ConsumptionPlus = $DbResult2->fetch_row(); 209 202 $ConsumptionPlus = $ConsumptionPlus[0]; 210 211 $NetworkDevice = 0;212 $Consumption = 0;213 $Id = $Member['NetworkSegment'];214 while(($Id != '') and ($Id != 0))215 {216 $DbResult2 = $this->Database->query('SELECT * FROM `NetworkSegment` WHERE `Id`='.$Id);217 $Device = $DbResult2->fetch_assoc();218 if($Device['Users'] > 0) $NetworkDevice += $Device['Price'] / $Device['Users'];219 if($Device['UsersOverheads'] > 0) $Consumption += $Device['Consumption'] / $Device['UsersOverheads'];220 $Id = $Device['Parent'];221 }222 203 223 204 $DbResult2 = $this->Database->query('SELECT SUM(`Service`.`Price`) AS `Price` '. … … 253 234 } 254 235 255 function RecalculateSegmentParameters()256 {257 $Output = 'Aktualizuji parametry segmentů...<br />';258 $this->Database->query('UPDATE `NetworkSegment` SET `Users` = 0, `UsersOverheads` = 0'); // Vynulovat počty uživatelů259 $DbResult = $this->Database->query('SELECT * FROM `NetworkSegment`');260 while($NetworkSegment = $DbResult->fetch_array())261 {262 $DbResult2 = $this->Database->query('SELECT `Users` FROM `NetworkSegment` WHERE `Id`='.$NetworkSegment['Id']);263 $RowP = $DbResult2->fetch_array();264 $DbResult2 = $this->Database->query('SELECT `UsersOverheads` FROM `NetworkSegment` WHERE `Id`='.$NetworkSegment['Id']);265 $RowP2 = $DbResult2->fetch_array();266 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 $Row2 = $DbResult2->fetch_array();272 $DbResult2 = $this->Database->query('SELECT COUNT(*) FROM Member WHERE NetworkSegment='.$NetworkSegment['Id']);273 $Row3 = $DbResult2->fetch_array();274 $ID = $NetworkSegment['Parent'];275 while($ID != 0)276 {277 $DbResult2 = $this->Database->query('SELECT * FROM NetworkSegment WHERE Id='.$ID);278 $Row4 = $DbResult2->fetch_array();279 $this->Database->update('NetworkSegment', 'Id='.$Row4['Id'],280 array('Users' => ($Row4['Users'] + $Row3[0]), 'UsersOverheads' => ($Row4['UsersOverheads'] + $Row3[0])));281 $ID = $Row4['Parent'];282 }283 $this->Database->update('NetworkSegment', 'Id='.$NetworkSegment['Id'],284 array('Price' => $Row2['Price'], 'Users' => ($Row3[0] + $RowP['Users']), 'Consumption' => $Row2['Consumption'], 'UsersOverheads' => ($Row3[0] + $RowP2['UsersOverheads'])));285 }286 287 // Zkorigovat segment Internet288 $DbResult = $this->Database->select('Member', 'COUNT(*)');289 $Row = $DbResult->fetch_array();290 $DbResult = $this->Database->update('NetworkSegment', 'Id='.$this->InternetSegmentId,291 array('Users' => $Row[0], 'UsersOverheads' => $Row[0]));292 $this->System->ModuleManager->Modules['Log']->NewRecord('Finance', 'RecalculateSegmentParameters');293 return($Output);294 }295 296 236 function GetVATByType($TypeId) 297 237 { … … 331 271 332 272 $this->System->RegisterPage('finance', 'PageFinance'); 333 $this->System->RegisterPage(array('finance', 'spotreba'), 'PageFinanceConsumption');334 $this->System->RegisterPage(array('finance', 'zarizeni'), 'PageFinanceDeviceList');335 273 $this->System->RegisterPage(array('finance', 'sluzby'), 'PageFinanceServices'); 336 274 $this->System->RegisterPage(array('finance', 'mesicni-prehledy'), 'PageFinanceMonthlyOverall'); … … 433 371 'Bank' => array('Type' => 'TFinanceBank', 'Caption' => 'Banka', 'Default' => ''), 434 372 'TimeCreate' => array('Type' => 'Date', 'Caption' => 'Čas vytvoření', 'Default' => ''), 435 'TimeEnd' => array('Type' => 'Date', 'Caption' => 'Čas zrušení', 'Default' => '' ),373 'TimeEnd' => array('Type' => 'Date', 'Caption' => 'Čas zrušení', 'Default' => '', 'Null' => true), 436 374 'Currency' => array('Type' => 'TCurrency', 'Caption' => 'Měna', 'Default' => ''), 437 375 'LoginName' => array('Type' => 'String', 'Caption' => 'Přihlašovací jméno / token', 'Default' => ''), -
trunk/Modules/Finance/Manage.php
r710 r715 18 18 { 19 19 case 'Recalculate': 20 $Output = $this->System->Modules['Finance']->RecalculateSegmentParameters();21 20 $Output .= $this->System->Modules['Finance']->RecalculateMemberPayment(); 22 21 break; … … 226 225 $MonthCurrent = date('m') + 0; 227 226 228 $Output .= $Finance->RecalculateSegmentParameters();229 227 $Output .= $Finance->LoadTariffs(); 230 228 $Output .= $Finance->RecalculateMemberPayment(); … … 236 234 $TotalDeviceCost = $Row[0]; 237 235 $Output .= 'Celková cena zařízení: Zařízení('.$TotalDeviceCost; 238 239 $DbResult = $this->Database->query('SELECT SUM(Price) FROM NetworkSegment');240 $Row = $DbResult->fetch_row();241 $TotalSegmentDeviceCost = $Row[0];242 $Output .= '), Segmenty('.$TotalSegmentDeviceCost;243 236 244 237 $DbResult = $this->Database->query('SELECT SUM(NetworkDevice) FROM MemberPayment'); -
trunk/Modules/Finance/Overview.php
r710 r715 15 15 $Output .= '<a href="'.$this->System->Link('/finance/mesicni-prehledy/').'">Měsíční přehledy</a><br />'; 16 16 $Output .= '<a href="'.$this->System->Link('/finance/sluzby/').'">Přehled nabízených služeb</a><br />'; 17 $Output .= '<a href="'.$this->System->Link('/finance/zarizeni/').'">Výpis zařízení</a><br />';18 17 if($this->System->User->CheckPermission('Finance', 'SubjectList')) 19 18 $Output .= '<a href="'.$this->System->Link('/finance/zakaznici/').'">Seznam zákazníků</a><br />'; 20 $Output .= '<a href="'.$this->System->Link('/finance/spotreba/').'">Spotřeba energie</a><br />';21 19 //$Output .= '<a href="'.$this->System->Config['Web']['RootFolder'].'/aktuality/index.php?category=9">Investice v síti</a><br />'; 22 20 -
trunk/Modules/FinanceBankAPI/ImportFio.php
r628 r715 27 27 if($DbResult->num_rows == 0) 28 28 { 29 $Output .= '<tr>';29 $Output .= '<tr>'; 30 30 $this->Database->insert('FinanceBankImport', array('Time' => TimeToMysqlDate($Record['Date']), 31 31 'BankAccount' => $this->BankAccount['Id'], 'Value' => $Record['Value'], … … 34 34 'Identification' => $Record['ID'], 'AccountNumber' => $Record['OffsetAccount'], 35 35 'BankCode' => $Record['BankCode'], 'Description' => $Record['Type'], 'OffsetAccountName' => $Record['UserIdent'])); 36 $Output .= '<td>'.$Record['OffsetAccount'].'</td>'; 37 $Output .= '<td>'.$Record['BankCode'].'</td>'; 38 $Output .= '<td>'.$Record['UserIdent'].'</td>'; 39 $Output .= '</tr>'; 36 $Output .= '<td>'.$Record['OffsetAccount'].'</td>'; 37 $Output .= '<td>'.$Record['BankCode'].'</td>'; 38 $Output .= '<td>'.$Record['UserIdent'].'</td>'; 39 $Output .= '<td>'.$Record['Value'].'</td>'; 40 $Output .= '</tr>'; 40 41 } 41 42 } 42 43 $Output .= '</table>'; 43 $this->Database->update('FinanceBankAccount', 'Id='.$this->BankAccount['Id'], array('LastImportDate' => TimeToMysqlDate($PeriodEnd))); 44 $this->Database->update('FinanceBankAccount', 'Id='.$this->BankAccount['Id'], 45 array('LastImportDate' => TimeToMysqlDate($PeriodEnd))); 44 46 return($Output); 45 47 } -
trunk/Modules/Network/Network.php
r712 r715 262 262 ), 263 263 )); 264 $this->System->FormManager->RegisterClass('NetworkSegment', array(265 'Title' => 'Úsek sítě',266 'Table' => 'NetworkSegment',267 'Items' => array(268 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),269 'Price' => array('Type' => 'Integer', 'Caption' => 'Cena', 'Default' => '0', 'Suffix' => 'Kč', 'ReadOnly' => true),270 'Parent' => array('Type' => 'TNetworkSegment', 'Caption' => 'Nadřazený', 'Default' => '', 'Null' => true),271 'Users' => array('Type' => 'Integer', 'Caption' => 'Uživatelů', 'Default' => '0', 'ReadOnly' => true),272 'Consumption' => array('Type' => 'Integer', 'Caption' => 'Spotřeba', 'Default' => '0', 'ReadOnly' => true, 'Suffix' => 'Wattů'),273 'UsersOverheads' => array('Type' => 'Integer', 'Caption' => 'Podílníků', 'Default' => '0', 'ReadOnly' => true),274 ),275 ));276 264 $this->System->FormManager->RegisterClass('DeviceAPIType', array( 277 265 'Title' => 'Typ API zařízení', … … 406 394 'Filter' => '1', 407 395 )); 408 $this->System->FormManager->RegisterFormType('TNetworkSegment', array(409 'Type' => 'Reference',410 'Table' => 'NetworkSegment',411 'Id' => 'Id',412 'Name' => 'Name',413 'Filter' => '1',414 ));415 416 396 } 417 397 -
trunk/Modules/Stock/Stock.php
r711 r715 49 49 'RegNumber' => array('Type' => 'String', 'Caption' => 'Evidenční číslo', 'Default' => '', 'Null' => true), 50 50 'Location' => array('Type' => 'TMember', 'Caption' => 'Umístění', 'Default' => '', 'Null' => true), 51 'Segment' => array('Type' => 'TNetworkSegment', 'Caption' => 'Úsek sítě', 'Default' => '', 'Null' => true),52 51 'Info' => array('Type' => 'Text', 'Caption' => 'Informace', 'Default' => ''), 53 52 'Esemble' => array('Type' => 'TStockSerialNumber', 'Caption' => 'Celek', 'Default' => ''),
Note:
See TracChangeset
for help on using the changeset viewer.