Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can I do this?
Message
De
30/09/2015 03:48:57
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire de rapports & Rapports
Titre:
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01625190
Message ID:
01625230
Vues:
51
>>>I need to print 1 page per record on the dbf followed by a second page printed a number of times
>>>
>>>So for example record 1 has 5 recipients so I need to print 1 header and 5 recipients pages
>>>
>>>So for example record 2 has 10 recipients so I need to print 1 header and 10 recipients pages
>>>
>>>Is this possible with VFP report system? If not what should I do
>>
>>Create a cursor to hold your records. The cursor should have two group fields -- the header and then the recipients. Add your other report fields. Then setup your cursor to have two groups - each starting on a new page. Then layout each group with the fields that you want printed.
>
>
>Thanks but I can't see how to do it do you have any examples?
*cursor
CREATE CURSOR C_parent (cHeader c1(10),cRecipient c1(10),iAmount I)

INSERT INTO C_parent VALUES('H1','reci01',005)
INSERT INTO C_parent VALUES('H1','reci05',008)
INSERT INTO C_parent VALUES('H1','reci11',011)
INSERT INTO C_parent VALUES('H2','reci12',014)
INSERT INTO C_parent VALUES('H2','reci06',017)
INSERT INTO C_parent VALUES('H2','reci02',020)
INSERT INTO C_parent VALUES('H3','reci03',023)
INSERT INTO C_parent VALUES('H1','reci05',026)
INSERT INTO C_parent VALUES('H1','reci11',029)
INSERT INTO C_parent VALUES('H2','reci12',032)
INSERT INTO C_parent VALUES('H2','reci06',035)
INSERT INTO C_parent VALUES('H4','reci04',038)
INSERT INTO C_parent VALUES('H3','reci07',041)
INSERT INTO C_parent VALUES('H4','reci08',044)
INSERT INTO C_parent VALUES('H3','reci09',047)
INSERT INTO C_parent VALUES('H4','reci10',050)
INSERT INTO C_parent VALUES('H3','reci13',053)
INSERT INTO C_parent VALUES('H4','reci14',056)
INSERT INTO C_parent VALUES('H1','reci15',059)
INSERT INTO C_parent VALUES('H2','reci16',062)
INSERT INTO C_parent VALUES('H3','reci07',065)
INSERT INTO C_parent VALUES('H4','reci08',068)
INSERT INTO C_parent VALUES('H3','reci09',071)
INSERT INTO C_parent VALUES('H4','reci10',074)
INSERT INTO C_parent VALUES('H3','reci13',077)
INSERT INTO C_parent VALUES('H4','reci14',080)
INSERT INTO C_parent VALUES('H1','reci15',083)
INSERT INTO C_parent VALUES('H2','reci16',086)
INSERT INTO C_parent VALUES('H3','reci17',089)
INSERT INTO C_parent VALUES('H4','reci18',092)
INSERT INTO C_parent VALUES('H1','reci19',095)
INSERT INTO C_parent VALUES('H2','reci20',098)
INSERT INTO C_parent VALUES('H3','reci21',101)
INSERT INTO C_parent VALUES('H4','reci22',104)
INSERT INTO C_parent VALUES('H1','reci23',107)

LOCATE
*mixed dataset
BROWSE NOWAIT

SELECT;
 Cur1.cHeader,;
 Cur1.cRecipient,;
 Cur1.iAmount;
 FROM C_parent AS Cur1;
 INTO CURSOR C_To_Print;
 ORDER BY cHeader,cRecipient;

*ordered dataset
BROWSE NOWAIT

*now you need a report that has a group by cHeader
*the report group header, one page high
*and detail for cRecipient and iAmount, one page high too

* REPORT FORM ....

SELECT;
 Cur1.cHeader,;
 Cur1.cRecipient,;
 SUM(Cur1.iAmount)AS iSUM;
 FROM C_parent AS Cur1;
 INTO CURSOR C_To_Print;
 ORDER BY cHeader,cRecipient;
 GROUP BY cHeader,cRecipient

*ordered, grouped and calculated dataset
BROWSE NOWAIT

*now you need a report that has a group by cHeader
*the report group header, one page high
*and detail for cRecipient and iSUM, one page high too

* REPORT FORM ....
Each header will be on one page, and each recipient will have his following own page, no matter how much recipients will come. No recipient means no header.
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord

Weeks of programming can save you hours of planning.

Off

There is no place like [::1]
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform