123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521 |
- $PBExportHeader$uo_reissue.sru
- forward
- global type uo_reissue from nonvisualobject
- end type
- end forward
- global type uo_reissue from nonvisualobject
- end type
- global uo_reissue uo_reissue
- type variables
- PUBLIC PROTECTEDWRITE Long scid
- PUBLIC PROTECTEDWRITE Long reissueid
- PUBLIC PROTECTEDWRITE String reissuecode
- PUBLIC PROTECTEDWRITE DateTime opdate
- PUBLIC PROTECTEDWRITE String opemp
- PUBLIC PROTECTEDWRITE DateTime moddate
- PUBLIC PROTECTEDWRITE String modemp
- PUBLIC PROTECTEDWRITE Int flag
- PUBLIC PROTECTEDWRITE DateTime auditingdate
- PUBLIC PROTECTEDWRITE String auditingrep
- PUBLIC PROTECTEDWRITE Decimal sumamt = 0
- Long relid
- String relcode
- DateTime reissuedate
- String dscrp
- Long cusid
- String cuscode
- String reissueemp
- String cusname
- Long r_type
- Long relint_3
- Long moneyid
- Decimal mrate
- long itemid
- Int cwauditingflag = 0 //总账审核标记
- DateTime cwauditingdate //总账审核时间
- String cwauditingrep //总账审核操作员
- Transaction commit_transaction
- Boolean if_getid_ture = TRUE
- s_reissuemx reissuemx[]
- Long it_mxbt
- Boolean it_newbegin = FALSE
- Boolean it_updatebegin = FALSE
- end variables
- forward prototypes
- public function integer p_clearmx ()
- public function integer p_reset ()
- public function integer p_getinfo (long arg_scid, long arg_reissueid, ref string arg_msg)
- public function integer getinfo (long arg_scid, long arg_reissueid, ref string arg_msg)
- public function integer newbegin (long arg_scid, ref string arg_msg)
- public function integer updatebegin (long arg_scid, long arg_reissueid, ref string arg_msg)
- public function integer add_dscrp (long arg_scid, long arg_reissueid, string arg_newdescppart, ref string arg_msg)
- public function integer save (boolean arg_ifcommit, ref string arg_msg)
- public function integer del (long arg_scid, long arg_reissueid, ref string arg_msg, boolean arg_ifcommit)
- public function integer auditing (boolean arg_ifcommit, ref string arg_msg)
- public function integer c_auditing (boolean arg_ifcommit, ref string arg_msg)
- public function integer acceptmx (decimal arg_qty, double arg_price, decimal arg_amt, string arg_mxdscrp, long arg_printid, ref string arg_msg, long arg_mtrlid, string arg_mtrlname)
- 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_clearmx ();//int p_clearmx()
- //清除明细
- it_mxbt=0
- sumamt = 0
- return 1
- end function
- public function integer p_reset ();//int p_reset()
- //清除对象及其明细
- scid = 0
- reissueid = 0
- reissuecode = ''
- opemp = ''
- modemp = ''
- auditingrep = ''
- flag = 0
- relid = 0
- relcode = ''
- dscrp = ''
- cusid = 0
- moneyid = 0
- cuscode = ''
- cusname = ''
- it_newbegin = FALSE
- it_updatebegin = FALSE
- //清除明细
- p_clearmx()
- RETURN 1
- end function
- public function integer p_getinfo (long arg_scid, long arg_reissueid, ref string arg_msg);//p_getinfo(arg_scid,arg_outwareid,arg_msg)
- //0 失败 1成功
- Int rslt = 1
- IF arg_reissueid <= 0 THEN
- rslt = 0
- arG_MSG = "非法补件单唯一码"
- GOTO ext
- END IF
- SELECT u_reissue.reissuecode,
- u_reissue.cusid,
- u_reissue.cuscode,
- u_reissue.cusname,
- u_reissue.reissuedate,
- u_reissue.relid,
- u_reissue.relcode,
- u_reissue.dscrp,
- u_reissue.flag,
- u_reissue.reissueemp,
- u_reissue.type,
- u_reissue.moneyid,
- u_reissue.mrate,
- u_reissue.relint_3,
- u_reissue.itemid,
- u_reissue.cwauditingflag,
- u_reissue.cwauditingrep,
- u_reissue.cwauditingdate
- INTO :reissuecode,
- :cusid,
- :cuscode,
- :cusname,
- :reissuedate,
- :relid,
- :relcode,
- :dscrp,
- :flag,
- :reissueemp,
- :r_type,
- :moneyid,
- :mrate,
- :relint_3,
- :itemid,
- :cwauditingflag,
- :cwauditingrep,
- :cwauditingdate
- FROM u_reissue
- WHERE u_reissue.reissueid = :arg_reissueid
- AND scid = :arg_scid
- USING commit_transaction;
-
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arG_MSG = "查询操作失败(错误补件单唯一码),补件单"+commit_transaction.SQLErrText
- GOTO ext
- END IF
- reissueid = arg_reissueid
- scid = arg_scid
- ext:
- IF rslt = 0 THEN p_reset()
- RETURN rslt
- end function
- public function integer getinfo (long arg_scid, long arg_reissueid, ref string arg_msg);//getinfo(arg_scid,arg_reissueid,arg_msg)
- //0 失败 1成功
- Int rslt = 1,i = 1,no_mxcheck = 0
- IF arg_reissueid <= 0 THEN
- rslt = 0
- arg_msg = "非法补件单唯一码"
- GOTO ext
- END IF
- sumamt = 0
- rslt = p_getinfo(arg_scid,arg_reissueid,arg_msg)
- IF rslt = 0 THEN GOTO ext
- //用游标读取明细
- IF r_type = 0 THEN
- DECLARE cur_inwaermx_0 CURSOR FOR
- SELECT u_reissuemx.printid,
- u_reissuemx.mtrlid,
- u_mtrldef.mtrlcode,
- u_mtrldef.mtrlname,
- u_reissuemx.qty,
- u_reissuemx.price,
- u_reissuemx.dscrp,
- u_reissuemx.amt,
- u_reissuemx.relid
- FROM u_reissuemx left OUTER join u_mtrldef on
- u_reissuemx.mtrlid = u_mtrldef.mtrlid
- WHERE u_reissuemx.reissueid = :arg_reissueid AND
- u_reissuemx.scid = :arg_scid USING commit_transaction;
-
- OPEN cur_inwaermx_0;
- FETCH cur_inwaermx_0 INTO :reissuemx[i].printid,
- :reissuemx[i].mtrlid,:reissuemx[i].mtrlcode,
- :reissuemx[i].mtrlname,:reissuemx[i].qty,
- :reissuemx[i].price,
- :reissuemx[i].mxdscrp,
- :reissuemx[i].amt,
- :reissuemx[i].relid;
- DO WHILE commit_transaction.SQLCode = 0
-
- sumamt += reissuemx[i].amt
-
- i++
-
- FETCH cur_inwaermx_0 INTO :reissuemx[i].printid,
- :reissuemx[i].mtrlid,:reissuemx[i].mtrlcode,
- :reissuemx[i].mtrlname,:reissuemx[i].qty,
- :reissuemx[i].price,
- :reissuemx[i].mxdscrp,
- :reissuemx[i].amt,
- :reissuemx[i].relid;
- LOOP
- CLOSE cur_inwaermx_0;
- ELSEIF r_type = 1 THEN
- DECLARE cur_inwaermx_1 CURSOR FOR
- SELECT u_reissuemx.printid,
- u_reissuemx.mtrlid,
- U_Expenses.Expensescode,
- U_Expenses.Expensesname,
- u_reissuemx.qty,
- u_reissuemx.price,
- u_reissuemx.dscrp,
- u_reissuemx.amt,
- u_reissuemx.relid
- FROM u_reissuemx left OUTER join U_Expenses on
- u_reissuemx.mtrlid = U_Expenses.Expensesid
- WHERE u_reissuemx.reissueid = :arg_reissueid AND
- u_reissuemx.scid = :arg_scid USING commit_transaction;
-
- OPEN cur_inwaermx_1;
- FETCH cur_inwaermx_1 INTO :reissuemx[i].printid,
- :reissuemx[i].mtrlid,:reissuemx[i].mtrlcode,
- :reissuemx[i].mtrlname,:reissuemx[i].qty,
- :reissuemx[i].price,
- :reissuemx[i].mxdscrp,
- :reissuemx[i].amt,
- :reissuemx[i].relid;
- DO WHILE commit_transaction.SQLCode = 0
-
- sumamt += reissuemx[i].amt
-
- i++
-
- FETCH cur_inwaermx_1 INTO :reissuemx[i].printid,
- :reissuemx[i].mtrlid,:reissuemx[i].mtrlcode,
- :reissuemx[i].mtrlname,:reissuemx[i].qty,
- :reissuemx[i].price,
- :reissuemx[i].mxdscrp,
- :reissuemx[i].amt,
- :reissuemx[i].relid;
- LOOP
- CLOSE cur_inwaermx_1;
-
- ELSEIF r_type = 2 THEN
- DECLARE cur_inwaermx_2 CURSOR FOR
- SELECT u_reissuemx.printid,
- u_reissuemx.mtrlid,
- U_Expenses.Expensescode,
- u_reissuemx.mtrlname,
- u_reissuemx.qty,
- u_reissuemx.price,
- u_reissuemx.dscrp,
- u_reissuemx.amt,
- u_reissuemx.relid
- FROM u_reissuemx left OUTER join U_Expenses on
- u_reissuemx.mtrlid = U_Expenses.Expensesid
- WHERE u_reissuemx.reissueid = :arg_reissueid AND
- u_reissuemx.scid = :arg_scid USING commit_transaction;
-
- OPEN cur_inwaermx_2;
- FETCH cur_inwaermx_2 INTO :reissuemx[i].printid,
- :reissuemx[i].mtrlid,:reissuemx[i].mtrlcode,
- :reissuemx[i].mtrlname,:reissuemx[i].qty,
- :reissuemx[i].price,
- :reissuemx[i].mxdscrp,
- :reissuemx[i].amt,
- :reissuemx[i].relid;
- DO WHILE commit_transaction.SQLCode = 0
-
- sumamt += reissuemx[i].amt
-
- i++
-
- FETCH cur_inwaermx_2 INTO :reissuemx[i].printid,
- :reissuemx[i].mtrlid,:reissuemx[i].mtrlcode,
- :reissuemx[i].mtrlname,:reissuemx[i].qty,
- :reissuemx[i].price,
- :reissuemx[i].mxdscrp,
- :reissuemx[i].amt,
- :reissuemx[i].relid;
- LOOP
- CLOSE cur_inwaermx_2;
- END IF
- //检验明细是否读入完整
- SELECT count(*) INTO :no_mxcheck
- FROM u_reissuemx
- WHERE u_reissuemx.reissueid = :arg_reissueid
- AND scid = :arg_scid 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
- reissueid = arg_reissueid
- scid = arg_scid
- it_mxbt = i - 1
- it_newbegin = FALSE
- it_updatebegin = FALSE
- ext:
- IF rslt = 0 THEN p_reset()
- RETURN rslt
- end function
- public function integer newbegin (long arg_scid, ref string arg_msg);//====================================================================
- // Function: newbegin(long arg_scid,int arg_billtype,ref string arg_msg)
- //--------------------------------------------------------------------
- // Description: 从置对象,设定业务类型,准备建立新进仓单
- //--------------------------------------------------------------------
- // Arguments:
- // value long arg_scid
- // value integer arg_billtype
- // reference string arg_msg
- //--------------------------------------------------------------------
- // Returns: integer
- //--------------------------------------------------------------------
- // Author: yyx Date: 2003.11.12
- //--------------------------------------------------------------------
- // Modify History:
- //
- //====================================================================
- int rslt=1
- if arg_scid < 0 then
- arg_msg = '请选择分部'
- rslt = 0
- goto ext
- end if
- p_reset()
- scid=arg_scid
- it_newbegin=true
- it_updatebegin=false
- ext:
- if rslt=0 then p_reset()
- return rslt
- end function
- public function integer updatebegin (long arg_scid, long arg_reissueid, ref string arg_msg);//====================================================================
- // Function: updatebegin(arg_scid,arg_inwareid,arg_billtype,arg_msg)
- //--------------------------------------------------------------------
- // Description: 从置对象,设定业务类型与关联ID,准备更新进仓单
- //--------------------------------------------------------------------
- // Arguments:
- // value long arg_scid
- // value long arg_inwareid
- // value integer arg_billtype
- // reference string arg_msg
- //--------------------------------------------------------------------
- // Returns: integer
- //--------------------------------------------------------------------
- // Author: yyx Date: 2003.11.12
- //--------------------------------------------------------------------
- // Modify History:
- //
- //====================================================================
- long rslt=1
- if arg_scid < 0 then
- arg_msg = '请选择分部'
- rslt = 0
- goto ext
- end if
- if arg_reissueid<=0 then
- rslt=0
- goto ext
- end if
- rslt=p_getinfo(arg_scid,arg_reissueid,arg_msg)
- if rslt=0 then goto ext
- if flag=1 then
- rslt=0
- arg_msg='单据已经审核,不可以修改'
- goto ext
- end if
- reissueid=arg_reissueid
- scid=arg_scid
- it_newbegin=false
- it_updatebegin=true
- p_clearmx() //清除明细
- ext:
- if rslt=0 then p_reset()
- return rslt
- end function
- public function integer add_dscrp (long arg_scid, long arg_reissueid, string arg_newdescppart, ref string arg_msg);//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
- rslt=p_getinfo(arg_scid,arg_reissueid,arg_msg)
- if rslt=0 then goto ext
- if flag=0 then
- rslt=0
- arg_msg="非审核状态下不可用"
- goto ext
- end if
- update u_reissue
- set dscrp = dscrp+' '+:arg_newdescppart
- where u_reissue.reissueid = :reissueid
- and scid=:scid using commit_transaction;
- if commit_transaction.sqlcode<>0 then
- rollback ;
- rslt=0
- arg_msg="因网络或其它原因导致添加单据备注操作失败"+"~n"+commit_transaction.sqlerrtext
- goto ext
- end if
- commit using commit_transaction;
- dscrp = dscrp+' '+arg_newdescppart
- ext: return (rslt)
- end function
- public function integer save (boolean arg_ifcommit, ref string arg_msg);Integer rslt = 1,cnt = 0,i
- DateTime server_dt
- Long ls_newid
- String ls_sccode
- IF IsNull(relid) THEN relid = 0
- IF IsNull(cusid) THEN cusid = 0
- IF IsNull(moneyid) THEN moneyid = 0
- IF IsNull(relcode) THEN relcode = ''
- IF IsNull(reissueemp) THEN reissueemp = ''
- IF IsNull(dscrp) THEN dscrp = ''
- IF IsNull(itemid) THEN itemid = 0
- 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 USING commit_transaction ;
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = "查询操作失败,日期 "
- GOTO ext
- END IF
- IF r_type = 2 THEN
- IF cusid = 0 THEN
- arg_msg = '请选择供应商'
- rslt = 0
- GOTO ext
- END IF
-
- SELECT count(*) INTO :cnt
- FROM u_spt
- WHERE sptid = :cusid
- USING commit_transaction;
- IF commit_transaction.SQLCode <> 0 THEN
- arg_msg = '查询供应商资料失败,'+sqlca.SQLErrText
- rslt = 0
- GOTO ext
- END IF
-
- IF cnt = 0 THEN
- rslt = 0
- arg_msg = '错误的供应商资料'
- GOTO ext
- END IF
- ELSE
-
- IF cusid = 0 THEN
- arg_msg = '请选择客户'
- rslt = 0
- GOTO ext
- END IF
-
- SELECT count(*) INTO :cnt
- FROM u_cust
- WHERE cusid = :cusid
- USING commit_transaction;
- IF commit_transaction.SQLCode <> 0 THEN
- arg_msg = '查询客户资料失败,'+sqlca.SQLErrText
- rslt = 0
- GOTO ext
- END IF
-
- IF cnt = 0 THEN
- rslt = 0
- arg_msg = '错误的客户资料'
- GOTO ext
- END IF
- END IF
- IF it_mxbt = 0 THEN //如果输入物料资料错则已经清空
- rslt = 0
- arg_msg = "没有正确进仓内容"
- GOTO ext
- END IF
- IF itemid = 0 THEN
- rslt = 0
- arg_msg = '请选择项目'
- GOTO ext
- END IF
- 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
- IF cnt = 0 THEN
- rslt = 0
- arg_msg = '错误的项目资料'
- GOTO ext
- END IF
- IF f_check_inoutdate(0,reissuedate,true,arg_msg) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
- ////////////////////////////////////////////// //开始区分:新建/更新 处理
- IF reissueid = 0 THEN //新建
- ls_newid = f_sys_scidentity(scid,"u_reissue","reissueid",arg_msg,if_getid_ture,commit_transaction)
- IF ls_newid <= 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 r_type = 0 THEN
- reissuecode = getid(scid,ls_sccode + 'FJ',Date(server_dt),if_getid_ture,commit_transaction)
- ELSEIF r_type = 1 THEN
- reissuecode = getid(scid,ls_sccode + 'FY',Date(server_dt),if_getid_ture,commit_transaction)
- ELSE
- reissuecode = getid(scid,ls_sccode + 'FS',Date(server_dt),if_getid_ture,commit_transaction)
- END IF
-
- IF reissuecode = "err" THEN
- reissuecode = ''
- rslt = 0
- arg_msg = "无法获取单据编号"+"~n"+commit_transaction.SQLErrText
- GOTO ext
- END IF
-
- INSERT INTO u_reissue (
- scid,
- reissueid,
- reissuecode,
- cusid,
- reissuedate,
- relid,
- relcode,
- dscrp,
- opdate,
- opemp,
- flag,
- reissueemp,
- type,
- moneyid,
- mrate,
- itemid)
- VALUES (
- :scid,
- :ls_newid,
- :reissuecode,
- :cusid,
- :reissuedate,
- :relid,
- :relcode,
- :dscrp,
- :server_dt,
- :publ_operator,
- :flag,
- :reissueemp,
- :r_type,
- :moneyid,
- :mrate,
- :itemid) USING commit_transaction ;
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
-
- IF Pos(Lower(commit_transaction.SQLErrText),'PK_u_reissue') > 0 THEN
- arg_msg = '插入操作失败,关键字单据ID重复'
- ELSEIF Pos(Lower(commit_transaction.SQLErrText),'IX_u_reissue') > 0 THEN
- arg_msg = '插入操作失败,关键字单据编号重复'
- ELSE
- arg_msg = "因网络或其它原因导致插入操作失败"+"~n"+commit_transaction.SQLErrText
- END IF
-
- GOTO ext
- END IF
-
- //读取新reissueid
- reissueid = ls_newid
-
- FOR i = 1 TO it_mxbt
- INSERT INTO u_reissuemx
- (scid,
- reissueid,
- mtrlid,
- printid,
- qty,
- price,
- amt,
- dscrp,
- mtrlname)
- VALUES (
- :scid,
- :ls_newid,
- :reissuemx[i].mtrlid,
- :reissuemx[i].printid,
- :reissuemx[i].qty,
- :reissuemx[i].price,
- :reissuemx[i].amt,
- :reissuemx[i].mxdscrp,
- :reissuemx[i].mtrlname) USING commit_transaction;
- IF commit_transaction.SQLCode <> 0 THEN
- reissueid = 0 //还原reissueid
- rslt = 0
-
- IF Pos(Lower(commit_transaction.SQLErrText),'PK_u_reissuemx') > 0 THEN
- arg_msg = '插入明细操作失败,关键字单据ID,序号重复'
- ELSE
- arg_msg = "因网络或其它原因导致插入明细操作失败"+"~n"+commit_transaction.SQLErrText
- END IF
-
- GOTO ext
- END IF
- NEXT
- ELSE //////////////////////////////////////////////// //更新
- UPDATE u_reissue
- SET cusid = :cusid,
- reissuedate = :reissuedate,
- relid = :relid,
- relcode = :relcode,
- dscrp = :dscrp,
- moddate = : server_dt,
- modemp = :publ_operator,
- reissueemp = :reissueemp,
- type = :r_type,
- moneyid = :moneyid,
- mrate = :mrate,
- itemid = :itemid
- WHERE u_reissue.reissueid = :reissueid
- AND u_reissue.scid = :scid
- AND flag = 0 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_reissuemx
- WHERE u_reissuemx.reissueid = :reissueid
- AND u_reissuemx.scid = :scid 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_reissuemx
- (scid,
- reissueid,
- mtrlid,
- printid,
- qty,
- price,
- amt,
- dscrp,
- mtrlname)
- VALUES (
- :scid,
- :reissueid,
- :reissuemx[i].mtrlid,
- :reissuemx[i].printid,
- :reissuemx[i].qty,
- :reissuemx[i].price,
- :reissuemx[i].amt,
- :reissuemx[i].mxdscrp,
- :reissuemx[i].mtrlname) USING commit_transaction;
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- IF Pos(Lower(commit_transaction.SQLErrText),'PK_u_reissuemx') > 0 THEN
- arg_msg = '插入明细操作失败,关键字单据ID,序号重复'
- ELSE
- arg_msg = "因网络或其它原因导致插入明细操作失败"+"~n"+commit_transaction.SQLErrText
- END IF
- GOTO ext
- END IF
- NEXT
- END IF
- it_newbegin = FALSE
- it_updatebegin = FALSE
- ext:
- IF rslt = 0 THEN
- ROLLBACK USING commit_transaction;
- p_clearmx()
- ELSEIF rslt = 1 AND arg_ifcommit THEN
- COMMIT USING commit_transaction;
- END IF
- RETURN rslt
- end function
- public function integer del (long arg_scid, long arg_reissueid, ref string arg_msg, boolean arg_ifcommit);//如果单据还没有审核删除单据极其明细
- //0 FAIL, 1 SUCCESS
- Int rslt = 1
- IF arg_reissueid <= 0 THEN
- rslt = 0
- arG_MSG = "没有删除对象,操作取消"
- GOTO ext
- END IF
- IF p_getinfo(arg_scid,arg_reissueid,arG_MSG) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
- IF flag = 1 THEN
- rslt = 0
- arG_MSG = "单据已经审核,不可以删除"
- GOTO ext
- END IF
- DELETE FROM u_reissue
- WHERE u_reissue.reissueid = :arg_reissueid
- AND u_reissue.scid = :arg_scid USING commit_transaction;
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arG_MSG = "删除补件单操作失败"+"~n"+commit_transaction.SQLErrText
- GOTO ext
- END IF
- DELETE FROM u_reissuemx
- WHERE u_reissuemx.reissueid = :arg_reissueid
- AND u_reissuemx.scid = :arg_scid 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;
- p_reset()
- ELSEIF rslt = 1 AND arg_ifcommit THEN
- COMMIT USING commit_transaction;
- END IF
- RETURN (rslt)
- end function
- public function integer auditing (boolean arg_ifcommit, ref string arg_msg);Long rslt = 1,cnt = 0,ll_i
- //DateTime ld_viewdate
- //SetNull(ld_viewdate)
- uo_musttake uo_take
- uo_mustpay uo_pay
- uo_take = CREATE uo_musttake
- uo_pay = CREATE uo_mustpay
- String ls_about,ls_dscrp
- Decimal ld_takeamt = 0,ld_msttakeamt = 0
- Decimal ld_payamt = 0,ld_mstpayamt = 0
- long ll_moneyid_native,ll_moneyid
- Decimal ld_mrate
- IF reissueid = 0 THEN
- rslt = 0
- arg_msg = "没有审核对象"
- GOTO ext
- END IF
- IF it_newbegin OR it_updatebegin THEN
- rslt = 0
- arg_msg = "编辑状态下不可以执行审核"
- GOTO ext
- END IF
- IF flag = 1 THEN
- rslt = 0
- arg_msg = "单据已经审核"
- GOTO ext
- END IF
- Int li_btype
- Long ll_accountsid
- SELECT btype,accountsid INTO :li_btype,:ll_accountsid
- FROM cw_banktype
- Where banktypeid = :relid USING commit_transaction;
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '查询结算方式类型失败,'+ commit_transaction.SQLErrText
- GOTO ext
- END IF
- Select moneyid Into :ll_moneyid_native
- From cw_currency
- Where native = 1;
- If sqlca.SQLCode <> 0 Then
- arg_msg = '查询本位币资料失败'
- rslt = 0
- Goto ext
- End If
- SELECT count(*) INTO :cnt
- FROM u_user
- Where username = :publ_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
- UPDATE u_reissue
- SET auditingrep = :publ_operator,
- auditingdate = getdate(),
- flag = 1
- WHERE u_reissue.reissueid = :reissueid
- AND flag = 0
- AND scid = :scid USING commit_transaction;
-
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = "因网络或其它原因导致审核单据操作失败"+"~n"+commit_transaction.SQLErrText
- GOTO ext
- ELSEIF commit_transaction.SQLNRows = 0 THEN
- rslt = 0
- arg_msg = "单据正在审核,请稍后查询。"+"~n"+commit_transaction.SQLErrText
- GOTO ext
- END IF
- IF r_type = 0 THEN //补件单
-
- IF sumamt <> 0 THEN
- ls_about = reissuecode + "补件款"
-
- ls_dscrp = ls_about
- ld_msttakeamt = sumamt
- IF li_btype = 1 THEN
- ld_takeamt = ld_msttakeamt
- ELSE
- ld_takeamt = 0
- END IF
-
- s_bmsttake s_take
-
- s_take.scid = scid
- s_take.cusid = cusid
- s_take.takedate = reissuedate
- s_take.inrep = reissueemp
- s_take.oriamt = ld_msttakeamt
- s_take.msttakeamt = ld_msttakeamt
- s_take.takeamt = ld_takeamt
- s_take.dscrp = ls_dscrp
- s_take.billcode = reissuecode
- s_take.banktypeid = relid
- s_take.opemp = publ_operator
- s_take.buildtype = 1
- s_take.outwareid = reissueid
- s_take.accountsid = ll_accountsid
- s_take.itemid = itemid
- s_take.moneyid = moneyid
- s_take.viewdate = reissuedate
- s_take.relcode = relcode
-
- IF uo_take.add_takerec (s_take,arg_msg,FALSE) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
-
- // IF uo_take.add_takerec(scid,cusid,reissuedate,reissueemp,ld_msttakeamt,Round(ld_msttakeamt,sys_saleamt_round),Round(ld_takeamt,sys_saleamt_round),ls_dscrp,&
- // reissuecode,relid,1,publ_operator,reissueid,0,arg_msg,FALSE,reissuedate,ll_accountsid,itemid,moneyid,relcode) = 0 THEN
- // rslt = 0
- // GOTO ext
- // END IF
-
- UPDATE u_reissue
- SET relint_3 = :uo_take.ref_takeid
- WHERE u_reissue.reissueid = :reissueid
- AND scid = :scid
- AND flag = 1 USING commit_transaction;
-
- IF commit_transaction.SQLCode <> 0 THEN
- arg_msg = '更新补件单相关应收帐ID失败'
- rslt = 0
- GOTO ext
- END IF
- END IF
- ELSEIF r_type = 1 THEN //费用单
-
- FOR ll_i = 1 TO it_mxbt
-
- IF reissuemx[ll_i].amt <> 0 THEN
-
- IF Trim(reissuemx[ll_i].mxdscrp) = '' THEN
- ls_about = reissuecode + ',' + reissuemx[ll_i].mtrlname
- ELSE
- ls_about = reissuecode + ',' + reissuemx[ll_i].mtrlname + ',' + reissuemx[ll_i].mxdscrp
- END IF
-
- ls_dscrp = ls_about
- ld_msttakeamt = 0 - reissuemx[ll_i].amt
- IF li_btype = 1 THEN
- ld_takeamt = ld_msttakeamt
- ELSE
- ld_takeamt = 0
- END IF
-
- IF sys_option_mst_multimoney = 0 THEN
- ld_msttakeamt = ld_msttakeamt * mrate
- ld_takeamt = ld_takeamt * mrate
- ld_mrate = 1
- ll_moneyid = ll_moneyid_native
- ELSE
- ld_msttakeamt = ld_msttakeamt
- ld_takeamt = ld_takeamt
- ld_mrate = mrate
- ll_moneyid = moneyid
- END IF
-
- s_bmsttake s_take2
-
- s_take2.scid = scid
- s_take2.cusid = cusid
- s_take2.takedate = reissuedate
- s_take2.inrep = reissueemp
- s_take2.oriamt = ld_msttakeamt
- s_take2.msttakeamt = ld_msttakeamt
- s_take2.takeamt = ld_takeamt
- s_take2.takeamt_cn = ld_takeamt
- s_take2.dscrp = ls_dscrp
- s_take2.billcode = reissuecode
- s_take2.banktypeid = relid
- s_take2.opemp = publ_operator
- s_take2.buildtype = 1
- s_take2.outwareid = reissueid
- s_take2.accountsid = ll_accountsid
- s_take2.itemid = itemid
- s_take2.moneyid = ll_moneyid
- s_take2.viewdate = reissuedate
- s_take2.relcode = relcode
-
- IF uo_take.add_takerec (s_take2,arg_msg,FALSE) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
-
-
-
- // IF uo_take.add_takerec(scid,cusid,reissuedate,reissueemp,ld_msttakeamt,Round(ld_msttakeamt,sys_saleamt_round),Round(ld_takeamt,sys_saleamt_round),ls_dscrp,&
- // reissuecode,relid,1,publ_operator,reissueid,0,arg_msg,FALSE,reissuedate,ll_accountsid,itemid,moneyid,relcode) = 0 THEN
- // rslt = 0
- // GOTO ext
- // END IF
-
-
- UPDATE u_reissuemx
- SET relid = :uo_take.ref_takeid
- FROM u_reissuemx,u_reissue
- WHERE u_reissuemx.reissueid = :reissueid
- AND u_reissuemx.printid = :reissuemx[ll_i].printid
- AND u_reissuemx.scid = :scid
- AND u_reissuemx.scid = u_reissue.scid
- AND u_reissuemx.reissueid = u_reissue.reissueid
- AND u_reissue.flag = 1 USING commit_transaction;
-
- IF commit_transaction.SQLCode <> 0 THEN
- arg_msg = '更新费用单相关应收帐ID失败'
- rslt = 0
- GOTO ext
- END IF
- END IF
- NEXT
- ELSEIF r_type = 2 THEN //?
- FOR ll_i = 1 TO it_mxbt
- IF Trim(reissuemx[ll_i].mxdscrp) = '' THEN
- ls_about = reissuecode + ',' + reissuemx[ll_i].mtrlname
- ELSE
- ls_about = reissuecode + ',' + reissuemx[ll_i].mtrlname + ',' + reissuemx[ll_i].mxdscrp
- END IF
-
- ls_dscrp = ls_about
-
- ld_mstpayamt = reissuemx[ll_i].amt
-
- IF li_btype = 1 THEN
- ld_payamt = ld_mstpayamt
- ELSE
- ld_payamt = 0
- END IF
-
- IF sys_option_msp_multimoney = 0 THEN
- ld_mstpayamt = ld_mstpayamt * mrate
- ld_payamt = ld_payamt * mrate
- ld_mrate = 1
- ll_moneyid = ll_moneyid_native
- ELSE
- ld_mstpayamt = ld_mstpayamt
- ld_payamt = ld_payamt
- ld_mrate = mrate
- ll_moneyid = moneyid
- END IF
-
-
- DateTime plandate
- SetNull(plandate)
-
- s_bmstpay s_pay
- s_pay.scid = scid
- s_pay.sptid = cusid
- s_pay.paydate = reissuedate
- s_pay.inrep = reissueemp
- s_pay.oriamt = ld_mstpayamt
- s_pay.mstpayamt = ld_mstpayamt
- s_pay.payamt = ld_payamt
- s_pay.dscrp = ls_dscrp
- s_pay.billcode = reissuecode
- s_pay.banktypeid = relid
- s_pay.opemp = publ_operator
- s_pay.buildtype = 1
- s_pay.inwareid = reissueid
- s_pay.accountsid = ll_accountsid
- s_pay.itemid = itemid
- s_pay.moneyid = ll_moneyid
- s_pay.viewdate = plandate
- s_pay.relcode = relcode
-
- IF uo_pay.add_payrec (s_pay,arg_msg,FALSE) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
-
- // IF uo_pay.add_payrec (scid,cusid,reissuedate,reissueemp,ld_mstpayamt,ld_mstpayamt,ld_payamt,ls_dscrp,&
- // reissuecode,relid,1,publ_operator,reissueid,0,arg_msg,FALSE,plandate,ll_accountsid,itemid,moneyid ,relcode) = 0 THEN
- // rslt = 0
- // GOTO ext
- // END IF
-
- UPDATE u_reissuemx
- SET relid = :uo_pay.ref_payid
- FROM u_reissuemx,u_reissue
- WHERE u_reissuemx.reissueid = :reissueid
- AND u_reissuemx.printid = :reissuemx[ll_i].printid
- AND u_reissuemx.scid = :scid
- AND u_reissuemx.scid = u_reissue.scid
- AND u_reissuemx.reissueid = u_reissue.reissueid
- AND u_reissue.flag = 1 USING commit_transaction;
- IF commit_transaction.SQLCode <> 0 THEN
- arg_msg = '更新相关应收帐ID失败'
- rslt = 0
- GOTO ext
- END IF
- NEXT
- END IF
- flag = 1
- ext:
- DESTROY uo_take
- DESTROY uo_pay
- IF rslt = 0 THEN
- ROLLBACK USING commit_transaction;
- ELSEIF rslt = 1 AND arg_ifcommit THEN
- COMMIT USING commit_transaction;
- END IF
- RETURN rslt
- end function
- public function integer c_auditing (boolean arg_ifcommit, ref string arg_msg);Long rslt = 1,cnt = 0,ll_i
- uo_musttake uo_take
- uo_mustpay uo_pay
- uo_take = CREATE uo_musttake
- uo_pay = create uo_mustpay
- Long ll_takeid
- DateTime null_dt
- SetNull(null_dt)
- IF reissueid = 0 THEN
- rslt = 0
- arg_msg = "没有审核对象"
- GOTO ext
- END IF
- IF it_newbegin OR it_updatebegin THEN
- rslt = 0
- arg_msg = "编辑状态下不可以执行审核"
- GOTO ext
- END IF
- IF cwauditingflag = 1 THEN
- rslt = 0
- arG_MSG = "该单据已经总账审核,不能进行财务撤审"
- GOTO ext
- END IF
- IF flag = 0 THEN
- rslt = 0
- arg_msg = "单据还未审核"
- GOTO ext
- END IF
- SELECT count(*) INTO :cnt
- FROM u_user
- Where username = :publ_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
- UPDATE u_reissue
- SET Auditingrep = '',
- Auditingdate = :null_dt,
- flag = 0,
- relint_3 = 0
- WHERE u_reissue.reissueid = :reissueid
- AND flag = 1
- AND scid = :scid USING commit_transaction;
-
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = "因网络或其它原因导致审核单据操作失败"+"~n"+commit_transaction.SQLErrText
- GOTO ext
- ELSEIF commit_transaction.SQLNRows = 0 THEN
- rslt = 0
- arg_msg = "单据正在审核,请稍后查询。"+"~n"+commit_transaction.SQLErrText
- GOTO ext
- END IF
- IF r_type = 0 THEN
- IF sumamt <> 0 THEN
- IF uo_take.del_takerec(scid,1,relint_3,cusid,arg_msg,FALSE) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
- END IF
- ELSEIF r_type = 1 THEN
- FOR ll_i = 1 TO it_mxbt
- IF reissuemx[ll_i].amt <> 0 THEN
- IF uo_take.del_takerec(scid,1,reissuemx[ll_i].relid,cusid,arg_msg,FALSE) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
-
- UPDATE u_reissuemx
- SET relid = 0
- WHERE u_reissuemx.reissueid = :reissueid
- AND u_reissuemx.printid = :reissuemx[ll_i].printid
- AND u_reissuemx.scid = :scid USING commit_transaction;
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = "因网络或其它原因导致审核单据操作失败"+"~n"+commit_transaction.SQLErrText
- GOTO ext
- END IF
- END IF
- NEXT
- ELSEIF r_type = 2 THEN
-
- FOR ll_i = 1 TO it_mxbt
- IF reissuemx[ll_i].amt <> 0 THEN
- IF uo_pay.del_payrec(scid,1,reissuemx[ll_i].relid,cusid,arg_msg,FALSE) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
- UPDATE u_reissuemx
- SET relid = 0
- WHERE u_reissuemx.reissueid = :reissueid
- AND u_reissuemx.printid = :reissuemx[ll_i].printid
- AND u_reissuemx.scid = :scid USING commit_transaction;
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = "因网络或其它原因导致审核单据操作失败"+"~n"+commit_transaction.SQLErrText
- GOTO ext
- END IF
- END IF
- NEXT
- END IF
- flag = 0
- ext:
- DESTROY uo_take
- DESTROY uo_pay
- IF rslt = 0 THEN
- ROLLBACK USING commit_transaction;
- ELSEIF rslt = 1 AND arg_ifcommit THEN
- COMMIT USING commit_transaction;
- END IF
- RETURN rslt
- end function
- public function integer acceptmx (decimal arg_qty, double arg_price, decimal arg_amt, string arg_mxdscrp, long arg_printid, ref string arg_msg, long arg_mtrlid, string arg_mtrlname);Int rslt = 1
- Long cnt = 0
- IF it_newbegin = FALSE AND it_updatebegin = FALSE THEN
- rslt = 0
- arg_msg = "非编辑状态不可以使用,操作取消"
- GOTO ext
- END IF
- //清除空值
- IF IsNull(arg_qty) THEN arg_qty = 0
- IF IsNull(arg_price) THEN arg_price = 0
- IF IsNull(arg_printid) THEN arg_printid = 0
- IF IsNull(arg_amt) THEN arg_amt = 0
- IF IsNull(arg_mxdscrp) THEN arg_mxdscrp = ''
- IF IsNull(arg_mtrlid) THEN arg_mtrlid = 0
- IF IsNull(arg_mtrlname) THEN arg_mtrlname = ''
- // 如果出仓数量为 0,或物料编号为空,则不作任何处理
- IF r_type = 0 THEN
- SELECT count(*) INTO :cnt
- FROM u_mtrldef
- Where mtrlid = :arg_mtrlid USING commit_transaction;
- IF commit_transaction.SQLCode <> 0 THEN
- arg_msg = "查询物料资料失败,"+commit_transaction.SQLErrText
- rslt = 0
- GOTO ext
- END IF
- IF arg_mtrlid = 0 THEN
- rslt = 1
- GOTO ext
- END IF
- ELSEIF r_type = 1 THEN
- SELECT count(*) INTO :cnt
- FROM U_Expenses
- Where Expensesid = :arg_mtrlid USING commit_transaction;
- IF commit_transaction.SQLCode <> 0 THEN
- arg_msg = '查询项目资料失败,'+commit_transaction.SQLErrText
- rslt = 0
- GOTO ext
- END IF
- IF arg_mtrlid = 0 THEN
- rslt = 1
- GOTO ext
- END IF
-
- ELSEIF r_type = 2 AND arg_mtrlid > 0 THEN
- SELECT count(*) INTO :cnt
- FROM U_Expenses
- Where Expensesid = :arg_mtrlid USING commit_transaction;
- IF commit_transaction.SQLCode <> 0 THEN
- arg_msg = '查询项目资料失败,'+commit_transaction.SQLErrText
- rslt = 0
- GOTO ext
- END IF
-
- END IF
- IF arg_qty = 0 THEN
- rslt = 1
- GOTO ext
- END IF
- //写入内容
- it_mxbt++
- reissuemx[it_mxbt].mtrlid = arg_mtrlid
- reissuemx[it_mxbt].qty = arg_qty
- reissuemx[it_mxbt].amt = Round(arg_amt,2)
- reissuemx[it_mxbt].price = arg_price
- reissuemx[it_mxbt].mxdscrp = arg_mxdscrp
- reissuemx[it_mxbt].printid = arg_printid
- reissuemx[it_mxbt].mtrlname = arg_mtrlname
- ext:
- IF rslt = 0 THEN
- p_clearmx()
- arg_msg = "第" + String(arg_printid) + "行," + arg_msg
- END IF
- 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_scid,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_reissue
- SET cwauditingflag = 1,
- cwauditingdate = getdate(),
- cwauditingrep = :publ_operator
- WHERE ( u_reissue.reissueid = :arg_billid ) AND
- ( u_reissue.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_scid,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_reissue
- SET cwauditingflag = 0,
- cwauditingdate =null,
- cwauditingrep = ''
- WHERE ( u_reissue.reissueid = :arg_billid ) AND
- ( u_reissue.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_reissue.create
- call super::create
- TriggerEvent( this, "constructor" )
- end on
- on uo_reissue.destroy
- TriggerEvent( this, "destructor" )
- call super::destroy
- end on
|