• Robbert Bos2
  • NEWBIE
  • 30 Points
  • Member since 2016
  • Admin
  • ICE

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 2
    Replies
I'm trying to find the fee which is active on the date of the worked hours. Goal is to schedule this every week to see our revenues.

Does anybody know how I can use the where clause in de for loop so the start date of the Fee is smaller (or equal) to the date of the time entry?
 
global class RevenueTimeEntry implements Schedulable {
    global void execute(SchedulableContext sc) {

        List<timeEntry__c> TimeEntry = new List<timeEntry__c>(
                [SELECT Id, date__c
                 FROM timeEntry__c 
                 WHERE Fee1__c = null
                 LIMIT 10]);

        System.debug(TimeEntry); 

        for(timeEntry__c te : TimeEntry){
            Decimal fee = [ SELECT Fee2__c
                            FROM AssignmentFee__c 
                            //WHERE DateStart__c <= :TimeEntry.date__c
                            LIMIT 1].Fee2__c;

            te.Fee1__c = fee;
        }
        update TimeEntry;
    }
}

 
I have a public list where in I want to check if the record owner is the same as a related object, but I keep getting an error. Anybody know if this is possible?
 
public List< Custom__c > getBalance2(){
        return [SELECT id, name, State__c, OwnerId, Related__r.OwnerId

                    FROM Custom__c 
                    WHERE State__c = 'Active'
                    AND Related__r.OwnerId =  :Balance2.OwnerId ];
}

 
I have changed My domain and have set the right page etc etc, but the layout of the login page keeps showing the same old page. I've tried the same on several sandboxes; they all instantly changed.

Is there something I'm missing? Anybody else had this problem before?
I've made a résumé to render as a word document and I got a specific problem. I call the job history witth apex and show this in a visualforce table. Problem I have here is that this table gets shown on a new page and only on that page. So if the information is larger then one page, some of the data is not shown.

Does anybody know how to insert pagepreaks into the pageblock(table)?
 
APEX:

public class relatedCV {
        public mployee__MF_Recruitment_Candidate__c can;
        public relatedCV(ApexPages.StandardController sc) {
            this.can = (mployee__MF_Recruitment_Candidate__c)sc.getRecord();
        }

        public list<mployee__candidatePosition__c> getWorks(){
           return [SELECT Name, Id, mployee__companyName__c, mployee__title__c, mployee__summary__c, mployee__startDateYear__c, mployee__endDateYear__c, Werkzaamheden__c FROM mployee__candidatePosition__c WHERE mployee__Candidate__c =:can.id];
        }

        
    }
 
VF Page

<apex:page standardStylesheets="false" standardController="mployee__MF_Recruitment_Candidate__c" extensions="relatedCV" sidebar="false" contentType="application/msword#test.doc" cache="true">
<html xmlns:w="urn:schemas-microsoft-com:office:word">

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<head>

<style>
p.MsoHeader, li.MsoHeader, div.MsoHeader    {
    margin:-0.1in 0in 0in -0.6in !important;
    padding:0in 0in 0in 0in !important;
    margin-top:0pt;
    mso-pagination:widow-orphan;
    tab-stops:center 3.0in right 6.0in;
    }
    
p.MsoFooter, li.MsoFooter, div.MsoFooter    {
    margin:0in 0in 0in 0in;
    margin-bottom:.0001pt;
    mso-pagination:widow-orphan;
    tab-stops:center 3.0in right 6.0in;
    font-family:DINPro-Light, Verdana, Arial;
    font-weight:normal;
    font-size:7.5pt;
    }
    
@page Section1    {
    size:8.5in 11.0in; 
    margin:0.5in 0.3in 0.5in 0.3in;
    mso-header-margin:0.0in;
    mso-header:h1;
    mso-footer:f1; 
    mso-footer-margin:0.3in;
    mso-paper-source:0;
    }
    
div.Section1    {
    page:Section1;
    }

table#hrdftrtbl{
    margin:0in 0in 0in 9in;
    }
     
