Changeset 810


Ignore:
Timestamp:
Mar 6, 2016, 11:23:58 PM (9 years ago)
Author:
chronos
Message:
  • Fixed: Content of columns in finance Trade reports.
  • Fixed: Rounding in finance treasury total.
Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Application/Version.php

    r809 r810  
    11<?php
    22
    3 $Revision = 809; // Subversion revision
     3$Revision = 810; // Subversion revision
    44$DatabaseRevision = 808; // SQL structure revision
    55$ReleaseTime = strtotime('2016-03-06');
  • trunk/Modules/Finance/Finance.php

    r809 r810  
    422422        'TimeCreate' => array('Type' => 'Date', 'Caption' => 'Čas vytvoření', 'Default' => ''),
    423423        'State' => array('Type' => 'Float', 'Caption' => 'Stav', 'Default' => '',
    424           'ReadOnly' => true, 'Suffix' => 'Kč', 'SQL' => '(SELECT SUM(`FinanceOperation`.`Value`) FROM `FinanceOperation` '.
    425           'WHERE `FinanceOperation`.`Treasury`=#Id)'),
     424          'ReadOnly' => true, 'Suffix' => 'Kč', 'SQL' => 'IFNULL(ROUND((SELECT SUM(`FinanceOperation`.`Value`) FROM `FinanceOperation` '.
     425          'WHERE `FinanceOperation`.`Treasury`=#Id), '.$Config['Finance']['Rounding'].'), 0)'),
    426426        'Operations' => array('Type' => 'TFinanceOperationListTreasury', 'Caption' => 'Operace', 'Default' => ''),
    427427        'Check' => array('Type' => 'TFinanceTreasuryCheckListTreasury', 'Caption' => 'Kontrola', 'Default' => ''),
  • trunk/Modules/Finance/Trade.php

    r750 r810  
    198198        $Output .= '<table style="font-size: smaller;" class="WideTable">';
    199199        $Output .= '<tr><th>Čas</th><th>Kód</th><th>Subjekt</th><th>Text</th><th>Hodnota [Kč]</th><th>Daňový</th><th>Hotovost</th></tr>';
    200         $DbResult = $this->Database->query('SELECT `FinanceOperation`.*, `DocumentLineCode`.`Name` AS `BillName`, `Subject`.`Name` AS `Name` FROM `FinanceOperation` '.
     200        $DbResult = $this->Database->query('SELECT `FinanceOperation`.*, `DocumentLineCode`.`Name` AS `BillName`, '.
     201          '`Subject`.`Name` AS `SubjectName`, `FinanceOperationGroup`.`ValueSign` AS `ValueSign` FROM `FinanceOperation` '.
    201202          'LEFT JOIN `Subject` ON `Subject`.`Id` = `FinanceOperation`.`Subject` '.
    202203          'LEFT JOIN `FinanceOperationGroup` ON `FinanceOperationGroup`.`Id` = `FinanceOperation`.`Group` '.
     
    208209          $Row['Time'] = explode(' ', $Row['Time']);
    209210          $Row['Time'] = $Row['Time'][0];
    210           $Row['Value'] = $Row['Value'];
     211          $Row['Value'] = $Row['Value'] * $Row['ValueSign'];
    211212          $Output .= '<tr><td>'.HumanDate($Row['Time']).'</td><td>'.$Row['BillName'].
    212             '</td><td>'.$Row['Name'].'</td><td>'.$Row['Text'].'</td><td>'.$Row['Value'].
     213            '</td><td>'.$Row['SubjectName'].'</td><td>'.$Row['Text'].'</td><td>'.$Row['Value'].
    213214            '</td><td>'.$Table[$Row['Taxable']].'</td><td>'.$Table[$Row['Cash']].'</td></tr>';
    214215          $Total += $Row['Value'];
     
    233234        $Output .= '<table style="font-size: smaller;" class="WideTable">';
    234235        $Output .= '<tr><th>Čas vystavení</th><th>Kód</th><th>Subjekt</th><th>Text</th><th>Hodnota [Kč]</th></tr>';
    235         $DbResult = $this->Database->query('SELECT `FinanceInvoice`.*, (SELECT GROUP_CONCAT(Description SEPARATOR ",") '.
    236           'FROM FinanceInvoiceItem WHERE FinanceInvoiceItem.FinanceInvoice = FinanceInvoice.Id) AS Text, `DocumentLineCode`.`Name` AS `BillName`, `Subject`.`Name` AS `Name` '.
    237           'FROM FinanceInvoice JOIN Subject ON Subject.Id = FinanceInvoice.Subject '.
     236        $DbResult = $this->Database->query('SELECT `FinanceInvoice`.*, '.
     237          '`DocumentLineCode`.`Name` AS `BillName`, `Subject`.`Name` AS `SubjectName`, '.
     238          '(SELECT GROUP_CONCAT(`Description` SEPARATOR ",") '.
     239          'FROM `FinanceInvoiceItem` WHERE `FinanceInvoiceItem`.`FinanceInvoice` = `FinanceInvoice`.`Id`) AS `Text` FROM `FinanceInvoice`'.
     240          'LEFT JOIN `Subject` ON `Subject`.`Id` = `FinanceInvoice`.`Subject` '.
    238241          'LEFT JOIN `FinanceInvoiceGroup` ON `FinanceInvoiceGroup`.`Id` = `FinanceInvoice`.`Group` '.
    239242          'LEFT JOIN `DocumentLineCode` ON `DocumentLineCode`.`Id` = `FinanceInvoice`.`BillCode` '.
    240           'WHERE (`FinanceInvoiceGroup`.`ValueSign` = 1) AND (FinanceInvoice.Time >= "'.$Year['DateStart'].
    241           '") AND (FinanceInvoice.Time <= "'.$Year['DateEnd'].'") ORDER BY Time');
     243          'WHERE (`FinanceInvoiceGroup`.`ValueSign` = 1) AND (`FinanceInvoice`.`Time` >= "'.$Year['DateStart'].
     244          '") AND (`FinanceInvoice`.`Time` <= "'.$Year['DateEnd'].'") ORDER BY `Time`');
    242245        while($Row = $DbResult->fetch_array())
    243246        {
    244247          if($Row['TimePayment'] == '0000-00-00 00:00:00') $Row['TimePayment'] = '&nbsp;';
    245248          $Output .= '<tr><td>'.HumanDate($Row['Time']).'</td><td>'.$Row['BillName'].
    246             '</td><td>'.$Row['Name'].'</td><td>'.$Row['Text'].'</td><td>'.$Row['Value'].'</td></tr>';
     249            '</td><td>'.$Row['SubjectName'].'</td><td>'.$Row['Text'].'</td><td>'.$Row['Value'].'</td></tr>';
    247250          $Total += $Row['Value'];
    248251        }
     
    259262        $Output .= '<table style="font-size: smaller;" class="WideTable">';
    260263        $Output .= '<tr><th>Čas vystavení</th><th>Kód</th><th>Subjekt</th><th>Text</th><th>Hodnota [Kč]</th></tr>';
    261         $DbResult = $this->Database->query('SELECT *, (SELECT GROUP_CONCAT(Description SEPARATOR ",") '.
    262           'FROM FinanceInvoiceItem WHERE FinanceInvoiceItem.FinanceInvoice = FinanceInvoice.Id) AS `Text`, `DocumentLineCode`.`Name` AS `BillName` '.
    263           'FROM FinanceInvoice JOIN Subject ON Subject.Id = FinanceInvoice.Subject '.
     264        $DbResult = $this->Database->query('SELECT *, `DocumentLineCode`.`Name` AS `BillName`, `Subject`.`Name` AS `SubjectName`, '.
     265          '(SELECT GROUP_CONCAT(Description SEPARATOR ",") '.
     266          'FROM `FinanceInvoiceItem` WHERE `FinanceInvoiceItem`.`FinanceInvoice` = `FinanceInvoice`.`Id`) AS `Text` '.
     267          'FROM `FinanceInvoice` '.
     268          'LEFT JOIN `Subject` ON `Subject`.`Id` = `FinanceInvoice`.`Subject` '.
    264269          'LEFT JOIN `FinanceInvoiceGroup` ON `FinanceInvoiceGroup`.`Id` = `FinanceInvoice`.`Group` '.
    265270          'LEFT JOIN `DocumentLineCode` ON `DocumentLineCode`.`Id` = `FinanceInvoice`.`BillCode` '.
     
    269274        {
    270275          if($Row['TimePayment'] == '0000-00-00 00:00:00') $Row['TimePayment'] = '&nbsp;';
    271           $Row['Value'] = $Row['Value'] * -1;
     276          $Row['Value'] = $Row['Value'] * $Row['ValueSign'];
    272277          $Output .= '<tr><td>'.HumanDate($Row['Time']).'</td><td>'.$Row['BillName'].
    273             '</td><td>'.$Row['Name'].'</td><td>'.$Row['Text'].'</td><td>'.($Row['Value'] * $Row['ValueSign']).'</td></tr>';
     278            '</td><td>'.$Row['SubjectName'].'</td><td>'.$Row['Text'].'</td><td>'.$Row['Value'].'</td></tr>';
    274279          $Total += $Row['Value'];
    275280        }
Note: See TracChangeset for help on using the changeset viewer.