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/QuotePDF.page | 553 ++++++++++++++++++++++++++++++++++---------------------
1 files changed, 342 insertions(+), 211 deletions(-)
diff --git a/force-app/main/default/pages/QuotePDF.page b/force-app/main/default/pages/QuotePDF.page
index d8564a8..103cf6e 100644
--- a/force-app/main/default/pages/QuotePDF.page
+++ b/force-app/main/default/pages/QuotePDF.page
@@ -1,225 +1,356 @@
-<apex:page standardController="Quote" extensions="QuotePDFExtensionController" showHeader="false" sidebar="false" renderAs="pdf" action="{!startQuote}">
-<apex:stylesheet value="{!URLFOR($Resource.quotepdf)}"/>
+<apex:page Controller="QuotePDFController" showHeader="false" sidebar="false" id="allPage" action="{!init}" >
+ <!-- <apex:page Controller="QuotePDFController" showHeader="false" sidebar="false" id="allPage" action="{!init}" renderAs="pdf"> -->
<head>
-
-<style>
-
-</style>
-
+ <style>
+ @page {
+ size: A4;
+ margin: 1mm 1mm 1mm 1mm;
+ }
+ </style>
</head>
-
-<body style="font-family: Arial Unicode MS;">
-
- <!-- 銉氥兗銈哥暘鍙枫伄瀹氱京 -->
- <apex:variable var="count" value="{!0}"/>
-
- <!-- 銉氥兗銈搞伄銉償銉笺儓 -->
- <apex:repeat value="{!printRecords}" var="items" id="thePage">
-
- <!-- 銉氥兗銈搞偔銉c兂銉愩偣 -->
- <div class="pageCanvas">
-
- <!-- 銉氥兗銈哥暘鍙枫偆銉炽偗銉儭銉炽儓 -->
- <apex:variable var="count" value="{!count + 1}"/>
+<body style="font-family: Arial Unicode MS; page-break-inside: auto">
+ <div id="pdf-wrapper">
+ <div class="pdf-page">
+ <table border="0" width="100%" style="border-collapse: collapse;">
+ <tr>
+ <td style="text-align:right;">{!quoteInfo.quoteDate}</td>
+ </tr>
+ <tr>
+ <td style="text-align:right;">{!$ObjectType.Quote.label}#{!quoteInfo.quoteNo}</td>
+ </tr>
+ <tr>
+ <td style="text-align:right;">{!$Label.Label_Total_pages}锛歿!pageCnt}</td>
+ </tr>
+ <tr>
+ <td style="text-align:left;">{!$Label.Label_From}锛歿!quoteInfo.dealerName}</td>
+ </tr>
+ <tr>
+ <td style="text-align:left;">{!$ObjectType.Contact.label}锛�<span id="dealerContactName">{!quoteInfo.dealerContactName}</span> {!$ObjectType.Contact.fields.MobilePhone.label}锛�<span>{!quoteInfo.dealerContactPhone}</span></td>
+ </tr>
+ <tr>
+ <td style="text-align:left;">{!$ObjectType.Account.fields.Address1__c.label}锛歿!quoteInfo.dealerAddress}</td>
+ </tr>
+ <tr>
+ <td style="text-align:left;">{!$ObjectType.Contact.fields.Phone.label}锛歿!quoteInfo.dealerPhone} {!$ObjectType.Contact.fields.Fax.label}锛歿!quoteInfo.dealerFax}</td>
+ </tr>
+ <tr>
+ <td style="text-align:left;">{!$ObjectType.Contact.fields.Email.label}锛歿!quoteInfo.dealerEmail}</td>
+ </tr>
+ <tr>
+ <td style="text-align:left;"> </td>
+ </tr>
+ <tr>
+ <td style="text-align:left;">{!$Label.Label_To}锛歿!quoteInfo.accountName}</td>
+ </tr>
+ <tr>
+ <td style="text-align:left;" id="accountContactName">{!quoteInfo.accountContactName}</td>
+ </tr>
+ <tr>
+ <td style="text-align:left;">{!$ObjectType.Contact.fields.Phone.label}锛�<span id="accountContactPhone">{!quoteInfo.accountContactPhone}</span> {!$ObjectType.Contact.fields.Email.label}锛�<span id="accountContactEmail">{!quoteInfo.accountContactEmail}</span></td>
+ </tr>
+ </table>
- <!-- 鍚勩儦銉笺偢銇偪銈ゃ儓銉� -->
- <div class="quoteTitle">{!$Label.Quote_Title}</div>
- <!-- 鍚勩儦銉笺偢銇儤銉冦儉銈儯銉炽儛銈� -->
- <div class="headerCanvas">
- <table style="border-style:none; border-color:red;">
- <tr>
- <td>
- <div>Quotation</div>
- <div> </div>
- <div>{!$Label.Quote_Client_Name}</div>
- <div><apex:outputpanel rendered="{!params.Agent1Name!=null}">{!$Label.Contract_Detail_Dealer_Name}</apex:outputpanel><apex:outputpanel rendered="{!params.Agent1Name==null}"> </apex:outputpanel></div>
- <div><apex:outputpanel rendered="{!params.Agent2Name!=null}">{!$Label.Contract_Detail_Dealer_Name}</apex:outputpanel><apex:outputpanel rendered="{!params.Agent2Name==null}"> </apex:outputpanel></div>
- </td>
- <td>
- <div>: </div>
- <div> </div>
- <div>: </div>
- <div><apex:outputpanel rendered="{!params.Agent1Name!=null}">:</apex:outputpanel> </div>
- <div><apex:outputpanel rendered="{!params.Agent2Name!=null}">:</apex:outputpanel> </div>
- </td>
- <td>
- <div> {!params.quoteNo}</div>
- <div> </div>
- <div> {!params.clientName}</div>
- <div> <apex:outputpanel rendered="{!params.Agent1Name!=null}">{!params.agent1Name}</apex:outputpanel></div>
- <div> <apex:outputpanel rendered="{!params.Agent2Name!=null}">{!params.agent2Name}</apex:outputpanel></div>
- </td>
+ <br/>
+ Quotation Sheet(Quotation #{!quoteInfo.quoteNo})<br/>
+
+ <table border="1" width="100%" style="border-collapse: collapse;table-layout: fixed;">
+ <colgroup>
+ <col width="10%" />
+ <col width="60%" />
+ <col width="10%" />
+ <col width="20%" />
+ </colgroup>
+ <tr style="text-align: center;">
+ <th>{!$Label.Label_Units}</th>
+ <th>{!$Label.Label_Description}</th>
+ <th>{!$ObjectType.QuoteLineItem.fields.Quantity.label}</th>
+ <th>{!$ObjectType.QuoteLineItem.fields.TotalPrice.label}{!currencyIsoCode}</th>
</tr>
- </table>
- <table style="border-style:none; top:0px; right:0px; position:absolute;">
+ <apex:repeat value="{!printRecords}" var="set">
<tr>
- <td>
- <div style="text-align:right;">鎶ヤ环鏃ユ湡 : {!params.quoteDateString}</div>
- <div>姝ゆ姤浠峰崟鑷姤浠锋棩璧蜂笁涓湀鍐呮湁鏁�</div>
- </td>
+ <td style="text-align: center;"><apex:outputText value="{!set.units}" /></td>
+ <td><apex:outputText value="{!set.description}" /></td>
+ <td style="text-align: right;"><apex:outputText value="{!set.qty}" /></td>
+ <td style="text-align: right;"><apex:outputText value="{!set.total}" /></td>
</tr>
+ </apex:repeat>
</table>
- <table style="border-style:none; border-color:green; top:36px; right:0px; position:absolute;">
- <tr>
- <td>
- <div> {!$Label.Quote_Department}</div>
- <div> <apex:outputpanel rendered="{!params.Agent1Name!=null}">{!$Label.phone}</apex:outputpanel></div>
- <div> <apex:outputpanel rendered="{!params.Agent2Name!=null}">{!$Label.phone}</apex:outputpanel></div>
- </td>
- <td>
- <div>: </div>
- <div><apex:outputpanel rendered="{!params.Agent1Name!=null}">:</apex:outputpanel> </div>
- <div><apex:outputpanel rendered="{!params.Agent2Name!=null}">:</apex:outputpanel> </div>
- </td>
- <td>
- <div> {!params.departmentName}</div>
- <div> <apex:outputpanel rendered="{!params.Agent1Name!=null}">{!params.agent1Phone}</apex:outputpanel></div>
- <div> <apex:outputpanel rendered="{!params.Agent2Name!=null}">{!params.agent2Phone}</apex:outputpanel></div>
- </td>
- <td>
- <div style="width:40px; border-style:none;"></div>
- </td>
- <td>
- <div> </div>
- <div> <apex:outputpanel rendered="{!params.Agent1Name!=null}">{!$Label.fax}</apex:outputpanel></div>
- <div> <apex:outputpanel rendered="{!params.Agent2Name!=null}">{!$Label.fax}</apex:outputpanel></div>
- </td>
- <td>
- <div> </div>
- <div><apex:outputpanel rendered="{!params.Agent1Name!=null}">:</apex:outputpanel> </div>
- <div><apex:outputpanel rendered="{!params.Agent2Name!=null}">:</apex:outputpanel> </div>
- </td>
- <td>
- <div> </div>
- <div> <apex:outputpanel rendered="{!params.Agent1Name!=null}">{!params.agent1Fax}</apex:outputpanel></div>
- <div> <apex:outputpanel rendered="{!params.Agent2Name!=null}">{!params.agent2Fax}</apex:outputpanel></div>
- </td>
- </tr>
- </table>
+
+ <br/>
+
+ Note:<br/>
+ <!-- 1) The payment terms are {!quoteInfo.note1} .<br/>
+ 浠樻鏂瑰紡 {!quoteInfo.note2} 銆�<br/>
+ 2) Quoation valid until {!quoteInfo.note3} .<br/>
+ 鎶ヤ环鏈夋晥鏈熷埌 {!quoteInfo.note3} 銆�<br/>
+ 3) All the commodoties come with {!quoteInfo.note4} year's manufacturer warranty.<br/>
+ 鎵�鏈夊晢鍝佸惈 {!quoteInfo.note4} 骞村巶瀹朵繚淇��<br/>
+ 4) The above quotations are {!quoteInfo.note5} prices, Commodoties shipped to the clien's requirements.<br/>
+ 涓婅堪鎶ヤ环涓� {!quoteInfo.note5} 浠凤紝鍟嗗搧閫佽嚦瀹㈡埛鎸囧畾鍦扮偣銆�<br/>
+ 5) The above quotations are all {!quoteInfo.note6}.<br/>
+ 涓婅堪鎶ヤ环鍧囦负 {!quoteInfo.note7} 浠枫��<br/>
+ 6) Configuration as per attached.<br/>
+ 閰嶇疆娓呭崟璇﹁闄勪欢銆�<br/> -->
+ <apex:outputText value="{!quoteInfo.comment}" escape="false"/>
+ <!-- 1) The above quotations are CIP prices, Commodities shipped to the client鈥檚 requirements.<br/>
+ 2) The above quotations are all tax {!quoteInfo.note2}.<br/>
+ 3) The payment terms are {!quoteInfo.note3}.<br/>
+ 4) Quotation valid until {!quoteInfo.note4}.<br/>
+ 5) All the commodities come with {!quoteInfo.note5} year鈥檚 manufacturer warranty.<br/>
+ 6) Configuration as per attached.<br/>
+ 7) Delivery lead time is {!quoteInfo.note7} days after receipt of payment.<br/> -->
+
</div>
-
- <!-- 瑭崇窗閮ㄥ垎銇儤銉冦儉 -->
- <div class="currencyType">鍗樹綅: {!params.trade}</div>
-
- <!-- 銉氥兗銈稿唴銇┏绱般伄REPEAT -->
- <div class="detailCanvas">
- <apex:dataTable value="{!items}" var="item" id="dataTable" styleClass="detailTable" headerClass="detailTableHeader" columnClasses="detailTableCols">
- <apex:column styleClass="detailRowNumber" style="vertical-align:text-top; text-align: center;">
- <apex:facet name="header">{!$Label.Quote_Product_Code}</apex:facet>
- <apex:outputText value="{!item.qli.Item_Order__c}"/>
- </apex:column>
- <apex:column styleClass="detailRowString" style="vertical-align:text-top;">
- <apex:facet name="header"></apex:facet>
- <apex:outputText value="{!item.qli.Asset_Model_No_forPrint__c}"/>
- </apex:column>
- <apex:column styleClass="detailRowString" style="vertical-align:text-top;">
- <apex:facet name="header"></apex:facet>
- <apex:outputText value="{!item.qli.NameForPrintDelimiter__c}"/>
- </apex:column>
- <apex:column styleClass="detailRowString" style="vertical-align:text-top;">
- <apex:facet name="header">{!$Label.Quote_Product_Name}</apex:facet>
- <!-- CHAN-BC6AFM LHJ 20190515 Start-->
- <!-- <apex:outputText value="{!item.qli.NameForPrint__c}"/> -->
- <c:PDFWbr targetStr="{!item.qli.NameForPrint__c}"/>
- <!-- CHAN-BC6AFM LHJ 20190515 End-->
- </apex:column>
- <apex:column styleClass="detailRowNumeric" style="vertical-align:text-top;" rendered="{!params.isUnitPrice==true}">
- <apex:facet name="header">{!$Label.Detail_Price}</apex:facet>
- <apex:outputText value="{0, number, ###,##0.00}">
- <apex:param value="{!item.UnitPrice_c}" />
- </apex:outputText>
- </apex:column>
- <apex:column styleClass="detailRowNumeric" style="vertical-align:text-top;">
- <apex:facet name="header">{!$Label.Quantity}</apex:facet>
- <apex:outputText value="{0, number, ###,###}">
- <apex:param value="{!item.qli.Quantity}" />
- </apex:outputText>
- </apex:column>
- <!-- 2021/01/18 liying start -->
- <apex:column styleClass="detailRowNumeric" style="text-align: center; vertical-align:text-top;" rendered="{!IF(params.isGuranteePeriod, true, false)}">
- <apex:facet name="header">鐗规畩淇濅慨骞撮檺</apex:facet>
- <apex:outputText value="{!item.qli.GuaranteePeriod__c}"/>
- </apex:column>
- <!-- 2021/01/18 liying end -->
- <apex:column styleClass="detailRowNumeric" style="vertical-align:text-top;" rendered="{!params.isOfferAmount==true}">
- <apex:facet name="header">{!$Label.Detail_Sum}</apex:facet>
- <apex:outputText value="{0, number, ###,##0.00}">
- <apex:param value="{!item.TotalPrice_c}" />
- </apex:outputText>
- </apex:column>
- </apex:dataTable>
- </div>
-
- <!-- 鏈�绲傘儦銉笺偢銇仩銇戣〃绀恒仚銈嬪悎瑷堟瑒 -->
- <apex:outputPanel rendered="{!count==maxPageNumber}">
- <div class="totalCanvas">
- <div style="width:120px;">
- <apex:outputPanel rendered="{!params.iSTotalPrice}"><div class="totalLabel">鎶ヤ环鎬婚 : </div></apex:outputPanel>
- <!-- <apex:outputPanel rendered="{!params.isMultiYearPrice && IF(params.trade == 'RMB', true, false)}"><div class="totalLabel">鏈嶅姟鎶ヤ环鎬婚 : </div></apex:outputPanel> -->
- <apex:outputPanel rendered="{!params.isDiscountRate}"><div class="totalLabel">{!$Label.Total_Discount_Percent} : </div></apex:outputPanel>
- <apex:outputPanel rendered="{!params.isDiscountAmount}"><div class="totalLabel">{!$Label.Discount_Amount} : </div></apex:outputPanel>
- <apex:outputPanel rendered="{!params.isTradingPrice}"><div class="totalLabel">{!$Label.Row_Total_Sum} : </div></apex:outputPanel>
- </div>
- <div style="position: absolute; top: 0px; right: 0px; padding-right:5px;">
- <div class="totalValue"><apex:outputText rendered="{!params.iSTotalPrice}" value="{0, number, ###,##0.00}"><apex:param value="{!params.totalPrice}"/></apex:outputText></div>
- <!-- <div class="totalValue"><apex:outputText rendered="{!params.isDiscountAmount}" value="{0, number, ###,##0.00}"><apex:param value="{!params.MultiYearWarrantyTotalPrice}"/></apex:outputText></div> -->
- <!-- <div class="totalValue"><apex:outputText rendered="{!params.isMultiYearPrice && IF(params.trade == 'RMB', true, false)}" value="{0, number, ###,##0.00}"><apex:param value="{!params.MultiYearWarrantyTotalPrice}"/></apex:outputText></div> -->
- <div class="totalValue"><apex:outputText rendered="{!params.isDiscountRate}">{!params.discountRate}%</apex:outputText></div>
- <div class="totalValue"><apex:outputText rendered="{!params.isDiscountAmount}" value="{0, number, ###,##0.00}"><apex:param value="{!params.discountAmount}"/></apex:outputText></div>
- <div class="totalValue"><apex:outputText rendered="{!params.isTradingPrice}" value="{0, number, ###,##0.00}"><apex:param value="{!params.tradingPrice}" /></apex:outputText></div>
- </div>
- </div>
+ <apex:outputPanel rendered="{!pageCnt > 1}" layout="none">
+ <div style="page-break-after: always;"/>
</apex:outputPanel>
-
- <br />
- <!-- 鍚勩儦銉笺偢銇儠銉冦偪銈儯銉炽儛銈� -->
- <apex:outputPanel rendered="{!count==maxPageNumber}">
- <div class="footerCanvas">
- <div class="footerSignLast">
- {!$Label.Quote_OWner} : {!params.ownerName}銆�{!$Label.Quote_Mobile_Phone} : {!params.mobilePhone}<br />
- <br />
- 锛坽!$Label.Quote_Owner_Signature}锛�<br />
-
+ <apex:variable value="{!1}" var="cnt1" />
+ <apex:repeat value="{!printRecords}" var="set">
+ <!-- <apex:variable value="{!1}" var="cnt2" /> -->
+ <apex:repeat value="{!set.setPage}" var="sp">
+ <div class="pdf-page">
+ <table border="1" width="100%" style="border-collapse: collapse;table-layout: fixed; font-size: 12px;">
+ <colgroup>
+ <col width="3%" />
+ <col width="10%" />
+ <col width="15%" />
+ <col width="{!IF(isPrintPrice=='true', 23, 33)}%" />
+ <col width="{!IF(isPrintPrice=='true', 20, 33)}%" />
+ <col width="5%" />
+ <apex:outputPanel rendered="{!isPrintPrice=='true'}" layout="none">
+ <col width="12%" />
+ <col width="12%" />
+ </apex:outputPanel>
+ </colgroup>
+ <!-- <apex:outputPanel rendered="{!cnt2 == 1}" layout="none"> -->
+ <tr style="text-align: center;">
+ <td colspan="{!IF(isPrintPrice=='true', 8, 6)}">{!set.description}{!$Label.Label_Set_detail}</td>
+ </tr>
+ <!-- </apex:outputPanel> -->
+ <tr style="text-align: center;">
+ <td>{!$Label.Label_No}</td>
+ <td>{!$ObjectType.Product2.fields.ProductCode.label}</td>
+ <td>{!$ObjectType.Product2.fields.Product_ECCode__c.label}</td>
+ <td>{!$ObjectType.Product2.fields.Description.label}</td>
+ <td>{!$ObjectType.QuoteLineItem.fields.Description.label}</td>
+ <td>{!$ObjectType.QuoteLineItem.fields.Quantity.label}</td>
+ <apex:outputPanel rendered="{!isPrintPrice=='true'}" layout="none">
+ <td>{!$ObjectType.QuoteLineItem.fields.UnitPrice.label}{!currencyIsoCode}</td>
+ <td>{!$ObjectType.QuoteLineItem.fields.TotalPrice.label}{!currencyIsoCode}</td>
+ </apex:outputPanel>
+ </tr>
+ <apex:repeat value="{!sp}" var="line">
+ <tr>
+ <td style="text-align: center;"><apex:outputText value="{!line.lineNo}" /></td>
+ <td><apex:outputText escape="false" value="{!line.productCode}" /></td>
+ <td><apex:outputText escape="false" value="{!line.productEC}" /></td>
+ <td><apex:outputText escape="false" value="{!line.description}" /></td>
+ <td><apex:outputText escape="false" value="{!line.comment}" /></td>
+ <td style="text-align: right;"><apex:outputText value="{!line.quantity}" /></td>
+ <apex:outputPanel rendered="{!isPrintPrice=='true'}" layout="none">
+ <td style="text-align: right;"><apex:outputText value="{!line.price}" /></td>
+ <td style="text-align: right;"><apex:outputText value="{!line.totalPrice}" /></td>
+ </apex:outputPanel>
+ </tr>
+ </apex:repeat>
+ </table>
</div>
-
- <div class="footerAddress">
-
- <div>
- 鈻!params.addressName}銆�銆�銆�<br />
- {!params.address}锛堥偖缂栵細{!params.postCode}锛�
- </div>
- <!-- <div style="height: 10px;"></div>
- <div>
- 鈻″ゥ鏋楀反鏂紙鍖椾含锛夐攢鍞湇鍔℃湁闄愬叕鍙镐笂娴峰垎鍏徃銆�銆�銆�<br />
- {!params.address}锛堥偖缂栵細{!params.postCode}锛�
- </div>
- <div style="height: 10px;"></div>
- <div>
- 鈻″ゥ鏋楀反鏂紙鍖椾含锛夐攢鍞湇鍔℃湁闄愬叕鍙稿箍宸炲垎鍏徃銆�銆�銆�<br />
- {!params.address}锛堥偖缂栵細{!params.postCode}锛�
- </div> -->
-
- </div>
- </div>
- </apex:outputPanel>
- <apex:outputPanel rendered="{!count!=maxPageNumber}">
- <div class="footerSign" style="position:absolute; top:880px;">
- {!$Label.Quote_OWner} : {!params.ownerName}銆�{!$Label.Quote_Mobile_Phone} : {!params.mobilePhone}<br />
- <br />
- 锛坽!$Label.Quote_Owner_Signature}锛�<br />
- </div>
- </apex:outputPanel>
-
- </div>
-
- <!-- 鍚勩儦銉笺偢銈掑尯鍒囥倠鏀广儦銉笺偢銆佹渶绲傘儦銉笺偢銇伅鍑恒仌銇亜銈堛亞銇仐銇︺亜銈� -->
- <apex:outputpanel rendered="{!count<maxPageNumber}">
- <div style="page-break-after: always;"/>
- </apex:outputpanel>
-
- </apex:repeat>
-
+
+
+ <apex:outputPanel rendered="{!cnt1 < pageCnt - 1}" layout="none">
+ <div style="page-break-after: always;"/>
+ </apex:outputPanel>
+
+ <!-- <apex:variable value="{!cnt2 + 1}" var="cnt2" /> -->
+ <apex:variable value="{!cnt1 + 1}" var="cnt1" />
+ </apex:repeat>
+ </apex:repeat>
+ </div>
</body>
+<style>
+ /* 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 -->
+<!-- 20220221 PI鏀归�� by 寰愪寒 start -->
+<script>
+ AWSService.sfSessionId = '{!GETSESSIONID()}';
+ sforce.connection.serverUrl = '{!$Site.Prefix}/services/Soap/u/53.0';
+ var staticResourceContact = JSON.parse('{!staticResourceContact}');
+ var staticResourceOpportunity = JSON.parse('{!staticResourceOpportunity}');
+ var staticResourceFile = JSON.parse('{!staticResourceFile}');
+ function Fun(pdf) {
+
+ var form = jQuery("<form method='post'></form>");
+ jQuery(document.body).append(form);
+ let href = window.location.href
+ let arr = href.split('/')
+ form.attr({ "action": staticResourceFile.hostUrl + staticResourceFile.extraInfo + "?from=" + encodeURIComponent(href) + "&fileName=" + encodeURIComponent(arr[arr.length - 1].split('?')[0]) });
+ // form.attr({"action":"http://127.0.0.1:8080/a/d?from="+encodeURIComponent(window.location.href)});
+ let input = jQuery("<input type='hidden'/>");
+ input.attr({ "name": "base64Str" });
+ input.val(pdf.output('datauristring').substr(28));
+ form.append(input);
+ form.submit();
+
+ // jQuery("body > *").each(function(){
+ // jQuery(this).css('display','none');
+ // })
+ // jQuery("body").append('<embed style="position:absolute; left: 0; top: 0;" width="100%" height="100%" src="'+pdf.output('datauristring')+'" type="application/pdf"/>')
+
+ }
+
+ let id = "pdf-wrapper";
+ var target = document.getElementById(id);
+ // 鎶奿mageDta杞崲鎴恥rl
+ // page_height锛氫竴椤电殑楂樺害
+ function ImageDataToUrl(img_data,page_height){
+ let cvs = document.createElement("CANVAS");
+ cvs.width = img_data.width;
+ cvs.height = page_height;
+ var ctx= cvs.getContext("2d");
+ ctx.fillStyle="white";
+ ctx.fillRect(0,0,cvs.width,cvs.height);// 濉厖canvas鎵�鏈夊尯鍩熶负鐧借壊
+ ctx.putImageData(img_data,0,0);
+ return cvs.toDataURL('image/jpeg', 1.0);
+ }
+ function jsPdfDownload() {
+
+ let jtargets = jQuery("#pdf-wrapper .pdf-page");
+ let j_arr = new Array(jtargets.length + 1).join(0).split('').map(function () { return false });
+ let landscape = false;
+ let pw = 595.28;
+ let ph = 841.89;
+ const marginw = 40;
+ const marginh = 40;
+
+ let orientation = '';
+ if (landscape) {
+ pw += ph; ph = pw - ph; pw = pw - ph;
+ orientation = 'l';
+ }
+ var pdf = new jsPDF(orientation, 'pt', 'a4');// 绗竴涓弬鏁板~瀛楁瘝l锛屾敞鎰忎笉鏄暟瀛�1锛屼负妯悜pdf
+ jtargets.each(function (i, e) {
+ e.style.background = "#FFFFFF";
+ })
+
+ let rei = 0;
+ let recursion = null;
+ recursion = function (i) {
+ if (i >= jtargets.length) {
+ Fun(pdf);
+ return;
+ }
+ e = jtargets[i];
+ html2canvas(e, {
+ scale: 2,
+ onrendered: function (canvas) {
+ /**
+ 鏈柟娉曢渶瑕佸仛鍑犱釜浜嬫儏
+ 1.闇�瑕佹妸canvas鐨勫唴瀹瑰垎椤垫樉绀哄埌pdf鐨勯〉涓�
+ 2.canvas鐨勫楂橀渶瑕佸拰pdf鐨勫楂樿繘琛屾槧灏�
+ 3.鎴彇鍒扮殑鍐呭闇�瑕佹斁杩涗竴椤靛楂樼殑canvas閲岄潰锛屽苟瀵瑰叾浣欏尯鍩熷埛鐧�
+ */
+ var ctx = canvas.getContext("2d");
+ let canvas_max_page_num = 9;
+ let canvas_current_page_num = 0;
+ var contentWidth = canvas.width;
+ var contentHeight = canvas.height;
+
+
+ //鏈敓鎴恜df鐨刪tml椤甸潰楂樺害
+ var leftHeight = contentHeight;
+ //椤甸潰鍋忕Щ
+ var position = 0;
+
+ //a4绾哥殑灏哄[595.28,841.89]锛宧tml椤甸潰鐢熸垚鐨刢anvas鍦╬df涓浘鐗囩殑瀹介珮
+ var outputWidth = pw - 2 * marginw;//595.28//宸﹀彸杈硅窛20
+ let rate = outputWidth / 780;//杈撳嚭瀹藉害鍜屽唴瀹瑰搴︾殑姣斾緥
+ var outputHeight = ph - 2 * marginh;//宸﹀彸杈硅窛20
+ let onePdfPageInCanvasHeight = contentWidth/outputWidth*outputHeight;//涓�椤祊df鍦╟anvas涓殑楂樺害;
+ //var pageData = canvas.toDataURL('image/jpeg', 1.0);
+ var pageData = null;
+ var imgData = null;
+
+ var captureHeight = null;// 鎴彇鐨勫綋鍓峜anvas椤电殑楂樺害
+
+ let j = i;
+ while(position < contentHeight){
+
+ if (j++) {
+ pdf.addPage();
+ }
+
+ if(position+onePdfPageInCanvasHeight>contentHeight){
+ captureHeight = contentHeight-position;
+ }else{
+ captureHeight = onePdfPageInCanvasHeight;
+ }
+
+ imgData = ctx.getImageData(0,position,contentWidth,captureHeight);
+ pageData = ImageDataToUrl(imgData,onePdfPageInCanvasHeight);
+ pdf.addImage(pageData, 'JPEG', marginw, marginh, outputWidth, outputHeight);//宸﹀彸杈硅窛20,琚緭鍑虹殑鍥剧墖浼氳鎷変几涓簅utputWidth锛宱utputHeight鐨勫楂�
+ canvas_current_page_num++;
+ position += onePdfPageInCanvasHeight;
+ if (canvas_max_page_num > 0 && canvas_current_page_num >= canvas_max_page_num) {
+ break;
+ }
+ }
+
+ recursion(i + 1);
+ }
+ })
+ };
+ recursion(rei);
+
+
+
+ }
+
+ //blockme();
+ document.body.onload = function(){
+
+ let i = 0;
+ let Foo = function(){
+ if ( i == 2) {
+ if(confirm("PDF宸插姞杞藉畬姣曪紝鏄惁鏄剧ず锛�")){
+ jsPdfDownload();
+ }
+ }
+ }
+
+ AWSService.query(staticResourceContact.queryUrl, '{!quoteInfo.conAwsDataId}', function(data){
+ //unblockUI();
+ document.getElementById("accountContactName").innerHTML = data.object.lastName;
+ document.getElementById("accountContactPhone").innerHTML = data.object.phone;
+ document.getElementById("accountContactEmail").innerHTML = data.object.email;
+ i++;
+ Foo();
+ }, staticResourceContact.token);
+
+ AWSService.query(staticResourceOpportunity.queryUrl, '{!quoteInfo.oppAwsDataId}', function(data){
+ //unblockUI();
+ document.getElementById("dealerContactName").innerHTML = data.object.dealerSalesStaffName;
+ i++;
+ Foo();
+ }, staticResourceOpportunity.token);
+ }
+
+
+
+</script>
+<!-- 20220221 PI鏀归�� by 寰愪寒 end -->
</apex:page>
\ No newline at end of file
--
Gitblit v1.9.1