Advertisement
JanKjeldsen

Axapta 3.0 holiday table

Jun 15th, 2012
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.44 KB | None | 0 0
  1. Exportfile for AOT version 1.0 or later
  2. Formatversion: 1
  3.  
  4. ***Element: DBT
  5.  
  6. ; Microsoft Business Solutions-Axapta Table : WorkHolidayTable unloaded at Fredag 15-06-2012
  7. ; --------------------------------------------------------------------------------
  8. TABLEVERSION 1
  9.  
  10. TABLE #WorkHolidayTable
  11. PROPERTIES
  12. Name #WorkHolidayTable
  13. Label #@CUA1418
  14. FormRef #
  15. TitleField1 #HolyDate
  16. TitleField2 #Name
  17. Temporary #No
  18. TableContents #Not specified
  19. Systemtable #No
  20. ConfigurationKey #
  21. SecurityKey #
  22. MaxAccessMode #Delete
  23. CacheLookup #EntireTable
  24. CreateRecIdIndex #No
  25. SaveDataPerCompany #Yes
  26. TableGroup #Group
  27. PrimaryIndex #DateIdx
  28. ClusterIndex #DateIdx
  29. ModifiedDate #No
  30. ModifiedTime #No
  31. ModifiedBy #No
  32. ModifiedTransactionId #No
  33. CreatedDate #Yes
  34. CreatedTime #Yes
  35. CreatedBy #Yes
  36. CreatedTransactionId #No
  37. ENDPROPERTIES
  38.  
  39. FIELDS
  40. FIELD #HolyDate
  41. DATE
  42. PROPERTIES
  43. Type #Date
  44. Name #HolyDate
  45. Label #@CUA1419
  46. HelpText #@CUA1419
  47. GroupPrompt #
  48. SaveContents #Yes
  49. Mandatory #Yes
  50. AllowEditOnCreate #Yes
  51. AllowEdit #No
  52. Visible #Yes
  53. ConfigurationKey #
  54. Table #WorkHolidayTable
  55. AliasFor #
  56. ExtendedDataType
  57. ARRAY
  58. #TransDate
  59. #
  60. ENDARRAY
  61. ENDPROPERTIES
  62.  
  63. FIELD #Name
  64. STRING
  65. PROPERTIES
  66. Type #String
  67. Name #Name
  68. Label #
  69. HelpText #@CUA1419
  70. GroupPrompt #
  71. SaveContents #Yes
  72. Mandatory #No
  73. AllowEditOnCreate #Yes
  74. AllowEdit #Yes
  75. Visible #Yes
  76. ConfigurationKey #
  77. Table #WorkHolidayTable
  78. AliasFor #
  79. ExtendedDataType
  80. ARRAY
  81. #Name
  82. #
  83. ENDARRAY
  84. StringSize #50
  85. Adjustment #Left
  86. ENDPROPERTIES
  87.  
  88. ENDFIELDS
  89. GROUPS
  90. GROUP #AutoReport
  91. PROPERTIES
  92. Name #AutoReport
  93. OldName #
  94. Label #
  95. ENDPROPERTIES
  96.  
  97. GROUPFIELDS
  98. #HolyDate
  99. #Name
  100. #dayName
  101. #week
  102. ENDGROUPFIELDS
  103. ENDGROUP
  104. GROUP #AutoLookup
  105. PROPERTIES
  106. Name #AutoLookup
  107. OldName #
  108. Label #
  109. ENDPROPERTIES
  110.  
  111. GROUPFIELDS
  112. ENDGROUPFIELDS
  113. ENDGROUP
  114. ENDGROUPS
  115.  
  116. INDICES
  117. #DateIdx
  118. PROPERTIES
  119. Name #DateIdx
  120. AllowDuplicates #No
  121. Enabled #Yes
  122. ConfigurationKey #
  123. ENDPROPERTIES
  124.  
  125. INDEXFIELDS
  126. #HolyDate
  127. ENDINDEXFIELDS
  128.  
  129. ENDINDICES
  130. REFERENCES
  131. REFERENCE #WorkHolidayTable
  132. PROPERTIES
  133. Name #WorkHolidayTable
  134. Table #WorkHolidayTable
  135. Validate #Yes
  136. ENDPROPERTIES
  137.  
  138. FIELDREFERENCES
  139. REFERENCETYPE NORMAL
  140. PROPERTIES
  141. Field #HolyDate
  142. RelatedField #HolyDate
  143. ENDPROPERTIES
  144.  
  145. ENDFIELDREFERENCES
  146. ENDREFERENCE
  147. ENDREFERENCES
  148.  
  149. DELETEACTIONS
  150. ENDDELETEACTIONS
  151.  
  152. METHODS
  153. Version: 3
  154. SOURCE #dayName
  155. #display str 8 dayName()
  156. #{
  157. # return this.HolyDate ? dayName(dayOfWk(this.HolyDate)) : '';
  158. #}
  159. ENDSOURCE
  160. SOURCE #insertNotExists
  161. #void insertNotExists()
  162. #{
  163. # if (!WorkHolidayTable::exist(this.HolyDate))
  164. # this.insert();
  165. #}
  166. ENDSOURCE
  167. SOURCE #week
  168. #display Week week()
  169. #{
  170. # return this.HolyDate ? wkOfYr(this.HolyDate) : 0;
  171. #}
  172. ENDSOURCE
  173. SOURCE #easterDay
  174. #// Brugbar ved alle årstal efter gregoriansk kalender (1701 ff.).
  175. #// Der er taget hensyn til 1992-ændringerne i kirkeåret,
  176. #// men ikke til særlige helligdage før Struensees reform 1770.
  177. #// ® Niels Aarup 1996
  178. #
  179. #static TransDate easterDay(Yr y)
  180. #{
  181. # int a = y mod 19;
  182. # int b = y div 100;
  183. # int c = y mod 100;
  184. # int d = b div 4;
  185. # int e = b mod 4;
  186. # int f = (b+8) div 25;
  187. # int g = (b-f+1) div 3;
  188. # int h = (19*a+b-d-g+15) mod 30;
  189. # int i = c div 4;
  190. # int k = c mod 4;
  191. # int l = (32+2*e+2*i-h-k) mod 7;
  192. # int m = (a+11*h+22*l) div 451;
  193. # int n = (h+l-7*m+114) div 31;
  194. # int p = (h+l-7*m+114) mod 31;
  195. # return mkdate(p+1,n,y);
  196. #}
  197. ENDSOURCE
  198. SOURCE #exist
  199. #static boolean exist(TransDate holyDate)
  200. #{
  201. # return holyDate && (select firstonly RecId from WorkHolidayTable where WorkHolidayTable.HolyDate == holyDate).RecId != 0;
  202. #}
  203. ENDSOURCE
  204. SOURCE #holidayCreate
  205. #static void holidayCreate(Yr y)
  206. #{
  207. # WorkHolidayTable h;
  208. # TransDate e = WorkHolidayTable::easterDay(y);
  209. # h.HolyDate = mkdate(01,01,y); h.Name = "Nytårsdag"; h.insertNotExists();
  210. # h.HolyDate = e-3; h.Name = "Skærtorsdag"; h.insertNotExists();
  211. # h.HolyDate = e-2; h.Name = "Langfredag"; h.insertNotExists();
  212. # h.HolyDate = e; h.Name = "Påskedag"; h.insertNotExists();
  213. # h.HolyDate = e+1; h.Name = "2. Påskedag"; h.insertNotExists();
  214. # h.HolyDate = e+26; h.Name = "Bededag"; h.insertNotExists();
  215. # h.HolyDate = e+39; h.Name = "Kr.himmelfartsdag"; h.insertNotExists();
  216. # h.HolyDate = e+49; h.Name = "Pinsedag"; h.insertNotExists();
  217. # h.HolyDate = e+50; h.Name = "2. Pinsedag"; h.insertNotExists();
  218. # h.HolyDate = mkdate(01,05,y); h.Name = "1. maj"; h.insertNotExists();
  219. # h.HolyDate = mkdate(05,06,y); h.Name = "Grundlovsdag"; h.insertNotExists();
  220. # h.HolyDate = mkdate(24,12,y); h.Name = "Juleaftensdag"; h.insertNotExists();
  221. # h.HolyDate = mkdate(25,12,y); h.Name = "Juledag"; h.insertNotExists();
  222. # h.HolyDate = mkdate(26,12,y); h.Name = "2. Juledag"; h.insertNotExists();
  223. # h.HolyDate = mkdate(31,12,y); h.Name = "Nytårsaftensdag"; h.insertNotExists();
  224. #}
  225. ENDSOURCE
  226. ENDMETHODS
  227. ENDTABLE
  228.  
  229.  
  230. ***Element: END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement