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


PHP get_discount函数代码示例

本文整理汇总了PHP中get_discount函数的典型用法代码示例。如果您正苦于以下问题:PHP get_discount函数的具体用法?PHP get_discount怎么用?PHP get_discount使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: curr_file

function curr_file($file_id)
{
    global $db, $tpf, $settings, $code;
    $file = $db->fetch_one_array("select * from {$tpf}files where file_id='{$file_id}'");
    if (!$file) {
        $file['is_del'] = 1;
    } else {
        $file['dl'] = create_down_url($file);
        $in_extract = $code == md5($file['file_key']) ? 1 : 0;
        $file['username'] = $file['p_name'] = @$db->result_first("select username from {$tpf}users where userid='{$file['userid']}' limit 1");
        $rs = $db->fetch_one_array("select folder_id,folder_name from {$tpf}folders where userid='{$file['userid']}' and folder_id='{$file['folder_id']}'");
        $file['file_category'] = $rs['folder_name'] ? '<a href="' . urr("space", "username=" . rawurlencode($file['username']) . "&folder_id=" . $rs['folder_id']) . '" target="_blank">' . $rs['folder_name'] . '</a>' : '- ' . __('uncategory') . ' -';
        $file_key = trim($file['file_key']);
        $tmp_ext = $file['file_extension'] ? '.' . $file['file_extension'] : "";
        $file_extension = $file['file_extension'];
        $file_ext = get_real_ext($file_extension);
        $file['file_description'] = str_replace('<br>', LF, $file[file_description]);
        $file['a_space'] = urr("space", "username=" . rawurlencode($file['username']));
        $file['file_name_min'] = filter_word($file['file_name'] . $tmp_ext);
        $file['file_name'] = filter_word($file['file_name'] . $tmp_ext);
        $file['file_size'] = get_size($file['file_size']);
        $file['p_time'] = $file['file_time'];
        $file['file_time'] = $file['time_hidden'] ? __('hidden') : date("Y-m-d", $file['file_time']);
        $file['credit_down'] = $file['file_credit'] ? (int) $file['file_credit'] : (int) $settings['credit_down'];
        $file['username'] = $file[user_hidden] ? __('hidden') : ($file['username'] ? '<a href="' . $file['a_space'] . '">' . $file['username'] . '</a>' : __('hidden'));
        $file['file_downs'] = $file['stat_hidden'] ? __('hidden') : get_discount($file[userid], $file['file_downs']);
        $file['file_views'] = $file['stat_hidden'] ? __('hidden') : get_discount($file[userid], $file['file_views']);
        $file['file_url'] = $settings['phpdisk_url'] . urr("viewfile", "file_id={$file['file_id']}");
        if (get_plans(get_profile($file[userid], 'plan_id'), 'open_second_page') == 3) {
            $file['a_downfile'] = urr("download", "file_id={$file_id}&key=" . random(32));
            $file['a_downfile2'] = urr("download", "file_id={$file_id}&key=" . random(32));
        }
    }
    return $file;
}
开发者ID:saintho,项目名称:phpdisk,代码行数:35,代码来源:download2.php

示例2: creatOrder

 /**
  * 生成订单
  */
 public function creatOrder()
 {
     $addr_id = intval($_POST['addr_id']);
     $addr_info = M('MemberAddrs')->where(array('addr_id' => $addr_id))->find();
     $goods_list = M('OrderGoods')->where(array('order_id' => 0, 'member_id' => $this->mid))->select();
     if (!empty($addr_info)) {
         $data['order_sn'] = order_sn();
         $data['member_id'] = $this->mid;
         $data['buyer_name'] = get_member_nickname($this->mid);
         switch (trim($_POST['pay_type'])) {
             case 1:
                 $data['payment_name'] = 'alipay';
                 break;
             case 2:
                 $data['payment_name'] = 'bdpay';
                 break;
         }
         $data['shipping_fee'] = 0;
         $data['goods_amount'] = 0;
         $data['discount'] = 0;
         $data['order_amount'] = 0;
         if (empty($goods_list)) {
             $this->error('您还没有选择好商品哦.', U('Cart/index'));
         }
         foreach ($goods_list as $key => $val) {
             //计算价格同时清除购物车里的商品
             $Cart = new Cart();
             $Cart->delItem($val['goods_id']);
             $goods_price = M('Goods')->where(array('goods_id' => $val['goods_id']))->getField('goods_price');
             if (get_distributor($this->mid)) {
                 $goods_price = $goods_price * MSC('distributor_discount');
             }
             $data['goods_amount'] += $goods_price * $val['goods_num'];
             $data['discount'] += $data['goods_amount'] * (1 - get_discount($val['goods_num']));
             //冻结库存
             M('Goods')->where(array('goods_id' => $val['goods_id']))->setDec('goods_storage', $val['goods_num']);
             M('Goods')->where(array('goods_id' => $val['goods_id']))->setInc('goods_freez', $val['goods_num']);
         }
         $data['order_amount'] = $data['goods_amount'] - $data['discount'];
         $data['order_message'] = str_rp($_POST['order_message'], 1);
         $member = M('Member')->where(array('member_id' => $this->mid))->field('mobile,email')->find();
         $data['mobile'] = $member['mobile'];
         $data['email'] = $member['email'];
         $data['order_state'] = 10;
         $data['add_time'] = NOW_TIME;
         $order_id = M('Order')->add($data);
         if ($order_id) {
             //认领订单商品 已从购物车页面写入
             M('OrderGoods')->where(array('order_id' => 0, 'member_id' => $this->mid))->setField('order_id', $order_id);
             //生成物流地址
             $address_data['order_id'] = $order_id;
             $address_data['buyer_id'] = $this->mid;
             $address_data['true_name'] = $addr_info['name'];
             $address_data['prov_id'] = $addr_info['province_id'];
             $address_data['city_id'] = $addr_info['city_id'];
             $address_data['area_id'] = $addr_info['area_id'];
             $address_data['address'] = $addr_info['addr'];
             $address_data['zip_code'] = $addr_info['zip'];
             $address_data['mob_phone'] = $addr_info['mobile'];
             $address_data['add_time'] = NOW_TIME;
             M('OrderAddress')->add($address_data);
             //订单日志
             $log_data['order_id'] = $order_id;
             $log_data['order_state'] = get_order_state_name(10);
             $log_data['change_state'] = get_order_state_name(20);
             $log_data['state_info'] = '会员确认订单';
             $log_data['log_time'] = NOW_TIME;
             $log_data['operator'] = '会员';
             M('OrderLog')->add($log_data);
             //进行支付跳转
             switch (trim($_POST['pay_type'])) {
                 case 1:
                     $this->success('订单生成成功', U('Pay/alipay', array('order_sn' => $data['order_sn'])));
                     break;
                 case 2:
                     $this->success('订单生成成功', U('Pay/bdpay', array('order_sn' => $data['order_sn'])));
                     break;
             }
         }
     } else {
         $this->error('请选择收货地址');
     }
 }
