$PBExportHeader$w_buytask_rece_fx.srw $PBExportComments$分销系统--客户采购订单接收窗口 forward global type w_buytask_rece_fx from w_publ_base_style end type type cb_accept from uo_imflatbutton within w_buytask_rece_fx end type type dw_main from datawindow within w_buytask_rece_fx end type type st_1 from statictext within w_buytask_rece_fx end type type mle_summary from multilineedit within w_buytask_rece_fx end type type st_2 from statictext within w_buytask_rece_fx end type type mle_postscript from multilineedit within w_buytask_rece_fx end type type st_3 from statictext within w_buytask_rece_fx end type type mle_remark from multilineedit within w_buytask_rece_fx end type type dw_mx from u_dw_rbtnfilter within w_buytask_rece_fx end type type cb_feedback from uo_imflatbutton within w_buytask_rece_fx end type type cb_reject from uo_imflatbutton within w_buytask_rece_fx end type end forward global type w_buytask_rece_fx from w_publ_base_style integer width = 4686 integer height = 2620 string title = "接收-采购订单" boolean minbox = false windowtype windowtype = response! windowstate windowstate = maximized! long backcolor = 16777215 string icon = "graphics\chain_link_128px.ico" boolean center = true cb_accept cb_accept dw_main dw_main st_1 st_1 mle_summary mle_summary st_2 st_2 mle_postscript mle_postscript st_3 st_3 mle_remark mle_remark dw_mx dw_mx cb_feedback cb_feedback cb_reject cb_reject end type global w_buytask_rece_fx w_buytask_rece_fx type variables s_open_packet s_tran end variables forward prototypes public function integer wf_retrieve () public function boolean wf_chk_ifchange (ref string arg_msg) end prototypes public function integer wf_retrieve ();int rslt = 1 dw_main.ReSet() dw_mx.ReSet() string arg_msg oleobject obj, buytask, buytaskMxs, mxItem obj = FXAppCom.GetReceBuytask(app_token_fx, s_tran.sn, ref arg_msg) if (arg_msg <> '') then rslt = 0 MessageBox('提示', '获取采购订单信息有误:' + arg_msg) goto ext end if // 明细 dw_mx.SetRedraw(false) buytaskMxs = obj.GetArrOfPBDictionary('buytaskMxs') datetime min_date long i, row decimal enprice, rebate, tax, uqty for i = 1 to buytaskMxs.Count row = dw_mx.InsertRow(0) mxItem = buytaskMxs.GetItem(i - 1) enprice = mxItem.GetDouble('enprice') rebate = mxItem.GetDouble('rebate') tax = mxItem.GetDouble('tax') uqty = mxItem.GetDouble('uqty') dw_mx.Object.printid[row] = mxItem.GetInt('printid') dw_mx.Object.mtrlname[row] = mxItem.GetString('mtrlname') dw_mx.Object.mtrlcode[row] = mxItem.GetString('mtrlcode') dw_mx.Object.mtrlmode[row] = mxItem.GetString('mtrlmode') dw_mx.Object.uqty[row] = uqty dw_mx.Object.spt_uqty[row] = uqty dw_mx.Object.unit[row] = Trim(mxItem.GetString('unit')) dw_mx.Object.enprice[row] = enprice dw_mx.Object.spt_enprice[row] = enprice dw_mx.Object.rebate[row] = rebate dw_mx.Object.tax[row] = tax if not IsNull(mxItem.GetDateTime('Requiredate')) then dw_mx.Object.Requiredate[row] = mxItem.GetDateTime('Requiredate') dw_mx.Object.spt_Requiredate[row] = mxItem.GetDateTime('Requiredate') end if dw_mx.Object.status[row] = mxItem.GetString('status') dw_mx.Object.spt_status[row] = mxItem.GetString('status') dw_mx.Object.woodcode[row] = mxItem.GetString('woodcode') dw_mx.Object.spt_woodcode[row] = mxItem.GetString('woodcode') dw_mx.Object.pcode[row] = mxItem.GetString('pcode') dw_mx.Object.spt_pcode[row] = mxItem.GetString('pcode') dw_mx.Object.dscrp[row] = mxItem.GetString('dscrp') dw_mx.Object.spt_dscrp[row] = mxItem.GetString('dscrp') dw_mx.Object.bateprice[row] = enprice * rebate dw_mx.Object.enprice_tax[row] = enprice / (1 + tax) dw_mx.Object.bateprice_tax[row] = (enprice * rebate) / (1 + tax) dw_mx.Object.taxamt[row] = (enprice * rebate * uqty) / (1 + tax) * tax dw_mx.Object.enamt_tax[row] = (uqty * enprice * rebate) / (1 + tax) dw_mx.Object.mtrlcuscode[row] = mxItem.GetString('mtrlcuscode') dw_mx.Object.plancode[row] = mxItem.GetString('plancode') if (i > 1) then if (mxItem.GetDateTime('Requiredate') < min_date) then min_date = mxItem.GetDateTime('Requiredate') end if else min_date = mxItem.GetDateTime('Requiredate') // i = 1 初始化min_date end if next dw_mx.SetRedraw(true) // 主表 dw_main.SetRedraw(false) buytask = obj.GetPBDictionary('buytask') row = dw_main.InsertRow(0) dw_main.Object.taskcode[row] = buytask.GetString('taskcode') dw_main.Object.moneyname[row] = buytask.GetString('moneyname') dw_main.Object.mrate[row] = buytask.GetDouble('mrate') dw_main.Object.status[row] = buytask.GetInt('status') dw_main.Object.packetstatus[row] = buytask.GetInt('packetstatus') if (not IsNull(buytask.GetDateTime('opdate'))) then dw_main.Object.opdate[row] = buytask.GetDateTime('opdate') end if dw_main.Object.requiredate[row] = min_date dw_main.Object.cuscode[row] = buytask.GetString('cuscode') dw_main.Object.comname[row] = buytask.GetString('comname') dw_main.Object.simplename[row] = buytask.GetString('simplename') dw_main.Object.address[row] = buytask.GetString('address') dw_main.Object.custype[row] = buytask.GetString('custype') dw_main.Object.tele[row] = buytask.GetString('tele') dw_main.Object.freight[row] = buytask.GetString('freight') dw_main.Object.freight_tele[row] = buytask.GetString('freight_tele') dw_main.Object.billamt[row] = buytask.GetDouble('billamt') dw_main.Object.train[row] = buytask.GetString('train') dw_main.Object.banktypename[row] = buytask.GetString('banktypename') dw_main.Object.dscrp[row] = buytask.GetString('dscrp') dw_main.Object.dscrp2[row] = buytask.GetString('dscrp2') //dw_main.Object.redscrp[row] = buytask.GetString('dscrp') //dw_main.Object.redscrp2[row] = buytask.GetString('dscrp2') dw_main.Object.opemp[row] = buytask.GetString('opemp') if (not IsNull(buytask.GetDateTime('opdate'))) then dw_main.Object.opdate1[row] = buytask.GetDateTime('opdate') end if dw_main.Object.modemp[row] = buytask.GetString('modemp') if (not IsNull(buytask.GetDateTime('moddate'))) then dw_main.Object.moddate[row] = buytask.GetDateTime('moddate') end if dw_main.Object.permit_emp[row] = buytask.GetString('permit_emp') if (not IsNull(buytask.GetDateTime('permit_date'))) then dw_main.Object.permit_date[row] = buytask.GetDateTime('permit_date') end if dw_main.Object.confirmuser[row] = buytask.GetString('confirmuser') if (not IsNull(buytask.GetDateTime('confirmtime'))) then dw_main.Object.confirmtime[row] = buytask.GetDateTime('confirmtime') end if dw_main.SetRedraw(true) if (f_find_fx_user_power(31, ref arg_msg) <> 1) then // 31-采购订单查看(单价) dw_main.Modify('destroy ljfieb_tempbuytask_billamt_t ~r~n destroy billamt ~r~n') dw_mx.Modify('destroy enprice_t ~r~n destroy enprice ~r~n') dw_mx.Modify('destroy spt_enprice_t ~r~n destroy spt_enprice ~r~n') dw_mx.Modify('destroy rebate_t ~r~n destroy rebate ~r~n') dw_mx.Modify('destroy tax_t ~r~n destroy tax ~r~n') dw_mx.Modify('destroy bateprice_t ~r~n destroy bateprice ~r~n') dw_mx.Modify('destroy enprice_tax_t ~r~n destroy enprice_tax ~r~n') dw_mx.Modify('destroy bateprice_tax_t ~r~n destroy bateprice_tax ~r~n') dw_mx.Modify('destroy taxamt_t ~r~n destroy taxamt ~r~n') dw_mx.Modify('destroy enamt_tax_t ~r~n destroy enamt_tax ~r~n') end if if (buytask.GetInt('Complete') = 1) then cb_accept.Enabled = false cb_feedback.Enabled = false cb_reject.Enabled = false else // if (f_find_fx_user_power(33, ref arg_msg) <> 1) then // 33-采购订单确认 // cb_accept.Enabled = false // end if if (f_find_fx_user_power(32, ref arg_msg) <> 1) then // 32-采购订单协商 cb_feedback.Enabled = false end if if (f_find_fx_user_power(34, ref arg_msg) <> 1) then // 34-采购订单拒绝 cb_reject.Enabled = false end if end if ext: return rslt end function public function boolean wf_chk_ifchange (ref string arg_msg);// 检查是否对明细进行修改 boolean ifchange = false dw_main.AcceptText() dw_mx.AcceptText() string msg_period long i for i = 1 to dw_mx.RowCount() msg_period = '' // 回复数量 if (dw_mx.Object.uqty[i] <> dw_mx.Object.spt_uqty[i]) then ifchange = true msg_period += '回复数量:(' + string(dw_mx.Object.uqty[i], '#,##0.##') + ' -> ' + string(dw_mx.Object.spt_uqty[i], '#,##0.##') + ');' end if // 回复单价 if (dw_mx.Object.enprice[i] <> dw_mx.Object.spt_enprice[i]) then ifchange = true msg_period += '回复单价:(' + string(dw_mx.Object.enprice[i], '#,##0.##') + ' -> ' + string(dw_mx.Object.spt_enprice[i], '#,##0.##') + ');' end if // 回复交期 if (dw_mx.Object.requiredate[i] <> dw_mx.Object.spt_requiredate[i]) then ifchange = true msg_period += '回复交期:(' + string(dw_mx.Object.requiredate[i], 'yyyy-MM-dd') + ' -> ' + string(dw_mx.Object.spt_requiredate[i], 'yyyy-MM-dd') + ');' end if // 回复配置 if (dw_mx.Object.status[i] <> dw_mx.Object.spt_status[i]) then ifchange = true msg_period += '回复配置:(' + dw_mx.Object.status[i] + ' -> ' + dw_mx.Object.spt_status[i] + ');' end if // 回复配置1 if (dw_mx.Object.woodcode[i] <> dw_mx.Object.spt_woodcode[i]) then ifchange = true msg_period += '回复配置1:(' + dw_mx.Object.woodcode[i] + ' -> ' + dw_mx.Object.spt_woodcode[i] + ');' end if // 回复配置2 if (dw_mx.Object.pcode[i] <> dw_mx.Object.spt_pcode[i]) then ifchange = true msg_period += '回复配置2:(' + dw_mx.Object.pcode[i] + ' -> ' + dw_mx.Object.spt_pcode[i] + ');' end if // 回复备注 if (dw_mx.Object.dscrp[i] <> dw_mx.Object.spt_dscrp[i]) then ifchange = true msg_period += '回复备注:(' + dw_mx.Object.dscrp[i] + ' -> ' + dw_mx.Object.spt_dscrp[i] + ');' end if // 汇总 if (msg_period <> '') then arg_msg += '明细第' + string(i) + '行,物料[' + dw_mx.Object.mtrlname[i] + ']回复内容:~r~n' + msg_period + '~r~n' end if next if (Len(arg_msg) > 490) then arg_msg = Mid(arg_msg, 1, 490) + '...' // 会有~r~n被截断问题? end if return ifchange end function on w_buytask_rece_fx.create int iCurrent call super::create this.cb_accept=create cb_accept this.dw_main=create dw_main this.st_1=create st_1 this.mle_summary=create mle_summary this.st_2=create st_2 this.mle_postscript=create mle_postscript this.st_3=create st_3 this.mle_remark=create mle_remark this.dw_mx=create dw_mx this.cb_feedback=create cb_feedback this.cb_reject=create cb_reject iCurrent=UpperBound(this.Control) this.Control[iCurrent+1]=this.cb_accept this.Control[iCurrent+2]=this.dw_main this.Control[iCurrent+3]=this.st_1 this.Control[iCurrent+4]=this.mle_summary this.Control[iCurrent+5]=this.st_2 this.Control[iCurrent+6]=this.mle_postscript this.Control[iCurrent+7]=this.st_3 this.Control[iCurrent+8]=this.mle_remark this.Control[iCurrent+9]=this.dw_mx this.Control[iCurrent+10]=this.cb_feedback this.Control[iCurrent+11]=this.cb_reject end on on w_buytask_rece_fx.destroy call super::destroy destroy(this.cb_accept) destroy(this.dw_main) destroy(this.st_1) destroy(this.mle_summary) destroy(this.st_2) destroy(this.mle_postscript) destroy(this.st_3) destroy(this.mle_remark) destroy(this.dw_mx) destroy(this.cb_feedback) destroy(this.cb_reject) end on event open;call super::open;s_tran = Message.PowerObjectParm if IsNUll(s_tran) then MessageBox('提示', '打开方式有误') Close(this) return end if if (not IsValid(s_tran)) then MessageBox('提示', '打开方式无效') Close(this) return end if string arg_msg // 30-采购订单 31-采购订单查看(单价) if (f_find_fx_user_power(30, ref arg_msg) <> 1 & and f_find_fx_user_power(31, ref arg_msg) <> 1) then MessageBox('权限提示', arg_msg) Close(this) return end if mle_summary.Text = s_tran.summary mle_postscript.Text = s_tran.postscript mle_remark.Text = s_tran.remark if (wf_retrieve( ) = 0) then Close(this) end if end event event resize;call super::resize;if (this.Width < 3762) then this.Width = 3762 if (this.Height < 2292) then this.Height = 2292 mle_summary.Width = this.workspacewidth( ) - mle_summary.X - 14 mle_postscript.Width = mle_summary.Width mle_remark.Width = mle_summary.Width dw_mx.Width = this.workspacewidth( ) dw_mx.Height = this.workspaceheight( ) - dw_main.Y - dw_main.Height cb_exit.X = this.workspacewidth( ) - cb_exit.Width end event type cb_func from w_publ_base_style`cb_func within w_buytask_rece_fx boolean visible = false end type type cb_exit from w_publ_base_style`cb_exit within w_buytask_rece_fx integer x = 2610 end type type ln_bar from w_publ_base_style`ln_bar within w_buytask_rece_fx end type type ln_bar2 from w_publ_base_style`ln_bar2 within w_buytask_rece_fx end type type r_bar from w_publ_base_style`r_bar within w_buytask_rece_fx end type type cb_accept from uo_imflatbutton within w_buytask_rece_fx integer width = 549 integer height = 164 integer taborder = 30 boolean bringtotop = true string text = "接受并转为销售订单" string normalpicname = "ok.bmp" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;dw_mx.SetFilter('') dw_mx.Filter() string arg_msg //if (f_find_fx_user_power(33, ref arg_msg) <> 1) then // 33-采购订单确认 // MessageBox('权限提示', arg_msg) // return //end if // 检查是否对明细进行修改 if wf_chk_ifchange(ref arg_msg) then MessageBox('提示', '已对订单明细进行修改,请使用[反馈修改内容]功能~r~n' + arg_msg) return end if // 没有修改,则直接确认接受 if (dw_mx.RowCount() <= 0) then MessageBox('提示', '没有明细内容') return end if long row row = dw_main.GetRow() if (IsNull(row)) then return if (dw_main.Object.status[row] <> 1) then MessageBox('提示', '该客户的采购订单未完成审核,不能转为正式销售订单,请通知该客户审核后重新发送.本次单据可拒绝.') return end if FXAppCom.AcceptBuytask(app_token_fx, s_tran.sn, ref arg_msg) if (arg_msg <> '') then MessageBox('提示', '接受并转为销售订单操作失败:' + arg_msg) else MessageBox('提示', '操作成功!') Close(parent) end if end event type dw_main from datawindow within w_buytask_rece_fx integer y = 172 integer width = 2226 integer height = 1396 integer taborder = 20 boolean bringtotop = true string title = "none" string dataobject = "dw_tempbuytask" boolean livescroll = true end type type st_1 from statictext within w_buytask_rece_fx integer x = 2249 integer y = 172 integer width = 146 integer height = 48 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 16777215 string text = "摘要" boolean focusrectangle = false end type type mle_summary from multilineedit within w_buytask_rece_fx integer x = 2249 integer y = 232 integer width = 1499 integer height = 392 integer taborder = 30 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 boolean vscrollbar = true boolean autovscroll = true boolean displayonly = true end type type st_2 from statictext within w_buytask_rece_fx integer x = 2249 integer y = 644 integer width = 146 integer height = 48 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 16777215 string text = "附言" boolean focusrectangle = false end type type mle_postscript from multilineedit within w_buytask_rece_fx integer x = 2249 integer y = 700 integer width = 1499 integer height = 392 integer taborder = 40 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 boolean vscrollbar = true boolean autovscroll = true boolean displayonly = true end type type st_3 from statictext within w_buytask_rece_fx integer x = 2249 integer y = 1116 integer width = 146 integer height = 48 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 16777215 string text = "备注" boolean focusrectangle = false end type type mle_remark from multilineedit within w_buytask_rece_fx integer x = 2249 integer y = 1176 integer width = 1499 integer height = 392 integer taborder = 40 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 boolean vscrollbar = true boolean autovscroll = true boolean displayonly = true end type type dw_mx from u_dw_rbtnfilter within w_buytask_rece_fx integer y = 1572 integer width = 3771 integer height = 832 integer taborder = 20 boolean bringtotop = true boolean titlebar = true string title = "订单明细" string dataobject = "dw_tempbuytaskmx" boolean controlmenu = true boolean maxbox = true boolean hscrollbar = true boolean vscrollbar = true boolean resizable = true boolean rbutton_filter_use = true boolean rbutton_setposition_use = true boolean titleclick_sort_use = true end type event itemfocuschanged;call super::itemfocuschanged;if (row > 0) then this.SetRow(row) this.SelectRow(0, false) this.SelectRow(row, true) string colName colName = this.GetColumnName() if (colName = 'spt_uqty' & or colName = 'spt_enprice' & or colName = 'spt_requiredate' & or colName = 'spt_status' & or colName = 'spt_woodcode' & or colName = 'spt_pcode' & or colName = 'spt_dscrp' & ) then this.SelectText(1, Len(this.GetText())) end if end if end event type cb_feedback from uo_imflatbutton within w_buytask_rece_fx integer x = 553 integer width = 384 integer height = 164 integer taborder = 20 boolean bringtotop = true string text = "反馈修改内容" toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;dw_mx.SetFilter('') dw_mx.Filter() string arg_msg if (f_find_fx_user_power(32, ref arg_msg) <> 1) then // 32-采购订单协商 MessageBox('权限提示', arg_msg) return end if if (dw_mx.RowCount() <= 0) then MessageBox('提示', '没有明细内容') return end if if not wf_chk_ifchange(ref arg_msg) then MessageBox('提示', '没有明细内容被修改') return end if If MessageBox('提示','确认要反馈此单据的修改内容吗?',Question!,YesNoCancel!) <> 1 Then Return OpenWithParm(w_packet_msg_edit_fx, arg_msg) s_open_packet s_ret s_ret = Message.PowerObjectParm if (s_ret.returnflag = 0) then MessageBox('提示', '操作取消') return end if string redscrp, redscrp2, postscript redscrp = Trim(dw_main.Object.redscrp[1]) if IsNull(redscrp) then redscrp = '' end if redscrp2 = Trim(dw_main.Object.redscrp2[1]) if IsNull(redscrp2) then redscrp2 = '' end if postscript = s_ret.postscript if IsNull(postscript) then postscript = '' end if if (Len(postscript) > 500) then MessageBox('提示', '留言板信息超长(500),请进行删减') return end if oleobject list, item list = FXAppCom.CreArrOfPbDictionary() long i for i = 1 to dw_mx.RowCount() item = FXAppCom.CreatePbDictionary() item.SetInt('printid', dw_mx.Object.printid[i]) item.SetDouble('uqty', dw_mx.Object.spt_uqty[i]) item.SetDouble('enprice', dw_mx.Object.spt_enprice[i]) item.SetDateTime('requiredate', dw_mx.Object.spt_Requiredate[i]) item.SetString('status', dw_mx.Object.spt_status[i]) item.SetString('woodcode', dw_mx.Object.spt_woodcode[i]) item.SetString('pcode', dw_mx.Object.spt_pcode[i]) item.SetString('dscrp', dw_mx.Object.spt_dscrp[i]) list.Add(item) next FXAppCom.FeedbackBuytask(app_token_fx, s_tran.sn, redscrp, redscrp2, postscript, list, ref arg_msg) if (arg_msg <> '') then MessageBox('提示', '反馈修改内容失败:' + arg_msg) else MessageBox('提示', '操作成功') Close(parent) end if end event type cb_reject from uo_imflatbutton within w_buytask_rece_fx integer x = 942 integer width = 151 integer height = 164 integer taborder = 20 boolean bringtotop = true boolean enabled = false string text = "拒绝" string normalpicname = "DELETE.BMP" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type