Ignore:
Timestamp:
Apr 6, 2020, 11:17:40 PM (5 years ago)
Author:
chronos
Message:
  • Modified: Improved code format.
File:
1 edited

Legend:

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

    r847 r873  
    6565    $Row = $DbResult->fetch_array();
    6666    $Balance['SmallAssets']['End'] = $Row[0] + 0;
    67     return($Balance);
     67    return ($Balance);
    6868  }
    6969
     
    7777    $StartYear = date('Y', $this->StartEvidence);
    7878    $EndYear = date('Y', time());
    79     for($Year = $StartYear; $Year <= $EndYear; $Year++)
     79    for ($Year = $StartYear; $Year <= $EndYear; $Year++)
    8080    {
    8181      $EndTime = mktime(0, 0, 0, 12, 31, $Year);
    8282      //$Year = date('Y', $EndTime);
    8383      $StartTime = mktime(0, 0, 0, 1, 1, $Year);
    84       if($StartTime < $this->StartEvidence) $StartTime = $this->StartEvidence;
     84      if ($StartTime < $this->StartEvidence) $StartTime = $this->StartEvidence;
    8585
    8686      $Balance = $this->GetTimePeriodBalance($StartTime, $EndTime);
     
    113113    $StartYear = date('Y', $this->StartEvidence);
    114114    $EndYear = date('Y', time());
    115     for($Year = $StartYear; $Year <= $EndYear; $Year++)
    116     {
    117       for($Month = 1; $Month <= 12; $Month++)
     115    for ($Year = $StartYear; $Year <= $EndYear; $Year++)
     116    {
     117      for ($Month = 1; $Month <= 12; $Month++)
    118118      {
    119119        $EndTime = mktime(0, 0, 0, $Month, 31, $Year);
    120120        //$Year = date('Y', $EndTime);
    121121        $StartTime = mktime(0, 0, 0, $Month, 1, $Year);
    122         if(($StartTime < time()) and ($EndTime > $this->StartEvidence))
     122        if (($StartTime < time()) and ($EndTime > $this->StartEvidence))
    123123        {
    124           if($StartTime < $this->StartEvidence) $StartTime = $this->StartEvidence;
     124          if ($StartTime < $this->StartEvidence) $StartTime = $this->StartEvidence;
    125125
    126126          $Balance = $this->GetTimePeriodBalance($StartTime, $EndTime);
     
    164164      'WHERE (`ValueSign` = 1) AND (`FinanceOperation`.`Time` >= "'.$Year['DateStart'].'") '.
    165165      'AND (`FinanceOperation`.`Time` <= "'.$Year['DateEnd'].'") ORDER BY `Time`');
    166     while($Row = $DbResult->fetch_array())
     166    while ($Row = $DbResult->fetch_array())
    167167    {
    168168      $Row['Time'] = explode(' ', $Row['Time']);
     
    204204      'WHERE (`FinanceOperationGroup`.`ValueSign` = -1) AND (`FinanceOperation`.`Time` >= "'.$Year['DateStart'].'") '.
    205205      'AND (`FinanceOperation`.`Time` <= "'.$Year['DateEnd'].'") ORDER BY `Time`');
    206     while($Row = $DbResult->fetch_array())
     206    while ($Row = $DbResult->fetch_array())
    207207    {
    208208      $Row['Time'] = explode(' ', $Row['Time']);
     
    245245      'WHERE (`FinanceInvoiceGroup`.`ValueSign` = 1) AND (`FinanceInvoice`.`Time` >= "'.$Year['DateStart'].
    246246      '") AND (`FinanceInvoice`.`Time` <= "'.$Year['DateEnd'].'") ORDER BY `Time`');
    247     while($Row = $DbResult->fetch_array())
    248     {
    249       if($Row['TimePayment'] == '0000-00-00 00:00:00') $Row['TimePayment'] = '&nbsp;';
     247    while ($Row = $DbResult->fetch_array())
     248    {
     249      if ($Row['TimePayment'] == '0000-00-00 00:00:00') $Row['TimePayment'] = '&nbsp;';
    250250      $Output .= '<tr><td>'.HumanDate($Row['Time']).'</td><td>'.$Row['BillName'].
    251251      '</td><td>'.$Row['SubjectName'].'</td><td>'.$Row['Text'].'</td><td>'.$Row['Value'].'</td></tr>';
     
    276276      'WHERE (`FinanceInvoiceGroup`.`ValueSign` = -1) AND (`FinanceInvoice`.`Time` >= "'.$Year['DateStart'].
    277277      '") AND (FinanceInvoice.Time <= "'.$Year['DateEnd'].'") ORDER BY Time');
    278     while($Row = $DbResult->fetch_array())
    279     {
    280       if($Row['TimePayment'] == '0000-00-00 00:00:00') $Row['TimePayment'] = '&nbsp;';
     278    while ($Row = $DbResult->fetch_array())
     279    {
     280      if ($Row['TimePayment'] == '0000-00-00 00:00:00') $Row['TimePayment'] = '&nbsp;';
    281281      $Row['Value'] = $Row['Value'] * $Row['ValueSign'];
    282282      $Output .= '<tr><td>'.HumanDate($Row['Time']).'</td><td>'.$Row['BillName'].
     
    314314      'WHERE (T6.Subject = Subject.Id) AND (`FinanceOperationGroup`.`ValueSign` = -1)) AS `Spends` '.
    315315      'FROM Subject ORDER BY Name');
    316     while($Row = $DbResult->fetch_assoc())
     316    while ($Row = $DbResult->fetch_assoc())
    317317    {
    318318      $Output .= '<tr><td style="text-align: left;"><a href="?table=SubjectAccount&Id='.$Row['Id'].'">'.$Row['Name'].'</a></td><td>'.$Row['Liabilities'].' / '.$Row['OpenedLiabilities'].'</td><td>'.$Row['Claims'].' / '.$Row['OpenedClaims'].'</td><td>'.$Row['Gains'].'</td><td>'.$Row['Spends'].'</td><td>'.($Row['Gains'] - $Row['Spends'] - $Row['Claims'] + $Row['Liabilities']).'</td><td>'.$Row['Cash'].'</td></tr>';
     
    330330      'FROM StockSerialNumber JOIN Product ON Product.Id = StockSerialNumber.Product '.
    331331      'WHERE (TimeElimination IS NOT NULL)');
    332     while($Row = $DbResult->fetch_array())
     332    while ($Row = $DbResult->fetch_array())
    333333    {
    334334      $Output .= '<tr><td>'.$Row['Name'].'</td><td>'.$Row['Price'].'</td><td>'.$Row['TimeEnlistment'].'</td><td>'.$Row['TimeElimination'].'</td></tr>';
     
    349349      'LEFT JOIN `FinanceOperationGroup` ON `FinanceOperationGroup`.`Id` = `FinanceOperation`.`Group` '.
    350350      'WHERE `Subject`='.$_GET['Id'].' ORDER BY `Time`');
    351     while($Row = $DbResult->fetch_array())
     351    while ($Row = $DbResult->fetch_array())
    352352    {
    353353      $Output .= '<tr><td>'.HumanDate($Row['Time']).'</td><td>'.$Row['Text'].
     
    364364      'LEFT JOIN `DocumentLineCode` ON `DocumentLineCode`.`Id` = `FinanceInvoice`.`BillCode` '.
    365365      'WHERE `Subject`='.$_GET['Id'].' ORDER BY `Time`');
    366     while($Row = $DbResult->fetch_array())
     366    while ($Row = $DbResult->fetch_array())
    367367    {
    368368      $Output .= '<tr><td>'.HumanDate($Row['Time']).'</td><td>'.HumanDate($Row['TimePayment']).
     
    375375     $Output .= '<tr><th>Datum vytvoření</th><th>Datum zaplacení</th><th>Název</th><th>Hodnota [Kč]</th></tr>';
    376376     $DbResult = $this->Database->select('FinanceAdvances', '*', 'Subject='.$_GET['Id']);
    377      while($Row = $DbResult->fetch_array())
     377     while ($Row = $DbResult->fetch_array())
    378378     {
    379379     $Output .= '<tr><td>'.$Row['Time'].'</td><td>'.$Row['TimePass'].'</td><td>'.$Row['ValueSign'].'</td><td>'.($Row['Value']).'</td><td>'.$Row['CashFlowId'].'</td></tr>';
     
    411411    $Output .= '<strong>Roční přehledy</strong><br/>';
    412412    $Output .= $this->ShowFinanceYears();
    413     if(array_key_exists('year', $_GET))
     413    if (array_key_exists('year', $_GET))
    414414    {
    415415      $Year = $_GET['year'] * 1;
     
    426426  function Show()
    427427  {
    428     if(!$this->System->User->CheckPermission('Finance', 'TradingStatus'))
    429       return('Nemáte oprávnění');
     428    if (!$this->System->User->CheckPermission('Finance', 'TradingStatus'))
     429      return ('Nemáte oprávnění');
    430430
    431431    $Finance = &$this->System->Modules['Finance'];
    432432
    433433    $Output = '';
    434     if(!array_key_exists('table', $_GET)) $_GET['table'] = '';
    435     switch($_GET['table'])
     434    if (!array_key_exists('table', $_GET)) $_GET['table'] = '';
     435    switch ($_GET['table'])
    436436    {
    437437      case 'AnnualBalance':
     
    478478        $Output = $this->ShowDefault();
    479479    }
    480     return($Output);
     480    return ($Output);
    481481  }
    482482
     
    485485    $Output = 'Roky: ';
    486486    $DbRows = $this->Database->select('FinanceYear', '*');
    487     while($DbRow = $DbRows->fetch_assoc())
     487    while ($DbRow = $DbRows->fetch_assoc())
    488488      $Output .= '<a href="?year='.$DbRow['Id'].'">'.$DbRow['Year'].'</a> ';
    489489    $Output .= '<br/>';
    490     return($Output);
     490    return ($Output);
    491491  }
    492492
Note: See TracChangeset for help on using the changeset viewer.