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/UserState.php

    r825 r873  
    4444    $DbResult = $this->Database->query($Query);
    4545    $SumValue = 0;
    46     while($Row = $DbResult->fetch_assoc())
     46    while ($Row = $DbResult->fetch_assoc())
    4747    {
    4848      $Row['State'] = round($Row['State'], 2);
    49       if($Row['State'] > 0) $Row['State'] = '<span style="color:green;">'.$Row['State'].'</span>';
    50       if($Row['State'] < 0) $Row['State'] = '<span style="color:red;">'.$Row['State'].'</span>';
    51       if($Row['Value'] == -0) $Row['Value'] = 0;
    52       if($Row['Value'] > 0) $Row['Value'] = '+'.$Row['Value'];
    53       if($Row['BillName'] == '') $Row['BillName'] = 'PDF';
    54       if($Row['File'] > 0) $Invoice = '<a href="'.$this->System->Link('/file?id='.$Row['File']).'">'.$Row['BillName'].'</a>';
     49      if ($Row['State'] > 0) $Row['State'] = '<span style="color:green;">'.$Row['State'].'</span>';
     50      if ($Row['State'] < 0) $Row['State'] = '<span style="color:red;">'.$Row['State'].'</span>';
     51      if ($Row['Value'] == -0) $Row['Value'] = 0;
     52      if ($Row['Value'] > 0) $Row['Value'] = '+'.$Row['Value'];
     53      if ($Row['BillName'] == '') $Row['BillName'] = 'PDF';
     54      if ($Row['File'] > 0) $Invoice = '<a href="'.$this->System->Link('/file?id='.$Row['File']).'">'.$Row['BillName'].'</a>';
    5555        else $Invoice = NotBlank($Row['BillName']);
    56       if($Row['PeriodFrom'] != '') $Period = HumanDate($Row['PeriodFrom']).' - '.HumanDate($Row['PeriodTo']);
     56      if ($Row['PeriodFrom'] != '') $Period = HumanDate($Row['PeriodFrom']).' - '.HumanDate($Row['PeriodTo']);
    5757        else $Period = '&nbsp;';
    5858      $Output .= '<tr><td style="text-align: right;">'.HumanDate($Row['Time']).'</td>'.
     
    6666    $Output .= '</table>';
    6767    $Output .= $PageList['Output'];
    68     return($Output);
     68    return ($Output);
    6969  }
    7070
     
    7575
    7676    // Determine which customer should be displayed
    77     if(array_key_exists('i', $_GET))
     77    if (array_key_exists('i', $_GET))
    7878    {
    79       if(!$this->System->User->CheckPermission('Finance', 'Manage')) return('Nemáte oprávnění');
     79      if (!$this->System->User->CheckPermission('Finance', 'Manage')) return ('Nemáte oprávnění');
    8080      $CustomerId = $_GET['i'];
    8181    } else
    8282    {
    83       if(!$this->System->User->CheckPermission('Finance', 'DisplaySubjectState')) return('Nemáte oprávnění');
     83      if (!$this->System->User->CheckPermission('Finance', 'DisplaySubjectState')) return ('Nemáte oprávnění');
    8484      $UserId = $this->System->User->User['Id'];
    8585      $DbResult = $this->Database->query('SELECT `Customer` FROM `UserCustomerRel` WHERE `User`='.$UserId.' LIMIT 1');
    86       if($DbResult->num_rows > 0)
     86      if ($DbResult->num_rows > 0)
    8787      {
    8888        $CustomerUserRel = $DbResult->fetch_assoc();
    8989        $CustomerId = $CustomerUserRel['Customer'];
    90       } else return($this->SystemMessage('Chyba', 'Nejste zákazníkem'));
     90      } else return ($this->SystemMessage('Chyba', 'Nejste zákazníkem'));
    9191    }
    9292
    9393    // Load customer info
    9494    $DbResult = $this->Database->query('SELECT * FROM `Member` WHERE `Id`='.$CustomerId);
    95     if($DbResult->num_rows == 1)
     95    if ($DbResult->num_rows == 1)
    9696    {
    9797      $Customer = $DbResult->fetch_assoc();
    98     } else return($this->SystemMessage('Položka nenalezena', 'Zákazník nenalezen'));
     98    } else return ($this->SystemMessage('Položka nenalezena', 'Zákazník nenalezen'));
    9999
    100100
    101101    // Load subject info
    102102    $DbResult = $this->Database->query('SELECT * FROM `Subject` WHERE `Id`='.$Customer['Subject']);
    103     if($DbResult->num_rows == 1)
     103    if ($DbResult->num_rows == 1)
    104104    {
    105105      $Subject = $DbResult->fetch_assoc();
    106     } else return($this->SystemMessage('Položka nenalezena', 'Subjekt nenalezen'));
     106    } else return ($this->SystemMessage('Položka nenalezena', 'Subjekt nenalezen'));
    107107
    108108
     
    141141      'LEFT JOIN `Service` ON `Service`.`Id`=`ServiceCustomerRel`.`Service` '.
    142142      'WHERE (`ServiceCustomerRel`.`Customer`='.$Customer['Id'].') AND (`ServiceCustomerRel`.`ChangeAction` IS NULL)');
    143     while($DbRow = $DbResult->fetch_assoc())
     143    while ($DbRow = $DbResult->fetch_assoc())
    144144    {
    145145      $Output .= '<tr><td>'.$DbRow['Name'].'</td><td>'.$DbRow['Price'].'</td></tr>';
     
    152152
    153153    $Output .= '</td></tr></table>';
    154     return($Output);
     154    return ($Output);
    155155  }
    156156}
Note: See TracChangeset for help on using the changeset viewer.