Set.php 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681
  1. <?php
  2. namespace Cash\Lib;
  3. use Dever;
  4. class Set
  5. {
  6. public function getCash($cash)
  7. {
  8. if (!$cash || $cash <= 0) {
  9. return 0;
  10. }
  11. return round($cash, 2);
  12. }
  13. public function info($audit_type, $audit)
  14. {
  15. $config = Dever::db('cash/order')->config;
  16. return $config['config_audit_type'][$audit_type] . $config['config_audit'][$audit];
  17. }
  18. public function statDate($type, $day)
  19. {
  20. if ($type == 1) {
  21. $string = 'Y年m月';
  22. } elseif ($type == 2) {
  23. $string = 'Y年W周';
  24. } else {
  25. $string = 'Y年m月d日';
  26. }
  27. return date($string, $day);
  28. }
  29. public function statYes($info, $type, $source = false)
  30. {
  31. $table = 'cash/' . $type;
  32. if ($type == 'shop_sell') {
  33. $type = 'shop';
  34. }
  35. $info = is_array($info) ? $info : Dever::db($table)->one($info);
  36. $other = Dever::db($type . '/info')->find($info[$type . '_id']);
  37. if (!$other) {
  38. return '';
  39. }
  40. if ($type == 'store') {
  41. return $this->statDate($info['type'], $info['day']) . '与'.$other['name'].'对账单数量是否正确<br />对账数量' . $info['num'] . '个';
  42. }
  43. return $this->statDate($info['type'], $info['day']) . '与'.$other['name'].'对账单款项是否正确<br />对账金额¥' . round($info['cash'],2) . '元';
  44. }
  45. public function statTime($start, $end)
  46. {
  47. return date('Y-m-d', $start) . ' ~ ' . date('Y-m-d', $end);
  48. }
  49. public function orderUpdate_commit($id, $name, $data)
  50. {
  51. Dever::config('base')->hook = true;
  52. $update = array();
  53. $audit = Dever::param('audit', $data);
  54. $info = Dever::db('cash/order')->one($id);
  55. if ($audit > 1 && $info['refund_id'] && $info['refund_id'] > 0) {
  56. Dever::load('shop/lib/refund')->set('buy')->action($info['refund_id'], $audit, false, false);
  57. if ($audit == 2) {
  58. $state = Dever::db('cash/order')->update(array('where_id' => $id, 'status' => 2, 'operdate' => time(), 'fdate' => time()));
  59. $order = Dever::db('shop/buy_order')->find(array('id' => $info['source_order_id'], 'clear' => true));
  60. if ($state && $info['jstype'] == 2 && isset($order['status']) && $order['status'] == 8) {
  61. # 如果是退款结算,同时要把主订单也结算
  62. $where = array();
  63. $where['source_order_id'] = $order['id'];
  64. $where['jstype'] = 1;
  65. $where['audit'] = 1;
  66. $info = Dever::db('cash/order')->find($where);
  67. if ($info) {
  68. $set['status'] = 2;
  69. $set['audit'] = 2;
  70. $set['where_id'] = $info['id'];
  71. $set['operdate'] = time();
  72. $set['fdate'] = time();
  73. Dever::db('cash/order')->update($set);
  74. }
  75. }
  76. }
  77. }
  78. }
  79. # 审核对账
  80. public function audit_api()
  81. {
  82. Dever::config('base')->hook = true;
  83. $id = Dever::input('id');
  84. $type = Dever::input('type', 'shop');
  85. $table = 'cash/' . $type;
  86. $data = Dever::db($table)->one($id);
  87. if ($data) {
  88. Dever::db($table)->update(array('where_id' => $id, 'status' => 2));
  89. if ($type == 'shop_sell' && $data['cash'] > 0) {
  90. return 'reload';
  91. $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));
  92. $shop = Dever::db('shop/info')->find($data['shop_id']);
  93. if ($card && $card['cash'] > 0) {
  94. $cash = sprintf("%01.2f", $card['cash']);
  95. $yue = $shop['price'] + $cash;
  96. $explan = date('Y年m月d日',$data['end']).'礼品卡对账金额';
  97. Dever::load('shop/lib/record')->pingtai($data['shop_id'],$shop['sid'],8,$data['shop_id'],$cash,$yue,$explan);
  98. }
  99. $bao = Dever::db('cash/order')->getCardAll(array('start'=>$data['start'],'end'=>$data['end'],'pay_type'=>3,'status'=>2,'type'=>1,'type_id'=>$data['shop_id'],'state'=>1));
  100. if($bao && $bao['cash']>0){
  101. $shop = Dever::db('shop/info')->find(array('id'=>$shop['id'],'s'=>1));
  102. $cash = sprintf("%01.2f", $bao['cash']);
  103. $yue = $shop['price'] + $cash;
  104. $explan = date('Y年m月d日',$data['end']).'钱包对账金额';
  105. Dever::load('shop/lib/record')->pingtai($data['shop_id'],$shop['sid'],8,$data['shop_id'],$cash,$yue,$explan);
  106. }
  107. }
  108. }
  109. return 'reload';
  110. }
  111. # 批量审核对账
  112. public function auditShopMul($id, $name, $data)
  113. {
  114. Dever::config('base')->hook = true;
  115. $table = 'cash/shop';
  116. if ($id) {
  117. $list = explode(',', $id);
  118. if ($list) {
  119. foreach ($list as $k => $v) {
  120. $data = Dever::db($table)->one($v);
  121. if ($data) {
  122. Dever::db($table)->update(array('where_id' => $v, 'status' => 2));
  123. }
  124. }
  125. }
  126. }
  127. return 'reload';
  128. }
  129. # 审核对账
  130. public function audit_other_api()
  131. {
  132. $id = Dever::input('id');
  133. $type = Dever::input('type', 'shop');
  134. $table = 'cash/' . $type;
  135. $info = Dever::db($table)->one($id);
  136. if ($info) {
  137. Dever::db($table)->update(array('where_id' => $id, $type . '_status' => 2));
  138. }
  139. return 'reload';
  140. }
  141. # 查看对账单详情
  142. public function view_api()
  143. {
  144. $id = Dever::input('id');
  145. if (!$id) {
  146. return false;
  147. }
  148. $show = Dever::input('show', 1);
  149. $type = Dever::input('type', 'shop');
  150. $pay_type = 1;
  151. $table = 'cash/' . $type;
  152. $source_type = $type;
  153. if ($type == 'shop') {
  154. $search_option_type = 1;
  155. $name = '门店';
  156. } if ($type == 'shop_sell') {
  157. $search_option_type = 1;
  158. $pay_type = '2,3';
  159. $name = '门店零售';
  160. $type = 'shop';
  161. } elseif ($type == 'store') {
  162. $search_option_type = 3;
  163. $name = '仓库';
  164. } elseif ($type == 'factory') {
  165. $search_option_type = 2;
  166. $name = '工厂';
  167. }
  168. $config = Dever::db($table)->config;
  169. $info = Dever::db($table)->one($id);
  170. $status = $config['config_status'][$info['status']];
  171. $other_status = $config['config_status'][$info[$type . '_status']];
  172. $other = Dever::db($type . '/info')->find($info[$type . '_id']);
  173. $html = '<div class="layui-col-md12"><div class="layui-card"><div class="layui-card-header">对账单详情</div><div class="layui-card-body">';
  174. $html .= '<table class="layui-table"><tbody>';
  175. $html .= '<tr>
  176. <td width="100">对账'.$name.'</td>
  177. <td>'.$this->table(false, array(array($other['name']))).'</td>
  178. </tr>';
  179. $html .= '<tr>
  180. <td width="80">对账时间</td>
  181. <td>'.$this->table(false, array(array($this->statDate($info['type'], $info['day'])))).'</td>
  182. </tr>';
  183. $html .= '<tr>
  184. <td width="80">对账周期</td>
  185. <td>'.$this->table(false, array(array($this->statTime($info['start'], $info['end'])))).'</td>
  186. </tr>';
  187. if ($type == 'store') {
  188. $html .= '<tr>
  189. <td width="80">商品数量</td>
  190. <td>'.$this->table(false, array(array($info['num']))).'</td>
  191. </tr>';
  192. } else {
  193. $html .= '<tr>
  194. <td width="80">对账金额</td>
  195. <td>'.$this->table(false, array(array('¥' . round($info['cash'], 2)))).'</td>
  196. </tr>';
  197. }
  198. if ($show == 1) {
  199. $html .= '<tr>
  200. <td width="80">'.$name.'对账状态</td>
  201. <td>'.$this->table(false, array(array($other_status))).'</td>
  202. </tr>';
  203. $html .= '<tr>
  204. <td width="100">平台对账状态</td>
  205. <td>'.$this->table(false, array(array($status))).'</td>
  206. </tr>';
  207. } else {
  208. $html .= '<tr>
  209. <td width="80">对账状态</td>
  210. <td>'.$this->table(false, array(array($other_status))).'</td>
  211. </tr>';
  212. }
  213. $button = array();
  214. if ($show == 1) {
  215. if ($info['status'] == 1) {
  216. $url = Dever::url('lib/set.audit&id='.$id.'&type=' . $source_type, 'cash');
  217. $button[] = '<button class="layui-btn layui-btn-primary" onclick="load(\''.$url.'\', \''.$this->statYes($info, $source_type).'\', \'请确认\')">立即确认</button>';
  218. }
  219. $config['phone'] = '联系人:' . $other['truename'] . ',联系电话:' . $other['mobile'];
  220. $button[] = '<button class="layui-btn layui-btn-primary" onclick="showAlert(\''.$config['phone'].'\')">联系'.$name.'</button>';
  221. $start = date('Y-m-d H:i:s', $info['start']);
  222. $end = date('Y-m-d H:i:s', $info['end']);
  223. $out = Dever::url('lib/set.excel?id=' . $info['id'] . '&type=' . $source_type, 'cash');
  224. $button[] = '<a class="layui-btn layui-btn-primary" href="'.$out.'">导出对账单</a>';
  225. } elseif ($show == 2) {
  226. if ($info[$type . '_status'] == 1 && $show != 1) {
  227. $url = Dever::url('lib/set.audit_other&id='.$id.'&type=' . $source_type, 'cash');
  228. $button[] = '<button class="layui-btn layui-btn-primary" onclick="load(\''.$url.'\', \''.$this->statYes($info, $source_type).'\', \'请确认\')">立即确认</button>';
  229. }
  230. $config = Dever::load('factory/admin/auth.config');
  231. $config['phone'] = '联系电话:' . $config['dz_phone'];
  232. $button[] = '<button class="layui-btn layui-btn-primary" onclick="showAlert(\''.$config['phone'].'\')">联系对账专员</button>';
  233. $print = Dever::url('admin/stat.print?id=' . $info['id'] . '&type=' . $source_type, $type);
  234. $button[] = '<a class="layui-btn layui-btn-primary" href="'.$print.'" target="_blank">打印对账单</a>';
  235. }
  236. $html .= '<tr>
  237. <td>功能按钮</td>
  238. <td>'.$this->table(false, array($button)).'</td>
  239. </tr>';
  240. $html .= '</tbody></table></div></div>';
  241. $data = $this->getOrderData($type, $info, '', $pay_type);
  242. if ($data) {
  243. $body = array();
  244. $config = Dever::db('cash/order')->config;
  245. foreach ($data as $k => $v) {
  246. $cdate = date('Y-m-d H:i', $v['cdate']);
  247. $fdate = $v['fdate'] ? date('Y-m-d H:i', $v['fdate']) : '';
  248. $operdate = $v['operdate'] ? date('Y-m-d H:i', $v['operdate']) : '';
  249. $noprice = 2;
  250. if ($type == 'factory') {
  251. $set_type = 2;
  252. $cash = '¥' . round($v['p_cash'], 2);
  253. } else {
  254. $cash = '¥' . round($v['cash'], 2);
  255. $set_type = 1;
  256. }
  257. if ($show == 1) {
  258. if ($v['source_type'] == 4) {
  259. $url = Dever::url('project/database/list?project=shop&table=sell_order_goods&order_id='.$v['source_order_id'].'&page_type=1&noprice=' . $noprice . '&type=' . $set_type, 'manage');
  260. } else {
  261. $url = Dever::url('project/database/list?project=shop&table=buy_order_goods&order_id='.$v['source_order_id'].'&page_type=1&noprice=' . $noprice . '&type=' . $set_type, 'manage');
  262. }
  263. $v['source_order_num'] = '<a href="'.$url.'" style="color:blue">'.$v['source_order_num'].'</a>';
  264. $head = array('结算单号', '订货单号', '结算类型', '下单日期', '完成日期', '结算日期', '对账金额');
  265. if ($type == 'store') {
  266. $head[6] = '商品数量';
  267. }
  268. $head[] = '结算状态';
  269. $d = array
  270. (
  271. $v['order_num'],
  272. $v['source_order_num'],
  273. $config['config_jstype'][$v['jstype']],
  274. $cdate,
  275. $fdate,
  276. $operdate,
  277. $cash,
  278. );
  279. if ($type == 'store') {
  280. $d[6] = $v['num'];
  281. }
  282. $d[] = '已入账';
  283. $body[] = $d;
  284. } else {
  285. $head = array('订货单号', '下单日期', '完成日期', '对账金额');
  286. if ($type == 'store') {
  287. $head[3] = '商品数量';
  288. }
  289. $head[] = '状态';
  290. $d = array
  291. (
  292. $v['source_order_num'],
  293. $cdate,
  294. $fdate,
  295. $cash,
  296. );
  297. if ($type == 'store') {
  298. $d[3] = $v['num'];
  299. }
  300. $d[] = '已入账';
  301. $body[] = $d;
  302. }
  303. }
  304. $page = Dever::page("current");
  305. $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>';
  306. }
  307. $html .= '</div>';
  308. return '<div class="layui-card-body">' . $html . '</div>';
  309. }
  310. private function table($head, $data)
  311. {
  312. $html = '';
  313. if ($head) {
  314. $html = '<table class="layui-table">';
  315. $html .= '<thead><tr>';
  316. foreach ($head as $k => $v) {
  317. $html .= '<th>'.$v.'</th>';
  318. }
  319. $html .= '</tr></thead>';
  320. $html .= '<tbody>';
  321. foreach ($data as $k => $v) {
  322. $html .= '<tr>';
  323. foreach ($v as $k1 => $v1) {
  324. $html .= '<td>'.$v1.'</td>';
  325. }
  326. $html .= '</tr>';
  327. }
  328. $html .= '</tbody>';
  329. $html .= '</table>';
  330. } else {
  331. foreach ($data as $k => $v) {
  332. $html .= '';
  333. foreach ($v as $k1 => $v1) {
  334. $html .= $v1 . '&nbsp;&nbsp;&nbsp;&nbsp;';
  335. }
  336. $html .= '';
  337. }
  338. }
  339. return $html;
  340. }
  341. # 导出对账单
  342. public function excel_api()
  343. {
  344. $type = Dever::input('type');
  345. $id = Dever::input('id');
  346. $table = 'cash/' . $type;
  347. $pay_type = 1;
  348. if ($type == 'shop_sell') {
  349. $pay_type = '2,3';
  350. $type = 'shop';
  351. }
  352. $config = Dever::db($table)->config;
  353. $info = Dever::db($table)->one($id);
  354. $data = $this->getOrderData($type, $info, 'NoPage', $pay_type);
  355. $stat_type = Dever::db('cash/shop')->config['config_type'];
  356. $other = Dever::db($type . '/info')->find($info[$type . '_id']);
  357. $status = $config['config_status'][$info['status']];
  358. $other_status = $config['config_status'][$info[$type . '_status']];
  359. $info['name'] = Dever::load('cash/lib/set')->statDate($stat_type, $info['day']);
  360. $info['status_name'] = $status;
  361. $file = $other['name'] . '的' . $info['name'] . '对账单';
  362. $header = $body = array();
  363. $header = array
  364. (
  365. 'top' => array
  366. (
  367. $file . ' ' . $info['status_name'] . ' 对账金额¥' . $info['cash']. ' 商品数量¥' . $info['num'],
  368. ),
  369. '结算单号',
  370. '订货单号',
  371. '结算类型',
  372. '下单日期',
  373. '完成日期',
  374. '结算日期',
  375. '对账金额',
  376. '礼品卡卡号',
  377. '礼品卡抵扣金额',
  378. );
  379. if ($type == 'store') {
  380. $head[6] = '商品数量';
  381. }
  382. $head[] = '结算状态';
  383. if ($data) {
  384. $body = array();
  385. foreach ($data as $k => $v) {
  386. $cdate = date('Y-m-d H:i', $v['cdate']);
  387. $fdate = $v['fdate'] ? date('Y-m-d H:i', $v['fdate']) : '';
  388. $operdate = $v['operdate'] ? date('Y-m-d H:i', $v['operdate']) : '';
  389. if ($type == 'factory') {
  390. $cash = '¥' . round($v['p_cash'], 2);
  391. } else {
  392. $cash = '¥' . round($v['cash'], 2);
  393. }
  394. $card_code_card = '';
  395. $card_code_cash = '';
  396. if ($v['pay_type'] == 2) {
  397. $sell_order = Dever::db('shop/sell_order')->find($v['source_order_id']);
  398. if ($sell_order) {
  399. $card_code_card = $sell_order['card_code_card'];
  400. $card_code_cash = $sell_order['card_code_cash'];
  401. }
  402. }
  403. $jstype = Dever::db('cash/order')->config['config_jstype'][$v['jstype']];
  404. $body[$k][0] = $v['order_num'];
  405. $body[$k][1] = $v['source_order_num'];
  406. $body[$k][2] = $jstype;
  407. $body[$k][3] = $cdate;
  408. $body[$k][4] = $operdate;
  409. $body[$k][5] = $fdate;
  410. $body[$k][6] = $cash;
  411. if ($type == 'store') {
  412. $body[$k][6] = $v['num'];
  413. }
  414. $body[$k][7] = $card_code_card;
  415. $body[$k][8] = $card_code_cash;
  416. $body[$k][] = '已入账';
  417. }
  418. }
  419. Dever::excelExport($body, $header, $file);
  420. }
  421. # 打印订单单
  422. public function printer($user)
  423. {
  424. $id = Dever::input('id');
  425. if (!$id) {
  426. return false;
  427. }
  428. $type = Dever::input('type', 'shop');
  429. $table = 'cash/' . $type;
  430. $pay_type = 1;
  431. if ($type == 'shop') {
  432. $name = '门店';
  433. } elseif ($type == 'shop_sell') {
  434. $pay_type = '2,3';
  435. $name = '门店';
  436. $type = 'shop';
  437. } elseif ($type == 'store') {
  438. $name = '仓库';
  439. } elseif ($type == 'factory') {
  440. $name = '工厂';
  441. }
  442. $config = Dever::db($table)->config;
  443. $info = Dever::db($table)->one($id);
  444. $status = $config['config_status'][$info['status']];
  445. $other_status = $config['config_status'][$info[$type . '_status']];
  446. $other = Dever::db($type . '/info')->find($info[$type . '_id']);
  447. $member = Dever::db($type . '/member')->find($user['id']);
  448. $factory_config = Dever::db('main/factory_config')->find();
  449. $main_config = Dever::db('main/config')->find();
  450. $pdf = Dever::load('pdf/lib/base')->init();
  451. $pdf->hr('-', $other['name']);
  452. $pdf->br()->font(20)->center('对账周期:' . $this->statTime($info['start'], $info['end']));
  453. $pdf->font(10);
  454. $pdf->br();
  455. $pdf->br()->left('对账日期:' . $this->statDate($info['type'], $info['day']), 80)->left('制单人:' . $member['name'], 60)->left('制单时间:' . date('Y-m-d H:i'), 40);
  456. $pdf->hr();
  457. $data = $this->getOrderData($type, $info, 'NoPage', $pay_type);
  458. $body = array();
  459. $body_total = array();
  460. $body_total['cash'] = 0;
  461. $body_total['num'] = 0;
  462. if ($data) {
  463. foreach ($data as $k => $v) {
  464. $cdate = date('Y-m-d H:i', $v['cdate']);
  465. $fdate = $v['fdate'] ? date('Y-m-d H:i', $v['fdate']) : '';
  466. $operdate = $v['operdate'] ? date('Y-m-d H:i', $v['operdate']) : '';
  467. $prefix = '¥';
  468. if ($type == 'store') {
  469. $cash = $v['num'];
  470. $prefix = '';
  471. } elseif ($type == 'factory') {
  472. $cash = $v['p_cash'];
  473. } else {
  474. $cash = $v['cash'];
  475. }
  476. $cash = round($cash, 2);
  477. $body[] = array
  478. (
  479. $v['source_order_num'],
  480. $cdate,
  481. $fdate,
  482. $prefix . $cash,
  483. '已入账'
  484. );
  485. $body_total['cash'] += $cash;
  486. $body_total['num'] += 1;
  487. }
  488. }
  489. $head = array(array('订单号', 60), array('下单日期', 43), array('完成日期', 43), array('对账金额', 30), array('状态', 20));
  490. if ($type == 'store') {
  491. $head[3][0] = '对账数量';
  492. }
  493. if ($body) {
  494. $pdf->br();
  495. foreach ($head as $k => $v) {
  496. $pdf->left($v[0], $v[1]);
  497. }
  498. foreach ($body as $k => $v) {
  499. $pdf->br();
  500. foreach ($head as $k1 => $v1) {
  501. $pdf->left($v[$k1], $v1[1]);
  502. }
  503. }
  504. $pdf->br();
  505. if ($type == 'store') {
  506. $pdf->right('共'.$body_total['num'].'个订单,合计对账数量' . $body_total['cash'] . '个');
  507. } else {
  508. $pdf->right('共'.$body_total['num'].'个订单,合计对账金额¥' . $body_total['cash'] . '元');
  509. }
  510. $pdf->hr();
  511. }
  512. $pdf->br(1);
  513. //$pdf->SetY(-100);
  514. $pdf->right('如遇任何问题请致电客服');
  515. $pdf->br();
  516. $pdf->font(20);
  517. $pdf->left($main_config['name'], 160);
  518. $pdf->font(10);
  519. $pdf->right('电话:' . $factory_config['phone'], 30);
  520. $pdf->br();
  521. $pdf->left($main_config['site'], 160);
  522. $pdf->font(10);
  523. $pdf->right($main_config['worktime'], 30);
  524. $pdf->out('对账单');
  525. }
  526. # 获取对账单数据
  527. public function getOrderData($type, $info, $page = 'NoPage', $pay_type = 1)
  528. {
  529. $id = $info[$type . '_id'];;
  530. if ($type == 'shop' || $type == 'shop_sell') {
  531. $where['type'] = 1;
  532. $where['type_id'] = $id;
  533. $where['pay_type'] = $pay_type;
  534. $m = 'getAll';
  535. } elseif ($type == 'factory') {
  536. $where['source_type'] = 3;
  537. $where['source_id'] = $id;
  538. $m = 'getAll';
  539. } else {
  540. $where['type'] = 2;
  541. $where['type_id'] = $id;
  542. $where['source_type'] = 2;
  543. $where['source_id'] = $id;
  544. $m = 'getAllByStore';
  545. }
  546. $m .= $page;
  547. $where['status'] = 2;
  548. $where['start'] = $info['start'];
  549. $where['end'] = $info['end'];
  550. return Dever::db('cash/order')->$m($where);
  551. }
  552. }