先说一下我需求,我是点击一个按钮,然后弹出一个pop窗。然后在里面选择好人员后,
然后调用下面的函数,将这些人员全部插入到datawindow里面方便打印~~
不过他们要求控制颜色,根据部门的差别。
在前台直接retrieve()刷出来的都可以区分颜色。
我不知道后台怎么写。 求指导
- HTML code
//====================================================================// 函数: of_add_emp()//--------------------------------// 描述:将人员显示到打印面板,方便打印其中部分人员的厂牌//--------------------------------// 参数 :// value string as_empid 工号//--------------------------------// 返回: integer//--------------------------------// 作者: full : 2011/06/21 //--------------------------------long li_pic_type li_pic_type = uf_getsysbasic(36) //是否开启了图片上传datastore lds_1long ll_rowcountlds_1 = create datastorelds_1.dataobject = 'd_emp_batchset_1'lds_1.settransobject(sqlca)lds_1.retrieve(as_empid,li_pic_type,is_path)ll_rowcount = lds_1.rowcount()if ll_rowcount < 1 then destroy lds_1 return -1end iflong ll_row,istring ls_name,ls_duty,ls_post,ls_emp_id,ls_ccdesc,ls_picpath,ls_level,ls_bumenuf_pgbarxp_open('数据加载中...',ll_rowcount)for i= 1 to ll_rowcount ls_emp_id = lds_1.object.h_emp_mstr_emp_id[i] //从datastore 里获得工号 ls_name = lds_1.object.h_emp_mstr_emp_name[i] //姓名 ls_ccdesc = lds_1.object.cc_mstr_cc_desc[i]//部门 ls_post = lds_1.object.h_emp_mstr_post_id[i] //岗位 ls_picpath =lds_1.object.pic_path[i] //图片路径 ls_duty = lds_1.object.h_duty_duty_desc[i] //职务 ls_level =lds_1.object.cc_mstr_cc_level[i] //部门 LEVEL ll_row = tab_1.tabpage_2.dw_3.insertrow(0) //插入到界面datawindow tab_1.tabpage_2.dw_3.object.h_emp_mstr_emp_name[ll_row] = ls_name //姓名 tab_1.tabpage_2.dw_3.object.cc_mstr_mid[ll_row] = mid(ls_ccdesc,3,999) //组别 select substring(cc_mstr.cc_desc,3,999) into :ls_bumen from cc_mstr,h_emp_mstr where h_emp_mstr.cc_pri_code=cc_mstr.cc_code and h_emp_mstr.emp_id =:ls_emp_id ; tab_1.tabpage_2.dw_3.object.cc_pri_mid[ll_row] =ls_bumen //部门 tab_1.tabpage_2.dw_3.object.emp_id_type[ll_row] = ls_emp_id //工号 tab_1.tabpage_2.dw_3.object.pic_path[ll_row] = ls_picpath //图片路径 tab_1.tabpage_2.dw_3.object.h_duty_duty_desc[ll_row] = ls_duty //职务 //上面厂别的显示 if left(ls_level ,4) = '0102' then tab_1.tabpage_2.dw_3.object.h_emp_mstr_text_1[ll_row] ='大唐xx电子有限公司' else tab_1.tabpage_2.dw_3.object.h_emp_mstr_text_1[ll_row] ='大唐xx半导体有限公司' end if tab_1.tabpage_2.dw_3.object.h_emp_mstr_text_2[ll_row]='xx CO.,LTD.' tab_1.tabpage_2.dw_3.object.h_emp_mstr_name_text[ll_row] = "姓名:" tab_1.tabpage_2.dw_3.object.h_emp_mstr_pri_desc_text[ll_row] = "部门:" tab_1.tabpage_2.dw_3.object.h_emp_mstr_duty_desc_text[ll_row] ="职位:" tab_1.tabpage_2.dw_3.object.h_emp_mstr_desc_text[ll_row] ="组别:" tab_1.tabpage_2.dw_3.object.h_emp_mstr_emp_id_text[ll_row] = "工号:" // 这里是前台的代码// if( left( cc_mstr_cc_level ,4)='0102',rgb(0,0,0) ,//if( h_emp_mstr_emp_try <>'1',rgb(250,0,0),//if(pos( cc_mstr_cc_desc ,"II")>0,rgb(0,230,100),//if(pos( cc_mstr_cc_desc ,"I")>0 and pos( cc_mstr_cc_desc ,"IT")=0 and pos( cc_mstr_cc_desc ,"WIP")=0,rgb//(0,0,240),//rgb(0,0,0))))) //这是我测试颜色的代码,前台无反映 //tab_1.tabpage_2.dw_3.Modify("h_emp_mstr_name_text.Color='0~t " + "If(h_emp_mstr_text_1='',65380,If(h_emp_mstr_text_1='',255,0))'")nextuf_pgbarxp_close()tab_1.tabpage_2.dw_3.setredraw(true)destroy lds_1return 1
------解决方案--------------------
1是用单双引号嵌套,2就是用转义符 ~
比如:
string ls_modify
ls_modify = ls_coln + ".format = ~" '#,###' ~t if(isnull("+ls_coln+") or mod("+ls_coln+",1)=0,'#,###', '##,###.##' )~""