Contract.php 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. <?php
  2. namespace app\api\controller\v1;
  3. use app\api\controller\Base;
  4. use app\hander\HelpHander;
  5. use think\Db;
  6. class Contract extends Base
  7. {
  8. // 合同详情
  9. public function detail(){
  10. $applyId = input('id/d',0);
  11. $ret = model('Contract')->info($applyId);
  12. HelpHander::success($ret);
  13. }
  14. // 打印合同详情
  15. public function detail2(){
  16. $applyId1 = input('id1/d',0);
  17. $applyId2 = input('id2/d',0);
  18. $applyId3 = input('id3/d',0);
  19. $lists = [];
  20. if($applyId1){
  21. $ret1 = model('Contract')->info($applyId1);
  22. $lists[] = $ret1;
  23. }
  24. if($applyId2){
  25. $ret2 = model('Contract')->info($applyId2);
  26. $lists[] = $ret2;
  27. }
  28. if($applyId3){
  29. $ret3 = model('Contract')->info($applyId3);
  30. $lists[] = $ret3;
  31. }
  32. HelpHander::success($lists);
  33. }
  34. // 列表
  35. public function list(){
  36. $page = input('page/d',1);
  37. $size = input('size/d',10);
  38. $contractSn = input('contractSn','','trim');
  39. $programSn = input('programSn','','trim');
  40. $title = input('title','','trim');
  41. $ispay = input('ispay/d',0);
  42. $programId = input('programId/d',0);
  43. $companyId = input('companyId/d',0);
  44. $startTime = input('startTime','','trim');
  45. $endTime = input('endTime','','trim');
  46. $company2 = input('company2','','trim');
  47. $ret = model('Contract')->lists($page,$size,$this->userId,$contractSn,$programSn,$title,$ispay,$programId,$companyId,$startTime,$endTime,$company2);
  48. HelpHander::success($ret);
  49. }
  50. // 导出列表
  51. public function exportList(){
  52. $contractSn = input('contractSn','','trim');
  53. $programSn = input('programSn','','trim');
  54. $title = input('title','','trim');
  55. $ispay = input('ispay/d',0);
  56. $programId = input('programId/d',0);
  57. $companyId = input('companyId/d',0);
  58. $startTime = input('startTime','','trim');
  59. $endTime = input('endTime','','trim');
  60. $company2 = input('company2','','trim');
  61. $ret = model('Contract')->exportlists($this->userId,$contractSn,$programSn,$title,$ispay,$programId,$companyId,$startTime,$endTime,$company2);
  62. HelpHander::success($ret);
  63. }
  64. // app全部合同列表
  65. public function applist(){
  66. $page = input('page/d',1);
  67. $size = input('size/d',10);
  68. $ret = model('Contract')->applists($page,$size,$this->userId);
  69. HelpHander::success($ret);
  70. }
  71. // 追加合同
  72. public function appendlist(){
  73. $applyId = input('applyId/d',0);
  74. $ret = model('Contract')->appendLists($applyId);
  75. HelpHander::success($ret);
  76. }
  77. // 支付或收款记录
  78. public function paylist(){
  79. $applyId = input('applyId/d',0);
  80. $ret = model('ContractPay')->payLists($applyId);
  81. HelpHander::success($ret);
  82. }
  83. // 财务支付或收款记录
  84. public function paylist2(){
  85. $page = input('page/d',1);
  86. $size = input('size/d',10);
  87. $title = input('title','','trim');
  88. $contractSn = input('contractSn','','trim');
  89. $fileStatus = input('fileStatus/d',-1);
  90. $qrStatus = input('qrStatus/d',-1);
  91. $ret = model('ContractPay')->payLists2($page,$size,$title,$contractSn,$qrStatus);
  92. HelpHander::success($ret);
  93. }
  94. public function payPrint(){
  95. $applyId = input('applyId/d',0);
  96. $ret = model('ContractPay')->payPrint($applyId);
  97. HelpHander::success($ret);
  98. }
  99. public function payConfirm(){
  100. $id = input('id/d',0);
  101. model('ContractPay')->payConfirm($id,$this->userId);
  102. HelpHander::success([],'操作成功');
  103. }
  104. public function payUpdates(){
  105. $id = input('id/d',0);
  106. $sdFile = input('file','','trim');
  107. model('ContractPay')->payupdates($id,$sdFile);
  108. HelpHander::success([],'操作成功');
  109. }
  110. public function stampLists(){
  111. $page = input('page/d',1);
  112. $size = input('size/d',10);
  113. $contractSn = input('contractSn','','trim');
  114. $programSn = input('programSn','','trim');
  115. $title = input('title','','trim');
  116. $status = input('status/d',-1);
  117. $startTime = input('startTime','','trim');
  118. $endTime = input('endTime','','trim');
  119. $type = input('type/d',0);
  120. $companyId = input('companyId/d',0);
  121. $sbStatus = input('sbStatus','','trim');
  122. $print = input('print','','trim');
  123. $ret = model('Contract')->stamplists($page,$size,$contractSn,$programSn,$title,$status,$startTime,$endTime,$type,$companyId,$sbStatus,$print);
  124. HelpHander::success($ret);
  125. }
  126. public function stampListsExport(){
  127. $contractSn = input('contractSn','','trim');
  128. $programSn = input('programSn','','trim');
  129. $title = input('title','','trim');
  130. $status = input('status/d',-1);
  131. $startTime = input('startTime','','trim');
  132. $endTime = input('endTime','','trim');
  133. $type = input('type/d',0);
  134. $companyId = input('companyId/d',0);
  135. $sbStatus = input('sbStatus','','trim');
  136. $print = input('print','','trim');
  137. $ret = model('Contract')->stampListsExport($contractSn,$programSn,$title,$status,$startTime,$endTime,$type,$companyId,$sbStatus,$print);
  138. HelpHander::success($ret);
  139. }
  140. public function stampUpdates(){
  141. $id = input('id/d',0);
  142. $sdFile = input('sdFile','','trim');
  143. model('Contract')->stampupdates($id,$sdFile);
  144. HelpHander::success([],'操作成功');
  145. }
  146. public function stampConfirm(){
  147. $id = input('id/d',0);
  148. model('Contract')->stampConfirm($id,$this->userId);
  149. HelpHander::success([],'操作成功');
  150. }
  151. public function confirm(){
  152. $id = input('id/d',0);
  153. model('Contract')->confirm($id);
  154. HelpHander::success([],'操作成功');
  155. }
  156. public function transferred(){
  157. $id = input('id/d',0);
  158. model('Contract')->transferred($id);
  159. HelpHander::success([],'操作成功');
  160. }
  161. public function appstatis(){
  162. $ret = model('Contract')->appstatis();
  163. HelpHander::success($ret,'操作成功');
  164. }
  165. // 修改印花税
  166. public function modifyStamp(){
  167. $contractId = input('contractId/d',0);
  168. $sdid = input('sdid/d',0);
  169. $money = input('money/f',0);
  170. model('Contract')->modifyStamp($contractId,$sdid,$money,$this->userId);
  171. HelpHander::success([],'操作成功');
  172. }
  173. // 打回
  174. public function backStamp(){
  175. $contractId = input('contractId/d',0);
  176. $sdReason = input('sdReason','','trim');
  177. if(!$sdReason){
  178. HelpHander::error('未填写打回原因');
  179. }
  180. model('Contract')->backStamp($contractId,$sdReason);
  181. HelpHander::success([],'操作成功');
  182. }
  183. public function stampLogList(){
  184. $page = input('page/d',1);
  185. $size = input('size/d',10);
  186. $contractId = input('contractId/d',0);
  187. $ret = model('Contract')->stampLogList($page,$size,$contractId);
  188. HelpHander::success($ret);
  189. }
  190. // 合同标记为已打印
  191. public function prints(){
  192. $applyIds = input('ids','','trim');
  193. if($applyIds){
  194. Db::name('contract')->where('apply_id','in',explode(',',$applyIds))->setField('print',1);
  195. }
  196. HelpHander::success([],'操作成功');
  197. }
  198. // 合同标记为已申报
  199. public function sbStatus(){
  200. $applyId = input('id','','trim');
  201. $ret = Db::name('contract')->where('apply_id',$applyId)->setField('sb_status',1);
  202. if(!$ret){
  203. HelpHander::error('操作失败');
  204. }
  205. HelpHander::success([],'操作成功');
  206. }
  207. public function renew(){
  208. $ret = model('Contract')->renew();
  209. HelpHander::success($ret);
  210. }
  211. public function renewConfirm(){
  212. $id = input('id','','trim');
  213. $renew = input('renew/d',0);
  214. $ret = model('Contract')->renewConfirm($id,$renew,$this->userId);
  215. if(!$ret){
  216. HelpHander::error('操作失败');
  217. }
  218. HelpHander::success([],'操作成功');
  219. }
  220. public function renewExport(){
  221. $ret = model('Contract')->renewExport();
  222. HelpHander::success($ret);
  223. }
  224. }