Changeset 844
- Timestamp:
- Jan 1, 2017, 10:21:42 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Application/FormClasses.php
r817 r844 29 29 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''), 30 30 'Shortcut' => array('Type' => 'String', 'Caption' => 'Kód', 'Default' => ''), 31 'Yearly' => array('Type' => 'Boolean', 'Caption' => 'Ročně', 'Default' => 0), 31 32 'Sequence' => array('Type' => 'TDocumentLineSequenceListLine', 'Caption' => 'Čísleníky', 'Default' => ''), 32 33 'Codes' => array('Type' => 'TDocumentLineCodeList', 'Caption' => 'Kódy', 'Default' => ''), -
trunk/Application/UpdateTrace.php
r839 r844 2036 2036 { 2037 2037 $Manager->Execute('ALTER TABLE `News` CHANGE `Date` `Date` DATETIME NULL, CHANGE `TargetDate` `TargetDate` DATETIME NULL;'); 2038 } 2039 2040 function UpdateTo844($Manager) 2041 { 2042 $Manager->Execute('ALTER TABLE `DocumentLine` ADD `Yearly` BOOLEAN NOT NULL DEFAULT FALSE AFTER `Shortcut`;'); 2038 2043 } 2039 2044 … … 2132 2137 824 => array('Revision' => 831, 'Function' => 'UpdateTo831'), 2133 2138 831 => array('Revision' => 838, 'Function' => 'UpdateTo838'), 2139 838 => array('Revision' => 844, 'Function' => 'UpdateTo844'), 2134 2140 )); 2135 2141 } -
trunk/Application/Version.php
r843 r844 2 2 3 3 $Revision = 844; // Subversion revision 4 $DatabaseRevision = 8 38; // SQL structure revision4 $DatabaseRevision = 844; // SQL structure revision 5 5 $ReleaseTime = strtotime('2017-01-01'); -
trunk/Modules/Finance/Finance.php
r812 r844 82 82 return(round($Spotreba * 0.72 * $this->kWh)); 83 83 } 84 85 function GetNextDocumentLineNumber($Id, $FinanceYear = 0) 86 { 87 if($FinanceYear == 0) 84 85 function CreateFinanceYear($Year) 86 { 87 $StartTime = mktime(0, 0, 0, 1, 1, $Year); 88 $EndTime = mktime(0, 0, 0, 12, 31, $Year); 89 $this->Database->insert('FinanceYear', array('Year' => $Year, 90 'DateStart' => TimeToMysqlDate($StartTime), 'DateEnd' => TimeToMysqlDate($EndTime), 'Closed' => 0)); 91 $YearId = $this->Database->insert_id; 92 93 // Create DocumentLineSequence from previous 94 $DbResult = $this->Database->select('DocumentLine', 'Id', '`Yearly` = 1'); 95 while($DbRow = $DbResult->fetch_assoc()) 96 { 97 $this->Database->insert('DocumentLineSequence', array('FinanceYear' => $YearId, 98 'NextNumber' => 1, 'YearPrefix' => 1, 'DocumentLine' => $DbRow['Id'])); 99 } 100 } 101 102 function GetFinanceYear($Year) 103 { 104 if($Year == 0) 88 105 { 89 106 // Get latest year 90 107 $DbResult = $this->Database->select('FinanceYear', '*', '1 ORDER BY `Year` DESC LIMIT 1'); 91 } else $DbResult = $this->Database->select('FinanceYear', '*', '`Year`='.$FinanceYear); 92 if($DbResult->num_rows == 0) throw new Exception('Rok '.$FinanceYear.' nenalezen'); 108 } else $DbResult = $this->Database->select('FinanceYear', '*', '`Year`='.$Year); 109 if($DbResult->num_rows == 0) { 110 if($Year == date('Y')) 111 { 112 $this->CreateFinanceYear($Year); 113 $DbResult = $this->Database->select('FinanceYear', '*', '`Year`='.$Year); 114 } else throw new Exception('Rok '.$Year.' nenalezen'); 115 } 93 116 $FinanceYear = $DbResult->fetch_assoc(); 94 if($FinanceYear['Closed'] == 1) throw new Exception('Rok '.$FinanceYear['Year'].' je již uzavřen. Nelze do něj přidávat položky.'); 117 if($FinanceYear['Closed'] == 1) 118 throw new Exception('Rok '.$FinanceYear['Year'].' je již uzavřen. Nelze do něj přidávat položky.'); 119 return $FinanceYear; 120 } 121 122 function GetNextDocumentLineNumber($Id, $FinanceYear = 0) 123 { 124 $FinanceYear = $this->GetFinanceYear($FinanceYear); 95 125 96 126 $DbResult = $this->Database->query('SELECT `Shortcut`, `Id` FROM `DocumentLine` WHERE `Id`='.$Id);
Note:
See TracChangeset
for help on using the changeset viewer.