Advertisement
Guest User

Untitled

a guest
Dec 31st, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 5.78 KB | None | 0 0
  1. List<Time_Entry_Type__c> timeEntryTypes = new List<Time_Entry_Type__c>();
  2.     Time_Entry_Type__c billShift1Hours = new Time_Entry_Type__c();
  3.     billShift1Hours.Name = 'Bill Shift 1 Hours';
  4.     billShift1Hours.Extra_Shift__c = true;
  5.     billShift1Hours.Counted_For_Rules__c = true;
  6.     billShift1Hours.Is_Count_As_Shift__c = false;
  7.     billShift1Hours.Has_Break_Section__c = true;
  8.     billShift1Hours.Is_Callback_Type__c = false;
  9.     billShift1Hours.Regular_Weekly_Rule__c = false;
  10.     billShift1Hours.Regular_Field_Pay_Type__c = 'Bill Shift 1 Pay';
  11.     billShift1Hours.Regular_Hours_Pay_Rate_Field__c = 'Bill_Shift1_Pay_Rate__c';
  12.     billShift1Hours.Regular_Field_Bill_Type__c = 'Bill Shift 1 Bill';
  13.     billShift1Hours.Regular_Hours_Bill_Rate_Field__c = 'Bill_Shift1_Bill_Rate__c';
  14.     billShift1Hours.OT_Pay__c = true;
  15.     billShift1Hours.OT_Field_Pay_Type__c = 'Bill Shift 1 OT Pay';
  16.     billShift1Hours.OT_Hours_Pay_Rate_Field__c = 'Bill_Shift1_OT_Pay_Rate__c';
  17.     billShift1Hours.OT_Bill__c = true;
  18.     billShift1Hours.OT_Field_Bill_Type__c = 'Bill Shift 1 OT Bill';
  19.     billShift1Hours.OT_Hours_Bill_Rate_Field__c = 'Bill_Shift1_OT_Bill_Rate__c';
  20.     billShift1Hours.Double_OT_Pay__c = true;
  21.     billShift1Hours.Double_OT_Field_Pay_Type__c = 'Bill Shift 1 Double OT Pay';
  22.     billShift1Hours.Double_Hours_Pay_Rate_Field__c = 'Bill_Shift1_Double_OT_Pay_Rate__c';
  23.     billShift1Hours.Double_OT_Bill__c = true;
  24.     billShift1Hours.Double_OT_Field_Bill_Type__c = 'Bill Shift 1 Double OT Bill';
  25.     billShift1Hours.Double_Hours_Bill_Rate_Field__c = 'Bill_Shift1_Double_OT_Bill_Rate__c';
  26.     timeEntryTypes.add(billShift1Hours);
  27.  
  28.     Time_Entry_Type__c regularHours = new Time_Entry_Type__c();
  29.     regularHours.Name = 'Regular Hours';
  30.     regularHours.Extra_Shift__c = true;
  31.     regularHours.Counted_For_Rules__c = true;
  32.     regularHours.Is_Count_As_Shift__c = true;
  33.     regularHours.Has_Break_Section__c = true;
  34.     regularHours.Is_Callback_Type__c = false;
  35.     regularHours.Regular_Weekly_Rule__c = true;
  36.     regularHours.Regular_Field_Pay_Type__c = 'Regular Pay';
  37.     regularHours.Regular_Hours_Pay_Rate_Field__c = 'Reg_Pay_Rate__c';
  38.     regularHours.Regular_Field_Bill_Type__c = 'Regular Bill';
  39.     regularHours.Regular_Hours_Bill_Rate_Field__c = 'Reg_Bill_Rate__c';
  40.     regularHours.OT_Pay__c = true;
  41.     regularHours.OT_Field_Pay_Type__c = 'OT Pay';
  42.     regularHours.OT_Hours_Pay_Rate_Field__c = 'OT_Pay_Rate__c';
  43.     regularHours.OT_Bill__c = true;
  44.     regularHours.OT_Field_Bill_Type__c = 'OT Bill';
  45.     regularHours.OT_Hours_Bill_Rate_Field__c = 'OT_Bill_Rate__c';
  46.     regularHours.Double_OT_Pay__c = true;
  47.     regularHours.Double_OT_Field_Pay_Type__c = 'Double OT Pay';
  48.     regularHours.Double_Hours_Pay_Rate_Field__c = 'Double_OT_Pay_Rate__c';
  49.     regularHours.Double_OT_Bill__c = true;
  50.     regularHours.Double_OT_Field_Bill_Type__c = 'Double OT Bill';
  51.     regularHours.Double_Hours_Bill_Rate_Field__c = 'Double_OT_Bill_Rate__c';
  52.     timeEntryTypes.add(regularHours);
  53.  
  54. insert timeEntryTypes;
  55. Time_Entry_Type__c regular = [SELECT Id FROM Time_Entry_Type__c WHERE Name = 'Regular Hours'];
  56. Billing_Card__c bc = new Billing_Card__c();
  57. bc.Billing_Card_Name_text__c = 'Supplemental - Boston Medical CenterUndo';
  58. bc.Reverse_Invoicing__c = 'Yes';
  59. bc.VMS_Discount_Fee__c = 'Fee';
  60. bc.Billing_Frequency__c = 'Bi-Weekly Standard';
  61. bc.Invoice_Split_Type__c = 'By Caregiver';
  62. bc.Reverse_Invoice_Approval_Required__c = 'Yes';
  63. bc.Work_Week__c = 'Sunday-Saturday';
  64. bc.Orientation_Rate__c = 'Full Rate';
  65. bc.VMS_Percentage__c = 4.23;
  66. bc.Early_Prompt_Pay_Discount__c = 0.00;
  67. bc.Orientation_Burden__c = 8;
  68. bc.Callback_Minimum_Hours__c = 2;
  69. bc.Effective_Date__c = Date.newInstance(2018, 06, 11);
  70. bc.Special_Billing_Instructions__c = 'test';
  71. bc.Time_Entries_Rounding_Rules__c = '15 minutes';
  72. bc.VMS_Discount_Fee__c = 'Discount';
  73. insert bc;
  74.  
  75. Clinician_Rate_Sheet__c rateSheet1 = new Clinician_Rate_Sheet__c(
  76.         Rate_Sheet_Start_Date__c = Date.today().addMonths(-2),
  77.         Rate_Sheet_End_Date__c = Date.today().addMonths(2),
  78.         Submission_Status__c = 'Pending',
  79.         Travel_Order__c = [SELECT Id FROM order__c LIMIT 1].Id,
  80.         Clinician__c = [SELECT Id FROM Temp__c ORDER BY Name DESC LIMIT 1].Id,
  81.         VMS_Fee__c = 4.23
  82. );
  83. rateSheet1.Rate_Sheet_Start_Date__c = Date.newInstance(2018, 11, 11);
  84. rateSheet1.Rate_Sheet_End_Date__c = Date.newInstance(2018, 11, 24);
  85. rateSheet1.Billing_Card__c = bc.Id;
  86. rateSheet1.Submission_Status__c = 'Filled';
  87. insert rateSheet1;
  88.  
  89.  
  90. List<TimeCard__c> timeCards = TimeCardService.generateTimeCards(new List<Id>{rateSheet1.Id});
  91.  
  92. List<TimeCard_Record__c> timeCardRecords = [SELECT Id FROM TimeCard_Record__c WHERE TimeCard__c In : timeCards];
  93. for (TimeCard_Record__c record : timeCardRecords) {
  94.     record.Filled__c = true;
  95. }
  96. update timeCardRecords;
  97.  
  98. List<Time_Entry__c> entries = new List<Time_Entry__c>();
  99. for (TimeCard_Record__c record : timeCardRecords) {
  100.     Time_Entry__c entry = new Time_Entry__c();
  101.     entry.Time_Entry_Type__c = regular.Id;
  102.     entry.Time_Card_Record__c = record.Id;
  103.     entry.Check_In__c = Time.newInstance(12, 30, 0, 0);
  104.     entry.Check_Out__c = Time.newInstance(22, 30, 0, 0);
  105.     entry.Break__c = 0.50;
  106.     entries.add(entry);
  107. }
  108. insert entries;
  109.  
  110. List<Time_Entry_Part__c> entryParts = new List<Time_Entry_Part__c>();
  111. for (Time_Entry__c entry : entries) {
  112.     Time_Entry_Part__c part = new Time_Entry_Part__c();
  113.     part.Time_Entry__c = entry.Id;
  114.     part.Hours_Amount__c = 9.50;
  115.     part.Time_Entry_Part_Type__c = 'Regular Bill';
  116.     part.Rate__c = 18.00;
  117.     part.Bill__c = true;
  118.     part.Exported__c = true;
  119.     entryParts.add(part);
  120. }
  121. insert entryParts;
  122.  
  123. for (TimeCard__c timeCard : timeCards) {
  124.     timeCard.Paylocity_Exported__c = true;
  125. }
  126. TriggerHandler.disabled = true;
  127. update timeCards;
  128. TriggerHandler.disabled = false;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement