Changeset 738 for trunk/temp


Ignore:
Timestamp:
Apr 14, 2015, 10:20:16 PM (10 years ago)
Author:
chronos
Message:
  • Removed: Spaces on end of line.
  • Modified: Tabs converted to spaces.
Location:
trunk/temp
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/temp/Bills.php

    r627 r738  
    1515  if(strpos($Invoice['Text'], 'Poplatek za měsíc') !== false)
    1616  {
    17         $Time = MysqlDateTimeToTime($Invoice['Time']);
    18         $TimeParts = ExtractTime($Time);
    19         $PeriodFrom = mktime($TimeParts['Hour'], $TimeParts['Minute'], $TimeParts['Second'],
    20                         $TimeParts['Month'], 1, $TimeParts['Year']);
    21         $PeriodTo = mktime($TimeParts['Hour'], $TimeParts['Minute'], $TimeParts['Second'],
    22                         $TimeParts['Month'], date('t', $Time), $TimeParts['Year']);
    23         $System->Database->query('UPDATE FinanceInvoice SET PeriodFrom = "'.TimeToMysqlDate($PeriodFrom).
     17    $Time = MysqlDateTimeToTime($Invoice['Time']);
     18    $TimeParts = ExtractTime($Time);
     19    $PeriodFrom = mktime($TimeParts['Hour'], $TimeParts['Minute'], $TimeParts['Second'],
     20        $TimeParts['Month'], 1, $TimeParts['Year']);
     21    $PeriodTo = mktime($TimeParts['Hour'], $TimeParts['Minute'], $TimeParts['Second'],
     22        $TimeParts['Month'], date('t', $Time), $TimeParts['Year']);
     23    $System->Database->query('UPDATE FinanceInvoice SET PeriodFrom = "'.TimeToMysqlDate($PeriodFrom).
    2424      '", PeriodTo ="'.TimeToMysqlDate($PeriodTo).'" WHERE Id='.$Invoice['Id']);
    2525  }
    2626  if(strpos($Invoice['Text'], 'za období') !== false)
    2727  {
    28         $Period = substr($Invoice['Text'], strpos($Invoice['Text'], 'za období') + 10);
    29         $PeriodFrom = strtotime(substr($Period, 0, strpos($Period, '-')));
    30         $PeriodTo = strtotime(substr($Period, strpos($Period, '-') + 1));
    31         $System->Database->query('UPDATE FinanceInvoice SET PeriodFrom = "'.TimeToMysqlDate($PeriodFrom).
    32                         '", PeriodTo ="'.TimeToMysqlDate($PeriodTo).'" WHERE Id='.$Invoice['Id']);
    33          
     28    $Period = substr($Invoice['Text'], strpos($Invoice['Text'], 'za období') + 10);
     29    $PeriodFrom = strtotime(substr($Period, 0, strpos($Period, '-')));
     30    $PeriodTo = strtotime(substr($Period, strpos($Period, '-') + 1));
     31    $System->Database->query('UPDATE FinanceInvoice SET PeriodFrom = "'.TimeToMysqlDate($PeriodFrom).
     32        '", PeriodTo ="'.TimeToMysqlDate($PeriodTo).'" WHERE Id='.$Invoice['Id']);
     33
    3434  }
    35  
     35
    3636  // SELECT * FROM (SELECT FinanceInvoice.Id, FinanceInvoice.Subject, FinanceInvoice.Value, (SELECT SUM(FinanceBillsItems.Price) FROM FinanceBillsItems WHERE FinanceBillsItems.Bill = FinanceBills.Id) AS BillPrice, (SELECT COUNT(FinanceBillsItems.Price) FROM FinanceBillsItems WHERE FinanceBillsItems.Bill = FinanceBills.Id) AS BillCount, (SELECT GROUP_CONCAT(FinanceBillsItems.Description SEPARATOR ",") FROM FinanceBillsItems WHERE FinanceBillsItems.Bill = FinanceBills.Id GROUP BY FinanceBillsItems.Bill) AS Items, FinanceInvoice.Text FROM `FinanceInvoice` LEFT JOIN FinanceBills ON FinanceBills.Id = FinanceInvoice.Bill WHERE FinanceInvoice.Bill IS NOT NULL) AS T WHERE Text <> Items AND Items <> "Poplatek za připojení k síti"
    37  
     37
    3838  while($BillItem = $DbResult3->fetch_assoc())
    3939  {
  • trunk/temp/FioCVSToSQL.php

    r572 r738  
    2121  $Value = str_replace(' ', '', $Value);
    2222  $Text = $Line[9];
    23   if($Value > 0) 
     23  if($Value > 0)
    2424  {
    2525    $BillCode = 'BV'.$BVId.'/2013';
     
    3131  }
    3232  if($Subject == '0094579415') $Subject = 72;
    33  
     33
    3434  $Output .= "INSERT INTO `FinanceOperation` (`Id`, `Time`, `Subject`, `Cash`, `Value`, `BillCode`, `Taxable`, `File`, `Text`, `Network`, `BankAccount`, `Treasury`) VALUES
    3535(NULL, '".TimeToMySQLDateTime($Date)."', ".$Subject.", 0, '".$Value."', '".$BillCode."', 1, NULL, '".$Text."', 1, 2, NULL);\n";
  • trunk/temp/meteo/Image.php

    r548 r738  
    1212  var $FileName;
    1313  var $Color;
    14  
    15   function __construct() 
     14
     15  function __construct()
    1616  {
    1717    $this->Color = COLOR_BLACK;
     
    2727  var $Y;
    2828
    29   function __construct() 
     29  function __construct()
    3030  {
    3131    $this->Color = COLOR_BLACK;
     
    4040  var $Color;
    4141
    42   function __construct() 
     42  function __construct()
    4343  {
    4444    $this->Color = COLOR_BLACK;
     
    4747}
    4848
    49 class Image 
     49class Image
    5050{
    51   var $Image; 
     51  var $Image;
    5252  var $Type;
    5353  var $Font;
    5454  var $Pen;
    55  
     55
    5656  function __construct()
    5757  {
     
    5959    $this->Type = IMAGETYPE_PNG;
    6060    $this->Pen = new Pen();
    61     $this->Font = new Font();   
    62     $this->Brush = new Brush();   
     61    $this->Font = new Font();
     62    $this->Brush = new Brush();
    6363  }
    64  
     64
    6565  function SaveToFile($FileName)
    6666  {
    67     if($this->Type == IMAGETYPE_JPEG) 
     67    if($this->Type == IMAGETYPE_JPEG)
    6868    {
    6969      imagejpeg($this->Image, $FileName);
    7070    } else
    71     if($this->Type == IMAGETYPE_GIF) 
     71    if($this->Type == IMAGETYPE_GIF)
    7272    {
    7373      imagegif($this->Image, $FileName);
    7474    } else
    75     if($this->Type == IMAGETYPE_PNG) 
     75    if($this->Type == IMAGETYPE_PNG)
    7676    {
    7777      imagepng($this->Image, $FileName);
    7878    }
    7979  }
    80  
     80
    8181  function LoadFromFile($FileName)
    8282  {
    8383    $ImageInfo = getimagesize($FileName);
    8484    $this->Type = $ImageInfo[2];
    85     if($this->Type == IMAGETYPE_JPEG) 
     85    if($this->Type == IMAGETYPE_JPEG)
    8686    {
    8787      $this->Image = imagecreatefromjpeg($FileName);
    8888    } else
    89     if($this->Type == IMAGETYPE_GIF) 
     89    if($this->Type == IMAGETYPE_GIF)
    9090    {
    9191      $this->Image = imagecreatefromgif($FileName);
    9292    } else
    93     if( $this->Type == IMAGETYPE_PNG) 
     93    if( $this->Type == IMAGETYPE_PNG)
    9494    {
    9595      $this->Image = imagecreatefrompng($FileName);
    96     } 
     96    }
    9797  }
    98  
     98
    9999  function Output()
    100100  {
     
    103103
    104104  function SetSize($Width, $Height)
    105   {     
     105  {
    106106    $NewImage = imagecreatetruecolor($Width, $Height);
    107     imagecopy($NewImage, $this->Image, 0, 0, 0, 0, $this->GetWidth(), $this->GetHeight());     
     107    imagecopy($NewImage, $this->Image, 0, 0, 0, 0, $this->GetWidth(), $this->GetHeight());
    108108    imagedestroy($this->Image);
    109109    $this->Image = $NewImage;
    110110  }
    111111
    112   function GetWidth() 
    113   { 
     112  function GetWidth()
     113  {
    114114    return(imagesx($this->Image));
    115115  }
    116  
    117   function GetHeight() 
     116
     117  function GetHeight()
    118118  {
    119119    return(imagesy($this->Image));
    120120  }
    121  
     121
    122122  function TextOut($X, $Y, $Text)
    123123  {
    124124    imagettftext($this->Image, $this->Font->Size, 0, $X, $Y, $this->ConvertColor($this->Font->Color), $this->Font->FileName, $Text);
    125125  }
    126  
     126
    127127  function TextWidth($Text)
    128128  {
     
    130130    return(abs($Box[4] - $Box[0]));
    131131  }
    132  
     132
    133133  function TextHeight($Text)
    134134  {
     
    136136    return(abs($Box[5] - $Box[1]));
    137137  }
    138  
     138
    139139  function ConvertColor($Color)
    140140  {
    141141    return(imagecolorallocate($this->Image, ($Color >> 16) & 0xff, ($Color >> 8) & 0xff, $Color & 0xff));
    142142  }
    143  
     143
    144144  function FillRect($X1, $Y1, $X2, $Y2)
    145145  {
    146146    imagefilledrectangle($this->Image, $X1, $Y1, $X2, $Y2, $this->ConvertColor($this->Brush->Color));
    147147  }
    148  
     148
    149149  function Line($X1, $Y1, $X2, $Y2)
    150150  {
  • trunk/temp/meteo/load_meteo.php

    r737 r738  
    33include('Image.php');
    44
    5 class MeteoStation 
     5class MeteoStation
    66{
    77  var $Id;
     
    2828    $this->Data = $Data;
    2929  }
    30  
     30
    3131  function DownloadData()
    3232  {
    3333    $XmlData = simplexml_load_file($this->URL);
    3434
    35     $Data = array('MeteoStation' => $this->Id, 
     35    $Data = array('MeteoStation' => $this->Id,
    3636      'WindSpeed' => trim($XmlData->windspeed),
    3737      'WindDir' => trim($XmlData->winddir),
     
    6161      'DewPoint' => $this->Data['DewPoint']));
    6262  }
    63  
     63
    6464  function CreateImage($FileName)
    6565  {
     
    9595    $Image->SaveToFile($FileName);
    9696  }
    97  
     97
    9898  function LoadFromDb()
    9999  {
     
    124124  foreach($Meteo->Data as $Index => $Item)
    125125  {
    126     $Collect[$Index][] = $Item; 
     126    $Collect[$Index][] = $Item;
    127127  }
    128   if(($I % 6) == 0) 
     128  if(($I % 6) == 0)
    129129  {
    130130    foreach($Collect as $Index => $Item)
  • trunk/temp/product.php

    r548 r738  
    1313{
    1414  echo($DbRow['Name'].', ');
    15  
    16   $System->Database->insert('Product', array('Name' => $DbRow['Name'], 
     15
     16  $System->Database->insert('Product', array('Name' => $DbRow['Name'],
    1717    'SellPrice' => $DbRow['Price'], 'BuyPrice' => $DbRow['Price'],
    1818    'Consumption' => $DbRow['Consumption'], 'UnitOfMeasure' => 1, 'VAT' => 20));
     
    2525    case 2: $Elimination = NULL; break;
    2626  }
    27        
     27
    2828  //  else $Elimination = $DbRow['TimeElimination'];
    2929  if($DbRow['Used'] == 2) $DbRow['User'] = NULL;
    3030  echo($DbRow['Used'].'"'.$Elimination.'"<br/>');
    3131//  print_r(array('Stock' => 1, 'Product' => $ProductId, 'Amount' => $DbRow['Count'],
    32 //    'Segment' => $DbRow['Segment'], 'TimeEnlistment' => $DbRow['Date'], 'TimeElimination' => $Elimination, 
     32//    'Segment' => $DbRow['Segment'], 'TimeEnlistment' => $DbRow['Date'], 'TimeElimination' => $Elimination,
    3333//    'SerialNumber' => $DbRow['DeviceId'], 'BuyPrice' => $DbRow['Price'], 'SellPrice' => $DbRow['Price'],
    3434//    'Location' => $DbRow['User'], 'Info' => $DbRow['Info']));
    3535  $Database->insert('StockItem', array('Stock' => 1, 'Product' => $ProductId, 'Amount' => $DbRow['Count'],
    36     'Segment' => $DbRow['Segment'], 'TimeEnlistment' => $DbRow['Date'], 'TimeElimination' => $Elimination, 
     36    'Segment' => $DbRow['Segment'], 'TimeEnlistment' => $DbRow['Date'], 'TimeElimination' => $Elimination,
    3737    'SerialNumber' => $DbRow['DeviceId'], 'BuyPrice' => $DbRow['Price'], 'SellPrice' => $DbRow['Price'],
    3838    'Location' => $DbRow['User'], 'Info' => $DbRow['Info']));
  • trunk/temp/renumbering.php

    r548 r738  
    2929    16 => array('AddressRange' => '10.145.66.160', 'Mask' => 27),
    3030  );
    31  
     31
    3232  function Show()
    3333  {
    3434    global $Config;
    35    
     35
    3636    $Output = '';
    3737
     
    4747        $Output .= '-- '.$Interface['Name'].': '.$Interface['LocalIP'].' => '.Int32ToIPv4($NextIP).'<br>';
    4848        $Output .= 'UPDATE NetworkInterface SET LocalIP = "'.Int32ToIPv4($NextIP).'" WHERE Id='.$Interface['Id'].';<br>';
    49         $NextIP++;       
     49        $NextIP++;
    5050      }
    5151      $Output .= '<hr>';
  • trunk/temp/test.php

    r705 r738  
    1111while($DbRow = $DbResult->fetch_assoc())
    1212{
    13         $DbResult2 = $System->Database->select('NetworkSubnet', 'AddressRangeIPv6',
    14                 'CompareNetworkPrefix(INET_ATON(AddressRange), INET_ATON("'.$DbRow['LocalIP'].'"), Mask) AND
    15                         (AddressRangeIPv6 != "")');
    16         if($DbResult2->num_rows > 0)
    17         {
    18                 $Subnet = $DbResult2->fetch_assoc();
    19                 $SubnetParts = explode('/', $Subnet['AddressRangeIPv6']);
     13  $DbResult2 = $System->Database->select('NetworkSubnet', 'AddressRangeIPv6',
     14    'CompareNetworkPrefix(INET_ATON(AddressRange), INET_ATON("'.$DbRow['LocalIP'].'"), Mask) AND
     15      (AddressRangeIPv6 != "")');
     16  if($DbResult2->num_rows > 0)
     17  {
     18    $Subnet = $DbResult2->fetch_assoc();
     19    $SubnetParts = explode('/', $Subnet['AddressRangeIPv6']);
    2020
    21           $Addr->AddressFromString($SubnetParts[0]);
     21    $Addr->AddressFromString($SubnetParts[0]);
    2222    $Addr->EncodeMAC($DbRow['MAC']);
    2323    echo($Addr->AddressToString().' '.$DbRow['MAC']."\n");
    2424
    25           $System->Database->update('NetworkInterface', 'Id='.$DbRow['Id'], array('IPv6' => $Addr->AddressToString()));
    26         }
     25    $System->Database->update('NetworkInterface', 'Id='.$DbRow['Id'], array('IPv6' => $Addr->AddressToString()));
     26  }
    2727}
  • trunk/temp/user_mail.php

    r548 r738  
    1414  {
    1515    global $Config;
    16    
     16
    1717    $Output = '';
    1818
Note: See TracChangeset for help on using the changeset viewer.