int 创建普通按钮右面(string 上级控件名, string 跟随控件名, string 新建控件名称, int x, int y, int 宽度, int 高度, string 文本, string 命令) { int gx, gy, gk, gg gk = gui_get_w(跟随控件名) + 宽度; gg = gui_get_h(跟随控件名) + 高度; gx = gui_get_x(跟随控件名) + gui_get_w(跟随控件名) + x; gy = gui_get_y(跟随控件名) + y; gui_create_button (上级控件名, 新建控件名称, gx, gy, gk, gg, 文本, 命令); return 1; }; int 创建普通按钮下面(string 上级控件名, string 跟随控件名, string 新建控件名称, int x, int y, int 宽度, int 高度, string 文本, string 命令) { int gx, gy, gk, gg gk = gui_get_w(跟随控件名) + 宽度; gg = gui_get_h(跟随控件名) + 高度; gx = gui_get_x(跟随控件名) + x; gy = gui_get_y(跟随控件名) + gui_get_h(跟随控件名) + y; gui_create_button (上级控件名, 新建控件名称, gx, gy, gk, gg, 文本, 命令); return 1; }; //参数:上级控件,跟随控件,新建控件,X坐标,Y坐标,宽度,高度,显示内容,字体,背景色,下拉框宽度,字典标识; string 创建标签下拉列表右边(string 上级控件名,string 跟随控件名,string 新建控件名称,int x,int y,int 宽度,int 高度,string 显示内容,int pont_size,int color_val,int inp_edti_width,string dict_id) { //创建标签 int gx,gy; gx=gui_get_x(跟随控件名)+x+gui_get_w(跟随控件名); gy=gui_get_y(跟随控件名) +y; gui_create_label(上级控件名,新建控件名称,gx,gy,显示内容); gui_set_w(新建控件名称,宽度); gui_set_h(新建控件名称,高度); gui_set_font_size(新建控件名称,pont_size); gui_set_bg_color(新建控件名称,color_val); //创建下拉框 跟随控件名=新建控件名称; 新建控件名称+="_edit_val"; int gx,gy,gh; gx=gui_get_x(跟随控件名)+x+gui_get_w(跟随控件名); gy=gui_get_y(跟随控件名) +y; gh=gui_get_h(跟随控件名) +高度; gui_create_combobox(上级控件名,新建控件名称,gx,gy,inp_edti_width,gh,dict_id); gui_set_font_size(新建控件名称,pont_size); gui_set_val(新建控件名称,""); return 新建控件名称; }; //参数:上级控件,跟随控件,新建控件,X坐标,Y坐标,宽度,高度,显示内容,字体,背景色,输入框宽度; string 创建标签输入框右边(string 上级控件名, string 跟随控件名, string 新建控件名称, int x, int y, int 宽度, int 高度, string 显示内容, int pont_size, int color_val, int inp_edti_width) { //创建标签 int gx, gy; gx = gui_get_x(跟随控件名) + x + gui_get_w(跟随控件名); gy = gui_get_y(跟随控件名) + y; gui_create_label(上级控件名, 新建控件名称, gx, gy, 显示内容); gui_set_w(新建控件名称, 宽度); gui_set_h(新建控件名称, 高度); gui_set_font_size(新建控件名称, pont_size); gui_set_bg_color(新建控件名称, color_val); //创建输入框 跟随控件名 = 新建控件名称; 新建控件名称 += "_edit_val"; int gx, gy, gh; gx = gui_get_x(跟随控件名) + x + gui_get_w(跟随控件名); gy = gui_get_y(跟随控件名) + y; gh = gui_get_h(跟随控件名) + 高度; gui_create_edit(上级控件名, 新建控件名称, gx, gy, inp_edti_width, gh); gui_set_font_size(新建控件名称, pont_size); gui_set_val(新建控件名称, ""); return 新建控件名称; }; //参数:上级控件,跟随控件,新建控件,X坐标,Y坐标,宽度,高度,显示内容,字体,背景色,输入框宽度; string 创建标签输入框下边(string 上级控件名, string 跟随控件名, string 新建控件名称, int x, int y, int 宽度, int 高度, string 显示内容, int pont_size, int color_val, int inp_edti_width) { //创建标签 int gx, gy; gx = gui_get_x(跟随控件名) + x ; gy = gui_get_y(跟随控件名) + y + gui_get_h(跟随控件名); gui_create_label(上级控件名, 新建控件名称, gx, gy, 显示内容); gui_set_w(新建控件名称, 宽度); gui_set_h(新建控件名称, 高度); gui_set_font_size(新建控件名称, pont_size); gui_set_bg_color(新建控件名称, color_val); //创建输入框 跟随控件名 = 新建控件名称; 新建控件名称 += "_edit_val"; int gx, gy, gh; gx = gui_get_x(跟随控件名) + x + gui_get_w(跟随控件名); gy = gui_get_y(跟随控件名) + y; gh = gui_get_h(跟随控件名) + 高度; gui_create_edit(上级控件名, 新建控件名称, gx, gy, inp_edti_width, gh); gui_set_font_size(新建控件名称, pont_size); gui_set_val(新建控件名称, ""); return 新建控件名称; }; //检索框内容:根据符号位置取出内容。参数:输入内容,符号,数据区字段 string search_joint_symbol(string compare_val, string symbol_val, string db_col_id) { string get_val; get_val = ""; int strlen_val; //符号占的 字节数 strlen_val = strlen(symbol_val); string val; val = compare_val; string temp_val; temp_val = ""; while (str_pos(val, symbol_val) > -1) { temp_val = (str_get_sub(val, 0, str_pos(val, symbol_val))); val = str_get_sub(val, str_pos(val, symbol_val) + strlen_val, strlen(val)); if (temp_val != "") { if (get_val == "") get_val += db_col_id + " like '%" + temp_val + "%' "; else get_val += "and " + db_col_id + " like '%" + temp_val + "%' "; } }; if (val != "") { if (get_val == "") get_val += db_col_id + " like '%" + val + "%' "; else get_val += "and " + db_col_id + " like '%" + val + "%' "; } //dbg(get_val); return get_val; } //输入文本:拆分成两个数字参数 string symbol_get_val(string symbol_val, int symbol_site, string compare_val) //根据符号位置取出内容。参数:符号,符号位置,输入内容 { int strlen_val; //符号占的 字节数 strlen_val = strlen(symbol_val); int Loop_time; //循环次数 Loop_time = 0; string val; val = compare_val; string temp_val; temp_val = ""; while (str_pos(val, symbol_val) > -1 && Loop_time >= 0) { temp_val = (str_get_sub(val, 0, str_pos(val, symbol_val))); val = str_get_sub(val, str_pos(val, symbol_val) + strlen_val, strlen(val)); //dbg(temp_val); Loop_time++; if (symbol_site == Loop_time) //如果循环次数等于符号位置 就返回取值 { return temp_val; } }; //dbg(val); 最后位置就取最后剩余值 return val; } //产品长宽高检索:参数:目录是否包括下级目录 0,1 int res_select_spec(int is_fater_cat) { string keep_edit_val; //历史检索框内容 保留 keep_edit_val = gui_get_text("Edit_Val"); gui_set_val("Edit_Val", "#+#+"); gui_trigger_change("Edit_Val"); gui_set_val("Edit_Val", keep_edit_val); string res_cat_id; //右边树形 目录编号 res_cat_id = treeview_get_selected_code("TreeView_Res_Cat"); string res_name, res_model, res_spec; res_name = gui_get_val("search_res_name_edit_val"); res_model = gui_get_val("search_res_model_edit_val"); res_spec = gui_get_val("search_res_spec_edit_val"); string ext_1; //销售客户-扩展1检索条件 ext_1 = gui_get_val("search_res_ext_1_edit_val"); //dbg("ext_1:"+ext_1) int search_space; //检索条件空白判断 search_space = 0; string check_symbol; //检查字符 check_symbol = " "; string cond_sql; cond_sql = ""; //目录限制: 0 不限制 ,1 限制本目录 2限制目录下所目录 if (res_cat_id != "") { if (is_fater_cat == 1) cond_sql += "and a.res_cat_id='" + res_cat_id + "' "; if (is_fater_cat == 2) { cond_sql += "and a.res_cat_id in(select key_id from app_tree_code_map where obj_id='res_catalog' "; cond_sql += "and tree_id like (select tree_id+'%' from app_tree_code_map where obj_id='res_catalog' and key_id='" + res_cat_id + "')) "; } } if (res_name != "") { search_space++; if (str_pos(res_name, check_symbol) > -1) { //检索框内容:根据符号位置取出内容。参数:输入内容,符号,数据区字段 string get_val; get_val = search_joint_symbol(res_name, check_symbol, "a.res_name"); if (get_val != "") cond_sql += "and (" + get_val + ") "; } else { cond_sql += "and a.res_name like '%" + res_name + "%' "; } } if (res_model != "") { search_space++; if (str_pos(res_model, check_symbol) > -1) { //检索框内容:根据符号位置取出内容。参数:输入内容,符号,数据区字段 string get_val; get_val = search_joint_symbol(res_model, check_symbol, "a.res_model"); if (get_val != "") cond_sql += "and (" + get_val + ") "; } else { cond_sql += "and a.res_model like '%" + res_model + "%' "; } } if (res_spec != "") { search_space++; if (str_pos(res_spec, check_symbol) > -1) { //检索框内容:根据符号位置取出内容。参数:输入内容,符号,数据区字段 string get_val; get_val = search_joint_symbol(res_spec, check_symbol, "a.res_spec"); if (get_val != "") cond_sql += "and (" + get_val + ") "; } else { cond_sql += "and a.res_spec like '%" + res_spec + "%' "; } } if (ext_1 != "") { search_space++; cond_sql += "and a.ext_1 in " + str_lst_to_sql_lst(ext_1) + " "; } db_select_area(1); if (search_space == 0) { msg("检索条件不能空白!"); return 1; } string sql; sql = "select a.res_name,a.res_id,res_spec,res_unit_type,res_cat_id as res_cat_name,res_kind,in_ceil_price,"; sql += "in_ref_price,out_floor_price,out_ref_price,ceil_num,floor_num,manufacturer,res_cat_id,"; sql += "quality_days,parent_res_id,stop_flag,auto_copy_parent_info,order_id,cost_price,price_dot_num,easy_code,default_edt_id,"; sql += "res_model,res_rank,res_place,ass_unit_type,num_dot_num,res_desc,edt_io_flag,cost_cal_method,edt_ceil_num,edt_floor_num,"; sql += "ext_1,ext_2,ext_3,ext_4,ext_5,ext_6,ext_7,ext_8,"; sql += "create_date,create_user_id,last_modi_date,last_modi_user_id,emf_route_id,subject_storage_amount,subject_sell_income,subject_sell_cost,bar_code,batch_flag "; sql += "from res a "; sql += "where 1=1 "; sql += cond_sql; sql += "order by a.res_cat_id,a.res_id,a.res_name "; db_run(sql); //dbg(sql); db_map("res_catalog", "res_cat_name", "res_cat_name"); db_map("res_unit_type", "res_unit_type", "res_unit_type"); db_map("yes_no", "stop_flag", "stop_flag"); db_map("res_kind", "res_kind", "res_kind"); db_map("res_unit_type", "ass_unit_type", "ass_unit_type"); db_map("yes_no", "edt_io_flag", "edt_io_flag"); db_map("res_cost_cal_method", "cost_cal_method", "cost_cal_method"); db_map("user", "create_user_id", "create_user_id"); db_map("user", "last_modi_user_id", "last_modi_user_id"); db_map("emf_route", "emf_route_id", "emf_route_id"); db_map("eba", "ext_1", "ext_1"); //db_show(); int n, id; n = db_row_count(); // SQL检索出报表 提取报表行数 if (n == 0) return 1; if (n > 1) grid_add_row_num("MG_All_Res", n - 1); for (id = 1; id <= n; id++) //循环次数 id的初始值为1.一般表格有合计可以少循环一次如果一定要的id<=n { int field_n, field_id; field_n = db_field_count(); for (field_id = 1; field_id <= field_n; field_id++) //循环次数 id的初始值为1.一般表格有合计可以少循环一次如果一定要的id<=n { grid_set_v("MG_All_Res", db_field_name(field_id - 1), id, db_res(field_id - 1)); } db_next(); }; //触发行刷新,先跳到第二行,再第一行就会刷新当前存量明细 if (grid_row_num("MG_All_Res") == 2) { grid_add_row_num("MG_All_Res", 1); grid_set_cur_row("MG_All_Res", 2); grid_set_cur_row("MG_All_Res", 1); grid_del_row("MG_All_Res", 2); } else { grid_set_cur_row("MG_All_Res", 2); grid_set_cur_row("MG_All_Res", 1); }; db_select_area(0); //grid_set_v("MG_All_Res","is_choise",1,1); return 1; }; int func_show_win() { grid_set_col_number("MG_All_Res", "ext_1", 0); grid_set_col_number("MG_All_Res", "ext_2", 0); grid_set_col_number("MG_All_Res", "ext_3", 0); string 新建控件名称; 新建控件名称 = 创建标签输入框右边("ScrollBox_Left", "Edit_Val", "search_res_name", 10, 0, 40, 0, "品名:", 10, 8421631, 110); 新建控件名称 = 创建标签输入框右边("ScrollBox_Left", 新建控件名称, "search_res_model", 5, 0, 40, 0, "型号:", 10, 8421631, 110); 新建控件名称 = 创建标签输入框右边("ScrollBox_Left", 新建控件名称, "search_res_spec", 5, 0, 40, 0, "规格:", 10, 8421631, 110); string check_symbol; //检查字符 check_symbol = "空格"; gui_set_hint("search_res_name_edit_val", "支持:"+check_symbol+" 多字段匹配 比:红 "+check_symbol+" 36"); gui_set_hint("search_res_model_edit_val", "支持:"+check_symbol+" 多字段匹配 比:红 "+check_symbol+" 36"); gui_set_hint("search_res_spec_edit_val", "支持:"+check_symbol+" 多字段匹配 比:红 "+check_symbol+" 36"); 新建控件名称 = 创建标签下拉列表右边("ScrollBox_Left", 新建控件名称, "search_res_ext_1", 5, 0, 40, 0, "销售客户", 10, 8421631, 200,"eba"); //新建控件名称 = 创建标签输入框右边("ScrollBox_Left", 新建控件名称, "search_res_width", 5, 0, 40, 0, "宽度:", 10, 8421631, 70); //新建控件名称 = 创建标签输入框右边("ScrollBox_Left", 新建控件名称, "search_res_length", 5, 0, 40, 0, "长度:", 10, 8421631, 70); //gui_set_hint("search_res_height_edit_val","支持:50 150 格式数值范围检索"); //gui_set_hint("search_res_width_edit_val","支持:50 150 格式数值范围检索"); //gui_set_hint("search_res_length_edit_val","支持:50 150 格式数值范围检索"); //检索按钮放 表格控件界面 创建普通按钮下面("ScrollBox2", "", "ok_search_res", 400, 0, 90, 23, "检索", "call_prog.rec.res_select.res_select_spec(0)"); 创建普通按钮右面("ScrollBox2", "ok_search_res", "ok_search_res_cat", 0, 0, 0, 0, "检索(本目录)", "call_prog.rec.res_select.res_select_spec(1)"); 创建普通按钮右面("ScrollBox2", "ok_search_res_cat", "ok_search_res_father_cat", 0, 0, 0, 0, "检索(父目录)", "call_prog.rec.res_select.res_select_spec(2)"); /* //检索按钮放 检索框右边 创建普通按钮右面("ScrollBox_Left", 新建控件名称, "ok_search_res", 0, 0, -10, 0, "检索", "call_prog.rec.res_select.res_select_spec(0)"); 创建普通按钮右面("ScrollBox_Left", "ok_search_res", "ok_search_res_cat", 0, 0, 10, 0, "检索(本目录)", "call_prog.rec.res_select.res_select_spec(1)"); 创建普通按钮右面("ScrollBox_Left", "ok_search_res_cat", "ok_search_res_father_cat", 0, 0, 0, 0, "检索(父目录)", "call_prog.rec.res_select.res_select_spec(2)"); */ //权限限制-销售客户检索条件 if(!is_super_user()&&!have_any_priv('u_res_select_01')) //管理员和有超权限只提示 { gui_hide("search_res_ext_1"); gui_hide("search_res_ext_1_edit_val"); }; //msg('func_show_win'); return 1; }; int func_win_active() { //msg('func_win_active'); return 1; }; int load_over() { //msg('load_over'); return 1; }; int row_change() { //msg('row_change'); return 1; }; |