$table->data[1][2] = print_input_text('search_date_end', $search_date_end, '', 15, 20, true, __('Date to'));
 $table->data[1][3] = print_input_text('search_min_billing', $search_min_billing, '', 15, 20, true, __('Min. billing'));
 $buttons = print_submit_button(__('Search'), "search_btn", false, 'class="sub search"', true);
 // Delete new lines from the string
 $where_clause = str_replace(array("\r", "\n"), '', $where_clause);
 $buttons .= print_button(__('Export to CSV'), '', false, 'window.open(\'' . 'include/export_csv.php?export_csv_companies=1&where_clause=' . str_replace('"', "\\'", $where_clause) . '&date=' . $date . '\')', 'class="sub csv"', true);
 $table->data[2][0] = $buttons;
 $table->colspan[2][0] = 4;
 echo '<form method="post" id="company_stats_form" action="index.php?sec=customers&sec2=operation/companies/company_detail">';
 print_table($table);
 // Input hidden for ORDER
 print_input_hidden('order_by_activity', $order_by_activity);
 print_input_hidden('order_by_company', $order_by_company);
 print_input_hidden('order_by_billing', $order_by_billing);
 echo '</form>';
 $companies = crm_get_companies_list($where_clause, $date, $order_by, false, $having);
 $companies = print_array_pagination($companies, "index.php?sec=customers&sec2=operation/companies/company_detail{$search_params}", $offset);
 if ($companies !== false) {
     $table->width = "99%";
     $table->class = "listing";
     $table->data = array();
     $table->style = array();
     $table->colspan = array();
     $table->head[0] = __('ID');
     $table->head[1] = __('Company') . $company_order_image;
     $table->head[2] = __('Role');
     $table->head[3] = __('Contracts');
     $table->head[4] = __('Leads');
     $table->head[5] = __('Manager');
     $table->head[6] = __('Country');
     $table->head[7] = __('Last activity') . $activity_order_image;
Exemple #2
0
    $where_clause = get_parameter('where_clause');
    $rows = crm_get_all_contacts(clean_output($where_clause));
    $filename = clean_output('contacts_export') . '-' . date("YmdHi");
    if ($rows === false) {
        return;
    }
}
if ($export_csv_companies) {
    $read = check_crm_acl('company', 'cr');
    if (!$read) {
        exit;
    }
    $where_clause = get_parameter('where_clause');
    $date = get_parameter('date');
    $filename = clean_output('company_export') . '-' . date("YmdHi");
    $rows = crm_get_companies_list(clean_output($where_clause), $date);
    if ($rows === false) {
        return;
    }
}
if ($export_csv_leads) {
    $read = check_crm_acl('company', 'cr');
    if (!$read) {
        exit;
    }
    $where_clause = get_parameter('where_clause');
    $filename = clean_output('lead_export') . '-' . date("YmdHi");
    $rows = crm_get_all_leads(clean_output($where_clause));
    if ($rows === false) {
        return;
    }
Exemple #3
0
    require_once 'include/functions_db.php';
    require_once 'include/functions_crm.php';
    $id_user = (string) get_parameter('id_user', $config['id_user']);
    $string = (string) get_parameter('term');
    // term is what autocomplete plugin gives
    $type = (string) get_parameter('type');
    $filter = (string) get_parameter('filter');
    // complements the main filter
    if ($filter) {
        $filter = safe_output($filter);
    }
    $where_clause = sprintf(' AND (tcompany.id = %d
									OR tcompany.name LIKE "%%%s%%"
									OR tcompany.country LIKE "%%%s%%"
									OR tcompany.manager LIKE "%%%s%%") AND tcompany.manager = "%s"', $string, $string, $string, $string, $id_user);
    $companies = crm_get_companies_list($where_clause . $filter, false, "ORDER BY name", true);
    if (!$companies) {
        return;
    }
    $result = array();
    foreach ($companies as $id => $name) {
        switch ($type) {
            case 'invoice':
                if (check_crm_acl('invoice', '', $id_user, $id)) {
                    array_push($result, array("label" => safe_output($name), "value" => $id));
                }
                break;
            default:
                array_push($result, array("label" => safe_output($name), "value" => $id));
                break;
        }
Exemple #4
0
 //$where_clause = "WHERE 1=1 AND id_company " .get_filter_by_company_accessibility($config["id_user"]);
 $where_clause = "WHERE 1=1";
 if ($search_text != "") {
     $where_clause .= " AND (fullname LIKE '%{$search_text}%' OR email LIKE '%{$search_text}%'\n\t\t\t\t\tOR phone LIKE '%{$search_text}%' OR mobile LIKE '%{$search_text}%') ";
 }
 if ($id_company) {
     $where_clause .= sprintf(' AND id_company = %d', $id_company);
 }
 $params = "&search_text={$search_text}&id_company={$id_company}";
 $table->width = '99%';
 $table->class = 'search-table';
 $table->style = array();
 $table->style[0] = 'font-weight: bold;';
 $table->data = array();
 $table->data[0][0] = print_input_text("search_text", $search_text, "", 15, 100, true, __('Search'));
 $companies = crm_get_companies_list("", false, "", true);
 $table->data[0][1] = print_select($companies, 'id_company', $id_company, '', 'All', 0, true, false, false, __('Company'));
 $table->data[0][2] = print_submit_button(__('Search'), "search_btn", false, 'class="sub search"', true);
 echo '<form id="contact_search_form" method="post">';
 print_table($table);
 echo '</form>';
 $contacts = crm_get_all_contacts($where_clause);
 if ($read && $enterprise) {
     $contacts = crm_get_user_contacts($config['id_user'], $contacts);
 }
 $contacts = print_array_pagination($contacts, "index.php?sec=customers&sec2=operation/contacts/contact_detail&params={$params}", $offset);
 if ($contacts !== false) {
     unset($table);
     $table->width = "99%";
     $table->class = "listing";
     $table->data = array();
Exemple #5
0
                        $data[3] = $contract["date_end"];
                        array_push ($table->data, $data);
                }
                print_table ($table);
        }
}


