From c1af5e1b39a722fcd5c35cc14c4d6801f7ae5c6d Mon Sep 17 00:00:00 2001 From: Nurmuhammet Allanov Date: Sun, 10 Nov 2024 14:18:24 +0500 Subject: [PATCH] support for items --- app/Http/Controllers/HomeController.php | 53 ++++++++++++++++++ app/Modules/Invoice/.DS_Store | Bin 6148 -> 8196 bytes .../Invoice/Actions/GenerateInvoiceExcell.php | 2 +- .../Invoice/Data/InvoiceExcellData.php | 3 + app/Modules/Invoice/Data/InvoiceItem.php | 20 +++++++ .../Invoice/Resources/Docs/invoice.xls | Bin 34816 -> 34816 bytes public/write.xls | Bin 15872 -> 15872 bytes routes/web.php | 33 +---------- 8 files changed, 79 insertions(+), 32 deletions(-) create mode 100644 app/Http/Controllers/HomeController.php create mode 100644 app/Modules/Invoice/Data/InvoiceItem.php 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 38809a2a46ef3e3f9d2373bf5819908ff2d0e575..352e2a84405c18e6aeb867700a6d56e90d2688ef 100644 GIT binary patch delta 382 zcmZoMXmOBWU|?W$DortDU;r^WfEYvza8E20o2aKKDgcrP@);QN8S)s4lgf(=l5#e0 zWDaB5e1O@Pc`-W&$HWE}L69P+8f{XHU^7GOmMlx_S zID-u>VJHI9IY5}oPz2Jak5vXkKMR8kLn6?=#K}rb$2H+RG+Q`esu+@hs*4#?L8`Se zMA3AyG57-Almc{74#-84NPJXxOio}H+pNSS%PhzY^cE0Ea03ZfPzVA;={xgeei6sX X?mPkdata->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 @@ +2?PKD diff --git a/public/write.xls b/public/write.xls index 389eee4d1e20500bb94ac059d7fa2faf487d94c3..e9899d085da11e0d4460f44f11f6c0309e1b92a2 100644 GIT binary patch delta 16 XcmZpuX{gz7O@!H$!E*CW5p_)fIf(`I delta 16 XcmZpuX{gz7O@!Hm!EEzQ5p_)fId28< diff --git a/routes/web.php b/routes/web.php index 5dc9032..add31b7 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1,35 +1,6 @@ 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']);