高章伟
2022-03-18 4bfe21c4b5ddc089ae5a95f4b10f6cff148b690d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
<apex:page standardController="Maintenance_Contract_Estimate__c" extensions="MaintenanceContractEstimatePDFController" showHeader="false" sidebar="false" action="{!init}" renderAs="pdf" applyHtmlTag="false" >
<!--<apex:page standardController="Maintenance_Contract_Estimate__c" extensions="MaintenanceContractEstimatePDFController" showHeader="false" sidebar="false" action="{!init}">-->
<html>
    <head>
        <style>
        @page {
            size: A4 landscape;
            margin: 12mm 12mm 5mm 12mm;
            
            @bottom-center {
                content: counter(page) " / " counter(pages);
            }
        }
        
        table { border-collapse: collapse; }
        
        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; }
        
        </style>
    </head>
<!--    TODO ラベル対応-->
    <body style="font-family: Arial Unicode MS; page-break-inside: auto">
        <!-- 表紙 -->
<!--        <table width="100%" cellspacing="0" cellpadding="0" >-->
<!--            <tr>-->
<!--                <td width="15%"></td>-->
<!--                <td width="10%"></td>-->
<!--                <td style="text-align: right">合同管理编码 &nbsp;{!targetObj.estimate.Maintenance_Contract__r.Management_Code__c}&nbsp;&nbsp;-->
<!--                </td>-->
<!--            </tr>-->
<!--            <tr><td height="80px"></td></tr>-->
<!--            <tr>-->
<!--                <td colspan="3" style="text-align: center;font-size: 24pt">-->
<!--                    {!targetObj.estimate.Maintenance_Contract__r.Hospital__r.Name}&nbsp;&nbsp;-->
<!--                    {!year}&nbsp;&nbsp;年度服务合同-->
<!--                </td>-->
<!--            </tr>-->
<!--            <tr><td height="140px"></td></tr>-->
<!--            <tr>-->
<!--                <td></td>-->
<!--                <td colspan="2" style="font-size: 18pt">甲方:&nbsp;{!targetObj.estimate.Maintenance_Contract__r.Hospital__r.Name}</td>-->
<!--            </tr>-->
<!--            <tr><td height="20px"></td></tr>-->
<!--            <tr>-->
<!--                <td></td>-->
<!--                <td colspan="2" style="font-size: 18pt">乙方:&nbsp;奥林巴斯(北京)销售服务有限公司     分公司</td>-->
<!--            </tr>-->
<!--            <tr><td height="80px"></td></tr>-->
<!--            <tr>-->
<!--                <td colspan="2"></td>-->
<!--                <td style="font-size: 16pt">签约科室&nbsp;&nbsp;{!targetObj.estimate.Department__c}</td>-->
<!--            </tr>-->
<!--            <tr><td height="10px"></td></tr>-->
<!--            <tr>-->
<!--                <td colspan="2"></td>-->
<!--                <td style="font-size: 16pt">签订地点</td>-->
<!--            </tr>-->
<!--            <tr><td height="10px"></td></tr>-->
<!--            <tr>-->
<!--                <td colspan="2"></td>-->
<!--                <td style="font-size: 16pt">签订日期</td>-->
<!--            </tr>-->
<!--            <tr><td height="10px"></td></tr>-->
<!--            <tr>-->
<!--                <td colspan="2"></td>-->
<!--                <td style="font-size: 16pt">-->
<!--                    合同期限&nbsp;&nbsp;-->
<!--                    <apex:outputtext value="{0, date, yyyy年MM月dd日}">-->
<!--                        <apex:param value="{!targetObj.estimate.Contract_Esti_Start_Date__c}" />-->
<!--                    </apex:outputtext>-->
<!--                    &nbsp;至&nbsp;-->
<!--                    <apex:outputtext value="{0, date, yyyy年MM月dd日}">-->
<!--                        <apex:param value="{!targetObj.estimate.Contract_Esti_End_Date__c}" />-->
<!--                    </apex:outputtext>-->
<!--                </td>-->
<!--            </tr>-->
<!--        </table>-->
<!--        -->
<!--        <div style="page-break-after: always;"/>-->
 
        <apex:variable value="{!1}" var="pageCnt" />
        <apex:variable value="{!0}" var="lineNo" />
        <!-- 改ページループ -->
        <apex:repeat value="{!targetObjList}" var="targetObj">
            <table width="100%" cellspacing="0" cellpadding="0" >
                <tr>
                    <td colspan="2" style="text-align: center;font-size: 20pt">服务合同报价单</td>
                </tr>
                <tr>
                    <td style="text-align: right;">报价编码:</td>
                    <td width="15%" style="text-align: right;">{!targetObj.estimate.Name}</td>
                </tr>
                <tr>
                    <td style="text-align: right;">报价日:</td>
                    <td width="15%" style="text-align: right;">{!SUBSTITUTE(TEXT(TODAY()), '-', '/')}</td>
                </tr>
                <tr>
                    <td style="text-align: right;">报价作成日:</td>
                    <td width="15%" style="text-align: right;">{!targetObj.createdDate}</td>
                </tr>
                <tr>
                    <td colspan="2" style="text-align: right;">此报价单自报价作成日起三个月内有效</td>
                </tr>
            </table>
            <table width="100%" cellspacing="0" cellpadding="0" >
                <tr>
                    <td width="15%">&nbsp;</td>
                    <td width="3%">&nbsp;</td>
                    <td width="7%">&nbsp;</td>
                    <td width="15%">&nbsp;</td>
                    <td width="5%">&nbsp;</td>
                    <td width="3%">&nbsp;</td>
                    <td>&nbsp;</td>
                </tr>
                <tr>
                    <td>对象医院</td>
                    <td>:</td>
                    <td colspan="2">{!targetObj.estimate.Maintenance_Contract__r.Hospital__r.Name}</td>
                    <td>科室</td>
                    <td>:</td>
                    <td>{!targetObj.estimate.Department__c}</td>
                </tr>
                <apex:outputPanel rendered="{!targetObj.estimate.Estimate_Target__c == '经销商'}" layout="none">
                    <tr>
                        <td>经销商名称</td>
                        <td>:</td>
                        <td colspan="5">{!targetObj.estimate.Dealer__r.Name}</td>
                    </tr>
                </apex:outputPanel>
                <apex:outputPanel rendered="{!targetObj.estimate.Estimate_Target__c == '医院'}" layout="none">
                    <tr><td colspan="7">&nbsp;</td></tr>
                </apex:outputPanel>
                <tr>
                    <td>合同开始日期</td>
                    <td>:</td>
                    <td colspan="2">{!SUBSTITUTE(TEXT(targetObj.estimate.Contract_Start_Date__c), '-', '/')}</td>
                    <td>合同月数</td>
                    <td>:</td>
                    <td><apex:outputText value="{0,number,#,###}">
                        <apex:param value="{!targetObj.estimate.Contract_Range__c}" />
                    </apex:outputText>个月</td>
                </tr>
                <tr>
                    <td>定期点检回数</td>
                    <td>:</td>
                    <td style="text-align: right"><apex:outputText value="{0,number,#,###}">
                        <apex:param value="{!targetObj.estimate.Service_contract_target_number__c}" />
                    </apex:outputText></td>
                    <td>&nbsp;&nbsp;回/年</td>
                    <td colspan="3">&nbsp;</td>
                </tr>
                <tr>
                    <td>消毒液</td>
                    <td>:</td>
                    <td style="text-align: right">{!IF(targetObj.estimate.NotUse_Oxygenated_Water__c, '不使用', '使用')}</td>
                    <td colspan="4">&nbsp;</td>
                </tr>
                <tr>
                    <td colspan="7" style="text-align: right">单位:RMB</td>
                </tr>
            </table>
            <table width="100%" cellspacing="0" cellpadding="0" style="table-layout: fixed;">
                <tr>
                    <td width="3%" class="border-thick-title" >No.</td>
                    <td width="12%" class="border-thick-title" >型号</td>
                    <td class="border-thick-title" >品名</td>
                    <td width="8%" class="border-thick-title" >生产编号</td>
                    <td width="8%" class="border-thick-title" >安装日期</td>
                    <td width="8%" class="border-thick-title" >点检结果</td>
                    <td width="3%" class="border-thick-title" >数量</td>
                    <td width="{!IF(targetObj.estimate.Print_ListPrice__c, '12%', '0%')}" class="border-thick-title" >{!IF(targetObj.estimate.Print_ListPrice__c, ' 单价', '')}</td>
                    <td width="{!IF(targetObj.estimate.Print_RepairPrice__c, '12%', '0%')}" class="border-thick-title" >{!IF(targetObj.estimate.Print_RepairPrice__c, '待确认修理费用', '')}</td>
                    <td width="0%" class="border-thick-title" ></td><!-- 新购入/继续 -->
                    <td width="8%" class="border-thick-title" >备注</td>
                    <!-- add 点检改善:约定点检设备对象 2021.6.10 fxk start-->
                    <td class="border-thick-title" >约定点检设备对象</td>
                    <!-- add 点检改善:约定点检设备对象 2021.6.10 fxk end-->
                </tr>
                <!-- 明細行ループ -->
                <apex:repeat value="{!targetObj.assetInfoList}" var="asset" id="asset">
                    <tr>
                        <td class="detail">{!asset.lineNo}</td>
                        <td class="detail">{!asset.assetModelNo}</td>
                        <td class="detail">{!asset.assetName}</td>
                        <td class="detail">{!asset.assetSerialNumber}</td>
                        <td class="detail">{!asset.installDate}</td>
                        <td class="detail">{!IF(ISNULL(asset.mcae), '-', asset.mcae.Check_Result__c)}</td>
                        <td class="detail">{!asset.quantity}</td>
                        <apex:outputPanel rendered="{!targetObj.estimate.Print_ListPrice__c}" layout="none">
                            <td style="text-align: right">
                                <apex:outputText value="{0,number,#,##0.00 ;▲#,##0.00 }" rendered="{!Not(Isnull(asset.listPrice))}">
                                    <apex:param value="{!IF(ISNULL(asset.lineNo), '', asset.listPrice)}" />
                                </apex:outputText>
                            </td>
                        </apex:outputPanel>
                        <apex:outputPanel rendered="{!Not(targetObj.estimate.Print_ListPrice__c)}" layout="none">
                            <td></td>
                        </apex:outputPanel>
                        <apex:outputPanel rendered="{!targetObj.estimate.Print_RepairPrice__c}" layout="none">
                            <td style="text-align: right">
                                <apex:outputText value="{0,number,#,##0.00}">
                                    <!--0.00を出したくない-->
                                    <apex:param value="{!IF(ISNULL(asset.mcae.Repair_Price__c), '', asset.repairPrice)}" />
                                </apex:outputText>
                            </td>
                        </apex:outputPanel>
                        <apex:outputPanel rendered="{!Not(targetObj.estimate.Print_RepairPrice__c)}" layout="none">
                            <td></td>
                        </apex:outputPanel>
                        <td class="detail"></td>
                        <td class="detail">{!asset.mcae.Comment__c}</td>
                        <!-- add 点检改善:约定点检设备对象 2021.6.10 fxk start-->
                        <td class="detail" style="text-align: center;"><c:PDFWbr targetStr="{!If((asset.mcae.Check_Object__c = true),'√','×')}"/></td>
                        <!-- add 点检改善:约定点检设备对象 2021.6.10 fxk end-->
                    </tr>
                    <apex:variable value="{!lineNo + 1}" var="lineNo" />
                </apex:repeat>
                
                <!-- 最後ページに合計金額だけが存在する場合のみ、描画しない -->
                <apex:outputPanel rendered="{!NOT(pageCnt == targetObjSize && lineNo < pageCnt)}" layout="none">
                    <tr><td colspan="12" class="border-thick-bottom"></td></tr>
                </apex:outputPanel>
                
                <!-- 最後ページ(pageCnt == targetObjSize)のみ、描画する -->
                <apex:outputPanel rendered="{!targetObj.estimate.Print_SumPrice__c && pageCnt == targetObjSize}" layout="none">
                    <tr>
                        <td colspan="{!IF(targetObj.estimate.Print_ListPrice__c, '11', '11')}" style="text-align: right;">报价总额</td>
                        <td colspan="{!IF(targetObj.estimate.Print_ListPrice__c, '1', '1')}" style="text-align: right;">
                            <apex:outputText value="{0,number,#,##0.00 }">
                                <apex:param value="{!targetObj.estimate.Estimate_Trial_Money__c}" />
                            </apex:outputText>
                        </td>
                    </tr>
                </apex:outputPanel>
                <apex:outputPanel rendered="{!targetObj.estimate.Print_SumPrice__c && pageCnt == targetObjSize}" layout="none">
                    <tr>
                        <td colspan="{!IF(targetObj.estimate.Print_ListPrice__c, '11', '11')}" style="text-align: right;">优惠百分比</td>
                        <td colspan="{!IF(targetObj.estimate.Print_ListPrice__c, '1', '1')}" style="text-align: right;">
                            <apex:outputText value="{0,number,#,##0.00%}">
                                <apex:param value="{!targetObj.estimate.Discount_Percentage__c}" />
                            </apex:outputText>
                        </td>
                    </tr>
                </apex:outputPanel>
                <apex:outputPanel rendered="{!targetObj.estimate.Print_SumPrice__c && pageCnt == targetObjSize}" layout="none">
                    <tr>
                        <td colspan="{!IF(targetObj.estimate.Print_ListPrice__c, '11', '11')}" style="text-align: right;">优惠金额</td>
                        <td colspan="{!IF(targetObj.estimate.Print_ListPrice__c, '1', '1')}" style="text-align: right;">
                            <apex:outputText value="{0,number,#,##0.00 }">
                                <apex:param value="{!targetObj.estimate.Discount_Price__c}" />
                            </apex:outputText>
                        </td>
                    </tr>
                </apex:outputPanel>
                <apex:outputPanel rendered="{!targetObj.estimate.Print_MaintePrice__c && pageCnt == targetObjSize}" layout="none">
                    <tr>
                        <td colspan="{!IF(targetObj.estimate.Print_ListPrice__c, '11', '11')}" style="text-align: right;">实际金额</td>
                        <td colspan="{!IF(targetObj.estimate.Print_ListPrice__c, '1', '1')}" style="text-align: right;">
                            <apex:outputText value="{0,number,#,##0.00 }">
                                <apex:param value="{!targetObj.estimate.Maintenance_Price__c}"/>
                            </apex:outputText>
                        </td>
                    </tr>
                </apex:outputPanel>
            </table>
            
            <apex:outputPanel rendered="{!pageCnt < targetObjSize}" layout="none">
                <div style="page-break-after: always;"/>
            </apex:outputPanel>
            
            <apex:variable value="{!pageCnt + 1}" var="pageCnt" />
        </apex:repeat>
    </body>
</html>
</apex:page>