|
@@ -54,7 +54,7 @@ class Set
|
|
|
Dever::load('shop/lib/refund')->set('buy')->action($info['refund_id'], $audit, false, false);
|
|
|
|
|
|
if ($audit == 2) {
|
|
|
- Dever::db('cash/order')->update(array('where_id' => $id, 'status' => 2, 'operdate' => time()));
|
|
|
+ Dever::db('cash/order')->update(array('where_id' => $id, 'status' => 2, 'operdate' => time(), 'fdate' => time()));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -176,20 +176,6 @@ class Set
|
|
|
|
|
|
</tr>';
|
|
|
}
|
|
|
- $id = $info[$type . '_id'];
|
|
|
- if ($type == 'shop') {
|
|
|
- $where['type'] = 1;
|
|
|
- $where['type_id'] = $id;
|
|
|
- } elseif ($type == 'factory') {
|
|
|
- $where['source_type'] = 3;
|
|
|
- $where['source_id'] = $id;
|
|
|
- } else {
|
|
|
- $where['type'] = 2;
|
|
|
- $where['type_id'] = $id;
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
- $where['status'] = 2;
|
|
|
|
|
|
$button = array();
|
|
|
|
|
@@ -204,12 +190,7 @@ class Set
|
|
|
|
|
|
$start = date('Y-m-d H:i:s', $info['start']);
|
|
|
$end = date('Y-m-d H:i:s', $info['end']);
|
|
|
- $ow = array();
|
|
|
- foreach ($where as $k => $v) {
|
|
|
- $ow['search_option_' . $k] = $v;
|
|
|
- }
|
|
|
- $ow = http_build_query($ow);
|
|
|
- $out = Dever::url('database.list_excel?project=cash&table=order&search_option_status=2&search_option_state=1&search_option_start_cdate=' . $start . '&search_option_end_cdate=' . $end . '&' . $ow, 'manage');
|
|
|
+ $out = Dever::url('lib/set.excel?id=' . $info['id'] . '&type=' . $type, 'cash');
|
|
|
|
|
|
$button[] = '<a class="layui-btn layui-btn-primary" href="'.$out.'">导出对账单</a>';
|
|
|
} elseif ($show == 2) {
|
|
@@ -235,7 +216,20 @@ class Set
|
|
|
|
|
|
$html .= '</tbody></table></div></div>';
|
|
|
|
|
|
-
|
|
|
+ $id = $info[$type . '_id'];
|
|
|
+ if ($type == 'shop') {
|
|
|
+ $where['type'] = 1;
|
|
|
+ $where['type_id'] = $id;
|
|
|
+ } elseif ($type == 'factory') {
|
|
|
+ $where['source_type'] = 3;
|
|
|
+ $where['source_id'] = $id;
|
|
|
+ } else {
|
|
|
+ $where['type'] = 2;
|
|
|
+ $where['type_id'] = $id;
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ $where['status'] = 2;
|
|
|
$where['start'] = $info['start'];
|
|
|
$where['end'] = $info['end'];
|
|
|
$data = Dever::db('cash/order')->getAll($where);
|
|
@@ -339,6 +333,94 @@ class Set
|
|
|
return $html;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ public function excel_api()
|
|
|
+ {
|
|
|
+ $type = Dever::input('type');
|
|
|
+ $id = Dever::input('id');
|
|
|
+
|
|
|
+ $table = 'cash/' . $type;
|
|
|
+
|
|
|
+ $config = Dever::db($table)->config;
|
|
|
+
|
|
|
+ $info = Dever::db($table)->one($id);
|
|
|
+ $id = $info[$type . '_id'];
|
|
|
+ if ($type == 'shop') {
|
|
|
+ $where['type'] = 1;
|
|
|
+ $where['type_id'] = $id;
|
|
|
+ } elseif ($type == 'factory') {
|
|
|
+ $where['source_type'] = 3;
|
|
|
+ $where['source_id'] = $id;
|
|
|
+ } else {
|
|
|
+ $where['type'] = 2;
|
|
|
+ $where['type_id'] = $id;
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ $where['status'] = 2;
|
|
|
+ $where['start'] = $info['start'];
|
|
|
+ $where['end'] = $info['end'];
|
|
|
+ $data = Dever::db('cash/order')->getAll($where);
|
|
|
+
|
|
|
+ $stat_type = Dever::db('cash/shop')->config['config_type'];
|
|
|
+ $other = Dever::db($type . '/info')->find($id);
|
|
|
+ $status = $config['config_status'][$info['status']];
|
|
|
+ $other_status = $config['config_status'][$info[$type . '_status']];
|
|
|
+
|
|
|
+ $info['name'] = Dever::load('cash/lib/set')->statDate($stat_type, $info['day']);
|
|
|
+ $info['status_name'] = $status;
|
|
|
+ $file = $other['name'] . '的' . $info['name'] . '对账单';
|
|
|
+ $header = $body = array();
|
|
|
+
|
|
|
+ $header = array
|
|
|
+ (
|
|
|
+ 'top' => array
|
|
|
+ (
|
|
|
+ $file . ' ' . $info['status_name'] . ' 对账金额¥' . $info['cash'],
|
|
|
+ ),
|
|
|
+ '结算单号',
|
|
|
+ '订货单号',
|
|
|
+ '结算类型',
|
|
|
+ '下单日期',
|
|
|
+ '完成日期',
|
|
|
+ '结算日期',
|
|
|
+ '对账金额',
|
|
|
+ '结算状态',
|
|
|
+ );
|
|
|
+ if ($type == 'store') {
|
|
|
+ $head[6] = '对账数量';
|
|
|
+ }
|
|
|
+ if ($data) {
|
|
|
+ $body = array();
|
|
|
+ foreach ($data as $k => $v) {
|
|
|
+
|
|
|
+ $cdate = date('Y-m-d H:i', $v['cdate']);
|
|
|
+ $fdate = $v['fdate'] ? date('Y-m-d H:i', $v['fdate']) : '';
|
|
|
+ $operdate = $v['operdate'] ? date('Y-m-d H:i', $v['operdate']) : '';
|
|
|
+
|
|
|
+ if ($type == 'store') {
|
|
|
+ $cash = $v['num'];
|
|
|
+ } elseif ($type == 'factory') {
|
|
|
+ $cash = '¥' . round($v['p_cash'], 2);
|
|
|
+ } else {
|
|
|
+ $cash = '¥' . round($v['cash'], 2);
|
|
|
+ }
|
|
|
+
|
|
|
+ $jstype = Dever::db('cash/order')->config['config_jstype'][$v['jstype']];
|
|
|
+ $body[$k][0] = $v['order_num'];
|
|
|
+ $body[$k][1] = $v['source_order_num'];
|
|
|
+ $body[$k][2] = $jstype;
|
|
|
+ $body[$k][3] = $cdate;
|
|
|
+ $body[$k][4] = $operdate;
|
|
|
+ $body[$k][5] = $fdate;
|
|
|
+ $body[$k][6] = $cash;
|
|
|
+ $body[$k][7] = '已入账';
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ Dever::excelExport($body, $header, $file);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
public function printer($user)
|
|
|
{
|