beautify code
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Modules\Invoice\Actions;
|
||||
|
||||
use App\Modules\Excell\Excell;
|
||||
use App\Modules\Excell\Fonts\FONTS;
|
||||
use App\Modules\Invoice\Data\InvoiceExcellData;
|
||||
use App\Modules\Invoice\Data\InvoiceItem;
|
||||
use App\Modules\Makeable;
|
||||
@@ -99,22 +101,6 @@ class GenerateInvoiceExcell
|
||||
$this->worksheet = $this->spreadsheet->getActiveSheet();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a RichText object with specified text and font settings.
|
||||
*/
|
||||
protected function addToRichText(RichText $richText, string $text, bool $isBold = false): RichText
|
||||
{
|
||||
$textRun = $richText->createTextRun($text);
|
||||
|
||||
$font = $textRun->getFont() ?: new Font;
|
||||
$font->setName('Times New Roman')->setSize(10);
|
||||
if ($isBold) {
|
||||
$font->setBold(true);
|
||||
}
|
||||
|
||||
return $richText;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fill the cells
|
||||
*/
|
||||
@@ -244,7 +230,7 @@ class GenerateInvoiceExcell
|
||||
);
|
||||
$this->worksheet->getStyle('A'.$itemCellNumber)->applyFromArray([
|
||||
'font' => ['bold' => false, 'size' => 8, 'name' => 'Times New Roman'],
|
||||
'alignment' => ['vertical' => Alignment::VERTICAL_TOP]
|
||||
'alignment' => ['vertical' => Alignment::VERTICAL_TOP],
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -304,17 +290,12 @@ class GenerateInvoiceExcell
|
||||
*/
|
||||
public function satyjySalgytBelgi(): RichText
|
||||
{
|
||||
$richText = new RichText;
|
||||
$satyjy_salgyt_belgi = $this->addToRichText(
|
||||
richText: $richText,
|
||||
text: 'Satyjynyň şahsy salgyt belgisi: '
|
||||
);
|
||||
|
||||
return $this->addToRichText(
|
||||
richText: $satyjy_salgyt_belgi,
|
||||
text: $this->data->seller_ssb,
|
||||
isBold: true
|
||||
);
|
||||
return Excell::richText()
|
||||
->setDefaultFont(FONTS::TIMES_NEW_ROMAN)
|
||||
->setDefaultSize(10)
|
||||
->add('Satyjynyň şahsy salgyt belgisi: ')
|
||||
->add($this->data->seller_ssb, bold: true)
|
||||
->toRichText();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -322,17 +303,12 @@ class GenerateInvoiceExcell
|
||||
*/
|
||||
public function satyjyBanky(): RichText
|
||||
{
|
||||
$richText = new RichText;
|
||||
$satyjy_banky = $this->addToRichText(
|
||||
richText: $richText,
|
||||
text: sprintf('Satyjynyň bankynyň ady %s, hasap № ', $this->data->seller_bank_name)
|
||||
);
|
||||
|
||||
return $this->addToRichText(
|
||||
richText: $satyjy_banky,
|
||||
text: $this->data->seller_bank_hb_1,
|
||||
isBold: true
|
||||
);
|
||||
return Excell::richText()
|
||||
->setDefaultFont(FONTS::TIMES_NEW_ROMAN)
|
||||
->setDefaultSize(10)
|
||||
->add(sprintf('Satyjynyň bankynyň ady %s, hasap № ', $this->data->seller_bank_name))
|
||||
->add($this->data->seller_bank_hb_1, bold: true)
|
||||
->toRichText();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -340,16 +316,16 @@ class GenerateInvoiceExcell
|
||||
*/
|
||||
public function satyjyBankyMaglumatlary(): RichText
|
||||
{
|
||||
$richText = new RichText;
|
||||
$city_label = $this->addToRichText($richText, 'şäherde (etrapda) ');
|
||||
$city = $this->addToRichText($city_label, $this->data->seller_bank_city, isBold: true);
|
||||
|
||||
$bab_label = $this->addToRichText($city, ' BAB ');
|
||||
$bab = $this->addToRichText($bab_label, $this->data->seller_bank_bab, isBold: true);
|
||||
|
||||
$hb_2_label = $this->addToRichText($bab, ' bankyň kor.hasap ');
|
||||
|
||||
return $this->addToRichText($hb_2_label, $this->data->seller_bank_hb_2, isBold: true);
|
||||
return Excell::richText()
|
||||
->setDefaultFont(FONTS::TIMES_NEW_ROMAN)
|
||||
->setDefaultSize(10)
|
||||
->add('şäherde (etrapda) ')
|
||||
->add($this->data->seller_bank_city, bold: true)
|
||||
->add(' BAB ')
|
||||
->add($this->data->seller_bank_bab, bold: true)
|
||||
->add(' bankyň kor.hasap ')
|
||||
->add($this->data->seller_bank_hb_2, bold: true)
|
||||
->toRichText();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
BIN
app/Modules/Invoice/Resources/.DS_Store
vendored
BIN
app/Modules/Invoice/Resources/.DS_Store
vendored
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user