Commit 604e0106 authored by hujun's avatar hujun

成交报告修改日志

parent 3158e0c7
......@@ -14,6 +14,7 @@ use app\index\extend\Basic;
use app\index\untils\ExportExcelUntil;
use app\model\AAgents;
use app\model\AStore;
use app\model\OBargainLogModel;
use app\model\OBargainModel;
use app\model\ORealIncome;
use app\model\OTaxes;
......@@ -263,7 +264,7 @@ class Finance extends Basic
$practical_fee_arr = $this->params["practical_fee"];
$bargain_id = $this->params["id"];
$add_real_arr = $update_real_arr = [];
$log_data = $add_real_arr = $update_real_arr = [];
$i = $j = 0;
foreach ($practical_fee_arr as $item) {
if (!$item['fee'] || !$item['operation_date']) {
......@@ -275,12 +276,14 @@ class Finance extends Basic
$update_real_arr[$i]['operation_id'] = $this->userId;
$update_real_arr[$i]['money'] = $item['fee'];
$update_real_arr[$i]['income_time'] = $item['operation_date'];
$log_data[$i]= '[编辑实收佣金:'.$item['fee'].',收佣日期'.$item['operation_date'].']'; //
$i++;
} else {
$add_real_arr[$j]['bargain_id'] = $bargain_id;
$add_real_arr[$j]['operation_id'] = $this->userId;
$add_real_arr[$j]['money'] = $item['fee'];
$add_real_arr[$j]['income_time'] = $item['operation_date'];
$log_data[$j]= '[新增实收佣金:'.$item['fee'].',收佣日期'.$item['operation_date'].']';
$j++;
}
}
......@@ -291,6 +294,9 @@ class Finance extends Basic
if ($j > 0) {
$m_real->addRealIncome($add_real_arr);
}
$content = '[应收总佣金:'.$update_data['commission'].']'. implode(' ',$log_data);
$this->editRecordLog((int)$this->params["id"], $content, 1, '', $update_data['is_open']);
} else {
$data['code'] = 101;
$data['msg'] = 'Modify the failure.';
......@@ -1185,6 +1191,33 @@ class Finance extends Basic
}
public function financeUpdateLog(){
return view('finance/finance_update_log');
if (!$this->request->isAjax()) {
return view('finance/finance_update_log');
}
}
/**
* 记录财务修改日志
*
* @param int $bargain_id
* @param string $step_content
* @param int $type
* @param string $house_number
* @param int $is_open
* @return int
*/
public function editRecordLog(int $bargain_id, string $step_content = '', int $type = 1, string $house_number = '', int $is_open = 0) {
$insert_data[0]['bargain_id'] = $bargain_id;
$insert_data[0]['step_content'] = $step_content;
$insert_data[0]['type'] = $type;
$insert_data[0]['operation_id'] = $this->userId;
$insert_data[0]['operation_name'] = $this->userName;
$insert_data[0]['house_number'] = $house_number;
$insert_data[0]['is_open'] = $is_open;
$insert_data[0]['create_time'] = date('Y-m-d H:i:s');
$m_bargain = new OBargainLogModel();
return $m_bargain->addLog($insert_data);
}
}
<?php
namespace app\model;
use think\Db;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/2/1
* Time : 17:15
* Intro:
*/
class OBargainLogModel extends BaseModel
{
protected $table = "o_bargain_log";
private $db_;
function __construct()
{
$this->db_ = Db::name($this->table);
}
public function addLog($params)
{
Db::startTrans();
try {
$this->db_->insertAll($params);
Db::commit();
return 1;
} catch (\Exception $e) {
Db::rollback();
return 0;
}
}
public function insertLog($params)
{
Db::startTrans();
try {
$id = $this->db_->insertGetId($params);
Db::commit();
return $id;
} catch (\Exception $e) {
Db::rollback();
return 0;
}
}
}
\ 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