/** * * @param int|DateTime $input unix timestamp or DateTime object */ public function setDateVatPrev($input) { $this->dateVatPrev = Utils::getDateTimeFrom($input); }
/** * @param mixed[] $arrayData input data */ public function __construct(array $arrayData) { $this->id = Utils::getValueOrNull($arrayData, 'id'); $this->sequenceCode = Utils::getValueOrNull($arrayData, 'sequence_code'); $this->variableSymbol = Utils::getValueOrNull($arrayData, 'variable_symbol'); $this->date = Utils::getDateTimeFrom($arrayData['date']); $this->dateVat = Utils::getDateTimeFrom($arrayData['date_vat']); $this->maturityDate = Utils::getDateTimeFrom($arrayData['maturity_date']); $this->currency = Utils::getValueOrNull($arrayData, 'currency'); $this->price = Utils::getValueOrNull($arrayData, 'price'); $this->priceCzk = Utils::getValueOrNull($arrayData, 'price_czk'); $this->priceIncVat = Utils::getValueOrNull($arrayData, 'price_inc_vat'); $this->priceIncVatCzk = Utils::getValueOrNull($arrayData, 'price_inc_vat_czk'); $this->toBePaid = Utils::getValueOrNull($arrayData, 'to_be_paid'); if (array_key_exists('customer', $arrayData)) { $this->customer = new Customer($arrayData['customer']); } $this->customerBankAccount = Utils::getValueOrNull($arrayData, 'customer_bank_account'); $this->paymentType = Utils::getValueOrNull($arrayData, 'payment_type'); if (array_key_exists('bank_account', $arrayData)) { $this->bankAccount = new BankAccount($arrayData['bank_account']); } $this->dateVatPrev = Utils::getDateTimeFrom($arrayData['date_vat_prev']); $this->description = Utils::getValueOrNull($arrayData, 'description'); $this->roundingType = Utils::getValueOrNull($arrayData, 'rounding_type'); if (array_key_exists('items', $arrayData)) { foreach ($arrayData['items'] as $itemData) { $this->items[] = new DocumentItem($itemData); } } $this->accounted = Utils::getValueOrNull($arrayData, 'accounted'); $this->deleted = Utils::getValueOrNull($arrayData, 'deleted'); }