0

I want to develop a page with displaying the date period in the left side bar ,its a hyperlink, By clicking the link need to display the data main page as table format(same page - with dynamic value) Below is the code, Can any one help me on this,How to get the Date Object Id value in APex class

Visual Force Page

<apex:page showheader="false" sidebar="false" Controller="TimesheetDays"  
extensions="TimesheetDays">
<html lang="en">
  <head>
     <title>Login</title>
  </head>
  <body>
     <style type="text/css">
        html {
        height: 100%;
        }
        body {
        margin: 0;
        height: 100%;
        }
        #main-container {
        display: table;
        width: 100%;
        height: 100%;
        }
        #sidebar {
        display: table-cell;
        width: 25%;
        vertical-align: top;
        background-color: #8e44ad;
        }
        #sidebar a {
        display: block;
        padding: 10px;
        color: rgba(255,255,255, 0.5);
        margin: 15px 0 0 0;
        text-decoration: none;
        }
        #sidebar a:hover {
        background-color: rgba(255, 255, 255, 0.1);
        color: white !important;
        }
        #content {
        display: table-cell;
        width: 85%;
        vertical-align: top;
        padding: 10px 0 0 10px;
        font-size: 12px;
        }
        tr.dataRow { 
        background-color:white; 
        }
        tr.dataRow:hover { 
        background-color: #e3f3ff;
        };
     </style>
     <apex:form >
        <div id="main-container">
           <div id="sidebar">
              <apex:repeat value="{!timesheetList}" var="a" >
                 <apex:inputHidden value="{!a.Id}"/>
                 <apex:outputLink value="?id={!a.Id}">
                    <apex:outputText value="{0,date,MM/dd/yy} to {1,date,MM/dd/yy}">
                       <apex:param value="{!a.Start_Date__c}" />
                       <apex:param value="{!a.End_Date__c}" />
                    </apex:outputText>
                 </apex:outputLink>
              </apex:repeat>
           </div>
           <div id="content">
              <apex:repeat value="{!timeSheetDayList}" var="a" >
                 <table border="1px" class="list">
                    <h3>
                       <tr class="headerRow">
                          <th class="headerRow">Date</th>
                          <th class="headerRow">Billable Over Time Hours</th>
                          <th class="headerRow">Unpaid Sick Time Off Hours</th>
                          <th class="headerRow">Unpaid Time off Hours</th>
                          <th class="headerRow">Project</th>
                       </tr>
                    </h3>
                    <tr class="dataRow">
                       <td class="dataCell">
                          <apex:outputText value="{0,date,MM/dd/yy}">
                             <apex:param value="{!a.Date__c}" />
                          </apex:outputText>
                       </td>
                       <td class="dataCell">
                          <apex:outputText value="{!a.Billable_Over_Time_Hours__c}" />
                       </td>
                       <td class="dataCell">
                          <apex:outputText value="{!a.Unpaid_Time_Off_Hours__c}" />
                       </td>
                       <td class="dataCell">
                          <apex:outputText value="{!a.Project__r.Name}" />
                       </td>
                    </tr>
                 </table>
                 <Br/>
              </apex:repeat>
           </div>
        </div>
     </apex:form>
  </body>
 </html>
 </apex:page>

Controller

public class TimesheetDays {

 public List<Time_Sheet__c> timesheetList{get;set;}
 public List<Time_Sheet_Day__c> timeSheetDayList{get;set;}

public TimesheetDays() {

    String usrid =  ApexPages.currentPage().getParameters().get('Id');        
    System.debug('usrid ' + usrid);


    timesheetList = new List<Time_Sheet__c>();        
    timesheetList = [SELECT  id, Start_Date__c, End_Date__c, Contact__c FROM Time_Sheet__c WHERE Contact__c = :usrid ORDER BY CreatedDate DESC   LIMIT 10];



   timeSheetDayList = new List<Time_Sheet_Day__c>();
   timeSheetDayList = [SELECT Date__c, Billable_Over_Time_Hours__c, Project__r.Name FROM Time_Sheet_Day__c WHERE Time_Sheet__c = {Need to pass the timeshhet Object ID} limit 3];

}

Page as Below.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.