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

Re: SQR3 / MAXIMO - Cost Summary



Bob,
  The total line is printing $48.30 because you're referencing the
synonym &totcost in your Print-Total Routine. This reflects the last
item used - '20974114'... You need to accumulate each occurance of
&totcost... In fact you don't even need the 'sumcost' routine... In your
'Print' procedure accumulate the #extcost variable (only when it is
printed... (i.e. when &itemcount = 1)...

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)

 let #totcost = #totcost + #extcost     ! TD-11/09/1998

 end-if
from sparepart
 where itemnum = &itemnum
end-select
end-procedure

Now in your 'Print_Total' procedure USE the #totcost variable...
INSTEAD  of the &totcost synonym...

begin-procedure print_total
print 'Total:'                          (+4,80)  bold

print   #totcost            (,90)     ! TD-11/09/1998

end-procedure

These changes will produce a total of $148.45 (The sum of the #extcost
column of the report). This program can be streamlined further...
Hope this helps,
                        -Tony DeLia



Hallmark, Robert J wrote:
>
> Chris,
>
> The attached Salvage.SPF is the output for the current report.  This is
> exactly the output I am looking for except that the Total should reflect the
> sum of the Ext Cost
> column on the output (148.45).  Instead it prints the cost figure for the
> last line of the output (48.3).
>
> Any help in resolving this problem will be greatly appreciated.
>
> Bob
>
>  <<SALVAGE2.SPF>>
> 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
>  do print_total
> 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
>  do sumcost
>  move &cost to #cost
>  move &curbal to #curbal
>  multiply #cost times #curbal
>  move #curbal to #extcost
>  do print
> from sparepart, item, invbalances, inventory
>  where sparepart.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 sumcost
> begin-select
> sum(inventory.lastcost * invbalances.curbal) &totcost
> from inventory, invbalances
>  where inventory.itemnum = invbalances.itemnum
>  and inventory.itemnum = &itemnum
>  and invbalances.itemnum = &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
>
> begin-procedure print_total
> print 'Total:'                          (+4,80)  bold
> print   &totcost            (,90)
> end-procedure
>
>     ---------------------------------------------------------------
>
>                    Name: SALVAGE2.SPF
>     Part 1.2       Type: unspecified type (application/octet-stream)
>                Encoding: quoted-printable

--
Tony DeLia
AnswerThink Consulting Group
PeopleSoft Solutions Practice - Delphi Partners
tdelia@erols.com