} param('vote_type', 'string', ''); param('vote_ID', 'string', 0); param('checked', 'integer', 0); param('redirect_to', 'url', ''); // Use the glyph or font-awesome icons if requested by skin param('b2evo_icons_type', 'string', ''); $Ajaxlog->add(sprintf('vote action: %s', $vote_action), 'note'); $Ajaxlog->add(sprintf('vote type: %s', $vote_type), 'note'); $Ajaxlog->add(sprintf('vote ID: %s', $vote_ID), 'note'); $voting_form_params = array('vote_type' => $vote_type); switch ($vote_type) { case 'link': // Vote on pictures $link_ID = preg_replace('/link_(\\d+)/i', '$1', $vote_ID); if (empty($link_ID) || !is_decimal($link_ID)) { // There is no correct link ID break 2; } $LinkCache =& get_LinkCache(); $Link =& $LinkCache->get_by_ID($link_ID, false); if (!$Link) { // Incorrect link ID break 2; } $File =& $Link->get_File(); if (!$File) { // The Link File is not available break 2; } if (empty($File->hash)) {
/** * Display formatted weight value in gram using a dot or comma as decimal separator. * When using dot, comma will be used as thousand separator and vice versa. * @param Float $weight weight value (in gram) * @param String $decimal_separator dot or comma to be used as decimal separator * @return String Formatted weight */ function displayWeight($weight, $decimal_marker = ',') { $thousand_marker = ','; if ($decimal_marker == ',') { $thousand_marker = '.'; } $decimal_point = is_decimal($weight) ? 2 : 0; $result = number_format($weight, $decimal_point, $decimal_marker, $thousand_marker); $result .= ' gram'; return $result; }
/** * Display weight of product in kilogram * @param Int $language_id * @return String */ public function displayWeight($language_id) { if ($language_id == '2' || $language_id == '3') { $dec_separator = ','; } else { $dec_separator = '.'; } //convert value from gram to kilogram $weight = $this->detail['pd2']['weight'] / 1000; if ($weight > 1 && !is_decimal($weight)) { //remove decimal when it's not needed $weight = round($weight); } else { $weight = number_format($weight, 2, $dec_separator, ''); } return $weight . ' kg'; }
$content .= '<div id="procat-accordion">'; $content .= '<div>'; $content .= '<h3><a href="#">Product ID</a></h3>'; $content .= '<div><table class="form" border="0" cellpadding="0" cellspacing="0">'; $content .= '<tr><td width="150">J&G ID</td><td>'; $content .= '<input type="text" name="products_id" value="' . $product_id . '" readonly="readonly" onclick="this.select();" />'; $content .= '</td></tr>'; $content .= '<tr><td>Article ID</td><td>'; $content .= '<input type="text" name="article_number" value="' . $article_number . '" readonly="readonly" onclick="this.select();" />'; $content .= '<tr><td>SP Product ID</td><td>'; $content .= '<input type="text" class="input2" id="products_id_sp" name="products_id_sp" value="' . $products_id_sp . '" onclick="this.select();" />'; $content .= '</td></tr>'; if ($jng_sp_id == '1' || $jng_sp_id == '3') { $real_article_number = substr($sp_detail['jng_id'], -3) . $article_number; if ($spinfo['length'] > 0) { if ($spinfo['length'] < 10 && is_decimal($spinfo['length'])) { $spinfo['length'] = $spinfo['length'] * 10; } $real_article_number .= '_' . intval($spinfo['length']); } $content .= '<tr>'; $content .= '<td>Neckermann ID</td>'; $content .= '<td><input type="text" name="real_article_number" value="' . $real_article_number . '" readonly="readonly" onclick="this.select();" /></td>'; $content .= '</tr>'; } /* $content .= '<tr><td>Supplier ID</td><td>'; $content .= '<input type="text" id="suppliers_products_id" class="input2" name="suppliers_products_id" value="'.$suppliers_products_id.'" />'; $content .= '</td></tr>'; $content .= '<tr id="supplier_name_row"><td>Supplier Name</td><td>'; $content .= '<input type="text" id="suppliers_name" class="input2" name="suppliers_name" value="'.$suppliers_name.'" />';
$dishDiets .= $value . ', '; } $dishDiets = substr($dishDiets, 0, -2); $dishDiets .= ')'; } ?> <div class="lunch-dish--title"><?php the_title(); ?> <span class="lunch-dish--diets"><?php echo $dishDiets; ?> </span></div> <div class="lunch-dish--price"> <?php echo is_decimal(get_field('price')) ? number_format((double) get_field('price'), 2, ',', '') : the_field('price'); ?> € </div> </div> <?php } ?> <?php } else { echo 'Ei vielä lounaita tälle päivälle'; } ?> </div> </div> <?php
$aired = "Aired:"; $firstAired = date('F j, Y', $episode->firstAired); } else { $aired = "Aired:"; $firstAired = "<font style='color:#aaa;'>n/a</font>"; } if ($episode->overview) { $overview = $episode->overview; if (substr($overview, 0, 3) == 'A. ') { $overview = substr($overview, 3); } $overview = substr($overview, 0, 120) . ''; } else { $overview = "No overview available for this episode"; } if (!$ignore && $seasonClean && is_decimal($episode->dvdEpisodeNumber) || $force) { $episode2 = $show->getEpisode($seasonClean, $episodeClean + 1); if ($episode2) { if ($episode2->overview) { $overview2 = $episode2->overview; if (substr($overview2, 0, 3) == 'B. ') { $overview2 = substr($overview2, 3); } $overview2 = substr($overview2, 0, 120) . ''; } else { $overview2; } } } if ($episode->id) { $tvdbepisode1_link1 = "<a href='http://thetvdb.com/?tab=episode&seriesid={$episode->seriesId}&seasonid={$episode->seasonId}&id={$episode->id}' style='font-weight: bold;color: #ff7800;text-shadow: 1px 1px 0px #000000;' target='_blank'>";
public function post_credit_buy(Request $request) { if ($request->ajax()) { function is_decimal($val) { return is_numeric($val) && floor($val) == $val; } if (Config::get('leech.payment_type') == 'discount' && ($request['amount'] != 5 && $request['amount'] != 10 && $request['amount'] != 20 && $request['amount'] != 50 && $request['amount'] != 100)) { return response()->json(['r' => 'e', 'm' => '1']); } if (is_null($request['amount']) || !is_numeric($request['amount']) || $request['amount'] > 100 || $request['amount'] < 5 || is_float($request['amount']) || !is_decimal($request['amount'])) { return response()->json(['r' => 'e', 'm' => '1']); } else { /*******************************************/ if (Config::get('leech.payment_type') == 'discount') { if ($request['amount'] == 5) { $amount = Config::get('leech.5GB_price'); } else { if ($request['amount'] == 10) { $amount = Config::get('leech.10GB_price'); } else { if ($request['amount'] == 20) { $amount = Config::get('leech.20GB_price'); } else { if ($request['amount'] == 50) { $amount = Config::get('leech.50GB_price'); } else { if ($request['amount'] == 100) { $amount = Config::get('leech.100GB_price'); } else { return response()->json(['r' => 'e', 'm' => '1']); } } } } } } else { $amount = $request['amount'] * Config::get('leech.credit_unit'); } $id = DB::table('payments')->insertGetId(['user_id' => Auth::user()->id, 'amount' => $amount, 'credit' => $request['amount']]); try { $client = new nusoap_client(Config::get('leech.soap_client')); } catch (Exception $e) { return response()->json(['r' => 'e', 'm' => '2']); } $namespace = Config::get('leech.namespace'); if ($client->getError()) { return response()->json(['r' => 'e', 'm' => '3']); } $parameters = ['terminalId' => Config::get('leech.terminalId'), 'userName' => Config::get('leech.userName'), 'userPassword' => Config::get('leech.userPassword'), 'orderId' => $id, 'amount' => $amount, 'localDate' => date("ymd"), 'localTime' => date("His"), 'additionalData' => 'Sepehr (B) - ' . Auth::user()->username, 'callBackUrl' => asset('/buy'), 'payerId' => 0]; $result = $client->call('bpPayRequest', $parameters, $namespace); if ($client->fault) { return response()->json(['r' => 'e', 'm' => '4']); } else { $resultStr = $result; if ($client->getError()) { return response()->json(['r' => 'e', 'm' => '5']); } else { $res = explode(',', $resultStr); $ResCode = $res[0]; if ($ResCode == 0) { DB::table('payments')->where('id', $id)->update(['RefId' => $res[1], 'ResCode1' => $res[0]]); return response()->json(['r' => 's', 'm' => '6', 'RefId' => $res[1], 'o_id' => $id, 't_amount' => $amount . ' ' . Config::get('leech.currency'), 't_credits' => $request['amount'] . ' GB']); } else { DB::table('payments')->where('id', $id)->update(['ResCode1' => $res[0]]); return response()->json(['r' => 'e', 'm' => '7']); } } } /*******************************************/ } } else { $post = true; $input = $request->only('RefId', 'ResCode', 'SaleOrderId', 'SaleReferenceId', 'CardHolderInfo', 'CardHolderPan'); $payment = DB::table('payments')->where('id', '=', $input['SaleOrderId'])->where('RefId', '=', $input['RefId'])->first(); // var_dump($payment); //return; $main = new main(); if ($payment == null) { return view('payment.buy', ['main' => $main, 'res' => 'error', 'error' => 'Wrong ID.', 'post' => $post]); } else { DB::table('payments')->where('id', '=', $input['SaleOrderId'])->where('RefId', '=', $input['RefId'])->update(['ResCode2' => $input['ResCode'], 'SaleReferenceId' => $input['SaleReferenceId'], 'CardHolderInfo' => $input['CardHolderInfo'], 'CardHolderPan' => $input['CardHolderPan'], 'pay_time' => date('Y-m-d H:i:s', time())]); if ($input['ResCode'] == 0) { //we should verify try { $client = new nusoap_client(Config::get('leech.soap_client')); } catch (Exception $e) { return view('payment.buy', ['main' => $main, 'res' => 'error', 'error' => 'We could not verify your payment. We will refund your money.', 'post' => $post]); } $namespace = Config::get('leech.namespace'); if ($client->getError()) { return view('payment.buy', ['main' => $main, 'res' => 'error', 'error' => 'We could not verify your payment. We will refund your money.', 'post' => $post]); } $parameters = ['terminalId' => Config::get('leech.terminalId'), 'userName' => Config::get('leech.userName'), 'userPassword' => Config::get('leech.userPassword'), 'orderId' => $input['SaleOrderId'], 'saleOrderId' => $input['SaleOrderId'], 'saleReferenceId' => $input['SaleReferenceId']]; // Call the SOAP method $result = $client->call('bpVerifyRequest', $parameters, $namespace); if ($client->fault) { return view('payment.buy', ['main' => $main, 'res' => 'error', 'error' => 'We could not connect to bank.', 'post' => $post]); } else { $resultStr = $result; $err = $client->getError(); if ($err) { return view('payment.buy', ['main' => $main, 'res' => 'error', 'error' => 'We could not connect to bank. No 2', 'post' => $post]); } else { DB::table('payments')->where('id', '=', $input['SaleOrderId'])->where('RefId', '=', $input['RefId'])->update(['verifyCode' => $resultStr]); if ($resultStr == 0) { // SETTLE try { $client = new nusoap_client(Config::get('leech.soap_client')); } catch (Exception $e) { return view('payment.buy', ['main' => $main, 'res' => 'error', 'error' => 'We could not verify your payment. We will refund your money.', 'post' => $post]); } $namespace = Config::get('leech.namespace'); if ($client->getError()) { return view('payment.buy', ['main' => $main, 'res' => 'error', 'error' => 'We could not verify your payment. We will refund your money.', 'post' => $post]); } $parameters = ['terminalId' => Config::get('leech.terminalId'), 'userName' => Config::get('leech.userName'), 'userPassword' => Config::get('leech.userPassword'), 'orderId' => $input['SaleOrderId'], 'saleOrderId' => $input['SaleOrderId'], 'saleReferenceId' => $input['SaleReferenceId']]; $result = $client->call('bpSettleRequest', $parameters, $namespace); if ($client->fault) { $res = -1; } else { $res = $result; } DB::table('payments')->where('id', '=', $input['SaleOrderId'])->where('RefId', '=', $input['RefId'])->update(['settleResponse' => $res]); $user = DB::table('users')->where('id', '=', $payment->user_id)->first(); $info = ['username' => $user->username, 'old.credit' => $user->credit, 'refID' => $input['SaleReferenceId'], 'card' => $input['CardHolderPan']]; DB::table('users')->where('id', '=', $payment->user_id)->increment('credit', $payment->credit * 1024 * 1024 * 1024); DB::table('credit_log')->insert(array('user_id' => $payment->user_id, 'credit_change' => $payment->credit * 1024 * 1024 * 1024, 'agent' => 0)); $info['new.credit'] = $info['old.credit'] + $payment->credit * 1024 * 1024 * 1024; return view('payment.buy', ['main' => $main, 'res' => 'success', 'info' => $info, 'post' => $post]); } else { return view('payment.buy', ['main' => $main, 'res' => 'error', 'error' => 'Your Payment is not verified', 'post' => $post]); } } } } else { return view('payment.buy', ['main' => $main, 'res' => 'error', 'error' => 'Your Payment was not successful', 'post' => $post]); } } } }
/** * Checks if the param is a decimal number * * @param string decimal to check * @return string error message if decimal is not valid */ function check_is_decimal($decimal) { if (!is_decimal($decimal)) { return T_('The decimal value is invalid.'); } }
# EDDHA tints the water red if (preg_match('/EDDHA/', $comp)) { if ((double) $results['Fe'] > 0.002) { $toxic = 'eddha'; } } //Outputs results... $json['success'] = true; if (is_decimal($dose_amount)) { $json['dose_amount'] = number_format($dose_amount, $round_to); } else { $json['dose_amount'] = $dose_amount; } $json['dose_units'] = $dose_units; foreach ($results as $key => $value) { if (is_decimal($value)) { $json[$key] = number_format($value, $round_to); } else { $json[$key] = $value; } } //$json['debug'] = $debug; if ($sol_error) { $json['sol_error'] = $sol_error; } if ($toxic) { $json['toxic'] = $toxic; } //Target method... $json['target_ppm'] = $target_amount; //Target element...
$pct_reject = $received > 0 ? $bad / $received * 100 : 0; $row = array(); // $ids_data = explode('|', $ids); // $sup_id = $ids_data[0]; // $sup_name = $ids_data[1]; $sup_pct_all_cat = $total_amount > 0 ? $amount / $total_amount * 100 : 0; $sup_pct_per_cat = $total_amount_cat[$cat] > 0 ? $amount / $total_amount_cat[$cat] * 100 : 0; $total_sup_pct += $sup_pct_all_cat; $sup_reject = $dt['total_received'] > 0 ? $dt['bad'] / $dt['total_received'] * 100 : 0; $row['c tac'] = "{$sup_name}"; $row['o'] = displayWeight($dt['weight']); $row['t'] = displayCurrency('IDR', $amount); $row['t2'] = (is_decimal($sup_pct_all_cat) ? number_format($sup_pct_all_cat, 2) : $sup_pct_all_cat) . ' %'; // $row['e'] = (is_decimal($sup_pct_per_cat) ? number_format($sup_pct_per_cat, 2) : $sup_pct_per_cat ).' %'; // $row['s'] = (is_decimal($pct_fullfilled) ? number_format($pct_fullfilled, 2) : $pct_fullfilled ).' %'; $row['r'] = (is_decimal($pct_reject) ? number_format($pct_reject, 2) : $pct_reject) . ' %'; $table[] = $row; } //PREPARE TOTAL ROW $row = array(); $row['c total text-center'] = 'Total'; $row['o total'] = displayWeight($total_weight); $row['t total'] = displayCurrency('IDR', $total_amount); $row['t2 total'] = "{$total_sup_pct} %"; $row['r total'] = ''; //$row['e'] = ""; //$row['s'] = ''; $table[] = $row; $content = '<div style="width:700px;">'; $content .= '<div style="float:right;">'; $content .= '<form name="filtering" action="?open=' . $session_page . '" method="post">';
function pivot_table($query, $float = null, $offset = null) { $fields = $query->list_fields(); ?> <table class="table table-bordered table-hover <?php echo $float == true ? "floathead" : ""; ?> " style="width:100%!important;"> <thead> <tr> <?php foreach ($fields as $field) { ?> <th><?php echo str_replace("_", " ", $field); ?> </th> <?php } ?> </tr> </thead> <tbody> <?php $tmp[] = ""; $x = 0; foreach ($fields as $field) { $tmp[$field] = ""; $assoc_field[$x] = $field; $x++; } $rin = 0; $GTOTAL = array(); foreach ($query->result_array() as $row) { $x = 0; foreach ($fields as $field) { if ($tmp[$field] != $row[$field]) { $z = $x + 1; if ($z < sizeof($assoc_field)) { $tmp[$assoc_field[$z]] = ""; } } $x++; } ?> <!-- <tr> <?php $y = 0; foreach ($fields as $field) { $arrow = $query->row_array($rin + 1); if ($row[$field] != $arrow[$field] && $y <= sizeof($fields) - 6) { ?> <td>TOTAL <?php echo $row[$field]; ?> </td> <?php } else { ?> <td> <?php if ($row[$field] != $arrow[$field] && $totals[$field] != 0.0) { //echo $totals[$field]; } ?> </td> <?php } $y++; } ?> </tr> --> <tr> <?php foreach ($fields as $field) { ?> <td style="border-left:1px solid!important; <?php echo is_decimal($row[$field]) ? "text-align:right!important;" : ""; ?> <?php echo $tmp[$field] != $row[$field] || is_decimal($row[$field]) === true || $row[$field] == "" && $tmp[$field] != "" ? "border-top:1px solid!important" : "border-top:0;border-bottom:0!important;"; ?> "> <?php echo $tmp[$field] != $row[$field] || is_decimal($row[$field]) === true ? is_decimal($row[$field]) ? number_format($row[$field], 2) : $row[$field] : ""; ?> </td> <?php $tmp[$field] = $row[$field]; if (is_decimal($row[$field])) { // $totals[$field] += $row[$field]; if (isset($GTOTAL[$field])) { $GTOTAL[$field] += $row[$field]; } else { $GTOTAL[$field] = $row[$field]; } } } ?> </tr> <?php $rin++; } ?> <tr style="background: #00cc99;color:#fff;font-weight: bold;"> <td colspan="<?php echo sizeof($fields) - $offset; ?> ">GRAND TOTAL</td> <?php foreach ($fields as $field) { ?> <?php if (isset($GTOTAL[$field])) { ?> <td style="text-align: right!important;"><?php echo number_format($GTOTAL[$field], 2); ?> </td> <?php } ?> <?php } ?> </tr> </tbody> </table> <?php }