Changeset 738 for trunk/temp
- Timestamp:
- Apr 14, 2015, 10:20:16 PM (10 years ago)
- Location:
- trunk/temp
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/temp/Bills.php
r627 r738 15 15 if(strpos($Invoice['Text'], 'Poplatek za měsíc') !== false) 16 16 { 17 18 19 20 21 22 23 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). 24 24 '", PeriodTo ="'.TimeToMysqlDate($PeriodTo).'" WHERE Id='.$Invoice['Id']); 25 25 } 26 26 if(strpos($Invoice['Text'], 'za období') !== false) 27 27 { 28 29 30 31 32 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 34 34 } 35 35 36 36 // 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 38 38 while($BillItem = $DbResult3->fetch_assoc()) 39 39 { -
trunk/temp/FioCVSToSQL.php
r572 r738 21 21 $Value = str_replace(' ', '', $Value); 22 22 $Text = $Line[9]; 23 if($Value > 0) 23 if($Value > 0) 24 24 { 25 25 $BillCode = 'BV'.$BVId.'/2013'; … … 31 31 } 32 32 if($Subject == '0094579415') $Subject = 72; 33 33 34 34 $Output .= "INSERT INTO `FinanceOperation` (`Id`, `Time`, `Subject`, `Cash`, `Value`, `BillCode`, `Taxable`, `File`, `Text`, `Network`, `BankAccount`, `Treasury`) VALUES 35 35 (NULL, '".TimeToMySQLDateTime($Date)."', ".$Subject.", 0, '".$Value."', '".$BillCode."', 1, NULL, '".$Text."', 1, 2, NULL);\n"; -
trunk/temp/meteo/Image.php
r548 r738 12 12 var $FileName; 13 13 var $Color; 14 15 function __construct() 14 15 function __construct() 16 16 { 17 17 $this->Color = COLOR_BLACK; … … 27 27 var $Y; 28 28 29 function __construct() 29 function __construct() 30 30 { 31 31 $this->Color = COLOR_BLACK; … … 40 40 var $Color; 41 41 42 function __construct() 42 function __construct() 43 43 { 44 44 $this->Color = COLOR_BLACK; … … 47 47 } 48 48 49 class Image 49 class Image 50 50 { 51 var $Image; 51 var $Image; 52 52 var $Type; 53 53 var $Font; 54 54 var $Pen; 55 55 56 56 function __construct() 57 57 { … … 59 59 $this->Type = IMAGETYPE_PNG; 60 60 $this->Pen = new Pen(); 61 $this->Font = new Font(); 62 $this->Brush = new Brush(); 61 $this->Font = new Font(); 62 $this->Brush = new Brush(); 63 63 } 64 64 65 65 function SaveToFile($FileName) 66 66 { 67 if($this->Type == IMAGETYPE_JPEG) 67 if($this->Type == IMAGETYPE_JPEG) 68 68 { 69 69 imagejpeg($this->Image, $FileName); 70 70 } else 71 if($this->Type == IMAGETYPE_GIF) 71 if($this->Type == IMAGETYPE_GIF) 72 72 { 73 73 imagegif($this->Image, $FileName); 74 74 } else 75 if($this->Type == IMAGETYPE_PNG) 75 if($this->Type == IMAGETYPE_PNG) 76 76 { 77 77 imagepng($this->Image, $FileName); 78 78 } 79 79 } 80 80 81 81 function LoadFromFile($FileName) 82 82 { 83 83 $ImageInfo = getimagesize($FileName); 84 84 $this->Type = $ImageInfo[2]; 85 if($this->Type == IMAGETYPE_JPEG) 85 if($this->Type == IMAGETYPE_JPEG) 86 86 { 87 87 $this->Image = imagecreatefromjpeg($FileName); 88 88 } else 89 if($this->Type == IMAGETYPE_GIF) 89 if($this->Type == IMAGETYPE_GIF) 90 90 { 91 91 $this->Image = imagecreatefromgif($FileName); 92 92 } else 93 if( $this->Type == IMAGETYPE_PNG) 93 if( $this->Type == IMAGETYPE_PNG) 94 94 { 95 95 $this->Image = imagecreatefrompng($FileName); 96 } 96 } 97 97 } 98 98 99 99 function Output() 100 100 { … … 103 103 104 104 function SetSize($Width, $Height) 105 { 105 { 106 106 $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()); 108 108 imagedestroy($this->Image); 109 109 $this->Image = $NewImage; 110 110 } 111 111 112 function GetWidth() 113 { 112 function GetWidth() 113 { 114 114 return(imagesx($this->Image)); 115 115 } 116 117 function GetHeight() 116 117 function GetHeight() 118 118 { 119 119 return(imagesy($this->Image)); 120 120 } 121 121 122 122 function TextOut($X, $Y, $Text) 123 123 { 124 124 imagettftext($this->Image, $this->Font->Size, 0, $X, $Y, $this->ConvertColor($this->Font->Color), $this->Font->FileName, $Text); 125 125 } 126 126 127 127 function TextWidth($Text) 128 128 { … … 130 130 return(abs($Box[4] - $Box[0])); 131 131 } 132 132 133 133 function TextHeight($Text) 134 134 { … … 136 136 return(abs($Box[5] - $Box[1])); 137 137 } 138 138 139 139 function ConvertColor($Color) 140 140 { 141 141 return(imagecolorallocate($this->Image, ($Color >> 16) & 0xff, ($Color >> 8) & 0xff, $Color & 0xff)); 142 142 } 143 143 144 144 function FillRect($X1, $Y1, $X2, $Y2) 145 145 { 146 146 imagefilledrectangle($this->Image, $X1, $Y1, $X2, $Y2, $this->ConvertColor($this->Brush->Color)); 147 147 } 148 148 149 149 function Line($X1, $Y1, $X2, $Y2) 150 150 { -
trunk/temp/meteo/load_meteo.php
r737 r738 3 3 include('Image.php'); 4 4 5 class MeteoStation 5 class MeteoStation 6 6 { 7 7 var $Id; … … 28 28 $this->Data = $Data; 29 29 } 30 30 31 31 function DownloadData() 32 32 { 33 33 $XmlData = simplexml_load_file($this->URL); 34 34 35 $Data = array('MeteoStation' => $this->Id, 35 $Data = array('MeteoStation' => $this->Id, 36 36 'WindSpeed' => trim($XmlData->windspeed), 37 37 'WindDir' => trim($XmlData->winddir), … … 61 61 'DewPoint' => $this->Data['DewPoint'])); 62 62 } 63 63 64 64 function CreateImage($FileName) 65 65 { … … 95 95 $Image->SaveToFile($FileName); 96 96 } 97 97 98 98 function LoadFromDb() 99 99 { … … 124 124 foreach($Meteo->Data as $Index => $Item) 125 125 { 126 $Collect[$Index][] = $Item; 126 $Collect[$Index][] = $Item; 127 127 } 128 if(($I % 6) == 0) 128 if(($I % 6) == 0) 129 129 { 130 130 foreach($Collect as $Index => $Item) -
trunk/temp/product.php
r548 r738 13 13 { 14 14 echo($DbRow['Name'].', '); 15 16 $System->Database->insert('Product', array('Name' => $DbRow['Name'], 15 16 $System->Database->insert('Product', array('Name' => $DbRow['Name'], 17 17 'SellPrice' => $DbRow['Price'], 'BuyPrice' => $DbRow['Price'], 18 18 'Consumption' => $DbRow['Consumption'], 'UnitOfMeasure' => 1, 'VAT' => 20)); … … 25 25 case 2: $Elimination = NULL; break; 26 26 } 27 27 28 28 // else $Elimination = $DbRow['TimeElimination']; 29 29 if($DbRow['Used'] == 2) $DbRow['User'] = NULL; 30 30 echo($DbRow['Used'].'"'.$Elimination.'"<br/>'); 31 31 // 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, 33 33 // 'SerialNumber' => $DbRow['DeviceId'], 'BuyPrice' => $DbRow['Price'], 'SellPrice' => $DbRow['Price'], 34 34 // 'Location' => $DbRow['User'], 'Info' => $DbRow['Info'])); 35 35 $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, 37 37 'SerialNumber' => $DbRow['DeviceId'], 'BuyPrice' => $DbRow['Price'], 'SellPrice' => $DbRow['Price'], 38 38 'Location' => $DbRow['User'], 'Info' => $DbRow['Info'])); -
trunk/temp/renumbering.php
r548 r738 29 29 16 => array('AddressRange' => '10.145.66.160', 'Mask' => 27), 30 30 ); 31 31 32 32 function Show() 33 33 { 34 34 global $Config; 35 35 36 36 $Output = ''; 37 37 … … 47 47 $Output .= '-- '.$Interface['Name'].': '.$Interface['LocalIP'].' => '.Int32ToIPv4($NextIP).'<br>'; 48 48 $Output .= 'UPDATE NetworkInterface SET LocalIP = "'.Int32ToIPv4($NextIP).'" WHERE Id='.$Interface['Id'].';<br>'; 49 $NextIP++; 49 $NextIP++; 50 50 } 51 51 $Output .= '<hr>'; -
trunk/temp/test.php
r705 r738 11 11 while($DbRow = $DbResult->fetch_assoc()) 12 12 { 13 14 15 16 17 18 19 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']); 20 20 21 21 $Addr->AddressFromString($SubnetParts[0]); 22 22 $Addr->EncodeMAC($DbRow['MAC']); 23 23 echo($Addr->AddressToString().' '.$DbRow['MAC']."\n"); 24 24 25 26 25 $System->Database->update('NetworkInterface', 'Id='.$DbRow['Id'], array('IPv6' => $Addr->AddressToString())); 26 } 27 27 } -
trunk/temp/user_mail.php
r548 r738 14 14 { 15 15 global $Config; 16 16 17 17 $Output = ''; 18 18
Note:
See TracChangeset
for help on using the changeset viewer.