2026年9月29日 星期二

V60202R- 多張標籤列印(不同內容的標籤) - 每頁含 [內容+標籤]+[分頁]

 目的: V60202R- 多張標籤列印(不同內容)

處理說明: 1>$('#div_print_area').printThis({}); 利用 div_print_area - 包含多張內容來預覽列印
                        $("#div_print_area").printThis({});
                  2>my_div_x: 每頁內容=div_內容+div_分頁
                  3>my_tbl_x: 每頁資料=tbl_內容+tbl_barcode
                  4>my_tbl_x1,my_tbl_x2: tbl_內容, tbl_barcode




1>*.js
 pub_print_area_Str1 = "<div id='div_print_area' style='border: 1px solid black;'>"
                                                   +pub_print_area_Str1
                                  +" </div >  <!--  end of div id='div_print_area' -->";
            $("#div_print_area").remove();
            var Tmp_sub_panel4 = $('#sub_panel4');
            Tmp_sub_panel4.append(pub_print_area_Str1);
       
            var Tmp_prn_div_Str = "#div_print_area";
            //printThis  - 會開啟預覽列印.html  , 原本子畫面.html 已被預覽列印取代, 所以 header  也不同了..
            //所以 printThis(loadCSS:  )   --> 才是 [預覽列印] 視窗 戴入的 *.css
            $(Tmp_prn_div_Str).printThis({                
                loadCSS: "../JsFunction/print_V60202R.css?v=@date", 
            });


var Tmp_PageCnt = CHK_PK_OBJ.PK_LIST.length;

for (var i = 0; i < Tmp_PageCnt; i++)
            {
            Tmp_uni = (i + 1).toString();
            cur_rec = CHK_PK_OBJ.ALL_LIST[i];      

            Tmp_MATNR = nulltoStr(cur_rec['MATNR']).toString();
            Tmp_WH = nulltoStr(cur_rec['WH']).toString();
            Tmp_SP = nulltoStr(cur_rec['SP']).toString();
            Tmp_NAME = nulltoStr(cur_rec['NAME']).toString();
            Tmp_MAKTX = nulltoStr(cur_rec['MAKTX']).toString();
            Tmp_barcode_text = Tmp_MATNR+"&"+Tmp_WH+"&"+Tmp_SP;

        //預覽列印的 HTML 內容        
            pub_print_area_Str1 = pub_print_area_Str1
                    +"<div id = 'my_div_" + Tmp_uni + "' style = 'width:10cm;height:3.8cm;border:1px solid black;font-size:9pt;' > "
                    + "<table id='my_tbl_" + Tmp_uni + "' style='width: 100%;height: 100%;' border=1 bordercolor = 'black' cellspacing = 0 >  "
                + "   <tr>   <!-- 包含 左邊文字內容 + 右邊barcode -->"
                    + "    <td width=70%> <!-- 左邊文字內容  --> "
                    + " <table id='my_tbl_" + Tmp_uni + "1' style='width:100%;height: 100%;' border=1 bordercolor='black' cellspacing=0>   "
                    + " <tr>  "
                    + " <th width=30% style='margin: 0 0 0 0 ;'>件號<br>(Parts No) : </th>  "
                    + " <td width=70%>" + Tmp_MATNR + "</td>  "
                    + " </tr>  "
                    + " <tr>  "
                    + " <th width=30%>名稱<br>(Name) :</th>   "
                    + " <td width=70%>" + Tmp_NAME + "<br>" + Tmp_MAKTX + "</td>  "
                    + "</tr>  "
                    + "<tr> "
                    + "<th width=30%>庫房 :</th> "
                    + "<td width=70 %>" + Tmp_WH + "</td>  "
                    + "</tr>  "
                    + "<tr> "
                    + "<th width=30%>儲位 :</th>  "
                    + "<td width=70 %>" + Tmp_SP + "</td>"
                    + "</tr>  "
                    + "</table>  <!--  end of table id='my_tbl_x1' -->"
                + " </td >   <!-- end of  <td width=70%>   -->"
                    + "<td  width=30%>  "
                    + " <table id='my_tbl_" + Tmp_uni + "2' style='width:100%;height: 100%;' border=1 bordercolor='black' cellspacing=0>  "
                    + "<tr>  "
                    + "<td>  " + genQRcodeStr(Tmp_barcode_text, 90, 90, false) + " </td> "
                    + "</tr> "
                    + " </table>  <!--  end of table id='my_tbl_x2' -->"
                + " </td>   <!-- width= 30# 左邊文字內容  -->"
                + "</tr>   <!-- 包含  左邊文字內容+右邊barcode  -->"
                + " </table>   <!--  end of table id='my_tbl_x' -->"                    
                    + "  <div class='display'  style='break-after:page'>   "
                    + "  </div>   <!--  end of div break-after:page   -->"
                    + "</div>  <!--  <div id = 'my_div_x'   --> ";
            }   // end of for  for (var i = 0; i < Tmp_PageCnt; i++) {


沒有留言:

張貼留言