mirror of
https://github.com/Karaka-Management/oms-Billing.git
synced 2026-02-02 17:58:41 +00:00
l11n, unit/app and simplification fixes
This commit is contained in:
parent
46b950ba2e
commit
ec8b455bdd
|
|
@ -1,180 +1,303 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Mpdf\Mpdf;
|
||||
class MYPDF extends TCPDF
|
||||
{
|
||||
public string $fontName = '';
|
||||
public int $fontSize = 8;
|
||||
public int $sideMargin = 15;
|
||||
|
||||
/** @var \phpOMS\Views\View $this */
|
||||
/** @var \Modules\Billing\Models\Bill $bill */
|
||||
$bill = $this->getData('bill');
|
||||
//Page header
|
||||
public function Header() {
|
||||
if ($this->header_xobjid === false) {
|
||||
$this->header_xobjid = $this->startTemplate($this->w, 0);
|
||||
|
||||
/**
|
||||
* @var \Modules\Billing\Models\BillElement[] $elements
|
||||
*/
|
||||
$elements = $bill->getElements();
|
||||
// Set Logo
|
||||
$image_file = __DIR__ . '/logo.png';
|
||||
$this->Image($image_file, 15, 15, 15, 15, 'PNG', '', 'T', false, 300, '', false, false, 0, false, false, false);
|
||||
|
||||
$mpdf = new Mpdf([
|
||||
'mode' => 'utf-8',
|
||||
'format' => 'A4-L',
|
||||
'orientation' => 'L',
|
||||
'margin_left' => 20,
|
||||
'margin_right' => 15,
|
||||
'margin_top' => 48,
|
||||
'margin_bottom' => 25,
|
||||
'margin_header' => 10,
|
||||
'margin_footer' => 10,
|
||||
]);
|
||||
// Set Title
|
||||
$this->SetFont('helvetica', 'B', 20);
|
||||
$this->setX(15 + 15 + 3);
|
||||
$this->Cell(0, 14, $this->header_title, 0, false, 'L', 0, '', 0, false, 'T', 'M');
|
||||
|
||||
$mpdf->SetDisplayMode('fullpage');
|
||||
$mpdf->SetTitle($bill->getNumber());
|
||||
$mpdf->SetAuthor('Karaka');
|
||||
$this->SetFont('helvetica', '', 10);
|
||||
$this->setX(15 + 15 + 3);
|
||||
$this->Cell(0, 26, $this->header_string, 0, false, 'L', 0, '', 0, false, 'T', 'M');
|
||||
|
||||
$html = '
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
font-size: 10pt;
|
||||
$this->endTemplate();
|
||||
}
|
||||
|
||||
$x = 0;
|
||||
$dx = 0;
|
||||
|
||||
if (!$this->header_xobj_autoreset AND $this->booklet AND (($this->page % 2) == 0)) {
|
||||
// adjust margins for booklet mode
|
||||
$dx = ($this->original_lMargin - $this->original_rMargin);
|
||||
}
|
||||
|
||||
if ($this->rtl) {
|
||||
$x = $this->w + $dx;
|
||||
} else {
|
||||
$x = 0 + $dx;
|
||||
}
|
||||
|
||||
$this->printTemplate($this->header_xobjid, $x, 0, 0, 0, '', '', false);
|
||||
if ($this->header_xobj_autoreset) {
|
||||
// reset header xobject template at each page
|
||||
$this->header_xobjid = false;
|
||||
}
|
||||
}
|
||||
p { margin: 0pt; }
|
||||
table.items {
|
||||
border: 0.1mm solid #000000;
|
||||
}
|
||||
td { vertical-align: top; }
|
||||
.items td {
|
||||
border-left: 0.1mm solid #000000;
|
||||
border-right: 0.1mm solid #000000;
|
||||
}
|
||||
table thead td {
|
||||
background-color: #EEEEEE;
|
||||
text-align: center;
|
||||
border: 0.1mm solid #000000;
|
||||
font-variant: small-caps;
|
||||
}
|
||||
.items td.blanktotal {
|
||||
background-color: #EEEEEE;
|
||||
border: 0.1mm solid #000000;
|
||||
background-color: #FFFFFF;
|
||||
border: 0mm none #000000;
|
||||
border-top: 0.1mm solid #000000;
|
||||
border-right: 0.1mm solid #000000;
|
||||
}
|
||||
.items td.totals {
|
||||
text-align: right;
|
||||
border: 0.1mm solid #000000;
|
||||
}
|
||||
.items td.cost {
|
||||
text-align: "." center;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<!--mpdf
|
||||
<htmlpageheader name="myheader">
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td width="50%" style="color:#0000BB; ">
|
||||
<span style="font-weight: bold; font-size: 14pt;">Karaka</span><br />
|
||||
123 1313 Webfoot Street<br />
|
||||
Duckburg<br />
|
||||
</td>
|
||||
<td width="50%" style="text-align: right;">
|
||||
Invoice No.<br />
|
||||
<span style="font-weight: bold; font-size: 12pt;">' . $bill->getNumber() . '</span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</htmlpageheader>
|
||||
|
||||
<htmlpagefooter name="myfooter">
|
||||
<div style="border-top: 1px solid #000000; font-size: 9pt; text-align: center; padding-top: 3mm; ">
|
||||
Page {PAGENO} of {nb}
|
||||
</div>
|
||||
</htmlpagefooter>
|
||||
// Page footer
|
||||
public function Footer() {
|
||||
$this->SetY(-25);
|
||||
|
||||
<sethtmlpageheader name="myheader" value="on" show-this-page="1" />
|
||||
<sethtmlpagefooter name="myfooter" value="on" />
|
||||
mpdf-->
|
||||
$this->SetFont('helvetica', 'I', 7);
|
||||
$this->Cell($this->getPageWidth() - 22, 0, 'Page '.$this->getAliasNumPage().'/'.$this->getAliasNbPages(), 0, false, 'R', 0, '', 0, false, 'T', 'M');
|
||||
$this->Ln();
|
||||
$this->Ln();
|
||||
|
||||
<div style="text-align: right">Date: 13th November 2008</div>
|
||||
$this->SetFillColor(245, 245, 245);
|
||||
$this->SetX(0);
|
||||
$this->Cell($this->getPageWidth(), 25, '', 0, 0, 'L', true, '', 0, false, 'T', 'T');
|
||||
|
||||
<table width="100%" style="font-family: serif;" cellpadding="10">
|
||||
<tr>
|
||||
<td width="45%" style="border: 0.1mm solid #888888; ">
|
||||
<span style="font-size: 7pt; color: #555555; font-family: sans;">SOLD TO:</span><br /><br />
|
||||
345 Anotherstreet<br />
|
||||
Little Village<br />
|
||||
Their City<br />
|
||||
CB22 6SO
|
||||
</td>
|
||||
<td width="10%"> </td>
|
||||
<td width="45%" style="border: 0.1mm solid #888888;">
|
||||
<span style="font-size: 7pt; color: #555555; font-family: sans;">SHIP TO:</span><br /><br />
|
||||
345 Anotherstreet<br />
|
||||
Little Village<br />
|
||||
Their City<br />CB22 6SO</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br />
|
||||
$this->SetFont('helvetica', '', 7);
|
||||
$this->SetXY(15 + 10, -15, true);
|
||||
$this->MultiCell(30, 0, "Jingga e.K.\nGartenstr. 26\n61206 Woellstadt", 0, 'L', false, 1, null, null, true, 0, false, true, 0, 'B');
|
||||
|
||||
<table class="items" width="100%" style="font-size: 9pt; border-collapse: collapse; " cellpadding="8">
|
||||
<thead>
|
||||
<tr>
|
||||
<td width="15%">Ref. No.</td>
|
||||
<td width="10%">Quantity</td>
|
||||
<td width="45%">Description</td>
|
||||
<td width="15%">Unit Price</td>
|
||||
<td width="15%">Amount</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>';
|
||||
$this->SetXY(25 + 15 + 20, -15, true);
|
||||
$this->MultiCell(40, 0, "Geschäftsführer: Dennis Eichhorn\nFinanzamt: HRB ???\nUSt Id: DE ??????????", 0, 'L', false, 1, null, null, true, 0, false, true, 0, 'B');
|
||||
|
||||
foreach ($elements as $element) {
|
||||
$html .= '
|
||||
<tr>
|
||||
<td align="center">' . $element->itemNumber . '</td>
|
||||
<td align="center">' . $element->quantity . '</td>
|
||||
<td>' . $element->itemName . '</td>
|
||||
<td class="cost">' . $element->singleSalesPriceNet->getCurrency(null) . '</td>
|
||||
<td class="cost">' . $element->totalSalesPriceNet->getCurrency(null) . '</td>
|
||||
</tr>';
|
||||
$this->SetXY(25 + 45 + 15 + 30, -15, true);
|
||||
$this->MultiCell(35, 0, "Volksbank Mittelhessen\nBIC: ??????????\nIBAN: ???????????", 0, 'L', false, 1, null, null, true, 0, false, true, 0, 'B');
|
||||
|
||||
$this->SetXY(25 + 45 + 35 + 15 + 40, -15, true);
|
||||
$this->MultiCell(35, 0, "www.jingga.app\ninfo@jingga.app\n+49 0152 ???????", 0, 'L', false, 1, null, null, true, 0, false, true, 0, 'B');
|
||||
}
|
||||
}
|
||||
|
||||
$html .= '
|
||||
<tr>
|
||||
<td class="blanktotal" colspan="3" rowspan="6"></td>
|
||||
<td class="totals">Subtotal:</td>
|
||||
<td class="totals cost">' . $bill->netSales->getCurrency(null) . '</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="totals">Tax:</td>
|
||||
<td class="totals cost">£18.25</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="totals">Shipping:</td>
|
||||
<td class="totals cost">£42.56</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="totals"><strong>TOTAL:</strong></td>
|
||||
<td class="totals cost"><strong>' . $bill->grossSales->getCurrency(null) . '</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="totals">Deposit:</td>
|
||||
<td class="totals cost">£100.00</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="totals"><strong>Balance due:</strong></td>
|
||||
<td class="totals cost"><strong>£1782.56</strong></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
$pdf = new MYPDF('P', 'mm', 'A4', true, 'UTF-8', false);
|
||||
|
||||
<div style="text-align: center; font-style: italic;">Payment terms: payment due in 30 days</div>
|
||||
</body>
|
||||
</html>
|
||||
';
|
||||
// set document information
|
||||
$pdf->SetCreator("Jingga");
|
||||
$pdf->SetAuthor('Jingga');
|
||||
$pdf->SetTitle('Invoice');
|
||||
$pdf->SetSubject('Sub title');
|
||||
$pdf->SetKeywords('Invoice, 2022');
|
||||
|
||||
$mpdf->AddPage();
|
||||
$mpdf->WriteHTML($html);
|
||||
// set default header data
|
||||
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, 'Jingga', 'Business solutions made simple.');
|
||||
|
||||
$mpdf->Output($this->getData('path'), \Mpdf\Output\Destination::FILE);
|
||||
// set header and footer fonts
|
||||
$pdf->SetHeaderFont([PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN]);
|
||||
$pdf->SetFooterFont([PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA]);
|
||||
|
||||
// set default monospaced font
|
||||
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
|
||||
|
||||
// set margins
|
||||
$pdf->SetMargins(15, 30, 15);
|
||||
|
||||
// set auto page breaks
|
||||
$pdf->SetAutoPageBreak(true, 25);
|
||||
|
||||
// set image scale factor
|
||||
$pdf->SetImageScale(PDF_IMAGE_SCALE_RATIO);
|
||||
|
||||
// add a page
|
||||
$pdf->AddPage();
|
||||
|
||||
$topPos = $pdf->getY();
|
||||
|
||||
// Address
|
||||
$pdf->SetY(55); // @todo: depending on amount of lines
|
||||
$pdf->SetFont('helvetica', '', 8);
|
||||
|
||||
$lineHeight = $pdf->getY();
|
||||
$pdf->Write(0, "Dennis Eichhorn\nGartenstr. 26\n61206 Woellstadt", '', 0, 'L', false, 0, false, false, 0);
|
||||
$lineHeight = ($lineHeight - $pdf->getY()) / 3;
|
||||
|
||||
// Document head
|
||||
$pdf->SetFont('helvetica', 'B', 20);
|
||||
$title = 'INVOICE';
|
||||
$titleWidth = $pdf->GetStringWidth($title, 'helvetica', 'B', 20);
|
||||
|
||||
$pdf->SetXY(
|
||||
$rightPos = ($pdf->getPageWidth() - $titleWidth - ($titleWidth < 55 ? 55 : 35) + 15),
|
||||
$topPos + 50 + $lineHeight * 3 - 38,
|
||||
true
|
||||
);
|
||||
|
||||
$pdf->SetTextColor(255, 255, 255);
|
||||
$pdf->SetFillColor(255, 162, 7);
|
||||
$pdf->Cell($pdf->getPageWidth() - $rightPos - 15, 0, $title, 0, 0, 'L', true);
|
||||
|
||||
$pdf->SetFont('helvetica', '', 8);
|
||||
$pdf->SetTextColor(255, 162, 7);
|
||||
|
||||
$pdf->SetXY($rightPos, $tempY = $pdf->getY() + 10, true);
|
||||
$pdf->MultiCell(23, 30, "Invoice No\nInvoice Date\nService Date\nCustomer No\nPO\nDue Date", 0, 'L');
|
||||
|
||||
$pdf->SetFont('helvetica', '', 8);
|
||||
$pdf->SetTextColor(0, 0, 0);
|
||||
|
||||
$pdf->SetXY($rightPos + 23 + 2, $tempY, true);
|
||||
$pdf->MultiCell(25, 30, "2022-123456\nYYYY-MM-DD\nYYYY-MM-DD\n123-456-789\n2022-123456\nYYYY-MM-DD", 0, 'L');
|
||||
$pdf->Ln();
|
||||
|
||||
$pdf->SetY($pdf->GetY() - 30);
|
||||
$pdf->writeHTMLCell(
|
||||
$pdf->getPageWidth() - 15 * 2, 0, null, null,
|
||||
"<strong>Lorem ipsum dolor sit amet,</strong><br \><br \>Consectetur adipiscing elit. Vivamus ac massa sit amet eros posuere accumsan feugiat vel est. Maecenas ultricies enim eu eros rhoncus, volutpat cursus enim imperdiet. Aliquam et odio ipsum. Quisque dapibus scelerisque tempor. Phasellus purus lorem, venenatis eget pretium ac, convallis et ante. Aenean pulvinar justo consectetur mi tincidunt venenatis. Suspendisse ultricies enim id nulla facilisis lacinia. <br /><br />Nam congue nunc nunc, eu pellentesque eros aliquam ac. Nunc placerat elementum turpis, quis facilisis diam volutpat at. Suspendisse enim leo, convallis nec ornare eu, auctor nec purus. Nunc neque metus, feugiat quis justo nec, mollis dignissim risus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In at ornare sem. Cras placerat, sapien sed ornare lacinia, mauris nulla volutpat nisl, eget dapibus nisl ipsum non est. Suspendisse ut nisl a ipsum rhoncus sodales.",
|
||||
0, 0, false, true, 'J'
|
||||
);
|
||||
$pdf->Ln();
|
||||
|
||||
$pdf->SetY($pdf->GetY() + 5);
|
||||
|
||||
$header = ['Item', 'Quantity', 'Rate', 'Total'];
|
||||
$data = [
|
||||
['ASDF', 2.0, 199.90, 399.80],
|
||||
["123-456-789<br><strong>This is a item name</strong><br><span style=\"color: #444;\">This is the item description in more detail for the customer so he knows what this content actually contains.</span>", 2.0, 199.90, 399.80],
|
||||
["123-456-789<br><strong>This is a item name</strong><br><span style=\"color: #444;\">This is the item description in more detail for the customer.</span>", 2.0, "199.90\n-10 %", "150.399.80\n-15.039"],
|
||||
["123-456-789<br><strong>This is a item name</strong><br><span style=\"color: #444;\">This is the item description in more detail for the customer so he knows what this content actually contains.</span>", 2.0, 199.90, 399.80],
|
||||
["123-456-789<br><strong>This is a item name</strong><br><span style=\"color: #444;\">This is the item description in more detail for the customer so he knows what this content actually contains. Here we are testing how it looks like if a very long text is posted in the description without any additional line breaks. It should auto-break!</span>", 2.0, 199.90, 399.80],
|
||||
["123-456-789<br><strong>This is a item name</strong><br><span style=\"color: #444;\">This is the item description in more detail for the customer so he knows what this content actually contains.</span>", 2.0, 199.90, 399.80],
|
||||
["123-456-789<br><strong>This is a item name</strong><br><span style=\"color: #444;\">This is the item description in more detail for the customer so he knows what this content actually contains.</span>", 2.0, 199.90, 399.80],
|
||||
["123-456-789<br><strong>This is a item name</strong><br><span style=\"color: #444;\">This is the item description in more detail for the customer so he knows what this content actually contains.</span>", 2.0, 199.90, 399.80],
|
||||
["123-456-789<br><strong>This is a item name</strong><br><span style=\"color: #444;\">This is the item description in more detail for the customer so he knows what this content actually contains.</span>", 2.0, 199.90, 399.80],
|
||||
["123-456-789<br><strong>This is a item name</strong><br><span style=\"color: #444;\">This is the item description in more detail for the customer so he knows what this content actually contains.</span>", 2.0, 199.90, 399.80],
|
||||
["123-456-789<br><strong>This is a item name</strong><br><span style=\"color: #444;\">This is the item description in more detail for the customer so he knows what this content actually contains.</span>", 2.0, 199.90, 399.80],
|
||||
["123-456-789<br><strong>This is a item name</strong><br><span style=\"color: #444;\">This is the item description in more detail for the customer so he knows what this content actually contains.</span>", 2.0, 199.90, 399.80],
|
||||
["123-456-789<br><strong>This is a item name</strong><br><span style=\"color: #444;\">This is the item description in more detail for the customer so he knows what this content actually contains.</span>", 2.0, 199.90, 399.80],
|
||||
["123-456-789<br><strong>This is a item name</strong><br><span style=\"color: #444;\">This is the item description in more detail for the customer so he knows what this content actually contains.</span>", 2.0, 199.90, 399.80],
|
||||
["123-456-789<br><strong>This is a item name</strong><br><span style=\"color: #444;\">This is the item description in more detail for the customer so he knows what this content actually contains.</span>", 2.0, 199.90, 399.80],
|
||||
['ASDF', 2.0, 199.90, 399.80],
|
||||
];
|
||||
|
||||
// Header
|
||||
$w = array($pdf->getPageWidth() - 20 - 20 - 20 - 2*15, 20, 20, 20);
|
||||
$num_headers = count($header);
|
||||
|
||||
$pdf->setCellPadding(1, 1, 1, 1);
|
||||
|
||||
$first = true;
|
||||
|
||||
// Data
|
||||
$fill = false;
|
||||
foreach($data as $row) {
|
||||
if ($row === null || $first || $pdf->getY() > $pdf->getPageHeight() - 40) {
|
||||
$pdf->SetFillColor(255, 162, 7);
|
||||
$pdf->SetTextColor(255);
|
||||
$pdf->SetDrawColor(255, 162, 7);
|
||||
//$pdf->SetLineWidth(0.3);
|
||||
$pdf->SetFont('helvetica', 'B', 8);
|
||||
|
||||
if (!$first || $row === null) {
|
||||
$pdf->AddPage();
|
||||
$pdf->Ln();
|
||||
}
|
||||
|
||||
for($i = 0; $i < $num_headers; ++$i) {
|
||||
$pdf->Cell($w[$i], 7, $header[$i], 1, 0, 'L', true);
|
||||
}
|
||||
|
||||
$pdf->Ln();
|
||||
$pdf->SetFillColor(245, 245, 245);
|
||||
$pdf->SetTextColor(0);
|
||||
$pdf->SetFont('helvetica', '', 8);
|
||||
|
||||
$first = false;
|
||||
}
|
||||
|
||||
$tempY = $pdf->getY();
|
||||
$pdf->writeHTMLCell($w[0], 10, null, null, $row[0], 0, 2, $fill);
|
||||
$height = $pdf->getY() - $tempY;
|
||||
|
||||
/*
|
||||
$pdf->writeHTMLCell($w[1], $height, 15 + $w[0], $tempY, $row[1], 0, 0, $fill);
|
||||
$pdf->writeHTMLCell($w[2], $height, 15 + $w[0] + $w[1], $tempY, $row[2], 0, 0, $fill);
|
||||
$pdf->writeHTMLCell($w[3], $height, 15 + $w[0] + $w[1] + $w[2], $tempY, $row[3], 0, 1, $fill);
|
||||
*/
|
||||
|
||||
$pdf->MultiCell($w[1], $height, $row[1], 0, 'L', $fill, 0, 15 + $w[0], $tempY, true, 0, false, true, 0, 'M', true);
|
||||
$pdf->MultiCell($w[2], $height, $row[2], 0, 'L', $fill, 0, 15 + $w[0] + $w[1], $tempY, true, 0, false, true, 0, 'M', true);
|
||||
$pdf->MultiCell($w[3], $height, $row[3], 0, 'L', $fill, 1, 15 + $w[0] + $w[1] + $w[2], $tempY, true, 0, false, true, 0, 'M', true);
|
||||
|
||||
$fill = !$fill;
|
||||
}
|
||||
|
||||
$pdf->Cell(\array_sum($w), 0, '', 'T');
|
||||
$pdf->Ln();
|
||||
|
||||
if ($pdf->getY() > $pdf->getPageHeight() - 40) {
|
||||
$pdf->AddPage();
|
||||
}
|
||||
|
||||
$pdf->SetFillColor(240, 240, 240);
|
||||
$pdf->SetTextColor(0);
|
||||
$pdf->SetDrawColor(240, 240, 240);
|
||||
$pdf->SetFont('helvetica', 'B', 8);
|
||||
|
||||
$tempY = $pdf->GetY();
|
||||
|
||||
$pdf->SetX($w[0] + $w[1] + 15);
|
||||
$pdf->Cell($w[2], 7, 'Subtotal', 0, 0, 'L', false);
|
||||
$pdf->Cell($w[3], 7, '40.000', 0, 0, 'L', false);
|
||||
$pdf->Ln();
|
||||
$pdf->SetX($w[0] + $w[1] + 15);
|
||||
$pdf->Cell($w[2], 7, 'Taxes (0%)', 0, 0, 'L', false);
|
||||
$pdf->Cell($w[3], 7, '40.000', 0, 0, 'L', false);
|
||||
$pdf->Ln();
|
||||
$pdf->SetX($w[0] + $w[1] + 15);
|
||||
$pdf->Cell($w[2], 7, 'Taxes (16%)', 0, 0, 'L', false);
|
||||
$pdf->Cell($w[3], 7, '40.000', 0, 0, 'L', false);
|
||||
$pdf->Ln();
|
||||
$pdf->SetX($w[0] + $w[1] + 15);
|
||||
$pdf->Cell($w[2], 7, 'Taxes (19%)', 0, 0, 'L', false);
|
||||
$pdf->Cell($w[3], 7, '40.000', 0, 0, 'L', false);
|
||||
$pdf->Ln();
|
||||
|
||||
$pdf->SetFillColor(255, 162, 7);
|
||||
$pdf->SetTextColor(255);
|
||||
$pdf->SetDrawColor(255, 162, 7);
|
||||
$pdf->SetFont('helvetica', 'B', 8);
|
||||
|
||||
$pdf->SetX($w[0] + $w[1] + 15);
|
||||
$pdf->Cell($w[2], 7, 'TOTAL', 1, 0, 'L', true);
|
||||
$pdf->Cell($w[3], 7, '40.000', 1, 0, 'L', true);
|
||||
$pdf->Ln();
|
||||
|
||||
$tempY2 = $pdf->getY();
|
||||
|
||||
$pdf->SetTextColor(0);
|
||||
$pdf->SetFont('helvetica', 'B', 8);
|
||||
$pdf->SetY($tempY);
|
||||
$pdf->Write(0, 'Payment Terms: ', '', 0, 'L', false, 0, false, false, 0);
|
||||
|
||||
$pdf->SetFont('helvetica', '', 8);
|
||||
$pdf->Write(0, 'Payment within 30 business days', '', 0, 'L', false, 0, false, false, 0);
|
||||
$pdf->Ln();
|
||||
|
||||
$pdf->SetFont('helvetica', 'B', 8);
|
||||
$pdf->Write(0, 'Terms: ', '', 0, 'L', false, 0, false, false, 0);
|
||||
|
||||
$pdf->SetFont('helvetica', '', 8);
|
||||
$pdf->Write(0, 'https://jingga.app/terms', '', 0, 'L', false, 0, false, false, 0);
|
||||
$pdf->Ln();
|
||||
|
||||
$pdf->SetY($tempY2);
|
||||
$pdf->Ln();
|
||||
|
||||
// $pdf->SetY($pdf->GetY() - 30);
|
||||
$pdf->writeHTMLCell(
|
||||
$pdf->getPageWidth() - 15 * 2, 0, null, null,
|
||||
"Consectetur adipiscing elit. Vivamus ac massa sit amet eros posuere accumsan feugiat vel est. Maecenas ultricies enim eu eros rhoncus, volutpat cursus enim imperdiet. Aliquam et odio ipsum. Quisque dapibus scelerisque tempor. Phasellus purus lorem, venenatis eget pretium ac, convallis et ante. Aenean pulvinar justo consectetur mi tincidunt venenatis. Suspendisse ultricies enim id nulla facilisis lacinia. Nam congue nunc nunc, eu pellentesque eros aliquam ac.<br /><br />Nunc placerat elementum turpis, quis facilisis diam volutpat at. Suspendisse enim leo, convallis nec ornare eu, auctor nec purus. Nunc neque metus, feugiat quis justo nec, mollis dignissim risus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In at ornare sem. Cras placerat, sapien sed ornare lacinia, mauris nulla volutpat nisl, eget dapibus nisl ipsum non est. Suspendisse ut nisl a ipsum rhoncus sodales.",
|
||||
0, 0, false, true, 'J'
|
||||
);
|
||||
$pdf->Ln();
|
||||
|
||||
//Close and output PDF document
|
||||
$pdf->Output('example_048.pdf', 'I');
|
||||
|
|
@ -9,9 +9,14 @@
|
|||
"primary": true,
|
||||
"autoincrement": true
|
||||
},
|
||||
"billing_type_name": {
|
||||
"name": "billing_type_name",
|
||||
"type": "VARCHAR(50)",
|
||||
"null": false
|
||||
},
|
||||
"billing_type_number_format": {
|
||||
"name": "billing_type_number_format",
|
||||
"type": "VARCHAR(254)",
|
||||
"type": "VARCHAR(255)",
|
||||
"null": false
|
||||
},
|
||||
"billing_type_template": {
|
||||
|
|
@ -608,6 +613,7 @@
|
|||
}
|
||||
},
|
||||
"billing_bill_subscription": {
|
||||
"description": "https://learn.microsoft.com/en-us/graph/outlook-schedule-recurring-events",
|
||||
"name": "billing_bill_subscription",
|
||||
"fields": {
|
||||
"billing_bill_subscription_id": {
|
||||
|
|
@ -678,11 +684,6 @@
|
|||
"name": "billing_bill_subscription_pattern_month",
|
||||
"type": "TINYINT(1)",
|
||||
"null": false
|
||||
},
|
||||
"billing_bill_subscription_pattern_numberofoccurrences": {
|
||||
"name": "billing_bill_subscription_pattern_numberofoccurrences",
|
||||
"type": "TINYINT(1)",
|
||||
"null": false
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
202
Admin/Install/types.json
Normal file
202
Admin/Install/types.json
Normal file
|
|
@ -0,0 +1,202 @@
|
|||
[
|
||||
{
|
||||
"name": "sales_offer",
|
||||
"numberFormat": "{y}-{id}",
|
||||
"transferType": 1,
|
||||
"transferStock": false,
|
||||
"l11n": {
|
||||
"de": "Offer",
|
||||
"en": "Angebot"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "sales_order_confirmation",
|
||||
"numberFormat": "{y}-{id}",
|
||||
"transferType": 1,
|
||||
"transferStock": false,
|
||||
"l11n": {
|
||||
"de": "Order Confirmation",
|
||||
"en": "Auftragsbestaetigung"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "sales_delivery_note",
|
||||
"numberFormat": "{y}-{id}",
|
||||
"transferType": 1,
|
||||
"transferStock": true,
|
||||
"l11n": {
|
||||
"de": "Delivery Note",
|
||||
"en": "Lieferschein"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "sales_invoice",
|
||||
"numberFormat": "{y}-{id}",
|
||||
"transferType": 1,
|
||||
"transferStock": false,
|
||||
"l11n": {
|
||||
"de": "Invoice",
|
||||
"en": "Rechnung"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "sales_proforma_invoice",
|
||||
"numberFormat": "{y}-{id}",
|
||||
"transferType": 1,
|
||||
"transferStock": false,
|
||||
"l11n": {
|
||||
"de": "Proforma Invoice",
|
||||
"en": "Proforma Rechnung"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "sales_credit_note",
|
||||
"numberFormat": "{y}-{id}",
|
||||
"transferType": 1,
|
||||
"transferStock": false,
|
||||
"l11n": {
|
||||
"de": "Credit Note",
|
||||
"en": "Rechnungskorrektur"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "sales_reverse_invoice",
|
||||
"numberFormat": "{y}-{id}",
|
||||
"transferType": 1,
|
||||
"transferStock": false,
|
||||
"l11n": {
|
||||
"de": "Reverse Invoice",
|
||||
"en": "Gutschrift"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "purchase_offer",
|
||||
"numberFormat": "{y}-{id}",
|
||||
"transferType": 2,
|
||||
"transferStock": false,
|
||||
"l11n": {
|
||||
"de": "Offer",
|
||||
"en": "Angebot"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "purchase_order_confirmation",
|
||||
"numberFormat": "{y}-{id}",
|
||||
"transferType": 2,
|
||||
"transferStock": false,
|
||||
"l11n": {
|
||||
"de": "Order Confirmation",
|
||||
"en": "Auftragsbestaetigung"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "purchase_delivery_note",
|
||||
"numberFormat": "{y}-{id}",
|
||||
"transferType": 2,
|
||||
"transferStock": true,
|
||||
"l11n": {
|
||||
"de": "Delivery Note",
|
||||
"en": "Lieferschein"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "purchase_invoice",
|
||||
"numberFormat": "{y}-{id}",
|
||||
"transferType": 2,
|
||||
"transferStock": false,
|
||||
"l11n": {
|
||||
"de": "Invoice",
|
||||
"en": "Rechnung"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "purchase_proforma_invoice",
|
||||
"numberFormat": "{y}-{id}",
|
||||
"transferType": 2,
|
||||
"transferStock": false,
|
||||
"l11n": {
|
||||
"de": "Proforma Invoice",
|
||||
"en": "Proforma Rechnung"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "purchase_credit_note",
|
||||
"numberFormat": "{y}-{id}",
|
||||
"transferType": 2,
|
||||
"transferStock": false,
|
||||
"l11n": {
|
||||
"de": "Credit Note",
|
||||
"en": "Rechnungskorrektur"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "purchase_reverse_invoice",
|
||||
"numberFormat": "{y}-{id}",
|
||||
"transferType": 2,
|
||||
"transferStock": false,
|
||||
"l11n": {
|
||||
"de": "Reverse Invoice",
|
||||
"en": "Gutschrift"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "stock_movement",
|
||||
"numberFormat": "{y}-{id}",
|
||||
"transferType": 4,
|
||||
"transferStock": false,
|
||||
"l11n": {
|
||||
"de": "Stock Movement",
|
||||
"en": "Lagerumbuchung"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "stock_scrapping",
|
||||
"numberFormat": "{y}-{id}",
|
||||
"transferType": 4,
|
||||
"transferStock": false,
|
||||
"l11n": {
|
||||
"de": "Scrapping",
|
||||
"en": "Verschrottung"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "sales_subscritpion",
|
||||
"numberFormat": "{y}-{id}",
|
||||
"transferType": 1,
|
||||
"transferStock": false,
|
||||
"l11n": {
|
||||
"de": "Subscription",
|
||||
"en": "Abonnement"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "sales_template",
|
||||
"numberFormat": "{y}-{id}",
|
||||
"transferType": 1,
|
||||
"transferStock": false,
|
||||
"l11n": {
|
||||
"de": "Template",
|
||||
"en": "Vorlage"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "purchase_subscritpion",
|
||||
"numberFormat": "{y}-{id}",
|
||||
"transferType": 1,
|
||||
"transferStock": false,
|
||||
"l11n": {
|
||||
"de": "Subscription",
|
||||
"en": "Abonnement"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "purchase_template",
|
||||
"numberFormat": "{y}-{id}",
|
||||
"transferType": 1,
|
||||
"transferStock": false,
|
||||
"l11n": {
|
||||
"de": "Template",
|
||||
"en": "Vorlage"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
@ -15,16 +15,15 @@ declare(strict_types=1);
|
|||
namespace Modules\Billing\Admin;
|
||||
|
||||
use Modules\Billing\Models\BillTransferType;
|
||||
use Modules\Billing\Models\BillType;
|
||||
use Modules\Billing\Models\BillTypeL11n;
|
||||
use Modules\Billing\Models\BillTypeL11nMapper;
|
||||
use Modules\Billing\Models\BillTypeMapper;
|
||||
use Modules\Media\Models\NullCollection;
|
||||
use phpOMS\Application\ApplicationAbstract;
|
||||
use phpOMS\Config\SettingsInterface;
|
||||
use phpOMS\Localization\ISO639x1Enum;
|
||||
use phpOMS\Module\InstallerAbstract;
|
||||
use phpOMS\Module\ModuleInfo;
|
||||
use phpOMS\Message\Http\HttpRequest;
|
||||
use phpOMS\Message\Http\HttpResponse;
|
||||
use phpOMS\Uri\HttpUri;
|
||||
|
||||
/**
|
||||
* Installer class.
|
||||
|
|
@ -57,206 +56,82 @@ final class Installer extends InstallerAbstract
|
|||
/** @var int $defaultTemplate */
|
||||
$defaultTemplate = (int) \reset($media['upload'][0]);
|
||||
|
||||
self::createOutgoingBillTypes($defaultTemplate);
|
||||
self::createIncomingBillTypes($defaultTemplate);
|
||||
self::createTransferBillTypes($defaultTemplate);
|
||||
self::createTemplateBillTypes($defaultTemplate);
|
||||
/* Bill types */
|
||||
$fileContent = \file_get_contents(__DIR__ . '/Install/types.json');
|
||||
if ($fileContent === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
$types = \json_decode($fileContent, true);
|
||||
self::createBillTypes($app, $types, $defaultTemplate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Install default outgoing bill types
|
||||
* Install default bill types
|
||||
*
|
||||
* @return BillType[]
|
||||
* @param ApplicationAbstract $app Application
|
||||
* @param array $types Bill types
|
||||
* @param int $template Default template
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private static function createOutgoingBillTypes(int $template) : array
|
||||
private static function createBillTypes(ApplicationAbstract $app, array $types, int $template) : array
|
||||
{
|
||||
$billType = [];
|
||||
$billTypes = [];
|
||||
|
||||
/** @var \Modules\Billing\Controller\ApiController $module */
|
||||
$module = $app->moduleManager->getModuleInstance('Billing');
|
||||
|
||||
// @todo: allow multiple alternative bill templates
|
||||
// @todo: implement ordering of templates
|
||||
|
||||
$billType['offer'] = new BillType('Offer');
|
||||
$billType['offer']->numberFormat = '{y}-{id}';
|
||||
$billType['offer']->template = new NullCollection($template);
|
||||
$billType['offer']->transferType = BillTransferType::SALES;
|
||||
$billType['offer']->transferStock = false;
|
||||
BillTypeMapper::create()->execute($billType['offer']);
|
||||
BillTypeL11nMapper::create()->execute(new BillTypeL11n($billType['offer']->getId(), 'Angebot', ISO639x1Enum::_DE));
|
||||
foreach ($types as $type) {
|
||||
$response = new HttpResponse();
|
||||
$request = new HttpRequest(new HttpUri(''));
|
||||
|
||||
$billType['order_confirmation'] = new BillType('Order Confirmation');
|
||||
$billType['order_confirmation']->numberFormat = '{y}-{id}';
|
||||
$billType['order_confirmation']->template = new NullCollection($template);
|
||||
$billType['order_confirmation']->transferType = BillTransferType::SALES;
|
||||
$billType['order_confirmation']->transferStock = false;
|
||||
BillTypeMapper::create()->execute($billType['order_confirmation']);
|
||||
BillTypeL11nMapper::create()->execute(new BillTypeL11n($billType['order_confirmation']->getId(), 'Auftragsbestaetigung', ISO639x1Enum::_DE));
|
||||
$request->header->account = 1;
|
||||
$request->setData('name', $type['name'] ?? '');
|
||||
$request->setData('title', \reset($type['l11n']));
|
||||
$request->setData('language', \array_keys($type['l11n'])[0] ?? 'en');
|
||||
$request->setData('number_format', $type['numberFormat'] ?? '{id}');
|
||||
$request->setData('transfer_stock', $type['transferStock'] ?? false);
|
||||
$request->setData('transfer_type', $type['transferType'] ?? BillTransferType::SALES);
|
||||
$request->setData('template', $template);
|
||||
|
||||
$billType['delivery_note'] = new BillType('Delivery Note');
|
||||
$billType['delivery_note']->numberFormat = '{y}-{id}';
|
||||
$billType['delivery_note']->template = new NullCollection($template);
|
||||
$billType['delivery_note']->transferType = BillTransferType::SALES;
|
||||
$billType['delivery_note']->transferStock = true;
|
||||
BillTypeMapper::create()->execute($billType['delivery_note']);
|
||||
BillTypeL11nMapper::create()->execute(new BillTypeL11n($billType['delivery_note']->getId(), 'Lieferschein', ISO639x1Enum::_DE));
|
||||
$module->apiBillTypeCreate($request, $response);
|
||||
|
||||
$billType['invoice'] = new BillType('Invoice');
|
||||
$billType['invoice']->numberFormat = '{y}-{id}';
|
||||
$billType['invoice']->template = new NullCollection($template);
|
||||
$billType['invoice']->transferType = BillTransferType::SALES;
|
||||
$billType['invoice']->transferStock = false;
|
||||
BillTypeMapper::create()->execute($billType['invoice']);
|
||||
BillTypeL11nMapper::create()->execute(new BillTypeL11n($billType['invoice']->getId(), 'Rechnung', ISO639x1Enum::_DE));
|
||||
$responseData = $response->get('');
|
||||
if (!\is_array($responseData)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$billType['proforma_invoice'] = new BillType('Proforma Invoice');
|
||||
$billType['proforma_invoice']->numberFormat = '{y}-{id}';
|
||||
$billType['proforma_invoice']->template = new NullCollection($template);
|
||||
$billType['proforma_invoice']->transferType = BillTransferType::SALES;
|
||||
$billType['proforma_invoice']->transferStock = false;
|
||||
BillTypeMapper::create()->execute($billType['proforma_invoice']);
|
||||
BillTypeL11nMapper::create()->execute(new BillTypeL11n($billType['proforma_invoice']->getId(), 'Proforma Rechnung', ISO639x1Enum::_DE));
|
||||
$billType = !\is_array($responseData['response'])
|
||||
? $responseData['response']->toArray()
|
||||
: $responseData['response'];
|
||||
|
||||
$billType['credit_note'] = new BillType('Credit Note');
|
||||
$billType['credit_note']->numberFormat = '{y}-{id}';
|
||||
$billType['credit_note']->template = new NullCollection($template);
|
||||
$billType['credit_note']->transferType = BillTransferType::SALES;
|
||||
$billType['credit_note']->transferStock = false;
|
||||
BillTypeMapper::create()->execute($billType['credit_note']);
|
||||
BillTypeL11nMapper::create()->execute(new BillTypeL11n($billType['credit_note']->getId(), 'Rechnungskorrektur', ISO639x1Enum::_DE));
|
||||
$billTypes[] = $billType;
|
||||
|
||||
$billType['reverse_invoice'] = new BillType('Credit Note');
|
||||
$billType['reverse_invoice']->numberFormat = '{y}-{id}';
|
||||
$billType['reverse_invoice']->template = new NullCollection($template);
|
||||
$billType['reverse_invoice']->transferType = BillTransferType::SALES;
|
||||
$billType['reverse_invoice']->transferStock = false;
|
||||
BillTypeMapper::create()->execute($billType['reverse_invoice']);
|
||||
BillTypeL11nMapper::create()->execute(new BillTypeL11n($billType['reverse_invoice']->getId(), 'Gutschrift', ISO639x1Enum::_DE));
|
||||
$isFirst = true;
|
||||
foreach ($type['l11n'] as $language => $l11n) {
|
||||
if ($isFirst) {
|
||||
$isFirst = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
return $billType;
|
||||
}
|
||||
$response = new HttpResponse();
|
||||
$request = new HttpRequest(new HttpUri(''));
|
||||
|
||||
/**
|
||||
* Install default incoming bill types
|
||||
*
|
||||
* @return BillType[]
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private static function createIncomingBillTypes(int $template) : array
|
||||
{
|
||||
$billType = [];
|
||||
$request->header->account = 1;
|
||||
$request->setData('title', $l11n);
|
||||
$request->setData('language', $language);
|
||||
$request->setData('type', $billType['id']);
|
||||
|
||||
$billType['offer'] = new BillType('Offer');
|
||||
$billType['offer']->numberFormat = '{y}-{id}';
|
||||
$billType['offer']->template = new NullCollection($template);
|
||||
$billType['offer']->transferType = BillTransferType::PURCHASE;
|
||||
$billType['offer']->transferStock = false;
|
||||
BillTypeMapper::create()->execute($billType['offer']);
|
||||
BillTypeL11nMapper::create()->execute(new BillTypeL11n($billType['offer']->getId(), 'Angebot', ISO639x1Enum::_DE));
|
||||
$module->apiBillTypeL11nCreate($request, $response);
|
||||
}
|
||||
}
|
||||
|
||||
$billType['order_confirmation'] = new BillType('Order Confirmation');
|
||||
$billType['order_confirmation']->numberFormat = '{y}-{id}';
|
||||
$billType['order_confirmation']->template = new NullCollection($template);
|
||||
$billType['order_confirmation']->transferType = BillTransferType::PURCHASE;
|
||||
$billType['order_confirmation']->transferStock = false;
|
||||
BillTypeMapper::create()->execute($billType['order_confirmation']);
|
||||
BillTypeL11nMapper::create()->execute(new BillTypeL11n($billType['order_confirmation']->getId(), 'Auftragsbestaetigung', ISO639x1Enum::_DE));
|
||||
|
||||
$billType['delivery_note'] = new BillType('Delivery Note');
|
||||
$billType['delivery_note']->numberFormat = '{y}-{id}';
|
||||
$billType['delivery_note']->template = new NullCollection($template);
|
||||
$billType['delivery_note']->transferType = BillTransferType::PURCHASE;
|
||||
$billType['delivery_note']->transferStock = true;
|
||||
BillTypeMapper::create()->execute($billType['delivery_note']);
|
||||
BillTypeL11nMapper::create()->execute(new BillTypeL11n($billType['delivery_note']->getId(), 'Lieferschein', ISO639x1Enum::_DE));
|
||||
|
||||
$billType['invoice'] = new BillType('Invoice');
|
||||
$billType['invoice']->numberFormat = '{y}-{id}';
|
||||
$billType['invoice']->template = new NullCollection($template);
|
||||
$billType['invoice']->transferType = BillTransferType::PURCHASE;
|
||||
$billType['invoice']->transferStock = false;
|
||||
BillTypeMapper::create()->execute($billType['invoice']);
|
||||
BillTypeL11nMapper::create()->execute(new BillTypeL11n($billType['invoice']->getId(), 'Rechnung', ISO639x1Enum::_DE));
|
||||
|
||||
$billType['credit_note'] = new BillType('Credit Note');
|
||||
$billType['credit_note']->numberFormat = '{y}-{id}';
|
||||
$billType['credit_note']->template = new NullCollection($template);
|
||||
$billType['credit_note']->transferType = BillTransferType::PURCHASE;
|
||||
$billType['credit_note']->transferStock = false;
|
||||
BillTypeMapper::create()->execute($billType['credit_note']);
|
||||
BillTypeL11nMapper::create()->execute(new BillTypeL11n($billType['credit_note']->getId(), 'Rechnungskorrektur', ISO639x1Enum::_DE));
|
||||
|
||||
$billType['reverse_invoice'] = new BillType('Credit Note');
|
||||
$billType['reverse_invoice']->numberFormat = '{y}-{id}';
|
||||
$billType['reverse_invoice']->template = new NullCollection($template);
|
||||
$billType['reverse_invoice']->transferType = BillTransferType::PURCHASE;
|
||||
$billType['reverse_invoice']->transferStock = false;
|
||||
BillTypeMapper::create()->execute($billType['reverse_invoice']);
|
||||
BillTypeL11nMapper::create()->execute(new BillTypeL11n($billType['reverse_invoice']->getId(), 'Gutschrift', ISO639x1Enum::_DE));
|
||||
|
||||
return $billType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Install default transfer bill types
|
||||
*
|
||||
* @return BillType[]
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private static function createTransferBillTypes(int $template) : array
|
||||
{
|
||||
$billType = [];
|
||||
|
||||
$billType['stock_movement'] = new BillType('Stock Movement');
|
||||
$billType['stock_movement']->numberFormat = '{y}-{id}';
|
||||
$billType['stock_movement']->template = new NullCollection($template);
|
||||
$billType['stock_movement']->transferType = BillTransferType::PURCHASE;
|
||||
$billType['stock_movement']->transferStock = false;
|
||||
BillTypeMapper::create()->execute($billType['stock_movement']);
|
||||
BillTypeL11nMapper::create()->execute(new BillTypeL11n($billType['stock_movement']->getId(), 'Lagerumbuchung', ISO639x1Enum::_DE));
|
||||
|
||||
$billType['scrapping'] = new BillType('Scrapping');
|
||||
$billType['scrapping']->numberFormat = '{y}-{id}';
|
||||
$billType['scrapping']->template = new NullCollection($template);
|
||||
$billType['scrapping']->transferType = BillTransferType::PURCHASE;
|
||||
$billType['scrapping']->transferStock = false;
|
||||
BillTypeMapper::create()->execute($billType['scrapping']);
|
||||
BillTypeL11nMapper::create()->execute(new BillTypeL11n($billType['scrapping']->getId(), 'Verschrottung', ISO639x1Enum::_DE));
|
||||
|
||||
return $billType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Install default template bill types
|
||||
*
|
||||
* These bill types don't have any effect on anything, they can simply be used as templates when creating new bills.
|
||||
*
|
||||
* @return BillType[]
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private static function createTemplateBillTypes(int $template) : array
|
||||
{
|
||||
$billType = [];
|
||||
|
||||
$billType['subscritpion'] = new BillType('Subscription');
|
||||
$billType['subscritpion']->numberFormat = '{y}-{id}';
|
||||
$billType['subscritpion']->template = new NullCollection($template);
|
||||
$billType['subscritpion']->transferType = BillTransferType::SALES;
|
||||
$billType['subscritpion']->transferStock = false;
|
||||
BillTypeMapper::create()->execute($billType['subscritpion']);
|
||||
BillTypeL11nMapper::create()->execute(new BillTypeL11n($billType['subscritpion']->getId(), 'Abonnement', ISO639x1Enum::_DE));
|
||||
|
||||
$billType['template'] = new BillType('Template');
|
||||
$billType['template']->numberFormat = '{y}-{id}';
|
||||
$billType['template']->template = new NullCollection($template);
|
||||
$billType['template']->transferType = BillTransferType::SALES;
|
||||
$billType['template']->transferStock = false;
|
||||
BillTypeMapper::create()->execute($billType['template']);
|
||||
BillTypeL11nMapper::create()->execute(new BillTypeL11n($billType['template']->getId(), 'Vorlage', ISO639x1Enum::_DE));
|
||||
|
||||
return $billType;
|
||||
return $billTypes;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,10 @@ use Modules\Billing\Models\BillElementMapper;
|
|||
use Modules\Billing\Models\BillMapper;
|
||||
use Modules\Billing\Models\BillStatus;
|
||||
use Modules\Billing\Models\BillTransferType;
|
||||
use Modules\Billing\Models\BillType;
|
||||
use phpOMS\Localization\BaseStringL11n;
|
||||
use Modules\Billing\Models\BillTypeMapper;
|
||||
use Modules\Billing\Models\BillTypeL11nMapper;
|
||||
use Modules\Billing\Models\SettingsEnum;
|
||||
use Modules\ClientManagement\Models\ClientMapper;
|
||||
use Modules\ItemManagement\Models\ItemMapper;
|
||||
|
|
@ -277,9 +280,10 @@ final class ApiController extends Controller
|
|||
$request->header->account,
|
||||
__DIR__ . '/../../../Modules/Media/Files' . $path,
|
||||
$path,
|
||||
type: $request->getData('type') ?? null,
|
||||
type: $request->getData('type', 'int'),
|
||||
pathSettings: PathSettings::FILE_PATH,
|
||||
hasAccountRelation: false
|
||||
hasAccountRelation: false,
|
||||
readContent: (bool) ($request->getData('parse_content') ?? false)
|
||||
);
|
||||
|
||||
$collection = null;
|
||||
|
|
@ -543,6 +547,8 @@ final class ApiController extends Controller
|
|||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
|
||||
require_once __DIR__ . '/../../../Resources/tcpdf/tcpdf.php';
|
||||
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
$view->setTemplate('/' . \substr($template->getSourceByName('bill.pdf.php')->getPath(), 0, -8), 'pdf.php');
|
||||
$view->setData('bill', $bill);
|
||||
|
|
@ -709,6 +715,7 @@ final class ApiController extends Controller
|
|||
|
||||
$mediaRequest->setData('bill', $billId);
|
||||
$mediaRequest->setData('type', $originalType);
|
||||
$mediaRequest->setData('parse_content', true, true);
|
||||
$this->apiMediaAddToBill($mediaRequest, $mediaResponse, $data);
|
||||
|
||||
$uploaded = $mediaResponse->get('')['response']['upload'];
|
||||
|
|
@ -720,19 +727,6 @@ final class ApiController extends Controller
|
|||
|
||||
// @todo: Parse text and analyze text structure
|
||||
|
||||
// Update bill with parsed text
|
||||
$billRequest = new HttpRequest();
|
||||
$billRequest->header->account = $request->header->account;
|
||||
$billRequest->header->l11n = $request->header->l11n;
|
||||
|
||||
$billRequest->setData('bill', $billId);
|
||||
$billRequest->setData('supplier', 1);
|
||||
|
||||
$billResponse = new HttpResponse();
|
||||
$billResponse->header->l11n = $response->header->l11n;
|
||||
|
||||
$this->apiBillUpdate($billRequest, $billResponse, $data);
|
||||
|
||||
// Create internal document
|
||||
$billResponse = new HttpResponse();
|
||||
$billRequest = new HttpRequest(new HttpUri(''));
|
||||
|
|
@ -745,4 +739,143 @@ final class ApiController extends Controller
|
|||
// @todo: Start workflow for bill, if a workflow is defined for bill uploading
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Api method to create item bill type
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param mixed $data Generic data
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function apiBillTypeCreate(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void
|
||||
{
|
||||
if (!empty($val = $this->validateBillTypeCreate($request))) {
|
||||
$response->set('bill_type_create', new FormValidation($val));
|
||||
$response->header->status = RequestStatusCode::R_400;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$billType = $this->createBillTypeFromRequest($request);
|
||||
$this->createModel($request->header->account, $billType, BillTypeMapper::class, 'bill_type', $request->getOrigin());
|
||||
|
||||
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Bill type', 'Bill type successfully created', $billType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to create item attribute from request.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
*
|
||||
* @return BillType
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function createBillTypeFromRequest(RequestAbstract $request) : BillType
|
||||
{
|
||||
$billType = new BillType($request->getData('name') ?? '');
|
||||
$billType->setL11n((string) ($request->getData('title') ?? ''), $request->getData('language') ?? ISO639x1Enum::_EN);
|
||||
$billType->template = new NullCollection((int) ($request->getData('template') ?? 0));
|
||||
$billType->numberFormat = (string) ($request->getData('number_format') ?? '{id}');
|
||||
$billType->transferStock = (bool) ($request->getData('transfer_stock') ?? false);
|
||||
$billType->transferType = (int) ($request->getData('transfer_type') ?? BillTransferType::SALES);
|
||||
|
||||
return $billType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate item attribute create request
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
*
|
||||
* @return array<string, bool>
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function validateBillTypeCreate(RequestAbstract $request) : array
|
||||
{
|
||||
$val = [];
|
||||
if (($val['title'] = empty($request->getData('title')))
|
||||
|| ($val['name'] = empty($request->getData('name')))
|
||||
) {
|
||||
return $val;
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Api method to create item attribute l11n
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param mixed $data Generic data
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function apiBillTypeL11nCreate(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void
|
||||
{
|
||||
if (!empty($val = $this->validateBillTypeL11nCreate($request))) {
|
||||
$response->set('bill_type_l11n_create', new FormValidation($val));
|
||||
$response->header->status = RequestStatusCode::R_400;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$billTypeL11n = $this->createBillTypeL11nFromRequest($request);
|
||||
$this->createModel($request->header->account, $billTypeL11n, BillTypeL11nMapper::class, 'bill_type_l11n', $request->getOrigin());
|
||||
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Bill type localization', 'Bill type localization successfully created', $billTypeL11n);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to create item attribute l11n from request.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
*
|
||||
* @return BaseStringL11n
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function createBillTypeL11nFromRequest(RequestAbstract $request) : BaseStringL11n
|
||||
{
|
||||
$billTypeL11n = new BaseStringL11n();
|
||||
$billTypeL11n->ref = (int) ($request->getData('type') ?? 0);
|
||||
$billTypeL11n->setLanguage((string) (
|
||||
$request->getData('language') ?? $request->getLanguage()
|
||||
));
|
||||
$billTypeL11n->content = (string) ($request->getData('title') ?? '');
|
||||
|
||||
return $billTypeL11n;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate item attribute l11n create request
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
*
|
||||
* @return array<string, bool>
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function validateBillTypeL11nCreate(RequestAbstract $request) : array
|
||||
{
|
||||
$val = [];
|
||||
if (($val['title'] = empty($request->getData('title')))
|
||||
|| ($val['type'] = empty($request->getData('type')))
|
||||
) {
|
||||
return $val;
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ namespace Modules\Billing\Models;
|
|||
use Modules\Media\Models\Collection;
|
||||
use Modules\Media\Models\NullCollection;
|
||||
use phpOMS\Localization\ISO639x1Enum;
|
||||
use phpOMS\Localization\BaseStringL11n;
|
||||
|
||||
/**
|
||||
* Bill type enum.
|
||||
|
|
@ -36,6 +37,8 @@ class BillType implements \JsonSerializable
|
|||
*/
|
||||
protected int $id = 0;
|
||||
|
||||
public string $name = '';
|
||||
|
||||
public Collection $template;
|
||||
|
||||
public string $numberFormat = '';
|
||||
|
|
@ -47,9 +50,9 @@ class BillType implements \JsonSerializable
|
|||
/**
|
||||
* Localization
|
||||
*
|
||||
* @var string|BillTypeL11n
|
||||
* @var string|BaseStringL11n
|
||||
*/
|
||||
protected string | BillTypeL11n $l11n;
|
||||
protected string | BaseStringL11n $l11n;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
|
@ -60,8 +63,8 @@ class BillType implements \JsonSerializable
|
|||
*/
|
||||
public function __construct(string $name = '')
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->template = new NullCollection();
|
||||
$this->setL11n($name);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -79,22 +82,23 @@ class BillType implements \JsonSerializable
|
|||
/**
|
||||
* Set l11n
|
||||
*
|
||||
* @param string|BillTypeL11n $l11n Tag article l11n
|
||||
* @param string|BaseStringL11n $l11n Tag article l11n
|
||||
* @param string $lang Language
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setL11n($l11n, string $lang = ISO639x1Enum::_EN) : void
|
||||
public function setL11n(string | BaseStringL11n $l11n, string $lang = ISO639x1Enum::_EN) : void
|
||||
{
|
||||
if ($l11n instanceof BillTypeL11n) {
|
||||
if ($l11n instanceof BaseStringL11n) {
|
||||
$this->l11n = $l11n;
|
||||
} elseif (isset($this->l11n) && $this->l11n instanceof BillTypeL11n) {
|
||||
$this->l11n->name = $l11n;
|
||||
} elseif (isset($this->l11n) && $this->l11n instanceof BaseStringL11n) {
|
||||
$this->l11n->content = $l11n;
|
||||
} else {
|
||||
$this->l11n = new BillTypeL11n();
|
||||
$this->l11n->name = $l11n;
|
||||
$this->l11n = new BaseStringL11n();
|
||||
$this->l11n->content = $l11n;
|
||||
$this->l11n->ref = $this->id;
|
||||
$this->l11n->setLanguage($lang);
|
||||
}
|
||||
}
|
||||
|
|
@ -106,7 +110,7 @@ class BillType implements \JsonSerializable
|
|||
*/
|
||||
public function getL11n() : string
|
||||
{
|
||||
return $this->l11n instanceof BillTypeL11n ? $this->l11n->name : $this->l11n;
|
||||
return $this->l11n instanceof BaseStringL11n ? $this->l11n->content : $this->l11n;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,135 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Karaka
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Billing\Models
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\Billing\Models;
|
||||
|
||||
use phpOMS\Localization\ISO639x1Enum;
|
||||
|
||||
/**
|
||||
* Billing class.
|
||||
*
|
||||
* @package Modules\Billing\Models
|
||||
* @license OMS License 1.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class BillTypeL11n implements \JsonSerializable
|
||||
{
|
||||
/**
|
||||
* Type ID.
|
||||
*
|
||||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected int $id = 0;
|
||||
|
||||
/**
|
||||
* Type.
|
||||
*
|
||||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public int | BillType $type = 0;
|
||||
|
||||
/**
|
||||
* Language.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected string $language = ISO639x1Enum::_EN;
|
||||
|
||||
/**
|
||||
* Name.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public string $name = '';
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param int|BillType $type Attribute type
|
||||
* @param string $name Localized name
|
||||
* @param string $language Language
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function __construct(int | BillType $type = 0, string $name = '', string $language = ISO639x1Enum::_EN)
|
||||
{
|
||||
$this->type = $type;
|
||||
$this->name = $name;
|
||||
$this->language = $language;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getId() : int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get language
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getLanguage() : string
|
||||
{
|
||||
return $this->language;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set language
|
||||
*
|
||||
* @param string $language Language
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setLanguage(string $language) : void
|
||||
{
|
||||
$this->language = $language;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function toArray() : array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'name' => $this->name,
|
||||
'type' => $this->type,
|
||||
'language' => $this->language,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function jsonSerialize() : mixed
|
||||
{
|
||||
return $this->toArray();
|
||||
}
|
||||
}
|
||||
|
|
@ -15,6 +15,7 @@ declare(strict_types=1);
|
|||
namespace Modules\Billing\Models;
|
||||
|
||||
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
||||
use phpOMS\Localization\BaseStringL11n;
|
||||
|
||||
/**
|
||||
* Bill type mapper class.
|
||||
|
|
@ -34,8 +35,8 @@ final class BillTypeL11nMapper extends DataMapperFactory
|
|||
*/
|
||||
public const COLUMNS = [
|
||||
'billing_type_l11n_id' => ['name' => 'billing_type_l11n_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'billing_type_l11n_name' => ['name' => 'billing_type_l11n_name', 'type' => 'string', 'internal' => 'name', 'autocomplete' => true],
|
||||
'billing_type_l11n_type' => ['name' => 'billing_type_l11n_type', 'type' => 'int', 'internal' => 'type'],
|
||||
'billing_type_l11n_name' => ['name' => 'billing_type_l11n_name', 'type' => 'string', 'internal' => 'content', 'autocomplete' => true],
|
||||
'billing_type_l11n_type' => ['name' => 'billing_type_l11n_type', 'type' => 'int', 'internal' => 'ref'],
|
||||
'billing_type_l11n_language' => ['name' => 'billing_type_l11n_language', 'type' => 'string', 'internal' => 'language'],
|
||||
];
|
||||
|
||||
|
|
@ -54,4 +55,12 @@ final class BillTypeL11nMapper extends DataMapperFactory
|
|||
* @since 1.0.0
|
||||
*/
|
||||
public const PRIMARYFIELD ='billing_type_l11n_id';
|
||||
|
||||
/**
|
||||
* Model to use by the mapper.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const MODEL = BaseStringL11n::class;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ final class BillTypeMapper extends DataMapperFactory
|
|||
*/
|
||||
public const COLUMNS = [
|
||||
'billing_type_id' => ['name' => 'billing_type_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'billing_type_name' => ['name' => 'billing_type_name', 'type' => 'string', 'internal' => 'name'],
|
||||
'billing_type_number_format' => ['name' => 'billing_type_number_format', 'type' => 'string', 'internal' => 'numberFormat'],
|
||||
'billing_type_template' => ['name' => 'billing_type_template', 'type' => 'int', 'internal' => 'template'],
|
||||
'billing_type_transfer_type' => ['name' => 'billing_type_transfer_type', 'type' => 'int', 'internal' => 'transferType'],
|
||||
|
|
@ -65,7 +66,7 @@ final class BillTypeMapper extends DataMapperFactory
|
|||
'mapper' => BillTypeL11nMapper::class,
|
||||
'table' => 'billing_type_l11n',
|
||||
'self' => 'billing_type_l11n_type',
|
||||
'column' => 'name',
|
||||
'column' => 'content',
|
||||
'external' => null,
|
||||
],
|
||||
];
|
||||
|
|
|
|||
|
|
@ -1,88 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Karaka
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package tests
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\Billing\tests\Models;
|
||||
|
||||
use Modules\Billing\Models\BillTypeL11n;
|
||||
use phpOMS\Localization\ISO639x1Enum;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class BillTypeL11nTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
private BillTypeL11n $l11n;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() : void
|
||||
{
|
||||
$this->l11n = new BillTypeL11n();
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\Billing\Models\BillTypeL11n
|
||||
* @group module
|
||||
*/
|
||||
public function testDefault() : void
|
||||
{
|
||||
self::assertEquals(0, $this->l11n->getId());
|
||||
self::assertEquals('', $this->l11n->name);
|
||||
self::assertEquals(0, $this->l11n->type);
|
||||
self::assertEquals(ISO639x1Enum::_EN, $this->l11n->getLanguage());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\Billing\Models\BillTypeL11n
|
||||
* @group module
|
||||
*/
|
||||
public function testNameInputOutput() : void
|
||||
{
|
||||
$this->l11n->name = 'TestName';
|
||||
self::assertEquals('TestName', $this->l11n->name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\Billing\Models\BillTypeL11n
|
||||
* @group module
|
||||
*/
|
||||
public function testLanguageInputOutput() : void
|
||||
{
|
||||
$this->l11n->setLanguage(ISO639x1Enum::_DE);
|
||||
self::assertEquals(ISO639x1Enum::_DE, $this->l11n->getLanguage());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\Billing\Models\BillTypeL11n
|
||||
* @group module
|
||||
*/
|
||||
public function testSerialize() : void
|
||||
{
|
||||
$this->l11n->name = 'Title';
|
||||
$this->l11n->description = 'Description';
|
||||
$this->l11n->type = 2;
|
||||
$this->l11n->setLanguage(ISO639x1Enum::_DE);
|
||||
|
||||
self::assertEquals(
|
||||
[
|
||||
'id' => 0,
|
||||
'name' => 'Title',
|
||||
'type' => 2,
|
||||
'language' => ISO639x1Enum::_DE,
|
||||
],
|
||||
$this->l11n->jsonSerialize()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -15,7 +15,7 @@ declare(strict_types=1);
|
|||
namespace Modules\Billing\tests\Models;
|
||||
|
||||
use Modules\Billing\Models\BillType;
|
||||
use Modules\Billing\Models\BillTypeL11n;
|
||||
use phpOMS\Localization\BaseStringL11n;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
|
|
@ -51,7 +51,7 @@ final class BillTypeTest extends \PHPUnit\Framework\TestCase
|
|||
$this->type->setL11n('Test1');
|
||||
self::assertEquals('Test1', $this->type->getL11n());
|
||||
|
||||
$this->type->setL11n(new BillTypeL11n(0, 'Test2'));
|
||||
$this->type->setL11n(new BaseStringL11n('Test2'));
|
||||
self::assertEquals('Test2', $this->type->getL11n());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user