Changeset 558


Ignore:
Timestamp:
Jul 21, 2013, 10:55:49 PM (11 years ago)
Author:
chronos
Message:
  • Opraveno: Chyba při zobrazení zařízení zákazníků pokud není žádný přihlášený.
  • Přidáno: Generování příjmových a výdajových dokladů.
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Common/Version.php

    r556 r558  
    11<?php
    22
    3 $Revision = 556; // Subversion revision
     3$Revision = 558; // Subversion revision
    44$DatabaseRevision = 551; // SQL structure revision
    5 $ReleaseTime = '2013-07-15';
     5$ReleaseTime = '2013-07-21';
    66
  • trunk/Modules/Finance/Bill.php

    r548 r558  
    3232  function GenerateHTML()
    3333  {
    34     global $SpecificSymbol, $Config;
    35    
    3634    $DbResult = $this->Database->select('FinanceInvoice', '*', '`Id`='.$this->InvoiceId);
    3735    $Invoice = $DbResult->fetch_assoc();
     
    4038    $Subject = $DbResult->fetch_assoc();
    4139   
    42     $DbResult = $this->Database->select('Subject', '*', '`Id`='.$Config['Finance']['MainSubjectId']);
     40    $DbResult = $this->Database->select('Subject', '*', '`Id`='.$this->System->Config['Finance']['MainSubjectId']);
    4341    $MainSubject = $DbResult->fetch_assoc();
    4442   
    4543    $DbResult = $this->Database->query('SELECT FinanceBankAccount.*, CONCAT(FinanceBankAccount.Number, "/", FinanceBank.Code) AS NumberFull FROM FinanceBankAccount '.
    4644      'JOIN FinanceBank ON FinanceBank.Id=FinanceBankAccount.Bank '.
    47       'WHERE (FinanceBankAccount.`Subject`='.$Config['Finance']['MainSubjectId'].') AND (FinanceBankAccount.`Use`=1)');
     45      'WHERE (FinanceBankAccount.`Subject`='.$this->System->Config['Finance']['MainSubjectId'].') AND (FinanceBankAccount.`Use`=1)');
    4846    $MainSubjectAccount = $DbResult->fetch_assoc();
    4947   
     
    132130    $Subject = $DbResult->fetch_assoc();
    133131   
    134     $DbResult = $this->Database->select('Subject', '*', '`Id`='.$Config['Finance']['MainSubjectId']);
     132    $DbResult = $this->Database->select('Subject', '*', '`Id`='.$this->System->Config['Finance']['MainSubjectId']);
    135133    $MainSubject = $DbResult->fetch_assoc();
    136134   
    137135    $DbResult = $this->Database->query('SELECT FinanceBankAccount.*, CONCAT(FinanceBankAccount.Number, "/", FinanceBank.Code) AS NumberFull FROM FinanceBankAccount '.
    138136      'JOIN FinanceBank ON FinanceBank.Id=FinanceBankAccount.Bank '.
    139       'WHERE (FinanceBankAccount.`Subject`='.$Config['Finance']['MainSubjectId'].') AND (FinanceBankAccount.`Use`=1)');
     137      'WHERE (FinanceBankAccount.`Subject`='.$this->System->Config['Finance']['MainSubjectId'].') AND (FinanceBankAccount.`Use`=1)');
    140138    $MainSubjectAccount = $DbResult->fetch_assoc();
    141139   
     
    146144    //  $InvoiceItems[$Item['Id']] = $Item;
    147145    //}
     146    $BooleanText = array('Ne', 'Ano');
     147    if($Operation['Value'] < 0)
     148    $Desc = array(
     149      'Type' => 'VÝDAJOVÝ',
     150      'Signature' => 'Vydal',
     151      'Sign' => -1,
     152      'Target' => 'Vydáno komu',
     153    );
     154    else $Desc = array(
     155      'Type' => 'PŘÍJMOVÝ',
     156      'Signature' => 'Přijal',
     157      'Sign' => 1,
     158      'Target' => 'Přijato od',
     159    );
    148160
    149161    $Output = '<table width="100%" border="1" cellspacing="0" cellpadding="3"><tr><td width="50%">'.
     
    157169      'Plátce DPH: '.$BooleanText[$MainSubject['PayVAT']].
    158170      '</td><td width="50%" valign="top">'.
    159       '<font size="5"><strong>PŘÍJMOVÝ POKLADNÍ DOKLAD</strong></font><br><br>'.
    160       'Číslo dokladu: '.$Bill['BillCode'].'<br>'.
    161       'Datum vystavení: '.HumanDate($Bill['TimeCreate']).'<br>'.
     171      '<font size="5"><strong>'.$Desc['Type'].' POKLADNÍ DOKLAD</strong></font><br><br>'.
     172      'Číslo dokladu: '.$Operation['BillCode'].'<br>'.
     173      'Datum vystavení: '.HumanDate($Operation['Time']).'<br>'.
    162174      '</td></tr>'.
    163       '<tr><td colspan="2"><strong>Přijato od:</strong><br>'.
     175      '<tr><td colspan="2"><strong>'.$Desc['Target'].':</strong><br>'.
    164176      $Subject['Name'].'<br>'.
    165177      $Subject['AddressStreet'].'<br>'.
     
    174186    //  $Total += ($Polozka['Quantity'] * $Polozka['Price']);
    175187    //}
     188    $Description = $Operation['Text'];
     189    $Total = $Operation['Value'] * $Desc['Sign'];
    176190    $Output .= '</td></tr>'.
    177191      '<tr><td colspan="2"><strong>Částka:</strong> '.$Total.' Kč<br><br>'.
    178192      '</td></tr>'.
    179193      '<tr><td colspan="2"><strong>Účel platby:</strong><br>'.$Description.'</td></tr>'.
    180       '<tr><td><br><br>Podpis příjemce:</td><td><br><br>Podpis pokladníka:</td></tr>';
     194      '<tr><td>&nbsp;</td><td><br><br>'.$Desc['Signature'].':</td></tr>';
    181195    $Output .= '</table>';
    182196    return($Output);
  • trunk/Modules/Finance/Finance.php

    r553 r558  
    363363        'Taxable' => array('Type' => 'Boolean', 'Caption' => 'Zdanitelné', 'Default' => ''),
    364364        'Value' => array('Type' => 'Integer', 'Caption' => 'Částka', 'Default' => '0', 'Suffix' => 'Kč'),
     365        'File' => array('Type' => 'TFile', 'Caption' => 'Doklad', 'Default' => '', 'Null' => true),
    365366        'Text' => array('Type' => 'String', 'Caption' => 'Popis', 'Default' => ''),
    366367        'Network' => array('Type' => 'Boolean', 'Caption' => 'Týkající sítě', 'Default' => ''),
  • trunk/Modules/Finance/Manage.php

    r553 r558  
    393393
    394394    // FinanceOperations
     395    $DbResult = $this->Database->query('SELECT * FROM `FinanceOperation` WHERE (`BillCode` <> "") '.
     396        'AND (`Value` != 0) AND (`File` IS NULL) AND (`Generate` = 1)');
     397    while($Row = $DbResult->fetch_assoc())
     398    {
     399      $DbResult2 = $this->Database->insert('File', array('Name' => '', 'Size' => 0,
     400          'Directory' => $this->System->Modules['Finance']->DirectoryId, 'Time' => 'NOW()'));
     401      $FileId = $this->Database->insert_id;
     402      $FileName = 'doklad2-'.$FileId.'.pdf';
     403      $Bill = new BillOperation($this->System);
     404      $Bill->Database = &$this->System->Database;
     405      $Bill->System = &$this->System;
     406      $Bill->OperationId = $Row['Id'];
     407      $FullFileName = $this->System->Modules['File']->GetDir($this->System->Modules['Finance']->DirectoryId).$FileName;
     408      $Bill->SaveToFile($FullFileName);
     409      if(file_exists($FullFileName))
     410      {
     411        $this->Database->update('File', 'Id='.$FileId, array('Name' => $FileName, 'Size' => filesize($FullFileName)));
     412        $this->Database->update('FinanceOperation', 'Id='.$Row['Id'], array('File' => $FileId));
     413        $Output .= '.';
     414      } else $Output .= 'Soubor "'.$FullFileName.'" se nepodařilo uložit.';
     415    }   
    395416    return($Output);
    396417  }
  • trunk/Modules/Network/HostList.php

    r548 r558  
    1515    $Output = '<div align="center" style="font-size: small;"><table class="WideTable">';
    1616    $Output .= '<tr><th>Jméno počítače</th><th>IP adresa</th><th>Typ</th><th>Naposledy online</th><th>Správce</th></tr>';
    17     $DbResult = $this->Database->query('SELECT NetworkDevice.*, User.Name as UserName, NetworkDeviceType.Name AS HostType FROM NetworkDevice LEFT JOIN Member ON Member.Id = NetworkDevice.Member LEFT JOIN User ON Member.ResponsibleUser = User.Id LEFT JOIN NetworkDeviceType ON NetworkDeviceType.Id = NetworkDevice.Type WHERE NetworkDevice.Used = 1 '.$Where.'ORDER BY NetworkDevice.Name');
     17    $DbResult = $this->Database->query('SELECT NetworkDevice.*, User.Name as UserName, NetworkDeviceType.Name AS HostType FROM NetworkDevice '.
     18      'LEFT JOIN Member ON Member.Id = NetworkDevice.Member '.
     19      'LEFT JOIN User ON Member.ResponsibleUser = User.Id '.
     20      'LEFT JOIN NetworkDeviceType ON NetworkDeviceType.Id = NetworkDevice.Type WHERE NetworkDevice.Used = 1 '.$Where.'ORDER BY NetworkDevice.Name');
    1821    while($Device = $DbResult->fetch_assoc())
    1922    {
  • trunk/Modules/Network/UserHosts.php

    r548 r558  
    1515    global $Config;
    1616   
     17    if($this->System->User->User['Id'] == '') return($this->SystemMessage('Nepovolený přístup', 'Nemáte oprávnění pro tuto operaci'));
    1718    $Output = '<div align="center" style="font-size: small;"><table class="WideTable">';
    1819    $Output .= '<tr><th>Jméno počítače</th><th>Místní adresa</th><th>Veřejná adresa</th><th>Fyzická adresa</th><th>Typ</th><th>Naposledy online</th></tr>';
    19     $DbResult = $this->Database->query('SELECT NetworkDevice.*, NetworkDeviceType.Name AS HostType FROM NetworkDevice LEFT JOIN NetworkDeviceType ON NetworkDeviceType.Id = NetworkDevice.Type WHERE NetworkDevice.Used = 1 AND NetworkDevice.Member = (SELECT Customer FROM UserCustomerRel WHERE User='.$this->System->User->User['Id'].') ORDER BY NetworkDevice.Name');
     20    $DbResult = $this->Database->query('SELECT NetworkDevice.*, NetworkDeviceType.Name AS HostType FROM NetworkDevice '.
     21      'LEFT JOIN NetworkDeviceType ON NetworkDeviceType.Id = NetworkDevice.Type '.
     22      'WHERE NetworkDevice.Used = 1 AND NetworkDevice.Member = (SELECT Customer FROM UserCustomerRel WHERE User='.$this->System->User->User['Id'].') ORDER BY NetworkDevice.Name');
    2023    while($Device = $DbResult->fetch_assoc())
    2124    {
    2225      if($Device['Online'] == 1) $Style = 'color: blue;'; else $Style = '';
    23       $Output .= '<tr><td colspan="4" style="text-align: left; font-weight: bold; '.$Style.'">'.$Device['Name'].'</td><td>'.$Device['HostType'].'</td><td style="text-align: right;">'.HumanDate($Device['LastOnline']).'</td></tr>';
     26      $Output .= '<tr><td colspan="4" style="text-align: left; font-weight: bold; '.
     27        $Style.'">'.$Device['Name'].'</td><td>'.$Device['HostType'].'</td><td style="text-align: right;">'.HumanDate($Device['LastOnline']).'</td></tr>';
    2428      $DbResult2 = $this->Database->query('SELECT * FROM NetworkInterface WHERE Device = '.$Device['Id']);
    2529      while($Interface = $DbResult2->fetch_assoc())
Note: See TracChangeset for help on using the changeset viewer.