w_inwaremx_buy_mod_price_p.srw 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. $PBExportHeader$w_inwaremx_buy_mod_price_p.srw
  2. forward
  3. global type w_inwaremx_buy_mod_price_p from w_publ_base
  4. end type
  5. type cb_ok from uo_imflatbutton within w_inwaremx_buy_mod_price_p
  6. end type
  7. type dw_1 from datawindow within w_inwaremx_buy_mod_price_p
  8. end type
  9. end forward
  10. global type w_inwaremx_buy_mod_price_p from w_publ_base
  11. integer width = 3616
  12. integer height = 1628
  13. string title = "采购收货单明细单价修改"
  14. boolean minbox = false
  15. windowtype windowtype = response!
  16. cb_ok cb_ok
  17. dw_1 dw_1
  18. end type
  19. global w_inwaremx_buy_mod_price_p w_inwaremx_buy_mod_price_p
  20. type variables
  21. s_edit_index_tran s_tran
  22. long ins_scid,ins_inwareid
  23. string ins_inwarecode
  24. int ii_enamt_edit = 0//0:不使用录入,不能编辑; 1:使用录入,可以编辑
  25. end variables
  26. on w_inwaremx_buy_mod_price_p.create
  27. int iCurrent
  28. call super::create
  29. this.cb_ok=create cb_ok
  30. this.dw_1=create dw_1
  31. iCurrent=UpperBound(this.Control)
  32. this.Control[iCurrent+1]=this.cb_ok
  33. this.Control[iCurrent+2]=this.dw_1
  34. end on
  35. on w_inwaremx_buy_mod_price_p.destroy
  36. call super::destroy
  37. destroy(this.cb_ok)
  38. destroy(this.dw_1)
  39. end on
  40. event open;call super::open;dw_1.settransobject(sqlca)
  41. s_tran=Message.PowerObjectParm
  42. ins_scid = s_tran.b_long
  43. ins_inwareid = s_tran.c_long
  44. ins_inwarecode = s_tran.c_string
  45. ii_enamt_edit = s_tran.d_long
  46. dw_1.retrieve( ins_scid,ins_inwareid)
  47. IF ii_enamt_edit = 0 THEN
  48. dw_1.Modify('u_inwaremx_uamt.protect = 1~t u_inwaremx_uamt.Color = 0')
  49. dw_1.Modify('u_inwaremx_uamt_t.Color = 0')
  50. ELSE
  51. dw_1.Modify('u_inwaremx_uamt.protect = 0~t u_inwaremx_uamt.Color = "0~trgb(0,0,255)"')
  52. dw_1.Modify('u_inwaremx_uamt_t.Color = "0~trgb(0,0,255)"')
  53. END IF
  54. dw_1.setfocus()
  55. end event
  56. type cb_func from w_publ_base`cb_func within w_inwaremx_buy_mod_price_p
  57. boolean visible = false
  58. end type
  59. type cb_exit from w_publ_base`cb_exit within w_inwaremx_buy_mod_price_p
  60. integer x = 2025
  61. integer y = 1404
  62. integer picsize = 16
  63. end type
  64. type cb_ok from uo_imflatbutton within w_inwaremx_buy_mod_price_p
  65. integer x = 1458
  66. integer y = 1404
  67. integer width = 311
  68. integer height = 96
  69. integer taborder = 20
  70. boolean bringtotop = true
  71. string normalpicname = "ok.bmp"
  72. integer picsize = 16
  73. end type
  74. event clicked;call super::clicked;
  75. Long rslt = 1
  76. Long i
  77. long ll_printid
  78. Decimal ld_uprice,ld_jgprice, lde_rebate, lde_tax
  79. String arg_msg
  80. dw_1.AcceptText()
  81. uo_inware uo_ware
  82. uo_ware = create uo_inware
  83. uo_ware.commit_transaction = sqlca
  84. i = dw_1.GetNextModified(0 , Primary!)
  85. IF i = 0 THEN
  86. arg_msg = "单价没有修改"
  87. rslt = 0
  88. GOTO ext
  89. END IF
  90. DO WHILE i > 0
  91. ll_printid = dw_1.Object.u_inwaremx_printid[i]
  92. ld_uprice = abs(dw_1.Object.u_inwaremx_uprice[i])
  93. ld_jgprice = 0
  94. lde_rebate = dw_1.Object.u_inwaremx_rebate[i]
  95. lde_tax = dw_1.Object.u_inwaremx_tax[i]
  96. IF uo_ware.mod_price(ins_scid,ins_inwareid,ll_printid,ld_uprice,ld_jgprice,lde_rebate, lde_tax,arg_msg,false) = 0 THEN
  97. arg_msg = "行:"+string(i)+","+arg_msg
  98. rslt = 0
  99. GOTO ext
  100. END IF
  101. i = dw_1.GetNextModified(i, Primary!)
  102. LOOP
  103. ext:
  104. destroy uo_ware
  105. IF rslt = 0 THEN
  106. ROLLBACK;
  107. MessageBox('错误',arg_msg, StopSign!, OK! )
  108. RETURN
  109. ELSE
  110. COMMIT;
  111. MessageBox('提示','修改单价成功!', Information!, OK! )
  112. Close(Parent)
  113. END IF
  114. end event
  115. type dw_1 from datawindow within w_inwaremx_buy_mod_price_p
  116. integer width = 3584
  117. integer height = 1348
  118. integer taborder = 30
  119. boolean bringtotop = true
  120. string title = "none"
  121. string dataobject = "dw_inwaremx_buy_mod_price_p"
  122. boolean hscrollbar = true
  123. boolean vscrollbar = true
  124. boolean hsplitscroll = true
  125. boolean livescroll = true
  126. borderstyle borderstyle = stylelowered!
  127. end type
  128. event constructor;f_title_change(this)
  129. end event
  130. event itemchanged;IF row <= 0 THEN RETURN
  131. IF row > dw_1.RowCount() THEN RETURN
  132. This.AcceptText()
  133. //由金额计算单价
  134. IF sys_option_outware_if_buyqty = 0 THEN
  135. IF ii_enamt_edit = 1 THEN
  136. IF dw_1.Object.u_inwaremx_uamt[row] <> 0 THEN
  137. IF dw_1.Object.u_inwaremx_rebate[row] <> 0 And dw_1.Object.u_inwaremx_uqty[row] <> 0 THEN
  138. dw_1.Object.u_inwaremx_uprice[row] = abs(dw_1.Object.u_inwaremx_uamt[row] / dw_1.Object.u_inwaremx_rebate[row] / dw_1.Object.u_inwaremx_uqty[row])
  139. END IF
  140. END IF
  141. ELSE
  142. dw_1.Object.u_inwaremx_uamt[row] = Round(dw_1.Object.u_inwaremx_uprice[row]*dw_1.Object.u_inwaremx_rebate[row]*dw_1.Object.u_inwaremx_uqty[row],2)
  143. END IF
  144. ELSE
  145. IF ii_enamt_edit = 1 THEN
  146. IF dw_1.Object.u_inwaremx_uamt[row] <> 0 THEN
  147. IF dw_1.Object.u_inwaremx_rebate[row] <> 0 And dw_1.Object.u_inwaremx_uqty[row] <> 0 THEN
  148. dw_1.Object.u_inwaremx_uprice[row] = abs(dw_1.Object.u_inwaremx_uamt[row] / dw_1.Object.u_inwaremx_rebate[row] / dw_1.Object.u_inwaremx_buyqty[row])
  149. END IF
  150. END IF
  151. ELSE
  152. dw_1.Object.u_inwaremx_uamt[row] = Round(dw_1.Object.u_inwaremx_uprice[row]*dw_1.Object.u_inwaremx_rebate[row]*dw_1.Object.u_inwaremx_buyqty[row],2)
  153. END IF
  154. END IF
  155. end event