我正在尝试将空白行和小计添加到表格的网格视图中。我已设法添加小计行,但空白行没有运气。空行用于分隔月份。我的代码如下,如果有人可以提供帮助我会很感激。如果你也可以告诉我如何加粗小计行(如果可能的话),这也很棒。
有相当多的数据,但简而言之,一些示例数据和输出看起来像:
select
d.period,
CASE WHEN d.period is null then 'Grand Total'
ELSE coalesce (d.description,'MONTHLY TOTAL') end AS Description,
sum(d.Prod_Qty) as 'Production Made',
round(sum(d.TotalTonnes),2) as Tonnes,
sum(d.TotalHrs) as Hours,
round(sum(d.TotalTonnes)/sum(d.TotalHrs),2) as 'Tonnes per Hour',
sum(d.ProdTime) as 'Production Time',
round(sum(d.TotalTonnes)/sum(d.ProdTime),2) as 'Prod Time per Tonne'
from
(
SELECT DISTINCT
EOMONTH(FWT_DAILYPRODUCTION.TransDate) AS Period,
FWT_DAILYPRODUCTION.Prod_Qty,
FWT_PROD_MACHINES.Description,
STOCK_ITEMS.CUBIC,
STOCK_ITEMS.X_BEATS,
STOCK_ITEMS.Weight,
FWT_DAILYPRODUCTION.Prod_Qty * STOCK_ITEMS.Weight / 1000 as TotalTonnes,
(select sum(FWT_LABOUR_LINES.ProdTime) from FWT_LABOUR_LINES where
FWT_DAILYPRODUCTION.SEQNO = FWT_LABOUR_LINES.HDR_SEQNO) as ProdTime,
(select sum(FWT_LABOUR_LINES.TotalHrs) from FWT_LABOUR_LINES where
FWT_DAILYPRODUCTION.SEQNO = FWT_LABOUR_LINES.HDR_SEQNO) as TotalHrs
FROM FWT_DAILYPRODUCTION FWT_DAILYPRODUCTION
FULL OUTER JOIN FWT_LABOUR_LINES FWT_LABOUR_LINES ON
(FWT_LABOUR_LINES.HDR_SEQNO = FWT_DAILYPRODUCTION.SEQNO)
FULL OUTER JOIN FWT_JOB_COST_HDR FWT_JOB_COST_HDR ON
(FWT_JOB_COST_HDR.SEQNO = FWT_DAILYPRODUCTION.JOBNO)
FULL OUTER JOIN FWT_PROD_MACHINES FWT_PROD_MACHINES ON
(FWT_PROD_MACHINES.SEQNO = FWT_JOB_COST_HDR.PROD_MACHINE)
FULL OUTER JOIN FWT_JOB_TYPE FWT_JOB_TYPE ON
(FWT_JOB_TYPE.SEQNO = FWT_JOB_COST_HDR.JOB_TYPE)
FULL OUTER JOIN FWT_JOB_STATUS FWT_JOB_STATUS ON
(FWT_JOB_STATUS.SEQNO = FWT_JOB_COST_HDR.STATUS)
FULL OUTER JOIN FWT_BILLOMAT FWT_BILLOMAT ON
(FWT_BILLOMAT.BILLCODE = FWT_JOB_COST_HDR.BILLCODE)
FULL OUTER JOIN STOCK_ITEMS STOCK_ITEMS ON
(STOCK_ITEMS.STOCKCODE = FWT_BILLOMAT.OUTPUT)
FULL OUTER JOIN STOCK_LOCATIONS STOCK_LOCATIONS ON
(STOCK_LOCATIONS.LOCNO = FWT_JOB_COST_HDR.LOCNO)
WHERE
( EOMONTH(FWT_DAILYPRODUCTION.TransDate) >= DATEADD(MM, DATEDIFF(MM, 0, GETDATE())-13, 0))
AND FWT_JOB_COST_HDR.PROD_MACHINE IN (24,19,20,21,22,23,12)
)d
Group by
rollup(d.period,d.description)
ORDER BY
d.period desc,
d.description desc
目前代码是:
driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(2));