gerardojbaez / sale-statements
为您的Laravel应用程序提供无支付依赖的销售记录系统。
v2.0.0-beta.2
2023-08-20 22:10 UTC
Requires
- illuminate/database: ^7.0|^8.0|^9.0|^10.0
Requires (Dev)
- mockery/mockery: ~1.5
- orchestra/testbench: ^6.24
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-09-21 00:41:00 UTC
README
为您的Laravel应用程序提供无支付依赖的销售记录系统。
轻松存储和管理您的应用程序的报价、订单、发票和贷项通知销售文档。
由Rentado.net和Full Help 🎉在生产中使用
特性
- 支持报价、订单、发票和贷项通知
- 能够从报价生成订单,从订单生成发票,从发票生成贷项通知。
- 可能扩展以支持其他销售文档。
- 在声明中存储折扣,并可选地将其与选定项目关联
- 按项目计税比率
TL;DR
use \Gerardojbaez\SaleStatements\Models\SaleStatement; use \Gerardojbaez\SaleStatements\Models\SaleStatementType; // Create Invoice sale statement $invoice = SaleStatement::create(SaleStatementType::TYPE_ORDER); // Add Billing and Shipping Address $invoice->addresses()->create([ 'is_shipping' => true, 'is_billing' => true, 'line_1' => '711-2880 Nulla St', 'locality' => 'Mankato', // City, Town, Municipality, etc... 'administrative_area' => 'Mississipi', // State, Province, Region, etc... 'country_code' => 'US', 'postalcode' => 96522, 'given_name' => 'Cecilia', // i.e., first name 'additional_name' => 'J.', // Can be used to hold a middle name, or a patronymic. 'family_name' => 'Chapman', // i.e., last name 'organization' => 'Acme Co.', ]); // Store a discount at the statement-level $discount = $invoice->discounts()->create([ 'name' => 'Get 20% off of license!', 'discount' => 20, 'is_percentage' => true, ]); // Store tax rate at the statement-level $tax = $statement->taxes()->create([ 'name' => 'PR 10.5 %', 'rate' => 0.105, 'amount' => 2486 ]); // Add line item to statement $item = $invoice->items()->create([ 'name' => 'Software license', 'price' => 14900, // $149.00 'quantity' => 1, ]); // Optionally associate discount with item $item->discounts()->attach($discount); // Associate tax rate with item $item->taxes()->attach($tax);
关于PDF、地址和货币格式化的说明
地址和货币格式化在不同的应用程序之间有很大差异,这就是为什么PDF生成未包含在此包中,将来也不太可能添加。
您可以考虑使用Dompdf和Sparksuite的发票模板作为起点。如果您的应用程序已经具有地址和货币格式化,则使用上述工具添加PDF可能是一个简单的任务。
关于货币值
所有金额都以最小单位表示(例如,分),因此5.00美元写作500
。因此,所有存储货币值的数据库列都使用INT数据类型。
我没有看到与我的用户或产品表的关系
没有假设您的账单和产品模型。如果您需要添加关系或扩展基本功能,您可以通过按需更改表并扩展默认模型来自由地进行。
安全性
如果您发现任何安全问题,请通过电子邮件g@gerardobaez.com联系,而不是使用问题跟踪器。
许可证
在MIT许可证下发布。请参阅包含的许可证文件以获取更多信息。