1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 08:21:34 +02:00
invoiceninja/app/Factory/QuoteFactory.php

54 lines
1.5 KiB
PHP
Raw Normal View History

2019-05-02 13:07:38 +02:00
<?php
2019-05-11 05:32:07 +02:00
/**
* Invoice Ninja (https://invoiceninja.com).
2019-05-11 05:32:07 +02:00
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
2024-04-12 06:15:41 +02:00
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
2019-05-11 05:32:07 +02:00
*
2021-06-16 08:58:16 +02:00
* @license https://www.elastic.co/licensing/elastic-license
2019-05-11 05:32:07 +02:00
*/
2019-05-02 13:07:38 +02:00
namespace App\Factory;
use App\Models\Quote;
class QuoteFactory
{
2024-01-14 05:05:00 +01:00
public static function create(int $company_id, int $user_id): Quote
{
$quote = new Quote();
$quote->status_id = Quote::STATUS_DRAFT;
$quote->number = null;
$quote->discount = 0;
$quote->is_amount_discount = true;
$quote->po_number = '';
$quote->footer = '';
$quote->terms = '';
$quote->public_notes = '';
$quote->private_notes = '';
$quote->date = now()->format('Y-m-d');
$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 = '';
$quote->amount = 0;
$quote->balance = 0;
$quote->partial = 0;
$quote->user_id = $user_id;
$quote->company_id = $company_id;
$quote->paid_to_date = 0;
2023-07-16 12:34:31 +02:00
$quote->exchange_rate = 1;
return $quote;
}
2019-05-02 13:07:38 +02:00
}