addone.html 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576
  1. <form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
  2. <div class="form-group">
  3. <label class="control-label col-xs-12 col-sm-2" style="width:8%;!important;">工单号:</label>
  4. <div class="col-xs-12 col-sm-8" style="width:22.23%;!important;">
  5. <input class="form-control " id="order" type="text" value="{$result['gd_gdbh']}" disabled>
  6. </div>
  7. <label class="control-label col-xs-12 col-sm-2" style="width:9%;!important;">产品名称:</label>
  8. <div class="col-xs-12 col-sm-8" style="width:22.23%;!important;">
  9. <input class="form-control " id="product" type="text" value="{$result['成品名称']}" disabled>
  10. </div>
  11. <label class="control-label col-xs-12 col-sm-2" style="width:12%;!important;">订单数量(万张):</label>
  12. <div class="col-xs-12 col-sm-8" style="width:22.23%;!important;">
  13. <input class="form-control " id="number" type="text" value="{$result['订单数量']}" disabled>
  14. </div>
  15. </div>
  16. <div class="form-group">
  17. <label class="control-label col-xs-12 col-sm-2" style="width:9.5%;!important;">配方选择:</label>
  18. <div class="col-xs-12 col-sm-8" style="width:22.23%;!important;">
  19. {foreach name="formulaData" item="vo"}
  20. <label style="margin-top: 2px;"><input type="radio" name="formula" value="{$vo}" class="color"/>{$vo}</label>
  21. {/foreach}
  22. </div>
  23. <div>
  24. <label class="radio-inline">
  25. <input type="radio" name="box" id="small" value="2" checked>
  26. <label for="small">小盒</label>
  27. </label>
  28. <label class="radio-inline">
  29. <input type="radio" name="box" id="big" value="1">
  30. <label for="big">大盒</label>
  31. </label>
  32. </div>
  33. </div>
  34. <div class="form-group">
  35. <label class="control-label col-xs-12 col-sm-2" style="width:15%;!important;">本次配置大盒数量:</label>
  36. <div class="col-xs-12 col-sm-8" style="width:20%;!important;">
  37. <input class="form-control bigBox" id="bigBox" name="" type="text" value="" data-rule="number" readonly>
  38. </div>
  39. <label class="control-label col-xs-12 col-sm-2" style="width:15%;!important;">本次配置小盒数量:</label>
  40. <div class="col-xs-12 col-sm-8" style="width:20%;!important;">
  41. <input class="form-control smallBox" id="smallBox" name="" type="text" value="" data-rule="number" readonly>
  42. </div>
  43. </div>
  44. <div class="form-group" >
  45. <div class="control-label col-xs-12 col-sm-2" style="width:50%;!important;">
  46. <div id="formula" style="margin-left:15px;">
  47. </div>
  48. </div>
  49. <div class="control-label col-xs-12 col-sm-2" style="width:50%;!important;">
  50. <div id="consume" >
  51. </div>
  52. </div>
  53. </div>
  54. <div id="print" style="display: none;">
  55. <div id="print_area">
  56. <div id="qrcode" style="margin-left: 80px;">
  57. <img src="" id="myImage" alt=""/>
  58. </div>
  59. <div id="time" style="margin-left: 450px;margin-top: -25px;"></div>
  60. <div style="height: 2px;"></div>
  61. <div id="print_base">
  62. <table border="1" cellspacing="0" style="text-align: center;width: 550px;margin-left: 80px;">
  63. <tr>
  64. <td colspan="7" id="print_input_formula"></td>
  65. </tr>
  66. <tr>
  67. <td style="width: 135px;">生产批次号</td>
  68. <td colspan="2" id="print_input_order" style="width: 100px;"></td>
  69. <td style="width: 100px;">数量</td>
  70. <td id="print_input_big" style="width: 100px;"></td>
  71. <td id="print_input_small" style="width: 100px;"></td>
  72. </tr>
  73. </table>
  74. <div style="height: 1px;"></div>
  75. <div id="print_formula" style="margin-left: 80px;">
  76. </div>
  77. <div style="height: 1px;"></div>
  78. <div id="print_consume" style="margin-left: 80px;">
  79. </div>
  80. </div>
  81. </div>
  82. </div>
  83. <div class="form-group layer-footer">
  84. <label class="control-label col-xs-12 col-sm-2"></label>
  85. <div class="col-xs-12 col-sm-8" style="margin-left:100px;">
  86. <button class="btn btn-default btn-embossed print-link">打印</button>
  87. <button class="btn btn-success btn-embossed print">保存</button>
  88. </div>
  89. </div>
  90. </form>
  91. <!--<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.js"></script>-->
  92. <script src="__CDN__/assets/js/jquery.js"></script>
  93. <script>
  94. var num = 1;
  95. //获取专色墨配方
  96. $('.color').click(function () {
  97. var formula = $('input[name="formula"]:checked').val();
  98. var order = $('#order').val();
  99. $.ajax({
  100. type: "POST",
  101. url: "{:url('admin/Order/getFormula')}",
  102. data: {formula: formula,order:order},
  103. dataType: "json",
  104. success: function (data) {
  105. if (data.status == 1) {
  106. //各专色计划消耗数据
  107. //配方数据
  108. var str = '<table border="1" cellspacing="0" style="text-align: center;width: 550px;">';
  109. str += '<tbody>';
  110. $.each(data.data,function (key,value) {
  111. str += '<tr>';
  112. var rowspan = -1;
  113. $.each(data.colorNumber,function (k,v) {
  114. if (key == v.beginRow){
  115. rowspan = v.rowSpan;
  116. }
  117. })
  118. if (rowspan != -1){
  119. str += '<td rowspan="'+rowspan+'" style="width: 100px;">'+value.color+'</td>';
  120. str += '<td style="width: 120px;">'+value.ink+'</td>';
  121. str += '<td style="width: 60px;">'+value.ink_number+'</td>';
  122. str += '<td style="width: 100px;"></td>';
  123. str += '<td rowspan="'+rowspan+'" style="width: 100px;"><p class="editWeight" contenteditable="true" style="width: 100px;" data-num="" data-value=""> '+value.number+'</p></td>';
  124. str += '<td style="width: 80px;">'+value.total+'</td>';
  125. }else {
  126. str += '<td style="width: 120px;">'+value.ink+'</td>';
  127. str += '<td style="width: 60px;">'+value.ink_number+'</td>';
  128. str += '<td style="width: 100px;"></td>';
  129. str += '<td style="width: 80px;">'+value.total+'</td>';
  130. }
  131. str += '</tr>';
  132. })
  133. str += '</tbody>';
  134. str += '</table>';
  135. $('#formula').empty();
  136. $('#formula').append(str);
  137. var htm = '<table id="print_table" border="1" cellspacing="0" style="text-align: center;width: 550px;">';
  138. htm += '<tbody>';
  139. $.each(data.data,function (key,value) {
  140. htm += '<tr>';
  141. var rowspan = -1;
  142. $.each(data.colorNumber,function (k,v) {
  143. if (key == v.beginRow){
  144. rowspan = v.rowSpan;
  145. }
  146. })
  147. if (rowspan != -1){
  148. htm += '<td rowspan="'+rowspan+'" style="width: 100px;">'+value.color+'</td>';
  149. htm += '<td style="width: 120px;">'+value.ink+'</td>';
  150. htm += '<td style="width: 60px;">'+value.ink_number+'</td>';
  151. htm += '<td style="width: 100px;"></td>';
  152. htm += '<td rowspan="'+rowspan+'" style="width: 100px;">'+value.number+'</td>';
  153. htm += '<td style="width: 80px;">'+value.total+'</td>';
  154. }else {
  155. htm += '<td style="width: 120px;">'+value.ink+'</td>';
  156. htm += '<td style="width: 60px;">'+value.ink_number+'</td>';
  157. htm += '<td style="width: 100px;"></td>';
  158. htm += '<td style="width: 80px;">'+value.total+'</td>';
  159. }
  160. htm += '</tr>';
  161. })
  162. htm += '</tbody>';
  163. htm += '</table>';
  164. $('#print_formula').empty();
  165. $('#print_formula').append(htm);
  166. getConsume(formula,0,0,0);
  167. }else {
  168. alert(data.msg)
  169. }
  170. }
  171. })
  172. })
  173. //获取大小盒计划消耗,formula->配方名称,number->数量(万张),boxModel->盒型(1.大盒,2.小盒)
  174. function getConsume(formula,bigNumber,smallNumber,boxModel){
  175. if (bigNumber == 0 && smallNumber == 0){
  176. $.ajax({
  177. type: "POST",
  178. url: "{:url('admin/Order/getConsume')}",
  179. data: {formula: formula,bigNumber:bigNumber,smallNumber:smallNumber,boxModel:boxModel},
  180. dataType: "json",
  181. success: function (data) {
  182. if (data.status == 1) {
  183. var str = '<table border="1" cellspacing="0" style="text-align: center;width: 550px;">';
  184. str += '<tbody class="consume">';
  185. $.each(data.data,function (key,value) {
  186. str += '<tr>';
  187. if (key == 0){
  188. str += '<td rowspan="'+data.rowSpan+'" style="width: 100px;">大盒计划消耗</td>';
  189. str += '<td style="width: 100px;">'+value.big_ink+'</td>';
  190. str += '<td style="width: 60px;">'+value.big_num+'</td>';
  191. str += '<td rowspan="'+data.rowSpan+'" style="width: 100px;">小盒计划消耗</td>';
  192. str += '<td style="width: 100px;">'+value.small_ink+'</td>';
  193. str += '<td style="width: 60px;">'+value.small_num+'</td>';
  194. }else{
  195. str += '<td style="width: 100px;">'+value.big_ink+'</td>';
  196. str += '<td style="width: 60px;">'+value.big_num+'</td>';
  197. str += '<td style="width: 100px;">'+value.small_ink+'</td>';
  198. str += '<td style="width: 60px;">'+value.small_num+'</td>';
  199. }
  200. str += '</tr>';
  201. })
  202. str += '</tbody>';
  203. str += '</table>';
  204. $('#consume').empty();
  205. $('#print_consume').empty();
  206. $('#consume').append(str);
  207. $('#print_consume').append(str);
  208. }
  209. }
  210. })
  211. }
  212. // else{
  213. // $.ajax({
  214. // type: "POST",
  215. // url: "{:url('admin/Order/getConsume')}",
  216. // data: {formula: formula,bigNumber:bigNumber,smallNumber:smallNumber,boxModel:boxModel},
  217. // dataType: "json",
  218. // success: function (data) {
  219. // if (data.status == 1) {
  220. // var str = '<table border="1" cellspacing="0" style="text-align: center;width: 550px;">';
  221. // str += '<tbody class="consume">';
  222. // $.each(data.data,function (key,value) {
  223. // str += '<tr>';
  224. // if (key == 0){
  225. // str += '<td rowspan="'+data.rowSpan+'" style="width: 100px;">大盒计划消耗</td>';
  226. // str += '<td style="width: 60px;">'+value.big_ink+'</td>';
  227. // str += '<td style="width: 60px;">'+value.big_num+'</td>';
  228. // str += '<td rowspan="'+data.rowSpan+'" style="width: 100px;">小盒计划消耗</td>';
  229. // str += '<td style="width: 60px;">'+value.small_ink+'</td>';
  230. // str += '<td style="width: 60px;">'+value.small_num+'</td>';
  231. // }else{
  232. // str += '<td style="width: 60px;">'+value.big_ink+'</td>';
  233. // str += '<td style="width: 60px;">'+value.big_num+'</td>';
  234. // str += '<td style="width: 60px;">'+value.small_ink+'</td>';
  235. // str += '<td style="width: 60px;">'+value.small_num+'</td>';
  236. // }
  237. // str += '</tr>';
  238. // })
  239. // str += '</tbody>';
  240. // str += '</table>';
  241. // $('#consume').empty();
  242. // $('#consume').append(str);
  243. // $('#print_consume').empty();
  244. // $('#print_consume').append(str);
  245. // var html = '<table border="1" cellspacing="0" style="text-align: center;width: 550px;">';
  246. // html += '<tbody>';
  247. // $.each(data.formulaData,function (k1,val) {
  248. // html += '<tr>';
  249. // var rowspan = -1;
  250. // $.each(data.colorNumber,function (k,v) {
  251. // if (k1 == v.beginRow){
  252. // rowspan = v.rowSpan;
  253. // }
  254. // })
  255. // if (rowspan != -1){
  256. // html += '<td rowspan="'+rowspan+'" style="width: 100px;">'+val.color+'</td>';
  257. // html += '<td style="width: 100px;">'+val.ink+'</td>';
  258. // html += '<td style="width: 60px;">'+val.ink_number+'</td>';
  259. // html += '<td style="width: 50px;"></td>';
  260. // html += '<td rowspan="'+rowspan+'" style="width: 50px;">'+val.number+'</td>';
  261. // html += '<td style="width: 60px;">'+val.total+'</td>';
  262. // }else {
  263. // html += '<td style="width: 100px;">'+val.ink+'</td>';
  264. // html += '<td style="width: 60px;">'+val.ink_number+'</td>';
  265. // html += '<td style="width: 50px;"></td>';
  266. // html += '<td style="width: 60px;">'+val.total+'</td>';
  267. // }
  268. // html += '</tr>';
  269. // })
  270. // html += '</tbody>';
  271. // html += '</table>';
  272. // $('#formula').empty();
  273. // $('#formula').append(html);
  274. // $('#print_formula').empty();
  275. // $('#print_formula').append(html);
  276. // }
  277. // }
  278. // })
  279. // }
  280. }
  281. $(document).on('blur','.editWeight',function (){
  282. var formula = $("input[name='formula']:checked").val();
  283. var box = $("input[name='box']:checked").val();
  284. var color = $(this).parent().prev().prev().prev().prev().text();
  285. var weight = $(this).text();
  286. if (formula == '' || formula == 'undefined'){
  287. confirm('配方不能为空');return false;
  288. }
  289. if (box == '' || box == 'undefined'){
  290. confirm('请选择大小盒');return false;
  291. }
  292. if (color == '' || color == 'undefined'){
  293. confirm('未获取到配方颜色');return false;
  294. }
  295. //修改配方总数
  296. var rowspan = $(this).parent().prev().prev().prev().prev().attr('rowspan');
  297. //次数,第几次修改次重量
  298. var getNum = $(this).attr('data-num');
  299. //修改后的值是多少
  300. var getValue = $(this).attr('data-value');
  301. if (getNum == '' || getValue == ''){
  302. var code = 1;
  303. }else{
  304. var code = Number(getNum) + 1;
  305. }
  306. $(this).attr('data-num',code);
  307. $(this).attr('data-value',Number(weight));
  308. // console.log(code)
  309. for (var i=0;i<rowspan;i++){
  310. if (i == 0){
  311. var totalText = $(this).parent().next()[0];
  312. var total = $(this).parent().next().text();
  313. if (code > 1){
  314. total = Math.trunc(total/getValue*5);
  315. }
  316. // console.log(totalText)
  317. totalText.innerText = Math.trunc(Number(weight)/5*total);
  318. }
  319. if (i == 1){
  320. var totalText = $(this).parent().parent().next().children().eq(3)[0];
  321. var total = $(this).parent().parent().next().children().eq(3).text();
  322. if (code > 1){
  323. total = Math.trunc(total/getValue*5);
  324. }
  325. totalText.innerText = Math.trunc(Number(weight)/5*total);
  326. }
  327. if (i == 2){
  328. var totalText = $(this).parent().parent().next().next().children().eq(3)[0];
  329. var total = $(this).parent().parent().next().next().children().eq(3).text();
  330. if (code > 1){
  331. total = Math.trunc(total/getValue*5);
  332. }
  333. totalText.innerText = Math.trunc(Number(weight)/5*total);
  334. }
  335. if (i == 3){
  336. var totalText = $(this).parent().parent().next().next().next().children().eq(3)[0];
  337. var total = $(this).parent().parent().next().next().next().children().eq(3).text();
  338. if (code > 1){
  339. total = Math.trunc(total/getValue*5);
  340. }
  341. totalText.innerText = Math.trunc(Number(weight)/5*total);
  342. }
  343. if (i == 4){
  344. var totalText = $(this).parent().parent().next().next().next().next().children().eq(3)[0];
  345. var total = $(this).parent().parent().next().next().next().next().children().eq(3).text();
  346. if (code > 1){
  347. total = Math.trunc(total/getValue*5);
  348. }
  349. totalText.innerText = Math.trunc(Number(weight)/5*total);
  350. }
  351. if (i == 5){
  352. var totalText = $(this).parent().parent().next().next().next().next().next().children().eq(3)[0];
  353. var total = $(this).parent().parent().next().next().next().next().next().children().eq(3).text();
  354. if (code > 1){
  355. total = Math.trunc(total/getValue*5);
  356. }
  357. totalText.innerText = Math.trunc(Number(weight)/5*total);
  358. }
  359. }
  360. $('#print_table').find('tr').each(function (){
  361. var tdArr = $(this).children();
  362. // console.log(tdArr)
  363. //第一行第一列的专色墨
  364. var printColor = tdArr.eq(0).text();
  365. //改变打印的重量//如果点击专色墨和循环的专色墨相同,修改其油墨总数
  366. if (color == printColor){
  367. var text = $(this).children().eq(4)[0];
  368. //修改需要调配的专墨重量
  369. text.innerText = weight;
  370. var printRow = tdArr.eq(0).attr('rowspan');
  371. // console.log(tdArr)
  372. for (var i=0;i<printRow;i++){
  373. if (i == 0){
  374. var totalTextPrint =$(this).children().eq(5)[0];
  375. var totalPrint = $(this).children().eq(5).text();
  376. if (code > 1){
  377. totalPrint = Math.trunc(totalPrint/getValue*5);
  378. }
  379. totalTextPrint.innerText = Math.trunc(Number(weight)/5*totalPrint);
  380. }
  381. if (i == 1){
  382. var totalTextPrint =$(this).next().children().eq(3)[0];
  383. var totalPrint = $(this).next().children().eq(3).text();
  384. if (code > 1){
  385. totalPrint = Math.trunc(totalPrint/getValue*5);
  386. }
  387. totalTextPrint.innerText = Math.trunc(Number(weight)/5*totalPrint);
  388. }
  389. if (i == 2){
  390. var totalTextPrint =$(this).next().next().children().eq(3)[0];
  391. var totalPrint = $(this).next().next().children().eq(3).text();
  392. if (code > 1){
  393. totalPrint = Math.trunc(totalPrint/getValue*5);
  394. }
  395. totalTextPrint.innerText = Math.trunc(Number(weight)/5*totalPrint);
  396. }
  397. if (i == 3){
  398. var totalTextPrint =$(this).next().next().next().children().eq(3)[0];
  399. var totalPrint = $(this).next().next().next().children().eq(3).text();
  400. if (code > 1){
  401. totalPrint = Math.trunc(totalPrint/getValue*5);
  402. }
  403. totalTextPrint.innerText = Math.trunc(Number(weight)/5*totalPrint);
  404. }
  405. if (i == 4){
  406. var totalTextPrint =$(this).next().next().next().next().children().eq(3)[0];
  407. var totalPrint = $(this).next().next().next().next().children().eq(3).text();
  408. if (code > 1){
  409. totalPrint = Math.trunc(totalPrint/getValue*5);
  410. }
  411. totalTextPrint.innerText = Math.trunc(Number(weight)/5*totalPrint);
  412. }
  413. if (i == 5){
  414. var totalTextPrint =$(this).next().next().next().next().next().children().eq(3)[0];
  415. var totalPrint = $(this).next().next().next().next().next().children().eq(3).text();
  416. if (code > 1){
  417. totalPrint = Math.trunc(totalPrint/getValue*5);
  418. }
  419. totalTextPrint.innerText = Math.trunc(Number(weight)/5*totalPrint);
  420. }
  421. }
  422. }
  423. })
  424. $.ajax({
  425. type: "POST",
  426. url: "{:url('admin/Order/sumPaper')}",
  427. data: {formula_name:formula,box:box,ink:color,weight:weight},
  428. dataType: "json",
  429. success: function (data) {
  430. if (data.status == 1){
  431. if (box == 1){
  432. $('#smallBox').val('');
  433. $('#bigBox').val(data.data);
  434. // getConsume(formula,0,1,1);
  435. }else{
  436. $('#bigBox').val('');
  437. $('#smallBox').val(data.data);
  438. // getConsume(formula,0,1,2);
  439. }
  440. }else{
  441. confirm(data.msg);
  442. }
  443. }
  444. })
  445. })
  446. // $('.bigBox').blur(function () {
  447. // var bigNumber = $(this).val();
  448. // var formula = $('input[name="formula"]:checked').val();
  449. // var smallNumber = $('.smallBox').val();
  450. // console.log(smallNumber)
  451. // if (formula != '') {
  452. // if (smallNumber == ''){
  453. // getConsume(formula,bigNumber,0,1);
  454. // }else{
  455. // getConsume(formula,bigNumber,smallNumber,0);
  456. // }
  457. // }
  458. //
  459. // })
  460. // $('.smallBox').blur(function () {
  461. // var smallNumber = $(this).val();
  462. // // var formula = $(".color").val();
  463. // var formula = $('input[name="formula"]:checked').val();
  464. // var bigNumber = $('.bigBox').val();
  465. // console.log(bigNumber)
  466. // if (formula != '') {
  467. // if (bigNumber == ''){
  468. // getConsume(formula,0,smallNumber,2);
  469. // }else {
  470. // getConsume(formula,bigNumber,smallNumber,0);
  471. // }
  472. // }
  473. // })
  474. </script>
  475. <!--<script type='text/javascript' src='http://cdn.staticfile.org/jquery/2.1.1/jquery.min.js'></script>-->
  476. <script type='text/javascript' src='__CDN__/assets/js/jquery2.1.1.min.js'></script>
  477. <!--<script type="text/javascript" src="http://cdn.staticfile.org/jquery.qrcode/1.0/jquery.qrcode.min.js"></script>-->
  478. <script type="text/javascript" src="__CDN__/assets/js/jquery.qrcode.min.js"></script>
  479. <script type="text/javascript" src="__CDN__/assets/js/jQuery.print.js"></script>
  480. <script >
  481. jQuery(function($) { 'use strict';
  482. var order = $('#order').val();
  483. $.ajax({
  484. type: "POST",
  485. url: "{:url('admin/Order/getBach')}",
  486. data: {order: order},
  487. dataType: "json",
  488. success: function (data) {
  489. if(data.status == 1){
  490. createQrcode(data.bach,100,100);
  491. }
  492. }
  493. });
  494. $(".print-link").on('click', function() {
  495. var formula = $('input[name="formula"]:checked').val();
  496. var bigBoxNumber = $('#bigBox').val();
  497. var smallBoxNumber = $('#smallBox').val();
  498. if (order == '' || formula == ''){
  499. return false;
  500. }
  501. if (bigBoxNumber == '' && smallBoxNumber == ''){
  502. return false;
  503. }
  504. var mydate = new Date();
  505. var year = mydate.getFullYear();
  506. var mouth = mydate.getMonth() + 1;
  507. if (parseInt(mouth)<10){
  508. mouth = '0'+mouth;
  509. }
  510. var date = mydate.getDate();
  511. if (parseInt(date)<10){
  512. date = '0'+date;
  513. }
  514. var hours = mydate.getHours();
  515. if (parseInt(hours)<10){
  516. hours = '0'+hours;
  517. }
  518. var minutes = mydate.getMinutes();
  519. if (parseInt(minutes)<10){
  520. minutes = '0'+minutes;
  521. }
  522. var seconds = mydate.getSeconds();
  523. if (parseInt(seconds)<10){
  524. seconds = '0'+seconds;
  525. }
  526. var now_time = year+'-'+mouth+'-'+date+' '+hours+':'+minutes+':'+seconds;
  527. var img = document.getElementById("myImage"); /// get image element
  528. var canvas = document.getElementsByTagName('canvas')[0];
  529. img.src = canvas.toDataURL(); /// update image
  530. $('#time').html(now_time);
  531. $('#print_input_formula').html(formula);
  532. $('#print_input_order').html(order);
  533. $('#print_input_big').html(bigBoxNumber);
  534. $('#print_input_small').html(smallBoxNumber);
  535. $.print("#print_area");
  536. return false;
  537. });
  538. function createQrcode(txt,width,height) {
  539. $("#qrcode").qrcode({
  540. render: "canvas",//canvas和table两种渲染方式
  541. width: width,
  542. height: height,
  543. correctLevel:2,//二维码纠错级别
  544. background:"#ffffff",//背景颜色
  545. foreground:"#000000", //二维码颜色
  546. text:txt
  547. });
  548. }
  549. });
  550. </script>