mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
Tie invoice to project
This commit is contained in:
@@ -6,6 +6,7 @@ namespace App\Classes\Modules\PerfexCRM\Processors;
|
||||
use App\Classes\Modules\PerfexCRM\Services\CreatesPerfexCRMInvoice;
|
||||
use App\Classes\Modules\PerfexCRM\Services\CreatesPerfexCRMInvoicePayment;
|
||||
use App\Classes\Modules\PerfexCRM\Services\ConvertsPerfexCRMLeadToCustomer;
|
||||
use App\Classes\Modules\PerfexCRM\Services\FetchesPerfexCRMProject;
|
||||
use App\Classes\Modules\PerfexCRM\DataTransferObjects\InvoicePerfexCRMObject;
|
||||
use App\Classes\Modules\PerfexCRM\DataTransferObjects\InvoicePaymentPerfexCRMObject;
|
||||
use App\Classes\Modules\PerfexCRM\DataTransferObjects\InvoiceSingleItemPerfexCRMObject;
|
||||
@@ -23,17 +24,22 @@ class CreatePerfexCRMInvoiceProcessor
|
||||
/** @var ConvertsPerfexCRMLeadToCustomer */
|
||||
private $convertsPerfexCRMLeadToCustomer;
|
||||
|
||||
/** @var FetchesPerfexCRMProject */
|
||||
private $fetchesPerfexCRMProject;
|
||||
|
||||
/**
|
||||
* CreatePerfexCRMInvoiceProcessor constructor.
|
||||
* @param CreatesPerfexCRMInvoice $createsPerfexCRMInvoice
|
||||
*/
|
||||
public function __construct(CreatesPerfexCRMInvoice $createsPerfexCRMInvoice,
|
||||
CreatesPerfexCRMInvoicePayment $createsPerfexCRMInvoicePayment,
|
||||
ConvertsPerfexCRMLeadToCustomer $convertsPerfexCRMLeadToCustomer)
|
||||
ConvertsPerfexCRMLeadToCustomer $convertsPerfexCRMLeadToCustomer,
|
||||
FetchesPerfexCRMProject $fetchesPerfexCRMProject)
|
||||
{
|
||||
$this->createsPerfexCRMInvoice = $createsPerfexCRMInvoice;
|
||||
$this->createsPerfexCRMInvoicePayment = $createsPerfexCRMInvoicePayment;
|
||||
$this->convertsPerfexCRMLeadToCustomer = $convertsPerfexCRMLeadToCustomer;
|
||||
$this->fetchesPerfexCRMProject = $fetchesPerfexCRMProject;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -71,7 +77,7 @@ class CreatePerfexCRMInvoiceProcessor
|
||||
$billingStreet = $billingStreet.$addresses->state()->first()->name.',';
|
||||
$billingStreet = $billingStreet.$addresses->country()->first()->name;
|
||||
|
||||
$projectId = "";
|
||||
|
||||
$allowedPaymentModes = [];
|
||||
$invoiceItems = [];
|
||||
|
||||
@@ -82,6 +88,16 @@ class CreatePerfexCRMInvoiceProcessor
|
||||
$clientId = $result->payload['client_id'];
|
||||
}
|
||||
|
||||
//get project
|
||||
$projectId = "";
|
||||
$bookingMarking = $transaction->owner->marking;
|
||||
$serviceTypeName = $transaction->owner->company->services()->where('id', $transaction->owner->service_id)->first()->name;
|
||||
$projectName = 'Exchange | '.$serviceTypeName.' | '.$bookingMarking;
|
||||
$project = $this->fetchesPerfexCRMProject->execute($projectName, $clientId);
|
||||
if(!is_null($project)){
|
||||
$projectId = $project->id;
|
||||
}
|
||||
|
||||
//newitems
|
||||
foreach ($purchaseOrder->transactionDetails as $key => $transaction_detail){
|
||||
$order = $key + 1;
|
||||
|
||||
@@ -14,7 +14,6 @@ use App\Classes\Modules\Bookings\Services\CalculatesBookingCurrencyAverageRate;
|
||||
use App\Classes\Modules\Companies\Services\FetchesCompany;
|
||||
use App\Classes\Modules\Bookings\Services\UpdatesBookingStatus;
|
||||
use App\Classes\Modules\Transactions\DataTransferObjects\TransactionObject;
|
||||
use App\Classes\Modules\PerfexCRM\Processors\CreatePerfexCRMInvoiceProcessor;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\SegmentConstants;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
@@ -53,8 +52,6 @@ class CreateInvoiceTransactionProcessor
|
||||
/** @var CreateInvoiceDocumentProcessor */
|
||||
private $invoiceDocumentProcessor;
|
||||
|
||||
/** @var CreatePerfexCRMInvoiceProcessor */
|
||||
private $createPerfexCRMInvoiceProcessor;
|
||||
|
||||
/**
|
||||
* CreateInvoiceTransactionProcessor constructor.
|
||||
@@ -69,9 +66,8 @@ class CreateInvoiceTransactionProcessor
|
||||
* @param FetchesCompany $fetchesCompany
|
||||
* @param UpdatesBookingStatus $updatesBookingStatus
|
||||
* @param CreateInvoiceDocumentProcessor $invoiceDocumentProcessor
|
||||
* @param CreatePerfexCRMInvoiceProcessor $createPerfexCRMInvoiceProcessor
|
||||
*/
|
||||
public function __construct(ListsTransactions $listsTransactions, CreatesTransaction $createsTransaction, GeneratesTransactionBillNumber $generatesTransactionBillNumber, CalculatesBookingPaidAmount $calculatesBookingPaidAmount, CalculatesBookingPayableAmount $calculatesBookingPayableAmount, CalculatesBookingTransferredAmount $calculatesBookingTransferredAmount, FetchesServiceConfigurations $fetchesServiceConfigurations, CalculatesBookingCurrencyAverageRate $calculatesBookingCurrencyAverageRate, FetchesCompany $fetchesCompany, UpdatesBookingStatus $updatesBookingStatus, CreateInvoiceDocumentProcessor $invoiceDocumentProcessor, CreatePerfexCRMInvoiceProcessor $createPerfexCRMInvoiceProcessor)
|
||||
public function __construct(ListsTransactions $listsTransactions, CreatesTransaction $createsTransaction, GeneratesTransactionBillNumber $generatesTransactionBillNumber, CalculatesBookingPaidAmount $calculatesBookingPaidAmount, CalculatesBookingPayableAmount $calculatesBookingPayableAmount, CalculatesBookingTransferredAmount $calculatesBookingTransferredAmount, FetchesServiceConfigurations $fetchesServiceConfigurations, CalculatesBookingCurrencyAverageRate $calculatesBookingCurrencyAverageRate, FetchesCompany $fetchesCompany, UpdatesBookingStatus $updatesBookingStatus, CreateInvoiceDocumentProcessor $invoiceDocumentProcessor)
|
||||
{
|
||||
$this->createsTransaction = $createsTransaction;
|
||||
$this->generatesTransactionBillNumber = $generatesTransactionBillNumber;
|
||||
@@ -82,7 +78,6 @@ class CreateInvoiceTransactionProcessor
|
||||
$this->fetchesCompany = $fetchesCompany;
|
||||
$this->updatesBookingStatus = $updatesBookingStatus;
|
||||
$this->invoiceDocumentProcessor = $invoiceDocumentProcessor;
|
||||
$this->createPerfexCRMInvoiceProcessor = $createPerfexCRMInvoiceProcessor;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user