找回密码
 注册账号

QQ登录

只需一步,快速开始

手机号码,快捷登录

手机号码,快捷登录

初学者课程:T3自学|T6自学|U8自学软件下载课件下载工具下载资料:通资料|U8资料|NC|培训|年结积分规则 | 使用常见问题Q&A
知识库:U8 | | NC | U9 | OA | 政务U8|U9|NCC|NC65|NC65客开|NCC客开新手必读 | 任务 | 快速增金币用友QQ群[微信群]
查看: 7410|回复: 7

[技巧] BS表单常用代码收集整理(欢迎补充)

  [复制链接]
发表于 2010-11-8 10:11:29 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册账号

×
本帖最后由 windy8848 于 2010-11-8 11:09 编辑

/分类树商品选择
function uf_selectsp() {
  var con = Trim(SKBILLgrid2.Cell(SKBILLgrid2.CurrentRow,SKBILLgrid2.CurrentCol).Text);
var treeSql = "select hzflbh as id,hzflchina,hzflbh from hzfamx where hzcode = 'sp_init' order by hzflbh";
var fieldkey = "id";
var dsOpensql = " select spid,spbh,spmch,shpgg,dw,shpchd,zjm from spkfk (nolock) "
    + " where beactive='是' "
        + " and (spbh like '" + con + "%' or zjm like '%" + con + "%' or spmch like '%" + con + "%') "
        + " order by spbh ";
var fieldkey_filterExp = "spbh like ':id" + "%' ";
var multsel = "是";
var undispflds = "spid,zjm";
var caption ="商品选择";
var pageSize=-1;
var codemode = "2,2,2,2";
    var width = 800;
    var height = 600;
    var notcopyflds = "";
    var filterExp = "( spbh like '%:v_get%' ) or ( zjm like '%:v_get%') or ( spmch like '%:v_get%')";
var returnOne = "是";
CreateFilterSelTree(treeSql,fieldkey,dsOpensql,fieldkey_filterExp,multsel,undispflds,caption,pageSize,dssub2,codemode,width,height,notcopyflds,filterExp,returnOne);
}
//商品选择
function uf_selectsp(sender) {
if (sender=='spbh') {
     var con = Trim(DsMain.Field('spbh').Value);
    } else if (sender=='spmch') {
  var con = Trim(DsMain.Field('spmch').Value);
    }
       //var con = Trim(SKBILLgrid2.Cell(SKBILLgrid2.CurrentRow,SKBILLgrid2.CurrentCol).Text);
        var sql = " select spid,spbh,spmch,shpgg,dw,shpchd,zjm from spkfk(nolock) "
                + " where beactive='是' "
                + " and (spbh like '" + con + "%' or zjm like '%" + con + "%' or spmch like '%" + con + "%') "
                + " order by spbh ";
        var undispflds  = "spid,zjm";
        var multisel    = "是";
        var pageSize    = "-1";
        var d_caption   = "商品选择";
        var d_width     = 645;
        var d_height    = 375;
        var notcopyflds = "";
        var returnone   = "是";
        var filterExp = "( spbh like '%:v_get%' ) or ( zjm like '%:v_get%') or ( spmch like '%:v_get%')";
        var idrowstyle = "";
        if (ZlSelectImpl(sql, undispflds , dssub2, multisel, pageSize, d_caption, d_width, d_height, notcopyflds,returnone,filterExp,idrowstyle)) {
        } else {
           dssub2.field('spid').value = '';
            dssub2.field('spbh').value = '';
            dssub2.field('spmch').value = '';
        }
}
//分类树单位选择
function uf_selectdw() {
    var con = Trim(SKBILLgrid1.Cell(SKBILLgrid1.CurrentRow,SKBILLgrid1.CurrentCol).Text);
    var treeSql = " select hzflbh as id,hzflchina,hzflbh from hzfamx where hzcode = 'dw_init' order by hzflbh ";
    var fieldkey = "id";
    var opensql = " select dwbh,danwbh,dwmch,zjm,kehufl,quyufl,kehulb from mchk(nolock) "
                + " where beactive='是' and is_jg='否' and isxs='是' and danwbh like ':id" + "%' "
                + " and (danwbh like '" + con + "%' or zjm like '%" + con + "%' or dwmch like '%" + con + "%') "
                + " order by danwbh ";
    var multsel = "是";
var undisplay = "dwbh";
    var caption = "单位选择";
var pageSize = -1;
var codemode = "2,2,2";
    var width = 800;
    var height = 600;
    var notcopyflds = "";
    var filterExp = "( danwbh like '%:v_get%' ) or ( zjm like '%:v_get%') or ( dwmch like '%:v_get%')";
CreateSelTree(treeSql,fieldkey,opensql,multsel,undisplay,caption,pageSize,dssub1,codemode,width,height,notcopyflds,filterExp);
}
function uf_selectdw(sender) {
if (sender=='danwbh') {
     var con = Trim(DsMain.Field('danwbh').Value);
    } else if (sender=='dwmch') {
  var con = Trim(DsMain.Field('dwmch').Value);
    }
   
        var con = Trim(SKBILLgrid1.Cell(SKBILLgrid1.CurrentRow,SKBILLgrid1.CurrentCol).Text);
        var sql = " select dwbh,danwbh,dwmch,zjm,kehufl,quyufl,kehulb from mchk(nolock) "
                + " where beactive='是' and is_jg='否' and isxs='是' "
                + " and (danwbh like '" + con + "%' or zjm like '%" + con + "%' or dwmch like '%" + con + "%') "
                + " order by danwbh ";
        var undispflds  = "dwbh,zjm";
        var multisel    = "是";
        var pageSize    = "-1";
        var d_caption   = "单位选择";
        var d_width     = 645;
        var d_height    = 375;
        var notcopyflds = "";
        var returnone   = "是";
        var filterExp = "( danwbh like '%:v_get%' ) or ( zjm like '%:v_get%') or ( dwmch like '%:v_get%')";
        if (ZlSelectImpl(sql, undispflds , dssub1, multisel, pageSize, d_caption, d_width, d_height, notcopyflds,returnone,filterExp)) {
        } else {
           dssub1.Field('dwbh').value = '';
            dssub1.Field('danwbh').value = '';
            dssub1.Field('dwmch').value = '';
        }
}

//检索方案色标显示
    var idrowstyle = " 'color: ' + if( ((xdqxx <= 0) or (xdqxg <= 0)) , 'red;', if( ((xdqxx > 0) and (xdqxx < 90)) or ((xdqxg > 0) and (xdqxg < 90)), 'blue;', 'black;')) +"  
   + " 'background-color: ' + if( (xdqxx > 90) and (xdqxg > 90),'yellow','white;') ";

//单据存盘代码
    try{
        if ( IsSpace(DjSave('提示')) ) {
         uf_onload();
        }
    }catch(e){
        alert(e.message);
    }

//当月最后一天
    DsMain.Field('end_rq').value = SqlToField("SELECT CONVERT(CHAR(10),DATEADD(Day,-1,CONVERT(char(8),DATEADD(Month,1,getdate()),120)+'01'),120)");
   
//操作员对应部门   
     var bmsql = " select b.bm from hr_bmzhygw a(nolock),bmdoc b(nolock) "
              + " where a.bmid=b.bmid and a.dzyid = '" + GetCookie('dzyid') + "' ";
    DsMain.Field('bm').Value = SqlToField(bmsql);
   
   
//存盘检查
    if (dssub1.RecordCount>0) {
        for (var i=0;i<dssub1.RecordCount;i++) {
            if (IsSpace(dssub1.GetValueAt(i,'spid'))) {
                alert('商品信息录入错误,请检查!');
                dssub1.SetPos(i);
                return false;
            }
        }
    }   



//表单色标
function uf_showColor(){
    //SKBILLgrid1.Cell(SKBILLgrid1.CurrentRow,pf_GetIndexByName(dssub1,'shl')).BgColor='';
    SKBILLgrid1.ColStyle(pf_GetIndexByName(dssub1,'shl')) = "background-Color:#3AC2FA";
    SKBILLgrid1.ColStyle(pf_GetIndexByName(dssub1,'hshj')) = "background-Color:#3AC2FA";
  }

function uf_showColor(){
    var color = " 'color: ' + if( 1 , 'black;', 'black;')";
    var backColor = "'background-color: ' + if( kczt='缺货' , '#A6CAF0;',if(kczt='积压', '#FFFF55;', 'white;')) "
    //var backColor = "'background-color: ' + if( kczt='缺货' , '#A6CAF0;',if(kczt='积压', '#FFFF55;',if(kczt='','aqua;', 'white;'))) "
    dssub2.idrowstyle = color + " + " + backColor;
    dssub2.UpdateGrid();
}

//多页面查询
function uf_page(){
if( PageControl1.tabPane.getSelectedIndex() == 0)
    {
uf_query1();
    }
if( PageControl1.tabPane.getSelectedIndex() == 1 )
    {
uf_query2();
    }
}


//过滤
function uf_filter(){
var danwbh = Trim(DsMain.Field('danwbh').Value);
var spbh = Trim(DsMain.Field('spbh').Value);
    dssub1.Filtered = false;
    dssub1.Filter = " ( danwbh like '%"+danwbh+"%' ) and ( spbh like '%"+spbh+"%' ) ";
    dssub1.Filtered = true;
}

//全选、单选
        for (var i = 0; i < dssub1.RecordCount ; i++)
        {
            SKBILLgrid1.Marked( i + 1 ) = true;
        }
        
