<?php

class ModuleEmployee extends AppModule
{
  function __construct($System)
  {
    parent::__construct($System);
    $this->Name = 'Employee';
    $this->Version = '1.0';
    $this->Creator = 'Chronos';
    $this->License = 'GNU/GPL';
    $this->Description = 'Employee wages management';
    $this->Dependencies = array('User');
  }

  function DoStart()
  {
    $this->System->FormManager->RegisterClass('Employee', array(
      'Title' => 'Zaměstnanci',
      'Table' => 'Employee',
      'DefaultSortColumn' => 'Name',
      'Items' => array(
        'FirstName' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
        'SecondName' => array('Type' => 'String', 'Caption' => 'Přijímení', 'Default' => ''),
        'PeriodicSalary' => array('Type' => 'Integer', 'Caption' => 'Pravidlená mzda', 'Default' => '0', 'Suffix' => 'Kč'),
        'ValidFrom' => array('Type' => 'Date', 'Caption' => 'Platnost od', 'Default' => '0'),
        'ValidTo' => array('Type' => 'Date', 'Caption' => 'Platnost do', 'Default' => '', 'Null' => true),
      ),
    ));
    $this->System->FormManager->RegisterClass('EmployeePayment', array(
      'Title' => 'Výplaty zaměstnacům',
      'Table' => 'EmployeePayment',
      'Items' => array(
        'Employee' => array('Type' => 'TEmployee', 'Caption' => 'Zaměstnanec', 'Default' => ''),
        'PeriodFrom' => array('Type' => 'Date', 'Caption' => 'Období od', 'Default' => '0'),
        'PeriodTo' => array('Type' => 'Date', 'Caption' => 'Období do', 'Default' => ''),
        'Salary' => array('Type' => 'Integer', 'Caption' => 'Částka', 'Default' => '', 'Suffix' => 'Kč'),
        'DatePayment' => array('Type' => 'Date', 'Caption' => 'Datum vyplacení', 'Default' => ''),
        'WorkHours' => array('Type' => 'Integer', 'Caption' => 'Počet hodin', 'Default' => '0'),
        'PayPerHour' => array('Type' => 'Integer', 'Caption' => 'Hodinová mzda', 'Default' => '0'),
        'TaxAdvance' => array('Type' => 'Integer', 'Caption' => 'Záloha daně', 'Default' => '0'),
      ),
    ));

  }
}
