SUBTOTAL
SUBTOTAL
An interface to the offer table in the database
getContact() : \contact
Get the contact that this offer is linked to
The contact
getAssignments() : array<mixed,\assignment>
Get all assignments for this offer
If something went wrong with the database
An array indexed by id of instances of the assignment class
setInvoiceDate(integer $invoice_date) : boolean
Set the invoice date of the assignment
integer | $invoice_date | The new invoice date for the assignment as a UNIX timestamp |
If something went wrong with the database
True on succes, false on failure
setPaymentReceived(integer $payment_received) : boolean
Set the payment received date of the assignment
integer | $payment_received | The new date the payment has been received as a UNIX timestamp |
If something went wrong with the database
True on succes, false on failure
getInvoiceFile() : \file|null
Get the file that the invoice this offer is linked to
The file, or null if it doesn't exist
setInvoiceFileId(integer $invoice_fileId) : boolean
Set the invoice file id of the assignment
integer | $invoice_fileId | The new invoice file id for the assignment |
If something went wrong with the database
True on succes, false on failure
calculate(integer $what = self::TOTAL, integer $round = 2, boolean $format = true) : float|boolean
Calculate a handy number about the invoice
Subtotal: the sum of the prices of the assignments excl. VAT
VAT: the sum of all the VAT from all the assignments
Total: the sum of subtotal and total
integer | $what | Any of offer::SUBTOTAL, offer::VAT and offer::TOTAL |
integer | $round | How many decimals to round the result on |
boolean | $format | Whether to format the number nicely (for output) or not (for calculations) |
If something went wrong with the database
The calculated value rounded to $round decimals, or false on incorrect input
delete() : boolean
Remove this offer from the database
If this doesn't succeed (i.e. false is returned), that means the offer was removed manually or by another instance of this class
If something went wrong with the database
True on success, false on failure
createAssignment(string $title, string $description, integer $hours, float $price_per_hour, float $vat) : \assignment
Make a new assignment linked to this order
string | $title | The title for this assignment |
string | $description | The description for this assignment |
integer | $hours | The amount of hours to work on this assignment |
float | $price_per_hour | The price per hour on this assignment |
float | $vat | The VAT percentage (so, 21 for 21%, not 0.21!) |
If something went wrong with the database
If there was a problem with the input
A new instance of the assignment class containing the new assignment
generateInvoice() : \file
Generate a PDF invoice
If something went wrong with the database
If the file could not be written or an other error occured
An instance of the file class with information on the invoice file generated