$hours_value = decimal_time_out($quote_item_data['hours']); } else { $hours_value = number_out($quote_item_data['hours'], true); } $row_replace['item_qty_or_hours'] = $hours_value ? $hours_value : '-'; } if ($quote_item_data['task_hourly_rate'] != 0) { $row_replace['item_amount_or_rate'] = dollar($quote_item_data['task_hourly_rate'], true, $quote['currency_id'], $task_decimal_places_trim, $task_decimal_places); } else { $row_replace['item_amount_or_rate'] = '-'; } $row_replace['item_total'] = dollar($quote_item_data['quote_item_amount'], true, $quote['currency_id']); // taxes per item if (isset($quote_item_data['taxes']) && is_array($quote_item_data['taxes']) && $quote_item_data['taxable'] && class_exists('module_finance', false)) { // this passes off the tax calculation to the 'finance' class, which modifies 'amount' to match the amount of tax applied here. $this_taxes = module_finance::sanatise_taxes($quote_item_data['taxes'], $quote_item_data['quote_item_amount']); $this_taxes_amounts = array(); $this_taxes_rates = array(); if (!count($this_taxes)) { $this_taxes = array('amount' => 0, 'percent' => 0); } foreach ($this_taxes as $this_tax) { $this_taxes_amounts[] = dollar($this_tax['amount'], true, $quote['currency_id']); $this_taxes_rates[] = $this_tax['percent'] . '%'; } $row_replace['item_tax'] = implode(', ', $this_taxes_amounts); $row_replace['item_tax_rate'] = implode(', ', $this_taxes_rates); } $this_item_row_html = $item_row_html; $this_item_row_html = str_replace(' data-item-row="true"', '', $this_item_row_html); // we pass this through the template system so we can make use of things like arithmatic.
} if ($invoice_item_data['task_hourly_rate'] != 0) { $row_replace['item_amount_or_rate'] = dollar($invoice_item_data['task_hourly_rate'], true, $invoice['currency_id'], $task_decimal_places_trim, $task_decimal_places); } else { $row_replace['item_amount_or_rate'] = '-'; } $row_replace['item_total'] = dollar($invoice_item_data['invoice_item_amount'], true, $invoice['currency_id']); // taxes per item if (isset($invoice_item_data['taxes']) && is_array($invoice_item_data['taxes']) && $invoice_item_data['taxable'] && class_exists('module_finance', false)) { // this passes off the tax calculation to the 'finance' class, which modifies 'amount' to match the amount of tax applied here. foreach ($invoice_item_data['taxes'] as $key => $val) { if (isset($val['amount'])) { unset($invoice_item_data['taxes'][$key]['amount']); } } $this_taxes = module_finance::sanatise_taxes($invoice_item_data['taxes'], $invoice_item_data['invoice_item_amount']); $this_taxes_amounts = array(); $this_taxes_rates = array(); if (!count($this_taxes)) { $this_taxes = array('amount' => 0, 'percent' => 0); } foreach ($this_taxes as $this_tax) { $this_taxes_amounts[] = dollar($this_tax['amount'], true, $invoice['currency_id']); $this_taxes_rates[] = $this_tax['percent'] . '%'; } $row_replace['item_tax'] = implode(', ', $this_taxes_amounts); $row_replace['item_tax_rate'] = implode(', ', $this_taxes_rates); } $this_item_row_html = $item_row_html; $this_item_row_html = str_replace(' data-item-row="true"', '', $this_item_row_html); // we pass this through the template system so we can make use of things like arithmatic.