sfdcace

vf component attachment

Nov 3rd, 2016
2,625
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.87 KB | None | 0 0
  1. <apex:component layout="none" access="global">
  2. <apex:attribute name="acc" description="Account details" type="Account" />
  3. <head>
  4. <style type="text/css" media="print">
  5. @page :first {
  6. @top-center {
  7. content: element(header);
  8. }
  9. }
  10.  
  11. @page {
  12. @bottom-left {
  13. content: element(footer);
  14. }
  15. }
  16.  
  17. * {
  18. margin: 0px;
  19. padding: 0px;
  20. }
  21.  
  22. div.header {
  23. background: url("{!$Resource.AccountHeader}") no-repeat center center;
  24. margin-top: 30px;
  25. height: 130px;
  26. width: 715px;
  27. text-align: center;
  28. position: running(header);
  29. }
  30.  
  31. div.content {
  32. padding-top: 130px;
  33. }
  34.  
  35. div.footer {
  36. display: block;
  37. padding: 5px;
  38. position: running(footer);
  39. }
  40.  
  41. div.subfooter {
  42. display: inline-block;
  43. }
  44.  
  45. div.right {
  46. float: right;
  47. }
  48.  
  49. .pagenumber:before {
  50. content: counter(page);
  51. }
  52.  
  53. .pagecount:before {
  54. content: counter(pages);
  55. }
  56.  
  57. .stationName {
  58. text-align: center;
  59. font-weight: bold;
  60. font-size: 20pt;
  61. margin-bottom: 30px;
  62. }
  63.  
  64. table {
  65. width: 100%;
  66. }
  67.  
  68. .centered {
  69. text-align: center;
  70. }
  71.  
  72. .right {
  73. text-align: right;
  74. }
  75.  
  76. .label {
  77. font-weight: bold;
  78. }
  79.  
  80. .tableHeader {
  81. border-width: 0px 0px 1px 0px;
  82. border-color: #000;
  83. border-style: solid;
  84. }
  85.  
  86. .sectionHeader {
  87. width: 100%;
  88. background-color: #eee;
  89. font-size: 16pt;
  90. padding: 5px;
  91. margin: 20px 0px;
  92. font-weight: bold;
  93. }
  94.  
  95. #totalAmount {
  96. width: 100%;
  97. text-align: right;
  98. margin-top: 15px;
  99. }
  100.  
  101. #totalAmountLabel {
  102. font-weight: bold;
  103. margin-right: 10px;
  104. }
  105. </style>
  106. </head>
  107. <div class="header"></div>
  108. <div class="content">
  109. <h1 class="accountName">
  110. {!acc.Name}
  111. </h1>
  112.  
  113. <table id="status">
  114. <tr>
  115. <td class="label">{!$ObjectType.Account.fields.Name.Label}</td>
  116. <td><apex:outputText value="{!acc.Name}" /></td>
  117. </tr>
  118. <tr>
  119. <td class="label">{!$ObjectType.Account.fields.AccountNumber.Label}</td>
  120. <td><apex:outputText value="{!acc.AccountNumber}" /></td>
  121. </tr>
  122. </table>
  123.  
  124. <div class="sectionHeader">{!$ObjectType.Opportunity.labelPlural}</div>
  125. <table id="resources">
  126. <tr>
  127. <th class="tableHeader">{!$ObjectType.Opportunity.fields.Name.Label}</th>
  128. <th class="tableHeader centered">{!$ObjectType.Opportunity.fields.StageName.Label}</th>
  129. <th class="tableHeader centered">{!$ObjectType.Opportunity.fields.Amount.Label}</th>
  130. </tr>
  131. <apex:repeat value="{!acc.Opportunities}" var="opp">
  132. <tr>
  133. <td><apex:outputField value="{!opp.Name}"/></td>
  134. <td class="centered"><apex:outputField value="{!opp.StageName}"/></td>
  135. <td class="centered"><apex:outputField value="{!opp.Amount}"/></td>
  136. </tr>
  137. </apex:repeat>
  138. </table>
  139.  
  140. <div class="sectionHeader">{!$ObjectType.Contact.labelPlural}</div>
  141. <table id="resources">
  142. <tr>
  143. <th class="tableHeader">{!$ObjectType.Contact.fields.Name.Label}</th>
  144. <th class="tableHeader centered">{!$ObjectType.Contact.fields.Email.Label}</th>
  145. <th class="tableHeader right">{!$ObjectType.Contact.fields.MailingCity.Label}</th>
  146. <th class="tableHeader right">{!$ObjectType.Contact.fields.MailingCountry.Label}</th>
  147. </tr>
  148. <apex:repeat value="{!acc.Contacts}" var="con">
  149. <tr>
  150. <td><apex:outputField value="{!con.Name}"/></td>
  151. <td class="centered"><apex:outputField value="{!con.Email}"/></td>
  152. <td class="right"><apex:outputField value="{!con.MailingCity}"/></td>
  153. <td class="right"><apex:outputField value="{!con.MailingCountry}"/></td>
  154. </tr>
  155. </apex:repeat>
  156. </table>
  157. <br class="clearboth" />
  158. <div id="totalAmount">
  159. <span id="totalAmountLabel">{!$ObjectType.Account.Fields.Total_Amount__c.Label}:</span>
  160. <apex:outputField value="{!acc.Total_Amount__c}"/>
  161. </div>
  162. </div>
  163. <div class="footer">
  164. <div class="centered">Generated by {!$User.FirstName} {!$User.LastName}</div>
  165. <div>
  166. <div class="subfooter">{!NOW()}</div>
  167. <div class="subfooter right">Page <span class="pagenumber"/> of <span class="pagecount"/></div>
  168. </div>
  169. </div>
  170. </apex:component>
Add Comment
Please, Sign In to add comment