Changeset 741 for trunk/Modules/Finance
- Timestamp:
- Jul 5, 2015, 6:24:33 PM (10 years ago)
- Location:
- trunk/Modules/Finance
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
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.