Ignore:
Timestamp:
Jan 2, 2014, 12:42:49 PM (11 years ago)
Author:
chronos
Message:
  • Upraveno: Přejmenováno v Invoice sloupec TimeCreation na Time.
  • Přidáno: Umožnění přidávat faktury a finanční operace i pro starší neuzavřené účetní období. Rok pro dokladovou řadu se určí podle data vytvoření.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/Finance/Zivnost.php

    r548 r627  
    2828    $Balance['Spend']['End'] = $Row[0] + 0;
    2929
    30     $DbResult = $this->Database->query('SELECT SUM(Value) FROM FinanceInvoice WHERE (TimeCreation < "'.TimeToMysqlDateTime($StartTime).'") AND (TimeCreation >= "'.TimeToMysqlDateTime($this->StartEvidence).'") AND (Value > 0)');
     30    $DbResult = $this->Database->query('SELECT SUM(Value) FROM FinanceInvoice WHERE (Time < "'.TimeToMysqlDateTime($StartTime).'") AND (Time >= "'.TimeToMysqlDateTime($this->StartEvidence).'") AND (Value > 0)');
    3131    $Row = $DbResult->fetch_array();
    3232    $Balance['Claims']['Start'] = $Row[0] + 0;
    33     $DbResult = $this->Database->query('SELECT SUM(Value) FROM FinanceInvoice WHERE (TimeCreation <= "'.TimeToMysqlDateTime($EndTime).'") AND (TimeCreation >= "'.TimeToMysqlDateTime($this->StartEvidence).'") AND (Value > 0)');
     33    $DbResult = $this->Database->query('SELECT SUM(Value) FROM FinanceInvoice WHERE (Time <= "'.TimeToMysqlDateTime($EndTime).'") AND (Time >= "'.TimeToMysqlDateTime($this->StartEvidence).'") AND (Value > 0)');
    3434    $Row = $DbResult->fetch_array();
    3535    $Balance['Claims']['End'] = $Row[0] + 0;
    3636
    37     $DbResult = $this->Database->query('SELECT SUM(-Value) FROM FinanceInvoice WHERE (TimeCreation < "'.TimeToMysqlDateTime($StartTime).'") AND (TimeCreation >= "'.TimeToMysqlDateTime($this->StartEvidence).'") AND (Value < 0)');
     37    $DbResult = $this->Database->query('SELECT SUM(-Value) FROM FinanceInvoice WHERE (Time < "'.TimeToMysqlDateTime($StartTime).'") AND (Time >= "'.TimeToMysqlDateTime($this->StartEvidence).'") AND (Value < 0)');
    3838    $Row = $DbResult->fetch_array();
    3939    $Balance['Liabilities']['Start'] = $Row[0] + 0;
    40     $DbResult = $this->Database->query('SELECT SUM(-Value) FROM FinanceInvoice WHERE (TimeCreation <= "'.TimeToMysqlDateTime($EndTime).'") AND (TimeCreation >= "'.TimeToMysqlDateTime($this->StartEvidence).'") AND (Value < 0)');
     40    $DbResult = $this->Database->query('SELECT SUM(-Value) FROM FinanceInvoice WHERE (Time <= "'.TimeToMysqlDateTime($EndTime).'") AND (Time >= "'.TimeToMysqlDateTime($this->StartEvidence).'") AND (Value < 0)');
    4141    $Row = $DbResult->fetch_array();
    4242    $Balance['Liabilities']['End'] = $Row[0] + 0;
     
    207207        $DbResult = $this->Database->query('SELECT *, (SELECT GROUP_CONCAT(Description SEPARATOR ",") FROM FinanceInvoiceItem WHERE FinanceInvoiceItem.FinanceInvoice = FinanceInvoice.Id) AS Text '.
    208208          'FROM FinanceInvoice JOIN Subject ON Subject.Id = FinanceInvoice.Subject '.
    209           'WHERE (Value > 0) AND (FinanceInvoice.TimeCreation >= "'.$Year['DateStart'].
    210           '") AND (FinanceInvoice.TimeCreation <= "'.$Year['DateEnd'].'") ORDER BY TimeCreation');
     209          'WHERE (Value > 0) AND (FinanceInvoice.Time >= "'.$Year['DateStart'].
     210          '") AND (FinanceInvoice.Time <= "'.$Year['DateEnd'].'") ORDER BY Time');
    211211        while($Row = $DbResult->fetch_array())
    212212        {
    213213          if($Row['TimePayment'] == '0000-00-00 00:00:00') $Row['TimePayment'] = '&nbsp;';
    214           $Output .= '<tr><td>'.HumanDate($Row['TimeCreation']).'</td><td>'.$Row['BillCode'].'</td><td>'.$Row['Name'].'</td><td>'.$Row['Text'].'</td><td>'.$Row['Value'].'</td></tr>';
     214          $Output .= '<tr><td>'.HumanDate($Row['Time']).'</td><td>'.$Row['BillCode'].'</td><td>'.$Row['Name'].'</td><td>'.$Row['Text'].'</td><td>'.$Row['Value'].'</td></tr>';
    215215          $Total += $Row['Value'];
    216216        }
     
    229229        $DbResult = $this->Database->query('SELECT *, (SELECT GROUP_CONCAT(Description SEPARATOR ",") FROM FinanceInvoiceItem WHERE FinanceInvoiceItem.FinanceInvoice = FinanceInvoice.Id) AS Text '.
    230230          'FROM FinanceInvoice JOIN Subject ON Subject.Id = FinanceInvoice.Subject '.
    231           'WHERE (Value < 0) AND (FinanceInvoice.TimeCreation >= "'.$Year['DateStart'].
    232           '") AND (FinanceInvoice.TimeCreation <= "'.$Year['DateEnd'].'") ORDER BY TimeCreation');
     231          'WHERE (Value < 0) AND (FinanceInvoice.Time >= "'.$Year['DateStart'].
     232          '") AND (FinanceInvoice.Time <= "'.$Year['DateEnd'].'") ORDER BY Time');
    233233        while($Row = $DbResult->fetch_array())
    234234        {
    235235          if($Row['TimePayment'] == '0000-00-00 00:00:00') $Row['TimePayment'] = '&nbsp;';
    236236          $Row['Value'] = $Row['Value'] * -1;
    237           $Output .= '<tr><td>'.HumanDate($Row['TimeCreation']).'</td><td>'.$Row['BillCode'].'</td><td>'.$Row['Name'].'</td><td>'.$Row['Text'].'</td><td>'.$Row['Value'].'</td></tr>';         
     237          $Output .= '<tr><td>'.HumanDate($Row['Time']).'</td><td>'.$Row['BillCode'].'</td><td>'.$Row['Name'].'</td><td>'.$Row['Text'].'</td><td>'.$Row['Value'].'</td></tr>';         
    238238          $Total += $Row['Value'];
    239239        }
     
    288288        $Output .= '<table style="font-size: smaller;" border="1" cellspacing="0" cellpadding="3">';
    289289        $Output .= '<tr><th>Datum vytvoření</th><th>Datum zaplacení</th><th>Název</th><th>Hodnota [Kč]</th><th>Doklad</th></tr>';
    290         $DbResult = $this->Database->select('FinanceInvoice', '*, (SELECT GROUP_CONCAT(Description SEPARATOR ",") FROM FinanceInvoiceItem WHERE FinanceInvoiceItem.FinanceInvoice = FinanceInvoice.Id) AS Text', 'Subject='.$_GET['Id'].' ORDER BY TimeCreation');
    291         while($Row = $DbResult->fetch_array())
    292         {
    293           $Output .= '<tr><td>'.HumanDate($Row['TimeCreation']).'</td><td>'.HumanDate($Row['TimePayment']).
     290        $DbResult = $this->Database->select('FinanceInvoice', '*, (SELECT GROUP_CONCAT(Description SEPARATOR ",") FROM FinanceInvoiceItem WHERE FinanceInvoiceItem.FinanceInvoice = FinanceInvoice.Id) AS Text', 'Subject='.$_GET['Id'].' ORDER BY Time');
     291        while($Row = $DbResult->fetch_array())
     292        {
     293          $Output .= '<tr><td>'.HumanDate($Row['Time']).'</td><td>'.HumanDate($Row['TimePayment']).
    294294            '</td><td>'.$Row['Text'].'</td><td>'.($Row['Value']).'</td><td>'.$Row['BillCode'].'</td></tr>';
    295295        }
     
    302302        while($Row = $DbResult->fetch_array())
    303303        {
    304           $Output .= '<tr><td>'.$Row['TimeCreation'].'</td><td>'.$Row['TimePass'].'</td><td>'.$Row['Direction'].'</td><td>'.($Row['Value']).'</td><td>'.$Row['CashFlowId'].'</td></tr>';
     304          $Output .= '<tr><td>'.$Row['Time'].'</td><td>'.$Row['TimePass'].'</td><td>'.$Row['Direction'].'</td><td>'.($Row['Value']).'</td><td>'.$Row['CashFlowId'].'</td></tr>';
    305305        }
    306306        $Output .= '</table>';*/
Note: See TracChangeset for help on using the changeset viewer.