Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. <apex:page standardController="Time_Sheet__c" extensions="i3_CaseTimesheet_Edit_Controller" sidebar="false">
  2. <apex:form >
  3. <apex:pageBlock title="Case Timesheet">
  4.  
  5. <div align="center">
  6. <apex:outputPanel >
  7. <apex:commandButton value="Save" action="{!Save}"/>
  8.  
  9. <apex:commandButton value="Cancel" action="{!Cancel}"/>
  10. </apex:outputPanel>
  11. </div>
  12. <br></br>
  13. <apex:pageBlocksection title="Enter Timesheet Details">
  14. <apex:inputtext value="{!TSNewDate}" label="New Date"/>
  15. </apex:pageBlocksection>
  16. </apex:pageBlock>
  17. </apex:form>
  18. </apex:page>
  19.  
  20. public class i3_CaseTimesheet_Edit_Controller {
  21.  
  22. public date TSNewDate {get;set;}
  23.  
  24. public i3_CaseTimesheet_Edit_Controller(ApexPages.StandardController stdController) {
  25. CurrRecId = ApexPages.currentPage().getParameters().get('Id');
  26. system.debug (CurrRecId);
  27. 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];
  28. TSNewDate = TSRecord[0].Completed_date__c;
  29. }
  30.  
  31. public PageReference Save()
  32. {
  33.  
  34. System.Debug('Entered Save');
  35. Time_sheet__c CTime = new Time_sheet__c();
  36. CTime.Completed_Date__c = TSNewDate;
  37. CTime.Id = CurrRecId;
  38. update CTime;
  39. PageReference TSPage = new PageReference('/' + CTime.Id); // to open the saved TS
  40. return TSPage;
  41. }
  42.  
  43. Time midnight = Time.newInstance(0,0,0,0);
  44. Datetime today = Datetime.newInstance(Date.today(), midnight);
  45. system.debug(today.format('MM/dd/yyyy'));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement