|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册账号
×
本帖最后由 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);
}
} |
|