Changeset 295 for trunk/finance/manage.php
- Timestamp:
- Oct 2, 2010, 7:40:25 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/finance/manage.php
r294 r295 54 54 case 'MonthlyPayment': 55 55 $Output = $this->ShowMonthlyPayment(); 56 break; 57 case 'GenerateBills': 58 $Output = $this->GenerateBills(); 56 59 break; 57 60 default: … … 68 71 $Output .= '<a href="clenove.php">Seznam členů</a><br />'; 69 72 $Output .= '<a href="zivnost.php">Živnost</a><br />'; 73 $Output .= '<a href="?Operation=GenerateBills">Generovat chybějící doklady</a><br />'; 70 74 } 71 75 return($Output); … … 538 542 $BillCode = $Finance->GetNextDocumentLineNumber(6); // Faktury vydané 539 543 $BillId = $this->System->Modules['Bill']->CreateBill($Member['Subject'], array(array('Description' => 'Připojení k síti', 'Price' => $PayPerPeriod, 'Quantity' => 1)), $Period['From'], $Period['To'], $BillCode); 540 $this->Database->insert('FinanceClaimsLiabilities', array('Value' => $PayPerPeriod, 'Subject' => $Member['Subject'], 'TimeCreation' => 'NOW()', 'T ext' => 'Připojení k síti za období '.$TimePeriodText, 'Bill' => 0, 'BillCode' => $BillCode));544 $this->Database->insert('FinanceClaimsLiabilities', array('Value' => $PayPerPeriod, 'Subject' => $Member['Subject'], 'TimeCreation' => 'NOW()', 'TimeDue' => 'DATE_ADD(NOW(), INTERVAL 15 DAY)', 'Text' => 'Připojení k síti za období '.$TimePeriodText, 'Bill' => 0, 'BillCode' => $BillCode)); 541 545 $Output .= $this->SendPaymentEmail($Member['Id']); 542 546 $this->Database->update('Member', 'Id='.$Member['Id'], array('BillingPeriodLastDate' => TimeToMysqlDateTime($Period['To']))); … … 616 620 } else $Output = 'Uživatel '.$User['Name'].' nemá email.'; 617 621 } 622 623 function GenerateBills() 624 { 625 // FinanceClaimsLiablities 626 $DbResult = $this->Database->query('SELECT * FROM FinanceClaimsLiabilities WHERE (BillCode <> "") AND (Value >= 0)'); 627 while($Row = $DbResult->fetch_assoc()) 628 { 629 $BillId = $this->System->Modules['Bill']->CreateBill($Row['Subject'], array(array('Description' => $Row['Text'], 'Price' => $Row['Value'], 'Quantity' => 1)), MysqlDateTimeToTime($Row['TimeCreation']), MysqlDateTimeToTime($Row['TimeDue']), $Row['BillCode']); 630 $this->Database->update('FinanceClaimsLiabilities', 'Id='.$Row['Id'], array('Bill' => $BillId)); 631 echo('.'); 632 } 633 634 // FinanceOperations 635 } 618 636 } 619 637
Note:
See TracChangeset
for help on using the changeset viewer.