Commit 831d8de4 authored by zhuwei's avatar zhuwei

1

parent 44c98351
......@@ -48,7 +48,7 @@ class CostDetail extends Basic
$conditions=$this->buildConditions($params);
$field = 'a.id,a.cost_id,b.setting_date,a.create_time,b.operator_name,
a.type,a.fee_item,a.purpose,b.store_id,a.assume_fee';
a.type,a.fee_item,a.purpose,c.store_id,a.assume_fee';
$list = $this->storeCostExt->getStoreCostExt($field, $conditions, $pageNo, $pageSize);
if(!$list)
......@@ -79,7 +79,7 @@ class CostDetail extends Basic
$conditions=$this->buildConditions($params);
$field = 'a.id,a.cost_id,b.setting_date,a.create_time,b.operator_name,
a.type,a.fee_item,a.purpose,b.store_id,a.assume_fee';
a.type,a.fee_item,a.purpose,c.store_id,a.assume_fee';
$list = $this->storeCostExt->getStoreCostExtExcel($field, $conditions);
if(!$list)
......@@ -429,4 +429,46 @@ class CostDetail extends Basic
return $str;
}
/**
* 我的门店成本
* @return \think\Response
*/
public function getMyCostDetailList()
{
$params = $this->params;
/* $params = array(
);*/
$conditions = [];
//计入月份
if (!empty($params["setting_date"])) {
$conditions["b.setting_date"] = $params["setting_date"];
}
//门店id
if (!empty($params['store_id'])) {
$conditions["b.store_id"] = $params["store_id"];
}
$field = 'a.id,a.cost_id,b.setting_date,a.create_time,b.operator_name,
a.type,a.fee_item,a.purpose,c.store_id,a.assume_fee';
$list = $this->storeCostExt->getMyCostDetailList($field, $conditions);
if(!$list)
return $this->response("200", "success", []);
foreach ($list as $k => $v) {
$list[$k]['type_name'] = $this->getTypeName($v['type']);
$list[$k]['fee_item_name'] = $this->getFeeItemName($v['fee_item']);
$list[$k]['store_name'] = $this->getStoreName($v['store_id']);
}
$count = $this->storeCostExt->getStoreCostExtTotal($field, $conditions);
$result["list"] = $list;
$result["total"] = $count;
return $this->response("200", "success", $result);
}
}
\ No newline at end of file
......@@ -30,6 +30,8 @@ class FStoreCostExt extends BaseModel
->field($field)
->alias('a')
->join('f_store_cost b', 'a.cost_id = b.id', 'left')
->join('f_apply_for_fee c', 'a.apply_for_id = c.id', 'left')
->where($params)
->limit($pageSize)
->page($pageNo)
......@@ -44,6 +46,8 @@ class FStoreCostExt extends BaseModel
->field($field)
->alias('a')
->join('f_store_cost b', 'a.cost_id = b.id', 'left')
->join('f_apply_for_fee c', 'a.apply_for_id = c.id', 'left')
->where($params)
->count();
return $result;
......@@ -107,4 +111,23 @@ class FStoreCostExt extends BaseModel
->where($where)
->sum($field);
}
/**
* 我的门店成本
* @param $field
* @param $params
* @return false|\PDOStatement|string|\think\Collection
*/
public function getMyCostDetailList($field,$params)
{
$params["b.status"] = 0;
$result = $this->db_
->field($field)
->alias('a')
->join('f_store_cost b', 'a.cost_id = b.id', 'left')
->join('f_apply_for_fee c', 'a.apply_for_id = c.id', 'left')
->where($params)
->select();
return $result;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment