1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Picqer\Financials\Exact; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* Class Quotation |
7
|
|
|
* |
8
|
|
|
* @package Picqer\Financials\Exact |
9
|
|
|
* @see https://start.exactonline.nl/docs/HlpRestAPIResourcesDetails.aspx?name=CRMQuotations |
10
|
|
|
* |
11
|
|
|
* @property Guid $QuotationID Identifier of the quotation |
12
|
|
|
* @property Double $AmountDC Amount in the default currency of the company |
13
|
|
|
* @property Double $AmountFC Amount in the currency of the transaction |
14
|
|
|
* @property DateTime $CloseDate Date on which the customer accepted or rejected the quotation version |
15
|
|
|
* @property DateTime $ClosingDate Date on which you expect to close/win the deal |
16
|
|
|
* @property DateTime $Created Date and time on which the quotation was created |
17
|
|
|
* @property Guid $Creator User ID of the creator |
18
|
|
|
* @property String $CreatorFullName Name of the creator |
19
|
|
|
* @property String $Currency The currency of the quotation |
20
|
|
|
* @property Guid $DeliveryAccount The account where the items should delivered |
21
|
|
|
* @property String $DeliveryAccountCode The code of the delivery account |
22
|
|
|
* @property Guid $DeliveryAccountContact The contact person of the delivery account |
23
|
|
|
* @property String $DeliveryAccountContactFullName Full name of the delivery account contact person |
24
|
|
|
* @property String $DeliveryAccountName The name of the delivery account |
25
|
|
|
* @property Guid $DeliveryAddress The id of the delivery address |
26
|
|
|
* @property String $Description The description of the quotation |
27
|
|
|
* @property Int32 $Division Division code |
28
|
|
|
* @property Guid $Document Document linked to the quotation |
29
|
|
|
* @property String $DocumentSubject The subject of the document |
30
|
|
|
* @property DateTime $DueDate Date after which the quotation is no longer valid |
31
|
|
|
* @property Guid $InvoiceAccount The account to which the invoice is sent |
32
|
|
|
* @property String $InvoiceAccountCode The code of the invoice account |
33
|
|
|
* @property Guid $InvoiceAccountContact The contact person of the invoice account |
34
|
|
|
* @property String $InvoiceAccountContactFullName Full name of the invoice account contact person |
35
|
|
|
* @property String $InvoiceAccountName The name of the invoice account |
36
|
|
|
* @property DateTime $Modified Date and time on which the quotation was last modified |
37
|
|
|
* @property Guid $Modifier User ID of the modifier |
38
|
|
|
* @property String $ModifierFullName Name of the modifier |
39
|
|
|
* @property Guid $Opportunity Opportunity linked to the quotation |
40
|
|
|
* @property String $OpportunityName The name of the opportunity |
41
|
|
|
* @property Guid $OrderAccount The account that requested the quotation |
42
|
|
|
* @property String $OrderAccountCode The code of the order account |
43
|
|
|
* @property Guid $OrderAccountContact The contact person of the order account |
44
|
|
|
* @property String $OrderAccountContactFullName Full name of the order account contact person |
45
|
|
|
* @property String $OrderAccountName The name of the order account |
46
|
|
|
* @property Guid $Project The project linked to the quotation |
47
|
|
|
* @property String $ProjectCode The code of the project |
48
|
|
|
* @property String $ProjectDescription The description of the project |
49
|
|
|
* @property DateTime $QuotationDate Date on which the quotation version is entered or printed. Both during entering and printing this date can be adjusted |
50
|
|
|
* @property QuotationLines $QuotationLines The collection of quotation lines |
51
|
|
|
* @property Int32 $QuotationNumber Unique number to indentify the quotation. By default this number is based on the setting for first available number |
52
|
|
|
* @property String $Remarks Extra text that can be added to the quotation |
53
|
|
|
* @property Guid $SalesPerson The user that is responsible for the quotation version |
54
|
|
|
* @property String $SalesPersonFullName Full name of the sales person |
55
|
|
|
* @property Int16 $Status The status of the quotation version. 5 = Rejected, 6 = Reviewed and closed, 10 = Recovery, 20 = Draft, 25 = Open, 35 = Processing... , 40 = Printed, 50 = Accepted |
56
|
|
|
* @property String $StatusDescription The description of the status |
57
|
|
|
* @property Double $VATAmountFC Total VAT amount in the currency of the transaction |
58
|
|
|
* @property Int32 $VersionNumber Number indicating the different reviews which are made for the quotation |
59
|
|
|
* @property String $YourRef The number by which this quotation is identified by the order account |
60
|
|
|
*/ |
61
|
|
View Code Duplication |
class Quotation extends Model |
|
|
|
|
62
|
|
|
{ |
63
|
|
|
|
64
|
|
|
use Query\Findable; |
65
|
|
|
use Persistance\Storable; |
66
|
|
|
|
67
|
|
|
protected $primaryKey = 'QuotationID'; |
68
|
|
|
|
69
|
|
|
protected $fillable = [ |
70
|
|
|
'QuotationID', |
71
|
|
|
'AmountDC', |
72
|
|
|
'AmountFC', |
73
|
|
|
'CloseDate', |
74
|
|
|
'ClosingDate', |
75
|
|
|
'Created', |
76
|
|
|
'Creator', |
77
|
|
|
'CreatorFullName', |
78
|
|
|
'Currency', |
79
|
|
|
'DeliveryAccount', |
80
|
|
|
'DeliveryAccountCode', |
81
|
|
|
'DeliveryAccountContact', |
82
|
|
|
'DeliveryAccountContactFullName', |
83
|
|
|
'DeliveryAccountName', |
84
|
|
|
'DeliveryAddress', |
85
|
|
|
'Description', |
86
|
|
|
'Division', |
87
|
|
|
'Document', |
88
|
|
|
'DocumentSubject', |
89
|
|
|
'DueDate', |
90
|
|
|
'InvoiceAccount', |
91
|
|
|
'InvoiceAccountCode', |
92
|
|
|
'InvoiceAccountContact', |
93
|
|
|
'InvoiceAccountContactFullName', |
94
|
|
|
'InvoiceAccountName', |
95
|
|
|
'Modified', |
96
|
|
|
'Modifier', |
97
|
|
|
'ModifierFullName', |
98
|
|
|
'Opportunity', |
99
|
|
|
'OpportunityName', |
100
|
|
|
'OrderAccount', |
101
|
|
|
'OrderAccountCode', |
102
|
|
|
'OrderAccountContact', |
103
|
|
|
'OrderAccountContactFullName', |
104
|
|
|
'OrderAccountName', |
105
|
|
|
'Project', |
106
|
|
|
'ProjectCode', |
107
|
|
|
'ProjectDescription', |
108
|
|
|
'QuotationDate', |
109
|
|
|
'QuotationLines', |
110
|
|
|
'QuotationNumber', |
111
|
|
|
'Remarks', |
112
|
|
|
'SalesPerson', |
113
|
|
|
'SalesPersonFullName', |
114
|
|
|
'Status', |
115
|
|
|
'StatusDescription', |
116
|
|
|
'VATAmountFC', |
117
|
|
|
'VersionNumber', |
118
|
|
|
'YourRef', |
119
|
|
|
]; |
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* @param array $array |
123
|
|
|
*/ |
124
|
|
|
public function addItem(array $array) |
125
|
|
|
{ |
126
|
|
|
if (! isset($this->attributes['QuotationLines']) || $this->attributes['QuotationLines'] == null) { |
127
|
|
|
$this->attributes['QuotationLines'] = []; |
128
|
|
|
} |
129
|
|
|
if (! isset($array['LineNumber'])) { |
130
|
|
|
$array['LineNumber'] = count($this->attributes['QuotationLines']) + 1; |
131
|
|
|
} |
132
|
|
|
$this->attributes['QuotationLines'][] = $array; |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
protected $url = 'crm/Quotations'; |
136
|
|
|
} |
137
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.