p    {
    font-size:8.0pt;
    font-family:"Verdana",sans-serif;
    }
  
*    {
    font-family:"Verdana",sans-serif !important;
    }
    
.fontapex {
    font-family:"Verdana",sans-serif !important;
    }
 
table.header  {
    width:100%;
    border-collapse:collapse;
    border:none;
    }
  
td.headerTD    {
    border-top:solid #E5472A 1.0pt;
    border-left:none;
    border-bottom:solid #E5472A 1.0pt;
    border-right:none;
    padding:0cm 5.4pt 0cm 5.4pt;height:3.0pt;
    text-align:center;
    font-weight:bold;
    }
  </style>
</head>
    
<div class="Section1" style="page-break-after:always">

    <!--Werkervaring-->
    <table class="blok" width="100%">
        <tr>
            <td valign="top" class="HeaderTD">
                <p><i>Relevante werkervaring</i></p>
            </td>
        </tr>
    </table>
  
    <apex:pageBlock mode="maindetail" >
        <apex:pageBlockTable value="{!Works}" var="work" align="left" style="padding: 0px 0px 10px 20px;">
            <apex:column headerValue="" width="150" style="vertical-align:top;">
                <p>{!work.mployee__startDateYear__c} - {!work.mployee__endDateYear__c}</p>           
                
            </apex:column>
            <apex:column headerValue="">
                <p><b>{!work.mployee__companyName__c}</b><br/>
                <i>{!work.mployee__title__c}</i></p>
                <p>Werkzaamheden:<apex:outputText escape="false"><p class="fontapex">{!work.Werkzaamheden__c}</p></apex:outputText></p>
                <p>&nbsp;</p>

            </apex:column>
        </apex:pageBlockTable>
        <br/><p>&nbsp;</p><br/>
    </apex:pageBlock><!--Werkervaring-->

</div>

</html>
</apex:page>

 
I'm trying to render a MS Word document from a visualforce page. But because of the use of the header/footer I get a blank second page.

Does anybody know how to get rid of the blank page? I tried several CSS and scripts.
 
<apex:page standardController="mployeeTime__timeSheetMonth__c" extensions="API_timeSheetMonthExtension" sidebar="false" contentType="application/msword#test.doc" cache="true">
<html xmlns:w="urn:schemas-microsoft-com:office:word">
<apex:variable var="item" value="{!mployeeTime__timeSheetMonth__c}" />

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

<style>

body {
        font-family:DINPro-Light, Verdana, Arial;
        font-size: 11px;        
    }

table {
        width:100%;
    }
    
.tablehours    {
    font-size: 9px;
    width:60%;
   }

    table td {
        width:25%;
    }
    table td.odd {
        background-color:#999;
    }
    
    table.line-items tbody tr td:last-child {
        border: none;
    }

    table.line-items tbody tr td {
        border-right: thin solid #999;
    }
    
p.MsoHeader, li.MsoHeader, div.MsoHeader    {
    margin:0in;
    margin-top:.0001pt;
    mso-pagination:widow-orphan;
    tab-stops:center 3.0in right 6.0in;
    }
    
p.MsoFooter, li.MsoFooter, div.MsoFooter    {
    margin:0in;
    margin-bottom:.0001pt;
    mso-pagination:widow-orphan;
    tab-stops:center 3.0in right 6.0in;
    font-family:DINPro-Light, Verdana, Arial;
    font-weight:normal;
    font-size:7.5pt;
    }
    
@page Section1    {
    size:8.5in 11.0in; 
    margin:0.5in 0.5in 0.5in 0.5in;
    mso-header-margin:0in;
    mso-header:h1;
    mso-footer:f1; 
    mso-footer-margin:0.2in;
    mso-paper-source:0;
    }
    
div.Section1    {
    page:Section1;
    }

table#hrdftrtbl{
    margin:0in 0in 0in 9in;
    }      

