removed invoice/bill status tables
This commit is contained in:
		@@ -144,7 +144,7 @@ class CreateDocumentTransaction extends Job
 | 
			
		||||
 | 
			
		||||
            throw new \Exception($message);
 | 
			
		||||
        } else {
 | 
			
		||||
            $this->setStatusCode($amount_check, $total_amount_check);
 | 
			
		||||
            $this->model->status = ($amount_check == $total_amount_check) ? 'paid' : 'partial';
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return true;
 | 
			
		||||
@@ -189,17 +189,6 @@ class CreateDocumentTransaction extends Job
 | 
			
		||||
        return $paid;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    protected function setStatusCode($amount_check, $total_amount_check)
 | 
			
		||||
    {
 | 
			
		||||
        $column = ($this->model instanceof Invoice) ? 'invoice_status_code' : 'bill_status_code';
 | 
			
		||||
 | 
			
		||||
        if ($amount_check == $total_amount_check) {
 | 
			
		||||
            $this->model->$column = 'paid';
 | 
			
		||||
        } else {
 | 
			
		||||
            $this->model->$column = 'partial';
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    protected function createHistory($transaction)
 | 
			
		||||
    {
 | 
			
		||||
        $history_desc = money((double) $transaction->amount, (string) $transaction->currency_code, true)->format() . ' ' . trans_choice('general.payments', 1);
 | 
			
		||||
 
 | 
			
		||||
@@ -32,9 +32,9 @@ class DeleteCompany extends Job
 | 
			
		||||
        $this->authorize();
 | 
			
		||||
 | 
			
		||||
        $this->deleteRelationships($this->company, [
 | 
			
		||||
            'accounts', 'bills', 'bill_histories', 'bill_items', 'bill_item_taxes', 'bill_statuses', 'bill_totals', 'categories',
 | 
			
		||||
            'accounts', 'bills', 'bill_histories', 'bill_items', 'bill_item_taxes', 'bill_totals', 'categories',
 | 
			
		||||
            'contacts', 'currencies', 'dashboards', 'email_templates', 'invoices', 'invoice_histories', 'invoice_items',
 | 
			
		||||
            'invoice_item_taxes', 'invoice_statuses', 'invoice_totals', 'items', 'modules', 'module_histories', 'reconciliations',
 | 
			
		||||
            'invoice_item_taxes', 'invoice_totals', 'items', 'modules', 'module_histories', 'reconciliations',
 | 
			
		||||
            'recurring', 'reports', 'settings', 'taxes', 'transactions', 'transfers', 'widgets',
 | 
			
		||||
        ]);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -39,7 +39,7 @@ class CreateBillHistory extends Job
 | 
			
		||||
        $bill_history = BillHistory::create([
 | 
			
		||||
            'company_id' => $this->bill->company_id,
 | 
			
		||||
            'bill_id' => $this->bill->id,
 | 
			
		||||
            'status_code' => $this->bill->bill_status_code,
 | 
			
		||||
            'status' => $this->bill->status,
 | 
			
		||||
            'notify' => $this->notify,
 | 
			
		||||
            'description' => $description,
 | 
			
		||||
        ]);
 | 
			
		||||
 
 | 
			
		||||
@@ -33,7 +33,7 @@ class DuplicateBill extends Job
 | 
			
		||||
        BillHistory::create([
 | 
			
		||||
            'company_id' => session('company_id'),
 | 
			
		||||
            'bill_id' => $clone->id,
 | 
			
		||||
            'status_code' => 'draft',
 | 
			
		||||
            'status' => 'draft',
 | 
			
		||||
            'notify' => 0,
 | 
			
		||||
            'description' => trans('messages.success.added', ['type' => $clone->bill_number]),
 | 
			
		||||
        ]);
 | 
			
		||||
 
 | 
			
		||||
@@ -57,7 +57,7 @@ class UpdateBill extends Job
 | 
			
		||||
        unset($this->bill->reconciled);
 | 
			
		||||
 | 
			
		||||
        if (($bill_paid) && $this->request['amount'] > $bill_paid) {
 | 
			
		||||
            $this->request['bill_status_code'] = 'partial';
 | 
			
		||||
            $this->request['status'] = 'partial';
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $this->bill->update($this->request->input());
 | 
			
		||||
 
 | 
			
		||||
@@ -39,7 +39,7 @@ class CreateInvoiceHistory extends Job
 | 
			
		||||
        $invoice_history = InvoiceHistory::create([
 | 
			
		||||
            'company_id' => $this->invoice->company_id,
 | 
			
		||||
            'invoice_id' => $this->invoice->id,
 | 
			
		||||
            'status_code' => $this->invoice->invoice_status_code,
 | 
			
		||||
            'status' => $this->invoice->status,
 | 
			
		||||
            'notify' => $this->notify,
 | 
			
		||||
            'description' => $description,
 | 
			
		||||
        ]);
 | 
			
		||||
 
 | 
			
		||||
@@ -57,7 +57,7 @@ class UpdateInvoice extends Job
 | 
			
		||||
        unset($this->invoice->reconciled);
 | 
			
		||||
 | 
			
		||||
        if (($invoice_paid) && $this->request['amount'] > $invoice_paid) {
 | 
			
		||||
            $this->request['invoice_status_code'] = 'partial';
 | 
			
		||||
            $this->request['status'] = 'partial';
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $this->invoice->update($this->request->all());
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user