w_edit_mx_requiredate.srw 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. $PBExportHeader$w_edit_mx_requiredate.srw
  2. forward
  3. global type w_edit_mx_requiredate from w_publ_base
  4. end type
  5. type dw_1 from u_dw_rbtnfilter within w_edit_mx_requiredate
  6. end type
  7. type cb_choice from uo_imflatbutton within w_edit_mx_requiredate
  8. end type
  9. end forward
  10. global type w_edit_mx_requiredate from w_publ_base
  11. integer width = 1984
  12. string title = "销售订单日期编辑"
  13. boolean minbox = false
  14. windowtype windowtype = response!
  15. event ue_p_requiredate ( )
  16. dw_1 dw_1
  17. cb_choice cb_choice
  18. end type
  19. global w_edit_mx_requiredate w_edit_mx_requiredate
  20. type variables
  21. s_edit_index_tran s_tranr
  22. long ins_scid
  23. long ins_taskid
  24. end variables
  25. event ue_p_requiredate();
  26. IF dw_1.GetRow() <= 0 THEN RETURN
  27. datetime rq
  28. Long uc_row
  29. Long i
  30. dw_1.AcceptText()
  31. rq = dw_1.OBJECT.u_saletaskmx_requiredate[1]
  32. IF ISNULL(rq) then
  33. messagebox("","第一行不能为空")
  34. return
  35. end if
  36. IF MessageBox('提示','是否要以第一行为参照批设定交货时间', question!, YesNo!, 2) = 2 then return
  37. dw_1.SetRedraw(FALSE)
  38. FOR i = 1 TO dw_1.RowCount()
  39. dw_1.Object.u_saletaskmx_requiredate[i] = rq
  40. NEXT
  41. dw_1.SetRedraw(TRUE)
  42. end event
  43. on w_edit_mx_requiredate.create
  44. int iCurrent
  45. call super::create
  46. this.dw_1=create dw_1
  47. this.cb_choice=create cb_choice
  48. iCurrent=UpperBound(this.Control)
  49. this.Control[iCurrent+1]=this.dw_1
  50. this.Control[iCurrent+2]=this.cb_choice
  51. end on
  52. on w_edit_mx_requiredate.destroy
  53. call super::destroy
  54. destroy(this.dw_1)
  55. destroy(this.cb_choice)
  56. end on
  57. event open;call super::open;s_tranr = Message.PowerObjectParm
  58. ins_scid = s_tranr.b_long
  59. ins_taskid = s_tranr.c_long
  60. dw_1.SetTransObject (sqlca)
  61. dw_1.retrieve(ins_scid,ins_taskid)
  62. end event
  63. type cb_func from w_publ_base`cb_func within w_edit_mx_requiredate
  64. end type
  65. type cb_exit from w_publ_base`cb_exit within w_edit_mx_requiredate
  66. integer width = 165
  67. integer height = 152
  68. integer picsize = 16
  69. toolbaralignment pic_align = alignattop!
  70. boolean border = false
  71. end type
  72. type dw_1 from u_dw_rbtnfilter within w_edit_mx_requiredate
  73. integer x = 14
  74. integer y = 164
  75. integer width = 1947
  76. integer height = 888
  77. integer taborder = 20
  78. boolean bringtotop = true
  79. string dataobject = "dw_edit_requiredate"
  80. boolean hscrollbar = true
  81. boolean vscrollbar = true
  82. boolean hsplitscroll = true
  83. end type
  84. event doubleclicked;call super::doubleclicked;IF Lower(Left(dwo.Type,4)) = 'text' THEN
  85. String LS_STR,column_name
  86. column_name = dwo.Name
  87. IF column_name = 'u_saletaskmx_requiredate_t' THEN
  88. parent.triggerevent('ue_p_requiredate')
  89. END IF
  90. END IF
  91. end event
  92. type cb_choice from uo_imflatbutton within w_edit_mx_requiredate
  93. integer x = 165
  94. integer width = 165
  95. integer height = 152
  96. integer taborder = 60
  97. boolean bringtotop = true
  98. boolean default = true
  99. string normalpicname = "ok.bmp"
  100. integer picsize = 16
  101. toolbaralignment pic_align = alignattop!
  102. boolean border = false
  103. end type
  104. event clicked;long rslt =1
  105. string arg_msg
  106. datetime requiredate,rq
  107. long i
  108. long mtrlid,taskid,scid,printid
  109. select requiredate into :rq from u_saletask
  110. where taskid = :ins_taskid and scid = :ins_scid;
  111. IF SQLCA.SQLCODE<>0 THEN
  112. ARG_MSG = "查询交货日期失败"
  113. RSLT = 0
  114. GOTO EXT
  115. END IF
  116. for i =1 to dw_1.rowcount()
  117. mtrlid = dw_1.object.u_saletaskmx_mtrlid[i]
  118. //taskid = dw_1.object.taskid[i]
  119. //scid = dw_1.object.scid[i]
  120. printid = dw_1.object.u_saletaskmx_printid[i]
  121. requiredate = dw_1.object.u_saletaskmx_requiredate[i]
  122. IF requiredate<=DATETIME('1900-01-01') or isnull(requiredate) THEN continue
  123. update u_saletaskmx
  124. set requiredate = :requiredate
  125. where mtrlid = :mtrlid
  126. and taskid = :ins_taskid
  127. and scid = :ins_scid
  128. and printid = :printid;
  129. IF SQLCA.SQLCODE<>0 THEN
  130. ARG_MSG = "第"+string(i)+"行,更新交货日期"+sqlca.sqlerrtext
  131. RSLT = 0
  132. GOTO EXT
  133. END IF
  134. next
  135. update u_saletask
  136. set requiredate = (select max(requiredate)
  137. from u_saletaskmx
  138. where taskid = :ins_taskid and scid = :ins_scid)
  139. where taskid = :ins_taskid and scid = :ins_scid ;
  140. IF SQLCA.SQLCODE<>0 THEN
  141. ARG_MSG = "主表更新最新交货日期失败"+sqlca.sqlerrtext
  142. RSLT = 0
  143. GOTO EXT
  144. END IF
  145. EXT:
  146. IF RSLT = 1 THEN
  147. COMMIT;
  148. ELSE
  149. messagebox("提示",ARG_MSG)
  150. ROLLBACK;
  151. return
  152. END IF
  153. CLOSE(PARENT)
  154. end event