$PBExportHeader$w_salebill.srw forward global type w_salebill from w_publ_pageretr end type type dw_uc from datawindow within w_salebill end type type dw_child from u_dw_rbtnfilter within w_salebill end type type cb_delet from uo_imflatbutton within w_salebill end type type cb_addzy from uo_imflatbutton within w_salebill end type type cb_auditing from uo_imflatbutton within w_salebill end type type cb_cauditing from uo_imflatbutton within w_salebill end type type cb_print from uo_imflatbutton within w_salebill end type type cb_retrieve from uo_imflatbutton within w_salebill end type type st_3 from statictext within w_salebill end type type ddlb_status from dropdownlistbox within w_salebill end type type cb_help from uo_imflatbutton within w_salebill end type type cb_add from uo_imflatbutton within w_salebill end type type cb_edit from uo_imflatbutton within w_salebill end type type cb_reset from uo_imflatbutton within w_salebill end type type ln_bar from line within w_salebill end type type ln_bar2 from line within w_salebill end type type r_bar from rectangle within w_salebill end type type ln_1 from line within w_salebill end type type ln_2 from line within w_salebill end type end forward global type w_salebill from w_publ_pageretr integer width = 3602 integer height = 2300 string title = "客户对数单" boolean maxbox = true windowstate windowstate = maximized! event retrieve_childdw ( ) event retrieve_childdw_uc ( ) event refresh_interface ( ) event ue_f7 ( ) event ue_f8 ( ) event ue_f9 ( ) event ue_f10 ( ) event ue_f6 ( ) event ue_f11 ( ) event ue_f12 ( ) event ue_addzy ( ) dw_uc dw_uc dw_child dw_child cb_delet cb_delet cb_addzy cb_addzy cb_auditing cb_auditing cb_cauditing cb_cauditing cb_print cb_print cb_retrieve cb_retrieve st_3 st_3 ddlb_status ddlb_status cb_help cb_help cb_add cb_add cb_edit cb_edit cb_reset cb_reset ln_bar ln_bar ln_bar2 ln_bar2 r_bar r_bar ln_1 ln_1 ln_2 ln_2 end type global w_salebill w_salebill type variables int child_column_int=1,uc_column_int=1 uo_salebill uo_bill int cur_flag = -1 long dw_child_w,dw_child_h,dw_pageretr_w,dw_pageretr_h String ls_newname = '' Long ll_prownum Long ls_powerid Int li_auditprint String ls_rpname = '' end variables forward prototypes public function integer wf_refresh_interface () public function integer wf_lock_child () public function integer wf_lock_uc () public subroutine wf_autoadd_mx () public function integer wf_refresh_curuc (long arg_salebillid) public subroutine wf_addnew (long arg_scid, long arg_id) end prototypes event retrieve_childdw;long row,uc_relid row=dw_pageretr.getrow() if row>0 then uc_relid=dw_pageretr.object.u_salebill_salebillid[row] dw_child.SetRedraw (false) dw_child.retrieve(uc_relid) dw_child.SetRedraw (true) else dw_child.reset() end if end event event retrieve_childdw_uc;IF NOT dw_edit_mode THEN dw_uc.Reset() dw_pageretr.RowsCopy(dw_pageretr.GetRow(), dw_pageretr.GetRow(), Primary!, dw_uc, 1, Primary!) END IF end event event refresh_interface;//被 wf_refresh_interface() 调用,用于界面刷新 end event event ue_f7;//cb_add_xm.triggerevent(clicked!) end event event ue_f8;////用于选择明细内容,被F8[默认]\dw_child.doubleclicked调用 //long child_row //if child_row=0 then // messagebox('系统提示','请选定目标明细行!') // return //end if // //s_edit_index_tran s_ch_tran //传递参数使用 //s_ch_tran.if_retrieve_all=false //是否一次RETRIEVE所有行 //s_ch_tran.work_mode=1 //0-单纯编辑模式 1-选择\编辑模式 //s_ch_tran.arg_pkid=0 //目标定位PKID (备用) ////查询列(物料编码)部分内容,用于初步筛选 //s_ch_tran.arg_string_code=trim(dw_child.object.u_mtrldef_mtrlcode[child_row]) // //OPENwithparm(W_materiel,s_ch_tran) //调用 // //S_materiel S_INSCUST //S_INSCUST=Message.PowerObjectParm //接受返回结构 //IF S_INSCUST.mtrlid>0 THEN //正常返回值则可以取以下值 // //dw_child.object.u_mtrldef_mtrlcode[child_row] //dw_child.object.u_mtrldef_unit[child_row] //dw_child.object.u_wasterinwaremx_mtrlid[child_row] //dw_child.object.u_wasterinwaremx_planprice[child_row] //dw_child.object.u_mtrldef_mtrlname[child_row] // ////S_INSCUST.mtrlid ////S_INSCUST.mtrlname ////S_INSCUST.mtrlcode ////S_INSCUST.unit ////S_INSCUST.mtrltype ////S_INSCUST.mtrlmode ////S_INSCUST.planprice // ////S_INSCUST.storageid ////S_INSCUST.cost ////S_INSCUST.price ////S_INSCUST.descrp ////S_INSCUST.source //END IF // end event event ue_f9();IF NOT dw_edit_mode THEN RETURN Long child_row child_row = dw_uc.GetRow() IF child_row = 0 THEN MessageBox('提示','请选定单据!',information!,ok!) RETURN END IF IF NOT IsValid(W_cust_edit) THEN s_edit_index_tran s_ch_tran //传递参数使用 s_ch_tran.if_retrieve_all = local_retrieve_all //是否一次RETRIEVE所有行 s_ch_tran.work_mode = 1 //0-单纯编辑模式 1-选择\编辑模式 s_ch_tran.arg_pkid = 0 //目标定位PKID (备用) s_ch_tran.arg_string_code = ''//查询列(物料编码)部分内容,用于初步筛选 OpenWithParm(W_cust_edit,s_ch_tran) //调用 s_custom S_INSCUST S_INSCUST = Message.PowerObjectParm //接受返回结构 IF S_INSCUST.cusid > 0 THEN //正常返回值则可以取以下值 dw_uc.SetRedraw(FALSE) dw_uc.Object.u_salebill_cusid[child_row] = S_INSCUST.cusid dw_uc.Object.u_cust_name[child_row] = S_INSCUST.Name dw_uc.Object.u_cust_cuscode[child_row] = S_INSCUST.cuscode dw_uc.SetRedraw(TRUE) END IF wf_autoadd_mx() dw_uc.SetColumn("u_salebill_billtype") END IF end event event ue_addzy(); if not f_power_ind(524) then messagebox('提示','你没有使用权限!',information!,ok!) return end if if dw_edit_mode then return string arg_msg='',LS_STR long uc_row s_inputbox S_SREU uc_row=dw_pageretr.getrow() if uc_row<=0 then messagebox('提示','请选定当前目标单据!',information!,ok!) return end if S_SREU.TITLE='请输入要补充到备注的内容' S_SREU.OLD_TEXT='' openwithparm(w_inputbox,S_SREU) LS_STR=Message.StringParm if trim(LS_STR)='' or isnull(LS_STR) then return if uo_bill.add_dscrp(dw_pageretr.object.u_salebill_salebillid[uc_row],LS_STR,arg_msg,true)=0 then messagebox('提示',arg_msg,stopsign!,ok!) return else messagebox('提示','添加备注操作成功!',information!,ok!) wf_refresh_curuc(dw_pageretr.object.u_salebill_salebillid[uc_row]) end if end event public function integer wf_refresh_interface ();//wf_refresh_interface IF dw_edit_mode THEN cb_addzy.Enabled = FALSE cb_retrieve.Enabled = FALSE cb_delet.Enabled = FALSE cb_print.Enabled = FALSE cb_auditing.Enabled = FALSE cb_cauditing.Enabled = FALSE cb_func.Enabled = FALSE dw_pageretr.RBUTTON_FILTER_USE = FALSE //右键查询功能开关 dw_pageretr.titleclick_sort_use = FALSE //单击标题排序功能开关 cb_edit.Enabled = TRUE cb_add.Enabled = TRUE cb_reset.Enabled = TRUE cb_edit.Text = "放弃&E" cb_add.Text = "保存&S" cb_edit.normalpicname = 'Undo.bmp' cb_add.normalpicname = 'Save.bmp' // dw_child.DataObject = 'dw_salebillmx_index' // dw_child.SetTransObject (sqlca) dw_child.Reset() ELSE cb_addzy.Enabled = TRUE cb_retrieve.Enabled = TRUE cb_delet.Enabled = TRUE cb_print.Enabled = TRUE cb_auditing.Enabled = TRUE cb_cauditing.Enabled = TRUE cb_func.Enabled = TRUE cb_reset.Enabled = FALSE dw_pageretr.RBUTTON_FILTER_USE = TRUE //右键查询功能开关 dw_pageretr.titleclick_sort_use = TRUE //单击标题排序功能开关 cb_add.Enabled = TRUE cb_edit.Enabled = TRUE cb_edit.Text = "修改&E" cb_add.Text = "新建&S" cb_edit.normalpicname = 'OPEN.bmp' cb_add.normalpicname = 'new.bmp' // dw_child.DataObject = 'dw_salebillmx_edit' // dw_child.SetTransObject (sqlca) THIS.TriggerEvent('retrieve_childdw') IF dw_pageretr.GetRow() <= 0 THEN cb_addzy.Enabled = FALSE cb_auditing.Enabled = FALSE END IF END IF IF retrieve_all OR dw_edit_mode THEN cb_nextpage.Enabled = FALSE cb_retrieveall.Enabled = FALSE em_pagerowno.Enabled = FALSE sle_usual_query.Enabled = FALSE ELSE cb_nextpage.Enabled = TRUE cb_retrieveall.Enabled = TRUE em_pagerowno.Enabled = TRUE sle_usual_query.Enabled = TRUE END IF wf_lock_child() wf_lock_uc() cb_edit.of_init_draw() cb_add.of_init_draw() cb_edit.of_paint() cb_add.of_paint() cb_add.TriggerEvent('ue_textchange') cb_edit.TriggerEvent('ue_textchange') THIS.TriggerEvent('refresh_interface') RETURN 1 end function public function integer wf_lock_child ();//wf_lock_child INT LS_INT IF dw_edit_mode THEN FOR LS_INT=1 TO child_column_int dw_child.SetTabOrder (LS_INT,LS_INT*10 ) NEXT ELSE FOR LS_INT=1 TO child_column_int dw_child.SetTabOrder (LS_INT, 0) NEXT END IF RETURN 1 end function public function integer wf_lock_uc ();//wf_lock_uc INT LS_INT long ls_row ls_row=dw_uc.getrow() IF dw_edit_mode THEN FOR LS_INT=1 TO uc_column_int dw_uc.SetTabOrder (LS_INT,LS_INT*10 ) NEXT ELSE FOR LS_INT=1 TO uc_column_int dw_uc.SetTabOrder (LS_INT, 0) NEXT END IF if ls_row>0 then dw_uc.setrow(ls_row) RETURN 1 end function public subroutine wf_autoadd_mx ();Long ucrow,ls_cusid,li_row Long ls_takeid,ll_moneyid String ls_billcode Decimal ls_oriamt,ls_Msttakeamt,ls_takeamt DateTime ls_takedate dw_uc.accepttext() ucrow = dw_uc.GetRow() IF ucrow <= 0 THEN RETURN ls_cusid = dw_uc.Object.u_salebill_cusid[ucrow] ll_moneyid=dw_uc.object.u_salebill_moneyid[ucrow] IF ls_cusid = 0 THEN dw_child.Reset() RETURN END IF //dw_child.Reset() // DECLARE take_cur CURSOR FOR // SELECT U_Bmsttake.takeid, // U_Bmsttake.Billcode, // U_Bmsttake.oriamt, // U_Bmsttake.Msttakeamt, // U_Bmsttake.takeamt, // U_Bmsttake.takedate // FROM U_Bmsttake // WHERE U_Bmsttake.finishflag = 0 AND cusid = :ls_cusid // Order By U_Bmsttake.takedate Asc ; // // OPEN take_cur; // FETCH take_cur INTO :ls_takeid,:ls_billcode,:ls_oriamt,:ls_Msttakeamt,:ls_takeamt,:ls_takedate; // DO WHILE sqlca.SQLCode = 0 // li_row = dw_child.InsertRow(0) // dw_child.Object.takeid [li_row] = ls_takeid // dw_child.Object.u_bmsttake_takedate[li_row] = ls_takedate // dw_child.Object.u_bmsttake_oriamt[li_row] = ls_oriamt // dw_child.Object.u_bmsttake_billcode[li_row] = ls_billcode // dw_child.Object.u_bmsttake_msttakeamt[li_row] = ls_Msttakeamt // dw_child.Object.u_bmsttake_takeamt[li_row] = ls_takeamt // // FETCH take_cur INTO :ls_takeid,:ls_billcode,:ls_oriamt,:ls_Msttakeamt,:ls_takeamt,:ls_takedate; // LOOP // CLOSE take_cur; // dw_child.Reset() IF dw_uc.Object.u_salebill_billtype[ucrow] = 1 THEN DECLARE take_cur CURSOR FOR SELECT U_Bmsttake.takeid, U_Bmsttake.Billcode, U_Bmsttake.oriamt, U_Bmsttake.Msttakeamt, U_Bmsttake.takeamt, U_Bmsttake.takedate FROM U_Bmsttake WHERE U_Bmsttake.finishflag = 0 AND cusid = :ls_cusid and U_Bmsttake.Msttakeamt - U_Bmsttake.takeamt>0 and (U_Bmsttake.Msttakeamt<>0) and u_bmsttake.moneyid=:ll_moneyid Order By U_Bmsttake.takedate Asc ; OPEN take_cur; FETCH take_cur INTO :ls_takeid,:ls_billcode,:ls_oriamt,:ls_Msttakeamt,:ls_takeamt,:ls_takedate; DO WHILE sqlca.SQLCode = 0 li_row = dw_child.InsertRow(0) dw_child.Object.takeid [li_row] = ls_takeid dw_child.Object.takedate[li_row] = ls_takedate dw_child.Object.oriamt[li_row] = ls_oriamt dw_child.Object.billcode[li_row] = ls_billcode dw_child.Object.mainmsttakeamt[li_row] = ls_Msttakeamt dw_child.Object.maintakeamt[li_row] = ls_takeamt FETCH take_cur INTO :ls_takeid,:ls_billcode,:ls_oriamt,:ls_Msttakeamt,:ls_takeamt,:ls_takedate; LOOP CLOSE take_cur; ELSEIF dw_uc.Object.u_salebill_billtype[ucrow] = 2 THEN DECLARE take_cur1 CURSOR FOR SELECT U_Bmsttake.takeid, U_Bmsttake.Billcode, U_Bmsttake.oriamt, U_Bmsttake.Msttakeamt, U_Bmsttake.takeamt, U_Bmsttake.takedate FROM U_Bmsttake WHERE U_Bmsttake.finishflag = 0 AND cusid = :ls_cusid and U_Bmsttake.Msttakeamt - U_Bmsttake.takeamt<0 and (U_Bmsttake.Msttakeamt<>0) and u_bmsttake.moneyid=:ll_moneyid Order By U_Bmsttake.takedate Asc ; OPEN take_cur1; FETCH take_cur1 INTO :ls_takeid,:ls_billcode,:ls_oriamt,:ls_Msttakeamt,:ls_takeamt,:ls_takedate; DO WHILE sqlca.SQLCode = 0 li_row = dw_child.InsertRow(0) dw_child.Object.takeid [li_row] = ls_takeid dw_child.Object.takedate[li_row] = ls_takedate dw_child.Object.oriamt[li_row] = ls_oriamt dw_child.Object.billcode[li_row] = ls_billcode dw_child.Object.mainmsttakeamt[li_row] = ls_Msttakeamt dw_child.Object.maintakeamt[li_row] = ls_takeamt FETCH take_cur1 INTO :ls_takeid,:ls_billcode,:ls_oriamt,:ls_Msttakeamt,:ls_takeamt,:ls_takedate; LOOP CLOSE take_cur1; END IF // takeid // u_bmsttake_takedate // u_bmsttake_oriamt // u_bmsttake_billcode // u_bmsttake_msttakeamt // u_bmsttake_takeamt // end subroutine public function integer wf_refresh_curuc (long arg_salebillid);//wf_refresh_curuc IF arg_salebillid <= 0 OR IsNull(arg_salebillid) THEN RETURN 0 Long uc_row uc_row = dw_pageretr.GetRow() IF uc_row <= 0 THEN RETURN 0 String relcode,dscrp,opemp,taketype,auditrep,inrep,salebillcode DateTime takedate,opdate,auditdate Decimal msttakeamt,takeamt Long cusid,moneyid Int flag String custname String cuscode long accountsid long itemid SELECT u_salebill.salebillcode, u_salebill.relcode, u_salebill.takedate, u_salebill.msttakeamt, u_salebill.takeamt, u_salebill.cusid, u_salebill.dscrp, u_salebill.opdate, u_salebill.opemp, u_salebill.taketype, u_salebill.auditdate, u_salebill.auditrep, u_salebill.flag, u_salebill.inrep, u_salebill.moneyid, u_cust.name, u_cust.cuscode , u_salebill.accountsid, u_salebill.itemid INTO :salebillcode, :relcode, :takedate, :msttakeamt, :takeamt, :cusid, :dscrp, :opdate, :opemp, :taketype, :auditdate, :auditrep, :flag, :inrep, :moneyid, :custname , :cuscode , :accountsid, :itemid FROM u_cust INNER JOIN u_salebill ON u_cust.cusid = u_salebill.cusid and ( u_salebill.salebillid = :arg_salebillid ) ; IF sqlca.SQLCode <> 0 THEN MessageBox('错误',"查询操作失败(错误单据唯一码)",stopsign!,ok!) RETURN 0 END IF dw_pageretr.Object.u_salebill_salebillid[uc_row] = arg_salebillid dw_pageretr.Object.u_salebill_salebillcode[uc_row] = salebillcode dw_pageretr.Object.u_salebill_takedate[uc_row] = takedate dw_pageretr.Object.u_salebill_relcode[uc_row] = relcode dw_pageretr.Object.u_salebill_inrep[uc_row] = inrep dw_pageretr.Object.u_salebill_msttakeamt[uc_row] = msttakeamt dw_pageretr.Object.u_salebill_takeamt[uc_row] = takeamt dw_pageretr.Object.u_salebill_dscrp[uc_row] = dscrp dw_pageretr.Object.u_salebill_cusid[uc_row] = cusid dw_pageretr.Object.u_salebill_opdate[uc_row] = opdate dw_pageretr.Object.u_salebill_opemp[uc_row] = opemp dw_pageretr.Object.u_salebill_auditdate[uc_row] = auditdate dw_pageretr.Object.u_salebill_auditrep[uc_row] = auditrep dw_pageretr.Object.u_salebill_flag[uc_row] = flag dw_pageretr.Object.u_salebill_moneyid[uc_row] = moneyid dw_pageretr.Object.u_cust_cuscode[uc_row] = cuscode dw_pageretr.Object.u_cust_name[uc_row] = custname dw_pageretr.Object.u_salebill_accountsid[uc_row] = accountsid dw_pageretr.Object.u_salebill_itemid[uc_row] = itemid dw_uc.Reset() dw_pageretr.RowsCopy(dw_pageretr.GetRow(), dw_pageretr.GetRow(), Primary!, dw_uc, 1, Primary!) dw_uc.ResetUpdate() dw_uc.SetRedraw(TRUE) //wf_flagstatus_rf() RETURN 1 end function public subroutine wf_addnew (long arg_scid, long arg_id);// String ls_cuscode,ls_cusname Long uc_row IF arg_id = 0 THEN RETURN cb_add.TriggerEvent( 'clicked') uc_row = dw_uc.GetRow() SELECT cuscode,name INTO :ls_cuscode,:ls_cusname FROM u_cust Where cusid = :arg_id; dw_uc.SetRedraw(FALSE) IF sqlca.SQLCode <> 0 THEN THIS.TriggerEvent('ue_f9') ELSE dw_uc.Object.u_salebill_cusid[uc_row] = arg_id dw_uc.Object.u_cust_name[uc_row] = ls_cusname dw_uc.Object.u_cust_cuscode[uc_row] = ls_cuscode wf_autoadd_mx() END IF dw_uc.SetRedraw(TRUE) dw_uc.SetColumn("u_salebill_accountsid") end subroutine on w_salebill.create int iCurrent call super::create this.dw_uc=create dw_uc this.dw_child=create dw_child this.cb_delet=create cb_delet this.cb_addzy=create cb_addzy this.cb_auditing=create cb_auditing this.cb_cauditing=create cb_cauditing this.cb_print=create cb_print this.cb_retrieve=create cb_retrieve this.st_3=create st_3 this.ddlb_status=create ddlb_status this.cb_help=create cb_help this.cb_add=create cb_add this.cb_edit=create cb_edit this.cb_reset=create cb_reset this.ln_bar=create ln_bar this.ln_bar2=create ln_bar2 this.r_bar=create r_bar this.ln_1=create ln_1 this.ln_2=create ln_2 iCurrent=UpperBound(this.Control) this.Control[iCurrent+1]=this.dw_uc this.Control[iCurrent+2]=this.dw_child this.Control[iCurrent+3]=this.cb_delet this.Control[iCurrent+4]=this.cb_addzy this.Control[iCurrent+5]=this.cb_auditing this.Control[iCurrent+6]=this.cb_cauditing this.Control[iCurrent+7]=this.cb_print this.Control[iCurrent+8]=this.cb_retrieve this.Control[iCurrent+9]=this.st_3 this.Control[iCurrent+10]=this.ddlb_status this.Control[iCurrent+11]=this.cb_help this.Control[iCurrent+12]=this.cb_add this.Control[iCurrent+13]=this.cb_edit this.Control[iCurrent+14]=this.cb_reset this.Control[iCurrent+15]=this.ln_bar this.Control[iCurrent+16]=this.ln_bar2 this.Control[iCurrent+17]=this.r_bar this.Control[iCurrent+18]=this.ln_1 this.Control[iCurrent+19]=this.ln_2 end on on w_salebill.destroy call super::destroy destroy(this.dw_uc) destroy(this.dw_child) destroy(this.cb_delet) destroy(this.cb_addzy) destroy(this.cb_auditing) destroy(this.cb_cauditing) destroy(this.cb_print) destroy(this.cb_retrieve) destroy(this.st_3) destroy(this.ddlb_status) destroy(this.cb_help) destroy(this.cb_add) destroy(this.cb_edit) destroy(this.cb_reset) destroy(this.ln_bar) destroy(this.ln_bar2) destroy(this.r_bar) destroy(this.ln_1) destroy(this.ln_2) end on event closequery;IF dw_edit_mode THEN Int ls_row = 0 dw_UC.AcceptText() ls_row = dw_UC.GetNextModified(0, Primary!)+& dw_UC.GetNextModified(0, Filter!)+dw_UC.DeletedCount() IF ls_row > 0 THEN IF MessageBox('询问','单据数据已经改变,是否先保存?',Question!,YesNo!,1 ) = 1 THEN RETURN 1 END IF ELSE ls_row = dw_child.GetNextModified(0, Primary!)+& dw_child.GetNextModified(0, Filter!)+dw_child.DeletedCount() IF ls_row > 0 THEN IF MessageBox('询问','单据明细数据已经改变,是否先保存?',Question!,YesNo!,1 ) = 1 THEN RETURN 1 END IF END IF END IF END IF end event event user_key;call super::user_key;IF KeyDown(KeyF6!) THEN this.TRIGGEREVENT('ue_f6') ELSEIF KeyDown(KeyF7!) THEN this.TRIGGEREVENT('ue_f7') ELSEIF KeyDown(KeyF8!) or KeyDown(KeyShift!) and KeyDown(KeyEnter!) THEN this.TRIGGEREVENT('ue_f8') ELSEIF KeyDown(KeyF9!) THEN this.TRIGGEREVENT('ue_f9') ELSEIF KeyDown(KeyF10!) THEN this.TRIGGEREVENT('ue_f10') ELSEIF KeyDown(KeyF11!) THEN this.TRIGGEREVENT('ue_f11') ELSEIF KeyDown(KeyF12!) THEN this.TRIGGEREVENT('ue_f12') elseIF KeyDown(KeyF1!) THEN this.TriggerEvent("ue_help") end if end event event open;this.triggerevent('ue_before_open') wf_movetocenter() if_ue_retr=true if_ue_filter=true if_ue_sort=true OLD_TITLE=THIS.TITLE s_tran=Message.PowerObjectParm IF not ISNULL(s_tran) then retrieve_all=s_tran.if_retrieve_all mode=s_tran.work_mode arg_pkid=s_tran.arg_pkid arg_string_code=s_tran.arg_string_code if_sharedata=s_tran.if_sharedata //是否应用sharedata,当retrieve_all=true是生效 ds_share=s_tran.ds_share end if //CHOOSE CASE MODE // CASE 0 // THIS.TITLE=OLD_TITLE+' 编辑模式 [F4-新建/保存 F5-编辑/放弃]' // CASE 1 // THIS.TITLE=OLD_TITLE+' 选择模式 [F4-新建/保存 F5-编辑/放弃]' //END CHOOSE dw_pageretr.RBUTTON_FILTER_USE=true //右键查询功能开关 dw_pageretr.titleclick_sort_use=true //单击标题排序功能开关 dw_pageretr.SetTransObject (sqlca) //pkcolumndbtname=dw_pageretr.Describe("#1.dbname") //取第一列为关键字 pkcolumndbtname=wf_get_pkcolumndbtname(dw_pageretr) //取第一列为关键字 ori_oldselect=dw_pageretr.Describe("DataWindow.Table.Select") ls_newselect=ori_oldselect ds_curquery=CREATE DATASTORE ds_curquery.DATAOBJECT='d_extr_find' ds_curquery.SetTransObject (sqlca) //if mode=1 then cb_mode_itfchg.TRIGGEREVENT(CLICKED!) wf_editindex_lockf() sle_usual_query.text=trim(arg_string_code) if NOT retrieve_all then THIS.TRIGGEREVENT("ue_usual_query_RETR") //修改ls_newselect,retrieve else if if_sharedata then ds_share.sharedata(dw_pageretr) else wf_retrieveuc(dw_pageretr,ls_newselect,1) this.TRIGGEREVENT('RETRIEVE_pageretr') end if end if IF retrieve_all THEN THIS.TRIGGEREVENT("ue_usual_query_filt") END IF wf_refresh_interface() uc_column_int=13 //uc dw前8列可以编辑 child_column_int=4 //子dw前4列可以编辑 uo_bill=create uo_salebill IF not ISNULL(s_tran) then if s_tran.b_long>0 then wf_addnew(s_tran.c_long , s_tran.b_long) end if end if end event event ue_before_open;dw_child.settransobject(sqlca) dw_uc.settransobject(sqlca) end event event retrieve_pageretr;Boolean cb_firstpage_enabled,cb_nextpage_enabled,cb_retrieveall_enabled Boolean cb_priorpage_enabled,cb_retrieve_enabled cb_nextpage_enabled = cb_nextpage.Enabled cb_retrieveall_enabled = cb_retrieveall.Enabled cb_nextpage.Enabled = FALSE cb_retrieveall.Enabled = FALSE datawindowchild childdw dw_uc.SetTransObject (sqlca) dw_uc.GetChild("u_salebill_accountsid",childdw) childdw.SetTransObject (sqlca) IF childdw.Retrieve(sys_user_account) = 0 THEN childdw.InsertRow(0) END IF dw_uc.Retrieve() dw_pageretr.Retrieve(cur_flag,sys_areaid) IF dw_pageretr.RowCount() > 0 THEN dw_pageretr.SetRow(1) dw_pageretr.triggerevent(rowfocuschanged!) end if //THIS.TriggerEvent('retreve_childdw') cb_nextpage.Enabled = cb_nextpage_enabled cb_retrieveall.Enabled = cb_retrieveall_enabled end event event key;this.triggerevent('user_key') end event event ue_usual_query_retr;call super::ue_usual_query_retr;string ls_querystrpart='' ls_newselect=lower(ori_oldselect) if trim(sle_usual_query.text)<>'' then if pos(trim(sle_usual_query.text),'%')=0 then ls_querystrpart="( u_salebill.salebillcode like '%"+trim(sle_usual_query.text)+"%')" else ls_querystrpart="( u_salebill.salebillcode like '"+trim(sle_usual_query.text)+"')" end if if Pos(ls_newselect," where ") <> 0 then ls_newselect=ls_newselect+" AND ("+ls_querystrpart+')' else ls_newselect=ls_newselect+" where ("+ls_querystrpart+')' end if end if wf_retrieveuc(dw_pageretr,ls_newselect,1) this.triggerevent('retrieve_pageretr') end event event ue_usual_query_filt;call super::ue_usual_query_filt;string obj_expr='' if trim(sle_usual_query.text)<>'' then IF POS(trim(sle_usual_query.text),'%')=0 THEN obj_expr=obj_expr+'( u_salebill_salebillcode LIKE "%'+trim(sle_usual_query.text)+'%" )' ELSE obj_expr=obj_expr+'( u_salebill_salebillcode LIKE "'+trim(sle_usual_query.text)+'" )' END IF end if dw_pageretr.setfilter(obj_expr) dw_pageretr.SetRedraw(False) dw_pageretr.filter() if dw_pageretr.rowcount()>=1 then dw_pageretr.selectrow(0,false) dw_pageretr.selectrow(1,true) end if dw_pageretr.SetRedraw(TRUE) end event event resize;call super::resize;ln_bar.EndX = THIS.Width ln_bar2.EndX = THIS.Width ln_1.EndX = THIS.Width ln_2.EndX = THIS.Width r_bar.Width = THIS.Width Long w_width,w_height w_width = 3602 w_height = 2300 IF newwidth < w_width THEN THIS.Width = w_width IF newheight < w_height THEN THIS.Height = w_height dw_child.Width = THIS.Width - (w_width - dw_child_w) dw_child.Height = THIS.Height - (w_height - dw_child_h) dw_pageretr.Width = THIS.Width - (w_width - dw_pageretr_w) end event type cb_func from w_publ_pageretr`cb_func within w_salebill integer x = 151 integer y = 0 integer width = 151 integer height = 172 end type type cb_exit from w_publ_pageretr`cb_exit within w_salebill integer x = 1888 integer y = 0 integer width = 151 integer height = 172 integer taborder = 230 integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type type sle_usual_query from w_publ_pageretr`sle_usual_query within w_salebill integer x = 229 integer y = 188 integer width = 521 boolean bringtotop = true end type type cb_retrieveall from w_publ_pageretr`cb_retrieveall within w_salebill integer x = 2482 integer height = 172 integer taborder = 180 string normalpicname = "p1.ico" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type type em_pagerowno from w_publ_pageretr`em_pagerowno within w_salebill integer x = 2139 integer y = 68 integer width = 334 integer taborder = 160 boolean bringtotop = true end type type dw_pageretr from w_publ_pageretr`dw_pageretr within w_salebill event retrieve_childdw_uc ( ) integer x = 2007 integer y = 288 integer width = 1536 integer height = 1012 boolean bringtotop = true string title = "单据摘要内容" string dataobject = "dw_salebilledit_index" end type event dw_pageretr::retrieve_childdw_uc();IF NOT dw_edit_mode THEN dw_uc.Reset() dw_pageretr.RowsCopy(dw_pageretr.GetRow(), dw_pageretr.GetRow(), Primary!, dw_uc, 1, Primary!) END IF end event event dw_pageretr::rowfocuschanged;call super::rowfocuschanged;IF NOT dw_edit_mode THEN PARENT.TriggerEvent('retrieve_childdw_uc') PARENT.TriggerEvent('retrieve_childdw') END IF DW_UC.SETROW(currentrow) DW_UC.ScrollToRow (currentrow) end event event dw_pageretr::ue_after_filter;if not dw_edit_mode then parent.triggerevent('retrieve_childdw') end event event dw_pageretr::constructor;call super::constructor;dw_pageretr_w = this.width dw_pageretr_h = this.height end event type st_1 from w_publ_pageretr`st_1 within w_salebill integer x = 32 integer y = 212 integer width = 210 string text = "单号含:" end type type cb_nextpage from w_publ_pageretr`cb_nextpage within w_salebill integer x = 2647 integer width = 64 integer height = 172 integer taborder = 220 string normalpicname = "p4.ico" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type type dw_uc from datawindow within w_salebill event dwnkey pbm_dwnkey integer y = 300 integer width = 2011 integer height = 996 integer taborder = 80 string dataobject = "dw_salebilledit_edit" boolean livescroll = true borderstyle borderstyle = stylelowered! end type event dwnkey;PARENT.TriggerEvent('user_key') String ls_cuscode String ls_cusname Long ll_cusid,uc_row IF dw_uc.GetColumnName ( ) = 'u_cust_cuscode' AND Key = KeyEnter! THEN dw_uc.AcceptText() uc_row = dw_uc.GetRow() ls_cuscode = Trim(dw_uc.Object.u_cust_cuscode[uc_row]) SELECT cusid,Name INTO :ll_cusid,:ls_cusname FROM u_cust Where cuscode = :ls_cuscode; dw_uc.SetRedraw(FALSE) IF sqlca.SQLCode <> 0 THEN PARENT.TriggerEvent('ue_f9') RETURN 1 ELSE dw_uc.Object.u_salebill_cusid[uc_row] = ll_cusid dw_uc.Object.u_cust_name[uc_row] = ls_cusname wf_autoadd_mx() END IF dw_uc.SetRedraw(TRUE) dw_uc.SetColumn("u_salebill_accountsid") RETURN 1 ELSE IF Key = KeyEnter! OR Key = Keydownarrow! THEN // keybd_event ( 9, 0, 0 , 0 ) // 按下tab keybd_event ( 9, 0, 2, 0 ) // 释放tab RETURN 1 ELSEIF Key = Keyuparrow! THEN keybd_event ( 16, 0, 0 , 0 ) keybd_event ( 9, 0, 0 , 0 ) keybd_event ( 9, 0, 2, 0 ) keybd_event ( 16, 0, 2, 0 ) RETURN 1 END IF END IF //parent.triggerevent('user_key') //If key = KeyEnter! Then // //keybd_event ( 9, 0, 0 , 0 ) // 按下tab //keybd_event ( 9, 0, 2, 0 ) // 释放tab //Return 1 //End If // end event event rowfocuschanged;IF not dw_edit_mode then if currentrow >0 THEN dw_pageretr.SETROW(currentrow) dw_pageretr.ScrollToRow(currentrow) dw_pageretr.selectrow(0,false) dw_pageretr.selectrow(currentrow,true) end if // parent.triggerevent('retrieve_childdw') end if //if currentrow>0 and not dw_edit_mode then // if dw_uc.object.flag[currentrow]=1 then // cb_auditing.enabled=false // cb_delet.enabled=false // cb_edit.enabled=false // cb_addzy.enabled=true // else // cb_auditing.enabled=true // cb_delet.enabled=true // cb_edit.enabled=true // cb_addzy.enabled=false // end if //else // cb_auditing.enabled=false // cb_delet.enabled=false // cb_edit.enabled=false // cb_addzy.enabled=false //end if end event event rowfocuschanging;if dw_edit_mode then return 1 end event event doubleclicked;IF dw_edit_mode and row >0 THEN parent.triggerevent('ue_f9') END IF end event event buttonclicked;IF dw_edit_mode and row >0 THEN parent.triggerevent('ue_f9') END IF end event event itemchanged;if row>0 and dw_edit_mode then if dwo.name='u_salebill_billtype' or dwo.name='u_salebill_moneyid' then wf_autoadd_mx() end if end if end event type dw_child from u_dw_rbtnfilter within w_salebill event dwnkey pbm_dwnkey integer y = 1300 integer width = 3543 integer height = 876 integer taborder = 30 boolean bringtotop = true boolean titlebar = true string title = "单据明细摘要内容" string dataobject = "dw_salebillmx_edit" boolean maxbox = true boolean hscrollbar = true boolean vscrollbar = true boolean resizable = true boolean hsplitscroll = true borderstyle borderstyle = stylebox! end type event dwnkey;call super::dwnkey;If key = KeyEnter! Then // keybd_event ( 9, 0, 0 , 0 ) // 按下tab keybd_event ( 9, 0, 2, 0 ) // 释放tab return 1 End If parent.triggerevent('user_key') end event event constructor;call super::constructor;titleclick_sort_use=true dw_child_h = THIS.Height dw_child_w = THIS.Width end event event clicked;call super::clicked;IF row>0 and dw_edit_mode THEN this.setrow(row) end if end event event rowfocuschanged;//IF dw_edit_mode THEN RETURN IF currentrow <=0 THEN RETURN this.selectrow(0,false) this.selectrow(currentrow,true) end event type cb_delet from uo_imflatbutton within w_salebill integer x = 631 integer width = 151 integer height = 172 integer taborder = 250 boolean bringtotop = true string text = "删除" string normalpicname = "delete.bmp" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;IF Not f_power_ind(653) THEN MessageBox('提示','你没有使用权限!',information!,ok!) RETURN END IF IF dw_edit_mode THEN RETURN IF Not KeyDown(KeyControl!) THEN IF MessageBox ("询问","是否确定要删除当前单据吗?",Question!,YesNo! ) = 2 THEN RETURN String arg_msg = '' Long uc_row uc_row = dw_pageretr.GetRow() IF uc_row <= 0 THEN MessageBox('提示','请选定当前目标单据!',information!,ok!) RETURN END IF string ll_saledscrp long ll_salebillid ll_salebillid = dw_pageretr.Object.u_salebill_salebillid[uc_row] Select dscrp Into :ll_saledscrp From u_salebill Where salebillid=:ll_salebillid ; IF trim(ll_saledscrp) = "客户收款结算单自动生成" THEN MessageBox('错误',"单据为自动类型,请撤审相关单据。") return END IF IF uo_bill.del(dw_pageretr.Object.u_salebill_salebillid[uc_row],arg_msg,True) = 0 THEN MessageBox('错误',arg_msg,stopsign!,ok!) ELSE MessageBox('提示','删除单据'+String(dw_pageretr.Object.u_salebill_salebillcode[uc_row])+'成功!',information!,ok!) //日志 Long ls_id,ls_curid String ls_code,ls_opemp ls_id = dw_pageretr.Object.u_salebill_salebillid[uc_row] ls_curid = dw_pageretr.Object.u_salebill_cusid[uc_row] ls_code = dw_pageretr.Object.u_salebill_salebillcode[uc_row] ls_opemp = dw_pageretr.Object.u_salebill_opemp[uc_row] f_setsysoplog('客户对数单','客户对数单删除,ID:'+String(ls_id)+',客户ID:'+String(ls_curid)+',code:'+ls_code+',建立人:'+ls_opemp,arg_msg,True) dw_pageretr.DeleteRow(uc_row) dw_pageretr.PostEvent(RowFocusChanged!) END IF ELSE IF MessageBox ("询问","是否确定要批删除列表中未审核的单据?",Question!,YesNo! ) = 2 THEN RETURN Long ll_billid, ll_i String ls_msg , ll_dscrp Int li_flag Long ll_suc,ll_fail dw_pageretr.AcceptText() // li_flag = dw_pageretr.Object.u_salebill_flag[dw_pageretr.GetRow()] Open(w_sys_wait_jdt) //初始化进度条 w_sys_wait_jdt.Show() w_sys_wait_jdt.wf_accepttol(dw_pageretr.RowCount()) FOR ll_i = 1 To dw_pageretr.RowCount() w_sys_wait_jdt.st_msg.Text = dw_pageretr.Object.u_salebill_salebillcode[ll_i] + " 正在删除..." //进度信息 li_flag = dw_pageretr.Object.u_salebill_flag[ll_i] IF li_flag = 1 THEN CONTINUE ll_billid = dw_pageretr.Object.u_salebill_salebillid[ll_i] // ls_taskcode = dw_pageretr.Object.u_salebill_salebillcode[ll_i] Select dscrp Into :ll_dscrp From u_salebill Where salebillid=:ll_billid ; IF trim(ll_saledscrp) = "客户收款结算单自动生成" THEN ll_fail++ ls_msg = "单据为自动建立类型单据,请撤审相关单据。" CONTINUE END IF IF uo_bill.del(ll_billid,arg_msg,True) = 0 THEN ll_fail++ CONTINUE END IF ll_suc++ w_sys_wait_jdt.wf_inc(ll_i) //进度 NEXT Close(w_sys_wait_jdt) MessageBox('提示','批删除成功!成功:'+String(ll_suc)+',失败:'+String(ll_fail) + ls_msg,information!,ok!) Parent.TriggerEvent('retrieve_pageretr') END IF end event type cb_addzy from uo_imflatbutton within w_salebill integer x = 1335 integer width = 251 integer height = 172 integer taborder = 240 boolean bringtotop = true string text = "单据功能" string normalpicname = "other.bmp" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;m_Dfc_Control_PopupMenu dmPopupMenu string menustr menustr="Text=增加备注~tEvent=ue_addzy" if len(trim(menustr))<>0 then dmPopupMenu = Create m_Dfc_Control_PopupMenu dmPopupMenu.mf_BuildMenu(This, menustr) dmPopupMenu.mf_PopMenu() Destroy dmPopupMenu end if end event type cb_auditing from uo_imflatbutton within w_salebill integer x = 782 integer width = 151 integer height = 172 integer taborder = 250 string text = "审核" string normalpicname = "audit.bmp" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;if not f_power_ind(652) then messagebox('提示','你没有使用权限!',information!,ok!) return end if if dw_edit_mode then return string arg_msg='' long pagerert_row pagerert_row=dw_pageretr.getrow() if pagerert_row<=0 then messagebox('提示','请选定当前目标单据!',information!,ok!) return end if if uo_bill.auditing(dw_pageretr.object.u_salebill_salebillid[pagerert_row],publ_operator,arg_msg,true)=0 then messagebox('错误',arg_msg,stopsign!,ok!) ELSE messagebox('提示','审核成功!',information!,ok!) wf_refresh_curuc(dw_pageretr.object.u_salebill_salebillid[pagerert_row]) end if end event type cb_cauditing from uo_imflatbutton within w_salebill integer x = 933 integer width = 151 integer height = 172 integer taborder = 260 boolean bringtotop = true string text = "撤审" string normalpicname = "caudit.bmp" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;if not f_power_ind(652) then messagebox('提示','你没有使用权限!',information!,ok!) return end if if dw_edit_mode then return string arg_msg='' long pagerert_row pagerert_row=dw_pageretr.getrow() if pagerert_row<=0 then messagebox('提示','请选定当前目标单据!',information!,ok!) return end if if uo_bill.c_auditing(dw_pageretr.object.u_salebill_salebillid[pagerert_row],publ_operator,arg_msg,true)=0 then messagebox('错误',arg_msg,stopsign!,ok!) ELSE messagebox('提示','撤审成功!',information!,ok!) wf_refresh_curuc(dw_pageretr.object.u_salebill_salebillid[pagerert_row]) end if end event type cb_print from uo_imflatbutton within w_salebill event ue_viewprint ( ) integer x = 1737 integer width = 151 integer height = 172 integer taborder = 40 boolean bringtotop = true string text = "预览" string normalpicname = "preview.bmp" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event ue_viewprint();Long ls_msgprintid ls_msgprintid = Message.LongParm SELECT dft_new_dwname,powerid,auditprint,prownum INTO :ls_newname,:ls_powerid,:li_auditprint,:ll_prownum FROM sys_dft_dwprint_dynamic Where sys_dft_dwprint_dynamic.dwprintid = :ls_msgprintid USING sqlca; IF sqlca.SQLCode <> 0 THEN ls_newname = '' ls_powerid = 0 END IF IF dw_pageretr.RowCount() = 0 THEN MessageBox('提示','没有可打印的单据!', Information!, OK! ) RETURN END IF Long LS_ROW LS_ROW = dw_pageretr.GetRow() IF LS_ROW <= 0 THEN MessageBox('提示','没有打印目标单据!', Information!, OK! ) RETURN END IF S_print_MSG LS_PRMSG IF ls_newname <> '' THEN LS_PRMSG.obj_dwNAME = ls_newname ELSE LS_PRMSG.obj_dwNAME = 'dw_rp_salebill_print' END IF LS_PRMSG.TAG_TEXT = '客户对数单' LS_PRMSG.FILTER_STRING = '' LS_PRMSG.retr_pram_falg = 15 LS_PRMSG.PAGECH_FLAG = 0 LS_PRMSG.retr_pramnmb = dw_pageretr.Object.u_salebill_salebillid[LS_ROW] LS_PRMSG.rowcnt = dw_child.RowCount() OpenWithParm(w_publ_preview,LS_PRMSG) end event event clicked;call super::clicked;String ls_dft_old_dwname, ls_dft_new_dwname,ls_chnname,ls_dwtype Long ls_dwprintid String ls_windowname Int ls_i Long ll_billid Int li_ifuse Long ll_row String Name,ll_rpname Long ll_RpID,ll_flag,ll_ifuse w_curwin = PARENT ls_windowname = PARENT.ClassName ( ) SELECT billid,ifuse INTO :ll_billid, :li_ifuse FROM u_report_bill Where winName = :ls_windowname; IF sqlca.SQLCode <> 0 THEN li_ifuse = 0 END IF IF li_ifuse = 0 THEN DECLARE dft_dwprint CURSOR FOR SELECT dwprintid,dft_old_dwname, dft_new_dwname, chnname, dwtype FROM sys_dft_dwprint_dynamic WHERE dwtype = :ls_windowname AND ptype = 0 and ifdefault = 0 ; OPEN dft_dwprint; FETCH dft_dwprint INTO :ls_dwprintid,:ls_dft_old_dwname, :ls_dft_new_dwname,:ls_chnname, :ls_dwtype; IF sqlca.SQLCode <> 0 THEN TriggerEvent('ue_viewprint',0,0) ELSE m_dft_dwprint_item m_1 m_1 = CREATE m_dft_dwprint_item ls_i = 1 DO WHILE sqlca.SQLCode = 0 f_add_menuItem_dft(m_1,ls_i,ls_chnname,String(ls_dwprintid)) FETCH dft_dwprint INTO :ls_dwprintid,:ls_dft_old_dwname, :ls_dft_new_dwname,:ls_chnname, :ls_dwtype; ls_i++ LOOP CLOSE dft_dwprint; m_1.PopMenu(THIS.X+50,THIS.Y+50) END IF ELSE DECLARE rpt_dwprint CURSOR FOR SELECT RpID,RpName,Flag,Ifuse FROM U_report_list WHERE billid = :ll_billid Order By RpName; OPEN rpt_dwprint; FETCH rpt_dwprint INTO :ll_RpID,:ll_rpname,:ll_flag,:ll_ifuse; IF sqlca.SQLCode <> 0 THEN PARENT.TriggerEvent('ue_rpt_viewprint',0,0) ELSE m_rpt_dwprint_item m_2 m_2 = CREATE m_rpt_dwprint_item ls_i = 1 DO WHILE sqlca.SQLCode = 0 IF f_pow_rpt(ll_RpID) AND ll_ifuse = 1 AND ll_flag = 1 THEN //权限检查f_pow_rpt( ) f_add_menuItem_rpt(m_2,ls_i,ll_rpname,String(ll_RpID)) END IF FETCH rpt_dwprint INTO :ll_RpID,:ll_rpname,:ll_flag,:ll_ifuse; ls_i++ LOOP CLOSE rpt_dwprint; m_2.Item[1].Visible = FALSE m_2.PopMenu(THIS.X+50,THIS.Y+50) END IF END IF end event type cb_retrieve from uo_imflatbutton within w_salebill integer width = 151 integer height = 172 integer taborder = 40 string text = "刷新" string normalpicname = "refresh.bmp" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;parent.triggerevent('retrieve_pageretr') end event type st_3 from statictext within w_salebill integer x = 786 integer y = 212 integer width = 201 integer height = 52 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 134217739 string text = "状 态:" boolean focusrectangle = false end type type ddlb_status from dropdownlistbox within w_salebill integer x = 983 integer y = 196 integer width = 352 integer height = 300 integer taborder = 50 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 string text = "[全部]" boolean sorted = false string item[] = {"[全部]","待审核","已审核"} borderstyle borderstyle = stylelowered! end type event selectionchanged;if index=1 then cur_flag=-1 elseif index=2 then cur_flag=0 elseif index=3 then cur_flag=1 end if parent.triggerevent('retrieve_pageretr') end event type cb_help from uo_imflatbutton within w_salebill string tag = "帮助[F1]" integer x = 1586 integer width = 151 integer height = 172 integer taborder = 20 boolean bringtotop = true string text = "帮助" string normalpicname = "help.bmp" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;parent.triggerevent("ue_help") end event type cb_add from uo_imflatbutton within w_salebill integer x = 302 integer width = 165 integer height = 172 integer taborder = 260 boolean bringtotop = true string text = "新建&S" string normalpicname = "new.bmp" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;IF NOT f_power_ind(641) THEN MessageBox('提示','你没有使用权限!',information!,ok!) RETURN END IF String arg_msg = '' Long uc_row,pagerert_row Long relid_pageretr,reld_uc Long i,ls_moneyid IF dw_edit_mode THEN dw_uc.AcceptText() dw_child.AcceptText() uc_row = dw_uc.GetRow() IF uc_row <= 0 THEN MessageBox('提示','请选定当前目标单据!',information!,ok!) RETURN END IF IF NOT dw_uc.Object.u_salebill_takedate[uc_row] > DateTime(2000-01-01,Now()) THEN MessageBox('提示','不合理发生时间!',information!,ok!) dw_uc.SetFocus() dw_uc.SetColumn("u_salebill_takedate") RETURN END IF IF NOT Len(String(dw_uc.Object.u_salebill_inrep[uc_row])) > 0 THEN MessageBox('提示','请填写经手人!',information!,ok!) dw_uc.SetFocus() dw_uc.SetColumn("u_salebill_inrep") RETURN END IF IF dw_uc.Object.u_salebill_banktypeid[uc_row] <= 0 THEN MessageBox('提示','请填写结算方式!',information!,ok!) dw_uc.SetFocus() dw_uc.SetColumn("u_salebill_banktypeid") RETURN END IF uo_bill.opemp = publ_operator uo_bill.takedate = dw_uc.Object.u_salebill_takedate[uc_row] uo_bill.relcode = dw_uc.Object.u_salebill_relcode[uc_row] uo_bill.inrep = dw_uc.Object.u_salebill_inrep[uc_row] uo_bill.banktypeid = dw_uc.Object.u_salebill_banktypeid[uc_row] uo_bill.dscrp = dw_uc.Object.u_salebill_dscrp[uc_row] uo_bill.cusid = dw_uc.Object.u_salebill_cusid[uc_row] uo_bill.msttakeamt = dw_uc.Object.u_salebill_msttakeamt[uc_row] uo_bill.takeamt = dw_uc.Object.u_salebill_takeamt[uc_row] uo_bill.accountsid = dw_uc.Object.u_salebill_accountsid[uc_row] uo_bill.itemid = dw_uc.Object.u_salebill_itemid[uc_row] uo_bill.billtype=dw_uc.Object.u_salebill_billtype[uc_row] uo_bill.moneyid=dw_uc.object.u_salebill_moneyid[uc_row] FOR i = 1 TO dw_child.RowCount() IF dw_child.Object.msttakeamt[i] <> 0 OR dw_child.Object.takeamt[i] <> 0 THEN IF uo_bill.acceptmx(dw_child.Object.takeid[i],& dw_child.Object.billcode[i],& dw_child.Object.msttakeamt[i],& dw_child.Object.takeamt[i],& dw_child.Object.oriamt[i],& dw_child.Object.mainmsttakeamt[i],& dw_child.Object.maintakeamt[i],& '',& arg_msg) = 0 THEN MessageBox('错误',arg_msg,stopsign!,ok!) RETURN END IF END IF NEXT IF uo_bill.Save(arg_msg,TRUE) = 0 THEN MessageBox('错误',arg_msg,stopsign!,ok!) RETURN END IF MessageBox('提示','保存操作成功!',information!,ok!) long ll_row ll_row = dw_pageretr.getrow() dw_pageretr.SelectRow(0,FALSE) dw_pageretr.SelectRow(ll_row,TRUE) wf_refresh_curuc(uo_bill.salebillid) //刷新uc f_SetProfileString (sys_empid,publ_userid+'_'+dw_uc.DataObject, "moneyid",String(dw_uc.Object.u_salebill_moneyid[dw_uc.GetRow()])) ELSE IF uo_bill.newbegin() = 0 THEN MessageBox('错误',arg_msg,stopsign!,ok!) RETURN END IF END IF IF NOT dw_edit_mode THEN int li_row li_row = dw_pageretr.InsertRow (1) dw_pageretr.ScrollToRow(li_row) dw_child.RESET() dw_uc.reset() dw_UC.SetFocus() dw_pageretr.RowsCopy(li_row,li_row, Primary!, dw_uc, 1, Primary!) ls_moneyid = long(f_ProfileString (sys_empid,publ_userid+'_'+dw_uc.DataObject, "moneyid",'0')) dw_uc.Object.u_salebill_moneyid[dw_uc.GetRow()]=ls_moneyid END IF dw_edit_mode = NOT dw_edit_mode wf_refresh_interface() end event type cb_edit from uo_imflatbutton within w_salebill integer x = 466 integer width = 165 integer height = 172 integer taborder = 270 boolean bringtotop = true string text = "修改&E" string normalpicname = "open.bmp" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;if not f_power_ind(641) then messagebox('提示','你没有使用权限!',information!,ok!) return end if string arg_msg='' long uc_row uc_row=dw_pageretr.getrow() if uc_row<=0 then messagebox('提示','请选定当前目标单据!',information!,ok!) return end if if not dw_edit_mode then if uo_bill.updatebegin(dw_pageretr.object.u_salebill_salebillid[uc_row],arg_msg)=0 then messagebox('错误',arg_msg,stopsign!,ok!) return end if end if dw_edit_mode= NOT dw_edit_mode wf_refresh_interface() IF dw_edit_mode THEN dw_pageretr.SetFocus() parent.triggerevent('retrieve_childdw') else parent.triggerevent('retrieve_pageretr') END IF end event type cb_reset from uo_imflatbutton within w_salebill integer x = 1083 integer width = 251 integer height = 172 integer taborder = 250 boolean bringtotop = true string text = "分配金额" string normalpicname = "bill.bmp" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;//wf_autoadd_mx() dw_uc.accepttext() dw_child.accepttext() long li_row,i decimal msttakeamt=0,takeamt=0,mxtakeamt=0 li_row=dw_uc.getrow() if li_row<=0 then messagebox('提示','请选择单据',information!,ok!) return end if if dw_child.rowcount()<=0 then messagebox('提示','请选择单据明细',information!,ok!) return end if msttakeamt=dw_uc.object.u_salebill_msttakeamt[li_row] takeamt=dw_uc.object.u_salebill_takeamt[li_row] //第一次循环:分配应付、计算总可分配 for i=1 to dw_child.rowcount() if msttakeamt > 0 then if dw_child.object.mainmsttakeamt[i]<=msttakeamt then dw_child.object.msttakeamt[i]=dw_child.object.mainmsttakeamt[i] msttakeamt=msttakeamt - dw_child.object.mainmsttakeamt[i] else dw_child.object.msttakeamt[i]=msttakeamt msttakeamt=0 end if end if takeamt = takeamt - (dw_child.object.mainmsttakeamt[i] - dw_child.object.maintakeamt[i]) dw_child.object.takeamt[i] = (dw_child.object.mainmsttakeamt[i] - dw_child.object.maintakeamt[i]) next dw_child.accepttext() //第二次循环:根据可分配判断正负,修正相关结余(正-负、负-正) if takeamt<0 then //不够分配 for i=dw_child.rowcount() to 1 STEP - 1 if (dw_child.object.mainmsttakeamt[i] - dw_child.object.maintakeamt[i])<=0 then CONTINUE if dw_child.object.mainmsttakeamt[i] - dw_child.object.maintakeamt[i] + takeamt <0 then dw_child.object.takeamt[i]=0 takeamt=takeamt + (dw_child.object.mainmsttakeamt[i] - dw_child.object.maintakeamt[i]) else dw_child.object.takeamt[i]=takeamt + (dw_child.object.mainmsttakeamt[i] - dw_child.object.maintakeamt[i]) takeamt=0 end if next else // 分配有剩 for i=dw_child.rowcount() to 1 STEP - 1 if (dw_child.object.mainmsttakeamt[i] - dw_child.object.maintakeamt[i])>=0 then CONTINUE if dw_child.object.mainmsttakeamt[i] - dw_child.object.maintakeamt[i] + takeamt >0 then dw_child.object.takeamt[i]=0 takeamt=takeamt + (dw_child.object.mainmsttakeamt[i] - dw_child.object.maintakeamt[i]) else dw_child.object.takeamt[i]=takeamt + (dw_child.object.mainmsttakeamt[i] - dw_child.object.maintakeamt[i]) takeamt=0 end if next end if dw_child.accepttext() //wf_autoadd_mx() //dw_uc.accepttext() //dw_child.accepttext() // //long li_row,i //decimal msttakeamt=0,takeamt=0,mxtakeamt=0 // //li_row=dw_uc.getrow() //if li_row<=0 then // messagebox(publ_operator,'请选择单据') // return //end if //if dw_child.rowcount()<=0 then // messagebox(publ_operator,'请单据明细') // return //end if // //msttakeamt=dw_uc.object.u_salebill_msttakeamt[li_row] //takeamt=dw_uc.object.u_salebill_takeamt[li_row] // ////第一次循环:分配应付、计算总可分配 //for i=1 to dw_child.rowcount() // if msttakeamt > 0 then // if dw_child.object.u_bmsttake_msttakeamt[i]<=msttakeamt then // dw_child.object.msttakeamt[i]=dw_child.object.u_bmsttake_msttakeamt[i] // msttakeamt=msttakeamt - dw_child.object.u_bmsttake_msttakeamt[i] // else // dw_child.object.msttakeamt[i]=msttakeamt // msttakeamt=0 // end if // end if // // takeamt = takeamt - (dw_child.object.u_bmsttake_msttakeamt[i] - dw_child.object.u_bmsttake_takeamt[i]) // // dw_child.object.takeamt[i] = (dw_child.object.u_bmsttake_msttakeamt[i] - dw_child.object.u_bmsttake_takeamt[i]) // //next //dw_child.accepttext() // ////第二次循环:根据可分配判断正负,修正相关结余(正-负、负-正) //if takeamt<0 then //不够分配 // // for i=dw_child.rowcount() to 1 STEP - 1 // if (dw_child.object.u_bmsttake_msttakeamt[i] - dw_child.object.u_bmsttake_takeamt[i])<=0 then CONTINUE // // if dw_child.object.u_bmsttake_msttakeamt[i] - dw_child.object.u_bmsttake_takeamt[i] + takeamt <0 then // dw_child.object.takeamt[i]=0 // takeamt=takeamt + (dw_child.object.u_bmsttake_msttakeamt[i] - dw_child.object.u_bmsttake_takeamt[i]) // else // dw_child.object.takeamt[i]=takeamt + (dw_child.object.u_bmsttake_msttakeamt[i] - dw_child.object.u_bmsttake_takeamt[i]) // takeamt=0 // end if // next //else // 分配有剩 // // for i=dw_child.rowcount() to 1 STEP - 1 // if (dw_child.object.u_bmsttake_msttakeamt[i] - dw_child.object.u_bmsttake_takeamt[i])>=0 then CONTINUE //// if dw_child.Object.u_bmsttake_takeamt[i]=0 then continue // // if dw_child.object.u_bmsttake_msttakeamt[i] - dw_child.object.u_bmsttake_takeamt[i] + takeamt >0 then // dw_child.object.takeamt[i]=0 // takeamt=takeamt + (dw_child.object.u_bmsttake_msttakeamt[i] - dw_child.object.u_bmsttake_takeamt[i]) // //dw_child.object.takeamt[i]=takeamt //+ (dw_child.object.u_bmsttake_msttakeamt[i] - dw_child.object.u_bmsttake_takeamt[i]) // else // dw_child.object.takeamt[i]=takeamt + (dw_child.object.u_bmsttake_msttakeamt[i] - dw_child.object.u_bmsttake_takeamt[i]) // takeamt=0 // end if // next //end if //dw_child.accepttext() // ////for i=1 to dw_child.rowcount() //// if dw_child.object.u_bmsttake_msttakeamt[i] = 0 then //// mxtakeamt = mxtakeamt + dw_child.object.u_bmsttake_takeamt[i] //// end if ////next //// ////takeamt = takeamt + mxtakeamt ////for i=1 to dw_child.rowcount() //// if msttakeamt > 0 then //// if dw_child.object.u_bmsttake_msttakeamt[i]<=msttakeamt then //// dw_child.object.u_bmsttakemx_msttakeamt[i]=dw_child.object.u_bmsttake_msttakeamt[i] //// msttakeamt=msttakeamt - dw_child.object.u_bmsttake_msttakeamt[i] //// else //// dw_child.object.u_bmsttakemx_msttakeamt[i]=msttakeamt //// msttakeamt=0 //// end if //// end if //// //// if takeamt > 0 then //// if dw_child.object.u_bmsttake_msttakeamt[i] - dw_child.object.u_bmsttake_takeamt[i]<=takeamt then //// dw_child.object.u_bmsttakemx_takeamt[i]=dw_child.object.u_bmsttake_msttakeamt[i] - dw_child.object.u_bmsttake_takeamt[i] //// takeamt=takeamt - (dw_child.object.u_bmsttake_msttakeamt[i] - dw_child.object.u_bmsttake_takeamt[i]) //// else //// dw_child.object.u_bmsttakemx_takeamt[i]=takeamt //// takeamt=0 //// end if //// end if ////next // end event type ln_bar from line within w_salebill long linecolor = 268435456 integer linethickness = 4 integer beginy = 176 integer endx = 3323 integer endy = 176 end type type ln_bar2 from line within w_salebill long linecolor = 16777215 integer linethickness = 4 integer beginy = 180 integer endx = 3323 integer endy = 180 end type type r_bar from rectangle within w_salebill long linecolor = 16777215 long fillcolor = 1073741824 integer x = 3360 integer width = 73 integer height = 172 end type event constructor;this.fillcolor = 14215660 this.linecolor = 14215660 this.x = -1 this.y = -1 this.height = ln_bar2.beginy - 5 end event type ln_1 from line within w_salebill long linecolor = 268435456 integer beginy = 284 integer endx = 3269 integer endy = 284 end type type ln_2 from line within w_salebill long linecolor = 16777215 integer beginy = 288 integer endx = 3273 integer endy = 288 end type