PrintedSalesInvoice   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
eloc 29
dl 0
loc 46
c 2
b 0
f 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A save() 0 5 1
A insert() 0 3 1
1
<?php
2
3
namespace Picqer\Financials\Exact;
4
5
/**
6
 * Class PrintedSalesInvoice.
7
 *
8
 * @see https://start.exactonline.nl/docs/HlpRestAPIResourcesDetails.aspx?name=SalesInvoicePrintedSalesInvoices
9
 *
10
 * @property string $InvoiceID Primary key, Reference to EntryID of SalesInvoice
11
 * @property int $Division Division code
12
 * @property string $Document Contains the id of the document that was created
13
 * @property string $DocumentCreationError Contains the error message if an error occurred during the creation of the document
14
 * @property string $DocumentCreationSuccess Contains information if a document was succesfully created
15
 * @property string $DocumentLayout Based on this layout a PDF is created and attached to an Exact Online document and an email
16
 * @property string $EmailCreationError Contains the error message if an error occurred during the creation of the email
17
 * @property string $EmailCreationSuccess Contains confirmation that an email was sent. If an email cannot be delivered this property will still show confirmation that the email was sent.
18
 * @property string $EmailLayout Based on this layout the email text is produced
19
 * @property string $ExtraText Extra text that can be added to the printed document and email
20
 * @property string $InvoiceDate Date of the invoice
21
 * @property string $PostboxMessageCreationError Contains the error message if an error occurred during the sending of a postbox message
22
 * @property string $PostboxMessageCreationSuccess Contains information if a postbox message was succesfully sent
23
 * @property string $PostboxSender The postbox from where the message is sent
24
 * @property int $ReportingPeriod Reporting period
25
 * @property int $ReportingYear Reporting year
26
 * @property bool $SendEmailToCustomer Set to True if an email containing the invoice should be sent to the invoice customer. This option overrules SendInvoiceToCustomerPostbox.
27
 * @property string $SenderEmailAddress Email address from which the email will be sent. If not specified, the company email address will be used.
28
 * @property bool $SendInvoiceToCustomerPostbox Set to True if a postbox message containing the invoice should be sent to the invoice customer
29
 * @property bool $SendOutputBasedOnAccount Set to True if the output preference should be taken from the account. It will be either Document only, Email or Digital postbox. This option overrules both SendEmailToCustomer and SendInvoiceToCustomerPostbox.
30
 */
31
class PrintedSalesInvoice extends Model
32
{
33
    use Query\Findable;
34
    use Persistance\Storable;
35
36
    protected $primaryKey = 'InvoiceID';
37
38
    protected $fillable = [
39
        'InvoiceID',
40
        'Division',
41
        'Document',
42
        'DocumentCreationError',
43
        'DocumentCreationSuccess',
44
        'DocumentLayout',
45
        'EmailCreationError',
46
        'EmailCreationSuccess',
47
        'EmailLayout',
48
        'ExtraText',
49
        'InvoiceDate',
50
        'PostboxMessageCreationError',
51
        'PostboxMessageCreationSuccess',
52
        'PostboxSender',
53
        'ReportingPeriod',
54
        'ReportingYear',
55
        'SendEmailToCustomer',
56
        'SenderEmailAddress',
57
        'SendInvoiceToCustomerPostbox',
58
        'SendOutputBasedOnAccount',
59
    ];
60
61
    /**
62
     * @return $this
63
     */
64
    public function save()
65
    {
66
        $this->fill($this->insert());
67
68
        return $this;
69
    }
70
71
    public function insert()
72
    {
73
        return $this->connection()->post($this->url, $this->json(0, true));
74
    }
75
76
    protected $url = 'salesinvoice/PrintedSalesInvoices';
77
}
78