order.php 15 KB

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