<?php
 
// archive-ipq-co.narod.ru
error_reporting(-1);
 
class Worker
{
  private static $percents = [
      1,
      1.25,
      1.5
    ];
 
  public $rang; // Ранг сотрудника 1-3
  public $dicrementcoffe; // выжрано кофе 
  public $stavka; // начальная ставка
  public $mainingDocument; // Произвел документов
  public $endStavka; // окончательная ставка, вычисляется через функцию EndStavka
  public $boss = false; // является ли сотрудник начальником
 
  public function __construct($rang, $stavka, $boss)
  {
    $this->rang = $rang;
    $this->stavka = $stavka;
    $this->boss = $boss;
 
    $this->dicrementcoffe = 0;
 
    $this->endStavka = $stavka * Worker::$percents[$this->rang];
 
    if ($this->boss) {
      $this->endStavka *= $percents[2];
    }
	return $endStavka;
  }
}
 
class Menedger extends Worker
{
 
 
	public $dicrementcoffe = 20;
	public $stavka = 500;
	public $mainingDocument = 200;	
}
class Market extends Worker
{
	public $dicrementcoffe = 15;
	public $stavka = 400;
	public $mainingDocument = 150;	
}
class Engeener extends Worker
{
	public $dicrementcoffe = 5;
	public $stavka = 200;
	public $mainingDocument = 50;	
}
class Analitic extends Worker
{
	public $dicrementcoffe = 50;
	public $stavka = 800;
	public $mainingDocument = 5;	
}
class Departament // возвращает массив с работниками в каждом департаменте
{ 
   	public $name;
	public $workers;
	public $menedgerA; //1 rang
	public $menedgerB; //2 rang
	public $menedgerC; //3 rang
	public $menedgerBoss; //Руководитель 
// инженеры
	public $engeenerA;  //1 rang
	public $engeenerB; //2 rang
	public $engeenerC; //3 rang
	public $engeenerBoss; //Руководитель 
//маркетологи
	public $marketA;//1 rang
	public $marketB;//2 rang
	public $marketC;//3 rang
	public $marketBoss;//Руководитель 
//аналитики
	public $analiticA; //1 rang
	public $analiticB; //2 rang
	public $analiticC; //3 rang
	public $analiticBoss; 
	public function __construct(){$this->workers=$this->quantityWorker();}
	public function quantityWorker () // Возвращает массив с сотрудниками
{	
for ($i=0; $i<$this->menedgerA; $i++) // заносим в массив менеджеров 1й ранг
{	
	$w = new Menedger($this->rang, $this->stavka, $this->boss);
	$w->rang = 1;
	$workers[] = $w;
}
for ($i=0; $i<$this->menedgerB; $i++) // заносим в массив менеджеров 2й ранг
{	
	$w = new Menedger($this->rang, $this->stavka, $this->boss);
	$w->rang = 2;
	$workers[] = $w;
}for ($i=0; $i<$this->menedgerA; $i++) // заносим в массив менеджеров 1й ранг
{	
	$w = new Menedger($this->rang, $this->stavka, $this->boss);
	$w->rang = 1;
	$workers[] = $w;
}for ($i=0; $i<$this->menedgerB; $i++) // заносим в массив менеджеров 3й ранг
{	
	$w = new Menedger($this->rang, $this->stavka, $this->boss);
	$w->rang = 3;
	$workers[] = $w;
}
for ($i=0; $i<$this->menedgerBoss; $i++) // заносим в массив менеджеров руководителей 
{	
	$w = new Menedger($this->rang, $this->stavka, $this->boss);
	$w->rang = 1;
	$w->boss = true;
	$workers[] = $w;
}for ($i=0; $i<$this->engeenerA; $i++) // заносим в массив инженеров 1й ранг
{	
	$w = new Engeener($this->rang, $this->stavka, $this->boss);
	$w->rang = 1;
	$workers[] = $w;
}for ($i=0; $i<$this->engeenerB; $i++) // заносим в массив инжей 2й ранг
{	
	$w = new Engeener($this->rang, $this->stavka, $this->boss);
	$w->rang = 2;
	$workers[] = $w;
}for ($i=0; $i<$this->engeenerC; $i++) // заносим в массив инжей 3й ранг
{	
	$w = new Engeener($this->rang, $this->stavka, $this->boss);
	$w->rang = 3;
	$workers[] = $w;
}
for ($i=0; $i<$this->engeenerBoss; $i++) // заносим в массив инжей боссов
{	
	$w = new Engeener($this->rang, $this->stavka, $this->boss);
	$w->rang = 1;
	$w->boss = true;
	$workers[] = $w;
}
for ($i=0; $i<$this->marketA; $i++) // заносим в массив маркетологов 1
{	
	$w = new Market($this->rang, $this->stavka, $this->boss);
	$w->rang = 1;
	$workers[] = $w;
}
for ($i=0; $i<$this->marketB; $i++) // заносим в массив маркетологов 2
{	
	$w = new Market($this->rang, $this->stavka, $this->boss);
	$w->rang = 2;
	$workers[] = $w;
}
for ($i=0; $i<$this->marketC; $i++) // заносим в массив мfhrtnjkjujd 3
{	$w = new Market($this->rang, $this->stavka, $this->boss);
	$w->rang = 3;
	$workers[] = $w;
}
for ($i=0; $i<$this->marketBoss; $i++) // заносим в массив Boss Market 
{	
	$w = new Market($this->rang, $this->stavka, $this->boss);
	$w->rang = 1;
	$w->boss = true;
	$workers[] = $w;
}
for ($i=0; $i<$this->analiticA; $i++) // заносим в массив Analitic 1
{	
	$w = new Analitic($this->rang, $this->stavka, $this->boss);
	$w->rang = 1;
	$workers[] = $w;
}for ($i=0; $i<$this->analiticB; $i++) // заносим в массив Analitic 2
{	
	$w = new Analitic($this->rang, $this->stavka, $this->boss);
	$w->rang = 2;
	$workers[] = $w;
}for ($i=0; $i<$this->analiticC; $i++) // Analitic 3
{	
	$w = new Analitic($this->rang, $this->stavka, $this->boss);
	$w->rang = 3;
	$workers[] = $w;
}
for ($i=0; $i<$this->analiticC; $i++) // Analitic BoSS
{	
	$w = new Analitic($this->rang, $this->stavka, $this->boss);
	$w->rang = 3;
	$w->boss = true;
	$workers[] = $w;
}
return $workers;
}
 
}
class ProcurementDivision extends Departament
{
	public $name = "Закупок";
	public $menedgerA=9;
	public $menedgerB=3;
	public $menedgerC=2;
	public $marketA=2;
	public $menedgerBoss=1;	//поменять в классе на ранг
}
 
$quest = new ProcurementDivision;
var_dump($quest);