12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607 |
- <?xml version="1.0" encoding="utf-8" ?>
- <Forms>
- <Form Name="FrmPayAccount">
- <Client>
- <Events>
- <Load>
- <![CDATA[
- @Title="薪资计算";
- GetSchema();
- ChangeMode("Search");
- Search("SearchDepartment");
- ]]>
- </Load>
- <Closing>
- ;<!--TODO-->
- </Closing>
- <Closed>
- ;<!--TODO-->
- </Closed>
- </Events>
- <Mode>
- <Search>
- <Lable name="Search" />
- </Search>
- <New>
- <Lable name="New" />
- </New>
- <View>
- <Lable name="View" />
- </View>
- <Modify>
- <Lable name="Modify" />
- </Modify>
- </Mode>
- <Controls>
- <IKTextButton name="tbNo" DataSource="PayAccount.No_AttendanceResult">
- <Events>
- <Enter>
- <![CDATA[
- if(tbNo.CValue != StringEmpty())
- {
- UpdateForm(false, "");
- if(Search("SearchPayAccount",tbNo.CValue))
- {
- Search("SearchFactDays",#PayAccount.Begin_AttendanceResult,#PayAccount.End_AttendanceResult);
- #PayAccount.FactDays_AttendanceResult = #FactDays.WorkDays_AttendanceResultData;
- ChangeMode("View");
- }
- else
- {
- if(Search("SearchAttendanceResult",tbNo.CValue))
- {
- if (Equals(#AttendanceResult.ID_Assessor,DBNull()))
- {
- MessageBox("该考勤资料结转未审核!",@Title);
- }
- else
- {
- ChangeMode("New");
- #PayAccount.ID_AttendanceResult = #AttendanceResult.ID_AttendanceResult;
- #PayAccount.No_AttendanceResult = #AttendanceResult.No_AttendanceResult;
- #PayAccount.Name_Department = #AttendanceResult.Name_Department;
- #PayAccount.Begin_AttendanceResult = #AttendanceResult.Begin_AttendanceResult;
- #PayAccount.End_AttendanceResult = #AttendanceResult.End_AttendanceResult;
-
- #PayAccount.PayDays_PayAccount = #AttendanceResult.PayDays_PayAccount;
- Search("SearchFactDays",#PayAccount.Begin_AttendanceResult,#PayAccount.End_AttendanceResult);
- #PayAccount.FactDays_AttendanceResult = #FactDays.WorkDays_AttendanceResultData;
- MergeTable("#AttendanceResultData","#PayAccountData");
- UpdateForm(true, "");
- }
- }
- else
- MessageBox("该考勤编号不存在!",@Title);
- }
- }
- else
- {
- MessageBox("请输入考勤编号!",@Title);
- }
- ]]>
- </Enter>
- </Events>
- </IKTextButton>
- <IKComboBoxEx name="cbDept" DisplaySource="PayAccount.Name_Department" ValueSource="PayAccount.Name_Department" DataSource="Department" DisplayMember="Name_Department" ValueMember="Name_Department">
- <Events>
- <Reload>
- UpdateForm(false, "cbDept");
- Search("SearchDepartment");
- UpdateForm(true, "cbDept");
- </Reload>
- </Events>
- </IKComboBoxEx>
- <IKDateTimePicker name="dtStart" DataSource="PayAccount.Begin_AttendanceResult"/>
- <IKDateTimePicker name="dtEnd" DataSource="PayAccount.End_AttendanceResult"/>
- <IKTextBox name="txtDate" DataSource="PayAccount.FactDays_AttendanceResult"/>
- <IKTextBox name="ikTextBox1" DataSource="PayAccount.PayDays_PayAccount"/>
- <IKTextBox name="txtCreator" DataSource="PayAccount.Name_Creator"></IKTextBox>
- <IKDateTimeText name="dttCreateDate" DataSource="PayAccount.CreateDate_PayAccount"></IKDateTimeText>
- <IKTextBox name="txtAssessor" DataSource="PayAccount.Name_Assessor"></IKTextBox>
- <IKDateTimeText name="dtAssessDate" DataSource="PayAccount.AssessDate_PayAccount"></IKDateTimeText>
- <IKTextBox name="txtLastModUser" DataSource="PayAccount.LastModUserName"></IKTextBox>
- <IKDateTimeText name="dtLastModDate" DataSource="PayAccount.LastModDate_PayAccount"></IKDateTimeText>
- <IKButton name="btnSearch">
- <Events>
- <Click>
- <![CDATA[
- SuspendLayout();
- for (@i=0;@i<RowCount("#PayAccountData");@i=@i+1)
- {
- SetPosition("#PayAccountData", @i);
- if (Search("SearchEmployee",#PayAccountData.ID_Employee))
- {
- if (Search("SearchPayBase",#Employee.PayLevel_Employee))
- {
- if (#Employee.OnDuty_Employee <= #PayAccount.Begin_AttendanceResult)
- {
- #PayAccountData.BasicPay_PayAccountData = (#PayBase.Value_PayBase + #Employee.DutySubsidy_Employee);
- }
- if (#Employee.OnDuty_Employee >= #PayAccount.End_AttendanceResult)
- {
- #PayAccountData.BasicPay_PayAccountData = (#PayBase.Value_PayBase + #Employee.DutySubsidy_Employee) * 0.8;
- }
- if (#Employee.OnDuty_Employee > #PayAccount.Begin_AttendanceResult && #Employee.OnDuty_Employee < #PayAccount.End_AttendanceResult)
- {
- Search("Searchdays",#Employee.OnDuty_Employee,#PayAccount.Begin_AttendanceResult,#PayAccount.End_AttendanceResult);
- #PayAccountData.BasicPay_PayAccountData = (#PayBase.Value_PayBase + #Employee.DutySubsidy_Employee) * #days.FrontPart / #days.AllPart * .8
- + (#PayBase.Value_PayBase + #Employee.DutySubsidy_Employee) * (1 - #days.FrontPart / #days.AllPart);
- }
- }
- }
-
- Search("SearchAttendanceResultData",#PayAccount.No_AttendanceResult,#PayAccountData.ID_Employee);
- #PayAccountData.OvertimePay_PayAccountData = #PayAccountData.BasicPay_PayAccountData / #PayAccount.PayDays_PayAccount * (#AttendanceResultData.OvertimeDays_AttendanceResultData + #AttendanceResultData.WeekendOtDays_AttendanceResultData * 2 + #AttendanceResultData.FeastOtDays_AttendanceResultData * 3);
-
-
-
-
- @LessFiveLater = 0;
- @LessFiveEarly = 0;
- @LessTenLater = 0;
- @LessTenEarly = 0;
- @LessFifteenLater = 0;
- @LessFifteenEarly = 0;
- @LessDay = 0;
- if (Search("SearchLaterOrEarly",#PayAccountData.ID_Employee,#PayAccount.Begin_AttendanceResult,#PayAccount.End_AttendanceResult,#PayAccount.ID_AttendanceResult))
- {
- SuspendLayout();
- for (@j=0;@j<RowCount("#LaterOrEarly");@j=@j+1)
- {
- SetPosition("#LaterOrEarly", @j);
- if (#LaterOrEarly.Minute_Later <= 5 && #LaterOrEarly.Minute_Later > 0)
- @LessFiveLater = @LessFiveLater + 1;
- if (#LaterOrEarly.Minute_Leaveearly <= 5 && #LaterOrEarly.Minute_Leaveearly > 0)
- @LessFiveEarly = @LessFiveEarly + 1;
-
- if (#LaterOrEarly.Minute_Later <= 10 && #LaterOrEarly.Minute_Later > 5)
- @LessTenLater = @LessTenLater + 1;
- if (#LaterOrEarly.Minute_Leaveearly <= 10 && #LaterOrEarly.Minute_Leaveearly > 5)
- @LessTenEarly = @LessTenEarly + 1;
-
- if (#LaterOrEarly.Minute_Later <= 30 && #LaterOrEarly.Minute_Later > 10)
- @LessFifteenLater = @LessFifteenLater + 1;
- if (#LaterOrEarly.Minute_Leaveearly <= 30 && #LaterOrEarly.Minute_Leaveearly > 10)
- @LessFifteenEarly = @LessFifteenEarly + 1;
-
- if (#LaterOrEarly.Minute_Later > 30 || #LaterOrEarly.Minute_Leaveearly > 30)
- @LessDay = @LessDay + 1;
- }
- ResumeLayout();
-
- #PayAccountData.Later_PayAccountData = @LessFiveLater * 5 + @LessTenLater * 10 + @LessFifteenLater * 15;
-
- #PayAccountData.LeaveEarly_PayAccountData = @LessFiveEarly * 5 + @LessTenEarly * 10 + @LessFifteenEarly * 15;
- }
-
-
- #PayAccountData.Absent_PayAccountData = #PayAccountData.BasicPay_PayAccountData / #PayAccount.PayDays_PayAccount * (#AttendanceResultData.AbsentDays_AttendanceResultData + @LessDay);
-
-
- Search("SearchSickRate",#PayAccountData.ID_Employee,#PayAccount.End_AttendanceResult);
- #PayAccountData.Sick_PayAccountData = #PayAccountData.BasicPay_PayAccountData / #PayAccount.PayDays_PayAccount * #AttendanceResultData.SickLeaveDays_AttendanceResultData * #SickRate.SickRate_SickHoliday;
-
-
- #PayAccountData.Event_PayAccountData = #PayAccountData.BasicPay_PayAccountData / #PayAccount.PayDays_PayAccount * #AttendanceResultData.AffairLeaveDays_AttendanceResultData;
-
- Search("SearchPaySetting");
- if (Equals(#Employee.Insurance_Employee , "") || Equals(#Employee.Insurance_Employee,DBNull()))
- {
- #PayAccountData.Provide_PayAccountData = 0;
- #PayAccountData.Idleness_PayAccountData = 0;
- #PayAccountData.Medical_PayAccountData = 0;
- #PayAccountData.AccumulationFund_PayAccountData = 0;
- }
- else
- {
- if (#Employee.Insurance_Employee == "未缴" || #Employee.Insurance_Employee == "综合保险" )
- {
- #PayAccountData.Provide_PayAccountData = 0;
- #PayAccountData.Idleness_PayAccountData = 0;
- #PayAccountData.Medical_PayAccountData = 0;
- #PayAccountData.AccumulationFund_PayAccountData = 0;
- }
- if (#Employee.Insurance_Employee == "三金")
- {
- #PayAccountData.Provide_PayAccountData = #PaySetting.ThreeFundBase_PaySetting * #PaySetting.ProvideInsure_PaySetting / 100;
- #PayAccountData.Idleness_PayAccountData = #PaySetting.ThreeFundBase_PaySetting * #PaySetting.IdlenessInsure_PaySetting / 100;
- #PayAccountData.Medical_PayAccountData = #PaySetting.ThreeFundBase_PaySetting * #PaySetting.MedicalInsure_PaySetting / 100;
- #PayAccountData.AccumulationFund_PayAccountData = 0;
- }
- if (#Employee.Insurance_Employee == "四金")
- {
- #PayAccountData.Provide_PayAccountData = #PaySetting.ThreeFundBase_PaySetting * #PaySetting.ProvideInsure_PaySetting / 100;
- #PayAccountData.Idleness_PayAccountData = #PaySetting.ThreeFundBase_PaySetting * #PaySetting.IdlenessInsure_PaySetting / 100;
- #PayAccountData.Medical_PayAccountData = #PaySetting.ThreeFundBase_PaySetting * #PaySetting.MedicalInsure_PaySetting / 100;
- #PayAccountData.AccumulationFund_PayAccountData = (#PayAccountData.BasicPay_PayAccountData + #PaySetting.AccFundAdjust_PaySetting) * #PaySetting.HouseAccFund_PaySetting / 100;
- }
- if (#Employee.Insurance_Employee == "公积金")
- {
- #PayAccountData.Provide_PayAccountData = 0;
- #PayAccountData.Idleness_PayAccountData = 0;
- #PayAccountData.Medical_PayAccountData = 0;
- #PayAccountData.AccumulationFund_PayAccountData = (#PayAccountData.BasicPay_PayAccountData + #PaySetting.AccFundAdjust_PaySetting) * #PaySetting.HouseAccFund_PaySetting / 100;
- }
- }
-
-
-
- #PayAccountData.Total_PayAccountData = #PayAccountData.BasicPay_PayAccountData
- + #PayAccountData.AttendanceBounty_PayAccountData
- + #PayAccountData.OvertimePay_PayAccountData
- + #PayAccountData.Bonus_PayAccountData
- - #PayAccountData.Later_PayAccountData
- - #PayAccountData.LeaveEarly_PayAccountData
- - #PayAccountData.Absent_PayAccountData
- - #PayAccountData.Sick_PayAccountData
- - #PayAccountData.Event_PayAccountData
- - #PayAccountData.Provide_PayAccountData
- - #PayAccountData.Idleness_PayAccountData
- - #PayAccountData.Medical_PayAccountData
- - #PayAccountData.AccumulationFund_PayAccountData
- - #PayAccountData.Detain_PayAccountData;
-
- if (#Employee.Country_Employee == 40)
- {
- @TaxBegin = #PaySetting.TaxBeginCH_PaySetting;
- }
- else
- {
- @TaxBegin = #PaySetting.TaxBeginF_PaySetting;
- }
-
- if(Search("SearchTaxSetting",#PayAccountData.Total_PayAccountData,#PayAccountData.AttendanceBounty_PayAccountData,@TaxBegin))
- {
- #PayAccountData.Tax_PayAccountData = (#PayAccountData.Total_PayAccountData-#PayAccountData.AttendanceBounty_PayAccountData-@TaxBegin) * #TaxSetting.TaxRate_TaxSetting /100 - #TaxSetting.FastDeduct_TaxSetting;
- }
- else
- {
- #PayAccountData.Tax_PayAccountData = 0;
- }
-
-
- #PayAccountData.FactPay_PayAccountData = #PayAccountData.Total_PayAccountData - #PayAccountData.Tax_PayAccountData;
-
- if (#PayAccount.FactDays_AttendanceResult == #AttendanceResultData.DutyDays_AttendanceResultData)
- {
- if (#PayAccountData.Later_PayAccountData == 0
- || #PayAccountData.LeaveEarly_PayAccountData == 0
- || #PayAccountData.Absent_PayAccountData == 0
- || #PayAccountData.Sick_PayAccountData == 0
- || #PayAccountData.Event_PayAccountData == 0)
- {
- #PayAccountData.AttendanceBounty_PayAccountData = 100;
- }
- }
-
- if (Search("SearchModifyBill",#PayAccountData.ID_Employee,#PayAccount.Begin_AttendanceResult))
- {
- #PayAccountData.Comment_PayAccountData = "有借出未还";
- }
- }
- ResumeLayout();
- ]]>
- </Click>
- </Events>
- </IKButton>
- <IKDataGridEx name="dgCalendarList" DataSource="PayAccountData" TableStyleIndex="0">
- <DataColumn Index="0" DataSource="PayAccountData.No_Employee" />
- <DataColumn Index="1" DataSource="PayAccountData.Name_Employee" />
- <DataColumn Index="2" DataSource="PayAccountData.BasicPay_PayAccountData" />
- <DataColumn Index="3" DataSource="PayAccountData.OvertimePay_PayAccountData" />
- <DataColumn Index="4" DataSource="PayAccountData.AttendanceBounty_PayAccountData" />
- <DataColumn Index="5" DataSource="PayAccountData.Later_PayAccountData" />
- <DataColumn Index="6" DataSource="PayAccountData.LeaveEarly_PayAccountData" />
- <DataColumn Index="7" DataSource="PayAccountData.Absent_PayAccountData" />
- <DataColumn Index="8" DataSource="PayAccountData.Sick_PayAccountData" />
- <DataColumn Index="9" DataSource="PayAccountData.Event_PayAccountData" />
- <DataColumn Index="10" DataSource="PayAccountData.Provide_PayAccountData" />
- <DataColumn Index="11" DataSource="PayAccountData.Idleness_PayAccountData" />
- <DataColumn Index="12" DataSource="PayAccountData.Medical_PayAccountData" />
- <DataColumn Index="13" DataSource="PayAccountData.AccumulationFund_PayAccountData" />
- <DataColumn Index="14" DataSource="PayAccountData.Bonus_PayAccountData" />
- <DataColumn Index="15" DataSource="PayAccountData.Detain_PayAccountData" />
- <DataColumn Index="16" DataSource="PayAccountData.Total_PayAccountData" />
- <DataColumn Index="17" DataSource="PayAccountData.Tax_PayAccountData" />
- <DataColumn Index="18" DataSource="PayAccountData.FactPay_PayAccountData" />
- <DataColumn Index="19" DataSource="PayAccountData.Comment_PayAccountData" />
- </IKDataGridEx>
- <IKFormToolBar name="toolBar">
- <Events>
- <ClickFirst>
- if(Search("SearchPayAccountByNoFirst", tbNo.CValue))
- {
- Search("SearchFactDays",#PayAccount.Begin_AttendanceResult,#PayAccount.End_AttendanceResult);
- #PayAccount.FactDays_AttendanceResult = #FactDays.WorkDays_AttendanceResultData;
- ChangeMode("View");
- }
- </ClickFirst>
- <ClickPrev>
- if(Search("SearchPayAccountByNoPrevious", tbNo.CValue))
- {
- Search("SearchFactDays",#PayAccount.Begin_AttendanceResult,#PayAccount.End_AttendanceResult);
- #PayAccount.FactDays_AttendanceResult = #FactDays.WorkDays_AttendanceResultData;
- ChangeMode("View");
- }
- </ClickPrev>
- <ClickNext>
- if(Search("SearchPayAccountByNoNext", tbNo.CValue))
- {
- Search("SearchFactDays",#PayAccount.Begin_AttendanceResult,#PayAccount.End_AttendanceResult);
- #PayAccount.FactDays_AttendanceResult = #FactDays.WorkDays_AttendanceResultData;
- ChangeMode("View");
- }
- </ClickNext>
- <ClickLast>
- if(Search("SearchPayAccountByNoLast", tbNo.CValue))
- {
- Search("SearchFactDays",#PayAccount.Begin_AttendanceResult,#PayAccount.End_AttendanceResult);
- #PayAccount.FactDays_AttendanceResult = #FactDays.WorkDays_AttendanceResultData;
- ChangeMode("View");
- }
- </ClickLast>
- <ClickNew>
- ;
- </ClickNew>
- <ClickEmpty>
- ChangeMode("Search");
- </ClickEmpty>
- <ClickSubmit>
- <Lable name="SubmitButtonClick" />
- @a = #PayAccount.No_AttendanceResult;
- @b = #PayAccount.FactDays_AttendanceResult;
- Empty();
- NewInstance();
- Search("SearchPayAccount",@a);
- #PayAccount.FactDays_AttendanceResult = @b;
- ChangeMode("View");
-
- </ClickSubmit>
- <ClickModify>
- ChangeMode("Modify");
- </ClickModify>
- <ClickDelete>
- Delete(); ChangeMode("Search");
- </ClickDelete>
- <ClickPrint>
- PrintReport();
- </ClickPrint>
- <ClickAudit>
- BeginAudit();
- #PayAccount.ID_Assessor = GetLoginUserID();
- #PayAccount.Name_Assessor = GetCurrentUser();
- #PayAccount.AssessDate_PayAccount = DateTimeNow();
- Audit();
- ChangeMode("View");
- EndAudit();
- </ClickAudit>
- <ClickUnAudit>
- BeginUnAudit();
- #PayAccount.ID_Assessor = DBNull();
- #PayAccount.Name_Assessor = "";
- UnAudit();
- ChangeMode("View");
- EndUnAudit();
- </ClickUnAudit>
- <ClickImport>
- ;
- </ClickImport>
- <ClickExport>
- ;
- </ClickExport>
- <ClickClose>
- ;
- </ClickClose>
- </Events>
- </IKFormToolBar>
- </Controls>
- <Tables>
- <Table name="PayAccountData">
- <Events>
- <ColumnsChanged>
- <Bonus_PayAccountData>
- Search("SearchPaySetting");
- Search("SearchEmployee",#PayAccountData.ID_Employee);
- #PayAccountData.Total_PayAccountData = #PayAccountData.BasicPay_PayAccountData
- + #PayAccountData.AttendanceBounty_PayAccountData
- + #PayAccountData.OvertimePay_PayAccountData
- + #PayAccountData.Bonus_PayAccountData
- - #PayAccountData.Later_PayAccountData
- - #PayAccountData.LeaveEarly_PayAccountData
- - #PayAccountData.Absent_PayAccountData
- - #PayAccountData.Sick_PayAccountData
- - #PayAccountData.Event_PayAccountData
- - #PayAccountData.Provide_PayAccountData
- - #PayAccountData.Idleness_PayAccountData
- - #PayAccountData.Medical_PayAccountData
- - #PayAccountData.AccumulationFund_PayAccountData
- - #PayAccountData.Detain_PayAccountData;
-
- if (#Employee.Country_Employee == 40)
- {
- @TaxBegin = #PaySetting.TaxBeginCH_PaySetting;
- }
- else
- {
- @TaxBegin = #PaySetting.TaxBeginF_PaySetting;
- }
- if(Search("SearchTaxSetting",#PayAccountData.Total_PayAccountData,#PayAccountData.AttendanceBounty_PayAccountData,@TaxBegin))
- {
- #PayAccountData.Tax_PayAccountData = (#PayAccountData.Total_PayAccountData-#PayAccountData.AttendanceBounty_PayAccountData-@TaxBegin) * #TaxSetting.TaxRate_TaxSetting /100 - #TaxSetting.FastDeduct_TaxSetting;
- }
- else
- {
- #PayAccountData.Tax_PayAccountData = 0;
- }
-
-
- #PayAccountData.FactPay_PayAccountData = #PayAccountData.Total_PayAccountData - #PayAccountData.Tax_PayAccountData;
- </Bonus_PayAccountData>
- <Detain_PayAccountData>
- Search("SearchPaySetting");
- Search("SearchEmployee",#PayAccountData.ID_Employee);
- #PayAccountData.Total_PayAccountData = #PayAccountData.BasicPay_PayAccountData
- + #PayAccountData.AttendanceBounty_PayAccountData
- + #PayAccountData.OvertimePay_PayAccountData
- + #PayAccountData.Bonus_PayAccountData
- - #PayAccountData.Later_PayAccountData
- - #PayAccountData.LeaveEarly_PayAccountData
- - #PayAccountData.Absent_PayAccountData
- - #PayAccountData.Sick_PayAccountData
- - #PayAccountData.Event_PayAccountData
- - #PayAccountData.Provide_PayAccountData
- - #PayAccountData.Idleness_PayAccountData
- - #PayAccountData.Medical_PayAccountData
- - #PayAccountData.AccumulationFund_PayAccountData
- - #PayAccountData.Detain_PayAccountData;
-
- if (#Employee.Country_Employee == 40)
- {
- @TaxBegin = #PaySetting.TaxBeginCH_PaySetting;
- }
- else
- {
- @TaxBegin = #PaySetting.TaxBeginF_PaySetting;
- }
- if(Search("SearchTaxSetting",#PayAccountData.Total_PayAccountData,#PayAccountData.AttendanceBounty_PayAccountData,@TaxBegin))
- {
- #PayAccountData.Tax_PayAccountData = (#PayAccountData.Total_PayAccountData-#PayAccountData.AttendanceBounty_PayAccountData-@TaxBegin) * #TaxSetting.TaxRate_TaxSetting /100 - #TaxSetting.FastDeduct_TaxSetting;
- }
- else
- {
- #PayAccountData.Tax_PayAccountData = 0;
- }
-
-
- #PayAccountData.FactPay_PayAccountData = #PayAccountData.Total_PayAccountData - #PayAccountData.Tax_PayAccountData;
- </Detain_PayAccountData>
- </ColumnsChanged>
- </Events>
- </Table>
- </Tables>
- </Client>
- <Server>
- <Tables>
- <Table name="PayAccount" Type="Parent">
- <GetSchema CmdType="Text" CmdText="Select Top 0 PayAccount.*
- ,No_AttendanceResult
- ,Name_Department
- ,Begin_AttendanceResult
- ,End_AttendanceResult
- ,FactDays_AttendanceResult
- ,PayDays_PayAccount
- ,a.Name_User As Name_Creator
- ,b.Name_User As Name_Assessor
- ,c.Name_User As LastModUserName
- From PayAccount
- Left Join dbo.AttendanceResult On AttendanceResult.ID_AttendanceResult = PayAccount.ID_AttendanceResult
- Left Join dbo.Department On Department.ID_Department = AttendanceResult.ID_Department
- Left Join AppUser a On a.ID_User = PayAccount.ID_Creator
- Left Join AppUser b On b.ID_User = PayAccount.ID_Assessor
- Left Join AppUser c On c.ID_User = PayAccount.LastModUser_PayAccount "/>
- <New CmdType="Text" CmdText="Insert Into dbo.PayAccount(ID_PayAccount
- , ID_AttendanceResult
- , PayDays_PayAccount
- , ID_Creator
- , CreateDate_PayAccount
- , LastModUser_PayAccount
- , LastModDate_PayAccount
- , ID_Assessor
- , AssessDate_PayAccount
- )
- Values(@ID_PayAccount
- , @ID_AttendanceResult
- , @PayDays_PayAccount
- , @ID_Creator
- , @CreateDate_PayAccount
- , @LastModUser_PayAccount
- , @LastModDate_PayAccount
- , @ID_Assessor
- , @AssessDate_PayAccount
- )">
- <Params>
- <Param name="@ID_PayAccount" type="PayAccount.ID_PayAccount" sourceColumn="ID_PayAccount" />
- <Param name="@ID_AttendanceResult" type="PayAccount.ID_AttendanceResult" sourceColumn="ID_AttendanceResult" />
- <Param name="@PayDays_PayAccount" type="PayAccount.PayDays_PayAccount" sourceColumn="PayDays_PayAccount" />
- <Param name="@ID_Creator" type="PayAccount.ID_Creator" sourceColumn="ID_Creator" />
- <Param name="@CreateDate_PayAccount" type="PayAccount.CreateDate_PayAccount" sourceColumn="CreateDate_PayAccount" />
- <Param name="@LastModUser_PayAccount" type="PayAccount.LastModUser_PayAccount" sourceColumn="LastModUser_PayAccount" />
- <Param name="@LastModDate_PayAccount" type="PayAccount.LastModDate_PayAccount" sourceColumn="LastModDate_PayAccount" />
- <Param name="@ID_Assessor" type="PayAccount.ID_Assessor" sourceColumn="ID_Assessor" />
- <Param name="@AssessDate_PayAccount" type="PayAccount.AssessDate_PayAccount" sourceColumn="AssessDate_PayAccount" />
- </Params>
- </New>
- <Update CmdType="Text" CmdText="Update PayAccount
- Set ID_AttendanceResult = @ID_AttendanceResult
- , PayDays_PayAccount = @PayDays_PayAccount
- , ID_Creator = @ID_Creator
- , CreateDate_PayAccount = @CreateDate_PayAccount
- , LastModUser_PayAccount = @LastModUser_PayAccount
- , LastModDate_PayAccount = @LastModDate_PayAccount
- , ID_Assessor = @ID_Assessor
- , AssessDate_PayAccount = @AssessDate_PayAccount
- Where ID_PayAccount = @ID_PayAccount">
- <Params>
- <Param name="@ID_PayAccount" type="PayAccount.ID_PayAccount" sourceColumn="ID_PayAccount" />
- <Param name="@ID_AttendanceResult" type="PayAccount.ID_AttendanceResult" sourceColumn="ID_AttendanceResult" />
- <Param name="@PayDays_PayAccount" type="PayAccount.PayDays_PayAccount" sourceColumn="PayDays_PayAccount" />
- <Param name="@ID_Creator" type="PayAccount.ID_Creator" sourceColumn="ID_Creator" />
- <Param name="@CreateDate_PayAccount" type="PayAccount.CreateDate_PayAccount" sourceColumn="CreateDate_PayAccount" />
- <Param name="@LastModUser_PayAccount" type="PayAccount.LastModUser_PayAccount" sourceColumn="LastModUser_PayAccount" />
- <Param name="@LastModDate_PayAccount" type="PayAccount.LastModDate_PayAccount" sourceColumn="LastModDate_PayAccount" />
- <Param name="@ID_Assessor" type="PayAccount.ID_Assessor" sourceColumn="ID_Assessor" />
- <Param name="@AssessDate_PayAccount" type="PayAccount.AssessDate_PayAccount" sourceColumn="AssessDate_PayAccount" />
- </Params>
- </Update>
- <Audit CmdType="Text" CmdText="Update PayAccount
- Set ID_Assessor = @ID_Assessor
- , AssessDate_PayAccount = @AssessDate_PayAccount
- Where ID_PayAccount = @ID_PayAccount">
- <Params>
- <Param name="@ID_PayAccount" type="PayAccount.ID_PayAccount" sourceColumn="ID_PayAccount" />
- <Param name="@ID_Assessor" type="PayAccount.ID_Assessor" sourceColumn="ID_Assessor" />
- <Param name="@AssessDate_PayAccount" type="PayAccount.AssessDate_PayAccount" sourceColumn="AssessDate_PayAccount" />
- </Params>
- </Audit>
- <Delete CmdType="Text" CmdText="Delete PayAccountData Where ID_PayAccount = @ID_PayAccount
- Delete PayAccount Where ID_PayAccount = @ID_PayAccount">
- <Params>
- <Param name="@ID_PayAccount" type="PayAccount.ID_PayAccount" sourceColumn="ID_PayAccount" />
- </Params>
- </Delete>
- </Table>
- <Table name="PayAccountData" Type="Child">
- <GetSchema CmdType="Text" CmdText="Select Top 0 dbo.PayAccountData.*
- ,No_Employee
- ,Name_Employee
- From PayAccountData
- Left Join Employee On PayAccountData.ID_Employee = Employee.ID_Employee">
-
- </GetSchema>
- <New CmdType="Text" CmdText="Insert Into dbo.PayAccountData(ID_PayAccountData
- , ID_PayAccount
- , ID_Employee
- , BasicPay_PayAccountData
- , OvertimePay_PayAccountData
- , AttendanceBounty_PayAccountData
- , Later_PayAccountData
- , LeaveEarly_PayAccountData
- , Absent_PayAccountData
- , Sick_PayAccountData
- , Event_PayAccountData
- , Provide_PayAccountData
- , Idleness_PayAccountData
- , Medical_PayAccountData
- , AccumulationFund_PayAccountData
- , Bonus_PayAccountData
- , Detain_PayAccountData
- , Total_PayAccountData
- , Tax_PayAccountData
- , FactPay_PayAccountData
- , Comment_PayAccountData
- )
- Values (@ID_PayAccountData
- , @ID_PayAccount
- , @ID_Employee
- , @BasicPay_PayAccountData
- , @OvertimePay_PayAccountData
- , @AttendanceBounty_PayAccountData
- , @Later_PayAccountData
- , @LeaveEarly_PayAccountData
- , @Absent_PayAccountData
- , @Sick_PayAccountData
- , @Event_PayAccountData
- , @Provide_PayAccountData
- , @Idleness_PayAccountData
- , @Medical_PayAccountData
- , @AccumulationFund_PayAccountData
- , @Bonus_PayAccountData
- , @Detain_PayAccountData
- , @Total_PayAccountData
- , @Tax_PayAccountData
- , @FactPay_PayAccountData
- , @Comment_PayAccountData
- )">
- <Params>
- <Param name="@ID_PayAccountData" type="PayAccountData.ID_PayAccountData" sourceColumn="ID_PayAccountData" />
- <Param name="@ID_PayAccount" type="PayAccountData.ID_PayAccount" sourceColumn="ID_PayAccount" />
- <Param name="@ID_Employee" type="PayAccountData.ID_Employee" sourceColumn="ID_Employee" />
- <Param name="@BasicPay_PayAccountData" type="PayAccountData.BasicPay_PayAccountData" sourceColumn="BasicPay_PayAccountData" />
- <Param name="@OvertimePay_PayAccountData" type="PayAccountData.OvertimePay_PayAccountData" sourceColumn="OvertimePay_PayAccountData" />
- <Param name="@AttendanceBounty_PayAccountData" type="PayAccountData.AttendanceBounty_PayAccountData" sourceColumn="AttendanceBounty_PayAccountData" />
- <Param name="@Later_PayAccountData" type="PayAccountData.Later_PayAccountData" sourceColumn="Later_PayAccountData" />
- <Param name="@LeaveEarly_PayAccountData" type="PayAccountData.LeaveEarly_PayAccountData" sourceColumn="LeaveEarly_PayAccountData" />
- <Param name="@Absent_PayAccountData" type="PayAccountData.Absent_PayAccountData" sourceColumn="Absent_PayAccountData" />
- <Param name="@Sick_PayAccountData" type="PayAccountData.Sick_PayAccountData" sourceColumn="Sick_PayAccountData" />
- <Param name="@Event_PayAccountData" type="PayAccountData.Event_PayAccountData" sourceColumn="Event_PayAccountData" />
- <Param name="@Provide_PayAccountData" type="PayAccountData.Provide_PayAccountData" sourceColumn="Provide_PayAccountData" />
- <Param name="@Idleness_PayAccountData" type="PayAccountData.Idleness_PayAccountData" sourceColumn="Idleness_PayAccountData" />
- <Param name="@Medical_PayAccountData" type="PayAccountData.Medical_PayAccountData" sourceColumn="Medical_PayAccountData" />
- <Param name="@AccumulationFund_PayAccountData" type="PayAccountData.AccumulationFund_PayAccountData" sourceColumn="AccumulationFund_PayAccountData" />
- <Param name="@Bonus_PayAccountData" type="PayAccountData.Bonus_PayAccountData" sourceColumn="Bonus_PayAccountData" />
- <Param name="@Detain_PayAccountData" type="PayAccountData.Detain_PayAccountData" sourceColumn="Detain_PayAccountData" />
- <Param name="@Total_PayAccountData" type="PayAccountData.Total_PayAccountData" sourceColumn="Total_PayAccountData" />
- <Param name="@Tax_PayAccountData" type="PayAccountData.Tax_PayAccountData" sourceColumn="Tax_PayAccountData" />
- <Param name="@FactPay_PayAccountData" type="PayAccountData.FactPay_PayAccountData" sourceColumn="FactPay_PayAccountData" />
- <Param name="@Comment_PayAccountData" type="PayAccountData.Comment_PayAccountData" sourceColumn="Comment_PayAccountData" />
- </Params>
- </New>
- <Update CmdType="Text" CmdText="Update dbo.PayAccountData
- Set ID_PayAccount = @ID_PayAccount
- , ID_Employee = @ID_Employee
- , BasicPay_PayAccountData = @BasicPay_PayAccountData
- , OvertimePay_PayAccountData = @OvertimePay_PayAccountData
- , AttendanceBounty_PayAccountData = @AttendanceBounty_PayAccountData
- , Later_PayAccountData = @Later_PayAccountData
- , LeaveEarly_PayAccountData = @LeaveEarly_PayAccountData
- , Absent_PayAccountData = @Absent_PayAccountData
- , Sick_PayAccountData = @Sick_PayAccountData
- , Event_PayAccountData = @Event_PayAccountData
- , Provide_PayAccountData = @Provide_PayAccountData
- , Idleness_PayAccountData = @Idleness_PayAccountData
- , Medical_PayAccountData = @Medical_PayAccountData
- , AccumulationFund_PayAccountData = @AccumulationFund_PayAccountData
- , Bonus_PayAccountData = @Bonus_PayAccountData
- , Detain_PayAccountData = @Detain_PayAccountData
- , Total_PayAccountData = @Total_PayAccountData
- , Tax_PayAccountData = @Tax_PayAccountData
- , FactPay_PayAccountData = @FactPay_PayAccountData
- , Comment_PayAccountData = @Comment_PayAccountData
- Where ID_PayAccountData = @ID_PayAccountData">
- <Params>
- <Param name="@ID_PayAccountData" type="PayAccountData.ID_PayAccountData" sourceColumn="ID_PayAccountData" />
- <Param name="@ID_PayAccount" type="PayAccountData.ID_PayAccount" sourceColumn="ID_PayAccount" />
- <Param name="@ID_Employee" type="PayAccountData.ID_Employee" sourceColumn="ID_Employee" />
- <Param name="@BasicPay_PayAccountData" type="PayAccountData.BasicPay_PayAccountData" sourceColumn="BasicPay_PayAccountData" />
- <Param name="@OvertimePay_PayAccountData" type="PayAccountData.OvertimePay_PayAccountData" sourceColumn="OvertimePay_PayAccountData" />
- <Param name="@AttendanceBounty_PayAccountData" type="PayAccountData.AttendanceBounty_PayAccountData" sourceColumn="AttendanceBounty_PayAccountData" />
- <Param name="@Later_PayAccountData" type="PayAccountData.Later_PayAccountData" sourceColumn="Later_PayAccountData" />
- <Param name="@LeaveEarly_PayAccountData" type="PayAccountData.LeaveEarly_PayAccountData" sourceColumn="LeaveEarly_PayAccountData" />
- <Param name="@Absent_PayAccountData" type="PayAccountData.Absent_PayAccountData" sourceColumn="Absent_PayAccountData" />
- <Param name="@Sick_PayAccountData" type="PayAccountData.Sick_PayAccountData" sourceColumn="Sick_PayAccountData" />
- <Param name="@Event_PayAccountData" type="PayAccountData.Event_PayAccountData" sourceColumn="Event_PayAccountData" />
- <Param name="@Provide_PayAccountData" type="PayAccountData.Provide_PayAccountData" sourceColumn="Provide_PayAccountData" />
- <Param name="@Idleness_PayAccountData" type="PayAccountData.Idleness_PayAccountData" sourceColumn="Idleness_PayAccountData" />
- <Param name="@Medical_PayAccountData" type="PayAccountData.Medical_PayAccountData" sourceColumn="Medical_PayAccountData" />
- <Param name="@AccumulationFund_PayAccountData" type="PayAccountData.AccumulationFund_PayAccountData" sourceColumn="AccumulationFund_PayAccountData" />
- <Param name="@Bonus_PayAccountData" type="PayAccountData.Bonus_PayAccountData" sourceColumn="Bonus_PayAccountData" />
- <Param name="@Detain_PayAccountData" type="PayAccountData.Detain_PayAccountData" sourceColumn="Detain_PayAccountData" />
- <Param name="@Total_PayAccountData" type="PayAccountData.Total_PayAccountData" sourceColumn="Total_PayAccountData" />
- <Param name="@Tax_PayAccountData" type="PayAccountData.Tax_PayAccountData" sourceColumn="Tax_PayAccountData" />
- <Param name="@FactPay_PayAccountData" type="PayAccountData.FactPay_PayAccountData" sourceColumn="FactPay_PayAccountData" />
- <Param name="@Comment_PayAccountData" type="PayAccountData.Comment_PayAccountData" sourceColumn="Comment_PayAccountData" />
- </Params>
- </Update>
- <Delete CmdType="Text" CmdText="Delete PayAccountData Where ID_PayAccountData = @ID_PayAccountData
- ">
- <Params>
- <Param name="@ID_PayAccountData" type="PayAccountData.ID_PayAccountData" sourceColumn="ID_PayAccountData" />
- </Params>
- </Delete>
- </Table>
- </Tables>
- <Search>
-
- <SearchPayAccount CmdType="Text" CmdText=" Select PayAccount.*
- ,No_AttendanceResult
- ,Case AttendanceResult.ID_Department
- When '12345678-1234-1234-1234-123456789012' then '全部'
- else Name_Department end As Name_Department
- ,Begin_AttendanceResult
- ,End_AttendanceResult
- ,FactDays_AttendanceResult
- ,PayDays_PayAccount
- ,a.Name_User As Name_Creator
- ,b.Name_User As Name_Assessor
- ,c.Name_User As LastModUserName
- From PayAccount
- Left Join dbo.AttendanceResult On AttendanceResult.ID_AttendanceResult = PayAccount.ID_AttendanceResult
- Left Join dbo.Department On Department.ID_Department = AttendanceResult.ID_Department
- Left Join AppUser a On a.ID_User = PayAccount.ID_Creator
- Left Join AppUser b On b.ID_User = PayAccount.ID_Assessor
- Left Join AppUser c On c.ID_User = PayAccount.LastModUser_PayAccount
- Where No_AttendanceResult = @No_AttendanceResult
-
- Declare @ID_AttendanceResult Uniqueidentifier
- Declare @ID_PayAccount Uniqueidentifier
- Select @ID_AttendanceResult = ID_AttendanceResult
- From AttendanceResult
- Where No_AttendanceResult = @No_AttendanceResult
- Select @ID_PayAccount = ID_PayAccount
- From PayAccount
- Where ID_AttendanceResult = @ID_AttendanceResult
-
- Select dbo.PayAccountData.*
- ,No_Employee
- ,Name_Employee
- From PayAccountData
- Left Join Employee On PayAccountData.ID_Employee = Employee.ID_Employee
- Where ID_PayAccount = @ID_PayAccount">
- <Params>
- <Param name="@No_AttendanceResult" type="AttendanceResult.No_AttendanceResult" Index="0" />
- </Params>
- <Tables>
- <Table name="PayAccount" />
- <Table name="PayAccountData" />
- </Tables>
- </SearchPayAccount>
-
- <SearchAttendanceResult CmdType="Text" CmdText="
- Select ID_AttendanceResult
- ,No_AttendanceResult
- ,Case AttendanceResult.ID_Department
- When '12345678-1234-1234-1234-123456789012' then '全部'
- else Name_Department end As Name_Department
- ,Begin_AttendanceResult
- ,End_AttendanceResult
- ,FactDays_AttendanceResult
- ,27.5 AS PayDays_PayAccount
- ,ID_Assessor
- From AttendanceResult
- Left Join Department On Department.ID_Department = AttendanceResult.ID_Department
- Where No_AttendanceResult = @No_AttendanceResult
- Declare @ID_AttendanceResult Uniqueidentifier
- Select @ID_AttendanceResult = ID_AttendanceResult
- From AttendanceResult
- Where No_AttendanceResult = @No_AttendanceResult
- Select Employee.ID_Employee
- ,No_Employee
- ,Name_Employee
- From AttendanceResultData
- Left Join Employee On Employee.ID_Employee = AttendanceResultData.ID_Employee
- Where ID_AttendanceResult = @ID_AttendanceResult">
- <Params>
- <Param name="@No_AttendanceResult" type="AttendanceResult.No_AttendanceResult" Index="0" />
- </Params>
- <Tables>
- <Table name="AttendanceResult" />
- <Table name="AttendanceResultData" />
- </Tables>
- </SearchAttendanceResult>
- <SearchDepartment CmdType="Text" CmdText="Select '全部' As Name_Department
- Union all
- Select Name_Department
- From Department">
- <Tables>
- <Table name="Department" />
- </Tables>
- </SearchDepartment>
- <SearchEmployee CmdType="Text" CmdText="Select *
- From Employee
- Where ID_Employee = @ID_Employee">
- <Params>
- <Param name="@ID_Employee" type="Employee.ID_Employee" Index="0" />
- </Params>
- <Tables>
- <Table name="Employee" />
- </Tables>
- </SearchEmployee>
- <SearchPayBase CmdType="Text" CmdText="Select *
- From PayBase
- Where Type_PayBase = @PayLevel_Employee">
- <Params>
- <Param name="@PayLevel_Employee" type="Employee.PayLevel_Employee" Index="0" />
- </Params>
- <Tables>
- <Table name="PayBase" />
- </Tables>
- </SearchPayBase>
- <SearchAttendanceResultData CmdType="Text" CmdText="Declare @ID_AttendanceResult Uniqueidentifier
- Select @ID_AttendanceResult = ID_AttendanceResult
- From AttendanceResult
- Where No_AttendanceResult = @No_AttendanceResult
-
- Select *
- From AttendanceResultData
- Where ID_AttendanceResult = @ID_AttendanceResult
- And ID_Employee = @ID_Employee">
- <Params>
- <Param name="@No_AttendanceResult" type="AttendanceResult.No_AttendanceResult" Index="0" />
- <Param name="@ID_Employee" type="Employee.ID_Employee" Index="1" />
- </Params>
- <Tables>
- <Table name="AttendanceResultData" />
- </Tables>
- </SearchAttendanceResultData>
- <SearchLaterOrEarly CmdType="Text" CmdText="Select *
- From LaterOrLeaveearly
- Where ID_Employee = @ID_Employee
- And Date_LaterOrLeaveearly > @Begin_AttendanceResult
- And Date_LaterOrLeaveearly < @End_AttendanceResult
- And ID_AttendanceResult = @ID_AttendanceResult">
- <Params>
- <Param name="@ID_Employee" type="Employee.ID_Employee" Index="0" />
- <Param name="@Begin_AttendanceResult" type="AttendanceResult.Begin_AttendanceResult" Index="1" />
- <Param name="@End_AttendanceResult" type="AttendanceResult.End_AttendanceResult" Index="2" />
- <Param name="@ID_AttendanceResult" type="AttendanceResult.ID_AttendanceResult" Index="3" />
- </Params>
- <Tables>
- <Table name="LaterOrEarly" />
- </Tables>
- </SearchLaterOrEarly>
- <SearchSickRate CmdType="Text" CmdText="Declare @ServiceLength_SickHoliday decimal(14,2)
- Set @ServiceLength_SickHoliday = 0
- Select @ServiceLength_SickHoliday =datediff(day,OnJobDate_Employee,@End_AttendanceResult)/365.00
- From Employee
- Where ID_Employee = @ID_Employee
- Select Top 1 SickRate_SickHoliday
- From SickHoliday
- Where @ServiceLength_SickHoliday <= ServiceLength_SickHoliday
- Order by ServiceLength_SickHoliday">
- <Params>
- <Param name="@ID_Employee" type="Employee.ID_Employee" Index="0" />
- <Param name="@End_AttendanceResult" type="AttendanceResult.End_AttendanceResult" Index="1" />
- </Params>
- <Tables>
- <Table name="SickRate" />
- </Tables>
- </SearchSickRate>
- <SearchPaySetting CmdType="Text" CmdText="Select *
- From PaySetting">
- <Tables>
- <Table name="PaySetting" />
- </Tables>
- </SearchPaySetting>
- <SearchTaxSetting CmdType="Text" CmdText="Declare @Mouney Decimal(14,2)
- Set @Mouney = @Total_PayAccountData-@AttendanceBounty_PayAccountData-@TaxBeginCH_PaySetting
- Select *
- From TaxSetting
- Where BeginAmount_TaxSetting < @Mouney
- And EndAmount_TaxSetting > @Mouney ">
-
- <Params>
- <Param name="@Total_PayAccountData" type="PayAccountData.Total_PayAccountData" Index="0" />
- <Param name="@AttendanceBounty_PayAccountData" type="AttendanceResult.AttendanceBounty_PayAccountData" Index="1" />
- <Param name="@TaxBeginCH_PaySetting" type="PaySetting.TaxBeginCH_PaySetting" Index="2" />
- </Params>
- <Tables>
- <Table name="TaxSetting" />
- </Tables>
- </SearchTaxSetting>
- <Searchdays CmdType="Text" CmdText="select datediff(day,@Begin_AttendanceResult,@OnDuty_Employee) As FrontPart
- ,datediff(day,@Begin_AttendanceResult,@End_AttendanceResult) As AllPart">
- <Params>
- <Param name="@OnDuty_Employee" type="Employee.OnDuty_Employee" Index="0" />
- <Param name="@Begin_AttendanceResult" type="AttendanceResult.Begin_AttendanceResult" Index="1" />
- <Param name="@End_AttendanceResult" type="AttendanceResult.End_AttendanceResult" Index="2" />
- </Params>
- <Tables>
- <Table name="days" />
- </Tables>
- </Searchdays>
- <SearchModifyBill CmdType="Text" CmdText="Select a.Date_ModifyDepotBill
- , a.ID_Proposer
- From
- (
- Select ModifyDepotBill.ID_ModifyDepotBill
- , No_ModifyDepotBill
- , ID_Product
- , ModifyDepotBillProduct.ID_Location
- , Quantity_ModifyDepotBillProduct
- , Date_ModifyDepotBill
- , ID_Proposer
- From ModifyDepotBill
- Left Join ModifyDepotBillProduct On ModifyDepotBillProduct.ID_ModifyDepotBill = ModifyDepotBill.ID_ModifyDepotBill
- Left Join ModifyTypeSettings On ModifyTypeSettings.ID_ModifyTypeSettings=ModifyDepotBill.Style_ModifyDepotBill
- Where ModName_ModifyTypeSettings = '借出'
- And ID_Assessor Is Not Null
- ) a
- Left Join
- (
- Select ModifyDepotBill.Source_ModifyDepotBill
- , ID_Product
- , ModifyDepotBillProduct.ID_Location
- , Quantity_ModifyDepotBillProduct
- From ModifyDepotBill
- Left Join ModifyDepotBillProduct On ModifyDepotBillProduct.ID_ModifyDepotBill = ModifyDepotBill.ID_ModifyDepotBill
- Left Join ModifyTypeSettings On ModifyTypeSettings.ID_ModifyTypeSettings=ModifyDepotBill.Style_ModifyDepotBill
- Where ModName_ModifyTypeSettings = '借出归还'
- And ID_Assessor Is Not Null
- ) b
- On A.No_ModifyDepotBill = b.Source_ModifyDepotBill
- And a.ID_Location = b.ID_Location
- And a.ID_Product = b.ID_Product
- Where IsNull(a.Quantity_ModifyDepotBillProduct,0)-IsNull(b.Quantity_ModifyDepotBillProduct,0) > 0
- And a.ID_Proposer = @ID_Employee
- And a.Date_ModifyDepotBill < @Begin_AttendanceResult">
- <Params>
- <Param name="@ID_Employee" type="Employee.ID_Employee" Index="0" />
- <Param name="@Begin_AttendanceResult" type="AttendanceResult.Begin_AttendanceResult" Index="1" />
- </Params>
- <Tables>
- <Table name="ModifyBill" />
- </Tables>
- </SearchModifyBill>
- <SearchPayAccountByNoFirst CmdType="Text" CmdText="
- DECLARE @NextNo nvarchar(64)
- SET @NextNo = @No_AttendanceResult
- SELECT TOP 1 @NextNo = AttendanceResult.No_AttendanceResult FROM PayAccount
- Left Join dbo.AttendanceResult On AttendanceResult.ID_AttendanceResult = PayAccount.ID_AttendanceResult
- Where AttendanceResult.ID_Assessor Is Not Null
- ORDER BY AttendanceResult.No_AttendanceResult
-
- Select PayAccount.*
- ,No_AttendanceResult
- ,Case AttendanceResult.ID_Department
- When '12345678-1234-1234-1234-123456789012' then '全部'
- else Name_Department end As Name_Department
- ,Begin_AttendanceResult
- ,End_AttendanceResult
- ,FactDays_AttendanceResult
- ,PayDays_PayAccount
- ,a.Name_User As Name_Creator
- ,b.Name_User As Name_Assessor
- ,c.Name_User As LastModUserName
- From PayAccount
- Left Join dbo.AttendanceResult On AttendanceResult.ID_AttendanceResult = PayAccount.ID_AttendanceResult
- Left Join dbo.Department On Department.ID_Department = AttendanceResult.ID_Department
- Left Join AppUser a On a.ID_User = PayAccount.ID_Creator
- Left Join AppUser b On b.ID_User = PayAccount.ID_Assessor
- Left Join AppUser c On c.ID_User = PayAccount.LastModUser_PayAccount
- Where No_AttendanceResult = @NextNo
-
- Declare @ID_AttendanceResult Uniqueidentifier
- Declare @ID_PayAccount Uniqueidentifier
- Select @ID_AttendanceResult = ID_AttendanceResult
- From AttendanceResult
- Where No_AttendanceResult = @NextNo
- Select @ID_PayAccount = ID_PayAccount
- From PayAccount
- Where ID_AttendanceResult = @ID_AttendanceResult
-
- Select dbo.PayAccountData.*
- ,No_Employee
- ,Name_Employee
- From PayAccountData
- Left Join Employee On PayAccountData.ID_Employee = Employee.ID_Employee
- Where ID_PayAccount = @ID_PayAccount">
- <Params>
- <Param name="@No_AttendanceResult" type="AttendanceResult.No_AttendanceResult" Index="0" />
- </Params>
- <Tables>
- <Table name="PayAccount" />
- <Table name="PayAccountData" />
- </Tables>
- </SearchPayAccountByNoFirst>
- <SearchPayAccountByNoPrevious CmdType="Text" CmdText="DECLARE @NextNo nvarchar(64)
- SET @NextNo = @No_AttendanceResult
- SELECT TOP 1 @NextNo = AttendanceResult.No_AttendanceResult FROM PayAccount
- Left Join dbo.AttendanceResult On AttendanceResult.ID_AttendanceResult = PayAccount.ID_AttendanceResult
- Where AttendanceResult.ID_Assessor Is Not Null
- And AttendanceResult.No_AttendanceResult < @No_AttendanceResult ORDER BY AttendanceResult.No_AttendanceResult Desc
-
- Select PayAccount.*
- ,No_AttendanceResult
- ,Case AttendanceResult.ID_Department
- When '12345678-1234-1234-1234-123456789012' then '全部'
- else Name_Department end As Name_Department
- ,Begin_AttendanceResult
- ,End_AttendanceResult
- ,FactDays_AttendanceResult
- ,PayDays_PayAccount
- ,a.Name_User As Name_Creator
- ,b.Name_User As Name_Assessor
- ,c.Name_User As LastModUserName
- From PayAccount
- Left Join dbo.AttendanceResult On AttendanceResult.ID_AttendanceResult = PayAccount.ID_AttendanceResult
- Left Join dbo.Department On Department.ID_Department = AttendanceResult.ID_Department
- Left Join AppUser a On a.ID_User = PayAccount.ID_Creator
- Left Join AppUser b On b.ID_User = PayAccount.ID_Assessor
- Left Join AppUser c On c.ID_User = PayAccount.LastModUser_PayAccount
- Where No_AttendanceResult = @NextNo
-
- Declare @ID_AttendanceResult Uniqueidentifier
- Declare @ID_PayAccount Uniqueidentifier
- Select @ID_AttendanceResult = ID_AttendanceResult
- From AttendanceResult
- Where No_AttendanceResult = @NextNo
- Select @ID_PayAccount = ID_PayAccount
- From PayAccount
- Where ID_AttendanceResult = @ID_AttendanceResult
-
- Select dbo.PayAccountData.*
- ,No_Employee
- ,Name_Employee
- From PayAccountData
- Left Join Employee On PayAccountData.ID_Employee = Employee.ID_Employee
- Where ID_PayAccount = @ID_PayAccount">
- <Params>
- <Param name="@No_AttendanceResult" type="AttendanceResult.No_AttendanceResult" Index="0" />
- </Params>
- <Tables>
- <Table name="PayAccount" />
- <Table name="PayAccountData" />
- </Tables>
- </SearchPayAccountByNoPrevious>
- <SearchPayAccountByNoNext CmdType="Text" CmdText="DECLARE @NextNo nvarchar(64)
- SET @NextNo = @No_AttendanceResult
- SELECT TOP 1 @NextNo = AttendanceResult.No_AttendanceResult FROM PayAccount
- Left Join dbo.AttendanceResult On AttendanceResult.ID_AttendanceResult = PayAccount.ID_AttendanceResult
- Where AttendanceResult.ID_Assessor Is Not Null
- And AttendanceResult.No_AttendanceResult > @No_AttendanceResult ORDER BY AttendanceResult.No_AttendanceResult
-
- Select PayAccount.*
- ,No_AttendanceResult
- ,Case AttendanceResult.ID_Department
- When '12345678-1234-1234-1234-123456789012' then '全部'
- else Name_Department end As Name_Department
- ,Begin_AttendanceResult
- ,End_AttendanceResult
- ,FactDays_AttendanceResult
- ,PayDays_PayAccount
- ,a.Name_User As Name_Creator
- ,b.Name_User As Name_Assessor
- ,c.Name_User As LastModUserName
- From PayAccount
- Left Join dbo.AttendanceResult On AttendanceResult.ID_AttendanceResult = PayAccount.ID_AttendanceResult
- Left Join dbo.Department On Department.ID_Department = AttendanceResult.ID_Department
- Left Join AppUser a On a.ID_User = PayAccount.ID_Creator
- Left Join AppUser b On b.ID_User = PayAccount.ID_Assessor
- Left Join AppUser c On c.ID_User = PayAccount.LastModUser_PayAccount
- Where No_AttendanceResult = @NextNo
-
- Declare @ID_AttendanceResult Uniqueidentifier
- Declare @ID_PayAccount Uniqueidentifier
- Select @ID_AttendanceResult = ID_AttendanceResult
- From AttendanceResult
- Where No_AttendanceResult = @NextNo
- Select @ID_PayAccount = ID_PayAccount
- From PayAccount
- Where ID_AttendanceResult = @ID_AttendanceResult
-
- Select dbo.PayAccountData.*
- ,No_Employee
- ,Name_Employee
- From PayAccountData
- Left Join Employee On PayAccountData.ID_Employee = Employee.ID_Employee
- Where ID_PayAccount = @ID_PayAccount">
- <Params>
- <Param name="@No_AttendanceResult" type="AttendanceResult.No_AttendanceResult" Index="0" />
- </Params>
- <Tables>
- <Table name="PayAccount" />
- <Table name="PayAccountData" />
- </Tables>
- </SearchPayAccountByNoNext>
- <SearchPayAccountByNoLast CmdType="Text" CmdText="DECLARE @NextNo nvarchar(64)
- SET @NextNo = @No_AttendanceResult
- SELECT TOP 1 @NextNo = AttendanceResult.No_AttendanceResult FROM PayAccount
- Left Join dbo.AttendanceResult On AttendanceResult.ID_AttendanceResult = PayAccount.ID_AttendanceResult
- Where AttendanceResult.ID_Assessor Is Not Null
- ORDER BY AttendanceResult.No_AttendanceResult desc
-
- Select PayAccount.*
- ,No_AttendanceResult
- ,Case AttendanceResult.ID_Department
- When '12345678-1234-1234-1234-123456789012' then '全部'
- else Name_Department end As Name_Department
- ,Begin_AttendanceResult
- ,End_AttendanceResult
- ,FactDays_AttendanceResult
- ,PayDays_PayAccount
- ,a.Name_User As Name_Creator
- ,b.Name_User As Name_Assessor
- ,c.Name_User As LastModUserName
- From PayAccount
- Left Join dbo.AttendanceResult On AttendanceResult.ID_AttendanceResult = PayAccount.ID_AttendanceResult
- Left Join dbo.Department On Department.ID_Department = AttendanceResult.ID_Department
- Left Join AppUser a On a.ID_User = PayAccount.ID_Creator
- Left Join AppUser b On b.ID_User = PayAccount.ID_Assessor
- Left Join AppUser c On c.ID_User = PayAccount.LastModUser_PayAccount
- Where No_AttendanceResult = @NextNo
-
- Declare @ID_AttendanceResult Uniqueidentifier
- Declare @ID_PayAccount Uniqueidentifier
- Select @ID_AttendanceResult = ID_AttendanceResult
- From AttendanceResult
- Where No_AttendanceResult = @NextNo
- Select @ID_PayAccount = ID_PayAccount
- From PayAccount
- Where ID_AttendanceResult = @ID_AttendanceResult
-
- Select dbo.PayAccountData.*
- ,No_Employee
- ,Name_Employee
- From PayAccountData
- Left Join Employee On PayAccountData.ID_Employee = Employee.ID_Employee
- Where ID_PayAccount = @ID_PayAccount">
- <Params>
- <Param name="@No_AttendanceResult" type="AttendanceResult.No_AttendanceResult" Index="0" />
- </Params>
- <Tables>
- <Table name="PayAccount" />
- <Table name="PayAccountData" />
- </Tables>
- </SearchPayAccountByNoLast>
- <SearchFactDays CmdType="Text" CmdText="Declare @ID_Applicant uniqueidentifier
- Declare @No_ApplicationBill nvarchar(64)
- Declare @Item_ApplicationBill nvarchar(64)
- Declare @StartDate_ApplicationBill datetime
- Declare @EndDate_ApplicationBill datetime
- Declare @OnStuffOne datetime
- Declare @OffStuffOne datetime
- Declare @OnStuffTwo datetime
- Declare @OffStuffTwo datetime
- Declare @AppHour decimal(14,1)
- Declare @LoopDate datetime
- IF Exists (Select * From tempdb.dbo.sysobjects Where id=Object_ID(N'tempdb.dbo.#TempApp'))
- DROP TABLE #TempApp
- Create Table #TempApp
- (
- ID_Applicant uniqueidentifier,
- Date varchar(10),
- OvertimeHour decimal(14,1),
- BusinessHour decimal(14,1),
- CompassionateHour decimal(14,1),
- SickHour decimal(14,1),
- SalaryHour decimal(14,1),
- exception bit,
- Comment nvarchar(256)
- )
- Declare cur cursor
- for
- Select ID_Applicant,No_ApplicationBill,Item_ApplicationBill,StartDate_ApplicationBill,EndDate_ApplicationBill
- ,OnStuffOne,OffStuffOne,OnStuffTwo,OffStuffTwo
- From dbo.ApplicationBill
- Join dbo.AttendanceRuleEmployee On ApplicationBill.ID_Applicant=dbo.AttendanceRuleEmployee.ID_Employee
- Join dbo.AttendanceRule On AttendanceRuleEmployee.ID_AttendanceRule=AttendanceRule.ID_AttendanceRule
- Join Employee ON Employee.ID_Employee=dbo.AttendanceRuleEmployee.ID_Employee
- Where ApplicationBill.ID_Assessor Is Not Null
- --And No_Employee Between IsNull(@StartNo_Employee,No_Employee) And IsNull(@EndNo_Employee,No_Employee)
- And DateDiff(day,@Begin_AttendanceResult,EndDate_ApplicationBill)>=0 And DateDiff(day,@End_AttendanceResult,StartDate_ApplicationBill) <=0
- --And ApplicationBill.ID_Department in (Select ID_Department From #department )
- Open cur
- Fetch Next From cur Into @ID_Applicant,@No_ApplicationBill,@Item_ApplicationBill,@StartDate_ApplicationBill,@EndDate_ApplicationBill
- ,@OnStuffOne,@OffStuffOne,@OnStuffTwo,@OffStuffTwo
- while @@fetch_status=0
- BEGIN
- Set @LoopDate=@StartDate_ApplicationBill
- while(DateDiff(day,@LoopDate,@EndDate_ApplicationBill)>=0)
- BEGIN
- IF(DateDiff(day,@Begin_AttendanceResult,@LoopDate)>=0 and DateDiff(day,@End_AttendanceResult,@LoopDate)<=0)
- BEGIN
- IF(DateDiff(day,@StartDate_ApplicationBill,@LoopDate)>0 and DateDiff(day,@EndDate_ApplicationBill,@LoopDate)<0)
- Set @AppHour=Convert(decimal(14,1),(dbo.TimeDiff(@OnStuffOne,@OffStuffOne)+dbo.TimeDiff(@OnStuffTwo,@OffStuffTwo))/60.0)
- Else IF(DateDiff(day,@StartDate_ApplicationBill,@LoopDate)=0)
- BEGIN
- IF(DateDiff(day,@EndDate_ApplicationBill,@LoopDate)<0)
- BEGIN
- IF(dbo.TimeDiff(@LoopDate,@OnStuffOne)>0)
- Set @AppHour=Convert(decimal(14,1),(dbo.TimeDiff(@OnStuffOne,@OffStuffOne)+dbo.TimeDiff(@OnStuffTwo,@OffStuffTwo))/60.0)
- Else IF(dbo.TimeDiff(@StartDate_ApplicationBill,@OffStuffOne)>0)
- Set @AppHour=Convert(decimal(14,1),(dbo.TimeDiff(@StartDate_ApplicationBill,@OffStuffOne)+dbo.TimeDiff(@OnStuffTwo,@OffStuffTwo))/60.0)
- else if(dbo.TimeDiff(@StartDate_ApplicationBill,@OnStuffTwo)>0)
- Set @AppHour=dbo.TimeDiff(@OnStuffTwo,@OffStuffTwo)
- else if(dbo.TimeDiff(@StartDate_ApplicationBill,@OffStuffTwo)>0)
- Set @AppHour=dbo.TimeDiff(@StartDate_ApplicationBill,@OffStuffTwo)/60.0
- else
- Set @AppHour=0
- END
- Else
- BEGIN
- IF(dbo.TimeDiff(@StartDate_ApplicationBill,@OnStuffOne)>0)
- BEGIN
- IF(dbo.TimeDiff(@EndDate_ApplicationBill,@OnStuffOne)>0)
- Set @AppHour=0
- Else IF (dbo.TimeDiff(@EndDate_ApplicationBill,@OffStuffOne)>0)
- Set @AppHour=Convert(decimal(14,1),dbo.TimeDiff(@OnStuffOne,@EndDate_ApplicationBill)/60.0)
- Else if (dbo.TimeDiff(@EndDate_ApplicationBill,@OnStuffTwo)>0)
- Set @AppHour=Convert(decimal(14,1),dbo.TimeDiff(@OnStuffOne,@OffStuffOne))
- else if(dbo.TimeDiff(@EndDate_ApplicationBill,@OffStuffTwo)>0)
- Set @AppHour=Convert(decimal(14,1),(dbo.TimeDiff(@OnStuffOne,@OffStuffOne)+dbo.TimeDiff(@OnStuffTwo,@EndDate_ApplicationBill))/60.0)
- else
- Set @AppHour=Convert(decimal(14,1),(dbo.TimeDiff(@OnStuffOne,@OffStuffOne)+dbo.TimeDiff(@OnStuffTwo,@OffStuffTwo))/60.0)
- END
- Else IF(dbo.TimeDiff(@StartDate_ApplicationBill,@OffStuffOne)>0)
- BEGIN
- IF (dbo.TimeDiff(@EndDate_ApplicationBill,@OffStuffOne)>0)
- Set @AppHour=Convert(decimal(14,1),dbo.TimeDiff(@StartDate_ApplicationBill,@EndDate_ApplicationBill)/60.0)
- Else if (dbo.TimeDiff(@EndDate_ApplicationBill,@OnStuffTwo)>0)
- Set @AppHour=Convert(decimal(14,1),dbo.TimeDiff(@StartDate_ApplicationBill,@OffStuffOne)/60.0)
- else if(dbo.TimeDiff(@EndDate_ApplicationBill,@OffStuffTwo)>0)
- Set @AppHour=Convert(decimal(14,1),(dbo.TimeDiff(@StartDate_ApplicationBill,@OffStuffOne)+dbo.TimeDiff(@OnStuffTwo,@EndDate_ApplicationBill))/60.0)
- else
- Set @AppHour=Convert(decimal(14,1),(dbo.TimeDiff(@StartDate_ApplicationBill,@OffStuffOne)+dbo.TimeDiff(@OnStuffTwo,@OffStuffTwo))/60.0)
- END
- else if(dbo.TimeDiff(@StartDate_ApplicationBill,@OnStuffTwo)>0)
- BEGIN
- IF (dbo.TimeDiff(@EndDate_ApplicationBill,@OnStuffTwo)>0)
- Set @AppHour=0
- Else if (dbo.TimeDiff(@EndDate_ApplicationBill,@OffStuffTwo)>0)
- Set @AppHour=Convert(decimal(14,1),dbo.TimeDiff(@OnStuffTwo,@EndDate_ApplicationBill)/60.0)
- else
- Set @AppHour=Convert(decimal(14,1),dbo.TimeDiff(@OnStuffTwo,@OffStuffTwo)/60.0)
- END
- else if(dbo.TimeDiff(@StartDate_ApplicationBill,@OffStuffTwo)>0)
- BEGIN
- IF (dbo.TimeDiff(@EndDate_ApplicationBill,@OffStuffTwo)>0)
- Set @AppHour=Convert(decimal(14,1),dbo.TimeDiff(@StartDate_ApplicationBill,@EndDate_ApplicationBill)/60.0)
- else
- Set @AppHour=Convert(decimal(14,1),dbo.TimeDiff(@StartDate_ApplicationBill,@OffStuffTwo)/60.0)
- END
- else
- Set @AppHour=0
- END
- END
- ELSE
- BEGIN
- IF(dbo.TimeDiff(@EndDate_ApplicationBill,@OnStuffOne)>0)
- Set @AppHour=0
- Else IF(dbo.TimeDiff(@EndDate_ApplicationBill,@OffStuffOne)>0)
- Set @AppHour=dbo.TimeDiff(@OnStuffOne,@EndDate_ApplicationBill)/60.0
- else if(dbo.TimeDiff(@EndDate_ApplicationBill,@OnStuffTwo)>0)
- Set @AppHour=dbo.TimeDiff(@OnStuffOne,@OffStuffOne)/60.0
- else if(dbo.TimeDiff(@EndDate_ApplicationBill,@OffStuffTwo)>0)
- Set @AppHour=Convert(decimal(14,1),(dbo.TimeDiff(@OnStuffOne,@OffStuffOne)+dbo.TimeDiff(@OnStuffTwo,@EndDate_ApplicationBill))/60.0)
- else
- Set @AppHour=Convert(decimal(14,1),(dbo.TimeDiff(@OnStuffOne,@OffStuffOne)+dbo.TimeDiff(@OnStuffTwo,@OffStuffTwo))/60.0)
- END
-
- IF(Not Exists (Select * From #TempApp Where ID_Applicant=@ID_Applicant And Date=convert(varchar(10),@LoopDate,120)))
- BEGIN
- IF(@Item_ApplicationBill='加班')
- Insert Into #TempApp(ID_Applicant,Date,OvertimeHour,Comment)
- Values(@ID_Applicant,convert(varchar(10),@LoopDate,120),@AppHour,'加班:'+@No_ApplicationBill)
- else if(@Item_ApplicationBill='出差')
- Insert Into #TempApp(ID_Applicant,Date,BusinessHour,Comment)
- Values(@ID_Applicant,convert(varchar(10),@LoopDate,120),@AppHour,'出差:'+@No_ApplicationBill)
- else if(@Item_ApplicationBill='事假')
- Insert Into #TempApp(ID_Applicant,Date,CompassionateHour,Comment)
- Values(@ID_Applicant,convert(varchar(10),@LoopDate,120),@AppHour,'事假:'+@No_ApplicationBill)
- else if(@Item_ApplicationBill='病假')
- Insert Into #TempApp(ID_Applicant,Date,SickHour,Comment)
- Values(@ID_Applicant,convert(varchar(10),@LoopDate,120),@AppHour,'病假:'+@No_ApplicationBill)
- else if(@Item_ApplicationBill='带薪假')
- Insert Into #TempApp(ID_Applicant,Date,SalaryHour,Comment)
- Values(@ID_Applicant,convert(varchar(10),@LoopDate,120),@AppHour,'带薪假:'+@No_ApplicationBill)
- else if(@Item_ApplicationBill='打卡异常')
- Insert Into #TempApp(ID_Applicant,Date,exception,Comment)
- Values(@ID_Applicant,convert(varchar(10),@LoopDate,120),1,'打卡异常:'+@No_ApplicationBill)
- END
- else
- Begin
- IF(@Item_ApplicationBill='加班')
- Update #TempApp Set OvertimeHour=IsNull(OvertimeHour,0)+@AppHour,Comment=Comment+' 加班:'+@No_ApplicationBill Where ID_Applicant=@ID_Applicant And Date=convert(varchar(10),@LoopDate,120)
- else if(@Item_ApplicationBill='出差')
- Update #TempApp Set BusinessHour=IsNull(BusinessHour,0)+@AppHour,Comment=Comment+' 出差:'+@No_ApplicationBill Where ID_Applicant=@ID_Applicant And Date=convert(varchar(10),@LoopDate,120)
- else if(@Item_ApplicationBill='事假')
- Update #TempApp Set CompassionateHour=IsNull(CompassionateHour,0)+@AppHour,Comment=Comment+' 事假:'+@No_ApplicationBill Where ID_Applicant=@ID_Applicant And Date=convert(varchar(10),@LoopDate,120)
- else if(@Item_ApplicationBill='病假')
- Update #TempApp Set SickHour=IsNull(SickHour,0)+@AppHour,Comment=Comment+' 病假:'+@No_ApplicationBill Where ID_Applicant=@ID_Applicant And Date=convert(varchar(10),@LoopDate,120)
- else if(@Item_ApplicationBill='带薪假')
- Update #TempApp Set SalaryHour=IsNull(SalaryHour,0)+@AppHour,Comment=Comment+' 带薪假:'+@No_ApplicationBill Where ID_Applicant=@ID_Applicant And Date=convert(varchar(10),@LoopDate,120)
- else if(@Item_ApplicationBill='打卡异常')
- Update #TempApp Set exception=1,Comment=Comment+' 打卡异常:'+@No_ApplicationBill Where ID_Applicant=@ID_Applicant And Date=convert(varchar(10),@LoopDate,120)
- End
-
- END
- Set @LoopDate=DateAdd(day,1,@LoopDate)
- END
- Fetch Next From cur Into @ID_Applicant,@No_ApplicationBill,@Item_ApplicationBill,@StartDate_ApplicationBill,@EndDate_ApplicationBill
- ,@OnStuffOne,@OffStuffOne,@OnStuffTwo,@OffStuffTwo
- END
- Close cur
- Deallocate cur
- ---------------------------------------------------------------------------------------------------
- IF Exists (Select * From tempdb.dbo.sysobjects Where id=Object_ID(N'tempdb.dbo.#Basic'))
- DROP TABLE #Basic
- Create Table #Basic
- (
- No_Employee nvarchar(64)
- ,Name_Employee nvarchar(64)
- ,Name_Department nvarchar(64)
- ,Date varchar(10)
- ,WeekDay nvarchar(8)
- ,Type_HolidaySetting nvarchar(64)
- ,Name_AttendanceRule nvarchar(64)
- ,StuffHour decimal(14,1)
- ,OnAttendanceOne datetime
- ,OffAttendanceOne datetime
- ,OnAttendanceTwo datetime
- ,OffAttendanceTwo datetime
- ,AttendanceHour decimal(14,1)
- ,OvertimeHour decimal(14,1)
- ,BusinessHour decimal(14,1)
- ,CompassionateHour decimal(14,1)
- ,SickHour decimal(14,1)
- ,SalaryHour decimal(14,1)
- ,AbsentHour decimal(14,1)
- ,ArriveLateMinute int
- ,LeaveEarlyMinute int
- ,Comment nvarchar(256)
- )
- Insert Into #Basic
- 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
- ,OnAttendanceOne
- ,OffAttendanceOne,OnAttendanceTwo,OffAttendanceTwo
- ,case Type_HolidaySetting when '工作日' then
- case when exception=1 then StuffHour
- else AttendanceHour end
- else null end As AttendanceHour
- ,case when #TempApp.OvertimeHour>StuffHour then StuffHour
- else #TempApp.OvertimeHour end As OvertimeHour
- ,case when #TempApp.BusinessHour>StuffHour then StuffHour
- else #TempApp.BusinessHour end As BusinessHour
- ,case when Type_HolidaySetting='工作日' then
- case when #TempApp.CompassionateHour>StuffHour then StuffHour
- else #TempApp.CompassionateHour end
- else null end As CompassionateHour
- ,case when Type_HolidaySetting='工作日' then
- case when #TempApp.SickHour>StuffHour then StuffHour
- else #TempApp.SickHour end
- else null end As SickHour
- ,case when Type_HolidaySetting='工作日' then
- case when #TempApp.SalaryHour>StuffHour then StuffHour
- else #TempApp.SalaryHour end
- else null end As SalaryHour
- ,case when Type_HolidaySetting='工作日' then
- case when exception=1 then null
- else
- case when (StuffHour-IsNull(AttendanceHour,0)-IsNull(BusinessHour,0)-IsNull(CompassionateHour,0)-IsNull(SickHour,0)-IsNull(SalaryHour,0)
- -case when dbo.TimeDiff(OnStuffOne,OnAttendanceOne) <=30 and dbo.TimeDiff(OnStuffOne,OnAttendanceOne)>0 then dbo.TimeDiff(OnStuffOne,OnAttendanceOne) else 0 end
- -case when dbo.TimeDiff(OffAttendanceOne,OffStuffOne)<30 and dbo.TimeDiff(OffAttendanceOne,OffStuffOne)>0 then dbo.TimeDiff(OffAttendanceOne,OffStuffOne) else 0 end ) >0 then
- (StuffHour-IsNull(AttendanceHour,0)-IsNull(BusinessHour,0)-IsNull(CompassionateHour,0)-IsNull(SickHour,0)-IsNull(SalaryHour,0)
- -case when dbo.TimeDiff(OnStuffOne,OnAttendanceOne) <=30 and dbo.TimeDiff(OnStuffOne,OnAttendanceOne)>0 then dbo.TimeDiff(OnStuffOne,OnAttendanceOne) else 0 end
- -case when dbo.TimeDiff(OffAttendanceOne,OffStuffOne)<30 and dbo.TimeDiff(OffAttendanceOne,OffStuffOne)>0 then dbo.TimeDiff(OffAttendanceOne,OffStuffOne) else 0 end )
- else null end
- end
- else null end As AbsentHour
- ,case when Type_HolidaySetting='工作日' And OnAttendanceOne Is Not Null then
- case when exception=1 then null
- else
- case when dbo.TimeDiff(OnStuffOne,OnAttendanceOne)<=ArriveLate_AttendanceRule or dbo.TimeDiff(OnStuffOne,OnAttendanceOne)>30 then null
- else (dbo.TimeDiff(OnStuffOne,OnAttendanceOne)-ArriveLate_AttendanceRule) end
- end
- else null end As ArriveLateMinute
- ,case when Type_HolidaySetting='工作日' And OnAttendanceOne Is Not Null then
- case when exception=1 then null
- else
- case when dbo.TimeDiff(OffAttendanceOne,OffStuffOne)<=LeaveEarly_AttendanceRule or dbo.TimeDiff(OffAttendanceOne,OffStuffOne)>30 then null
- else dbo.TimeDiff(OffAttendanceOne,OffStuffOne)-LeaveEarly_AttendanceRule end
- end
- else null end As LeaveEarlyMinute
- ,Comment
- From
- (
- Select a.*,Convert(decimal(14,1),(DateDiff(minute,OnAttendanceOne,OffAttendanceOne)+DateDiff(minute,OnAttendanceTwo,OffAttendanceTwo))/60.0) As AttendanceHour
- From
- (
- Select EmployeeCalendar.ID_Employee,No_Employee,Name_Employee,Name_Department,convert(varchar(10),Date_HolidaySetting,120) As Date,WeekDay_HolidaySetting,Type_HolidaySetting,Name_AttendanceRule
- ,(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
- ,(Select Top 1 Date_AttendanceRecord From (
- 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
- )a2 Order By Date_AttendanceRecord desc) As OffAttendanceOne
- ,(Select Top 1 Date_AttendanceRecord From (
- 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
- )a3 Order By Date_AttendanceRecord desc) As OnAttendanceTwo
- ,(Select Top 1 Date_AttendanceRecord From (
- 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
- )a4 Order By Date_AttendanceRecord desc) As OffAttendanceTwo
- ,OnStuffOne,OffStuffOne,OnStuffTwo,OffStuffTwo,ArriveLate_AttendanceRule,LeaveEarly_AttendanceRule,TakeOff_AttendanceRule
- ,Convert(decimal(14,1),(dbo.TimeDiff(OnStuffOne,OffStuffOne)+dbo.TimeDiff(OnStuffTwo,OffStuffTwo))/60.0) As StuffHour
- From
- (
- Select *
- From Employee,HolidaySetting
- --Where No_Employee Between IsNull(@StartNo_Employee,No_Employee) And IsNull(@EndNo_Employee,No_Employee)
- Where DateDiff(day,@Begin_AttendanceResult,Date_HolidaySetting)>=0 And DateDiff(day,@End_AttendanceResult,Date_HolidaySetting)<=0
- --And Employee.ID_Department in (Select ID_Department From #department )
- )EmployeeCalendar
- Left Join Department On Department.ID_Department=EmployeeCalendar.ID_Department
- Join dbo.AttendanceRuleEmployee On AttendanceRuleEmployee.ID_Employee=EmployeeCalendar.ID_Employee
- Left Join dbo.AttendanceRule On AttendanceRule.ID_AttendanceRule=dbo.AttendanceRuleEmployee.ID_AttendanceRule
- )a
- )EmployeeInfo
- Left Join #TempApp On #TempApp.ID_Applicant=EmployeeInfo.ID_Employee And #TempApp.Date=EmployeeInfo.Date
- -------------------------------------------------------------------------------------------
- Select top 1 IsNull(Sum(case Type_HolidaySetting when '工作日' then 1 end),0) As WorkDays_AttendanceResultData --工作日
- From
- #Basic
- Group By No_Employee,Name_Employee,StuffHour">
- <Params>
- <Param name="@Begin_AttendanceResult" type="AttendanceResult.Begin_AttendanceResult" sourceColumn="Begin_AttendanceResult" />
- <Param name="@End_AttendanceResult" type="AttendanceResult.End_AttendanceResult" sourceColumn="End_AttendanceResult" />
- </Params>
- <Tables>
- <Table name="FactDays" />
- </Tables>
- </SearchFactDays>
- </Search>
- </Server>
- <Lables>
- <Search>
- Empty();
- NewInstance();
- tbNo.ReadOnly = false;
- cbDept.Enabled = false;
- dtStart.Enabled = false;
- dtEnd.Enabled = false;
- txtDate.ReadOnly = true;
- ikTextBox1.ReadOnly = true;
- txtCreator.ReadOnly = true;
- dttCreateDate.ReadOnly = true;
- txtAssessor.ReadOnly = true;
- dtAssessDate.ReadOnly = true;
- txtLastModUser.ReadOnly = true;
- dtLastModDate.ReadOnly = true;
- btnSearch.Enabled = false;
- dgCalendarList.ReadOnly = true;
- toolBar.EnableSubmit = false;
- toolBar.EnableModify = false;
- toolBar.EnableDelete = false;
- toolBar.EnableAudit = false;
- toolBar.EnableUnAudit = false;
- toolBar.EnablePrint = false;
- #PayAccount.AssessDate_PayAccount = DBNull();
- #PayAccount.LastModUser_PayAccount = DBNull();
- #PayAccount.LastModDate_PayAccount = DBNull();
- UpdateForm(true, "");
- tbNo.Focus();
- @Status = 0;
- </Search>
- <New>
- Empty();
- NewInstance();
- tbNo.ReadOnly = true;
- cbDept.Enabled = false;
- dtStart.Enabled = false;
- dtEnd.Enabled = false;
- txtDate.ReadOnly = true;
- ikTextBox1.ReadOnly = false;
- txtCreator.ReadOnly = true;
- dttCreateDate.ReadOnly = true;
- txtAssessor.ReadOnly = true;
- dtAssessDate.ReadOnly = true;
- txtLastModUser.ReadOnly = true;
- dtLastModDate.ReadOnly = true;
- btnSearch.Enabled = true;
- dgCalendarList.ReadOnly = false;
- toolBar.EnableSubmit = true;
- toolBar.EnableModify = false;
- toolBar.EnableDelete = false;
- toolBar.EnableAudit = false;
- toolBar.EnableUnAudit = false;
- toolBar.EnablePrint = false;
- #PayAccount.ID_PayAccount = NewGuid();
- #PayAccount.ID_Creator = GetLoginUserID();
- #PayAccount.Name_Creator = GetCurrentUser();
- #PayAccount.ID_Assessor = DBNull();
- #PayAccount.AssessDate_PayAccount = DBNull();
- #PayAccount.LastModUser_PayAccount = DBNull();
- #PayAccount.LastModDate_PayAccount = DBNull();
- UpdateForm(true, "");
- ikTextBox1.Focus();
- @Status = 1;
- </New>
- <View>
- tbNo.ReadOnly = true;
- cbDept.Enabled = false;
- dtStart.Enabled = false;
- dtEnd.Enabled = false;
- txtDate.ReadOnly = true;
- ikTextBox1.ReadOnly = true;
- txtCreator.ReadOnly = true;
- dttCreateDate.ReadOnly = true;
- txtAssessor.ReadOnly = true;
- dtAssessDate.ReadOnly = true;
- txtLastModUser.ReadOnly = true;
- dtLastModDate.ReadOnly = true;
- btnSearch.Enabled = false;
- dgCalendarList.ReadOnly = true;
- toolBar.EnableSubmit = false;
- toolBar.EnablePrint = true;
- if(Equals(#PayAccount.ID_Assessor,DBNull()))
- {
- toolBar.EnableModify = GetRight(@Title,"修改");
- toolBar.EnableDelete = GetRight(@Title,"删除");
- toolBar.EnableAudit = GetRight(@Title,"审核");;
- toolBar.EnableUnAudit = false;
- }
- else
- {
- toolBar.EnableModify = false;
- toolBar.EnableDelete = false;
- toolBar.EnableAudit = false;
- toolBar.EnableUnAudit = GetRight(@Title,"取消审核");
- }
- toolBar.EnablePrint = true;
- UpdateForm(true, "");
- @Status = 2;
- tbNo.Focus();
- </View>
- <Modify>
- tbNo.ReadOnly = true;
- cbDept.Enabled = false;
- dtStart.Enabled = false;
- dtEnd.Enabled = false;
- txtDate.ReadOnly = true;
- ikTextBox1.ReadOnly = false;
- txtCreator.ReadOnly = true;
- dttCreateDate.ReadOnly = true;
- txtAssessor.ReadOnly = true;
- dtAssessDate.ReadOnly = true;
- txtLastModUser.ReadOnly = true;
- dtLastModDate.ReadOnly = true;
- btnSearch.Enabled = true;
- dgCalendarList.ReadOnly = false;
- toolBar.EnableSubmit = true;
- toolBar.EnableModify = false;
- toolBar.EnableDelete = false;
- toolBar.EnableAudit = false;
- toolBar.EnableUnAudit = false;
- toolBar.EnablePrint = false;
- #PayAccount.LastModUser_PayAccount = GetLoginUserID();
- #PayAccount.LastModUserName = GetCurrentUser();
- #PayAccount.LastModDate_PayAccount = DateTimeNow();
- UpdateForm(true, "");
- @Status = 3;
- </Modify>
- <SubmitButtonClick>
- <![CDATA[
- if (ikTextBox1.CValue < 0)
- {
- ikTextBox1.Focus();
- MessageBox("薪资计算日大于0!",@Title);
- return;
- }
- UpdateForm(false, "");
- SuspendLayout();
- for (@i=0;@i<RowCount("#PayAccountData");@i=@i+1)
- {
- SetPosition("#PayAccountData", @i);
- if (Equals(#PayAccountData.ID_PayAccountData,GuidEmpty()))
- #PayAccountData.ID_PayAccountData = NewGuid();
- #PayAccountData.ID_PayAccount =#PayAccount.ID_PayAccount;
- }
- ResumeLayout();
- if(@Status == 1)
- {
- #PayAccount.CreateDate_PayAccount = DateTimeNow();
- New();
- }
- else if(@Status == 3)
- {
- #PayAccount.LastModDate_PayAccount = DateTimeNow();
- Update();
- }
- ChangeMode("View");
- ]]>
- </SubmitButtonClick>
- </Lables>
- </Form>
- </Forms>
|