Changeset 507 for trunk/finance


Ignore:
Timestamp:
Apr 1, 2013, 7:14:59 PM (12 years ago)
Author:
chronos
Message:
  • Opraveno: Generování nastavení sítě. Generování front Queue nyní pracuje s přiřazením služeb k zařízením a podsítím.
  • Opraveno: Zjišťování adresáře souborů na disku dle id adresáře.
Location:
trunk/finance
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/finance/finance.php

    r497 r507  
    2626  var $Tariffs;
    2727  var $ExternalSubject = 96;
    28   var $MainSubject = 71;
     28  var $MainSubject;
    2929  var $BillingPeriods;
     30  var $DirectoryId;
    3031 
    3132  function LoadTariffs()
     
    3536    while($Tariff = $DbResult->fetch_array())
    3637    {
    37       $Tariff['InternetSpeedMin'] = $Tariff['InternetSpeedMin'] * 1024;
    38       $Tariff['InternetSpeedMax'] = $Tariff['InternetSpeedMax'] * 1024;
     38      $Tariff['InternetSpeedMin'] = $Tariff['InternetSpeedMin'] * 1000;
     39      $Tariff['InternetSpeedMax'] = $Tariff['InternetSpeedMax'] * 1000;
    3940      $this->Tariffs[$Tariff['Id']] = $Tariff;
    4041    } 
     
    4344  function RecalculateTariffs()
    4445  {
    45     $ResidualSpeed = $this->MaxSpeed * 1024;
     46    $ResidualSpeed = $this->MaxSpeed * 1000;
    4647 
    4748    $this->LoadTariffs();
     
    9293      }
    9394      $this->Database->update('Service', 'Id='.$Tariff['Id'],
    94         array('InternetSpeedMin' => ($Tariff['InternetSpeedMin'] / 1024),
     95        array('InternetSpeedMin' => ($Tariff['InternetSpeedMin'] / 1000),
    9596        'CustomerCount' => $Tariff['CustomerCount']));
    9697    }
     
    211212        else $MonthlyInet = 0;
    212213     
    213       //if($Row['inet'] == 1)
    214214      $Monthly += $MonthlyInet;
    215215      $Monthly -= $this->W2Kc($ConsumptionPlus);
    216       $Monthly -= $Member['Hire'];
    217       //if($Row['overheads'] == 1) $Monthly += $Sprava; // + W2Kc($Consumption);
    218216      $Monthly = round($Monthly);
    219217     
  • trunk/finance/manage.php

    r505 r507  
    381381      }
    382382      $Period = $this->GetBillingPeriod($Member['BillingPeriod']);
    383       if(($Period['From'] > $Member['UNIX_TIMESTAMP(Member.BillingPeriodLastDate)']) and
    384           ($Member['Blocked'] == 0))
     383      if(($Period['MonthCount'] > 0) and ($Member['Blocked'] == 0) and
     384        ($Period['From'] > $Member['UNIX_TIMESTAMP(Member.BillingPeriodLastDate)']))
    385385      {
    386386        $InvoiceItems = array();
     
    398398          $MonthlyTotal += $Service['Price'];
    399399        }
    400         if($Member['Hire'] != 0)
    401         {
    402           $Output .= '<tr><td>Nájem</td><td>'.(-$Member['Hire']).'</td></tr>';
    403           $MonthlyTotal -= $Member['Hire'];
    404         }
    405400        if($Member['MonthlyPlus'] != 0)
    406401        {
     402          $InvoiceItems[] = array('Description' => 'Spotřeba energie', 'Price' => -$Member['MonthlyPlus'],
     403            'Quantity' => $Period['MonthCount'], 'VAT' => 2);
    407404          $MonthlyTotal -= $Member['MonthlyPlus'];
    408405        }
     
    610607    while($Row = $DbResult->fetch_assoc())
    611608    {
    612       $DbResult2 = $this->Database->insert('File', array('Name' => '', 'Size' => 0));
     609      $DbResult2 = $this->Database->insert('File', array('Name' => '', 'Size' => 0,
     610        'Directory' => $this->System->Modules['Finance']->DirectoryId, 'Time' => 'NOW()'));
    613611      $FileId = $this->Database->insert_id;
    614612      $FileName = 'doklad-'.$FileId.'.pdf';
     
    617615      $Bill->System = &$this->System;
    618616      $Bill->InvoiceId = $Row['Id'];
    619       $FullFileName = $this->System->Modules['File']->FilesDir.$FileName;
     617      $FullFileName = $this->System->Modules['File']->GetDir($this->System->Modules['Finance']->DirectoryId).$FileName;
    620618      $Bill->SaveToFile($FullFileName);
    621       $this->Database->update('File', 'Id='.$FileId, array('Name' => $FileName, 'Size' => filesize($FullFileName)));
    622       $this->Database->update('FinanceInvoice', 'Id='.$Row['Id'], array('File' => $FileId));
    623       $Output .= '.';
     619      if(file_exists($FullFileName))
     620      {
     621        $this->Database->update('File', 'Id='.$FileId, array('Name' => $FileName, 'Size' => filesize($FullFileName)));
     622        $this->Database->update('FinanceInvoice', 'Id='.$Row['Id'], array('File' => $FileId));
     623        $Output .= '.';
     624      } else $Output .= 'Soubor "'.$FullFileName.'" se nepodařilo uložit.';
    624625    }
    625626
  • trunk/finance/tarify.php

    r479 r507  
    2525    {
    2626      $Tariff['Aggregation'] = '1:'.round($Tariff['InternetSpeedMax'] / $Tariff['InternetSpeedMin']);
    27       $Output .= '<tr><td style="color: blue;">'.$Tariff['Name'].'</td><td align="center">'.round($Tariff['InternetSpeedMin'] / 1024).'</td><td align="center" style="color: blue;">'.round($Tariff['InternetSpeedMax'] / 1024).'</td><td align="center">'.$Tariff['Aggregation'].'</td><td align="center">'.$Tariff['CustomerCount'].'</td><td align="center" style="color: blue;">'.$Tariff['Price'].'</td><td align="center">'.$Tariff['CustomerCount'] * $Tariff['Price'].'</td></tr>';
     27      $Output .= '<tr><td style="color: blue;">'.$Tariff['Name'].'</td><td align="center">'.round($Tariff['InternetSpeedMin'] / 1000).'</td><td align="center" style="color: blue;">'.round($Tariff['InternetSpeedMax'] / 1000).'</td><td align="center">'.$Tariff['Aggregation'].'</td><td align="center">'.$Tariff['CustomerCount'].'</td><td align="center" style="color: blue;">'.$Tariff['Price'].'</td><td align="center">'.$Tariff['CustomerCount'] * $Tariff['Price'].'</td></tr>';
    2828      $TotalPrice = $TotalPrice + $Tariff['Price'] * $Tariff['CustomerCount'];
    2929      $TotalMemberCount = $TotalMemberCount + $Tariff['CustomerCount'];
  • trunk/finance/user_state.php

    r499 r507  
    8585      if($Row['Value'] > 0) $Row['Value'] = '+'.$Row['Value'];
    8686      if($Row['BillCode'] == '') $Row['BillCode'] = 'PDF';
    87       if($Row['File'] > 0) $Invoice = '<a href="'.$this->System->Link('/FileDownload.php?id='.$Row['File']).'">'.$Row['BillCode'].'</a>';
     87      if($Row['File'] > 0) $Invoice = '<a href="'.$this->System->Link('/file?id='.$Row['File']).'">'.$Row['BillCode'].'</a>';
    8888        else $Invoice = '&nbsp;';
    8989      if($Row['PeriodFrom'] != '') $Period = HumanDate($Row['PeriodFrom']).' - '.HumanDate($Row['PeriodTo']);
     
    118118    }
    119119   
    120     if($Member['Hire'] != 0)
    121     {
    122       $Output .= '<tr><td>Nájem</td><td>'.(-$Member['Hire']).'</td></tr>';
    123       $Total -= $Member['Hire'];
    124     }
    125120    if($Member['MonthlyPlus'] != 0)
    126121    {
  • trunk/finance/zivnost.php

    r486 r507  
    88  var $ShortTitle = 'Daňová evidence';
    99  var $ExternalSubject = 96;
    10   var $MainSubject = 71;
    1110  var $StartEvidence = 0;
    1211
Note: See TracChangeset for help on using the changeset viewer.