Changeset 6 for www/finance
- Timestamp:
- Jan 16, 2008, 8:40:08 PM (17 years ago)
- Location:
- www/finance
- Files:
-
- 16 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
www/finance/clenove.php
r4 r6 50 50 '<tr><td><strong>Celkem</strong></td><td><strong>'.($InternetPrice + $PoplatekSprava + $PoplatekSpotreba - $PrijemSpotreba).'</strong></td></tr></table>'); 51 51 //echo('Tarif pro příští měsíc: '.$Tarify[$Row2['inet_tarif_next']]['name'].'<br><br>'); 52 echo('<br>'); 52 53 53 54 // Rozpis ceny za zařízení -
www/finance/faktury/index.php
r4 r6 1 1 <?php 2 include('../../global.php');3 2 include('../../style.php'); 4 3 ShowHeader('Faktury za internet','Faktury'); 5 4 6 5 echo('<table width="100%"><tr><td width="20%" valign="top">'); 6 echo('<a href="?date=internext_smlouva_10Mbit">Internext - smlouva 10 Mbit/s</a><br>'); 7 echo('<a href="?date=faktura_internext_2007-12">Internext Prosinec 2007</a><br>'); 8 echo('<a href="?date=faktura_internext_2007-11">Internext Listopad 2007</a><br>'); 9 echo('<a href="?date=faktura_internext_2007-10">Internext Říjen 2007</a><br>'); 10 echo('<a href="?date=faktura_internext_2007-09">Internext Září 2007</a><br>'); 11 echo('<a href="?date=faktura_internext_2007-08">Internext Srpen 2007</a><br>'); 12 echo('<a href="?date=faktura_internext_2007-07">Internext Červenec 2007</a><br>'); 13 echo('<a href="?date=faktura_internext_2007-06">Internext Červen 2007</a><br>'); 7 14 echo('<a href="?date=faktura_internext_2007-05">Internext Květen 2007</a><br>'); 8 15 echo('<a href="?date=faktura_internext_2007-04">Internext Duben 2007</a><br>'); -
www/finance/include.php
r4 r6 4 4 function RecalculateTariffs($Period = 1) 5 5 { 6 global $Tarify, $MaxSpeed, $Internet, $SpeedElement, $ Database;6 global $Tarify, $MaxSpeed, $Internet, $SpeedElement, $BaseSpeedElement, $Database; 7 7 8 $ResidualPrice = $Internet; 9 $ResidualSpeed = $MaxSpeed; 10 8 11 $Tarify = array(); 9 12 $DbResult = $Database->select('finance_tariffs', '*', 'period='.$Period.' ORDER BY speed_factor'); … … 23 26 $Row = $DbResult->fetch_array(); 24 27 $Tarify[$Index]['user_count'] = $Row[0]; 25 $TotalUserCount = $TotalUserCount + $Tarify[$Index]['user_count']; 26 $Tarify[$Index]['total_units'] = $Tarify[$Index]['price_units'] * $Tarify[$Index]['user_count']; 27 $TotalTarifUnits = $TotalTarifUnits + $Tarify[$Index]['total_units']; 28 switch($Tarif['group_id']) 29 { 30 case 1: 31 $TotalUserCount = $TotalUserCount + $Tarify[$Index]['user_count']; 32 $Tarify[$Index]['total_units'] = $Tarify[$Index]['price_units'] * $Tarify[$Index]['user_count']; 33 $TotalTarifUnits = $TotalTarifUnits + $Tarify[$Index]['total_units']; 28 34 29 if($Index == 3) // Zarizeni site v tarifu 3 neplati penize, ale ma internet 30 $Tarify[$Index]['total_speed_factor'] = $Tarify[$Index]['speed_factor'] * ($Tarify[$Index]['user_count']+1); 31 else $Tarify[$Index]['total_speed_factor'] = $Tarify[$Index]['speed_factor'] * $Tarify[$Index]['user_count']; 32 $TotalTarifSpeedUnits = $TotalTarifSpeedUnits + $Tarify[$Index]['total_speed_factor']; 35 if($Index == 3) // Zarizeni site v tarifu 3 neplati penize, ale ma internet 36 $Tarify[$Index]['total_speed_factor'] = $Tarify[$Index]['speed_factor'] * ($Tarify[$Index]['user_count']+1); 37 else $Tarify[$Index]['total_speed_factor'] = $Tarify[$Index]['speed_factor'] * $Tarify[$Index]['user_count']; 38 $TotalTarifSpeedUnits = $TotalTarifSpeedUnits + $Tarify[$Index]['total_speed_factor']; 39 break; 40 case 2: 41 $ResidualPrice -= $Tarif['price'] * $Tarify[$Index]['user_count']; 42 $ResidualSpeed -= $Tarif['min_speed'] * $Tarify[$Index]['user_count']; 43 $Tarify[$Index]['total_units'] = $Tarify[$Index]['price_units'] * $Tarify[$Index]['user_count']; 44 break; 45 case 3: 46 $Tarify[$Index]['total_units'] = $Tarify[$Index]['price_units'] * $Tarify[$Index]['user_count']; 47 break; 48 } 33 49 } 34 $PricePerUnit = $Internet / $TotalTarifUnits; 35 $SpeedPerUnit = $MaxSpeed * 1024 / $TotalTarifSpeedUnits; 50 $PricePerUnit = $ResidualPrice / $TotalTarifUnits; 51 $SpeedPerUnit = $ResidualSpeed * 1024 / $TotalTarifSpeedUnits; 52 36 53 // Recalculate price 37 $SpeedElement = 256*1024;38 54 foreach($Tarify as $Index => $Tarif) 39 55 { 40 $Tarify[$Index]['price'] = round($Tarif['price_units'] * $PricePerUnit); 41 $Tarify[$Index]['min_speed'] = round($Tarif['speed_factor'] * $SpeedPerUnit); 42 $Tarify[$Index]['max_speed'] = round($Tarify[$Index]['speed_factor'] * $SpeedElement); 56 switch($Tarif['group_id']) 57 { 58 case 1: 59 $Tarify[$Index]['price'] = round($Tarif['price_units'] * $PricePerUnit); 60 $Tarify[$Index]['min_speed'] = round($Tarif['speed_factor'] * $SpeedPerUnit); 61 $Tarify[$Index]['max_speed'] = round($Tarify[$Index]['speed_factor'] * $BaseSpeedElement * 1024); 62 break; 63 case 2: 64 $Tarify[$Index]['min_speed'] = $Tarify[$Index]['min_speed'] * 1024; 65 $Tarify[$Index]['max_speed'] = $Tarify[$Index]['max_speed'] * 1024; 66 break; 67 case 3: 68 $Tarify[$Index]['min_speed'] = $Tarify[$Index]['min_speed'] * 1024; 69 $Tarify[$Index]['max_speed'] = $Tarify[$Index]['max_speed'] * 1024; 70 break; 71 } 43 72 $Tarify[$Index]['aggregation'] = '1:'.round($Tarify[$Index]['max_speed'] / $Tarify[$Index]['min_speed']); 44 //echo($Tarify[$Index]['price'].'<br>');45 73 } 46 74 } … … 49 77 { 50 78 global $kWh, $Internet, $Sprava, $DatumOdecteni, $InternetUsers, $SpravaUsers, $InternetSegmentId, 51 $MaxSpeed, $RealMaxSpeed, $SpeedReserve, $ Database;79 $MaxSpeed, $RealMaxSpeed, $SpeedReserve, $BaseSpeedElement, $Database; 52 80 53 81 $DbResult = $Database->query("SELECT * FROM finance_charge WHERE period=".$Period); … … 58 86 $RealMaxSpeed = $Row['internet_speed']; 59 87 $SpeedReserve = $Row['internet_speed_reserve']; 88 $BaseSpeedElement = $Row['base_speed_element']; 60 89 $MaxSpeed = $RealMaxSpeed - $SpeedReserve; 61 90 -
www/finance/index.php
r4 r6 58 58 $DbResult = $Database->query("SELECT SUM(family) FROM users WHERE role=0"); 59 59 $Row5 = $DbResult->fetch_array(); 60 $TotalFamily = 6 50;60 $TotalFamily = 600; 61 61 echo('V připojených domácnostech celkem <strong>'.$Row5[0].'</strong> občanů ze všech <strong>'.$TotalFamily.'</strong> ('.round($Row5[0]/$TotalFamily*100).' %)<br>'); 62 62 echo('Provizorní bankovní účet kam lze posílát peníze: <strong>86-7755240207/0100</strong><br>'); -
www/finance/prepocet.php
r4 r6 152 152 //print_r($Charge); 153 153 $DbResult = $Database->insert('finance_charge', array('period' => 0, 'internet' => $Charge['internet'], 154 'internet_speed' => $Charge['internet_speed'], 'internet_speed_reserve' => $Charge['internet_speed_reserve'], 155 'administration_per_user' => $Charge['administration_per_user'], 'kWh' => $Charge['kWh'])); 154 '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'])); 156 155 157 156 … … 164 163 { 165 164 $Database->insert('finance_tariffs', array('period' => 0, 'name' => $Tariff['name'], 'id' => $Tariff['id'], 166 'speed_factor' => $Tariff['speed_factor'], 'price_units' => $Tariff['price_units'] ));165 'speed_factor' => $Tariff['speed_factor'], 'price_units' => $Tariff['price_units'], 'group_id' => $Tariff['group_id'], 'min_speed' => $Tariff['min_speed'], 'max_speed' => $Tariff['max_speed'], 'price' => $Tariff['price'])); 167 166 } 168 167 -
www/finance/tarify.php
r4 r6 1 1 <?php 2 include('../global.php');3 2 include('../style.php'); 4 3 include('include.php');
Note:
See TracChangeset
for help on using the changeset viewer.