2019-05-02 13:07:38 +02:00
|
|
|
<?php
|
2019-05-11 05:32:07 +02:00
|
|
|
/**
|
2020-09-06 11:38:10 +02:00
|
|
|
* Invoice Ninja (https://invoiceninja.com).
|
2019-05-11 05:32:07 +02:00
|
|
|
*
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
*
|
2021-01-03 22:54:54 +01:00
|
|
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
2019-05-11 05:32:07 +02:00
|
|
|
*
|
|
|
|
* @license https://opensource.org/licenses/AAL
|
|
|
|
*/
|
2019-05-02 13:07:38 +02:00
|
|
|
|
|
|
|
namespace App\Factory;
|
|
|
|
|
|
|
|
use App\Models\Quote;
|
|
|
|
|
|
|
|
class QuoteFactory
|
|
|
|
{
|
2020-03-03 10:44:26 +01:00
|
|
|
public static function create(int $company_id, int $user_id) :Quote
|
2019-12-30 22:59:12 +01:00
|
|
|
{
|
|
|
|
$quote = new Quote();
|
|
|
|
$quote->status_id = Quote::STATUS_DRAFT;
|
|
|
|
$quote->number = null;
|
|
|
|
$quote->discount = 0;
|
|
|
|
$quote->is_amount_discount = true;
|
|
|
|
$quote->po_number = '';
|
2020-03-03 10:44:26 +01:00
|
|
|
$quote->footer = '';
|
|
|
|
$quote->terms = '';
|
|
|
|
$quote->public_notes = '';
|
2019-12-30 22:59:12 +01:00
|
|
|
$quote->private_notes = '';
|
|
|
|
$quote->date = null;
|
|
|
|
$quote->due_date = null;
|
|
|
|
$quote->partial_due_date = null;
|
|
|
|
$quote->is_deleted = false;
|
|
|
|
$quote->line_items = json_encode([]);
|
|
|
|
$quote->tax_name1 = '';
|
|
|
|
$quote->tax_rate1 = 0;
|
|
|
|
$quote->tax_name2 = '';
|
|
|
|
$quote->tax_rate2 = 0;
|
2020-07-16 23:50:02 +02:00
|
|
|
$quote->custom_value1 = '';
|
|
|
|
$quote->custom_value2 = '';
|
|
|
|
$quote->custom_value3 = '';
|
|
|
|
$quote->custom_value4 = '';
|
2019-12-30 22:59:12 +01:00
|
|
|
$quote->amount = 0;
|
|
|
|
$quote->balance = 0;
|
|
|
|
$quote->partial = 0;
|
|
|
|
$quote->user_id = $user_id;
|
|
|
|
$quote->company_id = $company_id;
|
2020-09-06 11:38:10 +02:00
|
|
|
|
2019-12-30 22:59:12 +01:00
|
|
|
return $quote;
|
|
|
|
}
|
2019-05-02 13:07:38 +02:00
|
|
|
}
|