Changeset 643 for trunk/Modules/Finance/Bill.php
- Timestamp:
- Mar 24, 2014, 12:51:15 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Finance/Bill.php
r635 r643 30 30 { 31 31 var $InvoiceId; 32 33 function ShowSubjectInfo($Subject) 34 { 35 $BooleanText = array('Ne', 'Ano'); 36 $Output = $Subject['Name'].'<br>'. 37 $Subject['AddressStreet'].'<br>'. 38 $Subject['AddressPSC'].' '.$Subject['AddressTown'].'<br>'; 39 if($Subject['IC'] != 0) $Output .= 'IČ: '.$Subject['IC'].'<br>'; 40 if($Subject['DIC'] != '') $Output .= 'DIČ: '.$Subject['DIC'].'<br>'; 41 if($Subject['Account'] != '') $Output .= 'Účet: '.$Subject['Account'].'<br>'; 42 if($Subject['PayVAT'] != '') $Output .= 'Plátce DPH: '.$BooleanText[$Subject['PayVAT']].'<br>'; 43 return($Output); 44 } 32 45 33 46 function GenerateHTML() … … 37 50 38 51 $DbResult = $this->Database->select('Subject', '*', '`Id`='.$Invoice['Subject']); 39 $Subject = $DbResult->fetch_assoc(); 52 $SubjectTo = $DbResult->fetch_assoc(); 53 $SubjectTo['Account'] = ''; 54 $SubjectTo['PayVAT'] = ''; 55 $VarSym = $SubjectTo['Id']; 40 56 41 57 $DbResult = $this->Database->select('Subject', '*', '`Id`='.$this->System->Config['Finance']['MainSubjectId']); 42 $ MainSubject= $DbResult->fetch_assoc();58 $SubjectFrom = $DbResult->fetch_assoc(); 43 59 44 60 $DbResult = $this->Database->query('SELECT FinanceBankAccount.*, CONCAT(FinanceBankAccount.Number, "/", FinanceBank.Code) AS NumberFull FROM FinanceBankAccount '. 45 61 'JOIN FinanceBank ON FinanceBank.Id=FinanceBankAccount.Bank '. 46 62 'WHERE (FinanceBankAccount.`Subject`='.$this->System->Config['Finance']['MainSubjectId'].') AND (FinanceBankAccount.`Use`=1)'); 47 $MainSubjectAccount = $DbResult->fetch_assoc(); 63 $SubjectFromAccount = $DbResult->fetch_assoc(); 64 $SubjectFrom['Account'] = $SubjectFromAccount['NumberFull']; 48 65 49 66 $Dodavka = array(); 67 $InvoiceItems = array(); 50 68 $DbResult = $this->Database->select('FinanceInvoiceItem', '*', 'FinanceInvoice='.$this->InvoiceId); 51 69 while($Item = $DbResult->fetch_assoc()) … … 54 72 } 55 73 74 // If negative value => switch sides 75 if($Invoice['Value'] < 0) 76 { 77 $Subject = $SubjectTo; 78 $SubjectTo = $SubjectFrom; 79 $SubjectFrom = $Subject; 80 foreach($InvoiceItems as $Index => $Item) 81 { 82 $InvoiceItems[$Index]['Price'] = -$InvoiceItems[$Index]['Price']; 83 } 84 } 85 56 86 $PaymentType = array('převodem', 'hotově'); 57 87 $BooleanText = array('Ne', 'Ano'); … … 61 91 '<hr></td></tr>'. 62 92 '<tr><td valign="top" width="50%"><strong>Dodavatel:</strong><br>'. 63 $MainSubject['Name'].'<br>'. 64 $MainSubject['AddressStreet'].'<br>'. 65 $MainSubject['AddressPSC'].' '.$MainSubject['AddressTown'].'<br>'. 66 'IČ: '.$MainSubject['IC'].'<br>'. 67 'DIČ: '.$MainSubject['DIC'].'<br>'. 68 'Účet: '.$MainSubjectAccount['NumberFull'].'<br>'. 69 'Plátce DPH: '.$BooleanText[$MainSubject['PayVAT']].'<br>'. 93 $this->ShowSubjectInfo($SubjectFrom). 70 94 '</td><td valign="top">'. 71 95 '<strong>Odběratel:</strong><br>'. 72 $Subject['Name'].'<br>'. 73 $Subject['AddressStreet'].'<br>'. 74 $Subject['AddressPSC'].' '.$Subject['AddressTown'].'<br>'; 75 if($Subject['IC'] != 0) $Output .= 'IČ: '.$Subject['IC'].'<br>'; 76 if($Subject['DIC'] != '') $Output .= 'DIČ: '.$Subject['DIC'].'<br>'; 96 $this->ShowSubjectInfo($SubjectTo); 77 97 $Output .= 78 98 '</td></tr>'. … … 81 101 '<strong>Platební podmínky:</strong><br>'. 82 102 'Číslo dokladu: '.$Invoice['BillCode'].'<br>'. 83 'Variabilní symbol: '.$ Subject['Id'].'<br>'.103 'Variabilní symbol: '.$VarSym.'<br>'. 84 104 'Specifický symbol: '.$this->SpecificSymbol.'<br>'. 85 105 'Konstantní symbol:<br>'.
Note:
See TracChangeset
for help on using the changeset viewer.