Example #1
0
		$contcampo2++;
	}
}

$table->data[13][0] = print_input_text ('irpf', $irpf, '', 5, 20, true, __('Retention (%)'));
$table->data[13][1] = print_input_text ('concept_irpf', $concept_irpf, '', 20, 50, true, __('Concept Retention'));
$table->data[14][0] = print_input_text ('currency', $currency, '', 3, 3, true, __('Currency'));

echo '<div id="msg_ok_hidden" style="display:none;">';
	echo '<h3 class="suc">'.__('Custom search saved').'</h3>';
echo '</div>';

if ($id_invoice != -1) {
	$amount = get_invoice_amount ($id_invoice);
	$discount_before = get_invoice_discount_before ($id_invoice);
	$tax = get_invoice_tax ($id_invoice);
	$taxlength = count($tax);
	$contador = 1;
	$result = 0;
	foreach ( $tax as $key => $campo) { 
		$result = $result + $campo;
		$contador++;
	}
	$tax = $result;
	$irpf = get_invoice_irpf($id_invoice);
	//~ Descuento sobre el total
	$before_amount = $amount * ($discount_before/100);
	$total_before = round($amount - $before_amount, 2);
	//~ Se aplica sobre el descuento los task 
	$tax_amount = $total_before * ($tax/100);
	//~ Se aplica sobre el descuento el irpf
Example #2
0
            $table->head[7] = __('Options');
            $counter = 0;
            $company = get_db_row('tcompany', 'id', $id);
            foreach ($invoices as $invoice) {
                $lock_permission = crm_check_lock_permission($config["id_user"], $invoice["id"]);
                $is_locked = crm_is_invoice_locked($invoice["id"]);
                $locked_id_user = false;
                if ($is_locked) {
                    $locked_id_user = crm_get_invoice_locked_id_user($invoice["id"]);
                }
                $data = array();
                $url = "index.php?sec=customers&sec2=operation/companies/company_detail&view_invoice=1&id=" . $id . "&op=invoices&id_invoice=" . $invoice["id"];
                $data[0] = "<a href='{$url}'>" . $invoice["bill_id"] . "</a>";
                //$data[1] = "<a href='$url'>".$invoice["description"]."</a>";
                $data[2] = format_numeric(get_invoice_amount($invoice["id"])) . " " . strtoupper($invoice["currency"]);
                $tax = get_invoice_tax($invoice["id"]);
                $tax_amount = get_invoice_amount($invoice["id"]) * (1 + $tax / 100);
                if ($tax != 0) {
                    $data[2] .= print_help_tip(__("With taxes") . ": " . format_numeric($tax_amount), true);
                }
                $data[3] = __($invoice["invoice_type"]);
                $data[4] = __($invoice["status"]);
                $data[5] = "<span style='font-size: 10px'>" . $invoice["invoice_create_date"] . "</span>";
                $data[6] = "<span style='font-size: 10px'>" . $invoice["invoice_expiration_date"] . "</span>";
                $data[7] = '<a href="index.php?sec=users&amp;sec2=operation/invoices/invoice_view
					&amp;id_invoice=' . $invoice["id"] . '&amp;clean_output=1&amp;pdf_output=1&language=' . $invoice['id_language'] . '">
					<img src="images/page_white_acrobat.png" title="' . __('Export to PDF') . '"></a>';
                if ($lock_permission) {
                    if ($is_locked) {
                        $lock_image = 'lock.png';
                        $title = __('Unlock');
Example #3
0
function get_invoice_amount($id_invoice, $with_taxes = false)
{
    $sum = get_db_value('amount1+amount2+amount3+amount4+amount5', 'tinvoice', 'id', $id_invoice);
    if ($with_taxes && $sum) {
        $tax = get_invoice_tax($id_invoice);
        if ($tax == false) {
            return __('ERROR');
        }
        $sum += $sum * ($tax / 100);
    }
    if ($sum == false) {
        return __('ERROR');
    }
    return $sum;
}