$PBExportHeader$w_quoterqmtrl.srw forward global type w_quoterqmtrl from w_publ_base end type type cb_1 from uo_imflatbutton within w_quoterqmtrl end type type cb_mx1 from uo_imflatbutton within w_quoterqmtrl end type type cb_mx2 from uo_imflatbutton within w_quoterqmtrl end type type dw_2 from u_dw_rbtnfilter within w_quoterqmtrl end type type cb_cmpl from uo_imflatbutton within w_quoterqmtrl end type type cb_rqmtrl from uo_imflatbutton within w_quoterqmtrl end type type cb_workprice from uo_imflatbutton within w_quoterqmtrl end type type tab_1 from tab within w_quoterqmtrl end type type tabpage_1 from userobject within tab_1 end type type dw_1 from u_dw_rbtnfilter within tabpage_1 end type type tabpage_1 from userobject within tab_1 dw_1 dw_1 end type type tabpage_2 from userobject within tab_1 end type type dw_3 from u_dw_rbtnfilter within tabpage_2 end type type tabpage_2 from userobject within tab_1 dw_3 dw_3 end type type tab_1 from tab within w_quoterqmtrl tabpage_1 tabpage_1 tabpage_2 tabpage_2 end type type cb_chmtrl from uo_imflatbutton within w_quoterqmtrl end type type mle_message from multilineedit within w_quoterqmtrl end type type cb_other from uo_imflatbutton within w_quoterqmtrl end type type cb_2 from uo_imflatbutton within w_quoterqmtrl end type type ln_bar from line within w_quoterqmtrl end type type ln_bar2 from line within w_quoterqmtrl end type type r_bar from rectangle within w_quoterqmtrl end type end forward global type w_quoterqmtrl from w_publ_base integer width = 3611 integer height = 2380 string title = "报价单明细成本" boolean minbox = false windowtype windowtype = response! event ue_cmpl ( ) event ue_addrqmtrl ( ) event ue_delmtrlmx ( ) event ue_changemtrl ( ) event ue_addworkprice ( ) event ue_view_workprice ( ) event ue_view_structure ( ) event ue_add_workprice ( ) event ue_add_structure ( ) event ue_cmpl_mj ( ) event ue_cmpl_zc ( ) event ue_f8 ( ) cb_1 cb_1 cb_mx1 cb_mx1 cb_mx2 cb_mx2 dw_2 dw_2 cb_cmpl cb_cmpl cb_rqmtrl cb_rqmtrl cb_workprice cb_workprice tab_1 tab_1 cb_chmtrl cb_chmtrl mle_message mle_message cb_other cb_other cb_2 cb_2 ln_bar ln_bar ln_bar2 ln_bar2 r_bar r_bar end type global w_quoterqmtrl w_quoterqmtrl type variables s_quotemx_open s_mx uo_quote uo_q datawindow dw_1,dw_3 long il_printid = 0 end variables forward prototypes public function integer wf_addwpmx (long arg_mtrlid, string arg_pfcode, decimal arg_qty, ref string arg_msg) public subroutine wf_delmtrlmx (long arg_mtrlid, long arg_lp, long arg_row) public subroutine wf_addmtrlmx () public subroutine wf_addworkprice () public function window getparentwin () end prototypes event ue_cmpl();Long ll_row,ll_mtrlid Decimal ld_price,ld_wfjgprice,ld_jgprice String ls_mtrlcode,ls_pfcode,arg_msg uo_cmplcost uo_cmpl dw_2.AcceptText() dw_1.AcceptText() dw_3.AcceptText() ll_row = dw_2.GetRow() IF ll_row <= 0 THEN MessageBox('提示','没有可计算的物料') RETURN END IF Long ll_i Decimal ld_outcost,ld_outcost_sum FOR ll_i = 1 TO dw_1.RowCount() IF dw_1.Object.u_mtrldef_mtrlorigin[ll_i] = 2 THEN ld_price = ld_price + dw_1.Object.u_quoterqmtrl_rqqty[ll_i] * dw_1.Object.u_quoterqmtrl_newprice[ll_i] ELSEIF dw_1.Object.u_mtrldef_mtrlorigin[ll_i] = 3 THEN ld_wfjgprice = ld_wfjgprice + dw_1.Object.u_quoterqmtrl_rqqty[ll_i] * dw_1.Object.u_quoterqmtrl_newprice[ll_i] END IF ll_mtrlid = dw_1.Object.u_quoterqmtrl_mtrlid[ll_i] // SELECT isnull(sum(u_mtrl_cost.cost),0) INTO :ld_outcost // FROM u_mtrl_cost INNER JOIN // u_itemdef ON u_mtrl_cost.itemid = u_itemdef.itemid // WHERE u_mtrl_cost.mtrlid = :ll_mtrlid // AND u_itemdef.ifcost = 1; // IF sqlca.SQLCode <> 0 THEN // MessageBox('Error','查询物料:'+String(dw_1.Object.u_mtrldef_mtrlcode[ll_i])+'费用成本失败') // RETURN // END IF ld_outcost_sum = ld_outcost_sum + ld_outcost * dw_1.Object.u_quoterqmtrl_rqqty[ll_i] NEXT ll_mtrlid = dw_2.Object.u_quotemx_mtrlid[ll_row] //SELECT isnull(sum(u_mtrl_cost.cost),0) INTO :ld_outcost // FROM u_mtrl_cost INNER JOIN // u_itemdef ON u_mtrl_cost.itemid = u_itemdef.itemid // WHERE u_mtrl_cost.mtrlid = :ll_mtrlid // AND u_itemdef.ifcost = 1; //IF sqlca.SQLCode <> 0 THEN // MessageBox('Error','查询物料:'+String(dw_2.Object.u_mtrldef_mtrlcode[ll_row])+'费用成本失败') // RETURN //END IF ld_outcost_sum = ld_outcost_sum + ld_outcost FOR ll_i = 1 TO dw_3.RowCount() ld_jgprice = ld_jgprice + dw_3.Object.u_quoteworkprice_workqty[ll_i] * dw_3.Object.u_quoteworkprice_workprice[ll_i] NEXT dw_2.Object.u_quotemx_mtrlcost[ll_row] = ld_price dw_2.Object.u_quotemx_wfjgprice[ll_row] = ld_wfjgprice dw_2.Object.u_quotemx_mancost[ll_row] = ld_jgprice dw_2.Object.u_quotemx_outcost[ll_row] = ld_outcost_sum end event event ue_addrqmtrl();Long child_row Long ll_ucrow ll_ucrow = dw_2.GetRow() IF ll_ucrow <= 0 THEN MessageBox('系统提示','没有报价单据明细内容') RETURN END IF Long i Decimal ld_tmp_price_be,ld_tmp_price_af ld_tmp_price_be = 0 dw_1.AcceptText() FOR i = 1 TO dw_1.RowCount() IF dw_1.Object.u_mtrldef_mtrlorigin[i] = 3 OR dw_1.Object.u_mtrldef_mtrlorigin[i] = 2 THEN ld_tmp_price_be = ld_tmp_price_be + dw_1.Object.u_quoterqmtrl_rqqty[i] * dw_1.Object.u_quoterqmtrl_newprice[i] END IF NEXT child_row = dw_1.GetRow() 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.f_long = -1 Long chc = 1,ls_j Long ll_lp,ll_pmtrlid Decimal ld_price OpenWithParm(W_mtrldef_edit,s_tranf8) //调用 s_mtrldef_array S_INSCUST S_INSCUST = Message.PowerObjectParm //接受返回结构 FOR ls_j = 1 TO UpperBound(S_INSCUST.mtrlid) IF S_INSCUST.mtrlid[ls_j] > 0 THEN //正常返回值则可以取以下值 IF dw_1.Find('u_quoterqmtrl_mtrlid='+String(S_INSCUST.mtrlid[ls_j]),1,dw_1.RowCount()) = 0 THEN IF dw_1.GetRow() > 0 THEN IF dw_1.Object.u_quoterqmtrl_mtrlid[child_row] <> 0 THEN ll_lp = dw_1.Object.u_quoterqmtrl_lp[child_row] ll_pmtrlid = dw_1.Object.u_quoterqmtrl_pmtrlid[child_row] child_row = dw_1.InsertRow (0) ELSE child_row = dw_1.GetRow() ll_pmtrlid = dw_2.Object.u_quotemx_mtrlid[ll_ucrow] ll_lp = 1 END IF ELSE child_row = dw_1.InsertRow (0) ll_pmtrlid = dw_2.Object.u_quotemx_mtrlid[ll_ucrow] ll_lp = 1 END IF dw_1.Object.u_quoterqmtrl_mtrlid[child_row] = S_INSCUST.mtrlid[ls_j] dw_1.Object.u_mtrldef_mtrlcode [child_row] = S_INSCUST.mtrlcode[ls_j] dw_1.Object.u_mtrldef_mtrlname[child_row] = S_INSCUST.mtrlname[ls_j] dw_1.Object.u_mtrldef_unit[child_row] = S_INSCUST.unit[ls_j] dw_1.Object.u_mtrldef_mtrlorigin[child_row] = S_INSCUST.mtrlorigin[ls_j] dw_1.Object.u_quoterqmtrl_rqqty[child_row] = 0 dw_1.Object.u_quoterqmtrl_lp[child_row] = ll_lp dw_1.Object.u_quoterqmtrl_pmtrlid[child_row] = ll_pmtrlid IF S_INSCUST.mtrlorigin[ls_j] = 2 OR S_INSCUST.mtrlorigin[ls_j] = 3 THEN SELECT price INTO :ld_price FROM v_maxprice_sptprice Where mtrlid = :S_INSCUST.mtrlid[ls_j]; IF sqlca.SQLCode <> 0 THEN ld_price = 0 END IF dw_1.Object.u_quoterqmtrl_newprice[child_row] = ld_price END IF END IF END IF NEXT dw_1.SetFocus() dw_1.ScrollToRow(dw_1.RowCount()) dw_1.AcceptText() FOR i = 1 TO dw_1.RowCount() IF dw_1.Object.u_mtrldef_mtrlorigin[i] = 3 OR dw_1.Object.u_mtrldef_mtrlorigin[i] = 2 THEN ld_tmp_price_af = ld_tmp_price_af + dw_1.Object.u_quoterqmtrl_rqqty[i] * dw_1.Object.u_quoterqmtrl_newprice[i] END IF NEXT il_printid++ mle_message.Text = mle_message.Text +'(' +String(il_printid)+')增料前后差额:'+String(ld_tmp_price_af - ld_tmp_price_be,'#,##0.00########') + '~r~n' END IF // u_mtrldef_mtrlcode // u_mtrldef_mtrlname // u_mtrldef_unit // u_quoterqmtrl_rqqty // u_quoterqmtrl_rqdate //u_quoterqmtrl_dstrqty // u_quoterqmtrl_mtrlid end event event ue_delmtrlmx();IF MessageBox ("询问","该物料的下级物料明细将会同时删除,是否确定要删除当前用料明细?",Question!,YesNo! ) = 2 THEN RETURN Long ll_row ll_row = dw_1.GetRow() IF ll_row = 0 THEN MessageBox('提示','请选择删除的行对象!') RETURN END IF Long ll_mtrlid ,ll_lp ll_mtrlid = dw_1.Object.u_quoterqmtrl_mtrlid[ll_row] ll_lp = dw_1.Object.u_quoterqmtrl_lp[ll_row] Long ll_i Long i Decimal ld_tmp_price_be,ld_tmp_price_af ld_tmp_price_be = 0 dw_1.AcceptText() FOR i = 1 TO dw_1.RowCount() IF dw_1.Object.u_mtrldef_mtrlorigin[i] = 3 OR dw_1.Object.u_mtrldef_mtrlorigin[i] = 2 THEN ld_tmp_price_be = ld_tmp_price_be + dw_1.Object.u_quoterqmtrl_rqqty[i] * dw_1.Object.u_quoterqmtrl_newprice[i] END IF NEXT dw_1.SetRedraw(FALSE) wf_delmtrlmx(ll_mtrlid,ll_lp,ll_row) dw_1.DeleteRow (ll_row) dw_1.SetRedraw(TRUE) FOR i = 1 TO dw_1.RowCount() IF dw_1.Object.u_mtrldef_mtrlorigin[i] = 3 OR dw_1.Object.u_mtrldef_mtrlorigin[i] = 2 THEN ld_tmp_price_af = ld_tmp_price_af + dw_1.Object.u_quoterqmtrl_rqqty[i] * dw_1.Object.u_quoterqmtrl_newprice[i] END IF NEXT il_printid++ mle_message.Text = mle_message.Text +'(' +String(il_printid)+')删料前后差额:'+String(ld_tmp_price_af - ld_tmp_price_be,'#,##0.00########') + '~r~n' end event event ue_changemtrl();IF MessageBox ("询问","该物料的下级物料明细将会同时被替换,是否确定要换料?",Question!,YesNo! ) = 2 THEN RETURN //Long ll_row_ch //ll_row_ch = dw_1.GetRow() // //IF ll_row_ch = 0 THEN // MessageBox('提示','请选择要换料的对象!') // RETURN //END IF // //Long ll_mtrlid ,ll_lp //Long ll_pmtrlid //DateTime ld_requiredate //String ls_pfcode //String arg_msg //Decimal ld_price //Long ll_row //Decimal ld_rqqty //ll_mtrlid = dw_1.Object.u_quoterqmtrl_mtrlid[ll_row_ch] //ll_lp = dw_1.Object.u_quoterqmtrl_lp[ll_row_ch] //ll_pmtrlid = dw_1.Object.u_quoterqmtrl_pmtrlid[ll_row_ch] //ld_rqqty = dw_1.Object.u_quoterqmtrl_rqqty[ll_row_ch] //Long ll_i // //Long i //Decimal ld_tmp_price_be,ld_tmp_price_af //ld_tmp_price_be = 0 //dw_1.AcceptText() //FOR i = 1 TO dw_1.RowCount() // IF dw_1.Object.u_mtrldef_mtrlorigin[i] = 3 OR dw_1.Object.u_mtrldef_mtrlorigin[i] = 2 THEN // ld_tmp_price_be = ld_tmp_price_be + dw_1.Object.u_quoterqmtrl_rqqty[i] * dw_1.Object.u_quoterqmtrl_newprice[i] // END IF //NEXT // //IF NOT IsValid(w_order_ml_orderrqmtrl_change) THEN // // Long chc = 1,ls_j // // OpenWithParm(w_order_ml_orderrqmtrl_change,ll_mtrlid) //调用 // s_mtrldef_array S_INSCUST // // S_INSCUST = Message.PowerObjectParm //接受返回结构 // FOR ls_j = 1 TO UpperBound(S_INSCUST.mtrlid) // IF S_INSCUST.mtrlid[1] > 0 THEN //正常返回值则可以取以下值 // ls_pfcode = f_get_dft_pf(S_INSCUST.mtrlid[1]) // // s_order_ml_rqmtrl s_ref_mtrl // uo_order_ml_mrp uo_ml_mrp // uo_ml_mrp = CREATE uo_order_ml_mrp // // IF uo_ml_mrp.uof_cmpl_rqmtrl(0,-1,0,0,S_INSCUST.mtrlid[1],& // '','','',ls_pfcode,ld_rqqty,'',0,0,& // ld_requiredate,0,0,'','','','',0,0,0,0,s_ref_mtrl,arg_msg) = 0 THEN // MessageBox('Error',arg_msg) // RETURN // END IF // // dw_1.SetRedraw(FALSE) // wf_delmtrlmx(ll_mtrlid,ll_lp,ll_row_ch) // dw_1.SetRedraw(TRUE) // // dw_1.SetRedraw(FALSE) // FOR ll_i = UpperBound(s_ref_mtrl.mtrlid) TO 1 STEP - 1 // IF ll_i = UpperBound(s_ref_mtrl.mtrlid) THEN // ll_row = ll_row_ch // ELSE // ll_row = dw_1.InsertRow(ll_row) // END IF // // dw_1.Object.u_mtrldef_mtrlcode[ll_row] = s_ref_mtrl.mtrlcode[ll_i] // dw_1.Object.u_mtrldef_mtrlname[ll_row] = s_ref_mtrl.mtrlname[ll_i] // dw_1.Object.u_mtrldef_mtrlmode[ll_row] = s_ref_mtrl.mtrlmode[ll_i] // dw_1.Object.u_mtrldef_unit[ll_row] = s_ref_mtrl.unit[ll_i] // dw_1.Object.u_mtrldef_mtrlorigin[ll_row] = s_ref_mtrl.mtrlorigin[ll_i] // // // // dw_1.Object.u_orderrqmtrl_tree_status[ll_row] = s_ref_mtrl.status[ll_i] // // dw_1.Object.u_orderrqmtrl_tree_woodcode[ll_row] = s_ref_mtrl.woodcode[ll_i] // // dw_1.Object.u_orderrqmtrl_tree_pcode[ll_row] = s_ref_mtrl.pcode[ll_i] // // // dw_1.Object.u_quoterqmtrl_lp[ll_row] = s_ref_mtrl.lp[ll_i] + ll_lp // dw_1.Object.u_quoterqmtrl_mtrlid[ll_row] = s_ref_mtrl.mtrlid[ll_i] // dw_1.Object.u_quoterqmtrl_rqqty[ll_row] = s_ref_mtrl.qty[ll_i] // dw_1.Object.u_quoterqmtrl_pmtrlid[ll_row] = s_ref_mtrl.pmtrlid[ll_i] // // IF s_ref_mtrl.mtrlorigin[ll_i] = 2 OR s_ref_mtrl.mtrlorigin[ll_i] = 3 THEN // SELECT price INTO :ld_price // FROM v_maxprice_sptprice // Where mtrlid = :s_ref_mtrl.mtrlid[ll_i]; // IF sqlca.SQLCode <> 0 THEN // ld_price = 0 // END IF // dw_1.Object.u_quoterqmtrl_newprice[ll_row] = ld_price // END IF // // NEXT // // dw_1.SetRedraw(TRUE) // END IF // // FOR i = 1 TO dw_1.RowCount() // IF dw_1.Object.u_mtrldef_mtrlorigin[i] = 3 OR dw_1.Object.u_mtrldef_mtrlorigin[i] = 2 THEN // ld_tmp_price_af = ld_tmp_price_af + dw_1.Object.u_quoterqmtrl_rqqty[i] * dw_1.Object.u_quoterqmtrl_newprice[i] // END IF // NEXT // // il_printid++ // mle_message.Text = mle_message.Text +'(' +string(il_printid)+')换料前后差额:'+String(ld_tmp_price_af - ld_tmp_price_be,'#,##0.00########') + '~r~n' // // // NEXT // //END IF //dw_1.AcceptText() // // // // // end event event ue_addworkprice();Long ll_row Long ll_ucrow ll_ucrow = dw_2.GetRow() IF ll_ucrow <= 0 THEN MessageBox('系统提示','没有报价单明细内容') RETURN END IF ll_row = dw_3.GetRow() long ll_mtrlid string ls_mtrlcode,ls_mtrlname,ls_mtrlmode IF ll_row <= 0 THEN ll_row = dw_3.InsertRow(0) dw_3.object.u_quoteworkprice_mtrlid[ll_row] = dw_2.object.u_quotemx_mtrlid[ll_ucrow] dw_3.object.u_mtrldef_mtrlcode[ll_row] = dw_2.object.u_mtrldef_mtrlcode[ll_ucrow] dw_3.object.u_mtrldef_mtrlname[ll_row] = dw_2.object.u_mtrldef_mtrlname[ll_ucrow] dw_3.object.u_mtrldef_mtrlmode[ll_row] = dw_2.object.u_mtrldef_mtrlmode[ll_ucrow] ELSE ll_mtrlid = dw_3.object.u_quoteworkprice_mtrlid[ll_row] ls_mtrlcode = dw_3.object.u_mtrldef_mtrlcode[ll_row] ls_mtrlname = dw_3.object.u_mtrldef_mtrlname[ll_row] ls_mtrlmode = dw_3.object.u_mtrldef_mtrlmode[ll_row] ll_row = dw_3.InsertRow(ll_row) dw_3.object.u_quoteworkprice_mtrlid[ll_row] = ll_mtrlid dw_3.object.u_mtrldef_mtrlcode[ll_row] = ls_mtrlcode dw_3.object.u_mtrldef_mtrlname[ll_row] = ls_mtrlname dw_3.object.u_mtrldef_mtrlmode[ll_row] = ls_mtrlmode END IF end event event ue_view_workprice();long ll_row long ll_mtrlid string ls_mtrlcode ll_row = dw_2.getrow() ll_mtrlid = dw_2.object.u_quotemx_mtrlid[ll_row] ls_mtrlcode = dw_2.object.u_mtrldef_mtrlcode[ll_row] s_edit_index_tran s_tran s_tran.if_retrieve_all = TRUE //是否一次RETRIEVE所有行 s_tran.work_mode = 0 //0-单纯编辑模式, 1-选择模式 s_tran.arg_pkid = 0 //目标定位PKID (备用) s_tran.arg_string_code = ls_mtrlcode //查询列部分内容,用于初步筛选 //s_tran.mainid = arg_mainid openwithparm(w_sc_workpricetable, s_tran) end event event ue_view_structure();long ll_row long ll_mtrlid string ls_mtrlcode ll_row = dw_2.getrow() ll_mtrlid = dw_2.object.u_quotemx_mtrlid[ll_row] ls_mtrlcode = dw_2.object.u_mtrldef_mtrlcode[ll_row] s_edit_index_tran s_tran s_tran.if_retrieve_all = TRUE //是否一次RETRIEVE所有行 s_tran.work_mode = 0 //0-单纯编辑模式, 1-选择模式 s_tran.arg_pkid = 0 //目标定位PKID (备用) s_tran.arg_string_code = ls_mtrlcode //查询列部分内容,用于初步筛选 //s_tran.mainid = arg_mainid openwithparm(w_mtrl_structure, s_tran) end event event ue_add_workprice();Long ll_row Long ll_mtrlid String ls_mtrlcode Long i dw_3.AcceptText() ll_row = dw_2.GetRow() ll_mtrlid = dw_2.Object.u_quotemx_mtrlid[ll_row] ls_mtrlcode = dw_2.Object.u_mtrldef_mtrlcode[ll_row] s_edit_index_tran s_tran s_tran.if_retrieve_all = True //是否一次RETRIEVE所有行 s_tran.work_mode = 0 //0-单纯编辑模式, 1-选择模式 s_tran.arg_pkid = 0 //目标定位PKID (备用) s_tran.arg_string_code = ls_mtrlcode //查询列部分内容,用于初步筛选 //s_tran.mainid = arg_mainid s_tran.b_long = ll_mtrlid s_tran.dw_share = dw_3 OpenWithParm(w_sc_workpricetable, s_tran) end event event ue_add_structure();long ll_row long ll_mtrlid string ls_mtrlcode ll_row = dw_2.getrow() ll_mtrlid = dw_2.object.u_quotemx_mtrlid[ll_row] ls_mtrlcode = dw_2.object.u_mtrldef_mtrlcode[ll_row] s_edit_index_tran s_tran s_tran.if_retrieve_all = TRUE //是否一次RETRIEVE所有行 s_tran.work_mode = 0 //0-单纯编辑模式, 1-选择模式 s_tran.arg_pkid = 0 //目标定位PKID (备用) s_tran.arg_string_code = ls_mtrlcode //查询列部分内容,用于初步筛选 //s_tran.mainid = arg_mainid s_tran.b_long = ll_mtrlid s_tran.dw_share = dw_1 openwithparm(w_mtrl_structure, s_tran) end event event ue_cmpl_mj();Dec L, W, H String ls_mtrlmode Long i Int li_pos String ls_str IF tab_1.SelectedTab = 1 THEN i = dw_1.GetRow() IF i <= 0 THEN RETURN // FOR i = 1 To dw_1.RowCount() ls_mtrlmode = dw_1.Object.u_mtrldef_mtrlmode[i] //计算长,宽,高 li_pos = Pos(ls_mtrlmode , '*') IF li_pos > 0 THEN ls_str = Left(ls_mtrlmode, li_pos - 1) ls_mtrlmode = Mid(ls_mtrlmode, li_pos + 1) IF IsNumber(ls_str) THEN L = Dec(ls_str) END IF ELSE IF IsNumber(ls_mtrlmode) THEN L = Dec(ls_mtrlmode) END IF END IF li_pos = Pos(ls_mtrlmode , '*') IF li_pos > 0 THEN ls_str = Left(ls_mtrlmode, li_pos - 1) ls_mtrlmode = Mid(ls_mtrlmode, li_pos + 1) IF IsNumber(ls_str) THEN W = Dec(ls_str) END IF ELSE IF IsNumber(ls_mtrlmode) THEN W = Dec(ls_mtrlmode) END IF END IF // li_pos = Pos(ls_mtrlmode , '*') // IF li_pos > 0 THEN // ls_str = Left(ls_mtrlmode, li_pos - 1) // ls_mtrlmode = Mid(ls_mtrlmode, li_pos + 1) // IF IsNumber(ls_str) THEN // H = Dec(ls_str) // END IF // ELSE // IF IsNumber(ls_mtrlmode) THEN // H = Dec(ls_mtrlmode) // END IF // END IF dw_1.Object.u_quoterqmtrl_rqqty[i] = L * W / 1000000 // NEXT ELSE i = dw_3.GetRow() IF i <= 0 THEN RETURN ls_mtrlmode = dw_3.Object.u_mtrldef_mtrlmode[i] //计算长,宽,高 li_pos = Pos(ls_mtrlmode , '*') IF li_pos > 0 THEN ls_str = Left(ls_mtrlmode, li_pos - 1) ls_mtrlmode = Mid(ls_mtrlmode, li_pos + 1) IF IsNumber(ls_str) THEN L = Dec(ls_str) END IF ELSE IF IsNumber(ls_mtrlmode) THEN L = Dec(ls_mtrlmode) END IF END IF li_pos = Pos(ls_mtrlmode , '*') IF li_pos > 0 THEN ls_str = Left(ls_mtrlmode, li_pos - 1) ls_mtrlmode = Mid(ls_mtrlmode, li_pos + 1) IF IsNumber(ls_str) THEN W = Dec(ls_str) END IF ELSE IF IsNumber(ls_mtrlmode) THEN W = Dec(ls_mtrlmode) END IF END IF dw_3.Object.u_quoteworkprice_workqty[i] = L * W / 1000000 END IF RETURN end event event ue_cmpl_zc();Dec L, W, H String ls_mtrlmode Long i Int li_pos String ls_str IF tab_1.SelectedTab = 1 THEN i = dw_1.GetRow() IF i <= 0 THEN RETURN //FOR i = 1 To dw_1.RowCount() ls_mtrlmode = dw_1.Object.u_mtrldef_mtrlmode[i] //计算长,宽,高 li_pos = Pos(ls_mtrlmode , '*') IF li_pos > 0 THEN ls_str = Left(ls_mtrlmode, li_pos - 1) ls_mtrlmode = Mid(ls_mtrlmode, li_pos + 1) IF IsNumber(ls_str) THEN L = Dec(ls_str) END IF ELSE IF IsNumber(ls_mtrlmode) THEN L = Dec(ls_mtrlmode) END IF END IF li_pos = Pos(ls_mtrlmode , '*') IF li_pos > 0 THEN ls_str = Left(ls_mtrlmode, li_pos - 1) ls_mtrlmode = Mid(ls_mtrlmode, li_pos + 1) IF IsNumber(ls_str) THEN W = Dec(ls_str) END IF ELSE IF IsNumber(ls_mtrlmode) THEN W = Dec(ls_mtrlmode) END IF END IF // li_pos = Pos(ls_mtrlmode , '*') // IF li_pos > 0 THEN // ls_str = Left(ls_mtrlmode, li_pos - 1) // ls_mtrlmode = Mid(ls_mtrlmode, li_pos + 1) // IF IsNumber(ls_str) THEN // H = Dec(ls_str) // END IF // ELSE // IF IsNumber(ls_mtrlmode) THEN // H = Dec(ls_mtrlmode) // END IF // END IF dw_1.Object.u_quoterqmtrl_rqqty[i] = ( L + W ) * 2 / 1000 //NEXT ELSE i = dw_3.GetRow() IF i <= 0 THEN RETURN ls_mtrlmode = dw_3.Object.u_mtrldef_mtrlmode[i] //计算长,宽,高 li_pos = Pos(ls_mtrlmode , '*') IF li_pos > 0 THEN ls_str = Left(ls_mtrlmode, li_pos - 1) ls_mtrlmode = Mid(ls_mtrlmode, li_pos + 1) IF IsNumber(ls_str) THEN L = Dec(ls_str) END IF ELSE IF IsNumber(ls_mtrlmode) THEN L = Dec(ls_mtrlmode) END IF END IF li_pos = Pos(ls_mtrlmode , '*') IF li_pos > 0 THEN ls_str = Left(ls_mtrlmode, li_pos - 1) ls_mtrlmode = Mid(ls_mtrlmode, li_pos + 1) IF IsNumber(ls_str) THEN W = Dec(ls_str) END IF ELSE IF IsNumber(ls_mtrlmode) THEN W = Dec(ls_mtrlmode) END IF END IF dw_3.Object.u_quoteworkprice_workqty[i] = ( L + W ) * 2 / 1000 END IF RETURN end event event ue_f8();//用于选择明细内容,被F8[默认]\dw_3.doubleclicked调用 Long child_row Long ls_null long ll_row IF NOT dw_edit_mode THEN RETURN //IF flag = 1 THEN RETURN ll_row = dw_2.getrow() child_row = dw_3.GetRow() s_edit_index_tran s_ch_tran s_ch_tran.if_retrieve_all = TRUE s_ch_tran.work_mode = 1 s_ch_tran.arg_pkid = 0 s_ch_tran.b_long = 0 s_ch_tran.if_select_all = TRUE IF child_row > 0 THEN s_ch_tran.arg_string_code = dw_3.Object.u_quoteworkprice_procode[child_row] Long ls_j IF NOT IsValid(w_sc_workprocedure_response) THEN OpenWithParm(w_sc_workprocedure_response,s_ch_tran) //调用 s_workprocedure S_INSCUST S_INSCUST = Message.PowerObjectParm //接受返回结构 FOR ls_j = 1 TO UpperBound(S_INSCUST.wrkproid) IF S_INSCUST.wrkproid[ls_j] > 0 THEN //正常返回值则可以取以下值 IF dw_3.Find('u_quoteworkprice_proid='+String(S_INSCUST.wrkproid[ls_j]),1,dw_3.RowCount()) = 0 THEN IF dw_3.GetRow() > 0 THEN IF dw_3.Object.u_quoteworkprice_proid[child_row] <> 0 THEN child_row = dw_3.InsertRow (0) ELSE child_row = dw_3.GetRow() END IF ELSE child_row = dw_3.InsertRow (0) END IF END IF dw_3.Object.u_quoteworkprice_mtrlid[child_row] = dw_2.Object.u_quotemx_mtrlid[ll_row] dw_3.Object.u_mtrldef_mtrlcode[child_row] = dw_2.Object.u_mtrldef_mtrlcode[ll_row] dw_3.Object.u_mtrldef_mtrlname[child_row] = dw_2.Object.u_mtrldef_mtrlname[ll_row] dw_3.Object.u_mtrldef_mtrlmode[child_row] = dw_2.Object.u_mtrldef_mtrlmode[ll_row] dw_3.Object.u_quoteworkprice_proid[child_row] = S_INSCUST.wrkproid[ls_j] dw_3.Object.u_quoteworkprice_procode[child_row] = S_INSCUST.wrkprocode[ls_j] dw_3.Object.u_quoteworkprice_proname[child_row] = S_INSCUST.wrkproname[ls_j] // dw_3.Object.worklevel[child_row] = S_INSCUST.worklevel[ls_j] // dw_3.Object.techlevel[child_row] = S_INSCUST.techlevel[ls_j] // dw_3.Object.workhour[child_row] = S_INSCUST.workhour[ls_j] dw_3.Object.u_quoteworkprice_wrkgrpid[child_row] = S_INSCUST.wrkgrid[ls_j] dw_3.Object.u_quoteworkprice_workprice[child_row] = S_INSCUST.workprice[ls_j] dw_3.Object.u_quoteworkprice_cost[child_row] = S_INSCUST.workprice[ls_j] IF child_row > 1 THEN dw_3.Object.u_quoteworkprice_proorder[child_row] = dw_3.Object.u_quoteworkprice_proorder[child_row - 1] + 1 END IF END IF NEXT dw_3.SetRow(child_row) dw_3.ScrollToRow(child_row) dw_3.SetFocus() IF UpperBound(S_INSCUST.wrkproid) > 0 THEN dw_3.SetColumn("u_quoteworkprice_workprice") END IF END IF dw_3.SetRedraw(TRUE) dw_3.SetFocus() end event public function integer wf_addwpmx (long arg_mtrlid, string arg_pfcode, decimal arg_qty, ref string arg_msg);Int rslt = 1 Long ll_i,cnt,ll_j String ls_pfcode Decimal ld_qty Long count = 0 Long ll_row_mx IF IsNull(arg_mtrlid) OR arg_mtrlid = 0 THEN arg_msg = '产品错误,没有对应的产品' rslt = 0 GOTO ext END IF s_pfmx ls_s_pfmx[] //查询默认清单 datastore ds_workprice_mx ds_workprice_mx = CREATE datastore ds_workprice_mx.DataObject = 'dw_sc_workpricetable_mx' ds_workprice_mx.SetTransObject(sqlca) IF count > 2000 THEN //防止死递归 arg_msg = '递归太深'+String(count) rslt = 0 GOTO ext END IF DECLARE pf_cur CURSOR FOR SELECT u_PrdPF.Sonscale, u_PrdPF.SonLoss, u_PrdPF.SonDECLosS, u_PrdPF.SonMtrlid, u_mtrldef.mtrlcode, u_mtrldef.mtrlname, u_mtrldef.mtrlmode, u_mtrldef.mtrlorigin, u_PrdPF.sonpfcode FROM u_PrdPF, u_mtrldef WHERE ( u_PrdPF.SonMtrlid = u_mtrldef.mtrlid ) AND ( u_PrdPF.mtrlid = :arg_mtrlid ) AND ( u_PrdPF.pfcode = :arg_pfcode ); OPEN pf_cur; count = 1 FETCH pf_cur INTO :ls_s_pfmx[count].Sonscale,:ls_s_pfmx[count].SonLoss,& :ls_s_pfmx[count].SonDECLosS,:ls_s_pfmx[count].SonMtrlid,& :ls_s_pfmx[count].mtrlcode,:ls_s_pfmx[count].mtrlname,:ls_s_pfmx[count].mtrlmode,:ls_s_pfmx[count].mtrlorigin,:ls_s_pfmx[count].sonpfcode; DO WHILE sqlca.SQLCode = 0 count++ FETCH pf_cur INTO :ls_s_pfmx[count].Sonscale,:ls_s_pfmx[count].SonLoss,& :ls_s_pfmx[count].SonDECLosS,:ls_s_pfmx[count].SonMtrlid,& :ls_s_pfmx[count].mtrlcode,:ls_s_pfmx[count].mtrlname,:ls_s_pfmx[count].mtrlmode,:ls_s_pfmx[count].mtrlorigin,:ls_s_pfmx[count].sonpfcode; LOOP count = count - 1 CLOSE pf_cur; FOR ll_i = 1 TO count SELECT count(*) INTO :cnt FROM u_PrdPF WHERE ( u_PrdPF.mtrlid = :ls_s_pfmx[ll_i].SonMtrlid ) AND ( u_PrdPF.pfcode = :ls_s_pfmx[count].sonpfcode ); IF sqlca.SQLCode <> 0 THEN arg_msg = '查询物料:'+ls_s_pfmx[count].mtrlcode+'物料清单失败,'+sqlca.SQLErrText rslt = 0 GOTO ext END IF ld_qty = arg_qty * (ls_s_pfmx[ll_i].Sonscale/(1 - ls_s_pfmx[ll_i].SonLoss)+ls_s_pfmx[ll_i].SonDECLosS) //如果自制,将其工价表插入 IF ls_s_pfmx[ll_i].mtrlorigin = 0 THEN ds_workprice_mx.Retrieve(ls_s_pfmx[ll_i].SonMtrlid) FOR ll_j = 1 TO ds_workprice_mx.RowCount() ll_row_mx = dw_3.InsertRow(0) dw_3.Object.u_mtrldef_mtrlcode[ll_row_mx] = ls_s_pfmx[ll_i].mtrlcode dw_3.Object.u_mtrldef_mtrlname[ll_row_mx] = ls_s_pfmx[ll_i].mtrlname dw_3.Object.u_mtrldef_mtrlmode[ll_row_mx] = ls_s_pfmx[ll_i].mtrlmode dw_3.Object.u_quoteworkprice_workqty[ll_row_mx] = ds_workprice_mx.Object.workqty[ll_j] * ld_qty dw_3.Object.u_quoteworkprice_workprice[ll_row_mx] = ds_workprice_mx.Object.workprice[ll_j] dw_3.Object.u_quoteworkprice_cost[ll_row_mx] = ds_workprice_mx.Object.workprice[ll_j] // dw_3.Object.wprice[ll_row_mx] = ds_workprice_mx.Object.u_sc_workprice_wprice[ll_j] * ld_qty dw_3.Object.u_quoteworkprice_procode[ll_row_mx] = ds_workprice_mx.Object.procode[ll_j] dw_3.Object.u_quoteworkprice_proname[ll_row_mx] = ds_workprice_mx.Object.u_sc_workprice_proname[ll_j] dw_3.Object.u_sc_workgroup_wrkgrpcode[ll_row_mx] = ds_workprice_mx.Object.u_sc_workgroup_wrkgrpcode[ll_j] dw_3.Object.u_sc_workgroup_wrkgrpname[ll_row_mx] = ds_workprice_mx.Object.u_sc_workgroup_wrkgrpname[ll_j] dw_3.Object.u_quoteworkprice_dscrp[ll_row_mx] = ds_workprice_mx.Object.dscrp[ll_j] dw_3.Object.u_quoteworkprice_wrkgrpid[ll_row_mx] = ds_workprice_mx.Object.wrkgrpid[ll_j] dw_3.Object.u_quoteworkprice_proid[ll_row_mx] = ds_workprice_mx.Object.wrkgrpid[ll_j] dw_3.Object.u_quoteworkprice_proorder[ll_row_mx] = ds_workprice_mx.Object.proorder[ll_j] dw_3.Object.u_quoteworkprice_mtrlid[ll_row_mx] = ls_s_pfmx[ll_i].SonMtrlid NEXT END IF IF wf_addwpmx(ls_s_pfmx[ll_i].SonMtrlid,ls_s_pfmx[ll_i].sonpfcode,ld_qty,arg_msg) = 0 THEN rslt = 0 GOTO ext END IF NEXT ext: RETURN rslt end function public subroutine wf_delmtrlmx (long arg_mtrlid, long arg_lp, long arg_row);Long ll_i FOR ll_i = dw_1.RowCount() TO 1 STEP -1 IF dw_1.Object.u_quoterqmtrl_pmtrlid[ll_i] = arg_mtrlid AND & dw_1.Object.u_quoterqmtrl_lp[ll_i] = arg_lp + 1 THEN wf_delmtrlmx( dw_1.Object.u_quoterqmtrl_mtrlid[ll_i],dw_1.Object.u_quoterqmtrl_lp[ll_i],ll_i) dw_1.DeleteRow (ll_i) END IF NEXT end subroutine public subroutine wf_addmtrlmx ();Long ll_row,ll_mtrlid String ls_pfcode,arg_msg dw_2.AcceptText() ll_row = dw_2.GetRow() IF ll_row <= 0 THEN MessageBox('系统提示','没有单据内容,不能生成用料明细') RETURN END IF ll_mtrlid = dw_2.Object.u_quotemx_mtrlid[ll_row] IF ll_mtrlid <= 0 THEN MessageBox('提示','没有正确的物料,不能生成用料明细') RETURN END IF ls_pfcode = "组装" s_order_ml_rqmtrl s_ref_mtrl uo_order_ml_mrp uo_ml_mrp uo_ml_mrp = CREATE uo_order_ml_mrp DateTime ld_requiredate IF uo_ml_mrp.uof_cmpl_rqmtrl(0,-1,0,0,ll_mtrlid,& '','','',1,0,0,s_ref_mtrl,arg_msg,0,'') = 0 THEN MessageBox('Error',arg_msg) RETURN END IF dw_1.Reset() Decimal ld_price Long ll_i dw_1.SetRedraw(FALSE) FOR ll_i = 2 TO UpperBound(s_ref_mtrl.mtrlid) ll_row = dw_1.InsertRow(0) dw_1.Object.u_mtrldef_mtrlcode[ll_row] = s_ref_mtrl.mtrlcode[ll_i] dw_1.Object.u_mtrldef_mtrlname[ll_row] = s_ref_mtrl.mtrlname[ll_i] dw_1.Object.u_mtrldef_mtrlmode[ll_row] = s_ref_mtrl.mtrlmode[ll_i] dw_1.Object.u_mtrldef_unit[ll_row] = s_ref_mtrl.unit[ll_i] dw_1.Object.u_mtrldef_mtrlorigin[ll_row] = s_ref_mtrl.mtrlorigin[ll_i] // // dw_1.Object.u_orderrqmtrl_tree_status[ll_row] = s_ref_mtrl.status[ll_i] // dw_1.Object.u_orderrqmtrl_tree_woodcode[ll_row] = s_ref_mtrl.woodcode[ll_i] // dw_1.Object.u_orderrqmtrl_tree_pcode[ll_row] = s_ref_mtrl.pcode[ll_i] // dw_1.Object.u_quoterqmtrl_lp[ll_row] = s_ref_mtrl.lp[ll_i] dw_1.Object.u_quoterqmtrl_mtrlid[ll_row] = s_ref_mtrl.mtrlid[ll_i] dw_1.Object.u_quoterqmtrl_rqqty[ll_row] = s_ref_mtrl.qty[ll_i] dw_1.Object.u_quoterqmtrl_pmtrlid[ll_row] = s_ref_mtrl.pmtrlid[ll_i] IF s_ref_mtrl.mtrlorigin[ll_i] = 2 OR s_ref_mtrl.mtrlorigin[ll_i] = 3 THEN SELECT price INTO :ld_price FROM v_maxprice_sptprice Where mtrlid = :s_ref_mtrl.mtrlid[ll_i]; IF sqlca.SQLCode <> 0 THEN ld_price = 0 END IF dw_1.Object.u_quoterqmtrl_newprice[ll_row] = ld_price dw_1.Object.u_quoterqmtrl_costprice[ll_row] = ld_price END IF NEXT dw_1.SetRedraw(TRUE) DESTROY uo_ml_mrp end subroutine public subroutine wf_addworkprice ();Long ll_row,ll_mtrlid String ls_pfcode,arg_msg dw_2.AcceptText() ll_row = dw_2.GetRow() IF ll_row <= 0 THEN MessageBox('系统提示','没有单据内容,不能生成工价明细') RETURN END IF ll_mtrlid = dw_2.Object.u_quotemx_mtrlid[ll_row] IF ll_mtrlid <= 0 THEN MessageBox('提示','没有正确的物料,不能生成工价明细') RETURN END IF ls_pfcode = "组装" dw_3.Reset() //先插入自身工价表 datastore ds_workprice ds_workprice = Create datastore ds_workprice.DataObject = 'dw_sc_workpricetable_mx' ds_workprice.SetTransObject(sqlca) ds_workprice.Retrieve(ll_mtrlid) Long ll_i Long ll_row_mx dw_3.SetRedraw(False) FOR ll_i = 1 To ds_workprice.RowCount() ll_row_mx = dw_3.InsertRow(0) dw_3.Object.u_mtrldef_mtrlcode[ll_row_mx] = dw_2.Object.u_mtrldef_mtrlcode[ll_row] dw_3.Object.u_mtrldef_mtrlname[ll_row_mx] = dw_2.Object.u_mtrldef_mtrlname[ll_row] dw_3.Object.u_mtrldef_mtrlmode[ll_row_mx] = dw_2.Object.u_mtrldef_mtrlmode[ll_row] dw_3.Object.u_quoteworkprice_workqty[ll_row_mx] = ds_workprice.Object.workqty[ll_i] dw_3.Object.u_quoteworkprice_workprice[ll_row_mx] = ds_workprice.Object.workprice[ll_i] dw_3.Object.u_quoteworkprice_cost[ll_row_mx] = ds_workprice.Object.workprice[ll_i] dw_3.Object.wprice[ll_row_mx] = ds_workprice.Object.u_sc_workprice_wprice[ll_i] dw_3.Object.u_quoteworkprice_procode[ll_row_mx] = ds_workprice.Object.procode[ll_i] dw_3.Object.u_quoteworkprice_proname[ll_row_mx] = ds_workprice.Object.u_sc_workprice_proname[ll_i] dw_3.Object.u_sc_workgroup_wrkgrpcode[ll_row_mx] = ds_workprice.Object.u_sc_workgroup_wrkgrpcode[ll_i] dw_3.Object.u_sc_workgroup_wrkgrpname[ll_row_mx] = ds_workprice.Object.u_sc_workgroup_wrkgrpname[ll_i] dw_3.Object.u_quoteworkprice_dscrp[ll_row_mx] = ds_workprice.Object.dscrp[ll_i] dw_3.Object.u_quoteworkprice_wrkgrpid[ll_row_mx] = ds_workprice.Object.wrkgrpid[ll_i] dw_3.Object.u_quoteworkprice_proid[ll_row_mx] = ds_workprice.Object.wrkgrpid[ll_i] dw_3.Object.u_quoteworkprice_proorder[ll_row_mx] = ds_workprice.Object.proorder[ll_i] dw_3.Object.u_quoteworkprice_mtrlid[ll_row_mx] = ll_mtrlid NEXT //插入下级物料工价明细 IF wf_addwpmx(ll_mtrlid,ls_pfcode,1,arg_msg) = 0 THEN dw_3.Reset() dw_3.SetRedraw(True) MessageBox('系统提示',arg_msg) RETURN END IF dw_3.SetRedraw(True) end subroutine public function window getparentwin ();return this end function on w_quoterqmtrl.create int iCurrent call super::create this.cb_1=create cb_1 this.cb_mx1=create cb_mx1 this.cb_mx2=create cb_mx2 this.dw_2=create dw_2 this.cb_cmpl=create cb_cmpl this.cb_rqmtrl=create cb_rqmtrl this.cb_workprice=create cb_workprice this.tab_1=create tab_1 this.cb_chmtrl=create cb_chmtrl this.mle_message=create mle_message this.cb_other=create cb_other this.cb_2=create cb_2 this.ln_bar=create ln_bar this.ln_bar2=create ln_bar2 this.r_bar=create r_bar iCurrent=UpperBound(this.Control) this.Control[iCurrent+1]=this.cb_1 this.Control[iCurrent+2]=this.cb_mx1 this.Control[iCurrent+3]=this.cb_mx2 this.Control[iCurrent+4]=this.dw_2 this.Control[iCurrent+5]=this.cb_cmpl this.Control[iCurrent+6]=this.cb_rqmtrl this.Control[iCurrent+7]=this.cb_workprice this.Control[iCurrent+8]=this.tab_1 this.Control[iCurrent+9]=this.cb_chmtrl this.Control[iCurrent+10]=this.mle_message this.Control[iCurrent+11]=this.cb_other this.Control[iCurrent+12]=this.cb_2 this.Control[iCurrent+13]=this.ln_bar this.Control[iCurrent+14]=this.ln_bar2 this.Control[iCurrent+15]=this.r_bar end on on w_quoterqmtrl.destroy call super::destroy destroy(this.cb_1) destroy(this.cb_mx1) destroy(this.cb_mx2) destroy(this.dw_2) destroy(this.cb_cmpl) destroy(this.cb_rqmtrl) destroy(this.cb_workprice) destroy(this.tab_1) destroy(this.cb_chmtrl) destroy(this.mle_message) destroy(this.cb_other) destroy(this.cb_2) destroy(this.ln_bar) destroy(this.ln_bar2) destroy(this.r_bar) end on event open;dw_1 = tab_1.tabpage_1.dw_1 dw_3 = tab_1.tabpage_2.dw_3 dw_1.SetTransObject(sqlca) dw_2.SetTransObject(sqlca) dw_3.SetTransObject(sqlca) s_mx = Message.PowerObjectParm dw_2.Retrieve(s_mx.scid,s_mx.quoteid,s_mx.printid) IF dw_1.Retrieve(s_mx.scid,s_mx.quoteid,s_mx.printid) = 0 THEN wf_addmtrlmx() END IF IF dw_3.Retrieve(s_mx.scid,s_mx.quoteid,s_mx.printid) = 0 THEN wf_addworkprice() END IF cb_1.Enabled = (s_mx.mode = 0) cb_cmpl.Enabled = (s_mx.mode = 0) cb_mx1.Enabled = (s_mx.mode = 0) cb_mx2.Enabled = (s_mx.mode = 0) cb_chmtrl.Enabled = (s_mx.mode = 0) //cb_pfcode.Enabled = (s_mx.mode = 0) cb_rqmtrl.Enabled = (s_mx.mode = 0) cb_workprice.Enabled = (s_mx.mode = 0) IF s_mx.mode = 0 THEN this.title += " - 编辑模式" dw_2.SetTabOrder('u_quotemx_outcost',10) dw_2.SetTabOrder('u_quotemx_mtrlcost',20) dw_2.SetTabOrder('u_quotemx_mancost',30) dw_2.SetTabOrder('u_quotemx_wfjgprice',40) dw_2.SetTabOrder('u_quotemx_profit_margin',50) dw_2.SetTabOrder('u_quotemx_sumprice',60) dw_2.SetTabOrder('u_quotemx_sumprice_1',70) dw_1.SetTabOrder('u_quoterqmtrl_rqqty',10) dw_1.SetTabOrder('u_quoterqmtrl_newprice',20) dw_1.SetTabOrder('u_quoterqmtrl_costprice',30) dw_3.SetTabOrder('u_quoteworkprice_workqty',10) dw_3.SetTabOrder('u_quoteworkprice_workprice',20) dw_3.SetTabOrder('u_quoteworkprice_cost',30) dw_3.SetTabOrder('u_quoteworkprice_procode',40) dw_3.SetTabOrder('u_quoteworkprice_proname',50) dw_3.SetTabOrder('u_quoteworkprice_wrkgrpid',60) dw_2.SetFocus() dw_2.SetColumn('u_quotemx_outcost') dw_edit_mode = true ELSE this.title += " - 查看模式" dw_2.SetTabOrder('u_quotemx_outcost',0) dw_2.SetTabOrder('u_quotemx_mtrlcost',0) dw_2.SetTabOrder('u_quotemx_mancost',0) dw_2.SetTabOrder('u_quotemx_wfjgprice',0) dw_2.SetTabOrder('u_quotemx_profit_margin',0) dw_2.SetTabOrder('u_quotemx_sumprice',0) dw_2.SetTabOrder('u_quotemx_sumprice_1',0) dw_1.SetTabOrder('u_quoterqmtrl_rqqty',0) dw_1.SetTabOrder('u_quoterqmtrl_newprice',0) dw_1.SetTabOrder('u_quoterqmtrl_costprice',0) dw_3.SetTabOrder('u_quoteworkprice_workqty',0) dw_3.SetTabOrder('u_quoteworkprice_workprice',0) dw_3.SetTabOrder('u_quoteworkprice_procode',0) dw_3.SetTabOrder('u_quoteworkprice_proname',0) dw_3.SetTabOrder('u_quoteworkprice_wrkgrpid',0) dw_edit_mode = false END IF uo_q = CREATE uo_quote uo_q.commit_transaction = sqlca end event event resize;call super::resize;ln_bar.EndX = This.Width ln_bar2.EndX = This.Width r_bar.Width = This.Width tab_1.Width = This.Width - tab_1.X - 10 tab_1.Height = This.Height - tab_1.Y - 120 dw_1.Width = tab_1.tabpage_1.Width - 4 dw_1.Height = tab_1.tabpage_1.Height - 4 dw_3.Width = tab_1.tabpage_2.Width - 4 dw_3.Height = tab_1.tabpage_2.Height - 4 end event event close;call super::close;DESTROY uo_q end event type cb_func from w_publ_base`cb_func within w_quoterqmtrl boolean visible = false integer x = 2386 integer y = 32 boolean enabled = false end type type cb_exit from w_publ_base`cb_exit within w_quoterqmtrl integer x = 2057 integer width = 151 integer height = 164 string text = "取消" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type type cb_1 from uo_imflatbutton within w_quoterqmtrl integer width = 151 integer height = 164 integer taborder = 20 boolean bringtotop = true string text = "保存" string normalpicname = "save.bmp" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;Long ll_row,ll_i,ll_j Long ll_quoteid,ll_printid,ll_scid Decimal ld_sumprice,ld_sumprice_1 Decimal ld_mtrlcost,ld_mancost Decimal ld_outcost,ld_wfjgprice Decimal ld_profit_margin String ls_pfcode,arg_msg s_quote_rqmtrl s_q s_quote_workprice s_workprice dw_1.AcceptText( ) dw_2.AcceptText( ) dw_3.AcceptText( ) ll_row = dw_2.GetRow() IF ll_row <= 0 THEN MessageBox('提示','没有可保存的资料') RETURN END IF ll_quoteid = dw_2.Object.u_quotemx_quoteid[ll_row] ll_scid = dw_2.Object.u_quotemx_scid[ll_row] ll_printid = dw_2.Object.u_quotemx_printid[ll_row] ld_sumprice = dw_2.Object.u_quotemx_sumprice[ll_row] ld_sumprice_1 = dw_2.Object.u_quotemx_sumprice_1[ll_row] ld_mtrlcost = dw_2.Object.u_quotemx_mtrlcost[ll_row] ld_mancost = dw_2.Object.u_quotemx_mancost[ll_row] ld_outcost = dw_2.Object.u_quotemx_outcost[ll_row] ld_wfjgprice = dw_2.Object.u_quotemx_wfjgprice[ll_row] ld_profit_margin = dw_2.Object.u_quotemx_profit_margin[ll_row] ls_pfcode = dw_2.Object.u_quotemx_pfcode[ll_row] FOR ll_i = 1 TO dw_1.RowCount() s_q.printid[ll_i] = dw_1.Object.pid[ll_i] s_q.mtrlid[ll_i] = dw_1.Object.u_quoterqmtrl_mtrlid[ll_i] s_q.RqQty[ll_i] = dw_1.Object.u_quoterqmtrl_rqqty[ll_i] s_q.newprice[ll_i] = dw_1.Object.u_quoterqmtrl_newprice[ll_i] s_q.planprice[ll_i] = dw_1.Object.u_quoterqmtrl_planprice[ll_i] s_q.costprice[ll_i] = dw_1.Object.u_quoterqmtrl_costprice[ll_i] s_q.lp[ll_i] = dw_1.Object.u_quoterqmtrl_lp[ll_i] s_q.pmtrlid[ll_i] = dw_1.Object.u_quoterqmtrl_pmtrlid[ll_i] NEXT FOR ll_j = 1 TO dw_3.RowCount() s_workprice.pid[ll_j] = dw_3.Object.pid[ll_j] s_workprice.mtrlid[ll_j] = dw_3.Object.u_quoteworkprice_mtrlid[ll_j] s_workprice.proid[ll_j] = dw_3.Object.u_quoteworkprice_proid[ll_j] s_workprice.proorder[ll_j] = dw_3.Object.u_quoteworkprice_proorder[ll_j] s_workprice.procode[ll_j] = dw_3.Object.u_quoteworkprice_procode[ll_j] s_workprice.proname[ll_j] = dw_3.Object.u_quoteworkprice_proname[ll_j] s_workprice.wrkgrpid[ll_j] = dw_3.Object.u_quoteworkprice_wrkgrpid[ll_j] s_workprice.workprice[ll_j] = dw_3.Object.u_quoteworkprice_workprice[ll_j] s_workprice.cost[ll_j] = dw_3.Object.u_quoteworkprice_cost[ll_j] s_workprice.workqty[ll_j] = dw_3.Object.u_quoteworkprice_workqty[ll_j] s_workprice.dscrp[ll_j] = dw_3.Object.u_quoteworkprice_dscrp[ll_j] NEXT IF uo_q.uof_update_mx(ll_scid,ll_quoteid,ll_printid,ld_sumprice,ld_sumprice_1,ld_profit_margin,ld_mtrlcost,ld_mancost,ld_outcost,ld_wfjgprice,ls_pfcode,s_q,s_workprice,arg_msg,TRUE) = 0 THEN MessageBox('提示','保存失败,'+arg_msg) RETURN END IF MessageBox('系统提示','保存成功') //Close(PARENT) end event type cb_mx1 from uo_imflatbutton within w_quoterqmtrl integer x = 1344 integer width = 219 integer height = 164 integer taborder = 30 boolean bringtotop = true string text = "增明细" string normalpicname = "mx1.bmp" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;IF tab_1.SelectedTab = 1 THEN parent.triggerevent('ue_addrqmtrl') ELSE parent.triggerevent('ue_addworkprice') END IF end event type cb_mx2 from uo_imflatbutton within w_quoterqmtrl integer x = 1563 integer width = 219 integer height = 164 integer taborder = 30 boolean bringtotop = true string text = "删明细" string normalpicname = "mx2.bmp" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;IF tab_1.SelectedTab = 1 THEN PARENT.TriggerEvent('ue_delmtrlmx') ELSE IF MessageBox ("询问","是否确定要删除当前工价明细?",Question!,YesNo! ) = 2 THEN RETURN IF dw_3.GetRow() = 0 THEN MessageBox('提示','请选择删除的行对象!') RETURN END IF dw_3.DeleteRow (0) dw_3.TriggerEvent (RowFocusChanged!) END IF end event type dw_2 from u_dw_rbtnfilter within w_quoterqmtrl integer y = 176 integer width = 2382 integer height = 772 boolean bringtotop = true string dataobject = "dw_quotemx_edit" end type event dwnkey;IF Key = KeyEnter! THEN // keybd_event ( 9, 0, 0 , 0 ) // 按下tab keybd_event ( 9, 0, 2, 0 ) // 释放tab RETURN 1 END IF end event type cb_cmpl from uo_imflatbutton within w_quoterqmtrl integer x = 151 integer width = 274 integer height = 164 integer taborder = 40 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;IF s_mx.mode = 0 THEN PARENT.TriggerEvent('ue_cmpl') end event type cb_rqmtrl from uo_imflatbutton within w_quoterqmtrl integer x = 425 integer width = 384 integer height = 164 integer taborder = 30 boolean bringtotop = true string text = "生成用料明细" string normalpicname = "update2.BMP" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;IF MessageBox ("询问","是否确定要按当前清单重新生成用料明细?该操作会将原来的修改清除,是否继续?",Question!,YesNo! ) = 2 THEN RETURN wf_addmtrlmx() end event type cb_workprice from uo_imflatbutton within w_quoterqmtrl integer x = 809 integer width = 384 integer height = 164 integer taborder = 40 boolean bringtotop = true string text = "生成工价信息" string normalpicname = "update2.BMP" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;IF MessageBox ("询问","是否确定要按当前清单重新生成工价信息?该操作会将原来的修改清除,是否继续?",Question!,YesNo! ) = 2 THEN RETURN wf_addworkprice() end event type tab_1 from tab within w_quoterqmtrl integer y = 960 integer width = 3579 integer height = 1344 integer taborder = 20 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long backcolor = 134217739 boolean raggedright = true boolean focusonbuttondown = true integer selectedtab = 1 tabpage_1 tabpage_1 tabpage_2 tabpage_2 end type on tab_1.create this.tabpage_1=create tabpage_1 this.tabpage_2=create tabpage_2 this.Control[]={this.tabpage_1,& this.tabpage_2} end on on tab_1.destroy destroy(this.tabpage_1) destroy(this.tabpage_2) end on event selectionchanged;IF This.SelectedTab = 1 THEN cb_2.Text = "计算用料数量" ELSE cb_2.Text = "计算工价数量" END IF cb_2.TriggerEvent('ue_textchange') end event type tabpage_1 from userobject within tab_1 integer x = 18 integer y = 96 integer width = 3543 integer height = 1232 long backcolor = 134217739 string text = "用料明细" long tabtextcolor = 33554432 long tabbackcolor = 134217739 long picturemaskcolor = 536870912 dw_1 dw_1 end type on tabpage_1.create this.dw_1=create dw_1 this.Control[]={this.dw_1} end on on tabpage_1.destroy destroy(this.dw_1) end on type dw_1 from u_dw_rbtnfilter within tabpage_1 integer width = 3543 integer height = 1388 integer taborder = 20 string dataobject = "dw_quoterqmtrl_mod" boolean hscrollbar = true boolean vscrollbar = true boolean hsplitscroll = true end type event rowfocuschanged;call super::rowfocuschanged; IF currentrow > 0 THEN THIS.SetRow(currentrow) THIS.SelectRow(0,FALSE) THIS.SelectRow(currentrow,TRUE) END IF end event event clicked;call super::clicked;IF row > 0 THEN THIS.SetRow(row) THIS.SelectRow(0,FALSE) THIS.SelectRow(row,TRUE) END IF end event type tabpage_2 from userobject within tab_1 integer x = 18 integer y = 96 integer width = 3543 integer height = 1232 long backcolor = 134217739 string text = "工价明细" long tabtextcolor = 33554432 long tabbackcolor = 134217739 long picturemaskcolor = 536870912 dw_3 dw_3 end type on tabpage_2.create this.dw_3=create dw_3 this.Control[]={this.dw_3} end on on tabpage_2.destroy destroy(this.dw_3) end on type dw_3 from u_dw_rbtnfilter within tabpage_2 integer width = 3543 integer height = 1388 integer taborder = 20 string dataobject = "dw_quoteworkprice_mod" boolean hscrollbar = true boolean vscrollbar = true boolean hsplitscroll = true end type event clicked;call super::clicked;IF row > 0 THEN THIS.SetRow(row) THIS.SelectRow(0,FALSE) THIS.SelectRow(row,TRUE) END IF end event event rowfocuschanged;call super::rowfocuschanged;IF currentrow > 0 THEN THIS.SetRow(currentrow) THIS.SelectRow(0,FALSE) THIS.SelectRow(currentrow,TRUE) END IF end event event doubleclicked;call super::doubleclicked;GetParentWin().triggerevent('ue_f8') end event type cb_chmtrl from uo_imflatbutton within w_quoterqmtrl integer x = 1193 integer width = 151 integer height = 164 integer taborder = 30 boolean bringtotop = true string text = "换料" string normalpicname = "p2.BMP" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;parent.triggerevent('ue_changemtrl') end event type mle_message from multilineedit within w_quoterqmtrl integer x = 2391 integer y = 176 integer width = 1175 integer height = 764 integer taborder = 20 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 boolean hscrollbar = true boolean vscrollbar = true boolean displayonly = true borderstyle borderstyle = stylelowered! end type event constructor;this.text = '用料变更差额提示'+'~r~n' end event type cb_other from uo_imflatbutton within w_quoterqmtrl integer x = 1783 integer width = 274 integer height = 164 integer taborder = 40 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_view_workprice" menustr = menustr + "|" + "Text=调物料清单~tEvent=ue_view_structure" menustr = menustr + "|" + "Text=-" menustr = menustr + "|" + "Text=辅助建立工价表~tEvent=ue_add_workprice" menustr = menustr + "|" + "Text=辅助建立物料清单~tEvent=ue_add_structure" 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_2 from uo_imflatbutton within w_quoterqmtrl integer x = 827 integer y = 948 integer width = 494 integer taborder = 30 boolean bringtotop = true string text = "计算用料数量" end type event clicked;call super::clicked;m_Dfc_Control_PopupMenu dmPopupMenu String menustr menustr = "Text=按规格计算面积~tEvent=ue_cmpl_mj" menustr = menustr + "|" + "Text=按规格计算周长~tEvent=ue_cmpl_zc" //menustr = menustr + "|" + "Text=-" //menustr = menustr + "|" + "Text=辅助建立工价表~tEvent=ue_add_workprice" //menustr = menustr + "|" + "Text=辅助建立物料清单~tEvent=ue_add_structure" 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 ln_bar from line within w_quoterqmtrl long linecolor = 268435456 integer linethickness = 4 integer beginy = 168 integer endx = 2007 integer endy = 168 end type type ln_bar2 from line within w_quoterqmtrl long linecolor = 16777215 integer linethickness = 4 integer beginy = 172 integer endx = 2039 integer endy = 172 end type type r_bar from rectangle within w_quoterqmtrl long linecolor = 16777215 integer linethickness = 4 long fillcolor = 1073741824 integer x = 1038 integer y = 56 integer width = 146 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