View: V_EmptyPagesPerDocument
This view shows the number of sheets, pages, images, and blank (empty)
pages per root document.
|
DateOnly | The processing date. |
ClientName | The name of the client (Client in V_StepsReports). |
ClientID | The ID of the client (ID in C_Client). |
ProcessName | The name of the process. |
ProcessID | The ID of the process (ID in C_Process). |
BatchID | The ID of the root document (BatchID
in V_StepsReports). |
SheetNo | Number of sheets in the document. |
PageNo | Number of pages in the document. |
PageEmpty | Number of empty pages in the document. |
ImageNo | Number of images in the document. |
SQL Script
CREATE VIEW
[dbo].[V_EmptyPagesPerDocument]
AS SELECT DISTINCT
dbo.V_StepsReports.DateOnly, dbo.C_Client.Name AS ClientName, dbo.C_Client.ID
AS ClientID, dbo.C_Process.Name AS ProcessName, dbo.C_Process.ID AS
ProcessID, dbo.W_Document.BatchID,
(SELECT COUNT(*) AS Expr1
FROM dbo.W_Sheet
WHERE (BatchID = dbo.W_Document.BatchID))
AS SheetNo,
(SELECT COUNT(*) AS Expr1
FROM dbo.W_Page
WHERE (BatchID = dbo.W_Document.BatchID))
AS PageNo,
(SELECT COUNT(*) AS Expr1 FROM dbo.W_Page AS W_Page_1
WHERE (BatchID = dbo.W_Document.BatchID) AND (Empty = 1)) AS PageEmpty,
(SELECT COUNT(*) AS Expr1
FROM dbo.W_Image
WHERE (BatchID = dbo.W_Document.BatchID))
AS ImageNo
FROM
dbo.C_Process INNER JOIN
dbo.C_Client ON
dbo.C_Client.ID = dbo.C_Process.ClientID INNER JOIN
dbo.W_Document ON
dbo.C_Process.ID = dbo.W_Document.ProcessID INNER JOIN
dbo.V_StepsReports ON
dbo.W_Document.ID = dbo.V_StepsReports.DocumentID
Uses