Changeset 165 for www/finance/manage.php
- Timestamp:
- Mar 5, 2009, 10:16:12 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
www/finance/manage.php
r164 r165 47 47 case 'NewInvoiceForm': 48 48 $Output = $this->ShowNewInvoiceForm(); 49 break; 50 case 'ConvertData': 51 $Output = $this->ConvertData(); 49 52 break; 50 53 default: … … 56 59 $Output .= '<a href="?Operation=ConvertPDFToFile">Převést data z databáze do souborů</a><br />'; 57 60 $Output .= '<a href="?Operation=Bills">Správa dokladů</a><br />'; 61 $Output .= '<a href="?Operation=ConvertData">Převést tabulky</a><br />'; 58 62 $Output .= '<a href="prepocet.php">Přepočet financí</a><br />'; 59 63 $Output .= '<a href="clenove.php">Seznam subjektů</a><br />'; … … 356 360 { 357 361 $DbResult = $this->Database->query('SELECT * FROM FinanceBills'); 358 while($Bill = $DbResult->fetch_a rray())362 while($Bill = $DbResult->fetch_assoc()) 359 363 { 360 364 file_put_contents('doklady/doklad_'.$Bill['id'].'.pdf', $Bill['pdf']); … … 365 369 function CheckPDFFiles() 366 370 { 367 global $ Database, $InvoiceGenerator;371 global $InvoiceGenerator; 368 372 369 373 $DbResult = $this->Database->query('SELECT * FROM FinanceBills'); 370 while($Bill = $DbResult->fetch_a rray())374 while($Bill = $DbResult->fetch_assoc()) 371 375 { 372 376 file_put_contents('doklady2/doklad-'.$Bill['id'].'.pdf', file_get_contents('doklady/doklad-'.$Bill['id'].'.pdf')); … … 375 379 } 376 380 381 function ConvertData() 382 { 383 $Output = ''; 384 $this->Database->query('TRUNCATE TABLE FinanceOperation'); 385 386 // Move time of device price transformation 387 $this->Database->query('UPDATE finance_operations SET date="2007-11-30" WHERE comment = "Jednorázový poplatek za společné zařízení"'); 388 389 // Transform old operations 390 $DbResult = $this->Database->query('SELECT * FROM finance_operations WHERE finance_operations.date >= "2007-12-01"'); 391 while($DbRow = $DbResult->fetch_assoc()) 392 { 393 $this->Database->insert('FinanceOperation', array('Id' => $DbRow['id'], 'SourceSubject' => $DbRow['Source'], 'DestinationSubject' => $DbRow['Destination'], 'Value' => abs($DbRow['money']), 'Time' => $DbRow['date'], 'BillCode' => $DbRow['BillCode'], 'Taxable' => $DbRow['Taxable'], 'Text' => $DbRow['comment'], 'Bill' => $DbRow['bill_id'])); 394 $Output .= '.'; 395 } 396 397 // Transfer finance before era 398 $DbResult = $this->Database->query('SELECT * FROM Subject'); 399 while($Subject = $DbResult->fetch_assoc()) 400 { 401 $DbResult2 = $this->Database->query('SELECT SUM(money) as money FROM finance_operations WHERE user='.$Subject['Id'].' AND date < "2007-12-01"'); 402 $DbRow2 = $DbResult2->fetch_assoc(); 403 404 if($DbRow2['money'] > 0) 405 { 406 $DestinationSubject = $Subject['Id']; 407 $SourceSubject = 96; 408 $Comment = 'Přijatá záloha (z období před daňovou evidencí)'; 409 } else 410 { 411 $DestinationSubject = 71; 412 $SourceSubject = $Subject['Id']; 413 $Comment = 'Připojení k síti (z období před daňovou evidencí)'; 414 } 415 $DbRow2['date'] = TimeToMysqlDateTime(mktime(0, 0, 0, 12, 1, 2007)); 416 $this->Database->insert('FinanceOperation', array('SourceSubject' => $SourceSubject, 'DestinationSubject' => $DestinationSubject, 'Value' => abs($DbRow2['money']), 'Time' => $DbRow2['date'], 'Taxable' => 1, 'Text' => $Comment)); 417 $Output .= '#'; 418 } 419 420 return($Output); 421 } 377 422 } 378 423
Note:
See TracChangeset
for help on using the changeset viewer.