|******************************************************************************
|* xxxxx1234  0  VRC B50C c  
|* Print some data
|* Check ID
|* 2007-03-02
|* 
|******************************************************************************
|******************************************************************************
|* Main table xxxxx088 - Staging Table, Form Type 4
|******************************************************************************
|*	Rev.No. 2  <Date>
|* T1234_01_01, Handling staginh
|* - Initial Development
|*	Rev.No. 3  <Date>
|* Checked in for component copy
|******************************************************************************

declaration: 
#ident "@(#)T1234_01_01, <Date>"

	table	txxxxx088	|* Staging Table
	
	| Form Vars	

	extern domain tccwar		f.cwar			| Warehouse

	| Work Vars
	long			dev.type		| device type                         
	                                
    #define PFX_ITEM		"P"
	#define PFX_QUANTITY 	"Q"                            
             
	#include "ixxxxx0000" 				| General  Include

	#pragma used dll "oxxxxxdll0001"		| Staging-Handling

|****************************** before program ********************************

before.program:                             
	read.gen.par = xxxxx.dll0000.read.parameter("gen.par1")
	zoom.bool = false
	
zoom.from.all:
on.entry:            
	zoom.bool = true

|****************************** form section **********************************			
form.1:
init.form:
	get.screen.defaults()
	if zoom.bool then

		import("xxxxx088.qstk", f.astk) 
		disable.fields(READONLY,"f.cwar")

		select	count(*):sel.count
		from	xxxxx088
		where	xxxxx088._index5 = {:act.user}
		selectdo
		endselect
	endif


|****************************** choice section ********************************
choice.cont.process:
on.choice:
	check.all.input()
	execute(print.data)

choice.print.data:
on.choice:
		lbl.spooler = brp.open(spool.report,spool.device,1)
																		
		if lbl.spooler > 0 then
			read.main.table()
			brp.close(lbl.spooler)
		else		
			job.process.error = true
		endif
		

|****************************** field section *********************************

field.form.sel:
before.display:
	if zoom.bool then
		form.sel = "Print Selected Range from Staging Table"
	else
		form.sel = "Print Selection Range"
	endif	
	
|****************************** function section ******************************
functions:

function read.main.table()
{   
	domain tccwar		tmp.cwar
	
	if zoom.bool then
		
		select	xxxxx088_s.cwar:tmp.cwar,
				xxxxx088_s.loca:tmp.loca,
				xxxxx088_s.item:tmp.item,
				xxxxx088_s.clot:tmp.clot,
				xxxxx088_s.date:tmp.date,
				xxxxx088_s.seqn:tmp.seqn,
				xxxxx088_s.sele:tmp.sele,
				xxxxx088_s.cref:tmp.cref
		from	xxxxx088 xxxxx088_s
		where	xxxxx088_s._index5 = {:act.user} 
		order by xxxxx088_s._index5
		selectdo
			if f.skip.cref = tcyesno.yes and
			   not isspace(tmp.cref) then
			   	continue
			endif
			print.label(tmp.cwar,
						tmp.loca,
						tmp.item,
						tmp.clot,
						tmp.date,
						tmp.seqn)
		endselect

	else
        
    endif
}

function print.label(domain tccwar		i.cwar,
					 domain whloca		i.loca,
					 domain tcitem		i.item,
					 domain whclot		i.clot,
					 domain tcinvt.date	i.date,
					 domain tcpono		i.seqn)
{   
	sql.id=sql.parse("select	xxxxx088.* " &
			         "from		xxxxx088 " &
		             "where		xxxxx088._index1 = {:1, :2, :3, :4, :5, :6} " &
		             "order by xxxxx088._index1" )
	sql.where.bind(sql.id,1,i.cwar)
	sql.where.bind(sql.id,2,i.loca)
	sql.where.bind(sql.id,3,i.item)
	sql.where.bind(sql.id,4,i.clot)
	sql.where.bind(sql.id,5,i.date)
	sql.where.bind(sql.id,6,i.seqn)
	sql.exec(sql.id)
	while (sql.fetch(sql.id) = 0)
		brp.ready(lbl.spooler)	
	endwhile			
	sql.close(sql.id)	
}


|*** end of source ***