开发者ID:PrayerEzio,项目名称:zuoxika,代码行数:86,代码来源:OrderController.class.php

示例3: mysql_query

if ($card_id) {
    $vip = (int) @$vip;
    $sql = mysql_query("SELECT * FROM " . TABLE_CARD . " WHERE card_id='{$card_id}' AND vip='{$vip}' AND active!=0") or Error(1, __FILE__, __LINE__);
    if ($card = @mysql_fetch_array($sql)) {
        foreach ($contact_arr as $v) {
            $card[$v] = htmlspecialchars($card[$v], ENT_COMPAT, 'cp1251');
        }
        $card['active_select'] = array_select('active', array(-1 => 'Заблокирована', 1 => 'Активна'), $card['active'], 0, "onchange=\"blockdiv.style.display = (this.value==-1) ? '' : 'none'\"");
        $sql = mysql_query("SELECT count(*) FROM " . TABLE_ORDER . " WHERE card_id='{$card_id}' AND card_vip='{$vip}' AND !basket") or Error(1, __FILE__, __LINE__);
        $arr = @mysql_fetch_array($sql);
        $card['order_count'] = (int) @$arr[0];
        $card['order_link'] = "?p={$part}&searchorder=1&card_id={$card_id}&vip={$vip}";
        $sql = mysql_query("SELECT count(*) FROM " . TABLE_ORDER . " WHERE card_id='{$card_id}' AND card_vip='{$vip}' AND annul='' AND !basket") or Error(1, __FILE__, __LINE__);
        $arr = @mysql_fetch_array($sql);
        $card['active_count'] = (int) @$arr[0];
        $card['discount'] = get_discount($card['active_count'] + 1, $vip);
        $ofcount = 0;
        $card['office_select'] = mysql_select('office_id', "SELECT office_id, region FROM " . TABLE_OFFICE . " ORDER BY office_id", $card['office_id'], 0, '', $ofcount);
        $sql = mysql_query("SELECT MIN(card_id) FROM " . TABLE_CARD . " WHERE vip=1 AND active=0") or Error(1, __FILE__, __LINE__);
        $arr = @mysql_fetch_array($sql);
        $card['newcard_id'] = (int) @$arr[0];
        $card['admin_cardid'] = $admin_config['cardid'];
        $card['files'] = get_file_info($file_owner, $card['card_id']);
        $card['admin_config_card'] = $admin_config['card'];
        $content = get_template('templ/card.htm', $card);
    } else {
        $content = get_template('templ/card.htm', array("error" => 1));
    }
} else {
    if ($admin_config['card'] != 2) {
        $content = 'Нет доступа';
开发者ID:nikuha,项目名称:rs,代码行数:31,代码来源:card.php

示例4: print_inventory_sales

function print_inventory_sales()
{
    global $path_to_root;
    $from = $_POST['PARAM_0'];
    $destination = $_POST['PARAM_1'];
    if ($destination) {
        include_once $path_to_root . "/reporting/includes/excel_report.inc";
    } else {
        include_once $path_to_root . "/reporting/includes/pdf_report.inc";
    }
    $dec = user_price_dec();
    if ($category == ALL_NUMERIC) {
        $category = 0;
    }
    if ($category == 0) {
        $cat = _('All');
    } else {
        $cat = get_category_name($category);
    }
    $cols = array(0, 50, 100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750, 800, 850, 900, 950, 1000, 1050, 1100, 1150, 1200);
    $headers = array(_('Date'), _('Client Name'), _('IMC'), _('Charge'), _('Sales'), _('Date'), _('CM#'), _('Returns'), _(''), _('Discount'), _('Balance'), _('Date'), _('PR/OR#'), _('Date'), _('OR #'), _('Partial'), _('Net'), _('Balance'), _('Date'), _(''), _('Commission'), _('w/tax'), _('Net Commission'));
    $header2 = array(_(''), '', '', _('Invoice'), _('Amount'), _(''), _(''), _(''), _(''), _(''), _(''), _(''), _(''), _(''), _(''), _(''), _(''), _(''), _(''), _(''), '', _(''), _(''));
    $aligns = array('left', 'center', 'center', 'center', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right');
    $params = array(0 => $comments, 1 => array('text' => _('Period'), 'from' => $from, 'to' => $to), 2 => array('text' => _('Category'), 'from' => $cat, 'to' => ''));
    $rep = new FrontReport(_('Series Report'), "Series Report", user_pagesize(), 8, 'L');
    $rep->Font();
    $rep->Info($params, $cols, $header2, $aligns, $cols, $headers, $aligns);
    $rep->NewPage();
    $total = $grandtotal = 0.0;
    $total1 = $grandtotal1 = 0.0;
    $total2 = $grandtotal2 = 0.0;
    $catt = '';
    $res = getTransactions($imc, $from);
    while ($myrow = db_fetch($res)) {
        $company_data = get_company_prefs();
        $branch = get_branch($myrow["branch_code"]);
        $branch_data = get_branch_accounts($myrow['branch_code']);
        $dt = get_discount($branch_data['sales_discount_account'], $myrow['type'], $myrow['trans_no']);
        $salesman = get_imc_code($myrow['branch_code']);
        $res2 = get_return_details($myrow['order_']);
        $returns = 0;
        $rtn_dt = 0;
        while ($myrow2 = db_fetch($res2)) {
            $returns += $myrow2['ov_amount'];
            $credit_num = $myrow2['customized_no'];
            $cm_date = $myrow2['tran_date'];
            $res2 = get_return_discount($branch_data['sales_discount_account'], $myrow2['type'], $myrow2['trans_no']);
            while ($myrow3 = db_fetch($res2)) {
                $rtn_dt += abs($myrow3['amount']);
            }
        }
        $total_returns = $returns + $rtn_dt;
        $return_discount = $rtn_dt / $total_returns * 100;
        $discount = $myrow['discount'];
        $invoicetot = $myrow['ov_amount'] + $dt;
        $sales_discount = ($invoicetot - $total_returns) * ($return_discount / 100);
        $net_sales = $invoicetot - $total_returns - $sales_discount;
        $gross_commission = ($invoicetot - $total_returns) * ($myrow['commission'] / 100);
        $rep->TextCol(0, 1, $myrow['tran_date']);
        $rep->TextCol(1, 2, $myrow['br_name']);
        $rep->TextCol(2, 3, $salesman);
        $rep->TextCol(3, 4, $myrow['customized_no']);
        $rep->AmountCol(4, 5, $invoicetot, 2);
        $rep->TextCol(5, 6, $cm_date);
        $rep->TextCol(6, 7, $credit_num);
        $rep->AmountCol(7, 8, $total_returns, 2);
        $rep->TextCol(8, 9, $return_discount . "%");
        $rep->AmountCol(9, 10, $sales_discount, 2);
        $rep->AmountCol(10, 11, $net_sales, 2);
        $rep->TextCol(18, 19, $myrow['date']);
        $rep->TextCol(19, 20, $myrow['commission'] . "%");
        $rep->AmountCol(20, 21, $gross_commission, 2);
        $rep->AmountCol(21, 22, $myrow['with_tax'], 2);
        $rep->AmountCol(22, 23, $myrow['net_commission'], 2);
        $or = get_pr_details($myrow['type'], $myrow['trans_no']);
        while ($pr = db_fetch($or)) {
            $net_remittance = $net_sales - $pr['amt'];
            $rep->TextCol(11, 12, $pr['date_alloc']);
            $rep->TextCol(12, 13, $pr['customized_no']);
            $rep->TextCol(13, 14, _("DATE"));
            $rep->TextCol(14, 15, _("OR#"));
            $rep->TextCol(15, 16, "");
            $rep->AmountCol(17, 18, '', 2);
        }
        $rep->NewLine();
        //
    }
    $rep->NewLine();
    $rep->End();
}
开发者ID:knjy24,项目名称:FrontAccounting,代码行数:90,代码来源:rep_series_report_etc.php

示例5: print_invoices

function print_invoices()
{
    global $path_to_root, $alternative_tax_include_on_docs, $suppress_tax_rates, $no_zero_lines_amount;
    include_once $path_to_root . "/reporting/includes/pdf_report.inc";
    $from = $_POST['PARAM_0'];
    $to = $_POST['PARAM_1'];
    $currency = $_POST['PARAM_2'];
    $email = $_POST['PARAM_3'];
    $pay_service = $_POST['PARAM_4'];
    $comments = $_POST['PARAM_5'];
    $customer = $_POST['PARAM_6'];
    $orientation = $_POST['PARAM_7'];
    if (!$from || !$to) {
        return;
    }
    $orientation = $orientation ? 'L' : 'P';
    $dec = user_price_dec();
    $fno = explode("-", $from);
    $tno = explode("-", $to);
    $from = min($fno[0], $tno[0]);
    $to = max($fno[0], $tno[0]);
    $cols = array(4, 40, 60, 100, 200, 250, 300, 320, 400, 450, 500);
    // $headers in doctext.inc
    $aligns = array('left', 'left', 'left', 'left', 'right', 'right', 'right', 'right', 'right', 'right', 'right');
    //$params = array('comments' => $comments);
    $cur = get_company_Pref('curr_default');
    $company_data = get_company_prefs();
    if ($email == 0) {
        $rep = new FrontReport(_('INVOICE'), "InvoiceBulk", user_pagesize(), 9, $orientation);
    }
    if ($orientation == 'L') {
        recalculate_cols($cols);
    }
    for ($i = $from; $i <= $to; $i++) {
        if (!exists_customer_trans(ST_SALESINVOICE, $i)) {
            continue;
        }
        $sign = 1;
        $myrow = get_customer_trans($i, ST_SALESINVOICE);
        if ($customer && $myrow['debtor_no'] != $customer) {
            continue;
        }
        $baccount = get_default_bank_account($myrow['curr_code']);
        $params['bankaccount'] = $baccount['id'];
        $branch = get_branch($myrow["branch_code"]);
        $sales_order = get_sales_order_header($myrow["order_"], ST_SALESORDER);
        if ($email == 1) {
            $rep = new FrontReport("", "", user_pagesize(), 9, $orientation);
            //$rep->title = _('INVOICE');
            $rep->filename = "Invoice" . $myrow['reference'] . ".pdf";
        }
        $rep->SetHeaderType(0);
        $rep->currency = $cur;
        $rep->Font();
        $rep->Info(null, $cols, null, $aligns);
        //$contacts = get_branch_contacts($branch['branch_code'], 'invoice', $branch['debtor_no'], true);
        //$baccount['payment_service'] = $pay_service;
        $salesman = get_imc_code($branch['branch_code']);
        $pay_term = get_payment_terms($myrow['payment_terms']);
        $branch_data = get_branch_accounts($myrow['branch_code']);
        $dt = get_discount($branch_data['sales_discount_account'], $myrow['type'], $myrow['trans_no']);
        $invoice_no = get_custom_no($myrow['trans_no'], $myrow['type']);
        $contact = getContactPerson($myrow['salesman'], $myrow['debtor_no'], $branch['branch_code']);
        $rep->NewPage();
        $result = get_customer_trans_details(ST_SALESINVOICE, $i);
        $SubTotal = 0;
        $rep->NewLine(8);
        $rep->TextCol(2, 7, _("CHARGE INVOICE # " . $invoice_no));
        $rep->TextCol(8, 9, $myrow['TranDate']);
        $rep->NewLine();
        $rep->TextCol(2, 7, $branch['br_name']);
        if ($dt != 0) {
            //$display_bulk_discount = (($sub_total - $myrow['Total']) / $sub_total) * 100;
            $tot = $myrow['Total'] + $dt;
            $dscnt = ($tot - $myrow['Total']) / $tot * 100;
            //$dscnt = ($dt / $myrow['Total']) * 100;
            $significant = strlen(substr(strrchr($dscnt, "."), 1));
            if ($significant > 2) {
                $rep->TextCol(7, 9, floor($dscnt) . "%");
            } else {
                $rep->TextCol(7, 9, $dscnt . "%");
            }
        }
        $rep->NewLine();
        $rep->TextCol(2, 7, $branch['branch_ref']);
        $rep->TextCol(8, 9, $salesman);
        $rep->NewLine();
        $rep->TextCol(2, 6, $contact);
        if ($pay_term['terms'] == 'Cash Only') {
            $rep->TextCol(8, 9, $pay_term['terms']);
        } else {
            $rep->TextCol(7, 10, $pay_term['terms']);
        }
        $rep->NewLine();
        $oldrow = $rep->row;
        $newrow = $rep->row;
        $rep->TextColLines(2, 6, $branch['br_address'], -2);
        $rep->row = $oldrow;
        $rep->NewLine(5);
        $rep->Font('bold');
//.........这里部分代码省略.........
开发者ID:knjy24,项目名称:FrontAccounting,代码行数:101,代码来源:rep107_old.php

示例6: exit

         exit(__('log_day_error'));
     }
     $tmp = $log_day * 86400;
     $db->query_unbuffered("delete from " . get_table_credit_log() . " where in_time<{$timestamp}-{$tmp}");
     exit('true|' . __('adm_del_log_success'));
     break;
 case 'dostat':
     $act = gpc('act', 'P', '');
     $dd = gpc('dd', 'P', '');
     if ($act && $dd) {
         if (in_array($act, array('views', 'downs', 'money'))) {
             //$all = (float)@$db->result_first("select sum($act) from {$tpf}stat_user where dd='$dd'");
             $all = 0;
             $q = $db->query("select views,downs,money,userid from {$tpf}stat_user where dd='{$dd}'");
             while ($rs = $db->fetch_array($q)) {
                 $all += get_discount($rs[userid], $rs[$act]);
             }
             $db->free($q);
             unset($rs);
             echo 'true|' . round($all, 4);
         } else {
             echo 'Error Act';
         }
     } else {
         echo 'Error action!';
     }
     break;
 case 'vip_count':
     $vip_id = (int) gpc('vip_id', 'P', 0);
     $num = (int) @$db->result_first("select count(*) from {$tpf}users where vip_id='{$vip_id}'");
     echo 'true|' . $num;
开发者ID:saintho,项目名称:phpdisk,代码行数:31,代码来源:adm_ajax.php

示例7: print_statements

function print_statements()
{
    global $path_to_root, $systypes_array;
    include_once $path_to_root . "/reporting/includes/pdf_report2.inc";
    $from = date2sql($_POST['PARAM_0']);
    $to = date2sql($_POST['PARAM_1']);
    $customer = $_POST['PARAM_2'];
    $currency = $_POST['PARAM_3'];
    $email = $_POST['PARAM_4'];
    $comments = $_POST['PARAM_5'];
    $orientation = $_POST['PARAM_6'];
    $orientation = $orientation ? 'L' : 'P';
    $dec = 2;
    $cols = array(4, 64, 180, 250, 300, 350, 400, 480);
    //$headers in doctext.inc
    $aligns = array('left', 'left', 'left', 'right', 'right', 'right', 'right', 'right');
    $params = array('comments' => $comments);
    $cur = get_company_pref('curr_default');
    $PastDueDays1 = get_company_pref('past_due_days');
    $PastDueDays2 = 2 * $PastDueDays1;
    if ($email == 0) {
        $rep = new FrontReport(_('CUSTOMER ACCOUNT STATEMENT'), "StatementBulk", user_pagesize(), 9, $orientation);
    }
    if ($orientation == 'L') {
        recalculate_cols($cols);
    }
    $sql = "SELECT b.debtor_no, b.name AS DebtorName, b.address, b.tax_id, b.curr_code, cust.salesman, \n\tcurdate() AS tran_date, CONCAT (d.name, d.name2) AS contactPerson, d.phone, d.phone2  \n\tFROM " . TB_PREF . "debtors_master b INNER JOIN\n" . TB_PREF . "crm_contacts c on b.debtor_no=c.entity_id INNER JOIN " . TB_PREF . "crm_persons d on c.person_id=d.id\nINNER JOIN " . TB_PREF . "cust_branch cust on b.debtor_no=cust.debtor_no";
    if ($customer != ALL_TEXT) {
        $sql .= " WHERE c.type='customer' and cust.salesman = " . db_escape($customer);
    } else {
        $sql .= " where c.type='customer' and cust.salesman = " . db_escape($customer) . " ORDER by b.name";
    }
    $result = db_query($sql, "The customers could not be retrieved");
    while ($debtor_row = db_fetch($result)) {
        $date = date('Y-m-d');
        if ($from != $to) {
            // find the latest point where the balance was null
            $start = findLatestNullDate($debtor_row['debtor_no'], $from);
            // but not earlier than the $to date.
            if (date1_greater_date2(sql2date($start), sql2date($to))) {
                $start = $to;
            }
            if (date1_greater_date2(sql2date($from), sql2date($start))) {
                $start = $from;
            }
        } else {
            $start = $from;
        }
        $debtor_row['order_'] = "";
        $TransResult = getTransactions($debtor_row['debtor_no'], $start, $date);
        $baccount = get_default_bank_account($debtor_row['curr_code']);
        $params['bankaccount'] = $baccount['id'];
        if (db_num_rows($TransResult) == 0) {
            continue;
        }
        if ($email == 1) {
            $rep = new FrontReport("CUSTOMER ACCOUNT STATEMENT", "", user_pagesize(), 9, $orientation);
            $rep->title = _('STATEMENT OF ACCOUNT');
            $rep->filename = "Statement" . $debtor_row['debtor_no'] . ".pdf";
            $rep->Info($params, $cols, null, $aligns);
        }
        $rep->filename = "ST-" . strtr($debtor_row['DebtorName'], " '", "__") . "--" . strtr(Today(), "/", "-") . ".pdf";
        $contacts = get_customer_contacts($debtor_row['debtor_no'], 'invoice');
        $rep->SetHeaderType('customheader');
        $rep->currency = $cur;
        $rep->Font();
        $rep->Info(null, $cols, null, $aligns);
        $rep->SetCommonData($debtor_row, null, null, $baccount, ST_STATEMENT, $contacts);
        $rep->NewPage();
        $doctype = ST_STATEMENT;
        //$rep->TextCol(0,4,"yeah");
        $current = false;
        $balance = getInitialBalance($debtor_row['debtor_no'], $start);
        if (true || Abs($balance) > 1.0E-6) {
            if (Abs($balance) < 1.0E-6) {
                $rep->SetTextColor(190, 190, 190);
            } else {
                if ($balance > 0) {
                    $rep->SetTextColor(190, 0, 0);
                }
            }
            $rep->SetTextColor(0, 0, 0);
        }
        $overdue = 0;
        $prev = '';
        $gross_amount = 0;
        $gross_amount2 = 0;
        $payment_tot = 0;
        $tots = 0;
        $discount_amount = 0;
        $percent = 0;
        while ($transaction_row = db_fetch($TransResult)) {
            if ($myrow['IsVoid'] == '') {
                $company_data = get_company_prefs();
                $branch = get_branch($transaction_row["branch_code"]);
                $branch_data = get_branch_accounts($transaction_row['branch_code']);
                $dt = get_discount($branch_data['sales_discount_account'], $transaction_row['type'], $transaction_row['trans_no']);
                $DisplayTotal = number_format2(Abs($transaction_row["TotalAmount"] + $dt), $dec);
                $DisplayAlloc = number_format2($transaction_row["Allocated"], $dec);
                $DisplayNet = number_format2($transaction_row["TotalAmount"] - $transaction_row["Allocated"], $dec);
//.........这里部分代码省略.........
开发者ID:knjy24,项目名称:FrontAccounting,代码行数:101,代码来源:rep_customer_account_statement.php

示例8: brand_recommend_goods

/**
 * 获得指定品牌下的推荐和促销商品
 *
 * @access  private
 * @param   string  $type
 * @param   integer $brand
 * @return  array
 */
function brand_recommend_goods($type, $brand, $cat = 0)
{
    static $result = NULL;
    $time = gmtime();
    if ($result === NULL) {
        if ($cat > 0) {
            $cat_where = "AND " . get_children($cat);
        } else {
            $cat_where = '';
        }
        $sql = 'SELECT g.goods_id, g.goods_name, g.market_price, g.comments_number,g.sales_volume,g.shop_price AS org_price, g.promote_price, ' . "IFNULL(mp.user_price, g.shop_price * '{$_SESSION['discount']}') AS shop_price, " . 'promote_start_date, promote_end_date, g.goods_brief, g.goods_thumb, goods_img, ' . 'b.brand_name, g.is_best, g.is_new, g.is_hot, g.is_promote ' . 'FROM ' . $GLOBALS['ecs']->table('goods') . ' AS g ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('brand') . ' AS b ON b.brand_id = g.brand_id ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('member_price') . ' AS mp ' . "ON mp.goods_id = g.goods_id AND mp.user_rank = '{$_SESSION['user_rank']}' " . "WHERE g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 AND g.brand_id = '{$brand}' AND " . "(g.is_best = 1 OR (g.is_promote = 1 AND promote_start_date <= '{$time}' AND " . "promote_end_date >= '{$time}')) {$cat_where}" . 'ORDER BY g.sort_order, g.last_update DESC';
        $result = $GLOBALS['db']->getAll($sql);
    }
    /* 取得每一项的数量限制 */
    $num = 0;
    $type2lib = array('best' => 'recommend_best', 'new' => 'recommend_new', 'hot' => 'recommend_hot', 'promote' => 'recommend_promotion');
    $num = get_library_number($type2lib[$type]);
    $idx = 0;
    $goods = array();
    foreach ($result as $row) {
        if ($idx >= $num) {
            break;
        }
        if ($type == 'best' && $row['is_best'] == 1 || $type == 'promote' && $row['is_promote'] == 1 && $row['promote_start_date'] <= $time && $row['promote_end_date'] >= $time) {
            if ($row['promote_price'] > 0) {
                $promote_price = bargain_price($row['promote_price'], $row['promote_start_date'], $row['promote_end_date']);
                $goods[$idx]['promote_price'] = $promote_price > 0 ? price_format($promote_price) : '';
            } else {
                $goods[$idx]['promote_price'] = '';
            }
            $goods[$idx]['id'] = $row['goods_id'];
            $goods[$idx]['name'] = $row['goods_name'];
            $goods[$idx]['sales_volume'] = $row['sales_volume'];
            $goods[$idx]['comments_number'] = $row['comments_number'];
            /* 折扣节省计算 by ecmoban start */
            if ($row['market_price'] > 0) {
                $discount_arr = get_discount($row['goods_id']);
                //函数get_discount参数goods_id
            }
            $goods[$idx]['zhekou'] = $discount_arr['discount'];
            //zhekou
            $goods[$idx]['jiesheng'] = $discount_arr['jiesheng'];
            //jiesheng
            /* 折扣节省计算 by ecmoban end */
            $goods[$idx]['brief'] = $row['goods_brief'];
            $goods[$idx]['brand_name'] = $row['brand_name'];
            $goods[$idx]['short_style_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ? sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name'];
            $goods[$idx]['market_price'] = price_format($row['market_price']);
            $goods[$idx]['shop_price'] = price_format($row['shop_price']);
            $goods[$idx]['thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true);
            $goods[$idx]['goods_img'] = get_image_path($row['goods_id'], $row['goods_img']);
            $goods[$idx]['url'] = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']);
            $idx++;
        }
    }
    return $goods;
}
开发者ID:jinjing1989,项目名称:wei,代码行数:65,代码来源:brand.php

示例9: unset

         $bids .= $rs[touserid] . ',';
     }
     $db->free($q);
     unset($rs);
     $sql_do = $bids ? substr($bids, 0, -1) : '';
     $buddys = array();
     if ($sql_do) {
         $perpage = 20;
         $sql_do = "{$tpf}buddys b,{$tpf}users u where b.userid in ({$sql_do}) and b.touserid=u.userid";
         $rs = $db->fetch_one_array("select count(*) as total_num from {$sql_do}");
         $total_num = $rs['total_num'];
         $start_num = ($pg - 1) * $perpage;
         $q = $db->query("select u.credit,u.username,u.qq,u.userid,b.is_system from {$sql_do} order by bdid desc limit {$start_num},{$perpage}");
         //$buddys = array();
         while ($rs = $db->fetch_array($q)) {
             $rs[credit] = get_discount($rs[userid], $rs[credit]);
             $rs[is_system] = $rs[is_system] ? '系统分配' : '自己推广';
             $rs[a_space] = urr("space", "username=" . rawurlencode($rs[username]));
             $rs[qq] = $rs[qq] ? '<a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=' . $rs[qq] . '&site=qq&menu=yes"><img border="0" src="http://wpa.qq.com/pa?p=2:' . $rs[qq] . ':52" alt="点击这里给我发消息" title="点击这里给我发消息"/></a>' : '';
             $buddys[] = $rs;
         }
         $db->free($q);
         unset($rs);
         $page_nav = multi($total_num, $perpage, $pg, "mydisk.php?item=profile&action={$action}");
     }
     require_once template_echo('profile', $user_tpl_dir);
     break;
 case 'guest':
     if ($task == 'guest') {
         auth_task_guest();
     } else {
开发者ID:saintho,项目名称:phpdisk,代码行数:31,代码来源:profile.inc.php

示例10: get_discount

	<td align="center"><a href="<?php 
                    echo $v['a_space'];
                    ?>
" target="_blank"><?php 
                    echo $v['username'];
                    ?>
</a></td>
	<?php 
                }
                ?>
	<td align="center"><?php 
                echo get_discount($v[userid], $v['file_views']);
                ?>
</td>
	<td align="center"><?php 
                echo get_discount($v[userid], $v['file_downs']);
                ?>
</td>
	<td align="center"><?php 
                echo $v['file_size'];
                ?>
</td>
	<td align="center" width="150"  class="td_line txtgray"><?php 
                echo $v['file_time'];
                ?>
</td>
</tr>
<?php 
            }
            unset($files_array);
        } else {
开发者ID:saintho,项目名称:phpdisk,代码行数:31,代码来源:pd_search.tpl.php

示例11: reserve

 public function reserve()
 {
     if (!$this->mid) {
         // 			json_return(300,'请先登录.',array(),U('Login/index'));
         $this->error('请先登录', U('Login/index'));
     }
     $goods_id = intval($_POST['goods_id']);
     $spec_id = intval($_POST['spec_id']);
     $num = intval($_POST['num']);
     if ($num) {
         if ($spec_id) {
             $goods_id = M('GoodsSpec')->where(array('spec_id' => $spec_id))->getField('goods_id');
         }
         $goods = M('Goods')->where(array('goods_id' => $goods_id))->find();
         if (get_distributor($this->mid)) {
             $cdisc = MSC('distributor_discount');
         } else {
             $cdisc = 1;
         }
         $data['order_sn'] = order_sn();
         $data['member_id'] = $this->mid;
         $data['order_type'] = 2;
         $data['goods_amount'] = $cdisc * get_discount($num) * $num * $goods['goods_price'];
         $data['discount'] = 0;
         $data['order_amount'] = $data['goods_amount'] - $data['discount'];
         $data['order_state'] = 0;
         $data['add_time'] = NOW_TIME;
         $data['goods_id'] = $goods_id;
         $data['spec_id'] = $spec_id;
         $data['reserve_num'] = $num;
         $res = M('Reserve')->add($data);
         if ($res) {
             $this->success('预订成功', $_SERVER['HTTP_REFERER']);
             // 				json_return(200,'预订成功.');
         } else {
             $this->error('预订失败');
             // 				json_return(300,'预定失败.');
         }
     } else {
         $this->error('预订数量不能为空');
         json_return(300, '预订数量不能为空');
     }
 }
开发者ID:PrayerEzio,项目名称:zuoxika,代码行数:43,代码来源:GoodsController.class.php

示例12: print_cash_sale

function print_cash_sale()
{
    global $path_to_root;
    $from = $_POST['PARAM_0'];
    $destination = $_POST['PARAM_1'];
    if ($destination) {
        include_once $path_to_root . "/reporting/includes/excel_report.inc";
    } else {
        include_once $path_to_root . "/reporting/includes/pdf_report.inc";
    }
    $dec = user_price_dec();
    if ($category == ALL_NUMERIC) {
        $category = 0;
    }
    if ($category == 0) {
        $cat = _('All');
    } else {
        $cat = get_category_name($category);
    }
    $cols = array(0, 50, 250, 350, 400, 450, 500, 550, 600, 700, 750, 800, 850, 900, 950, 1000, 1050, 1100, 1150, 1200);
    $headers = array(_('DATE'), _('CLIENT NAME'), _('IMC'), _('CASH SALES'), _('INVOICE'), _('CASH'), _('SALES'), _('RETURNS'), _('SALES DISCOUNT'), _('SUNDRIES'), _('DR'), _('CR'));
    $header2 = array(_(''), '', _('CODE'), _('INVOICE'), _('AMOUNT'), _('DR'), _('CR'), _(' DR'), _('DR'), _(''), _(''));
    $aligns = array('left', 'left', 'center', 'left', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right');
    $params = array(0 => $comments, 1 => array('text' => _('Period'), 'from' => $from, 'to' => $to), 2 => array('text' => _('Category'), 'from' => $cat, 'to' => ''));
    $rep = new FrontReport(_('Cash Sales Report'), "CashSalesReport", user_pagesize(), 8, 'L');
    $rep->Font();
    $rep->Info($params, $cols, $header2, $aligns, $cols, $headers, $aligns);
    $rep->NewPage();
    $res = getTransactions($from);
    while ($myrow = db_fetch($res)) {
        $company_data = get_company_prefs();
        $branch = get_branch($myrow["branch_code"]);
        $branch_data = get_branch_accounts($myrow['branch_code']);
        $dt = get_discount($branch_data['sales_discount_account'], $myrow['type'], $myrow['trans_no']);
        $sales_acct = get_discount($branch_data['sales_account'], $myrow['type'], $myrow['trans_no']);
        $salesman = get_imc_code($myrow['branch_code']);
        $invoicetot = $myrow['ov_amount'] + $dt;
        $invoice_discount = $dt / $invoicetot * 100;
        $rep->TextCol(0, 1, $myrow['tranDate']);
        $rep->TextCol(1, 2, $myrow['br_name']);
        $rep->TextCol(2, 3, $salesman);
        $rep->TextCol(3, 4, $myrow['customized_no']);
        if ($myrow['IsVoid'] == '') {
            $rep->AmountCol(4, 5, $invoicetot, 2);
            $rep->AmountCol(5, 6, $myrow['ov_amount'], 2);
            $rtn_dt = 0;
            $res2 = get_return_details($myrow['order_']);
            while ($myrow2 = db_fetch($res2)) {
                $returns += $myrow2['ov_amount'];
                $res2 = get_return_discount($branch_data['sales_discount_account'], $myrow2['type'], $myrow2['trans_no']);
                while ($myrow3 = db_fetch($res2)) {
                    $rtn_dt += abs($myrow3['amount']);
                }
            }
            $net_sales = abs($sales_acct) - $dt - $rtn_dt;
            $rep->AmountCol(6, 7, $net_sales, 2);
            if ($rtn_dt != 0) {
                $rep->AmountCol(7, 8, $rtn_dt, 2);
            }
            if ($dt != 0) {
                $rep->AmountCol(8, 9, $dt, 2);
            }
            $rep->NewLine();
        } else {
            $rep->TextCol(4, 5, "Voided");
        }
        $net_invoice += $invoicetot;
        $net_dr += $myrow['ov_amount'];
        $net_cr += $net_sales;
        $net_return += $rtn_dt;
        $net_ret_dt += $dt;
    }
    $rep->NewLine();
    $rep->Font('bold');
    $rep->TextCol(1, 2, "TOTAL");
    $rep->AmountCol(4, 5, $net_invoice, 2);
    $rep->AmountCol(5, 6, $net_dr, 2);
    $rep->AmountCol(6, 7, $net_cr, 2);
    $rep->AmountCol(7, 8, $net_return, 2);
    $rep->AmountCol(8, 9, $net_ret_dt, 2);
    $rep->End();
}
开发者ID:knjy24,项目名称:FrontAccounting,代码行数:82,代码来源:rep_cash_sales_odl.php

示例13: conv_credit

function conv_credit($uid)
{
    global $db, $tpf;
    $myinfo[credit] = get_profile($uid, 'credit');
    $myinfo[dl_credit] = get_profile($uid, 'dl_credit');
    if (get_income_rate($uid)) {
        $money = get_discount($uid, $myinfo[credit]) * get_income_rate($uid);
        $dl_money = get_discount($uid, $myinfo['dl_credit']) * get_income_rate($uid, 1);
        $add_wealth = round($money + $dl_money, 4);
        $db->query_unbuffered("update {$tpf}users set credit=0,dl_credit=0,wealth=wealth+{$add_wealth} where userid='{$uid}' limit 1");
        //echo $add_wealth;
        return true;
    }
}
开发者ID:saintho,项目名称:phpdisk,代码行数:14,代码来源:global.func.php

示例14: cartsummary

 public function cartsummary()
 {
     $this->load->model('Memorial_model');
     $this->load->model('Affiliate_model');
     $comm = $this->Affiliate_model->get_affiliate($this->session->userdata('affiliate_id'));
     $this->load->model('Group_model');
     $cart = $this->Order_model->get_cart($this->session->userdata('cart_id'));
     $totals = array('itemtotal' => 0, 'shipping' => 0, 'service' => 0, 'surcharge' => 0, 'tax' => 0, 'coupon' => 0, 'coupon_code' => '', 'discount' => 0, 'grandtotal' => 0, 'discount_type' => 'percentage', 'coupon_type' => 'percentage');
     $coupon_discount = 0;
     $this->load->model('Company_model');
     $this->load->model('Customer_model');
     $cartdiscount = 0;
     $cartcoupon = 0;
     $cartdiscounttype = 'percentage';
     $cartcoupontype = 'percentage';
     foreach ($cart as $item) {
         $totals['itemtotal'] += $item->product_price;
         foreach ($item->addons as $addon) {
             $totals['itemtotal'] += $addon->addon_price * $addon->addon_quantity;
         }
     }
     if ($user_discount = $this->Customer_model->getDiscount($this->session->userdata('customer_id'))) {
         $totals['discount'] = $totals['itemtotal'] * $user_discount / 100;
     } else {
         if ($this->session->userdata('coupon')) {
             if ($coupon = get_coupon_discount($this->session->userdata('coupon'), $totals['itemtotal'])) {
                 $totals['coupon_code'] = $coupon->discount_name;
                 if ($coupon->discount_amount > 0) {
                     $cartcoupon = $coupon->discount_amount;
                     $cartcoupontype = 'amount';
                 } else {
                     $cartcoupon = $coupon->discount_percentage;
                     $cartcoupontype = 'percentage';
                 }
             }
         }
         if ($cartcoupon <= 0) {
             if ($discount = get_discount($totals['itemtotal'])) {
                 if ($discount->discount_amount > 0) {
                     $cartdiscount = $discount->discount_amount;
                     $cartdiscounttype = 'amount';
                 } else {
                     $cartdiscount = $discount->discount_percentage;
                     $cartdiscounttype = 'percentage';
                 }
             }
         }
     }
     $itemscount = count($cart);
     foreach ($cart as $item) {
         $ptotal = $item->product_price;
         foreach ($item->addons as $addon) {
             $ptotal += $addon->addon_price * $addon->addon_quantity;
         }
         $addition = $this->Order_model->get_add_estimate($item->orderitem_id);
         //$addition = $this->Group_model->get_add_charges($item->product_id,$item->postalcode);
         //san has changed on 13-7-2013
         //$totals['shipping'] += 10; ///$addition['shipping'];
         $totals['shipping'] += $addition['shipping'];
         $totals['service'] += $addition['service'];
         $totals['surcharge'] += $addition['surcharge'];
         if ($cartcoupon > 0) {
             if ($cartcoupontype == 'percentage') {
                 $totals['coupon'] += $cartcoupon * $ptotal / 100;
                 $ptotal -= $cartcoupon * $ptotal / 100;
             } else {
                 $part = $cartcoupon / $itemscount;
                 $totals['coupon'] += $part;
                 $ptotal -= $part;
             }
         } else {
             if ($cartdiscounttype == 'percentage') {
                 $totals['discount'] += $cartdiscount * $ptotal / 100;
                 $ptotal -= $cartdiscount * $ptotal / 100;
             } else {
                 $part = $cartdiscount / $itemscount;
                 $totals['discount'] += $part;
                 $ptotal -= $part;
             }
         }
         $ptotal += $addition['shipping'];
         $ptotal += $addition['service'];
         $ptotal += $addition['surcharge'];
         $totals['tax'] += $addition['tax'] * $ptotal / 100;
         //$addition['tax']
     }
     $totals['grandtotal'] = number_format($totals['itemtotal'], 2) + number_format($totals['shipping'], 2) + number_format($totals['service'], 2) + number_format($totals['surcharge'], 2) + number_format($totals['tax'], 2) - number_format($totals['discount'], 2) - number_format($totals['coupon'], 2);
     $data['p'] = (object) $_POST;
     $data['totals'] = $totals;
     $data['cart'] = $cart;
     //$data['commission'] = ($this->cart->total() * $comm->commission)/100;
     $result = array('cartsummary' => $this->load->view('mymemorial/summary', $data, true), 'shipping' => $totals['shipping'], 'tax' => $totals['tax'], 'commission' => 0);
     echo json_encode($result);
 }
开发者ID:bijuys,项目名称:MemorialFlowers,代码行数:94,代码来源:orders_new.php

示例15: checkout


//.........这里部分代码省略.........
             $conversion .= 'bta.addConversionLegacy("$", "' . $item->product_name . '", "' . number_format($itemprc, 2) . '");' . "\n";
             $itemf = str_replace('{addons}', $order_items, $itemf);
             $itemf = str_replace('{addon_price}', '$' . number_format($addontot, 2), $itemf);
             $addition = $this->Order_model->get_add_charges($item->orderitem_id);
             if (!($waiver = $this->Company_model->checkWaiver($this->session->userdata('customer_id')))) {
                 $totals['shipping'] += $addition['shipping'];
                 $totals['service'] += $addition['service'];
                 $totals['surcharge'] += $addition['surcharge'];
             }
             $totals['tax'] += $addition['tax'] * $ptotal / 100;
             $aitemformat .= str_replace('{product_description}', '', $itemf);
             $itemf = str_replace('{product_description}', substr($item->product_description, 0, 50), $itemf);
             $itemformat .= $itemf;
         }
         $ggitems = '';
         foreach ($cartitems as $citem) {
             $productids[] = $citem['sku'] . ':' . str_replace('+', '', $citem['name']);
             $itemvalues[] = $citem['amt'];
             $units[] = $citem['qty'];
             $skulist[] = $citem['sku'];
             $qlist[] = $citem['qty'];
             $amtlist[] = $citem['amt'];
             $namelist[] = $citem['name'];
         }
         $coupon_discount = 0;
         if ($user_discount = $this->Customer_model->getDiscount($this->session->userdata('customer_id'))) {
             $totals['discount'] = $totals['itemtotal'] * $user_discount / 100;
         } else {
             if ($this->session->userdata('coupon')) {
                 $coupon = get_coupon_discount($this->session->userdata('coupon'), $totals['itemtotal']);
                 $totals['coupon_code'] = $coupon->discount_name;
                 $totals['coupon'] = $coupon->discount_amount ? $coupon->discount_amount : $coupon->discount_percentage * $totals['itemtotal'] / 100;
             }
             $totals['discount'] = get_discount($totals['itemtotal']);
             $totals['companyless'] = get_company_discount($totals['itemtotal'], $this->session->userdata('customer_id') ? $this->session->userdata('customer_id') : '0');
         }
         if ($totals['discount'] > 0) {
             $skulist[] = 'Discount';
             $qlist[] = 0;
             $amtlist[] = $totals['discount'] * -100;
             $namelist[] = 'Discount';
             $productids[] = 'Discount';
             $itemvalues[] = round($totals['discount'] * 100);
             $units[] = 1;
         } else {
             $productids[] = 'Discount';
             $itemvalues[] = 0;
             $units[] = 1;
         }
         $totals['grandtotal'] = $totals['itemtotal'] + $totals['shipping'] + $totals['service'] + $totals['surcharge'] + $totals['tax'] - $totals['discount'] - $totals['coupon'] - $totals['companyless'];
         $invoiceTotal = number_format($totals['grandtotal'], 2);
         $customer_id = $this->session->userdata('customer_id') ? $this->session->userdata('customer_id') : '0';
         $affiliate_id = $this->session->userdata('referer') ? $this->session->userdata('referer') : '';
         $this->form_validation->set_rules("cardnumber", 'Credit Card Number', 'required|numeric|min_length[15]|max_length[16]');
         $this->form_validation->set_rules("expiry_month", 'Expiry Month', 'required|min_length[2]|max_length[5]');
         $this->form_validation->set_rules("expiry_year", 'Expiry Year', 'required|min_length[2]|max_length[5]');
         $this->form_validation->set_rules("cvv", 'CVV2', 'required|min_length[3]|max_length[5]');
         $this->form_validation->set_error_delimiters('<span class="error error_span">', '</span>');
         if ($this->form_validation->run() == TRUE) {
             $eformat = file_get_contents('assets/email_format.html');
             $eheader = file_get_contents('assets/email_header.html');
             $this->load->library('plugnpay');
             $order = unserialize(base64_decode($_POST['data']));
             $country = $this->Country_model->get_country($order->country_id);
             $order->country = $country->country_name;
             $order->ipaddress = $_SERVER['REMOTE_ADDR'];
开发者ID:bijuys,项目名称:MemorialFlowers,代码行数:67,代码来源:shop.php


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