$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&sec2=operation/invoices/invoice_view &id_invoice=' . $invoice["id"] . '&clean_output=1&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'); } else {
} } $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
if ($is_locked) { $locked_id_user = crm_get_invoice_locked_id_user ($invoice["id"]); } $data = array (); if ($invoice["id_company"] != 0){ $company_name = get_db_value ("name", "tcompany", "id", $invoice["id_company"]); $data[0] = "<a href='index.php?sec=customers&sec2=operation/companies/company_detail&view_invoice=1&id=".$invoice["id_company"]."&op=invoices&id_invoice=".$invoice["id"]."'>".$company_name."</a>"; } else { $data[0] = __("N/A"); } $id_title = $invoice["concept1"]; $data[1] = "<a title='$id_title' href='index.php?sec=customers&sec2=operation/companies/company_detail&view_invoice=1&id=".$invoice["id_company"]."&op=invoices&id_invoice=".$invoice["id"]."'>".$invoice["bill_id"]."</a>"; $amount = get_invoice_amount ($invoice["id"]); $discount_before = get_invoice_discount_before ($invoice["id"]); $tax = get_invoice_tax ($invoice["id"]); $taxlength = count($tax); $contador = 1; $result = 0; foreach ( $tax as $key => $campo) { $result = $result + $campo; $contador++; } $tax = $result; $irpf = get_invoice_irpf($invoice["id"]); //~ Descuento sobre el total $before_amount = $amount * ($discount_before/100); $total_before = round($amount - $before_amount, 2);
// $costs = array (); if(isset($cost)){ $table->class = 'listing'; $table->width = '100%'; $table->data = array (); $table->head = array (); $table->head[0] = __('Description'); $table->head[1] = __('Amount'); $table->head[2] = __('Filename'); $table->head[3] = __('Delete'); foreach ($costs as $cost) { $data = array (); $data[0] = $cost["description"]; $data[1] = get_invoice_amount($cost["id"]);// Check $id_invoice = $cost["id"]; $filename = get_db_sql ("SELECT filename FROM tattachment WHERE id_attachment = ". $cost["id_attachment"]); $data[2] = "<a href='".$config["base_url"]."/attachment/".$cost["id_attachment"]."_".$filename."'>$filename</a>"; if (($config["id_user"] = $cost["id_user"]) OR (project_manager_check ($id_project))){ $data[3] = "<a href='index.php?sec=projects&sec2=operation/projects/task_cost&id_task=$id_task&id_project=$id_project&operation=delete&id_invoice=$id_invoice '><img src='images/cross.png'></a>"; } array_push ($table->data, $data); } print_table ($table); } else { echo ui_print_error_message(__('No data found'), '', true, 'h3', true);