Ejemplo n.º 1
0
<?php

$this->a('items_storage.php');
$back_names[] = "cl_call";
$back_names[] = "cl_call2";
$back_names[] = "cl_call3";
$back_names[] = "cl_call4";
$back_names[] = "cl_call5";
// create tree navigation
$basemng = new basemng();
$basemng->mysqli = $this->mysqli;
$basemng->user = $this->user;
$js_include[] = 'js/treeNavigation.js';
$string_out .= $basemng->show_map();
$string_out .= $basemng->show_div_selectors();
$string_out .= "<div id='tree_selector' class='div_outer_tree'>" . $basemng->product_tree(0, 1) . "</div>";
// trade class
$trade = new trade();
$trade->mysqli = $this->mysqli;
$trade->user = $this->user;
$trade->request = $this->request;
$js_functions[] = $trade->show_js();
$js_functions[] = $trade->show_js_sel_prod_event_storage();
$js_functions[] = $trade->show_js_sel_cat_event_stor();
$string_out .= "<div id='action_buttons' class='divactionbuttons'>" . $trade->storage_buttons() . "</div>";
$string_out .= "<div id ='main_div' class='divmain'>" . $trade->def_storage_form() . "<div>";
Ejemplo n.º 2
0
<?
Ejemplo n.º 3
0
 function debit_procurement_table($d_id)
 {
     $sql = "SELECT \r\t\tPRODUCTS.PR_ID,\r\t\tITEMS.I_ID,\r\t\tDEAL_ITEMS_LIST.DIL_CUR_ID,\r\t\tCURRENCIES.CUR_NAME,\r\t\tPRODUCTS.PR_NAME,\r\t\tPRODUCTS.PR_SDESC,\r\t\tDEAL_ITEMS_LIST.DIL_PRICE\r\t\tFROM DEALS\r\t\tINNER JOIN DEAL_ITEMS_LIST ON DEAL_ITEMS_LIST.DIL_D_ID = DEALS.D_ID\r\t\tINNER JOIN ITEMS ON ITEMS.I_ID = DEAL_ITEMS_LIST.DIL_I_ID\r\t\tINNER JOIN PRODUCTS ON PRODUCTS.PR_ID = ITEMS.I_PR_ID\r\t\tINNER JOIN CURRENCIES ON CURRENCIES.CUR_ID = DEAL_ITEMS_LIST.DIL_CUR_ID\r\t\tWHERE DEALS.D_ID=" . $d_id . ";";
     $result = $this->mysqli->query($sql);
     if ($result) {
         while ($row = $result->fetch_row()) {
             $pr_id = $row[0];
             $i_id = $row[1];
             $cur_id = $row[2];
             $cur_name = $row[3];
             $pr_name = $row[4];
             $pr_sdesc = page::trim_str($row[5], 60);
             $dil_price = $row[6];
             $sum = $sum + $row[6];
             $pr_foto = basemng::get_product_foto($pr_id);
             $pr_foto = "<div class='prod_small_foto'>" . $pr_foto . "</div>";
             //group
             $tab[$pr_id]['name'] = $pr_name;
             $tab[$pr_id]['sdesc'] = $pr_sdesc;
             $tab[$pr_id]['sum'] = $tab[$pr_id]['sum'] + $dil_price;
             $tab[$pr_id]['count']++;
             $tab[$pr_id]['foto'] = $pr_foto;
             $tab[$pr_id]['cur_name'] = $cur_name;
         }
     }
     if ($tab) {
         foreach ($tab as $pr_id => $val) {
             //average price per position
             $pr_price = (int) ($val['sum'] / $val['count']);
             if ($style == 'multitable2' or $style == '') {
                 $style = 'multitable1';
             } else {
                 $style = 'multitable2';
             }
             //curency change alert
             if (!isset($currency)) {
                 $currency = $val['cur_name'];
             } elseif ($currency != $val['cur_name']) {
                 $cur_alert = "Внимание Разные валюты !";
             }
             $tbl .= "<tr class='" . $style . "' onclick=\"\"><td>" . $val['foto'] . "</td><td>" . $val['name'] . "</td><td>" . $val['sdesc'] . "</td><td>" . trade::getprice($pr_price) . "&nbsp" . $val['cur_name'] . "</td><td>" . $val['count'] . "</td><td>" . trade::getprice($val['sum']) . "</td></tr>";
         }
         $tbl .= "<tr><td></td><td></td><td><b>Сумма :</b></td><td><b>" . $summ . "</b></td></tr>";
         $out .= "<div id='list_table'><table class='multitable' ><tr><th>Фото</th><th>Модель товара</th><th>Краткое описание</th><th>Цена за единицу</th><th>Кол-во</th><th>Всего</th></tr>" . $tbl . "</table></div>";
     } else {
         $out .= "Список пуст";
     }
     return $out;
 }
