Ignore:
Timestamp:
Feb 5, 2013, 9:45:44 PM (12 years ago)
Author:
chronos
Message:
  • Přidáno: Tabulka pro přiřazení více služeb jednomu zákazníkovi. Původní data jsou převedena do nové struktury. Tabulka Service je společná pro všechny typy služeb a pro každou službu se zobrazí nebo vyplní pouze určité použitelné sloupce.
  • Opraveno: Korekce názvů modulů na názvy začínající slovem Module.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/finance/zivnost.php

    r454 r479  
    291291        break;
    292292      case 'SubjectAccount':
     293        $Output .= '<table style="width: 100%"><tr><td style="vertical-align: top;">';
    293294        $Output .= '<strong>Výpis příjmů/výdajů</strong>';
    294295        $Output .= '<table style="font-size: smaller;" border="1" cellspacing="0" cellpadding="3">';
    295         $Output .= '<tr><th>Datum</th><th>Název</th><th>Hodnota [Kč]</th></tr>';
    296         $DbResult = $this->Database->select('FinanceCashFlow', '*', 'Subject='.$_GET['Id']);
    297         while($Row = $DbResult->fetch_array())
    298         {
    299           $Output .= '<tr><td>'.$Row['Time'].'</td><td>'.$Row['Text'].'</td><td>'.$Row['Value'].'</td><td>'.$Row['Bill'].'</td></tr>';
    300         }
    301         $Output .= '</table><br />';
     296        $Output .= '<tr><th>Datum</th><th>Název</th><th>Hodnota [Kč]</th><th>Doklad</th></tr>';
     297        $DbResult = $this->Database->select('FinanceOperation', '*', 'Subject='.$_GET['Id'].' ORDER BY Time');
     298        while($Row = $DbResult->fetch_array())
     299        {
     300          $Output .= '<tr><td>'.HumanDate($Row['Time']).'</td><td>'.$Row['Text'].
     301            '</td><td>'.$Row['Value'].'</td><td>'.$Row['BillCode'].'</td></tr>';
     302        }
     303        $Output .= '</table></td><td style="vertical-align: top;">';
    302304
    303305        $Output .= '<strong>Výpis závazků/pohledávek</strong>';
    304306        $Output .= '<table style="font-size: smaller;" border="1" cellspacing="0" cellpadding="3">';
    305         $Output .= '<tr><th>Datum vytvoření</th><th>Datum zaplacení</th><th>Název</th><th>Hodnota [Kč]</th></tr>';
    306         $DbResult = $this->Database->select('FinanceClaimsLiabilities', '*', 'Subject='.$_GET['Id']);
    307         while($Row = $DbResult->fetch_array())
    308         {
    309           $Output .= '<tr><td>'.$Row['TimeCreation'].'</td><td>'.$Row['TimePayment'].'</td><td>'.$Row['Text'].'</td><td>'.(-$Row['Value']).'</td><td>'.$Row['Bill'].'</td></tr>';
    310         }
    311         $Output .= '</table><br />';
    312 
    313         $Output .= '<strong>Výpis záloh</strong>';
     307        $Output .= '<tr><th>Datum vytvoření</th><th>Datum zaplacení</th><th>Název</th><th>Hodnota [Kč]</th><th>Doklad</th></tr>';
     308        $DbResult = $this->Database->select('FinanceClaimsLiabilities', '*', 'Subject='.$_GET['Id'].' ORDER BY TimeCreation');
     309        while($Row = $DbResult->fetch_array())
     310        {
     311          $Output .= '<tr><td>'.HumanDate($Row['TimeCreation']).'</td><td>'.HumanDate($Row['TimePayment']).
     312            '</td><td>'.$Row['Text'].'</td><td>'.($Row['Value']).'</td><td>'.$Row['BillCode'].'</td></tr>';
     313        }
     314        $Output .= '</table></td></tr></table>';
     315
     316        /*$Output .= '<strong>Výpis záloh</strong>';
    314317        $Output .= '<table style="font-size: smaller;" border="1" cellspacing="0" cellpadding="3">';
    315318        $Output .= '<tr><th>Datum vytvoření</th><th>Datum zaplacení</th><th>Název</th><th>Hodnota [Kč]</th></tr>';
     
    319322          $Output .= '<tr><td>'.$Row['TimeCreation'].'</td><td>'.$Row['TimePass'].'</td><td>'.$Row['Direction'].'</td><td>'.($Row['Value']).'</td><td>'.$Row['CashFlowId'].'</td></tr>';
    320323        }
    321         $Output .= '</table>';
    322 
    323         $DbResult = $this->Database->query('SELECT Id, 0 AS Cash, (SELECT SUM(FinanceClaimsLiabilities.Value) FROM FinanceClaimsLiabilities WHERE FinanceClaimsLiabilities.Subject = Subject.Id AND FinanceClaimsLiabilities.Value > 0) as Claims, (SELECT SUM(FinanceClaimsLiabilities.Value) FROM FinanceClaimsLiabilities WHERE FinanceClaimsLiabilities.Subject = Subject.Id AND FinanceClaimsLiabilities.Value > 0 AND TimePayment IS NULL) as OpenedClaims, (SELECT SUM(FinanceClaimsLiabilities.Value) FROM FinanceClaimsLiabilities WHERE FinanceClaimsLiabilities.Subject = Subject.Id AND FinanceClaimsLiabilities.Value < 0) as Liabilities, (SELECT SUM(FinanceClaimsLiabilities.Value) FROM FinanceClaimsLiabilities WHERE FinanceClaimsLiabilities.Subject = Subject.Id AND FinanceClaimsLiabilities.Value < 0 AND TimePayment IS NULL) as OpenedLiabilities, (SELECT SUM(FinanceCashFlow.Value) FROM FinanceCashFlow WHERE FinanceCashFlow.Subject = Subject.Id AND FinanceCashFlow.Value > 0) as Gains, (SELECT SUM(FinanceCashFlow.Value) FROM FinanceCashFlow WHERE FinanceCashFlow.Subject = Subject.Id AND FinanceCashFlow.Value < 0) as Spends, (SELECT SUM(FinanceAdvances.Value) FROM FinanceAdvances WHERE FinanceAdvances.Subject = Subject.Id AND FinanceAdvances.Direction="In") as AdvancesIn, (SELECT SUM(FinanceAdvances.Value) FROM FinanceAdvances WHERE FinanceAdvances.Subject = Subject.Id AND FinanceAdvances.Direction="Out") as AdvancesOut FROM Subject WHERE Id='.$_GET['Id']);
     324        $Output .= '</table>';*/
     325
     326        $DbResult = $this->Database->query('SELECT Id, 0 AS Cash, (SELECT SUM(FinanceClaimsLiabilities.Value) '.
     327          'FROM FinanceClaimsLiabilities WHERE FinanceClaimsLiabilities.Subject = Subject.Id AND '.
     328          'FinanceClaimsLiabilities.Value > 0) as Claims, (SELECT SUM(FinanceClaimsLiabilities.Value) '.
     329          'FROM FinanceClaimsLiabilities WHERE FinanceClaimsLiabilities.Subject = Subject.Id AND '.
     330          'FinanceClaimsLiabilities.Value > 0 AND TimePayment IS NULL) as OpenedClaims, '.
     331          '(SELECT SUM(FinanceClaimsLiabilities.Value) FROM FinanceClaimsLiabilities '.
     332          'WHERE FinanceClaimsLiabilities.Subject = Subject.Id AND FinanceClaimsLiabilities.Value < 0) AS '.
     333          'Liabilities, (SELECT SUM(FinanceClaimsLiabilities.Value) FROM FinanceClaimsLiabilities '.
     334          'WHERE FinanceClaimsLiabilities.Subject = Subject.Id AND FinanceClaimsLiabilities.Value < 0 '.
     335          'AND TimePayment IS NULL) as OpenedLiabilities, (SELECT SUM(FinanceOperation.Value) '.
     336          'FROM FinanceOperation WHERE FinanceOperation.Subject = Subject.Id AND FinanceOperation.Value > 0) '.
     337          'AS Gains, (SELECT SUM(FinanceOperation.Value) FROM FinanceOperation WHERE '.
     338          'FinanceOperation.Subject = Subject.Id AND FinanceOperation.Value < 0) as Spends '.
     339          'FROM Subject WHERE Id='.$_GET['Id']);
    324340        $Row = $DbResult->fetch_array();
    325         $Output .= 'Stav placení: '.($Row['AdvancesIn'] - $Row['AdvancesOut'] - $Row['OpenedClaims'] + Abs($Row['OpenedLiabilities']));
     341        $Output .= 'Stav placení: '.(-$Row['OpenedClaims'] + Abs($Row['OpenedLiabilities']));
    326342        break;
    327343      case 'PrintMonthOperations':
Note: See TracChangeset for help on using the changeset viewer.