Commit 0407dd27 authored by hujun's avatar hujun

成交报告计算总数

parent ed868571
This diff is collapsed.
...@@ -371,6 +371,22 @@ class OBargainModel extends Model ...@@ -371,6 +371,22 @@ class OBargainModel extends Model
->select(); ->select();
} }
/**
* @param string $field
* @param string $params
* @return float|int
*/
public function getBargainListSum($field = '', $params = '')
{
return $this->alias('a')
->join('o_report b', 'a.report_id = b.id', 'left')
->join('o_order c', 'a.order_id = c.id', 'left')
->join('g_houses d', 'c.house_id = d.id', 'left')
->where($params)
->group('a.id')
->sum($field);
}
/** /**
* 成交报告总数 * 成交报告总数
* *
...@@ -1514,4 +1530,19 @@ class OBargainModel extends Model ...@@ -1514,4 +1530,19 @@ class OBargainModel extends Model
echo '--------------';*/ echo '--------------';*/
return $return; return $return;
} }
/**
* @param $field
* @param $where
* @return float|int
*/
public function sumField($field, $where) {
return $this->field($field)->alias('a')
->join('o_report b', 'a.report_id = b.id', 'left')
->join('o_order c', 'a.order_id = c.id', 'left')
->join('g_houses d', 'c.house_id = d.id', 'left')
->where($where)
->group('a.id')
->sum($field);
}
} }
\ No newline at end of file
...@@ -57,4 +57,30 @@ class ORealIncome extends BaseModel ...@@ -57,4 +57,30 @@ class ORealIncome extends BaseModel
return $result; return $result;
} }
/**
* @param $field
* @param $where
* @return float|int
*/
public function sumField($field, $where) {
return $this->where($where)
->sum($field);
}
/**
* @param string $field
* @param string $params
* @return float|int
*/
public function getIncomeListSum($field = '', $params = '')
{
return $this->alias('e')
->join('o_bargain a', 'e.bargain_id = a.id', 'left')
->join('o_report b', 'a.report_id = b.id', 'left')
->join('o_order c', 'a.order_id = c.id', 'left')
->join('g_houses d', 'c.house_id = d.id', 'left')
->where($params)
->group('a.id')
->sum($field);
}
} }
\ No newline at end of file
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