Skip to content

Commit

Permalink
Merge pull request #14 from mlevent/development
Browse files Browse the repository at this point in the history
Müstahsil makbuzu oluşturmadaki hatalar
  • Loading branch information
mlevent authored Jan 24, 2023
2 parents e350c0f + 32888bf commit c959fbc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 28 deletions.
34 changes: 9 additions & 25 deletions examples/createSelfEmployedReceipt.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,19 @@
//die();

$invoice = SelfEmployedReceiptModel::new(
tarih : '20/10/2022', // Opsiyonel @string (dd/mm/yyyy) @default=now
saat : '14:25:34', // Opsiyonel @string (hh/mm/ss) @default=now
paraBirimi : Currency::USD, // Opsiyonel @Currency @default=Currency::TRY
dovizKuru : 18.56, // Opsiyonel @float @default=0
vknTckn : '32669381008', // Zorunlu @string
aliciAdi : 'Mert', // Zorunlu @string
aliciSoyadi : 'Levent', // Zorunlu @string
aliciUnvan : '', // Opsiyonel @string
adres : '', // Opsiyonel @string
binaAdi : '', // Opsiyonel @string
binaNo : '', // Opsiyonel @string
kapiNo : '', // Opsiyonel @string
kasabaKoy : '', // Opsiyonel @string
mahalleSemtIlce: '', // Opsiyonel @string
sehir : '', // Opsiyonel @string
postaKodu : '', // Opsiyonel @string
ulke : 'Türkiye', // Zorunlu @string
vergiDairesi : '', // Opsiyonel @string
aciklama : '', // Opsiyonel @string
kdvTahakkukIcin: false, // Opsiyonel @boolean @default=false
vknTckn : '32669381008',
aliciAdi : 'Mert',
aliciSoyadi: 'Levent',
ulke : 'Türkiye',
);

$invoice->addItem(
SelfEmployedReceiptItemModel::new(
neIcinAlindigi : 'Dava Vekilliği', // Zorunlu @string
brutUcret : 100, // Zorunlu @float
kdvOrani : 18, // Zorunlu @int
gvStopajOrani : 20, // Opsiyonel @int
kdvTevkifatOrani: 40, // Opsiyonel @int
neIcinAlindigi : 'Dava Vekilliği',
brutUcret : 100,
kdvOrani : 18,
gvStopajOrani : 20,
kdvTevkifatOrani: 40,
)
);

Expand Down
2 changes: 1 addition & 1 deletion src/Models/AbstractModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function __constuct()

if (!$this->isImported() && $items = $this->getItems()) {
$this->clearItems()->addItem(...array_map(
fn ($item) => new InvoiceItemModel(...$item), $items
fn ($item) => new (substr(get_called_class(), 0, -5) . 'ItemModel')(...$item), $items
));
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/Models/ProducerReceiptItemModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ public function addTax(Tax $tax, int $rate, float $amount = 0): self
*/
public function prepare(ModelInterface $parent): self
{
return $this->exportTaxes(true);
$this->calculateTaxes();
return $this;
}

/**
Expand All @@ -89,7 +90,7 @@ public function getTotals(): array
*/
public function export(): array
{
return $this->keyMapper(array_merge($this->toArray(), $this->getTotals(), [
return $this->keyMapper(array_merge($this->toArray(), $this->getTotals(), $this->exportTaxes(true), [
'birim' => $this->birim->value,
]));
}
Expand Down

0 comments on commit c959fbc

Please sign in to comment.