× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



James,

One of these days, I'd really love to learn how to do that. It *actually
does* bother me that there's a major feature of The Cycle that I've had
little or no success using, even if there have only been a few occasions
when it would have been of practical use in my own Cycle programs. On at
least one of those occasions, I futzed around for hours without
accomplishing much, and ultimately ended up just doing a "roll-your-own."

just for you. This took me about 15 minutes to write. It's really
simple but it illustrates the power of level breaks. I used 'O' specs
so you could see the printing in the program, but it could just as
easily be a printer file and writes instead of excepts.

REMEMBER: detail time and total time calcs happen at different
points in the cycle. lots of stuff happens in between, but little of
it you have to worry about when dealing with something this simple.
The comments should be self explanatory.

finvoices ip e k disk
fcustclass if e k disk
fcustomers if e k disk
forders if e k disk
fQPRINT o f 132 printer OFLIND(*in99)

* file is sorted or keyed by customer class, customer, order and invoice.

iinvoicesR
i invCstCls l3
i invCust l2
i invOrder l1

***** begin detail time calcs ***********

* L3 - my current record is the first record of a
* new customer class control break - get description.

c if *inl3
c invCstCls chain custClass
c end

* L2 - my current record is the first record of a
* new customer number control break - get customer name.

c if *inl2
c invCust chain customers
c end

* L1 - my current record is the first record of a
* new Order number control break - get saleman code from order.

c if *inl1
c invOrder chain orders
c end

* L4 or overflow. (page break on overflow or on Customer Class)

c if *inl4 or *in99
c eval *in22 = *on
c except PageHdr
c end

* accumulate order totals

c eval l1Qty += invqty
c eval l1Amt += invamt

* write detail

c except Detail

* *in22 controls whether to print customer class code
* and description on the detail line.

c eval *in22 = *off
***** end detail time calcs ***********
***** begin TOTAL TIME CALCS **********

* l1 NEXT record to read will be new Order, print order totals.
* accum Customer totals

cl1 eval l2Qty += L1Qty
cl1 eval l2Amt += L1Amt

cl1 except L1Total

* l2 NEXT record to read will be new Customer, print Cust totals.
* accum Cust Cls totals

cl2 eval l3Qty += L2Qty
cl2 eval l3Amt += L2Amt

cl2 except L2Total

* l3 NEXT record to read will be new Cust Cls, print Class totals.
* accum Report totals

cl3 eval lrQty += L3Qty
cl3 eval lrAmt += L3Amt

cl3 except L3Total

* lr no more records will be read, print report totals.

clr except LRTotal

OQPRINT E PageHdr 1 03
O UDATE Y 20
O 30 'Invoices Register'
O + 2 'by Cust Class'
O + 2 'Customer and Order'
O 127 'PAGE'
O PAGE 3 132

O E PageHdr 2
O 9 'Cust Cls'
O +2 'Class Name'
O 29 'Customer'
O +2 'Order Number'
O +2 'Invoice'
O 102 'Quantity'
O 122 'Inv Amount'

O E Detail 1
O 22 invCstCls 9
O 22 classname +2
O invCust 29
O invord +2
O invoice +2
O invqty 102
O invamt 122

O E L1Total 11
O 13 'Order Totals:'
O invOrder +2
O +2 'Order Salesman:'
O OrdSlsman +2
O L1Qty L 102
O L1Amt L 122
O 125 '* '

O E L2Total 11
O 16 'Customer Totals:'
O invCust +2
O CustName +2
O L2Qty L 102
O L2Amt L 122
O 125 '** '

O E L3Total 11
O 19 'Cust Class Totals:'
O invCstCls +2
O CustGrpName +2
O L3Qty L 102
O L3Amt L 122
O 125 '***'

O E LRTotal 11
O 19 'Grand Totals:'
O LrQty L 102
O LrAmt L 122
O 125 '****'
****************** End of data ***************************************

results in a report that looks something like this:

note, custgrp11 and groupname1 appear on the first line of each page,
and in the cust group totals.

xx/xx/xx Invoices Register by Cust Group Customer and
Order page 1

Cust Grp Group Name Customer Order Number Invoice Quantity Inv Amount
cusgrp11 groupname1 cust1xxx 111111111111 2222222 125.00 2500.00
cust1xxx 111111111111 2222222 125.00 2500.00
cust1xxx 111111111111 2222223 125.00 2500.00

Order Totals: 11111111111 Order Slsman: slsmn1 375.00 7500.00 *

cust1xxx 111111111112 3222222 125.00 2500.00
cust1xxx 111111111112 3222222 125.00 2500.00
cust1xxx 111111111112 3222223 125.00 2500.00

Order Totals: 11111111112 Order Slsman: slsmn2 375.00 7500.00 *

Customer Totals: cust1xxx Customer Name xxxxxxxxxxxxx 750.00 15000.00 **

Cust Grp Totals: cusgrp11 group1namexxxxxxxxxxxx 750.00 15000.00 ***

Grand Totals: 750.00 15000.00 ****

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.