- Timestamp:
- Jan 1, 2013, 11:01:51 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Common/Global.php
r476 r477 338 338 function TimeToMysqlDateTime($Time) 339 339 { 340 return(date('Y-m-d H:i:s', $Time)); 340 if($Time == NULL) return(NULL); 341 else return(date('Y-m-d H:i:s', $Time)); 342 } 343 344 function TimeToMysqlDate($Time) 345 { 346 if($Time == NULL) return(NULL); 347 else return(date('Y-m-d', $Time)); 341 348 } 342 349 -
trunk/ToDo.txt
r454 r477 24 24 * API pro napojení jiných systémů 25 25 - Zprovoznit obsluhu stránek přes virtuální URL 26 - Umožnit placení více služeb na jeden účet, fakturu 27 - Udělat fond IP adres, zobrazit jejich užití, umožnit automatické přiřazení volných 28 - Vytvořit třídy pro práci s Mikrotik RouterOS API 26 29 27 30 Hotové -
trunk/config.sample.php
r396 r477 47 47 ( 48 48 'MainUserId' => 1, 49 'MainSubjectId' => 1, 49 50 ), 50 51 'MainRouter' => array -
trunk/finance/bills.php
r396 r477 9 9 function GenerateBill($BillId) 10 10 { 11 global $SpecificSymbol ;11 global $SpecificSymbol, $Config; 12 12 13 $DbResult = $this->Database->select('FinanceBills', '*', ' Id='.$BillId);13 $DbResult = $this->Database->select('FinanceBills', '*', '`Id`='.$BillId); 14 14 $Bill = $DbResult->fetch_assoc(); 15 15 16 $DbResult = $this->Database->select('Subject', '*', ' Id='.$Bill['Subject']);16 $DbResult = $this->Database->select('Subject', '*', '`Id`='.$Bill['Subject']); 17 17 $Subject = $DbResult->fetch_assoc(); 18 19 $DbResult = $this->Database->select('Subject', '*', '`Id`='.$Config['Finance']['MainSubjectId']); 20 $MainSubject = $DbResult->fetch_assoc(); 21 22 $DbResult = $this->Database->select('FinanceBankAccount', '*', '(`Subject`='. 23 $Config['Finance']['MainSubjectId'].') AND (`Use`=1)'); 24 $MainSubjectAccount = $DbResult->fetch_assoc(); 18 25 19 26 $Dodavka = array(); … … 25 32 26 33 $PaymentType = array('převodem', 'hotově'); 34 $BooleanText = array('Ne', 'Ano'); 27 35 28 36 switch($Bill['Type']) … … 33 41 '<hr></td></tr>'. 34 42 '<tr><td valign="top" width="50%"><strong>Dodavatel:</strong><br>'. 35 'Ing. Jiří Hajda<br>'.36 'Zděchov 208<br>'.37 '75607 Zděchov<br>'.38 'IČ: 75904535<br>'.39 'DIČ: CZ8303255884<br>'.40 'Účet: 218098370 / 0300<br>'.41 ' Neplátce DPH<br>'.43 $MainSubject['Name'].'<br>'. 44 $MainSubject['AddressStreet'].'<br>'. 45 $MainSubject['AddressPSC'].' '.$MainSubject['AddressTown'].'<br>'. 46 'IČ: '.$MainSubject['IC'].'<br>'. 47 'DIČ: '.$MainSubject['DIC'].'<br>'. 48 'Účet: '.$MainSubjectAccount['Number'].'<br>'. 49 'Plátce DPH: '.$BooleanText[$MainSubject['PayVAT']].'<br>'. 42 50 '</td><td valign="top">'. 43 51 '<strong>Odběratel:</strong><br>'. … … 62 70 'Datum zdanitel. plnění: '.HumanDate($Bill['TimeCreate']).'<br>'. 63 71 'Datum splatnosti: '.HumanDate($Bill['TimeDue']).'<br>'; 72 if(($Bill['PeriodFrom'] != '') and ($Bill['PeriodTo'] != '')) 73 $Output .= 'Fakturované období: '.HumanDate($Bill['PeriodFrom']).' - '.HumanDate($Bill['PeriodTo']).'<br>'; 64 74 $Output .= '</td></tr>'. 65 75 '<tr><td colspan="2">'. … … 85 95 $Output = '<table width="100%" border="1" cellspacing="0" cellpadding="3"><tr><td width="50%">'. 86 96 '<strong>Firma:</strong><br>'. 87 'Ing. Jiří Hajda<br>'. 88 'Zděchov 208<br>'. 89 '75607 Zděchov<br>'. 90 'IČ: 75904535<br>'. 91 'DIČ: CZ8303255884<br>'. 92 'Účet: 218098370 / 0300<br>'. 93 'Neplátce DPH</td><td width="50%" valign="top">'. 97 $MainSubject['Name'].'<br>'. 98 $MainSubject['AddressStreet'].'<br>'. 99 $MainSubject['AddressPSC'].' '.$MainSubject['AddressTown'].'<br>'. 100 'IČ: '.$MainSubject['IC'].'<br>'. 101 'DIČ: '.$MainSubject['DIC'].'<br>'. 102 'Účet: '.$MainSubjectAccount['Number'].'<br>'. 103 'Plátce DPH: '.$BooleanText[$MainSubject['PayVAT']]. 104 '</td><td width="50%" valign="top">'. 94 105 '<font size="5"><strong>PŘÍJMOVÝ POKLADNÍ DOKLAD</strong></font><br><br>'. 95 106 'Číslo dokladu: '.$Bill['BillCode'].'<br>'. … … 120 131 } 121 132 122 function CreateBill($SubjectId, $Items, $TimeCreate, $TimeDue, $BillCode = '', $Type = 'invoice') 123 { 124 $this->Database->insert('FinanceBills', array('TimeCreate' => TimeToMysqlDateTime($TimeCreate), 'Subject' => $SubjectId, 'TimeDue' => TimeToMysqlDateTime($TimeDue), 'BillCode' => $BillCode, 'Type' => $Type)); 133 function CreateBill($SubjectId, $Items, $TimeCreate, $TimeDue, $BillCode = '', $Type = 'invoice', 134 $PeriodFrom, $PeriodTo) 135 { 136 $this->Database->insert('FinanceBills', array('TimeCreate' => TimeToMysqlDateTime($TimeCreate), 137 'Subject' => $SubjectId, 'TimeDue' => TimeToMysqlDateTime($TimeDue), 138 'BillCode' => $BillCode, 'Type' => $Type, 'PeriodFrom' => TimeToMysqlDate($PeriodFrom), 139 'PeriodTo' => TimeToMysqlDate($PeriodTo))); 125 140 $BillId = $this->Database->insert_id; 126 141 foreach($Items as $Item) 127 142 { 128 $this->Database->insert('FinanceBillsItems', array('Bill' => $BillId, 'Description' => $Item['Description'], 'Price' => $Item['Price'], 'Quantity' => $Item['Quantity'])); 143 $this->Database->insert('FinanceBillsItems', array('Bill' => $BillId, 144 'Description' => $Item['Description'], 'Price' => $Item['Price'], 'Quantity' => $Item['Quantity'])); 129 145 } 130 146 //Header('Content-Type: application/pdf'); -
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.