Quotation   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 74
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 4
eloc 60
c 2
b 0
f 1
dl 0
loc 74
rs 10

1 Method

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