1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Picqer\Financials\Exact; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* Class SalesOrder. |
7
|
|
|
* |
8
|
|
|
* @see https://start.exactonline.nl/docs/HlpRestAPIResourcesDetails.aspx?name=SalesOrderSalesOrders |
9
|
|
|
* |
10
|
|
|
* @property string $OrderID Primary key |
11
|
|
|
* @property float $AmountDC Amount in the default currency of the company |
12
|
|
|
* @property float $AmountDiscount Discount amount in the default currency of the company |
13
|
|
|
* @property float $AmountDiscountExclVat Discount amount excluding VAT in the default currency of the company |
14
|
|
|
* @property float $AmountFC Amount in the currency of the transaction |
15
|
|
|
* @property float $AmountFCExclVat Amount exclude VAT in the currency of the transaction |
16
|
|
|
* @property int $ApprovalStatus Shows if this sales order is approved |
17
|
|
|
* @property string $ApprovalStatusDescription Description of ApprovalStatus |
18
|
|
|
* @property string $Approved Approval datetime |
19
|
|
|
* @property string $Approver User who approved the sales order |
20
|
|
|
* @property string $ApproverFullName Name of approver |
21
|
|
|
* @property string $Created Creation date |
22
|
|
|
* @property string $Creator User ID of creator |
23
|
|
|
* @property string $CreatorFullName Name of creator |
24
|
|
|
* @property string $Currency Currency code |
25
|
|
|
* @property string $DeliverTo Reference to the delivery customer. For an existing sales order this value can not be changed. |
26
|
|
|
* @property string $DeliverToContactPerson Reference to contact person of delivery customer |
27
|
|
|
* @property string $DeliverToContactPersonFullName Name of contact person of delivery customer |
28
|
|
|
* @property string $DeliverToName Name of delivery customer |
29
|
|
|
* @property string $DeliveryAddress Delivery address |
30
|
|
|
* @property string $DeliveryDate Delivery date |
31
|
|
|
* @property int $DeliveryStatus Shipping status |
32
|
|
|
* @property string $DeliveryStatusDescription Description of DeliveryStatus |
33
|
|
|
* @property string $Description Description |
34
|
|
|
* @property float $Discount Discount percentage |
35
|
|
|
* @property int $Division Division code |
36
|
|
|
* @property string $Document Document that is manually linked to the sales order |
37
|
|
|
* @property int $DocumentNumber Number of the document |
38
|
|
|
* @property string $DocumentSubject Subject of the document |
39
|
|
|
* @property int $InvoiceStatus Invoice status |
40
|
|
|
* @property string $InvoiceStatusDescription Description of InvoiceStatus |
41
|
|
|
* @property string $InvoiceTo Reference to the customer who will receive the invoice. For an existing sales order this value can not be changed. |
42
|
|
|
* @property string $InvoiceToContactPerson Reference to the contact person of the customer who will receive the invoice |
43
|
|
|
* @property string $InvoiceToContactPersonFullName Name of the contact person of the customer who will receive the invoice |
44
|
|
|
* @property string $InvoiceToName Name of the customer who will receive the invoice |
45
|
|
|
* @property string $Modified Last modified date |
46
|
|
|
* @property string $Modifier User ID of modifier |
47
|
|
|
* @property string $ModifierFullName Name of modifier |
48
|
|
|
* @property string $OrderDate Order date |
49
|
|
|
* @property string $OrderedBy Customer who ordered the sales order. For an existing sales order this value can not be changed. |
50
|
|
|
* @property string $OrderedByContactPerson Contact person of the customer who ordered the sales order |
51
|
|
|
* @property string $OrderedByContactPersonFullName Name of contact person of the customer who ordered the sales order |
52
|
|
|
* @property string $OrderedByName Name of the customer who ordered the sales order |
53
|
|
|
* @property int $OrderNumber Number of sales order |
54
|
|
|
* @property string $PaymentCondition The payment condition used for due date and discount calculation |
55
|
|
|
* @property string $PaymentConditionDescription Description of PaymentCondition |
56
|
|
|
* @property string $PaymentReference Payment reference for sales order |
57
|
|
|
* @property string $Remarks Extra remarks |
58
|
|
|
* @property salesorderlines $SalesOrderLines Collection of lines |
59
|
|
|
* @property string $Salesperson Sales representative |
60
|
|
|
* @property string $SalespersonFullName Name of sales representative |
61
|
|
|
* @property string $ShippingMethod ShippingMethod |
62
|
|
|
* @property string $ShippingMethodDescription Description of ShippingMethod |
63
|
|
|
* @property int $Status The status of the sales order. 12 = Open, 20 = Partial, 21 = Complete, 45 = Cancelled. |
64
|
|
|
* @property string $StatusDescription Description of Status |
65
|
|
|
* @property string $TaxSchedule Obsolete |
66
|
|
|
* @property string $TaxScheduleCode Obsolete |
67
|
|
|
* @property string $TaxScheduleDescription Obsolete |
68
|
|
|
* @property string $WarehouseCode Code of Warehouse |
69
|
|
|
* @property string $WarehouseDescription Description of Warehouse |
70
|
|
|
* @property string $WarehouseID Warehouse |
71
|
|
|
* @property string $YourRef The reference number of the customer |
72
|
|
|
*/ |
73
|
|
|
class SalesOrder extends Model |
74
|
|
|
{ |
75
|
|
|
use Query\Findable; |
76
|
|
|
use Persistance\Storable; |
77
|
|
|
|
78
|
|
|
protected $primaryKey = 'OrderID'; |
79
|
|
|
|
80
|
|
|
protected $saleOrderLines = []; |
81
|
|
|
|
82
|
|
|
protected $fillable = [ |
83
|
|
|
'OrderID', |
84
|
|
|
'AmountDC', |
85
|
|
|
'AmountDiscount', |
86
|
|
|
'AmountDiscountExclVat', |
87
|
|
|
'AmountFC', |
88
|
|
|
'AmountFCExclVat', |
89
|
|
|
'ApprovalStatus', |
90
|
|
|
'ApprovalStatusDescription', |
91
|
|
|
'Approved', |
92
|
|
|
'Approver', |
93
|
|
|
'ApproverFullName', |
94
|
|
|
'Created', |
95
|
|
|
'Creator', |
96
|
|
|
'CreatorFullName', |
97
|
|
|
'Currency', |
98
|
|
|
'DeliverTo', |
99
|
|
|
'DeliverToContactPerson', |
100
|
|
|
'DeliverToContactPersonFullName', |
101
|
|
|
'DeliverToName', |
102
|
|
|
'DeliveryAddress', |
103
|
|
|
'DeliveryDate', |
104
|
|
|
'DeliveryStatus', |
105
|
|
|
'DeliveryStatusDescription', |
106
|
|
|
'Description', |
107
|
|
|
'Discount', |
108
|
|
|
'Division', |
109
|
|
|
'Document', |
110
|
|
|
'DocumentNumber', |
111
|
|
|
'DocumentSubject', |
112
|
|
|
'InvoiceStatus', |
113
|
|
|
'InvoiceStatusDescription', |
114
|
|
|
'InvoiceTo', |
115
|
|
|
'InvoiceToContactPerson', |
116
|
|
|
'InvoiceToContactPersonFullName', |
117
|
|
|
'InvoiceToName', |
118
|
|
|
'Modified', |
119
|
|
|
'Modifier', |
120
|
|
|
'ModifierFullName', |
121
|
|
|
'OrderDate', |
122
|
|
|
'OrderedBy', |
123
|
|
|
'OrderedByContactPerson', |
124
|
|
|
'OrderedByContactPersonFullName', |
125
|
|
|
'OrderedByName', |
126
|
|
|
'OrderNumber', |
127
|
|
|
'PaymentCondition', |
128
|
|
|
'PaymentConditionDescription', |
129
|
|
|
'PaymentReference', |
130
|
|
|
'Remarks', |
131
|
|
|
'SalesOrderLines', |
132
|
|
|
'Salesperson', |
133
|
|
|
'SalespersonFullName', |
134
|
|
|
'ShippingMethod', |
135
|
|
|
'ShippingMethodDescription', |
136
|
|
|
'Status', |
137
|
|
|
'StatusDescription', |
138
|
|
|
'TaxSchedule', |
139
|
|
|
'TaxScheduleCode', |
140
|
|
|
'TaxScheduleDescription', |
141
|
|
|
'WarehouseCode', |
142
|
|
|
'WarehouseDescription', |
143
|
|
|
'WarehouseID', |
144
|
|
|
'YourRef', |
145
|
|
|
]; |
146
|
|
|
|
147
|
|
|
/** |
148
|
|
|
* @param array $array |
149
|
|
|
*/ |
150
|
|
|
public function addItem(array $array) |
151
|
|
|
{ |
152
|
|
|
if (! isset($this->attributes['SalesOrderLines']) || $this->attributes['SalesOrderLines'] == null) { |
153
|
|
|
$this->attributes['SalesOrderLines'] = []; |
154
|
|
|
} |
155
|
|
|
if (! isset($array['LineNumber'])) { |
156
|
|
|
$array['LineNumber'] = count($this->attributes['SalesOrderLines']) + 1; |
157
|
|
|
} |
158
|
|
|
$this->attributes['SalesOrderLines'][] = $array; |
159
|
|
|
} |
160
|
|
|
|
161
|
|
|
protected $url = 'salesorder/SalesOrders'; |
162
|
|
|
} |
163
|
|
|
|