Changeset 507 for trunk/finance
- Timestamp:
- Apr 1, 2013, 7:14:59 PM (12 years ago)
- Location:
- trunk/finance
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/finance/finance.php
r497 r507 26 26 var $Tariffs; 27 27 var $ExternalSubject = 96; 28 var $MainSubject = 71;28 var $MainSubject; 29 29 var $BillingPeriods; 30 var $DirectoryId; 30 31 31 32 function LoadTariffs() … … 35 36 while($Tariff = $DbResult->fetch_array()) 36 37 { 37 $Tariff['InternetSpeedMin'] = $Tariff['InternetSpeedMin'] * 10 24;38 $Tariff['InternetSpeedMax'] = $Tariff['InternetSpeedMax'] * 10 24;38 $Tariff['InternetSpeedMin'] = $Tariff['InternetSpeedMin'] * 1000; 39 $Tariff['InternetSpeedMax'] = $Tariff['InternetSpeedMax'] * 1000; 39 40 $this->Tariffs[$Tariff['Id']] = $Tariff; 40 41 } … … 43 44 function RecalculateTariffs() 44 45 { 45 $ResidualSpeed = $this->MaxSpeed * 10 24;46 $ResidualSpeed = $this->MaxSpeed * 1000; 46 47 47 48 $this->LoadTariffs(); … … 92 93 } 93 94 $this->Database->update('Service', 'Id='.$Tariff['Id'], 94 array('InternetSpeedMin' => ($Tariff['InternetSpeedMin'] / 10 24),95 array('InternetSpeedMin' => ($Tariff['InternetSpeedMin'] / 1000), 95 96 'CustomerCount' => $Tariff['CustomerCount'])); 96 97 } … … 211 212 else $MonthlyInet = 0; 212 213 213 //if($Row['inet'] == 1)214 214 $Monthly += $MonthlyInet; 215 215 $Monthly -= $this->W2Kc($ConsumptionPlus); 216 $Monthly -= $Member['Hire'];217 //if($Row['overheads'] == 1) $Monthly += $Sprava; // + W2Kc($Consumption);218 216 $Monthly = round($Monthly); 219 217 -
trunk/finance/manage.php
r505 r507 381 381 } 382 382 $Period = $this->GetBillingPeriod($Member['BillingPeriod']); 383 if(($Period[' From'] > $Member['UNIX_TIMESTAMP(Member.BillingPeriodLastDate)']) and384 ($Member['Blocked'] == 0))383 if(($Period['MonthCount'] > 0) and ($Member['Blocked'] == 0) and 384 ($Period['From'] > $Member['UNIX_TIMESTAMP(Member.BillingPeriodLastDate)'])) 385 385 { 386 386 $InvoiceItems = array(); … … 398 398 $MonthlyTotal += $Service['Price']; 399 399 } 400 if($Member['Hire'] != 0)401 {402 $Output .= '<tr><td>Nájem</td><td>'.(-$Member['Hire']).'</td></tr>';403 $MonthlyTotal -= $Member['Hire'];404 }405 400 if($Member['MonthlyPlus'] != 0) 406 401 { 402 $InvoiceItems[] = array('Description' => 'Spotřeba energie', 'Price' => -$Member['MonthlyPlus'], 403 'Quantity' => $Period['MonthCount'], 'VAT' => 2); 407 404 $MonthlyTotal -= $Member['MonthlyPlus']; 408 405 } … … 610 607 while($Row = $DbResult->fetch_assoc()) 611 608 { 612 $DbResult2 = $this->Database->insert('File', array('Name' => '', 'Size' => 0)); 609 $DbResult2 = $this->Database->insert('File', array('Name' => '', 'Size' => 0, 610 'Directory' => $this->System->Modules['Finance']->DirectoryId, 'Time' => 'NOW()')); 613 611 $FileId = $this->Database->insert_id; 614 612 $FileName = 'doklad-'.$FileId.'.pdf'; … … 617 615 $Bill->System = &$this->System; 618 616 $Bill->InvoiceId = $Row['Id']; 619 $FullFileName = $this->System->Modules['File']-> FilesDir.$FileName;617 $FullFileName = $this->System->Modules['File']->GetDir($this->System->Modules['Finance']->DirectoryId).$FileName; 620 618 $Bill->SaveToFile($FullFileName); 621 $this->Database->update('File', 'Id='.$FileId, array('Name' => $FileName, 'Size' => filesize($FullFileName))); 622 $this->Database->update('FinanceInvoice', 'Id='.$Row['Id'], array('File' => $FileId)); 623 $Output .= '.'; 619 if(file_exists($FullFileName)) 620 { 621 $this->Database->update('File', 'Id='.$FileId, array('Name' => $FileName, 'Size' => filesize($FullFileName))); 622 $this->Database->update('FinanceInvoice', 'Id='.$Row['Id'], array('File' => $FileId)); 623 $Output .= '.'; 624 } else $Output .= 'Soubor "'.$FullFileName.'" se nepodařilo uložit.'; 624 625 } 625 626 -
trunk/finance/tarify.php
r479 r507 25 25 { 26 26 $Tariff['Aggregation'] = '1:'.round($Tariff['InternetSpeedMax'] / $Tariff['InternetSpeedMin']); 27 $Output .= '<tr><td style="color: blue;">'.$Tariff['Name'].'</td><td align="center">'.round($Tariff['InternetSpeedMin'] / 10 24).'</td><td align="center" style="color: blue;">'.round($Tariff['InternetSpeedMax'] / 1024).'</td><td align="center">'.$Tariff['Aggregation'].'</td><td align="center">'.$Tariff['CustomerCount'].'</td><td align="center" style="color: blue;">'.$Tariff['Price'].'</td><td align="center">'.$Tariff['CustomerCount'] * $Tariff['Price'].'</td></tr>';27 $Output .= '<tr><td style="color: blue;">'.$Tariff['Name'].'</td><td align="center">'.round($Tariff['InternetSpeedMin'] / 1000).'</td><td align="center" style="color: blue;">'.round($Tariff['InternetSpeedMax'] / 1000).'</td><td align="center">'.$Tariff['Aggregation'].'</td><td align="center">'.$Tariff['CustomerCount'].'</td><td align="center" style="color: blue;">'.$Tariff['Price'].'</td><td align="center">'.$Tariff['CustomerCount'] * $Tariff['Price'].'</td></tr>'; 28 28 $TotalPrice = $TotalPrice + $Tariff['Price'] * $Tariff['CustomerCount']; 29 29 $TotalMemberCount = $TotalMemberCount + $Tariff['CustomerCount']; -
trunk/finance/user_state.php
r499 r507 85 85 if($Row['Value'] > 0) $Row['Value'] = '+'.$Row['Value']; 86 86 if($Row['BillCode'] == '') $Row['BillCode'] = 'PDF'; 87 if($Row['File'] > 0) $Invoice = '<a href="'.$this->System->Link('/ FileDownload.php?id='.$Row['File']).'">'.$Row['BillCode'].'</a>';87 if($Row['File'] > 0) $Invoice = '<a href="'.$this->System->Link('/file?id='.$Row['File']).'">'.$Row['BillCode'].'</a>'; 88 88 else $Invoice = ' '; 89 89 if($Row['PeriodFrom'] != '') $Period = HumanDate($Row['PeriodFrom']).' - '.HumanDate($Row['PeriodTo']); … … 118 118 } 119 119 120 if($Member['Hire'] != 0)121 {122 $Output .= '<tr><td>Nájem</td><td>'.(-$Member['Hire']).'</td></tr>';123 $Total -= $Member['Hire'];124 }125 120 if($Member['MonthlyPlus'] != 0) 126 121 { -
trunk/finance/zivnost.php
r486 r507 8 8 var $ShortTitle = 'Daňová evidence'; 9 9 var $ExternalSubject = 96; 10 var $MainSubject = 71;11 10 var $StartEvidence = 0; 12 11
Note:
See TracChangeset
for help on using the changeset viewer.