?>
</td>       
        <td class="align-center"><?php 
        echo $bill_info['ob_store_cost_totals'];
        ?>
</td>       
        <td class="align-center"><?php 
        echo $bill_info['ob_result_totals'];
        ?>
</td>
        <td class="align-center"><?php 
        echo date('Y-m-d', $bill_info['ob_create_date']);
        ?>
</td>
        <td class="align-center"><?php 
        echo billState($bill_info['ob_state']);
        ?>
</td>
        <td class="align-center"><?php 
        echo $bill_info['ob_store_name'] . '<br/>id:' . $bill_info['ob_store_id'];
        ?>
</td>
        <td class="align-center">
        <a href="index.php?act=bill&op=show_bill&ob_no=<?php 
        echo $bill_info['ob_no'];
        ?>
"><?php 
        echo $lang['nc_view'];
        ?>
</a>
        </td>
Exemple #2
0
 /**
  * 导出平台月出账单表
  *
  */
 public function export_billOp()
 {
     if (!empty($_GET['os_month']) && !preg_match('/^20\\d{4}$/', $_GET['os_month'], $match)) {
         showMessage('参数错误', '', 'html', 'error');
     }
     $model_bill = Model('bill');
     $condition = array();
     if (!empty($_GET['os_month'])) {
         $condition['os_month'] = intval($_GET['os_month']);
     }
     if (is_numeric($_GET['bill_state'])) {
         $condition['ob_state'] = intval($_GET['bill_state']);
     }
     if (preg_match('/^\\d{1,8}$/', $_GET['query_store'])) {
         $condition['ob_store_id'] = $_GET['query_store'];
     } elseif ($_GET['query_store'] != '') {
         $condition['ob_store_name'] = $_GET['query_store'];
     }
     if (!is_numeric($_GET['curpage'])) {
         $count = $model_bill->getOrderBillCount($condition);
         $array = array();
         if ($count > self::EXPORT_SIZE) {
             //显示下载链接
             $page = ceil($count / self::EXPORT_SIZE);
             for ($i = 1; $i <= $page; $i++) {
                 $limit1 = ($i - 1) * self::EXPORT_SIZE + 1;
                 $limit2 = $i * self::EXPORT_SIZE > $count ? $count : $i * self::EXPORT_SIZE;
                 $array[$i] = $limit1 . ' ~ ' . $limit2;
             }
             Tpl::output('list', $array);
             Tpl::output('murl', 'index.php?act=bill&op=index');
             Tpl::showpage('export.excel');
             exit;
         } else {
             //如果数量小,直接下载
             $data = $model_bill->getOrderBillList($condition, '*', '', 'ob_no desc', self::EXPORT_SIZE);
         }
     } else {
         //下载
         $limit1 = ($_GET['curpage'] - 1) * self::EXPORT_SIZE;
         $limit2 = self::EXPORT_SIZE;
         $data = $model_bill->getOrderBillList($condition, '*', '', 'ob_no desc', "{$limit1},{$limit2}");
     }
     $export_data = array();
     $export_data[0] = array('账单编号', '开始日期', '结束日期', '订单金额', '运费', '佣金金额', '退款金额', '退还佣金', '店铺费用', '本期应结', '出账日期', '账单状态', '店铺', '店铺ID');
     $ob_order_totals = 0;
     $ob_shipping_totals = 0;
     $ob_commis_totals = 0;
     $ob_order_return_totals = 0;
     $ob_commis_return_totals = 0;
     $ob_store_cost_totals = 0;
     $ob_result_totals = 0;
     foreach ($data as $k => $v) {
         $export_data[$k + 1][] = $v['ob_no'];
         $export_data[$k + 1][] = date('Y-m-d', $v['ob_start_date']);
         $export_data[$k + 1][] = date('Y-m-d', $v['ob_end_date']);
         $ob_order_totals += $export_data[$k + 1][] = $v['ob_order_totals'];
         $ob_shipping_totals += $export_data[$k + 1][] = $v['ob_shipping_totals'];
         $ob_commis_totals += $export_data[$k + 1][] = $v['ob_commis_totals'];
         $ob_order_return_totals += $export_data[$k + 1][] = $v['ob_order_return_totals'];
         $ob_commis_return_totals += $export_data[$k + 1][] = $v['ob_commis_return_totals'];
         $ob_store_cost_totals += $export_data[$k + 1][] = $v['ob_store_cost_totals'];
         $ob_result_totals += $export_data[$k + 1][] = $v['ob_result_totals'];
         $export_data[$k + 1][] = date('Y-m-d', $v['ob_create_date']);
         $export_data[$k + 1][] = billState($v['ob_state']);
         $export_data[$k + 1][] = $v['ob_store_name'];
         $export_data[$k + 1][] = $v['ob_store_id'];
     }
     $count = count($export_data);
     $export_data[$count][] = '';
     $export_data[$count][] = '';
     $export_data[$count][] = '合计';
     $export_data[$count][] = $ob_order_totals;
     $export_data[$count][] = $ob_commis_totals;
     $export_data[$count][] = $ob_order_return_totals;
     $export_data[$count][] = $ob_commis_return_totals;
     $export_data[$count][] = $ob_store_cost_totals;
     $export_data[$count][] = $ob_result_totals;
     $csv = new Csv();
     $export_data = $csv->charset($export_data, CHARSET, 'gbk');
     $csv->filename = $csv->charset('账单-', CHARSET) . $_GET['os_month'];
     $csv->export($export_data);
 }
echo date('Y-m-d', $output['bill_info']['ob_create_date']);
?>
</td></tr><tr>
      <td>平台应付金额:<?php 
echo $output['bill_info']['ob_result_totals'];
?>
 = <?php 
echo $output['bill_info']['ob_order_totals'];
?>
 (消费金额) - <?php 
echo $output['bill_info']['ob_commis_totals'];
?>
 (佣金金额)</td>
      </tr>
      <tr><td>结算状态:<?php 
echo billState($output['bill_info']['ob_state']);
?>
      <?php 
if ($output['bill_info']['ob_state'] == BILL_STATE_SUCCESS) {
    ?>
      	&emsp;结算日期<?php 
    echo $lang['nc_colon'];
    echo date('Y-m-d', $output['bill_info']['ob_pay_date']);
    ?>
,结算备注<?php 
    echo $lang['nc_colon'];
    echo $output['bill_info']['ob_pay_content'];
    ?>
      <?php 
}
?>