uo_msttake_other.sru 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512
  1. $PBExportHeader$uo_msttake_other.sru
  2. forward
  3. global type uo_msttake_other from nonvisualobject
  4. end type
  5. end forward
  6. global type uo_msttake_other from nonvisualobject
  7. end type
  8. global uo_msttake_other uo_msttake_other
  9. type variables
  10. Public ProtectedWrite Long billid
  11. Public ProtectedWrite String billcode
  12. Public ProtectedWrite String auditemp
  13. Public ProtectedWrite DateTime auditdate
  14. Public ProtectedWrite Int flag
  15. Public ProtectedWrite Int secflag
  16. Public ProtectedWrite String Opemp
  17. Public ProtectedWrite DateTime Opdate
  18. Public ProtectedWrite String ModEmp
  19. Public ProtectedWrite DateTime ModDate
  20. Long scid
  21. String credencecode
  22. Long banktypeid
  23. Decimal amt
  24. Long accountsid
  25. DateTime outdate
  26. String Descrp
  27. String rep
  28. Long rapmoneyid
  29. Long itemid
  30. Long relid
  31. Int billtype //0-其它收入支出,1-借款,2-还款
  32. Long empid
  33. Long deptid
  34. Int itemflag
  35. Long relrapid
  36. long moneyid
  37. long spt_cus_id
  38. decimal finish_amt
  39. Transaction commit_transaction //数据commit事务
  40. Int cwauditingflag = 0 //总账审核标记
  41. DateTime cwauditingdate //总账审核时间
  42. String cwauditingrep //总账审核操作员
  43. Private:
  44. Boolean IT_NEWBEGIN = False //新建标志
  45. Boolean IT_UPDATEBEGIN = False //修改标志
  46. Long it_mxbt = 0
  47. s_income_expenses_mx incomemx[]
  48. //int sys_option_income_secaudit
  49. end variables
  50. forward prototypes
  51. public function integer p_reset ()
  52. public function integer newbegin (ref string arg_msg)
  53. public function integer cancelpermit (long arg_billid, ref string arg_msg, boolean arg_ifcommit)
  54. public function integer cancel (long arg_billid, ref string arg_msg, boolean arg_ifcommit)
  55. public function integer p_getinfo (long arg_billid, ref string arg_msg)
  56. public function integer permit (long arg_billid, string arg_emp, ref string arg_msg, boolean arg_ifcommit)
  57. public function integer updatebegin (long arg_billid, ref string arg_msg)
  58. public function integer save (string arg_operator, ref string arg_msg, boolean arg_ifcommit)
  59. public function integer add_dscrp (long arg_billid, string arg_newdescppart, ref string arg_msg, boolean arg_ifcommit)
  60. public function integer cancelpermit2 (long arg_billid, ref string arg_msg, boolean arg_ifcommit)
  61. public function integer permit2 (long arg_billid, string arg_emp, ref string arg_msg, boolean arg_ifcommit)
  62. public function integer add_dscrp (long arg_billid, string arg_newdescppart, ref string arg_msg)
  63. public function integer p_clearmx ()
  64. public function integer getinfo (long arg_billid, ref string arg_msg)
  65. 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)
  66. public function integer audit_subject (long arg_scid, long arg_billid, boolean arg_ifcommit, ref string arg_msg)
  67. public function integer c_audit_subject (long arg_scid, long arg_billid, boolean arg_ifcommit, ref string arg_msg)
  68. end prototypes
  69. public function integer p_reset ();
  70. billid = 0
  71. billcode = ''
  72. credencecode = ''
  73. banktypeid = 0
  74. amt = 0
  75. accountsid = 0
  76. setnull(outdate)
  77. Descrp = ''
  78. rep = ''
  79. relid = 0
  80. rapmoneyid = 0
  81. moneyid = 0
  82. empid = 0
  83. billtype = 0
  84. itemid = 0
  85. deptid = 0
  86. flag = 0
  87. Opemp = ''
  88. setnull(Opdate)
  89. setnull(ModDate)
  90. ModEmp = ''
  91. auditemp = ''
  92. setnull(auditdate)
  93. it_newbegin=FALSE
  94. it_updatebegin=FALSE
  95. p_clearmx()
  96. RETURN 1
  97. end function
  98. public function integer newbegin (ref string arg_msg);//newbegin()
  99. //从置对象,设定业务类型,准备建立新单
  100. //0 fail 1 success
  101. LONG RSLT=1
  102. p_reset()
  103. it_newbegin=TRUE
  104. it_updatebegin=FALSE
  105. return RSLT
  106. end function
  107. public function integer cancelpermit (long arg_billid, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1
  108. DateTime nulldate
  109. Long ll_i
  110. SetNull(nulldate)
  111. IF sys_option_income_secaudit = -1000 THEN
  112. rslt = 0
  113. arg_msg = '选项:[328]其它收入支出单使用二级审核,读取初始默认值失败,操作取消!'
  114. GOTO ext
  115. END IF
  116. uo_iteminput uo_item
  117. uo_item = Create uo_iteminput
  118. uo_item.ib_CreateRapmoneyid = False
  119. //uo_item.commit_transaction = commit_transaction
  120. uo_empinfo uo_emptake
  121. uo_emptake = Create uo_empinfo
  122. uo_rapmoney uo_money
  123. uo_money = Create uo_rapmoney
  124. uo_money.commit_transaction = commit_transaction
  125. IF arg_billid <= 0 THEN
  126. rslt = 0
  127. arg_msg = '错误单据唯一码'
  128. GOTO ext
  129. END IF
  130. IF getinfo(arg_billid,arg_msg) = 0 THEN
  131. rslt = 0
  132. GOTO ext
  133. END IF
  134. IF finish_amt > 0 THEN
  135. rslt = 0
  136. arg_msg = '已开相关其他收款单,不能撤审'
  137. GOTO ext
  138. END IF
  139. IF flag <> 1 THEN
  140. rslt = 0
  141. arg_msg = "单据只有在已审核状态才可以执行撤消审核,请核对"
  142. GOTO ext
  143. END IF
  144. IF secflag = 1 THEN
  145. rslt = 0
  146. arg_msg = "单据已财务确认,不能执行撤消审核,请核对"
  147. GOTO ext
  148. END IF
  149. UPDATE U_income_expenses
  150. SET flag = 0,
  151. auditemp = '',
  152. auditdate = :nulldate,
  153. relrapid = 0
  154. WHERE U_income_expenses.billid = :arg_billid
  155. AND flag = 1
  156. Using commit_transaction ;
  157. IF commit_transaction.SQLCode <> 0 THEN
  158. rslt = 0
  159. arg_msg = "单据撤消审核操作失败"+"~n"+commit_transaction.SQLErrText
  160. GOTO ext
  161. END IF
  162. it_newbegin = False
  163. it_updatebegin = False
  164. ext:
  165. IF rslt = 0 THEN
  166. ROLLBACK Using commit_transaction;
  167. ELSEIF rslt = 1 And arg_ifcommit THEN
  168. COMMIT Using commit_transaction;
  169. END IF
  170. p_reset()
  171. Destroy uo_item
  172. Destroy uo_emptake
  173. Destroy uo_money
  174. Return (rslt)
  175. end function
  176. public function integer cancel (long arg_billid, ref string arg_msg, boolean arg_ifcommit);
  177. //0 FAIL, 1 SUCCESS
  178. Int rslt = 1
  179. IF arg_billid <= 0 THEN
  180. rslt = 0
  181. ARG_MSG = '错误单据唯一码'
  182. GOTO ext
  183. END IF
  184. IF p_getinfo(arg_billid,ARG_MSG) = 0 THEN
  185. rslt = 0
  186. GOTO ext
  187. END IF
  188. IF flag <> 0 THEN
  189. rslt = 0
  190. ARG_MSG = "单据已经审核,不可以删除"
  191. GOTO ext
  192. END IF
  193. DELETE FROM U_income_expenses
  194. Where U_income_expenses.billid = :arg_billid USING commit_transaction ;
  195. IF commit_transaction.SQLCode <> 0 THEN
  196. rslt = 0
  197. ARG_MSG = "删除单据操作失败"+"~n"+commit_transaction.SQLErrText
  198. GOTO ext
  199. END IF
  200. DELETE FROM U_income_expenses_mx
  201. Where U_income_expenses_mx.billid = :arg_billid USING commit_transaction;
  202. IF commit_transaction.SQLCode <> 0 THEN
  203. rslt = 0
  204. arg_msg = "删除单据明细操作失败"+"~n"+commit_transaction.SQLErrText
  205. ROLLBACK USING commit_transaction;
  206. GOTO ext
  207. END IF
  208. it_newbegin = FALSE
  209. it_updatebegin = FALSE
  210. ext:
  211. IF rslt = 0 THEN
  212. ROLLBACK USING commit_transaction;
  213. ELSEIF arg_ifcommit AND rslt = 1 THEN
  214. COMMIT USING commit_transaction;
  215. END IF
  216. p_reset()
  217. Return (rslt)
  218. end function
  219. public function integer p_getinfo (long arg_billid, ref string arg_msg);Int rslt = 1
  220. SELECT U_income_expenses.billid,
  221. U_income_expenses.billcode,
  222. U_income_expenses.credencecode,
  223. U_income_expenses.banktypeid,
  224. U_income_expenses.amt,
  225. U_income_expenses.accountsid,
  226. U_income_expenses.outdate,
  227. U_income_expenses.Descrp,
  228. U_income_expenses.rep,
  229. U_income_expenses.rapmoneyid,
  230. U_income_expenses.itemid,
  231. U_income_expenses.flag,
  232. U_income_expenses.secflag,
  233. U_income_expenses.Opemp,
  234. U_income_expenses.Opdate,
  235. U_income_expenses.ModDate,
  236. U_income_expenses.ModEmp,
  237. U_income_expenses.auditemp,
  238. U_income_expenses.auditdate,
  239. U_income_expenses.relid,
  240. U_income_expenses.billtype,
  241. U_income_expenses.empid,
  242. U_income_expenses.deptid,
  243. U_income_expenses.relrapid,
  244. U_income_expenses.itemflag,
  245. U_income_expenses.scid,
  246. U_income_expenses.moneyid,
  247. U_income_expenses.spt_cus_id,
  248. U_income_expenses.finish_amt,
  249. U_income_expenses.cwauditingflag,
  250. U_income_expenses.cwauditingrep,
  251. U_income_expenses.cwauditingdate
  252. INTO :billid,
  253. :billcode,
  254. :credencecode,
  255. :banktypeid,
  256. :amt,
  257. :accountsid,
  258. :outdate,
  259. :Descrp,
  260. :rep,
  261. :rapmoneyid,
  262. :itemid,
  263. :flag,
  264. :secflag,
  265. :Opemp,
  266. :Opdate,
  267. :ModDate,
  268. :ModEmp,
  269. :auditemp,
  270. :auditdate,
  271. :relid,
  272. :billtype,
  273. :empid,
  274. :deptid,
  275. :relrapid,
  276. :itemflag,
  277. :scid,
  278. :moneyid,
  279. :spt_cus_id,
  280. :finish_amt,
  281. :cwauditingflag,
  282. :cwauditingrep,
  283. :cwauditingdate
  284. FROM U_income_expenses
  285. Where ( U_income_expenses.billid = :arg_billid ) ;
  286. IF sqlca.SQLCode <> 0 THEN
  287. rslt = 0
  288. arg_msg = "查询其他收入单操作失败"+sqlca.SQLErrText
  289. GOTO ext
  290. END IF
  291. ext:
  292. RETURN rslt
  293. end function
  294. public function integer permit (long arg_billid, string arg_emp, ref string arg_msg, boolean arg_ifcommit);
  295. Int rslt = 1
  296. Long cnt = 0,ll_i
  297. Long ref_dateint
  298. uo_iteminput uo_item
  299. uo_item = Create uo_iteminput
  300. uo_item.ib_CreateRapmoneyid = false
  301. uo_empinfo uo_emptake
  302. uo_emptake = Create uo_empinfo
  303. uo_rapmoney uo_money
  304. uo_money = Create uo_rapmoney
  305. uo_money.commit_transaction = commit_transaction
  306. IF sys_option_income_secaudit = -1000 THEN
  307. rslt = 0
  308. arg_msg = '选项:[328]其它收入支出单使用二级审核,读取初始默认值失败,操作取消!'
  309. GOTO ext
  310. END IF
  311. IF arg_billid <= 0 THEN
  312. rslt = 0
  313. arg_msg = '错误其他收入支出单唯一码'
  314. GOTO ext
  315. END IF
  316. IF getinfo(arg_billid,arg_msg) = 0 THEN
  317. rslt = 0
  318. GOTO ext
  319. END IF
  320. IF flag <> 0 THEN
  321. rslt = 0
  322. arg_msg = "单据已经审核,操作取消"
  323. GOTO ext
  324. END IF
  325. cnt = 0
  326. SELECT count(*) INTO :cnt
  327. FROM u_user
  328. Where username = :arg_emp Using commit_transaction;
  329. IF commit_transaction.SQLCode <> 0 THEN
  330. rslt = 0
  331. arg_msg = "查询操作失败,操作员!"
  332. GOTO ext
  333. END IF
  334. IF cnt = 0 THEN
  335. rslt = 0
  336. arg_msg = "操作员姓名未登记或已取消!"
  337. GOTO ext
  338. END IF
  339. UPDATE U_income_expenses
  340. SET auditemp = :arg_emp ,
  341. auditdate = getdate(),
  342. flag = 1,
  343. relrapid = 0
  344. WHERE billid = :arg_billid
  345. AND flag = 0
  346. Using commit_transaction;
  347. IF commit_transaction.SQLCode <> 0 THEN
  348. rslt = 0
  349. arg_msg = "更单据审核操作失败 ~n"+commit_transaction.SQLErrText
  350. GOTO ext
  351. END IF
  352. it_newbegin = False
  353. it_updatebegin = False
  354. ext:
  355. IF rslt = 0 THEN
  356. ROLLBACK Using commit_transaction;
  357. ELSEIF rslt = 1 And arg_ifcommit THEN
  358. COMMIT Using commit_transaction;
  359. END IF
  360. p_reset()
  361. Destroy uo_item
  362. Destroy uo_money
  363. Destroy uo_emptake
  364. Return (rslt)
  365. end function
  366. public function integer updatebegin (long arg_billid, ref string arg_msg);//UPDATEbegin(long arg_taskid,ref string arg_msg)
  367. //从置对象,设定业务类型与关联ID,准备更新进仓单
  368. //0 fail 1 success
  369. Long rslt = 1,CNT = 0
  370. IF sys_option_income_secaudit = -1000 THEN
  371. rslt = 0
  372. arg_msg = '选项:[328]其它收入支出单使用二级审核,读取初始默认值失败,操作取消!'
  373. GOTO ext
  374. END IF
  375. IF arg_billid <= 0 THEN
  376. rslt = 0
  377. arg_msg = '错误其他收入支出单唯一码'
  378. GOTO ext
  379. END IF
  380. IF p_getinfo(arg_billid,arg_msg) = 0 THEN
  381. rslt = 0
  382. GOTO ext
  383. END IF
  384. IF sys_option_income_secaudit = 0 THEN
  385. IF flag <> 0 THEN
  386. rslt = 0
  387. arg_msg = '已经处于审核或完成等状态,不可以修改,如果其他收入支出单未完成并要修改请先撤销审核'
  388. GOTO ext
  389. END IF
  390. ELSE
  391. IF secflag <> 0 THEN
  392. rslt = 0
  393. arg_msg = '已经处于财务确认状态,不可以修改,如果其他收入支出单未完成并要修改请先撤销财务确认'
  394. GOTO ext
  395. END IF
  396. END IF
  397. it_newbegin = False
  398. it_updatebegin = True
  399. p_clearmx() //清除明细
  400. amt = 0
  401. ext:
  402. IF rslt = 0 THEN p_reset()
  403. RETURN rslt
  404. end function
  405. public function integer save (string arg_operator, ref string arg_msg, boolean arg_ifcommit);
  406. Integer rslt = 1,cnt = 0,i
  407. Long ls_newid
  408. DateTime server_datetime
  409. Long ll_id
  410. String ls_sccode
  411. IF IsNull(credencecode) THEN credencecode = ''
  412. IF IsNull(banktypeid) THEN banktypeid = 0
  413. IF IsNull(amt) THEN amt = 0
  414. IF IsNull(accountsid) THEN accountsid = 0
  415. IF IsNull(Descrp) THEN Descrp = ''
  416. IF IsNull(rep) THEN rep = ''
  417. IF IsNull(arg_operator) THEN arg_operator = ''
  418. IF IsNull(rapmoneyid) THEN rapmoneyid = 0
  419. IF IsNull(itemid) THEN itemid = 0
  420. IF IsNull(deptid) THEN deptid = 0
  421. IF IsNull(scid) THEN scid = 0
  422. IF IsNull(itemflag) THEN itemflag = 1
  423. IF IsNull(moneyid) THEN moneyid = 0
  424. IF IsNull(spt_cus_id) THEN spt_cus_id = 0
  425. IF it_newbegin = False And it_updatebegin = False THEN
  426. rslt = 0
  427. arg_msg = "非编辑状态不可以提交"
  428. GOTO ext
  429. END IF
  430. IF it_mxbt = 0 THEN
  431. rslt = 0
  432. arg_msg = '没有明细内容'
  433. GOTO ext
  434. END IF
  435. amt = 0
  436. FOR i = 1 To it_mxbt
  437. amt = amt + incomemx[i].amt
  438. NEXT
  439. IF amt = 0 THEN
  440. rslt = 0
  441. arg_msg = "请输入金额"
  442. GOTO ext
  443. END IF
  444. IF f_check_inoutdate(0,outdate,False,arg_msg) = 0 THEN
  445. rslt = 0
  446. arg_msg = "该单据超出指定日期范围(单据限制录入天数)"
  447. GOTO ext
  448. END IF
  449. //IF billtype = 1 Or billtype = 2 THEN
  450. // IF empid = 0 THEN
  451. // arg_msg = '请选择员工'
  452. // rslt = 0
  453. // GOTO ext
  454. // END IF
  455. // IF itemid = 0 THEN
  456. // rslt = 0
  457. // arg_msg = "请选择收支项目"
  458. // GOTO ext
  459. // END IF
  460. //
  461. // cnt = 0
  462. // SELECT count(*) INTO :cnt
  463. // FROM u_itemdef
  464. // WHERE itemid = :itemid
  465. // Using commit_transaction;
  466. // IF commit_transaction.SQLCode <> 0 THEN
  467. // arg_msg = '查询项目资料失败,'+sqlca.SQLErrText
  468. // rslt = 0
  469. // GOTO ext
  470. // END IF
  471. //END IF
  472. IF rep = '' THEN
  473. rslt = 0
  474. arg_msg = "请输入经手人"
  475. GOTO ext
  476. END IF
  477. IF banktypeid = 0 THEN
  478. rslt = 0
  479. arg_msg = "请选择结算方式"
  480. GOTO ext
  481. END IF
  482. //IF accountsid = 0 THEN
  483. // rslt = 0
  484. // arg_msg = "请选择银行帐号"
  485. // GOTO ext
  486. //END IF
  487. //SELECT moneyid
  488. // INTO :rapmoneyid
  489. // FROM u_accounts
  490. // WHERE u_accounts.accountsid = :accountsid
  491. // Using commit_transaction;
  492. //IF commit_transaction.SQLCode <> 0 THEN
  493. // arg_msg = '查询当前的出纳帐号币种失败,'+sqlca.SQLErrText
  494. // rslt = 0
  495. // GOTO ext
  496. //END IF
  497. moneyid = rapmoneyid
  498. cnt = 0
  499. SELECT count(*)
  500. INTO :cnt
  501. FROM cw_currency
  502. WHERE cw_currency.moneyid = :moneyid
  503. USING commit_transaction;
  504. IF commit_transaction.SQLCode <> 0 THEN
  505. arg_msg = '查询币种失败,'+sqlca.SQLErrText
  506. rslt = 0
  507. GOTO ext
  508. END IF
  509. IF cnt <> 1 THEN
  510. arg_msg = '账号的币种重复或不存在!'
  511. rslt = 0
  512. GOTO ext
  513. END IF
  514. //IF credencecode = '' THEN
  515. // rslt = 0
  516. // arg_msg = "请输入相关号"
  517. // GOTO ext
  518. //END IF
  519. SELECT Top 1 getdate() Into :server_datetime From u_user Using commit_transaction ;
  520. IF commit_transaction.SQLCode <> 0 THEN
  521. rslt = 0
  522. arg_msg = "查询操作失败,日期 "
  523. GOTO ext
  524. END IF
  525. cnt = 0
  526. SELECT count(*) INTO :cnt
  527. FROM u_user
  528. Where username = :arg_operator Using commit_transaction ;
  529. IF commit_transaction.SQLCode <> 0 THEN
  530. rslt = 0
  531. arg_msg = "查询操作失败,操作员!"
  532. GOTO ext
  533. END IF
  534. IF cnt = 0 THEN
  535. rslt = 0
  536. arg_msg = "操作员姓名未登记或已取消!"
  537. GOTO ext
  538. END IF
  539. opdate = server_datetime //填写单据建立时间(最近修改时间)
  540. ////////////////////////////////////////////// //开始区分:新建/更新 处理
  541. IF billid = 0 THEN //新建
  542. ll_id = f_sys_scidentity(0,"U_income_expenses","billid",arg_msg,True,id_sqlca)
  543. IF ll_id <= 0 THEN
  544. rslt = 0
  545. GOTO ext
  546. END IF
  547. //取分部代号
  548. IF f_get_sccode(scid,commit_transaction,ls_sccode,arg_msg) = 0 THEN
  549. rslt = 0
  550. GOTO ext
  551. END IF
  552. IF billtype = 3 THEN
  553. billcode = getid(0,ls_sccode + 'OT',Date(server_datetime),False,commit_transaction)
  554. END IF
  555. IF billcode = "err" THEN
  556. billcode = ''
  557. rslt = 0
  558. arg_msg = "无法获取单据编号"+"~n"+sqlca.SQLErrText
  559. GOTO ext
  560. END IF
  561. //读取新taskid
  562. billid = ll_id
  563. INSERT INTO U_income_expenses
  564. ( billid,
  565. billcode,
  566. credencecode,
  567. banktypeid,
  568. amt,
  569. accountsid,
  570. outdate,
  571. Descrp,
  572. rep,
  573. rapmoneyid,
  574. itemid,
  575. billtype,
  576. empid,
  577. Opemp,
  578. Opdate,
  579. deptid,
  580. itemflag,
  581. scid,
  582. moneyid,
  583. spt_cus_id)
  584. VALUES
  585. (
  586. :billid,
  587. :billcode,
  588. :credencecode,
  589. :banktypeid,
  590. :amt,
  591. :accountsid,
  592. :outdate,
  593. :Descrp,
  594. :rep,
  595. :rapmoneyid,
  596. :itemid,
  597. :billtype,
  598. :empid,
  599. :arg_operator,
  600. :opdate,
  601. :deptid,
  602. :itemflag,
  603. :scid,
  604. :moneyid,
  605. :spt_cus_id) Using commit_transaction ;
  606. IF commit_transaction.SQLCode <> 0 THEN
  607. if it_newbegin then billid = 0
  608. rslt = 0
  609. arg_msg = "插入其他收入支出单操作失败"+"~n"+commit_transaction.SQLErrText
  610. GOTO ext
  611. END IF
  612. // FOR i = 1 To it_mxbt
  613. // INSERT INTO U_income_expenses_mx
  614. // (billid,
  615. // printid,
  616. // itemid,
  617. // amt,
  618. // deptid,
  619. // buildtype,
  620. // relscid,
  621. // relbillid,
  622. // relbillcode,
  623. // useemp,
  624. // mxdscrp)
  625. // VALUES (:billid,
  626. // :incomemx[i].printid,
  627. // :incomemx[i].itemid,
  628. // :incomemx[i].amt,
  629. // :incomemx[i].deptid,
  630. // :incomemx[i].buildtype,
  631. // :incomemx[i].relscid,
  632. // :incomemx[i].relbillid,
  633. // :incomemx[i].relbillcode,
  634. // :incomemx[i].useemp,
  635. // :incomemx[i].mxdscrp) Using commit_transaction ;
  636. // IF commit_transaction.SQLCode <> 0 THEN
  637. // rslt = 0
  638. // arg_msg = "插入其他收入支出单明细操作失败"+"~n"+commit_transaction.SQLErrText
  639. // GOTO ext
  640. // END IF
  641. // NEXT
  642. ELSE //////////////////////////////////////////////// //更新
  643. UPDATE U_income_expenses
  644. SET
  645. billcode = :billcode,
  646. credencecode = :credencecode,
  647. banktypeid = :banktypeid,
  648. amt = :amt,
  649. accountsid = :accountsid,
  650. outdate = :outdate,
  651. Descrp = :Descrp,
  652. rep = :rep,
  653. empid = :empid,
  654. rapmoneyid = :rapmoneyid,
  655. itemid = :itemid,
  656. ModDate = getdate(),
  657. ModEmp = :arg_operator,
  658. deptid = :deptid,
  659. itemflag = :itemflag,
  660. scid = :scid,
  661. moneyid = :moneyid,
  662. spt_cus_id=:spt_cus_id
  663. WHERE U_income_expenses.billID = :billID
  664. Using commit_transaction;
  665. IF commit_transaction.SQLCode <> 0 Or commit_transaction.SQLNRows <= 0 THEN
  666. rslt = 0
  667. arg_msg = "更新其他收入支出单操作失败"+"~n"+commit_transaction.SQLErrText
  668. GOTO ext
  669. END IF
  670. DELETE FROM U_income_expenses_mx
  671. Where U_income_expenses_mx.billid = :billid Using commit_transaction;
  672. IF commit_transaction.SQLCode <> 0 THEN
  673. rslt = 0
  674. arg_msg = "删除旧有明细操作失败"+"~n"+commit_transaction.SQLErrText
  675. GOTO ext
  676. END IF
  677. // FOR i = 1 To it_mxbt
  678. // INSERT INTO U_income_expenses_mx
  679. // (billid,
  680. // printid,
  681. // itemid,
  682. // amt,
  683. // deptid,
  684. // buildtype,
  685. // relscid,
  686. // relbillid,
  687. // relbillcode,
  688. // useemp,
  689. // mxdscrp)
  690. // VALUES (:billid,
  691. // :incomemx[i].printid,
  692. // :incomemx[i].itemid,
  693. // :incomemx[i].amt,
  694. // :incomemx[i].deptid,
  695. // :incomemx[i].buildtype,
  696. // :incomemx[i].relscid,
  697. // :incomemx[i].relbillid,
  698. // :incomemx[i].relbillcode,
  699. // :incomemx[i].useemp,
  700. // :incomemx[i].mxdscrp) Using commit_transaction ;
  701. // IF commit_transaction.SQLCode <> 0 THEN
  702. // rslt = 0
  703. // arg_msg = "插入其他收入支出单明细操作失败"+"~n"+commit_transaction.SQLErrText
  704. // GOTO ext
  705. // END IF
  706. // NEXT
  707. END IF
  708. FOR i = 1 To it_mxbt
  709. INSERT INTO U_income_expenses_mx
  710. (billid,
  711. printid,
  712. itemid,
  713. amt,
  714. deptid,
  715. buildtype,
  716. relscid,
  717. relbillid,
  718. relbillcode,
  719. useemp,
  720. mxdscrp)
  721. VALUES (:billid,
  722. :incomemx[i].printid,
  723. :incomemx[i].itemid,
  724. :incomemx[i].amt,
  725. :incomemx[i].deptid,
  726. :incomemx[i].buildtype,
  727. :incomemx[i].relscid,
  728. :incomemx[i].relbillid,
  729. :incomemx[i].relbillcode,
  730. :incomemx[i].useemp,
  731. :incomemx[i].mxdscrp) Using commit_transaction ;
  732. IF commit_transaction.SQLCode <> 0 THEN
  733. if it_newbegin then billid = 0
  734. rslt = 0
  735. arg_msg = "插入其他收入支出单明细操作失败"+"~n"+commit_transaction.SQLErrText
  736. GOTO ext
  737. END IF
  738. NEXT
  739. it_newbegin = False
  740. it_updatebegin = False
  741. ext:
  742. IF rslt = 0 THEN
  743. ROLLBACK Using commit_transaction;
  744. p_clearmx()
  745. ELSEIF arg_ifcommit And rslt = 1 THEN
  746. COMMIT Using commit_transaction;
  747. END IF
  748. RETURN rslt
  749. end function
  750. public function integer add_dscrp (long arg_billid, string arg_newdescppart, ref string arg_msg, boolean arg_ifcommit);//add_dscrp(string arg_newdescppart)
  751. //0 fail 1 SUCCESS
  752. Int rslt = 1
  753. arg_newdescppart = Trim(arg_newdescppart)
  754. IF it_updatebegin Or it_newbegin THEN
  755. rslt = 0
  756. arG_MSG = "编辑状态下不可用"
  757. GOTO ext
  758. END IF
  759. IF arg_newdescppart = '' THEN
  760. rslt = 0
  761. arG_MSG = "要添加内容为空,操作取消"
  762. GOTO ext
  763. END IF
  764. IF p_getinfo(arg_billid,arG_MSG) = 0 THEN
  765. rslt = 0
  766. GOTO ext
  767. END IF
  768. IF flag <> 1 THEN
  769. rslt = 0
  770. arG_MSG = "待审核状态下不可用"
  771. GOTO ext
  772. END IF
  773. UPDATE U_income_expenses
  774. SET descrp = ltrim(rtrim(descrp))+' '+:arg_newdescppart
  775. Where U_income_expenses.billid = :arg_billid Using commit_transaction;
  776. IF commit_transaction.SQLCode <> 0 THEN
  777. rslt = 0
  778. arG_MSG = "添加单据备注操作失败"+"~n"+commit_transaction.SQLErrText
  779. ROLLBACK Using commit_transaction;
  780. GOTO ext
  781. END IF
  782. IF relrapid > 0 THEN
  783. UPDATE u_rap_money
  784. SET dscrp = ltrim(rtrim(dscrp)) + ' '+:arg_newdescppart
  785. Where rapmoneyid = :relrapid Using commit_transaction;
  786. IF commit_transaction.SQLCode <> 0 THEN
  787. rslt = 0
  788. arG_MSG = "添加相关出纳帐备注操作失败"+"~n"+commit_transaction.SQLErrText
  789. ROLLBACK Using commit_transaction;
  790. GOTO ext
  791. END IF
  792. END IF
  793. descrp = descrp+' '+arg_newdescppart
  794. it_newbegin = False
  795. it_updatebegin = False
  796. ext:
  797. IF arg_ifcommit And rslt = 1 THEN
  798. COMMIT Using commit_transaction;
  799. END IF
  800. p_reset()
  801. Return (rslt)
  802. end function
  803. public function integer cancelpermit2 (long arg_billid, ref string arg_msg, boolean arg_ifcommit);return 1
  804. //Int rslt = 1
  805. //Long ll_i
  806. //DateTime nulldate
  807. //SetNull(nulldate)
  808. //
  809. //IF sys_option_income_secaudit = -1000 THEN
  810. // rslt = 0
  811. // arg_msg = '选项:[328]其它收入支出单使用二级审核,读取初始默认值失败,操作取消!'
  812. // GOTO ext
  813. //END IF
  814. //
  815. //uo_iteminput uo_item
  816. //uo_item = Create uo_iteminput
  817. //uo_item.ib_CreateRapmoneyid = false
  818. //
  819. //IF arg_billid <= 0 THEN
  820. // rslt = 0
  821. // arg_msg = '错误单据唯一码'
  822. // GOTO ext
  823. //END IF
  824. //
  825. //IF getinfo(arg_billid,arg_msg) = 0 THEN
  826. // rslt = 0
  827. // GOTO ext
  828. //END IF
  829. //
  830. //IF secflag = 0 THEN
  831. // rslt = 0
  832. // arg_msg = "单据未财务确认,请检查"
  833. // GOTO ext
  834. //END IF
  835. //
  836. //IF sys_option_income_secaudit = 1 THEN
  837. // FOR ll_i = 1 To it_mxbt
  838. // IF incomemx[ll_i].itemid = 0 THEN CONTINUE
  839. // IF uo_item.del_iteminput(incomemx[ll_i].itemid,incomemx[ll_i].rel_dateint,1,arg_msg,False) = 0 THEN
  840. // MessageBox('系统提示',arg_msg)
  841. // rslt = 0
  842. // GOTO ext
  843. // END IF
  844. // NEXT
  845. //END IF
  846. //
  847. //UPDATE U_income_expenses
  848. // SET secflag = 0,
  849. // secauditemp = '',
  850. // secauditdate = :nulldate
  851. // WHERE U_income_expenses.billid = :arg_billid
  852. // AND secflag = 1
  853. // Using commit_transaction ;
  854. //IF commit_transaction.SQLCode <> 0 THEN
  855. // rslt = 0
  856. // arg_msg = "单据财务反确认操作失败"+"~n"+commit_transaction.SQLErrText
  857. // GOTO ext
  858. //END IF
  859. //
  860. //it_newbegin = False
  861. //it_updatebegin = False
  862. //
  863. //ext:
  864. //
  865. //IF rslt = 0 THEN
  866. // ROLLBACK Using commit_transaction;
  867. //ELSEIF rslt = 1 And arg_ifcommit THEN
  868. // COMMIT Using commit_transaction;
  869. //END IF
  870. //
  871. //p_reset()
  872. //
  873. //Return (rslt)
  874. //
  875. //
  876. //
  877. //
  878. end function
  879. public function integer permit2 (long arg_billid, string arg_emp, ref string arg_msg, boolean arg_ifcommit);return 1
  880. //Int rslt = 1
  881. //Long cnt = 0
  882. //Long ll_i
  883. //Long ref_dateint
  884. //
  885. //uo_iteminput uo_item
  886. //uo_item = Create uo_iteminput
  887. //uo_item.ib_CreateRapmoneyid = false
  888. //
  889. //
  890. //IF arg_billid <= 0 THEN
  891. // rslt = 0
  892. // ARG_MSG = '错误单据唯一码'
  893. // GOTO ext
  894. //END IF
  895. //
  896. //IF sys_option_income_secaudit = -1000 THEN
  897. // rslt = 0
  898. // ARG_MSG = '选项:[328]其它收入支出单使用二级审核,读取初始默认值失败,操作取消!'
  899. // GOTO ext
  900. //END IF
  901. //
  902. //IF getinfo(arg_billid,ARG_MSG) = 0 THEN
  903. // rslt = 0
  904. // GOTO ext
  905. //END IF
  906. //
  907. //IF flag = 0 THEN
  908. // rslt = 0
  909. // ARG_MSG = "单据未审核,不能进行财务确认"
  910. // GOTO ext
  911. //END IF
  912. //
  913. //IF secflag = 1 THEN
  914. // rslt = 0
  915. // ARG_MSG = "单据已财务确认,请检查"
  916. // GOTO ext
  917. //END IF
  918. //
  919. //cnt = 0
  920. //SELECT count(*) INTO :cnt
  921. // FROM u_user
  922. // Where username = :arg_emp Using commit_transaction;
  923. //IF commit_transaction.SQLCode <> 0 THEN
  924. // rslt = 0
  925. // ARG_MSG = "查询操作失败,操作员!"
  926. // GOTO ext
  927. //END IF
  928. //
  929. //IF cnt = 0 THEN
  930. // rslt = 0
  931. // ARG_MSG = "操作员姓名未登记或已取消!"
  932. // GOTO ext
  933. //END IF
  934. //
  935. //IF sys_option_income_secaudit = 1 THEN
  936. // s_iteminput s_input
  937. //
  938. //
  939. // FOR ll_i = 1 To it_mxbt
  940. // s_input.itemid = incomemx[ll_i].itemid
  941. // s_input.dateint = 0
  942. // s_input.outdate = outdate
  943. // s_input.dscrp = Descrp + ' ' + incomemx[ll_i].mxdscrp
  944. // s_input.outamt = incomemx[ll_i].amt
  945. // s_input.accountsid = accountsid
  946. // s_input.banktypeid = banktypeid
  947. // s_input.billcode = billcode
  948. // s_input.relcode = credencecode
  949. // s_input.buildtype = 1
  950. // s_input.opemp = publ_operator
  951. // s_input.relrep = rep
  952. // s_input.scid = scid
  953. //
  954. // IF uo_item.add_iteminput(s_input,ARG_MSG,False) = 0 THEN
  955. // rslt = 0
  956. // GOTO ext
  957. // END IF
  958. //
  959. // ref_dateint = uo_item.ref_dateint
  960. //
  961. // UPDATE U_income_expenses_mx
  962. // SET rel_dateint = :ref_dateint
  963. // WHERE billid = :arg_billid
  964. // And printid = :incomemx[ll_i].printid Using commit_transaction;
  965. // IF commit_transaction.SQLCode <> 0 THEN
  966. // rslt = 0
  967. // ARG_MSG = "更单据明细相关信息失败 ~n"+commit_transaction.SQLErrText
  968. // GOTO ext
  969. // END IF
  970. // NEXT
  971. //END IF
  972. //
  973. //
  974. //UPDATE U_income_expenses
  975. // SET secauditemp = :arg_emp ,
  976. // secauditdate = getdate(),
  977. // U_income_expenses.secflag = 1
  978. // WHERE U_income_expenses.billid = :arg_billid
  979. // AND U_income_expenses.secflag = 0
  980. // AND U_income_expenses.flag = 1
  981. // Using commit_transaction;
  982. //IF commit_transaction.SQLCode <> 0 THEN
  983. // rslt = 0
  984. // ARG_MSG = "更单据审核操作失败"+"~n"+commit_transaction.SQLErrText
  985. // GOTO ext
  986. //END IF
  987. //
  988. //it_newbegin = False
  989. //it_updatebegin = False
  990. //
  991. //ext:
  992. //IF rslt = 0 THEN
  993. // ROLLBACK Using commit_transaction;
  994. //ELSEIF rslt = 1 And arg_ifcommit THEN
  995. // COMMIT Using commit_transaction;
  996. //END IF
  997. //p_reset()
  998. //
  999. //Return (rslt)
  1000. //
  1001. //
  1002. //
  1003. //
  1004. //
  1005. //
  1006. //
  1007. //
  1008. //
  1009. //
  1010. //
  1011. //
  1012. end function
  1013. 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)
  1014. //Int rslt = 1
  1015. //s_rap_money_transfer arg_s_rap_money_transfer
  1016. //
  1017. //IF arg_billid <= 0 THEN
  1018. // rslt = 0
  1019. // arg_msg = '错误单据唯一码'
  1020. // GOTO ext
  1021. //END IF
  1022. //
  1023. //IF arg_newdescppart = '' THEN
  1024. // rslt = 0
  1025. // arg_msg = "要添加内容为空,操作取消"
  1026. // GOTO ext
  1027. //END IF
  1028. //
  1029. //IF p_getinfo(arg_billid,arg_msg) = 0 THEN
  1030. // rslt = 0
  1031. // GOTO ext
  1032. //END IF
  1033. //
  1034. //IF flag = 0 THEN
  1035. // rslt = 0
  1036. // arg_msg = '单据未审核,不可以增加备注'
  1037. // GOTO ext
  1038. //END IF
  1039. //
  1040. //UPDATE U_income_expenses
  1041. // SET DSCRP = ltrim(rtrim(DSCRP))+' '+:arg_newdescppart
  1042. // WHERE U_income_expenses.billid = :arg_billid
  1043. // And flag = 1;
  1044. //IF SQLCA.SQLCode <> 0 THEN
  1045. // rslt = 0
  1046. // arg_msg = "添加备注操作失败"+"~n"+SQLCA.SQLErrText
  1047. // GOTO ext
  1048. //END IF
  1049. //
  1050. //ext:
  1051. //IF rslt = 1 THEN
  1052. // COMMIT;
  1053. //ELSE
  1054. // ROLLBACK;
  1055. //END IF
  1056. //
  1057. //Return (rslt)
  1058. end function
  1059. public function integer p_clearmx ();it_mxbt = 0
  1060. return 1
  1061. end function
  1062. public function integer getinfo (long arg_billid, ref string arg_msg);Int rslt = 1
  1063. Long i = 1 ,no_mxcheck
  1064. IF arg_billid <= 0 THEN
  1065. rslt = 0
  1066. arg_msg = '错误单据唯一码'
  1067. GOTO ext
  1068. END IF
  1069. IF p_getinfo(arg_billid,arg_msg) = 0 THEN
  1070. rslt = 0
  1071. GOTO ext
  1072. END IF
  1073. DECLARE cur_mx CURSOR FOR
  1074. SELECT billid,printid, itemid, amt, deptid, buildtype, relscid, relbillid, relbillcode,rel_dateint,useemp,mxdscrp
  1075. FROM U_income_expenses_mx
  1076. Where billid = :arg_billid Using commit_transaction;
  1077. OPEN cur_mx;
  1078. FETCH cur_mx INTO :incomemx[i].billid,
  1079. :incomemx[i].printid,
  1080. :incomemx[i].itemid,
  1081. :incomemx[i].amt,
  1082. :incomemx[i].deptid,
  1083. :incomemx[i].buildtype,
  1084. :incomemx[i].relscid,
  1085. :incomemx[i].relbillid,
  1086. :incomemx[i].relbillcode,
  1087. :incomemx[i].rel_dateint,
  1088. :incomemx[i].useemp,
  1089. :incomemx[i].mxdscrp;
  1090. DO WHILE sqlca.SQLCode = 0
  1091. i++
  1092. FETCH cur_mx INTO :incomemx[i].billid,
  1093. :incomemx[i].printid,
  1094. :incomemx[i].itemid,
  1095. :incomemx[i].amt,
  1096. :incomemx[i].deptid,
  1097. :incomemx[i].buildtype,
  1098. :incomemx[i].relscid,
  1099. :incomemx[i].relbillid,
  1100. :incomemx[i].relbillcode,
  1101. :incomemx[i].rel_dateint,
  1102. :incomemx[i].useemp,
  1103. :incomemx[i].mxdscrp;
  1104. LOOP
  1105. CLOSE cur_mx;
  1106. SELECT count(*) INTO :no_mxcheck
  1107. FROM U_income_expenses_mx
  1108. Where billid = :arg_billid Using commit_transaction;
  1109. IF commit_transaction.SQLCode <> 0 THEN
  1110. rslt = 0
  1111. arg_msg = "查询操作失败,收入支出单明细数量"
  1112. GOTO ext
  1113. END IF
  1114. IF i <> (no_mxcheck+1) THEN
  1115. rslt = 0
  1116. arg_msg = "查询操作失败,收入支出单明细"
  1117. GOTO ext
  1118. END IF
  1119. it_mxbt = i - 1
  1120. it_newbegin = False
  1121. it_updatebegin = False
  1122. ext:
  1123. IF rslt = 0 THEN p_reset()
  1124. RETURN rslt
  1125. end function
  1126. 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
  1127. Long cnt
  1128. Int li_ifdepart,li_ifemp
  1129. IF it_newbegin = False And it_updatebegin = False THEN
  1130. rslt = 0
  1131. arg_msg = "非编辑状态不可以使用,操作取消"
  1132. GOTO ext
  1133. END IF
  1134. it_mxbt++
  1135. IF arg_itemid = 0 THEN
  1136. rslt = 0
  1137. arg_msg = "明细第"+String(it_mxbt)+"行,请选择收支项目"
  1138. GOTO ext
  1139. END IF
  1140. SELECT ifdepart,ifemp
  1141. INTO :li_ifdepart,:li_ifemp
  1142. FROM u_itemdef
  1143. WHERE itemid = :arg_itemid
  1144. Using commit_transaction;
  1145. IF commit_transaction.SQLCode <> 0 THEN
  1146. arg_msg = "明细第"+String(it_mxbt)+"行,查询项目资料失败,"+sqlca.SQLErrText
  1147. rslt = 0
  1148. GOTO ext
  1149. END IF
  1150. IF arg_buildtype = 0 THEN
  1151. arg_relscid = 0
  1152. arg_relbillid = 0
  1153. //arg_relbillcode = ''
  1154. // IF li_ifdepart = 1 And arg_deptid = 0 THEN
  1155. // arg_msg = "明细第"+String(it_mxbt)+"行,收支项目限制必须选择部门,请选择"
  1156. // rslt = 0
  1157. // GOTO ext
  1158. // END IF
  1159. //
  1160. // IF li_ifemp = 1 And Trim(arg_useemp) = '' THEN
  1161. // arg_msg = "明细第"+String(it_mxbt)+"行,收支项目限制必须填写使用人"
  1162. // rslt = 0
  1163. // GOTO ext
  1164. // END IF
  1165. END IF
  1166. incomemx[it_mxbt].itemid = arg_itemid
  1167. incomemx[it_mxbt].deptid = arg_deptid
  1168. incomemx[it_mxbt].relscid = arg_relscid
  1169. incomemx[it_mxbt].relbillid = arg_relbillid
  1170. incomemx[it_mxbt].buildtype = arg_buildtype
  1171. incomemx[it_mxbt].relbillcode = arg_relbillcode
  1172. incomemx[it_mxbt].printid = it_mxbt
  1173. incomemx[it_mxbt].amt = arg_amt
  1174. incomemx[it_mxbt].useemp = arg_useemp
  1175. incomemx[it_mxbt].mxdscrp = arg_mxdscrp
  1176. ext:
  1177. IF rslt = 0 THEN p_clearmx()
  1178. RETURN rslt
  1179. end function
  1180. public function integer audit_subject (long arg_scid, long arg_billid, boolean arg_ifcommit, ref string arg_msg);
  1181. Int rslt = 1,cnt = 0
  1182. IF arg_billid = 0 THEN
  1183. rslt = 0
  1184. arg_msg = "没有审核对象"
  1185. GOTO ext
  1186. END IF
  1187. IF p_getinfo(arg_billid,arg_msg) = 0 THEN
  1188. rslt = 0
  1189. GOTO ext
  1190. END IF
  1191. IF flag = 0 THEN
  1192. rslt = 0
  1193. arg_msg = "单据没有审核"
  1194. GOTO ext
  1195. END IF
  1196. IF cwauditingflag = 1 THEN
  1197. rslt = 0
  1198. arg_msg = "单据已经总账审核"
  1199. GOTO ext
  1200. END IF
  1201. UPDATE u_income_expenses
  1202. SET cwauditingflag = 1,
  1203. cwauditingdate = getdate(),
  1204. cwauditingrep = :publ_operator
  1205. WHERE ( u_income_expenses.billid = :arg_billid ) AND
  1206. ( u_income_expenses.scid = :arg_scid) Using commit_transaction;
  1207. IF commit_transaction.SQLCode <> 0 THEN
  1208. rslt = 0
  1209. arg_msg = "因网络或其它原因导致总账审核操作失败"+"~n"+commit_transaction.SQLErrText
  1210. ROLLBACK Using commit_transaction;
  1211. GOTO ext
  1212. END IF
  1213. ext:
  1214. IF arg_ifcommit And rslt = 1 THEN
  1215. COMMIT Using commit_transaction;
  1216. END IF
  1217. Return (rslt)
  1218. end function
  1219. public function integer c_audit_subject (long arg_scid, long arg_billid, boolean arg_ifcommit, ref string arg_msg);
  1220. Int rslt = 1,cnt = 0
  1221. IF arg_billid = 0 THEN
  1222. rslt = 0
  1223. arg_msg = "没有审核对象"
  1224. GOTO ext
  1225. END IF
  1226. IF p_getinfo(arg_billid,arg_msg) = 0 THEN
  1227. rslt = 0
  1228. GOTO ext
  1229. END IF
  1230. IF cwauditingflag = 0 THEN
  1231. rslt = 0
  1232. arg_msg = "单据没有总账审核"
  1233. GOTO ext
  1234. END IF
  1235. UPDATE u_income_expenses
  1236. SET cwauditingflag = 0,
  1237. cwauditingdate = NULL,
  1238. cwauditingrep = ''
  1239. WHERE ( u_income_expenses.billid = :arg_billid ) AND
  1240. ( u_income_expenses.scid = :arg_scid) Using commit_transaction;
  1241. IF commit_transaction.SQLCode <> 0 THEN
  1242. rslt = 0
  1243. arg_msg = "因网络或其它原因导致总账撤审操作失败"+"~n"+commit_transaction.SQLErrText
  1244. ROLLBACK Using commit_transaction;
  1245. GOTO ext
  1246. END IF
  1247. ext:
  1248. IF arg_ifcommit And rslt = 1 THEN
  1249. COMMIT Using commit_transaction;
  1250. END IF
  1251. Return (rslt)
  1252. end function
  1253. on uo_msttake_other.create
  1254. call super::create
  1255. TriggerEvent( this, "constructor" )
  1256. end on
  1257. on uo_msttake_other.destroy
  1258. TriggerEvent( this, "destructor" )
  1259. call super::destroy
  1260. end on
  1261. event constructor;String str_optionvalue,arg_msg
  1262. //f_get_sys_option_value('328',str_optionvalue,arg_msg)
  1263. //sys_option_income_secaudit = Long(str_optionvalue)
  1264. end event