Changeset 164 for www/finance
- Timestamp:
- Feb 21, 2009, 11:04:42 AM (16 years ago)
- Location:
- www/finance
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
www/finance/clenove.php
r163 r164 11 11 $Finance = $this->System->Modules['Finance']; 12 12 $this->System->Modules['Finance']->RecalculateTariffs(1); 13 if($this->System->Modules['User']->CheckPermission('Finance', 'SubjectList')) 13 if(!$this->System->Modules['User']->CheckPermission('Finance', 'SubjectList')) return('Nemáte oprávnění'); 14 15 // Seznam členů 16 $Output = 'Seznam účastníků:<br>'. 17 '<table style="font-size: smaller;" border="1" cellspacing="0" cellpadding="3">'. 18 '<tr><th>JZástupce</th><th>Subjekt</th>'; 19 //<th>Cena za zařízení [Kč]</th> 20 $Output .= '<th>Měsíční poplatek [Kč]</th><th>Stav účtu [Kč]</th><th>Běžící tarif</th><th>Příští tarif</th><th>Poznámky</th></tr>'; 21 $TotalDevice = 0; 22 $TotalMonth = 0; 23 $TotalCash = 0; 24 $DbResult = $this->Database->query('SELECT MonthlyTotal, Cash, Subject.Id, Subject.Name, NetworkDevice, InternetTariffCurrentMonth, InternetTariffNextMonth, CONCAT(User.SecondName, " ", User.FirstName) AS FullName FROM MemberPayment JOIN Member ON Member.Id=MemberPayment.Member JOIN Subject ON Subject.Id=Member.Subject JOIN User ON User.Id=Member.ResponsibleUser ORDER BY FullName'); 25 while($Row = $DbResult->fetch_assoc()) 14 26 { 15 // Seznam členů 16 $Output = 'Seznam účastníků:<br>'. 17 '<table style="font-size: smaller;" border="1" cellspacing="0" cellpadding="3">'. 18 '<tr><th>Jméno</th>'; 19 //<th>Cena za zařízení [Kč]</th> 20 $Output .= '<th>Měsíční poplatek [Kč]</th><th>Stav účtu [Kč]</th><th>Běžící tarif</th><th>Příští tarif</th><th>Poznámky</th></tr>'; 21 $TotalDevice = 0; 22 $TotalMonth = 0; 23 $TotalCash = 0; 24 $DbResult = $this->Database->query('SELECT * FROM MemberPayment JOIN Member ON Member.Id=MemberPayment.Member JOIN Subject ON Subject.Id=Member.Subject ORDER BY Name'); 25 while($Row = $DbResult->fetch_array()) 26 { 27 //$Row['cash'] = $Row['AdvancesIn'] - $Row['AdvancesOut'] + $Row['Liabilities'] - $Row['Claims']; 28 $TotalCash += $Row['Cash']; 29 if($Row['Cash'] < 0) $Row['Cash'] = '<span style="color: red;">'.$Row['Cash'].'</span>'; 30 $Tarif = $Finance->Tarify[$Row['InternetTariffCurrentMonth']]['name']; 31 $PristiTarif = $Finance->Tarify[$Row['InternetTariffNextMonth']]['name']; 32 $Output .= '<tr><td><a href="user_state.php?id='.$Row['Id'].'">'.$Row['Name'].'</a></td>'; 33 //<td align="right">'.$Row['network_device'].'</td> 34 $Output .= '<td align="right">'.$Row['MonthlyTotal'].'</td><td align="right">'.$Row['Cash'].'</td><td align="center">'.$Tarif.'</td><td align="center">'.$PristiTarif.'</td></tr>'; 35 $TotalDevice += $Row['NetworkDevice']; 36 $TotalMonth += ($Row['MonthlyTotal']); 37 } 38 $Output .= '<tr><td><strong>Celkem</strong></td>'; 39 //<td align="right"><strong>'.$TotalDevice.'</strong></td> 40 $Output .= '<td align="right"><strong>'.$TotalMonth.'</strong></td><td align="right"><strong>'.$TotalCash.'</strong></td><td align="right"> </td><td align="right"> </td><td align="right"> </td></tr>'; 41 $Output .= '</table>'; 42 } else $Output = 'Nemáte oprávnění'; 27 //$Row['cash'] = $Row['AdvancesIn'] - $Row['AdvancesOut'] + $Row['Liabilities'] - $Row['Claims']; 28 $TotalCash += $Row['Cash']; 29 if($Row['Cash'] < 0) $Row['Cash'] = '<span style="color: red;">'.$Row['Cash'].'</span>'; 30 $Tarif = $Finance->Tarify[$Row['InternetTariffCurrentMonth']]['name']; 31 $PristiTarif = $Finance->Tarify[$Row['InternetTariffNextMonth']]['name']; 32 $Output .= '<tr><td>'.$Row['FullName'].'</td><td><a href="user_state.php?userid='.$Row['Id'].'">'.$Row['Name'].'</a></td>'; 33 //<td align="right">'.$Row['network_device'].'</td> 34 $Output .= '<td align="right">'.$Row['MonthlyTotal'].'</td><td align="right">'.$Row['Cash'].'</td><td align="center">'.$Tarif.'</td><td align="center">'.$PristiTarif.'</td></tr>'; 35 $TotalDevice += $Row['NetworkDevice']; 36 $TotalMonth += ($Row['MonthlyTotal']); 37 } 38 $Output .= '<tr><td><strong>Celkem</strong></td><td> </td>'; 39 //<td align="right"><strong>'.$TotalDevice.'</strong></td> 40 $Output .= '<td align="right"><strong>'.$TotalMonth.'</strong></td><td align="right"><strong>'.$TotalCash.'</strong></td><td align="right"> </td><td align="right"> </td><td align="right"> </td></tr>'; 41 $Output .= '</table>'; 43 42 return($Output); 44 43 } -
www/finance/finance.php
r163 r164 113 113 114 114 $this->SpravaUsers = $this->InternetUsers; 115 $DbResult = $this->Database->query( "SELECT SUM(consumption) FROM network_segments");115 $DbResult = $this->Database->query('SELECT SUM(consumption) FROM network_segments'); 116 116 $TotalConsumption = $DbResult->fetch_array(); 117 117 $this->TotalConsumption = $TotalConsumption[0]; -
www/finance/manage.php
r157 r164 49 49 break; 50 50 default: 51 $Output = '<a href="?Operation=NewDeviceForm">Přidat nové zařízení</a><br>'; 52 $Output .= '<a href="?Operation=NewDeviceHistoryForm">Přidat nový záznam historie zařízení</a><br>'; 53 $Output .= '<a href="?Operation=NewPaymentForm">Přidat novou platbu</a><br>'; 54 $Output .= '<a href="?Operation=NewInvoiceForm">Přidat novou fakturu</a><br>'; 55 $Output .= '<a href="?Operation=ImportOldData">Importovat stará data</a><br>'; 56 $Output .= '<a href="?Operation=ConvertPDFToFile">Převést data z databáze do souborů</a><br>'; 57 $Output .= '<a href="?Operation=Bills">Správa dokladů</a><br>'; 58 $Output .= '<a href="prepocet.php">Přepočet financí</a><br>'; 51 $Output = '<a href="?Operation=NewDeviceForm">Přidat nové zařízení</a><br />'; 52 $Output .= '<a href="?Operation=NewDeviceHistoryForm">Přidat nový záznam historie zařízení</a><br />'; 53 $Output .= '<a href="?Operation=NewPaymentForm">Přidat novou platbu</a><br />'; 54 $Output .= '<a href="?Operation=NewInvoiceForm">Přidat novou fakturu</a><br />'; 55 $Output .= '<a href="?Operation=ImportOldData">Importovat stará data</a><br />'; 56 $Output .= '<a href="?Operation=ConvertPDFToFile">Převést data z databáze do souborů</a><br />'; 57 $Output .= '<a href="?Operation=Bills">Správa dokladů</a><br />'; 58 $Output .= '<a href="prepocet.php">Přepočet financí</a><br />'; 59 $Output .= '<a href="clenove.php">Seznam subjektů</a><br />'; 60 $Output .= '<a href="zivnost.php">Živnost</a><br />'; 59 61 } 60 62 return($Output); … … 244 246 $Row = $DbResult2->fetch_row(); 245 247 $TotalAdvance = $Row[0]; 246 //echo($User['second_name'].' '.$User['first_name'].' '.$TotalAdvance.'<br >');248 //echo($User['second_name'].' '.$User['first_name'].' '.$TotalAdvance.'<br />'); 247 249 // Záloha 248 250 if($TotalAdvance > 0) … … 254 256 { 255 257 $this->InsertLiability($Subject['Id'], (-$Row[0]), mktime(0, 0, 0, 12, 1, 2007), 0, 'Připojení k síti (z období před daňovou evidencí)'); 256 //echo($Database->LastQuery.'<br >');258 //echo($Database->LastQuery.'<br />'); 257 259 } 258 260 } … … 265 267 while($Operation = $DbResult2->fetch_assoc()) 266 268 { 267 //echo($Operation['comment'].'<br >');269 //echo($Operation['comment'].'<br />'); 268 270 if(substr($Operation['comment'], 0, 19) == 'Poplatek za měsíc') 269 271 { … … 274 276 { 275 277 $this->InsertMoney($Operation['user'], $Operation['money'], 0, 1, MysqlDateToTime($Operation['date']), 'Přijatá záloha'); 276 //echo($Operation['user'].' '.$Operation['money'].' Přijatá záloha<br >');278 //echo($Operation['user'].' '.$Operation['money'].' Přijatá záloha<br />'); 277 279 } else 278 280 if($Operation['comment'] == 'Internet') -
www/finance/prepocet.php
r163 r164 40 40 //if($Row['inet'] == 1) 41 41 $Monthly += $MonthlyInet; 42 $Monthly -= $ ConsumptionPlus;42 $Monthly -= $Finance->W2Kc($ConsumptionPlus); 43 43 //if($Row['overheads'] == 1) $Monthly += $Sprava; // + W2Kc($Consumption); 44 44 //echo($Row['fullname'].' '.$Row['inet'].' '.$Monthly.'<br>'); -
www/finance/zivnost.php
r157 r164 7 7 var $ShortTitle = 'Daňová evidence'; 8 8 9 function TransformFinance()9 /*function TransformFinance() 10 10 { 11 11 //$Database->Query('SELECT user as Subject, date as TimeCreation, date as TimeDue, date as TimePayment, -money as Value, bill_id as Bill, comment as Text FROM `finance_operations` WHERE Comment LIKE "Poplatek za měsíc%" AND date >= "2007-12-01"'); … … 26 26 } 27 27 } 28 } 28 }*/ 29 29 30 30 function Show() … … 156 156 $Output .= '<table style="font-size: smaller;" border="1" cellspacing="0" cellpadding="3">'; 157 157 $Output .= '<tr><th>Čas</th><th>Subjekt</th><th>Text</th><th>Hodnota [Kč]</th><th>Daňový</th><th>Hotovost</th></tr>'; 158 $DbResult = $this->Database->query('SELECT * , CONCAT(users.second_name, " ", users.first_name) as Name FROM FinanceCashFlow JOIN users ON users.id = FinanceCashFlow.Subject ORDER BY Time');158 $DbResult = $this->Database->query('SELECT * FROM FinanceCashFlow JOIN Subject ON Subject.Id = FinanceCashFlow.Subject ORDER BY Time'); 159 159 while($Row = $DbResult->fetch_array()) 160 160 { … … 168 168 $Output .= '<table style="font-size: smaller;" border="1" cellspacing="0" cellpadding="3">'; 169 169 $Output .= '<tr><th>Subjekt</th><th>Text</th><th>Hodnota [Kč]</th><th>Čas vystavení</th><th>Čas splatnosti</th><th>Čas uhrazení</th></tr>'; 170 $DbResult = $this->Database->query('SELECT * , CONCAT(users.second_name, " ", users.first_name) as Name FROM FinanceClaimsLiabilities JOIN users ON users.id = FinanceClaimsLiabilities.Subject WHERE Value > 0 ORDER BY TimeCreation');170 $DbResult = $this->Database->query('SELECT * FROM FinanceClaimsLiabilities JOIN Subject ON Subject.Id = FinanceClaimsLiabilities.Subject WHERE Value > 0 ORDER BY TimeCreation'); 171 171 while($Row = $DbResult->fetch_array()) 172 172 { … … 179 179 $Output .= '<table style="font-size: smaller;" border="1" cellspacing="0" cellpadding="3">'; 180 180 $Output .= '<tr><th>Subjekt</th><th>Text</th><th>Hodnota [Kč]</th><th>Čas vystavení</th><th>Čas splatnosti</th><th>Čas uhrazení</th></tr>'; 181 $DbResult = $this->Database->query('SELECT * , CONCAT(users.second_name, " ", users.first_name) as Name FROM FinanceClaimsLiabilities JOIN users ON users.id = FinanceClaimsLiabilities.Subject WHERE Value < 0 ORDER BY TimeCreation');181 $DbResult = $this->Database->query('SELECT * FROM FinanceClaimsLiabilities JOIN Subject ON Subject.Id = FinanceClaimsLiabilities.Subject WHERE Value < 0 ORDER BY TimeCreation'); 182 182 while($Row = $DbResult->fetch_array()) 183 183 { … … 192 192 $Output .= '<table style="font-size: smaller;" border="1" cellspacing="0" cellpadding="3">'; 193 193 $Output .= '<tr><th>Subjekt</th><th>Hodnota [Kč]</th><th>Čas vystavení</th><th>Čas uzavření</th></tr>'; 194 $DbResult = $this->Database->query('SELECT * , CONCAT(users.second_name, " ", users.first_name) as Name FROM FinanceAdvances JOIN users ON users.id = FinanceAdvances.Subject WHERE Direction = "In" ORDER BY TimeCreation');194 $DbResult = $this->Database->query('SELECT * FROM FinanceAdvances JOIN Subject ON Subject.Id = FinanceAdvances.Subject WHERE Direction = "In" ORDER BY TimeCreation'); 195 195 while($Row = $DbResult->fetch_array()) 196 196 { … … 203 203 $Output .= '<table style="font-size: smaller;" border="1" cellspacing="0" cellpadding="3">'; 204 204 $Output .= '<tr><th>Subjekt</th><th>Hodnota [Kč]</th><th>Čas vystavení</th><th>Čas uzavření</th></tr>'; 205 $DbResult = $this->Database->query('SELECT * , CONCAT(users.second_name, " ", users.first_name) as Name FROM FinanceAdvances JOIN users ON users.id = FinanceAdvances.Subject WHERE Direction = "Out" ORDER BY TimeCreation');205 $DbResult = $this->Database->query('SELECT * FROM FinanceAdvances JOIN Subject ON Subject.Id = FinanceAdvances.Subject WHERE Direction = "Out" ORDER BY TimeCreation'); 206 206 while($Row = $DbResult->fetch_array()) 207 207 { … … 215 215 $Output .= '<table style="font-size: smaller;" border="1" cellspacing="0" cellpadding="3">'; 216 216 $Output .= '<tr><th>Jméno</th><th>Závazky [Kč]</th><th>Pohledávky [Kč]</th><th>Příjmy [Kč]</th><th>Výdaje [Kč]</th><th>Zálohy [Kč]</th><th>Stav účtu</th><th>Starý systém</th></tr>'; 217 $DbResult = $this->Database->query('SELECT id, CONCAT(users.second_name, " ", users.first_name) as Fullname, cash, (SELECT SUM(FinanceClaimsLiabilities.Value) FROM FinanceClaimsLiabilities WHERE FinanceClaimsLiabilities.Subject = users.id AND FinanceClaimsLiabilities.Value > 0) as Claims, (SELECT SUM(FinanceClaimsLiabilities.Value) FROM FinanceClaimsLiabilities WHERE FinanceClaimsLiabilities.Subject = users.id AND FinanceClaimsLiabilities.Value > 0 AND TimePayment IS NULL) as OpenedClaims, (SELECT SUM(FinanceClaimsLiabilities.Value) FROM FinanceClaimsLiabilities WHERE FinanceClaimsLiabilities.Subject = users.id AND FinanceClaimsLiabilities.Value < 0) as Liabilities, (SELECT SUM(FinanceClaimsLiabilities.Value) FROM FinanceClaimsLiabilities WHERE FinanceClaimsLiabilities.Subject = users.id AND FinanceClaimsLiabilities.Value < 0 AND TimePayment IS NULL) as OpenedLiabilities, (SELECT SUM(FinanceCashFlow.Value) FROM FinanceCashFlow WHERE FinanceCashFlow.Subject = users.id AND FinanceCashFlow.Value > 0) as Gains, (SELECT SUM(FinanceCashFlow.Value) FROM FinanceCashFlow WHERE FinanceCashFlow.Subject = users.id AND FinanceCashFlow.Value < 0) as Spends, (SELECT SUM(FinanceAdvances.Value) FROM FinanceAdvances WHERE FinanceAdvances.Subject = users.id AND FinanceAdvances.Direction="In") as AdvancesIn, (SELECT SUM(FinanceAdvances.Value) FROM FinanceAdvances WHERE FinanceAdvances.Subject = users.id AND FinanceAdvances.Direction="Out") as AdvancesOut FROM users ORDER BY fullname');217 $DbResult = $this->Database->query('SELECT Id, Name, 0 AS Cash, (SELECT SUM(FinanceClaimsLiabilities.Value) FROM FinanceClaimsLiabilities WHERE FinanceClaimsLiabilities.Subject = Subject.Id AND FinanceClaimsLiabilities.Value > 0) as Claims, (SELECT SUM(FinanceClaimsLiabilities.Value) FROM FinanceClaimsLiabilities WHERE FinanceClaimsLiabilities.Subject = Subject.Id AND FinanceClaimsLiabilities.Value > 0 AND TimePayment IS NULL) as OpenedClaims, (SELECT SUM(FinanceClaimsLiabilities.Value) FROM FinanceClaimsLiabilities WHERE FinanceClaimsLiabilities.Subject = Subject.Id AND FinanceClaimsLiabilities.Value < 0) as Liabilities, (SELECT SUM(FinanceClaimsLiabilities.Value) FROM FinanceClaimsLiabilities WHERE FinanceClaimsLiabilities.Subject = Subject.Id AND FinanceClaimsLiabilities.Value < 0 AND TimePayment IS NULL) as OpenedLiabilities, (SELECT SUM(FinanceCashFlow.Value) FROM FinanceCashFlow WHERE FinanceCashFlow.Subject = Subject.Id AND FinanceCashFlow.Value > 0) as Gains, (SELECT SUM(FinanceCashFlow.Value) FROM FinanceCashFlow WHERE FinanceCashFlow.Subject = Subject.Id AND FinanceCashFlow.Value < 0) as Spends, (SELECT SUM(FinanceAdvances.Value) FROM FinanceAdvances WHERE FinanceAdvances.Subject = Subject.Id AND FinanceAdvances.Direction="In") as AdvancesIn, (SELECT SUM(FinanceAdvances.Value) FROM FinanceAdvances WHERE FinanceAdvances.Subject = Subject.Id AND FinanceAdvances.Direction="Out") as AdvancesOut FROM Subject ORDER BY Name'); 218 218 while($Row = $DbResult->fetch_array()) 219 219 { 220 220 $Advances = ($Row['AdvancesIn'] - $Row['AdvancesOut']); 221 $Output .= '<tr><td><a href="?table=SubjectAccount&Id='.$Row[' id'].'">'.$Row['Fullname'].'</a></td><td>'.$Row['Liabilities'].'/'.$Row['OpenedLiabilities'].'</td><td>'.$Row['Claims'].'/'.$Row['OpenedClaims'].'</td><td>'.$Row['Gains'].'</td><td>'.$Row['Spends'].'</td><td>'.$Advances.'</td><td>'.($Advances - $Row['OpenedClaims'] + Abs($Row['OpenedLiabilities'])).'</td><td>'.$Row['cash'].'</td></tr>';221 $Output .= '<tr><td><a href="?table=SubjectAccount&Id='.$Row['Id'].'">'.$Row['Name'].'</a></td><td>'.$Row['Liabilities'].'/'.$Row['OpenedLiabilities'].'</td><td>'.$Row['Claims'].'/'.$Row['OpenedClaims'].'</td><td>'.$Row['Gains'].'</td><td>'.$Row['Spends'].'</td><td>'.$Advances.'</td><td>'.($Advances - $Row['OpenedClaims'] + Abs($Row['OpenedLiabilities'])).'</td><td>'.$Row['Cash'].'</td></tr>'; 222 222 } 223 223 $Output .= '</table>'; … … 265 265 $Output .= '</table>'; 266 266 267 $DbResult = $this->Database->query('SELECT id, CONCAT(users.second_name, " ", users.first_name) as Fullname, cash, (SELECT SUM(FinanceClaimsLiabilities.Value) FROM FinanceClaimsLiabilities WHERE FinanceClaimsLiabilities.Subject = users.id AND FinanceClaimsLiabilities.Value > 0) as Claims, (SELECT SUM(FinanceClaimsLiabilities.Value) FROM FinanceClaimsLiabilities WHERE FinanceClaimsLiabilities.Subject = users.id AND FinanceClaimsLiabilities.Value > 0 AND TimePayment IS NULL) as OpenedClaims, (SELECT SUM(FinanceClaimsLiabilities.Value) FROM FinanceClaimsLiabilities WHERE FinanceClaimsLiabilities.Subject = users.id AND FinanceClaimsLiabilities.Value < 0) as Liabilities, (SELECT SUM(FinanceClaimsLiabilities.Value) FROM FinanceClaimsLiabilities WHERE FinanceClaimsLiabilities.Subject = users.id AND FinanceClaimsLiabilities.Value < 0 AND TimePayment IS NULL) as OpenedLiabilities, (SELECT SUM(FinanceCashFlow.Value) FROM FinanceCashFlow WHERE FinanceCashFlow.Subject = users.id AND FinanceCashFlow.Value > 0) as Gains, (SELECT SUM(FinanceCashFlow.Value) FROM FinanceCashFlow WHERE FinanceCashFlow.Subject = users.id AND FinanceCashFlow.Value < 0) as Spends, (SELECT SUM(FinanceAdvances.Value) FROM FinanceAdvances WHERE FinanceAdvances.Subject = users.id AND FinanceAdvances.Direction="In") as AdvancesIn, (SELECT SUM(FinanceAdvances.Value) FROM FinanceAdvances WHERE FinanceAdvances.Subject = users.id AND FinanceAdvances.Direction="Out") as AdvancesOut FROM users WHERE id='.$_GET['Id']);267 $DbResult = $this->Database->query('SELECT Id, 0 AS Cash, (SELECT SUM(FinanceClaimsLiabilities.Value) FROM FinanceClaimsLiabilities WHERE FinanceClaimsLiabilities.Subject = Subject.Id AND FinanceClaimsLiabilities.Value > 0) as Claims, (SELECT SUM(FinanceClaimsLiabilities.Value) FROM FinanceClaimsLiabilities WHERE FinanceClaimsLiabilities.Subject = Subject.Id AND FinanceClaimsLiabilities.Value > 0 AND TimePayment IS NULL) as OpenedClaims, (SELECT SUM(FinanceClaimsLiabilities.Value) FROM FinanceClaimsLiabilities WHERE FinanceClaimsLiabilities.Subject = Subject.Id AND FinanceClaimsLiabilities.Value < 0) as Liabilities, (SELECT SUM(FinanceClaimsLiabilities.Value) FROM FinanceClaimsLiabilities WHERE FinanceClaimsLiabilities.Subject = Subject.Id AND FinanceClaimsLiabilities.Value < 0 AND TimePayment IS NULL) as OpenedLiabilities, (SELECT SUM(FinanceCashFlow.Value) FROM FinanceCashFlow WHERE FinanceCashFlow.Subject = Subject.Id AND FinanceCashFlow.Value > 0) as Gains, (SELECT SUM(FinanceCashFlow.Value) FROM FinanceCashFlow WHERE FinanceCashFlow.Subject = Subject.Id AND FinanceCashFlow.Value < 0) as Spends, (SELECT SUM(FinanceAdvances.Value) FROM FinanceAdvances WHERE FinanceAdvances.Subject = Subject.Id AND FinanceAdvances.Direction="In") as AdvancesIn, (SELECT SUM(FinanceAdvances.Value) FROM FinanceAdvances WHERE FinanceAdvances.Subject = Subject.Id AND FinanceAdvances.Direction="Out") as AdvancesOut FROM Subject WHERE Id='.$_GET['Id']); 268 268 $Row = $DbResult->fetch_array(); 269 269 $Output .= 'Stav placení: '.($Row['AdvancesIn'] - $Row['AdvancesOut'] - $Row['OpenedClaims'] + Abs($Row['OpenedLiabilities']));
Note:
See TracChangeset
for help on using the changeset viewer.