Ejemplo n.º 4
0
function new_category_php($par_pc_id, $pc_name)
{
    $basemng = new basemng();
    $basemng->dbconnect();
    $basemng->insert_new_category((int) $par_pc_id, $basemng->u2w($pc_name));
}
Ejemplo n.º 5
0
<?php

$back_names[] = "cl_call";
$back_names[] = "cl_call2";
$back_names[] = "cl_call3";
$back_names[] = "cl_call4";
$back_names[] = "cl_call5";
$basemng = new basemng();
$basemng->mysqli = $this->mysqli;
$basemng->request = $this->request;
$basemng->user = $this->user;
//$js_functions[]=$basemng->show_js();
$js_include[] = 'js/treeNavigation.js';
$string_out .= $basemng->show_map();
$string_out .= "\n<div id='action_buttons' class='divactionbuttons'></div>";
if ($this->request['showproduct'] != '') {
    $out = $basemng->show_product($this->request['showproduct']);
}
$string_out .= "<div id ='main_div' class='divmain'>" . $out . "</div>";
$string_out .= "<div id='tree_selector' class='div_outer_tree'>" . $basemng->product_tree(0, 1) . "</div>";
Ejemplo n.º 6
0
<?php

// old
$back_names[] = "manage_base_php";
$back_names[] = "manage_base2_php";
$back_names[] = "save_product_php";
$back_names[] = "save_category_php";
$back_names[] = "new_category_php";
//new api
$back_names[] = "cl_call";
$back_names[] = "cl_call2";
$back_names[] = "cl_call3";
$back_names[] = "cl_call4";
$back_names[] = "cl_call5";
$this->a('basemng.php');
$basemng = new basemng();
$basemng->mysqli = $this->mysqli;
$basemng->request = $this->request;
$basemng->user = $this->user;
$js_functions[] = $basemng->show_js();
//$js_functions[]=$basemng->js_for_tree_navigation();
$js_include[] = 'js/baseManagement.js';
$js_include[] = 'js/treeNavigation.js';
$string_out .= $basemng->show_map();
$string_out .= "\n<div id='action_buttons' class='divactionbuttonsWide'>\r\n<table cellspacing=0 cellpadding=0 >\r\n<tr><td>\r\n<table class='basemng_panel_table' cellspacing=0 >\r\n<tr><td bgcolor=#8fdfcf><b>Товар :</b>" . $basemng->product_actions_buttons() . "</td></tr>\r\n<tr><td bgcolor=#8fdfcf>Выделенный товар :<b><div style='display:inline;' id='selected_prod_name' >не выбран</div></b></td></tr>\r\n</table>\r\r\n</td><td>\r\n<table class='basemng_panel_table' cellspacing=0 >\r\n<tr><td bgcolor=#8fcfdf><b>Категории:</b>" . $basemng->category_actions_buttons() . "</td></tr>\r\n<tr><td bgcolor=#8fcfdf>Выделенная категория :<b><div style='display:inline;' id='selected_cat_name' >не выбрана</div></b></td></tr>\r\n</table>\r\n</td></tr>\r\n</table>\r</div>";
$string_out .= "<div id ='main_div' class='divmainWide'>" . $basemng->def_basemng_form() . "</div>";
$string_out .= "<div id='tree_selector' class='div_outer_treeWide'>" . $basemng->product_tree(0) . "</div>";
Ejemplo n.º 7
0
 function show_multitable($pc_id)
 {
     $this->rec_tbl_prods_in_cat($pc_id);
     if ($this->cattable) {
         foreach ($this->cattable as $pr_id => $pr_name) {
             $product = $this->get_product_info($pr_id);
             $pr_sdesc = implode(array_slice(explode('<br>', wordwrap($product['SDESC'], 280, '<br>', false)), 0, 1));
             $pr_sdesc = $pr_sdesc != $product['SDESC'] ? $pr_sdesc . '...' : $pr_sdesc;
             $pr_foto = basemng::get_product_foto($pr_id);
             $pr_foto = "<div class='prod_small_foto'>" . $pr_foto . "</div>";
             if ($style == 'multitable2' or $style == '') {
                 $style = 'multitable1';
             } else {
                 $style = 'multitable2';
             }
             $tbl .= "<tr class='" . $style . "' onclick=\"sel_pr('" . $pr_id . "')\"><td>" . $pr_foto . "</td><td>" . $pr_name . "</td><td>" . $pr_sdesc . "</td></tr>";
         }
     }
     $out = $tbl ? "<table id='multutable' class='multitable'><tr><th>Фото</th><th width=30%>Наименование</th><th>Краткое описание</th></tr>" . $tbl . "</table>" : "Каталог пуст";
     return $out;
 }
