w_salebill.srw 52 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955
  1. $PBExportHeader$w_salebill.srw
  2. forward
  3. global type w_salebill from w_publ_pageretr
  4. end type
  5. type dw_uc from datawindow within w_salebill
  6. end type
  7. type dw_child from u_dw_rbtnfilter within w_salebill
  8. end type
  9. type cb_delet from uo_imflatbutton within w_salebill
  10. end type
  11. type cb_addzy from uo_imflatbutton within w_salebill
  12. end type
  13. type cb_auditing from uo_imflatbutton within w_salebill
  14. end type
  15. type cb_cauditing from uo_imflatbutton within w_salebill
  16. end type
  17. type cb_print from uo_imflatbutton within w_salebill
  18. end type
  19. type cb_retrieve from uo_imflatbutton within w_salebill
  20. end type
  21. type st_3 from statictext within w_salebill
  22. end type
  23. type ddlb_status from dropdownlistbox within w_salebill
  24. end type
  25. type cb_help from uo_imflatbutton within w_salebill
  26. end type
  27. type cb_add from uo_imflatbutton within w_salebill
  28. end type
  29. type cb_edit from uo_imflatbutton within w_salebill
  30. end type
  31. type cb_reset from uo_imflatbutton within w_salebill
  32. end type
  33. type ln_bar from line within w_salebill
  34. end type
  35. type ln_bar2 from line within w_salebill
  36. end type
  37. type r_bar from rectangle within w_salebill
  38. end type
  39. type ln_1 from line within w_salebill
  40. end type
  41. type ln_2 from line within w_salebill
  42. end type
  43. end forward
  44. global type w_salebill from w_publ_pageretr
  45. integer width = 3602
  46. integer height = 2300
  47. string title = "客户对数单"
  48. boolean maxbox = true
  49. windowstate windowstate = maximized!
  50. event retrieve_childdw ( )
  51. event retrieve_childdw_uc ( )
  52. event refresh_interface ( )
  53. event ue_f7 ( )
  54. event ue_f8 ( )
  55. event ue_f9 ( )
  56. event ue_f10 ( )
  57. event ue_f6 ( )
  58. event ue_f11 ( )
  59. event ue_f12 ( )
  60. event ue_addzy ( )
  61. dw_uc dw_uc
  62. dw_child dw_child
  63. cb_delet cb_delet
  64. cb_addzy cb_addzy
  65. cb_auditing cb_auditing
  66. cb_cauditing cb_cauditing
  67. cb_print cb_print
  68. cb_retrieve cb_retrieve
  69. st_3 st_3
  70. ddlb_status ddlb_status
  71. cb_help cb_help
  72. cb_add cb_add
  73. cb_edit cb_edit
  74. cb_reset cb_reset
  75. ln_bar ln_bar
  76. ln_bar2 ln_bar2
  77. r_bar r_bar
  78. ln_1 ln_1
  79. ln_2 ln_2
  80. end type
  81. global w_salebill w_salebill
  82. type variables
  83. int child_column_int=1,uc_column_int=1
  84. uo_salebill uo_bill
  85. int cur_flag = -1
  86. long dw_child_w,dw_child_h,dw_pageretr_w,dw_pageretr_h
  87. String ls_newname = ''
  88. Long ll_prownum
  89. Long ls_powerid
  90. Int li_auditprint
  91. String ls_rpname = ''
  92. end variables
  93. forward prototypes
  94. public function integer wf_refresh_interface ()
  95. public function integer wf_lock_child ()
  96. public function integer wf_lock_uc ()
  97. public subroutine wf_autoadd_mx ()
  98. public function integer wf_refresh_curuc (long arg_salebillid)
  99. public subroutine wf_addnew (long arg_scid, long arg_id)
  100. end prototypes
  101. event retrieve_childdw;long row,uc_relid
  102. row=dw_pageretr.getrow()
  103. if row>0 then
  104. uc_relid=dw_pageretr.object.u_salebill_salebillid[row]
  105. dw_child.SetRedraw (false)
  106. dw_child.retrieve(uc_relid)
  107. dw_child.SetRedraw (true)
  108. else
  109. dw_child.reset()
  110. end if
  111. end event
  112. event retrieve_childdw_uc;IF NOT dw_edit_mode THEN
  113. dw_uc.Reset()
  114. dw_pageretr.RowsCopy(dw_pageretr.GetRow(), dw_pageretr.GetRow(), Primary!, dw_uc, 1, Primary!)
  115. END IF
  116. end event
  117. event refresh_interface;//被 wf_refresh_interface() 调用,用于界面刷新
  118. end event
  119. event ue_f7;//cb_add_xm.triggerevent(clicked!)
  120. end event
  121. event ue_f8;////用于选择明细内容,被F8[默认]\dw_child.doubleclicked调用
  122. //long child_row
  123. //if child_row=0 then
  124. // messagebox('系统提示','请选定目标明细行!')
  125. // return
  126. //end if
  127. //
  128. //s_edit_index_tran s_ch_tran //传递参数使用
  129. //s_ch_tran.if_retrieve_all=false //是否一次RETRIEVE所有行
  130. //s_ch_tran.work_mode=1 //0-单纯编辑模式 1-选择\编辑模式
  131. //s_ch_tran.arg_pkid=0 //目标定位PKID (备用)
  132. ////查询列(物料编码)部分内容,用于初步筛选
  133. //s_ch_tran.arg_string_code=trim(dw_child.object.u_mtrldef_mtrlcode[child_row])
  134. //
  135. //OPENwithparm(W_materiel,s_ch_tran) //调用
  136. //
  137. //S_materiel S_INSCUST
  138. //S_INSCUST=Message.PowerObjectParm //接受返回结构
  139. //IF S_INSCUST.mtrlid>0 THEN //正常返回值则可以取以下值
  140. //
  141. //dw_child.object.u_mtrldef_mtrlcode[child_row]
  142. //dw_child.object.u_mtrldef_unit[child_row]
  143. //dw_child.object.u_wasterinwaremx_mtrlid[child_row]
  144. //dw_child.object.u_wasterinwaremx_planprice[child_row]
  145. //dw_child.object.u_mtrldef_mtrlname[child_row]
  146. //
  147. ////S_INSCUST.mtrlid
  148. ////S_INSCUST.mtrlname
  149. ////S_INSCUST.mtrlcode
  150. ////S_INSCUST.unit
  151. ////S_INSCUST.mtrltype
  152. ////S_INSCUST.mtrlmode
  153. ////S_INSCUST.planprice
  154. //
  155. ////S_INSCUST.storageid
  156. ////S_INSCUST.cost
  157. ////S_INSCUST.price
  158. ////S_INSCUST.descrp
  159. ////S_INSCUST.source
  160. //END IF
  161. //
  162. end event
  163. event ue_f9();IF NOT dw_edit_mode THEN RETURN
  164. Long child_row
  165. child_row = dw_uc.GetRow()
  166. IF child_row = 0 THEN
  167. MessageBox('提示','请选定单据!',information!,ok!)
  168. RETURN
  169. END IF
  170. IF NOT IsValid(W_cust_edit) THEN
  171. s_edit_index_tran s_ch_tran //传递参数使用
  172. s_ch_tran.if_retrieve_all = local_retrieve_all //是否一次RETRIEVE所有行
  173. s_ch_tran.work_mode = 1 //0-单纯编辑模式 1-选择\编辑模式
  174. s_ch_tran.arg_pkid = 0 //目标定位PKID (备用)
  175. s_ch_tran.arg_string_code = ''//查询列(物料编码)部分内容,用于初步筛选
  176. OpenWithParm(W_cust_edit,s_ch_tran) //调用
  177. s_custom S_INSCUST
  178. S_INSCUST = Message.PowerObjectParm //接受返回结构
  179. IF S_INSCUST.cusid > 0 THEN //正常返回值则可以取以下值
  180. dw_uc.SetRedraw(FALSE)
  181. dw_uc.Object.u_salebill_cusid[child_row] = S_INSCUST.cusid
  182. dw_uc.Object.u_cust_name[child_row] = S_INSCUST.Name
  183. dw_uc.Object.u_cust_cuscode[child_row] = S_INSCUST.cuscode
  184. dw_uc.SetRedraw(TRUE)
  185. END IF
  186. wf_autoadd_mx()
  187. dw_uc.SetColumn("u_salebill_billtype")
  188. END IF
  189. end event
  190. event ue_addzy();
  191. if not f_power_ind(524) then
  192. messagebox('提示','你没有使用权限!',information!,ok!)
  193. return
  194. end if
  195. if dw_edit_mode then return
  196. string arg_msg='',LS_STR
  197. long uc_row
  198. s_inputbox S_SREU
  199. uc_row=dw_pageretr.getrow()
  200. if uc_row<=0 then
  201. messagebox('提示','请选定当前目标单据!',information!,ok!)
  202. return
  203. end if
  204. S_SREU.TITLE='请输入要补充到备注的内容'
  205. S_SREU.OLD_TEXT=''
  206. openwithparm(w_inputbox,S_SREU)
  207. LS_STR=Message.StringParm
  208. if trim(LS_STR)='' or isnull(LS_STR) then return
  209. if uo_bill.add_dscrp(dw_pageretr.object.u_salebill_salebillid[uc_row],LS_STR,arg_msg,true)=0 then
  210. messagebox('提示',arg_msg,stopsign!,ok!)
  211. return
  212. else
  213. messagebox('提示','添加备注操作成功!',information!,ok!)
  214. wf_refresh_curuc(dw_pageretr.object.u_salebill_salebillid[uc_row])
  215. end if
  216. end event
  217. public function integer wf_refresh_interface ();//wf_refresh_interface
  218. IF dw_edit_mode THEN
  219. cb_addzy.Enabled = FALSE
  220. cb_retrieve.Enabled = FALSE
  221. cb_delet.Enabled = FALSE
  222. cb_print.Enabled = FALSE
  223. cb_auditing.Enabled = FALSE
  224. cb_cauditing.Enabled = FALSE
  225. cb_func.Enabled = FALSE
  226. dw_pageretr.RBUTTON_FILTER_USE = FALSE //右键查询功能开关
  227. dw_pageretr.titleclick_sort_use = FALSE //单击标题排序功能开关
  228. cb_edit.Enabled = TRUE
  229. cb_add.Enabled = TRUE
  230. cb_reset.Enabled = TRUE
  231. cb_edit.Text = "放弃&E"
  232. cb_add.Text = "保存&S"
  233. cb_edit.normalpicname = 'Undo.bmp'
  234. cb_add.normalpicname = 'Save.bmp'
  235. // dw_child.DataObject = 'dw_salebillmx_index'
  236. // dw_child.SetTransObject (sqlca)
  237. dw_child.Reset()
  238. ELSE
  239. cb_addzy.Enabled = TRUE
  240. cb_retrieve.Enabled = TRUE
  241. cb_delet.Enabled = TRUE
  242. cb_print.Enabled = TRUE
  243. cb_auditing.Enabled = TRUE
  244. cb_cauditing.Enabled = TRUE
  245. cb_func.Enabled = TRUE
  246. cb_reset.Enabled = FALSE
  247. dw_pageretr.RBUTTON_FILTER_USE = TRUE //右键查询功能开关
  248. dw_pageretr.titleclick_sort_use = TRUE //单击标题排序功能开关
  249. cb_add.Enabled = TRUE
  250. cb_edit.Enabled = TRUE
  251. cb_edit.Text = "修改&E"
  252. cb_add.Text = "新建&S"
  253. cb_edit.normalpicname = 'OPEN.bmp'
  254. cb_add.normalpicname = 'new.bmp'
  255. // dw_child.DataObject = 'dw_salebillmx_edit'
  256. // dw_child.SetTransObject (sqlca)
  257. THIS.TriggerEvent('retrieve_childdw')
  258. IF dw_pageretr.GetRow() <= 0 THEN
  259. cb_addzy.Enabled = FALSE
  260. cb_auditing.Enabled = FALSE
  261. END IF
  262. END IF
  263. IF retrieve_all OR dw_edit_mode THEN
  264. cb_nextpage.Enabled = FALSE
  265. cb_retrieveall.Enabled = FALSE
  266. em_pagerowno.Enabled = FALSE
  267. sle_usual_query.Enabled = FALSE
  268. ELSE
  269. cb_nextpage.Enabled = TRUE
  270. cb_retrieveall.Enabled = TRUE
  271. em_pagerowno.Enabled = TRUE
  272. sle_usual_query.Enabled = TRUE
  273. END IF
  274. wf_lock_child()
  275. wf_lock_uc()
  276. cb_edit.of_init_draw()
  277. cb_add.of_init_draw()
  278. cb_edit.of_paint()
  279. cb_add.of_paint()
  280. cb_add.TriggerEvent('ue_textchange')
  281. cb_edit.TriggerEvent('ue_textchange')
  282. THIS.TriggerEvent('refresh_interface')
  283. RETURN 1
  284. end function
  285. public function integer wf_lock_child ();//wf_lock_child
  286. INT LS_INT
  287. IF dw_edit_mode THEN
  288. FOR LS_INT=1 TO child_column_int
  289. dw_child.SetTabOrder (LS_INT,LS_INT*10 )
  290. NEXT
  291. ELSE
  292. FOR LS_INT=1 TO child_column_int
  293. dw_child.SetTabOrder (LS_INT, 0)
  294. NEXT
  295. END IF
  296. RETURN 1
  297. end function
  298. public function integer wf_lock_uc ();//wf_lock_uc
  299. INT LS_INT
  300. long ls_row
  301. ls_row=dw_uc.getrow()
  302. IF dw_edit_mode THEN
  303. FOR LS_INT=1 TO uc_column_int
  304. dw_uc.SetTabOrder (LS_INT,LS_INT*10 )
  305. NEXT
  306. ELSE
  307. FOR LS_INT=1 TO uc_column_int
  308. dw_uc.SetTabOrder (LS_INT, 0)
  309. NEXT
  310. END IF
  311. if ls_row>0 then dw_uc.setrow(ls_row)
  312. RETURN 1
  313. end function
  314. public subroutine wf_autoadd_mx ();Long ucrow,ls_cusid,li_row
  315. Long ls_takeid,ll_moneyid
  316. String ls_billcode
  317. Decimal ls_oriamt,ls_Msttakeamt,ls_takeamt
  318. DateTime ls_takedate
  319. dw_uc.accepttext()
  320. ucrow = dw_uc.GetRow()
  321. IF ucrow <= 0 THEN RETURN
  322. ls_cusid = dw_uc.Object.u_salebill_cusid[ucrow]
  323. ll_moneyid=dw_uc.object.u_salebill_moneyid[ucrow]
  324. IF ls_cusid = 0 THEN
  325. dw_child.Reset()
  326. RETURN
  327. END IF
  328. //dw_child.Reset()
  329. // DECLARE take_cur CURSOR FOR
  330. // SELECT U_Bmsttake.takeid,
  331. // U_Bmsttake.Billcode,
  332. // U_Bmsttake.oriamt,
  333. // U_Bmsttake.Msttakeamt,
  334. // U_Bmsttake.takeamt,
  335. // U_Bmsttake.takedate
  336. // FROM U_Bmsttake
  337. // WHERE U_Bmsttake.finishflag = 0 AND cusid = :ls_cusid
  338. // Order By U_Bmsttake.takedate Asc ;
  339. //
  340. // OPEN take_cur;
  341. // FETCH take_cur INTO :ls_takeid,:ls_billcode,:ls_oriamt,:ls_Msttakeamt,:ls_takeamt,:ls_takedate;
  342. // DO WHILE sqlca.SQLCode = 0
  343. // li_row = dw_child.InsertRow(0)
  344. // dw_child.Object.takeid [li_row] = ls_takeid
  345. // dw_child.Object.u_bmsttake_takedate[li_row] = ls_takedate
  346. // dw_child.Object.u_bmsttake_oriamt[li_row] = ls_oriamt
  347. // dw_child.Object.u_bmsttake_billcode[li_row] = ls_billcode
  348. // dw_child.Object.u_bmsttake_msttakeamt[li_row] = ls_Msttakeamt
  349. // dw_child.Object.u_bmsttake_takeamt[li_row] = ls_takeamt
  350. //
  351. // FETCH take_cur INTO :ls_takeid,:ls_billcode,:ls_oriamt,:ls_Msttakeamt,:ls_takeamt,:ls_takedate;
  352. // LOOP
  353. // CLOSE take_cur;
  354. //
  355. dw_child.Reset()
  356. IF dw_uc.Object.u_salebill_billtype[ucrow] = 1 THEN
  357. DECLARE take_cur CURSOR FOR
  358. SELECT U_Bmsttake.takeid,
  359. U_Bmsttake.Billcode,
  360. U_Bmsttake.oriamt,
  361. U_Bmsttake.Msttakeamt,
  362. U_Bmsttake.takeamt,
  363. U_Bmsttake.takedate
  364. FROM U_Bmsttake
  365. WHERE U_Bmsttake.finishflag = 0 AND cusid = :ls_cusid and
  366. U_Bmsttake.Msttakeamt - U_Bmsttake.takeamt>0 and (U_Bmsttake.Msttakeamt<>0)
  367. and u_bmsttake.moneyid=:ll_moneyid Order By U_Bmsttake.takedate Asc ;
  368. OPEN take_cur;
  369. FETCH take_cur INTO :ls_takeid,:ls_billcode,:ls_oriamt,:ls_Msttakeamt,:ls_takeamt,:ls_takedate;
  370. DO WHILE sqlca.SQLCode = 0
  371. li_row = dw_child.InsertRow(0)
  372. dw_child.Object.takeid [li_row] = ls_takeid
  373. dw_child.Object.takedate[li_row] = ls_takedate
  374. dw_child.Object.oriamt[li_row] = ls_oriamt
  375. dw_child.Object.billcode[li_row] = ls_billcode
  376. dw_child.Object.mainmsttakeamt[li_row] = ls_Msttakeamt
  377. dw_child.Object.maintakeamt[li_row] = ls_takeamt
  378. FETCH take_cur INTO :ls_takeid,:ls_billcode,:ls_oriamt,:ls_Msttakeamt,:ls_takeamt,:ls_takedate;
  379. LOOP
  380. CLOSE take_cur;
  381. ELSEIF dw_uc.Object.u_salebill_billtype[ucrow] = 2 THEN
  382. DECLARE take_cur1 CURSOR FOR
  383. SELECT U_Bmsttake.takeid,
  384. U_Bmsttake.Billcode,
  385. U_Bmsttake.oriamt,
  386. U_Bmsttake.Msttakeamt,
  387. U_Bmsttake.takeamt,
  388. U_Bmsttake.takedate
  389. FROM U_Bmsttake
  390. WHERE U_Bmsttake.finishflag = 0 AND cusid = :ls_cusid and
  391. U_Bmsttake.Msttakeamt - U_Bmsttake.takeamt<0 and (U_Bmsttake.Msttakeamt<>0)
  392. and u_bmsttake.moneyid=:ll_moneyid Order By U_Bmsttake.takedate Asc ;
  393. OPEN take_cur1;
  394. FETCH take_cur1 INTO :ls_takeid,:ls_billcode,:ls_oriamt,:ls_Msttakeamt,:ls_takeamt,:ls_takedate;
  395. DO WHILE sqlca.SQLCode = 0
  396. li_row = dw_child.InsertRow(0)
  397. dw_child.Object.takeid [li_row] = ls_takeid
  398. dw_child.Object.takedate[li_row] = ls_takedate
  399. dw_child.Object.oriamt[li_row] = ls_oriamt
  400. dw_child.Object.billcode[li_row] = ls_billcode
  401. dw_child.Object.mainmsttakeamt[li_row] = ls_Msttakeamt
  402. dw_child.Object.maintakeamt[li_row] = ls_takeamt
  403. FETCH take_cur1 INTO :ls_takeid,:ls_billcode,:ls_oriamt,:ls_Msttakeamt,:ls_takeamt,:ls_takedate;
  404. LOOP
  405. CLOSE take_cur1;
  406. END IF
  407. // takeid
  408. // u_bmsttake_takedate
  409. // u_bmsttake_oriamt
  410. // u_bmsttake_billcode
  411. // u_bmsttake_msttakeamt
  412. // u_bmsttake_takeamt
  413. //
  414. end subroutine
  415. public function integer wf_refresh_curuc (long arg_salebillid);//wf_refresh_curuc
  416. IF arg_salebillid <= 0 OR IsNull(arg_salebillid) THEN RETURN 0
  417. Long uc_row
  418. uc_row = dw_pageretr.GetRow()
  419. IF uc_row <= 0 THEN RETURN 0
  420. String relcode,dscrp,opemp,taketype,auditrep,inrep,salebillcode
  421. DateTime takedate,opdate,auditdate
  422. Decimal msttakeamt,takeamt
  423. Long cusid,moneyid
  424. Int flag
  425. String custname
  426. String cuscode
  427. long accountsid
  428. long itemid
  429. SELECT u_salebill.salebillcode,
  430. u_salebill.relcode,
  431. u_salebill.takedate,
  432. u_salebill.msttakeamt,
  433. u_salebill.takeamt,
  434. u_salebill.cusid,
  435. u_salebill.dscrp,
  436. u_salebill.opdate,
  437. u_salebill.opemp,
  438. u_salebill.taketype,
  439. u_salebill.auditdate,
  440. u_salebill.auditrep,
  441. u_salebill.flag,
  442. u_salebill.inrep,
  443. u_salebill.moneyid,
  444. u_cust.name,
  445. u_cust.cuscode ,
  446. u_salebill.accountsid,
  447. u_salebill.itemid
  448. INTO :salebillcode,
  449. :relcode,
  450. :takedate,
  451. :msttakeamt,
  452. :takeamt,
  453. :cusid,
  454. :dscrp,
  455. :opdate,
  456. :opemp,
  457. :taketype,
  458. :auditdate,
  459. :auditrep,
  460. :flag,
  461. :inrep,
  462. :moneyid,
  463. :custname ,
  464. :cuscode ,
  465. :accountsid,
  466. :itemid
  467. FROM u_cust INNER JOIN
  468. u_salebill ON u_cust.cusid = u_salebill.cusid and
  469. ( u_salebill.salebillid = :arg_salebillid ) ;
  470. IF sqlca.SQLCode <> 0 THEN
  471. MessageBox('错误',"查询操作失败(错误单据唯一码)",stopsign!,ok!)
  472. RETURN 0
  473. END IF
  474. dw_pageretr.Object.u_salebill_salebillid[uc_row] = arg_salebillid
  475. dw_pageretr.Object.u_salebill_salebillcode[uc_row] = salebillcode
  476. dw_pageretr.Object.u_salebill_takedate[uc_row] = takedate
  477. dw_pageretr.Object.u_salebill_relcode[uc_row] = relcode
  478. dw_pageretr.Object.u_salebill_inrep[uc_row] = inrep
  479. dw_pageretr.Object.u_salebill_msttakeamt[uc_row] = msttakeamt
  480. dw_pageretr.Object.u_salebill_takeamt[uc_row] = takeamt
  481. dw_pageretr.Object.u_salebill_dscrp[uc_row] = dscrp
  482. dw_pageretr.Object.u_salebill_cusid[uc_row] = cusid
  483. dw_pageretr.Object.u_salebill_opdate[uc_row] = opdate
  484. dw_pageretr.Object.u_salebill_opemp[uc_row] = opemp
  485. dw_pageretr.Object.u_salebill_auditdate[uc_row] = auditdate
  486. dw_pageretr.Object.u_salebill_auditrep[uc_row] = auditrep
  487. dw_pageretr.Object.u_salebill_flag[uc_row] = flag
  488. dw_pageretr.Object.u_salebill_moneyid[uc_row] = moneyid
  489. dw_pageretr.Object.u_cust_cuscode[uc_row] = cuscode
  490. dw_pageretr.Object.u_cust_name[uc_row] = custname
  491. dw_pageretr.Object.u_salebill_accountsid[uc_row] = accountsid
  492. dw_pageretr.Object.u_salebill_itemid[uc_row] = itemid
  493. dw_uc.Reset()
  494. dw_pageretr.RowsCopy(dw_pageretr.GetRow(), dw_pageretr.GetRow(), Primary!, dw_uc, 1, Primary!)
  495. dw_uc.ResetUpdate()
  496. dw_uc.SetRedraw(TRUE)
  497. //wf_flagstatus_rf()
  498. RETURN 1
  499. end function
  500. public subroutine wf_addnew (long arg_scid, long arg_id);//
  501. String ls_cuscode,ls_cusname
  502. Long uc_row
  503. IF arg_id = 0 THEN RETURN
  504. cb_add.TriggerEvent( 'clicked')
  505. uc_row = dw_uc.GetRow()
  506. SELECT cuscode,name
  507. INTO :ls_cuscode,:ls_cusname
  508. FROM u_cust
  509. Where cusid = :arg_id;
  510. dw_uc.SetRedraw(FALSE)
  511. IF sqlca.SQLCode <> 0 THEN
  512. THIS.TriggerEvent('ue_f9')
  513. ELSE
  514. dw_uc.Object.u_salebill_cusid[uc_row] = arg_id
  515. dw_uc.Object.u_cust_name[uc_row] = ls_cusname
  516. dw_uc.Object.u_cust_cuscode[uc_row] = ls_cuscode
  517. wf_autoadd_mx()
  518. END IF
  519. dw_uc.SetRedraw(TRUE)
  520. dw_uc.SetColumn("u_salebill_accountsid")
  521. end subroutine
  522. on w_salebill.create
  523. int iCurrent
  524. call super::create
  525. this.dw_uc=create dw_uc
  526. this.dw_child=create dw_child
  527. this.cb_delet=create cb_delet
  528. this.cb_addzy=create cb_addzy
  529. this.cb_auditing=create cb_auditing
  530. this.cb_cauditing=create cb_cauditing
  531. this.cb_print=create cb_print
  532. this.cb_retrieve=create cb_retrieve
  533. this.st_3=create st_3
  534. this.ddlb_status=create ddlb_status
  535. this.cb_help=create cb_help
  536. this.cb_add=create cb_add
  537. this.cb_edit=create cb_edit
  538. this.cb_reset=create cb_reset
  539. this.ln_bar=create ln_bar
  540. this.ln_bar2=create ln_bar2
  541. this.r_bar=create r_bar
  542. this.ln_1=create ln_1
  543. this.ln_2=create ln_2
  544. iCurrent=UpperBound(this.Control)
  545. this.Control[iCurrent+1]=this.dw_uc
  546. this.Control[iCurrent+2]=this.dw_child
  547. this.Control[iCurrent+3]=this.cb_delet
  548. this.Control[iCurrent+4]=this.cb_addzy
  549. this.Control[iCurrent+5]=this.cb_auditing
  550. this.Control[iCurrent+6]=this.cb_cauditing
  551. this.Control[iCurrent+7]=this.cb_print
  552. this.Control[iCurrent+8]=this.cb_retrieve
  553. this.Control[iCurrent+9]=this.st_3
  554. this.Control[iCurrent+10]=this.ddlb_status
  555. this.Control[iCurrent+11]=this.cb_help
  556. this.Control[iCurrent+12]=this.cb_add
  557. this.Control[iCurrent+13]=this.cb_edit
  558. this.Control[iCurrent+14]=this.cb_reset
  559. this.Control[iCurrent+15]=this.ln_bar
  560. this.Control[iCurrent+16]=this.ln_bar2
  561. this.Control[iCurrent+17]=this.r_bar
  562. this.Control[iCurrent+18]=this.ln_1
  563. this.Control[iCurrent+19]=this.ln_2
  564. end on
  565. on w_salebill.destroy
  566. call super::destroy
  567. destroy(this.dw_uc)
  568. destroy(this.dw_child)
  569. destroy(this.cb_delet)
  570. destroy(this.cb_addzy)
  571. destroy(this.cb_auditing)
  572. destroy(this.cb_cauditing)
  573. destroy(this.cb_print)
  574. destroy(this.cb_retrieve)
  575. destroy(this.st_3)
  576. destroy(this.ddlb_status)
  577. destroy(this.cb_help)
  578. destroy(this.cb_add)
  579. destroy(this.cb_edit)
  580. destroy(this.cb_reset)
  581. destroy(this.ln_bar)
  582. destroy(this.ln_bar2)
  583. destroy(this.r_bar)
  584. destroy(this.ln_1)
  585. destroy(this.ln_2)
  586. end on
  587. event closequery;IF dw_edit_mode THEN
  588. Int ls_row = 0
  589. dw_UC.AcceptText()
  590. ls_row = dw_UC.GetNextModified(0, Primary!)+&
  591. dw_UC.GetNextModified(0, Filter!)+dw_UC.DeletedCount()
  592. IF ls_row > 0 THEN
  593. IF MessageBox('询问','单据数据已经改变,是否先保存?',Question!,YesNo!,1 ) = 1 THEN
  594. RETURN 1
  595. END IF
  596. ELSE
  597. ls_row = dw_child.GetNextModified(0, Primary!)+&
  598. dw_child.GetNextModified(0, Filter!)+dw_child.DeletedCount()
  599. IF ls_row > 0 THEN
  600. IF MessageBox('询问','单据明细数据已经改变,是否先保存?',Question!,YesNo!,1 ) = 1 THEN
  601. RETURN 1
  602. END IF
  603. END IF
  604. END IF
  605. END IF
  606. end event
  607. event user_key;call super::user_key;IF KeyDown(KeyF6!) THEN
  608. this.TRIGGEREVENT('ue_f6')
  609. ELSEIF KeyDown(KeyF7!) THEN
  610. this.TRIGGEREVENT('ue_f7')
  611. ELSEIF KeyDown(KeyF8!) or KeyDown(KeyShift!) and KeyDown(KeyEnter!) THEN
  612. this.TRIGGEREVENT('ue_f8')
  613. ELSEIF KeyDown(KeyF9!) THEN
  614. this.TRIGGEREVENT('ue_f9')
  615. ELSEIF KeyDown(KeyF10!) THEN
  616. this.TRIGGEREVENT('ue_f10')
  617. ELSEIF KeyDown(KeyF11!) THEN
  618. this.TRIGGEREVENT('ue_f11')
  619. ELSEIF KeyDown(KeyF12!) THEN
  620. this.TRIGGEREVENT('ue_f12')
  621. elseIF KeyDown(KeyF1!) THEN
  622. this.TriggerEvent("ue_help")
  623. end if
  624. end event
  625. event open;this.triggerevent('ue_before_open')
  626. wf_movetocenter()
  627. if_ue_retr=true
  628. if_ue_filter=true
  629. if_ue_sort=true
  630. OLD_TITLE=THIS.TITLE
  631. s_tran=Message.PowerObjectParm
  632. IF not ISNULL(s_tran) then
  633. retrieve_all=s_tran.if_retrieve_all
  634. mode=s_tran.work_mode
  635. arg_pkid=s_tran.arg_pkid
  636. arg_string_code=s_tran.arg_string_code
  637. if_sharedata=s_tran.if_sharedata //是否应用sharedata,当retrieve_all=true是生效
  638. ds_share=s_tran.ds_share
  639. end if
  640. //CHOOSE CASE MODE
  641. // CASE 0
  642. // THIS.TITLE=OLD_TITLE+' 编辑模式 [F4-新建/保存 F5-编辑/放弃]'
  643. // CASE 1
  644. // THIS.TITLE=OLD_TITLE+' 选择模式 [F4-新建/保存 F5-编辑/放弃]'
  645. //END CHOOSE
  646. dw_pageretr.RBUTTON_FILTER_USE=true //右键查询功能开关
  647. dw_pageretr.titleclick_sort_use=true //单击标题排序功能开关
  648. dw_pageretr.SetTransObject (sqlca)
  649. //pkcolumndbtname=dw_pageretr.Describe("#1.dbname") //取第一列为关键字
  650. pkcolumndbtname=wf_get_pkcolumndbtname(dw_pageretr) //取第一列为关键字
  651. ori_oldselect=dw_pageretr.Describe("DataWindow.Table.Select")
  652. ls_newselect=ori_oldselect
  653. ds_curquery=CREATE DATASTORE
  654. ds_curquery.DATAOBJECT='d_extr_find'
  655. ds_curquery.SetTransObject (sqlca)
  656. //if mode=1 then cb_mode_itfchg.TRIGGEREVENT(CLICKED!)
  657. wf_editindex_lockf()
  658. sle_usual_query.text=trim(arg_string_code)
  659. if NOT retrieve_all then
  660. THIS.TRIGGEREVENT("ue_usual_query_RETR") //修改ls_newselect,retrieve
  661. else
  662. if if_sharedata then
  663. ds_share.sharedata(dw_pageretr)
  664. else
  665. wf_retrieveuc(dw_pageretr,ls_newselect,1)
  666. this.TRIGGEREVENT('RETRIEVE_pageretr')
  667. end if
  668. end if
  669. IF retrieve_all THEN
  670. THIS.TRIGGEREVENT("ue_usual_query_filt")
  671. END IF
  672. wf_refresh_interface()
  673. uc_column_int=13 //uc dw前8列可以编辑
  674. child_column_int=4 //子dw前4列可以编辑
  675. uo_bill=create uo_salebill
  676. IF not ISNULL(s_tran) then
  677. if s_tran.b_long>0 then
  678. wf_addnew(s_tran.c_long , s_tran.b_long)
  679. end if
  680. end if
  681. end event
  682. event ue_before_open;dw_child.settransobject(sqlca)
  683. dw_uc.settransobject(sqlca)
  684. end event
  685. event retrieve_pageretr;Boolean cb_firstpage_enabled,cb_nextpage_enabled,cb_retrieveall_enabled
  686. Boolean cb_priorpage_enabled,cb_retrieve_enabled
  687. cb_nextpage_enabled = cb_nextpage.Enabled
  688. cb_retrieveall_enabled = cb_retrieveall.Enabled
  689. cb_nextpage.Enabled = FALSE
  690. cb_retrieveall.Enabled = FALSE
  691. datawindowchild childdw
  692. dw_uc.SetTransObject (sqlca)
  693. dw_uc.GetChild("u_salebill_accountsid",childdw)
  694. childdw.SetTransObject (sqlca)
  695. IF childdw.Retrieve(sys_user_account) = 0 THEN
  696. childdw.InsertRow(0)
  697. END IF
  698. dw_uc.Retrieve()
  699. dw_pageretr.Retrieve(cur_flag,sys_areaid)
  700. IF dw_pageretr.RowCount() > 0 THEN
  701. dw_pageretr.SetRow(1)
  702. dw_pageretr.triggerevent(rowfocuschanged!)
  703. end if
  704. //THIS.TriggerEvent('retreve_childdw')
  705. cb_nextpage.Enabled = cb_nextpage_enabled
  706. cb_retrieveall.Enabled = cb_retrieveall_enabled
  707. end event
  708. event key;this.triggerevent('user_key')
  709. end event
  710. event ue_usual_query_retr;call super::ue_usual_query_retr;string ls_querystrpart=''
  711. ls_newselect=lower(ori_oldselect)
  712. if trim(sle_usual_query.text)<>'' then
  713. if pos(trim(sle_usual_query.text),'%')=0 then
  714. ls_querystrpart="( u_salebill.salebillcode like '%"+trim(sle_usual_query.text)+"%')"
  715. else
  716. ls_querystrpart="( u_salebill.salebillcode like '"+trim(sle_usual_query.text)+"')"
  717. end if
  718. if Pos(ls_newselect," where ") <> 0 then
  719. ls_newselect=ls_newselect+" AND ("+ls_querystrpart+')'
  720. else
  721. ls_newselect=ls_newselect+" where ("+ls_querystrpart+')'
  722. end if
  723. end if
  724. wf_retrieveuc(dw_pageretr,ls_newselect,1)
  725. this.triggerevent('retrieve_pageretr')
  726. end event
  727. event ue_usual_query_filt;call super::ue_usual_query_filt;string obj_expr=''
  728. if trim(sle_usual_query.text)<>'' then
  729. IF POS(trim(sle_usual_query.text),'%')=0 THEN
  730. obj_expr=obj_expr+'( u_salebill_salebillcode LIKE "%'+trim(sle_usual_query.text)+'%" )'
  731. ELSE
  732. obj_expr=obj_expr+'( u_salebill_salebillcode LIKE "'+trim(sle_usual_query.text)+'" )'
  733. END IF
  734. end if
  735. dw_pageretr.setfilter(obj_expr)
  736. dw_pageretr.SetRedraw(False)
  737. dw_pageretr.filter()
  738. if dw_pageretr.rowcount()>=1 then
  739. dw_pageretr.selectrow(0,false)
  740. dw_pageretr.selectrow(1,true)
  741. end if
  742. dw_pageretr.SetRedraw(TRUE)
  743. end event
  744. event resize;call super::resize;ln_bar.EndX = THIS.Width
  745. ln_bar2.EndX = THIS.Width
  746. ln_1.EndX = THIS.Width
  747. ln_2.EndX = THIS.Width
  748. r_bar.Width = THIS.Width
  749. Long w_width,w_height
  750. w_width = 3602
  751. w_height = 2300
  752. IF newwidth < w_width THEN THIS.Width = w_width
  753. IF newheight < w_height THEN THIS.Height = w_height
  754. dw_child.Width = THIS.Width - (w_width - dw_child_w)
  755. dw_child.Height = THIS.Height - (w_height - dw_child_h)
  756. dw_pageretr.Width = THIS.Width - (w_width - dw_pageretr_w)
  757. end event
  758. type cb_func from w_publ_pageretr`cb_func within w_salebill
  759. integer x = 151
  760. integer y = 0
  761. integer width = 151
  762. integer height = 172
  763. end type
  764. type cb_exit from w_publ_pageretr`cb_exit within w_salebill
  765. integer x = 1888
  766. integer y = 0
  767. integer width = 151
  768. integer height = 172
  769. integer taborder = 230
  770. integer picsize = 16
  771. toolbaralignment pic_align = alignattop!
  772. boolean border = false
  773. end type
  774. type sle_usual_query from w_publ_pageretr`sle_usual_query within w_salebill
  775. integer x = 229
  776. integer y = 188
  777. integer width = 521
  778. boolean bringtotop = true
  779. end type
  780. type cb_retrieveall from w_publ_pageretr`cb_retrieveall within w_salebill
  781. integer x = 2482
  782. integer height = 172
  783. integer taborder = 180
  784. string normalpicname = "p1.ico"
  785. integer picsize = 16
  786. toolbaralignment pic_align = alignattop!
  787. boolean border = false
  788. end type
  789. type em_pagerowno from w_publ_pageretr`em_pagerowno within w_salebill
  790. integer x = 2139
  791. integer y = 68
  792. integer width = 334
  793. integer taborder = 160
  794. boolean bringtotop = true
  795. end type
  796. type dw_pageretr from w_publ_pageretr`dw_pageretr within w_salebill
  797. event retrieve_childdw_uc ( )
  798. integer x = 2007
  799. integer y = 288
  800. integer width = 1536
  801. integer height = 1012
  802. boolean bringtotop = true
  803. string title = "单据摘要内容"
  804. string dataobject = "dw_salebilledit_index"
  805. end type
  806. event dw_pageretr::retrieve_childdw_uc();IF NOT dw_edit_mode THEN
  807. dw_uc.Reset()
  808. dw_pageretr.RowsCopy(dw_pageretr.GetRow(), dw_pageretr.GetRow(), Primary!, dw_uc, 1, Primary!)
  809. END IF
  810. end event
  811. event dw_pageretr::rowfocuschanged;call super::rowfocuschanged;IF NOT dw_edit_mode THEN
  812. PARENT.TriggerEvent('retrieve_childdw_uc')
  813. PARENT.TriggerEvent('retrieve_childdw')
  814. END IF
  815. DW_UC.SETROW(currentrow)
  816. DW_UC.ScrollToRow (currentrow)
  817. end event
  818. event dw_pageretr::ue_after_filter;if not dw_edit_mode then parent.triggerevent('retrieve_childdw')
  819. end event
  820. event dw_pageretr::constructor;call super::constructor;dw_pageretr_w = this.width
  821. dw_pageretr_h = this.height
  822. end event
  823. type st_1 from w_publ_pageretr`st_1 within w_salebill
  824. integer x = 32
  825. integer y = 212
  826. integer width = 210
  827. string text = "单号含:"
  828. end type
  829. type cb_nextpage from w_publ_pageretr`cb_nextpage within w_salebill
  830. integer x = 2647
  831. integer width = 64
  832. integer height = 172
  833. integer taborder = 220
  834. string normalpicname = "p4.ico"
  835. integer picsize = 16
  836. toolbaralignment pic_align = alignattop!
  837. boolean border = false
  838. end type
  839. type dw_uc from datawindow within w_salebill
  840. event dwnkey pbm_dwnkey
  841. integer y = 300
  842. integer width = 2011
  843. integer height = 996
  844. integer taborder = 80
  845. string dataobject = "dw_salebilledit_edit"
  846. boolean livescroll = true
  847. borderstyle borderstyle = stylelowered!
  848. end type
  849. event dwnkey;PARENT.TriggerEvent('user_key')
  850. String ls_cuscode
  851. String ls_cusname
  852. Long ll_cusid,uc_row
  853. IF dw_uc.GetColumnName ( ) = 'u_cust_cuscode' AND Key = KeyEnter! THEN
  854. dw_uc.AcceptText()
  855. uc_row = dw_uc.GetRow()
  856. ls_cuscode = Trim(dw_uc.Object.u_cust_cuscode[uc_row])
  857. SELECT cusid,Name INTO :ll_cusid,:ls_cusname FROM u_cust Where cuscode = :ls_cuscode;
  858. dw_uc.SetRedraw(FALSE)
  859. IF sqlca.SQLCode <> 0 THEN
  860. PARENT.TriggerEvent('ue_f9')
  861. RETURN 1
  862. ELSE
  863. dw_uc.Object.u_salebill_cusid[uc_row] = ll_cusid
  864. dw_uc.Object.u_cust_name[uc_row] = ls_cusname
  865. wf_autoadd_mx()
  866. END IF
  867. dw_uc.SetRedraw(TRUE)
  868. dw_uc.SetColumn("u_salebill_accountsid")
  869. RETURN 1
  870. ELSE
  871. IF Key = KeyEnter! OR Key = Keydownarrow! THEN //
  872. keybd_event ( 9, 0, 0 , 0 ) // 按下tab
  873. keybd_event ( 9, 0, 2, 0 ) // 释放tab
  874. RETURN 1
  875. ELSEIF Key = Keyuparrow! THEN
  876. keybd_event ( 16, 0, 0 , 0 )
  877. keybd_event ( 9, 0, 0 , 0 )
  878. keybd_event ( 9, 0, 2, 0 )
  879. keybd_event ( 16, 0, 2, 0 )
  880. RETURN 1
  881. END IF
  882. END IF
  883. //parent.triggerevent('user_key')
  884. //If key = KeyEnter! Then //
  885. //keybd_event ( 9, 0, 0 , 0 ) // 按下tab
  886. //keybd_event ( 9, 0, 2, 0 ) // 释放tab
  887. //Return 1
  888. //End If
  889. //
  890. end event
  891. event rowfocuschanged;IF not dw_edit_mode then
  892. if currentrow >0 THEN
  893. dw_pageretr.SETROW(currentrow)
  894. dw_pageretr.ScrollToRow(currentrow)
  895. dw_pageretr.selectrow(0,false)
  896. dw_pageretr.selectrow(currentrow,true)
  897. end if
  898. // parent.triggerevent('retrieve_childdw')
  899. end if
  900. //if currentrow>0 and not dw_edit_mode then
  901. // if dw_uc.object.flag[currentrow]=1 then
  902. // cb_auditing.enabled=false
  903. // cb_delet.enabled=false
  904. // cb_edit.enabled=false
  905. // cb_addzy.enabled=true
  906. // else
  907. // cb_auditing.enabled=true
  908. // cb_delet.enabled=true
  909. // cb_edit.enabled=true
  910. // cb_addzy.enabled=false
  911. // end if
  912. //else
  913. // cb_auditing.enabled=false
  914. // cb_delet.enabled=false
  915. // cb_edit.enabled=false
  916. // cb_addzy.enabled=false
  917. //end if
  918. end event
  919. event rowfocuschanging;if dw_edit_mode then return 1
  920. end event
  921. event doubleclicked;IF dw_edit_mode and row >0 THEN
  922. parent.triggerevent('ue_f9')
  923. END IF
  924. end event
  925. event buttonclicked;IF dw_edit_mode and row >0 THEN
  926. parent.triggerevent('ue_f9')
  927. END IF
  928. end event
  929. event itemchanged;if row>0 and dw_edit_mode then
  930. if dwo.name='u_salebill_billtype' or dwo.name='u_salebill_moneyid' then
  931. wf_autoadd_mx()
  932. end if
  933. end if
  934. end event
  935. type dw_child from u_dw_rbtnfilter within w_salebill
  936. event dwnkey pbm_dwnkey
  937. integer y = 1300
  938. integer width = 3543
  939. integer height = 876
  940. integer taborder = 30
  941. boolean bringtotop = true
  942. boolean titlebar = true
  943. string title = "单据明细摘要内容"
  944. string dataobject = "dw_salebillmx_edit"
  945. boolean maxbox = true
  946. boolean hscrollbar = true
  947. boolean vscrollbar = true
  948. boolean resizable = true
  949. boolean hsplitscroll = true
  950. borderstyle borderstyle = stylebox!
  951. end type
  952. event dwnkey;call super::dwnkey;If key = KeyEnter! Then //
  953. keybd_event ( 9, 0, 0 , 0 ) // 按下tab
  954. keybd_event ( 9, 0, 2, 0 ) // 释放tab
  955. return 1
  956. End If
  957. parent.triggerevent('user_key')
  958. end event
  959. event constructor;call super::constructor;titleclick_sort_use=true
  960. dw_child_h = THIS.Height
  961. dw_child_w = THIS.Width
  962. end event
  963. event clicked;call super::clicked;IF row>0 and dw_edit_mode THEN
  964. this.setrow(row)
  965. end if
  966. end event
  967. event rowfocuschanged;//IF dw_edit_mode THEN RETURN
  968. IF currentrow <=0 THEN RETURN
  969. this.selectrow(0,false)
  970. this.selectrow(currentrow,true)
  971. end event
  972. type cb_delet from uo_imflatbutton within w_salebill
  973. integer x = 631
  974. integer width = 151
  975. integer height = 172
  976. integer taborder = 250
  977. boolean bringtotop = true
  978. string text = "删除"
  979. string normalpicname = "delete.bmp"
  980. integer picsize = 16
  981. toolbaralignment pic_align = alignattop!
  982. boolean border = false
  983. end type
  984. event clicked;call super::clicked;IF Not f_power_ind(653) THEN
  985. MessageBox('提示','你没有使用权限!',information!,ok!)
  986. RETURN
  987. END IF
  988. IF dw_edit_mode THEN RETURN
  989. IF Not KeyDown(KeyControl!) THEN
  990. IF MessageBox ("询问","是否确定要删除当前单据吗?",Question!,YesNo! ) = 2 THEN RETURN
  991. String arg_msg = ''
  992. Long uc_row
  993. uc_row = dw_pageretr.GetRow()
  994. IF uc_row <= 0 THEN
  995. MessageBox('提示','请选定当前目标单据!',information!,ok!)
  996. RETURN
  997. END IF
  998. string ll_saledscrp
  999. long ll_salebillid
  1000. ll_salebillid = dw_pageretr.Object.u_salebill_salebillid[uc_row]
  1001. Select dscrp Into :ll_saledscrp From u_salebill Where salebillid=:ll_salebillid ;
  1002. IF trim(ll_saledscrp) = "客户收款结算单自动生成" THEN
  1003. MessageBox('错误',"单据为自动类型,请撤审相关单据。")
  1004. return
  1005. END IF
  1006. IF uo_bill.del(dw_pageretr.Object.u_salebill_salebillid[uc_row],arg_msg,True) = 0 THEN
  1007. MessageBox('错误',arg_msg,stopsign!,ok!)
  1008. ELSE
  1009. MessageBox('提示','删除单据'+String(dw_pageretr.Object.u_salebill_salebillcode[uc_row])+'成功!',information!,ok!)
  1010. //日志
  1011. Long ls_id,ls_curid
  1012. String ls_code,ls_opemp
  1013. ls_id = dw_pageretr.Object.u_salebill_salebillid[uc_row]
  1014. ls_curid = dw_pageretr.Object.u_salebill_cusid[uc_row]
  1015. ls_code = dw_pageretr.Object.u_salebill_salebillcode[uc_row]
  1016. ls_opemp = dw_pageretr.Object.u_salebill_opemp[uc_row]
  1017. f_setsysoplog('客户对数单','客户对数单删除,ID:'+String(ls_id)+',客户ID:'+String(ls_curid)+',code:'+ls_code+',建立人:'+ls_opemp,arg_msg,True)
  1018. dw_pageretr.DeleteRow(uc_row)
  1019. dw_pageretr.PostEvent(RowFocusChanged!)
  1020. END IF
  1021. ELSE
  1022. IF MessageBox ("询问","是否确定要批删除列表中未审核的单据?",Question!,YesNo! ) = 2 THEN RETURN
  1023. Long ll_billid, ll_i
  1024. String ls_msg , ll_dscrp
  1025. Int li_flag
  1026. Long ll_suc,ll_fail
  1027. dw_pageretr.AcceptText()
  1028. // li_flag = dw_pageretr.Object.u_salebill_flag[dw_pageretr.GetRow()]
  1029. Open(w_sys_wait_jdt) //初始化进度条
  1030. w_sys_wait_jdt.Show()
  1031. w_sys_wait_jdt.wf_accepttol(dw_pageretr.RowCount())
  1032. FOR ll_i = 1 To dw_pageretr.RowCount()
  1033. w_sys_wait_jdt.st_msg.Text = dw_pageretr.Object.u_salebill_salebillcode[ll_i] + " 正在删除..." //进度信息
  1034. li_flag = dw_pageretr.Object.u_salebill_flag[ll_i]
  1035. IF li_flag = 1 THEN CONTINUE
  1036. ll_billid = dw_pageretr.Object.u_salebill_salebillid[ll_i]
  1037. // ls_taskcode = dw_pageretr.Object.u_salebill_salebillcode[ll_i]
  1038. Select dscrp Into :ll_dscrp From u_salebill Where salebillid=:ll_billid ;
  1039. IF trim(ll_saledscrp) = "客户收款结算单自动生成" THEN
  1040. ll_fail++
  1041. ls_msg = "单据为自动建立类型单据,请撤审相关单据。"
  1042. CONTINUE
  1043. END IF
  1044. IF uo_bill.del(ll_billid,arg_msg,True) = 0 THEN
  1045. ll_fail++
  1046. CONTINUE
  1047. END IF
  1048. ll_suc++
  1049. w_sys_wait_jdt.wf_inc(ll_i) //进度
  1050. NEXT
  1051. Close(w_sys_wait_jdt)
  1052. MessageBox('提示','批删除成功!成功:'+String(ll_suc)+',失败:'+String(ll_fail) + ls_msg,information!,ok!)
  1053. Parent.TriggerEvent('retrieve_pageretr')
  1054. END IF
  1055. end event
  1056. type cb_addzy from uo_imflatbutton within w_salebill
  1057. integer x = 1335
  1058. integer width = 251
  1059. integer height = 172
  1060. integer taborder = 240
  1061. boolean bringtotop = true
  1062. string text = "单据功能"
  1063. string normalpicname = "other.bmp"
  1064. integer picsize = 16
  1065. toolbaralignment pic_align = alignattop!
  1066. boolean border = false
  1067. end type
  1068. event clicked;call super::clicked;m_Dfc_Control_PopupMenu dmPopupMenu
  1069. string menustr
  1070. menustr="Text=增加备注~tEvent=ue_addzy"
  1071. if len(trim(menustr))<>0 then
  1072. dmPopupMenu = Create m_Dfc_Control_PopupMenu
  1073. dmPopupMenu.mf_BuildMenu(This, menustr)
  1074. dmPopupMenu.mf_PopMenu()
  1075. Destroy dmPopupMenu
  1076. end if
  1077. end event
  1078. type cb_auditing from uo_imflatbutton within w_salebill
  1079. integer x = 782
  1080. integer width = 151
  1081. integer height = 172
  1082. integer taborder = 250
  1083. string text = "审核"
  1084. string normalpicname = "audit.bmp"
  1085. integer picsize = 16
  1086. toolbaralignment pic_align = alignattop!
  1087. boolean border = false
  1088. end type
  1089. event clicked;call super::clicked;if not f_power_ind(652) then
  1090. messagebox('提示','你没有使用权限!',information!,ok!)
  1091. return
  1092. end if
  1093. if dw_edit_mode then return
  1094. string arg_msg=''
  1095. long pagerert_row
  1096. pagerert_row=dw_pageretr.getrow()
  1097. if pagerert_row<=0 then
  1098. messagebox('提示','请选定当前目标单据!',information!,ok!)
  1099. return
  1100. end if
  1101. if uo_bill.auditing(dw_pageretr.object.u_salebill_salebillid[pagerert_row],publ_operator,arg_msg,true)=0 then
  1102. messagebox('错误',arg_msg,stopsign!,ok!)
  1103. ELSE
  1104. messagebox('提示','审核成功!',information!,ok!)
  1105. wf_refresh_curuc(dw_pageretr.object.u_salebill_salebillid[pagerert_row])
  1106. end if
  1107. end event
  1108. type cb_cauditing from uo_imflatbutton within w_salebill
  1109. integer x = 933
  1110. integer width = 151
  1111. integer height = 172
  1112. integer taborder = 260
  1113. boolean bringtotop = true
  1114. string text = "撤审"
  1115. string normalpicname = "caudit.bmp"
  1116. integer picsize = 16
  1117. toolbaralignment pic_align = alignattop!
  1118. boolean border = false
  1119. end type
  1120. event clicked;call super::clicked;if not f_power_ind(652) then
  1121. messagebox('提示','你没有使用权限!',information!,ok!)
  1122. return
  1123. end if
  1124. if dw_edit_mode then return
  1125. string arg_msg=''
  1126. long pagerert_row
  1127. pagerert_row=dw_pageretr.getrow()
  1128. if pagerert_row<=0 then
  1129. messagebox('提示','请选定当前目标单据!',information!,ok!)
  1130. return
  1131. end if
  1132. if uo_bill.c_auditing(dw_pageretr.object.u_salebill_salebillid[pagerert_row],publ_operator,arg_msg,true)=0 then
  1133. messagebox('错误',arg_msg,stopsign!,ok!)
  1134. ELSE
  1135. messagebox('提示','撤审成功!',information!,ok!)
  1136. wf_refresh_curuc(dw_pageretr.object.u_salebill_salebillid[pagerert_row])
  1137. end if
  1138. end event
  1139. type cb_print from uo_imflatbutton within w_salebill
  1140. event ue_viewprint ( )
  1141. integer x = 1737
  1142. integer width = 151
  1143. integer height = 172
  1144. integer taborder = 40
  1145. boolean bringtotop = true
  1146. string text = "预览"
  1147. string normalpicname = "preview.bmp"
  1148. integer picsize = 16
  1149. toolbaralignment pic_align = alignattop!
  1150. boolean border = false
  1151. end type
  1152. event ue_viewprint();Long ls_msgprintid
  1153. ls_msgprintid = Message.LongParm
  1154. SELECT dft_new_dwname,powerid,auditprint,prownum
  1155. INTO :ls_newname,:ls_powerid,:li_auditprint,:ll_prownum
  1156. FROM sys_dft_dwprint_dynamic
  1157. Where sys_dft_dwprint_dynamic.dwprintid = :ls_msgprintid USING sqlca;
  1158. IF sqlca.SQLCode <> 0 THEN
  1159. ls_newname = ''
  1160. ls_powerid = 0
  1161. END IF
  1162. IF dw_pageretr.RowCount() = 0 THEN
  1163. MessageBox('提示','没有可打印的单据!', Information!, OK! )
  1164. RETURN
  1165. END IF
  1166. Long LS_ROW
  1167. LS_ROW = dw_pageretr.GetRow()
  1168. IF LS_ROW <= 0 THEN
  1169. MessageBox('提示','没有打印目标单据!', Information!, OK! )
  1170. RETURN
  1171. END IF
  1172. S_print_MSG LS_PRMSG
  1173. IF ls_newname <> '' THEN
  1174. LS_PRMSG.obj_dwNAME = ls_newname
  1175. ELSE
  1176. LS_PRMSG.obj_dwNAME = 'dw_rp_salebill_print'
  1177. END IF
  1178. LS_PRMSG.TAG_TEXT = '客户对数单'
  1179. LS_PRMSG.FILTER_STRING = ''
  1180. LS_PRMSG.retr_pram_falg = 15
  1181. LS_PRMSG.PAGECH_FLAG = 0
  1182. LS_PRMSG.retr_pramnmb = dw_pageretr.Object.u_salebill_salebillid[LS_ROW]
  1183. LS_PRMSG.rowcnt = dw_child.RowCount()
  1184. OpenWithParm(w_publ_preview,LS_PRMSG)
  1185. end event
  1186. event clicked;call super::clicked;String ls_dft_old_dwname, ls_dft_new_dwname,ls_chnname,ls_dwtype
  1187. Long ls_dwprintid
  1188. String ls_windowname
  1189. Int ls_i
  1190. Long ll_billid
  1191. Int li_ifuse
  1192. Long ll_row
  1193. String Name,ll_rpname
  1194. Long ll_RpID,ll_flag,ll_ifuse
  1195. w_curwin = PARENT
  1196. ls_windowname = PARENT.ClassName ( )
  1197. SELECT billid,ifuse
  1198. INTO :ll_billid,
  1199. :li_ifuse
  1200. FROM u_report_bill
  1201. Where winName = :ls_windowname;
  1202. IF sqlca.SQLCode <> 0 THEN
  1203. li_ifuse = 0
  1204. END IF
  1205. IF li_ifuse = 0 THEN
  1206. DECLARE dft_dwprint CURSOR FOR
  1207. SELECT dwprintid,dft_old_dwname, dft_new_dwname, chnname, dwtype
  1208. FROM sys_dft_dwprint_dynamic
  1209. WHERE dwtype = :ls_windowname
  1210. AND ptype = 0 and ifdefault = 0 ;
  1211. OPEN dft_dwprint;
  1212. FETCH dft_dwprint INTO :ls_dwprintid,:ls_dft_old_dwname, :ls_dft_new_dwname,:ls_chnname, :ls_dwtype;
  1213. IF sqlca.SQLCode <> 0 THEN
  1214. TriggerEvent('ue_viewprint',0,0)
  1215. ELSE
  1216. m_dft_dwprint_item m_1
  1217. m_1 = CREATE m_dft_dwprint_item
  1218. ls_i = 1
  1219. DO WHILE sqlca.SQLCode = 0
  1220. f_add_menuItem_dft(m_1,ls_i,ls_chnname,String(ls_dwprintid))
  1221. FETCH dft_dwprint INTO :ls_dwprintid,:ls_dft_old_dwname, :ls_dft_new_dwname,:ls_chnname, :ls_dwtype;
  1222. ls_i++
  1223. LOOP
  1224. CLOSE dft_dwprint;
  1225. m_1.PopMenu(THIS.X+50,THIS.Y+50)
  1226. END IF
  1227. ELSE
  1228. DECLARE rpt_dwprint CURSOR FOR
  1229. SELECT RpID,RpName,Flag,Ifuse
  1230. FROM U_report_list
  1231. WHERE billid = :ll_billid
  1232. Order By RpName;
  1233. OPEN rpt_dwprint;
  1234. FETCH rpt_dwprint INTO :ll_RpID,:ll_rpname,:ll_flag,:ll_ifuse;
  1235. IF sqlca.SQLCode <> 0 THEN
  1236. PARENT.TriggerEvent('ue_rpt_viewprint',0,0)
  1237. ELSE
  1238. m_rpt_dwprint_item m_2
  1239. m_2 = CREATE m_rpt_dwprint_item
  1240. ls_i = 1
  1241. DO WHILE sqlca.SQLCode = 0
  1242. IF f_pow_rpt(ll_RpID) AND ll_ifuse = 1 AND ll_flag = 1 THEN //权限检查f_pow_rpt( )
  1243. f_add_menuItem_rpt(m_2,ls_i,ll_rpname,String(ll_RpID))
  1244. END IF
  1245. FETCH rpt_dwprint INTO :ll_RpID,:ll_rpname,:ll_flag,:ll_ifuse;
  1246. ls_i++
  1247. LOOP
  1248. CLOSE rpt_dwprint;
  1249. m_2.Item[1].Visible = FALSE
  1250. m_2.PopMenu(THIS.X+50,THIS.Y+50)
  1251. END IF
  1252. END IF
  1253. end event
  1254. type cb_retrieve from uo_imflatbutton within w_salebill
  1255. integer width = 151
  1256. integer height = 172
  1257. integer taborder = 40
  1258. string text = "刷新"
  1259. string normalpicname = "refresh.bmp"
  1260. integer picsize = 16
  1261. toolbaralignment pic_align = alignattop!
  1262. boolean border = false
  1263. end type
  1264. event clicked;call super::clicked;parent.triggerevent('retrieve_pageretr')
  1265. end event
  1266. type st_3 from statictext within w_salebill
  1267. integer x = 786
  1268. integer y = 212
  1269. integer width = 201
  1270. integer height = 52
  1271. boolean bringtotop = true
  1272. integer textsize = -9
  1273. integer weight = 400
  1274. fontcharset fontcharset = gb2312charset!
  1275. fontpitch fontpitch = variable!
  1276. string facename = "宋体"
  1277. long textcolor = 33554432
  1278. long backcolor = 134217739
  1279. string text = "状 态:"
  1280. boolean focusrectangle = false
  1281. end type
  1282. type ddlb_status from dropdownlistbox within w_salebill
  1283. integer x = 983
  1284. integer y = 196
  1285. integer width = 352
  1286. integer height = 300
  1287. integer taborder = 50
  1288. boolean bringtotop = true
  1289. integer textsize = -9
  1290. integer weight = 400
  1291. fontcharset fontcharset = gb2312charset!
  1292. fontpitch fontpitch = variable!
  1293. string facename = "宋体"
  1294. long textcolor = 33554432
  1295. string text = "[全部]"
  1296. boolean sorted = false
  1297. string item[] = {"[全部]","待审核","已审核"}
  1298. borderstyle borderstyle = stylelowered!
  1299. end type
  1300. event selectionchanged;if index=1 then
  1301. cur_flag=-1
  1302. elseif index=2 then
  1303. cur_flag=0
  1304. elseif index=3 then
  1305. cur_flag=1
  1306. end if
  1307. parent.triggerevent('retrieve_pageretr')
  1308. end event
  1309. type cb_help from uo_imflatbutton within w_salebill
  1310. string tag = "帮助[F1]"
  1311. integer x = 1586
  1312. integer width = 151
  1313. integer height = 172
  1314. integer taborder = 20
  1315. boolean bringtotop = true
  1316. string text = "帮助"
  1317. string normalpicname = "help.bmp"
  1318. integer picsize = 16
  1319. toolbaralignment pic_align = alignattop!
  1320. boolean border = false
  1321. end type
  1322. event clicked;call super::clicked;parent.triggerevent("ue_help")
  1323. end event
  1324. type cb_add from uo_imflatbutton within w_salebill
  1325. integer x = 302
  1326. integer width = 165
  1327. integer height = 172
  1328. integer taborder = 260
  1329. boolean bringtotop = true
  1330. string text = "新建&S"
  1331. string normalpicname = "new.bmp"
  1332. integer picsize = 16
  1333. toolbaralignment pic_align = alignattop!
  1334. boolean border = false
  1335. end type
  1336. event clicked;call super::clicked;IF NOT f_power_ind(641) THEN
  1337. MessageBox('提示','你没有使用权限!',information!,ok!)
  1338. RETURN
  1339. END IF
  1340. String arg_msg = ''
  1341. Long uc_row,pagerert_row
  1342. Long relid_pageretr,reld_uc
  1343. Long i,ls_moneyid
  1344. IF dw_edit_mode THEN
  1345. dw_uc.AcceptText()
  1346. dw_child.AcceptText()
  1347. uc_row = dw_uc.GetRow()
  1348. IF uc_row <= 0 THEN
  1349. MessageBox('提示','请选定当前目标单据!',information!,ok!)
  1350. RETURN
  1351. END IF
  1352. IF NOT dw_uc.Object.u_salebill_takedate[uc_row] > DateTime(2000-01-01,Now()) THEN
  1353. MessageBox('提示','不合理发生时间!',information!,ok!)
  1354. dw_uc.SetFocus()
  1355. dw_uc.SetColumn("u_salebill_takedate")
  1356. RETURN
  1357. END IF
  1358. IF NOT Len(String(dw_uc.Object.u_salebill_inrep[uc_row])) > 0 THEN
  1359. MessageBox('提示','请填写经手人!',information!,ok!)
  1360. dw_uc.SetFocus()
  1361. dw_uc.SetColumn("u_salebill_inrep")
  1362. RETURN
  1363. END IF
  1364. IF dw_uc.Object.u_salebill_banktypeid[uc_row] <= 0 THEN
  1365. MessageBox('提示','请填写结算方式!',information!,ok!)
  1366. dw_uc.SetFocus()
  1367. dw_uc.SetColumn("u_salebill_banktypeid")
  1368. RETURN
  1369. END IF
  1370. uo_bill.opemp = publ_operator
  1371. uo_bill.takedate = dw_uc.Object.u_salebill_takedate[uc_row]
  1372. uo_bill.relcode = dw_uc.Object.u_salebill_relcode[uc_row]
  1373. uo_bill.inrep = dw_uc.Object.u_salebill_inrep[uc_row]
  1374. uo_bill.banktypeid = dw_uc.Object.u_salebill_banktypeid[uc_row]
  1375. uo_bill.dscrp = dw_uc.Object.u_salebill_dscrp[uc_row]
  1376. uo_bill.cusid = dw_uc.Object.u_salebill_cusid[uc_row]
  1377. uo_bill.msttakeamt = dw_uc.Object.u_salebill_msttakeamt[uc_row]
  1378. uo_bill.takeamt = dw_uc.Object.u_salebill_takeamt[uc_row]
  1379. uo_bill.accountsid = dw_uc.Object.u_salebill_accountsid[uc_row]
  1380. uo_bill.itemid = dw_uc.Object.u_salebill_itemid[uc_row]
  1381. uo_bill.billtype=dw_uc.Object.u_salebill_billtype[uc_row]
  1382. uo_bill.moneyid=dw_uc.object.u_salebill_moneyid[uc_row]
  1383. FOR i = 1 TO dw_child.RowCount()
  1384. IF dw_child.Object.msttakeamt[i] <> 0 OR dw_child.Object.takeamt[i] <> 0 THEN
  1385. IF uo_bill.acceptmx(dw_child.Object.takeid[i],&
  1386. dw_child.Object.billcode[i],&
  1387. dw_child.Object.msttakeamt[i],&
  1388. dw_child.Object.takeamt[i],&
  1389. dw_child.Object.oriamt[i],&
  1390. dw_child.Object.mainmsttakeamt[i],&
  1391. dw_child.Object.maintakeamt[i],&
  1392. '',&
  1393. arg_msg) = 0 THEN
  1394. MessageBox('错误',arg_msg,stopsign!,ok!)
  1395. RETURN
  1396. END IF
  1397. END IF
  1398. NEXT
  1399. IF uo_bill.Save(arg_msg,TRUE) = 0 THEN
  1400. MessageBox('错误',arg_msg,stopsign!,ok!)
  1401. RETURN
  1402. END IF
  1403. MessageBox('提示','保存操作成功!',information!,ok!)
  1404. long ll_row
  1405. ll_row = dw_pageretr.getrow()
  1406. dw_pageretr.SelectRow(0,FALSE)
  1407. dw_pageretr.SelectRow(ll_row,TRUE)
  1408. wf_refresh_curuc(uo_bill.salebillid) //刷新uc
  1409. f_SetProfileString (sys_empid,publ_userid+'_'+dw_uc.DataObject, "moneyid",String(dw_uc.Object.u_salebill_moneyid[dw_uc.GetRow()]))
  1410. ELSE
  1411. IF uo_bill.newbegin() = 0 THEN
  1412. MessageBox('错误',arg_msg,stopsign!,ok!)
  1413. RETURN
  1414. END IF
  1415. END IF
  1416. IF NOT dw_edit_mode THEN
  1417. int li_row
  1418. li_row = dw_pageretr.InsertRow (1)
  1419. dw_pageretr.ScrollToRow(li_row)
  1420. dw_child.RESET()
  1421. dw_uc.reset()
  1422. dw_UC.SetFocus()
  1423. dw_pageretr.RowsCopy(li_row,li_row, Primary!, dw_uc, 1, Primary!)
  1424. ls_moneyid = long(f_ProfileString (sys_empid,publ_userid+'_'+dw_uc.DataObject, "moneyid",'0'))
  1425. dw_uc.Object.u_salebill_moneyid[dw_uc.GetRow()]=ls_moneyid
  1426. END IF
  1427. dw_edit_mode = NOT dw_edit_mode
  1428. wf_refresh_interface()
  1429. end event
  1430. type cb_edit from uo_imflatbutton within w_salebill
  1431. integer x = 466
  1432. integer width = 165
  1433. integer height = 172
  1434. integer taborder = 270
  1435. boolean bringtotop = true
  1436. string text = "修改&E"
  1437. string normalpicname = "open.bmp"
  1438. integer picsize = 16
  1439. toolbaralignment pic_align = alignattop!
  1440. boolean border = false
  1441. end type
  1442. event clicked;call super::clicked;if not f_power_ind(641) then
  1443. messagebox('提示','你没有使用权限!',information!,ok!)
  1444. return
  1445. end if
  1446. string arg_msg=''
  1447. long uc_row
  1448. uc_row=dw_pageretr.getrow()
  1449. if uc_row<=0 then
  1450. messagebox('提示','请选定当前目标单据!',information!,ok!)
  1451. return
  1452. end if
  1453. if not dw_edit_mode then
  1454. if uo_bill.updatebegin(dw_pageretr.object.u_salebill_salebillid[uc_row],arg_msg)=0 then
  1455. messagebox('错误',arg_msg,stopsign!,ok!)
  1456. return
  1457. end if
  1458. end if
  1459. dw_edit_mode= NOT dw_edit_mode
  1460. wf_refresh_interface()
  1461. IF dw_edit_mode THEN
  1462. dw_pageretr.SetFocus()
  1463. parent.triggerevent('retrieve_childdw')
  1464. else
  1465. parent.triggerevent('retrieve_pageretr')
  1466. END IF
  1467. end event
  1468. type cb_reset from uo_imflatbutton within w_salebill
  1469. integer x = 1083
  1470. integer width = 251
  1471. integer height = 172
  1472. integer taborder = 250
  1473. boolean bringtotop = true
  1474. string text = "分配金额"
  1475. string normalpicname = "bill.bmp"
  1476. integer picsize = 16
  1477. toolbaralignment pic_align = alignattop!
  1478. boolean border = false
  1479. end type
  1480. event clicked;//wf_autoadd_mx()
  1481. dw_uc.accepttext()
  1482. dw_child.accepttext()
  1483. long li_row,i
  1484. decimal msttakeamt=0,takeamt=0,mxtakeamt=0
  1485. li_row=dw_uc.getrow()
  1486. if li_row<=0 then
  1487. messagebox('提示','请选择单据',information!,ok!)
  1488. return
  1489. end if
  1490. if dw_child.rowcount()<=0 then
  1491. messagebox('提示','请选择单据明细',information!,ok!)
  1492. return
  1493. end if
  1494. msttakeamt=dw_uc.object.u_salebill_msttakeamt[li_row]
  1495. takeamt=dw_uc.object.u_salebill_takeamt[li_row]
  1496. //第一次循环:分配应付、计算总可分配
  1497. for i=1 to dw_child.rowcount()
  1498. if msttakeamt > 0 then
  1499. if dw_child.object.mainmsttakeamt[i]<=msttakeamt then
  1500. dw_child.object.msttakeamt[i]=dw_child.object.mainmsttakeamt[i]
  1501. msttakeamt=msttakeamt - dw_child.object.mainmsttakeamt[i]
  1502. else
  1503. dw_child.object.msttakeamt[i]=msttakeamt
  1504. msttakeamt=0
  1505. end if
  1506. end if
  1507. takeamt = takeamt - (dw_child.object.mainmsttakeamt[i] - dw_child.object.maintakeamt[i])
  1508. dw_child.object.takeamt[i] = (dw_child.object.mainmsttakeamt[i] - dw_child.object.maintakeamt[i])
  1509. next
  1510. dw_child.accepttext()
  1511. //第二次循环:根据可分配判断正负,修正相关结余(正-负、负-正)
  1512. if takeamt<0 then //不够分配
  1513. for i=dw_child.rowcount() to 1 STEP - 1
  1514. if (dw_child.object.mainmsttakeamt[i] - dw_child.object.maintakeamt[i])<=0 then CONTINUE
  1515. if dw_child.object.mainmsttakeamt[i] - dw_child.object.maintakeamt[i] + takeamt <0 then
  1516. dw_child.object.takeamt[i]=0
  1517. takeamt=takeamt + (dw_child.object.mainmsttakeamt[i] - dw_child.object.maintakeamt[i])
  1518. else
  1519. dw_child.object.takeamt[i]=takeamt + (dw_child.object.mainmsttakeamt[i] - dw_child.object.maintakeamt[i])
  1520. takeamt=0
  1521. end if
  1522. next
  1523. else // 分配有剩
  1524. for i=dw_child.rowcount() to 1 STEP - 1
  1525. if (dw_child.object.mainmsttakeamt[i] - dw_child.object.maintakeamt[i])>=0 then CONTINUE
  1526. if dw_child.object.mainmsttakeamt[i] - dw_child.object.maintakeamt[i] + takeamt >0 then
  1527. dw_child.object.takeamt[i]=0
  1528. takeamt=takeamt + (dw_child.object.mainmsttakeamt[i] - dw_child.object.maintakeamt[i])
  1529. else
  1530. dw_child.object.takeamt[i]=takeamt + (dw_child.object.mainmsttakeamt[i] - dw_child.object.maintakeamt[i])
  1531. takeamt=0
  1532. end if
  1533. next
  1534. end if
  1535. dw_child.accepttext()
  1536. //wf_autoadd_mx()
  1537. //dw_uc.accepttext()
  1538. //dw_child.accepttext()
  1539. //
  1540. //long li_row,i
  1541. //decimal msttakeamt=0,takeamt=0,mxtakeamt=0
  1542. //
  1543. //li_row=dw_uc.getrow()
  1544. //if li_row<=0 then
  1545. // messagebox(publ_operator,'请选择单据')
  1546. // return
  1547. //end if
  1548. //if dw_child.rowcount()<=0 then
  1549. // messagebox(publ_operator,'请单据明细')
  1550. // return
  1551. //end if
  1552. //
  1553. //msttakeamt=dw_uc.object.u_salebill_msttakeamt[li_row]
  1554. //takeamt=dw_uc.object.u_salebill_takeamt[li_row]
  1555. //
  1556. ////第一次循环:分配应付、计算总可分配
  1557. //for i=1 to dw_child.rowcount()
  1558. // if msttakeamt > 0 then
  1559. // if dw_child.object.u_bmsttake_msttakeamt[i]<=msttakeamt then
  1560. // dw_child.object.msttakeamt[i]=dw_child.object.u_bmsttake_msttakeamt[i]
  1561. // msttakeamt=msttakeamt - dw_child.object.u_bmsttake_msttakeamt[i]
  1562. // else
  1563. // dw_child.object.msttakeamt[i]=msttakeamt
  1564. // msttakeamt=0
  1565. // end if
  1566. // end if
  1567. //
  1568. // takeamt = takeamt - (dw_child.object.u_bmsttake_msttakeamt[i] - dw_child.object.u_bmsttake_takeamt[i])
  1569. //
  1570. // dw_child.object.takeamt[i] = (dw_child.object.u_bmsttake_msttakeamt[i] - dw_child.object.u_bmsttake_takeamt[i])
  1571. //
  1572. //next
  1573. //dw_child.accepttext()
  1574. //
  1575. ////第二次循环:根据可分配判断正负,修正相关结余(正-负、负-正)
  1576. //if takeamt<0 then //不够分配
  1577. //
  1578. // for i=dw_child.rowcount() to 1 STEP - 1
  1579. // if (dw_child.object.u_bmsttake_msttakeamt[i] - dw_child.object.u_bmsttake_takeamt[i])<=0 then CONTINUE
  1580. //
  1581. // if dw_child.object.u_bmsttake_msttakeamt[i] - dw_child.object.u_bmsttake_takeamt[i] + takeamt <0 then
  1582. // dw_child.object.takeamt[i]=0
  1583. // takeamt=takeamt + (dw_child.object.u_bmsttake_msttakeamt[i] - dw_child.object.u_bmsttake_takeamt[i])
  1584. // else
  1585. // dw_child.object.takeamt[i]=takeamt + (dw_child.object.u_bmsttake_msttakeamt[i] - dw_child.object.u_bmsttake_takeamt[i])
  1586. // takeamt=0
  1587. // end if
  1588. // next
  1589. //else // 分配有剩
  1590. //
  1591. // for i=dw_child.rowcount() to 1 STEP - 1
  1592. // if (dw_child.object.u_bmsttake_msttakeamt[i] - dw_child.object.u_bmsttake_takeamt[i])>=0 then CONTINUE
  1593. //// if dw_child.Object.u_bmsttake_takeamt[i]=0 then continue
  1594. //
  1595. // if dw_child.object.u_bmsttake_msttakeamt[i] - dw_child.object.u_bmsttake_takeamt[i] + takeamt >0 then
  1596. // dw_child.object.takeamt[i]=0
  1597. // takeamt=takeamt + (dw_child.object.u_bmsttake_msttakeamt[i] - dw_child.object.u_bmsttake_takeamt[i])
  1598. // //dw_child.object.takeamt[i]=takeamt //+ (dw_child.object.u_bmsttake_msttakeamt[i] - dw_child.object.u_bmsttake_takeamt[i])
  1599. // else
  1600. // dw_child.object.takeamt[i]=takeamt + (dw_child.object.u_bmsttake_msttakeamt[i] - dw_child.object.u_bmsttake_takeamt[i])
  1601. // takeamt=0
  1602. // end if
  1603. // next
  1604. //end if
  1605. //dw_child.accepttext()
  1606. //
  1607. ////for i=1 to dw_child.rowcount()
  1608. //// if dw_child.object.u_bmsttake_msttakeamt[i] = 0 then
  1609. //// mxtakeamt = mxtakeamt + dw_child.object.u_bmsttake_takeamt[i]
  1610. //// end if
  1611. ////next
  1612. ////
  1613. ////takeamt = takeamt + mxtakeamt
  1614. ////for i=1 to dw_child.rowcount()
  1615. //// if msttakeamt > 0 then
  1616. //// if dw_child.object.u_bmsttake_msttakeamt[i]<=msttakeamt then
  1617. //// dw_child.object.u_bmsttakemx_msttakeamt[i]=dw_child.object.u_bmsttake_msttakeamt[i]
  1618. //// msttakeamt=msttakeamt - dw_child.object.u_bmsttake_msttakeamt[i]
  1619. //// else
  1620. //// dw_child.object.u_bmsttakemx_msttakeamt[i]=msttakeamt
  1621. //// msttakeamt=0
  1622. //// end if
  1623. //// end if
  1624. ////
  1625. //// if takeamt > 0 then
  1626. //// if dw_child.object.u_bmsttake_msttakeamt[i] - dw_child.object.u_bmsttake_takeamt[i]<=takeamt then
  1627. //// dw_child.object.u_bmsttakemx_takeamt[i]=dw_child.object.u_bmsttake_msttakeamt[i] - dw_child.object.u_bmsttake_takeamt[i]
  1628. //// takeamt=takeamt - (dw_child.object.u_bmsttake_msttakeamt[i] - dw_child.object.u_bmsttake_takeamt[i])
  1629. //// else
  1630. //// dw_child.object.u_bmsttakemx_takeamt[i]=takeamt
  1631. //// takeamt=0
  1632. //// end if
  1633. //// end if
  1634. ////next
  1635. //
  1636. end event
  1637. type ln_bar from line within w_salebill
  1638. long linecolor = 268435456
  1639. integer linethickness = 4
  1640. integer beginy = 176
  1641. integer endx = 3323
  1642. integer endy = 176
  1643. end type
  1644. type ln_bar2 from line within w_salebill
  1645. long linecolor = 16777215
  1646. integer linethickness = 4
  1647. integer beginy = 180
  1648. integer endx = 3323
  1649. integer endy = 180
  1650. end type
  1651. type r_bar from rectangle within w_salebill
  1652. long linecolor = 16777215
  1653. long fillcolor = 1073741824
  1654. integer x = 3360
  1655. integer width = 73
  1656. integer height = 172
  1657. end type
  1658. event constructor;this.fillcolor = 14215660
  1659. this.linecolor = 14215660
  1660. this.x = -1
  1661. this.y = -1
  1662. this.height = ln_bar2.beginy - 5
  1663. end event
  1664. type ln_1 from line within w_salebill
  1665. long linecolor = 268435456
  1666. integer beginy = 284
  1667. integer endx = 3269
  1668. integer endy = 284
  1669. end type
  1670. type ln_2 from line within w_salebill
  1671. long linecolor = 16777215
  1672. integer beginy = 288
  1673. integer endx = 3273
  1674. integer endy = 288
  1675. end type