altocompta/vendor/num-num/ubl-invoice/src/LegalMonetaryTotal.php

245 lines
6.3 KiB
PHP

<?php
namespace NumNum\UBL;
use Sabre\Xml\Writer;
use Sabre\Xml\XmlSerializable;
class LegalMonetaryTotal implements XmlSerializable
{
private $lineExtensionAmount = 0;
private $taxExclusiveAmount = 0;
private $taxInclusiveAmount = 0;
private $allowanceTotalAmount = 0;
private $chargeTotalAmount = 0;
private $prepaidAmount;
private $payableAmount = 0;
private $payableRoundingAmount;
/**
* @return float
*/
public function getLineExtensionAmount(): ?float
{
return $this->lineExtensionAmount;
}
/**
* @param float $lineExtensionAmount
* @return LegalMonetaryTotal
*/
public function setLineExtensionAmount(?float $lineExtensionAmount): LegalMonetaryTotal
{
$this->lineExtensionAmount = $lineExtensionAmount;
return $this;
}
/**
* @return float
*/
public function getTaxExclusiveAmount(): ?float
{
return $this->taxExclusiveAmount;
}
/**
* @param float $taxExclusiveAmount
* @return LegalMonetaryTotal
*/
public function setTaxExclusiveAmount(?float $taxExclusiveAmount): LegalMonetaryTotal
{
$this->taxExclusiveAmount = $taxExclusiveAmount;
return $this;
}
/**
* @return float
*/
public function getTaxInclusiveAmount(): ?float
{
return $this->taxInclusiveAmount;
}
/**
* @param float $taxInclusiveAmount
* @return LegalMonetaryTotal
*/
public function setTaxInclusiveAmount(?float $taxInclusiveAmount): LegalMonetaryTotal
{
$this->taxInclusiveAmount = $taxInclusiveAmount;
return $this;
}
/**
* @return float
*/
public function getAllowanceTotalAmount(): ?float
{
return $this->allowanceTotalAmount;
}
/**
* @param float $allowanceTotalAmount
* @return LegalMonetaryTotal
*/
public function setAllowanceTotalAmount(?float $allowanceTotalAmount): LegalMonetaryTotal
{
$this->allowanceTotalAmount = $allowanceTotalAmount;
return $this;
}
/**
* @return float
*/
public function getChargeTotalAmount(): ?float
{
return $this->chargeTotalAmount;
}
/**
* @param float $chargeTotalAmount
* @return LegalMonetaryTotal
*/
public function setChargeTotalAmount(?float $chargeTotalAmount): LegalMonetaryTotal
{
$this->chargeTotalAmount = $chargeTotalAmount;
return $this;
}
/**
* @return ?float
*/
public function getPrepaidAmount(): ?float
{
return $this->prepaidAmount;
}
/**
* @param ?float $prepaidAmount
* @return LegalMonetaryTotal
*/
public function setPrepaidAmount(?float $prepaidAmount): LegalMonetaryTotal
{
$this->prepaidAmount = $prepaidAmount;
return $this;
}
/**
* @return float
*/
public function getPayableAmount(): ?float
{
return $this->payableAmount;
}
/**
* @param float $payableAmount
* @return LegalMonetaryTotal
*/
public function setPayableAmount(?float $payableAmount): LegalMonetaryTotal
{
$this->payableAmount = $payableAmount;
return $this;
}
public function getPayableRoundingAmount(): ?float
{
return $this->payableRoundingAmount;
}
/**
* @param float|null $payableRoundingAmount
* @return LegalMonetaryTotal
*/
public function setPayableRoundingAmount(?float $payableRoundingAmount): LegalMonetaryTotal
{
$this->payableRoundingAmount = $payableRoundingAmount;
return $this;
}
/**
* The xmlSerialize method is called during xml writing.
*
* @param Writer $writer
* @return void
*/
public function xmlSerialize(Writer $writer): void
{
$writer->write([
[
'name' => Schema::CBC . 'LineExtensionAmount',
'value' => NumberFormatter::format($this->lineExtensionAmount, 2),
'attributes' => [
'currencyID' => Generator::$currencyID
]
],
[
'name' => Schema::CBC . 'TaxExclusiveAmount',
'value' => NumberFormatter::format($this->taxExclusiveAmount, 2),
'attributes' => [
'currencyID' => Generator::$currencyID
]
],
[
'name' => Schema::CBC . 'TaxInclusiveAmount',
'value' => NumberFormatter::format($this->taxInclusiveAmount, 2),
'attributes' => [
'currencyID' => Generator::$currencyID
]
],
[
'name' => Schema::CBC . 'AllowanceTotalAmount',
'value' => NumberFormatter::format($this->allowanceTotalAmount,2),
'attributes' => [
'currencyID' => Generator::$currencyID
]
],
[
'name' => Schema::CBC . 'ChargeTotalAmount',
'value' => NumberFormatter::format($this->chargeTotalAmount, 2),
'attributes' => [
'currencyID' => Generator::$currencyID
]
]
]);
if ($this->prepaidAmount !== null) {
$writer->write([
[
'name' => Schema::CBC . 'PrepaidAmount',
'value' => NumberFormatter::format($this->prepaidAmount, 2),
'attributes' => [
'currencyID' => Generator::$currencyID
]
]
]);
}
if ($this->payableRoundingAmount !== null) {
$writer->write([
[
'name' => Schema::CBC . 'PayableRoundingAmount',
'value' => NumberFormatter::format($this->payableRoundingAmount, 2),
'attributes' => [
'currencyID' => Generator::$currencyID
]
],
]);
}
$writer->write([
[
'name' => Schema::CBC . 'PayableAmount',
'value' => NumberFormatter::format($this->payableAmount, 2),
'attributes' => [
'currencyID' => Generator::$currencyID
]
],
]);
}
}