h2  {
    font-family:DINPro-Light, Verdana, Arial;
    font-weight:normal;
    font-size:20pt;
    padding: 0px 0px 0px 0px;
    margin: 0px 0px 0px 0px;
    line-height: 19pt;
    color:#84BFC5;
    text-align:right;
    }
    
h3  {
    font-family:DINPro-Light, Verdana, Arial;
    font-weight:normal;
    font-size:20pt;
    padding: 0px 0px 0px 0px;
    margin: 0px 0px 0px 0px;
    line-height: 19pt;
    color:#6D6966;
    text-align:right;
    }

</style>
</head>

<div class="Section1" style="page-break-after:always;">       

<center><div style="font-weight:bold; font-size: 14px;">Urenverantwoording</div></center>
<hr/>      

<!-- invoice-details V I-->
<apex:panelGrid rendered="true"  columns="4" id="invoice-details-I">
    <b>Periode</b>
    <apex:panelGroup >
        <apex:outputField value="{!item.mployeeTime__periodStartDate__c}" />
        &nbsp;t/m&nbsp;
        <apex:outputField value="{!item.mployeeTime__periodEndDate__c}" />
    </apex:panelGroup>
    <b>Contactpersoon</b>                    
    <apex:outputLabel value="Marcel" />
    
    <b>Naam consultant</b>                
    <apex:outputField value="{!item.mployeeTime__Employee__c}" />
    <b>Afdeling</b>
    <apex:outputText value="{!item.mployeeTime__Assignment__r.mployee__ProjectName__c}" />
    
    <b>Debiteurnummer</b>
    <apex:outputText value="{!item.mployeeTime__Assignment__r.Name}"/>
    <b>Datum</b>
    <apex:outputText value="{0,date,dd'-'MM'-'yyyy}" >  
        <apex:param value="{!item.LastModifiedDate}" />
    </apex:outputText>                   
    
</apex:panelGrid>     
<hr/>

<table class="tablehours" border="1" align="center">
    <thead>
        <tr>
            <th class="label-bg" scope="col">Datum</th>
            <th class="label-bg" scope="col">Uren</th> 
        </tr>
    </thead>
    <tbody>
        <apex:repeat value="{!TimeSheet}" var="entry" >    
            <tr>
                <td align="right">
                    <apex:outputText value="{0,date,dd'-'MM'-'yyyy}" >  
                        <apex:param value="{!entry.date1}" />
                    </apex:outputText>
                </td>    
                <td align="right">
                    <apex:outputText value="{0,number,#,00.00}">
                         <apex:param value="{!entry.durations0}" />  
                    </apex:outputText>
                </td>
            </tr>
        </apex:repeat>
    </tbody>
    <tr>
      <th scope="row">Totaal</th>
      <th scope="row" align="right">
          <apex:outputText value="{!mployeeTime__timeSheetMonth__c.Totaal_gewerkte_uren__c}"/>
      </th>
    </tr>    
</table>     

<table width="50%" border="0" cellspacing="0" cellpadding="0">
    <br/>
    <tr>
        <td>Datum:</td>
        <td>Datum:</td>
    </tr>
    <tr>
        <td>Opdrachtgever:</td>
        <td>Professional:</td>
    </tr>  
</table>
<!--Header and Footer-->
<table id='hrdftrtbl' border='0' cellspacing='0' cellpadding='0'>
    <tr>
        <td>
            <!--Header-->
            <div style='mso-element:header' id="h1" >
                <p class="MsoHeader">
                    <table border="0" width="100%">
                        <tr>
                            <td width="30%">
                                <img src="" style="align:left"/>
                                <p>&nbsp;</p>
                            </td>
                            <td align="center" width="40%">
                            </td>
                            <td align="right" width="30%">
                                <h3>We</h3>
                                <h2>Know</h2>  
                                <h3>it</h3>
                                <p>&nbsp;</p>
                            </td>
                        </tr>
                    </table>
                </p>
            </div><!--Header einde-->
        </td>
        <td>
            <!--Footer-->
            <div style='mso-element:footer' id="f1">
                <p class="MsoFooter">
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                            <td align="center" width="100%">
                                <p align="center" class="MsoFooter">bla bla bla bla</p>
                                <p align="center" class="MsoFooter">bla bla bla bla</p>
                            </td>
                           
                        </tr>
                    </table>
                </p>
            </div><!--Footer einde-->
        </td>
    </tr>
