Пример #1
0
 }
 $table->width = '99%';
 $table->class = "search-table-button";
 $table->data = array();
 $table->colspan = array();
 $table->colspan[4][0] = 2;
 $table->colspan[5][0] = 2;
 $table->data[0][0] = print_input_text('name', $name, '', 40, 100, true, __('Company name'), $disabled_write);
 if ($id > 0 && ($write_permission || $manage_permission)) {
     $table->data[0][0] .= "&nbsp;<a href='#' onClick='javascript: show_validation_delete(\"delete_company\"," . $id . ",0,0);' title='" . __('Delete company') . "'><img src='images/cross.png'></a>";
 }
 $table->data[0][1] = print_input_text_extended('manager', $manager, 'text-user', '', 15, 30, $disabled_write, '', array(), true, '', __('Manager'));
 if (!$disabled_write) {
     $table->data[0][1] .= print_help_tip(__("Type at least two characters to search"), true);
 }
 $parent_name = $id_parent ? crm_get_company_name($id_parent) : __("None");
 $table->data[1][0] = print_input_text_extended("parent_name", $parent_name, "text-parent_name", '', 20, 0, true, "", "", true, false, __('Parent company'));
 $table->data[1][0] .= print_input_hidden('id_parent', $id_parent, true);
 $table->data[1][0] .= "&nbsp;<a href='javascript:show_company_search(\"\",\"\",\"\",\"\",\"\",\"\");' title='" . __('Add parent') . "'><img src='images/zoom.png'></a>";
 $table->data[1][0] .= "&nbsp;<a href='javascript:clearParent();' title='" . __('Clear parent') . "'><img src='images/cross.png'></a>";
 $table->data[1][1] = print_input_text("last_update", $last_update, "", 15, 100, true, __('Last update'), $disabled_write);
 $table->data[2][0] = print_input_text("fiscal_id", $fiscal_id, "", 15, 100, true, __('Fiscal ID'), $disabled_write);
 $table->data[2][1] = print_select_from_sql('SELECT id, name FROM tcompany_role ORDER BY name', 'id_company_role', $id_company_role, '', __('Select'), 0, true, false, false, __('Company Role'), $disabled_write);
 $table->data[3][0] = print_input_text("website", $website, "", 30, 100, true, __('Website'), $disabled_write);
 $table->data[3][1] = print_input_text("country", $country, "", 20, 100, true, __('Country'), $disabled_write);
 $table->data[4][0] = print_textarea('address', 3, 1, $address, '', true, __('Address'), $disabled_write);
 $table->data[5][0] = print_textarea("comments", 10, 1, $comments, '', true, __('Comments'), $disabled_write);
 if ($id > 0 && ($write_permission || $manage_permission)) {
     $button = print_submit_button(__('Update'), "update_btn", false, 'class="sub upd"', true);
     $button .= print_input_hidden('update_company', 1, true);
     $button .= print_input_hidden('id', $id, true);
Пример #2
0
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
global $config;
include_once 'include/functions_crm.php';
$get_company_search = get_parameter('get_company_search', 0);
$get_company_name = get_parameter('get_company_name', 0);
$get_delete_validation = get_parameter('get_delete_validation', 0);
$delete_item = get_parameter('delete_item', 0);
$get_invoice_id = get_parameter('get_invoice_id', 0);
$get_old_invoice_id = get_parameter('get_old_invoice_id', 0);
if ($get_company_name) {
    $id_company = get_parameter('id_company');
    $name = crm_get_company_name($id_company);
    echo safe_output($name);
    return;
}
if ($get_company_search) {
    $search = get_parameter('search', 0);
    $search_text = (string) get_parameter('search_text');
    $search_role = (int) get_parameter("search_role");
    $search_country = (string) get_parameter("search_country");
    $search_manager = (string) get_parameter("search_manager");
    $search_parent = get_parameter("search_parent");
    $search_date_begin = (string) get_parameter('search_date_begin');
    $search_date_end = (string) get_parameter('search_date_end');
    $date = false;
    if ($search_date_end == 'undefined') {
        $search_date_end = '';
Пример #3
0
function crm_get_data_user_graph($companies)
{
    global $config;
    if ($companies === false) {
        return false;
    }
    require_once "include/functions_graph.php";
    $company_user = array();
    $i = 0;
    foreach ($companies as $key => $company) {
        if ($i < 10) {
            $company_name = crm_get_company_name($company['id_company']);
            $company_user[$company_name] = $company['total_users'];
        }
    }
    return $company_user;
}
Пример #4
0
}
$invoices = crm_get_all_invoices($where_clause);
$inv_data_currency = array();
$inv_total_currency = array();
$inv_data_company = array();
//Get all currency and company totals and legend
foreach ($invoices as $inv) {
    $inv["total"] = crm_get_amount_total_invoice($inv);
    if (!isset($inv_total_currency[$inv["currency"]])) {
        $inv_total_currency[$inv["currency"]] = 0;
    }
    if (!isset($legend[$inv["currency"]])) {
        $legend[$inv["currency"]] = $inv["currency"];
    }
    $inv_total_currency[$inv["currency"]] = $inv_total_currency[$inv["currency"]] + $inv["total"];
    $comp_name = crm_get_company_name($inv["id_company"]);
    if (!isset($inv_data_company[$comp_name])) {
        $inv_data_company[$comp_name] = 0;
    }
    $inv_data_company[$comp_name] = $inv_data_company[$comp_name] + $inv["total"];
}
//Get data for graphs
foreach ($invoices as $inv) {
    $inv["total"] = crm_get_amount_total_invoice($inv);
    if (!isset($inv_data_currency[$inv["invoice_create_date"]])) {
        $inv_data_currency[$inv["invoice_create_date"]] = array();
        foreach ($inv_total_currency as $cur => $value) {
            $inv_data_currency[$inv["invoice_create_date"]][$cur] = 0;
        }
    }
    $inv_data_currency[$inv["invoice_create_date"]][$inv["currency"]] += $inv["total"];