From 4420517bbbffea48cabe7a7dcdf2e1c4b440fc85 Mon Sep 17 00:00:00 2001
From: GWY <guweiyi@prec-tech.com>
Date: 星期一, 30 五月 2022 16:15:26 +0800
Subject: [PATCH] 两个LS特殊条件在说明的增减
---
force-app/main/default/pages/OrderPdf2.page | 182 ++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 171 insertions(+), 11 deletions(-)
diff --git a/force-app/main/default/pages/OrderPdf2.page b/force-app/main/default/pages/OrderPdf2.page
index 9737a5a..8345a38 100644
--- a/force-app/main/default/pages/OrderPdf2.page
+++ b/force-app/main/default/pages/OrderPdf2.page
@@ -1,4 +1,4 @@
-<apex:page Controller="OrderPdf2Controller" showHeader="false" sidebar="false" id="allPage" action="{!init}" renderAs="pdf" > <!-- renderAs="pdf" -->
+<apex:page Controller="OrderPdf2Controller" showHeader="false" sidebar="false" id="allPage" action="{!init}" > <!-- renderAs="pdf" -->
<head>
<style>
@page {
@@ -15,9 +15,30 @@
td.border-thick-title { border-width: 1pt 0pt 1pt 0pt; border-style: solid; border-color: black; text-align: center;}
td.border-thick-bottom { border-width: 0pt 0pt 1pt 0pt; border-style: solid; border-color: black; text-align: center;}
td.detail { text-align: center; }
+ /* 20220221 PI鏀归�� by 寰愪寒 start */
+ body{margin: 0 auto;
+ width: 780px;}
+ #title1{height: 30px;}
+ #title2{height: 110px;}
+ /* 20220221 PI鏀归�� by 寰愪寒 end */
+
</style>
+ <!-- 20220221 PI鏀归�� by 寰愪寒 start -->
+ <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" />
+ <script src="../../soap/ajax/53.0/connection.js" type="text/javascript"></script>
+ <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
+ <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
+ <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
+
+ <apex:includeScript value="{!URLFOR($Resource.jspdf)}"/>
+ <apex:includeScript value="{!URLFOR($Resource.html2canvas)}"/>
+
+
+ <!-- 20220221 PI鏀归�� by 寰愪寒 end -->
</head>
-<body style="font-family: Arial Unicode MS; page-break-inside: auto; font-size: 8pt;">
+<body style="font-family: Arial Unicode MS; page-break-inside: auto; font-size: 8pt;line-height: 16pt;">
+ <div id="pdf-wrapper">
+ <div id="title1"></div>
<table border="0" width="100%">
<tr>
<td style="text-align: center; font-size: 16pt;">瀹岀◣璁㈣揣鍗�</td>
@@ -45,7 +66,17 @@
</apex:outputPanel>
</tr>
- <apex:outputPanel rendered="{!IF(productSegment == 'BS', true, false)}" layout="none">
+ <apex:outputPanel rendered="{!IF(productSegment == 'BS' && delivered == false, true, false)}" layout="none">
+ <tr>
+ <td style="text-align: right;" >浜岀被缁忚惀澶囨鍑瘉锛�</td>
+ <td style="text-align: left;">{!header.buyer_code}</td>
+ <td style="text-align: right;"> </td>
+ <td style="text-align: left;"> </td>
+ <!-- <td style="text-align: right;">浜岀被缁忚惀澶囨鍑瘉锛�</td>
+ <td style="text-align: left;">娌緪椋熻嵂鐩戞缁忚惀澶�20160318鍙�</td> -->
+ </tr>
+ </apex:outputPanel>
+ <apex:outputPanel rendered="{!IF(productSegment == 'BS' && delivered, true, false)}" layout="none">
<tr>
<td style="text-align: right;" >浜岀被缁忚惀澶囨鍑瘉锛�</td>
<td style="text-align: left;">{!header.buyer_code}</td>
@@ -141,7 +172,7 @@
</tr>
<tr>
<td style="text-align: right;">鑱旂郴鍦板潃锛�</td>
- <td style="text-align: left;" colspan="5">{!header.delivery_address}</td>
+ <td style="text-align: left;" colspan="5" id="delivery_address">{!header.delivery_address}</td>
</tr>
<tr>
<td style="text-align: right;">鍩庡競锛�</td>
@@ -151,11 +182,11 @@
</tr>
<tr>
<td style="text-align: right;">鏀惰揣浜哄鍚嶏細</td>
- <td style="text-align: left;">{!header.delivery_user}</td>
+ <td style="text-align: left;" id="delivery_user">{!header.delivery_user}</td>
<td style="text-align: right;">鍥鸿瘽锛�</td>
- <td style="text-align: left;">{!header.delivery_phone}</td>
+ <td style="text-align: left;" id="delivery_phone">{!header.delivery_phone}</td>
<td style="text-align: right;">鎵嬫満锛�</td>
- <td style="text-align: left;">{!header.delivery_tel}</td>
+ <td style="text-align: left;" id="delivery_tel">{!header.delivery_tel}</td>
</tr>
</table>
<table style="border:solid 1px black" width="100%">
@@ -183,7 +214,7 @@
</tr>
<tr>
<td style="text-align: right;">鑱旂郴鍦板潃锛�</td>
- <td style="text-align: left;" colspan="5">{!header.user_address}</td>
+ <td style="text-align: left;" colspan="5" id="user_address">{!header.user_address}</td>
</tr>
<tr>
<td style="text-align: right;">鍩庡競锛�</td>
@@ -193,11 +224,11 @@
</tr>
<tr>
<td style="text-align: right;">鐢ㄦ埛濮撳悕锛�</td>
- <td style="text-align: left;">{!header.user_name2}</td>
+ <td style="text-align: left;" id="user_name2">{!header.user_name2}</td>
<td style="text-align: right;">鍥鸿瘽锛�</td>
- <td style="text-align: left;">{!header.user_phone}</td>
+ <td style="text-align: left;" id="user_phone">{!header.user_phone}</td>
<td style="text-align: right;">鎵嬫満锛�</td>
- <td style="text-align: left;">{!header.user_tel}</td>
+ <td style="text-align: left;" id="user_tel">{!header.user_tel}</td>
</tr>
<apex:outputPanel layout="none" rendered="{!IF(productSegment == 'IE', true, false)}">
<tr>
@@ -523,5 +554,134 @@
<td style="text-align: left;"> </td>
</tr> -->
</table>
+</div>
</body>
+<!-- 20220221 PI鏀归�� by 寰愪寒 start -->
+<script>
+ AWSService.sfSessionId = '{!GETSESSIONID()}';
+ var staticResources = JSON.parse('{!staticResource}');
+
+ function Fun(pdf){
+ var iframe = document.createElement('iframe');
+ iframe.setAttribute('style', 'position:absolute;right:0; top:0; bottom:0; height:100%; width:100%');
+ document.body.appendChild(iframe);
+ iframe.src = pdf.output('datauristring');
+ for(let e of document.body.childNodes){
+ if( e != iframe && e.style){
+ e.style.display = 'none';
+ }
+ }
+ }
+
+ let id = "pdf-wrapper";
+ var target = document.getElementById(id);
+ function jsPdfDownload(){
+ let pdfName = "娴嬭瘯";
+ let id = "pdf-wrapper";
+ var target = document.getElementById(id);
+ target.style.background = "#FFFFFF";
+ if(pdfName==''||pdfName==undefined) pdfName= getNowFormatDate();
+
+ html2canvas(target, {
+ scale: 2,
+ onrendered:function(canvas) {
+ let landscape = false;
+ let pw = 595.28;
+ let ph = 841.89;
+ const marginw = 40;
+
+ let orientation = '';
+ if (landscape) {
+ let temp =ph;
+ ph = pw;
+ pw = temp;
+ orientation = 'l';
+ }
+
+
+ var contentWidth = canvas.width;
+ var contentHeight = canvas.height;
+
+ //涓�椤祊df鏄剧ずhtml椤甸潰鐢熸垚鐨刢anvas楂樺害;
+ var pageHeight = contentWidth / pw * ph;
+ //鏈敓鎴恜df鐨刪tml椤甸潰楂樺害
+ var leftHeight = contentHeight;
+ //椤甸潰鍋忕Щ
+ var position = 0;
+ //a4绾哥殑灏哄[595.28,841.89]锛宧tml椤甸潰鐢熸垚鐨刢anvas鍦╬df涓浘鐗囩殑瀹介珮
+ var imgWidth = pw-2*marginw;//595.28//宸﹀彸杈硅窛20
+ var imgHeight = imgWidth/contentWidth * contentHeight;//宸﹀彸杈硅窛20
+
+ var pageData = canvas.toDataURL('image/jpeg', 1.0);
+
+ var pdf = new jsPDF(orientation, 'pt', 'a4');// 绗竴涓弬鏁板~瀛楁瘝l锛屾敞鎰忎笉鏄暟瀛�1锛屼负妯悜pdf
+
+ //鏈変袱涓珮搴﹂渶瑕佸尯鍒嗭紝涓�涓槸html椤甸潰鐨勫疄闄呴珮搴︼紝鍜岀敓鎴恜df鐨勯〉闈㈤珮搴�(841.89)
+ //褰撳唴瀹规湭瓒呰繃pdf涓�椤垫樉绀虹殑鑼冨洿锛屾棤闇�鍒嗛〉
+ if (leftHeight < pageHeight) {
+ pdf.addImage(pageData, 'JPEG', marginw, 0, imgWidth, imgHeight );//宸﹀彸杈硅窛20
+ } else {
+ while(leftHeight > 0) {
+ pdf.addImage(pageData, 'JPEG', marginw, position, imgWidth, imgHeight)//宸﹀彸杈硅窛20
+ leftHeight -= pageHeight;
+ position -= ph;
+ //閬垮厤娣诲姞绌虹櫧椤�
+ if(leftHeight > 0) {
+ pdf.addPage();
+ }
+ }
+ }
+ Fun(pdf);
+ }
+ })
+ }
+
+ //blockme();
+ document.body.onload = function(){
+ let dataIds = [];
+
+ if('{!header.delivery_aws_data_id}')dataIds.push('{!header.delivery_aws_data_id}');
+ if('{!header.user_aws_data_id}')dataIds.push('{!header.user_aws_data_id}');
+
+ AWSService.post(staticResources.searchUrl, JSON.stringify({
+ dataIds:dataIds
+ }), function(data){
+
+ //unblockUI();
+ if(data && data.object && data.object.length){
+ for (const obj of data.object) {
+ if (obj.dataId == '{!header.delivery_aws_data_id}') {
+ document.getElementById("delivery_address").innerHTML = obj.address1;
+ document.getElementById("delivery_user").innerHTML = obj.lastName;
+ document.getElementById("delivery_phone").innerHTML = obj.phone;
+ document.getElementById("delivery_tel").innerHTML = obj.mobilePhone;
+ }
+
+ if (obj.dataId == '{!header.user_aws_data_id}') {
+ document.getElementById("user_address").innerHTML = obj.address1;
+ document.getElementById("user_name2").innerHTML = obj.lastName;
+ document.getElementById("user_phone").innerHTML = obj.phone;
+ document.getElementById("user_tel").innerHTML = obj.mobilePhone;
+ }
+ }
+
+
+ setTimeout(() => {
+ jsPdfDownload();
+ }, 1500);
+ }
+
+
+
+ }, staticResources.token);
+
+
+
+ }
+
+ document.body.onclick = function(){
+ //jsPdfDownload();
+ }
+</script>
+<!-- 20220221 PI鏀归�� by 寰愪寒 end -->
</apex:page>
\ No newline at end of file
--
Gitblit v1.9.1