Skip to content

Commit

Permalink
Merge Invoice and Bill into Document
Browse files Browse the repository at this point in the history
  • Loading branch information
burakcakirel committed Dec 23, 2020
1 parent 830cc05 commit 0c1424d
Show file tree
Hide file tree
Showing 436 changed files with 31,660 additions and 37,355 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,5 @@ _ide_helper_models.php
modules/*
!modules/OfflinePayments
!modules/PaypalStandard
!modules/BC21
.laravelstatsrc
196 changes: 0 additions & 196 deletions app/Abstracts/DocumentModel.php

This file was deleted.

8 changes: 7 additions & 1 deletion app/Abstracts/Export.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,15 @@ abstract class Export implements FromCollection, ShouldAutoSize, WithHeadings, W
{
public $ids;

public function __construct($ids = null)
/**
* @var string
*/
protected $type;

public function __construct($ids = null, string $type = '')
{
$this->ids = $ids;
$this->type = $type;
}

public function title(): string
Expand Down
12 changes: 12 additions & 0 deletions app/Abstracts/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,25 @@
namespace App\Abstracts;

use App\Models\Auth\User;
use App\Models\Common\Company;
use App\Traits\Jobs;
use Illuminate\Database\Eloquent\Factories\Factory as BaseFactory;
use Illuminate\Database\Eloquent\Model as EloquentModel;

abstract class Factory extends BaseFactory
{
use Jobs;

/**
* @var Company
*/
protected $company;

/**
* @var User|EloquentModel|object|null
*/
protected $user;

public function __construct(...$arguments)
{
parent::__construct(...$arguments);
Expand Down
18 changes: 9 additions & 9 deletions app/Abstracts/Http/PaymentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace App\Abstracts\Http;

use App\Events\Sale\PaymentReceived;
use App\Events\Document\PaymentReceived;
use App\Http\Requests\Portal\InvoicePayment as PaymentRequest;
use App\Models\Sale\Invoice;
use App\Models\Document\Document;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Support\Facades\URL;
use Monolog\Logger;
Expand Down Expand Up @@ -41,15 +41,15 @@ public function __construct()
});
}

public function show(Invoice $invoice, PaymentRequest $request)
public function show(Document $document, PaymentRequest $request)
{
$this->setContactFirstLastName($invoice);
$this->setContactFirstLastName($document);

$confirm_url = $this->getConfirmUrl($invoice);
$confirm_url = $this->getConfirmUrl($document);

$html = view('partials.portal.payment_method.' . $this->type, [
'setting' => $this->setting,
'invoice' => $invoice,
'invoice' => $document,
'confirm_url' => $confirm_url,
])->render();

Expand All @@ -62,12 +62,12 @@ public function show(Invoice $invoice, PaymentRequest $request)
]);
}

public function signed(Invoice $invoice, PaymentRequest $request)
public function signed(Document $document, PaymentRequest $request)
{
return $this->show($invoice, $request);
return $this->show($document, $request);
}

public function cancel(Invoice $invoice, $force_redirect = false)
public function cancel(Document $invoice, $force_redirect = false)
{
$message = trans('messages.warning.payment_cancel', ['method' => setting($this->alias . '.name')]);

Expand Down
10 changes: 10 additions & 0 deletions app/Abstracts/Import.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@ abstract class Import implements ToModel, SkipsOnError, SkipsOnFailure, WithBatc

public $empty_field = 'empty---';

/**
* @var string
*/
protected $type;

public function __construct(string $type = '')
{
$this->type = $type;
}

public function map($row): array
{
$row['company_id'] = session('company_id');
Expand Down
5 changes: 5 additions & 0 deletions app/Abstracts/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ abstract class Model extends Eloquent
'enabled' => 'boolean',
];

public static function observe($classes)
{
parent::observe($classes);
}

/**
* The "booting" method of the model.
*
Expand Down
4 changes: 2 additions & 2 deletions app/Abstracts/Report.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use App\Exports\Common\Reports as Export;
use App\Models\Banking\Transaction;
use App\Models\Common\Report as Model;
use App\Models\Sale\Invoice;
use App\Models\Document\Document;
use App\Traits\Charts;
use App\Traits\DateTime;
use App\Utilities\Chartjs;
Expand Down Expand Up @@ -355,7 +355,7 @@ public function setTotals($items, $date_field, $check_type = false, $table = 'de

$amount = $item->getAmountConvertedToDefault(false, $with_tax);

$type = (($item instanceof Invoice) || (($item instanceof Transaction) && ($item->type == 'income'))) ? 'income' : 'expense';
$type = ($item->type === Document::INVOICE_TYPE || $item->type === 'income') ? 'income' : 'expense';

if (($check_type == false) || ($type == 'income')) {
$this->row_values[$table][$item->$id_field][$date] += $amount;
Expand Down
34 changes: 34 additions & 0 deletions app/Abstracts/View/Components/DocumentForm.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

namespace App\Abstracts\View\Components;

use Illuminate\View\Component;
use Illuminate\Support\Str;

abstract class DocumentForm extends Component
{
public $type;

public $documents;

public $bulkActions;

/** @var bool */
public $hideBulkAction;

/**
* Create a new component instance.
*
* @return void
*/
public function __construct(
$type, $documents = [], $bulkActions = [],
bool $hideBulkAction = false
) {
$this->type = $type;
$this->documents = $documents;

$this->bulkActions = $bulkActions;
$this->hideBulkAction = $hideBulkAction;
}
}
Loading

0 comments on commit 0c1424d

Please sign in to comment.