Esempio n. 1
0
         Order::update($order_id, array('author_paid' => $order_info['cost_auth']));
         $data = array('change_date' => time(), 'change_user_id' => $_SESSION['user']['data']['id'], 'order_id' => $order_id, 'filial_id_new' => $order_info['filial_id'], 'klient_id_new' => $order_info['klient_id'], 'vuz_id_new' => $order_info['vuz_id'], 'vuz_user_new' => $order_info['vuz_user'], 'type_id_new' => $order_info['type_id'], 'type_user_new' => $order_info['type_user'], 'napr_id_new' => $order_info['napr_id'], 'disc_id_new' => $order_info['disc_id'], 'disc_user_new' => $order_info['disc_user'], 'time_kln_new' => $order_info['time_kln'], 'cost_kln_new' => $order_info['cost_kln'], 'payment_id_new' => $order_info['payment_id'], 'subject_new' => $order_info['subject'], 'about_kln_new' => $order_info['about_kln'], 'about_mng_new' => $order_info['about_mng'], 'kurs_new' => $order_info['kurs'], 'prakt_pc_new' => $order_info['prakt_pc'], 'pages_min_new' => $order_info['pages_min'], 'pages_max_new' => $order_info['pages_max'], 'src_min_new' => $order_info['src_min'], 'src_max_new' => $order_info['src_max'], 'from_id_new' => $order_info['from_id'], 'oform_new' => $order_info['oform'], 'next_rel_date_new' => $order_info['next_rel_date'], 'status_id_new' => $order_info['status_id'], 'ok_comment_new' => $order_info['ok_comment'], 'ok_comment_date_new' => $order_info['ok_comment_date'], 'payment_comment_new' => $order_info['payment_comment'], 'cost_auth_new' => $order_info['cost_auth'], 'time_auth_new' => $order_info['time_auth'], 'oplata_kln_new' => $order_info['oplata_kln'], 'author_paid_new' => $order_info['cost_auth'], 'company_paid_new' => $order_info['company_paid'], 'filial_id_old' => $order_info['filial_id'], 'klient_id_old' => $order_info['klient_id'], 'vuz_id_old' => $order_info['vuz_id'], 'vuz_user_old' => $order_info['vuz_user'], 'type_id_old' => $order_info['type_id'], 'type_user_old' => $order_info['type_user'], 'napr_id_old' => $order_info['napr_id'], 'disc_id_old' => $order_info['disc_id'], 'disc_user_old' => $order_info['disc_user'], 'time_kln_old' => $order_info['time_kln'], 'cost_kln_old' => $order_info['cost_kln'], 'payment_id_old' => $order_info['payment_id'], 'subject_old' => $order_info['subject'], 'about_kln_old' => $order_info['about_kln'], 'about_mng_old' => $order_info['about_mng'], 'kurs_old' => $order_info['kurs'], 'prakt_pc_old' => $order_info['prakt_pc'], 'pages_min_old' => $order_info['pages_min'], 'pages_max_old' => $order_info['pages_max'], 'src_min_old' => $order_info['src_min'], 'src_max_old' => $order_info['src_max'], 'from_id_old' => $order_info['from_id'], 'oform_old' => $order_info['oform'], 'next_rel_date_old' => $order_info['next_rel_date'], 'status_id_old' => $order_info['status_id'], 'ok_comment_old' => $order_info['ok_comment'], 'ok_comment_date_old' => $order_info['ok_comment_date'], 'payment_comment_old' => $order_info['payment_comment'], 'cost_auth_old' => $order_info['cost_auth'], 'time_auth_old' => $order_info['time_auth'], 'oplata_kln_old' => $order_info['oplata_kln'], 'author_paid_old' => $order_info['author_paid'], 'company_paid_old' => $order_info['company_paid']);
         OrderHistory::create($data);
     }
     $result[] = 0;
     break;
 case 'debt_to_company':
     $bDoUpdate = false;
     $orders = explode(',', $_GET['order_id']);
     foreach ($orders as $order_id) {
         $order_id = trim($order_id);
         if (empty($order_id)) {
             continue;
         }
         $order_info = get_order_info($order_id);
         $company_paid = calculate_debt_to_company($order_info['cost_kln'], $order_info['cost_auth'], $order_info['filial_id']);
         Order::update($order_id, array('company_paid' => $company_paid));
         $data = array('change_date' => time(), 'change_user_id' => $_SESSION['user']['data']['id'], 'order_id' => $order_id, 'filial_id_new' => $order_info['filial_id'], 'klient_id_new' => $order_info['klient_id'], 'vuz_id_new' => $order_info['vuz_id'], 'vuz_user_new' => $order_info['vuz_user'], 'type_id_new' => $order_info['type_id'], 'type_user_new' => $order_info['type_user'], 'napr_id_new' => $order_info['napr_id'], 'disc_id_new' => $order_info['disc_id'], 'disc_user_new' => $order_info['disc_user'], 'time_kln_new' => $order_info['time_kln'], 'cost_kln_new' => $order_info['cost_kln'], 'payment_id_new' => $order_info['payment_id'], 'subject_new' => $order_info['subject'], 'about_kln_new' => $order_info['about_kln'], 'about_mng_new' => $order_info['about_mng'], 'kurs_new' => $order_info['kurs'], 'prakt_pc_new' => $order_info['prakt_pc'], 'pages_min_new' => $order_info['pages_min'], 'pages_max_new' => $order_info['pages_max'], 'src_min_new' => $order_info['src_min'], 'src_max_new' => $order_info['src_max'], 'from_id_new' => $order_info['from_id'], 'oform_new' => $order_info['oform'], 'next_rel_date_new' => $order_info['next_rel_date'], 'status_id_new' => $order_info['status_id'], 'ok_comment_new' => $order_info['ok_comment'], 'ok_comment_date_new' => $order_info['ok_comment_date'], 'payment_comment_new' => $order_info['payment_comment'], 'cost_auth_new' => $order_info['cost_auth'], 'time_auth_new' => $order_info['time_auth'], 'oplata_kln_new' => $order_info['oplata_kln'], 'author_paid_new' => $order_info['author_paid'], 'company_paid_new' => $company_paid, 'filial_id_old' => $order_info['filial_id'], 'klient_id_old' => $order_info['klient_id'], 'vuz_id_old' => $order_info['vuz_id'], 'vuz_user_old' => $order_info['vuz_user'], 'type_id_old' => $order_info['type_id'], 'type_user_old' => $order_info['type_user'], 'napr_id_old' => $order_info['napr_id'], 'disc_id_old' => $order_info['disc_id'], 'disc_user_old' => $order_info['disc_user'], 'time_kln_old' => $order_info['time_kln'], 'cost_kln_old' => $order_info['cost_kln'], 'payment_id_old' => $order_info['payment_id'], 'subject_old' => $order_info['subject'], 'about_kln_old' => $order_info['about_kln'], 'about_mng_old' => $order_info['about_mng'], 'kurs_old' => $order_info['kurs'], 'prakt_pc_old' => $order_info['prakt_pc'], 'pages_min_old' => $order_info['pages_min'], 'pages_max_old' => $order_info['pages_max'], 'src_min_old' => $order_info['src_min'], 'src_max_old' => $order_info['src_max'], 'from_id_old' => $order_info['from_id'], 'oform_old' => $order_info['oform'], 'next_rel_date_old' => $order_info['next_rel_date'], 'status_id_old' => $order_info['status_id'], 'ok_comment_old' => $order_info['ok_comment'], 'ok_comment_date_old' => $order_info['ok_comment_date'], 'payment_comment_old' => $order_info['payment_comment'], 'cost_auth_old' => $order_info['cost_auth'], 'time_auth_old' => $order_info['time_auth'], 'oplata_kln_old' => $order_info['oplata_kln'], 'author_paid_old' => $order_info['author_paid'], 'company_paid_old' => $order_info['company_paid']);
         OrderHistory::create($data);
     }
     $result[] = 0;
     break;
 case 'color':
     $bDoUpdate = false;
     $currentColors = db::get_single_value("SELECT conf_ord_colors FROM " . TBL_PREF . "data_users WHERE id = " . $_SESSION['user']['data']['id']);
     if (empty($currentColors)) {
         $currentColors = array();
     } else {
         $currentColors = unserialize($currentColors);
     }
     $currentColors[$_GET['order_id']] = $_GET['value'];
