Skip to Content
0
Former Member
Dec 20, 2011 at 02:12 PM

Print draft in Crystal report

488 Views

Hi all,

I face a problem when printing draft document via crystal report.

when i try to print preview for non draft document , it runs well

But the problem is when i print preview in draft mode.

I use store procedure in sql.

my query is like this.

Create PROCEDURE [dbo].[Form_PO]

@Dockey numeric(19,6),
@ObjectId Numeric(19,6)

AS
BEGIN
IF @ObjectId = 22
BEGIN
		SELECT 
				--'ND' [DocuTipe],
				a.DocEntry,
				a.DocNum [PO NO],
				a.NumAtCard [Reff Number],
				a.DocDate [Document Date],
				a.DocDueDate [Delivery Date],
				a.TaxDate ,		
				a.CardCode [CardCode],
				a.CardName [CardName],
				
				
				
				a.Address2,
				
				
				c.PymntGroup   [Payment Terms],
				a.Comments [Remark],
				a.DocCur [Currency],
				b.ItemCode [ItemCode],
				b.Dscription,
				
				a.DocType [TypeDoc],
				e.TrnspName [Incoterms],
				b.Quantity,
				b.Price [Price],  
				
				b.LineTotal  [Amount],
				 a.DocTotal [AmountTotal], 

				d.Phone1 [Telp],
				d.Fax [Fax],
				
				
				
			FROM OPOR a
				INNER JOIN POR1 b ON a.docentry = b.docentry 
				INNER JOIN OCTG c ON a.GroupNum = c.GroupNum  
				INNER JOIN OCRD d ON a.CardCode = d.CardCode 
				LEFT JOIN OSHP e ON a.TrnspCode = e.TrnspCode 
				
			
			where a.DocEntry = @Dockey
			
			 
END


IF @ObjectId = 112
BEGIN
		SELECT 
				'DR' [DocuTipe],
				a.DocEntry,
				a.DocNum [PO NO],
				a.NumAtCard [Reff Number],
				a.DocDate [Document Date],
				a.DocDueDate [Delivery Date],
				a.TaxDate ,		
				a.CardCode[CardCode],
				a.CardName[CardName],
				
				a.Address2,
				
				
				c.PymntGroup   [Payment Terms],
				a.Comments [Remark],
				a.DocCur [Currency],
				b.ItemCode [ItemCode],
				b.Dscription,
				
				a.DocType [TypeDoc],
				e.TrnspName [Incoterms],
				b.Quantity,
				b.Price [Price],  
				
				b.LineTotal  [Amount],
				 a.DocTotal [AmountTotal], 
				
				d.Phone1 [Telp],
				d.Fax [Fax],
				
				
				
				
			FROM ODRF a
				INNER JOIN DRF1 b ON a.docentry = b.docentry 
				INNER JOIN OCTG c ON a.GroupNum = c.GroupNum 
				INNER JOIN OCRD d ON a.CardCode = d.CardCode 
				LEFT JOIN OSHP e ON a.TrnspCode = e.TrnspCode 
				
			
			where a.DocEntry   = @Dockey 
			and a.ObjType = 22
			
		END
END

So when i print draft document the objectId is 112 and will select the odrf table.

The issue is when print draft there is no data, but actually there are data in the odrf.

Is there any problem with my query ?

Regards

Jia shun