Changeset 722
- Timestamp:
- Jan 3, 2015, 8:20:29 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Application/FormClasses.php
r720 r722 126 126 'Price' => array('Type' => 'Integer', 'Caption' => 'Cena', 'Default' => '0', 'Suffix' => 'Kč'), 127 127 'VAT' => array('Type' => 'TFinanceVATType', 'Caption' => 'Sazba DPH', 'Default' => '0', 'Suffix' => ''), 128 'CustomerCount' => array('Type' => 'Integer', 'Caption' => 'Počet zákazníků', 'Default' => '', 'ReadOnly' => true), 128 'CustomerCount' => array('Type' => 'Integer', 'Caption' => 'Počet zákazníků', 'Default' => '', 'ReadOnly' => true, 129 'SQL' => '(SELECT COUNT(*) FROM `ServiceCustomerRel` LEFT JOIN `Member` ON `Member`.`Id`=`ServiceCustomerRel`.`Customer` WHERE (`ServiceCustomerRel`.`Service`=#Id) AND (`Member`.`Blocked`=0))'), 129 130 'Public' => array('Type' => 'Boolean', 'Caption' => 'Veřejné', 'Default' => ''), 130 131 'InternetSpeedMin' => array('Type' => 'Integer', 'Caption' => 'Min. rychlost internetu', 'Default' => '0', 'Suffix' => 'kbit/s'), -
trunk/Application/Version.php
r721 r722 1 1 <?php 2 2 3 $Revision = 72 1; // Subversion revision4 $DatabaseRevision = 72 0; // SQL structure revision3 $Revision = 722; // Subversion revision 4 $DatabaseRevision = 722; // SQL structure revision 5 5 $ReleaseTime = strtotime('2015-01-03'); -
trunk/Common/Setup/Updates.php
r720 r722 1122 1122 "VALUES (NULL , 'Vydané', ".$DbRow['Id'].", '".$ActionId."', '1');"); 1123 1123 } 1124 } 1125 1126 function UpdateTo722($Manager) 1127 { 1128 $Manager->Execute('ALTER TABLE `Service` DROP `CustomerCount`;'); 1124 1129 } 1125 1130 … … 1182 1187 718 => array('Revision' => 719, 'Function' => 'UpdateTo719'), 1183 1188 719 => array('Revision' => 720, 'Function' => 'UpdateTo720'), 1189 720 => array('Revision' => 722, 'Function' => 'UpdateTo722'), 1184 1190 )); 1185 1191 } -
trunk/Modules/Finance/Finance.php
r721 r722 51 51 } 52 52 53 function RecalculateTariffs()54 {55 $ResidualSpeed = $this->MaxSpeed * 1000;56 57 $this->LoadTariffs();58 59 $Column = array('Current', 'Next');60 $TotalMemberCount = 0;61 $TotalMaxSpeed = 0;62 foreach($this->Tariffs as $Index => $Tariff)63 {64 $DbResult = $this->Database->query('SELECT COUNT(*) FROM `Member` '.65 'LEFT JOIN `ServiceCustomerRel` ON `ServiceCustomerRel`.`Customer`=`Member`.`Id` '.66 'WHERE (`ServiceCustomerRel`.`Service`='.$Index.') AND (`Member`.`BillingPeriod` > 1) '.67 'AND (`Member`.`Blocked`=0)');68 $Row = $DbResult->fetch_row();69 $this->Tariffs[$Index]['CustomerCount'] = $Row[0];70 $Tariffs['CustomerCount'] = $Row[0];71 72 switch($Tariff['Category'])73 {74 case 1:75 $TotalMemberCount += $Tariff['CustomerCount'];76 $TotalMaxSpeed += $Tariff['InternetSpeedMax'] * $Tariff['CustomerCount'];77 break;78 case 2:79 $ResidualSpeed -= $Tariff['InternetSpeedMin'] * $Tariff['CustomerCount'];80 break;81 case 3:82 break;83 }84 }85 if($TotalMaxSpeed > 0) $Aggregation = $ResidualSpeed / $TotalMaxSpeed;86 else $Aggregation = 1;87 88 // Recalculate price89 foreach($this->Tariffs as $Index => $Tariff)90 {91 switch($Tariff['Category'])92 {93 case 1:94 // Přepočítávání rychlostí koliduje s rozdílovým zapisováním stromu front do mikrotiku.95 // Vždy při změně počtu počítačů či domácností docházelo ke změně minima a přepočtu všeho.96 //$Tariff['InternetSpeedMin'] = round($Tariff['InternetSpeedMax'] * $Aggregation);97 break;98 case 2:99 break;100 case 3:101 break;102 }103 $this->Database->update('Service', 'Id='.$Tariff['Id'],104 array('InternetSpeedMin' => ($Tariff['InternetSpeedMin'] / 1000),105 'CustomerCount' => $Tariff['CustomerCount']));106 }107 $this->LoadTariffs();108 }109 110 53 function LoadMonthParameters($Period = 1) // 0 - now, 1 - next month 111 54 { … … 225 168 } 226 169 $this->System->ModuleManager->Modules['Log']->NewRecord('Finance', 'RecalculateMemberPayment'); 227 $this->RecalculateTariffs(1);228 $this->RecalculateTariffs(0);229 170 return($Output); 230 171 }
Note:
See TracChangeset
for help on using the changeset viewer.