Automated formatting changes

This commit is contained in:
Formatter Bot 2023-01-07 18:02:29 +00:00
parent ec8b455bdd
commit 8216ff988b
5 changed files with 22 additions and 22 deletions

View File

@ -5,11 +5,13 @@ declare(strict_types=1);
class MYPDF extends TCPDF
{
public string $fontName = '';
public int $fontSize = 8;
public int $sideMargin = 15;
//Page header
public function Header() {
public function Header() : void {
if ($this->header_xobjid === false) {
$this->header_xobjid = $this->startTemplate($this->w, 0);
@ -32,7 +34,7 @@ class MYPDF extends TCPDF
$x = 0;
$dx = 0;
if (!$this->header_xobj_autoreset AND $this->booklet AND (($this->page % 2) == 0)) {
if (!$this->header_xobj_autoreset && $this->booklet && (($this->page % 2) == 0)) {
// adjust margins for booklet mode
$dx = ($this->original_lMargin - $this->original_rMargin);
}
@ -51,7 +53,7 @@ class MYPDF extends TCPDF
}
// Page footer
public function Footer() {
public function Footer() : void {
$this->SetY(-25);
$this->SetFont('helvetica', 'I', 7);
@ -121,7 +123,7 @@ $lineHeight = ($lineHeight - $pdf->getY()) / 3;
// Document head
$pdf->SetFont('helvetica', 'B', 20);
$title = 'INVOICE';
$title = 'INVOICE';
$titleWidth = $pdf->GetStringWidth($title, 'helvetica', 'B', 20);
$pdf->SetXY(
@ -158,7 +160,7 @@ $pdf->Ln();
$pdf->SetY($pdf->GetY() + 5);
$header = ['Item', 'Quantity', 'Rate', 'Total'];
$data = [
$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"],
@ -178,8 +180,8 @@ $data = [
];
// Header
$w = array($pdf->getPageWidth() - 20 - 20 - 20 - 2*15, 20, 20, 20);
$num_headers = count($header);
$w = [$pdf->getPageWidth() - 20 - 20 - 20 - 2 * 15, 20, 20, 20];
$num_headers = \count($header);
$pdf->setCellPadding(1, 1, 1, 1);
@ -300,4 +302,4 @@ $pdf->writeHTMLCell(
$pdf->Ln();
//Close and output PDF document
$pdf->Output('example_048.pdf', 'I');
$pdf->Output('example_048.pdf', 'I');

View File

@ -15,14 +15,12 @@ declare(strict_types=1);
namespace Modules\Billing\Admin;
use Modules\Billing\Models\BillTransferType;
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\Module\InstallerAbstract;
use phpOMS\Module\ModuleInfo;
use phpOMS\Uri\HttpUri;
/**

View File

@ -24,9 +24,8 @@ 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\BillTypeMapper;
use Modules\Billing\Models\SettingsEnum;
use Modules\ClientManagement\Models\ClientMapper;
use Modules\ItemManagement\Models\ItemMapper;
@ -38,6 +37,7 @@ use Modules\Media\Models\UploadStatus;
use Modules\SupplierManagement\Models\NullSupplier;
use Modules\SupplierManagement\Models\SupplierMapper;
use phpOMS\Autoloader;
use phpOMS\Localization\BaseStringL11n;
use phpOMS\Localization\Money;
use phpOMS\Message\Http\HttpRequest;
use phpOMS\Message\Http\HttpResponse;
@ -781,10 +781,10 @@ final class ApiController extends Controller
{
$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->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);
$billType->transferType = (int) ($request->getData('transfer_type') ?? BillTransferType::SALES);
return $billType;
}

View File

@ -16,8 +16,8 @@ namespace Modules\Billing\Models;
use Modules\Media\Models\Collection;
use Modules\Media\Models\NullCollection;
use phpOMS\Localization\ISO639x1Enum;
use phpOMS\Localization\BaseStringL11n;
use phpOMS\Localization\ISO639x1Enum;
/**
* Bill type enum.
@ -83,7 +83,7 @@ class BillType implements \JsonSerializable
* Set l11n
*
* @param string|BaseStringL11n $l11n Tag article l11n
* @param string $lang Language
* @param string $lang Language
*
* @return void
*
@ -96,9 +96,9 @@ class BillType implements \JsonSerializable
} elseif (isset($this->l11n) && $this->l11n instanceof BaseStringL11n) {
$this->l11n->content = $l11n;
} else {
$this->l11n = new BaseStringL11n();
$this->l11n = new BaseStringL11n();
$this->l11n->content = $l11n;
$this->l11n->ref = $this->id;
$this->l11n->ref = $this->id;
$this->l11n->setLanguage($lang);
}
}

View File

@ -35,7 +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_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'],