1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Sprain\SwissQrBill\PaymentPart\Output\PhpWordOutput\Table; |
4
|
|
|
|
5
|
|
|
use Sprain\SwissQrBill\PaymentPart\Output\PhpWordOutput\PhpWordHelper; |
6
|
|
|
use Sprain\SwissQrBill\PaymentPart\Output\PhpWordOutput\Table\Receipt\AmountSection; |
7
|
|
|
use PhpOffice\PhpWord\Element\Table; |
8
|
|
|
use PhpOffice\PhpWord\Element\Cell; |
9
|
|
|
|
10
|
|
|
class Receipt |
11
|
|
|
{ |
12
|
|
|
private Table $table; |
13
|
|
|
private Cell $titleSection; |
14
|
|
|
private Cell $informationSection; |
15
|
|
|
private AmountSection $amountSection; |
16
|
|
|
private Cell $acceptancePointSection; |
17
|
|
|
|
18
|
|
|
public function __construct(Cell $cell) |
19
|
|
|
{ |
20
|
|
|
$this->table = $cell->addTable([ |
21
|
|
|
'layout' => \PhpOffice\PhpWord\Style\Table::LAYOUT_FIXED, |
22
|
|
|
'width' => PhpWordHelper::percentToPct(100), |
23
|
|
|
'unit' => 'pct', |
24
|
|
|
]); |
25
|
|
|
$this->titleSection = $this->table->addRow(PhpWordHelper::mmToTwip(Style::TITLE_SECTION_HEIGHT))->addCell(); |
26
|
|
|
$this->informationSection = $this->table->addRow(PhpWordHelper::mmToTwip(Style::RECEIPT_INFORMATION_SECTION_HEIGHT))->addCell(); |
27
|
|
|
$this->amountSection = new AmountSection( |
28
|
|
|
$this->table->addRow(PhpWordHelper::mmToTwip(Style::RECEIPT_AMOUNT_SECTION_HEIGHT))->addCell(), |
29
|
|
|
Style::RECEIPT_CURRENCY_WIDTH, |
30
|
|
|
Style::RECEIPT_AMOUNT_WIDTH, |
31
|
|
|
Style::RECEIPT_AMOUNT_SECTION_HEIGHT |
32
|
|
|
); |
33
|
|
|
$this->acceptancePointSection = $this->table->addRow(PhpWordHelper::mmToTwip(Style::RECEIPT_ACCEPTANCE_SECTION_HEIGHT))->addCell(); |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
public function getTitleSection() : Cell |
37
|
|
|
{ |
38
|
|
|
return $this->titleSection; |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
public function getInformationSection() : Cell |
42
|
|
|
{ |
43
|
|
|
return $this->informationSection; |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
public function getAmountSection() : AmountSection |
47
|
|
|
{ |
48
|
|
|
return $this->amountSection; |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
public function getAcceptancePointSection() : Cell |
52
|
|
|
{ |
53
|
|
|
return $this->acceptancePointSection; |
54
|
|
|
} |
55
|
|
|
} |
56
|
|
|
|