Example #1
0
				$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/contracts/contract_detail&view_invoice=1&id_contract=".$id."&id=".$invoice['id_company']."&op=invoices&id_invoice=". $invoice["id"];

				$data[0] = "<a href='$url'>".$invoice["bill_id"]."</a>";

				$data[2] = format_numeric(get_invoice_amount ($invoice["id"])) ." ". strtoupper ($invoice["currency"]);

				$tax = get_invoice_tax_sum ($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>";
				
				array_push ($table->data, $data);
			}	
			print_table ($table);
			
		}
Example #2
0
}

// ACL
if (!isset($permission)) {
	$id_company = get_db_value("id_company", "tinvoice", "id", $id_invoice);
	$permission = check_crm_acl ('invoice', '', $config['id_user'], $id_company);
}
if (!$permission) {
	audit_db ($config['id_user'], $config["REMOTE_ADDR"], "ACL Violation", "Trying to access to an invoice view without permission");
	no_permission();
} // ACL

$company_to = get_db_row ("tcompany", "id", $invoice["id_company"]);
$tax2 = get_db_value ('tax', 'tinvoice', 'id', $id_invoice);
$amount = get_invoice_amount ($id_invoice);
$tax = get_invoice_tax_sum ($id_invoice);

$irpf = get_invoice_irpf($id_invoice);
$tax_name = get_invoice_tax_name ($id_invoice);
$discount_before = get_invoice_discount_before ($id_invoice);
$concept_discount_before = get_concept_invoice_discount_before ($id_invoice);
$concept_retention = get_invoice_concept_retention($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
$irpf_amount = $total_before * ($irpf/100);
$total = round($total_before + $tax_amount - $irpf_amount, 2);