SearchController.php 65 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041
  1. <?php
  2. namespace App\Http\Controllers\Admin;
  3. use App\Model\Adminuser;
  4. use App\Model\Project;
  5. use App\Model\Table_eight;
  6. use App\Model\Table_five;
  7. use App\Model\Table_four;
  8. use App\Model\Table_nine;
  9. use App\Model\Table_one;
  10. use App\Model\Table_seven;
  11. use App\Model\Table_six;
  12. use App\Model\Table_three;
  13. use App\Model\Table_two;
  14. use App\Model\Tablelist;
  15. use App\Http\Controllers\Admin\CommonController;
  16. use App\Model\User;
  17. use Illuminate\Support\Facades\DB;
  18. use Session;
  19. use Symfony\Component\HttpFoundation\Request;
  20. class SearchController extends CommonController
  21. {
  22. public function table_search(Request $request,$table_type_id)
  23. {
  24. $user_data = User::where('role','=','0')->get();
  25. $input = $request->all();
  26. if (isset($table_type_id)) {
  27. switch ($table_type_id) {
  28. case 1:
  29. $table_name = '国有土地房屋征收与补偿安置单(货币化安置)';
  30. $th = [
  31. '1' => '姓名',
  32. '2' => '购买存量房面积',
  33. '3' => '拆迁补偿总金额',
  34. '4' => '购买存量房总价格',
  35. '5' => '应交总差额',
  36. '6' => '应退总差额'
  37. ];
  38. //都不搜索 显示表单姓名
  39. if(empty($input['user_id']) && empty($input['project_id']))
  40. {
  41. $table = Table_one::query()
  42. ->where('status','>','1')
  43. ->groupBy('bzc_name')
  44. ->selectRaw('bzc_name')
  45. ->selectRaw('SUM(home_area+money_bus_area) as area')
  46. ->selectRaw('SUM(total_money) as total_money')
  47. ->selectRaw('SUM(money_home_price+money_bus_price) as price')
  48. ->selectRaw('SUM(money_home_jchae+money_bus_jchae) as jchae ')
  49. ->selectRaw('SUM(money_home_tchae+money_bus_tchae) as tchae')
  50. ;
  51. $table = $input['start_time'] != '' ? $table->where('created_at', '>', $input['start_time']) : $table;
  52. $table = $input['end_time'] != '' ? $table->where('created_at', '<', $input['end_time']) : $table;
  53. $table = $table->get();
  54. }
  55. //搜索录入人 显示收录人
  56. if(!empty($input['user_id'])&& empty($input['project_id']))
  57. {
  58. $table = Table_one::query()
  59. ->where('status','>','1')
  60. ->where('user_id','=',$input['user_id'])
  61. ->groupBy('id')
  62. ->selectRaw('user_id')
  63. ->selectRaw('SUM(home_area+money_bus_area) as area')
  64. ->selectRaw('SUM(total_money) as total_money')
  65. ->selectRaw('SUM(money_home_price+money_bus_price) as price')
  66. ->selectRaw('SUM(money_home_jchae+money_bus_jchae) as jchae ')
  67. ->selectRaw('SUM(money_home_tchae+money_bus_tchae) as tchae')
  68. ;
  69. $th[1] = '收录人';
  70. $table = $input['start_time'] != '' ? $table->where('created_at', '>', $input['start_time']) : $table;
  71. $table = $input['end_time'] != '' ? $table->where('created_at', '<', $input['end_time']) : $table;
  72. $table = $table->get();
  73. foreach($table as $value){
  74. $value['bzc_name'] = User::where('id','=',$value['user_id'])->first()->surname;
  75. }
  76. }
  77. //搜索项目 显示项目名
  78. if(!empty($input['project_id']) && empty($input['user_id'])){
  79. $table = Table_one::query()
  80. ->where('project_id','=',$input['project_id'])
  81. ->where('status','>','1')
  82. ->groupBy('id')
  83. ->selectRaw('project_id')
  84. ->selectRaw('SUM(home_area+money_bus_area) as area')
  85. ->selectRaw('SUM(total_money) as total_money')
  86. ->selectRaw('SUM(money_home_price+money_bus_price) as price')
  87. ->selectRaw('SUM(money_home_jchae+money_bus_jchae) as jchae ')
  88. ->selectRaw('SUM(money_home_tchae+money_bus_tchae) as tchae')
  89. ;
  90. $th[1] = '项目';
  91. $table = $input['start_time'] != '' ? $table->where('created_at', '>', $input['start_time']) : $table;
  92. $table = $input['end_time'] != '' ? $table->where('created_at', '<', $input['end_time']) : $table;
  93. $table = $table->get();
  94. foreach($table as $value){
  95. $value['bzc_name'] = Project::where('id','=',$value['project_id'])->first()->project_name;
  96. }
  97. }
  98. //搜索收录人 项目名 显示收录人
  99. if(!empty($input['project_id']) && !empty($input['user_id'])){
  100. $table = Table_one::query()
  101. ->where('status','>','1')
  102. ->where('user_id','=',$input['user_id'])
  103. ->where('project_id','=',$input['project_id'])
  104. ->groupBy('id')
  105. ->selectRaw('user_id')
  106. ->selectRaw('SUM(home_area+money_bus_area) as area')
  107. ->selectRaw('SUM(total_money) as total_money')
  108. ->selectRaw('SUM(money_home_price+money_bus_price) as price')
  109. ->selectRaw('SUM(money_home_jchae+money_bus_jchae) as jchae ')
  110. ->selectRaw('SUM(money_home_tchae+money_bus_tchae) as tchae')
  111. ;
  112. $th[1] = '收录人';
  113. $table = $input['start_time'] != '' ? $table->where('created_at', '>', $input['start_time']) : $table;
  114. $table = $input['end_time'] != '' ? $table->where('created_at', '<', $input['end_time']) : $table;
  115. $table = $table->get();
  116. foreach($table as $value){
  117. $value['bzc_name'] = User::where('id','=',$value['user_id'])->first()->surname;
  118. }
  119. }
  120. return view('admin.sta.sta_one', compact('user_data','table_name', 'table', 'th', 'table_type_id'));
  121. break;
  122. case 2:
  123. $table_name = '违章建筑自行拆除费用申领表';
  124. $th = [
  125. '1' => '姓名',
  126. '2' => '违章面积',
  127. '3' => '拆除金额',
  128. ];
  129. if(empty($input['user_id']) && empty($input['project_id'])){
  130. $table = Table_two::query()
  131. ->where('status','>','1')
  132. ->groupBy('bzc_name')
  133. ->selectRaw('bzc_name')
  134. ->selectRaw('SUM(bzc_area) as area')
  135. ->selectRaw('SUM(chaichuje)as money')
  136. ;
  137. $table = $input['start_time'] != '' ? $table->where('created_at', '>', $input['start_time']) : $table;
  138. $table = $input['end_time'] != '' ? $table->where('created_at', '<', $input['end_time']) : $table;
  139. $table = $table->get();
  140. }
  141. if(!empty($input['user_id'])&& empty($input['project_id'])){
  142. $table = Table_two::query()
  143. ->where('status','>','1')
  144. ->where('user_id','=',$input['user_id'])
  145. ->groupBy('id')
  146. ->selectRaw('user_id')
  147. ->selectRaw('SUM(bzc_area) as area')
  148. ->selectRaw('SUM(chaichuje)as money')
  149. ;
  150. $th[1] = '收录人';
  151. $table = $input['start_time'] != '' ? $table->where('created_at', '>', $input['start_time']) : $table;
  152. $table = $input['end_time'] != '' ? $table->where('created_at', '<', $input['end_time']) : $table;
  153. $table = $table->get();
  154. foreach($table as $value){
  155. $value['bzc_name'] = User::where('id','=',$value['user_id'])->first()->surname;
  156. }
  157. }
  158. if(!empty($input['project_id']) && empty($input['user_id'])){
  159. $table = Table_two::query()
  160. ->where('status','>','1')
  161. ->where('project_id','=',$input['project_id'])
  162. ->groupBy('id')
  163. ->selectRaw('project_id')
  164. ->selectRaw('SUM(bzc_area) as area')
  165. ->selectRaw('SUM(chaichuje)as money')
  166. ;
  167. $table = $input['start_time'] != '' ? $table->where('created_at', '>', $input['start_time']) : $table;
  168. $table = $input['end_time'] != '' ? $table->where('created_at', '<', $input['end_time']) : $table;
  169. $table = $table->get();
  170. foreach($table as $value){
  171. $value['bzc_name'] = Project::where('id','=',$value['project_id'])->first()->project_name;
  172. }
  173. }
  174. if(!empty($input['project_id']) && !empty($input['user_id'])){
  175. $table = Table_three::query()
  176. ->where('status','>','1')
  177. ->where('user_id','=',$input['user_id'])
  178. ->where('project_id','=',$input['project_id'])
  179. ->groupBy('id')
  180. ->selectRaw('user_id')
  181. ->selectRaw('SUM(bzc_area) as area')
  182. ->selectRaw('SUM(chaichuje)as money')
  183. ;
  184. $table = $input['start_time'] != '' ? $table->where('created_at', '>', $input['start_time']) : $table;
  185. $table = $input['end_time'] != '' ? $table->where('created_at', '<', $input['end_time']) : $table;
  186. $table = $table->get();
  187. foreach($table as $value){
  188. $value['bzc_name'] = User::where('id','=',$value['user_id'])->first()->surname;
  189. }
  190. }
  191. return view('admin.sta.sta_two', compact('table_type_id','user_data','table_name', 'table', 'th'));
  192. break;
  193. case 3:
  194. $table_name = '残疾人房征补贴审批确认单';
  195. $th = [
  196. '1' => '姓名',
  197. '2' => '残疾人补贴',
  198. '3' => '临时安置补贴 ',
  199. '4' => '搬迁补贴',
  200. '5' => '合计'
  201. ];
  202. if(empty($input['user_id']) && empty($input['project_id'])){
  203. $table = Table_three::query()
  204. ->where('status','>','1')
  205. ->groupBy('bzc_name')
  206. ->selectRaw('bzc_name')
  207. ->selectRaw('SUM(canbu) as canbu')
  208. ->selectRaw('SUM(linshibu)as linshibu')
  209. ->selectRaw('SUM(banqianbu) as banqianbu')
  210. ->selectRaw('SUM(total) as total')
  211. ;
  212. $table = $input['start_time'] != '' ? $table->where('created_at', '>', $input['start_time']) : $table;
  213. $table = $input['end_time'] != '' ? $table->where('created_at', '<', $input['end_time']) : $table;
  214. $table = $table->get();
  215. }
  216. if(!empty($input['user_id'])&& empty($input['project_id'])){
  217. $table = Table_three::query()
  218. ->where('status','>','1')
  219. ->where('user_id','=',$input['user_id'])
  220. ->groupBy('id')
  221. ->selectRaw('user_id')
  222. ->selectRaw('SUM(canbu) as canbu')
  223. ->selectRaw('SUM(linshibu)as linshibu')
  224. ->selectRaw('SUM(banqianbu) as banqianbu')
  225. ->selectRaw('SUM(total) as total')
  226. ;
  227. $th[1] = '收录人';
  228. $table = $input['start_time'] != '' ? $table->where('created_at', '>', $input['start_time']) : $table;
  229. $table = $input['end_time'] != '' ? $table->where('created_at', '<', $input['end_time']) : $table;
  230. $table = $table->get();
  231. foreach($table as $value){
  232. $value['bzc_name'] = User::where('id','=',$value['user_id'])->first()->surname;
  233. }
  234. }
  235. if(!empty($input['project_id']) && empty($input['user_id'])){
  236. $table = Table_three::query()
  237. ->where('status','>','1')
  238. ->where('project_id','=',$input['project_id'])
  239. ->groupBy('id')
  240. ->selectRaw('project_id')
  241. ->selectRaw('SUM(canbu) as canbu')
  242. ->selectRaw('SUM(linshibu)as linshibu')
  243. ->selectRaw('SUM(banqianbu) as banqianbu')
  244. ->selectRaw('SUM(total) as total')
  245. ;
  246. $th[1] = '项目';
  247. $table = $input['start_time'] != '' ? $table->where('created_at', '>', $input['start_time']) : $table;
  248. $table = $input['end_time'] != '' ? $table->where('created_at', '<', $input['end_time']) : $table;
  249. $table = $table->get();
  250. foreach($table as $value){
  251. $value['bzc_name'] = Project::where('id','=',$value['project_id'])->first()->project_name;
  252. }
  253. }
  254. if(!empty($input['project_id']) && !empty($input['user_id'])){
  255. $table = Table_three::query()
  256. ->where('status','>','1')
  257. ->where('project_id','=',$input['project_id'])
  258. ->where('user_id','=',$input['user_id'])
  259. ->groupBy('id')
  260. ->selectRaw('project_id')
  261. ->selectRaw('SUM(canbu) as canbu')
  262. ->selectRaw('SUM(linshibu)as linshibu')
  263. ->selectRaw('SUM(banqianbu) as banqianbu')
  264. ->selectRaw('SUM(total) as total')
  265. ;
  266. $th[1] = '收录人';
  267. $table = $input['start_time'] != '' ? $table->where('created_at', '>', $input['start_time']) : $table;
  268. $table = $input['end_time'] != '' ? $table->where('created_at', '<', $input['end_time']) : $table;
  269. $table = $table->get();
  270. foreach($table as $value){
  271. $value['bzc_name'] = User::where('id','=',$value['user_id'])->first()->surname;
  272. }
  273. }
  274. return view('admin.sta.sta_three', compact('table_type_id','user_data','user_data','table_name', 'table', 'th'));
  275. break;
  276. case 4:
  277. $table_name = '房屋征收提前搬迁奖励单';
  278. $th = [
  279. '1' => '姓名',
  280. '2' => '全额奖励',
  281. '3' => '差额奖励金',
  282. '4' => '同住奖励',
  283. '5' => '奖励总金额',
  284. ];
  285. if(empty($input['user_id']) && empty($input['project_id'])){
  286. $table = Table_four::query()
  287. ->where('status','>','1')
  288. ->groupBy('bzc_name')
  289. ->selectRaw('bzc_name')
  290. ->selectRaw('SUM(quanj) as quanj')
  291. ->selectRaw('SUM(chaj)as chaj')
  292. ->selectRaw('SUM(tongj) as tongj')
  293. ->selectRaw('SUM(zongj) as zongj')
  294. ;
  295. $table = $input['start_time'] != '' ? $table->where('created_at', '>', $input['start_time']) : $table;
  296. $table = $input['end_time'] != '' ? $table->where('created_at', '<', $input['end_time']) : $table;
  297. $table = $table->get();
  298. }
  299. if(!empty($input['user_id'])&& empty($input['project_id'])){
  300. $table = Table_four::query()
  301. ->where('status','>','1')
  302. ->where('user_id','=',$input['user_id'])
  303. ->groupBy('id')
  304. ->selectRaw('user_id')
  305. ->selectRaw('SUM(quanj) as quanj')
  306. ->selectRaw('SUM(chaj)as chaj')
  307. ->selectRaw('SUM(tongj) as tongj')
  308. ->selectRaw('SUM(zongj) as zongj')
  309. ;
  310. $th[1] = '收录人';
  311. $table = $input['start_time'] != '' ? $table->where('created_at', '>', $input['start_time']) : $table;
  312. $table = $input['end_time'] != '' ? $table->where('created_at', '<', $input['end_time']) : $table;
  313. $table = $table->get();
  314. foreach($table as $value){
  315. $value['bzc_name'] = User::where('id','=',$value['user_id'])->first()->surname;
  316. }
  317. }
  318. if(!empty($input['project_id']) && empty($input['user_id'])){
  319. $table = Table_four::query()
  320. ->where('status','>','1')
  321. ->where('project_id','=',$input['project_id'])
  322. ->groupBy('id')
  323. ->selectRaw('project_id')
  324. ->selectRaw('SUM(quanj) as quanj')
  325. ->selectRaw('SUM(chaj)as chaj')
  326. ->selectRaw('SUM(tongj) as tongj')
  327. ->selectRaw('SUM(zongj) as zongj')
  328. ;
  329. $th[1] = '项目';
  330. $table = $input['start_time'] != '' ? $table->where('created_at', '>', $input['start_time']) : $table;
  331. $table = $input['end_time'] != '' ? $table->where('created_at', '<', $input['end_time']) : $table;
  332. $table = $table->get();
  333. foreach($table as $value){
  334. $value['bzc_name'] = Project::where('id','=',$value['project_id'])->first()->project_name;
  335. }
  336. }
  337. if(!empty($input['project_id']) && !empty($input['user_id'])){
  338. $table = Table_four::query()
  339. ->where('status','>','1')
  340. ->where('project_id','=',$input['project_id'])
  341. ->where('user_id','=',$input['user_id'])
  342. ->groupBy('id')
  343. ->selectRaw('user_id')
  344. ->selectRaw('SUM(quanj) as quanj')
  345. ->selectRaw('SUM(chaj)as chaj')
  346. ->selectRaw('SUM(tongj) as tongj')
  347. ->selectRaw('SUM(zongj) as zongj')
  348. ;
  349. $th[1] = '收录人';
  350. $table = $input['start_time'] != '' ? $table->where('created_at', '>', $input['start_time']) : $table;
  351. $table = $input['end_time'] != '' ? $table->where('created_at', '<', $input['end_time']) : $table;
  352. $table = $table->get();
  353. foreach($table as $value){
  354. $value['bzc_name'] = User::where('id','=',$value['user_id'])->first()->surname;
  355. }
  356. }
  357. return view('admin.sta.sta_four', compact('table_type_id','user_data','table_name', 'table', 'th'));
  358. break;
  359. case 5:
  360. $table_name = '逾期过渡安置补助费发放单';
  361. $th = [
  362. '1' => '姓名',
  363. '2' => '逾期月数',
  364. '3' => '补助合计',
  365. '4' => '逾期补偿金',
  366. ];
  367. if(empty($input['user_id']) && empty($input['project_id'])){
  368. $table = Table_five::query()
  369. ->where('status','>','1')
  370. ->groupBy('bzc_name')
  371. ->selectRaw('bzc_name')
  372. ->selectRaw('SUM(yuqi_mothe1+yuqi_mothe2+yuqi_mothe3+yuqi_mothe4) as yuqi_mothe')
  373. ->selectRaw('SUM(total1+total2+total3+total4)as total')
  374. ->selectRaw('SUM(yuqij) as yuqij')
  375. ;
  376. $table = $input['start_time'] != '' ? $table->where('created_at', '>', $input['start_time']) : $table;
  377. $table = $input['end_time'] != '' ? $table->where('created_at', '<', $input['end_time']) : $table;
  378. $table = $table->get();
  379. }
  380. if(!empty($input['user_id'])&& empty($input['project_id'])){
  381. $table = Table_five::query()
  382. ->where('status','>','1')
  383. ->where('user_id','=',$input['user_id'])
  384. ->groupBy('id')
  385. ->selectRaw('user_id')
  386. ->selectRaw('SUM(yuqi_mothe1+yuqi_mothe2+yuqi_mothe3+yuqi_mothe4) as yuqi_mothe')
  387. ->selectRaw('SUM(total1+total2+total3+total4)as total')
  388. ->selectRaw('SUM(yuqij) as yuqij')
  389. ;
  390. $th = '收录人';
  391. $table = $input['start_time'] != '' ? $table->where('created_at', '>', $input['start_time']) : $table;
  392. $table = $input['end_time'] != '' ? $table->where('created_at', '<', $input['end_time']) : $table;
  393. $table = $table->get();
  394. foreach($table as $value){
  395. $value['bzc_name'] = User::where('id','=',$input['user_id'])->first()->surname;
  396. }
  397. }
  398. if(!empty($input['project_id']) && empty($input['user_id'])){
  399. $table = Table_five::query()
  400. ->where('status','>','1')
  401. ->where('project_id','=',$input['project_id'])
  402. ->groupBy('id')
  403. ->selectRaw('project_id')
  404. ->selectRaw('SUM(yuqi_mothe1+yuqi_mothe2+yuqi_mothe3+yuqi_mothe4) as yuqi_mothe')
  405. ->selectRaw('SUM(total1+total2+total3+total4)as total')
  406. ->selectRaw('SUM(yuqij) as yuqij')
  407. ;
  408. $th = '项目';
  409. $table = $input['start_time'] != '' ? $table->where('created_at', '>', $input['start_time']) : $table;
  410. $table = $input['end_time'] != '' ? $table->where('created_at', '<', $input['end_time']) : $table;
  411. $table = $table->get();
  412. foreach($table as $value){
  413. $value['bzc_name'] = Project::where('id','=',$input['project_id'])->first()->project_name;
  414. }
  415. }
  416. if(!empty($input['project_id']) && !empty($input['user_id'])){
  417. $table = Table_five::query()
  418. ->where('status','>','1')
  419. ->where('user_id','=',$input['user_id'])
  420. ->where('project_id','=',$input['project_id'])
  421. ->groupBy('id')
  422. ->selectRaw('user_id')
  423. ->selectRaw('SUM(yuqi_mothe1+yuqi_mothe2+yuqi_mothe3+yuqi_mothe4) as yuqi_mothe')
  424. ->selectRaw('SUM(total1+total2+total3+total4)as total')
  425. ->selectRaw('SUM(yuqij) as yuqij')
  426. ;
  427. $th = '收录人';
  428. $table = $input['start_time'] != '' ? $table->where('created_at', '>', $input['start_time']) : $table;
  429. $table = $input['end_time'] != '' ? $table->where('created_at', '<', $input['end_time']) : $table;
  430. $table = $table->get();
  431. foreach($table as $value){
  432. $value['bzc_name'] = User::where('id','=',$input['user_id'])->first()->surname;
  433. }
  434. }
  435. return view('admin.sta.sta_five', compact('table_type_id','user_data','table_name', 'table', 'th'));
  436. break;
  437. case 6:
  438. $table_name = '房屋征收安置补贴单';
  439. $th = [
  440. '1' => '姓名',
  441. '2' => '临时安置费',
  442. '3' => '搬迁费',
  443. '4' => '低保补贴',
  444. '5' => '其他',
  445. '6' => '补贴总金额',
  446. ];
  447. if(empty($input['user_id']) && empty($input['project_id'])){
  448. $table = Table_six::query()
  449. ->where('status','>','1')
  450. ->groupBy('bzc_name')
  451. ->selectRaw('bzc_name')
  452. ->selectRaw('SUM(anzhi) as anzhi')
  453. ->selectRaw('SUM(banqian)as banqian')
  454. ->selectRaw('SUM(dibu) as dibu')
  455. ->selectRaw('SUM(other) as other')
  456. ->selectRaw('SUM(totalj) as totalj')
  457. ;
  458. $table = $input['start_time'] != '' ? $table->where('created_at', '>', $input['start_time']) : $table;
  459. $table = $input['end_time'] != '' ? $table->where('created_at', '<', $input['end_time']) : $table;
  460. $table = $table->get();
  461. }
  462. if(!empty($input['user_id'])&& empty($input['project_id'])){
  463. $table = Table_six::query()
  464. ->where('status','>','1')
  465. ->where('user_id','=',$input['user_id'])
  466. ->groupBy('id')
  467. ->selectRaw('user_id')
  468. ->selectRaw('SUM(anzhi) as anzhi')
  469. ->selectRaw('SUM(banqian)as banqian')
  470. ->selectRaw('SUM(dibu) as dibu')
  471. ->selectRaw('SUM(other) as other')
  472. ->selectRaw('SUM(totalj) as totalj')
  473. ;
  474. $th[1] = '收录人';
  475. $table = $input['start_time'] != '' ? $table->where('created_at', '>', $input['start_time']) : $table;
  476. $table = $input['end_time'] != '' ? $table->where('created_at', '<', $input['end_time']) : $table;
  477. $table = $table->get();
  478. foreach($table as $value){
  479. $value['bzc_name'] = User::where('id','=',$input['user_id'])->first()->surname;
  480. }
  481. }
  482. if(!empty($input['project_id']) && empty($input['user_id'])){
  483. $table = Table_six::query()
  484. ->where('status','>','1')
  485. ->where('project_id','=',$input['project_id'])
  486. ->groupBy('id')
  487. ->selectRaw('project_id')
  488. ->selectRaw('SUM(anzhi) as anzhi')
  489. ->selectRaw('SUM(banqian)as banqian')
  490. ->selectRaw('SUM(dibu) as dibu')
  491. ->selectRaw('SUM(other) as other')
  492. ->selectRaw('SUM(totalj) as totalj')
  493. ;
  494. $th[1] = '项目';
  495. $table = $input['start_time'] != '' ? $table->where('created_at', '>', $input['start_time']) : $table;
  496. $table = $input['end_time'] != '' ? $table->where('created_at', '<', $input['end_time']) : $table;
  497. $table = $table->get();
  498. foreach($table as $value){
  499. $value['bzc_name'] = Project::where('id','=',$input['project_id'])->first()->project_name;
  500. }
  501. }
  502. if(!empty($input['project_id']) && !empty($input['user_id'])){
  503. $table = Table_six::query()
  504. ->where('status','>','1')
  505. ->where('project_id','=',$input['project_id'])
  506. ->where('user_id','=',$input['user_id'])
  507. ->groupBy('id')
  508. ->selectRaw('user_id')
  509. ->selectRaw('SUM(anzhi) as anzhi')
  510. ->selectRaw('SUM(banqian)as banqian')
  511. ->selectRaw('SUM(dibu) as dibu')
  512. ->selectRaw('SUM(other) as other')
  513. ->selectRaw('SUM(totalj) as totalj')
  514. ;
  515. $th[1] = '收录人';
  516. $table = $input['start_time'] != '' ? $table->where('created_at', '>', $input['start_time']) : $table;
  517. $table = $input['end_time'] != '' ? $table->where('created_at', '<', $input['end_time']) : $table;
  518. $table = $table->get();
  519. foreach($table as $value){
  520. $value['bzc_name'] = User::where('id','=',$input['user_id'])->first()->surname;
  521. }
  522. }
  523. return view('admin.sta.sta_six', compact('table_type_id','user_data','table_name', 'table', 'th'));
  524. break;
  525. case 7:
  526. $table_name = '核算单(货币化安置)';
  527. $th = [
  528. '1' => '姓名',
  529. '2' => '住宅有证面积可置换住宅面积',
  530. '3' => '住宅有证面积可置换商业面积',
  531. '4' => '住宅有证面积房务补偿',
  532. '5' => '无证面积可置换住宅面积',
  533. '6' => '无证面积可置换商业面积',
  534. '7' => '无证面积房务补偿',
  535. ];
  536. $th1 = [
  537. '1' => '姓名',
  538. '2' => '其中住改非可置换住宅面积',
  539. '3' => '其中住改非可置换商业面积',
  540. '4' => '其中住改非房务补偿',
  541. '5' => '商业有证面积可置换住宅面积',
  542. '6' => '商业有证面积可置换商业面积',
  543. '7' => '商业有证面积房务补偿',
  544. ];
  545. $th2 = [
  546. '1' => '姓名',
  547. '2' => '其他项可置换住宅面积',
  548. '3' => '其他项可置换商业面积',
  549. '4' => '其他项房务补偿',
  550. '5' => '可置换住宅面积小计',
  551. '6' => '可置换商业面积小计',
  552. '7' => '房务补偿小计',
  553. ];
  554. $th3 = [
  555. '1' => '姓名',
  556. '2' => '装修补偿额',
  557. '3' => '庭院补偿额',
  558. '4' => '停产停业损失补偿额',
  559. '5' => '构筑物及其他补偿金',
  560. '6' => '拆迁补偿总金额',
  561. ];
  562. if(empty($input['user_id']) && empty($input['project_id'])){
  563. $table = Table_seven::query()
  564. ->where('status','>','1')
  565. ->groupBy('bzc_name')
  566. ->selectRaw('bzc_name')
  567. ->selectRaw('SUM(bzc_area) as bzc_area')->selectRaw('SUM(data2)as data2')
  568. ->selectRaw('SUM(data3+data4) as data3')->selectRaw('SUM(data5) as data5')
  569. ->selectRaw('SUM(data6) as data6')->selectRaw('SUM(data7+data8) as data7')
  570. ->selectRaw('SUM(data9) as data9')->selectRaw('SUM(data10) as data10')
  571. ->selectRaw('SUM(data11+data12) as data11')->selectRaw('SUM(data13) as data13')
  572. ->selectRaw('SUM(data14) as data14')->selectRaw('SUM(data15+data16) as data15')
  573. ->selectRaw('SUM(data17) as data17')->selectRaw('SUM(data18) as data18')
  574. ->selectRaw('SUM(data19+data20) as data19')->selectRaw('SUM(data21) as data21')
  575. ->selectRaw('SUM(data22) as data22')->selectRaw('SUM(data23+data24) as data23')
  576. ->selectRaw('SUM(data25) as data25')->selectRaw('SUM(data26) as data26')
  577. ->selectRaw('SUM(data27) as data27')->selectRaw('SUM(data42) as data42')
  578. ->selectRaw('SUM(data43) as data43')
  579. ;
  580. $table = $input['start_time'] != '' ? $table->where('created_at', '>', $input['start_time']) : $table;
  581. $table = $input['end_time'] != '' ? $table->where('created_at', '<', $input['end_time']) : $table;
  582. $table = $table->get();
  583. }
  584. if(!empty($input['user_id'])&& empty($input['project_id'])){
  585. $table = Table_seven::query()
  586. ->where('status','>','1')
  587. ->where('user_id','=',$input['user_id'])
  588. ->groupBy('id')
  589. ->selectRaw('user_id')
  590. ->selectRaw('SUM(bzc_area) as bzc_area')->selectRaw('SUM(data2)as data2')
  591. ->selectRaw('SUM(data3+data4) as data3')->selectRaw('SUM(data5) as data5')
  592. ->selectRaw('SUM(data6) as data6')->selectRaw('SUM(data7+data8) as data7')
  593. ->selectRaw('SUM(data9) as data9')->selectRaw('SUM(data10) as data10')
  594. ->selectRaw('SUM(data11+data12) as data11')->selectRaw('SUM(data13) as data13')
  595. ->selectRaw('SUM(data14) as data14')->selectRaw('SUM(data15+data16) as data15')
  596. ->selectRaw('SUM(data17) as data17')->selectRaw('SUM(data18) as data18')
  597. ->selectRaw('SUM(data19+data20) as data19')->selectRaw('SUM(data21) as data21')
  598. ->selectRaw('SUM(data22) as data22')->selectRaw('SUM(data23+data24) as data23')
  599. ->selectRaw('SUM(data25) as data25')->selectRaw('SUM(data26) as data26')
  600. ->selectRaw('SUM(data27) as data27')->selectRaw('SUM(data42) as data42')
  601. ->selectRaw('SUM(data43) as data43')
  602. ;
  603. $th[1] = '收录人';
  604. $th1[1] = '收录人';
  605. $th2[1] = '收录人';
  606. $th3[1] = '收录人';
  607. $table = $input['start_time'] != '' ? $table->where('created_at', '>', $input['start_time']) : $table;
  608. $table = $input['end_time'] != '' ? $table->where('created_at', '<', $input['end_time']) : $table;
  609. $table = $table->get();
  610. foreach($table as $value){
  611. $value['bzc_name'] = User::where('id','=',$input['user_id'])->first()->surname;
  612. }
  613. }
  614. if(!empty($input['project_id']) && empty($input['user_id'])){
  615. $table = Table_seven::query()
  616. ->where('status','>','1')
  617. ->where('project_id','=',$input['project_id'])
  618. ->groupBy('id')
  619. ->selectRaw('project_id')
  620. ->selectRaw('SUM(bzc_area) as bzc_area')->selectRaw('SUM(data2)as data2')
  621. ->selectRaw('SUM(data3+data4) as data3')->selectRaw('SUM(data5) as data5')
  622. ->selectRaw('SUM(data6) as data6')->selectRaw('SUM(data7+data8) as data7')
  623. ->selectRaw('SUM(data9) as data9')->selectRaw('SUM(data10) as data10')
  624. ->selectRaw('SUM(data11+data12) as data11')->selectRaw('SUM(data13) as data13')
  625. ->selectRaw('SUM(data14) as data14')->selectRaw('SUM(data15+data16) as data15')
  626. ->selectRaw('SUM(data17) as data17')->selectRaw('SUM(data18) as data18')
  627. ->selectRaw('SUM(data19+data20) as data19')->selectRaw('SUM(data21) as data21')
  628. ->selectRaw('SUM(data22) as data22')->selectRaw('SUM(data23+data24) as data23')
  629. ->selectRaw('SUM(data25) as data25')->selectRaw('SUM(data26) as data26')
  630. ->selectRaw('SUM(data27) as data27')->selectRaw('SUM(data42) as data42')
  631. ->selectRaw('SUM(data43) as data43')
  632. ;
  633. $th[1] = '项目';
  634. $th1[1] = '项目';
  635. $th2[1] = '项目';
  636. $th3[1] = '项目';
  637. $table = $input['start_time'] != '' ? $table->where('created_at', '>', $input['start_time']) : $table;
  638. $table = $input['end_time'] != '' ? $table->where('created_at', '<', $input['end_time']) : $table;
  639. $table = $table->get();
  640. foreach($table as $value){
  641. $value['bzc_name'] = Project::where('id','=',$input['project_id'])->first()->project_name;
  642. }
  643. }
  644. if(!empty($input['project_id']) && !empty($input['user_id'])){
  645. $table = Table_seven::query()
  646. ->where('status','>','1')
  647. ->where('project_id','=',$input['project_id'])
  648. ->where('user_id','=',$input['user_id'])
  649. ->groupBy('id')
  650. ->selectRaw('user_id')
  651. ->selectRaw('SUM(bzc_area) as bzc_area')->selectRaw('SUM(data2)as data2')
  652. ->selectRaw('SUM(data3+data4) as data3')->selectRaw('SUM(data5) as data5')
  653. ->selectRaw('SUM(data6) as data6')->selectRaw('SUM(data7+data8) as data7')
  654. ->selectRaw('SUM(data9) as data9')->selectRaw('SUM(data10) as data10')
  655. ->selectRaw('SUM(data11+data12) as data11')->selectRaw('SUM(data13) as data13')
  656. ->selectRaw('SUM(data14) as data14')->selectRaw('SUM(data15+data16) as data15')
  657. ->selectRaw('SUM(data17) as data17')->selectRaw('SUM(data18) as data18')
  658. ->selectRaw('SUM(data19+data20) as data19')->selectRaw('SUM(data21) as data21')
  659. ->selectRaw('SUM(data22) as data22')->selectRaw('SUM(data23+data24) as data23')
  660. ->selectRaw('SUM(data25) as data25')->selectRaw('SUM(data26) as data26')
  661. ->selectRaw('SUM(data27) as data27')->selectRaw('SUM(data42) as data42')
  662. ->selectRaw('SUM(data43) as data43')
  663. ;
  664. $th[1] = '收录人';
  665. $th1[1] = '收录人';
  666. $th2[1] = '收录人';
  667. $th3[1] = '收录人';
  668. $table = $input['start_time'] != '' ? $table->where('created_at', '>', $input['start_time']) : $table;
  669. $table = $input['end_time'] != '' ? $table->where('created_at', '<', $input['end_time']) : $table;
  670. $table = $table->get();
  671. foreach($table as $value){
  672. $value['bzc_name'] = User::where('id','=',$input['user_id'])->first()->suranme;
  673. }
  674. }
  675. return view('admin.sta.sta_seven', compact('table_type_id','user_data','table_name', 'table', 'th', 'th1', 'th2', 'th3'));
  676. break;
  677. case 8:
  678. $table_name = '核算单(产权调换)';
  679. $th = [
  680. '1' => '姓名',
  681. '2' => '住宅有证面积可置换住宅面积',
  682. '3' => '住宅有证面积可置换商业面积',
  683. '4' => '住宅有证面积房务补偿',
  684. '5' => '无证面积可置换住宅面积',
  685. '6' => '无证面积可置换商业面积',
  686. '7' => '无证面积房务补偿',
  687. ];
  688. $th1 = [
  689. '1' => '姓名',
  690. '2' => '其中住改非可置换住宅面积',
  691. '3' => '其中住改非可置换商业面积',
  692. '4' => '其中住改非房务补偿',
  693. '5' => '商业有证面积可置换住宅面积',
  694. '6' => '商业有证面积可置换商业面积',
  695. '7' => '商业有证面积房务补偿',
  696. ];
  697. $th2 = [
  698. '1' => '姓名',
  699. '2' => '其他项可置换住宅面积',
  700. '3' => '其他项可置换商业面积',
  701. '4' => '其他项房务补偿',
  702. '5' => '可置换住宅面积小计',
  703. '6' => '可置换商业面积小计',
  704. '7' => '房务补偿小计',
  705. ];
  706. $th3 = [
  707. '1' => '姓名',
  708. '2' => '装修补偿额',
  709. '3' => '庭院补偿额',
  710. '4' => '停产停业损失补偿额',
  711. '5' => '构筑物及其他补偿金',
  712. '6' => '拆迁补偿总金额',
  713. ];
  714. $th4 = [
  715. '1' => '姓名',
  716. '2' => '住宅可调换面积',
  717. '3' => '住宅实际调换面积',
  718. '4' => '住宅大于可调换面积',
  719. '5' => '住宅可调换面积价格核算',
  720. '6' => '住宅大于可调换面积价格核算',
  721. '7' => '住宅调换房屋价格',
  722. ];
  723. $th5 = [
  724. '1' => '姓名',
  725. '2' => '商业可调换面积',
  726. '3' => '商业实际调换面积',
  727. '4' => '商业大于可调换面积',
  728. '5' => '商业可调换面积价格核算',
  729. '6' => '商业大于可调换面积价格核算',
  730. '7' => '商业调换房屋价格',
  731. '8' => '应退差额',
  732. '9' => '应缴差额',
  733. ];
  734. if(empty($input['user_id']) && empty($input['project_id'])){
  735. $table = Table_eight::query()
  736. ->where('status','>','1')
  737. ->groupBy('bzc_name')
  738. ->selectRaw('bzc_name')
  739. ->selectRaw('SUM(bzc_area) as bzc_area')->selectRaw('SUM(data2)as data2')
  740. ->selectRaw('SUM(data3+data4) as data3')->selectRaw('SUM(data5) as data5')
  741. ->selectRaw('SUM(data6) as data6')->selectRaw('SUM(data7+data8) as data7')
  742. ->selectRaw('SUM(data9) as data9')->selectRaw('SUM(data10) as data10')
  743. ->selectRaw('SUM(data11+data12) as data11')->selectRaw('SUM(data13) as data13')
  744. ->selectRaw('SUM(data14) as data14')->selectRaw('SUM(data15+data16) as data15')
  745. ->selectRaw('SUM(data17) as data17')->selectRaw('SUM(data18) as data18')
  746. ->selectRaw('SUM(data19+data20) as data19')->selectRaw('SUM(data21) as data21')
  747. ->selectRaw('SUM(data22) as data22')->selectRaw('SUM(data23+data24) as data23')
  748. ->selectRaw('SUM(data25) as data25')->selectRaw('SUM(data26) as data26')
  749. ->selectRaw('SUM(data27) as data27')->selectRaw('SUM(data42) as data42')
  750. ->selectRaw('SUM(data43) as data43')->selectRaw('SUM(home_area) as home_area')
  751. ->selectRaw('SUM(data50) as data50')->selectRaw('SUM(data51) as data51')
  752. ->selectRaw('SUM(data52) as data52')->selectRaw('SUM(data57) as data57')
  753. ->selectRaw('SUM(data58) as data58')->selectRaw('SUM(data53) as data53')
  754. ->selectRaw('SUM(data54) as data54')->selectRaw('SUM(data55) as data55')
  755. ->selectRaw('SUM(data56) as data56')->selectRaw('SUM(data61) as data61')
  756. ->selectRaw('SUM(data62) as data62')->selectRaw('SUM(data59) as data59')
  757. ->selectRaw('SUM(data60) as data60')
  758. ;
  759. $table = $input['start_time'] != '' ? $table->where('created_at', '>', $input['start_time']) : $table;
  760. $table = $input['end_time'] != '' ? $table->where('created_at', '<', $input['end_time']) : $table;
  761. $table = $table->get();
  762. }
  763. if(!empty($input['user_id'])&& empty($input['project_id'])){
  764. $table = Table_eight::query()
  765. ->where('status','>','1')
  766. ->where('user_id','=',$input['user_id'])
  767. ->groupBy('id')
  768. ->selectRaw('user_id')
  769. ->selectRaw('SUM(bzc_area) as bzc_area')->selectRaw('SUM(data2)as data2')
  770. ->selectRaw('SUM(data3+data4) as data3')->selectRaw('SUM(data5) as data5')
  771. ->selectRaw('SUM(data6) as data6')->selectRaw('SUM(data7+data8) as data7')
  772. ->selectRaw('SUM(data9) as data9')->selectRaw('SUM(data10) as data10')
  773. ->selectRaw('SUM(data11+data12) as data11')->selectRaw('SUM(data13) as data13')
  774. ->selectRaw('SUM(data14) as data14')->selectRaw('SUM(data15+data16) as data15')
  775. ->selectRaw('SUM(data17) as data17')->selectRaw('SUM(data18) as data18')
  776. ->selectRaw('SUM(data19+data20) as data19')->selectRaw('SUM(data21) as data21')
  777. ->selectRaw('SUM(data22) as data22')->selectRaw('SUM(data23+data24) as data23')
  778. ->selectRaw('SUM(data25) as data25')->selectRaw('SUM(data26) as data26')
  779. ->selectRaw('SUM(data27) as data27')->selectRaw('SUM(data42) as data42')
  780. ->selectRaw('SUM(data43) as data43')->selectRaw('SUM(home_area) as home_area')
  781. ->selectRaw('SUM(data50) as data50')->selectRaw('SUM(data51) as data51')
  782. ->selectRaw('SUM(data52) as data52')->selectRaw('SUM(data57) as data57')
  783. ->selectRaw('SUM(data58) as data58')->selectRaw('SUM(data53) as data53')
  784. ->selectRaw('SUM(data54) as data54')->selectRaw('SUM(data55) as data55')
  785. ->selectRaw('SUM(data56) as data56')->selectRaw('SUM(data61) as data61')
  786. ->selectRaw('SUM(data62) as data62')->selectRaw('SUM(data59) as data59')
  787. ->selectRaw('SUM(data60) as data60')
  788. ;
  789. $th[1] = '收录人';
  790. $th1[1] = '收录人';
  791. $th2[1] = '收录人';
  792. $th3[1] = '收录人';
  793. $th4[1] = '收录人';
  794. $th5[1] = '收录人';
  795. $table = $input['start_time'] != '' ? $table->where('created_at', '>', $input['start_time']) : $table;
  796. $table = $input['end_time'] != '' ? $table->where('created_at', '<', $input['end_time']) : $table;
  797. $table = $table->get();
  798. foreach($table as $value){
  799. $value['bzc_name'] = User::where('id','=',$input['user_id'])->first()->surname;
  800. }
  801. }
  802. if(!empty($input['project_id']) && empty($input['user_id'])){
  803. $table = Table_eight::query()
  804. ->where('status','>','1')
  805. ->where('project_id','=',$input['project_id'])
  806. ->groupBy('id')
  807. ->selectRaw('project_id')
  808. ->selectRaw('SUM(bzc_area) as bzc_area')->selectRaw('SUM(data2)as data2')
  809. ->selectRaw('SUM(data3+data4) as data3')->selectRaw('SUM(data5) as data5')
  810. ->selectRaw('SUM(data6) as data6')->selectRaw('SUM(data7+data8) as data7')
  811. ->selectRaw('SUM(data9) as data9')->selectRaw('SUM(data10) as data10')
  812. ->selectRaw('SUM(data11+data12) as data11')->selectRaw('SUM(data13) as data13')
  813. ->selectRaw('SUM(data14) as data14')->selectRaw('SUM(data15+data16) as data15')
  814. ->selectRaw('SUM(data17) as data17')->selectRaw('SUM(data18) as data18')
  815. ->selectRaw('SUM(data19+data20) as data19')->selectRaw('SUM(data21) as data21')
  816. ->selectRaw('SUM(data22) as data22')->selectRaw('SUM(data23+data24) as data23')
  817. ->selectRaw('SUM(data25) as data25')->selectRaw('SUM(data26) as data26')
  818. ->selectRaw('SUM(data27) as data27')->selectRaw('SUM(data42) as data42')
  819. ->selectRaw('SUM(data43) as data43')->selectRaw('SUM(home_area) as home_area')
  820. ->selectRaw('SUM(data50) as data50')->selectRaw('SUM(data51) as data51')
  821. ->selectRaw('SUM(data52) as data52')->selectRaw('SUM(data57) as data57')
  822. ->selectRaw('SUM(data58) as data58')->selectRaw('SUM(data53) as data53')
  823. ->selectRaw('SUM(data54) as data54')->selectRaw('SUM(data55) as data55')
  824. ->selectRaw('SUM(data56) as data56')->selectRaw('SUM(data61) as data61')
  825. ->selectRaw('SUM(data62) as data62')->selectRaw('SUM(data59) as data59')
  826. ->selectRaw('SUM(data60) as data60')
  827. ;
  828. $th[1] = '项目';
  829. $th1[1] = '项目';
  830. $th2[1] = '项目';
  831. $th3[1] = '项目';
  832. $th4[1] = '项目';
  833. $th5[1] = '项目';
  834. $table = $input['start_time'] != '' ? $table->where('created_at', '>', $input['start_time']) : $table;
  835. $table = $input['end_time'] != '' ? $table->where('created_at', '<', $input['end_time']) : $table;
  836. $table = $table->get();
  837. foreach($table as $value){
  838. $value['bzc_name'] = Project::where('id','=',$input['project_id'])->first()->project_name;
  839. }
  840. }
  841. if(!empty($input['project_id']) && !empty($input['user_id'])){
  842. $table = Table_eight::query()
  843. ->where('status','>','1')
  844. ->where('project_id','=',$input['project_id'])
  845. ->where('user_id','=',$input['user_id'])
  846. ->groupBy('id')
  847. ->selectRaw('user_id')
  848. ->selectRaw('SUM(bzc_area) as bzc_area')->selectRaw('SUM(data2)as data2')
  849. ->selectRaw('SUM(data3+data4) as data3')->selectRaw('SUM(data5) as data5')
  850. ->selectRaw('SUM(data6) as data6')->selectRaw('SUM(data7+data8) as data7')
  851. ->selectRaw('SUM(data9) as data9')->selectRaw('SUM(data10) as data10')
  852. ->selectRaw('SUM(data11+data12) as data11')->selectRaw('SUM(data13) as data13')
  853. ->selectRaw('SUM(data14) as data14')->selectRaw('SUM(data15+data16) as data15')
  854. ->selectRaw('SUM(data17) as data17')->selectRaw('SUM(data18) as data18')
  855. ->selectRaw('SUM(data19+data20) as data19')->selectRaw('SUM(data21) as data21')
  856. ->selectRaw('SUM(data22) as data22')->selectRaw('SUM(data23+data24) as data23')
  857. ->selectRaw('SUM(data25) as data25')->selectRaw('SUM(data26) as data26')
  858. ->selectRaw('SUM(data27) as data27')->selectRaw('SUM(data42) as data42')
  859. ->selectRaw('SUM(data43) as data43')->selectRaw('SUM(home_area) as home_area')
  860. ->selectRaw('SUM(data50) as data50')->selectRaw('SUM(data51) as data51')
  861. ->selectRaw('SUM(data52) as data52')->selectRaw('SUM(data57) as data57')
  862. ->selectRaw('SUM(data58) as data58')->selectRaw('SUM(data53) as data53')
  863. ->selectRaw('SUM(data54) as data54')->selectRaw('SUM(data55) as data55')
  864. ->selectRaw('SUM(data56) as data56')->selectRaw('SUM(data61) as data61')
  865. ->selectRaw('SUM(data62) as data62')->selectRaw('SUM(data59) as data59')
  866. ->selectRaw('SUM(data60) as data60')
  867. ;
  868. $th[1] = '收录人';
  869. $th1[1] = '收录人';
  870. $th2[1] = '收录人';
  871. $th3[1] = '收录人';
  872. $th4[1] = '收录人';
  873. $th5[1] = '收录人';
  874. $table = $input['start_time'] != '' ? $table->where('created_at', '>', $input['start_time']) : $table;
  875. $table = $input['end_time'] != '' ? $table->where('created_at', '<', $input['end_time']) : $table;
  876. $table = $table->get();
  877. foreach($table as $value){
  878. $value['bzc_name'] = User::where('id','=',$input['user_id'])->first()->surname;
  879. }
  880. }
  881. return view('admin.sta.sta_eight', compact('table_type_id','user_data','table_name', 'th', 'th1', 'th2', 'th3', 'th4', 'th5', 'table'));
  882. break;
  883. case 9:
  884. $table_name = '核算单(货币补偿)';
  885. $th = [
  886. '1' => '姓名',
  887. '2' => '房1房屋面积',
  888. '3' => '房2房屋面积',
  889. '4' => '房3房屋面积',
  890. '5' => '房4房屋面积',
  891. '6' => '房5房屋面积',
  892. '7' => '房6房屋面积',
  893. '8' => '合计',
  894. ];
  895. $th1 = [
  896. '1' => '姓名',
  897. '2' => '房1装修',
  898. '3' => '房2装修',
  899. '4' => '房3装修',
  900. '5' => '房4装修',
  901. '6' => '房5装修',
  902. '7' => '房6装修',
  903. '8' => '小计',
  904. ];
  905. $th2 = [
  906. '1' => '姓名',
  907. '2' => '空院补偿额',
  908. '3' => '停产停业损失补偿额',
  909. '4' => '房屋补偿总额',
  910. '5' => '构筑物及其他补偿金',
  911. '6' => '拆迁补偿总金额',
  912. ];
  913. if(empty($input['user_id']) && empty($input['project_id'])){
  914. $table = Table_nine::query()
  915. ->where('status','>','1')
  916. ->groupBy('bzc_name')
  917. ->selectRaw('bzc_name')
  918. ->selectRaw('SUM(data6) as data6')->selectRaw('SUM(data9)as data9')
  919. ->selectRaw('SUM(data12) as data12')->selectRaw('SUM(data15) as data15')
  920. ->selectRaw('SUM(data18) as data18')->selectRaw('SUM(data21) as data21')
  921. ->selectRaw('SUM(data24) as data24')->selectRaw('SUM(data7) as data7')
  922. ->selectRaw('SUM(data10) as data10')->selectRaw('SUM(data13) as data13')
  923. ->selectRaw('SUM(data16) as data16')->selectRaw('SUM(data19) as data19')
  924. ->selectRaw('SUM(data22) as data22')->selectRaw('SUM(data25) as data25')
  925. ->selectRaw('SUM(data26) as data26')->selectRaw('SUM(data27) as data27')
  926. ->selectRaw('SUM(data28) as data28')->selectRaw('SUM(data43) as data43')
  927. ->selectRaw('SUM(data44) as data44')
  928. ;
  929. $table = $input['start_time'] != '' ? $table->where('created_at', '>', $input['start_time']) : $table;
  930. $table = $input['end_time'] != '' ? $table->where('created_at', '<', $input['end_time']) : $table;
  931. $table = $table->get();
  932. }
  933. if(!empty($input['user_id'])&& empty($input['project_id'])){
  934. $table = Table_nine::query()
  935. ->where('status','>','1')
  936. ->where('user_id','=',$input['user_id'])
  937. ->groupBy('id')
  938. ->selectRaw('user_id')
  939. ->selectRaw('SUM(data6) as data6')->selectRaw('SUM(data9)as data9')
  940. ->selectRaw('SUM(data12) as data12')->selectRaw('SUM(data15) as data15')
  941. ->selectRaw('SUM(data18) as data18')->selectRaw('SUM(data21) as data21')
  942. ->selectRaw('SUM(data24) as data24')->selectRaw('SUM(data7) as data7')
  943. ->selectRaw('SUM(data10) as data10')->selectRaw('SUM(data13) as data13')
  944. ->selectRaw('SUM(data16) as data16')->selectRaw('SUM(data19) as data19')
  945. ->selectRaw('SUM(data22) as data22')->selectRaw('SUM(data25) as data25')
  946. ->selectRaw('SUM(data26) as data26')->selectRaw('SUM(data27) as data27')
  947. ->selectRaw('SUM(data28) as data28')->selectRaw('SUM(data43) as data43')
  948. ->selectRaw('SUM(data44) as data44')
  949. ;
  950. $th[1] = '收录人';
  951. $th1[1] = '收录人';
  952. $th2[1] = '收录人';
  953. $table = $input['start_time'] != '' ? $table->where('created_at', '>', $input['start_time']) : $table;
  954. $table = $input['end_time'] != '' ? $table->where('created_at', '<', $input['end_time']) : $table;
  955. $table = $table->get();
  956. foreach($table as $value){
  957. $value['bzc_name'] = User::where('id','=',$value['user_id'])->first()->surname;
  958. }
  959. }
  960. if(!empty($input['project_id']) && empty($input['user_id'])){
  961. $table = Table_nine::query()
  962. ->where('status','>','1')
  963. ->where('project_id','=',$input['project_id'])
  964. ->groupBy('id')
  965. ->selectRaw('project_id')
  966. ->selectRaw('SUM(data6) as data6')->selectRaw('SUM(data9)as data9')
  967. ->selectRaw('SUM(data12) as data12')->selectRaw('SUM(data15) as data15')
  968. ->selectRaw('SUM(data18) as data18')->selectRaw('SUM(data21) as data21')
  969. ->selectRaw('SUM(data24) as data24')->selectRaw('SUM(data7) as data7')
  970. ->selectRaw('SUM(data10) as data10')->selectRaw('SUM(data13) as data13')
  971. ->selectRaw('SUM(data16) as data16')->selectRaw('SUM(data19) as data19')
  972. ->selectRaw('SUM(data22) as data22')->selectRaw('SUM(data25) as data25')
  973. ->selectRaw('SUM(data26) as data26')->selectRaw('SUM(data27) as data27')
  974. ->selectRaw('SUM(data28) as data28')->selectRaw('SUM(data43) as data43')
  975. ->selectRaw('SUM(data44) as data44')
  976. ;
  977. $th[1] = '项目';
  978. $th1[1] = '项目';
  979. $th2[1] = '项目';
  980. $table = $input['start_time'] != '' ? $table->where('created_at', '>', $input['start_time']) : $table;
  981. $table = $input['end_time'] != '' ? $table->where('created_at', '<', $input['end_time']) : $table;
  982. $table = $table->get();
  983. foreach($table as $value){
  984. $value['bzc_name'] = Project::where('id','=',$value['project_id'])->first()->project_name;
  985. }
  986. }
  987. if(!empty($input['project_id']) && !empty($input['user_id'])){
  988. $table = Table_nine::query()
  989. ->where('status','>','1')
  990. ->where('project_id','=',$input['project_id'])
  991. ->where('user_id','=',$input['user_id'])
  992. ->groupBy('id')
  993. ->selectRaw('user_id')
  994. ->selectRaw('SUM(data6) as data6')->selectRaw('SUM(data9)as data9')
  995. ->selectRaw('SUM(data12) as data12')->selectRaw('SUM(data15) as data15')
  996. ->selectRaw('SUM(data18) as data18')->selectRaw('SUM(data21) as data21')
  997. ->selectRaw('SUM(data24) as data24')->selectRaw('SUM(data7) as data7')
  998. ->selectRaw('SUM(data10) as data10')->selectRaw('SUM(data13) as data13')
  999. ->selectRaw('SUM(data16) as data16')->selectRaw('SUM(data19) as data19')
  1000. ->selectRaw('SUM(data22) as data22')->selectRaw('SUM(data25) as data25')
  1001. ->selectRaw('SUM(data26) as data26')->selectRaw('SUM(data27) as data27')
  1002. ->selectRaw('SUM(data28) as data28')->selectRaw('SUM(data43) as data43')
  1003. ->selectRaw('SUM(data44) as data44')
  1004. ;
  1005. $th[1] = '收录人';
  1006. $th1[1] = '收录人';
  1007. $th2[1] = '收录人';
  1008. $table = $input['start_time'] != '' ? $table->where('created_at', '>', $input['start_time']) : $table;
  1009. $table = $input['end_time'] != '' ? $table->where('created_at', '<', $input['end_time']) : $table;
  1010. $table = $table->get();
  1011. foreach($table as $value){
  1012. $value['bzc_name'] = User::where('id','=',$value['user_id'])->first()->surname;
  1013. }
  1014. }
  1015. return view('admin.sta.sta_nine', compact('table_type_id','user_data','table_name', 'table', 'th', 'th1', 'th2'));
  1016. break;
  1017. }
  1018. } else {
  1019. return redirect('/');
  1020. }
  1021. }
  1022. }