当前位置: 首页>>代码示例>>PHP>>正文


PHP sbr_meta::getSBRRating方法代码示例

本文整理汇总了PHP中sbr_meta::getSBRRating方法的典型用法代码示例。如果您正苦于以下问题:PHP sbr_meta::getSBRRating方法的具体用法?PHP sbr_meta::getSBRRating怎么用?PHP sbr_meta::getSBRRating使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sbr_meta的用法示例。


在下文中一共展示了sbr_meta::getSBRRating方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: sbrCalc


//.........这里部分代码省略.........
    }
    if (!get_uid(false) || $err) {
        $res['success'] = false;
        echo json_encode($res);
        return;
    }
    $sbr_meta = sbr_meta::getInstance();
    $sbr_meta->scheme_type = $scheme_type;
    $schemes = $sbr_meta->getSchemes();
    $emp_total = $frl_total = 0;
    $emp_tax = $frl_tax = 0;
    $tcost = $sbr_cost;
    $sch = null;
    foreach ($schemes as $id => $scheme) {
        if ($scheme['type'] != $scheme_type) {
            continue;
        }
        $sch = $scheme;
    }
    $_taxes = $taxes = array();
    $rrq = array('U' => 0, 'Ff' => $frl_type, 'P' => $currency, 'Rf' => $rez_type);
    $pct = 0;
    foreach ($sch['taxes'][0] as $id => $tax) {
        $cost = sbr_meta::calcAnyTax($tax['id'], $tax['scheme_id'], $tcost, $rrq);
        $pct = $cost / $tcost;
        if (!$pct) {
            continue;
        }
        $tax['pct'] = $pct;
        $_taxes['frl'][] = $tax;
        $frl_tax += $pct * 100;
    }
    $rrq = array('U' => 1, 'Ff' => $frl_type, 'P' => $currency, 'Rf' => $rez_type, 'C' => $tcost);
    foreach ($sch['taxes'][1] as $id => $tax) {
        $cost = sbr_meta::calcAnyTax($tax['id'], $tax['scheme_id'], $tcost, $rrq);
        $pct = $cost / $tcost;
        if (!$pct) {
            continue;
        }
        $tax['pct'] = $pct;
        $_taxes['emp'][] = $tax;
        $emp_tax += $pct * 100;
    }
    if ($sbr_cost) {
        $emp_cost = $sbr_cost + $sbr_cost * ($emp_tax / 100);
        $frl_cost = $sbr_cost - $sbr_cost * ($frl_tax / 100);
    } elseif ($emp_cost) {
        $sbr_cost = $emp_cost - $emp_cost / (100 + $emp_tax) * $emp_tax;
        $frl_cost = $sbr_cost - $sbr_cost * $frl_tax / 100;
    } elseif ($frl_cost) {
        $sbr_cost = $frl_cost + $frl_cost / (100 - $frl_tax) * $frl_tax;
        $emp_cost = $sbr_cost + $sbr_cost * ($emp_tax / 100);
    }
    if ($sbr_cost && $sbr_cost < sbr_stages::MIN_COST_RUR) {
        $err = 1;
        $res['msg'] = iconv('CP1251', 'UTF8', 'Минимальный бюджет проекта - ' . sbr_stages::MIN_COST_RUR . ' руб.');
        $res['success'] = false;
        echo json_encode($res);
        return;
    }
    if ($rez_type == sbr::RT_UABYKZ && $sbr_cost && $sbr_cost > sbr::usd2rur(sbr::MAX_COST_USD)) {
        $err = 1;
        $sum = sbr_meta::view_cost(sbr::usd2rur(sbr::MAX_COST_USD), exrates::BANK);
        $sum = html_entity_decode($sum);
        $res['msg'] = iconv('CP1251', 'UTF8', 'Максимальный бюджет ' . $sum . ', поскольку исполнитель не является резидентом Российской Федерации');
        $res['success'] = false;
        echo json_encode($res);
        return;
    }
    if ($_taxes['frl']) {
        foreach ($_taxes['frl'] as $k => $tax) {
            $cost = $sbr_cost * $tax['pct'];
            if ($tax['tax_id'] == $sbr_meta->getTaxByCode('TAX_NDFL') || $tax['tax_id'] == $sbr_meta->getTaxByCode('TAX_NDFL_NR')) {
                $cost = sbr_meta::ndfl_round($cost);
            }
            $taxes['frl'][] = array('id' => $tax['id'], 'scheme' => $scheme_type, 'cost' => sbr_meta::view_cost($cost, null, false));
            $frl_total += $cost;
        }
    }
    foreach ($_taxes['emp'] as $k => $tax) {
        $cost = $sbr_cost * $tax['pct'];
        if ($tax['tax_id'] == $sbr_meta->getTaxByCode('TAX_NDFL') || $tax['tax_id'] == $sbr_meta->getTaxByCode('TAX_NDFL_NR')) {
            $cost = sbr_meta::ndfl_round($cost);
        }
        $taxes['emp'][] = array('id' => $tax['id'], 'scheme' => $scheme_type, 'cost' => sbr_meta::view_cost($cost, null, false));
        $emp_total += $cost;
    }
    $res['usr_type'] = intval($_POST['usr_type']);
    $res['taxes'] = $taxes;
    $res['emp_total'] = sbr_meta::view_cost($emp_total, null, false);
    $res['frl_total'] = sbr_meta::view_cost($frl_total, null, false);
    $res['emp_cost'] = round($sbr_cost + $emp_total, 2);
    $res['frl_cost'] = round($sbr_cost - $frl_total, 2);
    $res['sbr_cost'] = round($sbr_cost, 2);
    $res['rating_get'] = sbr_meta::getSBRRating($res['sbr_cost']);
    $res['hash'] = $GLOBALS['host'] . '/' . sbr::NEW_TEMPLATE_SBR . '/?site=calc&hash=' . $hash;
    $res['success'] = true;
    echo json_encode($res);
    return;
}
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:101,代码来源:sbr.server.php

示例2: getRatingSum

 /**
  * Берем рейтинг который получит фрилансер при завершении и выплате по сделке без риска
  * 
  * @param float $total_sum   Сумаа гонорара этапа (в руб)
  * @return float
  */
 public function getRatingSum($total_sum, $percent = '0.05')
 {
     return sbr_meta::getSBRRating($total_sum);
     //, $percent);
 }
开发者ID:amage,项目名称:fl-ru-damp,代码行数:11,代码来源:sbr.php


注:本文中的sbr_meta::getSBRRating方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。