w_inwaremx_cp_mod_price.srw 4.7 KB

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