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