</table><!--Header and Footer einde-->
 
</div><!--Section1 div einde-->

</html>
</apex:page>

 
I'm trying to find the fee which is active on the date of the worked hours. Goal is to schedule this every week to see our revenues.

Does anybody know how I can use the where clause in de for loop so the start date of the Fee is smaller (or equal) to the date of the time entry?
 
global class RevenueTimeEntry implements Schedulable {
    global void execute(SchedulableContext sc) {

        List<timeEntry__c> TimeEntry = new List<timeEntry__c>(
                [SELECT Id, date__c
                 FROM timeEntry__c 
                 WHERE Fee1__c = null
                 LIMIT 10]);

        System.debug(TimeEntry); 

        for(timeEntry__c te : TimeEntry){
            Decimal fee = [ SELECT Fee2__c
                            FROM AssignmentFee__c 
                            //WHERE DateStart__c <= :TimeEntry.date__c
                            LIMIT 1].Fee2__c;

            te.Fee1__c = fee;
        }
        update TimeEntry;
    }
}

 
I'm trying to render a MS Word document from a visualforce page. But because of the use of the header/footer I get a blank second page.

Does anybody know how to get rid of the blank page? I tried several CSS and scripts.
 
<apex:page standardController="mployeeTime__timeSheetMonth__c" extensions="API_timeSheetMonthExtension" sidebar="false" contentType="application/msword#test.doc" cache="true">
<html xmlns:w="urn:schemas-microsoft-com:office:word">
<apex:variable var="item" value="{!mployeeTime__timeSheetMonth__c}" />

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

<style>

body {
        font-family:DINPro-Light, Verdana, Arial;
        font-size: 11px;        
    }

table {
        width:100%;
    }
    
.tablehours    {
    font-size: 9px;
    width:60%;
   }

    table td {
        width:25%;
    }
    table td.odd {
        background-color:#999;
    }
    
    table.line-items tbody tr td:last-child {
        border: none;
    }

    table.line-items tbody tr td {
        border-right: thin solid #999;
    }
    
p.MsoHeader, li.MsoHeader, div.MsoHeader    {
    margin:0in;
    margin-top:.0001pt;
    mso-pagination:widow-orphan;
    tab-stops:center 3.0in right 6.0in;
    }
    
p.MsoFooter, li.MsoFooter, div.MsoFooter    {
    margin:0in;
    margin-bottom:.0001pt;
    mso-pagination:widow-orphan;
    tab-stops:center 3.0in right 6.0in;
    font-family:DINPro-Light, Verdana, Arial;
    font-weight:normal;
    font-size:7.5pt;
    }
    
@page Section1    {
    size:8.5in 11.0in; 
    margin:0.5in 0.5in 0.5in 0.5in;
    mso-header-margin:0in;
    mso-header:h1;
    mso-footer:f1; 
    mso-footer-margin:0.2in;
    mso-paper-source:0;
    }
    
div.Section1    {
    page:Section1;
    }

table#hrdftrtbl{
    margin:0in 0in 0in 9in;
    }      

h2  {
    font-family:DINPro-Light, Verdana, Arial;
    font-weight:normal;
    font-size:20pt;
    padding: 0px 0px 0px 0px;
    margin: 0px 0px 0px 0px;
    line-height: 19pt;
    color:#84BFC5;
    text-align:right;
    }
    
h3  {
    font-family:DINPro-Light, Verdana, Arial;
    font-weight:normal;
    font-size:20pt;
    padding: 0px 0px 0px 0px;
    margin: 0px 0px 0px 0px;
    line-height: 19pt;
    color:#6D6966;
    text-align:right;
    }

