$PBExportHeader$w_cmpl_product_price.srw forward global type w_cmpl_product_price from w_publ_base end type type dw_1 from u_dw_rbtnfilter within w_cmpl_product_price end type type cb_1 from uo_imflatbutton within w_cmpl_product_price end type type cb_3 from uo_imflatbutton within w_cmpl_product_price end type type st_1 from statictext within w_cmpl_product_price end type type cb_2 from uo_imflatbutton within w_cmpl_product_price end type type cb_edit from uo_imflatbutton within w_cmpl_product_price end type type cb_addmx from uo_imflatbutton within w_cmpl_product_price end type type cb_4 from uo_imflatbutton within w_cmpl_product_price end type type cb_sort from uo_imflatbutton within w_cmpl_product_price end type type cb_5 from uo_imflatbutton within w_cmpl_product_price end type type cb_6 from uo_imflatbutton within w_cmpl_product_price end type type cbx_1 from checkbox within w_cmpl_product_price end type type ln_bar from line within w_cmpl_product_price end type type ln_bar2 from line within w_cmpl_product_price end type type ln_1 from line within w_cmpl_product_price end type type ln_2 from line within w_cmpl_product_price end type type r_bar from rectangle within w_cmpl_product_price end type end forward global type w_cmpl_product_price from w_publ_base integer width = 4197 integer height = 2304 string title = "床垫产品计价" boolean minbox = false windowtype windowtype = response! windowstate windowstate = maximized! event ue_f8 ( ) event ue_f9 ( ) event ue_f10 ( ) event ue_save_modle ( ) event ue_save_modle_as ( ) event ue_save_bill ( ) event ue_save_bill_as ( ) event ue_open_bill ( ) event ue_pickmtrl ( ) event ue_addmx ( ) event ue_delmx ( ) dw_1 dw_1 cb_1 cb_1 cb_3 cb_3 st_1 st_1 cb_2 cb_2 cb_edit cb_edit cb_addmx cb_addmx cb_4 cb_4 cb_sort cb_sort cb_5 cb_5 cb_6 cb_6 cbx_1 cbx_1 ln_bar ln_bar ln_bar2 ln_bar2 ln_1 ln_1 ln_2 ln_2 r_bar r_bar end type global w_cmpl_product_price w_cmpl_product_price type variables //==================================================================== // 事件: w_cmpl_product_price.Declare Instance Variables() //-------------------------------------------------------------------- // 描述: //-------------------------------------------------------------------- // 参数: //-------------------------------------------------------------------- // 返回: (none) //-------------------------------------------------------------------- // 作者: lwl 日期: 2010年12月25日 //-------------------------------------------------------------------- // LONGJOE //-------------------------------------------------------------------- // 修改历史: defaultValue 作 物料最新价 // //==================================================================== long ins_column_count = 0 uo_cmpl_modle uo_modle uo_cmpl_bill uo_bill string ins_oldtitle // 报价单 uo_quote ins_quote // 区间 long ins_first = 5 long ins_last = 44 end variables forward prototypes public subroutine wf_refresh () public function integer wf_save (ref string arg_msg) public function integer wf_update_price (ref string arg_msg) end prototypes event ue_f8();// TODO: 研究列添加的交互方式 IF NOT IsValid(W_mtrldef_edit) THEN s_edit_index_tran s_tranf8 //传递参数使用 s_tranf8.if_retrieve_all = FALSE //是否一次RETRIEVE所有行 s_tranf8.work_mode = 1 //0-单纯编辑模式 1-选择\编辑模式 s_tranf8.arg_pkid = 0 //目标定位PKID (备用) s_tranf8.arg_string_code = '' //查询列(物料编码)部分内容,用于初步筛选 s_tranf8.if_select_all = TRUE //多选 s_tranf8.b_long = 0 //选采购 s_tranf8.c_long = -1 Long chc = 1,ls_j OpenWithParm(W_mtrldef_edit,s_tranf8) //调用 s_mtrldef_array S_INSCUST S_INSCUST = Message.PowerObjectParm //接受返回结构 IF UpperBound(S_INSCUST.mtrlid) > 30 THEN MessageBox('提示', '一次最多只能选30个产品') RETURN END IF dw_1.Reset() String ls_mod FOR ls_j = ins_first TO ins_last ls_mod = '#' + String(ls_j) + '.Visible = 0' ls_mod = dw_1.Modify(ls_mod) NEXT chc = 0 FOR ls_j = 1 TO UpperBound(S_INSCUST.mtrlid) IF S_INSCUST.mtrlid[ls_j] > 0 THEN chc ++ ls_mod = 'mtrl' + String(chc) + '.Visible = 1' ls_mod = dw_1.Modify(ls_mod) ls_mod = 'mtrl' + String(chc) + '_t.Text = ~''+String(S_INSCUST.mtrlname[ls_j])+'~'' ls_mod = dw_1.Modify(ls_mod) ls_mod = 'mtrl' + String(chc) + '_t.Tag = ~''+String(S_INSCUST.mtrlid[ls_j])+'~'' ls_mod = dw_1.Modify(ls_mod) ls_mod = 'mtrl' + String(chc) + '.Tag = ~''+String(S_INSCUST.mtrlcode[ls_j])+'~'' ls_mod = dw_1.Modify(ls_mod) END IF NEXT ins_column_count = chc FOR ls_j = (ins_first + 30) TO ins_last ls_mod = '#' + String(ls_j) + '.Visible = 1' ls_mod = dw_1.Modify(ls_mod) NEXT // // for ls_j = 1 to UpperBound(S_INSCUST.mtrlid) // if S_INSCUST.mtrlid[ls_j] > 0 then // chc = dw_2.insertrow(0) // dw_2.object.mtrlid[chc] = S_INSCUST.mtrlid[1] // dw_2.object.mtrlcode[chc] = S_INSCUST.mtrlcode[1] // dw_2.object.mtrlname[chc] = S_INSCUST.mtrlname[1] // // end if // next // // dw_1.Reset() END IF end event event ue_f9();long ll_product_mtrlid string ls_dscrp, ls_mode[] decimal ld_value if ins_column_count = 0 then MessageBox('提示', '请先选择产品') return end if if dw_1.rowcount() > 0 then IF MessageBox ("IF","更新模板将重置当前数据,是否继续?",Question!,YesNo! ) = 2 THEN RETURN end if IF NOT IsValid(w_cmpl_modle_ch) THEN Open(w_cmpl_modle_ch) //调用 long ls_j, ll_row, ll_col s_cmpl_modle_ch S_INSCUST S_INSCUST = Message.PowerObjectParm //接受返回结构 if S_INSCUST.modleid > 0 then uo_modle.modleid = s_inscust.modleid uo_modle.modlename = s_inscust.modlename dw_1.reset() st_1.Text = '模板名:' + S_INSCUST.modlename for ls_j = 1 to upperbound(S_INSCUST.printid) ll_row = dw_1.insertrow(0) dw_1.object.printid[ll_row] = S_INSCUST.printid[ls_j] dw_1.object.parmname[ll_row] = S_INSCUST.parmname[ls_j] dw_1.object.displayname[ll_row] = S_INSCUST.displayname[ls_j] //dw_1.object.defaultvalue[ll_row] = S_INSCUST.defaultvalue[ls_j] dw_1.object.if_useformula[ll_row] = S_INSCUST.if_useformula[ls_j] dw_1.object.formula[ll_row] = S_INSCUST.formula[ls_j] //dw_1.object.if_from_mtrl[ll_row] = S_INSCUST.if_from_mtrl[ls_j] dw_1.object.mtrlid[ll_row] = S_INSCUST.mtrlid[ls_j] //dw_1.object.mtrl_pro[ll_row] = S_INSCUST.mtrl_pro[ls_j] dw_1.object.if_from_product[ll_row] = S_INSCUST.if_from_product[ls_j] dw_1.object.product_pro[ll_row] = S_INSCUST.product_pro[ls_j] dw_1.object.mtrlcode[ll_row] = S_INSCUST.mtrlcode[ls_j] dw_1.object.mtrlname[ll_row] = S_INSCUST.mtrlname[ls_j] dw_1.object.unit[ll_row] = S_INSCUST.unit[ls_j] //============================================================================== // 物料相关 //============================================================================== if S_INSCUST.mtrlid[ls_j] > 0 then // DONE: 获取物料最新价 SELECT price INTO :ld_value FROM v_maxprice_sptprice WHERE mtrlid = :S_INSCUST.mtrlid[ls_j]; if sqlca.sqlcode <> 0 then ld_value = 0 end if dw_1.object.defaultvalue[ll_row] = ld_value end if //============================================================================== // 产品相关 //============================================================================== if S_INSCUST.if_from_product[ls_j] = 1 then if S_INSCUST.product_pro[ls_j] = '长' then for ll_col = 1 to ins_column_count ls_dscrp = dw_1.Describe('mtrl'+string(ll_col)+'_t.tag') ll_product_mtrlid = long(ls_dscrp) // DONE: 获取产品长 SELECT mtrlmode INTO :ls_dscrp FROM u_mtrldef WHERE mtrlid = :ll_product_mtrlid; if sqlca.sqlcode <> 0 then ls_dscrp = '0*0*0' end if f_str_split(ls_dscrp, '*', ls_mode) if upperbound(ls_mode) < 1 then ls_mode[1] = '0' end if if not isnumber(ls_mode[1]) then ls_mode[1] = '0' end if ld_value = dec(ls_mode[1]) dw_1.SetItem(ll_row, 'mtrl' + string(ll_col), ld_value) next end if if S_INSCUST.product_pro[ls_j] = '宽' then for ll_col = 1 to ins_column_count ls_dscrp = dw_1.Describe('mtrl'+string(ll_col)+'_t.tag') ll_product_mtrlid = long(ls_dscrp) // DONE: 获取产品宽 SELECT mtrlmode INTO :ls_dscrp FROM u_mtrldef WHERE mtrlid = :ll_product_mtrlid; if sqlca.sqlcode <> 0 then ls_dscrp = '0*0*0' end if f_str_split(ls_dscrp, '*', ls_mode) if upperbound(ls_mode) < 2 then ls_mode[2] = '0' end if if not isnumber(ls_mode[2]) then ls_mode[2] = '0' end if ld_value = dec(ls_mode[2]) dw_1.SetItem(ll_row, 'mtrl' + string(ll_col), ld_value) next end if if S_INSCUST.product_pro[ls_j] = '高' then for ll_col = 1 to ins_column_count ls_dscrp = dw_1.Describe('mtrl'+string(ll_col)+'_t.tag') ll_product_mtrlid = long(ls_dscrp) // DONE: 获取产品高 SELECT mtrlmode INTO :ls_dscrp FROM u_mtrldef WHERE mtrlid = :ll_product_mtrlid; if sqlca.sqlcode <> 0 then ls_dscrp = '0*0*0' end if f_str_split(ls_dscrp, '*', ls_mode) if upperbound(ls_mode) < 3 then ls_mode[3] = '0' end if if not isnumber(ls_mode[3]) then ls_mode[3] = '0' end if ld_value = dec(ls_mode[3]) dw_1.SetItem(ll_row, 'mtrl' + string(ll_col), ld_value) next end if end if if S_INSCUST.if_useformula[ls_j] = 1 then // DONE: 公式字段,手动触发 end if //============================================================================== // 不用公式,不相关物料,不相关产品 //============================================================================== // if S_INSCUST.if_useformula[ls_j] <> 1 AND S_INSCUST.if_from_product[ls_j] <> 1 AND S_INSCUST.if_from_mtrl[ls_j] <> 1 then // for ll_col = 1 to ins_column_count // dw_1.SetItem(ll_row, 'mtrl' + string(ll_col), S_INSCUST.defaultValue[ls_j]) // next // end if next end if END IF end event event ue_f10();s_cmpl_parm s_parms[] Long ll_row, ll_col String ls_msg Decimal ll_value if ins_column_count = 0 then MessageBox('提示', '请先选择产品') return end if if dw_1.RowCount() <= 0 then MessageBox('提示', '请先选择计价模板') return end if if dw_1.accepttext() <> 1 then return FOR ll_row = 1 TO dw_1.RowCount() FOR ll_col = 1 TO ins_column_count s_parms[ll_col].parmname[ll_row] = dw_1.Object.parmname[ll_row] s_parms[ll_col].DisplayName[ll_row] = dw_1.Object.DisplayName[ll_row] s_parms[ll_col].parmvalue[ll_row] = 0 IF dw_1.Object.if_useformula[ll_row] = 1 THEN IF f_cmpl_with_parms(dw_1.Object.formula[ll_row], s_parms[ll_col], ll_value, ls_msg) <> 1 THEN MessageBox('计算公式失败', ls_msg, stopsign!) dw_1.ScrollToRow(ll_row) dw_1.SetColumn('formula') dw_1.SetFocus() RETURN END IF if dw_1.Object.mtrlid[ll_row] > 0 THEN ll_value = ll_value * dw_1.object.defaultvalue[ll_row] end if dw_1.SetItem(ll_row, 'mtrl' + String(ll_col), ll_value) END IF s_parms[ll_col].parmvalue[ll_row] = dw_1.GetItemDecimal(ll_row, 'mtrl' + String(ll_col)) NEXT NEXT end event event ue_save_modle();// DONE: 保存模板 if dw_1.rowcount() <= 0 then MessageBox('提示', '没有内容不能保存') return end if s_inputbox s_parm string ls_return long i if dw_1.accepttext() <> 1 then return end if for i = 1 to dw_1.RowCount() if trim(dw_1.object.parmname[i]) = '' then MessageBox('提示', '参数名不能为空') dw_1.scrolltorow(i) dw_1.setcolumn('parmname') dw_1.SetFocus() return end if if trim(dw_1.object.displayname[i]) = '' then MessageBox('提示', '显示名不能为空') dw_1.scrolltorow(i) dw_1.setcolumn('displayname') dw_1.SetFocus() return end if if pos(dw_1.object.parmname[i], '[') > 0 then MessageBox('提示', '参数名不能包含字符"["') dw_1.scrolltorow(i) dw_1.setcolumn('parmname') dw_1.SetFocus() return end if if pos(dw_1.object.parmname[i], ']') > 0 then MessageBox('提示', '参数名不能包含字符"]"') dw_1.scrolltorow(i) dw_1.setcolumn('parmname') dw_1.SetFocus() return end if if dw_1.object.if_useformula[i] = 1 AND trim(dw_1.object.formula[i]) = '' then MEssageBox('提示', '请输入公式') dw_1.scrolltorow(i) dw_1.setcolumn('formula') dw_1.SetFocus() return end if if dw_1.object.if_from_mtrl[i] = 1 AND dw_1.object.mtrlid[i] <= 0 then MessageBox('提示', '请选择相关物料') dw_1.scrolltorow(i) dw_1.setcolumn('mtrlcode') dw_1.SetFocus() return end if if dw_1.object.if_from_mtrl[i] = 1 AND trim(dw_1.object.mtrl_pro[i]) = '' then MessageBox('提示', '请选择相关物料属性') dw_1.scrolltorow(i) dw_1.setcolumn('mtrl_pro') dw_1.SetFocus() return end if if dw_1.object.if_from_product[i] = 1 AND trim(dw_1.object.product_pro[i]) = '' then MessageBox('提示', '请选择相关产品属性') dw_1.scrolltorow(i) dw_1.setcolumn('product_pro') dw_1.SetFocus() return end if next string ls_msg if uo_modle.modleid = 0 then if uo_modle.newbegin(ls_msg) <> 1 then MessageBox('', ls_msg) return end if s_parm.title = '输入工作表名称' s_parm.old_text = '' openwithparm(w_inputbox, s_parm) ls_return = message.stringparm if ls_return = '' OR isnull(ls_return) then return uo_modle.ModleName = ls_return else if uo_modle.updatebegin(uo_modle.modleid, ls_msg) <> 1 then MessageBox('', ls_msg) return end if end if uo_modle.modletype = 0 // uo_modle.modlename = trim(sle_modlename.text) s_cmpl_modlemx tmp[] for i = 1 to dw_1.RowCount() dw_1.object.printid[i] = i tmp[i].modleid = 0 tmp[i].printid = dw_1.object.printid[i] tmp[i].parmName = dw_1.object.parmName[i] tmp[i].displayName = dw_1.object.displayName[i] tmp[i].defaultValue = dw_1.object.defaultValue[i] tmp[i].if_useformula = dw_1.object.if_useformula[i] tmp[i].formula = dw_1.object.formula[i] tmp[i].if_from_mtrl = dw_1.object.if_from_mtrl[i] tmp[i].mtrlid = dw_1.object.mtrlid[i] tmp[i].mtrl_pro = dw_1.object.mtrl_pro[i] tmp[i].if_from_product = dw_1.object.if_from_product[i] tmp[i].product_pro = dw_1.object.product_pro[i] next uo_modle.mxs = tmp if uo_modle.savesubmit(ls_msg) <> 1 then MessageBox('错误', ls_msg) return end if st_1.Text = '模板名:' + uo_modle.modlename end event event ue_save_modle_as();// DONE: 另存模板 long oldid oldid = uo_modle.modleid uo_modle.modleid = 0 this.triggerevent('ue_save_modle') if uo_modle.modleid = 0 then uo_modle.modleid = oldid end if end event event ue_save_bill();// DONE: 保存工作表 if dw_1.rowcount() <= 0 then MessageBox('提示', '没有内容不能保存') return end if s_inputbox s_parm string ls_return long i if dw_1.accepttext() <> 1 then return end if string ls_msg if uo_bill.ModleID = 0 then if uo_bill.Newbegin(ls_msg) <> 1 then MessageBox('', ls_msg) return end if s_parm.title = '输入工作表名称' s_parm.old_text = '' openwithparm(w_inputbox, s_parm) ls_return = message.stringparm if ls_return = '' OR isnull(ls_return) then return uo_bill.ModleName = ls_return else if uo_bill.UpdateBegin(uo_bill.Modleid, ls_msg) <> 1 then MessageBox('', ls_msg) return end if end if uo_bill.ModleType = 1 //uo_bill.orgModleID = 0 s_cmpl_modlemx tmp[] s_cmpl_modlemx_mx tmp_mx[] long j = 0, ll_col = 0 string ls_dscrp for i = 1 to dw_1.RowCount() dw_1.object.printid[i] = i tmp[i].modleid = 0 tmp[i].printid = i tmp[i].parmName = dw_1.object.parmName[i] tmp[i].displayName = dw_1.object.displayName[i] tmp[i].defaultValue = 0 tmp[i].if_useformula = dw_1.object.if_useformula[i] tmp[i].formula = dw_1.object.formula[i] tmp[i].if_from_mtrl = dw_1.object.if_from_mtrl[i] tmp[i].mtrlid = dw_1.object.mtrlid[i] tmp[i].mtrl_pro = dw_1.object.mtrl_pro[i] tmp[i].if_from_product = dw_1.object.if_from_product[i] tmp[i].product_pro = dw_1.object.product_pro[i] for ll_col = 1 to ins_column_count j++ tmp_mx[j].ModleID = 0 tmp_mx[j].printid = i ls_dscrp = dw_1.Describe('mtrl'+string(ll_col)+'_t.tag') tmp_mx[j].mtrlid = long(ls_dscrp) tmp_mx[j].value = dw_1.GetItemDecimal(i, 'mtrl' + String(ll_col)) next next uo_bill.mxs = tmp uo_bill.mx_mxs = tmp_mx if uo_bill.savesubmit(ls_msg) <> 1 then MessageBox('错误', ls_msg) return end if this.Title = ins_oldTitle + '[' + uo_bill.ModleName + ']' end event event ue_save_bill_as();// DONE: 另存工作表 long oldid oldid = uo_bill.modleid uo_bill.modleid = 0 this.triggerevent('ue_save_bill') if uo_bill.modleid = 0 then uo_bill.modleid = oldid end if end event event ue_open_bill();// DONE: 打开工作表 Long arg_Modleid String ls_msg s_mtrldef_array S_INSCUST Long ll_col = 0, ls_j, chc, ll_row, ll_i Long ll_mtrlid String ll_mtrlcode String ll_mtrlname string ls_dscrp decimal ll_value IF NOT IsValid(w_cmpl_bill_ch) THEN Open(w_cmpl_bill_ch) //调用 s_cmpl_modle_ch s_choice s_choice = Message.PowerObjectParm //接受返回结构 if isnull(s_choice) then return if isnull(s_choice.modleid) then return if s_choice.modleid > 0 then arg_ModleID = s_choice.modleid IF uo_bill.GetINfo(arg_Modleid, ls_msg) <> 1 THEN MessageBox('', ls_msg) RETURN END IF this.title = ins_oldtitle + '[' + uo_bill.ModleName + ']' declare cur1 cursor for select DISTINCT u_cmpl_modleMx_Mx.mtrlid, u_mtrldef.mtrlcode, u_mtrldef.mtrlname from u_cmpl_modleMx_Mx inner JOIN u_mtrldef ON u_cmpl_modleMx_Mx.mtrlid = u_mtrldef.mtrlid Where (u_cmpl_modleMx_Mx.ModleID = :arg_Modleid); open cur1; fetch cur1 INTO :ll_mtrlid, :ll_mtrlcode, :ll_mtrlname; DO WHILE sqlca.SQLCode = 0 ll_col ++ S_INSCUST.mtrlid[ll_col] = ll_mtrlid S_INSCUST.mtrlcode[ll_col] = ll_mtrlcode S_INSCUST.mtrlname[ll_col] = ll_mtrlname fetch cur1 INTO :ll_mtrlid, :ll_mtrlcode, :ll_mtrlname; LOOP close cur1; dw_1.Reset() String ls_mod FOR ls_j = 4 TO 43 ls_mod = '#' + String(ls_j) + '.Visible = 0' ls_mod = dw_1.Modify(ls_mod) NEXT chc = 0 FOR ls_j = 1 TO UpperBound(S_INSCUST.mtrlid) IF S_INSCUST.mtrlid[ls_j] > 0 THEN chc ++ ls_mod = 'mtrl' + String(chc) + '.Visible = 1' ls_mod = dw_1.Modify(ls_mod) ls_mod = 'mtrl' + String(chc) + '_t.Text = ~''+String(S_INSCUST.mtrlname[ls_j])+'~'' ls_mod = dw_1.Modify(ls_mod) ls_mod = 'mtrl' + String(chc) + '_t.Tag = ~''+String(S_INSCUST.mtrlid[ls_j])+'~'' ls_mod = dw_1.Modify(ls_mod) ls_mod = 'mtrl' + String(chc) + '.Tag = ~''+String(S_INSCUST.mtrlcode[ls_j])+'~'' ls_mod = dw_1.Modify(ls_mod) END IF NEXT ins_column_count = chc FOR ls_j = 34 TO 43 ls_mod = '#' + String(ls_j) + '.Visible = 1' ls_mod = dw_1.Modify(ls_mod) NEXT FOR ll_i = 1 TO UpperBound(uo_bill.mxs) ll_row = dw_1.insertrow(0) dw_1.object.printid[ll_row] = uo_bill.mxs[ll_i].printid dw_1.object.parmname[ll_row] = uo_bill.mxs[ll_i].parmname dw_1.object.displayname[ll_row] = uo_bill.mxs[ll_i].displayname dw_1.object.if_useformula[ll_row] = uo_bill.mxs[ll_i].if_useformula dw_1.object.formula[ll_row] = uo_bill.mxs[ll_i].formula dw_1.object.if_from_mtrl[ll_row] = uo_bill.mxs[ll_i].if_from_mtrl dw_1.object.mtrlid[ll_row] = uo_bill.mxs[ll_i].mtrlid dw_1.object.mtrl_pro[ll_row] = uo_bill.mxs[ll_i].mtrl_pro dw_1.object.if_from_product[ll_row] = uo_bill.mxs[ll_i].if_from_product dw_1.object.product_pro[ll_row] = uo_bill.mxs[ll_i].product_pro SELECT mtrlcode , mtrlname INTO :ll_mtrlcode, :ll_mtrlname FROM u_mtrldef WHERE mtrlid = :uo_bill.mxs[ll_i].mtrlid; if sqlca.sqlcode <> 0 then ll_mtrlcode = '' ll_mtrlname = '' dw_1.object.mtrlid[ll_row] = 0 end if dw_1.object.mtrlcode[ll_row] = ll_mtrlcode dw_1.object.mtrlname[ll_row] = ll_mtrlname for ll_col = 1 to ins_column_count ls_dscrp = dw_1.Describe('mtrl'+string(ll_col)+'_t.tag') ll_mtrlid = long(ls_dscrp) ll_value = 0 for ls_j = 1 to upperbound(uo_bill.mx_mxs) if uo_bill.mx_mxs[ls_j].printid = uo_bill.mxs[ll_i].printid & and uo_bill.mx_mxs[ls_j].mtrlid = ll_mtrlid then ll_value = uo_bill.mx_mxs[ls_j].value exit end if next dw_1.SetItem(ll_row, 'mtrl' + string(ll_col), ll_value) next NEXT end if end if end event event ue_pickmtrl(); long ll_row decimal ld_value long ll_col IF NOT IsValid(W_mtrldef_edit) THEN s_edit_index_tran s_tranf8 //传递参数使用 s_tranf8.if_retrieve_all = FALSE //是否一次RETRIEVE所有行 s_tranf8.work_mode = 1 //0-单纯编辑模式 1-选择\编辑模式 s_tranf8.arg_pkid = 0 //目标定位PKID (备用) s_tranf8.arg_string_code = '' //查询列(物料编码)部分内容,用于初步筛选 s_tranf8.if_select_all = FALSE //多选 s_tranf8.b_long = 2 //选采购 s_tranf8.c_long = -1 s_tranf8.f_long = 2 Long chc = 1,ls_j IF dw_1.GetRow() > 0 THEN s_tranf8.arg_string_code = Trim(dw_1.Object.mtrlcode[dw_1.GetRow()]) OpenWithParm(W_mtrldef_edit,s_tranf8) //调用 s_mtrldef_array S_INSCUST S_INSCUST = Message.PowerObjectParm //接受返回结构 if UpperBound(S_INSCUST.mtrlid) > 0 then if S_INSCUST.mtrlid[1] > 0 then ll_row = dw_1.GetRow() dw_1.object.mtrlid[ll_row] = S_INSCUST.mtrlid[1] dw_1.object.mtrlcode[ll_row] = S_INSCUST.mtrlcode[1] dw_1.object.mtrlname[ll_row] = S_INSCUST.mtrlname[1] dw_1.object.unit[ll_row] = S_INSCUST.unit[1] SELECT price INTO :ld_value FROM v_maxprice_sptprice WHERE mtrlid = :S_INSCUST.mtrlid[1]; if sqlca.sqlcode <> 0 then ld_value = 0 end if dw_1.object.defaultvalue[ll_row] = ld_value end if end if end if end event event ue_addmx();long ll_row ll_row = dw_1.insertrow(0) dw_1.object.printid[ll_row] = ll_row dw_1.scrolltorow(ll_row) dw_1.setcolumn('mtrl1') dw_1.setfocus() end event event ue_delmx();if dw_1.GetRow() > 0 then dw_1.deleterow(dw_1.GetRow()) dw_1.setfocus() end if end event public subroutine wf_refresh ();long i if dw_edit_mode then for i = 1 to ins_last dw_1.settaborder(i, 10*i) next cb_edit.Text = '保存&S' cb_edit.normalpicname = 'Save.bmp' else for i = 1 to ins_last dw_1.settaborder(i, 0) next cb_edit.Text = '修改&E' cb_edit.normalpicname = 'open.bmp' end if cb_3.Enabled = dw_edit_mode cb_addmx.Enabled = dw_edit_mode cb_4.Enabled = dw_edit_mode cb_sort.Enabled = dw_edit_mode cb_2.Enabled = dw_edit_mode cb_5.Enabled = dw_edit_mode cb_edit.of_init_draw() cb_edit.of_paint() cb_edit.TriggerEvent('ue_textchange') end subroutine public function integer wf_save (ref string arg_msg);// int rslt = 1 long i long old_modleid, ll_flag old_modleid = uo_bill.modleid if dw_1.rowcount() <= 0 then rslt = 0 arg_msg = '没有内容不能保存' goto ext end if uo_bill.ModleType = 1 //uo_bill.orgModleID = 0 for i = 1 to dw_1.RowCount() if trim(dw_1.object.parmname[i]) = '' then dw_1.scrolltorow(i) dw_1.setcolumn('parmname') dw_1.SetFocus() rslt = 0 arg_msg = '参数名不能为空' goto ext end if // if trim(dw_1.object.displayname[i]) = '' then // dw_1.scrolltorow(i) // dw_1.setcolumn('displayname') // dw_1.SetFocus() // rslt = 0 // arg_msg = '显示名不能为空' // goto ext // end if if pos(dw_1.object.parmname[i], '[') > 0 then dw_1.scrolltorow(i) dw_1.setcolumn('parmname') dw_1.SetFocus() rslt = 0 arg_msg = '参数名不能包含字符"["' goto ext end if if pos(dw_1.object.parmname[i], ']') > 0 then dw_1.scrolltorow(i) dw_1.setcolumn('parmname') dw_1.SetFocus() rslt = 0 arg_msg = '参数名不能包含字符"]"' goto ext end if // if dw_1.object.if_useformula[i] = 1 AND trim(dw_1.object.formula[i]) = '' then // MEssageBox('提示', '请输入公式') // dw_1.scrolltorow(i) // dw_1.setcolumn('formula') // dw_1.SetFocus() // return // end if // if dw_1.object.if_from_mtrl[i] = 1 AND dw_1.object.mtrlid[i] <= 0 then // MessageBox('提示', '请选择相关物料') // dw_1.scrolltorow(i) // dw_1.setcolumn('mtrlcode') // dw_1.SetFocus() // return // end if // if dw_1.object.if_from_mtrl[i] = 1 AND trim(dw_1.object.mtrl_pro[i]) = '' then // MessageBox('提示', '请选择相关物料属性') // dw_1.scrolltorow(i) // dw_1.setcolumn('mtrl_pro') // dw_1.SetFocus() // return // end if // if dw_1.object.if_from_product[i] = 1 AND trim(dw_1.object.product_pro[i]) = '' then // MessageBox('提示', '请选择相关产品属性') // dw_1.scrolltorow(i) // dw_1.setcolumn('product_pro') // dw_1.SetFocus() // return // end if next s_cmpl_modlemx tmp[] s_cmpl_modlemx_mx tmp_mx[] long j = 0, ll_col = 0 string ls_dscrp for i = 1 to dw_1.RowCount() dw_1.object.printid[i] = i tmp[i].modleid = 0 tmp[i].printid = i tmp[i].parmName = dw_1.object.parmName[i] tmp[i].displayName = dw_1.object.displayName[i] tmp[i].defaultValue = dw_1.object.defaultValue[i] tmp[i].if_useformula = dw_1.object.if_useformula[i] tmp[i].formula = dw_1.object.formula[i] tmp[i].if_from_mtrl = dw_1.object.if_from_mtrl[i] tmp[i].mtrlid = dw_1.object.mtrlid[i] tmp[i].mtrl_pro = dw_1.object.mtrl_pro[i] tmp[i].if_from_product = dw_1.object.if_from_product[i] tmp[i].product_pro = dw_1.object.product_pro[i] for ll_col = 1 to ins_column_count j++ tmp_mx[j].ModleID = 0 tmp_mx[j].printid = i ls_dscrp = dw_1.Describe('mtrl'+string(ll_col)+'_t.tag') tmp_mx[j].mtrlid = long(ls_dscrp) tmp_mx[j].value = dw_1.GetItemDecimal(i, 'mtrl' + String(ll_col)) next next uo_bill.mxs = tmp uo_bill.mx_mxs = tmp_mx if uo_bill.save(false, arg_msg) <> 1 then rslt = 0 goto ext end if //============================================================================== // 更新报价单 //============================================================================== SELECT flag into :ll_flag from u_quote where scid = :ins_quote.scid and quoteid = :ins_quote.quoteid; if sqlca.sqlcode <> 0 then rslt = 0 arg_msg = '获取报价单审核状态失败,' + sqlca.sqlerrtext goto ext end if if ll_flag = 1 then rslt = 0 arg_msg = '报价单已经审核,不能保存' goto ext end if update u_quote SET modleid = :uo_bill.modleid, modlename = :uo_bill.modlename WHERE scid = :ins_quote.scid and quoteid = :ins_quote.quoteid and flag = 0; if sqlca.sqlcode <> 0 then rslt = 0 arg_msg = '更新报价单失败,' + sqlca.sqlerrtext goto ext end if this.Title = ins_oldTitle + '[' + uo_bill.ModleName + ']' ext: if rslt = 0 then uo_bill.modleid = old_modleid rollback; else commit; end if return rslt end function public function integer wf_update_price (ref string arg_msg);int rslt = 1 long i long ll_mtrlid string ls_dscrp decimal ld_value long ll_flag select flag INTO :ll_flag from u_quote where scid = :ins_quote.scid and quoteid = :ins_quote.quoteid; if sqlca.sqlcode <> 0 then rslt = 0 arg_msg = '查询报价单审核状态失败,' + sqlca.sqlerrtext goto ext end if if ll_flag = 1 then rslt = 0 arg_msg = '报价单已经审核,不能修改报价' goto ext end if for i = 1 to ins_column_count ls_dscrp = dw_1.Describe('mtrl'+string(i)+'_t.tag') ll_mtrlid = long(ls_dscrp) ld_value = dw_1.GetItemDecimal(dw_1.RowCount(), 'mtrl' + String(i)) update u_quotemx set sumprice = :ld_value where scid = :ins_quote.scid and quoteid = :ins_quote.quoteid and mtrlid = :ll_mtrlid; if sqlca.sqlcode <> 0 then rslt = 0 arg_msg = '更新报价单报价明细失败,' + sqlca.sqlerrtext goto ext end if next ext: if rslt = 0 then rollback; else commit; end if return rslt end function on w_cmpl_product_price.create int iCurrent call super::create this.dw_1=create dw_1 this.cb_1=create cb_1 this.cb_3=create cb_3 this.st_1=create st_1 this.cb_2=create cb_2 this.cb_edit=create cb_edit this.cb_addmx=create cb_addmx this.cb_4=create cb_4 this.cb_sort=create cb_sort this.cb_5=create cb_5 this.cb_6=create cb_6 this.cbx_1=create cbx_1 this.ln_bar=create ln_bar this.ln_bar2=create ln_bar2 this.ln_1=create ln_1 this.ln_2=create ln_2 this.r_bar=create r_bar iCurrent=UpperBound(this.Control) this.Control[iCurrent+1]=this.dw_1 this.Control[iCurrent+2]=this.cb_1 this.Control[iCurrent+3]=this.cb_3 this.Control[iCurrent+4]=this.st_1 this.Control[iCurrent+5]=this.cb_2 this.Control[iCurrent+6]=this.cb_edit this.Control[iCurrent+7]=this.cb_addmx this.Control[iCurrent+8]=this.cb_4 this.Control[iCurrent+9]=this.cb_sort this.Control[iCurrent+10]=this.cb_5 this.Control[iCurrent+11]=this.cb_6 this.Control[iCurrent+12]=this.cbx_1 this.Control[iCurrent+13]=this.ln_bar this.Control[iCurrent+14]=this.ln_bar2 this.Control[iCurrent+15]=this.ln_1 this.Control[iCurrent+16]=this.ln_2 this.Control[iCurrent+17]=this.r_bar end on on w_cmpl_product_price.destroy call super::destroy destroy(this.dw_1) destroy(this.cb_1) destroy(this.cb_3) destroy(this.st_1) destroy(this.cb_2) destroy(this.cb_edit) destroy(this.cb_addmx) destroy(this.cb_4) destroy(this.cb_sort) destroy(this.cb_5) destroy(this.cb_6) destroy(this.cbx_1) destroy(this.ln_bar) destroy(this.ln_bar2) destroy(this.ln_1) destroy(this.ln_2) destroy(this.r_bar) end on event open;call super::open;long ls_j, chc string ls_mod string ls_msg long ll_scid long ll_quoteid long ll_mtrlid string ll_mtrlcode string ll_mtrlname s_mtrldef_array S_INSCUST long ll_modleid, ll_col, ll_i, ll_row string ls_dscrp decimal ll_value ins_oldtitle = this.Title uo_modle = create uo_cmpl_modle uo_modle.modleid = 0 uo_bill = create uo_cmpl_bill uo_bill.modleid = 0 ins_quote = create uo_quote ins_quote.commit_transaction = sqlca FOR ls_j = ins_first TO (ins_first + 29) ls_mod = '#' + String(ls_j) + '.Visible = 0' ls_mod = dw_1.Modify(ls_mod) NEXT //============================================================================== // DONE: 获取当前报价单 //============================================================================== s_edit_index_tran s_tran s_tran = message.PowerObjectParm ll_scid = s_tran.b_long ll_quoteid = s_tran.c_long //MessageBox('', string(ll_scid) + ',' + string(ll_quoteid)) if ins_quote.p_getinfo(ll_scid, ll_quoteid, ls_msg) <> 1 then MessageBox('系统错误', ls_msg) cb_exit.postevent(clicked!) return end if SELECT ModleID INTO :ll_modleid FROM u_quote WHERE scid = :ins_quote.scid AND quoteid = :ins_quote.quoteid; if sqlca.sqlcode <> 0 then MessageBox('系统错误', '数据库连接失败,'+ sqlca.sqlerrtext) cb_exit.postevent(clicked!) return end if if ll_modleid = 0 then //============================================================================== // 加载报价单产品 //============================================================================== declare cur1 CURSOR for SELECT DISTINCT u_quotemx.mtrlid, u_mtrldef.mtrlcode, u_mtrldef.mtrlname FROM u_quotemx INNER JOIN u_mtrldef ON u_quotemx.mtrlid = u_mtrldef.mtrlid WHERE (u_quotemx.scid = :ins_quote.scid) AND (u_quotemx.quoteid = :ins_quote.quoteid); open cur1; fetch cur1 INTO :ll_mtrlid, :ll_mtrlcode, :ll_mtrlname; chc = 0 do while sqlca.sqlcode = 0 chc++ S_INSCUST.mtrlid[chc] = ll_mtrlid S_INSCUST.mtrlcode[chc] = ll_mtrlcode S_INSCUST.mtrlname[chc] = ll_mtrlname fetch cur1 INTO :ll_mtrlid, :ll_mtrlcode, :ll_mtrlname; loop close cur1; FOR ls_j = ins_first TO ins_last ls_mod = '#' + String(ls_j) + '.Visible = 0' ls_mod = dw_1.Modify(ls_mod) NEXT chc = 0 FOR ls_j = 1 TO UpperBound(S_INSCUST.mtrlid) IF S_INSCUST.mtrlid[ls_j] > 0 THEN chc ++ ls_mod = 'mtrl' + String(chc) + '.Visible = 1' ls_mod = dw_1.Modify(ls_mod) ls_mod = 'mtrl' + String(chc) + '_t.Text = ~''+String(S_INSCUST.mtrlname[ls_j])+'~'' ls_mod = dw_1.Modify(ls_mod) ls_mod = 'mtrl' + String(chc) + '_t.Tag = ~''+String(S_INSCUST.mtrlid[ls_j])+'~'' ls_mod = dw_1.Modify(ls_mod) ls_mod = 'mtrl' + String(chc) + '.Tag = ~''+String(S_INSCUST.mtrlcode[ls_j])+'~'' ls_mod = dw_1.Modify(ls_mod) END IF NEXT ins_column_count = chc FOR ls_j = (ins_first + 30) TO ins_last ls_mod = '#' + String(ls_j) + '.Visible = 1' ls_mod = dw_1.Modify(ls_mod) NEXT else //============================================================================== // 加载设计模板 //============================================================================== IF uo_bill.GetINfo(ll_modleid, ls_msg) <> 1 THEN MessageBox('', ls_msg) RETURN END IF this.title = ins_oldtitle + '[' + uo_bill.ModleName + ']' declare cur2 cursor for select DISTINCT u_cmpl_modleMx_Mx.mtrlid, u_mtrldef.mtrlcode, u_mtrldef.mtrlname from u_cmpl_modleMx_Mx inner JOIN u_mtrldef ON u_cmpl_modleMx_Mx.mtrlid = u_mtrldef.mtrlid Where (u_cmpl_modleMx_Mx.ModleID = :ll_modleid); open cur2; fetch cur2 INTO :ll_mtrlid, :ll_mtrlcode, :ll_mtrlname; DO WHILE sqlca.SQLCode = 0 ll_col ++ S_INSCUST.mtrlid[ll_col] = ll_mtrlid S_INSCUST.mtrlcode[ll_col] = ll_mtrlcode S_INSCUST.mtrlname[ll_col] = ll_mtrlname fetch cur2 INTO :ll_mtrlid, :ll_mtrlcode, :ll_mtrlname; LOOP close cur2; dw_1.Reset() FOR ls_j = ins_first TO ins_last ls_mod = '#' + String(ls_j) + '.Visible = 0' ls_mod = dw_1.Modify(ls_mod) NEXT chc = 0 FOR ls_j = 1 TO UpperBound(S_INSCUST.mtrlid) IF S_INSCUST.mtrlid[ls_j] > 0 THEN chc ++ ls_mod = 'mtrl' + String(chc) + '.Visible = 1' ls_mod = dw_1.Modify(ls_mod) ls_mod = 'mtrl' + String(chc) + '_t.Text = ~''+String(S_INSCUST.mtrlname[ls_j])+'~'' ls_mod = dw_1.Modify(ls_mod) ls_mod = 'mtrl' + String(chc) + '_t.Tag = ~''+String(S_INSCUST.mtrlid[ls_j])+'~'' ls_mod = dw_1.Modify(ls_mod) ls_mod = 'mtrl' + String(chc) + '.Tag = ~''+String(S_INSCUST.mtrlcode[ls_j])+'~'' ls_mod = dw_1.Modify(ls_mod) END IF NEXT ins_column_count = chc FOR ls_j = (ins_first + 30) TO ins_last ls_mod = '#' + String(ls_j) + '.Visible = 1' ls_mod = dw_1.Modify(ls_mod) NEXT FOR ll_i = 1 TO UpperBound(uo_bill.mxs) ll_row = dw_1.insertrow(0) dw_1.object.printid[ll_row] = uo_bill.mxs[ll_i].printid dw_1.object.parmname[ll_row] = uo_bill.mxs[ll_i].parmname dw_1.object.displayname[ll_row] = uo_bill.mxs[ll_i].displayname dw_1.object.defaultvalue[ll_row] = uo_bill.mxs[ll_i].defaultvalue dw_1.object.if_useformula[ll_row] = uo_bill.mxs[ll_i].if_useformula dw_1.object.formula[ll_row] = uo_bill.mxs[ll_i].formula dw_1.object.if_from_mtrl[ll_row] = uo_bill.mxs[ll_i].if_from_mtrl dw_1.object.mtrlid[ll_row] = uo_bill.mxs[ll_i].mtrlid dw_1.object.mtrl_pro[ll_row] = uo_bill.mxs[ll_i].mtrl_pro dw_1.object.if_from_product[ll_row] = uo_bill.mxs[ll_i].if_from_product dw_1.object.product_pro[ll_row] = uo_bill.mxs[ll_i].product_pro dw_1.object.unit[ll_row] = uo_bill.mxs[ll_i].unit SELECT mtrlcode , mtrlname INTO :ll_mtrlcode, :ll_mtrlname FROM u_mtrldef WHERE mtrlid = :uo_bill.mxs[ll_i].mtrlid; if sqlca.sqlcode <> 0 then ll_mtrlcode = '' ll_mtrlname = '' dw_1.object.mtrlid[ll_row] = 0 end if dw_1.object.mtrlcode[ll_row] = ll_mtrlcode dw_1.object.mtrlname[ll_row] = ll_mtrlname for ll_col = 1 to ins_column_count ls_dscrp = dw_1.Describe('mtrl'+string(ll_col)+'_t.tag') ll_mtrlid = long(ls_dscrp) ll_value = 0 for ls_j = 1 to upperbound(uo_bill.mx_mxs) if uo_bill.mx_mxs[ls_j].printid = uo_bill.mxs[ll_i].printid & and uo_bill.mx_mxs[ls_j].mtrlid = ll_mtrlid then ll_value = uo_bill.mx_mxs[ls_j].value exit end if next dw_1.SetItem(ll_row, 'mtrl' + string(ll_col), ll_value) next NEXT end if wf_refresh() end event event resize;call super::resize;if this.width < 3648 then this.width = 3648 if this.Height < 1996 then this.Height = 1996 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 dw_1.height = this.height - 450 dw_1.width = this.width - 50 end event event close;call super::close;destroy uo_modle destroy uo_bill destroy uo_quote end event event ue_sort;call super::ue_sort;if dw_1.accepttext() <> 1 then return dw_1.SetRedraw(false) dw_1.Sort() Long ll_row FOR ll_row = 1 To dw_1.RowCount() dw_1.Object.printid[ll_row] = ll_row NEXT dw_1.SetRedraw(true) end event event closequery;call super::closequery;IF dw_edit_mode THEN IF MessageBox ("IF","将丢失未保存的修改,是否继续?",Question!,YesNo! ) = 2 THEN RETURN 1 END IF end event type cb_func from w_publ_base`cb_func within w_cmpl_product_price boolean visible = false integer x = 1166 end type type cb_exit from w_publ_base`cb_exit within w_cmpl_product_price integer x = 1641 integer width = 151 integer height = 164 integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type type dw_1 from u_dw_rbtnfilter within w_cmpl_product_price integer y = 296 integer width = 4087 integer height = 1920 integer taborder = 20 boolean bringtotop = true string dataobject = "dw_cmpl_mtrl30" boolean hscrollbar = true boolean vscrollbar = true boolean setcolumn_visible_use = false boolean autosave_filter_use = false boolean autosave_sort_use = false boolean autosave_setlayout_use = false boolean autosave_columnvisible_use = false end type event dwnkey;call super::dwnkey;String ls_mtrlcode,ls_mtrlname,ls_unit,ls_mtrlmode,ls_mtrlsectype,ls_zxmtrlmode String ls_ordercode,ls_relcode,ls_unit_buy Long ls_mtrlid,ls_sptid,ls_orderid,ls_storageid Dec ls_planprice,ls_lmbuyprice,ls_price,ls_rebate,ld_rate_buy Long cnt Long child_row Long ls_null SetNull(ls_null) String arg_msg = '' Decimal ls_1stnewcost,ls_1stzqrate,ls_1strate String ls_sptmtrlname String ls_1stunit,ls_status,ls_woodcode,ls_pcode Int li_statusflag,li_woodcodeflag,li_pcodeflag decimal ld_value long ll_col s_mtrldef_array arg_s_mtrldef IF dw_edit_mode THEN IF KeyDown(keydownarrow!) THEN Long li_row IF dw_1.GetRow() = dw_1.RowCount() THEN if dw_1.AcceptText() <> 1 then return 1 parent.triggerevent('ue_addmx') END IF ELSE IF KeyDown(keyenter!) AND NOT KeyDown(keycontrol!) AND NOT KeyDown(keyshift!) THEN if dw_1.AcceptText() <> 1 then return 1 IF dw_1.GetColumnName() = 'mtrlcode' THEN child_row = dw_1.GetRow() ls_mtrlcode = dw_1.Object.mtrlcode[child_row] ls_storageid = -1 if trim(ls_mtrlcode) = '' then dw_1.Object.mtrlid[child_row] = 0 dw_1.Object.mtrlcode[child_row] = '' dw_1.object.mtrlname[child_row] = '' else IF f_find_mtrl(ls_mtrlcode,ls_storageid,arg_s_mtrldef) = 0 THEN PARENT.TriggerEvent('ue_pickmtrl') RETURN 1 ELSE ls_mtrlid = arg_s_mtrldef.mtrlid[1] ls_mtrlcode = arg_s_mtrldef.mtrlcode[1] ls_mtrlname = arg_s_mtrldef.mtrlname[1] ls_unit = arg_s_mtrldef.unit[1] END IF dw_1.Object.mtrlid[child_row] = ls_mtrlid dw_1.Object.mtrlcode[child_row] = ls_mtrlcode dw_1.Object.mtrlname[child_row] = ls_mtrlname dw_1.object.unit[child_row] = ls_unit SELECT price INTO :ld_value FROM v_maxprice_sptprice WHERE mtrlid = :ls_mtrlid; if sqlca.sqlcode <> 0 then ld_value = 0 end if dw_1.object.defaultvalue[child_row] = ld_value end if IF Key = keyenter! THEN keybd_event ( 9, 0, 0 , 0 ) // 按下tab keybd_event ( 9, 0, 2, 0 ) // 释放tab RETURN 1 END IF ELSEIF dw_1.GetColumnName( ) = 'product_pro' AND dw_1.GetRow() = dw_1.RowCount() THEN parent.triggerevent('ue_addmx') RETURN 1 ELSE IF Key = keyenter! THEN keybd_event ( 9, 0, 0 , 0 ) // 按下tab keybd_event ( 9, 0, 2, 0 ) // 释放tab RETURN 1 END IF END IF END IF END IF END IF // u_mtrldef_mtrlcode // acprice // mtrlid // mtrlname // plprice end event event itemchanged;call super::itemchanged;if dwo.name = 'if_useformula' OR dwo.name = 'if_from_mtrl' OR dwo.name = 'if_from_product' then if trim(data) = '1' then if dwo.name <> 'if_useformula' then this.object.if_useformula[row] = 0 end if if dwo.name <> 'if_from_mtrl' then this.object.if_from_mtrl[row] = 0 end if if dwo.name <> 'if_from_product' then this.object.if_from_product[row] = 0 end if end if end if if dwo.name = 'parmname' then if this.object.displayname[row] = this.object.parmname[row] then this.object.displayname[row] = data end if end if end event event doubleclicked;call super::doubleclicked;if not dw_edit_mode then return if this.accepttext() <> 1 then return if dwo.name = 'formula' then s_cmpl_parm s_parm long i for i = 1 to row - 1 s_parm.parmname[i] = this.object.parmname[i] s_parm.displayname[i] = this.object.displayname[i] s_parm.parmvalue[i] = this.object.defaultvalue[i] next s_parm.oldformula = this.object.formula[row] openwithparm(w_cmpl_formula_edit, s_parm) string ls_ret ls_ret = message.StringParm if ls_ret <> 'NULL' then this.object.formula[row] = ls_ret end if end if if dwo.name = 'mtrlcode' then // DONE: 选择物料 parent.triggerevent('ue_pickmtrl') end if end event type cb_1 from uo_imflatbutton within w_cmpl_product_price boolean visible = false integer width = 274 integer height = 164 integer taborder = 30 boolean bringtotop = true string text = "产品选择" string normalpicname = "OPEN.BMP" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;parent.triggerevent('ue_f8') end event type cb_3 from uo_imflatbutton within w_cmpl_product_price integer x = 192 integer width = 366 integer height = 164 integer taborder = 30 boolean bringtotop = true boolean enabled = false string text = "选择计价模板" string normalpicname = "OPEN.BMP" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;if not dw_edit_mode then return parent.triggerevent('ue_f9') end event type st_1 from statictext within w_cmpl_product_price integer x = 23 integer y = 196 integer width = 1024 integer height = 72 boolean bringtotop = true integer textsize = -12 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 cb_2 from uo_imflatbutton within w_cmpl_product_price integer x = 1024 integer width = 151 integer height = 164 integer taborder = 30 boolean bringtotop = true boolean enabled = false string text = "计算" string normalpicname = "xls_efdppict.BMP" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;if not dw_edit_mode then return parent.triggerevent('ue_f10') end event type cb_edit from uo_imflatbutton within w_cmpl_product_price integer width = 192 integer height = 164 integer taborder = 30 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;// TODO: 没有权限不能修改 string ls_msg s_inputbox s_parm string ls_return if ins_quote.flag = 1 then MessageBox('提示', '报价单已经审核不能修改') return end if if dw_edit_mode then if wf_save(ls_msg) <> 1 then MessageBox('提示', ls_msg) return end if if cbx_1.checked then cb_6.postevent(clicked!) end if else if uo_bill.ModleID = 0 then if uo_bill.Newbegin(ls_msg) <> 1 then MessageBox('提示', ls_msg) return end if uo_bill.ModleName = ins_quote.quotecode else if uo_bill.UpdateBegin(uo_bill.Modleid, ls_msg) <> 1 then MessageBox('提示', ls_msg) return end if end if end if dw_edit_mode = not dw_edit_mode wf_refresh() end event type cb_addmx from uo_imflatbutton within w_cmpl_product_price integer x = 558 integer width = 151 integer height = 164 integer taborder = 40 boolean bringtotop = true boolean enabled = false string text = "增行" string normalpicname = "mx1.BMP" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;if not dw_edit_mode then return parent.triggerevent('ue_addmx') end event type cb_4 from uo_imflatbutton within w_cmpl_product_price integer x = 709 integer width = 151 integer height = 164 integer taborder = 50 boolean bringtotop = true boolean enabled = false string text = "删行" string normalpicname = "mx2.BMP" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;if not dw_edit_mode then return parent.triggerevent('ue_delmx') end event type cb_sort from uo_imflatbutton within w_cmpl_product_price integer x = 859 integer width = 165 integer height = 164 integer taborder = 40 boolean bringtotop = true boolean enabled = false string text = "重排" string normalpicname = "p2.BMP" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;if not dw_edit_mode then return parent.triggerevent('ue_sort') end event type cb_5 from uo_imflatbutton within w_cmpl_product_price integer x = 1175 integer width = 165 integer height = 164 integer taborder = 50 boolean bringtotop = true boolean enabled = false string text = "重置" string normalpicname = "Undo.bmp" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;// DONE: 打开工作表 Long arg_Modleid String ls_msg s_mtrldef_array S_INSCUST Long ll_col = 0, ls_j, chc, ll_row, ll_i Long ll_mtrlid String ll_mtrlcode String ll_mtrlname string ls_dscrp decimal ll_value if not dw_edit_mode then return IF MessageBox ("IF","重置将丢失未保存的修改,是否继续?",Question!,YesNo! ) = 2 THEN RETURN arg_ModleID = uo_bill.modleid if arg_ModleID = 0 then dw_1.Reset() return end if IF uo_bill.GetINfo(arg_Modleid, ls_msg) <> 1 THEN MessageBox('', ls_msg) RETURN END IF parent.title = ins_oldtitle + '[' + uo_bill.ModleName + ']' declare cur1 cursor for select DISTINCT u_cmpl_modleMx_Mx.mtrlid, u_mtrldef.mtrlcode, u_mtrldef.mtrlname from u_cmpl_modleMx_Mx inner JOIN u_mtrldef ON u_cmpl_modleMx_Mx.mtrlid = u_mtrldef.mtrlid Where (u_cmpl_modleMx_Mx.ModleID = :arg_Modleid); open cur1; fetch cur1 INTO :ll_mtrlid, :ll_mtrlcode, :ll_mtrlname; DO WHILE sqlca.SQLCode = 0 ll_col ++ S_INSCUST.mtrlid[ll_col] = ll_mtrlid S_INSCUST.mtrlcode[ll_col] = ll_mtrlcode S_INSCUST.mtrlname[ll_col] = ll_mtrlname fetch cur1 INTO :ll_mtrlid, :ll_mtrlcode, :ll_mtrlname; LOOP close cur1; dw_1.Reset() String ls_mod FOR ls_j = ins_first TO ins_last ls_mod = '#' + String(ls_j) + '.Visible = 0' ls_mod = dw_1.Modify(ls_mod) NEXT chc = 0 FOR ls_j = 1 TO UpperBound(S_INSCUST.mtrlid) IF S_INSCUST.mtrlid[ls_j] > 0 THEN chc ++ ls_mod = 'mtrl' + String(chc) + '.Visible = 1' ls_mod = dw_1.Modify(ls_mod) ls_mod = 'mtrl' + String(chc) + '_t.Text = ~''+String(S_INSCUST.mtrlname[ls_j])+'~'' ls_mod = dw_1.Modify(ls_mod) ls_mod = 'mtrl' + String(chc) + '_t.Tag = ~''+String(S_INSCUST.mtrlid[ls_j])+'~'' ls_mod = dw_1.Modify(ls_mod) ls_mod = 'mtrl' + String(chc) + '.Tag = ~''+String(S_INSCUST.mtrlcode[ls_j])+'~'' ls_mod = dw_1.Modify(ls_mod) END IF NEXT ins_column_count = chc FOR ls_j = (ins_first + 30) TO ins_last ls_mod = '#' + String(ls_j) + '.Visible = 1' ls_mod = dw_1.Modify(ls_mod) NEXT FOR ll_i = 1 TO UpperBound(uo_bill.mxs) ll_row = dw_1.insertrow(0) dw_1.object.printid[ll_row] = uo_bill.mxs[ll_i].printid dw_1.object.parmname[ll_row] = uo_bill.mxs[ll_i].parmname dw_1.object.displayname[ll_row] = uo_bill.mxs[ll_i].displayname dw_1.object.defaultvalue[ll_row] = uo_bill.mxs[ll_i].defaultvalue dw_1.object.if_useformula[ll_row] = uo_bill.mxs[ll_i].if_useformula dw_1.object.formula[ll_row] = uo_bill.mxs[ll_i].formula dw_1.object.if_from_mtrl[ll_row] = uo_bill.mxs[ll_i].if_from_mtrl dw_1.object.mtrlid[ll_row] = uo_bill.mxs[ll_i].mtrlid dw_1.object.mtrl_pro[ll_row] = uo_bill.mxs[ll_i].mtrl_pro dw_1.object.if_from_product[ll_row] = uo_bill.mxs[ll_i].if_from_product dw_1.object.product_pro[ll_row] = uo_bill.mxs[ll_i].product_pro dw_1.object.unit[ll_row] = uo_bill.mxs[ll_i].unit SELECT mtrlcode , mtrlname INTO :ll_mtrlcode, :ll_mtrlname FROM u_mtrldef WHERE mtrlid = :uo_bill.mxs[ll_i].mtrlid; if sqlca.sqlcode <> 0 then ll_mtrlcode = '' ll_mtrlname = '' dw_1.object.mtrlid[ll_row] = 0 end if dw_1.object.mtrlcode[ll_row] = ll_mtrlcode dw_1.object.mtrlname[ll_row] = ll_mtrlname for ll_col = 1 to ins_column_count ls_dscrp = dw_1.Describe('mtrl'+string(ll_col)+'_t.tag') ll_mtrlid = long(ls_dscrp) ll_value = 0 for ls_j = 1 to upperbound(uo_bill.mx_mxs) if uo_bill.mx_mxs[ls_j].printid = uo_bill.mxs[ll_i].printid & and uo_bill.mx_mxs[ls_j].mtrlid = ll_mtrlid then ll_value = uo_bill.mx_mxs[ls_j].value exit end if next dw_1.SetItem(ll_row, 'mtrl' + string(ll_col), ll_value) next NEXT dw_edit_mode = not dw_edit_mode wf_refresh() end event type cb_6 from uo_imflatbutton within w_cmpl_product_price integer x = 1339 integer height = 164 integer taborder = 20 boolean bringtotop = true string text = "更新报价" string normalpicname = "update.BMP" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;// TODO: 更新报价权限 if dw_1.rowcount() <= 0 then MessageBox('提示', '没有报价内容,不能更新') return end if string ls_msg if wf_update_price(ls_msg) <> 1 then MessageBox('提示', ls_msg) return end if messageBox('', '更新报价成功') end event type cbx_1 from checkbox within w_cmpl_product_price integer x = 1111 integer y = 188 integer width = 521 integer height = 92 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 checked = true end type type ln_bar from line within w_cmpl_product_price long linecolor = 268435456 integer linethickness = 4 integer beginy = 172 integer endx = 3200 integer endy = 172 end type type ln_bar2 from line within w_cmpl_product_price long linecolor = 16777215 integer linethickness = 4 integer beginx = 9 integer beginy = 176 integer endx = 3273 integer endy = 176 end type type ln_1 from line within w_cmpl_product_price long linecolor = 268435456 integer linethickness = 4 integer beginy = 284 integer endx = 3250 integer endy = 284 end type type ln_2 from line within w_cmpl_product_price long linecolor = 16777215 integer linethickness = 4 integer beginy = 288 integer endx = 3282 integer endy = 288 end type type r_bar from rectangle within w_cmpl_product_price long linecolor = 16777215 integer linethickness = 4 long fillcolor = 1073741824 integer x = 1998 integer y = 40 integer width = 87 integer height = 68 end type event constructor;this.fillcolor = 14215660 this.linecolor = 14215660 this.x = -1 this.y = -1 this.height = ln_bar.beginy - 5 end event