123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538 |
- $PBExportHeader$uo_addemp.sru
- forward
- global type uo_addemp from nonvisualobject
- end type
- end forward
- global type uo_addemp from nonvisualobject
- end type
- global uo_addemp uo_addemp
- type variables
- long addempid
- long departmentid
- string duty //申请职位
- datetime billdate //申请日期
- datetime arrivedate //希望到职日期
- decimal qty //增补人数
- string reason //申请理由
- string sex //性别
- string ifmarry //婚否
- long agepri //年龄-起
- long ageend //年龄-止
- string diploma //学历
- string specialty //专业
- string postname //职称
- string englevel //英语水平
- string experienece //经验
- string dscrp //补充内容
- string petition //申请人
- string administration //行政部
- string depmanager //部门经理
- string genmanager //总经理
- string addempcode //单据编码
- long flag //审核状态
- string opemp
- datetime opdate
- string modemp
- datetime moddate
- string auditrep
- datetime auditdate
- string dscrp2
- boolean it_newbegin=false //新建标志
- boolean it_updatebegin=false//修改标志
- end variables
- forward prototypes
- public function integer p_reset ()
- public function integer p_getinfo (long arg_addempid, ref string arg_msg)
- public function integer newbegin ()
- public function integer save (ref string arg_msg, boolean arg_ifcommit)
- public function integer del (long arg_addempid, ref string arg_msg)
- public function integer auditing (long arg_addempid, ref string arg_msg, boolean arg_ifcommit)
- public function integer c_auditing (long arg_addempid, ref string arg_msg, boolean arg_ifcommit)
- public function integer updatebegin (long arg_addempid, ref string arg_msg)
- end prototypes
- public function integer p_reset ();addempid = 0
- departmentid = 0
- duty = ''
- qty = 0
- reason = ''
- sex = ''
- ifmarry = ''
- agepri = 0
- ageend = 0
- diploma = ''
- specialty = ''
- postname = ''
- englevel = ''
- experienece = ''
- dscrp = ''
- petition = ''
- administration = ''
- depmanager = ''
- genmanager = ''
- addempcode = ''
- flag = 0
- dscrp2 = ''
- it_newbegin=false
- it_updatebegin=false
- return 1
- end function
- public function integer p_getinfo (long arg_addempid, ref string arg_msg);long rslt = 1
- SELECT u_addemp.departmentid,
- u_addemp.duty,
- u_addemp.arrivedate,
- u_addemp.qty,
- u_addemp.reason,
- u_addemp.sex,
- u_addemp.ifmarry,
- u_addemp.agepri,
- u_addemp.ageend,
- u_addemp.diploma,
- u_addemp.specialty,
- u_addemp.postname,
- u_addemp.englevel,
- u_addemp.experienece,
- u_addemp.dscrp,
- u_addemp.petition,
- u_addemp.administration,
- u_addemp.depmanager,
- u_addemp.genmanager,
- u_addemp.addempcode,
- u_addemp.flag,
- u_addemp.opemp,
- u_addemp.opdate,
- u_addemp.modemp,
- u_addemp.moddate,
- u_addemp.auditrep,
- u_addemp.auditdate ,
- u_addemp.dscrp2
- into :departmentid,
- :duty,
- :arrivedate,
- :qty,
- :reason,
- :sex,
- :ifmarry,
- :agepri,
- :ageend,
- :diploma,
- :specialty,
- :postname,
- :englevel,
- :experienece,
- :dscrp,
- :petition,
- :administration,
- :depmanager,
- :genmanager,
- :addempcode,
- :flag,
- :opemp,
- :opdate,
- :modemp,
- :moddate,
- :auditrep,
- :auditdate,
- :dscrp2
- from u_addemp
- where u_addemp.addempid = :arg_addempid ;
- if sqlca.sqlcode <> 0 then
- rslt = 0
- arg_msg = '查询人员增补申请单失败(错误单据唯一码)'+sqlca.sqlerrtext
- goto ext
- end if
- addempid = arg_addempid
- ext:
- return rslt
- end function
- public function integer newbegin ();p_reset()
- it_newbegin=TRUE
- it_updatebegin=FALSE
- return 1
- end function
- public function integer save (ref string arg_msg, boolean arg_ifcommit);Long rslt = 1
- DateTime server_dt
- Long ls_newid
- IF IsNull(departmentid) THEN departmentid = 0
- IF IsNull(duty) THEN duty = ''
- IF IsNull(qty) THEN qty = 0
- IF IsNull(reason) THEN reason = ''
- IF IsNull(sex) THEN sex = ''
- IF IsNull(ifmarry) THEN ifmarry = ''
- IF IsNull(agepri) THEN agepri = 0
- IF IsNull(ageend) THEN ageend = 0
- IF IsNull(diploma) THEN diploma = ''
- IF IsNull(specialty) THEN specialty = ''
- IF IsNull(postname) THEN postname = ''
- IF IsNull(englevel) THEN englevel = ''
- IF IsNull(experienece) THEN experienece = ''
- IF IsNull(dscrp) THEN dscrp = ''
- IF IsNull(petition) THEN petition = ''
- IF IsNull(administration) THEN administration = ''
- IF IsNull(depmanager) THEN depmanager = ''
- IF IsNull(genmanager) THEN genmanager = ''
- IF IsNull(flag) THEN flag = 0
- IF IsNull(dscrp2) THEN dscrp2 = ''
- IF it_newbegin = False And it_updatebegin = False THEN
- rslt = 0
- arg_msg = "非编辑状态不可以提交"
- GOTO ext
- END IF
- SELECT Top 1 getdate() Into :server_dt From u_user;
- //取得系统时间,借用操作员表
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = "查询操作失败,日期 "
- GOTO ext
- END IF
- IF addempid = 0 THEN
- ls_newid = f_sys_scidentity(0,"u_addemp","addempid",arg_msg,False,sqlca)
- IF ls_newid < 0 THEN
- rslt = 0
- GOTO ext
- END IF
-
- addempcode = getid(0,"ZB",Date(server_dt),False,sqlca) //取得新单据编号
- IF addempcode = "err" THEN
- addempcode = ''
- rslt = 0
- arg_msg = "无法获取人员增补单编号"
- GOTO ext
- END IF
-
- INSERT INTO u_addemp(
- u_addemp.addempid,
- u_addemp.departmentid,
- u_addemp.duty,
- u_addemp.billdate,
- u_addemp.arrivedate,
- u_addemp.qty,
- u_addemp.reason,
- u_addemp.sex,
- u_addemp.ifmarry,
- u_addemp.agepri,
- u_addemp.ageend,
- u_addemp.diploma,
- u_addemp.specialty,
- u_addemp.postname,
- u_addemp.englevel,
- u_addemp.experienece,
- u_addemp.dscrp,
- u_addemp.petition,
- u_addemp.administration,
- u_addemp.depmanager,
- u_addemp.genmanager,
- u_addemp.addempcode,
- u_addemp.flag,
- u_addemp.opemp,
- u_addemp.opdate,
- u_addemp.dscrp2)
- VALUES ( :ls_newid,
- :departmentid,
- :duty,
- :billdate,
- :arrivedate,
- :qty,
- :reason,
- :sex,
- :ifmarry,
- :agepri,
- :ageend,
- :diploma,
- :specialty,
- :postname,
- :englevel,
- :experienece,
- :dscrp,
- :petition,
- :administration,
- :depmanager,
- :genmanager,
- :addempcode,
- 0,
- :publ_operator,
- :server_dt,
- :dscrp2);
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = "因网络或其它原因导致插入操作失败>>"+"~n"+sqlca.SQLErrText
- GOTO ext
- END IF
-
- addempid = ls_newid
-
- ELSE
- UPDATE u_addemp
- SET departmentid = :departmentid,
- duty = :duty,
- billdate = :billdate,
- arrivedate = :arrivedate,
- qty = :qty,
- reason = :reason,
- sex = :sex,
- ifmarry = :ifmarry,
- agepri = :agepri,
- ageend = :ageend,
- diploma = :diploma,
- specialty = :specialty,
- postname = :postname,
- englevel = :englevel,
- experienece = :experienece,
- dscrp = :dscrp,
- petition = :petition,
- administration = :administration,
- depmanager = :depmanager,
- genmanager = :genmanager,
- addempcode = :addempcode,
- modemp = :publ_operator,
- moddate = :server_dt,
- dscrp2 = :dscrp2
- WHERE u_addemp.addempid = :addempid AND
- u_addemp.flag = 0;
- IF sqlca.SQLCode <> 0 Or sqlca.SQLNRows <= 0 THEN
- rslt = 0
- arg_msg = "因网络或其它原因导致更新单据操作失败"+"~n"+sqlca.SQLErrText
- GOTO ext
- END IF
- END IF
- it_newbegin = False
- it_updatebegin = False
- ext:
- IF rslt = 0 THEN
- ROLLBACK;
- ELSEIF rslt = 1 And arg_ifcommit THEN
- COMMIT;
- END IF
- Return(rslt)
- end function
- public function integer del (long arg_addempid, ref string arg_msg);long rslt = 1
- if arg_addempid <= 0 then
- rslt = 0
- arg_msg = '没有删除对象,取消操作'
- goto ext
- end if
- if p_getinfo(arg_addempid,arg_msg) = 0 then
- rslt = 0
- goto ext
- end if
- if flag = 1 then
- rslt = 0
- arg_msg = "该人员增补单已经审核,不能删除"
- goto ext
- end if
- if it_newbegin or it_updatebegin then
- rslt=0
- arg_msg="编辑状态下不可以执行,操作取消"
- goto ext
- end if
- delete from u_addemp where u_addemp.addempid = :arg_addempid;
- if sqlca.sqlcode <> 0 then
- rslt = 0
- arg_msg = "删除人员增补单操作失败"+"~n"+sqlca.sqlerrtext
- goto ext
- end if
- commit;
- it_newbegin = false
- it_updatebegin = false
- if rslt = 0 then
- rollback;
- p_reset()
- end if
- ext:
- return (rslt)
- end function
- public function integer auditing (long arg_addempid, ref string arg_msg, boolean arg_ifcommit);long rslt = 1 ,cnt
- IF arg_addempid<=0 THEN
- rslt=0
- ARG_MSG='错误人员增补单唯一码'
- goto ext
- end if
- if p_getinfo(arg_addempid,arg_msg)=0 then
- rslt=0
- goto ext
- end if
- if flag = 1 then
- rslt=0
- arG_MSG="该人员增补单已经审核,操作取消"
- goto ext
- END IF
- cnt=0
- SELECT count(*) INTO :cnt
- FROM u_user
- WHERE username=:publ_operator using sqlca;
- if sqlca.sqlcode<>0 then
- rslt=0
- arG_MSG="查询操作失败,操作员!"
- goto ext
- end if
- if cnt=0 then
- rslt=0
- arG_MSG="操作员姓名未登记或已取消!"
- goto ext
- end if
- update u_addemp
- set flag = 1,
- auditrep = :publ_operator,
- auditdate = getdate()
- where u_addemp.addempid = :arg_addempid;
- if sqlca.sqlcode<>0 then
- ARG_msg='更新人员增补单审核状态失败,原因>>'+sqlca.sqlerrtext
- rslt=0
- goto ext
- end if
- ext:
- if rslt=0 then
- rollback;
- elseif rslt=1 and arg_ifcommit then
- commit;
- end if
- return rslt
- end function
- public function integer c_auditing (long arg_addempid, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1
- Long cnt = 0
- DateTime null_server_dt
- SetNull(null_server_dt)
- IF arg_addempid <= 0 THEN
- rslt = 0
- ARG_MSG = '错误人员增补单唯一码'
- GOTO ext
- END IF
- IF p_getinfo(arg_addempid,ARG_MSG) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
- IF flag = 0 THEN
- rslt = 0
- ARG_MSG = "该人员增补单还未审核,操作取消"
- GOTO ext
- END IF
- cnt = 0
- SELECT count(*) INTO :cnt
- From u_employ Where addempid = :arg_addempid;
- IF sqlca.SQLCode <> 0 THEN
- ARG_MSG = '查询单据是否已开初试单失败,'+sqlca.SQLErrText
- rslt = 0
- GOTO ext
- END IF
- IF cnt > 0 THEN
- ARG_MSG = '单据已开初试单失败,不能撤审'
- rslt = 0
- GOTO ext
- END IF
- cnt = 0
- SELECT count(*) INTO :cnt
- From u_reexam Where addempid = :arg_addempid;
- IF sqlca.SQLCode <> 0 THEN
- ARG_MSG = '查询单据是否已开复试单失败,'+sqlca.SQLErrText
- rslt = 0
- GOTO ext
- END IF
- IF cnt > 0 THEN
- ARG_MSG = '单据已开复试单失败,不能撤审'
- rslt = 0
- GOTO ext
- END IF
- UPDATE u_addemp
- SET flag = 0 ,
- auditrep = '',
- auditdate = :null_server_dt
- Where u_addemp.addempid = :arg_addempid And flag = 1 ;
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- ARG_MSG = '更新人员增补单状态失败!原因:'+sqlca.SQLErrText
- GOTO ext
- END IF
- ext:
- IF rslt = 0 THEN
- ROLLBACK;
- ELSEIF rslt = 1 And arg_ifcommit THEN
- COMMIT;
- END IF
- RETURN rslt
- end function
- public function integer updatebegin (long arg_addempid, ref string arg_msg);int rslt = 1
- if arg_addempid <= 0 then
- rslt = 0
- arg_msg = '错误的规章制度唯一码'
- goto ext
- end if
- if p_getinfo(arg_addempid,arg_msg)=0 then
- rslt=0
- goto ext
- end if
- if flag = 1 then
- rslt = 0
- arg_msg = "规章制度已审核,不能修改"
- goto ext
- end if
- addempid = arg_addempid
- it_newbegin = false
- it_updatebegin = true
- ext:
- if rslt = 0 then p_reset()
- return rslt
- end function
- on uo_addemp.create
- call super::create
- TriggerEvent( this, "constructor" )
- end on
- on uo_addemp.destroy
- TriggerEvent( this, "destructor" )
- call super::destroy
- end on
|