|
@@ -33,10 +33,13 @@ class Set
|
|
|
return date($string, $day);
|
|
|
}
|
|
|
|
|
|
- public function statYes($info, $type)
|
|
|
+ public function statYes($info, $type, $source = false)
|
|
|
{
|
|
|
$table = 'cash/' . $type;
|
|
|
|
|
|
+ if ($type == 'shop_sell') {
|
|
|
+ $type = 'shop';
|
|
|
+ }
|
|
|
$info = is_array($info) ? $info : Dever::db($table)->one($info);
|
|
|
$other = Dever::db($type . '/info')->find($info[$type . '_id']);
|
|
|
if (!$other) {
|
|
@@ -99,7 +102,7 @@ class Set
|
|
|
if ($data) {
|
|
|
Dever::db($table)->update(array('where_id' => $id, 'status' => 2));
|
|
|
|
|
|
- if ($type == 'shop_sell') {
|
|
|
+ if ($type == 'shop_sell' && $data['cash'] > 0) {
|
|
|
$card = Dever::db('cash/order')->getCardAll(array('start'=>$data['start'],'end'=>$data['end'],'pay_type'=>2,'status'=>2,'type'=>1,'type_id'=>$data['shop_id'],'state'=>1));
|
|
|
$shop = Dever::db('shop/info')->find($data['shop_id']);
|
|
|
if ($card && $card['cash'] > 0) {
|
|
@@ -149,6 +152,8 @@ class Set
|
|
|
$show = Dever::input('show', 1);
|
|
|
$type = Dever::input('type', 'shop');
|
|
|
$pay_type = 1;
|
|
|
+ $table = 'cash/' . $type;
|
|
|
+ $source_type = $type;
|
|
|
if ($type == 'shop') {
|
|
|
$search_option_type = 1;
|
|
|
$name = '门店';
|
|
@@ -156,6 +161,7 @@ class Set
|
|
|
$search_option_type = 1;
|
|
|
$pay_type = '2,3';
|
|
|
$name = '门店零售';
|
|
|
+ $type = 'shop';
|
|
|
} elseif ($type == 'store') {
|
|
|
$search_option_type = 3;
|
|
|
$name = '仓库';
|
|
@@ -164,8 +170,6 @@ class Set
|
|
|
$name = '工厂';
|
|
|
}
|
|
|
|
|
|
- $table = 'cash/' . $type;
|
|
|
-
|
|
|
$config = Dever::db($table)->config;
|
|
|
|
|
|
$info = Dever::db($table)->one($id);
|
|
@@ -236,28 +240,28 @@ class Set
|
|
|
if ($show == 1) {
|
|
|
if ($info['status'] == 1) {
|
|
|
|
|
|
- $url = Dever::url('lib/set.audit&id='.$id.'&type=' . $type, 'cash');
|
|
|
- $button[] = '<button class="layui-btn layui-btn-primary" onclick="load(\''.$url.'\', \''.$this->statYes($info, $type).'\', \'请确认\')">立即确认</button>';
|
|
|
+ $url = Dever::url('lib/set.audit&id='.$id.'&type=' . $source_type, 'cash');
|
|
|
+ $button[] = '<button class="layui-btn layui-btn-primary" onclick="load(\''.$url.'\', \''.$this->statYes($info, $source_type).'\', \'请确认\')">立即确认</button>';
|
|
|
}
|
|
|
$config['phone'] = '联系人:' . $other['truename'] . ',联系电话:' . $other['mobile'];
|
|
|
$button[] = '<button class="layui-btn layui-btn-primary" onclick="showAlert(\''.$config['phone'].'\')">联系'.$name.'</button>';
|
|
|
|
|
|
$start = date('Y-m-d H:i:s', $info['start']);
|
|
|
$end = date('Y-m-d H:i:s', $info['end']);
|
|
|
- $out = Dever::url('lib/set.excel?id=' . $info['id'] . '&type=' . $type, 'cash');
|
|
|
+ $out = Dever::url('lib/set.excel?id=' . $info['id'] . '&type=' . $source_type, 'cash');
|
|
|
|
|
|
$button[] = '<a class="layui-btn layui-btn-primary" href="'.$out.'">导出对账单</a>';
|
|
|
} elseif ($show == 2) {
|
|
|
if ($info[$type . '_status'] == 1 && $show != 1) {
|
|
|
|
|
|
- $url = Dever::url('lib/set.audit_other&id='.$id.'&type=' . $type, 'cash');
|
|
|
- $button[] = '<button class="layui-btn layui-btn-primary" onclick="load(\''.$url.'\', \''.$this->statYes($info, $type).'\', \'请确认\')">立即确认</button>';
|
|
|
+ $url = Dever::url('lib/set.audit_other&id='.$id.'&type=' . $source_type, 'cash');
|
|
|
+ $button[] = '<button class="layui-btn layui-btn-primary" onclick="load(\''.$url.'\', \''.$this->statYes($info, $source_type).'\', \'请确认\')">立即确认</button>';
|
|
|
}
|
|
|
$config = Dever::load('factory/admin/auth.config');
|
|
|
$config['phone'] = '联系电话:' . $config['dz_phone'];
|
|
|
$button[] = '<button class="layui-btn layui-btn-primary" onclick="showAlert(\''.$config['phone'].'\')">联系对账专员</button>';
|
|
|
|
|
|
- $print = Dever::url('admin/stat.print?id=' . $info['id'] . '&type=' . $type, $type);
|
|
|
+ $print = Dever::url('admin/stat.print?id=' . $info['id'] . '&type=' . $source_type, $type);
|
|
|
|
|
|
$button[] = '<a class="layui-btn layui-btn-primary" href="'.$print.'" target="_blank">打印对账单</a>';
|
|
|
}
|
|
@@ -401,6 +405,7 @@ class Set
|
|
|
$pay_type = 1;
|
|
|
if ($type == 'shop_sell') {
|
|
|
$pay_type = '2,3';
|
|
|
+ $type = 'shop';
|
|
|
}
|
|
|
|
|
|
$config = Dever::db($table)->config;
|
|
@@ -478,20 +483,22 @@ class Set
|
|
|
}
|
|
|
|
|
|
$type = Dever::input('type', 'shop');
|
|
|
+
|
|
|
+ $table = 'cash/' . $type;
|
|
|
+
|
|
|
$pay_type = 1;
|
|
|
if ($type == 'shop') {
|
|
|
$name = '门店';
|
|
|
} elseif ($type == 'shop_sell') {
|
|
|
$pay_type = '2,3';
|
|
|
$name = '门店';
|
|
|
+ $type = 'shop';
|
|
|
} elseif ($type == 'store') {
|
|
|
$name = '仓库';
|
|
|
} elseif ($type == 'factory') {
|
|
|
$name = '工厂';
|
|
|
}
|
|
|
|
|
|
- $table = 'cash/' . $type;
|
|
|
-
|
|
|
$config = Dever::db($table)->config;
|
|
|
|
|
|
$info = Dever::db($table)->one($id);
|