order.php 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515
  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_commit',
  90. 'update' => 'cash/lib/set.orderUpdate_commit',
  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' => 'varchar-100',
  188. 'name' => '数量',
  189. 'default' => '',
  190. 'desc' => '数量',
  191. 'match' => 'option',
  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. 'alter' => array
  307. (
  308. 3 => array
  309. (
  310. array('update', 'num', 'num', 'varchar-100 0 数量'),
  311. ),
  312. 'version' => 3,
  313. ),
  314. 'manage' => array
  315. (
  316. 'delete' => false,
  317. 'edit' => false,
  318. 'insert' => false,
  319. 'excel' => true,
  320. 'page_list' => 'order_list',
  321. 'list_button' => array
  322. (
  323. 'fast' => array('审核', '"order&where_id={id}&col=audit,desc&oper_save_jump=order&oper_table=order&oper_parent=order"', '{audit_type} == 2 && {audit} == 1'),
  324. ),
  325. ),
  326. 'request' => array
  327. (
  328. # 获取数量
  329. 'getNum' => array
  330. (
  331. # 匹配的正则或函数 选填项
  332. 'option' => array
  333. (
  334. 'start' => array('yes-cdate', '>='),
  335. 'end' => array('yes-cdate', '<='),
  336. 'type' => 'yes',
  337. 'type_id' => 'yes',
  338. 'source_type' => 'yes',
  339. 'source_id' => 'yes',
  340. 'status' => array('yes', 'in'),
  341. 'state' => 1,
  342. ),
  343. 'type' => 'one',
  344. 'col' => 'sum(num) as total',
  345. ),
  346. # 获取总金额
  347. 'getCash' => array
  348. (
  349. # 匹配的正则或函数 选填项
  350. 'option' => array
  351. (
  352. 'start' => array('yes-cdate', '>='),
  353. 'end' => array('yes-cdate', '<='),
  354. 'type' => 'yes',
  355. 'type_id' => 'yes',
  356. 'source_type' => 'yes',
  357. 'source_id' => 'yes',
  358. 'status' => array('yes', 'in'),
  359. 'state' => 1,
  360. ),
  361. 'type' => 'one',
  362. 'col' => 'sum(cash) as total',
  363. ),
  364. # 获取总金额
  365. 'getPCash' => array
  366. (
  367. # 匹配的正则或函数 选填项
  368. 'option' => array
  369. (
  370. 'start' => array('yes-cdate', '>='),
  371. 'end' => array('yes-cdate', '<='),
  372. 'type' => 'yes',
  373. 'type_id' => 'yes',
  374. 'source_type' => 'yes',
  375. 'source_id' => 'yes',
  376. 'status' => array('yes', 'in'),
  377. 'state' => 1,
  378. ),
  379. 'type' => 'one',
  380. 'col' => 'sum(p_cash) as total',
  381. ),
  382. 'getAll' => array
  383. (
  384. # 匹配的正则或函数 选填项
  385. 'option' => array
  386. (
  387. 'start' => array('yes-cdate', '>='),
  388. 'end' => array('yes-cdate', '<='),
  389. 'type' => 'yes',
  390. 'type_id' => 'yes',
  391. 'source_type' => 'yes',
  392. 'source_id' => 'yes',
  393. 'status' => array('yes', 'in'),
  394. 'state' => 1,
  395. ),
  396. 'type' => 'all',
  397. 'page' => array(10, 'list'),
  398. 'col' => '*',
  399. ),
  400. 'getAllByStore' => array
  401. (
  402. # 匹配的正则或函数 选填项
  403. 'option' => array
  404. (
  405. 'start' => array('yes-cdate', '>='),
  406. 'end' => array('yes-cdate', '<='),
  407. 'type' => array('yes-type', '=', 'and (( '),
  408. 'type_id' => array('yes-type_id', '=', 'and )'),
  409. 'source_type' => array('yes-source_type', '=', 'or ( '),
  410. 'source_id' => array('yes-source_id', '=', 'and )) '),
  411. 'status' => array('yes', 'in'),
  412. 'state' => 1,
  413. ),
  414. 'type' => 'all',
  415. 'page' => array(10, 'list'),
  416. 'col' => '*',
  417. ),
  418. 'getAllNoPage' => array
  419. (
  420. # 匹配的正则或函数 选填项
  421. 'option' => array
  422. (
  423. 'start' => array('yes-cdate', '>='),
  424. 'end' => array('yes-cdate', '<='),
  425. 'type' => 'yes',
  426. 'type_id' => 'yes',
  427. 'source_type' => 'yes',
  428. 'source_id' => 'yes',
  429. 'status' => array('yes', 'in'),
  430. 'state' => 1,
  431. ),
  432. 'type' => 'all',
  433. 'col' => '*',
  434. ),
  435. 'getAllByStoreNoPage' => array
  436. (
  437. # 匹配的正则或函数 选填项
  438. 'option' => array
  439. (
  440. 'start' => array('yes-cdate', '>='),
  441. 'end' => array('yes-cdate', '<='),
  442. 'type' => array('yes-type', '=', 'and (( '),
  443. 'type_id' => array('yes-type_id', '=', 'and )'),
  444. 'source_type' => array('yes-source_type', '=', 'or ( '),
  445. 'source_id' => array('yes-source_id', '=', 'and )) '),
  446. 'status' => array('yes', 'in'),
  447. 'state' => 1,
  448. ),
  449. 'type' => 'all',
  450. 'col' => '*',
  451. ),
  452. 'getDataByOrderId' => array
  453. (
  454. # 匹配的正则或函数 选填项
  455. 'option' => array
  456. (
  457. 'type' => 'yes',
  458. 'type_id' => 'yes',
  459. 'source_type' => 'yes',
  460. 'source_id' => 'yes',
  461. 'source_order_id' => array('yes', 'in'),
  462. 'status' => array('yes', 'in'),
  463. 'state' => 1,
  464. ),
  465. 'type' => 'all',
  466. 'col' => '*',
  467. ),
  468. ),
  469. );