[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

SQR3 / MAXIMO - Cost Summary



This report produces a list of parts to be salvaged based on the equipment
number which is input.  The report runs fine until I add the command line
for giving me a total cost of items to be salvaged.  This command is
sum(inventory.lastcost * invbalances.curbal) &totcost which also appears in
blue in the report body below.   The syntax for this command is found on
page 113 in the SQR3 Language Tutorial guide for version 3.0 and page 129 of
the version 4.0 Users Guide.

 The error message received when I run the report is as follows:

" ODESCR
(SQR 1303) Error in SQL (perhaps missing &name after expression):
select sparepart.eqnum, sparepart.itemnum, item.description,
inventory.lastcost, invbalances.location, invbalances.binnum,
invbalances.curbal, sum(inventory.lastcost * invbalances.curbal)  from
sparepart, item, invbalances, inventory where eqnum = :1 and
sparepart.itemnum like '20______' and sparepart.itemnum = item.itemnum and
sparepart.itemnum = invbalances.itemnum and sparepart.itemnum =
inventory.itemnum order by sparepart.itemnum
(SQR 1304) Check SELECT columns, expressions and 'where' clause for syntax."


Any help will be greatly appreciated

Bob



Begin-Setup
Declare-Layout Default
 Orientation=Landscape
 Paper-Size=(11,8.5)
 left-margin=.12
 right-margin=.37
 top-margin=.12
 bottom-margin=.25
End-Declare
End-Setup

Begin-Program
 input $test
 input $eqnum
 do description
 do Parts
End-program

Begin-Heading 7
 Date-Time (1,1) 'MM/DD/YY HH24:MI'
 Print 'salvage2.sqr'            (1,65)
 Print 'SALVAGE REPORT'          (3,30)    bold
 Print 'Asset:'                  (5,1)     bold
 Print &eqnum                    (5,10)    box
 Print &eqdesc                   (5,22,50)
 Print 'Itemnum'                 (7,1,7)   bold underline
 Print 'Description'             (7,13,11) bold underline
 Print 'Loc'                     (7,45,3)  bold underline
 Print 'Bin'                     (7,52,3)  bold underline
 Print 'Bal'                     (7,65,3)  bold underline
 Print 'Actual'                  (6,72)    bold
 Print 'Count'                   (7,72)    bold underline
 Print 'Unit'                    (6,80)    bold
 Print 'Cost'                    (7,80)    bold underline
 Print 'Ext'                     (6,90)    bold
 print 'Cost'                    (7,90)    bold underline
End-Heading

Begin-Procedure description
begin-select
description    &eqdesc
from equipment
 where eqnum = $eqnum
end-select
end-procedure

Begin-Procedure Parts
begin-select
sparepart.eqnum         &eqnum
sparepart.itemnum       &itemnum
item.description        &description
inventory.lastcost      &cost
invbalances.location    &location
invbalances.binnum      &binnum
invbalances.curbal      &curbal
sum(inventory.lastcost * invbalances.curbal) &totcost
 move &cost to #cost
 move &curbal to #curbal
 multiply #cost times #curbal
 move #curbal to #extcost
 do print
from sparepart, item, invbalances, inventory
 where eqnum = $eqnum
 and sparepart.itemnum like '20______'
 and sparepart.itemnum = item.itemnum
 and sparepart.itemnum = invbalances.itemnum
 and sparepart.itemnum = inventory.itemnum
 order by sparepart.itemnum
end-select
end-procedure

begin-procedure print
begin-select
count(itemnum) &itemcount
 If &itemcount = 1
 print &itemnum             (+1,1)
 print &description         (,13,29)
 print &location            (,45)
 print &binnum              (,52)
 print &curbal              (,65)
 print '______'             (,72)
 Print &cost                (,80)
 Print #extcost             (,90)
 end-if
from sparepart
 where itemnum = &itemnum
end-select
end-procedure