PurchaseEntry   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 68
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 56
c 1
b 0
f 0
dl 0
loc 68
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 PurchaseEntry.
7
 *
8
 * @see https://start.exactonline.nl/docs/HlpRestAPIResourcesDetails.aspx?name=PurchaseEntryPurchaseEntries
9
 *
10
 * @property string $EntryID Primary key
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 int $BatchNumber Batch number
14
 * @property string $Created Creation date
15
 * @property string $Creator User ID of creator
16
 * @property string $CreatorFullName Name of creator
17
 * @property string $Currency Currency code
18
 * @property string $Description Description
19
 * @property int $Division Division code
20
 * @property string $Document Reference to document
21
 * @property int $DocumentNumber Document number
22
 * @property string $DocumentSubject Document subject
23
 * @property string $DueDate Date when payment should be done
24
 * @property string $EntryDate Entry date
25
 * @property int $EntryNumber Entry number
26
 * @property string $ExternalLinkDescription Description of ExternalLink
27
 * @property string $ExternalLinkReference External link
28
 * @property float $GAccountAmountFC A positive value of the amount indicates that the amount is to be paid to the suppliers G bank account.In case of a credit invoice the amount should have negative value when retrieved or posted to Exact.
29
 * @property int $InvoiceNumber Invoice number
30
 * @property string $Journal Journal
31
 * @property string $JournalDescription Description of Journal
32
 * @property string $Modified Last modified date
33
 * @property string $Modifier User ID of modifier
34
 * @property string $ModifierFullName Name of modifier
35
 * @property int $OrderNumber Order number
36
 * @property string $PaymentCondition Payment condition
37
 * @property string $PaymentConditionDescription Description of PaymentCondition
38
 * @property string $PaymentReference The payment reference used for bank imports, VAT return and Tax reference
39
 * @property int $ProcessNumber
40
 * @property array $PurchaseEntryLines Collection of lines
41
 * @property float $Rate Currency exchange rate
42
 * @property int $ReportingPeriod Reporting period
43
 * @property int $ReportingYear Reporting year
44
 * @property bool $Reversal Indicates that amounts are reversed
45
 * @property int $Status Status: 5 = Rejected, 20 = Open, 50 = Processed
46
 * @property string $StatusDescription Description of Status
47
 * @property string $Supplier Reference to supplier (account)
48
 * @property string $SupplierName Name of supplier
49
 * @property int $Type Type: 30 = Purchase entry, 31 = Purchase credit note
50
 * @property string $TypeDescription Description of Type
51
 * @property float $VATAmountDC Vat Amount in the default currency of the company
52
 * @property float $VATAmountFC Vat Amount in the currency of the transaction
53
 * @property string $YourRef Your reference
54
 */
55
class PurchaseEntry extends Model
56
{
57
    use Query\Findable;
58
    use Persistance\Storable;
59
60
    protected $primaryKey = 'EntryID';
61
62
    protected $purchaseEntryLines = [];
63
64
    protected $fillable = [
65
        'EntryID',
66
        'AmountDC',
67
        'AmountFC',
68
        'BatchNumber',
69
        'Created',
70
        'Creator',
71
        'CreatorFullName',
72
        'Currency',
73
        'Description',
74
        'Division',
75
        'Document',
76
        'DocumentNumber',
77
        'DocumentSubject',
78
        'DueDate',
79
        'EntryDate',
80
        'EntryNumber',
81
        'ExternalLinkDescription',
82
        'ExternalLinkReference',
83
        'GAccountAmountFC',
84
        'InvoiceNumber',
85
        'Journal',
86
        'JournalDescription',
87
        'Modified',
88
        'Modifier',
89
        'ModifierFullName',
90
        'OrderNumber',
91
        'PaymentCondition',
92
        'PaymentConditionDescription',
93
        'PaymentReference',
94
        'ProcessNumber',
95
        'PurchaseEntryLines',
96
        'Rate',
97
        'ReportingPeriod',
98
        'ReportingYear',
99
        'Reversal',
100
        'Status',
101
        'StatusDescription',
102
        'Supplier',
103
        'SupplierName',
104
        'Type',
105
        'TypeDescription',
106
        'VATAmountDC',
107
        'VATAmountFC',
108
        'YourRef',
109
    ];
110
111
    public function addItem(array $array)
112
    {
113
        if (! isset($this->attributes['PurchaseEntryLines']) || $this->attributes['PurchaseEntryLines'] == null) {
114
            $this->attributes['PurchaseEntryLines'] = [];
115
        }
116
        if (! isset($array['LineNumber'])) {
117
            $array['LineNumber'] = count($this->attributes['PurchaseEntryLines']) + 1;
118
        }
119
        $this->attributes['PurchaseEntryLines'][] = $array;
120
    }
121
122
    protected $url = 'purchaseentry/PurchaseEntries';
123
}
124