//单据修改
function uf_fz_kpxg() {
    AddBill();
    var cur_user = GetCookie('dzyname');
    var sqlDj = " select a.djbh,a.piaohao,a.rq,b.danwbh,b.dwmch,b.zjm,a.beizhu,a.bm,a.ywy,b.shh,b.dzhdh,b.yhzhh, "
              + "   b.kehudengji,a.djbh as xgdjbh,a.djbs,a.dwbh,a.bezzs,a.djlx,a.ontime,a.bezzs,a.bendian "
              + " from jxdjhz a(nolock),mchk b(nolock) "
              + " where a.is_zx='否' and a.shenhe='否' and a.username='"+ cur_user +"'  "
              + " and not exists(select djbh from jxdjmx c where c.djbh=a.djbh and c.isjs='是') "
              + " and a.dwbh=b.dwbh and b.beactive='是' and a.djbs like 'JHG' "
              + " order by a.djbh ";
    var hzFld = "djbh";
    var sqlHz = " select a.*,b.* from jxdjhz a (nolock),mchk b (nolock) "
              + " where a.dwbh=b.dwbh and a.djbh=':djbh'";
    var sqlMx = " select '' as xgdjbh,0 as recnum,djbh,dj_sn,a.spid,dj_sort,recnum,spbh,spmch,shpgg,shpchd,"
              + " b.dw,a.hw,c.huowname,a.pihao,a.sxrq,a.baozhiqi,a.shl,a.baozhshl,a.lingsshl,a.jlgg,pfpj,dj,hshj,a.koul,a.shlv,je,hsje,she,a.beizhu,a.chbdj,zgshj,"
              + " zdshj,is_gdsj,a.zengp,b.zjm,a.dj as tmpdj,a.hshj as tmphshj"
              + " from jxdjmx a(nolock),spkfk b(nolock),huoweizl c(nolock) "
              + " where a.spid=b.spid and a.hw=c.hw and a.djbh=':djbh'";
    var bCopyDjbh = true;
    var bSelAllMx = true;
var hzNotcopyFlds = "";
    var mxNotcopyFlds = "";
var hzFilterExp = "";
var mxFilterExp = "( spbh like ':v_get%' ) or ( zjm like '%:v_get%') or ( spmch like '%:v_get%')";
var mxHideFlds = "";
var bDjProtect = true;
var returnOne = false;
    if(DjSelect(DsMain, dssub1, sqlDj, sqlHz, sqlMx, hzFld, bCopyDjbh, bSelAllMx, hzNotcopyFlds, mxNotcopyFlds, hzFilterExp, mxFilterExp, mxHideFlds, bDjProtect, returnOne) == true) {
    pubdjbh=DsMain.Field('djbh').Value;
    }
}


//BS检索方案色标使用
function uf_test() {
var sql = " SELECT TOP 2000 spid, spbh, spmch, shpgg, dw, shpchd, pizhwh, jixing, leibie, zjm "
      + " from spkfk (nolock) "
            + " where beactive='是' ";
    var undispflds = "spid,zjm";
    var multisel = "否";
    var pageSize = -1;
    var d_caption = "色标测试";
    var d_width = 800;
    var d_height = 600;
    var notcopyflds = "";
    var returnone = "是";
    var filterExp = " ( spbh like ':v_get%' ) or ( zjm like '%:v_get%') or ( spmch like '%:v_get%') ";
    var idrowstyle = " 'color: ' + if( leibie='进口药品', 'red;', if( leibie='非药品', 'blue;', 'black;')) + "
          + " 'background-color: ' + if( leibie='中药', 'yellow;', 'white;') ";
ZlSelectImpl(sql, undispflds , DsMain, multisel, pageSize, d_caption, d_width, d_height, notcopyflds, returnone, filterExp, idrowstyle)
}


//当前明细记录拆分
function uf_MXSplit() {
var rcd = dssub1.RecordCount;
var fld = dssub1.FieldCount;
if (dssub1.RecordCount == 0) {
  alert('当前没有记录可供拆分!');
        return;
    }
    var arr = new Array(fld);
    for (var i = 0; i < fld; i++) {
  arr = dssub1.GetValueAt(dssub1.RecNo, i);
    }
dssub1.Append();
    for (var i = 0; i < fld; i++) {
  dssub1.SetValueAt(dssub1.RecNo, i, arr);
    }
}
发表于 2010-11-8 22:52:55 | 显示全部楼层
跟过,学习学习
发表于 2010-12-23 10:43:01 | 显示全部楼层
跟过,学习学习
发表于 2011-5-4 22:57:03 | 显示全部楼层
学习学习
发表于 2011-5-23 10:48:44 | 显示全部楼层
只能是 学习 下
发表于 2011-8-3 11:38:22 | 显示全部楼层
还有的请补充
发表于 2011-11-3 10:23:58 | 显示全部楼层
学习学习,没怎么做过,BS的东西
发表于 2011-12-16 01:44:12 | 显示全部楼层
很不错的介绍,好好看下!!
回复 点赞 拍砖

使用道具 举报

您需要登录后才可以回帖 登录 | 注册账号

本版积分规则

QQ|站长微信|Archiver|手机版|小黑屋|用友之家 ( 蜀ICP备07505338号|51072502110008 )

GMT+8, 2024-11-21 20:39 , Processed in 0.050250 second(s), 9 queries , Gzip On, Redis On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表