order.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432
  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', 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. 'match' => 'is_numeric',
  123. ),
  124. 'type_id' => array
  125. (
  126. 'type' => 'int-11',
  127. 'name' => $search_name,
  128. 'default' => '',
  129. 'desc' => '采购人',
  130. 'match' => 'is_numeric',
  131. 'search' => $search == 3 ? '' : 'select',
  132. 'option' => $search_option,
  133. //'update_search' => $search_url,
  134. 'list' => $search == 3 ? false : 'Dever::load("shop/lib/manage.buyInfo", "{type}", "{type_id}")',
  135. ),
  136. 'source_type' => array
  137. (
  138. 'type' => 'int-11',
  139. 'name' => '供货商类型',
  140. 'default' => '',
  141. 'desc' => '供货商类型',
  142. 'match' => 'is_numeric',
  143. ),
  144. 'source_id' => array
  145. (
  146. 'type' => 'int-11',
  147. 'name' => $search_name,
  148. 'default' => '',
  149. 'desc' => '供货商',
  150. 'match' => 'is_numeric',
  151. 'search' => $search == 3 ? 'select' : '',
  152. 'option' => $search_option,
  153. //'update_search' => $search_url,
  154. 'list' => $search == 3 ? 'Dever::load("shop/lib/manage.buyInfo", "{source_type}", "{source_id}")' : false,
  155. ),
  156. 'source_order_id' => array
  157. (
  158. 'type' => 'int-11',
  159. 'name' => '订货单id',
  160. 'default' => '',
  161. 'desc' => '订货单id',
  162. 'match' => 'is_numeric',
  163. ),
  164. 'source_order_num' => array
  165. (
  166. 'type' => 'varchar-100',
  167. 'name' => '订货单编号',
  168. 'default' => '',
  169. 'desc' => '订货单编号',
  170. 'match' => 'is_string',
  171. 'update' => 'text',
  172. 'search' => 'fulltext',
  173. 'list' => 'Dever::load("shop/lib/manage.getOrderUrl", "{source_order_id}", "{source_order_num}")',
  174. ),
  175. 'refund_id' => array
  176. (
  177. 'type' => 'int-11',
  178. 'name' => '退款id',
  179. 'default' => '-1',
  180. 'desc' => '退款id',
  181. 'match' => 'is_numeric',
  182. ),
  183. 'num' => array
  184. (
  185. 'type' => 'int-11',
  186. 'name' => '数量',
  187. 'default' => '',
  188. 'desc' => '数量',
  189. 'match' => 'is_numeric',
  190. 'list' => true,
  191. ),
  192. 'cash' => array
  193. (
  194. 'type' => 'varchar-50',
  195. 'name' => '结算金额',
  196. 'default' => '0',
  197. 'desc' => '结算金额',
  198. 'match' => 'option',
  199. 'update' => 'text',
  200. 'list' => $search == 1 ? true : false,
  201. ),
  202. 'p_cash' => array
  203. (
  204. 'type' => 'varchar-50',
  205. 'name' => '结算金额',
  206. 'default' => '0',
  207. 'desc' => '结算金额',
  208. 'match' => 'option',
  209. 'update' => 'text',
  210. 'list' => $search == 3 ? true : false,
  211. ),
  212. 'jstype' => array
  213. (
  214. 'type' => 'tinyint-1',
  215. 'name' => '结算类型',
  216. 'default' => '1',
  217. 'desc' => '结算类型',
  218. 'match' => 'is_numeric',
  219. 'option' => $jstype,
  220. 'search' => 'select',
  221. 'list' => true,
  222. ),
  223. 'status' => array
  224. (
  225. 'type' => 'tinyint-1',
  226. 'name' => '入账状态',
  227. 'default' => '1',
  228. 'desc' => '入账状态',
  229. 'match' => 'is_numeric',
  230. 'option' => $status,
  231. 'search' => 'select',
  232. 'list' => true,
  233. ),
  234. 'audit' => array
  235. (
  236. 'type' => 'tinyint-1',
  237. 'name' => '审核状态',
  238. 'default' => '1',
  239. 'desc' => '审核状态',
  240. 'match' => 'is_numeric',
  241. 'option' => $audit_1,
  242. 'search' => 'select',
  243. 'update' => 'radio',
  244. 'list' => 'Dever::load("cash/lib/set.info", "{audit_type}", "{audit}")',
  245. ),
  246. 'audit_type' => array
  247. (
  248. 'type' => 'tinyint-1',
  249. 'name' => '审核类型',
  250. 'default' => '1',
  251. 'desc' => '审核类型',
  252. 'match' => 'is_numeric',
  253. 'option' => $audit_type,
  254. ),
  255. 'fdate' => array
  256. (
  257. 'type' => 'int-11',
  258. 'name' => '完成时间',
  259. 'default' => '',
  260. 'match' => 'is_numeric',
  261. 'desc' => '',
  262. ),
  263. 'operdate' => array
  264. (
  265. 'type' => 'int-11',
  266. 'name' => '结算时间',
  267. 'default' => '',
  268. 'match' => 'is_numeric',
  269. 'desc' => '',
  270. 'search' => 'date',
  271. 'list' => '"{operdate}" ? date("Y-m-d H:i:s", {operdate}) : ""',
  272. ),
  273. 'desc' => array
  274. (
  275. 'type' => 'varchar-500',
  276. 'name' => '未通过原因',
  277. 'default' => '',
  278. 'desc' => '未通过原因',
  279. 'match' => 'option',
  280. 'update' => 'textarea',
  281. 'list' => true,
  282. ),
  283. 'state' => array
  284. (
  285. 'type' => 'tinyint-1',
  286. 'name' => '状态',
  287. 'default' => '1',
  288. 'desc' => '请选择状态',
  289. 'match' => 'is_numeric',
  290. ),
  291. 'cdate' => array
  292. (
  293. 'type' => 'int-11',
  294. 'name' => '生成时间',
  295. 'match' => array('is_numeric', time()),
  296. 'desc' => '',
  297. # 只有insert时才生效
  298. 'insert' => true,
  299. //'search' => 'date',
  300. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  301. //'list' => 'Dever::load("service/lib/manage.showOrderTime", "{id}")',
  302. ),
  303. ),
  304. 'manage' => array
  305. (
  306. 'delete' => false,
  307. 'edit' => false,
  308. 'insert' => false,
  309. 'excel' => true,
  310. 'page_list' => 'order_list',
  311. 'list_button' => array
  312. (
  313. 'fast' => array('审核', '"order&where_id={id}&col=audit,desc&oper_save_jump=order&oper_table=order&oper_parent=order"', '{audit_type} == 2 && {audit} == 1'),
  314. ),
  315. ),
  316. 'request' => array
  317. (
  318. # 获取数量
  319. 'getNum' => array
  320. (
  321. # 匹配的正则或函数 选填项
  322. 'option' => array
  323. (
  324. 'start' => array('yes-cdate', '>='),
  325. 'end' => array('yes-cdate', '<='),
  326. 'type' => 'yes',
  327. 'type_id' => 'yes',
  328. 'source_type' => 'yes',
  329. 'source_id' => 'yes',
  330. 'status' => array('yes', 'in'),
  331. 'state' => 1,
  332. ),
  333. 'type' => 'one',
  334. 'col' => 'sum(num) as total',
  335. ),
  336. # 获取总金额
  337. 'getCash' => array
  338. (
  339. # 匹配的正则或函数 选填项
  340. 'option' => array
  341. (
  342. 'start' => array('yes-cdate', '>='),
  343. 'end' => array('yes-cdate', '<='),
  344. 'type' => 'yes',
  345. 'type_id' => 'yes',
  346. 'source_type' => 'yes',
  347. 'source_id' => 'yes',
  348. 'status' => array('yes', 'in'),
  349. 'state' => 1,
  350. ),
  351. 'type' => 'one',
  352. 'col' => 'sum(cash) as total',
  353. ),
  354. # 获取总金额
  355. 'getPCash' => array
  356. (
  357. # 匹配的正则或函数 选填项
  358. 'option' => array
  359. (
  360. 'start' => array('yes-cdate', '>='),
  361. 'end' => array('yes-cdate', '<='),
  362. 'type' => 'yes',
  363. 'type_id' => 'yes',
  364. 'source_type' => 'yes',
  365. 'source_id' => 'yes',
  366. 'status' => array('yes', 'in'),
  367. 'state' => 1,
  368. ),
  369. 'type' => 'one',
  370. 'col' => 'sum(p_cash) as total',
  371. ),
  372. 'getAll' => array
  373. (
  374. # 匹配的正则或函数 选填项
  375. 'option' => array
  376. (
  377. 'start' => array('yes-cdate', '>='),
  378. 'end' => array('yes-cdate', '<='),
  379. 'type' => 'yes',
  380. 'type_id' => 'yes',
  381. 'source_type' => 'yes',
  382. 'source_id' => 'yes',
  383. 'status' => array('yes', 'in'),
  384. 'state' => 1,
  385. ),
  386. 'type' => 'all',
  387. 'page' => array(10, 'list'),
  388. 'col' => '*',
  389. ),
  390. ),
  391. );