Ejemplo n.º 8
0
 function sell_price_selector($pr_id, $d_id)
 {
     $deal = trade::get_deal_properties($d_id);
     $existance = trade::get_product_existance($pr_id);
     $margin = trade::get_margins_by_product($pr_id);
     $m_basic = trade::get_basic_margins();
     $margin_groups = trade::get_margin_groups();
     $m_groups_basic = trade::get_basic_groups_margin();
     $product = basemng::get_product_info($pr_id);
     //for every mergin group ( now- partner )
     $m_basic_abs = $m_basic['abs'];
     $m_basic_prc = $m_basic['prc'];
     // start price
     // if have a USD price
     if (isset($existance['maxprice'][2]['price'])) {
         // rate
         $rate = (int) $this->sp['usd_rate'] / 100;
         // start price
         $start_price = $existance['maxprice'][2]['price'] * $rate;
         $max_price = $start_price;
         $min_price = $existance['minprice'][2]['price'] * $rate;
     } else {
         $start_price = (int) $existance['maxprice'][1]['price'];
         $max_price = $start_price;
         $min_price = $existance['minprice'][1]['price'];
     }
     // incoming price
     if ($max_price == $min_price and $max_price != '') {
         $prod_price = "Закупочная цена :" . trade::getprice($max_price) . " Грн";
     }
     if ($max_price != $min_price) {
         $prod_price = "Закупочная цена : от " . trade::getprice((int) $min_price) . " до " . trade::getprice((int) $max_price) . " Грн";
     }
     if (!$max_price) {
         $prod_price = "Закупочная цена : неизвестна ";
     }
     $pr_fix = trade::get_absolute_prod_price($pr_id);
     if ($pr_fix) {
         $sell_price = $pr_fix;
         $margin_msg = "Установлена фиксированная цена";
     } else {
         if ($start_price > 0) {
             // by margin group cycle
             foreach ($margin_groups as $mg_id => $mg_name) {
                 $m_all_mg_abs = $m_groups_basic[$mg_id][2]['val'];
                 $m_all_mg_prc = $m_groups_basic[$mg_id][3]['val'];
                 $m_pr_mg_abs = $margin[$mg_id][9]['val'];
                 $m_pr_mg_prc = $margin[$mg_id][10]['val'];
                 $m_pr_mg_fix = $margin[$mg_id][11]['val'];
                 if (!$m_pr_mg_fix) {
                     // margin !
                     // basic margin
                     $price = $start_price + $m_basic_abs;
                     $price = $price + (int) ($price * $m_basic_prc) / 10000;
                     // by margin group for all products
                     $price1 = $price;
                     $price = $price + $m_all_mg_abs;
                     $price = $price + (int) ($price * $m_all_mg_prc / 10000);
                     // by margin groups for this product
                     $price = $price + $m_pr_mg_abs;
                     $price = $price + (int) ($price * $m_pr_mg_prc / 10000);
                 } else {
                     $price = $m_pr_mg_fix;
                 }
                 // fixed price for product by margin group
                 $price = (int) $price;
                 // sell mng for current partner ( margin group )
                 $_2p_selection = '';
                 if ($mg_id == trade::get_margin_group_by_partner($deal['2p_id'])) {
                     $sell_price = trade::getprice($price);
                     $_2p_selection = "bgcolor='#88bbaa'";
                 }
                 // generate form
                 $m_action = "\$('#sell_price').val('" . trade::getprice($price) . "');";
                 $m_form_names .= "<td width=10% " . $_2p_selection . " onclick=\"" . $m_action . "\" ><div><font class='microfont'>" . $mg_name . "</font></div></td>";
                 $m_form_prices .= "<td width=10% " . $_2p_selection . " onclick=\"" . $m_action . "\" ><div id='mg_" . $mg_id . "_price'>" . trade::getprice($price) . "</div></td>";
             }
             $margin_msg = "<table class='multitable'><tr>" . $m_form_names . "</tr><tr>" . $m_form_prices . "</tr></table>";
         } else {
             $margin_msg = "Нет закупочной цены для наценки";
         }
     }
     // main sell selector
     // product existance form
     $product_existance_form = "Количество всего: " . (int) $existance['exist'] . "\n\t\t<table class='multitable'><tr><td>Склад</td><td>План.</td><td>Едет</td><td>Отлож.</td></tr>\n\t\t<tr><td>" . (int) $existance['stored'] . "</td><td>" . (int) $existance['planned'] . "</td><td>" . (int) $existance['purchased'] . "</td><td>" . (int) $existance['saved'] . "</td></tr></table>";
     //sell price area
     $selling_price_box = "<input type='text' size='7' maxlength='7' id='sell_price' class='input_text' value='" . $sell_price . "'>";
     $sell_price_area = $prod_price . "<br> Продать за " . $selling_price_box;
     $main_sell_selector = "<table><tr valign='top'><td><div id='product_existance'>" . $product_existance_form . "</div></td><td>" . $sell_price_area . "</td></tr></table>\n\t\t";
     // $product_table_sell_selector
     foreach ($existance['places'] as $pl_id => $val) {
         $place = trade::get_place_properties_by_id($pl_id);
         $out[$pl_id] .= "Склад '" . $place['pl_name'] . "'<br><table class='multitable' >";
         foreach ($val as $i_id => $prop) {
             if ($style == 'multitable2' or $style == '') {
                 $style = 'multitable1';
             } else {
                 $style = 'multitable2';
             }
             $add_act = "onclick=\"x_cl_call5('trade','insert_item_to_list'," . $i_id . "," . $d_id . ",\$('#sell_price').val(),1," . $pr_id . ",'show_result');\"";
             if ($prop['is_id'] == 1 or $prop['is_id'] == 2 or $prop['is_id'] == 3) {
                 $add_butt = "<button class='button' " . $add_act . " ><img class='menu_img' src='/img/site/add.png'></button>";
             } else {
                 $add_butt = '';
             }
             $out[$pl_id] .= "<tr class='" . $style . "'><td width=60px>" . $prop['serial'] . "</td><td>" . $prop['desc'] . "</td><td width=130px>" . $prop['owner'] . "</td><td width=100px>" . $prop['status'] . "</td><td width=2%>" . $add_butt . "</td></tr>";
         }
         $out[$pl_id] .= "</table>";
     }
     $product_table_sell_selector = implode($out);
     $pr_foto = basemng::get_product_foto($pr_id);
     $pr_foto = "<div class='prod_small_foto'>" . $pr_foto . "</div>";
     // full selling product form
     $ans = "<table width=130%>\n\t\t<tr><td><table><tr><td>" . $pr_foto . "</td><td><h3>" . $product['NAME'] . "</h3></td></tr></table></td></tr>\n\t\t<tr><td>" . $main_sell_selector . "</td></tr>\n\t\t<tr><td>" . $margin_msg . "</td></tr>\n\t\t<tr><td><div id='product_table_sell_selector'>" . $product_table_sell_selector . "</div></td></tr>\n\t\t</table>\n\t\t";
     return $ans;
 }