invoice-edit.jsp 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. [#ftl]
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <title>编辑发票信息</title>
  7. <!--框架必需start-->
  8. <script type="text/javascript" src="${ctx}/qui/libs/js/jquery.js"></script>
  9. <script type="text/javascript" src="${ctx}/qui/libs/js/framework.js"></script>
  10. <link href="${ctx}/qui/libs/css/import_basic.css" rel="stylesheet" type="text/css"/>
  11. <link rel="stylesheet" type="text/css" id="skin" prePath="${ctx}/qui/"/>
  12. <link rel="stylesheet" type="text/css" id="customSkin"/>
  13. <!--框架必需end-->
  14. <!-- 表单验证start -->
  15. <link rel="stylesheet" href="${ctx}/qui/libs/js/form/validform/css/style.css" type="text/css" media="all" />
  16. <script src="${ctx}/qui/libs/js/form/validform/validform.js" type="text/javascript"></script>
  17. <!-- 表单验证end -->
  18. <!--表单异步提交start-->
  19. <script src="${ctx}/qui/libs/js/form/form.js" type="text/javascript"></script>
  20. <!--表单异步提交end-->
  21. <!--箭头分页start-->
  22. <script type="text/javascript" src="${ctx}/qui/libs/js/nav/pageArrow.js"></script>
  23. <!--箭头分页end-->
  24. <!-- 日期选择框start -->
  25. <script type="text/javascript"
  26. src="${ctx}/qui/libs/js/form/datePicker/WdatePicker.js"></script>
  27. <!-- 日期选择框end -->
  28. </head>
  29. <body>
  30. <div class="box1" id="formContent" whiteBg="true">
  31. <form id="myFormId" action="${ctx}/invoice/editData.do" method="post" >
  32. <input type="hidden" name="invoiceId" value='${bwp.invoiceId!""}'/>
  33. <input type="hidden" name="invoiceInfo" value='${bwp.invoiceInfo!""}'/>
  34. <table class="tableStyle" formMode="view">
  35. <tr>
  36. <td><span class="star">*</span>发票代码:</td>
  37. <td><input type="text" name="invoiceCode" value='${bwp.invoiceCode!""}' datatype="*" autocomplete="off"/></td>
  38. <td><span class="star">*</span>发票号:</td>
  39. <td><input type="text" name="invoiceNumb" value='${bwp.invoiceNumb!""}' datatype="*" autocomplete="off"/></td>
  40. </tr>
  41. <tr >
  42. <td><span class="star">*</span>发票抬头:</td>
  43. <td colspan="3"><input style="width: 75%" type="text" name="orgName" value='${bwp.orgName!""}' autocomplete="off" datatype="*"/></td>
  44. </tr>
  45. <tr>
  46. <td><span class="star">*</span>纳税人识别号:</td>
  47. <td colspan="3"><input style="width: 75%" type="text" name="taxpayerNumber" value='${bwp.taxpayerNumber!""}' autocomplete="off" datatype="*"/></td>
  48. </tr>
  49. <tr>
  50. <td>总金额:</td>
  51. <td><input type="text" name="totalAmount" value='${bwp.totalAmount!""}' autocomplete="off" /></td>
  52. <td>税额:</td>
  53. <td><input type="text" name="taxAmount" value='${bwp.taxAmount!""}' autocomplete="off" /></td>
  54. </tr>
  55. <tr>
  56. <td>开票时间:</td>
  57. <td><input type="text" class="date" dateFmt="yyyy-MM-dd" id="billingTimeStr" autocomplete="off" name="billingTimeStr" value='${bwp.billingTime!""?string("yyyy-MM-dd")}' /></td>
  58. <td>开票人:</td>
  59. <td><input type="text" name="billingUser" value='${bwp.billingUser!""}' autocomplete="off"/></td>
  60. </tr>
  61. <tr>
  62. <td>发票状态:</td>
  63. <td><select name="state"
  64. data='{"list":[{"value":"1","key":"正常"},{"value":"2","key":"作废"}]}'
  65. selectedValue='${bwp.state!""}'></select>
  66. </td>
  67. <td>备注:</td>
  68. <td ><textarea rows="2" name="remark">${bwp.remark!""}</textarea></td>
  69. </tr>
  70. </table>
  71. <div class="right">
  72. <div class="padding_top5 padding_left10">
  73. <a href="#" onclick="addRow()"><span class="icon_add">添加</span></a>
  74. <div class="box_tool_line"></div>
  75. <a href="#" onclick="delRow()"><span class="icon_delete">删除</span></a>
  76. <div class="box_tool_line"></div>
  77. <a href="#" onclick="save()"><span class="icon_save">保存</span></a>
  78. <div class="box_tool_line"></div>
  79. <a href="#" onclick="top.Dialog.close()"><span class="icon_back">退出</span></a>
  80. <div class="clear"></div>
  81. </div>
  82. </div>
  83. </form>
  84. <table id="invoiceInfoTab" class="tableStyle" useCheckBox="false">
  85. <thead>
  86. <th width="5%"></th>
  87. <th width="25%">名称</th>
  88. <th width="10%">规格</th>
  89. <th width="10%">单位</th>
  90. <th width="10%">数量</th>
  91. <th width="10%">单价</th>
  92. <th width="10%">金额</th>
  93. <th width="10%">税率(%)</th>
  94. <th width="10%">税费</th>
  95. </thead>
  96. <tbody>
  97. [#if bwp.infoList??]
  98. [#assign size=1]
  99. [#list bwp.infoList as bs]
  100. [#if bs??]
  101. <tr>
  102. <td width="5%"><input type='checkbox' name='infoCk'/></td>
  103. <td width="25%"><input type='text' name='name' value='${bs.name!"" }' style='width:95%;'/></td>
  104. <td width="10%"><input type='text' name='specs' value='${bs.specs!"" }' style='width:95%;'/></td>
  105. <td width="10%"><input type='text' name='unit' value='${bs.unit!"" }' style='width:95%;'/></td>
  106. <td width="10%"><input type='number' name='number' value='${bs.number!"" }' style='width:95%;'/></td>
  107. <td width="10%"><input type='number' name='price' value='${bs.price!"" }' style='width:95%;'/></td>
  108. <td width="10%"><input type='number' name='amount' value='${bs.amount!"" }' style='width:95%;'/></td>
  109. <td width="10%"><input type='number' name='taxRate' value='${bs.taxRate!"" }' style='width:95%;'/></td>
  110. <td width="10%"><input type='number' name='taxAmount' value='${bs.taxAmount!"0" }' style='width:95%;'/></td>
  111. </tr>
  112. [/#if]
  113. [#assign size=size+1]
  114. [/#list]
  115. [/#if]
  116. </tbody>
  117. </table>
  118. </div>
  119. <!-- 异步提交start -->
  120. <script type="text/javascript">
  121. function initComplete(){
  122. //表单提交
  123. $("#myFormId").Validform({
  124. tiptype:3,//表示在右边显示
  125. ajaxPost:true,
  126. datatype:{
  127. //小数
  128. "decimal" : /^\d+\.\d+$/
  129. },
  130. showAllError:true,
  131. callback:function(responseText){
  132. $.Hidemsg();
  133. if(responseText.status=="y"){
  134. top.Dialog.alert(responseText.info,function(){
  135. closeWin();
  136. });
  137. }else{
  138. top.Dialog.alert(responseText.info,function(){
  139. return false;
  140. });
  141. }
  142. }
  143. });
  144. }
  145. //重置
  146. function closeWin() {
  147. //刷新数据
  148. top.frmright.resetSearch();
  149. //关闭窗口
  150. top.Dialog.close();
  151. }
  152. var j=1;
  153. //添加行
  154. function addRow(){
  155. //名称
  156. var val0="<td width='5%'><input type='checkbox' name='infoCk' value='"+j+"'/></td>";
  157. var val1="<td width='25%'><input type='text' name='name' value='' style='width:95%;' autocomplete='off' /></td>";
  158. //规格<t</td>"; width="10%"
  159. var val2="<td width='10%'><input type='text' name='specs' value='元/m³' style='width:95%;' autocomplete='off'/></td>";
  160. //单位<t</td>"; width="10%"
  161. var val3="<td width='10%'><input type='text' name='unit' value='m³' style='width:95%;' autocomplete='off'/></td>";
  162. //数量<t</td>"; width="10%"
  163. var val4="<td width='10%'><input type='number' name='number' value='' style='width:95%;' autocomplete='off'/></td>";
  164. //单价<t</td>"; width="10%"
  165. var val5="<td width='10%'><input type='number' name='price' value='' style='width:95%;' autocomplete='off'/></td>";
  166. //金额<t</td>"; width="10%"
  167. var val6="<td width='10%'><input type='number' name='amount' value='' style='width:95%;' autocomplete='off'/></td>";
  168. var val7="<td width='10%'><input type='number' name='taxRate' value='' style='width:95%;' autocomplete='off'/></td>";
  169. var val8="<td width='10%'><input type='number' name='taxAmount' value='' style='width:95%;' autocomplete='off'/></td>";
  170. var $tr=$("<tr>"+val0+val1+val2+val3+val4+val5+val6+val7+val8+"</tr>");
  171. $("#invoiceInfoTab tbody").append($tr);
  172. j++;
  173. //重新渲染表格
  174. $("#invoiceInfoTab").render();
  175. }
  176. //删除行
  177. function delRow(){
  178. var cks=$("input[name='infoCk']:checked");
  179. if(cks.length==0){
  180. top.Dialog.alert('请选择要删除的行!');
  181. return ;
  182. }
  183. for(var i=cks.length-1;i>=0;i--){
  184. //删除表单上的行
  185. $(cks[i]).parent().parent().remove();
  186. }
  187. }
  188. function save() {
  189. //将明细拼接成String
  190. var trDate = $("#invoiceInfoTab tbody ").find("tr");
  191. trDate = Array.from(trDate);
  192. var infoList=[];
  193. trDate.forEach(function (item,index) {
  194. var inputData = $(item).find("input");
  195. inputData = Array.from(inputData);
  196. var data = {};
  197. inputData.forEach(function (value) {
  198. var inputItem = $(value);
  199. if(inputItem.attr("name")!="infoCk"){
  200. if (inputItem.attr("type") =="number") {
  201. data[inputItem.attr("name")] =Number(inputItem.val());
  202. }else{
  203. data[inputItem.attr("name")] = inputItem.val();
  204. }
  205. }
  206. });
  207. infoList.push(data);
  208. })
  209. $("input[name='invoiceInfo']").val(JSON.stringify(infoList));
  210. $("#myFormId").submit();
  211. }
  212. </script>
  213. <!-- 异步提交end -->
  214. </body>
  215. </html>