jQuery + Stimulsoft.Report 報表空間打印多個IDnode
split函數,多行ID函數
1. 獲取選擇多行ID(前臺)ui
//按鈕-打印 function PrinterWorkQuality() { var row = $("#ui_Grid2").datagrid("getChecked"); if (row.length > 0) { var parmIds = ""; $.each(row, function (i, row) { parmIds += row.Id + ","; }); parmIds = parmIds.substring(0, parmIds.length - 1); ClostTabByName("製程巡檢單"); AddSubPage('製程巡檢單', '../../Content/page/report.aspx?area=Stock&rpt=WorkQuality&id=' + parmIds, 'icon-report'); } }
2.參數varchar ,size = 200(報表)spa
3.XQuery Split函數(SQL)code
create function func_splitid (@str varchar(max),@split varchar(10)) RETURNS @t Table (c1 int) AS BEGIN DECLARE @x XML SET @x = CONVERT(XML,'<items><item id="' + REPLACE(@str, @split, '"/><item id="') + '"/></items>') INSERT INTO @t SELECT x.item.value('@id[1]', 'INT') FROM @x.nodes('//items/item') AS x(item) RETURN END GO
4.存儲過程(SQL)blog
-- exec TX_R_WorkQuality @qcidlist = '1,2,3,4' alter PROCEDURE TX_R_WorkQuality @qcidlist varchar(100) as begin create table #tmpqcid ( qcid int ) insert into #tmpqcid(qcid) select c1 from func_splitid(@qcidlist,',') SELECT m1.* ,convert(nvarchar(10),EDate) as strDate,case when WShift='shift1' then '白班' else '晚班' end as WShiftName FROM VWorkQuality m1 inner join #tmpqcid m2 on m1.Id = m2.qcid drop table #tmpqcid end
5.查詢語句(報表)ci
exec TX_R_WorkQuality @idget