w_reissue_cus_ljfieb_edit.srw 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541
  1. $PBExportHeader$w_reissue_cus_ljfieb_edit.srw
  2. forward
  3. global type w_reissue_cus_ljfieb_edit from w_publ_base
  4. end type
  5. type cb_save from uo_imflatbutton within w_reissue_cus_ljfieb_edit
  6. end type
  7. type dw_uc from datawindow within w_reissue_cus_ljfieb_edit
  8. end type
  9. type dw_child from datawindow within w_reissue_cus_ljfieb_edit
  10. end type
  11. type st_1 from statictext within w_reissue_cus_ljfieb_edit
  12. end type
  13. type ln_bar from line within w_reissue_cus_ljfieb_edit
  14. end type
  15. type ln_bar2 from line within w_reissue_cus_ljfieb_edit
  16. end type
  17. type r_bar from rectangle within w_reissue_cus_ljfieb_edit
  18. end type
  19. end forward
  20. global type w_reissue_cus_ljfieb_edit from w_publ_base
  21. integer width = 3611
  22. integer height = 2380
  23. string title = "费用单信息匹配"
  24. boolean minbox = false
  25. windowtype windowtype = response!
  26. cb_save cb_save
  27. dw_uc dw_uc
  28. dw_child dw_child
  29. st_1 st_1
  30. ln_bar ln_bar
  31. ln_bar2 ln_bar2
  32. r_bar r_bar
  33. end type
  34. global w_reissue_cus_ljfieb_edit w_reissue_cus_ljfieb_edit
  35. type variables
  36. Transaction tr_eb_sqlca
  37. s_packet_ljfieb s_inscust
  38. string ins_sn
  39. long ins_cusid,ins_scid,ins_billtype
  40. string ins_reissuecode
  41. uo_reissue uo_ware
  42. end variables
  43. on w_reissue_cus_ljfieb_edit.create
  44. int iCurrent
  45. call super::create
  46. this.cb_save=create cb_save
  47. this.dw_uc=create dw_uc
  48. this.dw_child=create dw_child
  49. this.st_1=create st_1
  50. this.ln_bar=create ln_bar
  51. this.ln_bar2=create ln_bar2
  52. this.r_bar=create r_bar
  53. iCurrent=UpperBound(this.Control)
  54. this.Control[iCurrent+1]=this.cb_save
  55. this.Control[iCurrent+2]=this.dw_uc
  56. this.Control[iCurrent+3]=this.dw_child
  57. this.Control[iCurrent+4]=this.st_1
  58. this.Control[iCurrent+5]=this.ln_bar
  59. this.Control[iCurrent+6]=this.ln_bar2
  60. this.Control[iCurrent+7]=this.r_bar
  61. end on
  62. on w_reissue_cus_ljfieb_edit.destroy
  63. call super::destroy
  64. destroy(this.cb_save)
  65. destroy(this.dw_uc)
  66. destroy(this.dw_child)
  67. destroy(this.st_1)
  68. destroy(this.ln_bar)
  69. destroy(this.ln_bar2)
  70. destroy(this.r_bar)
  71. end on
  72. event open;call super::open;tr_eb_sqlca = sys_email_sqlca // 电子商务连接
  73. If sys_email_sqlca.DBHandle() = 0 Then
  74. MessageBox('Error','电子商务数据库连接失败,请检查')
  75. Return
  76. End If
  77. uo_ware = Create uo_reissue
  78. uo_ware.commit_transaction = sqlca
  79. s_inscust = Message.PowerObjectParm
  80. ins_sn = s_inscust.serialnum
  81. ins_cusid = s_inscust.cusid
  82. ins_scid = s_inscust.scid
  83. ins_billtype = s_inscust.billtype
  84. If ins_billtype = 1 Then
  85. dw_uc.Modify("banktypeid.dddw.Name='ddd_banktypename'")
  86. Else
  87. dw_uc.Modify("banktypeid.dddw.Name='ddd_buy_taketype'")
  88. End If
  89. dw_uc.SetTransObject(tr_eb_sqlca)
  90. dw_child.SetTransObject(tr_eb_sqlca)
  91. datawindowchild childdwmx
  92. dw_uc.GetChild("banktypeid",childdwmx)
  93. childdwmx.SetTransObject (sqlca)
  94. If childdwmx.Retrieve() = 0 Then
  95. childdwmx.InsertRow(0)
  96. End If
  97. datawindowchild childdwmx_2
  98. dw_uc.GetChild("moneyid",childdwmx_2)
  99. childdwmx_2.SetTransObject (sqlca)
  100. If childdwmx_2.Retrieve() = 0 Then
  101. childdwmx_2.InsertRow(0)
  102. End If
  103. dw_uc.Retrieve(ins_sn)
  104. dw_child.Retrieve(ins_sn)
  105. //自动匹配信息
  106. Long ll_ucrow,ll_i
  107. String ls_moneyname,ls_banktypename
  108. Long ll_moneyid,ll_banktypeid
  109. Long ll_itemid
  110. String ls_itemcode,ls_itemname
  111. ll_ucrow = dw_uc.GetRow()
  112. dw_uc.accepttext()
  113. dw_child.accepttext()
  114. dw_uc.setredraw(false)
  115. dw_child.setredraw(false)
  116. If ll_ucrow > 0 Then
  117. ls_moneyname = dw_uc.Object.moneyname[ll_ucrow]
  118. Select moneyid Into :ll_moneyid
  119. From cw_currency
  120. Where Name = :ls_moneyname Using sqlca;
  121. If sqlca.SQLCode = 0 Then
  122. dw_uc.Object.moneyid[ll_ucrow] = ll_moneyid
  123. End If
  124. ls_banktypename = dw_uc.Object.banktypename[ll_ucrow]
  125. If ins_billtype = 1 Then
  126. Select banktypeid
  127. Into :ll_banktypeid
  128. From cw_banktype
  129. Where inuse = 1 And banktype = 0 And banktypename = :ls_banktypename Using sqlca;
  130. If sqlca.SQLCode = 0 Then
  131. dw_uc.Object.banktypeid[ll_ucrow] = ll_banktypeid
  132. End If
  133. Else
  134. Select banktypeid
  135. Into :ll_banktypeid
  136. From cw_banktype
  137. Where inuse = 1 And banktype = 1 And banktypename = :ls_banktypename Using sqlca;
  138. If sqlca.SQLCode = 0 Then
  139. dw_uc.Object.banktypeid[ll_ucrow] = ll_banktypeid
  140. End If
  141. End If
  142. ls_itemname = dw_uc.Object.itemname[ll_ucrow]
  143. Select u_itemdef.itemid,
  144. u_itemdef.itemcode
  145. Into :ll_itemid,
  146. :ls_itemcode
  147. From u_itemdef
  148. Where u_itemdef.itemname = :ls_itemname Using sqlca;
  149. If sqlca.SQLCode = 0 Then
  150. dw_uc.Object.itemid[ll_ucrow] = ll_itemid
  151. dw_uc.Object.itemcode_self[ll_ucrow] = ls_itemcode
  152. dw_uc.Object.itemname_self[ll_ucrow] = ls_itemname
  153. End If
  154. End If
  155. For ll_i = 1 To dw_child.RowCount()
  156. ls_itemname = dw_child.Object.expensesname[ll_i]
  157. If ins_billtype = 1 Then
  158. Select U_Expenses.ExpensesID,
  159. U_Expenses.ExpensesCode
  160. Into :ll_itemid,
  161. :ls_itemcode
  162. From U_Expenses
  163. Where U_Expenses.ExpensesName = :ls_itemname
  164. And Expensestype = 0 Using sqlca;
  165. If sqlca.SQLCode = 0 Then
  166. dw_child.Object.itemid[ll_i] = ll_itemid
  167. dw_child.Object.itemcode_self[ll_i] = ls_itemcode
  168. dw_child.Object.itemname_self[ll_i] = ls_itemname
  169. End If
  170. Else
  171. Select U_Expenses.ExpensesID,
  172. U_Expenses.ExpensesCode
  173. Into :ll_itemid,
  174. :ls_itemcode
  175. From U_Expenses
  176. Where U_Expenses.ExpensesName = :ls_itemname
  177. And Expensestype = 1 Using sqlca;
  178. If sqlca.SQLCode = 0 Then
  179. dw_child.Object.itemid[ll_i] = ll_itemid
  180. dw_child.Object.itemcode_self[ll_i] = ls_itemcode
  181. dw_child.Object.itemname_self[ll_i] = ls_itemname
  182. End If
  183. End If
  184. Next
  185. dw_uc.setredraw(true)
  186. dw_child.setredraw(true)
  187. end event
  188. event close;call super::close;closewithreturn(this,ins_reissuecode)
  189. end event
  190. event resize;call super::resize;ln_bar.endx = this.width
  191. ln_bar2.endx = this.width
  192. r_bar.width = this.width
  193. end event
  194. type cb_func from w_publ_base`cb_func within w_reissue_cus_ljfieb_edit
  195. boolean visible = false
  196. end type
  197. type cb_exit from w_publ_base`cb_exit within w_reissue_cus_ljfieb_edit
  198. integer x = 302
  199. integer width = 187
  200. integer height = 164
  201. integer picsize = 16
  202. toolbaralignment pic_align = alignattop!
  203. boolean border = false
  204. end type
  205. type cb_save from uo_imflatbutton within w_reissue_cus_ljfieb_edit
  206. integer height = 164
  207. integer taborder = 30
  208. boolean bringtotop = true
  209. string text = "生成单据"
  210. string normalpicname = "save.bmp"
  211. integer picsize = 16
  212. toolbaralignment pic_align = alignattop!
  213. boolean border = false
  214. end type
  215. event clicked;call super::clicked;Long uc_row,i
  216. String arg_msg
  217. String ls_reissuecode
  218. uc_row = dw_uc.GetRow()
  219. If uc_row <= 0 Then
  220. MessageBox('系统提示','没有可保存的内容')
  221. Return
  222. End If
  223. dw_uc.AcceptText()
  224. dw_child.AcceptText()
  225. If dw_uc.Object.banktypeid[uc_row] = 0 Then
  226. MessageBox('系统提示','请选择结算方式')
  227. dw_uc.SetFocus()
  228. dw_uc.SetColumn("banktypeid")
  229. Return
  230. End If
  231. If dw_uc.Object.moneyid[uc_row] = 0 Then
  232. MessageBox('系统提示','请选择币种')
  233. dw_uc.SetFocus()
  234. dw_uc.SetColumn("moneyid")
  235. Return
  236. End If
  237. If dw_uc.Object.itemid[uc_row] = 0 Then
  238. MessageBox('系统提示','请选择本厂项目')
  239. dw_uc.SetFocus()
  240. Return
  241. End If
  242. If uo_ware.newbegin(ins_scid,arg_msg) = 0 Then
  243. MessageBox('Error!',arg_msg)
  244. Return
  245. End If
  246. uo_ware.reissuedate = dw_uc.Object.reissuedate[uc_row]
  247. uo_ware.dscrp = dw_uc.Object.dscrp[uc_row]
  248. uo_ware.cusid = ins_cusid
  249. uo_ware.relcode = dw_uc.Object.relcode[uc_row]
  250. uo_ware.r_type = ins_billtype
  251. uo_ware.relid = dw_uc.Object.banktypeid[uc_row]
  252. uo_ware.moneyid = dw_uc.Object.moneyid[uc_row]
  253. uo_ware.reissueemp = dw_uc.Object.reissueemp[uc_row]
  254. uo_ware.itemid = dw_uc.Object.itemid[uc_row]
  255. For i = 1 To dw_child.RowCount()
  256. If dw_child.Object.itemid[i] = 0 Then
  257. MessageBox('系统提示','第'+String(i)+'行明细,请先选择本厂项目')
  258. Return
  259. End If
  260. If uo_ware.acceptmx( dw_child.Object.qty[i],&
  261. 0 - dw_child.Object.price[i],&
  262. 0 - dw_child.Object.amt[i],&
  263. dw_child.Object.dscrp[i],&
  264. i,&
  265. arg_msg,&
  266. dw_child.Object.itemid[i],&
  267. dw_child.object.itemname_self[i]) = 0 Then
  268. MessageBox('Error!',arg_msg)
  269. Return
  270. End If
  271. Next
  272. If uo_ware.Save(True,arg_msg) = 0 Then
  273. MessageBox('Error!',arg_msg)
  274. Return
  275. End If
  276. ins_reissuecode = uo_ware.reissuecode
  277. Update LJFIEB_reissue
  278. Set relreissuecode = :ins_reissuecode,
  279. flag = 1,
  280. ConfirmTime = getdate(),
  281. ConfirmUser = :publ_operator
  282. Where SerialNum = :ins_sn Using tr_eb_sqlca;
  283. If tr_eb_sqlca.SQLCode <> 0 Then
  284. Rollback Using tr_eb_sqlca;
  285. MessageBox('Error','更新客户费用申请单相关单号失败,'+tr_eb_sqlca.SQLErrText)
  286. Return
  287. End If
  288. //更新本地通信记录
  289. Update LJFIEB_packet
  290. Set status = 6,
  291. Complete = 1,
  292. ConfirmTime = getdate(),
  293. ConfirmUser = :publ_operator
  294. Where SerialNum = :ins_sn Using tr_eb_sqlca;
  295. If tr_eb_sqlca.SQLCode <> 0 Then
  296. Rollback Using tr_eb_sqlca;
  297. MessageBox('Error','更新本地通信记录失败,'+tr_eb_sqlca.SQLErrText)
  298. Return
  299. End If
  300. Close(Parent)
  301. end event
  302. type dw_uc from datawindow within w_reissue_cus_ljfieb_edit
  303. integer y = 188
  304. integer width = 3579
  305. integer height = 400
  306. integer taborder = 20
  307. boolean bringtotop = true
  308. string title = "none"
  309. string dataobject = "dw_reissue_cus_ljfieb_edit"
  310. boolean livescroll = true
  311. borderstyle borderstyle = stylelowered!
  312. end type
  313. event buttonclicked;If dwo.Name = 'b_ch' Then
  314. Long uc_row
  315. String ls_itemcode
  316. uc_row = dw_uc.GetRow()
  317. If uc_row = 0 Then
  318. MessageBox('系统提示','请选定单据!')
  319. Return
  320. End If
  321. ls_itemcode = Trim(dw_uc.Object.itemcode_self[uc_row])
  322. dw_uc.AcceptText()
  323. If Not IsValid(w_itemdef) Then
  324. s_edit_index_tran s_ch_tran //传递参数使用
  325. s_ch_tran.if_retrieve_all = local_retrieve_all //是否一次retrieve所有行
  326. s_ch_tran.work_mode = 1 //0-单纯编辑模式 1-选择\编辑模式
  327. s_ch_tran.arg_pkid = 0 //目标定位pkid (备用)
  328. s_ch_tran.arg_string_code = ls_itemcode //查询列(物料编码)部分内容,用于初步筛选
  329. s_ch_tran.if_retrieve_all = True
  330. OpenWithParm(w_itemdef,s_ch_tran) //调用
  331. s_itemdef s_item_ch
  332. s_item_ch = Message.PowerObjectParm //接受返回结构
  333. If s_item_ch.itemid > 0 Then //正常返回值则可以取以下值
  334. dw_uc.SetRedraw(False)
  335. dw_uc.Object.itemid[uc_row] = s_item_ch.itemid
  336. dw_uc.Object.itemcode_self[uc_row] = s_item_ch.itemcode
  337. dw_uc.Object.itemname_self[uc_row] = s_item_ch.itemname
  338. dw_uc.SetRedraw(True)
  339. End If
  340. End If
  341. End If
  342. end event
  343. type dw_child from datawindow within w_reissue_cus_ljfieb_edit
  344. integer y = 672
  345. integer width = 3589
  346. integer height = 1588
  347. integer taborder = 30
  348. boolean bringtotop = true
  349. string title = "none"
  350. string dataobject = "dw_reissue_mx_ljfieb_edit"
  351. boolean hscrollbar = true
  352. boolean vscrollbar = true
  353. boolean livescroll = true
  354. borderstyle borderstyle = stylelowered!
  355. end type
  356. event doubleclicked;
  357. Long child_row
  358. child_row = dw_child.GetRow()
  359. If child_row <= 0 Then
  360. MessageBox('系统提示','请先选中明细行')
  361. Return
  362. End If
  363. If Not ((IsValid(w_expensesdef) And ins_billtype = 1 ) Or (IsValid(w_expensesdef_spt) And ins_billtype = 2 )) Then
  364. s_edit_index_tran s_ch_tran //传递参数使用
  365. s_ch_tran.if_retrieve_all = False //是否一次RETRIEVE所有行
  366. s_ch_tran.work_mode = 1 //0-单纯编辑模式 1-选择\编辑模式
  367. s_ch_tran.arg_pkid = 0 //目标定位PKID (备用)
  368. s_ch_tran.arg_string_code = '' //查询列(物料编码)部分内容,用于初步筛选
  369. s_ch_tran.if_select_all = False
  370. s_ch_tran.b_long = -1
  371. Long chc = 1,ls_j
  372. dw_child.AcceptText()
  373. If dw_child.GetRow() > 0 Then s_ch_tran.arg_string_code = Trim(dw_child.Object.itemcode_self[dw_child.GetRow()])
  374. If ins_billtype = 1 Then
  375. OpenWithParm(w_expensesdef,s_ch_tran)
  376. Else
  377. OpenWithParm(w_expensesdef_spt,s_ch_tran)
  378. End If
  379. s_mtrldef_array S_item_ch
  380. S_item_ch = Message.PowerObjectParm
  381. For ls_j = 1 To UpperBound(S_item_ch.mtrlid)
  382. If S_item_ch.mtrlid[ls_j] > 0 Then
  383. // IF dw_child.GetRow() > 0 THEN
  384. // IF dw_child.Object.itemid[child_row] <> 0 THEN
  385. // child_row = dw_child.InsertRow (0)
  386. // ELSE
  387. // child_row = dw_child.GetRow()
  388. // END IF
  389. // ELSE
  390. // child_row = dw_child.InsertRow (0)
  391. // END IF
  392. dw_child.Object.itemid[child_row] = S_item_ch.mtrlid[ls_j]
  393. dw_child.Object.itemcode_self[child_row] = S_item_ch.mtrlcode[ls_j]
  394. dw_child.Object.itemname_self[child_row] = S_item_ch.mtrlname[ls_j]
  395. End If
  396. Next
  397. dw_child.SetFocus()
  398. End If
  399. end event
  400. type st_1 from statictext within w_reissue_cus_ljfieb_edit
  401. integer x = 27
  402. integer y = 608
  403. integer width = 453
  404. integer height = 48
  405. boolean bringtotop = true
  406. integer textsize = -9
  407. integer weight = 400
  408. fontcharset fontcharset = gb2312charset!
  409. fontpitch fontpitch = variable!
  410. string facename = "宋体"
  411. long textcolor = 33554432
  412. long backcolor = 134217739
  413. string text = "双击选择本厂项目"
  414. boolean focusrectangle = false
  415. end type
  416. type ln_bar from line within w_reissue_cus_ljfieb_edit
  417. long linecolor = 268435456
  418. integer linethickness = 4
  419. integer beginy = 172
  420. integer endx = 3200
  421. integer endy = 172
  422. end type
  423. type ln_bar2 from line within w_reissue_cus_ljfieb_edit
  424. long linecolor = 16777215
  425. integer linethickness = 4
  426. integer beginx = 9
  427. integer beginy = 176
  428. integer endx = 3273
  429. integer endy = 176
  430. end type
  431. type r_bar from rectangle within w_reissue_cus_ljfieb_edit
  432. long linecolor = 16777215
  433. integer linethickness = 4
  434. long fillcolor = 1073741824
  435. integer x = 3351
  436. integer width = 87
  437. integer height = 68
  438. end type
  439. event constructor;this.fillcolor = 14215660
  440. this.linecolor = 14215660
  441. this.x = -1
  442. this.y = -1
  443. this.height = ln_bar.beginy - 5
  444. end event