Changeset 747 for trunk/Modules/Finance
- Timestamp:
- Sep 21, 2015, 12:12:26 AM (9 years ago)
- Location:
- trunk/Modules/Finance
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Finance/Bill.php
r741 r747 52 52 function GenerateHTML() 53 53 { 54 $DbResult = $this->Database->select('FinanceInvoice', '*', '`Id`='.$this->InvoiceId); 54 $DbResult = $this->Database->query('SELECT `FinanceInvoice`.*, `FinanceInvoiceGroup`.`Direction` FROM `FinanceInvoice` '. 55 'LEFT JOIN `FinanceInvoiceGroup` ON `FinanceInvoiceGroup`.`Id`=`FinanceInvoice`.`Group` '. 56 'WHERE `FinanceInvoice`.`Id`='.$this->InvoiceId); 55 57 $Invoice = $DbResult->fetch_assoc(); 56 58 … … 79 81 80 82 // If direction is in => switch sides 81 if($Invoice['Direction'] == FINANCE_DIRECTION_OUT) 82 { 83 if($Invoice['Direction'] == FINANCE_DIRECTION_OUT) 84 { 83 85 } 84 86 else if($Invoice['Direction'] == FINANCE_DIRECTION_IN) … … 151 153 function GenerateHTML() 152 154 { 153 $DbResult = $this->Database->select('FinanceOperation', '*', '`Id`='.$this->OperationId); 155 $DbResult = $this->Database->query('SELECT `FinanceOperation`.*, `FinanceOperationGroup`.`Direction` FROM `FinanceOperation` '. 156 'LEFT JOIN `FinanceOperationGroup` ON `FinanceOperationGroup`.`Id`=`FinanceOperation`.`Group` '. 157 'WHERE `FinanceOperation`.`Id`='.$this->OperationId); 154 158 $Operation = $DbResult->fetch_assoc(); 155 159 -
trunk/Modules/Finance/Finance.php
r742 r747 109 109 } 110 110 111 function GetNextDocumentLineNumberId($Id, $FinanceYear = 0) 112 { 113 $Code = $this->GetNextDocumentLineNumber($Id, $FinanceYear); 114 $this->Database->insert('DocumentLineCode', array('DocumentLine' => $Id, 'Name' => $Code)); 115 return $this->Database->insert_id; 116 } 117 111 118 function GetFinanceGroupById($Id, $Table) 112 119 { … … 125 132 while($Member = $DbResult->fetch_assoc()) 126 133 { 127 $DbResult2 = $this->Database->query('SELECT ((SELECT COALESCE(SUM(`Value` * `ValueSign`), 0) FROM `FinanceOperation` '.128 'WHERE `Subject`='.$Member['Subject'].') - (SELECT COALESCE(SUM(`Value` * `ValueSign`), 0) FROM `FinanceInvoice` '.134 $DbResult2 = $this->Database->query('SELECT ((SELECT COALESCE(SUM(`Value`), 0) FROM `FinanceOperation` '. 135 'WHERE `Subject`='.$Member['Subject'].') - (SELECT COALESCE(SUM(`Value`), 0) FROM `FinanceInvoice` '. 129 136 'WHERE `Subject`='.$Member['Subject'].')) AS `Cash`'); 130 137 $Cash = $DbResult2->fetch_row(); … … 220 227 'Cash' => array('Type' => 'Boolean', 'Caption' => 'Hotově', 'Default' => ''), 221 228 'Taxable' => array('Type' => 'Boolean', 'Caption' => 'Zdanitelné', 'Default' => ''), 222 'Direction' => array('Type' => 'TFinanceDirection', 'Caption' => 'Směr', 'Default' => '0'), 223 'ValueSign' => array('Type' => 'TFinanceValueSign', 'Caption' => 'Znaménko', 'Default' => '1'), 224 'Value' => array('Type' => 'Integer', 'Caption' => 'Částka', 'Default' => '0', 'Suffix' => 'Kč'), 229 'Value' => array('Type' => 'Integer', 'Caption' => 'Částka absolutní', 'Default' => '0', 'Suffix' => 'Kč', 'ReadOnly' => true), 230 'ValueUser' => array('Type' => 'Integer', 'Caption' => 'Částka', 'Default' => '0', 'Suffix' => 'Kč'), 225 231 'File' => array('Type' => 'TFile', 'Caption' => 'Doklad', 'Default' => '', 'Null' => true), 226 232 'Text' => array('Type' => 'String', 'Caption' => 'Popis', 'Default' => ''), … … 232 238 ), 233 239 'BeforeInsert' => array($this, 'BeforeInsertFinanceOperation'), 240 'AfterInsert' => array($this, 'AfterInsertFinanceOperation'), 241 'BeforeModify' => array($this, 'BeforeModifyFinanceOperation'), 234 242 )); 235 243 … … 243 251 $this->System->FormManager->Classes['FinanceTreasuryIn']['Items']['Cash']['Filter'] = false; 244 252 $this->System->FormManager->Classes['FinanceTreasuryIn']['Items']['BankAccount']['Hidden'] = true; 253 $this->System->FormManager->Classes['FinanceTreasuryIn']['Items']['Value']['Hidden'] = true; 245 254 246 255 $this->System->FormManager->RegisterClass('FinanceTreasuryOut', $this->System->FormManager->Classes['FinanceOperation']); … … 253 262 $this->System->FormManager->Classes['FinanceTreasuryIn']['Items']['Cash']['Filter'] = false; 254 263 $this->System->FormManager->Classes['FinanceTreasuryOut']['Items']['BankAccount']['Hidden'] = true; 264 $this->System->FormManager->Classes['FinanceTreasuryOut']['Items']['Value']['Hidden'] = true; 255 265 256 266 $this->System->FormManager->RegisterClass('FinanceAccountIn', $this->System->FormManager->Classes['FinanceOperation']); … … 263 273 $this->System->FormManager->Classes['FinanceTreasuryIn']['Items']['Cash']['Filter'] = false; 264 274 $this->System->FormManager->Classes['FinanceAccountIn']['Items']['Treasury']['Hidden'] = true; 275 $this->System->FormManager->Classes['FinanceAccountIn']['Items']['Value']['Hidden'] = true; 265 276 266 277 $this->System->FormManager->RegisterClass('FinanceAccountOut', $this->System->FormManager->Classes['FinanceOperation']); … … 273 284 $this->System->FormManager->Classes['FinanceTreasuryIn']['Items']['Cash']['Filter'] = false; 274 285 $this->System->FormManager->Classes['FinanceAccountOut']['Items']['Treasury']['Hidden'] = true; 286 $this->System->FormManager->Classes['FinanceAccountOut']['Items']['Value']['Hidden'] = true; 275 287 276 288 $this->System->FormManager->RegisterClass('FinanceOperationGroup', array( … … 311 323 'TimeDue' => array('Type' => 'Date', 'Caption' => 'Čas splatnosti', 'Default' => ''), 312 324 'TimePayment' => array('Type' => 'Date', 'Caption' => 'Čas zaplacení', 'Default' => '', 'Null' => true), 313 'Direction' => array('Type' => 'TFinanceDirection', 'Caption' => 'Směr', 'Default' => '0'), 314 'ValueSign' => array('Type' => 'TFinanceValueSign', 'Caption' => 'Znaménko', 'Default' => '1'), 315 'Value' => array('Type' => 'Integer', 'Caption' => 'Částka', 'Default' => '0', 'Suffix' => 'Kč'), 316 'File' => array('Type' => 'TFile', 'Caption' => 'Doklad', 'Default' => '', 'Null' => true), 325 'Value' => array('Type' => 'Integer', 'Caption' => 'Částka absolutní', 'Default' => '0', 'Suffix' => 'Kč', 'ReadOnly' => true), 326 'ValueUser' => array('Type' => 'Integer', 'Caption' => 'Částka', 'Default' => '0', 'Suffix' => 'Kč', 'ReadOnly' => true, 327 'SQL' => 'SELECT SUM(CEIL(`Price`*`Quantity`)) FROM `FinanceInvoiceItem` WHERE `FinanceInvoiceItem`.`FinanceInvoice`=#Id'), 317 328 'Generate' => array('Type' => 'Boolean', 'Caption' => 'Generovat', 'Default' => ''), 318 329 'PeriodFrom' => array('Type' => 'Date', 'Caption' => 'Období od', 'Default' => '', 'Null' => true), … … 325 336 'WHERE `FinanceInvoiceOperationRel`.`Invoice`=#Id)'), 326 337 ), 327 'BeforeInsert' => array($this, 'BeforeInsertFinanceOperation'), 338 'BeforeInsert' => array($this, 'BeforeInsertFinanceInvoice'), 339 'AfterInsert' => array($this, 'AfterInsertFinanceInvoice'), 340 'BeforeModify' => array($this, 'BeforeModifyFinanceInvoice'), 328 341 )); 329 342 $this->System->FormManager->RegisterClass('FinanceInvoiceIn', $this->System->FormManager->Classes['FinanceInvoice']); … … 332 345 $this->System->FormManager->Classes['FinanceInvoiceIn']['Items']['Group']['Hidden'] = true; 333 346 $this->System->FormManager->Classes['FinanceInvoiceIn']['Items']['Group']['Filter'] = true; 347 $this->System->FormManager->Classes['FinanceInvoiceIn']['Items']['Value']['Hidden'] = true; 334 348 335 349 $this->System->FormManager->RegisterClass('FinanceInvoiceOut', $this->System->FormManager->Classes['FinanceInvoice']); … … 338 352 $this->System->FormManager->Classes['FinanceInvoiceOut']['Items']['Group']['Hidden'] = true; 339 353 $this->System->FormManager->Classes['FinanceInvoiceOut']['Items']['Group']['Filter'] = true; 354 $this->System->FormManager->Classes['FinanceInvoiceOut']['Items']['Value']['Hidden'] = true; 340 355 341 356 $this->System->FormManager->RegisterClass('FinanceInvoiceGroup', array( … … 346 361 'DocumentLine' => array('Type' => 'TDocumentLine', 'Caption' => 'Dokladová řada', 'Default' => '0'), 347 362 'ValueSign' => array('Type' => 'TFinanceValueSign', 'Caption' => 'Znaménko hodnoty', 'Default' => '0'), 348 363 'Direction' => array('Type' => 'TFinanceDirection', 'Caption' => 'Směr', 'Default' => '0'), 349 364 ), 350 365 )); … … 377 392 'ReadOnly' => true, 'SQL' => 'CEIL(`Price` * `Quantity`)'), 378 393 ), 394 'AfterInsert' => array($this, 'AfterInsertFinanceInvoiceItem'), 395 'AfterModify' => array($this, 'AfterModifyFinanceInvoiceItem'), 396 'AfterDelete' => array($this, 'AfterModifyFinanceInvoiceItem'), 379 397 )); 380 398 $this->System->FormManager->RegisterClass('FinanceTreasury', array( … … 386 404 'TimeCreate' => array('Type' => 'Date', 'Caption' => 'Čas vytvoření', 'Default' => ''), 387 405 'State' => array('Type' => 'Float', 'Caption' => 'Stav', 'Default' => '', 388 'ReadOnly' => true, 'Suffix' => 'Kč', 'SQL' => '(SELECT SUM(`FinanceOperation`.`Value` * `FinanceOperation`.`ValueSign`) FROM `FinanceOperation` '.406 'ReadOnly' => true, 'Suffix' => 'Kč', 'SQL' => '(SELECT SUM(`FinanceOperation`.`Value`) FROM `FinanceOperation` '. 389 407 'WHERE `FinanceOperation`.`Treasury`=#Id)'), 390 408 'Operations' => array('Type' => 'TFinanceOperationListTreasury', 'Caption' => 'Operace', 'Default' => ''), … … 417 435 'LastImportId' => array('Type' => 'String', 'Caption' => 'Id posledního importu', 'Default' => ''), 418 436 'State' => array('Type' => 'Float', 'Caption' => 'Stav', 'Default' => '', 419 'ReadOnly' => true, 'Suffix' => 'Kč', 'SQL' => '(SELECT SUM(`FinanceOperation`.`Value` * `FinanceOperation`.`ValueSign`) FROM `FinanceOperation` '.437 'ReadOnly' => true, 'Suffix' => 'Kč', 'SQL' => '(SELECT SUM(`FinanceOperation`.`Value`) FROM `FinanceOperation` '. 420 438 'WHERE `FinanceOperation`.`BankAccount`=#Id)'), 421 439 'AutoImport' => array('Type' => 'Boolean', 'Caption' => 'Automaticky stahovat z banky', 'Default' => ''), … … 551 569 else $Year = date("Y", $Form->Values['ValidFrom']); 552 570 $FinanceGroup = $this->System->Modules['Finance']->GetFinanceGroupById($Form->Values['Group'], 'FinanceOperationGroup'); 553 $Form->Values['BillCode'] = $this->System->Modules['Finance']->GetNextDocumentLineNumber($FinanceGroup['DocumentLine'], $Year); 571 $Form->Values['BillCode'] = $this->System->Modules['Finance']->GetNextDocumentLineNumberId($FinanceGroup['DocumentLine'], $Year); 572 return($Form->Values); 573 } 574 575 function AfterInsertFinanceOperation($Form, $Id) 576 { 577 $FinanceGroup = $this->System->Modules['Finance']->GetFinanceGroupById($Form->Values['Group'], 'FinanceOperationGroup'); 578 $this->Database->query('UPDATE `'.$Form->Definition['Table'].'` SET `Value`= '. 579 ($Form->Values['ValueUser'] * $FinanceGroup['ValueSign']).' WHERE `Id`='.$Id); 580 return($Form->Values); 581 } 582 583 function BeforeModifyFinanceOperation($Form, $Id) 584 { 585 $FinanceGroup = $this->System->Modules['Finance']->GetFinanceGroupById($Form->Values['Group'], 'FinanceOperationGroup'); 586 $this->Database->query('UPDATE `'.$Form->Definition['Table'].'` SET `Value`= '. 587 ($Form->Values['ValueUser'] * $FinanceGroup['ValueSign']).' WHERE `Id`='.$Id); 588 return($Form->Values); 589 } 590 591 function BeforeInsertFinanceInvoice($Form) 592 { 593 if(array_key_exists('Time', $Form->Values)) $Year = date("Y", $Form->Values['Time']); 594 else $Year = date("Y", $Form->Values['ValidFrom']); 595 $FinanceGroup = $this->System->Modules['Finance']->GetFinanceGroupById($Form->Values['Group'], 'FinanceInvoiceGroup'); 596 $Form->Values['BillCode'] = $this->System->Modules['Finance']->GetNextDocumentLineNumberId($FinanceGroup['DocumentLine'], $Year); 597 return($Form->Values); 598 } 599 600 function AfterInsertFinanceInvoice($Form, $Id) 601 { 602 $FinanceGroup = $this->System->Modules['Finance']->GetFinanceGroupById($Form->Values['Group'], 'FinanceInvoiceGroup'); 603 $DbResult = $this->Database->query(str_replace('#Id', $Id, $Form->Definition['Items']['ValueUser']['SQL'])); 604 $DbRow = $DbResult->fetch_row(); 605 $Sum = $DbRow[0]; 606 607 $this->Database->query('UPDATE `'.$Form->Definition['Table'].'` SET `Value`= '. 608 ($Sum * $FinanceGroup['ValueSign']).' WHERE `Id`='.$Id); 609 return($Form->Values); 610 } 611 612 function BeforeModifyFinanceInvoice($Form, $Id) 613 { 614 $FinanceGroup = $this->System->Modules['Finance']->GetFinanceGroupById($Form->Values['Group'], 'FinanceInvoiceGroup'); 615 $DbResult = $this->Database->query(str_replace('#Id', $Id, $Form->Definition['Items']['ValueUser']['SQL'])); 616 $DbRow = $DbResult->fetch_row(); 617 $Sum = $DbRow[0]; 618 $this->Database->query('UPDATE `'.$Form->Definition['Table'].'` SET `Value`= '. 619 ($Sum * $FinanceGroup['ValueSign']).' WHERE `Id`='.$Id); 620 return($Form->Values); 621 } 622 623 function AfterInsertFinanceInvoiceItem($Form, $Id) 624 { 625 $ParentForm = new Form($this->System->FormManager); 626 $ParentForm->SetClass('FinanceInvoice'); 627 $ParentForm->LoadValuesFromDatabase($Form->Values['FinanceInvoice']); 628 $this->AfterInsertFinanceInvoice($ParentForm, $Form->Values['FinanceInvoice']); 629 return($Form->Values); 630 } 631 632 function AfterModifyFinanceInvoiceItem($Form, $Id) 633 { 634 $ParentForm = new Form($this->System->FormManager); 635 $ParentForm->SetClass('FinanceInvoice'); 636 $ParentForm->LoadValuesFromDatabase($Form->Values['FinanceInvoice']); 637 $this->BeforeModifyFinanceInvoice($ParentForm, $Form->Values['FinanceInvoice']); 554 638 return($Form->Values); 555 639 } -
trunk/Modules/Finance/Import.php
r740 r747 120 120 } 121 121 122 function InsertMoney($Subject, $Value, $ ValueSign, $Cash, $Taxable, $Time, $Text, $Group)122 function InsertMoney($Subject, $Value, $Cash, $Taxable, $Time, $Text, $Group) 123 123 { 124 124 $Year = date('Y', $Time); 125 $BillCode = $this->System->Modules['Finance']->GetNextDocumentLineNumber ($Group['DocumentLine'], $Year);125 $BillCode = $this->System->Modules['Finance']->GetNextDocumentLineNumberId($Group['DocumentLine'], $Year); 126 126 // TODO: Fixed BankAccount=1, allow to select bank account for import 127 127 $this->Database->insert('FinanceOperation', array('Text' => $Text, 128 'Subject' => $Subject, 'Cash' => $Cash, 'Value ' => $Value, 'ValueSign' => $ValueSign,128 'Subject' => $Subject, 'Cash' => $Cash, 'ValueUser' => $Value, 'Value' => $Value * $Group['ValueSign'], 129 129 'Time' => TimeToMysqlDateTime($Time), 'Taxable' => $Taxable, 'BillCode' => $BillCode, 130 130 'BankAccount' => 1, 'Group' => $Group['Id'])); 131 // TODO: Update Value 131 132 } 132 133 … … 146 147 $Date = explode('-', $_POST['Date'.$I]); 147 148 $Date = mktime(0, 0, 0, $Date[1], $Date[2], $Date[0]); 148 $this->InsertMoney($_POST['Subject'.$I], Abs($_POST['Money'.$I]), $FinanceGroup['ValueSign'],149 $this->InsertMoney($_POST['Subject'.$I], Abs($_POST['Money'.$I]), 149 150 0, $_POST['Taxable'.$I], $Date, $_POST['Text'.$I], $FinanceGroup); 150 151 $Output .= $I.', '; -
trunk/Modules/Finance/Manage.php
r741 r747 100 100 } 101 101 102 function InsertInvoice($Subject, $TimeCreation, $TimeDue, $ ValueSign, $Items,103 $Group, $PeriodFrom, $PeriodTo, $Direction)102 function InsertInvoice($Subject, $TimeCreation, $TimeDue, $Items, 103 $Group, $PeriodFrom, $PeriodTo) 104 104 { 105 105 global $LastInsertTime; 106 106 107 107 $Year = date('Y', $TimeCreation); 108 $BillCode = $this->System->Modules['Finance']->GetNextDocumentLineNumber ($Group['DocumentLine'], $Year);108 $BillCode = $this->System->Modules['Finance']->GetNextDocumentLineNumberId($Group['DocumentLine'], $Year); 109 109 $SumValue = 0; 110 110 foreach($Items as $Item) { … … 113 113 $this->Database->insert('FinanceInvoice', array( 114 114 'Subject' => $Subject, 'Time' => TimeToMysqlDateTime($TimeCreation), 115 'TimeDue' => TimeToMysqlDateTime($TimeDue), 'Value' => $SumValue ,116 ' ValueSign' => $ValueSign, 'BillCode' => $BillCode, 'Direction' => $Direction,115 'TimeDue' => TimeToMysqlDateTime($TimeDue), 'Value' => $SumValue * $Group['ValueSign'], 116 'BillCode' => $BillCode, 117 117 'PeriodFrom' => TimeToMysqlDate($PeriodFrom), 'PeriodTo' => TimeToMysqlDate($PeriodTo), 118 'Generate' => 1, 'Group' => $ FinanceGroup['Id']));118 'Generate' => 1, 'Group' => $Group['Id'])); 119 119 $InvoiceId = $this->Database->insert_id; 120 120 foreach($Items as $Item) … … 185 185 $Output .= $TimePeriodText.': '.$MonthlyTotal.' * '.$Period['MonthCount'].' = '.$PayPerPeriod.'<br />'; 186 186 $this->InsertInvoice($Member['Subject'], time(), time() + 3600 * 24 * INVOICE_DUE_DAYS, 187 $ FinanceGroup['ValueSign'], $InvoiceItems, $FinanceGroup, $Period['From'],188 $Period['To'], $FinanceGroup['Direction']);187 $InvoiceItems, $FinanceGroup, $Period['From'], 188 $Period['To']); 189 189 190 190 $Output .= $this->SendPaymentEmail($Member['Id']); … … 358 358 '<th style="border-style: solid; border-width: 1px; padding: 1px 5px 1px 5px; text-align: center; font-weight: bold;">Popis</th>'. 359 359 '<th style="border-style: solid; border-width: 1px; padding: 1px 5px 1px 5px; text-align: center; font-weight: bold;">Částka [Kč]</th></tr>'."\n"; 360 $DbResult = $this->Database->query('SELECT T1.* FROM ((SELECT `Text`, `Time`, (`Value`*`ValueSign`) AS`Value`, `File` FROM `FinanceOperation` WHERE (`Subject`='.$Member['Subject'].')) UNION ALL '.360 $DbResult = $this->Database->query('SELECT T1.* FROM ((SELECT `Text`, `Time`, `Value`, `File` FROM `FinanceOperation` WHERE (`Subject`='.$Member['Subject'].')) UNION ALL '. 361 361 '(SELECT (SELECT GROUP_CONCAT(`Description` SEPARATOR ", ") FROM `FinanceInvoiceItem` '. 362 362 'WHERE `FinanceInvoiceItem`.`FinanceInvoice` = `FinanceInvoice`.`Id`) AS `Text`, '. 363 '`Time`, - (`Value`*`ValueSign`) AS`Value`, `File` FROM `FinanceInvoice` WHERE (`Subject`='.363 '`Time`, -`Value`, `File` FROM `FinanceInvoice` WHERE (`Subject`='. 364 364 $Member['Subject'].')) ORDER BY `Time` DESC) AS `T1` WHERE (`T1`.`Time` > "'.$Member['BillingPeriodLastDate'].'")'); 365 365 while($DbRow = $DbResult->fetch_assoc()) -
trunk/Modules/Finance/UserState.php
r740 r747 9 9 function ShowFinanceOperation($Subject) 10 10 { 11 $UserOperationTableQuery = '((SELECT `Text`, `Time`, (`Value`*`ValueSign`) AS`Value`, `File`, `BillCode`, NULL AS `PeriodFrom`, NULL AS `PeriodTo` '.11 $UserOperationTableQuery = '((SELECT `Text`, `Time`, `Value`, `File`, `BillCode`, NULL AS `PeriodFrom`, NULL AS `PeriodTo` '. 12 12 'FROM `FinanceOperation` WHERE (`Subject`='.$Subject['Id'].')) UNION ALL '. 13 13 '(SELECT (SELECT GROUP_CONCAT(`Description` SEPARATOR ",") FROM `FinanceInvoiceItem` WHERE `FinanceInvoice`=`FinanceInvoice`.`Id`) AS `Text`, '. 14 '`Time`, - (`Value`*`ValueSign`) AS`Value`, `File`, `BillCode`, `PeriodFrom`, `PeriodTo` FROM `FinanceInvoice` WHERE (`Subject`='.$Subject['Id'].')))';14 '`Time`, -`Value`, `File`, `BillCode`, `PeriodFrom`, `PeriodTo` FROM `FinanceInvoice` WHERE (`Subject`='.$Subject['Id'].')))'; 15 15 16 16 $Output = '<div style="text-align:center">Výpis finančních operací</div>'; … … 105 105 106 106 // Account state 107 $UserOperationTableQuery = '((SELECT `Text`, `Time`, (`Value`*`ValueSign`) AS`Value`, `File`, `BillCode`, NULL AS `PeriodFrom`, NULL AS `PeriodTo` '.107 $UserOperationTableQuery = '((SELECT `Text`, `Time`, `Value`, `File`, `BillCode`, NULL AS `PeriodFrom`, NULL AS `PeriodTo` '. 108 108 'FROM `FinanceOperation` WHERE (`Subject`='.$Subject['Id'].')) UNION ALL '. 109 109 '(SELECT (SELECT GROUP_CONCAT(`Description` SEPARATOR ",") FROM `FinanceInvoiceItem` WHERE `FinanceInvoice`=`FinanceInvoice`.`Id`) AS `Text`, '. 110 '`Time`, - (`Value`*`ValueSign`) AS`Value`, `File`, `BillCode`, `PeriodFrom`, `PeriodTo` FROM `FinanceInvoice` WHERE (`Subject`='.$Subject['Id'].')) ORDER BY `Time` DESC) AS `T1`';110 '`Time`, -`Value`, `File`, `BillCode`, `PeriodFrom`, `PeriodTo` FROM `FinanceInvoice` WHERE (`Subject`='.$Subject['Id'].')) ORDER BY `Time` DESC) AS `T1`'; 111 111 $DbResult = $this->Database->query('SELECT SUM(`T1`.`Value`) AS `Total` FROM '.$UserOperationTableQuery); 112 112 $DbRow = $DbResult->fetch_array();
Note:
See TracChangeset
for help on using the changeset viewer.