<img src="images/' . $lock_image . '" title="' . $title . '"></a>'; } echo "</h3>"; include "operation/invoices/invoice_view.php"; } else { // Show edit/insert invoice include "operation/invoices/invoices.php"; } } // Operation_invoice changes inside the previous include if ($operation_invoices == "" and $new_invoice == 0 and $view_invoice == 0) { $parent_company = get_db_value('id_parent', 'tcompany', 'id', $id); if (!$parent_company && $parent_company != '') { $invoices = crm_get_all_invoices("id_company = {$id} OR id_company = {$parent_company}"); } else { $invoices = crm_get_all_invoices("id_company = {$id}"); } $invoices = print_array_pagination($invoices, "index.php?sec=customers&sec2=operation/companies/company_detail&id={$id}&op=invoices"); if ($invoices !== false) { $table->width = "98%"; $table->class = "listing"; $table->cellspacing = 0; $table->cellpadding = 0; $table->tablealign = "left"; $table->data = array(); $table->size = array(); $table->style = array(); $table->style[0] = 'font-weight: bold'; $table->colspan = array(); $table->head[0] = __('ID'); //$table->head[1] = __('Description');
$select_db = mysql_select_db($config['dbname'], $conexion); $export_csv_leads = get_parameter('export_csv_leads', 0); $export_csv_companies = get_parameter('export_csv_companies', 0); $export_csv_contacts = get_parameter('export_csv_contacts', 0); $export_csv_contracts = get_parameter('export_csv_contracts', 0); $export_csv_invoices = get_parameter('export_csv_invoices', 0); $export_csv_inventory = get_parameter('export_csv_inventory', 0); $export_csv_audit = get_parameter('export_csv_audit', 0); $export_csv_tickets = get_parameter('export_csv_tickets', 0); if ($export_csv_invoices) { $read = check_crm_acl('company', 'cr'); if (!$read) { exit; } $where_clause = get_parameter('where_clause'); $rows = crm_get_all_invoices(clean_output($where_clause)); if ($rows === false) { return; } $rows_aux = array(); foreach ($rows as $key => $invoice) { $company_name = get_db_value('name', 'tcompany', 'id', $invoice['id_company']); $rows_aux[$key]['id'] = $invoice['id']; $rows_aux[$key]['id_user'] = $invoice['id_user']; $rows_aux[$key]['id_task'] = $invoice['id_task']; $rows_aux[$key]['id_company'] = $invoice['id_company']; $rows_aux[$key]['company'] = $company_name; $rows_aux[$key]['bill_id'] = $invoice['bill_id']; $rows_aux[$key]['concept1'] = $invoice['concept1']; $rows_aux[$key]['concept2'] = $invoice['concept2']; $rows_aux[$key]['concept3'] = $invoice['concept3'];
$form .= '<div class="form_result">'; $form .= "<div class='divresult_left'>"; $form .= print_table($table,true); $form .= '</div>'; $form .= "<div class='divform_right'>"; $form .= "<div class='button-form'>"; $form .= print_submit_button (__('Search'), "search_btn", false, 'class="sub search"', true); $form .= '</div>'; $form .= '</div>'; $form .= '</div>'; $form .= '</form>'; print_container_div("companys_form",__("Invoices form search"),$form, 'open', false, false); } $invoices = crm_get_all_invoices ($where_clause, $order_by); // NO pagination for PDF output if ($clean_output == 1) $config["block_size"] = 5000; if ($invoices != false) { $invoices = print_array_pagination ($invoices, "index.php?sec=customers&sec2=operation/invoices/invoice_detail$search_params"); $url_id_order = 'index.php?sec=customers&sec2=operation/invoices/invoice_detail'.$search_params.'&order_by=bill_id'; $url_create_order = 'index.php?sec=customers&sec2=operation/invoices/invoice_detail'.$search_params.'&order_by=invoice_create_date'; switch ($order_by) { case "bill_id": $id_img = " <a href='$url_id_order'><img src='images/arrow_down_orange.png'></a>"; $date_img = " <a href='$url_create_order'><img src='images/block_orange.png'></a>"; break;
$permission = check_crm_acl('invoice', '', $config['id_user'], $id); $view_invoice = get_parameter("view_invoice", 0); $id_company = get_parameter('id_company'); $id = get_parameter('id'); $contract_data = get_db_row('tcontract', 'id', $id); if (!$permission) { audit_db($config["id_user"], $config["REMOTE_ADDR"], "ACL Violation", "Trying to access to an invoice"); include "general/noaccess.php"; exit; } if ($view_invoice) { $id_invoice = get_parameter('id_invoice', -1); $id = get_parameter('id_company'); include "operation/invoices/invoice_view.php"; } else { $invoices = crm_get_all_invoices("contract_number = " . $contract_data['contract_number']); $invoices = print_array_pagination($invoices, "index.php?sec=customers&sec2=operation/contracts/contract_detail&id={$id}&op=invoices&invoice_contract_number=" . $contract_data['contract_number']); if ($invoices !== false) { $table->width = "98%"; $table->class = "listing"; $table->cellspacing = 0; $table->cellpadding = 0; $table->tablealign = "left"; $table->data = array(); $table->size = array(); $table->style = array(); $table->style[0] = 'font-weight: bold'; $table->colspan = array(); $table->head[0] = __('ID'); $table->head[2] = __('Amount'); $table->head[3] = __('Type');
$data[0] = "<a href='index.php?sec=customers&sec2=operation/companies/company_detail&id=".$company["id"]."'>" . $company["name"]. "</a>"; $data[1] = get_db_sql ("SELECT name FROM tcompany_role WHERE id = ".$company["id_company_role"]); array_push ($table->data, $data); } print_table ($table); } } // Invoices if ( check_crm_acl('company', 'cr') && $show_customers != MENU_HIDDEN ){ $where_clause = " bill_id LIKE '%".$search_string."%' "; $invoices = crm_get_all_invoices ($where_clause); if ($invoices) { echo "<h3>"; echo __("Invoices"); echo "</h3>"; $table = new StdClass(); $table->width = "100%"; $table->class = "listing"; $table->data = array (); $table->size = array (); $table->style = array (); $table->colspan = array (); $table->head[0] = __('ID');
} else { // Show edit/insert invoice include ("operation/invoices/invoices.php"); } } // Operation_invoice changes inside the previous include if (($operation_invoices == "") AND ($new_invoice == 0) AND ($view_invoice == 0)) { $parent_company = get_db_value ('id_parent', 'tcompany', 'id', $id); if ((!$parent_company) && ($parent_company != '')) { $invoices = crm_get_all_invoices ("id_company = $id OR id_company = $parent_company"); } else { $invoices = crm_get_all_invoices ("id_company = $id"); } $invoices = print_array_pagination ($invoices, "index.php?sec=customers&sec2=operation/companies/company_detail&id=$id&op=invoices"); if ($invoices !== false) { $table->width = "98%"; $table->class = "listing"; $table->cellspacing = 0; $table->cellpadding = 0; $table->tablealign="left"; $table->data = array (); $table->size = array (); $table->style = array (); $table->style[0] = 'font-weight: bold';