public function getMembersGroup() { use_class('minierp_users'); $class_mu = new minierp_users(); if (!is_null($this->id)) { $q = "SELECT * FROM minierp_groups_members WHERE minierp_groups_id={$this->id}"; $r = tep_db_query($q); if (tep_db_num_rows($r) > 0) { while ($row = tep_db_fetch_array($r)) { $users_id[] = $row['minierp_users_id']; } $users_ids = implode(",", $users_id); $members = $class_mu->retrieveList('id IN (' . $users_ids . ')'); return $members; } } return false; }
<?php use_class('minierp_users'); $user_name = tep_db_prepare_input($_POST['username']); $password = tep_db_prepare_input($_POST['userwpw']); $mu = new minierp_users(); $user = $mu->login(base64_decode($user_name), base64_decode($password)); $result = array(); $result['status'] = '0'; $result['modules'] = '0'; if (is_array($user) && isset($user['id'])) { $result['status'] = '1'; $result['modules'] = array(); $result['modules'][] = '1'; }
function updateStatus($old_status, $new_status, $username) { $design_current_status = $this->sub_status != '' ? "{$this->status}-{$this->sub_status}" : $this->status; if ($design_current_status == $old_status) { $sda = array(); $temp_new_status = explode('-', $new_status); $temp_old_status = explode('-', $old_status); $new_main_status = $temp_new_status[0]; $old_main_status = $temp_old_status[0]; $new_sub_status = isset($temp_new_status[1]) ? $temp_new_status[1] : 'null'; $old_sub_status = isset($temp_old_status[1]) ? $temp_old_status[1] : 'null'; $sda['status'] = $new_main_status; $sda['sub_status'] = $new_sub_status; //will automatically reset sub_status when its moved to status that have no sub status tep_db_perform('designs', $sda, 'update', "designs_id={$this->id}"); $this->status = $new_main_status; $this->sub_status = $new_sub_status == 'null' ? null : $new_sub_status; $timestamp = $this->addStatusHistory($new_status, $username); $long_timestamp = date('Y-m-d H:i:s'); if ($old_status == '2' && $new_status == '11') { //REQUEST TO PULLEDRACK $this->setTargetDateStart($timestamp); } elseif ($old_status == '11' && $new_status == '2') { //PULLEDRACK BACK TO REQUEST $this->setTargetDateStart('CLEAR'); // } elseif ($old_status=='3' && $new_status=='5') { //DRAFTS TO SAMPLINGS } elseif ($old_status == '3' && $new_main_status == '5') { //DRAFTS TO SAMPLINGS // $drafts = $this->retrieveDrafts("approve_status='A'"); $drafts = $this->retrieveDrafts("approve_status!='R'"); if (count($drafts) == 0) { use_class('design_draft'); $draft = new design_draft(); $draft->create($this->id, $this->name, $this->colors_request, $this->followers->list_raw); $draft->uploadImage('1', DIR_WS_IMAGES . $this->image_1, basename($this->image_1)); //$draft->setApproveStatus('A', 'auto-set'); } } elseif ($old_status == '8' && $new_status == '9') { //FINALIZE TO DONE $this->setTargetDateEnd($timestamp); $drafts = $this->retrieveDrafts("approve_status!='R'"); $drafts_ids = array(); foreach ($drafts as $d) { $drafts_ids[] = $d['drafts_id']; } $products = $this->retrieveProducts(); //ADD TO WATCHLSIT $products_ids = array(); //to be used by ADD ATTRIBUTES $products_ids_nosample = array(); $products_ids_sample = array(); use_class('minierp_users'); use_class('elements_preorder'); use_class('elements_order'); use_class('products_articles'); use_class('products_minierp'); use_class('elements_stock'); $class_mu = new minierp_users(); $class_pm = new products_minierp(); $class_pa = new products_articles(); $class_es = new elements_stock(); $use_elements = array(); $eao = 2; //element adjust order foreach ($products as $p) { if (in_array($p['drafts_id'], $drafts_ids) && $p['finalized_time'] != '' && $p['finalized_by'] != '') { $products_ids[] = $p['products_id']; if ($p['create_sample'] == '1') { $products_ids_sample[] = $p['products_id']; } else { $products_ids_nosample[] = $p['products_id']; } foreach ($this->watched_by as $wl_user_id) { if ($wl_user_id > 0) { $class_mu->addToWatchlist($wl_user_id, $p['products_id']); } } // #BEGIN CALCULATE NEW ELEMENT SOURCE // first check category $tpdbq_products_use_elements = $class_pm->retrieveElementsUsage($p['products_id']); foreach ($tpdbq_products_use_elements as $row_pue) { $use_elements[] = array('elements_id' => $row_pue['elements_id'], 'quantity' => (int) $row_pue['quantity'] * $eao); } $tpdbq_products_articles = $class_pa->retrieveList($p['products_id'], "active_status='1'"); foreach ($tpdbq_products_articles as $row_pa) { $tpdbq_products_articles_use_elements = $class_pm->retrieveElementsUsage($p['products_id'], $row_pa['products_articles_id']); foreach ($tpdbq_products_articles_use_elements as $row_pue) { $use_elements[] = array('elements_id' => $row_pue['elements_id'], 'quantity' => (int) $row_pue['quantity'] * $eao); } } // #END CALCULATE NEW ELEMENT SOURCE } } // merge same element id $merge_use_elements = array(); foreach ($use_elements as $use_element) { $eid = $use_element['elements_id']; $qty = $use_element['quantity']; if (!isset($merge_use_elements[$eid])) { $merge_use_elements[$eid] = $qty; } else { if ($qty > $merge_use_elements[$eid]) { $merge_use_elements[$eid] = $qty; } } } // check to stock and // insert to element preorder //echo "</pre>merge<pre>";var_dump($merge_use_elements); // dari sini gk dibaca foreach ($merge_use_elements as $eid => $qty) { $epreorder = new elements_preorder($eid); $elstock = $class_es->retrieveOne(WAREHOUSE_ID_ELEMENTS, $eid); $tot_qty_el_preorder = elements_preorder::openOrdersQuantity($eid); $tot_qty_el_order = elements_order::openOrdersQuantity($eid); $total = $elstock['stock'] + $tot_qty_el_preorder + $tot_qty_el_order; if ($total < $qty) { $stock = $qty - $total; $epreorder->addOrder($stock, null, "New Design " . $this->id); } } //ADD ATTRIBUTES if (count($products_ids) > 0 && ($this->styles_id_F > 0 || $this->styles_id_L > 0)) { use_class('styles'); $class_s = new styles(); if ($this->styles_id_F > 0) { $class_s->addProduct($this->styles_id_F, $products_ids, $username); } if ($this->styles_id_L > 0) { $class_s->addProduct($this->styles_id_L, $products_ids, $username); } } //FINALLY, ACTIVATE THE PRODUCTS if (count($products_ids_nosample) > 0) { $class_pm->activateProducts($products_ids_nosample, true); } if (count($products_ids_sample) > 0) { $class_pm->activateProducts($products_ids_sample, true, true); } } elseif ($old_status == '11' && $new_status == '10-0') { //PULLRACK TO SOURCING $this->updateField('is_sourcing', 1); $n_drafts = $this->retrieveDrafts("approve_status!='R'"); if (count($n_drafts) == 0) { use_class('design_draft'); $draft = new design_draft(); $draft->create($this->id, $this->name); $draft->uploadImage('1', DIR_WS_IMAGES . $this->image_1, basename($this->image_1)); //$element = $draft->createElement('', $this->name, 0, '', 0, date('Y-m-d H:i:s'), 'auto', '0'); //we not auto create this, since we already used sub_status on design level } } elseif ($old_status == '10-0' && $new_status == '11') { //SOURCING BACK TO PULLRACK $this->updateField('is_sourcing', 'null'); } //INCREMENT FOR GRAPH DATASOURCE // if($old_status==3 && ($new_status==4||$new_status==5)) { if ($old_status == 3 && ($new_status == 4 || $new_main_status == 5)) { //COUNT NUMBER OF DESIGN MOVED OUT $this->addDataToField($long_timestamp, 'design_drafts', 1); } // if($new_status>5){ if ($new_main_status > 5) { //COUNT NUMBER OF PRODUCTS MOVED OUT $q = "SELECT COUNT(dp.designs_id) total_products FROM designs_products dp"; $q .= " INNER JOIN designs_drafts dd ON dd.drafts_id = dp.drafts_id AND dd.approve_status != 'R'"; $q .= " WHERE dp.designs_id = " . $this->id; $q .= " GROUP BY dp.designs_id"; $dbq = tep_db_query($q); $res = tep_db_fetch_array($dbq); $total_products = $res['total_products'] > 0 ? $res['total_products'] : 0; // if($old_status==5 && $new_status==6) $this->addDataToField($long_timestamp, 'design_samplings', $total_products); if ($old_main_status == 5 && $new_main_status == 14) { $this->addDataToField($long_timestamp, 'design_samplings', $total_products); } // if($old_status==6 && $new_status==12) $this->addDataToField($long_timestamp, 'design_graphics', $total_products); if ($old_main_status == 14 && $new_status == 12) { $this->addDataToField($long_timestamp, 'design_graphics', $total_products); } if ($old_status == 12 && $new_status == 7) { $this->addDataToField($long_timestamp, 'design_product_qc', $total_products); } if ($old_status == 7 && $new_status == 8) { $this->addDataToField($long_timestamp, 'design_details', $total_products); } if ($old_status == 8 && $new_status == 9) { $this->addDataToField($long_timestamp, 'design_finalize', $total_products); } } /*NO NEED ANYMORE, SINCE WE ALREADY SAVED sub_status ON DESIGN LEVEL if($new_status==10) { if($old_status=='1' && $this->isSourcingNewElements()) $this->addStatusHistory("10-0", $username); elseif($old_status=='6' && $this->isSourcingNewElements()) $this->addStatusHistory("10-0", $username); elseif($old_status=='4') $this->addStatusHistory("10-1", $username); elseif($old_status=='5') $this->addStatusHistory("10-7", $username); } */ } }
use_class('Product'); use_class('products_minierp'); use_class('products_articles'); use_class('products_brand'); use_class('styles'); use_class('minierp_users'); use_class('production_instruction_manual'); use_class('jng_sp_catalog'); use_class('jng_sp_catalog_params'); use_class('depot_orders'); use_class('elements_stock'); $class_pm = new products_minierp(); $class_pa = new products_articles(); $class_pb = new products_brand(); $class_s = new styles(); $class_mu = new minierp_users(); $class_jc = new jng_sp_catalog(); $class_jcp = new jng_sp_catalog_params(); $class_do = new depot_orders(); $class_es = new elements_stock(); $ebay_name_max_chars = 80; $ebay_language_id = '2'; function delete_extra_image($pei_id, $pei_name = '') { global $uploaddir; $deletion = false; $del_image_query = tep_db_query("SELECT * FROM products_extra_images WHERE products_extra_images_id = {$pei_id}"); $del_image = tep_db_fetch_array($del_image_query); $check_double_query = tep_db_query("SELECT * FROM products_extra_images WHERE products_extra_image = '{$del_image['products_extra_image']}'"); if (tep_db_num_rows($check_double_query) <= 1) { if ($pei_name != $del_image['products_extra_image']) {
<?php global $db; require_once '../confy.php'; require_once '../functions.php'; require_once '../functions-2.php'; tep_db_connect(); use_class('minierp_users'); $user_name = tep_db_prepare_input($_POST['username']); $password_plain = tep_db_prepare_input($_POST['userwpw']); $mu = new minierp_users(); $user = $mu->login($user_name, $password_plain); $result = array(); $result['status'] = '0'; $result['modules'] = '0'; if (is_array($user) && isset($user['id'])) { $result['status'] = '1'; $result['modules'] = array(); $result['modules'][] = '1'; } ajaxReturn($result); tep_db_close();
private function setDetail($jng_sp_id = '', $name = '', $create_date = '', $create_by = '', $status = '', $booking_id = '', $depot_orders_id = '', $elements_sourcing = '', $jng_sp_orders_id = '', $comments = '', $followers = '', $elements_orders = '') { $module_name = 'Preorder'; $module_item_category = ''; $module_item_link = 'open=sp-preorder&id=' . $this->id; //GRAB OWNER IMAGE if ($create_by != '') { use_class('minierp_users'); $class_mu = new minierp_users(); $user_owner = $class_mu->retrieveList("username='******'"); $create_by_image = $user_owner[0]['users_image']; $create_by_id = $user_owner[0]['id']; } else { $create_by_image = ''; } $this->jng_sp_id = $jng_sp_id; $this->name = $name; $this->create_date = $create_date; $this->create_by = $create_by; $this->create_by_id = $create_by_id; $this->create_by_image = $create_by_image; $this->status = $status; $this->booking_id = $booking_id; $this->depot_orders_id = $depot_orders_id == '' ? array() : unserialize($depot_orders_id); $this->elements_sourcing = $elements_sourcing == '' ? array() : unserialize($elements_sourcing); $this->jng_sp_orders_id = $jng_sp_orders_id == '' ? array() : unserialize($jng_sp_orders_id); $this->elements_orders = $elements_orders == '' ? array() : unserialize($elements_orders); $this->comments = new comments('jng_sp_preorders', 'comments', 'jng_sp_preorders_id', $this->id, $comments, '', '', $module_name, $module_item_category, $name, $module_item_link); $this->followers = new followers('jng_sp_preorders', 'followers', 'jng_sp_preorders_id', $this->id, $this->create_by_id, $followers, $module_name, $module_item_category, $name, $module_item_link); $this->setItems(); }
function deleteProduct($products_id, $username) { use_class('products_minierp'); use_class('minierp_users'); $class_pm = new products_minierp(); $class_mu = new minierp_users(); $p = $class_pm->retrieveDetail($products_id, 'pd'); $class_pm->deleteNewProduct($products_id); tep_db_query("DELETE FROM designs_products WHERE products_id={$products_id}"); $class_mu->removeFromWatchlist('*', $products_id); if ($username != 'draft-deletion') { $comment = 'I delete Product ID ' . $products_id . ' (' . $p['pd']['2']['products_name'] . ')'; $this->comments->addComment($username, $comment); } }
<?php //SUBMIT ACTION $changestatus = false; if (isset($_POST['me_action'])) { use_class('minierp_users'); $class_mu = new minierp_users(); if ($_POST['me_action'] == 'SAVETEMPLATE') { $new_template = tep_db_prepare_input($_POST['new_template']); $result = $class_mu->saveTemplate($session_userinfo['id'], $new_template); setTemplate($new_template); } elseif ($_POST['me_action'] == 'CHANGEPASSWORD') { $oldpass = tep_db_prepare_input($_POST['oldpass']); $newpass = tep_db_prepare_input($_POST['newpass']); if ($session_userinfo['status'] == 'DTI') { $filter = "dti_referrers_id={$session_userinfo['id']}"; $dti_partner_detail = $class_dti->retrieveReferrerDetail($referrer_id, $filter); if ($dti_partner_detail['dti_referrers_password'] != $oldpass) { $changestatus = false; } else { $sda = array('dti_referrers_password' => $newpass); $class_dti->update($session_userinfo['id'], $sda); $changestatus = true; } } else { $changestatus = $class_mu->changePassword($session_userinfo['id'], $oldpass, $newpass); } $result = $changestatus ? '1' : '0'; } elseif ($_POST['me_action'] == 'UPLOADIMAGE') { $user_id = tep_db_prepare_input($_POST['user_id']); $new_image = $class_mu->changeUsersImage($user_id, $_FILES['image']['tmp_name']);
<?php use_class('improvement'); use_class('minierp_users'); $class_mu = new minierp_users(); $create_new_button = 'Create New'; $id = isset($_GET['id']) ? tep_db_prepare_input($_GET['id']) : null; $improvement = new improvement($id); $is_createnew = is_null($improvement->id); $newdata_created = isset($_GET['new']) && $_GET['new'] == 'true'; $reloadlist = false; if ($newdata_created) { $messagebox->add('New MIMS successfully created with ID ' . $improvement->id, 'green'); $reloadlist = true; } if (isset($_POST['me_action'])) { if (!is_null($improvement->id)) { $improvement->followers->addFollower($session_userinfo['id']); } if ($_POST['me_action'] == 'CREATENEWDATA' || $_POST['me_action'] == 'UPDATEDATA') { $owner_id = tep_db_prepare_input($_POST['owner_id']); $owner_name = tep_db_prepare_input($_POST['owner_name']); $owner_image = ''; $date_added = tep_db_prepare_input($_POST['date_added']); $team = tep_db_prepare_input($_POST['team']); $teamcat = null; $eta = null; $target = null; $deadline = null; $kickoff_date = null; $pic = null;
<?php ##################################### # Author : D3W4 & SAHAT # # Created : Aug 3, 2012 11:50:56 AM # ##################################### use_class('minierp_users'); use_class('notifications'); $class_mu = new minierp_users(); $class_n = new notifications(); //SUBMIT ACTION if (isset($_POST['me_action'])) { if ($_POST['me_action'] == 'LOADUSERS') { $min_time_user_idle = 5 * 60; $min_time_user_offline = 60 * 60; $users_list = $class_mu->retrieveList("status=1", "username"); $users = array(); $u = array(); $u['img'] = 'Image'; $u['name'] = 'Username and Email Address'; $u['o'] = 'Manobo<br/>Online Status'; $u['e'] = 'Last Access<br/>Time Manobo'; $u['a'] = 'Skype ID<br/>'; $u['need_feed tac'] = 'Open<br/>Feedback'; $table_users[] = $u; foreach ($users_list as $row) { $users[] = $row['id'] . "|" . $row['skype_id']; $manobo_online_status_class = "notice"; switch ($row['is_login_manobo']) { case 0: $manobo_online_status = "is-offline";
/** * For handling submitted POST * @global array $session_userinfo * @param array $post_vars */ public function postProcess($post_vars) { global $session_userinfo; $result = array(); if ($post_vars['me_action'] == 'SEARCH') { $type = $post_vars['type']; $jng_sp_id = $post_vars['jng_sp_id']; //another strange case, in live datepicker filter is always given as \'datevalue\' instead of 'datevalue' //still cant find the root cause (and it's ok in local dev), so for quickwin workaround we simple replace //the \' value into ' with below update (sahat 11.02.2014) //$post_filters = explode("|", $post_vars['post_filters']); $post_filters = explode("|", str_replace('\\\'', "'", $post_vars['post_filters'])); $post_sorts = explode("|", $post_vars['post_sorts']); $filters = array(); foreach ($post_filters as $f) { $f_temp = explode('-', $f); $field = $f_temp[0]; unset($f_temp[0]); $value = implode('-', $f_temp); //explode to array for input on field $multivalue_fields which allowed multivalue separated by $multivalue_separator if (in_array($field, $this->multivalue_fields)) { $mv_temp = explode(current($this->multivalue_separator), $value); if (is_array($mv_temp) && $mv_temp > 0) { foreach ($mv_temp as $mv) { $mv = trim($mv); if (!isset($filters[$field]) || !in_array($mv, $filters[$field])) { $filters[$field][] = $mv; } } } else { $filters[$field][] = $value; } } else { $filters[$field][] = $value; } } $sorts = array(); foreach ($post_sorts as $s) { list($field, $value) = explode("-", $s); $sorts[$field][] = $value; } $query = $this->constructQuery($jng_sp_id, $filters, $sorts); //die($query); $dbq = tep_db_query($query); $result = ''; $products_ids = array(); $total_stock = 0; $total_stock_value = 0; $total_margin = 0; $total_sold = 0; $total_rets = 0; $total_sales = 0; $total_vc = 0; $total_sold_l30d = 0; $total_sold_l60d = 0; $total_sold_l90d = 0; $total_sales_l30d = 0; $total_sales_l60d = 0; $total_sales_l90d = 0; $display_spot = ''; while ($r = tep_db_fetch_array($dbq)) { $products_ids[] = $r['products_id']; $total_stock += $r['hh_stock']; $total_stock_value += $r['hh_stock_value']; $total_margin += $r['margin']; $total_sold += $r['total_sold']; $total_rets += $r['total_returned']; $total_sales += $r['total_sales']; $vc += $r['vc_now']; //$total_vc += $r['total_vc']; $total_vc += $r['vc_total']; $total_sold_l30d += $r['sold_monthly_1']; $total_sold_l60d += $r['sold_monthly_2']; $total_sold_l90d += $r['sold_monthly_3']; $total_sales_l30d += $r['sales_monthly_1']; $total_sales_l60d += $r['sales_monthly_2']; $total_sales_l90d += $r['sales_monthly_3']; } $jng_nodata = '<span class="notice">N/A for J&G</span>'; $returned_rate = number_format($total_sold > 0 ? $total_rets / $total_sold * 100 : 0, 1); $n_products_ids = count($products_ids); $result['type'] = $type; $result['spid'] = $jng_sp_id; $result['avg_margin'] = ($n_products_ids > 0 ? number_format($total_margin / $n_products_ids, 1) : 0) . '%'; $result['total'] = $n_products_ids; $result['total_stock'] = $total_stock; $result['total_stock_value'] = displayCurrency(CURRENCY_DEFAULT, convertCurrency($total_stock_value, CURRENCY_CODE_EURO, CURRENCY_DEFAULT)); $result['total_sold'] = $jng_sp_id == '0' ? $jng_nodata : $total_sold; $result['total_rets'] = $jng_sp_id == '0' ? $jng_nodata : $total_rets . " ({$returned_rate}%)"; $result['total_sales'] = $jng_sp_id == '0' ? $jng_nodata : displayCurrency(DEFAULT_CURRENCY, $total_sales); $result['vc'] = $jng_sp_id == '0' ? $jng_nodata : number_format($vc, 2); //$result['total_vc'] = number_format($total_vc, 2); $result['vc_total'] = $jng_sp_id == '0' ? $jng_nodata : number_format($total_vc, 2); $result['total_sales_l30d'] = displayCurrency(DEFAULT_CURRENCY, $total_sales_l30d); $result['total_sales_l60d'] = displayCurrency(DEFAULT_CURRENCY, $total_sales_l60d); $result['total_sales_l90d'] = displayCurrency(DEFAULT_CURRENCY, $total_sales_l90d); $result['total_sold_l30d'] = $total_sold_l30d; $result['total_sold_l60d'] = $total_sold_l60d; $result['total_sold_l90d'] = $total_sold_l90d; $result['products_ids'] = implode(',', $products_ids); } elseif ($post_vars['me_action'] == 'DISPLAY') { use_class('products_minierp'); use_class('minierp_users'); use_class('Product'); $class_pm = new products_minierp(); $class_mu = new minierp_users(); $jng_sp_id = $post_vars['jng_sp_id']; $type = $post_vars['type']; $products_id = $post_vars['products_id']; $is_killed = $post_vars['is_killed']; $is_sp_not_yet_added = $post_vars['is_sp_not_yet_added']; $added_post_vars = array('is_killed' => $is_killed, 'is_sp_not_yet_added' => $is_sp_not_yet_added); $display_type = $post_vars['display_type']; $row_number = $post_vars['row_number']; $showing_id = $post_vars['showing_id']; $obj_product = new Product($products_id); $display_res = $this->retrieveDataForDisplay($jng_sp_id, $products_id, $added_post_vars, $display_type); $res = $display_res[0]; $img_size = $display_type == 'thumbnail' ? IMAGE_SIZE_THUMBNAIL_2 : IMAGE_SIZE_THUMBNAIL_1; //SHOW PURE IMAGE FOR SP THAT USED IT AS MAIN IMAGE if (in_array($jng_sp_id, $this->sp_use_pure_image)) { $obj_product->setDisplayImage(Product::IMAGE_TYPE_ZALANDO); } else { if (in_array($jng_sp_id, $this->sp_use_clear_image)) { $obj_product->setDisplayImage(Product::IMAGE_TYPE_AMAZON); } } //$products_image = webImageWithDetailLinkStars($image_used, $img_size, $img_size, 'Product '.$products_id, 'img-border', 'View Larger Image', IMAGE_SIZE_BIG_1, '', $res['stars'], 3, '', '', $res['products_brand_id']); $products_image = $obj_product->displayImage($img_size, $img_size); $position_padding = $display_type == 'thumbnail' ? '2px 0 0 15px;' : ''; $products_image = webImageAddPosition($row_number, $products_image, $position_padding); $products_complexity = productComplexityName($res['complexity']); $products_stars = drawStars($res['stars']); $products_is_watched = $class_mu->isOnWatchlist($session_userinfo['id'], $products_id); $resultsdt = array(); if ($display_type == 'table' || $type == 'displaytooltip') { if ($type == 'thumbnail_tooltip') { //HTML Version result $sales_partner_id = $jng_sp_id == 'allsp' ? '0' : $jng_sp_id; //TODO: seperate B2C and B2b calculation, or even better is if // we can calculate it by the object directly $price = $obj_product->getPriceSelling($sales_partner_id); $net_price = Product::calculateNetPrice($price, VAT); $cogs = $obj_product->getProductCOGSValue(); $profit = Product::calculateProfit($net_price, $cogs); $margin = Product::calculateMargin($profit, $net_price); $jng_nodata = '<span class="notice">N/A for J&G</span>'; $infos = array(); $infos[] = $obj_product->displayIDAndCode(); $infos[] = $res['products_name']; if ($res['hh_stock'] > 0) { $infos[] = '<strong class="green">Depot Stock = ' . $res['hh_stock'] . '</strong>'; } else { $infos[] = '<strong>Depot Stock = 0</strong>'; } $infos[] = 'Complexity = ' . $products_complexity; if ($res['sample_created'] == '1') { $infos[] = '<span class="green">Sample order created</span>'; } else { $infos[] = '<span class="notice">No sample order created</span>'; } if ($jng_sp_id == '0') { $total_sold = $jng_nodata; $return_info = $jng_nodata; $qty_sold = $jng_nodata; } else { $returned_rate = number_format($res['returned_rate'], 1); $sales_monthly = number_format($res['sales_monthly'], 1); $sales_weekly = number_format($res['sales_weekly'], 1); $total_sold = $res['total_sold']; $return_info = $res['total_returned'] . ' (' . $returned_rate . '%)'; $qty_sold = "per Week: {$sales_weekly} ⋅ per Month: {$sales_monthly}"; } $tooltip = '<div class="draw-table"><table border="0" cellpadding="0" cellspacing="0">'; $tooltip .= '<tr class="o"><td class="w200 bold">Brand</td><td class="w300 bold">' . $res['brand_name'] . '</td></tr>'; $tooltip .= '<tr class="e"><td>Info</td><td>• ' . implode('<br />• ', $infos) . '</td></tr>'; $tooltip .= '<tr class="o"><td>Price Preview</td><td>' . $obj_product->displayPricePreview($sales_partner_id) . '</td></tr>'; $tooltip .= '<tr class="e"><td>Margin in %</td><td>' . $obj_product->displayMargin($price, $margin) . '</td></tr>'; $tooltip .= '<tr class="o"><td>Age JG (finalized)</td><td>' . $res['jng_products_age'] . ' days</td></tr>'; $tooltip .= '<tr class="e"><td>Age (selected SP filter)</td><td>' . $res['products_age'] . ' days</td></tr>'; $tooltip .= '<tr class="o"><td>Total Sold (excl. JG)</td><td>' . $total_sold . '</td></tr>'; $tooltip .= '<tr class="e"><td>Total Returns (excl. JG)</td><td>' . $return_info . '</td></tr>'; $tooltip .= '<tr class="o"><td>Pieces Sold</td><td>' . str_replace('align="center"', 'align="left"', $obj_product->displayRecentSoldTable()) . '</div></td></tr>'; $tooltip .= '<tr class="e"><td>Qty. Sold (excl. JG)</td><td>' . $qty_sold . '</td></tr>'; $tooltip .= '</table></div>'; $ajaxResult = array(); $ajaxResult['type'] = $type; $ajaxResult['spid'] = $jng_sp_id; $ajaxResult['products_id'] = $products_id; $ajaxResult['tooltip'] = $tooltip; $ajaxResult['rownumber'] = $row_number; $ajaxResult['showingid'] = $showing_id; ajaxReturn($ajaxResult); } else { $sales_partner_id = $jng_sp_id == 'allsp' ? '0' : $jng_sp_id; $price = $obj_product->getPriceSelling($sales_partner_id); $net_price = Product::calculateNetPrice($price, VAT); $cogs = $obj_product->getProductCOGSValue(); $profit = Product::calculateProfit($net_price, $cogs); $margin = Product::calculateMargin($profit, $net_price); $material_expenses = displayCurrency(DEFAULT_CURRENCY, convertCurrency($res['material_expenses'], 'EUR', DEFAULT_CURRENCY), false); $products_price = displayCurrency(DEFAULT_CURRENCY, $res['products_price'], false); $products_price_old = displayCurrency(DEFAULT_CURRENCY, $res['products_price_old'], false); $products_created = date('d-M-Y', strtotime($res['products_date_added'])); $vc_now = number_format($res['vc_now'], 2); $total_vc = number_format($res['vc_total'], 2); $vc_percent = number_format($res['vc_percent'], 1); //$margin = $res['margin']; //$margin = '<span class="'.(($class_pm->priceMargindIsGood($res['products_price'], $margin)) ? 'green' : 'red') . '">' . // number_format($margin, 1) . '%</span>'; $margin = $obj_product->displayMargin($price, $margin); $returned_rate = number_format($res['returned_rate'], 1); $discount = number_format($res['products_discount'], 2); $total_sales = number_format($res['total_sales'], 2); $sales_monthly = number_format($res['sales_monthly'], 1); $sales_weekly = number_format($res['sales_weekly'], 1); $jng_nodata = '<span class="notice">N/A' . ($type == 'displaytooltip' ? ' ' : '<br />') . 'for J&G</span>'; //0-4 $resultsdt[] = $products_image; $resultsdt[] = $products_id; $resultsdt[] = $res['products_model']; $resultsdt[] = $res['products_name']; //$resultsdt[] = $class_pm->displayProductName($products_id); $resultsdt[] = $products_price_old; //5-9 $resultsdt[] = $products_price; $resultsdt[] = $discount; $resultsdt[] = $jng_sp_id == '0' ? $jng_nodata : $vc_now; $resultsdt[] = $jng_sp_id == '0' ? $jng_nodata : $vc_percent; $resultsdt[] = $margin; //10-14 $resultsdt[] = $res['products_age']; $resultsdt[] = $jng_sp_id == '0' ? $jng_nodata : $res['total_sold']; $resultsdt[] = $jng_sp_id == '0' ? $jng_nodata : $total_vc; $resultsdt[] = $res['total_returned']; $resultsdt[] = $jng_sp_id == '0' ? $jng_nodata : $returned_rate; //15-19 $resultsdt[] = $jng_sp_id == '0' ? $jng_nodata : $total_sales; $resultsdt[] = $res['sold_monthly_1']; $resultsdt[] = $res['sold_monthly_2']; $resultsdt[] = $res['sold_monthly_3']; $resultsdt[] = $jng_sp_id == '0' ? $jng_nodata : $sales_weekly; //20-24 $resultsdt[] = $jng_sp_id == '0' ? $jng_nodata : $sales_monthly; $resultsdt[] = $res['brand_name']; $resultsdt[] = $res['kill_status']; $resultsdt[] = $products_created; $resultsdt[] = $res['hh_stock']; //25-28 $resultsdt[] = $products_complexity; $resultsdt[] = $products_stars; $resultsdt[] = $products_is_watched; $resultsdt[] = $res['sample_created']; //29 $resultsdt[] = $res['jng_products_age']; $resultsdt[] = $material_expenses; $resultsdt[] = $res['products_length']; } } elseif ($display_type == 'thumbnail') { //0-4 $resultsdt[] = $products_image; $resultsdt[] = $products_id; $resultsdt[] = $res['products_model']; $resultsdt[] = $products_stars; $resultsdt[] = $products_is_watched; //5 $resultsdt[] = $res['sample_created']; } $result['type'] = $type; $result['spid'] = $jng_sp_id; $result['result'] = implode($this->result_separator, $resultsdt); $result['rownumber'] = $row_number; $result['showingid'] = $showing_id; } ajaxReturn($result); }
/** * Set object parameters * @param String $date * @param String $name * @param Int $status * @param String $create_by */ private function setDetail($date = '', $name = '', $status = '', $create_by = '') { //GRAB OWNER IMAGE if ($create_by > 0) { use_class('minierp_users'); $class_mu = new minierp_users(); $user_owner = $class_mu->retrieveList("id={$create_by}"); $create_by_image = $user_owner[0]['users_image']; } else { $create_by_image = ''; } $this->date = $date; $this->name = $name; $this->status = $status; $this->create_by = $create_by; $this->create_by_image = $create_by_image; $this->setItems(); }
function drawLikes($div_style = '') { global $session_userinfo; $content = '<div id="likers" class="boxer"' . ($div_style != '' ? ' style="' . $div_style . '"' : '') . '><table border="0" cellpadding="0" cellspacing="0"><tr>'; $content .= '<td><div class="icon-likes"> </div></td>'; $content .= '<td>'; $likesTotal = 0; $likesYou = ''; if (count($this->list) > 0) { use_class('minierp_users'); $class_mu = new minierp_users(); $users_filter = 'id IN (' . implode(',', $this->list) . ')'; $likesName = array(); $userlist_raw = $class_mu->retrieveList($users_filter, 'username'); foreach ($userlist_raw as $u) { $likesTotal++; if ($session_userinfo['id'] == $u['id']) { $likesYou = $this->drawSingleLike($u['id'], 'You'); } else { $likesName[] = $this->drawSingleLike($u['id'], $u['username']); } } if ($likesYou != '') { $content .= $likesYou; } $likesName_total = count($likesName); if ($likesName_total == 1) { if ($likesYou != '') { $content .= ' and '; } $content .= $likesName[0]; } elseif ($likesName_total > 1) { if ($likesYou != '') { $content .= ', '; } $lastName = array_pop($likesName); $content .= implode(', ', $likesName); $content .= ' and ' . $lastName; } $content .= ' like this.'; } if ($likesTotal > 0) { $content .= '<br />'; } $content .= '<a href="" class="action">Click here to '; $content .= $likesYou == '' ? 'like' : 'stop liking'; $content .= ' this</a>'; $content .= '</td>'; //#likers $content .= '</tr></table></div>'; return $content; }
$q .= " LEFT JOIN improvements i2 ON i2.pic=mu.id AND i2.department={$filter_team} AND i2.status={$status}"; $q .= " WHERE i.department={$filter_team} AND i.status IN (1,2,3,4,5,7)"; $q .= " GROUP BY pic_id ORDER BY pic_name"; $r = tep_db_query($q); $pics = array(); $pics['0'] = 'Show All'; while ($row = tep_db_fetch_array($r)) { $pics[$row['pic_id']] = "{$row['pic_name']} ({$row['total_mims']})"; } //LOAD DATA FOR COMBO BOX PIC (UNSET) $q = tep_db_query("SELECT COUNT(DISTINCT improvements_id) AS total_mims FROM improvements WHERE department={$filter_team} AND status={$status} AND pic=0"); $row = tep_db_fetch_array($q); $pics['UNSET'] = 'Unset (' . $row['total_mims'] . ')'; if ($filter_pic != 'UNSET' && $filter_pic > 0 && !isset($pics[$filter_pic])) { use_class('minierp_users'); $class_mu = new minierp_users(); $user = $class_mu->retrieveList("id={$filter_pic}"); $pics[$user[0]['id']] = $user[0]['username'] . ' (0)'; } $tabcontent = '<div class="filter_type" style="float:left;">'; $tabcontent .= '<strong>Filter by </strong>'; $tabcontent .= '<select>' . loadComboListFromArray(array('Team', 'Owner'), null, $filter_type) . '</select>'; $tabcontent .= '</div>'; $tabcontent .= '<div class="filter_owner" style="float:left;' . ($filter_type == '1' ? '' : 'display:none;') . '">'; $tabcontent .= '<select><option value="0" class="notice">Select an Owner...</option>' . loadComboListFromArray($owners, null, $filter_owner, false) . '</select>'; $tabcontent .= '</div>'; $tabcontent .= '<div class="filter_dept" style="float:left;' . ($filter_type == '0' ? '' : 'display:none;') . '">'; //$tabcontent .= '<strong style="margin-right:5px;">Team</strong>'; $tabcontent .= '<select><option value="0" class="notice">Select a Team...</option>' . loadComboListFromArray($teams, null, $filter_team) . '</select>'; $tabcontent .= '</div>'; $tabcontent .= '<div class="filter_pic" style="float:left;' . ($filter_type == '0' ? '' : 'display:none;') . '">';
<?php use_class('minierp_users'); $class_mu = new minierp_users(); $reloadlist = false; $btn_text_setact = 'Set Active'; $btn_text_setina = 'Set Inactive'; //SUBMIT ACTION if (isset($_POST['me_action'])) { if ($_POST['me_action'] == 'SAVEMEUSERDETAIL') { $user_id = tep_db_prepare_input($_POST['user_id']); $password = tep_db_prepare_input($_POST['userwpw']); if ($password != '' && strlen($password) < 5 || $user_id == 'new' && $password == '') { $messagebox->add('Password must have minimum 5 characters, please retry.'); } else { $reloadlist = true; $username = tep_db_prepare_input($_POST['username']); $email = tep_db_prepare_input($_POST['email']); $active_status = tep_db_prepare_input($_POST['status']); $skype_id = tep_db_prepare_input($_POST['skype_id']); if ($user_id == 'new') { if ($username == '') { $messagebox->add('Please specify username!'); } else { $new_user_id = $class_mu->createNewUser($username, $password, $email, $active_status, $skype_id); if ($new_user_id > 0) { $messagebox->add("New User ID {$new_user_id} is successfully created.", 'green'); //header("Location: ?open=setting-me-users&id=$new_user_id&status=new"); //exit; } else { $messagebox->add('Username "<strong>' . $username . '</strong>" already exist, please try a different one!');
public function setDetail($name = '', $team = '', $category = '', $priority = '', $date_added = '', $owner_id = '', $owner_name = '', $owner_image = '', $owner_location = '', $pic = '', $pic_name = '', $pic_image = '', $description = '', $goals = '', $eta = '', $deadline = '', $check_date = '', $comments = '', $followers = '', $attachments = '', $likes = '', $kickoff_date = '', $relevancy_stars = 0, $is_sensitive = 0, $description_technical = '', $attachments_kickoff = '') { $module_name = 'Improvement'; $module_item_category = self::getTeamCategories($team, $category); $module_item_link = 'open=improvement&id=' . $this->id; //GRAB OWNER IMAGE if ($owner_id > 0) { use_class('minierp_users'); $class_mu = new minierp_users(); $user_owner = $class_mu->retrieveList("id = '{$owner_id}'"); $owner_image = $user_owner[0]['users_image']; } //GRAB PIC IMAGE if ($pic > 0) { if (!is_object($class_mu)) { use_class('minierp_users'); $class_mu = new minierp_users(); } $user_pic = $class_mu->retrieveList("id = '{$pic}'"); $pic_image = $user_pic[0]['users_image']; } $this->name = $name; $this->team = $team; $this->category = $category; $this->priority = $priority; $this->date_added = $date_added; $this->owner_id = $owner_id; $this->owner_name = $owner_name; $this->owner_image = is_file(DIR_WS_IMAGES . $owner_image) ? $owner_image : 'user-default.png'; $this->owner_location = $owner_location; $this->pic = $pic; $this->pic_name = $pic_name; $this->pic_image = is_file(DIR_WS_IMAGES . $pic_image) ? $pic_image : 'user-default.png'; $this->description = $description; $this->description_technical = $description_technical; $this->goals = $goals; $this->eta = $eta; $this->deadline = $deadline; $this->check_date = $check_date; $this->comments = new comments('improvements', 'comments', 'improvements_id', $this->id, $comments, '', '', $module_name, $module_item_category, $name, $module_item_link); $this->followers = new followers('improvements', 'followers', 'improvements_id', $this->id, $this->owner_id, $followers, $module_name, $module_item_category, $name, $module_item_link); $this->attachments = new attachments('improvements', 'attachments', 'improvements_id', $this->id, 'improvements', $attachments); $this->attachments_kickoff = new attachments('improvements', 'attachments_kickoff', 'improvements_id', $this->id, 'improvements', $attachments_kickoff); $this->likes = new likes('improvements', 'likes', 'improvements_id', $this->id, $this->owner_id, $likes, $module_name, $module_item_category, $name, $module_item_link); $this->kickoff_date = $kickoff_date; $this->relevancy_stars = $relevancy_stars; $this->is_sensitive = $is_sensitive; }
$logger->close(); $result = array(); $result['total_updated'] = $n_updated; $result['stock_updated'] = $stock; ajaxReturn($result); } elseif ($_POST['me_action'] == 'ADDTOWATCHLIST') { use_class('minierp_users'); $class_mu = new minierp_users(); $pid = tep_db_prepare_input($_POST['products_id']); $class_mu->addToWatchlist($session_userinfo['id'], $pid); $result = array(); $result['pid'] = $pid; ajaxReturn($result); } elseif ($_POST['me_action'] == 'REMOVEFROMWATCHLIST') { use_class('minierp_users'); $class_mu = new minierp_users(); $pid = tep_db_prepare_input($_POST['products_id']); $class_mu->removeFromWatchlist($session_userinfo['id'], $pid); $result = array(); $result['pid'] = $pid; ajaxReturn($result); } else { $class_ps->postProcess($_POST); } } $title = 'Products Analysis » ' . $class_ps->createComboSP(); $content .= '<table width="99%"><tr>'; $content .= '<td>'; $content .= $class_ps->createFilterBox(); $content .= '</td>'; $content .= '<td width="200">';
function drawFollowers() { use_class('minierp_users'); $class_mu = new minierp_users(); $users_filter = 'status=1'; if (count($this->list) > 0) { $users_filter .= ' OR id IN (' . implode(',', $this->list) . ')'; } $userlist = array(); $userlist_raw = $class_mu->retrieveList($users_filter, 'username'); foreach ($userlist_raw as $u) { $userlist[$u['id']] = $u['username']; } $owner_name = $userlist[$this->owner_id]; unset($userlist[$this->owner_id]); $followersName = array(); foreach ($this->list as $uid) { $followersName[$uid] = $userlist[$uid]; unset($userlist[$uid]); } $addfols = '<div class="fol-add"><select class="input">' . loadComboListFromArray($userlist, null, null, false) . '</select> <span class="boxer pointer">+</span></div>'; //$content .= $addfols; $totalfollowers = count($followersName); $content = '<div id="fol-users" style="padding-bottom:10px;">'; //$content .= '<div class="fol bold">'.$owner_name.' (Owner)</div>'; $content .= $this->drawSingleFollower($this->owner_id, $owner_name); if ($totalfollowers > 0) { foreach ($followersName as $uid => $uname) { //$content .= $this->drawSingleFollower($uid, $uname, false, ($uid==$session_user_id)); $content .= $this->drawSingleFollower($uid, $uname); } } $content .= '</div>'; //#fol-users $content .= $addfols; return $content; }