source: trunk/Modules/Finance/Finance.php@ 549

Last change on this file since 549 was 549, checked in by chronos, 12 years ago
  • Přidáno: Vlastnost Generate u plateb a faktur pro určení, které doklady se mají zpožděně generovat jako PDF.
File size: 22.7 KB
Line 
1<?php
2
3include_once(dirname(__FILE__).'/Overview.php');
4include_once(dirname(__FILE__).'/Consumption.php');
5include_once(dirname(__FILE__).'/Devices.php');
6include_once(dirname(__FILE__).'/Bill.php');
7include_once(dirname(__FILE__).'/Services.php');
8include_once(dirname(__FILE__).'/Customers.php');
9include_once(dirname(__FILE__).'/MonthlyOverall.php');
10include_once(dirname(__FILE__).'/Manage.php');
11include_once(dirname(__FILE__).'/UserState.php');
12include_once(dirname(__FILE__).'/Import.php');
13include_once(dirname(__FILE__).'/Zivnost.php');
14
15define('TARIFF_FREE', 7);
16define('INVOICE_DUE_DAYS', 15);
17define('INVOICE_OUT_DOC_LINE', 6);
18
19class Finance extends Module
20{
21 var $kWh;
22 var $Internet;
23 var $Sprava;
24 var $DatumOdecteni;
25 var $InternetUsers;
26 var $SpravaUsers;
27 var $InternetSegmentId = 21;
28 var $MaxSpeed;
29 var $RealMaxSpeed;
30 var $SpeedReserve;
31 var $BaseSpeedElement;
32 var $TotalConsumption;
33 var $UserIdNetwork = 46;
34 var $BaseTariffPrice;
35 var $TopTariffPrice;
36 var $TotalPaid;
37 var $TotalInternetPaid;
38 var $Tariffs;
39 var $ExternalSubject = 96;
40 var $MainSubject;
41 var $BillingPeriods;
42 var $DirectoryId;
43
44 function LoadTariffs()
45 {
46 $this->Tariffs = array();
47 $DbResult = $this->Database->select('Service', '*', '`ReplaceId` IS NULL ORDER BY `Name`, `InternetSpeedMax`');
48 while($Tariff = $DbResult->fetch_array())
49 {
50 $Tariff['InternetSpeedMin'] = $Tariff['InternetSpeedMin'] * 1000;
51 $Tariff['InternetSpeedMax'] = $Tariff['InternetSpeedMax'] * 1000;
52 $this->Tariffs[$Tariff['Id']] = $Tariff;
53 }
54 }
55
56 function RecalculateTariffs()
57 {
58 $ResidualSpeed = $this->MaxSpeed * 1000;
59
60 $this->LoadTariffs();
61
62 $Column = array('Current', 'Next');
63 $TotalMemberCount = 0;
64 $TotalMaxSpeed = 0;
65 foreach($this->Tariffs as $Index => $Tariff)
66 {
67 $DbResult = $this->Database->query('SELECT COUNT(*) FROM `Member` '.
68 'LEFT JOIN `ServiceCustomerRel` ON `ServiceCustomerRel`.`Customer`=`Member`.`Id` '.
69 'WHERE (`ServiceCustomerRel`.`Service`='.$Index.') AND (`Member`.`BillingPeriod` > 1) '.
70 'AND (`Member`.`Blocked`=0)');
71 $Row = $DbResult->fetch_row();
72 $this->Tariffs[$Index]['CustomerCount'] = $Row[0];
73 $Tariffs['CustomerCount'] = $Row[0];
74
75 switch($Tariff['Category'])
76 {
77 case 1:
78 $TotalMemberCount += $Tariff['CustomerCount'];
79 $TotalMaxSpeed += $Tariff['InternetSpeedMax'] * $Tariff['CustomerCount'];
80 break;
81 case 2:
82 $ResidualSpeed -= $Tariff['InternetSpeedMin'] * $Tariff['CustomerCount'];
83 break;
84 case 3:
85 break;
86 }
87 }
88 if($TotalMaxSpeed > 0) $Aggregation = $ResidualSpeed / $TotalMaxSpeed;
89 else $Aggregation = 1;
90
91 // Recalculate price
92 foreach($this->Tariffs as $Index => $Tariff)
93 {
94 switch($Tariff['Category'])
95 {
96 case 1:
97 // Přepočítávání rychlostí koliduje s rozdílovým zapisováním stromu front do mikrotiku.
98 // Vždy při změně počtu počítačů či domácností docházelo ke změně minima a přepočtu všeho.
99 //$Tariff['InternetSpeedMin'] = round($Tariff['InternetSpeedMax'] * $Aggregation);
100 break;
101 case 2:
102 break;
103 case 3:
104 break;
105 }
106 $this->Database->update('Service', 'Id='.$Tariff['Id'],
107 array('InternetSpeedMin' => ($Tariff['InternetSpeedMin'] / 1000),
108 'CustomerCount' => $Tariff['CustomerCount']));
109 }
110 $this->LoadTariffs();
111 }
112
113 function LoadMonthParameters($Period = 1) // 0 - now, 1 - next month
114 {
115 $DbResult = $this->Database->query('SELECT * FROM `FinanceBillingPeriod`');
116 while($BillingPeriod = $DbResult->fetch_assoc())
117 $this->BillingPeriods[$BillingPeriod['Id']] = $BillingPeriod;
118
119 // Period parameter is not used as it have to be determined from item replacement
120 $DbResult = $this->Database->query('SELECT * FROM `FinanceCharge` WHERE `ReplaceId` IS NULL LIMIT 1');
121 $Row = $DbResult->fetch_array();
122 $this->kWh = $Row['kWh'];
123 $this->Internet = $Row['Internet'];
124 $this->Sprava = $Row['AdministrationPerUser'];
125 $this->RealMaxSpeed = $Row['InternetSpeed'];
126 $this->SpeedReserve = $Row['InternetSpeedReserve'];
127 $this->BaseSpeedElement = $Row['BaseSpeedElement'];
128 $this->MaxSpeed = $this->RealMaxSpeed - $this->SpeedReserve;
129 $this->TopTariffPrice = $Row['TopTariffPrice'];
130 $this->BaseTariffPrice = $Row['BaseTariffPrice'];
131
132 $DbResult = $this->Database->query('SELECT COUNT(*) FROM `Member`');
133 $Row = $DbResult->fetch_row();
134 $this->InternetUsers = $Row[0];
135 $DbResult = $this->Database->query('SELECT COUNT(*) FROM `Member` WHERE (`Blocked`=0) AND (`BillingPeriod` > 1)');
136 $Row = $DbResult->fetch_row();
137 $this->PayingUsers = $Row[0];
138
139 $this->SpravaUsers = $this->PayingUsers;
140
141 $DbResult = $this->Database->query('SELECT SUM(`Consumption`) FROM `NetworkSegment`');
142 $TotalConsumption = $DbResult->fetch_array();
143 $this->TotalConsumption = $TotalConsumption[0];
144
145 $DbResult = $this->Database->query('SELECT SUM(`MemberPayment`.`MonthlyInternet`) AS `MonthlyInternet`, '.
146 'SUM(`MemberPayment`.`MonthlyTotal`) AS `MonthlyTotal` '.
147 'FROM `MemberPayment` JOIN `Member` ON `Member`.`Id`=`MemberPayment`.`Member` WHERE `Member`.`Blocked`=0');
148 $Row = $DbResult->fetch_assoc();
149 $this->TotalInternetPaid = $Row['MonthlyInternet'];
150 $this->TotalPaid = $Row['MonthlyTotal'];
151
152 $this->LoadTariffs($Period);
153 }
154
155 function W2Kc($Spotreba)
156 {
157 return(round($Spotreba * 0.72 * $this->kWh));
158 }
159
160 function GetNextDocumentLineNumber($Id, $FinanceYear = 0)
161 {
162 if($FinanceYear == 0)
163 {
164 // Get latest year
165 $DbResult = $this->Database->select('FinanceYear', '*', '1 ORDER BY `Year` DESC LIMIT 1');
166 } else $DbResult = $this->Database->select('FinanceYear', '*', 'Id='.$FinanceYear);
167 $FinanceYear = $DbResult->fetch_assoc();
168
169 $DbResult = $this->Database->query('SELECT `Shortcut`, `Id` FROM `DocumentLine` WHERE `Id`='.$Id);
170 $DocumentLine = $DbResult->fetch_assoc();
171
172 $DbResult = $this->Database->query('SELECT * FROM `DocumentLineSequence` WHERE '.
173 '`DocumentLine`='.$Id.' AND `FinanceYear`='.$FinanceYear['Id']);
174 $Sequence = $DbResult->fetch_assoc();
175
176 if($Sequence['YearPrefix'] == 1)
177 {
178 $Result = $DocumentLine['Shortcut'].$Sequence['NextNumber'].'/'.$FinanceYear['Year'];
179 } else $Result = $DocumentLine['Shortcut'].$Sequence['NextNumber'];
180
181 $this->Database->query('UPDATE `DocumentLineSequence` SET `NextNumber` = `NextNumber` + 1 '.
182 'WHERE (`DocumentLine`='.$Id.') AND (`FinanceYear`='.$FinanceYear['Id'].')');
183 return($Result);
184 }
185
186 function RecalculateMemberPayment()
187 {
188 $Output = 'Aktualizuji finance členů...<br />';
189 $this->Database->query('TRUNCATE TABLE `MemberPayment`');
190 $DbResult = $this->Database->query('SELECT * FROM `Member`');
191 while($Member = $DbResult->fetch_assoc())
192 {
193 $DbResult2 = $this->Database->query('SELECT ((SELECT COALESCE(SUM(Value), 0) FROM FinanceOperation '.
194 'WHERE Subject='.$Member['Subject'].') + (SELECT COALESCE(SUM(-Value), 0) FROM FinanceInvoice '.
195 'WHERE Subject='.$Member['Subject'].')) as Cash');
196 $Cash = $DbResult2->fetch_row();
197 $Cash = $Cash[0];
198
199 $DbResult2 = $this->Database->query('SELECT SUM(`Product`.`Consumption`) * `StockItem`.`Amount` '.
200 'FROM `StockItem` JOIN `Product` ON `Product`.`Id` = `StockItem`.`Product` '.
201 'WHERE (`StockItem`.`Location` = '.$Member['Id'].') AND (`StockItem`.`TimeElimination` IS NULL)');
202 $ConsumptionPlus = $DbResult2->fetch_row();
203 $ConsumptionPlus = $ConsumptionPlus[0];
204
205 $NetworkDevice = 0;
206 $Consumption = 0;
207 $Id = $Member['NetworkSegment'];
208 while(($Id != '') and ($Id != 0))
209 {
210 $DbResult2 = $this->Database->query('SELECT * FROM `NetworkSegment` WHERE `Id`='.$Id);
211 $Device = $DbResult2->fetch_assoc();
212 if($Device['Users'] > 0) $NetworkDevice += $Device['Price'] / $Device['Users'];
213 if($Device['UsersOverheads'] > 0) $Consumption += $Device['Consumption'] / $Device['UsersOverheads'];
214 $Id = $Device['Parent'];
215 }
216
217 $DbResult2 = $this->Database->query('SELECT SUM(`Service`.`Price`) AS `Price` '.
218 'FROM `ServiceCustomerRel` LEFT JOIN '.
219 '`Service` ON `Service`.`Id` = `ServiceCustomerRel`.`Service` WHERE `ServiceCustomerRel`.`Customer`='.
220 $Member['Id'].' AND `ServiceCustomerRel`.`Action` IS NULL');
221 $DbRow = $DbResult2->fetch_assoc();
222 $Monthly = 0;
223 if($DbRow['Price'] != '') $MonthlyInet = $DbRow['Price'];
224 else $MonthlyInet = 0;
225
226 $Monthly += $MonthlyInet;
227 $Monthly -= $this->W2Kc($ConsumptionPlus);
228 $Monthly = round($Monthly);
229
230 if($Member['BillingPeriodNext'] == 1)
231 {
232 // Inactive payer
233 $MonthlyInet = 0;
234 $Monthly = 0;
235 $ConsumptionPlus = 0;
236 $Consumption = 0;
237 }
238 $this->Database->insert('MemberPayment', array('Member' => $Member['Id'],
239 'NetworkDevice' => $NetworkDevice, 'MonthlyInternet' => $MonthlyInet,
240 'MonthlyTotal' => $Monthly, 'MonthlyConsumption' => $this->W2Kc($Consumption),
241 'Cash' => $Cash, 'MonthlyPlus' => $this->W2Kc($ConsumptionPlus)));
242 }
243 $this->System->ModuleManager->Modules['Log']->NewRecord('Finance', 'RecalculateMemberPayment');
244 $this->RecalculateTariffs(1);
245 $this->RecalculateTariffs(0);
246 return($Output);
247 }
248
249 function RecalculateSegmentParameters()
250 {
251 $Output = 'Aktualizuji parametry segmentů...<br />';
252 $this->Database->query('UPDATE `NetworkSegment` SET `Users` = 0, `UsersOverheads` = 0'); // Vynulovat počty uživatelů
253 $DbResult = $this->Database->query('SELECT * FROM `NetworkSegment`');
254 while($NetworkSegment = $DbResult->fetch_array())
255 {
256 $DbResult2 = $this->Database->query('SELECT `Users` FROM `NetworkSegment` WHERE `Id`='.$NetworkSegment['Id']);
257 $RowP = $DbResult2->fetch_array();
258 $DbResult2 = $this->Database->query('SELECT `UsersOverheads` FROM `NetworkSegment` WHERE `Id`='.$NetworkSegment['Id']);
259 $RowP2 = $DbResult2->fetch_array();
260
261 $DbResult2 = $this->Database->query('SELECT SUM(`Product`.`BuyPrice`) * `StockItem`.`Amount` AS `Price`, '.
262 'SUM(`Product`.`Consumption`) * `StockItem`.`Amount` AS `Consumption` '.
263 'FROM `StockItem` JOIN `Product` ON `Product`.`Id` = `StockItem`.`Product` '.
264 'WHERE (`StockItem`.`Segment`='.$NetworkSegment['Id'].') AND (`StockItem`.`TimeElimination` IS NULL)');
265 $Row2 = $DbResult2->fetch_array();
266 $DbResult2 = $this->Database->query('SELECT COUNT(*) FROM Member WHERE NetworkSegment='.$NetworkSegment['Id']);
267 $Row3 = $DbResult2->fetch_array();
268 $ID = $NetworkSegment['Parent'];
269 while($ID != 0)
270 {
271 $DbResult2 = $this->Database->query('SELECT * FROM NetworkSegment WHERE Id='.$ID);
272 $Row4 = $DbResult2->fetch_array();
273 $this->Database->update('NetworkSegment', 'Id='.$Row4['Id'],
274 array('Users' => ($Row4['Users'] + $Row3[0]), 'UsersOverheads' => ($Row4['UsersOverheads'] + $Row3[0])));
275 $ID = $Row4['Parent'];
276 }
277 $this->Database->update('NetworkSegment', 'Id='.$NetworkSegment['Id'],
278 array('Price' => $Row2['Price'], 'Users' => ($Row3[0] + $RowP['Users']), 'Consumption' => $Row2['Consumption'], 'UsersOverheads' => ($Row3[0] + $RowP2['UsersOverheads'])));
279 }
280
281 // Zkorigovat segment Internet
282 $DbResult = $this->Database->select('Member', 'COUNT(*)');
283 $Row = $DbResult->fetch_array();
284 $DbResult = $this->Database->update('NetworkSegment', 'Id='.$this->InternetSegmentId,
285 array('Users' => $Row[0], 'UsersOverheads' => $Row[0]));
286 $this->System->ModuleManager->Modules['Log']->NewRecord('Finance', 'RecalculateSegmentParameters');
287 return($Output);
288 }
289}
290
291class ModuleFinance extends AppModule
292{
293 function __construct($System)
294 {
295 parent::__construct($System);
296 $this->Name = 'Finance';
297 $this->Version = '1.0';
298 $this->Creator = 'Chronos';
299 $this->License = 'GNU/GPLv3';
300 $this->Description = 'Base module for finance management';
301 $this->Dependencies = array('File');
302 }
303
304 function Install()
305 {
306 }
307
308 function Uninstall()
309 {
310 }
311
312 function Start()
313 {
314 global $Config;
315
316 parent::Start();
317 $this->System->RegisterPage('finance', 'PageFinance');
318 $this->System->RegisterPage(array('finance', 'spotreba'), 'PageFinanceConsumption');
319 $this->System->RegisterPage(array('finance', 'zarizeni'), 'PageFinanceDeviceList');
320 $this->System->RegisterPage(array('finance', 'sluzby'), 'PageFinanceServices');
321 $this->System->RegisterPage(array('finance', 'mesicni-prehledy'), 'PageFinanceMonthlyOverall');
322 $this->System->RegisterPage(array('finance', 'zakaznici'), 'PageFinanceCustomers');
323 $this->System->RegisterPage(array('finance', 'sprava'), 'PageFinanceManage');
324 $this->System->RegisterPage(array('finance', 'platby'), 'PageFinanceUserState');
325 $this->System->RegisterPage(array('finance', 'import'), 'PageFinanceImportPayment');
326 $this->System->RegisterPage(array('finance', 'zivnost'), 'PageFinanceTaxFiling');
327
328 $this->System->FormManager->RegisterClass('NewPayment', array(
329 'Title' => 'Nová platba',
330 'Items' => array(
331 'DocumentLine' => array('Type' => 'TDocumentLine', 'Caption' => 'Dokladová řada', 'Default' => 3),
332 'Time' => array('Type' => 'Date', 'Caption' => 'Čas', 'Default' => 'Now'),
333 'Subject' => array('Type' => 'TFinanceSubject', 'Caption' => 'Subjekt', 'Default' => 0),
334 'Value' => array('Type' => 'Float', 'Caption' => 'Částka [Kč]', 'Default' => '0', 'Suffix' => 'Kč'),
335 'Text' => array('Type' => 'String', 'Caption' => 'Popis', 'Default' => 'Vklad'),
336 'Cash' => array('Type' => 'Boolean', 'Caption' => 'Hotovost', 'Default' => '0'),
337 'Taxable' => array('Type' => 'Boolean', 'Caption' => 'Ovlivňující daňový základ', 'Default' => '1'),
338 //'BankAccount' => array('Type' => 'TBankAccount', 'Caption' => 'Bankovní účet', 'Default' => '1'),
339 ),
340 ));
341 $this->System->FormManager->RegisterClass('NewInvoice', array(
342 'Title' => 'Nová faktura',
343 'Items' => array(
344 'DocumentLine' => array('Type' => 'TDocumentLine', 'Caption' => 'Dokladová řada', 'Default' => 5),
345 'TimeCreation' => array('Type' => 'Date', 'Caption' => 'Čas vytvoření', 'Default' => 'Now'),
346 'TimeDue' => array('Type' => 'Date', 'Caption' => 'Čas splatnosti', 'Default' => 'Now'),
347 'Subject' => array('Type' => 'TFinanceSubject', 'Caption' => 'Subjekt', 'Default' => 0),
348 'Text' => array('Type' => 'String', 'Caption' => 'Popis', 'Default' => 'Nákup zařízení'),
349 'Value' => array('Type' => 'Float', 'Caption' => 'Částka [Kč]', 'Default' => '0', 'Suffix' => 'Kč'),
350 //'Items' => array('Type' => 'Array', 'Caption' => 'Položky', 'ItemClass' => 'FinanceInvoiceItem'),
351 ),
352 ));
353 $this->System->FormManager->RegisterClass('FinanceOperation', array(
354 'Title' => 'Finanční operace',
355 'Table' => 'FinanceOperation',
356 'DefaultSortColumn' => 'Time',
357 'Items' => array(
358 'Time' => array('Type' => 'Date', 'Caption' => 'Čas realizace', 'Default' => ''),
359 'Subject' => array('Type' => 'TSubject', 'Caption' => 'Subjekt', 'Default' => ''),
360 'Cash' => array('Type' => 'Boolean', 'Caption' => 'Hotově', 'Default' => ''),
361 'Taxable' => array('Type' => 'Boolean', 'Caption' => 'Zdanitelné', 'Default' => ''),
362 'Value' => array('Type' => 'Integer', 'Caption' => 'Částka', 'Default' => '0', 'Suffix' => 'Kč'),
363 'BillCode' => array('Type' => 'String', 'Caption' => 'Označení', 'Default' => ''),
364 'Text' => array('Type' => 'String', 'Caption' => 'Popis', 'Default' => ''),
365 'Network' => array('Type' => 'Boolean', 'Caption' => 'Týkající sítě', 'Default' => ''),
366 'BankAccount' => array('Type' => 'TFinanceBankAccount', 'Caption' => 'Účet', 'Default' => '', 'Null' => true),
367 'Treasury' => array('Type' => 'TFinanceTreasury', 'Caption' => 'Pokladna', 'Default' => '', 'Null' => true),
368 'Generate' => array('Type' => 'Boolean', 'Caption' => 'Generovat', 'Default' => ''),
369 ),
370 ));
371 $this->System->FormManager->RegisterClass('FinanceInvoice', array(
372 'Title' => 'Faktury',
373 'Table' => 'FinanceInvoice',
374 'DefaultSortColumn' => 'TimeCreation',
375 'Items' => array(
376 'BillCode' => array('Type' => 'String', 'Caption' => 'Označení', 'Default' => ''),
377 'Subject' => array('Type' => 'TSubject', 'Caption' => 'Subjekt', 'Default' => ''),
378 'TimeCreation' => array('Type' => 'Date', 'Caption' => 'Čas vytvoření', 'Default' => ''),
379 'TimeDue' => array('Type' => 'Date', 'Caption' => 'Čas splatnosti', 'Default' => ''),
380 'TimePayment' => array('Type' => 'Date', 'Caption' => 'Čas zaplacení', 'Default' => ''),
381 'Value' => array('Type' => 'Integer', 'Caption' => 'Částka', 'Default' => '0', 'Suffix' => 'Kč'),
382 'File' => array('Type' => 'TFile', 'Caption' => 'Doklad', 'Default' => '', 'Null' => true),
383 'Generate' => array('Type' => 'Boolean', 'Caption' => 'Generovat', 'Default' => ''),
384 'Items' => array('Type' => 'TFinanceInvoiceItemListInvoice', 'Caption' => 'Položky', 'Default' => ''),
385 ),
386 ));
387 $this->System->FormManager->RegisterClass('FinanceInvoiceItem', array(
388 'Title' => 'Položka faktury',
389 'Table' => 'FinanceInvoiceItem',
390 'Items' => array(
391 'FinanceInvoice' => array('Type' => 'TFinanceInvoice', 'Caption' => 'Faktura', 'Default' => '0'),
392 'Description' => array('Type' => 'String', 'Caption' => 'Popis', 'Default' => 'Položka'),
393 'Price' => array('Type' => 'Float', 'Caption' => 'Částka', 'Default' => '0', 'Suffix' => 'Kč'),
394 'Quantity' => array('Type' => 'Integer', 'Caption' => 'Množství', 'Default' => '1'),
395 'VAT' => array('Type' => 'Integer', 'Caption' => 'Daň', 'Default' => '19', 'Suffix' => '%'),
396 ),
397 ));
398 $this->System->FormManager->RegisterClass('FinanceTreasury', array(
399 'Title' => 'Pokladny',
400 'Table' => 'FinanceTreasury',
401 'DefaultSortColumn' => 'Name',
402 'Items' => array(
403 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
404 'TimeCreate' => array('Type' => 'Date', 'Caption' => 'Čas vytvoření', 'Default' => ''),
405 ),
406 ));
407 $this->System->FormManager->RegisterClass('FinanceBankAccount', array(
408 'Title' => 'Účty',
409 'Table' => 'FinanceBankAccount',
410 'DefaultSortColumn' => 'Comment',
411 'Items' => array(
412 'Subject' => array('Type' => 'TSubject', 'Caption' => 'Vlastník', 'Default' => ''),
413 'Comment' => array('Type' => 'String', 'Caption' => 'Komentář', 'Default' => ''),
414 'Number' => array('Type' => 'String', 'Caption' => 'Číslo', 'Default' => ''),
415 'Bank' => array('Type' => 'TFinanceBank', 'Caption' => 'Banka', 'Default' => ''),
416 'TimeCreate' => array('Type' => 'Date', 'Caption' => 'Čas vytvoření', 'Default' => ''),
417 'TimeEnd' => array('Type' => 'Date', 'Caption' => 'Čas zrušení', 'Default' => ''),
418 'Currency' => array('Type' => 'TCurrency', 'Caption' => 'Měna', 'Default' => ''),
419 'LoginName' => array('Type' => 'String', 'Caption' => 'Přihlašovací jméno / token', 'Default' => ''),
420 'LoginPassword' => array('Type' => 'String', 'Caption' => 'Přihlašovací heslo', 'Default' => ''),
421 'Operations' => array('Type' => 'TFinanceOperationListAccount', 'Caption' => 'Operace', 'Default' => ''),
422 ),
423 'ItemActions' => array(
424 array('Caption' => 'Import plateb z banky', 'URL' => '/finance/import-api/?'),
425 array('Caption' => 'Import plateb ze souboru', 'URL' => '/finance/import-soubor/?'),
426 ),
427 ));
428 $this->System->FormManager->RegisterClass('FinanceBank', array(
429 'Title' => 'Banky',
430 'Table' => 'FinanceBank',
431 'Items' => array(
432 'Name' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => ''),
433 'Code' => array('Type' => 'String', 'Caption' => 'Český kód', 'Default' => ''),
434 'BIC' => array('Type' => 'String', 'Caption' => 'Kód BIC', 'Default' => ''),
435 'Country' => array('Type' => 'TCountry', 'Caption' => 'Země', 'Default' => ''),
436 ),
437 ));
438 $this->System->FormManager->RegisterClass('Currency', array(
439 'Title' => 'Měny',
440 'Table' => 'Currency',
441 'Items' => array(
442 'Code' => array('Type' => 'String', 'Caption' => 'Kód'),
443 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
444 'Symbol' => array('Type' => 'String', 'Caption' => 'Symbol', 'Default' => ''),
445 ),
446 ));
447 $this->System->FormManager->RegisterClass('FinanceCharge', array(
448 'Title' => 'Parametry účtování',
449 'Table' => 'FinanceCharge',
450 'Items' => array(
451 'Internet' => array('Type' => 'Integer', 'Caption' => 'Platba Internetu', 'Default' => '0', 'Suffix' => 'Kč'),
452 'InternetSpeed' => array('Type' => 'Integer', 'Caption' => 'Rychlost Internetu', 'Default' => '0', 'Suffix' => 'Mbit/s'),
453 'InternetSpeedReserve' => array('Type' => 'Integer', 'Caption' => 'Rezerva rychlosti', 'Default' => '0', 'Suffix' => 'Mbit/s'),
454 'AdministrationPerUser' => array('Type' => 'Integer', 'Caption' => 'Správa za uživatele', 'Default' => '0', 'Suffix' => 'Kč'),
455 'kWh' => array('Type' => 'Integer', 'Caption' => 'Cena kWh', 'Default' => '0', 'Suffix' => 'Kč'),
456 'BaseSpeedElement' => array('Type' => 'Integer', 'Caption' => 'Základní díl rychlosti', 'Default' => '0', 'Suffix' => 'Mbit/s'),
457 'BaseTariffPrice' => array('Type' => 'Integer', 'Caption' => 'Základní cena tarifu', 'Default' => '0', 'Suffix' => 'Kč'),
458 'TopTariffPrice' => array('Type' => 'Integer', 'Caption' => 'Nejvyšší cena tarifu', 'Default' => '0', 'Suffix' => 'Kč'),
459 'Action' => array('Type' => 'TActionEnum', 'Caption' => 'Změna období', 'Default' => '', 'Null' => true),
460 'ReplaceId' => array('Type' => 'TFinanceCharge', 'Caption' => 'Cílová položka', 'Default' => '0', 'Null' => true),
461 ),
462 ));
463
464 $this->System->AddModule(new Bill($this->System));
465 $this->System->AddModule(new Finance($this->System));
466 $this->System->Modules['Finance']->MainSubject = $Config['Finance']['MainSubjectId'];
467 $this->System->Modules['Finance']->DirectoryId = $Config['Finance']['DirectoryId'];
468 }
469
470 function Stop()
471 {
472 }
473}
Note: See TracBrowser for help on using the repository browser.