mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 05:02:36 +01:00
Model updates
This commit is contained in:
parent
32ca69bc52
commit
f20183025b
@ -50,6 +50,7 @@ class InvoiceFactory
|
||||
$invoice->partial = 0;
|
||||
$invoice->user_id = $user_id;
|
||||
$invoice->company_id = $company_id;
|
||||
$invoice->recurring_invoice_id = null;
|
||||
|
||||
return $invoice;
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ class ProductFactory
|
||||
$product->product_key = '';
|
||||
$product->notes = '';
|
||||
$product->cost = 0;
|
||||
$product->price = 0;
|
||||
$product->qty = 0;
|
||||
$product->tax_name1 = '';
|
||||
$product->tax_rate1 = 0;
|
||||
|
@ -16,7 +16,7 @@ use App\DataMapper\CompanySettings;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\RecurringInvoice;
|
||||
|
||||
class RecurringInvoiceToInvoiceFactory
|
||||
class recurring_invoiceToInvoiceFactory
|
||||
{
|
||||
|
||||
public static function create(RecurringInvoice $recurring_invoice) :Invoice
|
||||
@ -24,30 +24,31 @@ class RecurringInvoiceToInvoiceFactory
|
||||
$invoice = new Invoice();
|
||||
$invoice->status_id = Invoice::STATUS_DRAFT;
|
||||
$invoice->discount = $recurring_invoice->discount;
|
||||
$invoice->is_amount_discount = $recurringinvoice->is_amount_discount;
|
||||
$invoice->po_number = $recurringinvoice->po_number;
|
||||
$invoice->footer = $recurringinvoice->footer;
|
||||
$invoice->terms = $recurringinvoice->terms;
|
||||
$invoice->public_notes = $recurringinvoice->public_notes;
|
||||
$invoice->private_notes = $recurringinvoice->private_notes;
|
||||
$invoice->is_amount_discount = $recurring_invoice->is_amount_discount;
|
||||
$invoice->po_number = $recurring_invoice->po_number;
|
||||
$invoice->footer = $recurring_invoice->footer;
|
||||
$invoice->terms = $recurring_invoice->terms;
|
||||
$invoice->public_notes = $recurring_invoice->public_notes;
|
||||
$invoice->private_notes = $recurring_invoice->private_notes;
|
||||
$invoice->invoice_date = date_create()->format(config('ninja.date_format'));
|
||||
$invoice->due_date = $recurringinvoice->due_date; //todo calculate based on terms
|
||||
$invoice->is_deleted = $recurringinvoice->is_deleted;
|
||||
$invoice->line_items = $recurringinvoice->line_items;
|
||||
$invoice->settings = $recurringinvoice->settings;
|
||||
$invoice->due_date = $recurring_invoice->due_date; //todo calculate based on terms
|
||||
$invoice->is_deleted = $recurring_invoice->is_deleted;
|
||||
$invoice->line_items = $recurring_invoice->line_items;
|
||||
$invoice->settings = $recurring_invoice->settings;
|
||||
$invoice->backup = json_encode([]);
|
||||
$invoice->tax_name1 = $recurringinvoice->tax_name1;
|
||||
$invoice->tax_rate1 = $recurringinvoice->tax_rate1;
|
||||
$invoice->tax_name2 = $recurringinvoice->tax_name2;
|
||||
$invoice->tax_rate2 = $recurringinvoice->tax_rate2;
|
||||
$invoice->custom_value1 = $recurringinvoice->custom_value1;
|
||||
$invoice->custom_value2 = $recurringinvoice->custom_value2;
|
||||
$invoice->custom_value3 = $recurringinvoice->custom_value3;
|
||||
$invoice->custom_value4 = $recurringinvoice->custom_value4;
|
||||
$invoice->amount = $recurringinvoice->amount;
|
||||
$invoice->balance = $recurringinvoice->balance;
|
||||
$invoice->user_id = $recurringinvoice->user_id;
|
||||
$invoice->company_id = $recurringinvoice->company_id;
|
||||
$invoice->tax_name1 = $recurring_invoice->tax_name1;
|
||||
$invoice->tax_rate1 = $recurring_invoice->tax_rate1;
|
||||
$invoice->tax_name2 = $recurring_invoice->tax_name2;
|
||||
$invoice->tax_rate2 = $recurring_invoice->tax_rate2;
|
||||
$invoice->custom_value1 = $recurring_invoice->custom_value1;
|
||||
$invoice->custom_value2 = $recurring_invoice->custom_value2;
|
||||
$invoice->custom_value3 = $recurring_invoice->custom_value3;
|
||||
$invoice->custom_value4 = $recurring_invoice->custom_value4;
|
||||
$invoice->amount = $recurring_invoice->amount;
|
||||
$invoice->balance = $recurring_invoice->balance;
|
||||
$invoice->user_id = $recurring_invoice->user_id;
|
||||
$invoice->company_id = $recurring_invoice->company_id;
|
||||
$invoice->recurring_invoice_id = $recurring_invoice->id
|
||||
|
||||
return $invoice;
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ $factory->define(App\Models\Product::class, function (Faker $faker) {
|
||||
'product_key' => $faker->text(7),
|
||||
'notes' => $faker->text(20),
|
||||
'cost' => $faker->numberBetween(1,1000),
|
||||
'price' => $faker->numberBetween(1,1000),
|
||||
'qty' => $faker->numberBetween(1,100),
|
||||
'tax_name1' => 'GST',
|
||||
'tax_rate1' => 10,
|
||||
|
@ -367,6 +367,8 @@ class CreateUsersTable extends Migration
|
||||
$t->unsignedInteger('company_id')->index();
|
||||
$t->unsignedInteger('status_id');
|
||||
|
||||
$t->unsignedInteger('recurring_invoice_id')->nullable();
|
||||
|
||||
$t->string('invoice_number')->nullable();
|
||||
$t->float('discount');
|
||||
$t->boolean('is_amount_discount');
|
||||
@ -648,6 +650,7 @@ class CreateUsersTable extends Migration
|
||||
$t->string('product_key');
|
||||
$t->text('notes');
|
||||
$t->decimal('cost', 13, 2);
|
||||
$t->decimal('price', 13, 2);
|
||||
$t->decimal('qty', 13, 2)->nullable();
|
||||
|
||||
$t->string('tax_name1')->nullable();
|
||||
|
Loading…
Reference in New Issue
Block a user