<apex:page controller="QuotesPDFController" showHeader="false" sidebar="false" id="allPage" action="{!init}" >
|
<!-- renderAs="pdf" -->
|
|
<html>
|
<head>
|
<style>
|
@page {
|
size: A4 landscape;
|
margin: 12mm 12mm 5mm 12mm;
|
}
|
/* 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>
|
<div id="pdf-wrapper">
|
<div id="title1"></div>
|
<table border="0" style="font-family: Arial Unicode MS; page-break-inside: auto" width="100%">
|
<colgroup>
|
<col width="60%"/>
|
<col width="10%"/>
|
<col width="30%"/>
|
</colgroup>
|
<tr style="font-size: 12px;">
|
<td rowspan="4"> <apex:image value="{!URLFOR($Resource.SWO)}" style="width: 50%;height: 50%"/></td>
|
<td>报价单号</td>
|
<td>{!quo.ESTIMATE__c}</td>
|
</tr>
|
<tr style="font-size: 12px;">
|
|
<td>日期</td>
|
<td><apex:outputField value="{!quo.DATE__c}" /></td>
|
</tr>
|
<tr>
|
|
<td> </td>
|
<td></td>
|
</tr>
|
<tr style="font-size: 18px">
|
|
<td>报价单</td>
|
<td></td>
|
</tr>
|
</table>
|
<br/>
|
<table border="0" style="font-family: Arial Unicode MS; page-break-inside: auto;font-size:12px;line-height: 10px" width="100%">
|
<colgroup>
|
<col width="60%"/>
|
<col width="40%"/>
|
</colgroup>
|
<tr style="font-weight: bolder;font-size: 14px;">
|
<th>收单方</th>
|
<th>收货方</th>
|
</tr>
|
<tr rowspan="3">
|
<td>
|
<!-- <c:PDFWbr targetStr="{!conName}"/><br/>
|
<c:PDFWbr targetStr="{!quo.COMPANYName__c}"/><br/> -->
|
<p style="line-height:15px;"><apex:outputField id="BILL_TO__c" value="{!quo.BILL_TO__c}"/><br/>
|
CHINA
|
</p>
|
</td>
|
<td>
|
<!-- <c:PDFWbr targetStr="{!conName}"/><br/>
|
<c:PDFWbr targetStr="{!quo.COMPANYName__c}"/><br/> -->
|
<p style="line-height:15px;"><apex:outputField id="SHIP_TO__c" value="{!quo.SHIP_TO__c}"/><br/>
|
CHINA
|
</p>
|
</td>
|
</tr>
|
</table>
|
<br/>
|
<br/>
|
|
<table border="1" style="font-family: Arial Unicode MS; page-break-inside: auto;font-size:10px;line-height: 14px;border-style: solid; border-width: 1px; border-color: #ACACAC; border-collapse: collapse; " width="100%" cellpadding="0">
|
<colgroup>
|
<col width="20%"/>
|
<col width="20%"/>
|
<col width="20%"/>
|
<col width="20%"/>
|
<col width="20%"/>
|
</colgroup>
|
<tr style="background-color: #ACACAC;color: #fff">
|
<td>失效</td>
|
<td>货币</td>
|
<td>Incoterm</td>
|
<td>账期</td>
|
<td style="border-right-width: 0px;">Lead Time</td>
|
</tr>
|
<tr >
|
<td><apex:outputField value="{!quo.EXPIRES__c}" /></td>
|
<td>{!quo.CURRENCY__c}</td>
|
<td>{!quo.INCOTERM__c}</td>
|
<td>{!quo.TERMS__c}</td>
|
<td style="border-right-width: 0px;">{!quo.LEAD_TIME__c}</td>
|
</tr>
|
<tr style="background-color: #ACACAC;color: #fff">
|
<td>PO 编号</td>
|
<td>Contact Name</td>
|
<td>Contact Phone</td>
|
<td colspan="2" style="border-right-width: 0px;">Contact Email</td>
|
<!-- <td style="border-right-width: 0px;"></td> -->
|
</tr>
|
<tr>
|
<apex:outputPanel layout="none" rendered="{!IF(quo.PO__c != null, true, false)}">
|
<td style="border-bottom-width: 0;">{!quo.PO__c} </td>
|
</apex:outputPanel>
|
<apex:outputPanel layout="none" rendered="{!IF(quo.PO__c != null, false, true)}">
|
<td style="border-bottom-width: 0;"> </td>
|
</apex:outputPanel>
|
|
<apex:outputPanel layout="none" rendered="{!IF(conName != null, true, false)}">
|
<td style="border-bottom-width: 0;" id="conName">{!conName} </td>
|
</apex:outputPanel>
|
<apex:outputPanel layout="none" rendered="{!IF(conName != null, false, true)}">
|
<td style="border-bottom-width: 0;"> </td>
|
</apex:outputPanel>
|
|
<apex:outputPanel layout="none" rendered="{!IF(quo.CONTACT_PHONE__c != null, true, false)}">
|
<td style="border-bottom-width: 0;" id="CONTACT_PHONE__c">{!quo.CONTACT_PHONE__c} </td>
|
</apex:outputPanel>
|
<apex:outputPanel layout="none" rendered="{!IF(quo.CONTACT_PHONE__c != null, false, true)}">
|
<td style="border-bottom-width: 0;"> </td>
|
</apex:outputPanel>
|
|
<apex:outputPanel layout="none" rendered="{!IF(quo.CONTACT_EMAIL__c != null, true, false)}">
|
<td colspan="2" style="border-right-width: 0px;">{!quo.CONTACT_EMAIL__c} </td>
|
</apex:outputPanel>
|
<apex:outputPanel layout="none" rendered="{!IF(quo.CONTACT_EMAIL__c != null, false, true)}">
|
<td colspan="2" style="border-right-width: 0px;"> </td>
|
</apex:outputPanel>
|
|
</tr>
|
</table>
|
<table border="1" style="font-family: Arial Unicode MS;font-size:10px;line-height: 10px;border-style: solid; border-width: 1px; border-color: #ACACAC; border-collapse: collapse; " width="100%" cellpadding="0">
|
<colgroup>
|
<col width="10%"/>
|
<col width="15%"/>
|
<col width="5%"/>
|
<col width="30%"/>
|
<col width="8%"/>
|
<col width="8%"/>
|
<col width="8%"/>
|
<col width="8%"/>
|
<col width="8%"/>
|
</colgroup>
|
<tr style="background-color: #ACACAC;color: #fff;border-bottom-width: 1px;line-height: 14px;">
|
<th style="vertical-align:middle;">货品</th>
|
<th style="vertical-align:middle;">Part Number</th>
|
<th style="vertical-align:middle;">数量</th>
|
<th style="vertical-align:middle;">说明</th>
|
<th style="vertical-align:middle;">单价</th>
|
<th style="vertical-align:middle;">不含税合计...</th>
|
<th style="vertical-align:middle;">税率</th>
|
<th style="vertical-align:middle;">税额</th>
|
<th style="vertical-align:middle;border-right-width: 0;border-bottom-width: 1px">总金额</th>
|
|
</tr>
|
<apex:repeat id="quoteList" value="{!lineList}" var="item">
|
<apex:outputPanel layout="none" rendered="{!IF(item.description != '空白行', true, false)}">
|
<tr>
|
<td style="border-bottom-width: 0; border-right-width: 0; border-top-width: 0;"><c:PDFWbr targetStr="{!item.productName}"/></td>
|
<td style="border-bottom-width: 0; border-right-width: 0; border-top-width: 0;"><c:PDFWbr targetStr="{!item.qi.PART_NUMBERNew__c}"/></td>
|
<td style="border-bottom-width: 0; border-right-width: 0; border-top-width: 0;">{!item.qi.QUANTITY__c}</td>
|
<td style="border-bottom-width: 0; border-right-width: 0; border-top-width: 0;"><c:PDFWbr targetStr="{!item.description}"/></td>
|
<td style="border-bottom-width: 0; border-right-width: 0; border-top-width: 0;"><apex:outputText value="{0,number,###,###,##0.00}">
|
<apex:param value="{!item.qi.RATE__c}"/>
|
</apex:outputText></td>
|
<td style="border-bottom-width: 0; border-right-width: 0; border-top-width: 0;"><apex:outputText value="{0,number,###,###,##0.00}">
|
<apex:param value="{!item.qi.AMOUNT__c}"/>
|
</apex:outputText></td>
|
<td style="border-bottom-width: 0; border-right-width: 0; border-top-width: 0;"><apex:outputText value="{0,number,###,###,##0.00}">
|
<apex:param value="{!item.qi.TAX_RATE__c}"/>
|
</apex:outputText></td>
|
<td style="border-bottom-width: 0; border-right-width: 0; border-top-width: 0;"><apex:outputText value="{0,number,###,###,##0.00}">
|
<apex:param value="{!item.qi.TAX_AMT__c}"/>
|
</apex:outputText></td>
|
<td style="border-bottom-width: 0; border-right-width: 0; border-top-width: 0;">
|
<apex:outputText value="{0,number,###,###,##0.00}">
|
<apex:param value="{!item.qi.GROSS_AMT__c}"/>
|
</apex:outputText></td>
|
</tr>
|
</apex:outputPanel>
|
<apex:outputPanel layout="none" rendered="{!IF(item.description == '空白行', true, false)}">
|
<tr>
|
<td style="border-bottom-width: 0; border-right-width: 0; border-top-width: 0;"> </td>
|
<td style="border-bottom-width: 0; border-right-width: 0; border-top-width: 0;"></td>
|
<td style="border-bottom-width: 0; border-right-width: 0; border-top-width: 0;"></td>
|
<td style="border-bottom-width: 0; border-right-width: 0; border-top-width: 0;"></td>
|
<td style="border-bottom-width: 0; border-right-width: 0; border-top-width: 0;"></td>
|
<td style="border-bottom-width: 0; border-right-width: 0; border-top-width: 0;"></td>
|
<td style="border-bottom-width: 0; border-right-width: 0; border-top-width: 0;"></td>
|
<td style="border-bottom-width: 0; border-right-width: 0; border-top-width: 0;"></td>
|
<td style="border-bottom-width: 0; border-right-width: 0; border-top-width: 0;"></td>
|
</tr>
|
</apex:outputPanel>
|
</apex:repeat>
|
|
</table>
|
|
<apex:outputPanel rendered="{!pageNum==2}">
|
<table border="1" style="font-family: Arial Unicode MS;font-size:9px;line-height: 10px;border-style: solid; border-width: 1px; border-color: #ACACAC; border-collapse: collapse; " width="100%" cellpadding="0">
|
<colgroup>
|
<col width="10%"/>
|
<col width="15%"/>
|
<col width="5%"/>
|
<col width="30%"/>
|
<col width="8%"/>
|
<col width="8%"/>
|
<col width="8%"/>
|
<col width="8%"/>
|
<col width="8%"/>
|
</colgroup>
|
<tr style="background-color: #ACACAC;color: #fff">
|
<th>货品</th>
|
<th>Part Number</th>
|
<th>数量</th>
|
<th>说明</th>
|
<th>单价</th>
|
<th>不含税合计...</th>
|
<th>税率</th>
|
<th >税额</th>
|
<th style="border-bottom-width: 0; border-right-width: 0; border-top-width: 0;">总金额</th>
|
</tr>
|
<apex:repeat id="quoteList2" value="{!lineList2}" var="item">
|
<apex:outputPanel layout="none" rendered="{!IF(item.description != '空白行', true, false)}">
|
<tr>
|
<td style="border-bottom-width: 0; border-right-width: 0; border-top-width: 0;"><c:PDFWbr targetStr="{!item.productName}"/></td>
|
<td style="border-bottom-width: 0; border-right-width: 0; border-top-width: 0;"><c:PDFWbr targetStr="{!item.qi.PART_NUMBERNew__c}"/></td>
|
<td style="border-bottom-width: 0; border-right-width: 0; border-top-width: 0;">{!item.qi.QUANTITY__c}</td>
|
<td style="border-bottom-width: 0; border-right-width: 0; border-top-width: 0;"><c:PDFWbr targetStr="{!item.description}"/></td>
|
<td style="border-bottom-width: 0; border-right-width: 0; border-top-width: 0;">{!item.qi.RATE__c}</td>
|
<td style="border-bottom-width: 0; border-right-width: 0; border-top-width: 0;">{!item.qi.AMOUNT__c}</td>
|
<td style="border-bottom-width: 0; border-right-width: 0; border-top-width: 0;">{!item.qi.TAX_RATE__c}</td>
|
<td style="border-bottom-width: 0; border-right-width: 0; border-top-width: 0;">{!item.qi.TAX_AMT__c}</td>
|
<td style="border-bottom-width: 0; border-right-width: 0; border-top-width: 0;">{!item.qi.GROSS_AMT__c}</td>
|
</tr>
|
</apex:outputPanel>
|
<apex:outputPanel layout="none" rendered="{!IF(item.description == '空白行', true, false)}">
|
<tr>
|
<td style="border-bottom-width: 0; border-right-width: 0; border-top-width: 0;"> </td>
|
<td style="border-bottom-width: 0; border-right-width: 0; border-top-width: 0;"></td>
|
<td style="border-bottom-width: 0; border-right-width: 0; border-top-width: 0;"></td>
|
<td style="border-bottom-width: 0; border-right-width: 0; border-top-width: 0;"></td>
|
<td style="border-bottom-width: 0; border-right-width: 0; border-top-width: 0;"></td>
|
<td style="border-bottom-width: 0; border-right-width: 0; border-top-width: 0;"></td>
|
<td style="border-bottom-width: 0; border-right-width: 0; border-top-width: 0;"></td>
|
<td style="border-bottom-width: 0; border-right-width: 0; border-top-width: 0;"></td>
|
<td style="border-bottom-width: 0; border-right-width: 0; border-top-width: 0;"></td>
|
</tr>
|
</apex:outputPanel>
|
</apex:repeat>
|
</table>
|
</apex:outputPanel>
|
|
<table border="0" style="font-family: Arial Unicode MS; page-break-inside: auto;font-size: 7px;" width="100%">
|
<colgroup>
|
<col width="76%"/>
|
<col width="12%"/>
|
<col width="12%"/>
|
</colgroup>
|
<tr>
|
<td rowspan="4">
|
<apex:outputField value="{!quo.CUSTOMER_MESSAGE__c}" />
|
<!-- -在维修的过程中,若发现新故障,我们将另外给您报价。<br/>
|
-维修质保期为仪器发货后三个月加八天。<br/>
|
-<br/>
|
如您确认此报价并同意维修,敬请您在90天之内完成付款。否则您的仪器被将视为放弃维修,我们会以运费到付的方式把<br/>仪器给您寄回,并向您收取1000元的检测费用。<br/>
|
-用户在此确认同意此次维修报价:<br/>
|
客户签字或盖章:<br/>
|
日期: -->
|
</td>
|
<td style="vertical-align: bottom; font-size: 14px;">
|
Subtotal
|
</td>
|
<td style="vertical-align: bottom;font-size: 14px;">
|
<apex:outputText value="{0,number,###,###,##0.00}">
|
<apex:param value="{!quo.SUBTOTAL__c}"/>
|
</apex:outputText>
|
</td>
|
</tr>
|
<tr>
|
<apex:outputPanel layout="none" rendered="{!IF(quo.DISCOUNT__c != 0, true, false)}">
|
<td style="vertical-align: top;font-size: 14px;">Discount</td>
|
<td style="vertical-align: top;font-size: 14px;"><apex:outputText value="{0,number,###,###,##0.00}">
|
<apex:param value="{!quo.DISCOUNT__c}"/>
|
</apex:outputText></td>
|
</apex:outputPanel>
|
</tr>
|
<tr>
|
<td style="vertical-align: top;font-size: 14px;">Tax Total</td>
|
<td style="vertical-align: top;font-size: 14px;"><apex:outputText value="{0,number,###,###,##0.00}">
|
<apex:param value="{!quo.TAX__c}"/>
|
</apex:outputText></td>
|
</tr>
|
<tr>
|
<td style="vertical-align: top;font-size: 14px;">Total</td>
|
<td style="vertical-align: top;font-size: 14px;"><apex:outputText value="{0,number,###,###,##0.00}">
|
<apex:param value="{!quo.TOTAL__c}"/>
|
</apex:outputText></td>
|
</tr>
|
</table>
|
</div>
|
|
</body>
|
<!-- 20220221 PI改造 by 徐亮 start -->
|
<script>
|
AWSService.sfSessionId = '{!GETSESSIONID()}';
|
var staticResources = JSON.parse('{!staticResource}');
|
var contactStaticResource = JSON.parse('{!contactStaticResource}');
|
|
function Fun(pdf){
|
let uri = pdf.output('datauristring');
|
let matches = /(?<=addFile=)[^&]*/.exec(window.location.href);
|
if (matches && matches.length) {
|
eval('top.'+matches[0]+'("'+uri+'")');
|
return;
|
}
|
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 = uri;
|
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;
|
|
//一页pdf显示html页面生成的canvas高度;
|
var pageHeight = contentWidth / pw * ph;
|
//未生成pdf的html页面高度
|
var leftHeight = contentHeight;
|
//页面偏移
|
var position = 0;
|
//a4纸的尺寸[595.28,841.89],html页面生成的canvas在pdf中图片的宽高
|
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页面的实际高度,和生成pdf的页面高度(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);
|
}
|
})
|
}
|
|
|
document.body.onload = function(){
|
let i = 0;
|
let Foo = function(){
|
if(i == 2){
|
jsPdfDownload();
|
}
|
}
|
if('{!quo.AWS_Data_Id__c}'){
|
AWSService.query(staticResources.queryUrl, '{!quo.AWS_Data_Id__c}', function(data){
|
let e = document.getElementById("allPage:BILL_TO__c");if(e)e.innerHTML = data.object.billTo;
|
e =document.getElementById("allPage:SHIP_TO__c");if(e)e.innerHTML = data.object.shipTo;
|
e =document.getElementById("CONTACT_PHONE__c");if(e)e.innerHTML = data.object.contactPhone;
|
i++;
|
Foo();
|
|
}, staticResources.token);
|
}else{
|
i++;
|
Foo();
|
}
|
|
if('{!quo.CONTACT_NAME__r.AWS_Data_Id__c}'){
|
AWSService.query(contactStaticResource.queryUrl, '{!quo.CONTACT_NAME__r.AWS_Data_Id__c}', function(data){
|
let e = document.getElementById("conName");if(e)e.innerHTML = data.object.lastName;
|
i++;
|
Foo();
|
}, staticResources.token);
|
}else{
|
i++;
|
Foo();
|
}
|
|
|
}
|
</script>
|
<!-- 20220221 PI改造 by 徐亮 end -->
|
</html>
|
</apex:page>
|