FrmAttendanceResult.xml 87 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <Forms>
  3. <Form Name="FrmAttendanceResult">
  4. <Client>
  5. <Events>
  6. <Load>
  7. <![CDATA[
  8. @Title="考勤资料结转";
  9. GetSchema();
  10. ChangeMode("Search");
  11. ]]>
  12. </Load>
  13. <Closing>
  14. </Closing>
  15. <Closed>
  16. </Closed>
  17. </Events>
  18. <Mode>
  19. <Search>
  20. <Lable name="Search" />
  21. </Search>
  22. <New>
  23. <Lable name="New" />
  24. </New>
  25. <View>
  26. <Lable name="View" />
  27. </View>
  28. <Modify>
  29. <Lable name="Modify" />
  30. </Modify>
  31. </Mode>
  32. <Controls>
  33. <IKTextButton name="tbNo" DataSource="AttendanceResult.No_AttendanceResult">
  34. <Events>
  35. <Enter>
  36. <![CDATA[
  37. if(tbNo.ReadOnly == false)
  38. {
  39. if(tbNo.CValue != StringEmpty())
  40. {
  41. UpdateForm(false, "");
  42. if(Search("SearchAttendanceResultWithNo", tbNo.CValue))
  43. {
  44. ChangeMode("View");
  45. }
  46. else
  47. {
  48. if(GetRight(@Title,"新增"))
  49. {
  50. ChangeMode("New");
  51. }
  52. else
  53. MessageBox("您没有新增考勤资料结转的权限!",@Title);
  54. }
  55. }
  56. else
  57. {
  58. MessageBox("请输入考勤编号!",@Title);
  59. }
  60. }
  61. ]]>
  62. </Enter>
  63. </Events>
  64. </IKTextButton>
  65. <IKComboBoxEx name="cbDept" ValueSource="AttendanceResult.ID_Department" DisplaySource="AttendanceResult.Name_Department" DataSource="Department" ValueMember="ID_Department" DisplayMember="Name_Department" >
  66. <Events>
  67. <Reload>
  68. UpdateForm(false, "cbDept");
  69. Search("SearchAllDepartment");
  70. UpdateForm(true, "cbDept");
  71. </Reload>
  72. </Events>
  73. </IKComboBoxEx>
  74. <IKDateTimePicker name="dtStart" DataSource="AttendanceResult.Begin_AttendanceResult"/>
  75. <IKDateTimePicker name="dtEnd" DataSource="AttendanceResult.End_AttendanceResult"/>
  76. <IKTextBox name="txtComment" DataSource="AttendanceResult.Comment_AttendanceResult"/>
  77. <IKTextBox name="txtCreator" DataSource="AttendanceResult.Name_Creator"/>
  78. <IKDateTimeText name="dttCreateDate" DataSource="AttendanceResult.CreateDate_AttendanceResult"/>
  79. <IKTextBox name="txtAssessor" DataSource="AttendanceResult.Name_Assessor"/>
  80. <IKDateTimeText name="dtAssessDate" DataSource="AttendanceResult.AssessDate_AttendanceResult"/>
  81. <IKTextBox name="txtLastModUser" DataSource="AttendanceResult.LastModUserName"/>
  82. <IKDateTimeText name="dtLastModDate" DataSource="AttendanceResult.LastModDate_AttendanceResult"/>
  83. <IKButton name="btnSearch">
  84. <Events>
  85. <Click>
  86. if(Search("SearchApplicationBill",dtStart.CValue,dtEnd.CValue,cbDept.SelectedName))
  87. {
  88. MergeTable("#ApplicationBill","#AttendanceResultData");
  89. MergeTable("#Basic","#LaterOrLeaveearly");
  90. }
  91. </Click>
  92. </Events>
  93. </IKButton>
  94. <IKDataGridEx name="ikDataGridEx2" DataSource="AttendanceResultData" TableStyleIndex="0">
  95. <DataColumn Index="0" DataSource="AttendanceResultData.No_Employee" />
  96. <DataColumn Index="1" DataSource="AttendanceResultData.Name_Employee" />
  97. <DataColumn Index="2" DataSource="AttendanceResultData.WorkDays_AttendanceResultData" />
  98. <DataColumn Index="3" DataSource="AttendanceResultData.DutyDays_AttendanceResultData" />
  99. <DataColumn Index="4" DataSource="AttendanceResultData.OvertimeDays_AttendanceResultData" />
  100. <DataColumn Index="5" DataSource="AttendanceResultData.WeekendOtDays_AttendanceResultData" />
  101. <DataColumn Index="6" DataSource="AttendanceResultData.FeastOtDays_AttendanceResultData" />
  102. <DataColumn Index="7" DataSource="AttendanceResultData.EvectionDays_AttendanceResultData" />
  103. <DataColumn Index="8" DataSource="AttendanceResultData.AffairLeaveDays_AttendanceResultData" />
  104. <DataColumn Index="9" DataSource="AttendanceResultData.SickLeaveDays_AttendanceResultData" />
  105. <DataColumn Index="10" DataSource="AttendanceResultData.PayLeaveDays_AttendanceResultData" />
  106. <DataColumn Index="11" DataSource="AttendanceResultData.AbsentDays_AttendanceResultData" />
  107. <DataColumn Index="12" DataSource="AttendanceResultData.LaterTimes_AttendanceResultData" />
  108. <DataColumn Index="13" DataSource="AttendanceResultData.LaterMinutes_AttendanceResultData" />
  109. <DataColumn Index="14" DataSource="AttendanceResultData.EarlyLeaveTimes_AttendanceResultData" />
  110. <DataColumn Index="15" DataSource="AttendanceResultData.EarlyLeaveMinutes_AttendanceResultData" />
  111. <DataColumn Index="16" DataSource="AttendanceResultData.Comment_AttendanceResultData" />
  112. </IKDataGridEx>
  113. <IKDataGridEx name="ikDataGridEx1" DataSource="LaterOrLeaveearly" TableStyleIndex="0">
  114. <DataColumn Index="0" DataSource="LaterOrLeaveearly.No_Employee" />
  115. <DataColumn Index="1" DataSource="LaterOrLeaveearly.Name_Employee" />
  116. <DataColumn Index="2" DataSource="LaterOrLeaveearly.Date_LaterOrLeaveearly" />
  117. <DataColumn Index="3" DataSource="LaterOrLeaveearly.Minute_Leaveearly" />
  118. <DataColumn Index="4" DataSource="LaterOrLeaveearly.Minute_Later" />
  119. </IKDataGridEx>
  120. <IKFormToolBar name="toolBar">
  121. <Events>
  122. <ClickFirst>
  123. if(Search("SearchAttendanceResultByNoFirst", tbNo.CValue))
  124. {
  125. ChangeMode("View");
  126. }
  127. </ClickFirst>
  128. <ClickPrev>
  129. if(Search("SearchAttendanceResultByNoPrevious", tbNo.CValue))
  130. {
  131. ChangeMode("View");
  132. }
  133. </ClickPrev>
  134. <ClickNext>
  135. if(Search("SearchAttendanceResultByNoNext", tbNo.CValue))
  136. {
  137. ChangeMode("View");
  138. }
  139. </ClickNext>
  140. <ClickLast>
  141. if(Search("SearchAttendanceResultByNoLast", tbNo.CValue))
  142. {
  143. ChangeMode("View");
  144. }
  145. </ClickLast>
  146. <ClickEmpty>
  147. ChangeMode("Search");
  148. </ClickEmpty>
  149. <ClickSubmit>
  150. <Lable name="SubmitButtonClick" />
  151. @a = #AttendanceResult.No_AttendanceResult;
  152. Empty();
  153. NewInstance();
  154. Search("SearchAttendanceResultWithNo", @a);
  155. ChangeMode("View");
  156. </ClickSubmit>
  157. <ClickModify>
  158. ChangeMode("Modify");
  159. </ClickModify>
  160. <ClickDelete>
  161. Delete();
  162. ChangeMode("Search");
  163. </ClickDelete>
  164. <ClickAudit>
  165. BeginAudit();
  166. #AttendanceResult.ID_Assessor = GetLoginUserID();
  167. #AttendanceResult.Name_Assessor = GetCurrentUser();
  168. #AttendanceResult.AssessDate_AttendanceResult = DateTimeNow();
  169. Audit();
  170. ChangeMode("View");
  171. EndAudit();
  172. </ClickAudit>
  173. <ClickUnAudit>
  174. BeginUnAudit();
  175. #AttendanceResult.ID_Assessor = DBNull();
  176. #AttendanceResult.Name_Assessor = "";
  177. UnAudit();
  178. ChangeMode("View");
  179. EndUnAudit();
  180. </ClickUnAudit>
  181. </Events>
  182. </IKFormToolBar>
  183. </Controls>
  184. </Client>
  185. <Server>
  186. <Tables>
  187. <Table name="AttendanceResult" Type="Parent">
  188. <GetSchema CmdType="Text" CmdText="Select Top 0 AttendanceResult.*
  189. , a.Name_User AS Name_Creator
  190. , b.Name_User AS Name_Assessor
  191. , c.Name_User AS LastModUserName
  192. , Name_Department
  193. From AttendanceResult
  194. Left Join AppUser a On a.ID_User = AttendanceResult.ID_Creator
  195. Left Join AppUser b On b.ID_User = AttendanceResult.ID_Assessor
  196. Left Join AppUser c On c.ID_User = AttendanceResult.LastModUser_AttendanceResult
  197. Left Join Department On Department.ID_Department = AttendanceResult.ID_Department"/>
  198. <New CmdType="Text" CmdText="Insert Into dbo.AttendanceResult (ID_AttendanceResult
  199. , No_AttendanceResult
  200. , Begin_AttendanceResult
  201. , End_AttendanceResult
  202. , FactDays_AttendanceResult
  203. , ID_Department
  204. , Comment_AttendanceResult
  205. , ID_Creator
  206. , CreateDate_AttendanceResult
  207. , LastModUser_AttendanceResult
  208. , LastModDate_AttendanceResult
  209. , ID_Assessor
  210. , AssessDate_AttendanceResult
  211. )
  212. Values (@ID_AttendanceResult
  213. , @No_AttendanceResult
  214. , @Begin_AttendanceResult
  215. , @End_AttendanceResult
  216. , @FactDays_AttendanceResult
  217. , @ID_Department
  218. , @Comment_AttendanceResult
  219. , @ID_Creator
  220. , @CreateDate_AttendanceResult
  221. , @LastModUser_AttendanceResult
  222. , @LastModDate_AttendanceResult
  223. , @ID_Assessor
  224. , @AssessDate_AttendanceResult
  225. )">
  226. <Params>
  227. <Param name="@ID_AttendanceResult" type="AttendanceResult.ID_AttendanceResult" sourceColumn="ID_AttendanceResult" />
  228. <Param name="@No_AttendanceResult" type="AttendanceResult.No_AttendanceResult" sourceColumn="No_AttendanceResult" />
  229. <Param name="@Begin_AttendanceResult" type="AttendanceResult.Begin_AttendanceResult" sourceColumn="Begin_AttendanceResult" />
  230. <Param name="@End_AttendanceResult" type="AttendanceResult.End_AttendanceResult" sourceColumn="End_AttendanceResult" />
  231. <Param name="@FactDays_AttendanceResult" type="AttendanceResult.FactDays_AttendanceResult" sourceColumn="FactDays_AttendanceResult" />
  232. <Param name="@ID_Department" type="AttendanceResult.ID_Department" sourceColumn="ID_Department" />
  233. <Param name="@Comment_AttendanceResult" type="AttendanceResult.Comment_AttendanceResult" sourceColumn="Comment_AttendanceResult" />
  234. <Param name="@ID_Creator" type="AttendanceResult.ID_Creator" sourceColumn="ID_Creator" />
  235. <Param name="@CreateDate_AttendanceResult" type="AttendanceResult.CreateDate_AttendanceResult" sourceColumn="CreateDate_AttendanceResult" />
  236. <Param name="@LastModUser_AttendanceResult" type="AttendanceResult.LastModUser_AttendanceResult" sourceColumn="LastModUser_AttendanceResult" />
  237. <Param name="@LastModDate_AttendanceResult" type="AttendanceResult.LastModDate_AttendanceResult" sourceColumn="LastModDate_AttendanceResult" />
  238. <Param name="@ID_Assessor" type="AttendanceResult.ID_Assessor" sourceColumn="ID_Assessor" />
  239. <Param name="@AssessDate_AttendanceResult" type="AttendanceResult.AssessDate_AttendanceResult" sourceColumn="AssessDate_AttendanceResult" />
  240. </Params>
  241. </New>
  242. <Update CmdType="Text" CmdText="Update dbo.AttendanceResult
  243. Set No_AttendanceResult = @No_AttendanceResult
  244. , Begin_AttendanceResult = @Begin_AttendanceResult
  245. , End_AttendanceResult = @End_AttendanceResult
  246. , FactDays_AttendanceResult = @FactDays_AttendanceResult
  247. , ID_Department = @ID_Department
  248. , Comment_AttendanceResult = @Comment_AttendanceResult
  249. , ID_Creator = @ID_Creator
  250. , CreateDate_AttendanceResult = @CreateDate_AttendanceResult
  251. , LastModUser_AttendanceResult = @LastModUser_AttendanceResult
  252. , LastModDate_AttendanceResult = @LastModDate_AttendanceResult
  253. , ID_Assessor = @ID_Assessor
  254. , AssessDate_AttendanceResult = @AssessDate_AttendanceResult
  255. Where ID_AttendanceResult = @ID_AttendanceResult">
  256. <Params>
  257. <Param name="@ID_AttendanceResult" type="AttendanceResult.ID_AttendanceResult" sourceColumn="ID_AttendanceResult" />
  258. <Param name="@No_AttendanceResult" type="AttendanceResult.No_AttendanceResult" sourceColumn="No_AttendanceResult" />
  259. <Param name="@Begin_AttendanceResult" type="AttendanceResult.Begin_AttendanceResult" sourceColumn="Begin_AttendanceResult" />
  260. <Param name="@End_AttendanceResult" type="AttendanceResult.End_AttendanceResult" sourceColumn="End_AttendanceResult" />
  261. <Param name="@FactDays_AttendanceResult" type="AttendanceResult.FactDays_AttendanceResult" sourceColumn="FactDays_AttendanceResult" />
  262. <Param name="@ID_Department" type="AttendanceResult.ID_Department" sourceColumn="ID_Department" />
  263. <Param name="@Comment_AttendanceResult" type="AttendanceResult.Comment_AttendanceResult" sourceColumn="Comment_AttendanceResult" />
  264. <Param name="@ID_Creator" type="AttendanceResult.ID_Creator" sourceColumn="ID_Creator" />
  265. <Param name="@CreateDate_AttendanceResult" type="AttendanceResult.CreateDate_AttendanceResult" sourceColumn="CreateDate_AttendanceResult" />
  266. <Param name="@LastModUser_AttendanceResult" type="AttendanceResult.LastModUser_AttendanceResult" sourceColumn="LastModUser_AttendanceResult" />
  267. <Param name="@LastModDate_AttendanceResult" type="AttendanceResult.LastModDate_AttendanceResult" sourceColumn="LastModDate_AttendanceResult" />
  268. <Param name="@ID_Assessor" type="AttendanceResult.ID_Assessor" sourceColumn="ID_Assessor" />
  269. <Param name="@AssessDate_AttendanceResult" type="AttendanceResult.AssessDate_AttendanceResult" sourceColumn="AssessDate_AttendanceResult" />
  270. </Params>
  271. </Update>
  272. <Delete CmdType="Text" CmdText="Delete LaterOrLeaveearly Where ID_AttendanceResult = @ID_AttendanceResult
  273. Delete AttendanceResultData Where ID_AttendanceResult = @ID_AttendanceResult
  274. Delete AttendanceResult Where ID_AttendanceResult = @ID_AttendanceResult">
  275. <Params>
  276. <Param name="@ID_AttendanceResult" type="AttendanceResult.ID_AttendanceResult" sourceColumn="ID_AttendanceResult" />
  277. </Params>
  278. </Delete>
  279. <FKErrorReport ErrorMessage="该单据已被其他单据引用,删除失败!" />
  280. <UNIQUEErrorReport ErrorMessage="该考勤号已存在,提交失败!" />
  281. <Audit CmdType="Text" CmdText="Update AttendanceResult
  282. Set ID_Assessor = @ID_Assessor
  283. , AssessDate_AttendanceResult = @AssessDate_AttendanceResult
  284. Where ID_AttendanceResult = @ID_AttendanceResult">
  285. <Params>
  286. <Param name="@ID_AttendanceResult" type="AttendanceResult.ID_AttendanceResult" sourceColumn="ID_AttendanceResult" />
  287. <Param name="@ID_Assessor" type="AttendanceResult.ID_Assessor" sourceColumn="ID_Assessor" />
  288. <Param name="@AssessDate_AttendanceResult" type="AttendanceResult.AssessDate_AttendanceResult" sourceColumn="AssessDate_AttendanceResult" />
  289. </Params>
  290. </Audit>
  291. </Table>
  292. <Table name="AttendanceResultData" Type="Child">
  293. <GetSchema CmdType="Text" CmdText="Select Top 0 AttendanceResultData.*
  294. , No_Employee
  295. , Name_Employee
  296. From AttendanceResultData
  297. Left Join Employee On Employee.ID_Employee = AttendanceResultData.ID_Employee" />
  298. <New CmdType="Text" CmdText="Insert Into dbo.AttendanceResultData (ID_AttendanceResultData
  299. , ID_AttendanceResult
  300. , ID_Employee
  301. , WorkDays_AttendanceResultData
  302. , DutyDays_AttendanceResultData
  303. , OvertimeDays_AttendanceResultData
  304. , WeekendOtDays_AttendanceResultData
  305. , FeastOtDays_AttendanceResultData
  306. , EvectionDays_AttendanceResultData
  307. , AffairLeaveDays_AttendanceResultData
  308. , SickLeaveDays_AttendanceResultData
  309. , PayLeaveDays_AttendanceResultData
  310. , AbsentDays_AttendanceResultData
  311. , LaterTimes_AttendanceResultData
  312. , LaterMinutes_AttendanceResultData
  313. , EarlyLeaveTimes_AttendanceResultData
  314. , EarlyLeaveMinutes_AttendanceResultData
  315. , Comment_AttendanceResultData
  316. )
  317. Values (@ID_AttendanceResultData
  318. , @ID_AttendanceResult
  319. , @ID_Employee
  320. , @WorkDays_AttendanceResultData
  321. , @DutyDays_AttendanceResultData
  322. , @OvertimeDays_AttendanceResultData
  323. , @WeekendOtDays_AttendanceResultData
  324. , @FeastOtDays_AttendanceResultData
  325. , @EvectionDays_AttendanceResultData
  326. , @AffairLeaveDays_AttendanceResultData
  327. , @SickLeaveDays_AttendanceResultData
  328. , @PayLeaveDays_AttendanceResultData
  329. , @AbsentDays_AttendanceResultData
  330. , @LaterTimes_AttendanceResultData
  331. , @LaterMinutes_AttendanceResultData
  332. , @EarlyLeaveTimes_AttendanceResultData
  333. , @EarlyLeaveMinutes_AttendanceResultData
  334. , @Comment_AttendanceResultData
  335. )">
  336. <Params>
  337. <Param name="@ID_AttendanceResultData" type="AttendanceResultData.ID_AttendanceResultData" sourceColumn="ID_AttendanceResultData" />
  338. <Param name="@ID_AttendanceResult" type="AttendanceResultData.ID_AttendanceResult" sourceColumn="ID_AttendanceResult" />
  339. <Param name="@ID_Employee" type="AttendanceResultData.ID_Employee" sourceColumn="ID_Employee" />
  340. <Param name="@WorkDays_AttendanceResultData" type="AttendanceResultData.WorkDays_AttendanceResultData" sourceColumn="WorkDays_AttendanceResultData" />
  341. <Param name="@DutyDays_AttendanceResultData" type="AttendanceResultData.DutyDays_AttendanceResultData" sourceColumn="DutyDays_AttendanceResultData" />
  342. <Param name="@OvertimeDays_AttendanceResultData" type="AttendanceResultData.OvertimeDays_AttendanceResultData" sourceColumn="OvertimeDays_AttendanceResultData" />
  343. <Param name="@WeekendOtDays_AttendanceResultData" type="AttendanceResultData.WeekendOtDays_AttendanceResultData" sourceColumn="WeekendOtDays_AttendanceResultData" />
  344. <Param name="@FeastOtDays_AttendanceResultData" type="AttendanceResultData.FeastOtDays_AttendanceResultData" sourceColumn="FeastOtDays_AttendanceResultData" />
  345. <Param name="@EvectionDays_AttendanceResultData" type="AttendanceResultData.EvectionDays_AttendanceResultData" sourceColumn="EvectionDays_AttendanceResultData" />
  346. <Param name="@AffairLeaveDays_AttendanceResultData" type="AttendanceResultData.AffairLeaveDays_AttendanceResultData" sourceColumn="AffairLeaveDays_AttendanceResultData" />
  347. <Param name="@SickLeaveDays_AttendanceResultData" type="AttendanceResultData.SickLeaveDays_AttendanceResultData" sourceColumn="SickLeaveDays_AttendanceResultData" />
  348. <Param name="@PayLeaveDays_AttendanceResultData" type="AttendanceResultData.PayLeaveDays_AttendanceResultData" sourceColumn="PayLeaveDays_AttendanceResultData" />
  349. <Param name="@AbsentDays_AttendanceResultData" type="AttendanceResultData.AbsentDays_AttendanceResultData" sourceColumn="AbsentDays_AttendanceResultData" />
  350. <Param name="@LaterTimes_AttendanceResultData" type="AttendanceResultData.LaterTimes_AttendanceResultData" sourceColumn="LaterTimes_AttendanceResultData" />
  351. <Param name="@LaterMinutes_AttendanceResultData" type="AttendanceResultData.LaterMinutes_AttendanceResultData" sourceColumn="LaterMinutes_AttendanceResultData" />
  352. <Param name="@EarlyLeaveTimes_AttendanceResultData" type="AttendanceResultData.EarlyLeaveTimes_AttendanceResultData" sourceColumn="EarlyLeaveTimes_AttendanceResultData" />
  353. <Param name="@EarlyLeaveMinutes_AttendanceResultData" type="AttendanceResultData.EarlyLeaveMinutes_AttendanceResultData" sourceColumn="EarlyLeaveMinutes_AttendanceResultData" />
  354. <Param name="@Comment_AttendanceResultData" type="AttendanceResultData.Comment_AttendanceResultData" sourceColumn="Comment_AttendanceResultData" />
  355. </Params>
  356. </New>
  357. <Update CmdType="Text" CmdText="Update dbo.AttendanceResultData
  358. Set ID_AttendanceResult = @ID_AttendanceResult
  359. , ID_Employee = @ID_Employee
  360. , WorkDays_AttendanceResultData = @WorkDays_AttendanceResultData
  361. , DutyDays_AttendanceResultData = @DutyDays_AttendanceResultData
  362. , OvertimeDays_AttendanceResultData = @OvertimeDays_AttendanceResultData
  363. , WeekendOtDays_AttendanceResultData = @WeekendOtDays_AttendanceResultData
  364. , FeastOtDays_AttendanceResultData = @FeastOtDays_AttendanceResultData
  365. , EvectionDays_AttendanceResultData = @EvectionDays_AttendanceResultData
  366. , AffairLeaveDays_AttendanceResultData = @AffairLeaveDays_AttendanceResultData
  367. , SickLeaveDays_AttendanceResultData = @SickLeaveDays_AttendanceResultData
  368. , PayLeaveDays_AttendanceResultData = @PayLeaveDays_AttendanceResultData
  369. , AbsentDays_AttendanceResultData = @AbsentDays_AttendanceResultData
  370. , LaterTimes_AttendanceResultData = @LaterTimes_AttendanceResultData
  371. , LaterMinutes_AttendanceResultData = @LaterMinutes_AttendanceResultData
  372. , EarlyLeaveTimes_AttendanceResultData = @EarlyLeaveTimes_AttendanceResultData
  373. , EarlyLeaveMinutes_AttendanceResultData = @EarlyLeaveMinutes_AttendanceResultData
  374. , Comment_AttendanceResultData = @Comment_AttendanceResultData
  375. Where ID_AttendanceResultData = @ID_AttendanceResultData">
  376. <Params>
  377. <Param name="@ID_AttendanceResultData" type="AttendanceResultData.ID_AttendanceResultData" sourceColumn="ID_AttendanceResultData" />
  378. <Param name="@ID_AttendanceResult" type="AttendanceResultData.ID_AttendanceResult" sourceColumn="ID_AttendanceResult" />
  379. <Param name="@ID_Employee" type="AttendanceResultData.ID_Employee" sourceColumn="ID_Employee" />
  380. <Param name="@WorkDays_AttendanceResultData" type="AttendanceResultData.WorkDays_AttendanceResultData" sourceColumn="WorkDays_AttendanceResultData" />
  381. <Param name="@DutyDays_AttendanceResultData" type="AttendanceResultData.DutyDays_AttendanceResultData" sourceColumn="DutyDays_AttendanceResultData" />
  382. <Param name="@OvertimeDays_AttendanceResultData" type="AttendanceResultData.OvertimeDays_AttendanceResultData" sourceColumn="OvertimeDays_AttendanceResultData" />
  383. <Param name="@WeekendOtDays_AttendanceResultData" type="AttendanceResultData.WeekendOtDays_AttendanceResultData" sourceColumn="WeekendOtDays_AttendanceResultData" />
  384. <Param name="@FeastOtDays_AttendanceResultData" type="AttendanceResultData.FeastOtDays_AttendanceResultData" sourceColumn="FeastOtDays_AttendanceResultData" />
  385. <Param name="@EvectionDays_AttendanceResultData" type="AttendanceResultData.EvectionDays_AttendanceResultData" sourceColumn="EvectionDays_AttendanceResultData" />
  386. <Param name="@AffairLeaveDays_AttendanceResultData" type="AttendanceResultData.AffairLeaveDays_AttendanceResultData" sourceColumn="AffairLeaveDays_AttendanceResultData" />
  387. <Param name="@SickLeaveDays_AttendanceResultData" type="AttendanceResultData.SickLeaveDays_AttendanceResultData" sourceColumn="SickLeaveDays_AttendanceResultData" />
  388. <Param name="@PayLeaveDays_AttendanceResultData" type="AttendanceResultData.PayLeaveDays_AttendanceResultData" sourceColumn="PayLeaveDays_AttendanceResultData" />
  389. <Param name="@AbsentDays_AttendanceResultData" type="AttendanceResultData.AbsentDays_AttendanceResultData" sourceColumn="AbsentDays_AttendanceResultData" />
  390. <Param name="@LaterTimes_AttendanceResultData" type="AttendanceResultData.LaterTimes_AttendanceResultData" sourceColumn="LaterTimes_AttendanceResultData" />
  391. <Param name="@LaterMinutes_AttendanceResultData" type="AttendanceResultData.LaterMinutes_AttendanceResultData" sourceColumn="LaterMinutes_AttendanceResultData" />
  392. <Param name="@EarlyLeaveTimes_AttendanceResultData" type="AttendanceResultData.EarlyLeaveTimes_AttendanceResultData" sourceColumn="EarlyLeaveTimes_AttendanceResultData" />
  393. <Param name="@EarlyLeaveMinutes_AttendanceResultData" type="AttendanceResultData.EarlyLeaveMinutes_AttendanceResultData" sourceColumn="EarlyLeaveMinutes_AttendanceResultData" />
  394. <Param name="@Comment_AttendanceResultData" type="AttendanceResultData.Comment_AttendanceResultData" sourceColumn="Comment_AttendanceResultData" />
  395. </Params>
  396. </Update>
  397. <Delete CmdType="Text" CmdText="Delete AttendanceResultData Where ID_AttendanceResultData = @ID_AttendanceResultData">
  398. <Params>
  399. <Param name="@ID_AttendanceResultData" type="AttendanceResultData.ID_AttendanceResultData" sourceColumn="ID_AttendanceResultData" />
  400. </Params>
  401. </Delete>
  402. </Table>
  403. <Table name="LaterOrLeaveearly" Type="Child">
  404. <GetSchema CmdType="Text" CmdText="Select Top 0 LaterOrLeaveearly.*
  405. , No_Employee
  406. , Name_Employee
  407. From LaterOrLeaveearly
  408. Left Join Employee On Employee.ID_Employee = LaterOrLeaveearly.ID_Employee" />
  409. <New CmdType="Text" CmdText="Insert Into dbo.LaterOrLeaveearly (ID_LaterOrLeaveearly
  410. , ID_AttendanceResult
  411. , ID_Employee
  412. , Date_LaterOrLeaveearly
  413. , Minute_Later
  414. , Minute_Leaveearly
  415. )
  416. Values (@ID_LaterOrLeaveearly
  417. , @ID_AttendanceResult
  418. , @ID_Employee
  419. , @Date_LaterOrLeaveearly
  420. , @Minute_Later
  421. , @Minute_Leaveearly
  422. )">
  423. <Params>
  424. <Param name="@ID_LaterOrLeaveearly" type="LaterOrLeaveearly.ID_LaterOrLeaveearly" sourceColumn="ID_LaterOrLeaveearly" />
  425. <Param name="@ID_AttendanceResult" type="LaterOrLeaveearly.ID_AttendanceResult" sourceColumn="ID_AttendanceResult" />
  426. <Param name="@ID_Employee" type="LaterOrLeaveearly.ID_Employee" sourceColumn="ID_Employee" />
  427. <Param name="@Date_LaterOrLeaveearly" type="LaterOrLeaveearly.Date_LaterOrLeaveearly" sourceColumn="Date_LaterOrLeaveearly" />
  428. <Param name="@Minute_Later" type="LaterOrLeaveearly.Minute_Later" sourceColumn="Minute_Later" />
  429. <Param name="@Minute_Leaveearly" type="LaterOrLeaveearly.Minute_Leaveearly" sourceColumn="Minute_Leaveearly" />
  430. </Params>
  431. </New>
  432. <Update CmdType="Text" CmdText="Update dbo.LaterOrLeaveearly
  433. Set ID_AttendanceResult = @ID_AttendanceResult
  434. , ID_Employee = @ID_Employee
  435. , Date_LaterOrLeaveearly = @Date_LaterOrLeaveearly
  436. , Minute_Later = @Minute_Later
  437. , Minute_Leaveearly = @Minute_Leaveearly
  438. Where ID_LaterOrLeaveearly = @ID_LaterOrLeaveearly">
  439. <Params>
  440. <Param name="@ID_LaterOrLeaveearly" type="LaterOrLeaveearly.ID_LaterOrLeaveearly" sourceColumn="ID_LaterOrLeaveearly" />
  441. <Param name="@ID_AttendanceResult" type="LaterOrLeaveearly.ID_AttendanceResult" sourceColumn="ID_AttendanceResult" />
  442. <Param name="@ID_Employee" type="LaterOrLeaveearly.ID_Employee" sourceColumn="ID_Employee" />
  443. <Param name="@Date_LaterOrLeaveearly" type="LaterOrLeaveearly.Date_LaterOrLeaveearly" sourceColumn="Date_LaterOrLeaveearly" />
  444. <Param name="@Minute_Later" type="LaterOrLeaveearly.Minute_Later" sourceColumn="Minute_Later" />
  445. <Param name="@Minute_Leaveearly" type="LaterOrLeaveearly.Minute_Leaveearly" sourceColumn="Minute_Leaveearly" />
  446. </Params>
  447. </Update>
  448. <Delete CmdType="Text" CmdText="Delete LaterOrLeaveearly Where ID_LaterOrLeaveearly = @ID_LaterOrLeaveearly">
  449. <Params>
  450. <Param name="@ID_LaterOrLeaveearly" type="LaterOrLeaveearly.ID_LaterOrLeaveearly" sourceColumn="ID_LaterOrLeaveearly" />
  451. </Params>
  452. </Delete>
  453. </Table>
  454. </Tables>
  455. <Search>
  456. <SearchAttendanceResultWithNo CmdType="Text" CmdText="Declare @ID_AttendanceResult Uniqueidentifier
  457. Select @ID_AttendanceResult = ID_AttendanceResult
  458. From AttendanceResult
  459. Where No_AttendanceResult = @No_AttendanceResult
  460. Select AttendanceResult.*
  461. , a.Name_User AS Name_Creator
  462. , b.Name_User AS Name_Assessor
  463. , c.Name_User AS LastModUserName
  464. , Case AttendanceResult.ID_Department
  465. When '12345678-1234-1234-1234-123456789012' then '全部'
  466. else Name_Department end As Name_Department
  467. From AttendanceResult
  468. Left Join AppUser a On a.ID_User = AttendanceResult.ID_Creator
  469. Left Join AppUser b On b.ID_User = AttendanceResult.ID_Assessor
  470. Left Join AppUser c On c.ID_User = AttendanceResult.LastModUser_AttendanceResult
  471. Left Join Department On Department.ID_Department = AttendanceResult.ID_Department
  472. Where ID_AttendanceResult = @ID_AttendanceResult
  473. Select AttendanceResultData.*
  474. , No_Employee
  475. , Name_Employee
  476. From AttendanceResultData
  477. Left Join Employee On Employee.ID_Employee = AttendanceResultData.ID_Employee
  478. Where ID_AttendanceResult = @ID_AttendanceResult
  479. Select LaterOrLeaveearly.*
  480. , No_Employee
  481. , Name_Employee
  482. From LaterOrLeaveearly
  483. Left Join Employee On Employee.ID_Employee = LaterOrLeaveearly.ID_Employee
  484. Where ID_AttendanceResult = @ID_AttendanceResult">
  485. <Params>
  486. <Param name="@No_AttendanceResult" type="AttendanceResult.No_AttendanceResult" sourceColumn="No_AttendanceResult" />
  487. </Params>
  488. <Tables>
  489. <Table name="AttendanceResult" />
  490. <Table name="AttendanceResultData" />
  491. <Table name="LaterOrLeaveearly" />
  492. </Tables>
  493. </SearchAttendanceResultWithNo>
  494. <SearchAllDepartment CmdType="Text" CmdText="Select '12345678-1234-1234-1234-123456789012' As ID_Department
  495. , '全部' As Name_Department
  496. Union All
  497. Select ID_Department
  498. , Name_Department
  499. From Department">
  500. <Tables>
  501. <Table name="Department" />
  502. </Tables>
  503. </SearchAllDepartment>
  504. <SearchApplicationBill CmdType="Text" CmdText="
  505. Declare @ID_Applicant uniqueidentifier
  506. Declare @No_ApplicationBill nvarchar(64)
  507. Declare @Item_ApplicationBill nvarchar(64)
  508. Declare @StartDate_ApplicationBill datetime
  509. Declare @EndDate_ApplicationBill datetime
  510. Declare @OnStuffOne datetime
  511. Declare @OffStuffOne datetime
  512. Declare @OnStuffTwo datetime
  513. Declare @OffStuffTwo datetime
  514. Declare @AppHour decimal(14,1)
  515. Declare @LoopDate datetime
  516. Declare @ID_Department Uniqueidentifier
  517. Select @ID_Department = ID_Department
  518. From Department
  519. Where Name_Department = @Name_Department
  520. IF Exists (Select * From tempdb.dbo.sysobjects Where id=Object_ID(N'tempdb.dbo.#department'))
  521. DROP TABLE #department
  522. Create table #department
  523. (
  524. ID_Department Uniqueidentifier
  525. )
  526. if (@Name_Department = '全部')
  527. Insert Into #department Select ID_Department From Department
  528. else
  529. Insert Into #department Select ID_Department From Department Where Name_Department = @Name_Department
  530. IF Exists (Select * From tempdb.dbo.sysobjects Where id=Object_ID(N'tempdb.dbo.#TempApp'))
  531. DROP TABLE #TempApp
  532. Create Table #TempApp
  533. (
  534. ID_Applicant uniqueidentifier,
  535. Date varchar(10),
  536. OvertimeHour decimal(14,1),
  537. BusinessHour decimal(14,1),
  538. CompassionateHour decimal(14,1),
  539. SickHour decimal(14,1),
  540. SalaryHour decimal(14,1),
  541. exception bit,
  542. Comment nvarchar(256)
  543. )
  544. Declare cur cursor
  545. for
  546. Select ApplicationBillEmployee.ID_Employee As ID_Applicant,No_ApplicationBill,Item_ApplicationBill,StartDate_ApplicationBill,EndDate_ApplicationBill
  547. ,OnStuffOne,OffStuffOne,OnStuffTwo,OffStuffTwo
  548. From dbo.ApplicationBill
  549. Join dbo.ApplicationBillEmployee On ApplicationBillEmployee.ID_ApplicationBill=ApplicationBill.ID_ApplicationBill
  550. Join dbo.AttendanceRuleEmployee On ApplicationBillEmployee.ID_Employee=dbo.AttendanceRuleEmployee.ID_Employee
  551. Join dbo.AttendanceRule On AttendanceRuleEmployee.ID_AttendanceRule=AttendanceRule.ID_AttendanceRule
  552. Join Employee ON Employee.ID_Employee=dbo.AttendanceRuleEmployee.ID_Employee
  553. Where ApplicationBill.ID_Assessor Is Not Null
  554. --And No_Employee Between IsNull(@StartNo_Employee,No_Employee) And IsNull(@EndNo_Employee,No_Employee)
  555. And DateDiff(day,@StartDate,EndDate_ApplicationBill)&gt;=0 And DateDiff(day,@EndDate,StartDate_ApplicationBill) &lt;=0
  556. And Employee.ID_Department in (Select ID_Department From #department )
  557. Open cur
  558. Fetch Next From cur Into @ID_Applicant,@No_ApplicationBill,@Item_ApplicationBill,@StartDate_ApplicationBill,@EndDate_ApplicationBill
  559. ,@OnStuffOne,@OffStuffOne,@OnStuffTwo,@OffStuffTwo
  560. while @@fetch_status=0
  561. BEGIN
  562. Set @LoopDate=@StartDate_ApplicationBill
  563. while(DateDiff(day,@LoopDate,@EndDate_ApplicationBill)&gt;=0)
  564. BEGIN
  565. IF(DateDiff(day,@StartDate,@LoopDate)&gt;=0 and DateDiff(day,@EndDate,@LoopDate)&lt;=0)
  566. BEGIN
  567. IF(DateDiff(day,@StartDate_ApplicationBill,@LoopDate)&gt;0 and DateDiff(day,@EndDate_ApplicationBill,@LoopDate)&lt;0)
  568. Set @AppHour=Convert(decimal(14,1),(dbo.TimeDiff(@OnStuffOne,@OffStuffOne)+dbo.TimeDiff(@OnStuffTwo,@OffStuffTwo))/60.0)
  569. Else IF(DateDiff(day,@StartDate_ApplicationBill,@LoopDate)=0)
  570. BEGIN
  571. IF(DateDiff(day,@EndDate_ApplicationBill,@LoopDate)&lt;0)
  572. BEGIN
  573. IF(dbo.TimeDiff(@LoopDate,@OnStuffOne)&gt;0)
  574. Set @AppHour=Convert(decimal(14,1),(dbo.TimeDiff(@OnStuffOne,@OffStuffOne)+dbo.TimeDiff(@OnStuffTwo,@OffStuffTwo))/60.0)
  575. Else IF(dbo.TimeDiff(@StartDate_ApplicationBill,@OffStuffOne)&gt;0)
  576. Set @AppHour=Convert(decimal(14,1),(dbo.TimeDiff(@StartDate_ApplicationBill,@OffStuffOne)+dbo.TimeDiff(@OnStuffTwo,@OffStuffTwo))/60.0)
  577. else if(dbo.TimeDiff(@StartDate_ApplicationBill,@OnStuffTwo)&gt;0)
  578. Set @AppHour=dbo.TimeDiff(@OnStuffTwo,@OffStuffTwo)
  579. else if(dbo.TimeDiff(@StartDate_ApplicationBill,@OffStuffTwo)&gt;0)
  580. Set @AppHour=dbo.TimeDiff(@StartDate_ApplicationBill,@OffStuffTwo)/60.0
  581. else
  582. Set @AppHour=0
  583. END
  584. Else
  585. BEGIN
  586. IF(dbo.TimeDiff(@StartDate_ApplicationBill,@OnStuffOne)&gt;0)
  587. BEGIN
  588. IF(dbo.TimeDiff(@EndDate_ApplicationBill,@OnStuffOne)&gt;0)
  589. Set @AppHour=0
  590. Else IF (dbo.TimeDiff(@EndDate_ApplicationBill,@OffStuffOne)&gt;0)
  591. Set @AppHour=Convert(decimal(14,1),dbo.TimeDiff(@OnStuffOne,@EndDate_ApplicationBill)/60.0)
  592. Else if (dbo.TimeDiff(@EndDate_ApplicationBill,@OnStuffTwo)&gt;0)
  593. Set @AppHour=Convert(decimal(14,1),dbo.TimeDiff(@OnStuffOne,@OffStuffOne))
  594. else if(dbo.TimeDiff(@EndDate_ApplicationBill,@OffStuffTwo)&gt;0)
  595. Set @AppHour=Convert(decimal(14,1),(dbo.TimeDiff(@OnStuffOne,@OffStuffOne)+dbo.TimeDiff(@OnStuffTwo,@EndDate_ApplicationBill))/60.0)
  596. else
  597. Set @AppHour=Convert(decimal(14,1),(dbo.TimeDiff(@OnStuffOne,@OffStuffOne)+dbo.TimeDiff(@OnStuffTwo,@OffStuffTwo))/60.0)
  598. END
  599. Else IF(dbo.TimeDiff(@StartDate_ApplicationBill,@OffStuffOne)&gt;0)
  600. BEGIN
  601. IF (dbo.TimeDiff(@EndDate_ApplicationBill,@OffStuffOne)&gt;0)
  602. Set @AppHour=Convert(decimal(14,1),dbo.TimeDiff(@StartDate_ApplicationBill,@EndDate_ApplicationBill)/60.0)
  603. Else if (dbo.TimeDiff(@EndDate_ApplicationBill,@OnStuffTwo)&gt;0)
  604. Set @AppHour=Convert(decimal(14,1),dbo.TimeDiff(@StartDate_ApplicationBill,@OffStuffOne)/60.0)
  605. else if(dbo.TimeDiff(@EndDate_ApplicationBill,@OffStuffTwo)&gt;0)
  606. Set @AppHour=Convert(decimal(14,1),(dbo.TimeDiff(@StartDate_ApplicationBill,@OffStuffOne)+dbo.TimeDiff(@OnStuffTwo,@EndDate_ApplicationBill))/60.0)
  607. else
  608. Set @AppHour=Convert(decimal(14,1),(dbo.TimeDiff(@StartDate_ApplicationBill,@OffStuffOne)+dbo.TimeDiff(@OnStuffTwo,@OffStuffTwo))/60.0)
  609. END
  610. else if(dbo.TimeDiff(@StartDate_ApplicationBill,@OnStuffTwo)&gt;0)
  611. BEGIN
  612. IF (dbo.TimeDiff(@EndDate_ApplicationBill,@OnStuffTwo)&gt;0)
  613. Set @AppHour=0
  614. Else if (dbo.TimeDiff(@EndDate_ApplicationBill,@OffStuffTwo)&gt;0)
  615. Set @AppHour=Convert(decimal(14,1),dbo.TimeDiff(@OnStuffTwo,@EndDate_ApplicationBill)/60.0)
  616. else
  617. Set @AppHour=Convert(decimal(14,1),dbo.TimeDiff(@OnStuffTwo,@OffStuffTwo)/60.0)
  618. END
  619. else if(dbo.TimeDiff(@StartDate_ApplicationBill,@OffStuffTwo)&gt;0)
  620. BEGIN
  621. IF (dbo.TimeDiff(@EndDate_ApplicationBill,@OffStuffTwo)&gt;0)
  622. Set @AppHour=Convert(decimal(14,1),dbo.TimeDiff(@StartDate_ApplicationBill,@EndDate_ApplicationBill)/60.0)
  623. else
  624. Set @AppHour=Convert(decimal(14,1),dbo.TimeDiff(@StartDate_ApplicationBill,@OffStuffTwo)/60.0)
  625. END
  626. else
  627. Set @AppHour=0
  628. END
  629. END
  630. ELSE
  631. BEGIN
  632. IF(dbo.TimeDiff(@EndDate_ApplicationBill,@OnStuffOne)&gt;0)
  633. Set @AppHour=0
  634. Else IF(dbo.TimeDiff(@EndDate_ApplicationBill,@OffStuffOne)&gt;0)
  635. Set @AppHour=dbo.TimeDiff(@OnStuffOne,@EndDate_ApplicationBill)/60.0
  636. else if(dbo.TimeDiff(@EndDate_ApplicationBill,@OnStuffTwo)&gt;0)
  637. Set @AppHour=dbo.TimeDiff(@OnStuffOne,@OffStuffOne)/60.0
  638. else if(dbo.TimeDiff(@EndDate_ApplicationBill,@OffStuffTwo)&gt;0)
  639. Set @AppHour=Convert(decimal(14,1),(dbo.TimeDiff(@OnStuffOne,@OffStuffOne)+dbo.TimeDiff(@OnStuffTwo,@EndDate_ApplicationBill))/60.0)
  640. else
  641. Set @AppHour=Convert(decimal(14,1),(dbo.TimeDiff(@OnStuffOne,@OffStuffOne)+dbo.TimeDiff(@OnStuffTwo,@OffStuffTwo))/60.0)
  642. END
  643. IF(Not Exists (Select * From #TempApp Where ID_Applicant=@ID_Applicant And Date=convert(varchar(10),@LoopDate,120)))
  644. BEGIN
  645. IF(@Item_ApplicationBill='加班')
  646. Insert Into #TempApp(ID_Applicant,Date,OvertimeHour,Comment)
  647. Values(@ID_Applicant,convert(varchar(10),@LoopDate,120),@AppHour,'加班:'+@No_ApplicationBill)
  648. else if(@Item_ApplicationBill='出差')
  649. Insert Into #TempApp(ID_Applicant,Date,BusinessHour,Comment)
  650. Values(@ID_Applicant,convert(varchar(10),@LoopDate,120),@AppHour,'出差:'+@No_ApplicationBill)
  651. else if(@Item_ApplicationBill='事假')
  652. Insert Into #TempApp(ID_Applicant,Date,CompassionateHour,Comment)
  653. Values(@ID_Applicant,convert(varchar(10),@LoopDate,120),@AppHour,'事假:'+@No_ApplicationBill)
  654. else if(@Item_ApplicationBill='病假')
  655. Insert Into #TempApp(ID_Applicant,Date,SickHour,Comment)
  656. Values(@ID_Applicant,convert(varchar(10),@LoopDate,120),@AppHour,'病假:'+@No_ApplicationBill)
  657. else if(@Item_ApplicationBill='带薪假')
  658. Insert Into #TempApp(ID_Applicant,Date,SalaryHour,Comment)
  659. Values(@ID_Applicant,convert(varchar(10),@LoopDate,120),@AppHour,'带薪假:'+@No_ApplicationBill)
  660. else if(@Item_ApplicationBill='打卡异常')
  661. Insert Into #TempApp(ID_Applicant,Date,exception,Comment)
  662. Values(@ID_Applicant,convert(varchar(10),@LoopDate,120),1,'打卡异常:'+@No_ApplicationBill)
  663. END
  664. else
  665. Begin
  666. IF(@Item_ApplicationBill='加班')
  667. Update #TempApp Set OvertimeHour=IsNull(OvertimeHour,0)+@AppHour,Comment=Comment+' 加班:'+@No_ApplicationBill Where ID_Applicant=@ID_Applicant And Date=convert(varchar(10),@LoopDate,120)
  668. else if(@Item_ApplicationBill='出差')
  669. Update #TempApp Set BusinessHour=IsNull(BusinessHour,0)+@AppHour,Comment=Comment+' 出差:'+@No_ApplicationBill Where ID_Applicant=@ID_Applicant And Date=convert(varchar(10),@LoopDate,120)
  670. else if(@Item_ApplicationBill='事假')
  671. Update #TempApp Set CompassionateHour=IsNull(CompassionateHour,0)+@AppHour,Comment=Comment+' 事假:'+@No_ApplicationBill Where ID_Applicant=@ID_Applicant And Date=convert(varchar(10),@LoopDate,120)
  672. else if(@Item_ApplicationBill='病假')
  673. Update #TempApp Set SickHour=IsNull(SickHour,0)+@AppHour,Comment=Comment+' 病假:'+@No_ApplicationBill Where ID_Applicant=@ID_Applicant And Date=convert(varchar(10),@LoopDate,120)
  674. else if(@Item_ApplicationBill='带薪假')
  675. Update #TempApp Set SalaryHour=IsNull(SalaryHour,0)+@AppHour,Comment=Comment+' 带薪假:'+@No_ApplicationBill Where ID_Applicant=@ID_Applicant And Date=convert(varchar(10),@LoopDate,120)
  676. else if(@Item_ApplicationBill='打卡异常')
  677. Update #TempApp Set exception=1,Comment=Comment+' 打卡异常:'+@No_ApplicationBill Where ID_Applicant=@ID_Applicant And Date=convert(varchar(10),@LoopDate,120)
  678. End
  679. END
  680. Set @LoopDate=DateAdd(day,1,@LoopDate)
  681. END
  682. Fetch Next From cur Into @ID_Applicant,@No_ApplicationBill,@Item_ApplicationBill,@StartDate_ApplicationBill,@EndDate_ApplicationBill
  683. ,@OnStuffOne,@OffStuffOne,@OnStuffTwo,@OffStuffTwo
  684. END
  685. Close cur
  686. Deallocate cur
  687. ---------------------------------------------------------------------------------------------------
  688. IF Exists (Select * From tempdb.dbo.sysobjects Where id=Object_ID(N'tempdb.dbo.#Basic'))
  689. DROP TABLE #Basic
  690. Create Table #Basic
  691. (
  692. No_Employee nvarchar(64)
  693. ,Name_Employee nvarchar(64)
  694. ,Name_Department nvarchar(64)
  695. ,Date varchar(10)
  696. ,WeekDay nvarchar(8)
  697. ,Type_HolidaySetting nvarchar(64)
  698. ,Name_AttendanceRule nvarchar(64)
  699. ,StuffHour decimal(14,1)
  700. ,OnAttendance datetime
  701. ,OffAttendance datetime
  702. ,AttendanceHour decimal(14,1)
  703. ,OvertimeHour decimal(14,1)
  704. ,BusinessHour decimal(14,1)
  705. ,CompassionateHour decimal(14,1)
  706. ,SickHour decimal(14,1)
  707. ,SalaryHour decimal(14,1)
  708. ,AbsentHour decimal(14,1)
  709. ,ArriveLateMinute int
  710. ,LeaveEarlyMinute int
  711. ,Comment nvarchar(256)
  712. )
  713. Insert Into #Basic
  714. Select No_Employee,Name_Employee,Name_Department,EmployeeInfo.Date,case WeekDay_HolidaySetting when 1 then '日' when 2 then '一' when 3 then '二' when 4 then '三' when 5 then '四' when 6 then '五' else '六' end As WeekDay,Type_HolidaySetting,Name_AttendanceRule,StuffHour
  715. ,OnAttendance,OffAttendance
  716. --,OnAttendanceTwo,OffAttendanceTwo
  717. ,case Type_HolidaySetting when '工作日' then
  718. case when exception=1 then StuffHour
  719. else AttendanceHour end
  720. else null end As AttendanceHour
  721. ,case when #TempApp.OvertimeHour&gt;StuffHour then StuffHour
  722. else #TempApp.OvertimeHour end As OvertimeHour
  723. ,case when #TempApp.BusinessHour&gt;StuffHour then StuffHour
  724. else #TempApp.BusinessHour end As BusinessHour
  725. ,case when Type_HolidaySetting='工作日' then
  726. case when #TempApp.CompassionateHour&gt;StuffHour then StuffHour
  727. else #TempApp.CompassionateHour end
  728. else null end As CompassionateHour
  729. ,case when Type_HolidaySetting='工作日' then
  730. case when #TempApp.SickHour&gt;StuffHour then StuffHour
  731. else #TempApp.SickHour end
  732. else null end As SickHour
  733. ,case when Type_HolidaySetting='工作日' then
  734. case when #TempApp.SalaryHour&gt;StuffHour then StuffHour
  735. else #TempApp.SalaryHour end
  736. else null end As SalaryHour
  737. ,case when Type_HolidaySetting='工作日' then
  738. case when exception=1 then null
  739. else
  740. case when (StuffHour-IsNull(AttendanceHour,0)-IsNull(BusinessHour,0)-IsNull(CompassionateHour,0)-IsNull(SickHour,0)-IsNull(SalaryHour,0)
  741. -case when dbo.TimeDiff(OnStuffOne,OnAttendance) &lt;=30 and dbo.TimeDiff(OnStuffOne,OnAttendance)&gt;0 then dbo.TimeDiff(OnStuffOne,OnAttendance) else 0 end
  742. -case when dbo.TimeDiff(OffAttendance,OffStuffTwo)&lt;30 and dbo.TimeDiff(OffAttendance,OffStuffTwo)&gt;0 then dbo.TimeDiff(OffAttendance,OffStuffTwo) else 0 end ) &gt;0 then
  743. (StuffHour-IsNull(AttendanceHour,0)-IsNull(BusinessHour,0)-IsNull(CompassionateHour,0)-IsNull(SickHour,0)-IsNull(SalaryHour,0)
  744. -case when dbo.TimeDiff(OnStuffOne,OnAttendance) &lt;=30 and dbo.TimeDiff(OnStuffOne,OnAttendance)&gt;0 then dbo.TimeDiff(OnStuffOne,OnAttendance) else 0 end
  745. -case when dbo.TimeDiff(OffAttendance,OffStuffTwo)&lt;30 and dbo.TimeDiff(OffAttendance,OffStuffTwo)&gt;0 then dbo.TimeDiff(OffAttendance,OffStuffTwo) else 0 end )
  746. else null end
  747. end
  748. else null end As AbsentHour
  749. ,case when Type_HolidaySetting='工作日' And OnAttendance Is Not Null then
  750. case when exception=1 then null
  751. else
  752. case when dbo.TimeDiff(OnStuffOne,OnAttendance)&lt;=ArriveLate_AttendanceRule or dbo.TimeDiff(OnStuffOne,OnAttendance)&gt;30 then null
  753. else (dbo.TimeDiff(OnStuffOne,OnAttendance)-ArriveLate_AttendanceRule) end
  754. end
  755. else null end As ArriveLateMinute
  756. ,case when Type_HolidaySetting='工作日' And OnAttendance Is Not Null then
  757. case when exception=1 then null
  758. else
  759. case when dbo.TimeDiff(OffAttendance,OffStuffTwo)&lt;=LeaveEarly_AttendanceRule or dbo.TimeDiff(OffAttendance,OffStuffTwo)&gt;30 then null
  760. else dbo.TimeDiff(OffAttendance,OffStuffTwo)-LeaveEarly_AttendanceRule end
  761. end
  762. else null end As LeaveEarlyMinute
  763. ,Comment
  764. From
  765. (
  766. Select a.*,dbo.GetAttendanceHour(OnStuffOne,OffStuffOne,OnStuffTwo,OffStuffTwo,OnAttendance,OffAttendance) As AttendanceHour
  767. From
  768. (
  769. Select EmployeeCalendar.ID_Employee,No_Employee,Name_Employee,Name_Department,convert(varchar(10),Date_HolidaySetting,120) As Date,WeekDay_HolidaySetting,Type_HolidaySetting,Name_AttendanceRule
  770. ,(Select Top 1 Date_AttendanceRecord From dbo.AttendanceRecord Join Employee On Employee.CardNo_Employee=AttendanceRecord.No_Card Where Employee.ID_Employee=EmployeeCalendar.ID_Employee And DateDiff(day,Date_AttendanceRecord,EmployeeCalendar.Date_HolidaySetting)=0 Order By Date_AttendanceRecord) As OnAttendance
  771. ,(Select Top 1 Date_AttendanceRecord From dbo.AttendanceRecord Join Employee On Employee.CardNo_Employee=AttendanceRecord.No_Card Where Employee.ID_Employee=EmployeeCalendar.ID_Employee And DateDiff(day,Date_AttendanceRecord,EmployeeCalendar.Date_HolidaySetting)=0 Order By Date_AttendanceRecord desc) As OffAttendance
  772. ,OnStuffOne,OffStuffOne,OnStuffTwo,OffStuffTwo,ArriveLate_AttendanceRule,LeaveEarly_AttendanceRule,TakeOff_AttendanceRule
  773. ,Convert(decimal(14,1),(dbo.TimeDiff(OnStuffOne,OffStuffOne)+dbo.TimeDiff(OnStuffTwo,OffStuffTwo))/60.0) As StuffHour
  774. From
  775. (
  776. Select *
  777. From Employee,HolidaySetting
  778. --Where No_Employee Between IsNull(@StartNo_Employee,No_Employee) And IsNull(@EndNo_Employee,No_Employee)
  779. Where DateDiff(day,@StartDate,Date_HolidaySetting)&gt;=0 And DateDiff(day,@EndDate,Date_HolidaySetting)&lt;=0
  780. And Employee.ID_Department in (Select ID_Department From #department )
  781. )EmployeeCalendar
  782. Left Join Department On Department.ID_Department=EmployeeCalendar.ID_Department
  783. Join dbo.AttendanceRuleEmployee On AttendanceRuleEmployee.ID_Employee=EmployeeCalendar.ID_Employee
  784. Left Join dbo.AttendanceRule On AttendanceRule.ID_AttendanceRule=dbo.AttendanceRuleEmployee.ID_AttendanceRule
  785. )a
  786. )EmployeeInfo
  787. Left Join #TempApp On #TempApp.ID_Applicant=EmployeeInfo.ID_Employee And #TempApp.Date=EmployeeInfo.Date
  788. -------------------------------------------------------------------------------------------
  789. Select No_Employee,Name_Employee
  790. ,IsNull(Sum(case Type_HolidaySetting when '工作日' then 1 end),0) As WorkDays_AttendanceResultData --工作日
  791. ,IsNull(Sum(case when AttendanceHour Is Not Null then
  792. case when AttendanceHour&gt;StuffHour then StuffHour else AttendanceHour end
  793. end)/StuffHour,0) As DutyDays_AttendanceResultData --出勤天数
  794. ,IsNull(Sum(case Type_HolidaySetting when '工作日' then OvertimeHour end)/StuffHour,0) As OvertimeDays_AttendanceResultData --平时加班天数
  795. ,IsNull(Sum(case Type_HolidaySetting when '周末' then OvertimeHour end)/StuffHour,0) As WeekendOtDays_AttendanceResultData --周末加班天数
  796. ,IsNull(Sum(case Type_HolidaySetting when '节日' then OvertimeHour end)/StuffHour,0) As FeastOtDays_AttendanceResultData --节日加班天数
  797. ,IsNull(Sum(BusinessHour)/StuffHour,0) As EvectionDays_AttendanceResultData --出差天数
  798. ,IsNull(Sum(CompassionateHour)/StuffHour,0) As AffairLeaveDays_AttendanceResultData --事假天数
  799. ,IsNull(Sum(SickHour)/StuffHour,0) As SickLeaveDays_AttendanceResultData --病假天数
  800. ,IsNull(Sum(SalaryHour)/StuffHour,0) As PayLeaveDays_AttendanceResultData --带薪假天数
  801. ,IsNull(Sum(AbsentHour)/StuffHour,0) As AbsentDays_AttendanceResultData --旷工天数
  802. ,IsNull(Sum(case when ArriveLateMinute is Not Null then 1 end),0) As LaterTimes_AttendanceResultData --迟到次数
  803. ,IsNull(Sum(ArriveLateMinute),0) As LaterMinutes_AttendanceResultData --迟到分钟
  804. ,IsNull(Sum(case when LeaveEarlyMinute is Not Null then 1 end),0) As EarlyLeaveTimes_AttendanceResultData --早退次数
  805. ,IsNull(Sum(LeaveEarlyMinute),0) As EarlyLeaveMinutes_AttendanceResultData --早退分钟
  806. From
  807. #Basic
  808. Group By No_Employee,Name_Employee,StuffHour
  809. Select No_Employee,Name_Employee,IsNull(Date,0) As Date_LaterOrLeaveearly,IsNull(ArriveLateMinute,0) As Minute_Later,IsNull(LeaveEarlyMinute,0) As Minute_Leaveearly
  810. From
  811. #Basic
  812. Where ArriveLateMinute Is Not Null Or LeaveEarlyMinute Is Not Null
  813. Order By No_Employee,Date
  814. drop table #department
  815. ">
  816. <Params>
  817. <Param name="@StartDate" type="SaleBill.Date_SaleBill" Index="0" />
  818. <Param name="@EndDate" type="SaleBill.Date_SaleBill" Index="1" />
  819. <Param name="@Name_Department" type="Department.Name_Department" Index="2" />
  820. </Params>
  821. <Tables>
  822. <Table name="ApplicationBill" />
  823. <Table name="Basic" />
  824. </Tables>
  825. </SearchApplicationBill>
  826. <SearchEmployeeID CmdType="Text" CmdText="Select ID_Employee From Employee Where No_Employee = @No_Employee">
  827. <Params>
  828. <Param name="@No_Employee" type="Employee.No_Employee" sourceColumn="No_Employee" />
  829. </Params>
  830. <Tables>
  831. <Table name="EmployeeID" />
  832. </Tables>
  833. </SearchEmployeeID>
  834. <SearchAttendanceResultByNoFirst CmdType="Text" CmdText="
  835. Declare @ID_AttendanceResult Uniqueidentifier
  836. Select Top 1 @ID_AttendanceResult = ID_AttendanceResult
  837. From AttendanceResult
  838. Order By AttendanceResult.No_AttendanceResult
  839. Select AttendanceResult.*
  840. , a.Name_User AS Name_Creator
  841. , b.Name_User AS Name_Assessor
  842. , c.Name_User AS LastModUserName
  843. , Case AttendanceResult.ID_Department
  844. When '12345678-1234-1234-1234-123456789012' then '全部'
  845. else Name_Department end As Name_Department
  846. From AttendanceResult
  847. Left Join AppUser a On a.ID_User = AttendanceResult.ID_Creator
  848. Left Join AppUser b On b.ID_User = AttendanceResult.ID_Assessor
  849. Left Join AppUser c On c.ID_User = AttendanceResult.LastModUser_AttendanceResult
  850. Left Join Department On Department.ID_Department = AttendanceResult.ID_Department
  851. Where ID_AttendanceResult = @ID_AttendanceResult
  852. Select AttendanceResultData.*
  853. , No_Employee
  854. , Name_Employee
  855. From AttendanceResultData
  856. Left Join Employee On Employee.ID_Employee = AttendanceResultData.ID_Employee
  857. Where ID_AttendanceResult = @ID_AttendanceResult
  858. Select LaterOrLeaveearly.*
  859. , No_Employee
  860. , Name_Employee
  861. From LaterOrLeaveearly
  862. Left Join Employee On Employee.ID_Employee = LaterOrLeaveearly.ID_Employee
  863. Where ID_AttendanceResult = @ID_AttendanceResult">
  864. <Params>
  865. <Param name="@No_AttendanceResult" type="AttendanceResult.No_AttendanceResult" sourceColumn="No_AttendanceResult" />
  866. </Params>
  867. <Tables>
  868. <Table name="AttendanceResult" />
  869. <Table name="AttendanceResultData" />
  870. <Table name="LaterOrLeaveearly" />
  871. </Tables>
  872. </SearchAttendanceResultByNoFirst>
  873. <SearchAttendanceResultByNoPrevious CmdType="Text" CmdText="Declare @ID_AttendanceResult Uniqueidentifier
  874. Select Top 1 @ID_AttendanceResult = ID_AttendanceResult
  875. From AttendanceResult
  876. Where AttendanceResult.No_AttendanceResult &lt; @No_AttendanceResult
  877. Order By AttendanceResult.No_AttendanceResult Desc
  878. Select AttendanceResult.*
  879. , a.Name_User AS Name_Creator
  880. , b.Name_User AS Name_Assessor
  881. , c.Name_User AS LastModUserName
  882. , Case AttendanceResult.ID_Department
  883. When '12345678-1234-1234-1234-123456789012' then '全部'
  884. else Name_Department end As Name_Department
  885. From AttendanceResult
  886. Left Join AppUser a On a.ID_User = AttendanceResult.ID_Creator
  887. Left Join AppUser b On b.ID_User = AttendanceResult.ID_Assessor
  888. Left Join AppUser c On c.ID_User = AttendanceResult.LastModUser_AttendanceResult
  889. Left Join Department On Department.ID_Department = AttendanceResult.ID_Department
  890. Where ID_AttendanceResult = @ID_AttendanceResult
  891. Select AttendanceResultData.*
  892. , No_Employee
  893. , Name_Employee
  894. From AttendanceResultData
  895. Left Join Employee On Employee.ID_Employee = AttendanceResultData.ID_Employee
  896. Where ID_AttendanceResult = @ID_AttendanceResult
  897. Select LaterOrLeaveearly.*
  898. , No_Employee
  899. , Name_Employee
  900. From LaterOrLeaveearly
  901. Left Join Employee On Employee.ID_Employee = LaterOrLeaveearly.ID_Employee
  902. Where ID_AttendanceResult = @ID_AttendanceResult">
  903. <Params>
  904. <Param name="@No_AttendanceResult" type="AttendanceResult.No_AttendanceResult" sourceColumn="No_AttendanceResult" />
  905. </Params>
  906. <Tables>
  907. <Table name="AttendanceResult" />
  908. <Table name="AttendanceResultData" />
  909. <Table name="LaterOrLeaveearly" />
  910. </Tables>
  911. </SearchAttendanceResultByNoPrevious>
  912. <SearchAttendanceResultByNoNext CmdType="Text" CmdText="Declare @ID_AttendanceResult Uniqueidentifier
  913. Select Top 1 @ID_AttendanceResult = ID_AttendanceResult
  914. From AttendanceResult
  915. Where AttendanceResult.No_AttendanceResult &gt; @No_AttendanceResult
  916. ORDER BY AttendanceResult.No_AttendanceResult
  917. Select AttendanceResult.*
  918. , a.Name_User AS Name_Creator
  919. , b.Name_User AS Name_Assessor
  920. , c.Name_User AS LastModUserName
  921. , Case AttendanceResult.ID_Department
  922. When '12345678-1234-1234-1234-123456789012' then '全部'
  923. else Name_Department end As Name_Department
  924. From AttendanceResult
  925. Left Join AppUser a On a.ID_User = AttendanceResult.ID_Creator
  926. Left Join AppUser b On b.ID_User = AttendanceResult.ID_Assessor
  927. Left Join AppUser c On c.ID_User = AttendanceResult.LastModUser_AttendanceResult
  928. Left Join Department On Department.ID_Department = AttendanceResult.ID_Department
  929. Where ID_AttendanceResult = @ID_AttendanceResult
  930. Select AttendanceResultData.*
  931. , No_Employee
  932. , Name_Employee
  933. From AttendanceResultData
  934. Left Join Employee On Employee.ID_Employee = AttendanceResultData.ID_Employee
  935. Where ID_AttendanceResult = @ID_AttendanceResult
  936. Select LaterOrLeaveearly.*
  937. , No_Employee
  938. , Name_Employee
  939. From LaterOrLeaveearly
  940. Left Join Employee On Employee.ID_Employee = LaterOrLeaveearly.ID_Employee
  941. Where ID_AttendanceResult = @ID_AttendanceResult">
  942. <Params>
  943. <Param name="@No_AttendanceResult" type="AttendanceResult.No_AttendanceResult" sourceColumn="No_AttendanceResult" />
  944. </Params>
  945. <Tables>
  946. <Table name="AttendanceResult" />
  947. <Table name="AttendanceResultData" />
  948. <Table name="LaterOrLeaveearly" />
  949. </Tables>
  950. </SearchAttendanceResultByNoNext>
  951. <SearchAttendanceResultByNoLast CmdType="Text" CmdText="Declare @ID_AttendanceResult Uniqueidentifier
  952. Select Top 1 @ID_AttendanceResult = ID_AttendanceResult
  953. From AttendanceResult
  954. Order By AttendanceResult.No_AttendanceResult desc
  955. Select AttendanceResult.*
  956. , a.Name_User AS Name_Creator
  957. , b.Name_User AS Name_Assessor
  958. , c.Name_User AS LastModUserName
  959. , Case AttendanceResult.ID_Department
  960. When '12345678-1234-1234-1234-123456789012' then '全部'
  961. else Name_Department end As Name_Department
  962. From AttendanceResult
  963. Left Join AppUser a On a.ID_User = AttendanceResult.ID_Creator
  964. Left Join AppUser b On b.ID_User = AttendanceResult.ID_Assessor
  965. Left Join AppUser c On c.ID_User = AttendanceResult.LastModUser_AttendanceResult
  966. Left Join Department On Department.ID_Department = AttendanceResult.ID_Department
  967. Where ID_AttendanceResult = @ID_AttendanceResult
  968. Select AttendanceResultData.*
  969. , No_Employee
  970. , Name_Employee
  971. From AttendanceResultData
  972. Left Join Employee On Employee.ID_Employee = AttendanceResultData.ID_Employee
  973. Where ID_AttendanceResult = @ID_AttendanceResult
  974. Select LaterOrLeaveearly.*
  975. , No_Employee
  976. , Name_Employee
  977. From LaterOrLeaveearly
  978. Left Join Employee On Employee.ID_Employee = LaterOrLeaveearly.ID_Employee
  979. Where ID_AttendanceResult = @ID_AttendanceResult">
  980. <Params>
  981. <Param name="@No_AttendanceResult" type="AttendanceResult.No_AttendanceResult" sourceColumn="No_AttendanceResult" />
  982. </Params>
  983. <Tables>
  984. <Table name="AttendanceResult" />
  985. <Table name="AttendanceResultData" />
  986. <Table name="LaterOrLeaveearly" />
  987. </Tables>
  988. </SearchAttendanceResultByNoLast>
  989. </Search>
  990. </Server>
  991. <Lables>
  992. <Search>
  993. Empty();
  994. NewInstance();
  995. tbNo.ReadOnly = false;
  996. cbDept.Enabled = false;
  997. dtStart.Enabled = false;
  998. dtEnd.Enabled = false;
  999. txtComment.ReadOnly = true;
  1000. txtCreator.ReadOnly = true;
  1001. dttCreateDate.ReadOnly = true;
  1002. txtAssessor.ReadOnly = true;
  1003. dtAssessDate.ReadOnly = true;
  1004. txtLastModUser.ReadOnly = true;
  1005. dtLastModDate.ReadOnly = true;
  1006. btnSearch.Enabled = false;
  1007. ikDataGridEx2.ReadOnly = true;
  1008. ikDataGridEx1.ReadOnly = true;
  1009. toolBar.EnableSubmit=false;
  1010. toolBar.EnableModify=false;
  1011. toolBar.EnableDelete=false;
  1012. toolBar.EnableAudit = false;
  1013. toolBar.EnableUnAudit = false;
  1014. #AttendanceResult.CreateDate_AttendanceResult=DBNull();
  1015. #AttendanceResult.LastModUser_AttendanceResult=DBNull();
  1016. #AttendanceResult.LastModDate_AttendanceResult=DBNull();
  1017. UpdateForm(true, "");
  1018. tbNo.Focus();
  1019. @Status=0;
  1020. </Search>
  1021. <New>
  1022. Empty();
  1023. NewInstance();
  1024. tbNo.ReadOnly = true;
  1025. cbDept.Enabled = true;
  1026. dtStart.Enabled = true;
  1027. dtEnd.Enabled = true;
  1028. txtComment.ReadOnly = false;
  1029. txtCreator.ReadOnly = true;
  1030. dttCreateDate.ReadOnly = true;
  1031. txtAssessor.ReadOnly = true;
  1032. dtAssessDate.ReadOnly = true;
  1033. txtLastModUser.ReadOnly = true;
  1034. dtLastModDate.ReadOnly = true;
  1035. btnSearch.Enabled = true;
  1036. ikDataGridEx2.ReadOnly = false;
  1037. ikDataGridEx1.ReadOnly = false;
  1038. toolBar.EnableSubmit=GetRight(@Title,"新增");
  1039. toolBar.EnableModify=false;
  1040. toolBar.EnableDelete=false;
  1041. toolBar.EnableAudit = false;
  1042. toolBar.EnableUnAudit = false;
  1043. #AttendanceResult.No_AttendanceResult=tbNo.CValue;
  1044. #AttendanceResult.Name_Creator=GetCurrentUser();
  1045. #AttendanceResult.ID_AttendanceResult=NewGuid();
  1046. #AttendanceResult.ID_Creator=GetLoginUserID();
  1047. #AttendanceResult.CreateDate_AttendanceResult=DateTimeNow();
  1048. #AttendanceResult.LastModUser_AttendanceResult=DBNull();
  1049. #AttendanceResult.LastModDate_AttendanceResult=DBNull();
  1050. #AttendanceResult.ID_Assessor = DBNull();
  1051. #AttendanceResult.Name_Assessor = DBNull();
  1052. #AttendanceResult.AssessDate_AttendanceResult = DBNull();
  1053. UpdateForm(true, "");
  1054. @Status=1;
  1055. </New>
  1056. <View>
  1057. tbNo.ReadOnly = true;
  1058. cbDept.Enabled = false;
  1059. dtStart.Enabled = false;
  1060. dtEnd.Enabled = false;
  1061. txtComment.ReadOnly = true;
  1062. txtCreator.ReadOnly = true;
  1063. dttCreateDate.ReadOnly = true;
  1064. txtAssessor.ReadOnly = true;
  1065. dtAssessDate.ReadOnly = true;
  1066. txtLastModUser.ReadOnly = true;
  1067. dtLastModDate.ReadOnly = true;
  1068. btnSearch.Enabled = false;
  1069. ikDataGridEx2.ReadOnly = true;
  1070. ikDataGridEx1.ReadOnly = true;
  1071. toolBar.EnableSubmit=false;
  1072. if(Equals(#AttendanceResult.ID_Assessor,DBNull()))
  1073. {
  1074. toolBar.EnableModify = GetRight(@Title,"修改");
  1075. toolBar.EnableDelete = GetRight(@Title,"删除");
  1076. toolBar.EnableAudit = GetRight(@Title,"审核");;
  1077. toolBar.EnableUnAudit = false;
  1078. }
  1079. else
  1080. {
  1081. toolBar.EnableModify = false;
  1082. toolBar.EnableDelete = false;
  1083. toolBar.EnableAudit = false;
  1084. toolBar.EnableUnAudit = GetRight(@Title,"取消审核");
  1085. }
  1086. UpdateForm(true, "");
  1087. @Status=2;
  1088. </View>
  1089. <Modify>
  1090. tbNo.ReadOnly = true;
  1091. cbDept.Enabled = true;
  1092. dtStart.Enabled = true;
  1093. dtEnd.Enabled = true;
  1094. txtComment.ReadOnly = false;
  1095. txtCreator.ReadOnly = true;
  1096. dttCreateDate.ReadOnly = true;
  1097. txtAssessor.ReadOnly = true;
  1098. dtAssessDate.ReadOnly = true;
  1099. txtLastModUser.ReadOnly = true;
  1100. dtLastModDate.ReadOnly = true;
  1101. btnSearch.Enabled = true;
  1102. ikDataGridEx2.ReadOnly = false;
  1103. ikDataGridEx1.ReadOnly = false;
  1104. toolBar.EnableSubmit = GetRight(@Title,"新增");
  1105. toolBar.EnableModify = false;
  1106. toolBar.EnableDelete = false;
  1107. toolBar.EnableAudit = false;
  1108. toolBar.EnableUnAudit = false;
  1109. #AttendanceResult.LastModUser_AttendanceResult = GetLoginUserID();
  1110. #AttendanceResult.LastModUserName = GetCurrentUser();
  1111. #AttendanceResult.LastModDate_AttendanceResult = DateTimeNow();
  1112. UpdateForm(true, "");
  1113. @Status = 3;
  1114. </Modify>
  1115. <SubmitButtonClick>
  1116. <![CDATA[
  1117. if (dtStart.CValue == "")
  1118. {
  1119. MessageBox("请输入考勤开始日!",@Title);
  1120. dtStart.Focus();
  1121. return;
  1122. }
  1123. if (dtEnd.CValue == "")
  1124. {
  1125. MessageBox("请输入考勤结束日!",@Title);
  1126. dtEnd.Focus();
  1127. return;
  1128. }
  1129. if(cbDept.SelectedName=="")
  1130. {
  1131. MessageBox("请输入考勤部门!",@Title);
  1132. cbDept.Focus();
  1133. return;
  1134. }
  1135. UpdateForm(false, "");
  1136. SuspendLayout();
  1137. for (@i=0;@i < RowCount("#AttendanceResultData");@i=@i+1)
  1138. {
  1139. SetPosition("#AttendanceResultData", @i);
  1140. Search("SearchEmployeeID",#AttendanceResultData.No_Employee);
  1141. #AttendanceResultData.ID_Employee = #EmployeeID.ID_Employee;
  1142. if (Equals(#AttendanceResultData.ID_AttendanceResultData,GuidEmpty()))
  1143. #AttendanceResultData.ID_AttendanceResultData = NewGuid();
  1144. #AttendanceResultData.ID_AttendanceResult = #AttendanceResult.ID_AttendanceResult;
  1145. }
  1146. for (@i=0;@i < RowCount("#LaterOrLeaveearly");@i=@i+1)
  1147. {
  1148. SetPosition("#LaterOrLeaveearly", @i);
  1149. Search("SearchEmployeeID",#LaterOrLeaveearly.No_Employee);
  1150. #LaterOrLeaveearly.ID_Employee = #EmployeeID.ID_Employee;
  1151. if (Equals(#LaterOrLeaveearly.ID_LaterOrLeaveearly,GuidEmpty()))
  1152. #LaterOrLeaveearly.ID_LaterOrLeaveearly = NewGuid();
  1153. #LaterOrLeaveearly.ID_AttendanceResult = #AttendanceResult.ID_AttendanceResult;
  1154. }
  1155. ResumeLayout();
  1156. if(@Status == 1)
  1157. {
  1158. #AttendanceResult.CreateDate_AttendanceResult=GetCurrentTime();
  1159. New();
  1160. }
  1161. else if(@Status == 3)
  1162. {
  1163. #AttendanceResult.LastModDate_AttendanceResult=GetCurrentTime();
  1164. Update();
  1165. }
  1166. ChangeMode("View");
  1167. ]]>
  1168. </SubmitButtonClick>
  1169. </Lables>
  1170. </Form>
  1171. </Forms>