buli
2022-05-13 2f4492ee18f90274582fcc2bb06f5e9bf64136e8
force-app/main/default/pages/QuotePDF.page
@@ -1,225 +1,163 @@
<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}" renderAs="pdf">
<head>
<style>
</style>
    <style>
        @page {
            size: A4;
            margin: 1mm 1mm 1mm 1mm;
        }
    </style>
</head>
<body style="font-family: Arial Unicode MS; page-break-inside: auto">
    <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}:{!quoteInfo.dealerContactName}&nbsp;&nbsp;&nbsp;&nbsp;{!$ObjectType.Contact.fields.MobilePhone.label}:{!quoteInfo.dealerContactPhone}</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}&nbsp;&nbsp;&nbsp;&nbsp;{!$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;">&nbsp;</td>
        </tr>
        <tr>
            <td style="text-align:left;">{!$Label.Label_To}:{!quoteInfo.accountName}</td>
        </tr>
        <tr>
            <td style="text-align:left;">{!quoteInfo.accountContactName}</td>
        </tr>
        <tr>
            <td style="text-align:left;">{!$ObjectType.Contact.fields.Phone.label}:{!quoteInfo.accountContactPhone}&nbsp;&nbsp;&nbsp;&nbsp;{!$ObjectType.Contact.fields.Email.label}:{!quoteInfo.accountContactEmail}</td>
        </tr>
    </table>
<body style="font-family: Arial Unicode MS;">
    <br/>
    Quotation Sheet(Quotation #{!quoteInfo.quoteNo})<br/>
    <!-- ページ番号の定義 -->
    <apex:variable var="count" value="{!0}"/>
    <!-- ページのリピート -->
    <apex:repeat value="{!printRecords}" var="items" id="thePage">
    <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>
        <apex:repeat value="{!printRecords}" var="set">
        <tr>
            <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>
    <!-- ページキャンバス -->
    <div class="pageCanvas">
        <!-- ページ番号インクリメント -->
        <apex:variable var="count" value="{!count + 1}"/>
        <!-- 各ページのタイトル -->
        <div class="quoteTitle">{!$Label.Quote_Title}</div>
        <!-- 各ページのヘッダキャンバス -->
        <div class="headerCanvas">
            <table style="border-style:none; border-color:red;">
                <tr>
                    <td>
                        <div>Quotation</div>
                        <div>&nbsp;</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}">&nbsp;</apex:outputpanel></div>
                        <div><apex:outputpanel rendered="{!params.Agent2Name!=null}">{!$Label.Contract_Detail_Dealer_Name}</apex:outputpanel><apex:outputpanel rendered="{!params.Agent2Name==null}">&nbsp;</apex:outputpanel></div>
                    </td>
                    <td>
                        <div>:&nbsp;</div>
                        <div>&nbsp;</div>
                        <div>:&nbsp;</div>
                        <div><apex:outputpanel rendered="{!params.Agent1Name!=null}">:</apex:outputpanel>&nbsp;</div>
                        <div><apex:outputpanel rendered="{!params.Agent2Name!=null}">:</apex:outputpanel>&nbsp;</div>
                    </td>
                    <td>
                        <div>&nbsp;{!params.quoteNo}</div>
                        <div>&nbsp;</div>
                        <div>&nbsp;{!params.clientName}</div>
                        <div>&nbsp;<apex:outputpanel rendered="{!params.Agent1Name!=null}">{!params.agent1Name}</apex:outputpanel></div>
                        <div>&nbsp;<apex:outputpanel rendered="{!params.Agent2Name!=null}">{!params.agent2Name}</apex:outputpanel></div>
                    </td>
                </tr>
            </table>
            <table style="border-style:none; top:0px; right:0px; position:absolute;">
                <tr>
                    <td>
                        <div style="text-align:right;">报价日期 :&nbsp;&nbsp;{!params.quoteDateString}</div>
                        <div>此报价单自报价日起三个月内有效</div>
                    </td>
                </tr>
            </table>
            <table style="border-style:none; border-color:green; top:36px; right:0px; position:absolute;">
                <tr>
                    <td>
                        <div>&nbsp;{!$Label.Quote_Department}</div>
                        <div>&nbsp;<apex:outputpanel rendered="{!params.Agent1Name!=null}">{!$Label.phone}</apex:outputpanel></div>
                        <div>&nbsp;<apex:outputpanel rendered="{!params.Agent2Name!=null}">{!$Label.phone}</apex:outputpanel></div>
                    </td>
                    <td>
                        <div>:&nbsp;</div>
                        <div><apex:outputpanel rendered="{!params.Agent1Name!=null}">:</apex:outputpanel>&nbsp;</div>
                        <div><apex:outputpanel rendered="{!params.Agent2Name!=null}">:</apex:outputpanel>&nbsp;</div>
                    </td>
                    <td>
                        <div>&nbsp;{!params.departmentName}</div>
                        <div>&nbsp;<apex:outputpanel rendered="{!params.Agent1Name!=null}">{!params.agent1Phone}</apex:outputpanel></div>
                        <div>&nbsp;<apex:outputpanel rendered="{!params.Agent2Name!=null}">{!params.agent2Phone}</apex:outputpanel></div>
                    </td>
                    <td>
                        <div style="width:40px; border-style:none;"></div>
                    </td>
                    <td>
                        <div>&nbsp;</div>
                        <div>&nbsp;<apex:outputpanel rendered="{!params.Agent1Name!=null}">{!$Label.fax}</apex:outputpanel></div>
                        <div>&nbsp;<apex:outputpanel rendered="{!params.Agent2Name!=null}">{!$Label.fax}</apex:outputpanel></div>
                    </td>
                    <td>
                        <div>&nbsp;</div>
                        <div><apex:outputpanel rendered="{!params.Agent1Name!=null}">:</apex:outputpanel>&nbsp;</div>
                        <div><apex:outputpanel rendered="{!params.Agent2Name!=null}">:</apex:outputpanel>&nbsp;</div>
                    </td>
                    <td>
                        <div>&nbsp;</div>
                        <div>&nbsp;<apex:outputpanel rendered="{!params.Agent1Name!=null}">{!params.agent1Fax}</apex:outputpanel></div>
                        <div>&nbsp;<apex:outputpanel rendered="{!params.Agent2Name!=null}">{!params.agent2Fax}</apex:outputpanel></div>
                    </td>
                </tr>
            </table>
        </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>
        <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 />
                </div>
                <div class="footerAddress">
                    <div>
                        □{!params.addressName}   <br />
                        {!params.address}(邮编:{!params.postCode})
                    </div>
                    <!-- <div style="height: 10px;"></div>
                    <div>
                        □奥林巴斯(北京)销售服务有限公司上海分公司   <br />
                        &nbsp;&nbsp;{!params.address}(邮编:{!params.postCode})
                    </div>
                    <div style="height: 10px;"></div>
                    <div>
                        □奥林巴斯(北京)销售服务有限公司广州分公司   <br />
                        &nbsp;&nbsp;{!params.address}(邮编:{!params.postCode})
                    </div> -->
    <br/>
                </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}">
    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’s 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’s manufacturer warranty.<br/>
    6)  Configuration as per attached.<br/>
    7)  Delivery lead time is {!quoteInfo.note7} days after receipt of payment.<br/> -->
    <apex:outputPanel rendered="{!pageCnt > 1}" layout="none">
        <div style="page-break-after: always;"/>
        </apex:outputpanel>
    </apex:outputPanel>
<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">
    <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>
    <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>
</body>
</apex:page>