Changeset 891 for trunk/Modules/Finance/Finance.php
- Timestamp:
- Dec 30, 2020, 11:52:07 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Finance/Finance.php
r890 r891 221 221 } 222 222 223 class FinanceGroup extends Model 224 { 225 static function GetDesc(): ModelDesc 226 { 227 $Desc = new ModelDesc('FinanceGroup'); 228 $Desc->AddString('Description'); 229 return $Desc; 230 } 231 } 232 233 class FinanceOperation extends Model 234 { 235 static function GetDesc(): ModelDesc 236 { 237 $Desc = new ModelDesc('FinanceOperation'); 238 $Desc->AddReference('Group', 'FinanceGroup'); 239 $Desc->AddDateTime('Time'); 240 $Desc->AddReference('Subject', 'Subject'); 241 $Desc->AddBoolean('Cash'); 242 $Desc->AddFloat('Value'); 243 $Desc->AddFloat('ValueUser'); 244 $Desc->AddReference('BillCode', 'DocumentLineCode'); 245 $Desc->AddBoolean('Taxable'); 246 $Desc->AddReference('File', 'File'); 247 $Desc->AddString('Text'); 248 $Desc->AddBoolean('Network'); 249 $Desc->AddReference('BankAccount', 'FinanceBankAccount'); 250 $Desc->AddReference('Treasury', 'FinanceTreasury'); 251 $Desc->AddBoolean('Generate'); 252 return $Desc; 253 } 254 } 255 256 class FinanceOperationGroup extends Model 257 { 258 static function GetDesc(): ModelDesc 259 { 260 $Desc = new ModelDesc('FinanceOperationGroup'); 261 $Desc->AddString('Name'); 262 $Desc->AddReference('DocumentLine', 'DocumentLine'); 263 $Desc->AddInteger('ValueSign'); 264 $Desc->AddInteger('Direction'); 265 return $Desc; 266 } 267 } 268 269 class FinanceInvoice extends Model 270 { 271 static function GetDesc(): ModelDesc 272 { 273 $Desc = new ModelDesc('FinanceInvoice'); 274 $Desc->AddReference('Group', 'FinanceGroup'); 275 $Desc->AddReference('BillCode', 'DocumentLineCode'); 276 $Desc->AddReference('Subject', 'Subject'); 277 $Desc->AddDateTime('Time'); 278 $Desc->AddDateTime('TimeDue'); 279 $Desc->AddDateTime('TimePayment'); 280 $Desc->AddFloat('Value'); 281 $Desc->AddReference('File', 'File'); 282 $Desc->AddDate('PeriodFrom'); 283 $Desc->AddDate('PeriodTo'); 284 $Desc->AddBoolean('Cash'); 285 $Desc->AddBoolean('Generate'); 286 $Desc->AddBoolean('VisibleToUser'); 287 return $Desc; 288 } 289 } 290 291 class FinanceInvoiceGroup extends Model 292 { 293 static function GetDesc(): ModelDesc 294 { 295 $Desc = new ModelDesc('FinanceInvoiceGroup'); 296 $Desc->AddString('Name'); 297 $Desc->AddReference('DocumentLine', 'DocumentLine'); 298 $Desc->AddInteger('ValueSign'); 299 $Desc->AddInteger('Direction'); 300 return $Desc; 301 } 302 } 303 304 class Company extends Model 305 { 306 static function GetDesc(): ModelDesc 307 { 308 $Desc = new ModelDesc('Company'); 309 $Desc->AddString('Name'); 310 $Desc->AddReference('Subject', 'Subject'); 311 return $Desc; 312 } 313 } 314 315 class FinanceInvoiceItem extends Model 316 { 317 static function GetDesc(): ModelDesc 318 { 319 $Desc = new ModelDesc('FinanceInvoiceItem'); 320 $Desc->AddReference('FinanceInvoice', 'FinanceInvoice'); 321 $Desc->AddString('Description'); 322 $Desc->AddFloat('Price'); 323 $Desc->AddFloat('Quantity'); 324 $Desc->AddInteger('VAT'); 325 return $Desc; 326 } 327 } 328 329 class FinanceTreasury extends Model 330 { 331 static function GetDesc(): ModelDesc 332 { 333 $Desc = new ModelDesc('FinanceTreasury'); 334 $Desc->AddString('Name'); 335 $Desc->AddDate('TimeCreate'); 336 return $Desc; 337 } 338 } 339 340 class FinanceTreasuryCheck extends Model 341 { 342 static function GetDesc(): ModelDesc 343 { 344 $Desc = new ModelDesc('FinanceTreasuryCheck'); 345 $Desc->AddReference('Treasury', 'FinanceTreasury', false); 346 $Desc->AddDateTime('Time'); 347 $Desc->AddInteger('Value1'); 348 $Desc->AddInteger('Value2'); 349 $Desc->AddInteger('Value5'); 350 $Desc->AddInteger('Value10'); 351 $Desc->AddInteger('Value20'); 352 $Desc->AddInteger('Value50'); 353 $Desc->AddInteger('Value100'); 354 $Desc->AddInteger('Value200'); 355 $Desc->AddInteger('Value500'); 356 $Desc->AddInteger('Value1000'); 357 $Desc->AddInteger('Value2000'); 358 $Desc->AddInteger('Value5000'); 359 return $Desc; 360 } 361 } 362 363 class FinanceBankAccount extends Model 364 { 365 static function GetDesc(): ModelDesc 366 { 367 $Desc = new ModelDesc('FinanceBankAccount'); 368 $Desc->AddReference('Subject', 'Subject'); 369 $Desc->AddString('Comment'); 370 $Desc->AddString('Number'); 371 $Desc->AddReference('Bank', 'FinanceBank'); 372 $Desc->AddDate('TimeCreate'); 373 $Desc->AddDate('TimeEnd'); 374 $Desc->AddReference('Currency', 'Currency'); 375 $Desc->AddString('LoginName'); 376 $Desc->AddString('LoginPassword'); 377 $Desc->AddBoolean('Use'); 378 $Desc->AddDate('LastImportDate'); 379 $Desc->AddString('LastImportId'); 380 $Desc->AddBoolean('AutoImport'); 381 return $Desc; 382 } 383 } 384 385 class FinanceBank extends Model 386 { 387 static function GetDesc(): ModelDesc 388 { 389 $Desc = new ModelDesc('FinanceBank'); 390 $Desc->AddString('Name'); 391 $Desc->AddString('Code'); 392 $Desc->AddString('BIC'); 393 $Desc->AddReference('Country', 'Country'); 394 return $Desc; 395 } 396 } 397 398 class Currency extends Model 399 { 400 static function GetDesc(): ModelDesc 401 { 402 $Desc = new ModelDesc('Currency'); 403 $Desc->AddString('Code'); 404 $Desc->AddString('Name'); 405 $Desc->AddString('Symbol'); 406 return $Desc; 407 } 408 } 409 410 class FinanceCharge extends Model 411 { 412 static function GetDesc(): ModelDesc 413 { 414 $Desc = new ModelDesc('FinanceCharge'); 415 $Desc->AddInteger('Internet'); 416 $Desc->AddInteger('InternetSpeed'); 417 $Desc->AddInteger('InternetSpeedReserve'); 418 $Desc->AddInteger('AdministrationPerUser'); 419 $Desc->AddInteger('kWh'); 420 $Desc->AddInteger('BaseSpeedElement'); 421 $Desc->AddInteger('BaseTariffPrice'); 422 $Desc->AddInteger('TopTariffPrice'); 423 $Desc->AddChangeAction(); 424 return $Desc; 425 } 426 } 427 428 class FinanceVat extends Model 429 { 430 static function GetDesc(): ModelDesc 431 { 432 $Desc = new ModelDesc('FinanceVAT'); 433 $Desc->AddReference('Type', 'FinanceVatType'); 434 $Desc->AddDate('ValidFrom'); 435 $Desc->AddDate('ValidTo'); 436 $Desc->AddInteger('Value'); 437 return $Desc; 438 } 439 } 440 441 class FinanceVatType extends Model 442 { 443 static function GetDesc(): ModelDesc 444 { 445 $Desc = new ModelDesc('FinanceVATType'); 446 $Desc->AddString('Name'); 447 return $Desc; 448 } 449 } 450 451 class Contract extends Model 452 { 453 static function GetDesc(): ModelDesc 454 { 455 $Desc = new ModelDesc('Contract'); 456 $Desc->AddReference('DocumentLine', 'DocumentLine'); 457 $Desc->AddReference('BillCode', 'DocumentLineCode'); 458 $Desc->AddReference('Subject', 'Subject'); 459 $Desc->AddDate('ValidFrom'); 460 $Desc->AddDate('ValidTo'); 461 $Desc->AddReference('File', 'File'); 462 return $Desc; 463 } 464 } 465 223 466 class ModuleFinance extends AppModule 224 467 { … … 234 477 $this->License = 'GNU/GPLv3'; 235 478 $this->Description = 'Base module for finance management'; 236 $this->Dependencies = array('File', 'EmailQueue' );479 $this->Dependencies = array('File', 'EmailQueue', 'Subject', 'Document'); 237 480 238 481 $this->Bill = new Bill($this->System); … … 240 483 } 241 484 485 static function GetModels(): array 486 { 487 return array( 488 'FinanceVatType', 489 'FinanceVat', 490 'FinanceGroup', 491 'FinanceOperationGroup', 492 'FinanceOperation', 493 'FinanceInvoiceGroup', 494 'FinanceInvoice', 495 'FinanceInvoiceItem', 496 'Company', 497 'FinanceTreasury', 498 'FinanceTreasuryCheck', 499 'Currency', 500 'FinanceBank', 501 'FinanceBankAccount', 502 'FinanceCharge', 503 'Contract' 504 ); 505 } 506 242 507 function DoInstall(): void 243 508 { 509 foreach (self::GetModels() as $Model) 510 { 511 $this->InstallModel($Model::GetDesc()); 512 } 244 513 } 245 514 246 515 function DoUninstall(): void 247 516 { 517 foreach (array_reverse(self::GetModels()) as $Model) 518 { 519 $this->UninstallModel($Model::GetDesc()); 520 } 248 521 } 249 522 … … 277 550 'Treasury' => array('Type' => 'TFinanceTreasury', 'Caption' => 'Pokladna', 'Default' => '', 'Null' => true), 278 551 'Generate' => array('Type' => 'Boolean', 'Caption' => 'Generovat', 'Default' => ''), 279 'Balance' => array('Type' => 'Integer', 'Caption' => 'Zůstatek', 'Default' => '', 552 'Balance' => array('Type' => 'Integer', 'Caption' => 'Zůstatek', 'Default' => '', 280 553 'ReadOnly' => true, 'SQL' => '(SELECT SUM(`FinanceOperation2`.`Value`) FROM `FinanceOperation` AS `FinanceOperation2` WHERE `FinanceOperation2`.`Time`<`Time`)'), 281 554 'InvoiceRel' => array('Type' => 'TFinanceInvoiceOperationRelListOperation', 'Caption' => 'Zaplacené faktury', 'Default' => ''), … … 291 564 ), 292 565 )); 293 566 294 567 $this->System->FormManager->RegisterClass('FinanceTreasuryIn', $this->System->FormManager->Classes['FinanceOperation']); 295 568 $this->System->FormManager->Classes['FinanceTreasuryIn']['Title'] = 'Pokladní příjmy';
Note:
See TracChangeset
for help on using the changeset viewer.