Changeset 901 for trunk/Modules/Finance/Finance.php
- Timestamp:
- Feb 17, 2021, 9:27:32 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Finance/Finance.php
r900 r901 21 21 $this->License = 'GNU/GPLv3'; 22 22 $this->Description = 'Base module for finance management'; 23 $this->Dependencies = array(ModuleFile::GetName(), ModuleEmailQueue::GetName(), ModuleSubject::GetName(), ModuleDocument::GetName()); 23 $this->Dependencies = array(ModuleFile::GetName(), ModuleEmailQueue::GetName(), ModuleSubject::GetName(), 24 ModuleDocument::GetName()); 24 25 $this->Models = array(FinanceBillingPeriod::GetClassName(), FinanceVatType::GetClassName(), FinanceVat::GetClassName(), 25 26 FinanceGroup::GetClassName(), FinanceOperationGroup::GetClassName(), FinanceOperation::GetClassName(), … … 27 28 Company::GetClassName(), FinanceTreasury::GetClassName(), FinanceTreasuryCheck::GetClassName(), 28 29 Currency::GetClassName(), FinanceBank::GetClassName(), FinanceBankAccount::GetClassName(), FinanceCharge::GetClassName(), 29 Contract::GetClassName(),FinanceInvoiceOperationRel::GetClassName());30 FinanceInvoiceOperationRel::GetClassName()); 30 31 31 32 $this->Bill = new Bill($this->System); … … 423 424 'Name' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => ''), 424 425 ), 425 ));426 $this->System->FormManager->RegisterClass('Contract', array(427 'Title' => 'Smlouvy',428 'Table' => 'Contract',429 'Items' => array(430 'DocumentLine' => array('Type' => 'TDocumentLine', 'Caption' => 'Dokladová řada', 'Default' => ''),431 'BillCode' => array('Type' => 'TDocumentLineCode', 'Caption' => 'Kód', 'Default' => '', 'Null' => true),432 'Subject' => array('Type' => 'TSubject', 'Caption' => 'Subjekt', 'Default' => ''),433 'ValidFrom' => array('Type' => 'Date', 'Caption' => 'Platnost od', 'Default' => ''),434 'ValidTo' => array('Type' => 'Date', 'Caption' => 'Platnost do', 'Default' => '', 'Null' => true),435 'File' => array('Type' => 'TFile', 'Caption' => 'Soubor', 'Default' => '', 'Null' => true),436 ),437 'BeforeInsert' => array($this, 'BeforeInsertContract'),438 ));439 $this->System->FormManager->RegisterFormType('TContract', array(440 'Type' => 'Reference',441 'Table' => 'Contract',442 'Id' => 'Id',443 'Name' => 'BillCode',444 'Filter' => '1',445 426 )); 446 427 $this->System->FormManager->RegisterFormType('TFinanceVAT', array( … … 541 522 } 542 523 543 function DoStop(): void544 {545 }546 547 524 function BeforeInsertFinanceOperation(Form $Form): array 548 525 { … … 550 527 else $Year = date("Y", $Form->Values['ValidFrom']); 551 528 $FinanceGroup = $this->Finance->GetFinanceGroupById($Form->Values['Group'], 'FinanceOperationGroup'); 552 $Form->Values['BillCode'] = $this->Finance->GetNextDocumentLineNumberId($FinanceGroup['DocumentLine'], $Year);529 $Form->Values['BillCode'] = ModuleDocument::Cast($this->System->GetModule('Document'))->GetNextDocumentLineNumberId($FinanceGroup['DocumentLine'], $Year); 553 530 return $Form->Values; 554 531 } … … 576 553 else $Year = date("Y", $Form->Values['ValidFrom']); 577 554 $Group = $this->Finance->GetFinanceGroupById($Form->Values['Group'], 'FinanceInvoiceGroup'); 578 $Form->Values['BillCode'] = $this->Finance->GetNextDocumentLineNumberId($Group['DocumentLine'], $Year);555 $Form->Values['BillCode'] = ModuleDocument::Cast($this->System->GetModule('Document'))->GetNextDocumentLineNumberId($Group['DocumentLine'], $Year); 579 556 return $Form->Values; 580 557 } … … 621 598 } 622 599 623 function BeforeInsertContract(Form $Form): array624 {625 if (array_key_exists('Time', $Form->Values)) $Year = date("Y", $Form->Values['Time']);626 else $Year = date("Y", $Form->Values['ValidFrom']);627 $Form->Values['BillCode'] = $this->Finance->GetNextDocumentLineNumberId($Form->Values['DocumentLine'], $Year);628 return $Form->Values;629 }630 631 600 static function Cast(Module $Module): ModuleFinance 632 601 {
Note:
See TracChangeset
for help on using the changeset viewer.