123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512 |
- $PBExportHeader$uo_msttake_other.sru
- forward
- global type uo_msttake_other from nonvisualobject
- end type
- end forward
- global type uo_msttake_other from nonvisualobject
- end type
- global uo_msttake_other uo_msttake_other
- type variables
- Public ProtectedWrite Long billid
- Public ProtectedWrite String billcode
- Public ProtectedWrite String auditemp
- Public ProtectedWrite DateTime auditdate
- Public ProtectedWrite Int flag
- Public ProtectedWrite Int secflag
- Public ProtectedWrite String Opemp
- Public ProtectedWrite DateTime Opdate
- Public ProtectedWrite String ModEmp
- Public ProtectedWrite DateTime ModDate
- Long scid
- String credencecode
- Long banktypeid
- Decimal amt
- Long accountsid
- DateTime outdate
- String Descrp
- String rep
- Long rapmoneyid
- Long itemid
- Long relid
- Int billtype //0-其它收入支出,1-借款,2-还款
- Long empid
- Long deptid
- Int itemflag
- Long relrapid
- long moneyid
- long spt_cus_id
- decimal finish_amt
- Transaction commit_transaction //数据commit事务
- Int cwauditingflag = 0 //总账审核标记
- DateTime cwauditingdate //总账审核时间
- String cwauditingrep //总账审核操作员
- Private:
- Boolean IT_NEWBEGIN = False //新建标志
- Boolean IT_UPDATEBEGIN = False //修改标志
- Long it_mxbt = 0
- s_income_expenses_mx incomemx[]
- //int sys_option_income_secaudit
- end variables
- forward prototypes
- public function integer p_reset ()
- public function integer newbegin (ref string arg_msg)
- public function integer cancelpermit (long arg_billid, ref string arg_msg, boolean arg_ifcommit)
- public function integer cancel (long arg_billid, ref string arg_msg, boolean arg_ifcommit)
- public function integer p_getinfo (long arg_billid, ref string arg_msg)
- public function integer permit (long arg_billid, string arg_emp, ref string arg_msg, boolean arg_ifcommit)
- public function integer updatebegin (long arg_billid, ref string arg_msg)
- public function integer save (string arg_operator, ref string arg_msg, boolean arg_ifcommit)
- public function integer add_dscrp (long arg_billid, string arg_newdescppart, ref string arg_msg, boolean arg_ifcommit)
- public function integer cancelpermit2 (long arg_billid, ref string arg_msg, boolean arg_ifcommit)
- public function integer permit2 (long arg_billid, string arg_emp, ref string arg_msg, boolean arg_ifcommit)
- public function integer add_dscrp (long arg_billid, string arg_newdescppart, ref string arg_msg)
- public function integer p_clearmx ()
- public function integer getinfo (long arg_billid, ref string arg_msg)
- public function integer acceptmx (long arg_itemid, decimal arg_amt, long arg_deptid, integer arg_buildtype, long arg_relscid, long arg_relbillid, string arg_relbillcode, string arg_useemp, string arg_mxdscrp, ref string arg_msg)
- public function integer audit_subject (long arg_scid, long arg_billid, boolean arg_ifcommit, ref string arg_msg)
- public function integer c_audit_subject (long arg_scid, long arg_billid, boolean arg_ifcommit, ref string arg_msg)
- end prototypes
- public function integer p_reset ();
- billid = 0
- billcode = ''
- credencecode = ''
- banktypeid = 0
- amt = 0
- accountsid = 0
- setnull(outdate)
- Descrp = ''
- rep = ''
- relid = 0
- rapmoneyid = 0
- moneyid = 0
- empid = 0
- billtype = 0
- itemid = 0
- deptid = 0
- flag = 0
- Opemp = ''
- setnull(Opdate)
- setnull(ModDate)
- ModEmp = ''
- auditemp = ''
- setnull(auditdate)
- it_newbegin=FALSE
- it_updatebegin=FALSE
- p_clearmx()
- RETURN 1
- end function
- public function integer newbegin (ref string arg_msg);//newbegin()
- //从置对象,设定业务类型,准备建立新单
- //0 fail 1 success
- LONG RSLT=1
- p_reset()
- it_newbegin=TRUE
- it_updatebegin=FALSE
- return RSLT
- end function
- public function integer cancelpermit (long arg_billid, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1
- DateTime nulldate
- Long ll_i
- SetNull(nulldate)
- IF sys_option_income_secaudit = -1000 THEN
- rslt = 0
- arg_msg = '选项:[328]其它收入支出单使用二级审核,读取初始默认值失败,操作取消!'
- GOTO ext
- END IF
- uo_iteminput uo_item
- uo_item = Create uo_iteminput
- uo_item.ib_CreateRapmoneyid = False
- //uo_item.commit_transaction = commit_transaction
- uo_empinfo uo_emptake
- uo_emptake = Create uo_empinfo
- uo_rapmoney uo_money
- uo_money = Create uo_rapmoney
- uo_money.commit_transaction = commit_transaction
- IF arg_billid <= 0 THEN
- rslt = 0
- arg_msg = '错误单据唯一码'
- GOTO ext
- END IF
- IF getinfo(arg_billid,arg_msg) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
- IF finish_amt > 0 THEN
- rslt = 0
- arg_msg = '已开相关其他收款单,不能撤审'
- GOTO ext
- END IF
- IF flag <> 1 THEN
- rslt = 0
- arg_msg = "单据只有在已审核状态才可以执行撤消审核,请核对"
- GOTO ext
- END IF
- IF secflag = 1 THEN
- rslt = 0
- arg_msg = "单据已财务确认,不能执行撤消审核,请核对"
- GOTO ext
- END IF
- UPDATE U_income_expenses
- SET flag = 0,
- auditemp = '',
- auditdate = :nulldate,
- relrapid = 0
- WHERE U_income_expenses.billid = :arg_billid
- AND flag = 1
- Using commit_transaction ;
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = "单据撤消审核操作失败"+"~n"+commit_transaction.SQLErrText
- GOTO ext
- END IF
- it_newbegin = False
- it_updatebegin = False
- ext:
- IF rslt = 0 THEN
- ROLLBACK Using commit_transaction;
- ELSEIF rslt = 1 And arg_ifcommit THEN
- COMMIT Using commit_transaction;
- END IF
- p_reset()
- Destroy uo_item
- Destroy uo_emptake
- Destroy uo_money
- Return (rslt)
- end function
- public function integer cancel (long arg_billid, ref string arg_msg, boolean arg_ifcommit);
- //0 FAIL, 1 SUCCESS
- Int rslt = 1
- IF arg_billid <= 0 THEN
- rslt = 0
- ARG_MSG = '错误单据唯一码'
- GOTO ext
- END IF
- IF p_getinfo(arg_billid,ARG_MSG) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
- IF flag <> 0 THEN
- rslt = 0
- ARG_MSG = "单据已经审核,不可以删除"
- GOTO ext
- END IF
- DELETE FROM U_income_expenses
- Where U_income_expenses.billid = :arg_billid USING commit_transaction ;
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- ARG_MSG = "删除单据操作失败"+"~n"+commit_transaction.SQLErrText
- GOTO ext
- END IF
- DELETE FROM U_income_expenses_mx
- Where U_income_expenses_mx.billid = :arg_billid USING commit_transaction;
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = "删除单据明细操作失败"+"~n"+commit_transaction.SQLErrText
- ROLLBACK USING commit_transaction;
- GOTO ext
- END IF
- it_newbegin = FALSE
- it_updatebegin = FALSE
- ext:
- IF rslt = 0 THEN
- ROLLBACK USING commit_transaction;
- ELSEIF arg_ifcommit AND rslt = 1 THEN
- COMMIT USING commit_transaction;
- END IF
- p_reset()
- Return (rslt)
- end function
- public function integer p_getinfo (long arg_billid, ref string arg_msg);Int rslt = 1
- SELECT U_income_expenses.billid,
- U_income_expenses.billcode,
- U_income_expenses.credencecode,
- U_income_expenses.banktypeid,
- U_income_expenses.amt,
- U_income_expenses.accountsid,
- U_income_expenses.outdate,
- U_income_expenses.Descrp,
- U_income_expenses.rep,
- U_income_expenses.rapmoneyid,
- U_income_expenses.itemid,
- U_income_expenses.flag,
- U_income_expenses.secflag,
- U_income_expenses.Opemp,
- U_income_expenses.Opdate,
- U_income_expenses.ModDate,
- U_income_expenses.ModEmp,
- U_income_expenses.auditemp,
- U_income_expenses.auditdate,
- U_income_expenses.relid,
- U_income_expenses.billtype,
- U_income_expenses.empid,
- U_income_expenses.deptid,
- U_income_expenses.relrapid,
- U_income_expenses.itemflag,
- U_income_expenses.scid,
- U_income_expenses.moneyid,
- U_income_expenses.spt_cus_id,
- U_income_expenses.finish_amt,
- U_income_expenses.cwauditingflag,
- U_income_expenses.cwauditingrep,
- U_income_expenses.cwauditingdate
- INTO :billid,
- :billcode,
- :credencecode,
- :banktypeid,
- :amt,
- :accountsid,
- :outdate,
- :Descrp,
- :rep,
- :rapmoneyid,
- :itemid,
- :flag,
- :secflag,
- :Opemp,
- :Opdate,
- :ModDate,
- :ModEmp,
- :auditemp,
- :auditdate,
- :relid,
- :billtype,
- :empid,
- :deptid,
- :relrapid,
- :itemflag,
- :scid,
- :moneyid,
- :spt_cus_id,
- :finish_amt,
- :cwauditingflag,
- :cwauditingrep,
- :cwauditingdate
- FROM U_income_expenses
- Where ( U_income_expenses.billid = :arg_billid ) ;
-
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = "查询其他收入单操作失败"+sqlca.SQLErrText
- GOTO ext
- END IF
- ext:
- RETURN rslt
- end function
- public function integer permit (long arg_billid, string arg_emp, ref string arg_msg, boolean arg_ifcommit);
- Int rslt = 1
- Long cnt = 0,ll_i
- Long ref_dateint
- uo_iteminput uo_item
- uo_item = Create uo_iteminput
- uo_item.ib_CreateRapmoneyid = false
- uo_empinfo uo_emptake
- uo_emptake = Create uo_empinfo
- uo_rapmoney uo_money
- uo_money = Create uo_rapmoney
- uo_money.commit_transaction = commit_transaction
- IF sys_option_income_secaudit = -1000 THEN
- rslt = 0
- arg_msg = '选项:[328]其它收入支出单使用二级审核,读取初始默认值失败,操作取消!'
- GOTO ext
- END IF
- IF arg_billid <= 0 THEN
- rslt = 0
- arg_msg = '错误其他收入支出单唯一码'
- GOTO ext
- END IF
- IF getinfo(arg_billid,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_user
- Where username = :arg_emp Using commit_transaction;
- IF commit_transaction.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_income_expenses
- SET auditemp = :arg_emp ,
- auditdate = getdate(),
- flag = 1,
- relrapid = 0
- WHERE billid = :arg_billid
- AND flag = 0
- Using commit_transaction;
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = "更单据审核操作失败 ~n"+commit_transaction.SQLErrText
- GOTO ext
- END IF
- it_newbegin = False
- it_updatebegin = False
- ext:
- IF rslt = 0 THEN
- ROLLBACK Using commit_transaction;
- ELSEIF rslt = 1 And arg_ifcommit THEN
- COMMIT Using commit_transaction;
- END IF
- p_reset()
- Destroy uo_item
- Destroy uo_money
- Destroy uo_emptake
- Return (rslt)
- end function
- public function integer updatebegin (long arg_billid, ref string arg_msg);//UPDATEbegin(long arg_taskid,ref string arg_msg)
- //从置对象,设定业务类型与关联ID,准备更新进仓单
- //0 fail 1 success
- Long rslt = 1,CNT = 0
- IF sys_option_income_secaudit = -1000 THEN
- rslt = 0
- arg_msg = '选项:[328]其它收入支出单使用二级审核,读取初始默认值失败,操作取消!'
- GOTO ext
- END IF
- IF arg_billid <= 0 THEN
- rslt = 0
- arg_msg = '错误其他收入支出单唯一码'
- GOTO ext
- END IF
- IF p_getinfo(arg_billid,arg_msg) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
- IF sys_option_income_secaudit = 0 THEN
- IF flag <> 0 THEN
- rslt = 0
- arg_msg = '已经处于审核或完成等状态,不可以修改,如果其他收入支出单未完成并要修改请先撤销审核'
- GOTO ext
- END IF
- ELSE
- IF secflag <> 0 THEN
- rslt = 0
- arg_msg = '已经处于财务确认状态,不可以修改,如果其他收入支出单未完成并要修改请先撤销财务确认'
- GOTO ext
- END IF
- END IF
- it_newbegin = False
- it_updatebegin = True
- p_clearmx() //清除明细
- amt = 0
- ext:
- IF rslt = 0 THEN p_reset()
- RETURN rslt
- end function
- public function integer save (string arg_operator, ref string arg_msg, boolean arg_ifcommit);
- Integer rslt = 1,cnt = 0,i
- Long ls_newid
- DateTime server_datetime
- Long ll_id
- String ls_sccode
- IF IsNull(credencecode) THEN credencecode = ''
- IF IsNull(banktypeid) THEN banktypeid = 0
- IF IsNull(amt) THEN amt = 0
- IF IsNull(accountsid) THEN accountsid = 0
- IF IsNull(Descrp) THEN Descrp = ''
- IF IsNull(rep) THEN rep = ''
- IF IsNull(arg_operator) THEN arg_operator = ''
- IF IsNull(rapmoneyid) THEN rapmoneyid = 0
- IF IsNull(itemid) THEN itemid = 0
- IF IsNull(deptid) THEN deptid = 0
- IF IsNull(scid) THEN scid = 0
- IF IsNull(itemflag) THEN itemflag = 1
- IF IsNull(moneyid) THEN moneyid = 0
- IF IsNull(spt_cus_id) THEN spt_cus_id = 0
- IF it_newbegin = False And it_updatebegin = False THEN
- rslt = 0
- arg_msg = "非编辑状态不可以提交"
- GOTO ext
- END IF
- IF it_mxbt = 0 THEN
- rslt = 0
- arg_msg = '没有明细内容'
- GOTO ext
- END IF
- amt = 0
- FOR i = 1 To it_mxbt
- amt = amt + incomemx[i].amt
- NEXT
- IF amt = 0 THEN
- rslt = 0
- arg_msg = "请输入金额"
- GOTO ext
- END IF
- IF f_check_inoutdate(0,outdate,False,arg_msg) = 0 THEN
- rslt = 0
- arg_msg = "该单据超出指定日期范围(单据限制录入天数)"
- GOTO ext
- END IF
- //IF billtype = 1 Or billtype = 2 THEN
- // IF empid = 0 THEN
- // arg_msg = '请选择员工'
- // rslt = 0
- // GOTO ext
- // END IF
-
- // IF itemid = 0 THEN
- // rslt = 0
- // arg_msg = "请选择收支项目"
- // GOTO ext
- // END IF
- //
- // cnt = 0
- // SELECT count(*) INTO :cnt
- // FROM u_itemdef
- // WHERE itemid = :itemid
- // Using commit_transaction;
- // IF commit_transaction.SQLCode <> 0 THEN
- // arg_msg = '查询项目资料失败,'+sqlca.SQLErrText
- // rslt = 0
- // GOTO ext
- // END IF
- //END IF
- IF rep = '' THEN
- rslt = 0
- arg_msg = "请输入经手人"
- GOTO ext
- END IF
- IF banktypeid = 0 THEN
- rslt = 0
- arg_msg = "请选择结算方式"
- GOTO ext
- END IF
- //IF accountsid = 0 THEN
- // rslt = 0
- // arg_msg = "请选择银行帐号"
- // GOTO ext
- //END IF
- //SELECT moneyid
- // INTO :rapmoneyid
- // FROM u_accounts
- // WHERE u_accounts.accountsid = :accountsid
- // Using commit_transaction;
- //IF commit_transaction.SQLCode <> 0 THEN
- // arg_msg = '查询当前的出纳帐号币种失败,'+sqlca.SQLErrText
- // rslt = 0
- // GOTO ext
- //END IF
- moneyid = rapmoneyid
- cnt = 0
- SELECT count(*)
- INTO :cnt
- FROM cw_currency
- WHERE cw_currency.moneyid = :moneyid
- USING commit_transaction;
- IF commit_transaction.SQLCode <> 0 THEN
- arg_msg = '查询币种失败,'+sqlca.SQLErrText
- rslt = 0
- GOTO ext
- END IF
- IF cnt <> 1 THEN
- arg_msg = '账号的币种重复或不存在!'
- rslt = 0
- GOTO ext
- END IF
- //IF credencecode = '' THEN
- // rslt = 0
- // arg_msg = "请输入相关号"
- // GOTO ext
- //END IF
- SELECT Top 1 getdate() Into :server_datetime From u_user Using commit_transaction ;
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = "查询操作失败,日期 "
- GOTO ext
- END IF
- cnt = 0
- SELECT count(*) INTO :cnt
- FROM u_user
- Where username = :arg_operator Using commit_transaction ;
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = "查询操作失败,操作员!"
- GOTO ext
- END IF
- IF cnt = 0 THEN
- rslt = 0
- arg_msg = "操作员姓名未登记或已取消!"
- GOTO ext
- END IF
- opdate = server_datetime //填写单据建立时间(最近修改时间)
- ////////////////////////////////////////////// //开始区分:新建/更新 处理
- IF billid = 0 THEN //新建
- ll_id = f_sys_scidentity(0,"U_income_expenses","billid",arg_msg,True,id_sqlca)
- IF ll_id <= 0 THEN
- rslt = 0
- GOTO ext
- END IF
-
- //取分部代号
- IF f_get_sccode(scid,commit_transaction,ls_sccode,arg_msg) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
-
- IF billtype = 3 THEN
- billcode = getid(0,ls_sccode + 'OT',Date(server_datetime),False,commit_transaction)
- END IF
-
- IF billcode = "err" THEN
- billcode = ''
- rslt = 0
- arg_msg = "无法获取单据编号"+"~n"+sqlca.SQLErrText
- GOTO ext
- END IF
-
- //读取新taskid
- billid = ll_id
- INSERT INTO U_income_expenses
- ( billid,
- billcode,
- credencecode,
- banktypeid,
- amt,
- accountsid,
- outdate,
- Descrp,
- rep,
- rapmoneyid,
- itemid,
- billtype,
- empid,
- Opemp,
- Opdate,
- deptid,
- itemflag,
- scid,
- moneyid,
- spt_cus_id)
- VALUES
- (
- :billid,
- :billcode,
- :credencecode,
- :banktypeid,
- :amt,
- :accountsid,
- :outdate,
- :Descrp,
- :rep,
- :rapmoneyid,
- :itemid,
- :billtype,
- :empid,
- :arg_operator,
- :opdate,
- :deptid,
- :itemflag,
- :scid,
- :moneyid,
- :spt_cus_id) Using commit_transaction ;
- IF commit_transaction.SQLCode <> 0 THEN
- if it_newbegin then billid = 0
- rslt = 0
- arg_msg = "插入其他收入支出单操作失败"+"~n"+commit_transaction.SQLErrText
- GOTO ext
- END IF
-
- // FOR i = 1 To it_mxbt
- // INSERT INTO U_income_expenses_mx
- // (billid,
- // printid,
- // itemid,
- // amt,
- // deptid,
- // buildtype,
- // relscid,
- // relbillid,
- // relbillcode,
- // useemp,
- // mxdscrp)
- // VALUES (:billid,
- // :incomemx[i].printid,
- // :incomemx[i].itemid,
- // :incomemx[i].amt,
- // :incomemx[i].deptid,
- // :incomemx[i].buildtype,
- // :incomemx[i].relscid,
- // :incomemx[i].relbillid,
- // :incomemx[i].relbillcode,
- // :incomemx[i].useemp,
- // :incomemx[i].mxdscrp) Using commit_transaction ;
- // IF commit_transaction.SQLCode <> 0 THEN
- // rslt = 0
- // arg_msg = "插入其他收入支出单明细操作失败"+"~n"+commit_transaction.SQLErrText
- // GOTO ext
- // END IF
- // NEXT
-
- ELSE //////////////////////////////////////////////// //更新
-
- UPDATE U_income_expenses
- SET
- billcode = :billcode,
- credencecode = :credencecode,
- banktypeid = :banktypeid,
- amt = :amt,
- accountsid = :accountsid,
- outdate = :outdate,
- Descrp = :Descrp,
- rep = :rep,
- empid = :empid,
- rapmoneyid = :rapmoneyid,
- itemid = :itemid,
- ModDate = getdate(),
- ModEmp = :arg_operator,
- deptid = :deptid,
- itemflag = :itemflag,
- scid = :scid,
- moneyid = :moneyid,
- spt_cus_id=:spt_cus_id
- WHERE U_income_expenses.billID = :billID
- Using commit_transaction;
- IF commit_transaction.SQLCode <> 0 Or commit_transaction.SQLNRows <= 0 THEN
- rslt = 0
- arg_msg = "更新其他收入支出单操作失败"+"~n"+commit_transaction.SQLErrText
- GOTO ext
- END IF
-
- DELETE FROM U_income_expenses_mx
- Where U_income_expenses_mx.billid = :billid Using commit_transaction;
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = "删除旧有明细操作失败"+"~n"+commit_transaction.SQLErrText
- GOTO ext
- END IF
-
- // FOR i = 1 To it_mxbt
- // INSERT INTO U_income_expenses_mx
- // (billid,
- // printid,
- // itemid,
- // amt,
- // deptid,
- // buildtype,
- // relscid,
- // relbillid,
- // relbillcode,
- // useemp,
- // mxdscrp)
- // VALUES (:billid,
- // :incomemx[i].printid,
- // :incomemx[i].itemid,
- // :incomemx[i].amt,
- // :incomemx[i].deptid,
- // :incomemx[i].buildtype,
- // :incomemx[i].relscid,
- // :incomemx[i].relbillid,
- // :incomemx[i].relbillcode,
- // :incomemx[i].useemp,
- // :incomemx[i].mxdscrp) Using commit_transaction ;
- // IF commit_transaction.SQLCode <> 0 THEN
- // rslt = 0
- // arg_msg = "插入其他收入支出单明细操作失败"+"~n"+commit_transaction.SQLErrText
- // GOTO ext
- // END IF
- // NEXT
- END IF
- FOR i = 1 To it_mxbt
- INSERT INTO U_income_expenses_mx
- (billid,
- printid,
- itemid,
- amt,
- deptid,
- buildtype,
- relscid,
- relbillid,
- relbillcode,
- useemp,
- mxdscrp)
- VALUES (:billid,
- :incomemx[i].printid,
- :incomemx[i].itemid,
- :incomemx[i].amt,
- :incomemx[i].deptid,
- :incomemx[i].buildtype,
- :incomemx[i].relscid,
- :incomemx[i].relbillid,
- :incomemx[i].relbillcode,
- :incomemx[i].useemp,
- :incomemx[i].mxdscrp) Using commit_transaction ;
- IF commit_transaction.SQLCode <> 0 THEN
- if it_newbegin then billid = 0
- rslt = 0
- arg_msg = "插入其他收入支出单明细操作失败"+"~n"+commit_transaction.SQLErrText
- GOTO ext
- END IF
- NEXT
- it_newbegin = False
- it_updatebegin = False
- ext:
- IF rslt = 0 THEN
- ROLLBACK Using commit_transaction;
- p_clearmx()
- ELSEIF arg_ifcommit And rslt = 1 THEN
- COMMIT Using commit_transaction;
- END IF
- RETURN rslt
- end function
- public function integer add_dscrp (long arg_billid, string arg_newdescppart, ref string arg_msg, boolean arg_ifcommit);//add_dscrp(string arg_newdescppart)
- //0 fail 1 SUCCESS
- Int rslt = 1
- arg_newdescppart = Trim(arg_newdescppart)
- IF it_updatebegin Or it_newbegin THEN
- rslt = 0
- arG_MSG = "编辑状态下不可用"
- GOTO ext
- END IF
- IF arg_newdescppart = '' THEN
- rslt = 0
- arG_MSG = "要添加内容为空,操作取消"
- GOTO ext
- END IF
- IF p_getinfo(arg_billid,arG_MSG) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
- IF flag <> 1 THEN
- rslt = 0
- arG_MSG = "待审核状态下不可用"
- GOTO ext
- END IF
- UPDATE U_income_expenses
- SET descrp = ltrim(rtrim(descrp))+' '+:arg_newdescppart
- Where U_income_expenses.billid = :arg_billid Using commit_transaction;
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arG_MSG = "添加单据备注操作失败"+"~n"+commit_transaction.SQLErrText
- ROLLBACK Using commit_transaction;
- GOTO ext
- END IF
- IF relrapid > 0 THEN
- UPDATE u_rap_money
- SET dscrp = ltrim(rtrim(dscrp)) + ' '+:arg_newdescppart
- Where rapmoneyid = :relrapid Using commit_transaction;
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arG_MSG = "添加相关出纳帐备注操作失败"+"~n"+commit_transaction.SQLErrText
- ROLLBACK Using commit_transaction;
- GOTO ext
- END IF
- END IF
- descrp = descrp+' '+arg_newdescppart
- it_newbegin = False
- it_updatebegin = False
- ext:
- IF arg_ifcommit And rslt = 1 THEN
- COMMIT Using commit_transaction;
- END IF
- p_reset()
- Return (rslt)
- end function
- public function integer cancelpermit2 (long arg_billid, ref string arg_msg, boolean arg_ifcommit);return 1
- //Int rslt = 1
- //Long ll_i
- //DateTime nulldate
- //SetNull(nulldate)
- //
- //IF sys_option_income_secaudit = -1000 THEN
- // rslt = 0
- // arg_msg = '选项:[328]其它收入支出单使用二级审核,读取初始默认值失败,操作取消!'
- // GOTO ext
- //END IF
- //
- //uo_iteminput uo_item
- //uo_item = Create uo_iteminput
- //uo_item.ib_CreateRapmoneyid = false
- //
- //IF arg_billid <= 0 THEN
- // rslt = 0
- // arg_msg = '错误单据唯一码'
- // GOTO ext
- //END IF
- //
- //IF getinfo(arg_billid,arg_msg) = 0 THEN
- // rslt = 0
- // GOTO ext
- //END IF
- //
- //IF secflag = 0 THEN
- // rslt = 0
- // arg_msg = "单据未财务确认,请检查"
- // GOTO ext
- //END IF
- //
- //IF sys_option_income_secaudit = 1 THEN
- // FOR ll_i = 1 To it_mxbt
- // IF incomemx[ll_i].itemid = 0 THEN CONTINUE
- // IF uo_item.del_iteminput(incomemx[ll_i].itemid,incomemx[ll_i].rel_dateint,1,arg_msg,False) = 0 THEN
- // MessageBox('系统提示',arg_msg)
- // rslt = 0
- // GOTO ext
- // END IF
- // NEXT
- //END IF
- //
- //UPDATE U_income_expenses
- // SET secflag = 0,
- // secauditemp = '',
- // secauditdate = :nulldate
- // WHERE U_income_expenses.billid = :arg_billid
- // AND secflag = 1
- // Using commit_transaction ;
- //IF commit_transaction.SQLCode <> 0 THEN
- // rslt = 0
- // arg_msg = "单据财务反确认操作失败"+"~n"+commit_transaction.SQLErrText
- // GOTO ext
- //END IF
- //
- //it_newbegin = False
- //it_updatebegin = False
- //
- //ext:
- //
- //IF rslt = 0 THEN
- // ROLLBACK Using commit_transaction;
- //ELSEIF rslt = 1 And arg_ifcommit THEN
- // COMMIT Using commit_transaction;
- //END IF
- //
- //p_reset()
- //
- //Return (rslt)
- //
- //
- //
- //
- end function
- public function integer permit2 (long arg_billid, string arg_emp, ref string arg_msg, boolean arg_ifcommit);return 1
- //Int rslt = 1
- //Long cnt = 0
- //Long ll_i
- //Long ref_dateint
- //
- //uo_iteminput uo_item
- //uo_item = Create uo_iteminput
- //uo_item.ib_CreateRapmoneyid = false
- //
- //
- //IF arg_billid <= 0 THEN
- // rslt = 0
- // ARG_MSG = '错误单据唯一码'
- // GOTO ext
- //END IF
- //
- //IF sys_option_income_secaudit = -1000 THEN
- // rslt = 0
- // ARG_MSG = '选项:[328]其它收入支出单使用二级审核,读取初始默认值失败,操作取消!'
- // GOTO ext
- //END IF
- //
- //IF getinfo(arg_billid,ARG_MSG) = 0 THEN
- // rslt = 0
- // GOTO ext
- //END IF
- //
- //IF flag = 0 THEN
- // rslt = 0
- // ARG_MSG = "单据未审核,不能进行财务确认"
- // GOTO ext
- //END IF
- //
- //IF secflag = 1 THEN
- // rslt = 0
- // ARG_MSG = "单据已财务确认,请检查"
- // GOTO ext
- //END IF
- //
- //cnt = 0
- //SELECT count(*) INTO :cnt
- // FROM u_user
- // Where username = :arg_emp Using commit_transaction;
- //IF commit_transaction.SQLCode <> 0 THEN
- // rslt = 0
- // ARG_MSG = "查询操作失败,操作员!"
- // GOTO ext
- //END IF
- //
- //IF cnt = 0 THEN
- // rslt = 0
- // ARG_MSG = "操作员姓名未登记或已取消!"
- // GOTO ext
- //END IF
- //
- //IF sys_option_income_secaudit = 1 THEN
- // s_iteminput s_input
- //
- //
- // FOR ll_i = 1 To it_mxbt
- // s_input.itemid = incomemx[ll_i].itemid
- // s_input.dateint = 0
- // s_input.outdate = outdate
- // s_input.dscrp = Descrp + ' ' + incomemx[ll_i].mxdscrp
- // s_input.outamt = incomemx[ll_i].amt
- // s_input.accountsid = accountsid
- // s_input.banktypeid = banktypeid
- // s_input.billcode = billcode
- // s_input.relcode = credencecode
- // s_input.buildtype = 1
- // s_input.opemp = publ_operator
- // s_input.relrep = rep
- // s_input.scid = scid
- //
- // IF uo_item.add_iteminput(s_input,ARG_MSG,False) = 0 THEN
- // rslt = 0
- // GOTO ext
- // END IF
- //
- // ref_dateint = uo_item.ref_dateint
- //
- // UPDATE U_income_expenses_mx
- // SET rel_dateint = :ref_dateint
- // WHERE billid = :arg_billid
- // And printid = :incomemx[ll_i].printid Using commit_transaction;
- // IF commit_transaction.SQLCode <> 0 THEN
- // rslt = 0
- // ARG_MSG = "更单据明细相关信息失败 ~n"+commit_transaction.SQLErrText
- // GOTO ext
- // END IF
- // NEXT
- //END IF
- //
- //
- //UPDATE U_income_expenses
- // SET secauditemp = :arg_emp ,
- // secauditdate = getdate(),
- // U_income_expenses.secflag = 1
- // WHERE U_income_expenses.billid = :arg_billid
- // AND U_income_expenses.secflag = 0
- // AND U_income_expenses.flag = 1
- // Using commit_transaction;
- //IF commit_transaction.SQLCode <> 0 THEN
- // rslt = 0
- // ARG_MSG = "更单据审核操作失败"+"~n"+commit_transaction.SQLErrText
- // GOTO ext
- //END IF
- //
- //it_newbegin = False
- //it_updatebegin = False
- //
- //ext:
- //IF rslt = 0 THEN
- // ROLLBACK Using commit_transaction;
- //ELSEIF rslt = 1 And arg_ifcommit THEN
- // COMMIT Using commit_transaction;
- //END IF
- //p_reset()
- //
- //Return (rslt)
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- end function
- public function integer add_dscrp (long arg_billid, string arg_newdescppart, ref string arg_msg);return add_dscrp(arg_billid, arg_newdescppart, arg_msg, true)
- //Int rslt = 1
- //s_rap_money_transfer arg_s_rap_money_transfer
- //
- //IF arg_billid <= 0 THEN
- // rslt = 0
- // arg_msg = '错误单据唯一码'
- // GOTO ext
- //END IF
- //
- //IF arg_newdescppart = '' THEN
- // rslt = 0
- // arg_msg = "要添加内容为空,操作取消"
- // GOTO ext
- //END IF
- //
- //IF p_getinfo(arg_billid,arg_msg) = 0 THEN
- // rslt = 0
- // GOTO ext
- //END IF
- //
- //IF flag = 0 THEN
- // rslt = 0
- // arg_msg = '单据未审核,不可以增加备注'
- // GOTO ext
- //END IF
- //
- //UPDATE U_income_expenses
- // SET DSCRP = ltrim(rtrim(DSCRP))+' '+:arg_newdescppart
- // WHERE U_income_expenses.billid = :arg_billid
- // And flag = 1;
- //IF SQLCA.SQLCode <> 0 THEN
- // rslt = 0
- // arg_msg = "添加备注操作失败"+"~n"+SQLCA.SQLErrText
- // GOTO ext
- //END IF
- //
- //ext:
- //IF rslt = 1 THEN
- // COMMIT;
- //ELSE
- // ROLLBACK;
- //END IF
- //
- //Return (rslt)
- end function
- public function integer p_clearmx ();it_mxbt = 0
- return 1
- end function
- public function integer getinfo (long arg_billid, ref string arg_msg);Int rslt = 1
- Long i = 1 ,no_mxcheck
- IF arg_billid <= 0 THEN
- rslt = 0
- arg_msg = '错误单据唯一码'
- GOTO ext
- END IF
- IF p_getinfo(arg_billid,arg_msg) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
- DECLARE cur_mx CURSOR FOR
- SELECT billid,printid, itemid, amt, deptid, buildtype, relscid, relbillid, relbillcode,rel_dateint,useemp,mxdscrp
- FROM U_income_expenses_mx
- Where billid = :arg_billid Using commit_transaction;
-
- OPEN cur_mx;
- FETCH cur_mx INTO :incomemx[i].billid,
- :incomemx[i].printid,
- :incomemx[i].itemid,
- :incomemx[i].amt,
- :incomemx[i].deptid,
- :incomemx[i].buildtype,
- :incomemx[i].relscid,
- :incomemx[i].relbillid,
- :incomemx[i].relbillcode,
- :incomemx[i].rel_dateint,
- :incomemx[i].useemp,
- :incomemx[i].mxdscrp;
-
- DO WHILE sqlca.SQLCode = 0
- i++
- FETCH cur_mx INTO :incomemx[i].billid,
- :incomemx[i].printid,
- :incomemx[i].itemid,
- :incomemx[i].amt,
- :incomemx[i].deptid,
- :incomemx[i].buildtype,
- :incomemx[i].relscid,
- :incomemx[i].relbillid,
- :incomemx[i].relbillcode,
- :incomemx[i].rel_dateint,
- :incomemx[i].useemp,
- :incomemx[i].mxdscrp;
-
- LOOP
- CLOSE cur_mx;
- SELECT count(*) INTO :no_mxcheck
- FROM U_income_expenses_mx
- Where billid = :arg_billid Using commit_transaction;
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = "查询操作失败,收入支出单明细数量"
- GOTO ext
- END IF
- IF i <> (no_mxcheck+1) THEN
- rslt = 0
- arg_msg = "查询操作失败,收入支出单明细"
- GOTO ext
- END IF
- it_mxbt = i - 1
- it_newbegin = False
- it_updatebegin = False
- ext:
- IF rslt = 0 THEN p_reset()
- RETURN rslt
- end function
- public function integer acceptmx (long arg_itemid, decimal arg_amt, long arg_deptid, integer arg_buildtype, long arg_relscid, long arg_relbillid, string arg_relbillcode, string arg_useemp, string arg_mxdscrp, ref string arg_msg);Int rslt = 1
- Long cnt
- Int li_ifdepart,li_ifemp
- IF it_newbegin = False And it_updatebegin = False THEN
- rslt = 0
- arg_msg = "非编辑状态不可以使用,操作取消"
- GOTO ext
- END IF
- it_mxbt++
- IF arg_itemid = 0 THEN
- rslt = 0
- arg_msg = "明细第"+String(it_mxbt)+"行,请选择收支项目"
- GOTO ext
- END IF
- SELECT ifdepart,ifemp
- INTO :li_ifdepart,:li_ifemp
- FROM u_itemdef
- WHERE itemid = :arg_itemid
- Using commit_transaction;
- IF commit_transaction.SQLCode <> 0 THEN
- arg_msg = "明细第"+String(it_mxbt)+"行,查询项目资料失败,"+sqlca.SQLErrText
- rslt = 0
- GOTO ext
- END IF
- IF arg_buildtype = 0 THEN
- arg_relscid = 0
- arg_relbillid = 0
- //arg_relbillcode = ''
-
- // IF li_ifdepart = 1 And arg_deptid = 0 THEN
- // arg_msg = "明细第"+String(it_mxbt)+"行,收支项目限制必须选择部门,请选择"
- // rslt = 0
- // GOTO ext
- // END IF
- //
- // IF li_ifemp = 1 And Trim(arg_useemp) = '' THEN
- // arg_msg = "明细第"+String(it_mxbt)+"行,收支项目限制必须填写使用人"
- // rslt = 0
- // GOTO ext
- // END IF
- END IF
- incomemx[it_mxbt].itemid = arg_itemid
- incomemx[it_mxbt].deptid = arg_deptid
- incomemx[it_mxbt].relscid = arg_relscid
- incomemx[it_mxbt].relbillid = arg_relbillid
- incomemx[it_mxbt].buildtype = arg_buildtype
- incomemx[it_mxbt].relbillcode = arg_relbillcode
- incomemx[it_mxbt].printid = it_mxbt
- incomemx[it_mxbt].amt = arg_amt
- incomemx[it_mxbt].useemp = arg_useemp
- incomemx[it_mxbt].mxdscrp = arg_mxdscrp
- ext:
- IF rslt = 0 THEN p_clearmx()
- RETURN rslt
- end function
- public function integer audit_subject (long arg_scid, long arg_billid, boolean arg_ifcommit, ref string arg_msg);
- Int rslt = 1,cnt = 0
- IF arg_billid = 0 THEN
- rslt = 0
- arg_msg = "没有审核对象"
- GOTO ext
- END IF
- IF p_getinfo(arg_billid,arg_msg) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
- IF flag = 0 THEN
- rslt = 0
- arg_msg = "单据没有审核"
- GOTO ext
- END IF
- IF cwauditingflag = 1 THEN
- rslt = 0
- arg_msg = "单据已经总账审核"
- GOTO ext
- END IF
- UPDATE u_income_expenses
- SET cwauditingflag = 1,
- cwauditingdate = getdate(),
- cwauditingrep = :publ_operator
- WHERE ( u_income_expenses.billid = :arg_billid ) AND
- ( u_income_expenses.scid = :arg_scid) Using commit_transaction;
-
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = "因网络或其它原因导致总账审核操作失败"+"~n"+commit_transaction.SQLErrText
- ROLLBACK Using commit_transaction;
- GOTO ext
- END IF
- ext:
- IF arg_ifcommit And rslt = 1 THEN
- COMMIT Using commit_transaction;
- END IF
- Return (rslt)
- end function
- public function integer c_audit_subject (long arg_scid, long arg_billid, boolean arg_ifcommit, ref string arg_msg);
- Int rslt = 1,cnt = 0
- IF arg_billid = 0 THEN
- rslt = 0
- arg_msg = "没有审核对象"
- GOTO ext
- END IF
- IF p_getinfo(arg_billid,arg_msg) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
- IF cwauditingflag = 0 THEN
- rslt = 0
- arg_msg = "单据没有总账审核"
- GOTO ext
- END IF
- UPDATE u_income_expenses
- SET cwauditingflag = 0,
- cwauditingdate = NULL,
- cwauditingrep = ''
- WHERE ( u_income_expenses.billid = :arg_billid ) AND
- ( u_income_expenses.scid = :arg_scid) Using commit_transaction;
-
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = "因网络或其它原因导致总账撤审操作失败"+"~n"+commit_transaction.SQLErrText
- ROLLBACK Using commit_transaction;
- GOTO ext
- END IF
- ext:
- IF arg_ifcommit And rslt = 1 THEN
- COMMIT Using commit_transaction;
- END IF
- Return (rslt)
- end function
- on uo_msttake_other.create
- call super::create
- TriggerEvent( this, "constructor" )
- end on
- on uo_msttake_other.destroy
- TriggerEvent( this, "destructor" )
- call super::destroy
- end on
- event constructor;String str_optionvalue,arg_msg
- //f_get_sys_option_value('328',str_optionvalue,arg_msg)
- //sys_option_income_secaudit = Long(str_optionvalue)
- end event
|