123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890 |
- $PBExportHeader$uo_spt_price_change.sru
- forward
- global type uo_spt_price_change from nonvisualobject
- end type
- type s_spt_price_changemx from structure within uo_spt_price_change
- end type
- end forward
- type s_spt_price_changemx from structure
- long mtrlid
- string status
- decimal { 5 } rate
- decimal { 5 } price
- decimal { 5 } wareprice
- decimal { 5 } lastprice
- string dscrp
- long sptid
- long printid
- string mtrlcode
- string unit
- string sptmtrlname
- datetime lastdate
- string woodcode
- string pcode
- decimal { 5 } qty
- decimal { 5 } rebate
- end type
- global type uo_spt_price_change from nonvisualobject
- end type
- global uo_spt_price_change uo_spt_price_change
- type variables
- public protectedwrite long billid
- public protectedwrite string billcode
-
- public protectedwrite datetime opdate
- public protectedwrite string opemp
- public protectedwrite datetime moddate
- public protectedwrite string modemp
- public protectedwrite int flag=0
- public protectedwrite datetime auditingdate
- public protectedwrite string auditingrep
- long mtrlid
- datetime billdate
- long sptid
- string dscrp
- string inrep
- int billtype
- long moneyid
- Transaction commit_transaction //数据commit事务
- private:
- boolean it_newbegin=false //新建标志
- boolean it_updatebegin=false//修改标志
- Boolean if_getid_ture = TRUE
- s_spt_price_changemx changemx[] //明细结构数组
- Long it_mxbt = 0 //明细结构数组末指针
- uo_spt_price uo_price
- end variables
- forward prototypes
- public function integer p_reset ()
- public function integer updatebegin (long arg_billid, ref string arg_msg)
- public function integer save (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 newbegin ()
- public function integer p_clearmx ()
- public function integer getinfo (long arg_billid, ref string arg_msg)
- public function integer p_getinfo (long arg_billid, ref string arg_msg)
- public function integer del (long arg_billid, boolean arg_ifcommit, ref string arg_msg)
- public function integer c_auditing (boolean arg_ifcommit, ref string arg_msg)
- public function integer auditing (boolean arg_ifcommit, ref string arg_msg)
- public function integer acceptmx (long arg_printid, long arg_mtrlid, string arg_mtrlcode, string arg_unit, decimal arg_qty, decimal arg_price, decimal arg_rebate, decimal arg_rate, string arg_status, string arg_woodcode, string arg_pcode, string arg_sptmtrlname, string arg_dscrp, ref string arg_msg)
- end prototypes
- public function integer p_reset ();//INT p_RESET()
- //清除对象及其明细
- billid = 0
- billcode = ''
- flag = 0
- inrep = ''
- sptid = 0
- billtype = 0
- dscrp = ''
- it_newbegin = FALSE
- it_updatebegin = FALSE
- p_clearmx( )
- RETURN 1
- end function
- public function integer updatebegin (long arg_billid, ref string arg_msg);Int rslt = 1
- IF arg_billid <= 0 THEN
- billid = 0
- arg_msg = '错误的单据ID'
- GOTO ext
- END IF
- rslt = p_getinfo(arg_billid,arg_msg)
- IF rslt = 0 THEN GOTO ext
- IF flag = 1 THEN
- rslt = 0
- arg_msg = '单据已经审核,不可以修改'
- GOTO ext
- END IF
- billid = arg_billid
- it_newbegin = FALSE
- it_updatebegin = TRUE
- p_clearmx() //清除明细
- ext:
- IF rslt = 0 THEN p_reset()
- RETURN rslt
- end function
- public function integer save (ref string arg_msg, boolean arg_ifcommit);Integer rslt = 1,cnt = 0,i
- DateTime server_dt
- Long ls_newid
- IF IsNull(sptid) THEN sptid = 0
- IF IsNull(moneyid) THEN moneyid = 0
- IF IsNull(dscrp) THEN dscrp = ''
- IF IsNull(inrep) THEN inrep = ''
- IF it_newbegin = False And it_updatebegin = False THEN
- rslt = 0
- arg_msg = "非编辑状态不可以提交"
- GOTO ext
- END IF
- IF billtype <> 1 And billtype <> 2 THEN
- arg_msg = '错误的单据类型,1-调价单,2-报价单'
- rslt = 0
- GOTO ext
- END IF
- cnt = 0
- SELECT count(*) INTO :cnt
- FROM u_spt
- Where sptid = :sptid;
- IF sqlca.SQLCode <> 0 THEN
- arg_msg = '查询供应商资料失败'
- rslt = 0
- GOTO ext
- END IF
- IF cnt <> 1 THEN
- arg_msg = '供应商资料重复或不存在'
- rslt = 0
- GOTO ext
- END IF
- //币种, 默认本位币
- cnt = 0
- SELECT count(*) INTO :cnt
- FROM cw_currency
- Where moneyid = :moneyid;
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '查询币种失败! '+sqlca.SQLErrText
- GOTO ext
- END IF
- IF cnt <> 1 THEN
- arg_msg = '币种重复或不存在'
- rslt = 0
- 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 Year(Date(billdate)) < 2000 Or IsNull(billdate) THEN
- rslt = 0
- arg_msg = "时间不合理"
- GOTO ext
- END IF
- IF billid = 0 THEN //新建
- ls_newid = f_sys_scidentity(0,"u_spt_price_change","billid",arg_msg,False,sqlca)
- IF ls_newid <= 0 THEN
- rslt = 0
- GOTO ext
- END IF
-
-
- billcode = getid(0,"SP",Date(server_dt),False,sqlca) //取得新单据编号
- IF billcode = "err" THEN
- billcode = ''
- rslt = 0
- arg_msg = "无法获取单据编号"
- GOTO ext
- END IF
-
- INSERT INTO u_spt_price_change
- (billid,
- billcode,
- billdate,
- sptid,
- dscrp,
- opemp,
- opdate,
- inrep,
- billtype,
- moneyid)
- VALUES (
- :ls_newid,
- :billcode,
- :billdate,
- :sptid,
- :dscrp,
- :publ_operator,
- :server_dt,
- :inrep,
- :billtype,
- :moneyid) Using commit_transaction;
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
-
- IF Pos(Lower(commit_transaction.SQLErrText),'PK_u_spt_price_change') > 0 THEN
- arg_msg = '插入操作失败,关键字单据ID重复'
- ELSE
- arg_msg = "插入操作失败"+"~n"+commit_transaction.SQLErrText
- END IF
-
- GOTO ext
- END IF
- billid = ls_newid
- ELSE //////////////////////////////////////////////// //更新
-
- UPDATE u_spt_price_change
- SET billdate = :billdate,
- sptid = :sptid,
- moddate = :server_dt,
- modemp = :publ_operator,
- dscrp = :dscrp,
- inrep = :inrep,
- billtype = :billtype,
- moneyid = :moneyid
- WHERE billid = :billid
- And flag = 0 Using commit_transaction;
- IF sqlca.SQLCode <> 0 Or sqlca.SQLNRows <= 0 THEN
- rslt = 0
- arg_msg = "更新单据操作失败"+"~n"+commit_transaction.SQLErrText
- GOTO ext
- END IF
-
- //删除原有明细
- DELETE FROM u_spt_price_changemx
- WHERE u_spt_price_changemx.billid = :billid
- Using commit_transaction;
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = "删除旧有明细操作失败"+"~n"+commit_transaction.SQLErrText
- GOTO ext
- END IF
-
- END IF
- FOR i = 1 To it_mxbt
- INSERT INTO u_spt_price_changemx
- (
- billid,
- mtrlid,
- unit,
- qty,
- price,
- rebate,
- status,
- lastprice,
- wareprice,
- rate,
- sptmtrlname,
- Dscrp,
- printid,
- lastdate,
- woodcode,
- pcode)
- VALUES
- (
- :billid,
- :changemx[i].mtrlid,
- :changemx[i].unit,
- :changemx[i].qty,
- :changemx[i].price,
- :changemx[i].rebate,
- :changemx[i].status,
- :changemx[i].lastprice,
- :changemx[i].wareprice,
- :changemx[i].rate,
- :changemx[i].sptmtrlname,
- :changemx[i].Dscrp,
- :changemx[i].printid,
- :changemx[i].lastdate,
- :changemx[i].woodcode,
- :changemx[i].pcode
- ) 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 rslt = 1 And arg_ifcommit 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);Int rslt = 1
- arg_newdescppart = Trim(arg_newdescppart)
- IF arg_billid <= 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
- rslt = p_getinfo(arg_billid,arg_msg)
- IF rslt = 0 THEN GOTO ext
- IF flag = 0 THEN
- rslt = 0
- arg_msg = "非审核状态下不可用"
- GOTO ext
- END IF
- UPDATE u_spt_price_change
- SET dscrp = dscrp+' '+:arg_newdescppart
- Where u_spt_price_change.billid = :billid Using commit_transaction;
- IF commit_transaction.SQLCode <> 0 THEN
- ROLLBACK ;
- rslt = 0
- arg_msg = "因网络或其它原因导致添加单据备注操作失败"+"~n"+commit_transaction.SQLErrText
- GOTO ext
- END IF
- dscrp = dscrp+' '+arg_newdescppart
- ext:
- IF rslt = 0 THEN
- ROLLBACK Using commit_transaction ;
- ELSE
- COMMIT Using commit_transaction ;
- END IF
- Return(rslt)
- end function
- public function integer newbegin ();p_reset()
- it_newbegin=TRUE
- it_updatebegin=FALSE
- return 1
- end function
- public function integer p_clearmx ();//int p_clearmx()
- //清除明细
- it_mxbt=0
- return 1
- end function
- public function integer getinfo (long arg_billid, ref string arg_msg);//getinfo(arg_scid,arg_billid,arg_msg)
- //0 失败 1成功
- Int rslt = 1,i = 1,no_mxcheck = 0
- IF arg_billid <= 0 THEN
- rslt = 0
- arg_msg = "非法调价单唯一码"
- GOTO ext
- END IF
- rslt = p_getinfo(arg_billid,arg_msg)
- IF rslt = 0 THEN GOTO ext
- //用游标读取明细
- DECLARE cur_changemx CURSOR FOR
- SELECT
- u_spt_price_changemx.printid,
- u_spt_price_changemx.mtrlid,
- u_mtrldef.mtrlcode,
- u_spt_price_changemx.unit,
- u_spt_price_changemx.qty,
- u_spt_price_changemx.price,
- u_spt_price_changemx.rebate,
- u_spt_price_changemx.status,
- u_spt_price_changemx.sptmtrlname,
- u_spt_price_changemx.Dscrp,
- u_spt_price_changemx.lastprice,
- u_spt_price_changemx.wareprice,
- u_spt_price_changemx.rate,
- u_spt_price_changemx.lastdate,
- u_spt_price_changemx.woodcode,
- u_spt_price_changemx.pcode
- FROM u_spt_price_change
- INNER JOIN
- u_spt_price_changemx ON
- u_spt_price_change.billid = u_spt_price_changemx.billid
- INNER JOIN
- u_mtrldef ON u_spt_price_changemx.mtrlid = u_mtrldef.mtrlid
- WHERE u_spt_price_change.billid = :arg_billid
- USING commit_transaction;
-
- OPEN cur_changemx;
- FETCH cur_changemx INTO
- :changemx[i].printid,
- :changemx[i].mtrlid,
- :changemx[i].mtrlcode,
- :changemx[i].unit,
- :changemx[i].qty,
- :changemx[i].price,
- :changemx[i].rebate,
- :changemx[i].status,
- :changemx[i].sptmtrlname,
- :changemx[i].Dscrp,
- :changemx[i].lastprice,
- :changemx[i].wareprice,
- :changemx[i].rate,
- :changemx[i].lastdate,
- :changemx[i].woodcode,
- :changemx[i].pcode;
-
- DO WHILE commit_transaction.SQLCode = 0
- i++
- FETCH cur_changemx INTO
- :changemx[i].printid,
- :changemx[i].mtrlid,
- :changemx[i].mtrlcode,
- :changemx[i].unit,
- :changemx[i].qty,
- :changemx[i].price,
- :changemx[i].rebate,
- :changemx[i].status,
- :changemx[i].sptmtrlname,
- :changemx[i].Dscrp,
- :changemx[i].lastprice,
- :changemx[i].wareprice,
- :changemx[i].rate,
- :changemx[i].lastdate,
- :changemx[i].woodcode,
- :changemx[i].pcode;
-
- LOOP
- CLOSE cur_changemx;
- //检验明细是否读入完整
- SELECT count(*) INTO :no_mxcheck
- FROM u_spt_price_change
- INNER JOIN
- u_spt_price_changemx ON
- u_spt_price_change.billid = u_spt_price_changemx.billid
- INNER JOIN
- u_mtrldef ON u_spt_price_changemx.mtrlid = u_mtrldef.mtrlid
- WHERE u_spt_price_change.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
- billid = arg_billid
- it_mxbt = i - 1
- it_newbegin = FALSE
- it_updatebegin = FALSE
- ext:
- IF rslt = 0 THEN p_reset()
- RETURN rslt
- end function
- public function integer p_getinfo (long arg_billid, ref string arg_msg);Int rslt = 1
- IF arg_billid <= 0 THEN
- rslt = 0
- arG_MSG = "非法调价单唯一码"
- GOTO ext
- END IF
- SELECT
- Billcode,
- billdate,
- sptid,
- flag,
- dscrp,
- inrep,
- billtype,
- moneyid
- Into
- :Billcode,
- :billdate,
- :sptid,
- :flag,
- :dscrp,
- :inrep,
- :billtype,
- :moneyid
- From u_spt_price_change
- Where billid = :arg_billid
- Using commit_transaction;
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arG_MSG = "查询操作失败(错误调价单唯一码),调价单"+commit_transaction.SQLErrText
- GOTO ext
- END IF
- billid = arg_billid
- ext:
- IF rslt = 0 THEN p_reset()
- RETURN rslt
- end function
- public function integer del (long arg_billid, boolean arg_ifcommit, ref string arg_msg);Int rslt = 1
- IF arg_billid <= 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
- rslt = p_getinfo(arg_billid,arg_msg)
- IF rslt = 0 THEN GOTO ext
- IF flag = 1 THEN
- rslt = 0
- arg_msg = "单据已经审核,不可以删除"
- GOTO ext
- END IF
- DELETE FROM u_spt_price_change WHERE u_spt_price_change.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_spt_price_changemx WHERE u_spt_price_changemx.billid = :arg_billid
- 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
- Return (rslt)
- end function
- public function integer c_auditing (boolean arg_ifcommit, ref string arg_msg);
- Long cnt = 0,i
- Int rslt = 1
- DateTime null_server_dt
- SetNull(null_server_dt)
- IF billid = 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 = 0 THEN
- rslt = 0
- arg_msg = '该单价调整未审核,不用撤审!'
- GOTO ext
- END IF
- UPDATE u_spt_price_change SET
- flag = 0,
- Auditemp = '',
- Auditdate = :null_server_dt
- Where flag = 1 AND billid = :billid USING commit_transaction;
-
- IF commit_transaction.SQLCode <> 0 THEN
- arg_msg = '更新单价调整失败,原因:'+commit_transaction.SQLErrText
- rslt = 0
- GOTO ext
- END IF
- //
- ////币种, 默认本位币
- //Long moneyid
- //SELECT moneyid INTO :moneyid
- // FROM cw_currency
- // WHERE native = 1
- // USING commit_transaction;
- //IF commit_transaction.SQLCode <> 0 THEN
- // rslt = 0
- // arg_msg = '查询本位币失败! '+commit_transaction.SQLErrText
- // GOTO ext
- //END IF
- FOR i = 1 TO it_mxbt
- IF uo_price.uf_del_sptprice(0,sptid,changemx[i].mtrlid,changemx[i].unit,changemx[i].status,changemx[i].woodcode,changemx[i].pcode,billid,&
- i,moneyid,FALSE,arg_msg) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
-
- // IF uo_price.uf_update_sptmtrlname(sptid,changemx[i].mtrlid,changemx[i].unit,changemx[i].sptmtrlname,false,arg_msg) = 0 THEN
- // rslt = 0
- // GOTO ext
- // END IF
-
- NEXT
- ext:
- 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 auditing (boolean arg_ifcommit, ref string arg_msg);
- Long cnt = 0,i
- Int rslt = 1
- IF billid = 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
- UPDATE u_spt_price_change SET
- flag = 1,
- auditemp = :publ_operator,
- Auditdate = getdate()
- WHERE billid = :billid
- And flag = 0 Using commit_transaction;
-
- IF commit_transaction.SQLCode <> 0 THEN
- arg_msg = '更新单价调整失败,原因>>'+commit_transaction.SQLErrText
- rslt = 0
- GOTO ext
- END IF
- ////币种, 默认本位币
- //Long moneyid
- //SELECT moneyid INTO :moneyid
- // FROM cw_currency
- // WHERE native = 1
- // Using commit_transaction;
- //IF commit_transaction.SQLCode <> 0 THEN
- // rslt = 0
- // arg_msg = '查询本位币失败! '+commit_transaction.SQLErrText
- // GOTO ext
- //END IF
- FOR i = 1 To it_mxbt
- IF uo_price.uf_update_sptprice(0,sptid,changemx[i].mtrlid,changemx[i].unit,changemx[i].status,changemx[i].woodcode,changemx[i].pcode,billid,moneyid,changemx[i].price,changemx[i].rebate,&
- changemx[i].rate,changemx[i].wareprice,billdate,billcode,1,'报价/调价单',i,2,False,arg_msg) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
-
- IF uo_price.uf_update_sptmtrlname(sptid,changemx[i].mtrlid,changemx[i].unit,changemx[i].sptmtrlname,False,arg_msg) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
-
- NEXT
- ext:
- 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 (long arg_printid, long arg_mtrlid, string arg_mtrlcode, string arg_unit, decimal arg_qty, decimal arg_price, decimal arg_rebate, decimal arg_rate, string arg_status, string arg_woodcode, string arg_pcode, string arg_sptmtrlname, string arg_dscrp, ref string arg_msg);Int rslt = 1
- Decimal i_lastprice,i_lastrate,i_rate
- datetime ld_lastdate
- string ls_unit
- IF it_newbegin = FALSE AND it_updatebegin = FALSE THEN
- rslt = 0
- arg_msg = "非编辑状态不可以使用,操作取消"
- GOTO ext
- END IF
- //清除空值
- IF IsNull(arg_printid) THEN arg_printid = 0
- IF IsNull(arg_mtrlid) THEN arg_mtrlid = 0
- IF IsNull(arg_mtrlcode) THEN arg_mtrlcode = ''
- IF IsNull(arg_status) THEN arg_status = ''
- IF IsNull(arg_dscrp) THEN arg_dscrp = ''
- IF IsNull(arg_price) THEN arg_price = 0
- IF IsNull(arg_qty) THEN arg_qty = 0
- IF IsNull(arg_unit) THEN arg_unit = ''
- if IsNull(arg_rate) THEN arg_rate = 1
- if IsNull(arg_rebate) THEN arg_rebate = 1
- IF IsNull(arg_woodcode) THEN arg_woodcode = ''
- IF IsNull(arg_pcode) THEN arg_pcode = ''
- if arg_rate = 0 THEN arg_rate = 1
- ls_unit = arg_unit
- IF arg_mtrlid = 0 and arg_price = 0 THEN
- rslt = 1
- GOTO ext
- END IF
- IF f_check_status(1, arg_status) = 0 THEN
- rslt = 0
- arg_msg ="第" + string(arg_printid) + "行,查询操作失败,可能配置未定义,编码:"+arg_mtrlcode+",配置:"+arg_status
- GOTO ext
- END IF
- IF uo_price.uf_getmtrlsptprice_ch(sptid,arg_mtrlid,ls_unit,arg_status,arg_woodcode,arg_pcode,i_lastprice,i_rate,ld_lastdate,arg_msg) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
- it_mxbt++
- changemx[it_mxbt].printid = it_mxbt
- changemx[it_mxbt].mtrlid = arg_mtrlid
- changemx[it_mxbt].unit = arg_unit
- changemx[it_mxbt].qty = arg_qty
- changemx[it_mxbt].rebate = arg_rebate
- changemx[it_mxbt].price = arg_price
- changemx[it_mxbt].lastprice = i_lastprice
- changemx[it_mxbt].wareprice = round((arg_price * arg_rebate) /arg_rate,10)
- changemx[it_mxbt].rate = arg_rate
- changemx[it_mxbt].sptmtrlname = arg_sptmtrlname
- changemx[it_mxbt].Dscrp = arg_dscrp
- changemx[it_mxbt].lastdate = ld_lastdate
- changemx[it_mxbt].status = arg_status
- changemx[it_mxbt].woodcode = arg_woodcode
- changemx[it_mxbt].pcode = arg_pcode
- ext:
- RETURN rslt
- end function
- on uo_spt_price_change.create
- call super::create
- TriggerEvent( this, "constructor" )
- end on
- on uo_spt_price_change.destroy
- TriggerEvent( this, "destructor" )
- call super::destroy
- end on
- event constructor;uo_price = CREATE uo_spt_price
- end event
- event destructor;destroy uo_price
- end event
|