diff --git a/.DS_Store b/.DS_Store index 1b58ec4..a820ce6 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/app/Modules/.DS_Store b/app/Modules/.DS_Store index 4330fbb..2a11c41 100644 Binary files a/app/Modules/.DS_Store and b/app/Modules/.DS_Store differ diff --git a/app/Modules/Invoice/.DS_Store b/app/Modules/Invoice/.DS_Store new file mode 100644 index 0000000..38809a2 Binary files /dev/null and b/app/Modules/Invoice/.DS_Store differ diff --git a/app/Modules/Invoice/Controllers/InvoiceController.php b/app/Modules/Invoice/Controllers/InvoiceController.php new file mode 100644 index 0000000..dbde2c2 --- /dev/null +++ b/app/Modules/Invoice/Controllers/InvoiceController.php @@ -0,0 +1,49 @@ +enabled; + } + + /** + * Disable module + */ + public function disable(): void + { + $this->enabled = false; + } + + /** + * Enable module + */ + public function enable(): void + { + $this->enabled = true; + } + + /** + * Check if module has a filament resource + */ + public function hasFilamentResource(): bool + { + return true; + } +} diff --git a/app/Modules/Invoice/Models/Invoice.php b/app/Modules/Invoice/Models/Invoice.php new file mode 100644 index 0000000..4741484 --- /dev/null +++ b/app/Modules/Invoice/Models/Invoice.php @@ -0,0 +1,11 @@ +enabled; + } + + /** + * Disable module + */ + public function disable(): void + { + $this->enabled = false; + } + + /** + * Enable module + */ + public function enable(): void + { + $this->enabled = true; + } + + /** + * Check if module has a filament resource + */ + public function hasFilamentResource(): bool + { + return true; + } +} diff --git a/composer.json b/composer.json index 68d08d4..45b34d7 100644 --- a/composer.json +++ b/composer.json @@ -9,6 +9,7 @@ "filament/filament": "^3.2", "laravel/framework": "^11.9", "laravel/tinker": "^2.9", + "phpoffice/phpspreadsheet": "^3.3", "phpoffice/phpword": "^1.3" }, "require-dev": { diff --git a/composer.lock b/composer.lock index 4de9c05..530437b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "8a4d84668f344ea1cf8145eb52a30343", + "content-hash": "2c5e3e156b6775d0bb4507a50ddce50a", "packages": [ { "name": "anourvalar/eloquent-serialize", @@ -3133,6 +3133,190 @@ ], "time": "2024-10-15T19:35:06+00:00" }, + { + "name": "maennchen/zipstream-php", + "version": "3.1.1", + "source": { + "type": "git", + "url": "https://github.com/maennchen/ZipStream-PHP.git", + "reference": "6187e9cc4493da94b9b63eb2315821552015fca9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/maennchen/ZipStream-PHP/zipball/6187e9cc4493da94b9b63eb2315821552015fca9", + "reference": "6187e9cc4493da94b9b63eb2315821552015fca9", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "ext-zlib": "*", + "php-64bit": "^8.1" + }, + "require-dev": { + "ext-zip": "*", + "friendsofphp/php-cs-fixer": "^3.16", + "guzzlehttp/guzzle": "^7.5", + "mikey179/vfsstream": "^1.6", + "php-coveralls/php-coveralls": "^2.5", + "phpunit/phpunit": "^10.0", + "vimeo/psalm": "^5.0" + }, + "suggest": { + "guzzlehttp/psr7": "^2.4", + "psr/http-message": "^2.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "ZipStream\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Paul Duncan", + "email": "pabs@pablotron.org" + }, + { + "name": "Jonatan Männchen", + "email": "jonatan@maennchen.ch" + }, + { + "name": "Jesse Donat", + "email": "donatj@gmail.com" + }, + { + "name": "András Kolesár", + "email": "kolesar@kolesar.hu" + } + ], + "description": "ZipStream is a library for dynamically streaming dynamic zip files from PHP without writing to the disk at all on the server.", + "keywords": [ + "stream", + "zip" + ], + "support": { + "issues": "https://github.com/maennchen/ZipStream-PHP/issues", + "source": "https://github.com/maennchen/ZipStream-PHP/tree/3.1.1" + }, + "funding": [ + { + "url": "https://github.com/maennchen", + "type": "github" + } + ], + "time": "2024-10-10T12:33:01+00:00" + }, + { + "name": "markbaker/complex", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/MarkBaker/PHPComplex.git", + "reference": "95c56caa1cf5c766ad6d65b6344b807c1e8405b9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/MarkBaker/PHPComplex/zipball/95c56caa1cf5c766ad6d65b6344b807c1e8405b9", + "reference": "95c56caa1cf5c766ad6d65b6344b807c1e8405b9", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "dev-master", + "phpcompatibility/php-compatibility": "^9.3", + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0", + "squizlabs/php_codesniffer": "^3.7" + }, + "type": "library", + "autoload": { + "psr-4": { + "Complex\\": "classes/src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mark Baker", + "email": "mark@lange.demon.co.uk" + } + ], + "description": "PHP Class for working with complex numbers", + "homepage": "https://github.com/MarkBaker/PHPComplex", + "keywords": [ + "complex", + "mathematics" + ], + "support": { + "issues": "https://github.com/MarkBaker/PHPComplex/issues", + "source": "https://github.com/MarkBaker/PHPComplex/tree/3.0.2" + }, + "time": "2022-12-06T16:21:08+00:00" + }, + { + "name": "markbaker/matrix", + "version": "3.0.1", + "source": { + "type": "git", + "url": "https://github.com/MarkBaker/PHPMatrix.git", + "reference": "728434227fe21be27ff6d86621a1b13107a2562c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/MarkBaker/PHPMatrix/zipball/728434227fe21be27ff6d86621a1b13107a2562c", + "reference": "728434227fe21be27ff6d86621a1b13107a2562c", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "dev-master", + "phpcompatibility/php-compatibility": "^9.3", + "phpdocumentor/phpdocumentor": "2.*", + "phploc/phploc": "^4.0", + "phpmd/phpmd": "2.*", + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0", + "sebastian/phpcpd": "^4.0", + "squizlabs/php_codesniffer": "^3.7" + }, + "type": "library", + "autoload": { + "psr-4": { + "Matrix\\": "classes/src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mark Baker", + "email": "mark@demon-angel.eu" + } + ], + "description": "PHP Class for working with matrices", + "homepage": "https://github.com/MarkBaker/PHPMatrix", + "keywords": [ + "mathematics", + "matrix", + "vector" + ], + "support": { + "issues": "https://github.com/MarkBaker/PHPMatrix/issues", + "source": "https://github.com/MarkBaker/PHPMatrix/tree/3.0.1" + }, + "time": "2022-12-02T22:17:43+00:00" + }, { "name": "masterminds/html5", "version": "2.9.0", @@ -3845,6 +4029,110 @@ }, "time": "2024-08-12T07:30:45+00:00" }, + { + "name": "phpoffice/phpspreadsheet", + "version": "3.3.0", + "source": { + "type": "git", + "url": "https://github.com/PHPOffice/PhpSpreadsheet.git", + "reference": "87ddd21eb0b6b7ad20a11d314348ef307475f547" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/87ddd21eb0b6b7ad20a11d314348ef307475f547", + "reference": "87ddd21eb0b6b7ad20a11d314348ef307475f547", + "shasum": "" + }, + "require": { + "ext-ctype": "*", + "ext-dom": "*", + "ext-fileinfo": "*", + "ext-gd": "*", + "ext-iconv": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-simplexml": "*", + "ext-xml": "*", + "ext-xmlreader": "*", + "ext-xmlwriter": "*", + "ext-zip": "*", + "ext-zlib": "*", + "maennchen/zipstream-php": "^2.1 || ^3.0", + "markbaker/complex": "^3.0", + "markbaker/matrix": "^3.0", + "php": "^8.1", + "psr/http-client": "^1.0", + "psr/http-factory": "^1.0", + "psr/simple-cache": "^1.0 || ^2.0 || ^3.0" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "dev-main", + "dompdf/dompdf": "^2.0 || ^3.0", + "friendsofphp/php-cs-fixer": "^3.2", + "mitoteam/jpgraph": "^10.3", + "mpdf/mpdf": "^8.1.1", + "phpcompatibility/php-compatibility": "^9.3", + "phpstan/phpstan": "^1.1", + "phpstan/phpstan-phpunit": "^1.0", + "phpunit/phpunit": "^9.6 || ^10.5", + "squizlabs/php_codesniffer": "^3.7", + "tecnickcom/tcpdf": "^6.5" + }, + "suggest": { + "dompdf/dompdf": "Option for rendering PDF with PDF Writer", + "ext-intl": "PHP Internationalization Functions", + "mitoteam/jpgraph": "Option for rendering charts, or including charts with PDF or HTML Writers", + "mpdf/mpdf": "Option for rendering PDF with PDF Writer", + "tecnickcom/tcpdf": "Option for rendering PDF with PDF Writer" + }, + "type": "library", + "autoload": { + "psr-4": { + "PhpOffice\\PhpSpreadsheet\\": "src/PhpSpreadsheet" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Maarten Balliauw", + "homepage": "https://blog.maartenballiauw.be" + }, + { + "name": "Mark Baker", + "homepage": "https://markbakeruk.net" + }, + { + "name": "Franck Lefevre", + "homepage": "https://rootslabs.net" + }, + { + "name": "Erik Tilt" + }, + { + "name": "Adrien Crivelli" + } + ], + "description": "PHPSpreadsheet - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine", + "homepage": "https://github.com/PHPOffice/PhpSpreadsheet", + "keywords": [ + "OpenXML", + "excel", + "gnumeric", + "ods", + "php", + "spreadsheet", + "xls", + "xlsx" + ], + "support": { + "issues": "https://github.com/PHPOffice/PhpSpreadsheet/issues", + "source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/3.3.0" + }, + "time": "2024-09-29T07:04:07+00:00" + }, { "name": "phpoffice/phpword", "version": "1.3.0", diff --git a/public/write.xls b/public/write.xls new file mode 100644 index 0000000..36331f7 Binary files /dev/null and b/public/write.xls differ diff --git a/routes/web.php b/routes/web.php index 188e914..eec769a 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1,5 +1,85 @@ getActiveSheet(); + + Carbon::setLocale('tk'); + + // Define vars... + $number = random_int(1, 99); + $date = new Carbon('2024-11-08'); + $year = $date->year; + $day = $date->format('d'); + $month_as_string = $date->translatedFormat('F'); + $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_number = "23206934160169902250000"; + + // Cell vars... + $hasap_faktura = 'Hasap-faktura № ' . $number; + $sene = sprintf('%s ýylyň «%s» %s', $year, $day, $month_as_string); + $satyjy = sprintf('Satyjy: %s %s', $seller_firm_type, $seller_firm_name); + + $satyjy_salgyt_belgi = new RichText(); + $satyjy_salgyt_belgi + ->createTextRun('Satyjynyň şahsy salgyt belgisi: ') + ->getFont() + ->setName('Times New Roman') + ->setSize(10); + + $satyjy_salgyt_belgi + ->createTextRun($seller_ssb) + ->getFont() + ->setBold(true) + ->setName('Times New Roman') + ->setSize(10); + + $satyjy_bank_maglumatlary = new RichText(); + $satyjy_bank_maglumatlary + ->createTextRun(sprintf('Satyjynyň bankynyň ady %s, hasap № ', $seller_bank_name)) + ->getFont() + ->setName('Times New Roman') + ->setSize(10); + + $satyjy_bank_maglumatlary + ->createTextRun($seller_bank_number) + ->getFont() + ->setBold(true) + ->setName('Times New Roman') + ->setSize(10); + + // Set cell vars... + $worksheet->getCell('C6')->setValue($hasap_faktura); + $worksheet->getCell('C7')->setValue($sene); + $worksheet->getCell('A9')->setValue($satyjy); + $worksheet->getCell('A11')->setValue($satyjy_salgyt_belgi); + $worksheet->getCell('A12')->setValue($satyjy_bank_maglumatlary); + + $worksheet->getCell('A13')->setValue(sprintf('şäherde (etrapda) %s BAB %s bankyň kor.hasap %s', 'Aşgabat', '390101601', '21101934110100700005000')); + + $worksheet->getCell('A16')->setValue(sprintf('Satyn alyjy: %s', 'Türkmenistanyň „Türkmenbaşy“ paýdarlar täjirçilik banky')); + + $worksheet->getCell('A18')->setValue(sprintf('744000 Aşgabat ş., Çandebil şaýoly köç., 121,')); + + $worksheet->getCell('A19')->setValue(sprintf('Alyjynyň bankynyň ady %s %s', 'Türkmenistanyň Merkezi Banky', 'Aşgabat ş.')); + + $worksheet->getCell('A20')->setValue(sprintf('Satyn alyjynyň şahsy salgyt belgisi %s, MFO %s, Hasap № %s', '101301000408', '390101304', '21101934110100300007000')); + + $writer = IOFactory::createWriter($spreadsheet, 'Xls'); + $writer->save('write.xls'); + + return 'F'; +});