Changeset 741
- Timestamp:
- Jul 5, 2015, 6:24:33 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Application/Version.php
r739 r741 1 1 <?php 2 2 3 $Revision = 7 39; // Subversion revision4 $DatabaseRevision = 7 39; // SQL structure revision5 $ReleaseTime = strtotime('2015-0 5-22');3 $Revision = 741; // Subversion revision 4 $DatabaseRevision = 741; // SQL structure revision 5 $ReleaseTime = strtotime('2015-07-05'); -
trunk/Common/Setup/Updates.php
r740 r741 1355 1355 `Domain` int(11) NOT NULL, 1356 1356 `Sequence` int(11) NOT NULL, 1357 PRIMARY KEY (`Id`) 1357 1358 ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;'); 1358 1359 1359 $Manager->Execute('ALTER TABLE `NetworkDomainServer` 1360 ADD PRIMARY KEY (`Id`), ADD KEY `Domain` (`Domain`);'); 1360 $Manager->Execute('ALTER TABLE `NetworkDomainServer` ADD KEY `Domain` (`Domain`);'); 1361 1361 1362 1362 $Manager->Execute('ALTER TABLE `NetworkDomainServer` … … 1421 1421 $Manager->Execute('ALTER TABLE `FinanceInvoice` CHANGE `Direction` `ValueSign` INT(11) NOT NULL;'); 1422 1422 $Manager->Execute('ALTER TABLE `FinanceOperation` CHANGE `Direction` `ValueSign` INT(11) NOT NULL;'); 1423 } 1424 1425 function UpdateTo741($Manager) 1426 { 1427 // Add Direction column 1428 $Manager->Execute('ALTER TABLE `FinanceOperationGroup` ADD `Direction` INT NOT NULL ;'); 1429 $Manager->Execute('UPDATE `FinanceOperationGroup` SET `Direction` = 1 WHERE ValueSign=-1'); 1430 $Manager->Execute('ALTER TABLE `FinanceOperation` ADD `Direction` INT NOT NULL AFTER `Cash`;'); 1431 $Manager->Execute('UPDATE `FinanceOperation` SET `Direction` = 1 WHERE ValueSign=-1'); 1432 $Manager->Execute('ALTER TABLE `FinanceInvoiceGroup` ADD `Direction` INT NOT NULL ;'); 1433 $Manager->Execute('UPDATE `FinanceInvoiceGroup` SET `Direction` = 1 WHERE ValueSign=1'); 1434 $Manager->Execute('ALTER TABLE `FinanceInvoice` ADD `Direction` INT NOT NULL AFTER `TimePayment`;'); 1435 $Manager->Execute('UPDATE `FinanceInvoice` SET `Direction` = 1 WHERE ValueSign=1'); 1423 1436 } 1424 1437 … … 1490 1503 735 => array('Revision' => 736, 'Function' => 'UpdateTo736'), 1491 1504 736 => array('Revision' => 739, 'Function' => 'UpdateTo739'), 1505 739 => array('Revision' => 740, 'Function' => 'UpdateTo740'), 1506 740 => array('Revision' => 741, 'Function' => 'UpdateTo741'), 1492 1507 )); 1493 1508 } -
trunk/Modules/Finance/Bill.php
r740 r741 78 78 } 79 79 80 // If negative value => switch sides 81 if($Invoice['ValueSign'] == -1) 80 // If direction is in => switch sides 81 if($Invoice['Direction'] == FINANCE_DIRECTION_OUT) 82 { 83 } 84 else if($Invoice['Direction'] == FINANCE_DIRECTION_IN) 82 85 { 83 86 $Subject = $SubjectTo; … … 85 88 $SubjectFrom = $Subject; 86 89 } 90 else throw new Exception('Wrong finance direction'); 87 91 88 92 $PaymentType = array('převodem', 'hotově'); … … 162 166 163 167 $BooleanText = array('Ne', 'Ano'); 164 if($Operation[' ValueSign'] == -1)168 if($Operation['Direction'] == FINANCE_DIRECTION_OUT) 165 169 $Desc = array( 166 170 'Type' => 'VÝDAJOVÝ', … … 168 172 'Target' => 'Vydáno komu', 169 173 ); 170 else if($Operation[' ValueSign'] == 1)174 else if($Operation['Direction'] == FINANCE_DIRECTION_IN) 171 175 $Desc = array( 172 176 'Type' => 'PŘÍJMOVÝ', -
trunk/Modules/Finance/Finance.php
r740 r741 17 17 define('INVOICE_GROUP_OUT', 2); 18 18 define('VAT_TYPE_BASE', 2); 19 19 define('FINANCE_DIRECTION_OUT', 0); 20 define('FINANCE_DIRECTION_IN', 1); 20 21 21 22 class Finance extends Model … … 219 220 'Cash' => array('Type' => 'Boolean', 'Caption' => 'Hotově', 'Default' => ''), 220 221 'Taxable' => array('Type' => 'Boolean', 'Caption' => 'Zdanitelné', 'Default' => ''), 221 'ValueSign' => array('Type' => 'TFinanceOperationValueSign', 'Caption' => 'Znaménko', 'Default' => '1'), 222 'Direction' => array('Type' => 'TFinanceDirection', 'Caption' => 'Směr', 'Default' => '0'), 223 'ValueSign' => array('Type' => 'TFinanceValueSign', 'Caption' => 'Znaménko', 'Default' => '1'), 222 224 'Value' => array('Type' => 'Integer', 'Caption' => 'Částka', 'Default' => '0', 'Suffix' => 'Kč'), 223 225 'File' => array('Type' => 'TFile', 'Caption' => 'Doklad', 'Default' => '', 'Null' => true), … … 278 280 'Name' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => '0'), 279 281 'DocumentLine' => array('Type' => 'TDocumentLine', 'Caption' => 'Dokladová řada', 'Default' => '0'), 280 'ValueSign' => array('Type' => 'TFinanceInvoiceValueSign', 'Caption' => 'Znaménko hodnoty', 'Default' => '0'), 282 'ValueSign' => array('Type' => 'TFinanceValueSign', 'Caption' => 'Znaménko hodnoty', 'Default' => '0'), 283 'Direction' => array('Type' => 'TFinanceDirection', 'Caption' => 'Směr', 'Default' => '0'), 281 284 ), 282 285 )); … … 288 291 'Filter' => '1', 289 292 )); 290 $this->System->FormManager->RegisterFormType('TFinance OperationValueSign', array(293 $this->System->FormManager->RegisterFormType('TFinanceValueSign', array( 291 294 'Type' => 'Enumeration', 292 295 'States' => array(-1 => 'Mínus', 1 => 'Plus'), 296 )); 297 $this->System->FormManager->RegisterFormType('TFinanceDirection', array( 298 'Type' => 'Enumeration', 299 'States' => array(0 => 'Příjem', 1 => 'Výdej'), 293 300 )); 294 301 $this->System->FormManager->RegisterClass('FinanceInvoice', array( … … 304 311 'TimeDue' => array('Type' => 'Date', 'Caption' => 'Čas splatnosti', 'Default' => ''), 305 312 'TimePayment' => array('Type' => 'Date', 'Caption' => 'Čas zaplacení', 'Default' => '', 'Null' => true), 306 'ValueSign' => array('Type' => 'TFinanceInvoiceValueSign', 'Caption' => 'Znaménko', 'Default' => '1'), 313 'Direction' => array('Type' => 'TFinanceDirection', 'Caption' => 'Směr', 'Default' => '0'), 314 'ValueSign' => array('Type' => 'TFinanceValueSign', 'Caption' => 'Znaménko', 'Default' => '1'), 307 315 'Value' => array('Type' => 'Integer', 'Caption' => 'Částka', 'Default' => '0', 'Suffix' => 'Kč'), 308 316 'File' => array('Type' => 'TFile', 'Caption' => 'Doklad', 'Default' => '', 'Null' => true), … … 331 339 $this->System->FormManager->Classes['FinanceInvoiceOut']['Items']['Group']['Filter'] = true; 332 340 333 $this->System->FormManager->RegisterFormType('TFinanceInvoiceValueSign', array(334 'Type' => 'Enumeration',335 'States' => array(-1 => 'Mínus', 1 => 'Plus'),336 ));337 338 341 $this->System->FormManager->RegisterClass('FinanceInvoiceGroup', array( 339 342 'Title' => 'Skupina faktur', … … 342 345 'Name' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => '0'), 343 346 'DocumentLine' => array('Type' => 'TDocumentLine', 'Caption' => 'Dokladová řada', 'Default' => '0'), 344 'ValueSign' => array('Type' => 'TFinanceInvoiceValueSign', 'Caption' => 'Znaménko hodnoty', 'Default' => '0'), 347 'ValueSign' => array('Type' => 'TFinanceValueSign', 'Caption' => 'Znaménko hodnoty', 'Default' => '0'), 348 'Direction' => array('Type' => 'TFinanceDirection', 'Caption' => 'Směr', 'Default' => '0'), 345 349 ), 346 350 )); -
trunk/Modules/Finance/Manage.php
r740 r741 101 101 102 102 function InsertInvoice($Subject, $TimeCreation, $TimeDue, $ValueSign, $Items, 103 $Group, $PeriodFrom, $PeriodTo )103 $Group, $PeriodFrom, $PeriodTo, $Direction) 104 104 { 105 105 global $LastInsertTime; … … 114 114 'Subject' => $Subject, 'Time' => TimeToMysqlDateTime($TimeCreation), 115 115 'TimeDue' => TimeToMysqlDateTime($TimeDue), 'Value' => $SumValue, 116 'ValueSign' => $ValueSign, 'BillCode' => $BillCode, 116 'ValueSign' => $ValueSign, 'BillCode' => $BillCode, 'Direction' => $Direction, 117 117 'PeriodFrom' => TimeToMysqlDate($PeriodFrom), 'PeriodTo' => TimeToMysqlDate($PeriodTo), 118 118 'Generate' => 1, 'Group' => $FinanceGroup['Id'])); … … 185 185 $Output .= $TimePeriodText.': '.$MonthlyTotal.' * '.$Period['MonthCount'].' = '.$PayPerPeriod.'<br />'; 186 186 $this->InsertInvoice($Member['Subject'], time(), time() + 3600 * 24 * INVOICE_DUE_DAYS, 187 $FinanceGroup['ValueSign'], $InvoiceItems, $FinanceGroup, $Period['From'], $Period['To']); 187 $FinanceGroup['ValueSign'], $InvoiceItems, $FinanceGroup, $Period['From'], 188 $Period['To'], $FinanceGroup['Direction']); 188 189 189 190 $Output .= $this->SendPaymentEmail($Member['Id']);
Note:
See TracChangeset
for help on using the changeset viewer.