Sure.
Report 1:
IF object_id('sp_DBR_Report1','P') IS NOT NULL
DROP PROCEDURE [sp_DBR_Report1]
GO
CREATE PROCEDURE sp_DBR_Report1 @inLogin varchar(30)
AS
BEGIN
DECLARE @Tstatus varchar(10);
SET @TStatus = 'Unassigned';
select 'dbr.tab', 'Unassigned';
select 'dbr.tab', 'Assigned';
select 'dbr.tab', 'Closed';
select 'dbr.report', 'sp_DBR_Report2', 'Unassigned','CID=2', 'inLogin=3', 'Tstatus=4';
select 'dbr.list', 'hlist';
select 'dbr.hidecolumns',2;
select c.CName as 'CName',
c.CID as 'CID',
@inLogin,
@Tstatus
from mydbr_Data..CInfo as c
select 'dbr.embed_object', 'Unassigned';
select 'dbr.tab.next';
SET @Tstatus = 'Assigned';
select 'dbr.report', 'sp_DBR_Report2', 'Assigned','CID=2', 'inLogin=3', 'Tstatus=4';
select 'dbr.list', 'hlist';
select 'dbr.hidecolumns',2;
select c.CName as 'CName',
c.CID as 'CID',
@inLogin,
@Tstatus
from mydbr_Data..CInfo as c;
select 'dbr.embed_object', 'Assigned';
select 'dbr.tab.next';
SET @Tstatus = 'Closed';
select 'dbr.report', 'sp_DBR_Report2', 'Closed','CID=2', 'inLogin=3', 'Tstatus=4';
select 'dbr.list', 'hlist';
select 'dbr.hidecolumns',2;
select c.CName as 'CName',
c.CID as 'CID',
@inLogin,
@Tstatus
from mydbr_Data..CInfo as c;
select 'dbr.embed_object', 'Closed';
END
Report 2:
IF object_id('sp_DBR_Report2','P') IS NOT NULL
DROP PROCEDURE [sp_DBR_Report2]
GO
CREATE PROCEDURE sp_DBR_Report2 @CID varchar(25), @inLogin varchar(30), @Tstatus varchar(10)
AS
BEGIN
select 'dbr.pager', 50;
select 'dbr.editable', 8, 'sp_DBR_Report3', 'ControlNum=1', 'inLogin=9','type=select', 'select=select ''Unassigned'' union select ''Assigned'' union select ''Closed''';
select 'dbr.hidecolumns',1;
select a.ControlNum as 'ControlNumber',
a.CName as 'Customer Name',
a.TotalCharge as 'Billed',
a.Adress as 'Address',
a.City as 'City',
a.State as 'State',
a.Comment as 'Comment',
c.Tstatus as 'Status',
@inLogin
from mydbr_Data..TMaster as a
JOIN mydbr_Data..CInfo as b on
a.CID = b.CID
JOIN mydbr_Data..TTracking as c on
a.ControlNum = c.ControlNum
where a.CID = @CID and c.Tstatus = @Tstatus;
END
GO
Report 3:
IF object_id('sp_DBR_Report3','P') IS NOT NULL
DROP PROCEDURE [sp_DBR_Report3]
GO
CREATE PROCEDURE sp_DBR_Report3 @ControlNum varchar(50), @inLogin varchar(30), @inValue varchar(10)
AS
BEGIN
update mydbr_Data..TTracking
set Tstatus = @inValue
where ControlNum = @ControlNum;
INSERT INTO mydbr_Data..TTrackingComments (UserID, CommentDate, Comment, ControlNum)
VALUES (@inLogin,CURRENT_TIMESTAMP,'Status changed to ' + @inValue,@ControlNum);
END
GO