diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php new file mode 100644 index 0000000..eb51776 --- /dev/null +++ b/app/Http/Controllers/HomeController.php @@ -0,0 +1,53 @@ +setTemplateFile(app_path('Modules/Invoice/Resources/Docs/invoice.xls')) + ->setData(new InvoiceExcellData( + number: random_int(1, 99), + date: new Carbon('2024-11-08'), + seller_firm_type: 'Telekeçi', + seller_firm_name: 'Nurmuhammet Allanov Parahatowiç', + seller_ssb: '201126532321', + seller_bank_name: 'Türkmenistanyň „Halkbank“ paýdarlar täjirçilik banky', + seller_bank_hb_1: '23206934160169902250000', + seller_bank_hb_2: '21101934110100700005000', + seller_bank_city: 'Aşgabat', + seller_bank_bab: '390101601', + + buyer: 'Türkmenistanyň „Türkmenbaşy“ paýdarlar täjirçilik banky', + buyer_address: '744000 Aşgabat ş., Çandebil şaýoly köç., 121,', + buyer_bank: 'Türkmenistanyň Merkezi Banky', + buyer_bank_address: 'Aşgabat ş.', + buyer_bank_data: sprintf('şahsy salgyt belgisi %s, MFO %s, Hasap № %s', '101301000408', '390101304', '21101934110100300007000'), + + items: [ + new InvoiceItem( + name: 'Programma üpjünçiligini işläp taýýarlamak barada', + unit: 'ay', + quantity: 1, + unit_price: 25000, + vat: null, + excludingVat: null, + vat_percentage: null, + vat_tmt: null, + total: 25000, + ), + ] + )) + ->handle() + ->save(); + + return 'F'; + } +} diff --git a/app/Modules/Invoice/.DS_Store b/app/Modules/Invoice/.DS_Store index 38809a2..352e2a8 100644 Binary files a/app/Modules/Invoice/.DS_Store and b/app/Modules/Invoice/.DS_Store differ diff --git a/app/Modules/Invoice/Actions/GenerateInvoiceExcell.php b/app/Modules/Invoice/Actions/GenerateInvoiceExcell.php index 6ea2c35..259a616 100644 --- a/app/Modules/Invoice/Actions/GenerateInvoiceExcell.php +++ b/app/Modules/Invoice/Actions/GenerateInvoiceExcell.php @@ -255,6 +255,6 @@ class GenerateInvoiceExcell */ public function satynAlyjyBankyMaglumatlary(): string { - return 'Satyn alyjynyň ' . $this->data->buyer_bank_data; + return 'Satyn alyjynyň '.$this->data->buyer_bank_data; } } diff --git a/app/Modules/Invoice/Data/InvoiceExcellData.php b/app/Modules/Invoice/Data/InvoiceExcellData.php index 896bf43..68d885c 100644 --- a/app/Modules/Invoice/Data/InvoiceExcellData.php +++ b/app/Modules/Invoice/Data/InvoiceExcellData.php @@ -24,5 +24,8 @@ class InvoiceExcellData public string $buyer_bank, public string $buyer_bank_address, public string $buyer_bank_data, + + /** @var array */ + public array $items, ) {} } diff --git a/app/Modules/Invoice/Data/InvoiceItem.php b/app/Modules/Invoice/Data/InvoiceItem.php new file mode 100644 index 0000000..22037c8 --- /dev/null +++ b/app/Modules/Invoice/Data/InvoiceItem.php @@ -0,0 +1,20 @@ +setTemplateFile(app_path('Modules/Invoice/Resources/Docs/invoice.xls')) - ->setData(new InvoiceExcellData( - number: random_int(1, 99), - date: new Carbon('2024-11-08'), - seller_firm_type: 'Telekeçi', - seller_firm_name: 'Nurmuhammet Allanov Parahatowiç', - seller_ssb: '201126532321', - seller_bank_name: 'Türkmenistanyň „Halkbank“ paýdarlar täjirçilik banky', - seller_bank_hb_1: '23206934160169902250000', - seller_bank_hb_2: '21101934110100700005000', - seller_bank_city: 'Aşgabat', - seller_bank_bab: '390101601', - - buyer: 'Türkmenistanyň „Türkmenbaşy“ paýdarlar täjirçilik banky', - buyer_address: '744000 Aşgabat ş., Çandebil şaýoly köç., 121,', - buyer_bank: 'Türkmenistanyň Merkezi Banky', - buyer_bank_address: 'Aşgabat ş.', - buyer_bank_data: sprintf('şahsy salgyt belgisi %s, MFO %s, Hasap № %s', '101301000408', '390101304', '21101934110100300007000') - )) - ->handle() - ->save(); - - return 'F'; -}); +Route::get('/', [HomeController::class, 'index']);