蜂巢 / 发票
0.2.3
2018-12-12 13:44 UTC
Requires
- php: ^7.1
- honey-comb/core: 0.3.*
- honey-comb/starter: ^0.2.16
- laravel/framework: 5.6.*
Requires (Dev)
- codedungeon/phpunit-result-printer: ^0.19
- mockery/mockery: ^1.0
- orchestra/testbench-browser-kit: ^3.6
- phpunit/phpunit: ~7.0
README
为HoneyComb CMS提供的发票包 https://github.com/honey-comb/invoices
描述
HoneyComb CMS发票功能
注意
这是HoneyComb CMS包的一部分发票包。
需求
- php:
^7.1
- laravel:
^5.6
- composer
安装
首先通过Composer安装此包。
{ "require": { "honey-comb/invoices": "0.1.*" } }
或者
composer require honey-comb/invoices
用法
如果您使用honey-comb/payments包,您可以使用我们生成的支付创建事件监听器示例来生成发票。
-
运行
php artisan vendor:publish --tag=hc-invoice
-
在EventServiceProvider中注册事件
protected $listen = [ \HoneyComb\Payments\Events\HCPaymentCreated::class => [ \App\Listeners\HCPaymentCreatedListener::class ], ];
有两个DTO:HCInvoiceDTO
和HCInvoiceItemDTO
创建发票
$invoiceItemDto = (new HCInvoiceItemDTO()) ->setLabel('Product') ->setQuantity(1) ->setVat(2) ->setAmount(10) ->setUnitPrice(10) ->setVatTotal(2) ->setAmountTotal(12); $invoiceDto = (new HCInvoiceDTO()) ->setAmount(10) ->setAmountTotal(12) ->setVat(2) ->setInvoiceDate('2016-04-13') ->setItems([ $invoiceItemDto->toArray(), ]); return $this->invoiceService->createAdvanceInvoice($invoiceDto->toArray());