[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
Re: Portrait or Landscape from an IF statement
- Subject: Re: Portrait or Landscape from an IF statement
- From: "Benzenhafer, Dave" <DBenzenhafer@DEEPWATER.COM>
- Date: Wed, 25 Apr 2001 11:58:31 -0500
Nathan
The report is compiled to an SQT. We have a Program interface that calls the
report with the different User selection options. As the report starts to
run it pulls in the selection parameters that the report will use to select
data. After that it goes to the Main section. Below is an example of the
Setup and Header/Footer Sections. The problem was that the report would
always run in the Portrait orientation even though the Selection parameter
was yes and I couldn't seem to be able to force it to landscape.
I appreciate you taking the time to look at it.
BEGIN-SETUP
DECLARE-LAYOUT port1
PAPER-SIZE = (8.27,11)
ORIENTATION = PORTRAIT
TOP-MARGIN = .5
BOTTOM-MARGIN = .5
LEFT-MARGIN = .5
RIGHT-MARGIN = .5
CHAR-WIDTH = 4.8
END-DECLARE
DECLARE-LAYOUT land1
PAPER-SIZE = (11,8.27)
ORIENTATION = LANDSCAPE
TOP-MARGIN = 0.75
BOTTOM-MARGIN = 0.25
LEFT-MARGIN = 0.50
RIGHT-MARGIN = 0.50
CHAR-WIDTH = 4.8
END-DECLARE
DECLARE-PRINTER default-hp
POINT-SIZE = 8
PITCH = 15
FONT = 5 ! [SQR.INI] 5=Times New Roman,proportional
END-DECLARE
DECLARE-REPORT port
LAYOUT = port1
PRINTER-TYPE = hp
END-DECLARE
DECLARE-REPORT land
LAYOUT = land1
PRINTER-TYPE = hp
END-DECLARE
END-SETUP
#Include 'comprocs.sqc'
!---------------------------------------------------------------Program
Begin-Program
Do Get_Submission_ID ($submission_id)
Do Get-Report-Parameters
Do Main
End-Program
!---------------------------------------------Portrait_Heading
Begin-Heading 6 FOR-REPORTS = (port)
Alter-Printer Font=500 Point-Size=12
Do RigName
Print &rig (1,1)
Print 'Inventory Without Mfg No.' (1) Center
Alter-Printer Font=5 Point-Size=8
Page-Number (4,96) 'Page '
Last-Page () 'of '
End-Heading
!---------------------------------------------Portrait_Footing
Begin-Footing 2 FOR-REPORTS = (port)
Alter-Printer Font=5 Point-Size=8
Print 'Printed' (2,90)
Print $current-date () edit 'Month DD, YYYY'
End-Footing
!------------------------------------------Landscape_Heading
Begin-Heading 6 FOR-REPORTS = (land)
Alter-Printer Font=500 Point-Size=12
Do RigName
Print &rig (1,1)
Print 'Inventory With Mfg No.' (1) Center
Alter-Printer Font=5 Point-Size=8
Page-Number (4,134) 'Page '
Last-Page () 'of '
End-Heading
!------------------------------------------Landscape_Footing
Begin-Footing 2 FOR-REPORTS = (land)
Alter-Printer Font=5 Point-Size=8
Print 'Printed' (2,128)
Print $current-date () edit 'Month DD, YYYY'
End-Footing
!-------------------------------------------Main
Begin-Procedure Main
Begin-Select
Alter-Printer Font=5 Point-Size=8
eslq.ROW_BIN &row_bin () On-Break Level=1 Print=Never
Before=ROW_BIN_Before
eslq.PRIMARY_FLAG &primary
eslq.NEW_QTY &new_qty
eslq.REB_QTY &reb_qty
eslq.CAP_QTY &cap_qty
es.ISSUE_UOM_ID &uom_id
eslq.STK_NO &stk_no
es.DESCRIPTION &desc
Do Print_Detail
>From EIM_STOCK_LOCATION_QUANTITIES eslq,
EIM_STOCK es
Where eslq.LOC_CODE = $p_rig_id
AND eslq.SLQ_TYPE <> '10087'
AND es.STK_NO = eslq.STK_NO
End-Select
End-Procedure
!--------------------------------------------------------ROW_BIN_Before
Begin-Procedure ROW_BIN_Before
Next-Listing
Graphic (1,1,22) Box 1 10 5
Alter-Printer Font=500 Point-Size=8
Print ' Row Bin' (1,1)
Print &row_bin (1,10,17)
Next-Listing
Alter-Printer Font=5 Point-Size=8
End-Procedure ROW_BIN_Before
!------------------------------------Print_Detail
Begin-Procedure Print_Detail
If $p_mfg_rpt = 'Y'
Use-report land
Print &primary (1,13)
Print #tot_qty (1,16) Edit 99,999na
Print &reb_qty (,+2) Edit 999,9na
Do UnitOfMeasure
Print &uom (1,+1,8)
Print &stk_no (1,37,15)
Do MFG ! Not in Example
Print &mfg_ref_no (,55)
Print &co_name (,90,40)
Print 'Desc:' (2,30)
Print &desc (2,37,98) Wrap 98 10 strip=<10><13> on=<10><13>
Else
Use-report port
Alter-Printer Font=5 Point-Size=8
Graphic (1,1,8) Horz-Line 10
Print &primary (1,13)
Print #tot_qty (1,16) Edit 99,999na
Print &reb_qty (,+2) Edit 999,9na
Do UnitOfMeasure
Print &uom (1,+1,8)
Alter-Printer Font=500 Point-Size=8
Print &stk_no (1,37,15)
Alter-Printer Font=5 Point-Size=8
Print &desc (,55,50) Wrap 50 10 strip=<10><13> on=<10><13>
End-if
End-Procedure
Dave Benzenhafer
-----Original Message-----
From: Nathan Stratton Treadway [mailto:nathant@ONTKO.COM]
Sent: Wednesday, April 25, 2001 10:15 AM
To: SQR-USERS@list.iex.net
Subject: Re: Portrait or Landscape from an IF statement
On Mon, Apr 23, 2001 at 10:42:42AM -0500, Benzenhafer, Dave wrote:
> After looking at the SQR archives, I gather that SQR will not support a
> change in printing format based on an IF statement.
> I am trying to confirm this won't work before I spend three days on it.
> Example
>
> If $p_mfg_rpt = 'Y'
> Use-report land
> Else
> Use-report port
> End-if
I'm not sure what the context was for the messages you found, but I
think the code above should allow you to do what you want, with the
following notes:
a) you can't switch orientation in the middle of a report (i.e.
remember that when you use USE-REPORT, you are moving the output
to a separate report file)
b) you will need to have separate DECLARE-REPORTs for the two kinds of
report, each configuring the proper page layout
c) you will need to be careful about the filenames that the output
files will receive. Because you will have separate DECLARE-REPORTs
for "land" and "port", they will be given separate file names.
If you just choose one or the other of the reports and all the
output goes to the same place, only one file will be created --
but if the report you are using is the second one defined, it the
file will be called "reportname_01.spf" instead of "reportname.spf".
If you do know at report compile time which orientation you want to use
(i.e. you can pass the info in on the command line), then you can use
the ASK command and an #IF within the DECLARE-REPORT paragraph to avoid
issues b) and c) (as Scott Hitchock mentioned).
If you need to choose the orientation at run time, you can work around
c) with something like this:
move $sqr-report to $initial_report_filespec
If $p_mfg_rpt = 'Y'
Use-report land
Else
Use-report port
End-if
new-report $initial_report_filespec
Hope that helps.
Nathan
----------------------------------------------------------------------------
Nathan Stratton Treadway | Ray Ontko & Co. | Software consulting services
nathant@ontko.com | Richmond, IN | http://www.ontko.com/