Ignore:
Timestamp:
Jan 2, 2015, 11:16:56 PM (10 years ago)
Author:
chronos
Message:
  • Added: Support for Hidden items in form types values.
  • Added: Support for Filtered items in form types values.
  • Modified: FinanceOperation Value splitted to (Direction * Value). Direction can be +1 or -1 depends on if money goes out or in company.
  • Added: Menu "Incomes and spends" is now splitted to incomes/spends of bank account or treasury. Direction and document line is filled automatically.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/IS/IS.php

    r711 r719  
    2626    $this->System->FormManager->ShowRelation = true;
    2727
     28    // a - action
    2829    if(array_key_exists('a', $_GET)) $Action = $_GET['a'];
    2930      else $Action = '';
     31    // t - table
    3032    if(array_key_exists('t', $_GET)) $Table = $_GET['t'];
    3133      else $Table = '';
     34    // i - index of item
    3235    if(array_key_exists('i', $_GET)) $ItemId = $_GET['i'];
    3336      else $ItemId = 0;
     37    // fc - preset colum
     38    if(array_key_exists('fn', $_GET)) $FilterName = $_GET['fn'];
     39      else $FilterName = '';
     40    if(array_key_exists('fv', $_GET)) $FilterValue = $_GET['fv'];
     41      else $FilterValue = '';
    3442    if(array_key_exists('menutype', $_COOKIE)) $MenuType = $_COOKIE['menutype'];
    3543      else $MenuType = 0;
     
    3745    setcookie('menutype', $MenuType, time() + 60 * 60 * 24 * 365);
    3846
    39     if($Action == 'list') $Content = $this->ShowList($Table);
     47    if($Action == 'list') {
     48        if($FilterName == '') $Content = $this->ShowList($Table);
     49          else $Content = $this->ShowList($Table, '', '', $FilterName, $FilterValue);
     50    }
    4051    else if($Action == 'select') $Content = $this->ShowSelect($Table);
    4152    else if($Action == 'mapselect') $Content = $this->ShowMapSelect($Table);
     
    7081  {
    7182    $Output = '<strong>Nástěnka:</strong><br/>';
    72     $DbResult = $this->Database->select('Task', 'COUNT(*)', 'Progress < 100');
     83    $DbResult = $this->Database->select('Task', 'COUNT(*)', '`Progress` < 100');
    7384    $DbRow = $DbResult->fetch_row();
    7485    $Output .= 'Nedokončených úkolů: '.$DbRow['0'].'<br/>';
     86   
    7587    $DbResult = $this->Database->select('Member', 'COUNT(*)', '1');
    7688    $DbRow = $DbResult->fetch_row();
    7789    $Output .= 'Zákazníků: '.$DbRow['0'].'<br/>';
     90   
    7891    $DbResult = $this->Database->select('Subject', 'COUNT(*)', '1');
    7992    $DbRow = $DbResult->fetch_row();
    8093    $Output .= 'Subjektů: '.$DbRow['0'].'<br/>';
     94   
    8195    $DbResult = $this->Database->select('User', 'COUNT(*)', '1');
    8296    $DbRow = $DbResult->fetch_row();
    8397    $Output .= 'Uživatelů: '.$DbRow['0'].'<br/>';
     98   
    8499    $DbResult = $this->Database->select('NetworkDevice', 'COUNT(*)', '1');
    85100    $DbRow = $DbResult->fetch_row();
    86101    $Output .= 'Registrovaných zařízení: '.$DbRow['0'].'<br/>';
    87     $DbResult = $this->Database->select('FinanceOperation', 'SUM(Value)', '1');
     102   
     103    $DbResult = $this->Database->select('FinanceOperation', 'SUM(`Value` * `Direction`)', '1');
    88104    $DbRow = $DbResult->fetch_row();
    89105    $Output .= 'Stav placení: '.$DbRow['0'].'<br/>';
    90     $DbResult = $this->Database->select('FinanceBankImport', 'COUNT(*)', 'FinanceOperation IS NULL');
     106   
     107    $DbResult = $this->Database->select('FinanceBankImport', 'COUNT(*)', '`FinanceOperation` IS NULL');
    91108    $DbRow = $DbResult->fetch_row();
    92109    $Output .= 'Nezpárovaných plateb: '.$DbRow['0'].'<br/>';
     
    397414      else $SourceTable = '`'.$FormClass['Table'].'` AS `TX`';
    398415
     416    // Build form type filter
     417    $TypeFilter = '';
     418    foreach($FormClass['Items'] as $ItemIndex => $FormItem)   
     419    if(!array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) or
     420    (array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) and
     421    ($this->System->FormManager->FormTypes[$FormItem['Type']]['Type'] != 'ManyToOne')))
     422    if(array_key_exists('Filter', $FormItem) and ($FormItem['Filter'] == true))
     423    {
     424        if($TypeFilter != '') $TypeFilter .= ' AND ';           
     425        $TypeFilter .= '('.$ItemIndex.' = "'.$FormItem['Default'].'")';
     426    }     
     427    if($TypeFilter != '')
     428    {
     429        if($Filter != '') $Filter = ' AND';
     430        $Filter .= ' '.$TypeFilter;
     431    }
     432   
    399433    // Build user filter
    400434    $UserFilter = '';
     
    403437    {
    404438      foreach($FormClass['Items'] as $ItemIndex => $FormItem)
     439      if(!array_key_exists('Hidden', $FormItem) or ($FormItem['Hidden'] == false))
    405440      if(!array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) or
    406441      (array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) and
     
    435470    if($Filter != '') $Filter = ' HAVING '.$Filter;
    436471
    437     foreach($FormClass['Items'] as $ItemIndex => $FormItem)
     472    foreach($FormClass['Items'] as $ItemIndex => $FormItem)     
    438473      if(!array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) or
    439474      (array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) and
     
    441476      {
    442477        if($ExcludeColumn != $ItemIndex)
     478        if(!array_key_exists('Hidden', $FormItem) or ($FormItem['Hidden'] == false))
    443479          $TableColumns[] = array('Name' => $ItemIndex, 'Title' => $FormItem['Caption']);
    444480        $UseType = $UseType = $FormItem['Type'];
     
    499535    $Output .= '<tr><form action="?a='.$_GET['a'].'&amp;t='.$Table.'&amp;filter=1'.$Addition.'" method="post">';
    500536    foreach($FormClass['Items'] as $ItemIndex => $FormItem)
     537    if(!array_key_exists('Hidden', $FormItem) or ($FormItem['Hidden'] == false))
    501538    if((!array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) or
    502539    (array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) and
     
    520557      $Output .= '<tr>';
    521558      foreach($FormClass['Items'] as $ItemIndex => $FormItem)
     559      if(!array_key_exists('Hidden', $FormItem) or ($FormItem['Hidden'] == false))
    522560      if((!array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) or
    523561      (array_key_exists($FormItem['Type'], $this->System->FormManager->FormTypes) and
Note: See TracChangeset for help on using the changeset viewer.