</style>
</head>

<div class="Section1" style="page-break-after:always;">       

<center><div style="font-weight:bold; font-size: 14px;">Urenverantwoording</div></center>
<hr/>      

<!-- invoice-details V I-->
<apex:panelGrid rendered="true"  columns="4" id="invoice-details-I">
    <b>Periode</b>
    <apex:panelGroup >
        <apex:outputField value="{!item.mployeeTime__periodStartDate__c}" />
        &nbsp;t/m&nbsp;
        <apex:outputField value="{!item.mployeeTime__periodEndDate__c}" />
    </apex:panelGroup>
    <b>Contactpersoon</b>                    
    <apex:outputLabel value="Marcel" />
    
    <b>Naam consultant</b>                
    <apex:outputField value="{!item.mployeeTime__Employee__c}" />
    <b>Afdeling</b>
    <apex:outputText value="{!item.mployeeTime__Assignment__r.mployee__ProjectName__c}" />
    
    <b>Debiteurnummer</b>
    <apex:outputText value="{!item.mployeeTime__Assignment__r.Name}"/>
    <b>Datum</b>
    <apex:outputText value="{0,date,dd'-'MM'-'yyyy}" >  
        <apex:param value="{!item.LastModifiedDate}" />
    </apex:outputText>                   
    
</apex:panelGrid>     
<hr/>

<table class="tablehours" border="1" align="center">
    <thead>
        <tr>
            <th class="label-bg" scope="col">Datum</th>
            <th class="label-bg" scope="col">Uren</th> 
        </tr>
    </thead>
    <tbody>
        <apex:repeat value="{!TimeSheet}" var="entry" >    
            <tr>
                <td align="right">
                    <apex:outputText value="{0,date,dd'-'MM'-'yyyy}" >  
                        <apex:param value="{!entry.date1}" />
                    </apex:outputText>
                </td>    
                <td align="right">
                    <apex:outputText value="{0,number,#,00.00}">
                         <apex:param value="{!entry.durations0}" />  
                    </apex:outputText>
                </td>
            </tr>
        </apex:repeat>
    </tbody>
    <tr>
      <th scope="row">Totaal</th>
      <th scope="row" align="right">
          <apex:outputText value="{!mployeeTime__timeSheetMonth__c.Totaal_gewerkte_uren__c}"/>
      </th>
    </tr>    
</table>     

<table width="50%" border="0" cellspacing="0" cellpadding="0">
    <br/>
    <tr>
        <td>Datum:</td>
        <td>Datum:</td>
    </tr>
    <tr>
        <td>Opdrachtgever:</td>
        <td>Professional:</td>
    </tr>  
</table>
<!--Header and Footer-->
<table id='hrdftrtbl' border='0' cellspacing='0' cellpadding='0'>
    <tr>
        <td>
            <!--Header-->
            <div style='mso-element:header' id="h1" >
                <p class="MsoHeader">
                    <table border="0" width="100%">
                        <tr>
                            <td width="30%">
                                <img src="" style="align:left"/>
                                <p>&nbsp;</p>
                            </td>
                            <td align="center" width="40%">
                            </td>
                            <td align="right" width="30%">
                                <h3>We</h3>
                                <h2>Know</h2>  
                                <h3>it</h3>
                                <p>&nbsp;</p>
                            </td>
                        </tr>
                    </table>
                </p>
            </div><!--Header einde-->
        </td>
        <td>
            <!--Footer-->
            <div style='mso-element:footer' id="f1">
                <p class="MsoFooter">
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                            <td align="center" width="100%">
                                <p align="center" class="MsoFooter">bla bla bla bla</p>
                                <p align="center" class="MsoFooter">bla bla bla bla</p>
                            </td>
                           
                        </tr>
                    </table>
                </p>
            </div><!--Footer einde-->
        </td>
    </tr>
</table><!--Header and Footer einde-->
 
</div><!--Section1 div einde-->

</html>
</apex:page>