Changeset 680
- Timestamp:
- Jul 27, 2014, 12:28:16 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Application/Version.php
r679 r680 1 1 <?php 2 2 3 $Revision = 6 79; // Subversion revision3 $Revision = 680; // Subversion revision 4 4 $DatabaseRevision = 679; // SQL structure revision 5 $ReleaseTime = strtotime('2014-07-2 6');5 $ReleaseTime = strtotime('2014-07-27'); -
trunk/Modules/Finance/Bill.php
r643 r680 29 29 class BillInvoice extends Bill 30 30 { 31 var $InvoiceId; 32 31 var $InvoiceId; 32 33 33 function ShowSubjectInfo($Subject) 34 34 { … … 48 48 $DbResult = $this->Database->select('FinanceInvoice', '*', '`Id`='.$this->InvoiceId); 49 49 $Invoice = $DbResult->fetch_assoc(); 50 50 51 51 $DbResult = $this->Database->select('Subject', '*', '`Id`='.$Invoice['Subject']); 52 52 $SubjectTo = $DbResult->fetch_assoc(); … … 54 54 $SubjectTo['PayVAT'] = ''; 55 55 $VarSym = $SubjectTo['Id']; 56 56 57 57 $DbResult = $this->Database->select('Subject', '*', '`Id`='.$this->System->Config['Finance']['MainSubjectId']); 58 58 $SubjectFrom = $DbResult->fetch_assoc(); 59 59 60 60 $DbResult = $this->Database->query('SELECT FinanceBankAccount.*, CONCAT(FinanceBankAccount.Number, "/", FinanceBank.Code) AS NumberFull FROM FinanceBankAccount '. 61 61 'JOIN FinanceBank ON FinanceBank.Id=FinanceBankAccount.Bank '. … … 63 63 $SubjectFromAccount = $DbResult->fetch_assoc(); 64 64 $SubjectFrom['Account'] = $SubjectFromAccount['NumberFull']; 65 65 66 66 $Dodavka = array(); 67 67 $InvoiceItems = array(); 68 $DbResult = $this->Database->select('FinanceInvoiceItem', '* ', 'FinanceInvoice='.$this->InvoiceId);68 $DbResult = $this->Database->select('FinanceInvoiceItem', '*, CEIL(`Price` * `Quantity`) AS `Total`', '`FinanceInvoice`='.$this->InvoiceId); 69 69 while($Item = $DbResult->fetch_assoc()) 70 70 { 71 71 $InvoiceItems[$Item['Id']] = $Item; 72 72 } 73 73 74 74 // If negative value => switch sides 75 75 if($Invoice['Value'] < 0) … … 77 77 $Subject = $SubjectTo; 78 78 $SubjectTo = $SubjectFrom; 79 $SubjectFrom = $Subject; 79 $SubjectFrom = $Subject; 80 80 foreach($InvoiceItems as $Index => $Item) 81 81 { … … 83 83 } 84 84 } 85 85 86 86 $PaymentType = array('převodem', 'hotově'); 87 87 $BooleanText = array('Ne', 'Ano'); … … 120 120 '<tr><th align="left">Dodávka</th><th align="right">Množství</th><th align="right">Cena/MJ</th><th align="right">Celkem</th></tr>'. 121 121 '<tr><td colspan="4"><hr></td></tr>'; 122 122 123 123 $Total = 0; 124 124 foreach($InvoiceItems as $Item) … … 126 126 $Output .= '<tr><td>'.$Item['Description'].'</td><td align="right">'. 127 127 $Item['Quantity'].'</td><td align="right">'.$Item['Price']. 128 ' Kč</td><td align="right">'. ($Item['Quantity'] * $Item['Price']).' Kč</td></tr>';129 $Total += ($Item['Quantity'] * $Item['Price']);128 ' Kč</td><td align="right">'.$Item['Total'].' Kč</td></tr>'; 129 $Total += $Item['Total']; 130 130 } 131 131 $Output .= '<tr><th colspan="3" align="left">Celkem</th><th align="right">'.$Total.' Kč</th></tr>'; … … 134 134 '<tr><td colspan="2"><hr></td></tr>'. 135 135 '</table>'; 136 136 137 137 return($Output); 138 138 } … … 141 141 class BillOperation extends Bill 142 142 { 143 var $OperationId; 144 143 var $OperationId; 144 145 145 function GenerateHTML() 146 146 { 147 147 $DbResult = $this->Database->select('FinanceOperation', '*', '`Id`='.$this->OperationId); 148 148 $Operation = $DbResult->fetch_assoc(); 149 149 150 150 $DbResult = $this->Database->select('Subject', '*', '`Id`='.$Operation['Subject']); 151 151 $Subject = $DbResult->fetch_assoc(); 152 152 153 153 $DbResult = $this->Database->select('Subject', '*', '`Id`='.$this->System->Config['Finance']['MainSubjectId']); 154 154 $MainSubject = $DbResult->fetch_assoc(); 155 155 156 156 $DbResult = $this->Database->query('SELECT FinanceBankAccount.*, CONCAT(FinanceBankAccount.Number, "/", FinanceBank.Code) AS NumberFull FROM FinanceBankAccount '. 157 157 'JOIN FinanceBank ON FinanceBank.Id=FinanceBankAccount.Bank '. 158 158 'WHERE (FinanceBankAccount.`Subject`='.$this->System->Config['Finance']['MainSubjectId'].') AND (FinanceBankAccount.`Use`=1)'); 159 159 $MainSubjectAccount = $DbResult->fetch_assoc(); 160 160 161 161 //$Dodavka = array(); 162 162 //$DbResult = $this->Database->select('FinanceInvoiceItem', '*', 'FinanceInvoice='.$BillId); … … 168 168 if($Operation['Value'] < 0) 169 169 $Desc = array( 170 'Type' => 'VÝDAJOVÝ', 171 'Signature' => 'Vydal', 170 'Type' => 'VÝDAJOVÝ', 171 'Signature' => 'Vydal', 172 172 'Sign' => -1, 173 173 'Target' => 'Vydáno komu', 174 174 ); 175 175 else $Desc = array( 176 'Type' => 'PŘÍJMOVÝ', 177 'Signature' => 'Přijal', 176 'Type' => 'PŘÍJMOVÝ', 177 'Signature' => 'Přijal', 178 178 'Sign' => 1, 179 179 'Target' => 'Přijato od', … … 200 200 if($Subject['IC'] != 0) $Output .= 'IČ: '.$Subject['IC'].'<br>'; 201 201 if($Subject['DIC'] != '') $Output .= 'DIČ: '.$Subject['DIC'].'<br>'; 202 $Total = 0;203 $Description = '';204 //foreach($Dodavka as $Polozka)205 //{206 // $Description .= $Polozka['Description'].'<br>';207 // $Total += ($Polozka['Quantity'] * $Polozka['Price']);208 //}209 202 $Description = $Operation['Text']; 210 203 $Total = $Operation['Value'] * $Desc['Sign']; -
trunk/Modules/Finance/Finance.php
r660 r680 399 399 'VAT' => array('Type' => 'Integer', 'Caption' => 'Daň', 'Default' => '21', 'Suffix' => '%'), 400 400 'Total' => array('Type' => 'Integer', 'Caption' => 'Celkem', 'Default' => '', 'Suffix' => 'Kč', 401 'ReadOnly' => true, 'SQL' => ' `Price` * `Quantity`'),401 'ReadOnly' => true, 'SQL' => 'CEIL(`Price` * `Quantity`)'), 402 402 ), 403 403 )); -
trunk/Modules/Finance/Manage.php
r653 r680 110 110 $SumValue = 0; 111 111 foreach($Items as $Item) 112 $SumValue = $SumValue + $Item['Price'] * $Item['Quantity'];112 $SumValue = $SumValue + ceil($Item['Price'] * $Item['Quantity']); 113 113 $this->Database->insert('FinanceInvoice', array( 114 114 'Subject' => $Subject, 'Time' => TimeToMysqlDateTime($TimeCreation), … … 119 119 foreach($Items as $Item) 120 120 $this->Database->insert('FinanceInvoiceItem', array('FinanceInvoice' => $InvoiceId, 121 'Description' => $Item['Description'], 'Price' => $Item['Price'], 'Quantity' => $Item['Quantity'], 'VAT' => $Item['VAT'])); 121 'Description' => $Item['Description'], 'Price' => $Item['Price'], 122 'Quantity' => $Item['Quantity'], 'VAT' => $Item['VAT'])); 122 123 //$LastInsertTime = $Time; 123 124 //$this->CheckAdvancesAndLiabilities($Subject);
Note:
See TracChangeset
for help on using the changeset viewer.