public function getInvoiceLabels()
{
$data = [];
$custom = (array) json_decode($this->invoice_labels);
$fields = ['invoice', 'invoice_date', 'due_date', 'invoice_number', 'po_number', 'discount', 'taxes', 'tax', 'item', 'description', 'unit_cost', 'quantity', 'line_total', 'subtotal', 'paid_to_date', 'balance_due', 'partial_due', 'terms', 'your_invoice', 'quote', 'your_quote', 'quote_date', 'quote_number', 'total', 'invoice_issued_to', 'quote_issued_to', 'rate', 'hours', 'balance', 'from', 'to', 'invoice_to', 'quote_to', 'details', 'invoice_no', 'quote_no', 'valid_until', 'client_name', 'address1', 'address2', 'id_number', 'vat_number', 'city_state_postal', 'country', 'email', 'contact_name', 'company_name', 'website', 'phone', 'blank'];
foreach ($fields as $field) {
if (isset($custom[$field]) && $custom[$field]) {
$data[$field] = $custom[$field];
} else {
$data[$field] = $this->isEnglish() ? uctrans("texts.{$field}") : trans("texts.{$field}");
}
}
foreach (['item', 'quantity', 'unit_cost'] as $field) {
$data["{$field}_orig"] = $data[$field];
}
foreach (['invoice.custom_text_value1' => 'custom_invoice_text_label1', 'invoice.custom_text_value2' => 'custom_invoice_text_label2', 'client.custom_value1' => 'custom_client_label1', 'client.custom_value2' => 'custom_client_label2', 'account.custom_value1' => 'custom_label1', 'account.custom_value2' => 'custom_label2'] as $field => $property) {
$data[$field] = $this->{$property} ?: trans('texts.custom_field');
}
return $data;
}