addReturnCar.jsp 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469
  1. <%@ page language="java" contentType="text/html;charset=GBK" pageEncoding="GBK"%>
  2. <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  4. <html>
  5. <head>
  6. <meta http-equiv="Content-Type" content="text/html;charset=GBK">
  7. <title>添加回车登记</title>
  8. <link href="${pageContext.request.contextPath}/main.css" rel="stylesheet" type="text/css" />
  9. <link href="${pageContext.request.contextPath }/liger/lib/ligerUI/skins/${sessionScope.css}/css/ligerui-all.css" rel="stylesheet" type="text/css" />
  10. <script src="${pageContext.request.contextPath }/liger/lib/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
  11. <script src="${pageContext.request.contextPath }/liger/lib/ligerUI/js/core/base.js" type="text/javascript"></script>
  12. <script type="text/javascript" src="/shares/js/constant.js"></script>
  13. <script type="text/javascript" src="/shares/js/common.js"></script>
  14. <script src="/shares/xheditor/xheditor-1.1.14/xheditor-1.1.14-zh-cn.min.js" type="text/javascript"></script>
  15. <script src="${pageContext.request.contextPath}/liger/lib/json2.js" type="text/javascript"></script>
  16. <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerDialog.js" type="text/javascript"></script>
  17. <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerGrid.js" type="text/javascript"></script>
  18. <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerTextBox.js" type="text/javascript"></script>
  19. <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerCheckBox.js" type="text/javascript"></script>
  20. <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerComboBox.js" type="text/javascript"></script>
  21. <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerSpinner.js" type="text/javascript"></script>
  22. <script src="${pageContext.request.contextPath }/liger/lib/ligerUI/js/plugins/ligerDateEditor.js" type="text/javascript"></script>
  23. <script type="text/javascript" src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/ligerui.all.js"></script>
  24. <script type="text/javascript">
  25. $(function() {
  26. loadTypeTree("selectbutton1", {type : "singleuser",backId : "dev_buy_person",backName : "dev_buy_person_name",tab : 1});
  27. loadTypeTree("selectbutton2", {type : "detpusersingle",backId : "dev_useman",backName : "dev_useman_name",tab : 1});
  28. $("#return_time").ligerDateEditor({showTime : true,width:160,labelAlign : 'left'});
  29. $("#stop_place").ligerComboBox();
  30. });
  31. function checkForm(){
  32. var rs = $.validate({
  33. name : "plate_number",
  34. model : [ {type : "require",msg : "车牌号不能为空!"}, {type : "len",min : 1,max : 20,msg : "设备编号长度不能超过20个字!"
  35. } ]
  36. });
  37. /* rs = $.validate({
  38. name : "car_department",
  39. model : [ {type : "require",msg : "用车部门不能为空!"} ]
  40. }) && rs;
  41. rs = $.validate({
  42. name : "car_people",model : [ {type : "require",msg : "用车人不能为空!"} ]
  43. }) && rs;
  44. rs = $.validate({
  45. name : "destination",model : [ {type : "require",msg : "目的地不能为空!"}]
  46. }) && rs;
  47. rs = $.validate({
  48. name : "out_car_mileage",model : [ {type : "require",msg : "出车里程不能为空!"}]
  49. }) && rs;*/
  50. /* rs = $.validate({
  51. name : "out_car_reason",model : [ {type : "require",msg : "出车原因不能为空!"}]
  52. }) && rs; */
  53. rs = $.validate({
  54. name : "return_mileage",model :[{type : "require",msg : "回车里程不能为空!"},
  55. {type : "isNumber",msg : "请输入数字!"},
  56. {type : "regex",regex: new RegExp("^[0-9]*[1-9][0-9]*$"),msg : "请输入正整数!"},
  57. {type : "len",min : 0,max : 10,msg : "回车里程不能超过10个字符!"}]
  58. }) && rs;
  59. rs = $.validate({
  60. name : "journey",model : [ {type : "require",msg : "本次行程不能为空!"}]
  61. }) && rs;
  62. rs = $.validate({
  63. name : "return_time",model : [ {type : "require",msg : "回车时间不能为空!"}]
  64. }) && rs;
  65. /* rs = $.validate({
  66. name : "stop_place",model : [ {type : "require",msg : "停放位置不能为空!"}]
  67. }) && rs; */
  68. rs = $.validate({
  69. name : "freight_income",model : [ {type : "isNumber",msg : "请输入数字!"},{type : "len",min : 0,max : 10,msg : "运费收入不能超过10个字符!"}]
  70. }) && rs;
  71. rs = $.validate({
  72. name : "road_toll",model : [ {type : "isNumber",msg : "请输入数字!"},{type : "len",min : 0,max : 10,msg : "过路费不能超过10个字符!"}]
  73. }) && rs;
  74. rs = $.validate({
  75. name : "car_washing_fee",model : [ {type : "isNumber",msg : "请输入数字!"},{type : "len",min : 0,max : 10,msg : "洗车费不能超过10个字符!"}]
  76. }) && rs;
  77. rs = $.validate({
  78. name : "parking_fee",model : [ {type : "isNumber",msg : "请输入数字!"},{type : "len",min : 0,max : 10,msg : "停车费不能超过10个字符!"}]
  79. }) && rs;
  80. rs = $.validate({
  81. name : "water_fee",model : [ {type : "isNumber",msg : "请输入数字!"},{type : "len",min : 0,max : 10,msg : "加油费不能超过10个字符!"}]
  82. }) && rs;
  83. rs = $.validate({
  84. name : "other_fee",model : [ {type : "isNumber",msg : "请输入数字!"},{type : "len",min : 0,max : 10,msg : "其它费用不能超过10个字符!"}]
  85. }) && rs;
  86. if (rs) {
  87. var out_car_time= document.getElementById("out_car_time");
  88. var return_time= document.getElementById("return_time");
  89. if(out_car_time.value != "" && typeof (out_car_time.value) != "undefined"){
  90. if(return_time.value != "" && typeof (return_time.value) != "undefined"){
  91. var a = $("#out_car_time").val();
  92. var b = $("#return_time").val();
  93. a = a.replace(" ", "-").replace(":", "-").replace(":", "-");
  94. var arr = a.split("-");
  95. var fisrtTime = Date.UTC(arr[0], (arr[1] - 1), arr[2], arr[3], arr[4], 0);
  96. b = b.replace(" ", "-").replace(":", "-");
  97. var arrs = b.split("-");
  98. var secondTime = Date.UTC(arrs[0], (arrs[1] - 1), arrs[2], arrs[3], arrs[4], 0);
  99. if (fisrtTime >= secondTime) {
  100. $.ligerDialog.alert('回车日期不能小于出车日期!', '提示', 'warn');
  101. $("#return_time").val("");
  102. $("#out_day_number").val("");
  103. return false;
  104. }
  105. fisrtTime = Date.UTC(arr[0], (arr[1] - 1), arr[2]);
  106. secondTime = Date.UTC(arrs[0], (arrs[1] - 1), arrs[2]);
  107. var dif = secondTime - fisrtTime;
  108. var days = dif/ 3600000 / 24;
  109. document.getElementById("out_day_number").value = days;
  110. }
  111. }
  112. var out_car_mileage = $("#out_car_mileage").val();
  113. var return_mileage = $("#return_mileage").val();
  114. if(!isNaN(return_mileage)) {
  115. if(Number(return_mileage) < Number(out_car_mileage)){
  116. $.ligerDialog.alert('回车里程不能小于出车里程!', '提示', 'warn');
  117. return false;
  118. }
  119. if(return_mileage != null){
  120. var journey = Number(return_mileage) - Number(out_car_mileage);
  121. $("#journey").val(journey);
  122. }
  123. }else{
  124. $("#journey").val("");
  125. }
  126. return true;
  127. }else{
  128. return false;
  129. }
  130. }
  131. /**
  132. * 选择车牌号函数
  133. */
  134. function chooseCustomer(o) {
  135. o = $.extend({
  136. plate_number_id : "plate_number_id",
  137. out_car_id : "out_car_id",
  138. plate_number : "plate_number",
  139. car_department : "car_department",
  140. car_people : "car_people",
  141. destination : "destination",
  142. out_car_mileage : "out_car_mileage",
  143. motorcade : "motorcade",
  144. out_car_time : "out_car_time",
  145. out_car_reason : "out_car_reason",
  146. checkbox : true
  147. }, o);
  148. $.ligerDialog.open({
  149. url : 'carReturnCarAction.do?task=toReturnCarListOk2&lookup=lookup&checkbox='+o.checkbox,
  150. height : 350,
  151. width : 800,
  152. title : "出车信息(未回车)",
  153. buttons : [{text : '确定',
  154. onclick : function(item, dialog) {
  155. var rows = dialog.frame.f_select();
  156. if(rows.length == 0){
  157. $.ligerDialog.alert('请选择一个出车信息!', '提示', 'warn');
  158. return;
  159. }
  160. if(rows.length > 1){
  161. $.ligerDialog.alert('只能选择一个出车信息!', '提示', 'warn');
  162. return;
  163. }
  164. var universalids = "",plate_number_ids = "", plate_numbers = "" ,car_departments = "" ,car_people_types = "" ,car_peoples = "" ,destinations = "" ,out_car_mileages = "" ,motorcades = "" ,out_car_times = "" ,out_car_reasons = "";
  165. if (rows) {
  166. for ( var i = 0; i < rows.length; i++) {
  167. universalids += ("," + rows[i].universalid);
  168. plate_number_ids += ("," + rows[i].car_id);
  169. plate_numbers += ("," + rows[i].plate_number);
  170. car_departments += ("," + rows[i].car_department_name);
  171. car_peoples += ("," + rows[i].car_people_name);
  172. destinations += ("," + rows[i].destination);
  173. out_car_mileages += ("," + rows[i].out_car_mileage);
  174. motorcades += ("," + rows[i].motorcade);
  175. out_car_times += ("," + rows[i].out_car_time);
  176. out_car_reasons += ("," + rows[i].out_car_reason);
  177. }
  178. universalid = universalids.substring(1, universalids.length);
  179. plate_number_id = plate_number_ids.substring(1, plate_number_ids.length);
  180. plate_number = plate_numbers.substring(1, plate_numbers.length);
  181. car_department = car_departments.substring(1, car_departments.length);
  182. car_people = car_peoples.substring(1, car_peoples.length);
  183. destination = destinations.substring(1, destinations.length);
  184. out_car_mileage = out_car_mileages.substring(1, out_car_mileages.length);
  185. motorcade = motorcades.substring(1, motorcades.length);
  186. out_car_time = out_car_times.substring(1, out_car_times.length);
  187. out_car_reason = out_car_reasons.substring(1, out_car_reasons.length);
  188. }
  189. if ($("#" + o.out_car_id).length > 0){
  190. $("#" + o.out_car_id).val(universalid);
  191. }
  192. if ($("#" + o.plate_number_id).length > 0){
  193. $("#" + o.plate_number_id).val(plate_number_id);
  194. }
  195. if ($("#" + o.plate_number).length > 0){
  196. $("#" + o.plate_number).val(plate_number);
  197. }
  198. if ($("#" + o.car_department).length > 0){
  199. $("#" + o.car_department).val(car_department);
  200. }
  201. if ($("#" + o.car_people).length > 0){
  202. $("#" + o.car_people).val(car_people);
  203. }
  204. if ($("#" + o.destination).length > 0){
  205. $("#" + o.destination).val(destination);
  206. }
  207. if ($("#" + o.out_car_mileage).length > 0){
  208. $("#" + o.out_car_mileage).val(out_car_mileage);
  209. }
  210. if ($("#" + o.motorcade).length > 0){
  211. $("#" + o.motorcade).val(motorcade);
  212. }
  213. if ($("#" + o.out_car_time).length > 0){
  214. $("#" + o.out_car_time).val(out_car_time);
  215. }
  216. if ($("#" + o.out_car_reason).length > 0){
  217. $("#" + o.out_car_reason).val(out_car_reason);
  218. }
  219. dialog.close();
  220. $(".l-dialog-win").remove();
  221. }
  222. }, {
  223. text : '取消',
  224. onclick : function(item, dialog) {
  225. dialog.close();
  226. $(".l-dialog-win").remove();
  227. }} ],
  228. name : "listDialog"
  229. });
  230. }
  231. function mileage(a){
  232. var out_car_mileage = $("#out_car_mileage").val();
  233. var return_mileage = $("#return_mileage").val();
  234. if(!isNaN(return_mileage)) {
  235. if(Number(return_mileage) < Number(out_car_mileage)){
  236. $.ligerDialog.alert('回车里程不能小于出车里程!', '提示', 'warn');
  237. }
  238. if(return_mileage != null){
  239. var journey = Number(return_mileage) - Number(out_car_mileage);
  240. $("#journey").val(journey);
  241. }
  242. }else{
  243. $("#journey").val("");
  244. }
  245. }
  246. function days(a){
  247. var out_car_time= document.getElementById("out_car_time");
  248. var return_time= document.getElementById("return_time");
  249. if(out_car_time.value != "" && typeof (out_car_time.value) != "undefined"){
  250. if(return_time.value != "" && typeof (return_time.value) != "undefined"){
  251. var a = $("#out_car_time").val();
  252. var b = $("#return_time").val();
  253. a = a.replace(" ", "-").replace(":", "-").replace(":", "-");
  254. var arr = a.split("-");
  255. var fisrtTime = Date.UTC(arr[0], (arr[1] - 1), arr[2], arr[3], arr[4], 0);
  256. b = b.replace(" ", "-").replace(":", "-");
  257. var arrs = b.split("-");
  258. var secondTime = Date.UTC(arrs[0], (arrs[1] - 1), arrs[2], arrs[3], arrs[4], 0);
  259. if (fisrtTime >= secondTime) {
  260. $.ligerDialog.alert('回车日期不能小于出车日期!', '提示', 'warn');
  261. $("#return_time").val("");
  262. $("#out_day_number").val("");
  263. return false;
  264. }
  265. fisrtTime = Date.UTC(arr[0], (arr[1] - 1), arr[2]);
  266. secondTime = Date.UTC(arrs[0], (arrs[1] - 1), arrs[2]);
  267. var dif = secondTime - fisrtTime;
  268. var days = dif/ 3600000 / 24;
  269. document.getElementById("out_day_number").value = days;
  270. }
  271. }
  272. }
  273. function closeW(){
  274. var tabIframe = window.parent.document.getElementsByName("${requestScope.tabid}");
  275. tabIframe[0].contentDocument.getElementsByName("content2")[0].contentWindow.closeDialog();
  276. }
  277. function refresh(obj){
  278. if(obj == "1"){
  279. var tabIframe = window.parent.document.getElementsByName("${requestScope.tabid}");
  280. tabIframe[0].contentDocument.getElementsByName("content2")[0].contentWindow.closeDialog();
  281. tabIframe[0].contentDocument.getElementsByName("content2")[0].contentWindow.location.reload();
  282. //window.parent.submitItemName();
  283. //window.parent.obj.close();
  284. }
  285. }
  286. $(document).ready(function() {
  287. $("[name='plate_number']").focus();
  288. refresh('${msgEvent}');
  289. });
  290. </script>
  291. <style type="text/css">
  292. .file-style{
  293. width: 550px;
  294. }
  295. .file-style input[type='file'] {
  296. width:385px ;
  297. height:24px;
  298. line-height:22px;
  299. vertical-align: bottom;
  300. background-color: #fff;
  301. border: 1px solid #cccccc;
  302. margin-top: 2px;
  303. margin-bottom: 2px;
  304. }
  305. </style>
  306. </head>
  307. <body>
  308. <%@ include file="/include/message.jsp"%>
  309. <form action="carReturnCarAction.do" method="post" onsubmit="return checkForm()">
  310. <div id="title" class="form-button">
  311. <input type="submit" class="l-button" value="保存" />
  312. <c:if test="${type == null }">
  313. <input type="button" value="关闭" class="l-button" onclick="closeWindow();" />
  314. </c:if>
  315. <c:if test="${type == '1' }">
  316. <input type="button" value="关闭" class="l-button" onclick="closeW();" />
  317. </c:if>
  318. </div>
  319. <div class="container-layout">
  320. <div class="forum-container">
  321. <center>
  322. <table class="l-table-edit line">
  323. <tr>
  324. <th colspan="4">
  325. 回车登记信息
  326. </th>
  327. </tr>
  328. <tr>
  329. <td class="l-table-edit-text">车牌号<FONT COLOR="red">*</FONT>:</td>
  330. <td class="l-table-edit-td" colspan="3">
  331. <input type="text" id="plate_number" name="plate_number" value="${outCar.plate_number }" onfocus="this.blur()">
  332. <input type="hidden" id="plate_number_id" name="plate_number_id" value="${outCar.car_id }">
  333. <!-- <input type="button" class="l-button" value="选择"
  334. onclick="chooseCustomer({plate_number_id:'plate_number_id',out_car_id:'out_car_id',out_car_time:'out_car_time',plate_number:'plate_number',car_department:'car_department',car_people_type:'car_people_type',car_people:'car_people',destination:'destination',out_car_mileage:'out_car_mileage',motorcade:'motorcade',out_car_reason:'out_car_reason'});" /> -->
  335. </td>
  336. </tr>
  337. <tr>
  338. <td class="l-table-edit-text">回车时间<FONT COLOR="red">*</FONT>:</td>
  339. <td class="l-table-edit-td">
  340. <input type="text" id="return_time" name="return_time" value="" onblur="days(this)">
  341. <input type="hidden" id="return_time" name="return_time" value="">
  342. </td>
  343. <td class="l-table-edit-text">回车里程<FONT COLOR="red">*</FONT>:</td>
  344. <td class="l-table-edit-td">
  345. <input type="text" id="return_mileage" name="return_mileage" value="" onblur="mileage(this)">
  346. </td>
  347. </tr>
  348. <tr>
  349. <tr>
  350. <td class="l-table-edit-text">出车天数<FONT COLOR="red">*</FONT>:</td>
  351. <td class="l-table-edit-td">
  352. <input type="text" id="out_day_number" name="out_day_number" value="" onfocus="this.blur()">
  353. </td>
  354. <td class="l-table-edit-text">本次行程<FONT COLOR="red">*</FONT></td>
  355. <td class="l-table-edit-td">
  356. <input type="text" id="journey" name="journey" value="" onfocus="this.blur()">
  357. </td>
  358. </tr>
  359. <tr>
  360. <td class="l-table-edit-text">停放位置</td>
  361. <td class="l-table-edit-td">
  362. <select id="stop_place" name="stop_place">
  363. <option value="">-选择-</option>
  364. <c:forEach items="${dictionaries }" var="dictionaries">
  365. <option value="${dictionaries.universalid }">${dictionaries.dictionary_name }</option>
  366. </c:forEach>
  367. </select>
  368. </td>
  369. <td class="l-table-edit-text">出车里程:</td>
  370. <td class="l-table-edit-td">
  371. <input type="text" id="out_car_mileage" name="out_car_mileage" value="${outCar.out_car_mileage}" style="border: none;" onfocus="this.blur()">
  372. </td>
  373. </tr>
  374. <tr>
  375. <td class="l-table-edit-text">用车部门:</td>
  376. <td class="l-table-edit-td">
  377. <input type="text" id="car_department" name="car_department" value="${outCar.car_department_name}" style="border: none;" onfocus="this.blur()">
  378. </td>
  379. <td class="l-table-edit-text">用车人:</td>
  380. <td class="l-table-edit-td" width="35%">
  381. <input type="text" id="car_people" name="car_people" value="${outCar.car_people_name}" style="border: none;" onfocus="this.blur()">
  382. </td>
  383. </tr>
  384. <tr>
  385. <td class="l-table-edit-text">出车时间:</td>
  386. <td class="l-table-edit-td">
  387. <input type="text" id="out_car_time" name="out_car_time" value="${out_car_time}" style="border: none;" onfocus="this.blur()">
  388. </td>
  389. <td class="l-table-edit-text">目的地:</td>
  390. <td class="l-table-edit-td">
  391. <input type="text" id="destination" name="destination" value="${outCar.destination}" style="border: none;" onfocus="this.blur()">
  392. </td>
  393. </tr>
  394. </tr>
  395. <tr>
  396. <td class="l-table-edit-text">出车原因:</td>
  397. <td class="l-table-edit-td" colspan="3">
  398. <input type="text" id="out_car_reason" name="out_car_reason" value="${outCar.out_car_reason}" style="border: none;" onfocus="this.blur()">
  399. </td>
  400. </tr>
  401. <tr>
  402. <td class="l-table-edit-text">备注:</td>
  403. <td class="l-table-edit-td" colspan="3">
  404. <input type="text" id="remark" name="remark" value="${outCar.remark}" style="border: none;" onfocus="this.blur()">
  405. <!-- <div style="float: left;">
  406. <textarea id="remark" name="remark" rows="3" cols="60"></textarea>
  407. </div> -->
  408. </td>
  409. </tr>
  410. <tr>
  411. <th colspan="4">
  412. 费用信息
  413. </th>
  414. </tr>
  415. <tr>
  416. <td class="l-table-edit-text">运费收入:</td>
  417. <td class="l-table-edit-td">
  418. <input type="text" id="freight_income" name="freight_income" value="">
  419. </td>
  420. <td class="l-table-edit-text">过路费:</td>
  421. <td class="l-table-edit-td">
  422. <input type="text" id="road_toll" name="road_toll" value="">
  423. </td>
  424. </tr>
  425. <tr>
  426. <td class="l-table-edit-text">洗车费:</td>
  427. <td class="l-table-edit-td">
  428. <input type="text" id="car_washing_fee" name="car_washing_fee" value="">
  429. </td>
  430. <td class="l-table-edit-text">停车费</td>
  431. <td class="l-table-edit-td">
  432. <input type="text" id="parking_fee" name="parking_fee" value="">
  433. </td>
  434. </tr>
  435. <tr>
  436. <td class="l-table-edit-text">加水费:</td>
  437. <td class="l-table-edit-td">
  438. <input type="text" id="water_fee" name="water_fee" value="">
  439. </td>
  440. <td class="l-table-edit-text">其它费用:</td>
  441. <td class="l-table-edit-td">
  442. <input type="text" id="other_fee" name="other_fee" value="">
  443. </td>
  444. </tr>
  445. </table>
  446. <input type="hidden" id="types" name="types" value="${requestScope.type }">
  447. <input type="hidden" id="out_car_id" name="out_car_id" value="${outCar.universalid }">
  448. <input type="hidden" id="task" name="task" value="doAddReturnCar">
  449. <input type="hidden" id="tabid" name="tabid" value="${requestScope.tabid}">
  450. </center>
  451. </div>
  452. </div>
  453. </form>
  454. </body>
  455. </html>