madeitbelgium / business-control
businessControl.be 的 PHP (Laravel) SDK
dev-master
2020-03-03 16:24 UTC
Requires
- php: >=7.1.0
- guzzlehttp/guzzle: 6.*
Requires (Dev)
- mockery/mockery: ~1.0
- php-coveralls/php-coveralls: ~2.1
- phpunit/phpunit: ~7.0
This package is auto-updated.
Last update: 2024-08-29 05:23:31 UTC
README
使用此 Laravel 包,您可以与 BusinessControl.be CRM 交互。
安装
在您的 composer.json
中要求此包,并更新 composer。
"madeitbelgium/business-control": "^0.1"
文档
用法
use MadeITBelgium\BusinessControl\Facade\BusinessControl; $companyId = 1; //BusinessControl Company ID //Search client $clients = BusinessControl::client()->searchByVat('BE0653.855.818', $companyId); $clients = BusinessControl::client()->searchByEmail('info@madeit.be', $companyId); //create client $client = BusinessControl::client()->create([ 'name' => 'Name', 'company_id' => $companyId, 'team_id' => null, 'client_group_id' => null, 'contact_name' => $name, 'phone' => $phone, 'contact_phone' => null, 'email' => $email, 'invoice_email' => $email, 'contact_email' => $email, 'street_name' => $street, 'street_number' => null, 'postal_code' => $postcode, 'postal_name' => $city, 'country' => $country, 'vat' => $vat ]); if($client->success) { $clientId = $client->client->id; } //Create invoice $invoiceNumber = BusinessControl::invoice()->nextInvoiceNumber(date('Y'), $companyId); $newNumber = ""; if($invoiceNumber->prefix !== null) { $newNumber = $invoiceNumber->prefix; } $number = $invoiceNumber->next; if($invoiceNumber->length !== null) { $number = str_pad($number, $invoiceNumber->length, "0", STR_PAD_LEFT); } $newNumber = $newNumber . $number; $invoice = BusinessControl::invoice()->create([ 'company_id' => $companyId, 'team_id' => null, 'client_id' => $clientId, 'title' => "Made I.T. subscription", 'description' => "", 'invoice_number' => $newNumber, 'invoice_date' => Carbon::now()->format('Y-m-d'), 'invoice_sent' => Carbon::now()->format('Y-m-d'), 'invoice_expire' => Carbon::now()->addDays(14)->format('Y-m-d'), 'invoice_approved' => Carbon::now()->format('Y-m-d'), 'invoice_rejected' => null, 'invoice_completed' => Carbon::now()->format('Y-m-d'), 'invoice_lines' => [ [ 'name' => 'Made I.T. subscription', 'amount' => $period, 'vat' => $vat ? 21 : 0, 'unit_price_excl' => $vat ? ($monthPrice/1.21) : $monthPrice, 'unit_price_vat' => $vat ? ($monthPrice - $monthPrice/1.21) : 0, 'unit_price_incl' => $monthPrice, 'total_price_excl' => $vat ? ($totalPrice/1.21) : $totalPrice, 'total_price_vat' => $vat ? ($totalPrice - $totalPrice/1.21) : 0, 'total_price_incl' => $totalPrice, ] ] ]); if($invoice->success) { $invoiceId = $invoice->invoice->id; BusinessControl::invoice()->updateStatus($invoiceId, 5); }
完整的文档可以在: http://www.madeit.be/ 找到
支持
支持 github 或邮件: tjebbe.lievens@madeit.be
贡献
请尽量遵循 psr-2 编码风格指南。 http://www.php-fig.org/psr/psr-2/
许可证
此包采用 LGPL 许可。您可以在个人和商业项目中免费使用它。代码可以被分支和修改,但原始版权作者应始终包含在内!