|
@@ -13,11 +13,32 @@ class Manage
|
|
|
return $config['config_audit_type'][$audit_type] . $config['config_audit'][$audit];
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- * 更新信息
|
|
|
- *
|
|
|
- * @return mixed
|
|
|
- */
|
|
|
+ public function statDate($type, $day)
|
|
|
+ {
|
|
|
+ if ($type == 1) {
|
|
|
+ $string = 'Y年m月';
|
|
|
+ } else {
|
|
|
+ $string = 'Y年W周';
|
|
|
+ }
|
|
|
+
|
|
|
+ return date($string, $day);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function statYes($id, $type)
|
|
|
+ {
|
|
|
+ $table = 'cash/' . $type;
|
|
|
+
|
|
|
+ $info = Dever::db($table)->one($id);
|
|
|
+ $shop = Dever::db('shop/info')->find($info[$type . '_id']);
|
|
|
+
|
|
|
+ return $this->statDate($info['type'], $info['day']) . '与'.$shop['name'].'对账单款项是否正确<br />对账金额¥' . $info['cash'] . '元';
|
|
|
+ }
|
|
|
+
|
|
|
+ public function statTime($start, $end)
|
|
|
+ {
|
|
|
+ return date('Y-m-d', $start) . ' ~ ' . date('Y-m-d', $end);
|
|
|
+ }
|
|
|
+
|
|
|
public function orderUpdate($id, $name, $data)
|
|
|
{
|
|
|
Dever::config('base')->hook = true;
|
|
@@ -32,4 +53,162 @@ class Manage
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ public function audit_api()
|
|
|
+ {
|
|
|
+ $id = Dever::input('id');
|
|
|
+ $type = Dever::input('type', 'shop');
|
|
|
+ $table = 'cash/' . $type;
|
|
|
+
|
|
|
+ $info = Dever::db($table)->one($id);
|
|
|
+
|
|
|
+ if ($info) {
|
|
|
+ Dever::db($table)->update(array('where_id' => $id, 'status' => 2));
|
|
|
+ }
|
|
|
+
|
|
|
+ return 'ok';
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public function view_api()
|
|
|
+ {
|
|
|
+ $id = Dever::input('id');
|
|
|
+
|
|
|
+ $type = Dever::input('type', 'shop');
|
|
|
+
|
|
|
+ $table = 'cash/' . $type;
|
|
|
+
|
|
|
+ $config = Dever::db($table)->config;
|
|
|
+
|
|
|
+ $info = Dever::db($table)->one($id);
|
|
|
+
|
|
|
+ $status = $config['config_status'][$info['status']];
|
|
|
+ $shop_status = $config['config_status'][$info['shop_status']];
|
|
|
+
|
|
|
+ $shop = Dever::db('shop/info')->find($info[$type . '_id']);
|
|
|
+
|
|
|
+ $html = '<div class="layui-col-md12"><div class="layui-card"><div class="layui-card-header">对账单详情</div><div class="layui-card-body">';
|
|
|
+
|
|
|
+ $html .= '<table class="layui-table"><tbody>';
|
|
|
+
|
|
|
+ $html .= '<tr>
|
|
|
+ <td width="80">对账门店</td>
|
|
|
+ <td>'.$this->table(false, array(array($shop['name']))).'</td>
|
|
|
+
|
|
|
+ </tr>';
|
|
|
+
|
|
|
+ $html .= '<tr>
|
|
|
+ <td width="80">对账周期</td>
|
|
|
+ <td>'.$this->table(false, array(array($this->statTime($info['start'], $info['end'])))).'</td>
|
|
|
+
|
|
|
+ </tr>';
|
|
|
+
|
|
|
+ $html .= '<tr>
|
|
|
+ <td width="80">对账金额</td>
|
|
|
+ <td>'.$this->table(false, array(array('¥' . $info['cash'] . '元'))).'</td>
|
|
|
+
|
|
|
+ </tr>';
|
|
|
+
|
|
|
+ $html .= '<tr>
|
|
|
+ <td width="80">门店对账状态</td>
|
|
|
+ <td>'.$this->table(false, array(array($shop_status))).'</td>
|
|
|
+
|
|
|
+ </tr>';
|
|
|
+
|
|
|
+ $html .= '<tr>
|
|
|
+ <td width="100">平台对账状态</td>
|
|
|
+ <td>'.$this->table(false, array(array($status))).'</td>
|
|
|
+
|
|
|
+ </tr>';
|
|
|
+
|
|
|
+ $button = array();
|
|
|
+ if ($info['status'] == 1) {
|
|
|
+ $button[] = '<button class="layui-btn layui-btn-primary" onclick="">立即确认</button>';
|
|
|
+ }
|
|
|
+ $button[] = '<button class="layui-btn layui-btn-primary" onclick="">联系门店</button>';
|
|
|
+
|
|
|
+ $button[] = '<button class="layui-btn layui-btn-primary" onclick="">导出对账单</button>';
|
|
|
+ $html .= '<tr>
|
|
|
+ <td>功能按钮</td>
|
|
|
+ <td>'.$this->table(false, array($button)).'</td>
|
|
|
+
|
|
|
+ </tr>';
|
|
|
+
|
|
|
+ $html .= '</tbody></table></div></div>';
|
|
|
+
|
|
|
+ $where['type'] = 1;
|
|
|
+ $where['type_id'] = $info['shop_id'];
|
|
|
+ $where['status'] = 2;
|
|
|
+
|
|
|
+ $data = Dever::db('cash/order')->select_page($where);
|
|
|
+ if ($data) {
|
|
|
+ $head = array('结算单号', '订货单号', '结算类型', '下单日期', '完成日期', '结算日期', '对账金额', '结算状态');
|
|
|
+
|
|
|
+ $body = array();
|
|
|
+ $config = Dever::db('cash/order')->config;
|
|
|
+ foreach ($data as $k => $v) {
|
|
|
+ $cdate = date('Y-m-d H:i', $v['cdate']);
|
|
|
+ $fdate = date('Y-m-d H:i', $v['fdate']);
|
|
|
+ $operdate = date('Y-m-d H:i', $v['operdate']);
|
|
|
+ $cash = $v['cash'];
|
|
|
+ $body[] = array
|
|
|
+ (
|
|
|
+ $v['order_num'],
|
|
|
+ $v['source_order_num'],
|
|
|
+ $config['config_jstype'][$v['jstype']],
|
|
|
+ $cdate,
|
|
|
+ $fdate,
|
|
|
+ $operdate,
|
|
|
+ $cash,
|
|
|
+ '已入账'
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ $page = Dever::page("current");
|
|
|
+
|
|
|
+ $html .= '<div class="layui-card"><div class="layui-card-header">对账清单</div><div class="layui-card-body" style="max-heights: 500px;overflow: auto;">' . $this->table($head, $body) . $page . '</div></div>';
|
|
|
+ }
|
|
|
+
|
|
|
+ $html .= '</div>';
|
|
|
+
|
|
|
+ return '<div class="layui-card-body">' . $html . '</div>';
|
|
|
+ }
|
|
|
+
|
|
|
+ private function table($head, $data)
|
|
|
+ {
|
|
|
+ $html = '';
|
|
|
+ if ($head) {
|
|
|
+ $html = '<table class="layui-table">';
|
|
|
+
|
|
|
+ $html .= '<thead><tr>';
|
|
|
+ foreach ($head as $k => $v) {
|
|
|
+ $html .= '<th>'.$v.'</th>';
|
|
|
+ }
|
|
|
+ $html .= '</tr></thead>';
|
|
|
+
|
|
|
+ $html .= '<tbody>';
|
|
|
+ foreach ($data as $k => $v) {
|
|
|
+ $html .= '<tr>';
|
|
|
+ foreach ($v as $k1 => $v1) {
|
|
|
+ $html .= '<td>'.$v1.'</td>';
|
|
|
+ }
|
|
|
+ $html .= '</tr>';
|
|
|
+ }
|
|
|
+
|
|
|
+ $html .= '</tbody>';
|
|
|
+
|
|
|
+ $html .= '</table>';
|
|
|
+ } else {
|
|
|
+ foreach ($data as $k => $v) {
|
|
|
+ $html .= '';
|
|
|
+ foreach ($v as $k1 => $v1) {
|
|
|
+ $html .= $v1 . ' ';
|
|
|
+ }
|
|
|
+ $html .= '';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return $html;
|
|
|
+ }
|
|
|
}
|