- Timestamp:
- Jan 20, 2012, 3:05:24 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Common/Global.php
r373 r377 61 61 $System = new System($Database); 62 62 $System->Config = &$Config; 63 $System->Install(); 63 64 $System->ReloadList(); 64 65 $System->Install(); … … 375 376 } 376 377 377 GlobalInit(); 378 function ProcessURL() 379 { 380 if(array_key_exists('REDIRECT_QUERY_STRING', $_SERVER)) 381 $PathString = $_SERVER['REDIRECT_QUERY_STRING']; 382 else $PathString = ''; 383 if(substr($PathString, -1, 1) == '/') $PathString = substr($PathString, 0, -1); 384 //echo('"'.$QueryString.'"'); 385 $PathItems = explode('/', $PathString); 386 if(strpos($_SERVER['REQUEST_URI'], '?') !== false) 387 $_SERVER['QUERY_STRING'] = substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], '?') + 1); 388 else $_SERVER['QUERY_STRING'] = ''; 389 parse_str($_SERVER['QUERY_STRING'], $_GET); 390 return($PathItems); 391 } 378 392 379 393 ?> -
trunk/Common/Model.php
r373 r377 31 31 var $Properties; 32 32 var $System; 33 var $Module; 34 var $Installed; 33 35 34 36 function __construct($Database, $System) … … 36 38 $this->Database = &$Database; 37 39 $this->System = &$System; 38 $this->AddPropertyDateTime('TimeCreate'); 39 $this->AddPropertyOneToMany('UserCreate', 'User'); 40 $this->AddPropertyDateTime('TimeModify'); 41 $this->AddPropertyOneToMany('UserModify', 'User'); 42 $this->AddPropertyOneToMany('Module', 'Module'); 43 } 44 45 function AddPropertyDateTime($Name) 46 { 47 $this->Properties[] = array('Name' => $Name, 'Type' => PropertyDateTime); 48 } 49 50 function AddPropertyDate($Name) 51 { 52 $this->Properties[] = array('Name' => $Name, 'Type' => PropertyDate); 53 } 54 55 function AddPropertyTime($Name) 56 { 57 $this->Properties[] = array('Name' => $Name, 'Type' => PropertyTime); 58 } 59 60 function AddPropertyOneToMany($Name, $TargetModel) 61 { 62 $this->Properties[] = array('Name' => $Name, 'Type' => PropertyOneToMany, 'TargetModel' => $TargetModel); 63 } 64 65 function AddPropertyText($Name) 66 { 67 $this->Properties[] = array('Name' => $Name, 'Type' => PropertyText); 68 } 69 70 function AddPropertyText8($Name) 71 { 72 $this->Properties[] = array('Name' => $Name, 'Type' => PropertyText8); 73 } 74 75 function AddPropertyText16($Name) 76 { 77 $this->Properties[] = array('Name' => $Name, 'Type' => PropertyText16); 78 } 79 80 function AddPropertyText24($Name) 81 { 82 $this->Properties[] = array('Name' => $Name, 'Type' => PropertyText24); 83 } 84 85 function AddPropertyText32($Name) 86 { 87 $this->Properties[] = array('Name' => $Name, 'Type' => PropertyText32); 88 } 89 90 function AddPropertyString($Name) 91 { 92 $this->Properties[] = array('Name' => $Name, 'Type' => PropertyString); 93 } 94 95 function AddPropertyInteger($Name) 96 { 97 $this->Properties[] = array('Name' => $Name, 'Type' => PropertyInteger); 98 } 99 100 function AddPropertyInteger8($Name) 101 { 102 $this->Properties[] = array('Name' => $Name, 'Type' => PropertyInteger8); 103 } 104 105 function AddPropertyInteger16($Name) 106 { 107 $this->Properties[] = array('Name' => $Name, 'Type' => PropertyInteger16); 108 } 109 110 function AddPropertyInteger24($Name) 111 { 112 $this->Properties[] = array('Name' => $Name, 'Type' => PropertyInteger24); 113 } 114 115 function AddPropertyInteger32($Name) 116 { 117 $this->Properties[] = array('Name' => $Name, 'Type' => PropertyInteger32); 118 } 119 120 function AddPropertyInteger64($Name) 121 { 122 $this->Properties[] = array('Name' => $Name, 'Type' => PropertyInteger64); 123 } 124 125 function AddPropertyFloat($Name) 126 { 127 $this->Properties[] = array('Name' => $Name, 'Type' => PropertyFloat); 128 } 129 130 function AddPropertyDouble($Name) 131 { 132 $this->Properties[] = array('Name' => $Name, 'Type' => PropertyDouble); 133 } 134 135 function AddPropertyBoolean($Name) 136 { 137 $this->Properties[] = array('Name' => $Name, 'Type' => PropertyBoolean); 40 $this->AddPropertyOneToMany('ItemOwnerModule', 'SystemModule', true); 41 $this->AddPropertyDateTime('ItemTimeCreate', true); 42 $this->AddPropertyOneToMany('ItemUserCreate', 'User', true); 43 $this->AddPropertyDateTime('ItemTimeModify', true); 44 $this->AddPropertyOneToMany('ItemUserModify', 'User', true); 45 } 46 47 function AddPropertyDateTime($Name, $Null = false) 48 { 49 $this->Properties[] = array('Name' => $Name, 'Type' => PropertyDateTime, 50 'Null' => $Null); 51 } 52 53 function AddPropertyDate($Name, $Null = false) 54 { 55 $this->Properties[] = array('Name' => $Name, 'Type' => PropertyDate, 56 'Null' => $Null); 57 } 58 59 function AddPropertyTime($Name, $Null = false) 60 { 61 $this->Properties[] = array('Name' => $Name, 'Type' => PropertyTime, 62 'Null' => $Null); 63 } 64 65 function AddPropertyOneToMany($Name, $TargetModel, $Null = false) 66 { 67 $this->Properties[] = array('Name' => $Name, 'Type' => PropertyOneToMany, 68 'TargetModel' => $TargetModel, 'Null' => $Null); 69 } 70 71 function AddPropertyText($Name, $Null = false) 72 { 73 $this->Properties[] = array('Name' => $Name, 'Type' => PropertyText, 74 'Null' => $Null); 75 } 76 77 function AddPropertyText8($Name, $Null = false) 78 { 79 $this->Properties[] = array('Name' => $Name, 'Type' => PropertyText8, 80 'Null' => $Null); 81 } 82 83 function AddPropertyText16($Name, $Null = false) 84 { 85 $this->Properties[] = array('Name' => $Name, 'Type' => PropertyText16, 86 'Null' => $Null); 87 } 88 89 function AddPropertyText24($Name, $Null = false) 90 { 91 $this->Properties[] = array('Name' => $Name, 'Type' => PropertyText24, 92 'Null' => $Null); 93 } 94 95 function AddPropertyText32($Name, $Null = false) 96 { 97 $this->Properties[] = array('Name' => $Name, 'Type' => PropertyText32, 98 'Null' => $Null); 99 } 100 101 function AddPropertyString($Name, $Null = false) 102 { 103 $this->Properties[] = array('Name' => $Name, 'Type' => PropertyString, 104 'Null' => $Null); 105 } 106 107 function AddPropertyInteger($Name, $Null = false) 108 { 109 $this->Properties[] = array('Name' => $Name, 'Type' => PropertyInteger, 110 'Null' => $Null); 111 } 112 113 function AddPropertyInteger8($Name, $Null = false) 114 { 115 $this->Properties[] = array('Name' => $Name, 'Type' => PropertyInteger8, 116 'Null' => $Null); 117 } 118 119 function AddPropertyInteger16($Name, $Null = false) 120 { 121 $this->Properties[] = array('Name' => $Name, 'Type' => PropertyInteger16, 122 'Null' => $Null); 123 } 124 125 function AddPropertyInteger24($Name, $Null = false) 126 { 127 $this->Properties[] = array('Name' => $Name, 'Type' => PropertyInteger24, 128 'Null' => $Null); 129 } 130 131 function AddPropertyInteger32($Name, $Null = false) 132 { 133 $this->Properties[] = array('Name' => $Name, 'Type' => PropertyInteger32, 134 'Null' => $Null); 135 } 136 137 function AddPropertyInteger64($Name, $Null = false) 138 { 139 $this->Properties[] = array('Name' => $Name, 'Type' => PropertyInteger64, 140 'Null' => $Null); 141 } 142 143 function AddPropertyFloat($Name, $Null = false) 144 { 145 $this->Properties[] = array('Name' => $Name, 'Type' => PropertyFloat, 146 'Null' => $Null); 147 } 148 149 function AddPropertyDouble($Name, $Null = false) 150 { 151 $this->Properties[] = array('Name' => $Name, 'Type' => PropertyDouble, 152 'Null' => $Null); 153 } 154 155 function AddPropertyBoolean($Name, $Null = false) 156 { 157 $this->Properties[] = array('Name' => $Name, 'Type' => PropertyBoolean, 158 'Null' => $Null); 138 159 } 139 160 140 function AddPropertyManyToMany($TargetModel, $Relation, $Colum Own, $ColumnTarget)161 function AddPropertyManyToMany($TargetModel, $Relation, $ColumnOwn, $ColumnTarget, $Null = false) 141 162 { 142 163 $this->Properties[] = array('Type' => PropertyManyToMany, 143 'TargetModel' => $TargetModel, ' Relation' => $Relation, 'ColumnOwn' => $ColumnOwn,144 'ColumnTarget' => $ColumnTarget );164 'TargetModel' => $TargetModel, 'Name' => $Relation, 'ColumnOwn' => $ColumnOwn, 165 'ColumnTarget' => $ColumnTarget, 'Null' => $Null); 145 166 } 146 167 147 168 function Install() 148 169 { 170 if($this->Installed) return; 171 $this->Installed = true; 149 172 $this->Database->insert('SystemModel', array('Name' => $this->Name, 'Module' => $this->Module->Id)); 150 173 $this->Id = $this->Database->insert_id; … … 156 179 $this->Database->insert('SystemModelProperty', array('Name' => $Property['Name'], 157 180 'Model' => $this->Id, 'Type' => $Property['Type'])); 181 if($Property['Null']) $Null = 'NULL'; 182 else $Null = 'NOT NULL'; 158 183 if($Property['Type'] == PropertyDateTime) 159 $Query .= '`'.$Property['Name'].'` DATETIME NOT NULL,';184 $Query .= '`'.$Property['Name'].'` DATETIME '.$Null.','; 160 185 else if($Property['Type'] == PropertyDate) 161 $Query .= '`'.$Property['Name'].'` DATE NOT NULL,';186 $Query .= '`'.$Property['Name'].'` DATE '.$Null.','; 162 187 else if($Property['Type'] == PropertyTime) 163 $Query .= '`'.$Property['Name'].'` TIME NOT NULL,';188 $Query .= '`'.$Property['Name'].'` TIME '.$Null.','; 164 189 else if($Property['Type'] == PropertyString) 165 $Query .= '`'.$Property['Name'].'` VARCHAR(255) COLLATE utf8_general_ci NOT NULL,';190 $Query .= '`'.$Property['Name'].'` VARCHAR(255) COLLATE utf8_general_ci '.$Null.','; 166 191 else if($Property['Type'] == PropertyText8) 167 $Query .= '`'.$Property['Name'].'` TINYTEXT COLLATE utf8_general_ci NOT NULL,';192 $Query .= '`'.$Property['Name'].'` TINYTEXT COLLATE utf8_general_ci '.$Null.','; 168 193 else if($Property['Type'] == PropertyText16) 169 $Query .= '`'.$Property['Name'].'` TEXT COLLATE utf8_general_ci NOT NULL,';194 $Query .= '`'.$Property['Name'].'` TEXT COLLATE utf8_general_ci '.$Null.','; 170 195 else if($Property['Type'] == PropertyText24) 171 $Query .= '`'.$Property['Name'].'` MEDIUMTEXT COLLATE utf8_general_ci NOT NULL,';196 $Query .= '`'.$Property['Name'].'` MEDIUMTEXT COLLATE utf8_general_ci '.$Null.','; 172 197 else if($Property['Type'] == PropertyText32) 173 $Query .= '`'.$Property['Name'].'` LONGTEXT COLLATE utf8_general_ci NOT NULL,';198 $Query .= '`'.$Property['Name'].'` LONGTEXT COLLATE utf8_general_ci '.$Null.','; 174 199 else if($Property['Type'] == PropertyInteger8) 175 $Query .= '`'.$Property['Name'].'` TINYINT(4) NOT NULL,';200 $Query .= '`'.$Property['Name'].'` TINYINT(4) '.$Null.','; 176 201 else if($Property['Type'] == PropertyInteger16) 177 $Query .= '`'.$Property['Name'].'` SMALLINT(6) NOT NULL,';202 $Query .= '`'.$Property['Name'].'` SMALLINT(6) '.$Null.','; 178 203 else if($Property['Type'] == PropertyInteger24) 179 $Query .= '`'.$Property['Name'].'` MEDIUMINT(9) NOT NULL,';204 $Query .= '`'.$Property['Name'].'` MEDIUMINT(9) '.$Null.','; 180 205 else if($Property['Type'] == PropertyInteger32) 181 $Query .= '`'.$Property['Name'].'` INT(11) NOT NULL,';206 $Query .= '`'.$Property['Name'].'` INT(11) '.$Null.','; 182 207 else if($Property['Type'] == PropertyInteger64) 183 $Query .= '`'.$Property['Name'].'` BIGINT(20) NOT NULL,';208 $Query .= '`'.$Property['Name'].'` BIGINT(20) '.$Null.','; 184 209 else if($Property['Type'] == PropertyBoolean) 185 $Query .= '`'.$Property['Name'].'` BOOLEAN NOT NULL,';210 $Query .= '`'.$Property['Name'].'` BOOLEAN '.$Null.','; 186 211 else if($Property['Type'] == PropertyFloat) 187 $Query .= '`'.$Property['Name'].'` FLOAT NOT NULL,';212 $Query .= '`'.$Property['Name'].'` FLOAT '.$Null.','; 188 213 else if($Property['Type'] == PropertyDouble) 189 $Query .= '`'.$Property['Name'].'` DOUBLE NOT NULL,';214 $Query .= '`'.$Property['Name'].'` DOUBLE '.$Null.','; 190 215 else if($Property['Type'] == PropertyOneToMany) 191 $Query .= '`'.$Property['Name'].'` INT(255) NOT NULL,'.216 $Query .= '`'.$Property['Name'].'` INT(255)'.$Null.','. 192 217 'KEY `'.$Property['Name'].'` (`'.$Property['Name'].'`),'; 193 218 else if($Property['Type'] == PropertyManyToMany) ; … … 195 220 //$Query .= '`'.$Property['Name'].'` INT(255) NOT NULL,'. 196 221 // 'KEY `'.$Property['Name'].'` (`'.$Property['Name'].'`),'; 222 197 223 } 198 224 $Query .= 'PRIMARY KEY (`Id`)'. … … 202 228 { 203 229 if($Property['Type'] == PropertyOneToMany) 204 $this->Database->query('ALTER TABLE `'.$this->Name.'` ADD CONSTRAINT '. 205 '`'.$this->Name.'_ibfk_'.$Property['Name'].'` FOREIGN KEY (`'.$Property['TargetModel'].'`) REFERENCES `'.$Property['TargetModel'].'` (`Id`);'); 230 { 231 if(!$this->Module->Models[$Property['TargetModel']]->Installed) 232 $this->Module->Models[$Property['TargetModel']]->Install(); 233 $this->Database->query('ALTER TABLE `'.$this->Name.'` ADD FOREIGN KEY (`'.$Property['Name'].'`) REFERENCES `'.$Property['TargetModel'].'` (`Id`);'); 234 } 206 235 } 207 236 } -
trunk/Common/Module.php
r374 r377 27 27 function Install() 28 28 { 29 if($this->Installed) return; 29 30 DebugLog('Installing module '.$this->Name.'...'); 31 $this->Installed = true; 32 foreach($this->Dependencies as $Dependency) 33 $this->System->Modules[$Dependency]->Install(); 34 $this->LoadModels(); 30 35 foreach($this->Models as $ModelName) 31 36 { 32 $Model = new $ModelName($this->Database, $this->System); 33 $Model->Module = &$this; 34 $Model->Install(); 35 unset($Model); 37 $this->System->Models[$ModelName]->Install(); 36 38 } 37 39 $this->Database->query('UPDATE SystemModule SET Installed=1 WHERE Name="'.$this->Name.'"'); … … 52 54 function Init() 53 55 { 56 if($this->Initialized) return; 54 57 $this->Initialized = true; 55 58 foreach($this->Dependencies as $Dependency) 56 if(!$this->System->Modules[$Dependency]->Initialized) 57 $this->System->Modules[$Dependency]->Init(); 59 $this->System->Modules[$Dependency]->Init(); 60 } 61 62 function LoadModels() 63 { 64 foreach($this->Models as $ModelName) 65 { 66 $this->System->Models[$ModelName] = new $ModelName($this->Database, $this->System); 67 $this->System->Models[$ModelName]->Module = &$this; 68 } 58 69 } 59 70 } … … 75 86 } 76 87 77 function Init($Installed = true)88 function LoadModules($Installed = true) 78 89 { 79 90 $Query = 'SELECT `Id`, `Name` FROM `SystemModule`'; … … 88 99 $this->Modules[$Module['Name']]->Id = $Module['Id']; 89 100 } 101 } 102 103 function Init() 104 { 90 105 foreach($this->Modules as $Index => $Module) 91 106 $this->Modules[$Index]->Init(); … … 103 118 `Installed` int(11) NOT NULL, 104 119 `Description` text COLLATE utf8_czech_ci NOT NULL, 105 `Depende cies` varchar(255) COLLATE utf8_czech_ci NOT NULL,120 `Dependencies` varchar(255) COLLATE utf8_czech_ci NOT NULL, 106 121 PRIMARY KEY (`Id`) 107 122 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1;'); … … 122 137 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1;'); 123 138 $this->ReloadList(); 124 $this-> Init(false);139 $this->LoadModules(false); 125 140 foreach($this->Modules as $Index => $Module) 126 141 { -
trunk/Modules/Finance/Finance.php
r373 r377 83 83 } 84 84 85 class FinanceBillingPeriod extends Model 86 { 87 function __construct($Database, $System) 88 { 89 parent::__construct($Database, $System); 90 $this->Name = 'FinanceBillingPeriod'; 91 $this->AddPropertyString('Name'); 92 $this->AddPropertyInteger('MonthCount'); 93 } 94 } 95 85 96 class FinanceTariff extends Model 86 97 { … … 127 138 $this->AddPropertyString('BillCode'); 128 139 $this->AddPropertyOneToMany('Subject', 'Subject'); 129 $this->AddPropertyDateTime('TimeCreat e');140 $this->AddPropertyDateTime('TimeCreation'); 130 141 $this->AddPropertyDateTime('TimeDue'); 131 142 $this->AddPropertyDateTime('TimePayment'); … … 163 174 $this->AddPropertyFloat('Price'); 164 175 $this->AddPropertyFloat('Quantity'); 176 } 177 } 178 179 class FinanceCharge extends Model 180 { 181 function __construct($Database, $System) 182 { 183 parent::__construct($Database, $System); 184 $this->Name = 'FinanceCharge'; 185 $this->AddPropertyInteger('Period'); 186 $this->AddPropertyInteger('Internet'); 187 $this->AddPropertyInteger('InternetSpeed'); 188 $this->AddPropertyInteger('InternetSpeedReserve'); 189 $this->AddPropertyInteger('AdministrationPerUser'); 190 $this->AddPropertyInteger('kWh'); 191 $this->AddPropertyInteger('BaseSpeedElement'); 192 $this->AddPropertyInteger('BaseTariffPrice'); 193 $this->AddPropertyInteger('TopTariffPrice'); 194 } 195 } 196 197 class FinanceMonthlyOverall extends Model 198 { 199 function __construct($Database, $System) 200 { 201 parent::__construct($Database, $System); 202 $this->Name = 'FinanceMonthlyOverall'; 203 $this->AddPropertyInteger('Money'); 204 $this->AddPropertyDate('Date'); 205 $this->AddPropertyInteger('Administration'); 206 $this->AddPropertyInteger('kWh'); 207 $this->AddPropertyInteger('AdministrationTotal'); 208 $this->AddPropertyInteger('ConsumptionTotal'); 209 $this->AddPropertyInteger('TotalPaid'); 210 $this->AddPropertyInteger('BaseTariffPrice'); 211 $this->AddPropertyInteger('TopTariffPrice'); 212 $this->AddPropertyInteger('MemberCount'); 213 $this->AddPropertyInteger('Investment'); 165 214 } 166 215 } … … 237 286 $this->License = 'GNU/GPL'; 238 287 $this->Description = 'Accounting processing'; 239 $this->Dependencies = array('User' );288 $this->Dependencies = array('User', 'Subject'); 240 289 $this->Models = array('FinanceYear', 'DocumentLine', 'DocumentLineSequence', 241 290 'FinanceTariff', 'FinanceOperation', 'FinanceClaimsLiabilities', 242 'FinanceBills', 'FinanceBillsItems'); 291 'FinanceBills', 'FinanceBillsItems', 'FinanceBillingPeriod', 'FinanceCharge', 292 'FinanceMonthlyOverall'); 243 293 $this->Views = array('FinanceOperation', 'FinanceClaimsLiabilities'); 244 294 } … … 331 381 $this->BillingPeriods[$BillingPeriod['Id']] = $BillingPeriod; 332 382 333 $DbResult = $this->Database->query('SELECT * FROM finance_charge WHERE period='.$Period);383 $DbResult = $this->Database->query('SELECT * FROM FinanceCharge WHERE period='.$Period); 334 384 $Row = $DbResult->fetch_array(); 335 385 $this->kWh = $Row['kWh']; 336 $this->Internet = $Row[' internet'];337 $this->Sprava = $Row[' administration_per_user'];338 $this->RealMaxSpeed = $Row[' internet_speed'];339 $this->SpeedReserve = $Row[' internet_speed_reserve'];340 $this->BaseSpeedElement = $Row[' base_speed_element'];386 $this->Internet = $Row['Internet']; 387 $this->Sprava = $Row['AdministrationPerUser']; 388 $this->RealMaxSpeed = $Row['InternetSpeed']; 389 $this->SpeedReserve = $Row['InternetSpeedReserve']; 390 $this->BaseSpeedElement = $Row['BaseSpeedElement']; 341 391 $this->MaxSpeed = $this->RealMaxSpeed - $this->SpeedReserve; 342 392 $this->TopTariffPrice = $Row['TopTariffPrice']; … … 348 398 349 399 $this->SpravaUsers = $this->InternetUsers; 350 $DbResult = $this->Database->query('SELECT SUM(` consumption`) FROM `network_segments`');400 $DbResult = $this->Database->query('SELECT SUM(`Consumption`) FROM `network_segments`'); 351 401 $TotalConsumption = $DbResult->fetch_array(); 352 402 $this->TotalConsumption = $TotalConsumption[0]; -
trunk/Modules/Finance/FinanceOverview.php
r366 r377 23 23 $Output .= '<br /><strong>Souhrn:</strong><br />'; 24 24 25 $DbResult = $this->Database->query('SELECT * FROM finance_monthly_overall ORDER BY date DESC LIMIT 0,1');25 $DbResult = $this->Database->query('SELECT * FROM FinanceMonthlyOverall ORDER BY Date DESC LIMIT 0,1'); 26 26 $Row = $DbResult->fetch_array(); 27 27 $Output .= 'Platba za internetovou linku ('.$Finance->RealMaxSpeed.'/'.$Finance->RealMaxSpeed.' kbit/s): <strong>'.$Finance->Internet.' Kč</strong><br />'; … … 60 60 $TotalGain = 0; 61 61 $TotalExpense = 0; 62 $DbResult = $this->Database->query('SELECT SUM( consumption) FROM network_devices WHERE used=1');62 $DbResult = $this->Database->query('SELECT SUM(Consumption) FROM network_devices WHERE used=1'); 63 63 $Row = $DbResult->fetch_array(); 64 64 $TotalConsumption = $this->System->Modules['Finance']->W2Kc($Row[0]); -
trunk/Modules/Finance/Manage.php
r375 r377 279 279 280 280 // Načti poslední měsíční přehled a nastavení 281 $DbResult = $this->Database->select(' finance_monthly_overall', '*', '1 ORDER BY date DESC LIMIT 1');281 $DbResult = $this->Database->select('FinanceMonthlyOverall', '*', '1 ORDER BY Date DESC LIMIT 1'); 282 282 $Overall = $DbResult->fetch_array(); 283 283 284 284 $Output -= 'Datum: '.date('j.n.Y').'<br />'; 285 285 286 $Datum = explode('-', $Overall[' date']);286 $Datum = explode('-', $Overall['Date']); 287 287 $Mesic = date('m') + 0; 288 288 … … 359 359 // Update finance charge 360 360 $Output .= 'Měním aktuální parametry sítě...<br>'; 361 $this->Database->delete(' finance_charge', 'period = 0');362 $DbResult = $this->Database->select(' finance_charge', '*', 'period = 1');361 $this->Database->delete('FinanceCharge', 'Period = 0'); 362 $DbResult = $this->Database->select('FinanceCharge', '*', 'Period = 1'); 363 363 $Charge = $DbResult->fetch_assoc(); 364 364 //print_r($Charge); 365 $DbResult = $this->Database->insert('finance_charge', array('period' => 0, 'internet' => $Charge['internet'], 'internet_speed' => $Charge['internet_speed'], 'internet_speed_reserve' => $Charge['internet_speed_reserve'], 'administration_per_user' => $Charge['administration_per_user'], 'kWh' => $Charge['kWh'], 'base_speed_element' => $Charge['base_speed_element'], 'BaseTariffPrice' => $Charge['BaseTariffPrice'], 'TopTariffPrice' => $Charge['TopTariffPrice'])); 365 $DbResult = $this->Database->insert('FinanceCharge', array('Period' => 0, 366 'Internet' => $Charge['Internet'], 'InternetSpeed' => $Charge['InternetSpeed'], 367 'InternetSpeedReserve' => $Charge['InternetSpeedReserve'], 368 'AdministrationPerUser' => $Charge['AdministrationPerUser'], 369 'kWh' => $Charge['kWh'], 'BaseSpeedElement' => $Charge['BaseSpeedElement'], 370 'BaseTariffPrice' => $Charge['BaseTariffPrice'], 'TopTariffPrice' => $Charge['TopTariffPrice'])); 366 371 367 372 $Output .= 'Přidávám měsíční přehled...<br />'; 368 $this->Database->insert('finance_monthly_overall', array('date' => 'NOW()', 'money' => $Finance->Internet, 'kWh' => $Finance->kWh, 'administration' => $Finance->Sprava, 'administration_total' => $SpravaCelkem, 'consumption_total' => $TotalConsumptionCost, 'total_paid' => $Finance->TotalPaid, 'BaseTariffPrice' => $Charge['BaseTariffPrice'], 'TopTariffPrice' => $Charge['TopTariffPrice'], 'member_count' => $Finance->InternetUsers)); 373 $this->Database->insert('FinanceMonthlyOverall', array('Date' => 'NOW()', 374 'Money' => $Finance->Internet, 'kWh' => $Finance->kWh, 375 'Administration' => $Finance->Sprava, 'AdministrationTotal' => $SpravaCelkem, 376 'ConsumptionTotal' => $TotalConsumptionCost, 'TotalPaid' => $Finance->TotalPaid, 377 'BaseTariffPrice' => $Charge['BaseTariffPrice'], 'TopTariffPrice' => $Charge['TopTariffPrice'], 'MemberCount' => $Finance->InternetUsers)); 369 378 370 379 // Update tarrifs -
trunk/Modules/Finance/MonthlyOverall.php
r370 r377 11 11 12 12 $Output = '<table class="WideTable"><tr><th>Rok</th><th>Měsíc</th><th>Internet [Kč]</th><th>Účastníků</th><th>Správa [Kč/účastníka]</th><th>Správa [Kč]</th><th>Spotřeba [Kč/kWh]</th><th>Spotřeba [Kč]</th><th>Obrat [Kč]</th><th>Průměrná cena [Kč/účastníka]</th><th align="center">Investice [Kč]</th></tr>'; 13 $Total = array(' money' => 0, 'administration_total' => 0, 'consumption_total' => 0, 'total_paid' => 0, 'investment' => 0);14 $DbResult = $this->Database->select(' finance_monthly_overall', '*', '1 ORDER BY date DESC');13 $Total = array('Money' => 0, 'AdministrationTotal' => 0, 'ConsumptionTotal' => 0, 'TotalPaid' => 0, 'Investment' => 0); 14 $DbResult = $this->Database->select('FinanceMonthlyOverall', '*', '1 ORDER BY Date DESC'); 15 15 while($Month = $DbResult->fetch_array()) 16 16 { 17 $DateParts = explode('-', $Month['date']); 18 $Output .= '<tr><td>'.$DateParts[0].'</td><td align="center">'.$MonthNames[$DateParts[1] * 1].'</td><td align="center">'.$Month['money'].'</td><td align="center">'.$Month['member_count'].'</td><td align="center">'.$Month['administration'].'</td><td align="center">'.$Month['administration_total'].'</td><td align="center">'.$Month['kWh'].'</td><td align="center">'.$Month['consumption_total'].'</td><td align="center">'.$Month['total_paid'].'</td><td align="center">'.round($Month['total_paid'] / $Month['member_count']).'</td><td align="center">'.$Month['investment'].'</td></tr>'; 17 $DateParts = explode('-', $Month['Date']); 18 $Output .= '<tr><td>'.$DateParts[0].'</td><td align="center">'. 19 $MonthNames[$DateParts[1] * 1].'</td><td align="center">'.$Month['Money']. 20 '</td><td align="center">'.$Month['MemberCount'].'</td><td align="center">'. 21 $Month['Administration'].'</td><td align="center">'.$Month['AdministrationTotal']. 22 '</td><td align="center">'.$Month['kWh'].'</td><td align="center">'. 23 $Month['Consumption_Total'].'</td><td align="center">'.$Month['TotalPaid']. 24 '</td><td align="center">'.round($Month['TotalPaid'] / $Month['MemberCount']). 25 '</td><td align="center">'.$Month['Investment'].'</td></tr>'; 19 26 20 $Total[' money'] += $Month['money'];21 $Total[' administration_total'] += $Month['administration_total'];22 $Total[' consumption_total'] += $Month['consumption_total'];23 $Total[' total_paid'] += $Month['total_paid'];24 $Total['investment'] += $Month['investment'];27 $Total['Money'] += $Month['Money']; 28 $Total['AdministrationTotal'] += $Month['AdministrationTotal']; 29 $Total['ConsumptionTotal'] += $Month['ConsumptionTotal']; 30 $Total['TotalPaid'] += $Month['TotalPaid']; 31 $Total['Investment'] += $Month['Investment']; 25 32 //if($DateParts[1] == '01') echo('<tr><td style="font-size: 4;" colspan="10"> </td></tr>'); 26 33 } 27 $Output .= '<tr><th colspan="2">Celkem</th><th>'.$Total[' money'].'</th><th> </th><th> </th><th>'.$Total['administration_total'].'</th><th> </th><th>'.$Total['consumption_total'].'</th><th>'.$Total['total_paid'].'</th><th> </th><th>'.$Total['investment'].'</th>';34 $Output .= '<tr><th colspan="2">Celkem</th><th>'.$Total['Money'].'</th><th> </th><th> </th><th>'.$Total['AdministrationTotal'].'</th><th> </th><th>'.$Total['ConsumptionTotal'].'</th><th>'.$Total['TotalPaid'].'</th><th> </th><th>'.$Total['Investment'].'</th>'; 28 35 $Output .= '</table>'; 29 36 return($Output); -
trunk/Modules/Network/Network.php
r373 r377 162 162 $this->Title = 'Nový email'; 163 163 $this->SubmitText = 'Odeslat'; 164 AddItemString('Address', 'Adresa', '');165 AddItemString('Subject', 'Předmět', '');166 AddItemText('Content', 'Obsah', '');164 $this->AddItemString('Address', 'Adresa', ''); 165 $this->AddItemString('Subject', 'Předmět', ''); 166 $this->AddItemText('Content', 'Obsah', ''); 167 167 } 168 168 } -
trunk/Modules/NetworkShare/NetworkShare.php
r362 r377 12 12 $this->Name = 'NetworkShareItem'; 13 13 $this->AddPropertyString('Name'); 14 $this->AddPropertyOneToMany('Parent', 'NetworkShareItem s');14 $this->AddPropertyOneToMany('Parent', 'NetworkShareItem'); 15 15 $this->AddPropertyOneToMany('Host', 'NetworkDevice'); 16 16 $this->AddPropertyInteger64('Size'); -
trunk/Modules/Project/Project.php
r364 r377 9 9 $this->AddPropertyDateTime('TimeSchedule'); 10 10 $this->AddPropertyOneToMany('UserAssignedTo', 'User'); 11 $this->AddPropertyManyToOne('Comments', 'ProjectComment', 'Project');12 11 $this->AddPropertyText('Description'); 13 12 } -
trunk/Modules/User/User.php
r376 r377 50 50 $this->AddPropertyDateTime('LastLoginTime'); 51 51 $this->AddPropertyDateTime('RegistrationTime'); 52 $this->AddPropertyOneToMany(' User', 'User');52 $this->AddPropertyOneToMany('Member', 'Member'); 53 53 $this->AddPropertyBoolean('Locked'); 54 54 $this->AddPropertyInteger('ICQ'); -
trunk/index.php
r364 r377 2 2 3 3 include_once('Common/Global.php'); 4 5 function ProcessURL() 6 { 7 if(array_key_exists('REDIRECT_QUERY_STRING', $_SERVER)) 8 $PathString = $_SERVER['REDIRECT_QUERY_STRING']; 9 else $PathString = ''; 10 if(substr($PathString, -1, 1) == '/') $PathString = substr($PathString, 0, -1); 11 //echo('"'.$QueryString.'"'); 12 $PathItems = explode('/', $PathString); 13 if(strpos($_SERVER['REQUEST_URI'], '?') !== false) 14 $_SERVER['QUERY_STRING'] = substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], '?') + 1); 15 else $_SERVER['QUERY_STRING'] = ''; 16 parse_str($_SERVER['QUERY_STRING'], $_GET); 17 return($PathItems); 18 } 4 GlobalInit(); 19 5 20 6 $System->PathItems = ProcessURL();
Note:
See TracChangeset
for help on using the changeset viewer.