Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <apex:page standardController="Time_Sheet__c" extensions="i3_CaseTimesheet_Edit_Controller" sidebar="false">
- <apex:form >
- <apex:pageBlock title="Case Timesheet">
- <div align="center">
- <apex:outputPanel >
- <apex:commandButton value="Save" action="{!Save}"/>
- <apex:commandButton value="Cancel" action="{!Cancel}"/>
- </apex:outputPanel>
- </div>
- <br></br>
- <apex:pageBlocksection title="Enter Timesheet Details">
- <apex:inputtext value="{!TSNewDate}" label="New Date"/>
- </apex:pageBlocksection>
- </apex:pageBlock>
- </apex:form>
- </apex:page>
- public class i3_CaseTimesheet_Edit_Controller {
- public date TSNewDate {get;set;}
- public i3_CaseTimesheet_Edit_Controller(ApexPages.StandardController stdController) {
- CurrRecId = ApexPages.currentPage().getParameters().get('Id');
- system.debug (CurrRecId);
- TSRecord = [Select Contract__c, Assigned_To__c, Account__c, Case__c, Duration__c, Email_Customer__c, Public_Comments__c, Description__c, Completed_Date__c from Time_sheet__c where ID = :CurrRecId];
- TSNewDate = TSRecord[0].Completed_date__c;
- }
- public PageReference Save()
- {
- System.Debug('Entered Save');
- Time_sheet__c CTime = new Time_sheet__c();
- CTime.Completed_Date__c = TSNewDate;
- CTime.Id = CurrRecId;
- update CTime;
- PageReference TSPage = new PageReference('/' + CTime.Id); // to open the saved TS
- return TSPage;
- }
- Time midnight = Time.newInstance(0,0,0,0);
- Datetime today = Datetime.newInstance(Date.today(), midnight);
- system.debug(today.format('MM/dd/yyyy'));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement