1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Picqer\Financials\Exact; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* Class PurchaseOrder. |
7
|
|
|
* |
8
|
|
|
* @see https://start.exactonline.nl/docs/HlpRestAPIResourcesDetails.aspx?name=PurchaseOrderPurchaseOrders |
9
|
|
|
* |
10
|
|
|
* @property string $PurchaseOrderID Primary key |
11
|
|
|
* @property float $AmountDC Total amount in the default currency of the company |
12
|
|
|
* @property float $AmountFC Total amount in the currency of the transaction |
13
|
|
|
* @property string $Created Creation date |
14
|
|
|
* @property string $Creator User ID of creator |
15
|
|
|
* @property string $CreatorFullName Name of creator |
16
|
|
|
* @property string $Currency Currency code |
17
|
|
|
* @property string $DeliveryAccount Reference to account for delivery |
18
|
|
|
* @property string $DeliveryAccountCode Delivery account code |
19
|
|
|
* @property string $DeliveryAccountName Account name |
20
|
|
|
* @property string $DeliveryAddress Reference to shipping address |
21
|
|
|
* @property string $DeliveryContact Reference to contact for delivery |
22
|
|
|
* @property string $DeliveryContactPersonFullName Name of the contact person of the customer who will receive delivered goods |
23
|
|
|
* @property string $Description Description of the purchase order |
24
|
|
|
* @property int $Division Division code |
25
|
|
|
* @property string $Document Document that is manually linked to the purchase order |
26
|
|
|
* @property string $DocumentSubject Subject of the document |
27
|
|
|
* @property bool $DropShipment Shows if it is a drop shipment purchase order |
28
|
|
|
* @property float $ExchangeRate Allows you to set the currency for the invoice. You can only do this if you have checked the Variable: Currency and Variable: Exchange rate fields in the sales journal settings. Once a line has been created in the invoice, the currency can no longer be changed. |
29
|
|
|
* @property int $InvoiceStatus Invoice status of purchase order: 10-Open, 20-Partial, 30-Complete, 40-Canceled |
30
|
|
|
* @property string $Modified Last modified date |
31
|
|
|
* @property string $Modifier User ID of modifier |
32
|
|
|
* @property string $ModifierFullName Name of modifier |
33
|
|
|
* @property string $OrderDate Order date |
34
|
|
|
* @property int $OrderNumber Human readable id of the purchase order |
35
|
|
|
* @property int $OrderStatus Purchase order status: 10-Open, 20-Partial, 30-Complete, 40-Canceled |
36
|
|
|
* @property string $PaymentCondition The payment condition code used for due date and discount calculation |
37
|
|
|
* @property string $PaymentConditionDescription Description of payment condition |
38
|
|
|
* @property string $PurchaseAgent Purchase agent |
39
|
|
|
* @property string $PurchaseAgentFullName Name of purchase agent |
40
|
|
|
* @property PurchaseOrderLines $PurchaseOrderLines Collection of lines |
41
|
|
|
* @property string $ReceiptDate This field shows the date the goods are expected to be received. |
42
|
|
|
* @property int $ReceiptStatus Receipt status of purchase order: 10-Open, 20-Partial, 30-Complete, 40-Canceled |
43
|
|
|
* @property string $Remarks Include any relevant remarks regarding the purchase order. |
44
|
|
|
* @property string $SalesOrder Reference to sales order when purchase order generated via back to back sales order |
45
|
|
|
* @property int $SalesOrderNumber Number of the sales order |
46
|
|
|
* @property string $ShippingMethod ShippingMethod |
47
|
|
|
* @property string $ShippingMethodDescription Description of ShippingMethod |
48
|
|
|
* @property int $Source This shows how the purchase order was created: 1-Manual entry, 2-Import, 3-Other, 4-Purchase order, 5-Sales order, 6-Supplier's items, 7-Subcontract, 8-Purchase order advice, 9-Shop order, 10-MRP calculation |
49
|
|
|
* @property string $Supplier Reference to supplier account |
50
|
|
|
* @property string $SupplierCode Code of supplier |
51
|
|
|
* @property string $SupplierContact Contact of supplier |
52
|
|
|
* @property string $SupplierContactPersonFullName Contact person full name of supplier |
53
|
|
|
* @property string $SupplierName Name of supplier |
54
|
|
|
* @property float $VATAmount Total VAT amount in the currency of the transaction |
55
|
|
|
* @property string $Warehouse Warehouse |
56
|
|
|
* @property string $WarehouseCode Code of Warehouse |
57
|
|
|
* @property string $WarehouseDescription Description of Warehouse |
58
|
|
|
* @property string $YourRef Shows the reference number associated with the purchase order. Enter a description and reference to make the purchase order easier to identify. |
59
|
|
|
*/ |
60
|
|
|
class PurchaseOrder extends Model |
61
|
|
|
{ |
62
|
|
|
use Query\Findable; |
63
|
|
|
use Persistance\Storable; |
64
|
|
|
|
65
|
|
|
protected $primaryKey = 'PurchaseOrderID'; |
66
|
|
|
|
67
|
|
|
protected $purchaseOrderLines = []; |
68
|
|
|
|
69
|
|
|
protected $fillable = [ |
70
|
|
|
'PurchaseOrderID', |
71
|
|
|
'AmountDC', |
72
|
|
|
'AmountFC', |
73
|
|
|
'Created', |
74
|
|
|
'Creator', |
75
|
|
|
'CreatorFullName', |
76
|
|
|
'Currency', |
77
|
|
|
'DeliveryAccount', |
78
|
|
|
'DeliveryAccountCode', |
79
|
|
|
'DeliveryAccountName', |
80
|
|
|
'DeliveryAddress', |
81
|
|
|
'DeliveryContact', |
82
|
|
|
'DeliveryContactPersonFullName', |
83
|
|
|
'Description', |
84
|
|
|
'Division', |
85
|
|
|
'Document', |
86
|
|
|
'DocumentSubject', |
87
|
|
|
'DropShipment', |
88
|
|
|
'ExchangeRate', |
89
|
|
|
'InvoiceStatus', |
90
|
|
|
'Modified', |
91
|
|
|
'Modifier', |
92
|
|
|
'ModifierFullName', |
93
|
|
|
'OrderDate', |
94
|
|
|
'OrderNumber', |
95
|
|
|
'OrderStatus', |
96
|
|
|
'PaymentCondition', |
97
|
|
|
'PaymentConditionDescription', |
98
|
|
|
'PurchaseAgent', |
99
|
|
|
'PurchaseAgentFullName', |
100
|
|
|
'PurchaseOrderLines', |
101
|
|
|
'ReceiptDate', |
102
|
|
|
'ReceiptStatus', |
103
|
|
|
'Remarks', |
104
|
|
|
'SalesOrder', |
105
|
|
|
'SalesOrderNumber', |
106
|
|
|
'ShippingMethod', |
107
|
|
|
'ShippingMethodDescription', |
108
|
|
|
'Source', |
109
|
|
|
'Supplier', |
110
|
|
|
'SupplierCode', |
111
|
|
|
'SupplierContact', |
112
|
|
|
'SupplierContactPersonFullName', |
113
|
|
|
'SupplierName', |
114
|
|
|
'VATAmount', |
115
|
|
|
'Warehouse', |
116
|
|
|
'WarehouseCode', |
117
|
|
|
'WarehouseDescription', |
118
|
|
|
'YourRef', |
119
|
|
|
]; |
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* @param array $array |
123
|
|
|
*/ |
124
|
|
|
public function addItem(array $array) |
125
|
|
|
{ |
126
|
|
|
if (! isset($this->attributes['PurchaseOrderLines']) || $this->attributes['PurchaseOrderLines'] == null) { |
127
|
|
|
$this->attributes['PurchaseOrderLines'] = []; |
128
|
|
|
} |
129
|
|
|
if (! isset($array['LineNumber'])) { |
130
|
|
|
$array['LineNumber'] = count($this->attributes['PurchaseOrderLines']) + 1; |
131
|
|
|
} |
132
|
|
|
$this->attributes['PurchaseOrderLines'][] = $array; |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
protected $url = 'purchaseorder/PurchaseOrders'; |
136
|
|
|
} |
137
|
|
|
|