Changeset 477 for trunk/finance/manage.php
- Timestamp:
- Jan 1, 2013, 11:01:51 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/finance/manage.php
r458 r477 10 10 function Show() 11 11 { 12 if(!$this->System->Modules['User']->CheckPermission('Finance', 'Manage')) return('Nemáte oprávnění'); 13 14 if(array_key_exists('Operation', $_GET)) $Operation = $_GET['Operation']; else $Operation = ''; 12 if(!$this->System->Modules['User']->CheckPermission('Finance', 'Manage')) 13 return('Nemáte oprávnění'); 14 15 if(array_key_exists('Operation', $_GET)) $Operation = $_GET['Operation']; 16 else $Operation = ''; 15 17 //$Operation = 'ImportOldData'; 16 18 switch($Operation) … … 143 145 } 144 146 145 function InsertLiability($Subject, $Value, $TimeCreation, $TimeDue, $Text, $DocumentLine) 147 function InsertLiability($Subject, $Value, $TimeCreation, $TimeDue, $Text, 148 $DocumentLine, $PeriodFrom, $PeriodTo) 146 149 { 147 150 global $LastInsertTime; 148 151 149 152 $BillCode = $this->System->Modules['Finance']->GetNextDocumentLineNumber($DocumentLine); 150 $this->Database->insert('FinanceClaimsLiabilities', array('Text' => $Text, 'Subject' => $Subject, 'TimeCreation' => TimeToMysqlDateTime($TimeCreation), 'TimeDue' => TimeToMysqlDateTime($TimeDue), 'Value' => $Value, 'BillCode' => $BillCode)); 153 $this->Database->insert('FinanceClaimsLiabilities', array('Text' => $Text, 154 'Subject' => $Subject, 'TimeCreation' => TimeToMysqlDateTime($TimeCreation), 155 'TimeDue' => TimeToMysqlDateTime($TimeDue), 'Value' => $Value, 'BillCode' => $BillCode, 156 'PeriodFrom' => TimeToMysqlDate($PeriodFrom), 'PeriodTo' => TimeToMysqlDate($PeriodTo))); 151 157 $Output = '.'; //$this->Database->LastQuery.'<br />'; 152 158 //$LastInsertTime = $Time; … … 240 246 $Form->LoadvaluesFromForm(); 241 247 //print_r($Form->Values); 242 $this->InsertLiability($Form->Values['Subject'], $Form->Values['Value'], $Form->Values['TimeCreation'], $Form->Values['TimeDue'], $Form->Values['Text'], $Form->Values['DocumentLine']); 248 $this->InsertLiability($Form->Values['Subject'], $Form->Values['Value'], 249 $Form->Values['TimeCreation'], $Form->Values['TimeDue'], $Form->Values['Text'], 250 $Form->Values['DocumentLine'], NULL, NULL); 243 251 $LastId = $this->Database->insert_id; 244 252 $DbResult = $this->Database->select('FinanceClaimsLiabilities', 'BillCode', 'Id='.$LastId); … … 360 368 $Output .= $TimePeriodText.': '.$Member['MonthlyTotal'].' * '.$Period['MonthCount'].' = '.$PayPerPeriod.'<br />'; 361 369 $BillCode = $Finance->GetNextDocumentLineNumber(6); // Faktury vydané 362 $BillId = $this->System->Modules['Bill']->CreateBill($Member['Subject'], array(array('Description' => 'Připojení k Internetu', 'Price' => $PayPerPeriod, 'Quantity' => 1)), time(), time() + 3600 * 24 * 15, $BillCode); 363 $this->Database->insert('FinanceClaimsLiabilities', array('Value' => $PayPerPeriod, 'Subject' => $Member['Subject'], 'TimeCreation' => 'NOW()', 'TimeDue' => 'DATE_ADD(NOW(), INTERVAL 15 DAY)', 'Text' => 'Připojení k Internetu za období '.$TimePeriodText, 'Bill' => $BillId, 'BillCode' => $BillCode)); 370 $BillId = $this->System->Modules['Bill']->CreateBill($Member['Subject'], 371 array(array('Description' => 'Připojení k Internetu', 'Price' => $PayPerPeriod, 372 'Quantity' => 1)), time(), time() + 3600 * 24 * 15, $BillCode, $Period['From'], $Period['To']); 373 $this->Database->insert('FinanceClaimsLiabilities', array('Value' => $PayPerPeriod, 374 'Subject' => $Member['Subject'], 'TimeCreation' => 'NOW()', 375 'TimeDue' => 'DATE_ADD(NOW(), INTERVAL 15 DAY)', 376 'Text' => 'Připojení k Internetu za období '.$TimePeriodText, 377 'Bill' => $BillId, 'BillCode' => $BillCode)); 364 378 $Output .= $this->SendPaymentEmail($Member['Id']); 365 379 $this->Database->update('Member', 'Id='.$Member['Id'], array('BillingPeriodLastDate' => TimeToMysqlDateTime($Period['To']))); … … 453 467 while($Row = $DbResult->fetch_assoc()) 454 468 { 455 $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']); 469 $BillId = $this->System->Modules['Bill']->CreateBill($Row['Subject'], 470 array(array('Description' => $Row['Text'], 'Price' => $Row['Value'], 'Quantity' => 1)), 471 MysqlDateTimeToTime($Row['TimeCreation']), MysqlDateTimeToTime($Row['TimeDue']), 472 $Row['BillCode'], 'invoice', MysqlDateToTime($Row['PeriodFrom']), MysqlDateToTime($Row['PeriodTo'])); 456 473 $this->Database->update('FinanceClaimsLiabilities', 'Id='.$Row['Id'], array('Bill' => $BillId)); 457 474 echo('.');
Note:
See TracChangeset
for help on using the changeset viewer.