// Companies
if ( check_crm_acl('company', 'cr') && $show_customers != MENU_HIDDEN ){

	$where_clause = " AND (tcompany.name LIKE '%".$search_string."%' OR tcompany.id IN (SELECT id_company
																FROM tcompany_activity
																WHERE description LIKE '%$search_string%'))";
	
	$companies = crm_get_companies_list($where_clause, false, "ORDER BY name");
	
	if ($companies) {
		
		echo "<h3>";
		echo __("Companies");
		echo "</h3>";
		
		$table = new StdClass();
		$table->width = '100%';
		$table->class = 'listing';
		$table->data = array ();
		$table->size = array ();
		$table->style = array ();
		$table->head = array();
		$table->head[0] = __('Company');
Exemple #6
0
         $where_clause .= sprintf(' AND manager = "%s" ', $search_manager);
     }
     if ($search_parent != 0) {
         $where_clause .= sprintf(' AND id_parent = %d ', $search_parent);
     }
     if ($search_date_begin != "") {
         $where_clause .= " AND `date` >= {$search_date_begin}";
         $date = true;
     }
     if ($search_date_end != "") {
         $where_clause .= " AND `date` <= {$search_date_end}";
         $date = true;
     }
 }
 $params = "&search_manager={$search_manager}&search_text={$search_text}&search_role={$search_role}&search_country={$search_country}&search_parent={$search_parent}&search_date_begin={$search_date_begin}&search_date_end={$search_date_end}";
 $companies = crm_get_companies_list($where_clause, $date);
 if ($companies !== false) {
     $table_list->width = "98%";
     $table_list->class = "listing";
     $table_list->data = array();
     $table_list->style = array();
     $table_list->colspan = array();
     $table_list->head[0] = __('Company');
     $table_list->head[1] = __('Role');
     $table_list->head[2] = __('Estimated sale');
     $table_list->head[3] = __('Manager');
     $table_list->head[4] = __('Country');
     $table_list->head[5] = __('Last activity');
     $table_list->head[6] = __('Delete');
     foreach ($companies as $company) {
         $data = array();