order.php 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591
  1. <?php
  2. $jstype = array
  3. (
  4. 1 => '订货结算',
  5. 2 => '退款结算',
  6. 3 => '零售结算',
  7. );
  8. $pay_type = array
  9. (
  10. 1 => '在线支付',
  11. 2 => '礼品卡支付',
  12. 3 => '钱包支付',
  13. );
  14. $status = array
  15. (
  16. 1 => '未入账',
  17. 2 => '已入账',
  18. );
  19. $audit = array
  20. (
  21. 1 => '待审核',
  22. 2 => '审核通过',
  23. 3 => '审核未通过',
  24. );
  25. $audit_1 = array
  26. (
  27. //1 => '待审核',
  28. 2 => '审核通过',
  29. 3 => '审核未通过',
  30. );
  31. $audit_type = array
  32. (
  33. 1 => '系统',
  34. 2 => '人工',
  35. );
  36. $source = Dever::config('base')->source;
  37. $shop = function()
  38. {
  39. $array = array();
  40. $info = Dever::db('shop/info')->select();
  41. if($info)
  42. {
  43. $array += $info;
  44. }
  45. return $array;
  46. };
  47. $store = function()
  48. {
  49. $array = array();
  50. $info = Dever::db('store/info')->select();
  51. if($info)
  52. {
  53. $array += $info;
  54. }
  55. return $array;
  56. };
  57. $factory = function()
  58. {
  59. $array = array();
  60. $info = Dever::db('factory/info')->select();
  61. if($info)
  62. {
  63. $array += $info;
  64. }
  65. return $array;
  66. };
  67. # 1是门店 2是仓库 但仓库没有结算单 3是工厂
  68. $search = Dever::input('search_option_source_type', 1);
  69. if ($search == 1) {
  70. $search_name = '结算门店';
  71. $search_option = $shop;
  72. $search_url = 'shop/lib/manage.search';
  73. } elseif ($search == 2) {
  74. $search_name = '结算仓库';
  75. $search_option = $store;
  76. $search_url = 'store/lib/manage.search';
  77. } if ($search == 3) {
  78. $search_name = '结算工厂';
  79. $search_option = $factory;
  80. $search_url = 'factory/lib/manage.search';
  81. }
  82. return array
  83. (
  84. # 表名
  85. 'name' => 'order',
  86. # 显示给用户看的名称
  87. 'lang' => '结算单',
  88. 'order' => 100,
  89. 'config_jstype' => $jstype,
  90. 'config_status' => $status,
  91. 'config_audit' => $audit,
  92. 'config_audit_type' => $audit_type,
  93. 'config_source' => $source,
  94. 'end' => array
  95. (
  96. 'insert' => 'cash/lib/set.orderUpdate_commit',
  97. 'update' => 'cash/lib/set.orderUpdate_commit',
  98. ),
  99. # 数据结构
  100. 'struct' => array
  101. (
  102. 'id' => array
  103. (
  104. 'type' => 'int-11',
  105. 'name' => 'ID',
  106. 'default' => '',
  107. 'desc' => '',
  108. 'match' => 'is_numeric',
  109. 'search' => 'order',
  110. 'list' => true,
  111. ),
  112. 'order_num' => array
  113. (
  114. 'type' => 'varchar-100',
  115. 'name' => '结算单号',
  116. 'default' => '',
  117. 'desc' => '结算单号',
  118. 'match' => 'is_string',
  119. 'update' => 'text',
  120. 'search' => 'fulltext',
  121. 'list' => true,
  122. ),
  123. 'type' => array
  124. (
  125. 'type' => 'int-11',
  126. 'name' => '采购人类型',
  127. 'default' => '',
  128. 'desc' => '采购人类型',
  129. 'search' => 'hidden',
  130. 'match' => 'is_numeric',
  131. ),
  132. 'type_id' => array
  133. (
  134. 'type' => 'int-11',
  135. 'name' => $search_name,
  136. 'default' => '',
  137. 'desc' => '采购人',
  138. 'match' => 'is_numeric',
  139. 'search' => $search == 3 ? '' : 'select',
  140. 'option' => $search_option,
  141. //'update_search' => $search_url,
  142. 'list' => $search == 3 ? false : 'Dever::load("shop/lib/manage.buyInfo", "{type}", "{type_id}")',
  143. ),
  144. 'source_type' => array
  145. (
  146. 'type' => 'int-11',
  147. 'name' => '供货商类型',
  148. 'default' => '',
  149. 'desc' => '供货商类型',
  150. 'search' => 'hidden',
  151. 'match' => 'is_numeric',
  152. ),
  153. 'source_id' => array
  154. (
  155. 'type' => 'int-11',
  156. 'name' => $search_name,
  157. 'default' => '',
  158. 'desc' => '供货商',
  159. 'match' => 'is_numeric',
  160. 'search' => $search == 3 ? 'select' : '',
  161. 'option' => $search_option,
  162. //'update_search' => $search_url,
  163. 'list' => $search == 3 ? 'Dever::load("shop/lib/manage.buyInfo", "{source_type}", "{source_id}")' : false,
  164. ),
  165. 'source_order_id' => array
  166. (
  167. 'type' => 'int-11',
  168. 'name' => '订货单id',
  169. 'default' => '',
  170. 'desc' => '订货单id',
  171. 'match' => 'is_numeric',
  172. ),
  173. 'source_order_num' => array
  174. (
  175. 'type' => 'varchar-100',
  176. 'name' => '订货单编号',
  177. 'default' => '',
  178. 'desc' => '订货单编号',
  179. 'match' => 'is_string',
  180. 'update' => 'text',
  181. 'search' => 'fulltext',
  182. 'list' => 'Dever::load("shop/lib/manage.getOrderUrl", "{source_type}", "{source_order_id}", "{source_order_num}", "'.$search.'")',
  183. ),
  184. 'refund_id' => array
  185. (
  186. 'type' => 'int-11',
  187. 'name' => '退款id',
  188. 'default' => '-1',
  189. 'desc' => '退款id',
  190. 'match' => 'is_numeric',
  191. ),
  192. 'num' => array
  193. (
  194. 'type' => 'varchar-100',
  195. 'name' => '数量',
  196. 'default' => '',
  197. 'desc' => '数量',
  198. 'match' => 'option',
  199. 'list' => true,
  200. ),
  201. 'cash' => array
  202. (
  203. 'type' => 'varchar-50',
  204. 'name' => '结算金额',
  205. 'default' => '0',
  206. 'desc' => '结算金额',
  207. 'match' => 'option',
  208. 'update' => 'text',
  209. 'list' => $search == 1 ? true : false,
  210. ),
  211. 'p_cash' => array
  212. (
  213. 'type' => 'varchar-50',
  214. 'name' => '结算金额',
  215. 'default' => '0',
  216. 'desc' => '结算金额',
  217. 'match' => 'option',
  218. 'update' => 'text',
  219. 'list' => $search == 3 ? true : false,
  220. ),
  221. 'jstype' => array
  222. (
  223. 'type' => 'tinyint-1',
  224. 'name' => '结算类型',
  225. 'default' => '1',
  226. 'desc' => '结算类型',
  227. 'match' => 'is_numeric',
  228. 'option' => $jstype,
  229. 'search' => 'select',
  230. 'list' => true,
  231. ),
  232. 'status' => array
  233. (
  234. 'type' => 'tinyint-1',
  235. 'name' => '入账状态',
  236. 'default' => '1',
  237. 'desc' => '入账状态',
  238. 'match' => 'is_numeric',
  239. 'option' => $status,
  240. 'search' => 'select',
  241. 'list' => true,
  242. ),
  243. 'audit' => array
  244. (
  245. 'type' => 'tinyint-1',
  246. 'name' => '审核状态',
  247. 'default' => '1',
  248. 'desc' => '审核状态',
  249. 'match' => 'is_numeric',
  250. 'option' => $audit_1,
  251. 'search' => 'select',
  252. 'update' => 'radio',
  253. 'list' => 'Dever::load("cash/lib/set.info", "{audit_type}", "{audit}")',
  254. ),
  255. 'audit_type' => array
  256. (
  257. 'type' => 'tinyint-1',
  258. 'name' => '审核类型',
  259. 'default' => '1',
  260. 'desc' => '审核类型',
  261. 'match' => 'is_numeric',
  262. 'option' => $audit_type,
  263. ),
  264. 'pay_type' => array
  265. (
  266. 'type' => 'tinyint-1',
  267. 'name' => '支付类型',
  268. 'default' => '1',
  269. 'desc' => '支付类型',
  270. 'match' => 'is_numeric',
  271. 'option' => $pay_type,
  272. 'search' => 'select',
  273. 'list' => true,
  274. ),
  275. 'fdate' => array
  276. (
  277. 'type' => 'int-11',
  278. 'name' => '完成时间',
  279. 'default' => '',
  280. 'match' => 'is_numeric',
  281. 'desc' => '',
  282. ),
  283. 'operdate' => array
  284. (
  285. 'type' => 'int-11',
  286. 'name' => '结算时间',
  287. 'default' => '',
  288. 'match' => 'is_numeric',
  289. 'desc' => '',
  290. 'search' => 'date',
  291. 'list' => '"{operdate}" ? date("Y-m-d H:i:s", {operdate}) : ""',
  292. ),
  293. 'desc' => array
  294. (
  295. 'type' => 'varchar-500',
  296. 'name' => '审核备注',
  297. 'default' => '',
  298. 'desc' => '审核备注',
  299. 'match' => 'option',
  300. 'update' => 'textarea',
  301. 'list' => true,
  302. ),
  303. 'state' => array
  304. (
  305. 'type' => 'tinyint-1',
  306. 'name' => '状态',
  307. 'default' => '1',
  308. 'desc' => '请选择状态',
  309. 'match' => 'is_numeric',
  310. ),
  311. 'cdate' => array
  312. (
  313. 'type' => 'int-11',
  314. 'name' => '生成时间',
  315. 'match' => array('is_numeric', time()),
  316. 'desc' => '',
  317. # 只有insert时才生效
  318. 'insert' => true,
  319. //'search' => 'date',
  320. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  321. //'list' => 'Dever::load("service/lib/manage.showOrderTime", "{id}")',
  322. ),
  323. ),
  324. 'alter' => array
  325. (
  326. 3 => array
  327. (
  328. array('update', 'num', 'num', 'varchar-100 0 数量'),
  329. ),
  330. 'version' => 3,
  331. ),
  332. 'manage' => array
  333. (
  334. 'list_table' => 'html',
  335. 'delete' => false,
  336. 'edit' => false,
  337. 'insert' => false,
  338. // 'excel' => true,
  339. 'excel' =>array(array('数据导出', '结算单数据列表','cash/lib/order.out_order'),),
  340. 'page_list' => 'order_list',
  341. 'list_button' => array
  342. (
  343. 'fast' => array('审核', '"order&where_id={id}&col=audit,desc&oper_save_jump=order&oper_table=order&oper_parent=order"', '{audit_type} == 2 && {audit} == 1'),
  344. ),
  345. ),
  346. 'request' => array
  347. (
  348. # 获取数量
  349. 'getNum' => array
  350. (
  351. # 匹配的正则或函数 选填项
  352. 'option' => array
  353. (
  354. 'start' => array('yes-fdate', '>='),
  355. 'end' => array('yes-fdate', '<='),
  356. 'type' => 'yes',
  357. 'type_id' => 'yes',
  358. 'source_type' => 'yes',
  359. 'source_id' => 'yes',
  360. 'pay_type' => array('yes', 'in'),
  361. 'status' => array('yes', 'in'),
  362. 'state' => 1,
  363. ),
  364. 'type' => 'one',
  365. 'order' => array('id' => 'desc'),
  366. 'col' => 'sum(num) as total',
  367. ),
  368. # 获取总金额
  369. 'getCash' => array
  370. (
  371. # 匹配的正则或函数 选填项
  372. 'option' => array
  373. (
  374. 'start' => array('yes-fdate', '>='),
  375. 'end' => array('yes-fdate', '<='),
  376. 'type' => 'yes',
  377. 'type_id' => 'yes',
  378. 'source_type' => 'yes',
  379. 'source_id' => 'yes',
  380. 'pay_type' => array('yes', 'in'),
  381. 'status' => array('yes', 'in'),
  382. 'state' => 1,
  383. ),
  384. 'type' => 'one',
  385. 'order' => array('id' => 'desc'),
  386. 'col' => 'sum(cash) as total',
  387. ),
  388. # 获取总金额
  389. 'getPCash' => array
  390. (
  391. # 匹配的正则或函数 选填项
  392. 'option' => array
  393. (
  394. 'start' => array('yes-fdate', '>='),
  395. 'end' => array('yes-fdate', '<='),
  396. 'type' => 'yes',
  397. 'type_id' => 'yes',
  398. 'source_type' => 'yes',
  399. 'source_id' => 'yes',
  400. 'pay_type' => array('yes', 'in'),
  401. 'status' => array('yes', 'in'),
  402. 'state' => 1,
  403. ),
  404. 'type' => 'one',
  405. 'order' => array('id' => 'desc'),
  406. 'col' => 'sum(p_cash) as total',
  407. ),
  408. 'getAll' => array
  409. (
  410. # 匹配的正则或函数 选填项
  411. 'option' => array
  412. (
  413. 'start' => array('yes-fdate', '>='),
  414. 'end' => array('yes-fdate', '<='),
  415. 'type' => 'yes',
  416. 'type_id' => 'yes',
  417. 'source_type' => 'yes',
  418. 'source_id' => 'yes',
  419. 'pay_type' => array('yes', 'in'),
  420. 'status' => array('yes', 'in'),
  421. 'state' => 1,
  422. ),
  423. 'type' => 'all',
  424. 'order' => array('id' => 'desc'),
  425. 'page' => array(10, 'list'),
  426. 'col' => '*',
  427. ),
  428. 'getAllByStore' => array
  429. (
  430. # 匹配的正则或函数 选填项
  431. 'option' => array
  432. (
  433. 'start' => array('yes-fdate', '>='),
  434. 'end' => array('yes-fdate', '<='),
  435. 'type' => array('yes-type', '=', 'and (( '),
  436. 'type_id' => array('yes-type_id', '=', 'and )'),
  437. 'source_type' => array('yes-source_type', '=', 'or ( '),
  438. 'source_id' => array('yes-source_id', '=', 'and )) '),
  439. 'pay_type' => array('yes', 'in'),
  440. 'status' => array('yes', 'in'),
  441. 'state' => 1,
  442. ),
  443. 'type' => 'all',
  444. 'order' => array('id' => 'desc'),
  445. 'page' => array(10, 'list'),
  446. 'col' => '*',
  447. ),
  448. 'getAllNoPage' => array
  449. (
  450. # 匹配的正则或函数 选填项
  451. 'option' => array
  452. (
  453. 'start' => array('yes-fdate', '>='),
  454. 'end' => array('yes-fdate', '<='),
  455. 'type' => 'yes',
  456. 'type_id' => 'yes',
  457. 'source_type' => 'yes',
  458. 'source_id' => 'yes',
  459. 'pay_type' => array('yes', 'in'),
  460. 'status' => array('yes', 'in'),
  461. 'state' => 1,
  462. ),
  463. 'type' => 'all',
  464. 'order' => array('id' => 'desc'),
  465. 'col' => '*',
  466. ),
  467. 'getAllByStoreNoPage' => array
  468. (
  469. # 匹配的正则或函数 选填项
  470. 'option' => array
  471. (
  472. 'start' => array('yes-fdate', '>='),
  473. 'end' => array('yes-fdate', '<='),
  474. 'type' => array('yes-type', '=', 'and (( '),
  475. 'type_id' => array('yes-type_id', '=', 'and )'),
  476. 'source_type' => array('yes-source_type', '=', 'or ( '),
  477. 'source_id' => array('yes-source_id', '=', 'and )) '),
  478. 'pay_type' => array('yes', 'in'),
  479. 'status' => array('yes', 'in'),
  480. 'state' => 1,
  481. ),
  482. 'type' => 'all',
  483. 'order' => array('id' => 'desc'),
  484. 'col' => '*',
  485. ),
  486. 'getDataByOrderId' => array
  487. (
  488. # 匹配的正则或函数 选填项
  489. 'option' => array
  490. (
  491. 'type' => 'yes',
  492. 'type_id' => 'yes',
  493. 'source_type' => 'yes',
  494. 'source_id' => 'yes',
  495. 'source_order_id' => array('yes', 'in'),
  496. 'pay_type' => array('yes', 'in'),
  497. 'status' => array('yes', 'in'),
  498. 'state' => 1,
  499. ),
  500. 'type' => 'all',
  501. 'order' => array('id' => 'desc'),
  502. 'col' => '*',
  503. ),
  504. 'getExcel' => array
  505. (
  506. # 匹配的正则或函数 选填项
  507. 'option' => array
  508. (
  509. 'start' => array('yes-fdate', '>='),
  510. 'end' => array('yes-fdate', '<='),
  511. 'type' => 'yes',
  512. 'type_id' => 'yes',
  513. 'pay_type' => 'yes',
  514. 'audit' => 'yes',
  515. 'jstype' => 'yes',
  516. 'pay_type' => array('yes', 'in'),
  517. 'status' => array('yes', 'in'),
  518. 'state' => 1,
  519. ),
  520. 'type' => 'all',
  521. 'order' => array('id' => 'desc'),
  522. 'col' => '*',
  523. ),
  524. 'getCardAll' => array
  525. (
  526. # 匹配的正则或函数 选填项
  527. 'option' => array
  528. (
  529. 'start' => array('yes-fdate', '>='),
  530. 'end' => array('yes-fdate', '<='),
  531. 'type' => 'yes',
  532. 'type_id' => 'yes',
  533. 'pay_type' => array('yes', 'in'),
  534. 'status' => array('yes', 'in'),
  535. 'state' => 1,
  536. ),
  537. 'type' => 'one',
  538. 'order' => array('id' => 'desc'),
  539. 'col' => 'sum(cash) as cash',
  540. ),
  541. ),
  542. );