FrmPayAccount.xml 101 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <Forms>
  3. <Form Name="FrmPayAccount">
  4. <Client>
  5. <Events>
  6. <Load>
  7. <![CDATA[
  8. @Title="薪资计算";
  9. GetSchema();
  10. ChangeMode("Search");
  11. Search("SearchDepartment");
  12. ]]>
  13. </Load>
  14. <Closing>
  15. ;<!--TODO-->
  16. </Closing>
  17. <Closed>
  18. ;<!--TODO-->
  19. </Closed>
  20. </Events>
  21. <Mode>
  22. <Search>
  23. <Lable name="Search" />
  24. </Search>
  25. <New>
  26. <Lable name="New" />
  27. </New>
  28. <View>
  29. <Lable name="View" />
  30. </View>
  31. <Modify>
  32. <Lable name="Modify" />
  33. </Modify>
  34. </Mode>
  35. <Controls>
  36. <IKTextButton name="tbNo" DataSource="PayAccount.No_AttendanceResult">
  37. <Events>
  38. <Enter>
  39. <![CDATA[
  40. if(tbNo.CValue != StringEmpty())
  41. {
  42. UpdateForm(false, "");
  43. if(Search("SearchPayAccount",tbNo.CValue))
  44. {
  45. Search("SearchFactDays",#PayAccount.Begin_AttendanceResult,#PayAccount.End_AttendanceResult);
  46. #PayAccount.FactDays_AttendanceResult = #FactDays.WorkDays_AttendanceResultData;
  47. ChangeMode("View");
  48. }
  49. else
  50. {
  51. if(Search("SearchAttendanceResult",tbNo.CValue))
  52. {
  53. if (Equals(#AttendanceResult.ID_Assessor,DBNull()))
  54. {
  55. MessageBox("该考勤资料结转未审核!",@Title);
  56. }
  57. else
  58. {
  59. ChangeMode("New");
  60. #PayAccount.ID_AttendanceResult = #AttendanceResult.ID_AttendanceResult;
  61. #PayAccount.No_AttendanceResult = #AttendanceResult.No_AttendanceResult;
  62. #PayAccount.Name_Department = #AttendanceResult.Name_Department;
  63. #PayAccount.Begin_AttendanceResult = #AttendanceResult.Begin_AttendanceResult;
  64. #PayAccount.End_AttendanceResult = #AttendanceResult.End_AttendanceResult;
  65. #PayAccount.PayDays_PayAccount = #AttendanceResult.PayDays_PayAccount;
  66. Search("SearchFactDays",#PayAccount.Begin_AttendanceResult,#PayAccount.End_AttendanceResult);
  67. #PayAccount.FactDays_AttendanceResult = #FactDays.WorkDays_AttendanceResultData;
  68. MergeTable("#AttendanceResultData","#PayAccountData");
  69. UpdateForm(true, "");
  70. }
  71. }
  72. else
  73. MessageBox("该考勤编号不存在!",@Title);
  74. }
  75. }
  76. else
  77. {
  78. MessageBox("请输入考勤编号!",@Title);
  79. }
  80. ]]>
  81. </Enter>
  82. </Events>
  83. </IKTextButton>
  84. <IKComboBoxEx name="cbDept" DisplaySource="PayAccount.Name_Department" ValueSource="PayAccount.Name_Department" DataSource="Department" DisplayMember="Name_Department" ValueMember="Name_Department">
  85. <Events>
  86. <Reload>
  87. UpdateForm(false, "cbDept");
  88. Search("SearchDepartment");
  89. UpdateForm(true, "cbDept");
  90. </Reload>
  91. </Events>
  92. </IKComboBoxEx>
  93. <IKDateTimePicker name="dtStart" DataSource="PayAccount.Begin_AttendanceResult"/>
  94. <IKDateTimePicker name="dtEnd" DataSource="PayAccount.End_AttendanceResult"/>
  95. <IKTextBox name="txtDate" DataSource="PayAccount.FactDays_AttendanceResult"/>
  96. <IKTextBox name="ikTextBox1" DataSource="PayAccount.PayDays_PayAccount"/>
  97. <IKTextBox name="txtCreator" DataSource="PayAccount.Name_Creator"></IKTextBox>
  98. <IKDateTimeText name="dttCreateDate" DataSource="PayAccount.CreateDate_PayAccount"></IKDateTimeText>
  99. <IKTextBox name="txtAssessor" DataSource="PayAccount.Name_Assessor"></IKTextBox>
  100. <IKDateTimeText name="dtAssessDate" DataSource="PayAccount.AssessDate_PayAccount"></IKDateTimeText>
  101. <IKTextBox name="txtLastModUser" DataSource="PayAccount.LastModUserName"></IKTextBox>
  102. <IKDateTimeText name="dtLastModDate" DataSource="PayAccount.LastModDate_PayAccount"></IKDateTimeText>
  103. <IKButton name="btnSearch">
  104. <Events>
  105. <Click>
  106. <![CDATA[
  107. SuspendLayout();
  108. for (@i=0;@i<RowCount("#PayAccountData");@i=@i+1)
  109. {
  110. SetPosition("#PayAccountData", @i);
  111. if (Search("SearchEmployee",#PayAccountData.ID_Employee))
  112. {
  113. if (Search("SearchPayBase",#Employee.PayLevel_Employee))
  114. {
  115. if (#Employee.OnDuty_Employee <= #PayAccount.Begin_AttendanceResult)
  116. {
  117. #PayAccountData.BasicPay_PayAccountData = (#PayBase.Value_PayBase + #Employee.DutySubsidy_Employee);
  118. }
  119. if (#Employee.OnDuty_Employee >= #PayAccount.End_AttendanceResult)
  120. {
  121. #PayAccountData.BasicPay_PayAccountData = (#PayBase.Value_PayBase + #Employee.DutySubsidy_Employee) * 0.8;
  122. }
  123. if (#Employee.OnDuty_Employee > #PayAccount.Begin_AttendanceResult && #Employee.OnDuty_Employee < #PayAccount.End_AttendanceResult)
  124. {
  125. Search("Searchdays",#Employee.OnDuty_Employee,#PayAccount.Begin_AttendanceResult,#PayAccount.End_AttendanceResult);
  126. #PayAccountData.BasicPay_PayAccountData = (#PayBase.Value_PayBase + #Employee.DutySubsidy_Employee) * #days.FrontPart / #days.AllPart * .8
  127. + (#PayBase.Value_PayBase + #Employee.DutySubsidy_Employee) * (1 - #days.FrontPart / #days.AllPart);
  128. }
  129. }
  130. }
  131. Search("SearchAttendanceResultData",#PayAccount.No_AttendanceResult,#PayAccountData.ID_Employee);
  132. #PayAccountData.OvertimePay_PayAccountData = #PayAccountData.BasicPay_PayAccountData / #PayAccount.PayDays_PayAccount * (#AttendanceResultData.OvertimeDays_AttendanceResultData + #AttendanceResultData.WeekendOtDays_AttendanceResultData * 2 + #AttendanceResultData.FeastOtDays_AttendanceResultData * 3);
  133. @LessFiveLater = 0;
  134. @LessFiveEarly = 0;
  135. @LessTenLater = 0;
  136. @LessTenEarly = 0;
  137. @LessFifteenLater = 0;
  138. @LessFifteenEarly = 0;
  139. @LessDay = 0;
  140. if (Search("SearchLaterOrEarly",#PayAccountData.ID_Employee,#PayAccount.Begin_AttendanceResult,#PayAccount.End_AttendanceResult,#PayAccount.ID_AttendanceResult))
  141. {
  142. SuspendLayout();
  143. for (@j=0;@j<RowCount("#LaterOrEarly");@j=@j+1)
  144. {
  145. SetPosition("#LaterOrEarly", @j);
  146. if (#LaterOrEarly.Minute_Later <= 5 && #LaterOrEarly.Minute_Later > 0)
  147. @LessFiveLater = @LessFiveLater + 1;
  148. if (#LaterOrEarly.Minute_Leaveearly <= 5 && #LaterOrEarly.Minute_Leaveearly > 0)
  149. @LessFiveEarly = @LessFiveEarly + 1;
  150. if (#LaterOrEarly.Minute_Later <= 10 && #LaterOrEarly.Minute_Later > 5)
  151. @LessTenLater = @LessTenLater + 1;
  152. if (#LaterOrEarly.Minute_Leaveearly <= 10 && #LaterOrEarly.Minute_Leaveearly > 5)
  153. @LessTenEarly = @LessTenEarly + 1;
  154. if (#LaterOrEarly.Minute_Later <= 30 && #LaterOrEarly.Minute_Later > 10)
  155. @LessFifteenLater = @LessFifteenLater + 1;
  156. if (#LaterOrEarly.Minute_Leaveearly <= 30 && #LaterOrEarly.Minute_Leaveearly > 10)
  157. @LessFifteenEarly = @LessFifteenEarly + 1;
  158. if (#LaterOrEarly.Minute_Later > 30 || #LaterOrEarly.Minute_Leaveearly > 30)
  159. @LessDay = @LessDay + 1;
  160. }
  161. ResumeLayout();
  162. #PayAccountData.Later_PayAccountData = @LessFiveLater * 5 + @LessTenLater * 10 + @LessFifteenLater * 15;
  163. #PayAccountData.LeaveEarly_PayAccountData = @LessFiveEarly * 5 + @LessTenEarly * 10 + @LessFifteenEarly * 15;
  164. }
  165. #PayAccountData.Absent_PayAccountData = #PayAccountData.BasicPay_PayAccountData / #PayAccount.PayDays_PayAccount * (#AttendanceResultData.AbsentDays_AttendanceResultData + @LessDay);
  166. Search("SearchSickRate",#PayAccountData.ID_Employee,#PayAccount.End_AttendanceResult);
  167. #PayAccountData.Sick_PayAccountData = #PayAccountData.BasicPay_PayAccountData / #PayAccount.PayDays_PayAccount * #AttendanceResultData.SickLeaveDays_AttendanceResultData * #SickRate.SickRate_SickHoliday;
  168. #PayAccountData.Event_PayAccountData = #PayAccountData.BasicPay_PayAccountData / #PayAccount.PayDays_PayAccount * #AttendanceResultData.AffairLeaveDays_AttendanceResultData;
  169. Search("SearchPaySetting");
  170. if (Equals(#Employee.Insurance_Employee , "") || Equals(#Employee.Insurance_Employee,DBNull()))
  171. {
  172. #PayAccountData.Provide_PayAccountData = 0;
  173. #PayAccountData.Idleness_PayAccountData = 0;
  174. #PayAccountData.Medical_PayAccountData = 0;
  175. #PayAccountData.AccumulationFund_PayAccountData = 0;
  176. }
  177. else
  178. {
  179. if (#Employee.Insurance_Employee == "未缴" || #Employee.Insurance_Employee == "综合保险" )
  180. {
  181. #PayAccountData.Provide_PayAccountData = 0;
  182. #PayAccountData.Idleness_PayAccountData = 0;
  183. #PayAccountData.Medical_PayAccountData = 0;
  184. #PayAccountData.AccumulationFund_PayAccountData = 0;
  185. }
  186. if (#Employee.Insurance_Employee == "三金")
  187. {
  188. #PayAccountData.Provide_PayAccountData = #PaySetting.ThreeFundBase_PaySetting * #PaySetting.ProvideInsure_PaySetting / 100;
  189. #PayAccountData.Idleness_PayAccountData = #PaySetting.ThreeFundBase_PaySetting * #PaySetting.IdlenessInsure_PaySetting / 100;
  190. #PayAccountData.Medical_PayAccountData = #PaySetting.ThreeFundBase_PaySetting * #PaySetting.MedicalInsure_PaySetting / 100;
  191. #PayAccountData.AccumulationFund_PayAccountData = 0;
  192. }
  193. if (#Employee.Insurance_Employee == "四金")
  194. {
  195. #PayAccountData.Provide_PayAccountData = #PaySetting.ThreeFundBase_PaySetting * #PaySetting.ProvideInsure_PaySetting / 100;
  196. #PayAccountData.Idleness_PayAccountData = #PaySetting.ThreeFundBase_PaySetting * #PaySetting.IdlenessInsure_PaySetting / 100;
  197. #PayAccountData.Medical_PayAccountData = #PaySetting.ThreeFundBase_PaySetting * #PaySetting.MedicalInsure_PaySetting / 100;
  198. #PayAccountData.AccumulationFund_PayAccountData = (#PayAccountData.BasicPay_PayAccountData + #PaySetting.AccFundAdjust_PaySetting) * #PaySetting.HouseAccFund_PaySetting / 100;
  199. }
  200. if (#Employee.Insurance_Employee == "公积金")
  201. {
  202. #PayAccountData.Provide_PayAccountData = 0;
  203. #PayAccountData.Idleness_PayAccountData = 0;
  204. #PayAccountData.Medical_PayAccountData = 0;
  205. #PayAccountData.AccumulationFund_PayAccountData = (#PayAccountData.BasicPay_PayAccountData + #PaySetting.AccFundAdjust_PaySetting) * #PaySetting.HouseAccFund_PaySetting / 100;
  206. }
  207. }
  208. #PayAccountData.Total_PayAccountData = #PayAccountData.BasicPay_PayAccountData
  209. + #PayAccountData.AttendanceBounty_PayAccountData
  210. + #PayAccountData.OvertimePay_PayAccountData
  211. + #PayAccountData.Bonus_PayAccountData
  212. - #PayAccountData.Later_PayAccountData
  213. - #PayAccountData.LeaveEarly_PayAccountData
  214. - #PayAccountData.Absent_PayAccountData
  215. - #PayAccountData.Sick_PayAccountData
  216. - #PayAccountData.Event_PayAccountData
  217. - #PayAccountData.Provide_PayAccountData
  218. - #PayAccountData.Idleness_PayAccountData
  219. - #PayAccountData.Medical_PayAccountData
  220. - #PayAccountData.AccumulationFund_PayAccountData
  221. - #PayAccountData.Detain_PayAccountData;
  222. if (#Employee.Country_Employee == 40)
  223. {
  224. @TaxBegin = #PaySetting.TaxBeginCH_PaySetting;
  225. }
  226. else
  227. {
  228. @TaxBegin = #PaySetting.TaxBeginF_PaySetting;
  229. }
  230. if(Search("SearchTaxSetting",#PayAccountData.Total_PayAccountData,#PayAccountData.AttendanceBounty_PayAccountData,@TaxBegin))
  231. {
  232. #PayAccountData.Tax_PayAccountData = (#PayAccountData.Total_PayAccountData-#PayAccountData.AttendanceBounty_PayAccountData-@TaxBegin) * #TaxSetting.TaxRate_TaxSetting /100 - #TaxSetting.FastDeduct_TaxSetting;
  233. }
  234. else
  235. {
  236. #PayAccountData.Tax_PayAccountData = 0;
  237. }
  238. #PayAccountData.FactPay_PayAccountData = #PayAccountData.Total_PayAccountData - #PayAccountData.Tax_PayAccountData;
  239. if (#PayAccount.FactDays_AttendanceResult == #AttendanceResultData.DutyDays_AttendanceResultData)
  240. {
  241. if (#PayAccountData.Later_PayAccountData == 0
  242. || #PayAccountData.LeaveEarly_PayAccountData == 0
  243. || #PayAccountData.Absent_PayAccountData == 0
  244. || #PayAccountData.Sick_PayAccountData == 0
  245. || #PayAccountData.Event_PayAccountData == 0)
  246. {
  247. #PayAccountData.AttendanceBounty_PayAccountData = 100;
  248. }
  249. }
  250. if (Search("SearchModifyBill",#PayAccountData.ID_Employee,#PayAccount.Begin_AttendanceResult))
  251. {
  252. #PayAccountData.Comment_PayAccountData = "有借出未还";
  253. }
  254. }
  255. ResumeLayout();
  256. ]]>
  257. </Click>
  258. </Events>
  259. </IKButton>
  260. <IKDataGridEx name="dgCalendarList" DataSource="PayAccountData" TableStyleIndex="0">
  261. <DataColumn Index="0" DataSource="PayAccountData.No_Employee" />
  262. <DataColumn Index="1" DataSource="PayAccountData.Name_Employee" />
  263. <DataColumn Index="2" DataSource="PayAccountData.BasicPay_PayAccountData" />
  264. <DataColumn Index="3" DataSource="PayAccountData.OvertimePay_PayAccountData" />
  265. <DataColumn Index="4" DataSource="PayAccountData.AttendanceBounty_PayAccountData" />
  266. <DataColumn Index="5" DataSource="PayAccountData.Later_PayAccountData" />
  267. <DataColumn Index="6" DataSource="PayAccountData.LeaveEarly_PayAccountData" />
  268. <DataColumn Index="7" DataSource="PayAccountData.Absent_PayAccountData" />
  269. <DataColumn Index="8" DataSource="PayAccountData.Sick_PayAccountData" />
  270. <DataColumn Index="9" DataSource="PayAccountData.Event_PayAccountData" />
  271. <DataColumn Index="10" DataSource="PayAccountData.Provide_PayAccountData" />
  272. <DataColumn Index="11" DataSource="PayAccountData.Idleness_PayAccountData" />
  273. <DataColumn Index="12" DataSource="PayAccountData.Medical_PayAccountData" />
  274. <DataColumn Index="13" DataSource="PayAccountData.AccumulationFund_PayAccountData" />
  275. <DataColumn Index="14" DataSource="PayAccountData.Bonus_PayAccountData" />
  276. <DataColumn Index="15" DataSource="PayAccountData.Detain_PayAccountData" />
  277. <DataColumn Index="16" DataSource="PayAccountData.Total_PayAccountData" />
  278. <DataColumn Index="17" DataSource="PayAccountData.Tax_PayAccountData" />
  279. <DataColumn Index="18" DataSource="PayAccountData.FactPay_PayAccountData" />
  280. <DataColumn Index="19" DataSource="PayAccountData.Comment_PayAccountData" />
  281. </IKDataGridEx>
  282. <IKFormToolBar name="toolBar">
  283. <Events>
  284. <ClickFirst>
  285. if(Search("SearchPayAccountByNoFirst", tbNo.CValue))
  286. {
  287. Search("SearchFactDays",#PayAccount.Begin_AttendanceResult,#PayAccount.End_AttendanceResult);
  288. #PayAccount.FactDays_AttendanceResult = #FactDays.WorkDays_AttendanceResultData;
  289. ChangeMode("View");
  290. }
  291. </ClickFirst>
  292. <ClickPrev>
  293. if(Search("SearchPayAccountByNoPrevious", tbNo.CValue))
  294. {
  295. Search("SearchFactDays",#PayAccount.Begin_AttendanceResult,#PayAccount.End_AttendanceResult);
  296. #PayAccount.FactDays_AttendanceResult = #FactDays.WorkDays_AttendanceResultData;
  297. ChangeMode("View");
  298. }
  299. </ClickPrev>
  300. <ClickNext>
  301. if(Search("SearchPayAccountByNoNext", tbNo.CValue))
  302. {
  303. Search("SearchFactDays",#PayAccount.Begin_AttendanceResult,#PayAccount.End_AttendanceResult);
  304. #PayAccount.FactDays_AttendanceResult = #FactDays.WorkDays_AttendanceResultData;
  305. ChangeMode("View");
  306. }
  307. </ClickNext>
  308. <ClickLast>
  309. if(Search("SearchPayAccountByNoLast", tbNo.CValue))
  310. {
  311. Search("SearchFactDays",#PayAccount.Begin_AttendanceResult,#PayAccount.End_AttendanceResult);
  312. #PayAccount.FactDays_AttendanceResult = #FactDays.WorkDays_AttendanceResultData;
  313. ChangeMode("View");
  314. }
  315. </ClickLast>
  316. <ClickNew>
  317. ;
  318. </ClickNew>
  319. <ClickEmpty>
  320. ChangeMode("Search");
  321. </ClickEmpty>
  322. <ClickSubmit>
  323. <Lable name="SubmitButtonClick" />
  324. @a = #PayAccount.No_AttendanceResult;
  325. @b = #PayAccount.FactDays_AttendanceResult;
  326. Empty();
  327. NewInstance();
  328. Search("SearchPayAccount",@a);
  329. #PayAccount.FactDays_AttendanceResult = @b;
  330. ChangeMode("View");
  331. </ClickSubmit>
  332. <ClickModify>
  333. ChangeMode("Modify");
  334. </ClickModify>
  335. <ClickDelete>
  336. Delete(); ChangeMode("Search");
  337. </ClickDelete>
  338. <ClickPrint>
  339. PrintReport();
  340. </ClickPrint>
  341. <ClickAudit>
  342. BeginAudit();
  343. #PayAccount.ID_Assessor = GetLoginUserID();
  344. #PayAccount.Name_Assessor = GetCurrentUser();
  345. #PayAccount.AssessDate_PayAccount = DateTimeNow();
  346. Audit();
  347. ChangeMode("View");
  348. EndAudit();
  349. </ClickAudit>
  350. <ClickUnAudit>
  351. BeginUnAudit();
  352. #PayAccount.ID_Assessor = DBNull();
  353. #PayAccount.Name_Assessor = "";
  354. UnAudit();
  355. ChangeMode("View");
  356. EndUnAudit();
  357. </ClickUnAudit>
  358. <ClickImport>
  359. ;
  360. </ClickImport>
  361. <ClickExport>
  362. ;
  363. </ClickExport>
  364. <ClickClose>
  365. ;
  366. </ClickClose>
  367. </Events>
  368. </IKFormToolBar>
  369. </Controls>
  370. <Tables>
  371. <Table name="PayAccountData">
  372. <Events>
  373. <ColumnsChanged>
  374. <Bonus_PayAccountData>
  375. Search("SearchPaySetting");
  376. Search("SearchEmployee",#PayAccountData.ID_Employee);
  377. #PayAccountData.Total_PayAccountData = #PayAccountData.BasicPay_PayAccountData
  378. + #PayAccountData.AttendanceBounty_PayAccountData
  379. + #PayAccountData.OvertimePay_PayAccountData
  380. + #PayAccountData.Bonus_PayAccountData
  381. - #PayAccountData.Later_PayAccountData
  382. - #PayAccountData.LeaveEarly_PayAccountData
  383. - #PayAccountData.Absent_PayAccountData
  384. - #PayAccountData.Sick_PayAccountData
  385. - #PayAccountData.Event_PayAccountData
  386. - #PayAccountData.Provide_PayAccountData
  387. - #PayAccountData.Idleness_PayAccountData
  388. - #PayAccountData.Medical_PayAccountData
  389. - #PayAccountData.AccumulationFund_PayAccountData
  390. - #PayAccountData.Detain_PayAccountData;
  391. if (#Employee.Country_Employee == 40)
  392. {
  393. @TaxBegin = #PaySetting.TaxBeginCH_PaySetting;
  394. }
  395. else
  396. {
  397. @TaxBegin = #PaySetting.TaxBeginF_PaySetting;
  398. }
  399. if(Search("SearchTaxSetting",#PayAccountData.Total_PayAccountData,#PayAccountData.AttendanceBounty_PayAccountData,@TaxBegin))
  400. {
  401. #PayAccountData.Tax_PayAccountData = (#PayAccountData.Total_PayAccountData-#PayAccountData.AttendanceBounty_PayAccountData-@TaxBegin) * #TaxSetting.TaxRate_TaxSetting /100 - #TaxSetting.FastDeduct_TaxSetting;
  402. }
  403. else
  404. {
  405. #PayAccountData.Tax_PayAccountData = 0;
  406. }
  407. #PayAccountData.FactPay_PayAccountData = #PayAccountData.Total_PayAccountData - #PayAccountData.Tax_PayAccountData;
  408. </Bonus_PayAccountData>
  409. <Detain_PayAccountData>
  410. Search("SearchPaySetting");
  411. Search("SearchEmployee",#PayAccountData.ID_Employee);
  412. #PayAccountData.Total_PayAccountData = #PayAccountData.BasicPay_PayAccountData
  413. + #PayAccountData.AttendanceBounty_PayAccountData
  414. + #PayAccountData.OvertimePay_PayAccountData
  415. + #PayAccountData.Bonus_PayAccountData
  416. - #PayAccountData.Later_PayAccountData
  417. - #PayAccountData.LeaveEarly_PayAccountData
  418. - #PayAccountData.Absent_PayAccountData
  419. - #PayAccountData.Sick_PayAccountData
  420. - #PayAccountData.Event_PayAccountData
  421. - #PayAccountData.Provide_PayAccountData
  422. - #PayAccountData.Idleness_PayAccountData
  423. - #PayAccountData.Medical_PayAccountData
  424. - #PayAccountData.AccumulationFund_PayAccountData
  425. - #PayAccountData.Detain_PayAccountData;
  426. if (#Employee.Country_Employee == 40)
  427. {
  428. @TaxBegin = #PaySetting.TaxBeginCH_PaySetting;
  429. }
  430. else
  431. {
  432. @TaxBegin = #PaySetting.TaxBeginF_PaySetting;
  433. }
  434. if(Search("SearchTaxSetting",#PayAccountData.Total_PayAccountData,#PayAccountData.AttendanceBounty_PayAccountData,@TaxBegin))
  435. {
  436. #PayAccountData.Tax_PayAccountData = (#PayAccountData.Total_PayAccountData-#PayAccountData.AttendanceBounty_PayAccountData-@TaxBegin) * #TaxSetting.TaxRate_TaxSetting /100 - #TaxSetting.FastDeduct_TaxSetting;
  437. }
  438. else
  439. {
  440. #PayAccountData.Tax_PayAccountData = 0;
  441. }
  442. #PayAccountData.FactPay_PayAccountData = #PayAccountData.Total_PayAccountData - #PayAccountData.Tax_PayAccountData;
  443. </Detain_PayAccountData>
  444. </ColumnsChanged>
  445. </Events>
  446. </Table>
  447. </Tables>
  448. </Client>
  449. <Server>
  450. <Tables>
  451. <Table name="PayAccount" Type="Parent">
  452. <GetSchema CmdType="Text" CmdText="Select Top 0 PayAccount.*
  453. ,No_AttendanceResult
  454. ,Name_Department
  455. ,Begin_AttendanceResult
  456. ,End_AttendanceResult
  457. ,FactDays_AttendanceResult
  458. ,PayDays_PayAccount
  459. ,a.Name_User As Name_Creator
  460. ,b.Name_User As Name_Assessor
  461. ,c.Name_User As LastModUserName
  462. From PayAccount
  463. Left Join dbo.AttendanceResult On AttendanceResult.ID_AttendanceResult = PayAccount.ID_AttendanceResult
  464. Left Join dbo.Department On Department.ID_Department = AttendanceResult.ID_Department
  465. Left Join AppUser a On a.ID_User = PayAccount.ID_Creator
  466. Left Join AppUser b On b.ID_User = PayAccount.ID_Assessor
  467. Left Join AppUser c On c.ID_User = PayAccount.LastModUser_PayAccount "/>
  468. <New CmdType="Text" CmdText="Insert Into dbo.PayAccount(ID_PayAccount
  469. , ID_AttendanceResult
  470. , PayDays_PayAccount
  471. , ID_Creator
  472. , CreateDate_PayAccount
  473. , LastModUser_PayAccount
  474. , LastModDate_PayAccount
  475. , ID_Assessor
  476. , AssessDate_PayAccount
  477. )
  478. Values(@ID_PayAccount
  479. , @ID_AttendanceResult
  480. , @PayDays_PayAccount
  481. , @ID_Creator
  482. , @CreateDate_PayAccount
  483. , @LastModUser_PayAccount
  484. , @LastModDate_PayAccount
  485. , @ID_Assessor
  486. , @AssessDate_PayAccount
  487. )">
  488. <Params>
  489. <Param name="@ID_PayAccount" type="PayAccount.ID_PayAccount" sourceColumn="ID_PayAccount" />
  490. <Param name="@ID_AttendanceResult" type="PayAccount.ID_AttendanceResult" sourceColumn="ID_AttendanceResult" />
  491. <Param name="@PayDays_PayAccount" type="PayAccount.PayDays_PayAccount" sourceColumn="PayDays_PayAccount" />
  492. <Param name="@ID_Creator" type="PayAccount.ID_Creator" sourceColumn="ID_Creator" />
  493. <Param name="@CreateDate_PayAccount" type="PayAccount.CreateDate_PayAccount" sourceColumn="CreateDate_PayAccount" />
  494. <Param name="@LastModUser_PayAccount" type="PayAccount.LastModUser_PayAccount" sourceColumn="LastModUser_PayAccount" />
  495. <Param name="@LastModDate_PayAccount" type="PayAccount.LastModDate_PayAccount" sourceColumn="LastModDate_PayAccount" />
  496. <Param name="@ID_Assessor" type="PayAccount.ID_Assessor" sourceColumn="ID_Assessor" />
  497. <Param name="@AssessDate_PayAccount" type="PayAccount.AssessDate_PayAccount" sourceColumn="AssessDate_PayAccount" />
  498. </Params>
  499. </New>
  500. <Update CmdType="Text" CmdText="Update PayAccount
  501. Set ID_AttendanceResult = @ID_AttendanceResult
  502. , PayDays_PayAccount = @PayDays_PayAccount
  503. , ID_Creator = @ID_Creator
  504. , CreateDate_PayAccount = @CreateDate_PayAccount
  505. , LastModUser_PayAccount = @LastModUser_PayAccount
  506. , LastModDate_PayAccount = @LastModDate_PayAccount
  507. , ID_Assessor = @ID_Assessor
  508. , AssessDate_PayAccount = @AssessDate_PayAccount
  509. Where ID_PayAccount = @ID_PayAccount">
  510. <Params>
  511. <Param name="@ID_PayAccount" type="PayAccount.ID_PayAccount" sourceColumn="ID_PayAccount" />
  512. <Param name="@ID_AttendanceResult" type="PayAccount.ID_AttendanceResult" sourceColumn="ID_AttendanceResult" />
  513. <Param name="@PayDays_PayAccount" type="PayAccount.PayDays_PayAccount" sourceColumn="PayDays_PayAccount" />
  514. <Param name="@ID_Creator" type="PayAccount.ID_Creator" sourceColumn="ID_Creator" />
  515. <Param name="@CreateDate_PayAccount" type="PayAccount.CreateDate_PayAccount" sourceColumn="CreateDate_PayAccount" />
  516. <Param name="@LastModUser_PayAccount" type="PayAccount.LastModUser_PayAccount" sourceColumn="LastModUser_PayAccount" />
  517. <Param name="@LastModDate_PayAccount" type="PayAccount.LastModDate_PayAccount" sourceColumn="LastModDate_PayAccount" />
  518. <Param name="@ID_Assessor" type="PayAccount.ID_Assessor" sourceColumn="ID_Assessor" />
  519. <Param name="@AssessDate_PayAccount" type="PayAccount.AssessDate_PayAccount" sourceColumn="AssessDate_PayAccount" />
  520. </Params>
  521. </Update>
  522. <Audit CmdType="Text" CmdText="Update PayAccount
  523. Set ID_Assessor = @ID_Assessor
  524. , AssessDate_PayAccount = @AssessDate_PayAccount
  525. Where ID_PayAccount = @ID_PayAccount">
  526. <Params>
  527. <Param name="@ID_PayAccount" type="PayAccount.ID_PayAccount" sourceColumn="ID_PayAccount" />
  528. <Param name="@ID_Assessor" type="PayAccount.ID_Assessor" sourceColumn="ID_Assessor" />
  529. <Param name="@AssessDate_PayAccount" type="PayAccount.AssessDate_PayAccount" sourceColumn="AssessDate_PayAccount" />
  530. </Params>
  531. </Audit>
  532. <Delete CmdType="Text" CmdText="Delete PayAccountData Where ID_PayAccount = @ID_PayAccount
  533. Delete PayAccount Where ID_PayAccount = @ID_PayAccount">
  534. <Params>
  535. <Param name="@ID_PayAccount" type="PayAccount.ID_PayAccount" sourceColumn="ID_PayAccount" />
  536. </Params>
  537. </Delete>
  538. </Table>
  539. <Table name="PayAccountData" Type="Child">
  540. <GetSchema CmdType="Text" CmdText="Select Top 0 dbo.PayAccountData.*
  541. ,No_Employee
  542. ,Name_Employee
  543. From PayAccountData
  544. Left Join Employee On PayAccountData.ID_Employee = Employee.ID_Employee">
  545. </GetSchema>
  546. <New CmdType="Text" CmdText="Insert Into dbo.PayAccountData(ID_PayAccountData
  547. , ID_PayAccount
  548. , ID_Employee
  549. , BasicPay_PayAccountData
  550. , OvertimePay_PayAccountData
  551. , AttendanceBounty_PayAccountData
  552. , Later_PayAccountData
  553. , LeaveEarly_PayAccountData
  554. , Absent_PayAccountData
  555. , Sick_PayAccountData
  556. , Event_PayAccountData
  557. , Provide_PayAccountData
  558. , Idleness_PayAccountData
  559. , Medical_PayAccountData
  560. , AccumulationFund_PayAccountData
  561. , Bonus_PayAccountData
  562. , Detain_PayAccountData
  563. , Total_PayAccountData
  564. , Tax_PayAccountData
  565. , FactPay_PayAccountData
  566. , Comment_PayAccountData
  567. )
  568. Values (@ID_PayAccountData
  569. , @ID_PayAccount
  570. , @ID_Employee
  571. , @BasicPay_PayAccountData
  572. , @OvertimePay_PayAccountData
  573. , @AttendanceBounty_PayAccountData
  574. , @Later_PayAccountData
  575. , @LeaveEarly_PayAccountData
  576. , @Absent_PayAccountData
  577. , @Sick_PayAccountData
  578. , @Event_PayAccountData
  579. , @Provide_PayAccountData
  580. , @Idleness_PayAccountData
  581. , @Medical_PayAccountData
  582. , @AccumulationFund_PayAccountData
  583. , @Bonus_PayAccountData
  584. , @Detain_PayAccountData
  585. , @Total_PayAccountData
  586. , @Tax_PayAccountData
  587. , @FactPay_PayAccountData
  588. , @Comment_PayAccountData
  589. )">
  590. <Params>
  591. <Param name="@ID_PayAccountData" type="PayAccountData.ID_PayAccountData" sourceColumn="ID_PayAccountData" />
  592. <Param name="@ID_PayAccount" type="PayAccountData.ID_PayAccount" sourceColumn="ID_PayAccount" />
  593. <Param name="@ID_Employee" type="PayAccountData.ID_Employee" sourceColumn="ID_Employee" />
  594. <Param name="@BasicPay_PayAccountData" type="PayAccountData.BasicPay_PayAccountData" sourceColumn="BasicPay_PayAccountData" />
  595. <Param name="@OvertimePay_PayAccountData" type="PayAccountData.OvertimePay_PayAccountData" sourceColumn="OvertimePay_PayAccountData" />
  596. <Param name="@AttendanceBounty_PayAccountData" type="PayAccountData.AttendanceBounty_PayAccountData" sourceColumn="AttendanceBounty_PayAccountData" />
  597. <Param name="@Later_PayAccountData" type="PayAccountData.Later_PayAccountData" sourceColumn="Later_PayAccountData" />
  598. <Param name="@LeaveEarly_PayAccountData" type="PayAccountData.LeaveEarly_PayAccountData" sourceColumn="LeaveEarly_PayAccountData" />
  599. <Param name="@Absent_PayAccountData" type="PayAccountData.Absent_PayAccountData" sourceColumn="Absent_PayAccountData" />
  600. <Param name="@Sick_PayAccountData" type="PayAccountData.Sick_PayAccountData" sourceColumn="Sick_PayAccountData" />
  601. <Param name="@Event_PayAccountData" type="PayAccountData.Event_PayAccountData" sourceColumn="Event_PayAccountData" />
  602. <Param name="@Provide_PayAccountData" type="PayAccountData.Provide_PayAccountData" sourceColumn="Provide_PayAccountData" />
  603. <Param name="@Idleness_PayAccountData" type="PayAccountData.Idleness_PayAccountData" sourceColumn="Idleness_PayAccountData" />
  604. <Param name="@Medical_PayAccountData" type="PayAccountData.Medical_PayAccountData" sourceColumn="Medical_PayAccountData" />
  605. <Param name="@AccumulationFund_PayAccountData" type="PayAccountData.AccumulationFund_PayAccountData" sourceColumn="AccumulationFund_PayAccountData" />
  606. <Param name="@Bonus_PayAccountData" type="PayAccountData.Bonus_PayAccountData" sourceColumn="Bonus_PayAccountData" />
  607. <Param name="@Detain_PayAccountData" type="PayAccountData.Detain_PayAccountData" sourceColumn="Detain_PayAccountData" />
  608. <Param name="@Total_PayAccountData" type="PayAccountData.Total_PayAccountData" sourceColumn="Total_PayAccountData" />
  609. <Param name="@Tax_PayAccountData" type="PayAccountData.Tax_PayAccountData" sourceColumn="Tax_PayAccountData" />
  610. <Param name="@FactPay_PayAccountData" type="PayAccountData.FactPay_PayAccountData" sourceColumn="FactPay_PayAccountData" />
  611. <Param name="@Comment_PayAccountData" type="PayAccountData.Comment_PayAccountData" sourceColumn="Comment_PayAccountData" />
  612. </Params>
  613. </New>
  614. <Update CmdType="Text" CmdText="Update dbo.PayAccountData
  615. Set ID_PayAccount = @ID_PayAccount
  616. , ID_Employee = @ID_Employee
  617. , BasicPay_PayAccountData = @BasicPay_PayAccountData
  618. , OvertimePay_PayAccountData = @OvertimePay_PayAccountData
  619. , AttendanceBounty_PayAccountData = @AttendanceBounty_PayAccountData
  620. , Later_PayAccountData = @Later_PayAccountData
  621. , LeaveEarly_PayAccountData = @LeaveEarly_PayAccountData
  622. , Absent_PayAccountData = @Absent_PayAccountData
  623. , Sick_PayAccountData = @Sick_PayAccountData
  624. , Event_PayAccountData = @Event_PayAccountData
  625. , Provide_PayAccountData = @Provide_PayAccountData
  626. , Idleness_PayAccountData = @Idleness_PayAccountData
  627. , Medical_PayAccountData = @Medical_PayAccountData
  628. , AccumulationFund_PayAccountData = @AccumulationFund_PayAccountData
  629. , Bonus_PayAccountData = @Bonus_PayAccountData
  630. , Detain_PayAccountData = @Detain_PayAccountData
  631. , Total_PayAccountData = @Total_PayAccountData
  632. , Tax_PayAccountData = @Tax_PayAccountData
  633. , FactPay_PayAccountData = @FactPay_PayAccountData
  634. , Comment_PayAccountData = @Comment_PayAccountData
  635. Where ID_PayAccountData = @ID_PayAccountData">
  636. <Params>
  637. <Param name="@ID_PayAccountData" type="PayAccountData.ID_PayAccountData" sourceColumn="ID_PayAccountData" />
  638. <Param name="@ID_PayAccount" type="PayAccountData.ID_PayAccount" sourceColumn="ID_PayAccount" />
  639. <Param name="@ID_Employee" type="PayAccountData.ID_Employee" sourceColumn="ID_Employee" />
  640. <Param name="@BasicPay_PayAccountData" type="PayAccountData.BasicPay_PayAccountData" sourceColumn="BasicPay_PayAccountData" />
  641. <Param name="@OvertimePay_PayAccountData" type="PayAccountData.OvertimePay_PayAccountData" sourceColumn="OvertimePay_PayAccountData" />
  642. <Param name="@AttendanceBounty_PayAccountData" type="PayAccountData.AttendanceBounty_PayAccountData" sourceColumn="AttendanceBounty_PayAccountData" />
  643. <Param name="@Later_PayAccountData" type="PayAccountData.Later_PayAccountData" sourceColumn="Later_PayAccountData" />
  644. <Param name="@LeaveEarly_PayAccountData" type="PayAccountData.LeaveEarly_PayAccountData" sourceColumn="LeaveEarly_PayAccountData" />
  645. <Param name="@Absent_PayAccountData" type="PayAccountData.Absent_PayAccountData" sourceColumn="Absent_PayAccountData" />
  646. <Param name="@Sick_PayAccountData" type="PayAccountData.Sick_PayAccountData" sourceColumn="Sick_PayAccountData" />
  647. <Param name="@Event_PayAccountData" type="PayAccountData.Event_PayAccountData" sourceColumn="Event_PayAccountData" />
  648. <Param name="@Provide_PayAccountData" type="PayAccountData.Provide_PayAccountData" sourceColumn="Provide_PayAccountData" />
  649. <Param name="@Idleness_PayAccountData" type="PayAccountData.Idleness_PayAccountData" sourceColumn="Idleness_PayAccountData" />
  650. <Param name="@Medical_PayAccountData" type="PayAccountData.Medical_PayAccountData" sourceColumn="Medical_PayAccountData" />
  651. <Param name="@AccumulationFund_PayAccountData" type="PayAccountData.AccumulationFund_PayAccountData" sourceColumn="AccumulationFund_PayAccountData" />
  652. <Param name="@Bonus_PayAccountData" type="PayAccountData.Bonus_PayAccountData" sourceColumn="Bonus_PayAccountData" />
  653. <Param name="@Detain_PayAccountData" type="PayAccountData.Detain_PayAccountData" sourceColumn="Detain_PayAccountData" />
  654. <Param name="@Total_PayAccountData" type="PayAccountData.Total_PayAccountData" sourceColumn="Total_PayAccountData" />
  655. <Param name="@Tax_PayAccountData" type="PayAccountData.Tax_PayAccountData" sourceColumn="Tax_PayAccountData" />
  656. <Param name="@FactPay_PayAccountData" type="PayAccountData.FactPay_PayAccountData" sourceColumn="FactPay_PayAccountData" />
  657. <Param name="@Comment_PayAccountData" type="PayAccountData.Comment_PayAccountData" sourceColumn="Comment_PayAccountData" />
  658. </Params>
  659. </Update>
  660. <Delete CmdType="Text" CmdText="Delete PayAccountData Where ID_PayAccountData = @ID_PayAccountData
  661. ">
  662. <Params>
  663. <Param name="@ID_PayAccountData" type="PayAccountData.ID_PayAccountData" sourceColumn="ID_PayAccountData" />
  664. </Params>
  665. </Delete>
  666. </Table>
  667. </Tables>
  668. <Search>
  669. <SearchPayAccount CmdType="Text" CmdText=" Select PayAccount.*
  670. ,No_AttendanceResult
  671. ,Case AttendanceResult.ID_Department
  672. When '12345678-1234-1234-1234-123456789012' then '全部'
  673. else Name_Department end As Name_Department
  674. ,Begin_AttendanceResult
  675. ,End_AttendanceResult
  676. ,FactDays_AttendanceResult
  677. ,PayDays_PayAccount
  678. ,a.Name_User As Name_Creator
  679. ,b.Name_User As Name_Assessor
  680. ,c.Name_User As LastModUserName
  681. From PayAccount
  682. Left Join dbo.AttendanceResult On AttendanceResult.ID_AttendanceResult = PayAccount.ID_AttendanceResult
  683. Left Join dbo.Department On Department.ID_Department = AttendanceResult.ID_Department
  684. Left Join AppUser a On a.ID_User = PayAccount.ID_Creator
  685. Left Join AppUser b On b.ID_User = PayAccount.ID_Assessor
  686. Left Join AppUser c On c.ID_User = PayAccount.LastModUser_PayAccount
  687. Where No_AttendanceResult = @No_AttendanceResult
  688. Declare @ID_AttendanceResult Uniqueidentifier
  689. Declare @ID_PayAccount Uniqueidentifier
  690. Select @ID_AttendanceResult = ID_AttendanceResult
  691. From AttendanceResult
  692. Where No_AttendanceResult = @No_AttendanceResult
  693. Select @ID_PayAccount = ID_PayAccount
  694. From PayAccount
  695. Where ID_AttendanceResult = @ID_AttendanceResult
  696. Select dbo.PayAccountData.*
  697. ,No_Employee
  698. ,Name_Employee
  699. From PayAccountData
  700. Left Join Employee On PayAccountData.ID_Employee = Employee.ID_Employee
  701. Where ID_PayAccount = @ID_PayAccount">
  702. <Params>
  703. <Param name="@No_AttendanceResult" type="AttendanceResult.No_AttendanceResult" Index="0" />
  704. </Params>
  705. <Tables>
  706. <Table name="PayAccount" />
  707. <Table name="PayAccountData" />
  708. </Tables>
  709. </SearchPayAccount>
  710. <SearchAttendanceResult CmdType="Text" CmdText="
  711. Select ID_AttendanceResult
  712. ,No_AttendanceResult
  713. ,Case AttendanceResult.ID_Department
  714. When '12345678-1234-1234-1234-123456789012' then '全部'
  715. else Name_Department end As Name_Department
  716. ,Begin_AttendanceResult
  717. ,End_AttendanceResult
  718. ,FactDays_AttendanceResult
  719. ,27.5 AS PayDays_PayAccount
  720. ,ID_Assessor
  721. From AttendanceResult
  722. Left Join Department On Department.ID_Department = AttendanceResult.ID_Department
  723. Where No_AttendanceResult = @No_AttendanceResult
  724. Declare @ID_AttendanceResult Uniqueidentifier
  725. Select @ID_AttendanceResult = ID_AttendanceResult
  726. From AttendanceResult
  727. Where No_AttendanceResult = @No_AttendanceResult
  728. Select Employee.ID_Employee
  729. ,No_Employee
  730. ,Name_Employee
  731. From AttendanceResultData
  732. Left Join Employee On Employee.ID_Employee = AttendanceResultData.ID_Employee
  733. Where ID_AttendanceResult = @ID_AttendanceResult">
  734. <Params>
  735. <Param name="@No_AttendanceResult" type="AttendanceResult.No_AttendanceResult" Index="0" />
  736. </Params>
  737. <Tables>
  738. <Table name="AttendanceResult" />
  739. <Table name="AttendanceResultData" />
  740. </Tables>
  741. </SearchAttendanceResult>
  742. <SearchDepartment CmdType="Text" CmdText="Select '全部' As Name_Department
  743. Union all
  744. Select Name_Department
  745. From Department">
  746. <Tables>
  747. <Table name="Department" />
  748. </Tables>
  749. </SearchDepartment>
  750. <SearchEmployee CmdType="Text" CmdText="Select *
  751. From Employee
  752. Where ID_Employee = @ID_Employee">
  753. <Params>
  754. <Param name="@ID_Employee" type="Employee.ID_Employee" Index="0" />
  755. </Params>
  756. <Tables>
  757. <Table name="Employee" />
  758. </Tables>
  759. </SearchEmployee>
  760. <SearchPayBase CmdType="Text" CmdText="Select *
  761. From PayBase
  762. Where Type_PayBase = @PayLevel_Employee">
  763. <Params>
  764. <Param name="@PayLevel_Employee" type="Employee.PayLevel_Employee" Index="0" />
  765. </Params>
  766. <Tables>
  767. <Table name="PayBase" />
  768. </Tables>
  769. </SearchPayBase>
  770. <SearchAttendanceResultData CmdType="Text" CmdText="Declare @ID_AttendanceResult Uniqueidentifier
  771. Select @ID_AttendanceResult = ID_AttendanceResult
  772. From AttendanceResult
  773. Where No_AttendanceResult = @No_AttendanceResult
  774. Select *
  775. From AttendanceResultData
  776. Where ID_AttendanceResult = @ID_AttendanceResult
  777. And ID_Employee = @ID_Employee">
  778. <Params>
  779. <Param name="@No_AttendanceResult" type="AttendanceResult.No_AttendanceResult" Index="0" />
  780. <Param name="@ID_Employee" type="Employee.ID_Employee" Index="1" />
  781. </Params>
  782. <Tables>
  783. <Table name="AttendanceResultData" />
  784. </Tables>
  785. </SearchAttendanceResultData>
  786. <SearchLaterOrEarly CmdType="Text" CmdText="Select *
  787. From LaterOrLeaveearly
  788. Where ID_Employee = @ID_Employee
  789. And Date_LaterOrLeaveearly &gt; @Begin_AttendanceResult
  790. And Date_LaterOrLeaveearly &lt; @End_AttendanceResult
  791. And ID_AttendanceResult = @ID_AttendanceResult">
  792. <Params>
  793. <Param name="@ID_Employee" type="Employee.ID_Employee" Index="0" />
  794. <Param name="@Begin_AttendanceResult" type="AttendanceResult.Begin_AttendanceResult" Index="1" />
  795. <Param name="@End_AttendanceResult" type="AttendanceResult.End_AttendanceResult" Index="2" />
  796. <Param name="@ID_AttendanceResult" type="AttendanceResult.ID_AttendanceResult" Index="3" />
  797. </Params>
  798. <Tables>
  799. <Table name="LaterOrEarly" />
  800. </Tables>
  801. </SearchLaterOrEarly>
  802. <SearchSickRate CmdType="Text" CmdText="Declare @ServiceLength_SickHoliday decimal(14,2)
  803. Set @ServiceLength_SickHoliday = 0
  804. Select @ServiceLength_SickHoliday =datediff(day,OnJobDate_Employee,@End_AttendanceResult)/365.00
  805. From Employee
  806. Where ID_Employee = @ID_Employee
  807. Select Top 1 SickRate_SickHoliday
  808. From SickHoliday
  809. Where @ServiceLength_SickHoliday &lt;= ServiceLength_SickHoliday
  810. Order by ServiceLength_SickHoliday">
  811. <Params>
  812. <Param name="@ID_Employee" type="Employee.ID_Employee" Index="0" />
  813. <Param name="@End_AttendanceResult" type="AttendanceResult.End_AttendanceResult" Index="1" />
  814. </Params>
  815. <Tables>
  816. <Table name="SickRate" />
  817. </Tables>
  818. </SearchSickRate>
  819. <SearchPaySetting CmdType="Text" CmdText="Select *
  820. From PaySetting">
  821. <Tables>
  822. <Table name="PaySetting" />
  823. </Tables>
  824. </SearchPaySetting>
  825. <SearchTaxSetting CmdType="Text" CmdText="Declare @Mouney Decimal(14,2)
  826. Set @Mouney = @Total_PayAccountData-@AttendanceBounty_PayAccountData-@TaxBeginCH_PaySetting
  827. Select *
  828. From TaxSetting
  829. Where BeginAmount_TaxSetting &lt; @Mouney
  830. And EndAmount_TaxSetting &gt; @Mouney ">
  831. <Params>
  832. <Param name="@Total_PayAccountData" type="PayAccountData.Total_PayAccountData" Index="0" />
  833. <Param name="@AttendanceBounty_PayAccountData" type="AttendanceResult.AttendanceBounty_PayAccountData" Index="1" />
  834. <Param name="@TaxBeginCH_PaySetting" type="PaySetting.TaxBeginCH_PaySetting" Index="2" />
  835. </Params>
  836. <Tables>
  837. <Table name="TaxSetting" />
  838. </Tables>
  839. </SearchTaxSetting>
  840. <Searchdays CmdType="Text" CmdText="select datediff(day,@Begin_AttendanceResult,@OnDuty_Employee) As FrontPart
  841. ,datediff(day,@Begin_AttendanceResult,@End_AttendanceResult) As AllPart">
  842. <Params>
  843. <Param name="@OnDuty_Employee" type="Employee.OnDuty_Employee" Index="0" />
  844. <Param name="@Begin_AttendanceResult" type="AttendanceResult.Begin_AttendanceResult" Index="1" />
  845. <Param name="@End_AttendanceResult" type="AttendanceResult.End_AttendanceResult" Index="2" />
  846. </Params>
  847. <Tables>
  848. <Table name="days" />
  849. </Tables>
  850. </Searchdays>
  851. <SearchModifyBill CmdType="Text" CmdText="Select a.Date_ModifyDepotBill
  852. , a.ID_Proposer
  853. From
  854. (
  855. Select ModifyDepotBill.ID_ModifyDepotBill
  856. , No_ModifyDepotBill
  857. , ID_Product
  858. , ModifyDepotBillProduct.ID_Location
  859. , Quantity_ModifyDepotBillProduct
  860. , Date_ModifyDepotBill
  861. , ID_Proposer
  862. From ModifyDepotBill
  863. Left Join ModifyDepotBillProduct On ModifyDepotBillProduct.ID_ModifyDepotBill = ModifyDepotBill.ID_ModifyDepotBill
  864. Left Join ModifyTypeSettings On ModifyTypeSettings.ID_ModifyTypeSettings=ModifyDepotBill.Style_ModifyDepotBill
  865. Where ModName_ModifyTypeSettings = '借出'
  866. And ID_Assessor Is Not Null
  867. ) a
  868. Left Join
  869. (
  870. Select ModifyDepotBill.Source_ModifyDepotBill
  871. , ID_Product
  872. , ModifyDepotBillProduct.ID_Location
  873. , Quantity_ModifyDepotBillProduct
  874. From ModifyDepotBill
  875. Left Join ModifyDepotBillProduct On ModifyDepotBillProduct.ID_ModifyDepotBill = ModifyDepotBill.ID_ModifyDepotBill
  876. Left Join ModifyTypeSettings On ModifyTypeSettings.ID_ModifyTypeSettings=ModifyDepotBill.Style_ModifyDepotBill
  877. Where ModName_ModifyTypeSettings = '借出归还'
  878. And ID_Assessor Is Not Null
  879. ) b
  880. On A.No_ModifyDepotBill = b.Source_ModifyDepotBill
  881. And a.ID_Location = b.ID_Location
  882. And a.ID_Product = b.ID_Product
  883. Where IsNull(a.Quantity_ModifyDepotBillProduct,0)-IsNull(b.Quantity_ModifyDepotBillProduct,0) > 0
  884. And a.ID_Proposer = @ID_Employee
  885. And a.Date_ModifyDepotBill &lt; @Begin_AttendanceResult">
  886. <Params>
  887. <Param name="@ID_Employee" type="Employee.ID_Employee" Index="0" />
  888. <Param name="@Begin_AttendanceResult" type="AttendanceResult.Begin_AttendanceResult" Index="1" />
  889. </Params>
  890. <Tables>
  891. <Table name="ModifyBill" />
  892. </Tables>
  893. </SearchModifyBill>
  894. <SearchPayAccountByNoFirst CmdType="Text" CmdText="
  895. DECLARE @NextNo nvarchar(64)
  896. SET @NextNo = @No_AttendanceResult
  897. SELECT TOP 1 @NextNo = AttendanceResult.No_AttendanceResult FROM PayAccount
  898. Left Join dbo.AttendanceResult On AttendanceResult.ID_AttendanceResult = PayAccount.ID_AttendanceResult
  899. Where AttendanceResult.ID_Assessor Is Not Null
  900. ORDER BY AttendanceResult.No_AttendanceResult
  901. Select PayAccount.*
  902. ,No_AttendanceResult
  903. ,Case AttendanceResult.ID_Department
  904. When '12345678-1234-1234-1234-123456789012' then '全部'
  905. else Name_Department end As Name_Department
  906. ,Begin_AttendanceResult
  907. ,End_AttendanceResult
  908. ,FactDays_AttendanceResult
  909. ,PayDays_PayAccount
  910. ,a.Name_User As Name_Creator
  911. ,b.Name_User As Name_Assessor
  912. ,c.Name_User As LastModUserName
  913. From PayAccount
  914. Left Join dbo.AttendanceResult On AttendanceResult.ID_AttendanceResult = PayAccount.ID_AttendanceResult
  915. Left Join dbo.Department On Department.ID_Department = AttendanceResult.ID_Department
  916. Left Join AppUser a On a.ID_User = PayAccount.ID_Creator
  917. Left Join AppUser b On b.ID_User = PayAccount.ID_Assessor
  918. Left Join AppUser c On c.ID_User = PayAccount.LastModUser_PayAccount
  919. Where No_AttendanceResult = @NextNo
  920. Declare @ID_AttendanceResult Uniqueidentifier
  921. Declare @ID_PayAccount Uniqueidentifier
  922. Select @ID_AttendanceResult = ID_AttendanceResult
  923. From AttendanceResult
  924. Where No_AttendanceResult = @NextNo
  925. Select @ID_PayAccount = ID_PayAccount
  926. From PayAccount
  927. Where ID_AttendanceResult = @ID_AttendanceResult
  928. Select dbo.PayAccountData.*
  929. ,No_Employee
  930. ,Name_Employee
  931. From PayAccountData
  932. Left Join Employee On PayAccountData.ID_Employee = Employee.ID_Employee
  933. Where ID_PayAccount = @ID_PayAccount">
  934. <Params>
  935. <Param name="@No_AttendanceResult" type="AttendanceResult.No_AttendanceResult" Index="0" />
  936. </Params>
  937. <Tables>
  938. <Table name="PayAccount" />
  939. <Table name="PayAccountData" />
  940. </Tables>
  941. </SearchPayAccountByNoFirst>
  942. <SearchPayAccountByNoPrevious CmdType="Text" CmdText="DECLARE @NextNo nvarchar(64)
  943. SET @NextNo = @No_AttendanceResult
  944. SELECT TOP 1 @NextNo = AttendanceResult.No_AttendanceResult FROM PayAccount
  945. Left Join dbo.AttendanceResult On AttendanceResult.ID_AttendanceResult = PayAccount.ID_AttendanceResult
  946. Where AttendanceResult.ID_Assessor Is Not Null
  947. And AttendanceResult.No_AttendanceResult &lt; @No_AttendanceResult ORDER BY AttendanceResult.No_AttendanceResult Desc
  948. Select PayAccount.*
  949. ,No_AttendanceResult
  950. ,Case AttendanceResult.ID_Department
  951. When '12345678-1234-1234-1234-123456789012' then '全部'
  952. else Name_Department end As Name_Department
  953. ,Begin_AttendanceResult
  954. ,End_AttendanceResult
  955. ,FactDays_AttendanceResult
  956. ,PayDays_PayAccount
  957. ,a.Name_User As Name_Creator
  958. ,b.Name_User As Name_Assessor
  959. ,c.Name_User As LastModUserName
  960. From PayAccount
  961. Left Join dbo.AttendanceResult On AttendanceResult.ID_AttendanceResult = PayAccount.ID_AttendanceResult
  962. Left Join dbo.Department On Department.ID_Department = AttendanceResult.ID_Department
  963. Left Join AppUser a On a.ID_User = PayAccount.ID_Creator
  964. Left Join AppUser b On b.ID_User = PayAccount.ID_Assessor
  965. Left Join AppUser c On c.ID_User = PayAccount.LastModUser_PayAccount
  966. Where No_AttendanceResult = @NextNo
  967. Declare @ID_AttendanceResult Uniqueidentifier
  968. Declare @ID_PayAccount Uniqueidentifier
  969. Select @ID_AttendanceResult = ID_AttendanceResult
  970. From AttendanceResult
  971. Where No_AttendanceResult = @NextNo
  972. Select @ID_PayAccount = ID_PayAccount
  973. From PayAccount
  974. Where ID_AttendanceResult = @ID_AttendanceResult
  975. Select dbo.PayAccountData.*
  976. ,No_Employee
  977. ,Name_Employee
  978. From PayAccountData
  979. Left Join Employee On PayAccountData.ID_Employee = Employee.ID_Employee
  980. Where ID_PayAccount = @ID_PayAccount">
  981. <Params>
  982. <Param name="@No_AttendanceResult" type="AttendanceResult.No_AttendanceResult" Index="0" />
  983. </Params>
  984. <Tables>
  985. <Table name="PayAccount" />
  986. <Table name="PayAccountData" />
  987. </Tables>
  988. </SearchPayAccountByNoPrevious>
  989. <SearchPayAccountByNoNext CmdType="Text" CmdText="DECLARE @NextNo nvarchar(64)
  990. SET @NextNo = @No_AttendanceResult
  991. SELECT TOP 1 @NextNo = AttendanceResult.No_AttendanceResult FROM PayAccount
  992. Left Join dbo.AttendanceResult On AttendanceResult.ID_AttendanceResult = PayAccount.ID_AttendanceResult
  993. Where AttendanceResult.ID_Assessor Is Not Null
  994. And AttendanceResult.No_AttendanceResult &gt; @No_AttendanceResult ORDER BY AttendanceResult.No_AttendanceResult
  995. Select PayAccount.*
  996. ,No_AttendanceResult
  997. ,Case AttendanceResult.ID_Department
  998. When '12345678-1234-1234-1234-123456789012' then '全部'
  999. else Name_Department end As Name_Department
  1000. ,Begin_AttendanceResult
  1001. ,End_AttendanceResult
  1002. ,FactDays_AttendanceResult
  1003. ,PayDays_PayAccount
  1004. ,a.Name_User As Name_Creator
  1005. ,b.Name_User As Name_Assessor
  1006. ,c.Name_User As LastModUserName
  1007. From PayAccount
  1008. Left Join dbo.AttendanceResult On AttendanceResult.ID_AttendanceResult = PayAccount.ID_AttendanceResult
  1009. Left Join dbo.Department On Department.ID_Department = AttendanceResult.ID_Department
  1010. Left Join AppUser a On a.ID_User = PayAccount.ID_Creator
  1011. Left Join AppUser b On b.ID_User = PayAccount.ID_Assessor
  1012. Left Join AppUser c On c.ID_User = PayAccount.LastModUser_PayAccount
  1013. Where No_AttendanceResult = @NextNo
  1014. Declare @ID_AttendanceResult Uniqueidentifier
  1015. Declare @ID_PayAccount Uniqueidentifier
  1016. Select @ID_AttendanceResult = ID_AttendanceResult
  1017. From AttendanceResult
  1018. Where No_AttendanceResult = @NextNo
  1019. Select @ID_PayAccount = ID_PayAccount
  1020. From PayAccount
  1021. Where ID_AttendanceResult = @ID_AttendanceResult
  1022. Select dbo.PayAccountData.*
  1023. ,No_Employee
  1024. ,Name_Employee
  1025. From PayAccountData
  1026. Left Join Employee On PayAccountData.ID_Employee = Employee.ID_Employee
  1027. Where ID_PayAccount = @ID_PayAccount">
  1028. <Params>
  1029. <Param name="@No_AttendanceResult" type="AttendanceResult.No_AttendanceResult" Index="0" />
  1030. </Params>
  1031. <Tables>
  1032. <Table name="PayAccount" />
  1033. <Table name="PayAccountData" />
  1034. </Tables>
  1035. </SearchPayAccountByNoNext>
  1036. <SearchPayAccountByNoLast CmdType="Text" CmdText="DECLARE @NextNo nvarchar(64)
  1037. SET @NextNo = @No_AttendanceResult
  1038. SELECT TOP 1 @NextNo = AttendanceResult.No_AttendanceResult FROM PayAccount
  1039. Left Join dbo.AttendanceResult On AttendanceResult.ID_AttendanceResult = PayAccount.ID_AttendanceResult
  1040. Where AttendanceResult.ID_Assessor Is Not Null
  1041. ORDER BY AttendanceResult.No_AttendanceResult desc
  1042. Select PayAccount.*
  1043. ,No_AttendanceResult
  1044. ,Case AttendanceResult.ID_Department
  1045. When '12345678-1234-1234-1234-123456789012' then '全部'
  1046. else Name_Department end As Name_Department
  1047. ,Begin_AttendanceResult
  1048. ,End_AttendanceResult
  1049. ,FactDays_AttendanceResult
  1050. ,PayDays_PayAccount
  1051. ,a.Name_User As Name_Creator
  1052. ,b.Name_User As Name_Assessor
  1053. ,c.Name_User As LastModUserName
  1054. From PayAccount
  1055. Left Join dbo.AttendanceResult On AttendanceResult.ID_AttendanceResult = PayAccount.ID_AttendanceResult
  1056. Left Join dbo.Department On Department.ID_Department = AttendanceResult.ID_Department
  1057. Left Join AppUser a On a.ID_User = PayAccount.ID_Creator
  1058. Left Join AppUser b On b.ID_User = PayAccount.ID_Assessor
  1059. Left Join AppUser c On c.ID_User = PayAccount.LastModUser_PayAccount
  1060. Where No_AttendanceResult = @NextNo
  1061. Declare @ID_AttendanceResult Uniqueidentifier
  1062. Declare @ID_PayAccount Uniqueidentifier
  1063. Select @ID_AttendanceResult = ID_AttendanceResult
  1064. From AttendanceResult
  1065. Where No_AttendanceResult = @NextNo
  1066. Select @ID_PayAccount = ID_PayAccount
  1067. From PayAccount
  1068. Where ID_AttendanceResult = @ID_AttendanceResult
  1069. Select dbo.PayAccountData.*
  1070. ,No_Employee
  1071. ,Name_Employee
  1072. From PayAccountData
  1073. Left Join Employee On PayAccountData.ID_Employee = Employee.ID_Employee
  1074. Where ID_PayAccount = @ID_PayAccount">
  1075. <Params>
  1076. <Param name="@No_AttendanceResult" type="AttendanceResult.No_AttendanceResult" Index="0" />
  1077. </Params>
  1078. <Tables>
  1079. <Table name="PayAccount" />
  1080. <Table name="PayAccountData" />
  1081. </Tables>
  1082. </SearchPayAccountByNoLast>
  1083. <SearchFactDays CmdType="Text" CmdText="Declare @ID_Applicant uniqueidentifier
  1084. Declare @No_ApplicationBill nvarchar(64)
  1085. Declare @Item_ApplicationBill nvarchar(64)
  1086. Declare @StartDate_ApplicationBill datetime
  1087. Declare @EndDate_ApplicationBill datetime
  1088. Declare @OnStuffOne datetime
  1089. Declare @OffStuffOne datetime
  1090. Declare @OnStuffTwo datetime
  1091. Declare @OffStuffTwo datetime
  1092. Declare @AppHour decimal(14,1)
  1093. Declare @LoopDate datetime
  1094. IF Exists (Select * From tempdb.dbo.sysobjects Where id=Object_ID(N'tempdb.dbo.#TempApp'))
  1095. DROP TABLE #TempApp
  1096. Create Table #TempApp
  1097. (
  1098. ID_Applicant uniqueidentifier,
  1099. Date varchar(10),
  1100. OvertimeHour decimal(14,1),
  1101. BusinessHour decimal(14,1),
  1102. CompassionateHour decimal(14,1),
  1103. SickHour decimal(14,1),
  1104. SalaryHour decimal(14,1),
  1105. exception bit,
  1106. Comment nvarchar(256)
  1107. )
  1108. Declare cur cursor
  1109. for
  1110. Select ID_Applicant,No_ApplicationBill,Item_ApplicationBill,StartDate_ApplicationBill,EndDate_ApplicationBill
  1111. ,OnStuffOne,OffStuffOne,OnStuffTwo,OffStuffTwo
  1112. From dbo.ApplicationBill
  1113. Join dbo.AttendanceRuleEmployee On ApplicationBill.ID_Applicant=dbo.AttendanceRuleEmployee.ID_Employee
  1114. Join dbo.AttendanceRule On AttendanceRuleEmployee.ID_AttendanceRule=AttendanceRule.ID_AttendanceRule
  1115. Join Employee ON Employee.ID_Employee=dbo.AttendanceRuleEmployee.ID_Employee
  1116. Where ApplicationBill.ID_Assessor Is Not Null
  1117. --And No_Employee Between IsNull(@StartNo_Employee,No_Employee) And IsNull(@EndNo_Employee,No_Employee)
  1118. And DateDiff(day,@Begin_AttendanceResult,EndDate_ApplicationBill)>=0 And DateDiff(day,@End_AttendanceResult,StartDate_ApplicationBill) &lt;=0
  1119. --And ApplicationBill.ID_Department in (Select ID_Department From #department )
  1120. Open cur
  1121. Fetch Next From cur Into @ID_Applicant,@No_ApplicationBill,@Item_ApplicationBill,@StartDate_ApplicationBill,@EndDate_ApplicationBill
  1122. ,@OnStuffOne,@OffStuffOne,@OnStuffTwo,@OffStuffTwo
  1123. while @@fetch_status=0
  1124. BEGIN
  1125. Set @LoopDate=@StartDate_ApplicationBill
  1126. while(DateDiff(day,@LoopDate,@EndDate_ApplicationBill)>=0)
  1127. BEGIN
  1128. IF(DateDiff(day,@Begin_AttendanceResult,@LoopDate)>=0 and DateDiff(day,@End_AttendanceResult,@LoopDate)&lt;=0)
  1129. BEGIN
  1130. IF(DateDiff(day,@StartDate_ApplicationBill,@LoopDate)>0 and DateDiff(day,@EndDate_ApplicationBill,@LoopDate)&lt;0)
  1131. Set @AppHour=Convert(decimal(14,1),(dbo.TimeDiff(@OnStuffOne,@OffStuffOne)+dbo.TimeDiff(@OnStuffTwo,@OffStuffTwo))/60.0)
  1132. Else IF(DateDiff(day,@StartDate_ApplicationBill,@LoopDate)=0)
  1133. BEGIN
  1134. IF(DateDiff(day,@EndDate_ApplicationBill,@LoopDate)&lt;0)
  1135. BEGIN
  1136. IF(dbo.TimeDiff(@LoopDate,@OnStuffOne)>0)
  1137. Set @AppHour=Convert(decimal(14,1),(dbo.TimeDiff(@OnStuffOne,@OffStuffOne)+dbo.TimeDiff(@OnStuffTwo,@OffStuffTwo))/60.0)
  1138. Else IF(dbo.TimeDiff(@StartDate_ApplicationBill,@OffStuffOne)>0)
  1139. Set @AppHour=Convert(decimal(14,1),(dbo.TimeDiff(@StartDate_ApplicationBill,@OffStuffOne)+dbo.TimeDiff(@OnStuffTwo,@OffStuffTwo))/60.0)
  1140. else if(dbo.TimeDiff(@StartDate_ApplicationBill,@OnStuffTwo)>0)
  1141. Set @AppHour=dbo.TimeDiff(@OnStuffTwo,@OffStuffTwo)
  1142. else if(dbo.TimeDiff(@StartDate_ApplicationBill,@OffStuffTwo)>0)
  1143. Set @AppHour=dbo.TimeDiff(@StartDate_ApplicationBill,@OffStuffTwo)/60.0
  1144. else
  1145. Set @AppHour=0
  1146. END
  1147. Else
  1148. BEGIN
  1149. IF(dbo.TimeDiff(@StartDate_ApplicationBill,@OnStuffOne)>0)
  1150. BEGIN
  1151. IF(dbo.TimeDiff(@EndDate_ApplicationBill,@OnStuffOne)>0)
  1152. Set @AppHour=0
  1153. Else IF (dbo.TimeDiff(@EndDate_ApplicationBill,@OffStuffOne)>0)
  1154. Set @AppHour=Convert(decimal(14,1),dbo.TimeDiff(@OnStuffOne,@EndDate_ApplicationBill)/60.0)
  1155. Else if (dbo.TimeDiff(@EndDate_ApplicationBill,@OnStuffTwo)>0)
  1156. Set @AppHour=Convert(decimal(14,1),dbo.TimeDiff(@OnStuffOne,@OffStuffOne))
  1157. else if(dbo.TimeDiff(@EndDate_ApplicationBill,@OffStuffTwo)>0)
  1158. Set @AppHour=Convert(decimal(14,1),(dbo.TimeDiff(@OnStuffOne,@OffStuffOne)+dbo.TimeDiff(@OnStuffTwo,@EndDate_ApplicationBill))/60.0)
  1159. else
  1160. Set @AppHour=Convert(decimal(14,1),(dbo.TimeDiff(@OnStuffOne,@OffStuffOne)+dbo.TimeDiff(@OnStuffTwo,@OffStuffTwo))/60.0)
  1161. END
  1162. Else IF(dbo.TimeDiff(@StartDate_ApplicationBill,@OffStuffOne)>0)
  1163. BEGIN
  1164. IF (dbo.TimeDiff(@EndDate_ApplicationBill,@OffStuffOne)>0)
  1165. Set @AppHour=Convert(decimal(14,1),dbo.TimeDiff(@StartDate_ApplicationBill,@EndDate_ApplicationBill)/60.0)
  1166. Else if (dbo.TimeDiff(@EndDate_ApplicationBill,@OnStuffTwo)>0)
  1167. Set @AppHour=Convert(decimal(14,1),dbo.TimeDiff(@StartDate_ApplicationBill,@OffStuffOne)/60.0)
  1168. else if(dbo.TimeDiff(@EndDate_ApplicationBill,@OffStuffTwo)>0)
  1169. Set @AppHour=Convert(decimal(14,1),(dbo.TimeDiff(@StartDate_ApplicationBill,@OffStuffOne)+dbo.TimeDiff(@OnStuffTwo,@EndDate_ApplicationBill))/60.0)
  1170. else
  1171. Set @AppHour=Convert(decimal(14,1),(dbo.TimeDiff(@StartDate_ApplicationBill,@OffStuffOne)+dbo.TimeDiff(@OnStuffTwo,@OffStuffTwo))/60.0)
  1172. END
  1173. else if(dbo.TimeDiff(@StartDate_ApplicationBill,@OnStuffTwo)>0)
  1174. BEGIN
  1175. IF (dbo.TimeDiff(@EndDate_ApplicationBill,@OnStuffTwo)>0)
  1176. Set @AppHour=0
  1177. Else if (dbo.TimeDiff(@EndDate_ApplicationBill,@OffStuffTwo)>0)
  1178. Set @AppHour=Convert(decimal(14,1),dbo.TimeDiff(@OnStuffTwo,@EndDate_ApplicationBill)/60.0)
  1179. else
  1180. Set @AppHour=Convert(decimal(14,1),dbo.TimeDiff(@OnStuffTwo,@OffStuffTwo)/60.0)
  1181. END
  1182. else if(dbo.TimeDiff(@StartDate_ApplicationBill,@OffStuffTwo)>0)
  1183. BEGIN
  1184. IF (dbo.TimeDiff(@EndDate_ApplicationBill,@OffStuffTwo)>0)
  1185. Set @AppHour=Convert(decimal(14,1),dbo.TimeDiff(@StartDate_ApplicationBill,@EndDate_ApplicationBill)/60.0)
  1186. else
  1187. Set @AppHour=Convert(decimal(14,1),dbo.TimeDiff(@StartDate_ApplicationBill,@OffStuffTwo)/60.0)
  1188. END
  1189. else
  1190. Set @AppHour=0
  1191. END
  1192. END
  1193. ELSE
  1194. BEGIN
  1195. IF(dbo.TimeDiff(@EndDate_ApplicationBill,@OnStuffOne)>0)
  1196. Set @AppHour=0
  1197. Else IF(dbo.TimeDiff(@EndDate_ApplicationBill,@OffStuffOne)>0)
  1198. Set @AppHour=dbo.TimeDiff(@OnStuffOne,@EndDate_ApplicationBill)/60.0
  1199. else if(dbo.TimeDiff(@EndDate_ApplicationBill,@OnStuffTwo)>0)
  1200. Set @AppHour=dbo.TimeDiff(@OnStuffOne,@OffStuffOne)/60.0
  1201. else if(dbo.TimeDiff(@EndDate_ApplicationBill,@OffStuffTwo)>0)
  1202. Set @AppHour=Convert(decimal(14,1),(dbo.TimeDiff(@OnStuffOne,@OffStuffOne)+dbo.TimeDiff(@OnStuffTwo,@EndDate_ApplicationBill))/60.0)
  1203. else
  1204. Set @AppHour=Convert(decimal(14,1),(dbo.TimeDiff(@OnStuffOne,@OffStuffOne)+dbo.TimeDiff(@OnStuffTwo,@OffStuffTwo))/60.0)
  1205. END
  1206. IF(Not Exists (Select * From #TempApp Where ID_Applicant=@ID_Applicant And Date=convert(varchar(10),@LoopDate,120)))
  1207. BEGIN
  1208. IF(@Item_ApplicationBill='加班')
  1209. Insert Into #TempApp(ID_Applicant,Date,OvertimeHour,Comment)
  1210. Values(@ID_Applicant,convert(varchar(10),@LoopDate,120),@AppHour,'加班:'+@No_ApplicationBill)
  1211. else if(@Item_ApplicationBill='出差')
  1212. Insert Into #TempApp(ID_Applicant,Date,BusinessHour,Comment)
  1213. Values(@ID_Applicant,convert(varchar(10),@LoopDate,120),@AppHour,'出差:'+@No_ApplicationBill)
  1214. else if(@Item_ApplicationBill='事假')
  1215. Insert Into #TempApp(ID_Applicant,Date,CompassionateHour,Comment)
  1216. Values(@ID_Applicant,convert(varchar(10),@LoopDate,120),@AppHour,'事假:'+@No_ApplicationBill)
  1217. else if(@Item_ApplicationBill='病假')
  1218. Insert Into #TempApp(ID_Applicant,Date,SickHour,Comment)
  1219. Values(@ID_Applicant,convert(varchar(10),@LoopDate,120),@AppHour,'病假:'+@No_ApplicationBill)
  1220. else if(@Item_ApplicationBill='带薪假')
  1221. Insert Into #TempApp(ID_Applicant,Date,SalaryHour,Comment)
  1222. Values(@ID_Applicant,convert(varchar(10),@LoopDate,120),@AppHour,'带薪假:'+@No_ApplicationBill)
  1223. else if(@Item_ApplicationBill='打卡异常')
  1224. Insert Into #TempApp(ID_Applicant,Date,exception,Comment)
  1225. Values(@ID_Applicant,convert(varchar(10),@LoopDate,120),1,'打卡异常:'+@No_ApplicationBill)
  1226. END
  1227. else
  1228. Begin
  1229. IF(@Item_ApplicationBill='加班')
  1230. Update #TempApp Set OvertimeHour=IsNull(OvertimeHour,0)+@AppHour,Comment=Comment+' 加班:'+@No_ApplicationBill Where ID_Applicant=@ID_Applicant And Date=convert(varchar(10),@LoopDate,120)
  1231. else if(@Item_ApplicationBill='出差')
  1232. Update #TempApp Set BusinessHour=IsNull(BusinessHour,0)+@AppHour,Comment=Comment+' 出差:'+@No_ApplicationBill Where ID_Applicant=@ID_Applicant And Date=convert(varchar(10),@LoopDate,120)
  1233. else if(@Item_ApplicationBill='事假')
  1234. Update #TempApp Set CompassionateHour=IsNull(CompassionateHour,0)+@AppHour,Comment=Comment+' 事假:'+@No_ApplicationBill Where ID_Applicant=@ID_Applicant And Date=convert(varchar(10),@LoopDate,120)
  1235. else if(@Item_ApplicationBill='病假')
  1236. Update #TempApp Set SickHour=IsNull(SickHour,0)+@AppHour,Comment=Comment+' 病假:'+@No_ApplicationBill Where ID_Applicant=@ID_Applicant And Date=convert(varchar(10),@LoopDate,120)
  1237. else if(@Item_ApplicationBill='带薪假')
  1238. Update #TempApp Set SalaryHour=IsNull(SalaryHour,0)+@AppHour,Comment=Comment+' 带薪假:'+@No_ApplicationBill Where ID_Applicant=@ID_Applicant And Date=convert(varchar(10),@LoopDate,120)
  1239. else if(@Item_ApplicationBill='打卡异常')
  1240. Update #TempApp Set exception=1,Comment=Comment+' 打卡异常:'+@No_ApplicationBill Where ID_Applicant=@ID_Applicant And Date=convert(varchar(10),@LoopDate,120)
  1241. End
  1242. END
  1243. Set @LoopDate=DateAdd(day,1,@LoopDate)
  1244. END
  1245. Fetch Next From cur Into @ID_Applicant,@No_ApplicationBill,@Item_ApplicationBill,@StartDate_ApplicationBill,@EndDate_ApplicationBill
  1246. ,@OnStuffOne,@OffStuffOne,@OnStuffTwo,@OffStuffTwo
  1247. END
  1248. Close cur
  1249. Deallocate cur
  1250. ---------------------------------------------------------------------------------------------------
  1251. IF Exists (Select * From tempdb.dbo.sysobjects Where id=Object_ID(N'tempdb.dbo.#Basic'))
  1252. DROP TABLE #Basic
  1253. Create Table #Basic
  1254. (
  1255. No_Employee nvarchar(64)
  1256. ,Name_Employee nvarchar(64)
  1257. ,Name_Department nvarchar(64)
  1258. ,Date varchar(10)
  1259. ,WeekDay nvarchar(8)
  1260. ,Type_HolidaySetting nvarchar(64)
  1261. ,Name_AttendanceRule nvarchar(64)
  1262. ,StuffHour decimal(14,1)
  1263. ,OnAttendanceOne datetime
  1264. ,OffAttendanceOne datetime
  1265. ,OnAttendanceTwo datetime
  1266. ,OffAttendanceTwo datetime
  1267. ,AttendanceHour decimal(14,1)
  1268. ,OvertimeHour decimal(14,1)
  1269. ,BusinessHour decimal(14,1)
  1270. ,CompassionateHour decimal(14,1)
  1271. ,SickHour decimal(14,1)
  1272. ,SalaryHour decimal(14,1)
  1273. ,AbsentHour decimal(14,1)
  1274. ,ArriveLateMinute int
  1275. ,LeaveEarlyMinute int
  1276. ,Comment nvarchar(256)
  1277. )
  1278. Insert Into #Basic
  1279. 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
  1280. ,OnAttendanceOne
  1281. ,OffAttendanceOne,OnAttendanceTwo,OffAttendanceTwo
  1282. ,case Type_HolidaySetting when '工作日' then
  1283. case when exception=1 then StuffHour
  1284. else AttendanceHour end
  1285. else null end As AttendanceHour
  1286. ,case when #TempApp.OvertimeHour>StuffHour then StuffHour
  1287. else #TempApp.OvertimeHour end As OvertimeHour
  1288. ,case when #TempApp.BusinessHour>StuffHour then StuffHour
  1289. else #TempApp.BusinessHour end As BusinessHour
  1290. ,case when Type_HolidaySetting='工作日' then
  1291. case when #TempApp.CompassionateHour>StuffHour then StuffHour
  1292. else #TempApp.CompassionateHour end
  1293. else null end As CompassionateHour
  1294. ,case when Type_HolidaySetting='工作日' then
  1295. case when #TempApp.SickHour>StuffHour then StuffHour
  1296. else #TempApp.SickHour end
  1297. else null end As SickHour
  1298. ,case when Type_HolidaySetting='工作日' then
  1299. case when #TempApp.SalaryHour>StuffHour then StuffHour
  1300. else #TempApp.SalaryHour end
  1301. else null end As SalaryHour
  1302. ,case when Type_HolidaySetting='工作日' then
  1303. case when exception=1 then null
  1304. else
  1305. case when (StuffHour-IsNull(AttendanceHour,0)-IsNull(BusinessHour,0)-IsNull(CompassionateHour,0)-IsNull(SickHour,0)-IsNull(SalaryHour,0)
  1306. -case when dbo.TimeDiff(OnStuffOne,OnAttendanceOne) &lt;=30 and dbo.TimeDiff(OnStuffOne,OnAttendanceOne)>0 then dbo.TimeDiff(OnStuffOne,OnAttendanceOne) else 0 end
  1307. -case when dbo.TimeDiff(OffAttendanceOne,OffStuffOne)&lt;30 and dbo.TimeDiff(OffAttendanceOne,OffStuffOne)>0 then dbo.TimeDiff(OffAttendanceOne,OffStuffOne) else 0 end ) >0 then
  1308. (StuffHour-IsNull(AttendanceHour,0)-IsNull(BusinessHour,0)-IsNull(CompassionateHour,0)-IsNull(SickHour,0)-IsNull(SalaryHour,0)
  1309. -case when dbo.TimeDiff(OnStuffOne,OnAttendanceOne) &lt;=30 and dbo.TimeDiff(OnStuffOne,OnAttendanceOne)>0 then dbo.TimeDiff(OnStuffOne,OnAttendanceOne) else 0 end
  1310. -case when dbo.TimeDiff(OffAttendanceOne,OffStuffOne)&lt;30 and dbo.TimeDiff(OffAttendanceOne,OffStuffOne)>0 then dbo.TimeDiff(OffAttendanceOne,OffStuffOne) else 0 end )
  1311. else null end
  1312. end
  1313. else null end As AbsentHour
  1314. ,case when Type_HolidaySetting='工作日' And OnAttendanceOne Is Not Null then
  1315. case when exception=1 then null
  1316. else
  1317. case when dbo.TimeDiff(OnStuffOne,OnAttendanceOne)&lt;=ArriveLate_AttendanceRule or dbo.TimeDiff(OnStuffOne,OnAttendanceOne)>30 then null
  1318. else (dbo.TimeDiff(OnStuffOne,OnAttendanceOne)-ArriveLate_AttendanceRule) end
  1319. end
  1320. else null end As ArriveLateMinute
  1321. ,case when Type_HolidaySetting='工作日' And OnAttendanceOne Is Not Null then
  1322. case when exception=1 then null
  1323. else
  1324. case when dbo.TimeDiff(OffAttendanceOne,OffStuffOne)&lt;=LeaveEarly_AttendanceRule or dbo.TimeDiff(OffAttendanceOne,OffStuffOne)>30 then null
  1325. else dbo.TimeDiff(OffAttendanceOne,OffStuffOne)-LeaveEarly_AttendanceRule end
  1326. end
  1327. else null end As LeaveEarlyMinute
  1328. ,Comment
  1329. From
  1330. (
  1331. Select a.*,Convert(decimal(14,1),(DateDiff(minute,OnAttendanceOne,OffAttendanceOne)+DateDiff(minute,OnAttendanceTwo,OffAttendanceTwo))/60.0) As AttendanceHour
  1332. From
  1333. (
  1334. Select EmployeeCalendar.ID_Employee,No_Employee,Name_Employee,Name_Department,convert(varchar(10),Date_HolidaySetting,120) As Date,WeekDay_HolidaySetting,Type_HolidaySetting,Name_AttendanceRule
  1335. ,(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 OnAttendanceOne
  1336. ,(Select Top 1 Date_AttendanceRecord From (
  1337. Select Top 2 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,Date_HolidaySetting)=0 Order By Date_AttendanceRecord
  1338. )a2 Order By Date_AttendanceRecord desc) As OffAttendanceOne
  1339. ,(Select Top 1 Date_AttendanceRecord From (
  1340. Select Top 3 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,Date_HolidaySetting)=0 Order By Date_AttendanceRecord
  1341. )a3 Order By Date_AttendanceRecord desc) As OnAttendanceTwo
  1342. ,(Select Top 1 Date_AttendanceRecord From (
  1343. Select Top 4 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,Date_HolidaySetting)=0 Order By Date_AttendanceRecord
  1344. )a4 Order By Date_AttendanceRecord desc) As OffAttendanceTwo
  1345. ,OnStuffOne,OffStuffOne,OnStuffTwo,OffStuffTwo,ArriveLate_AttendanceRule,LeaveEarly_AttendanceRule,TakeOff_AttendanceRule
  1346. ,Convert(decimal(14,1),(dbo.TimeDiff(OnStuffOne,OffStuffOne)+dbo.TimeDiff(OnStuffTwo,OffStuffTwo))/60.0) As StuffHour
  1347. From
  1348. (
  1349. Select *
  1350. From Employee,HolidaySetting
  1351. --Where No_Employee Between IsNull(@StartNo_Employee,No_Employee) And IsNull(@EndNo_Employee,No_Employee)
  1352. Where DateDiff(day,@Begin_AttendanceResult,Date_HolidaySetting)>=0 And DateDiff(day,@End_AttendanceResult,Date_HolidaySetting)&lt;=0
  1353. --And Employee.ID_Department in (Select ID_Department From #department )
  1354. )EmployeeCalendar
  1355. Left Join Department On Department.ID_Department=EmployeeCalendar.ID_Department
  1356. Join dbo.AttendanceRuleEmployee On AttendanceRuleEmployee.ID_Employee=EmployeeCalendar.ID_Employee
  1357. Left Join dbo.AttendanceRule On AttendanceRule.ID_AttendanceRule=dbo.AttendanceRuleEmployee.ID_AttendanceRule
  1358. )a
  1359. )EmployeeInfo
  1360. Left Join #TempApp On #TempApp.ID_Applicant=EmployeeInfo.ID_Employee And #TempApp.Date=EmployeeInfo.Date
  1361. -------------------------------------------------------------------------------------------
  1362. Select top 1 IsNull(Sum(case Type_HolidaySetting when '工作日' then 1 end),0) As WorkDays_AttendanceResultData --工作日
  1363. From
  1364. #Basic
  1365. Group By No_Employee,Name_Employee,StuffHour">
  1366. <Params>
  1367. <Param name="@Begin_AttendanceResult" type="AttendanceResult.Begin_AttendanceResult" sourceColumn="Begin_AttendanceResult" />
  1368. <Param name="@End_AttendanceResult" type="AttendanceResult.End_AttendanceResult" sourceColumn="End_AttendanceResult" />
  1369. </Params>
  1370. <Tables>
  1371. <Table name="FactDays" />
  1372. </Tables>
  1373. </SearchFactDays>
  1374. </Search>
  1375. </Server>
  1376. <Lables>
  1377. <Search>
  1378. Empty();
  1379. NewInstance();
  1380. tbNo.ReadOnly = false;
  1381. cbDept.Enabled = false;
  1382. dtStart.Enabled = false;
  1383. dtEnd.Enabled = false;
  1384. txtDate.ReadOnly = true;
  1385. ikTextBox1.ReadOnly = true;
  1386. txtCreator.ReadOnly = true;
  1387. dttCreateDate.ReadOnly = true;
  1388. txtAssessor.ReadOnly = true;
  1389. dtAssessDate.ReadOnly = true;
  1390. txtLastModUser.ReadOnly = true;
  1391. dtLastModDate.ReadOnly = true;
  1392. btnSearch.Enabled = false;
  1393. dgCalendarList.ReadOnly = true;
  1394. toolBar.EnableSubmit = false;
  1395. toolBar.EnableModify = false;
  1396. toolBar.EnableDelete = false;
  1397. toolBar.EnableAudit = false;
  1398. toolBar.EnableUnAudit = false;
  1399. toolBar.EnablePrint = false;
  1400. #PayAccount.AssessDate_PayAccount = DBNull();
  1401. #PayAccount.LastModUser_PayAccount = DBNull();
  1402. #PayAccount.LastModDate_PayAccount = DBNull();
  1403. UpdateForm(true, "");
  1404. tbNo.Focus();
  1405. @Status = 0;
  1406. </Search>
  1407. <New>
  1408. Empty();
  1409. NewInstance();
  1410. tbNo.ReadOnly = true;
  1411. cbDept.Enabled = false;
  1412. dtStart.Enabled = false;
  1413. dtEnd.Enabled = false;
  1414. txtDate.ReadOnly = true;
  1415. ikTextBox1.ReadOnly = false;
  1416. txtCreator.ReadOnly = true;
  1417. dttCreateDate.ReadOnly = true;
  1418. txtAssessor.ReadOnly = true;
  1419. dtAssessDate.ReadOnly = true;
  1420. txtLastModUser.ReadOnly = true;
  1421. dtLastModDate.ReadOnly = true;
  1422. btnSearch.Enabled = true;
  1423. dgCalendarList.ReadOnly = false;
  1424. toolBar.EnableSubmit = true;
  1425. toolBar.EnableModify = false;
  1426. toolBar.EnableDelete = false;
  1427. toolBar.EnableAudit = false;
  1428. toolBar.EnableUnAudit = false;
  1429. toolBar.EnablePrint = false;
  1430. #PayAccount.ID_PayAccount = NewGuid();
  1431. #PayAccount.ID_Creator = GetLoginUserID();
  1432. #PayAccount.Name_Creator = GetCurrentUser();
  1433. #PayAccount.ID_Assessor = DBNull();
  1434. #PayAccount.AssessDate_PayAccount = DBNull();
  1435. #PayAccount.LastModUser_PayAccount = DBNull();
  1436. #PayAccount.LastModDate_PayAccount = DBNull();
  1437. UpdateForm(true, "");
  1438. ikTextBox1.Focus();
  1439. @Status = 1;
  1440. </New>
  1441. <View>
  1442. tbNo.ReadOnly = true;
  1443. cbDept.Enabled = false;
  1444. dtStart.Enabled = false;
  1445. dtEnd.Enabled = false;
  1446. txtDate.ReadOnly = true;
  1447. ikTextBox1.ReadOnly = true;
  1448. txtCreator.ReadOnly = true;
  1449. dttCreateDate.ReadOnly = true;
  1450. txtAssessor.ReadOnly = true;
  1451. dtAssessDate.ReadOnly = true;
  1452. txtLastModUser.ReadOnly = true;
  1453. dtLastModDate.ReadOnly = true;
  1454. btnSearch.Enabled = false;
  1455. dgCalendarList.ReadOnly = true;
  1456. toolBar.EnableSubmit = false;
  1457. toolBar.EnablePrint = true;
  1458. if(Equals(#PayAccount.ID_Assessor,DBNull()))
  1459. {
  1460. toolBar.EnableModify = GetRight(@Title,"修改");
  1461. toolBar.EnableDelete = GetRight(@Title,"删除");
  1462. toolBar.EnableAudit = GetRight(@Title,"审核");;
  1463. toolBar.EnableUnAudit = false;
  1464. }
  1465. else
  1466. {
  1467. toolBar.EnableModify = false;
  1468. toolBar.EnableDelete = false;
  1469. toolBar.EnableAudit = false;
  1470. toolBar.EnableUnAudit = GetRight(@Title,"取消审核");
  1471. }
  1472. toolBar.EnablePrint = true;
  1473. UpdateForm(true, "");
  1474. @Status = 2;
  1475. tbNo.Focus();
  1476. </View>
  1477. <Modify>
  1478. tbNo.ReadOnly = true;
  1479. cbDept.Enabled = false;
  1480. dtStart.Enabled = false;
  1481. dtEnd.Enabled = false;
  1482. txtDate.ReadOnly = true;
  1483. ikTextBox1.ReadOnly = false;
  1484. txtCreator.ReadOnly = true;
  1485. dttCreateDate.ReadOnly = true;
  1486. txtAssessor.ReadOnly = true;
  1487. dtAssessDate.ReadOnly = true;
  1488. txtLastModUser.ReadOnly = true;
  1489. dtLastModDate.ReadOnly = true;
  1490. btnSearch.Enabled = true;
  1491. dgCalendarList.ReadOnly = false;
  1492. toolBar.EnableSubmit = true;
  1493. toolBar.EnableModify = false;
  1494. toolBar.EnableDelete = false;
  1495. toolBar.EnableAudit = false;
  1496. toolBar.EnableUnAudit = false;
  1497. toolBar.EnablePrint = false;
  1498. #PayAccount.LastModUser_PayAccount = GetLoginUserID();
  1499. #PayAccount.LastModUserName = GetCurrentUser();
  1500. #PayAccount.LastModDate_PayAccount = DateTimeNow();
  1501. UpdateForm(true, "");
  1502. @Status = 3;
  1503. </Modify>
  1504. <SubmitButtonClick>
  1505. <![CDATA[
  1506. if (ikTextBox1.CValue < 0)
  1507. {
  1508. ikTextBox1.Focus();
  1509. MessageBox("薪资计算日大于0!",@Title);
  1510. return;
  1511. }
  1512. UpdateForm(false, "");
  1513. SuspendLayout();
  1514. for (@i=0;@i<RowCount("#PayAccountData");@i=@i+1)
  1515. {
  1516. SetPosition("#PayAccountData", @i);
  1517. if (Equals(#PayAccountData.ID_PayAccountData,GuidEmpty()))
  1518. #PayAccountData.ID_PayAccountData = NewGuid();
  1519. #PayAccountData.ID_PayAccount =#PayAccount.ID_PayAccount;
  1520. }
  1521. ResumeLayout();
  1522. if(@Status == 1)
  1523. {
  1524. #PayAccount.CreateDate_PayAccount = DateTimeNow();
  1525. New();
  1526. }
  1527. else if(@Status == 3)
  1528. {
  1529. #PayAccount.LastModDate_PayAccount = DateTimeNow();
  1530. Update();
  1531. }
  1532. ChangeMode("View");
  1533. ]]>
  1534. </SubmitButtonClick>
  1535. </Lables>
  1536. </Form>
  1537. </Forms>