nizongfeng 3 anni fa
parent
commit
2103e15ceb
4 ha cambiato i file con 47 aggiunte e 3 eliminazioni
  1. +21
    -2
      application/admin/dao/PaymentOrderDao.php
  2. +14
    -1
      application/admin/dao/ReceiptOrderDao.php
  3. +6
    -0
      application/admin/view/payment_order/index.html
  4. +6
    -0
      application/admin/view/receipt_order/index.html

+ 21
- 2
application/admin/dao/PaymentOrderDao.php Vedi File

@@ -123,20 +123,39 @@ class PaymentOrderDao
if ($param['status']."" != 'all') {
$where["a.status"] = $param['status'];
}
$having = [];
if(!empty($param['startCost']) && !empty($param['endCost'])) {
$having[] = " (itemMoney >= {$param['startCost']} and itemMoney <= {$param['endCost']} ) or (hotelMoney >= {$param['startCost']} and hotelMoney <= {$param['endCost']} ) ";
}
if(!empty($param['startCost']) && empty($param['endCost'])) {
$having[] = " (itemMoney >= {$param['startCost']} ) or (hotelMoney >= {$param['startCost']} ) ";
}
if(empty($param['startCost']) && !empty($param['endCost'])) {
$having[] = " (itemMoney <= {$param['endCost']} ) or (hotelMoney <= {$param['endCost']} ) ";
}
$offset = ($param['pageNum'] - 1) * $param['pageSize'];
$receiptOrder = new PaymentOrder();
$total = $receiptOrder
->alias("a")
->field("a.*,
(SELECT ifnull( sum( total_cost ), 0 ) from hbp_order_item where payment_order_id = a.id) 'itemMoney',
(SELECT ifnull( sum( total_cost ), 0 ) from hbp_order_hotel where payment_order_id = a.id) 'hotelMoney'
")
->group("a.id")
->where($where)->count();
->where($where)
->having(join("and", $having))
->count();
$list = $receiptOrder
->alias("a")
->field("a.*,
(SELECT concat('订单:',ifnull( GROUP_CONCAT( id ORDER BY id DESC ), '-' ), '</br>成本:',ifnull( sum( total_cost ), '-' )) from hbp_order_item where payment_order_id = a.id) 'item',
(SELECT concat('订单:',ifnull( GROUP_CONCAT( id ORDER BY id DESC ), '-' ), '</br>成本:',ifnull( sum( total_cost ), '-' )) from hbp_order_hotel where payment_order_id = a.id) 'hotel'
(SELECT concat('订单:',ifnull( GROUP_CONCAT( id ORDER BY id DESC ), '-' ), '</br>成本:',ifnull( sum( total_cost ), '-' )) from hbp_order_hotel where payment_order_id = a.id) 'hotel',
(SELECT ifnull( sum( total_cost ), 0 ) from hbp_order_item where payment_order_id = a.id) 'itemMoney',
(SELECT ifnull( sum( total_cost ), 0 ) from hbp_order_hotel where payment_order_id = a.id) 'hotelMoney'
")
->group("a.id")
->where($where)
->having(join("and", $having))
->limit($offset, $param['pageSize'])
->order("a.id","DESC")->select();



+ 14
- 1
application/admin/dao/ReceiptOrderDao.php Vedi File

@@ -124,6 +124,16 @@ class ReceiptOrderDao
if ($param['status']."" != 'all') {
$where["a.status"] = $param['status'];
}
$having = "";
if(!empty($param['startMoney']) && !empty($param['endMoney'])) {
$having = " total_amount >= {$param['startMoney']} and total_amount <= {$param['endMoney']} ";
}
if(!empty($param['startMoney']) && empty($param['endMoney'])) {
$having = " total_amount >= {$param['startMoney']} ";
}
if(empty($param['startMoney']) && !empty($param['endMoney'])) {
$having = " total_amount <= {$param['endMoney']} ";
}
$offset = ($param['pageNum'] - 1) * $param['pageSize'];
$receiptOrder = new ReceiptOrder();
$total = $receiptOrder
@@ -131,7 +141,9 @@ class ReceiptOrderDao
->join('hbp_order_main b', 'a.id = b.receipt_order_id', 'left')
->field("a.*,GROUP_CONCAT(b.id) order_ids,sum(b.total_amount) total_amount")
->group("a.id")
->where($where)->count();
->where($where)
->having($having)
->count();

$list = $receiptOrder
->alias("a")
@@ -139,6 +151,7 @@ class ReceiptOrderDao
->field("a.*,GROUP_CONCAT(b.id ORDER BY b.id DESC) order_ids,sum(b.total_amount) total_amount")
->group("a.id")
->where($where)
->having($having)
->limit($offset, $param['pageSize'])
->order("id","DESC")->select();
$data = ["total" => $total, "list" => $list->toArray()];


+ 6
- 0
application/admin/view/payment_order/index.html Vedi File

@@ -20,6 +20,10 @@
:value="item.id">
</el-option>
</el-select>
<span>成本</span>
<el-input-number v-model="search.startCost" style="width: 170px;" placeholder="请输入内容" clearable></el-input-number>
~
<el-input-number v-model="search.endCost" style="width: 170px;" placeholder="请输入内容" clearable></el-input-number>
<el-button type="primary" icon="el-icon-search" @click="getData(1)">搜索</el-button>
<el-button type="primary" icon="el-icon-plus" @click="edit(null)">新增付款单</el-button>
</div>
@@ -285,6 +289,8 @@
search: {
name: "",
status: "all",
startCost:"",
endCost:"",
pageSize: 10,
pageNum: 1
},


+ 6
- 0
application/admin/view/receipt_order/index.html Vedi File

@@ -20,6 +20,10 @@
:value="item.id">
</el-option>
</el-select>
<span>成本</span>
<el-input-number v-model="search.startMoney" style="width: 170px;" placeholder="请输入内容" clearable></el-input-number>
~
<el-input-number v-model="search.endMoney" style="width: 170px;" placeholder="请输入内容" clearable></el-input-number>
<el-button type="primary" icon="el-icon-search" @click="getData(1)">搜索</el-button>
<el-button type="primary" icon="el-icon-plus" @click="edit(null)">新增收款单</el-button>
</div>
@@ -252,6 +256,8 @@
search: {
name: "",
status: "all",
startMoney:0,
endMoney:0,
pageSize: 10,
pageNum: 1
},


Caricamento…
Annulla
Salva