Esempio n. 2
0
    $column->Caption = "Доход фирмы";
    $column->Key = "company_profit";
    $column = $stat_tbl->NewColumn();
    $column->Caption = "Оплачено фирме";
    $column->Key = "company_paid";
    $column = $stat_tbl->NewColumn();
    $column->Caption = "Долг перед фирмой";
    $column->Key = "debt_to_company";
    if ($isDirector) {
        $column->instantEdit = true;
    }
    $column = $stat_tbl->NewColumn();
    $column->Caption = "Заказы";
    $column->Key = "orders";
    $column->hidden = true;
    $column->id = 'orders_list';
}
$result = array('id' => 'Стоимость, руб.', 'client_price' => 0, 'client_payed' => 0, 'client_debt' => 0, 'author_price' => 0, 'author_payed' => 0, 'debt_to_author' => 0, 'company_profit' => 0, 'company_paid' => 0, 'debt_to_company' => 0, 'orders' => '');
foreach (db::get_arrays("SELECT cost_kln, cost_auth, oplata_kln, author_paid, filial_id, id, company_paid FROM " . TBL_PREF . $Filter->DstTable . " WHERE " . (!empty($result_filter) ? $result_filter : "1")) as $row) {
    $result['client_price'] += $row['cost_kln'];
    $result['client_payed'] += $row['oplata_kln'];
    $result['client_debt'] += $row['cost_kln'] - $row['oplata_kln'];
    $result['author_price'] += $row['cost_auth'];
    $result['author_payed'] += $row['author_paid'] ? $row['author_paid'] : 0;
    $result['company_profit'] += calculate_debt_to_company($row['cost_kln'], $row['cost_auth'], $row['filial_id']);
    $result['company_paid'] += $row['company_paid'];
    $result['orders'] .= empty($result['orders']) ? $row['id'] : ',' . $row['id'];
}
$result['debt_to_author'] = $result['author_price'] - $result['author_payed'];
$result['debt_to_company'] = $result['company_profit'] - $result['company_paid'];
$stat_tbl->AddRow($result, "id");
Esempio n. 3
0
$ypos += 20;
$t = $frm->Text(10, $ypos, 115, $order_info["oplata_kln"]);
$t->linkName = "oplata_kln";
$t->AddValidator(new CGUI_VALIDATOR_NOEMPTY());
$t->AddValidator(new CGUI_VALIDATOR_09());
$ypos += 30;
$frm->Label("Способ оплаты", 10, $ypos);
$ypos += 20;
$s = $frm->Select(10, $ypos, 200, array(0 => array("name" => "-выберите-")) + $data_payments, "name", $order_info['payment_id']);
//18
$s->linkName = "opl";
$s->AddValidator(new CGUI_VALIDATOR_NOZERO());
$ypos += 30;
$frm->Label('Долг перед фирмой', 10, $ypos);
$ypos += 20;
$t = $frm->Text(10, $ypos, 200, calculate_debt_to_company($order_info["cost_kln"], $order_info["cost_auth"], $order_info['filial_id']));
$t->Disabled = true;
$ypos += 30;
$statuses = array('Не определен');
foreach (get_orders_statuses() as $status) {
    $statuses[$status['id']] = $status['status_name'];
}
$frm->Label("Статус заказа", 10, $ypos);
$frm->Label("Далее", 445, $ypos);
$ypos += 20;
$s = $frm->Select(10, $ypos, 200, $statuses, "", $order_info['status_id']);
//21
$s->linkName = "status_id";
$s = $frm->Select(445, $ypos, 200, array(0 => "к списку заказов", 1 => "правка заказа", 2 => "повторить заказ"));
//22
$s->linkName = "next";
Esempio n. 4
0
function get_debt_to_company($value, $row)
{
    return number_format(calculate_debt_to_company($row['cost_kln'], $row['cost_auth'], $row['filial_id']), 2);
}