12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- $PBExportHeader$f_create_cred.srf
- global type f_create_cred from function_object
- end type
- forward prototypes
- global function integer f_create_cred (s_credence arg_s_cred, boolean arg_ifcommit, ref string arg_msg, ref long arg_ref_credid, ref long arg_ref_credno)
- end prototypes
- global function integer f_create_cred (s_credence arg_s_cred, boolean arg_ifcommit, ref string arg_msg, ref long arg_ref_credid, ref long arg_ref_credno);Int rslt = 1
- Long i,ll_itmxt
- uo_credence uo_cred
- uo_cred = Create uo_credence
- ll_itmxt = UpperBound(arg_s_cred.arg_s_credmx)
- IF ll_itmxt = 0 THEN
- arg_msg = '没有凭证明细'
- rslt = 0
- GOTO ext
- END IF
- IF uo_cred.newbegin() = 0 THEN
- arg_msg = '凭证建立失败'
- rslt = 0
- GOTO ext
- END IF
- uo_cred.creddate = arg_s_cred.creddate
- uo_cred.reldate = arg_s_cred.reldate
- uo_cred.reldcode = arg_s_cred.relcode
- IF arg_ref_credno = 0 THEN
- uo_cred.credno = uo_cred.get_new_credno(0,arg_s_cred.credtype,sys_curyearmon,arg_msg)
- ELSE
- uo_cred.credno = arg_ref_credno
- END IF
- uo_cred.subaccsetid = sys_subaccsetid
- uo_cred.readtype = arg_s_cred.readtype
- uo_cred.cmonth = sys_curyearmon
- uo_cred.credtype = arg_s_cred.credtype
- uo_cred.ifauto = arg_s_cred.ifauto
- FOR i = 1 To ll_itmxt
- IF uo_cred.acceptmx(i,arg_s_cred.arg_s_credmx[i].subid,&
- arg_s_cred.arg_s_credmx[i].brief,arg_s_cred.arg_s_credmx[i].rate,&
- arg_s_cred.arg_s_credmx[i].rawdebit,arg_s_cred.arg_s_credmx[i].rawcredit,&
- arg_s_cred.arg_s_credmx[i].debit,arg_s_cred.arg_s_credmx[i].credit,&
- arg_s_cred.arg_s_credmx[i].amount,arg_s_cred.arg_s_credmx[i].price,&
- arg_s_cred.arg_s_credmx[i].deptid,arg_s_cred.arg_s_credmx[i].itemid,&
- arg_s_cred.arg_s_credmx[i].billdate,arg_s_cred.arg_s_credmx[i].billid,&
- arg_s_cred.arg_s_credmx[i].billno,arg_s_cred.arg_s_credmx[i].cropbillid,&
- arg_s_cred.arg_s_credmx[i].ifreadonly,arg_s_cred.arg_s_credmx[i].cusid,&
- arg_s_cred.arg_s_credmx[i].sptid,0,arg_msg) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
- NEXT
- String ls_opemp
- IF arg_s_cred.ifauto = 1 THEN
- ls_opemp = publ_operator
- ELSE
- ls_opemp = '机制'
- END IF
- IF uo_cred.Save(ls_opemp,arg_msg,arg_ifcommit) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
- arg_ref_credid = uo_cred.credid
- arg_ref_credno = uo_cred.credno
- ext:
- Destroy uo_cred
- RETURN rslt
- end function
|