Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing Report With Detail Band Limit 2

Status
Not open for further replies.

alisaif

ISP
Apr 6, 2013
418
AE
Hi

This is my first thread!

Can I set the detail band with my choice. As I have a pre printed form and have more than 20 records which will take two form to print. I want to print 10 items on each form. From 11 record it should jump to 2nd page.

Thanks
 
Are the 20 records in the controlling table or cursor (the one that is selected when you issue the REPORT FORM command)? If so, then what you want to achieve is the normal behaviour. The first page will show the first so-many records (the actual number will depend on how many records fit on the page). The next page will show the next so-many records, and so on.

If you are asking how you can force the first page to contain exactly ten records, then you must design the report with that in mind. In particular, adjust the height of the detail band so make that exactly ten records will fill the page.

If that's not what you're asking, please clarify your question.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Thanks for the reply!!

I adjusted the size in report ( Detail->Detail Band Properties->Start Detail set on new page when less than:) I checked here by reducing the size but no result.

Note I want to print multiple copies (1+2 copies) (invoice, delivery Order) etc. which is pre-printed.
Is there any other solution to solve this issue?

Thanks
 
> I checked here by reducing the size
Well, reducing the size makes more records fit. You have to fit the height for exactly 10 records, so maybe you need more height, so that 10 records fill in the page and there is a page break. You don't have an option force a page break.

If you want your 10 records tightly together and then have space until the page margin, what would help is to adjust the page footer band to be as high as needed to enforce the 11th detail row to come to page2.

Bye, Olaf.
 
I adjusted the size in report ( Detail->Detail Band Properties->Start Detail set on new page when less than:) I checked here by reducing the size but no result.

No, that's not going to help. What that does is to prevent a record being printed at the bottom of the page when there is not enough room for it. It won't force a page break after a given number of records.

You've really got to adjust the height of the bands so that exactly ten records appear on the page.

First determine the height of the page. Subtract the height of the top and bottom margins, then subtract the height of the header and footer bands. Divide the result by ten. The result is the height you need for the detail band.

You might have to make some minor adjustments to the final figure to allow for the unprintable area at the edge of the page. So be prepared for a bit of trial and error before you get the final result. Bbut the steps I've described should get you very close to the desired result.

Note I want to print multiple copies (1+2 copies) (invoice, delivery Order) etc. which is pre-printed.

That's a separate issue. You can achieve that by issuing the REPORT FORM command twice. But I suggest you focus on the main problem for now, and we can come back to the question of multiple copies later.

Mike




__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Thanks Mr.Mike

Can I attach image here, I want to show you the image of delivery challan with the exact length of header and footer and the result I got from your reply!

Thanks

Saif
 
Saif,

Yes, you can attach an image, but you will first need to upload it to a website or a photo-sharing site. The easiest solution is to upload it to your own site if you have one. If not, you might be able to use Dropbox or something similar (I've never tried doing that).

Either way, once you've got the image on line, just paste the URL in the "Attachment" box at the bottom of the editing window.

Please use a small version of the image. If it is too big, it will overpower the browser window and make everything else harder to read.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Put your Report Data into its own Cursor and add a new field for Grouping

And have your Report set up with a Group that uses this new field (from example below - RptPage) and have it set to Start Each Group On A New Page.

The following code is a quickly thrown together example so feel free to correct or improve it as needed.
Perhaps something like this...
Code:
SELECT MyData.*;
   99 AS RptPage;
   FROM MyData;
   WHERE [i]<whatever report criteria you need to use>[/i];
   ORDER BY [i]<whatever line order you need>[/i];
   INTO CURSOR RptData READWRITE

nRecordsPerPage = 10
SELECT RptData
nRptRecords = RECCOUNT()

FOR Cntr = 1 To nRptRecords STEP nRecordsPerPage
   nLastRec = Cntr + 9
   REPLACE ALL RptPage WITH Cntr;
      FOR BETWEEN(RECNO , Cntr, nLastRec)
ENDFOR

SELECT RptData
REPORT FORM MyReport NOCONSOLE TO PRINT

Good Luck,
JRB-Bldr

 
A much simpler method of populating the new field (used for Grouping) would be:

Code:
nRecordsPerPage = 10
SELECT RptData
REPLACE ALL RptPage WITH INT(RECNO()/nRecordsPerPage) + 1

SELECT RptData
REPORT FORM MyReport NOCONSOLE TO PRINT

Good Luck,
JRB-Bldr
 

Hi,

I am using Cursor which is as follows:

Select Domain.Dono, ;
Domain.DoDate, ;
Domain.Sdno, ;
Domain.pcode, ;
Domain.location, ;
Domain.cashname, ;
Domain.Enteredby, ;
Domain.salesman, ;
Domain.merchand, ;
Domain.lpo, ;
Domain.discamount, ;
Domain.discrem, ;
Domain.remarks, ;
Domain.marks, ;
Domain.sprem, ;
Dosub.icode, ;
Dosub.qntymaj, ;
Dosub.qntymin, ;
Dosub.ratemaj, ;
Dosub.ratemin, ;
icode.barcode, ;
icode.full_desc, ;
icode.packing, ;
icode.unit, ;
icode.s_code, ;
icode.m_code, ;
icode.itemsize, ;
icode.totwt, ;
Customer.full_name, ;
Cast(0 As n(12,2)) As ItemValue, ;
CAST('' As c(72)) as Address, ;
CAST('' As c(52)) as city, ;
CAST('' As c(52)) as Country, ;
CAST('' As c(10)) as tel1, ;
CAST('' As c(10)) as fax, ;
CAST('' As c(72)) as web, ;
CAST('' As c(72)) as email, ;
Cast(icode.itemsize * Dosub.qntymaj As Numeric(10,3)) As Ctnsize, ;
Dosub.iselect ;
FROM ;
village!Domain ;
INNER Join village!Dosub ;
ON Domain.Dono = Dosub.Dono ;
INNER Join village!icode ;
ON Dosub.icode = icode.icode ;
INNER Join village!Customer ;
ON Domain.pcode = Customer.pcode;
WHERE Domain.Dono == mDono;
ORDER By Domain.Dono Into Cursor DoView Readwrite
INDEX on Dono TAG Dono
INDEX on icode TAG icode ADDITIVE
INDEX on Dono+icode TAG Docode ADDITIVE

and use the following in command button to call the report:

LOCAL mamount,mDono,CoName
mDono = This.Parent.txtDono.Value

SET REPORTBEHAVIOR 80

SELECT DoView
SET ORDER TO Docode
SEEK mDono IN DoView
Do FoxyPreviewer.App
_Screen.oFoxyPreviewer._SecondsText = "By Saif"

Report Form Locfile('\reports\DoPrint1.frx') TO PRINTER PROMPT

So,
Where to define your code?

 
Saif,

You still haven't told us why you can't do what I have been telling you to do: design the report so that exactly ten records fill the page.

Based on what you have told us, that should work. If there's some reason that it doesn't, we can look at alternative methods. But we need some feedback from you. Have you tried that method? What is the result?

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Thanks and Sorry Mr.Mike

I could'nt reply you, I got the result as per your instruction and it is printing exactly ten records and printing the other records on next pages.
but in the bottom of the delivery challan, we have to mention the vehicle no., loaded by, name of the sales person etc. it is printing in extremely bottom of the page and I have defined those variables in page footer.

I want to print them at least 7 lines up.

Thanks

Saif
 
OK, so you want to print some data in the page footer, but it is printing too low down on the page. Is that right?

If so, then you need to adjust the height of the page footer band. Make it so that you have enough space below the text that you want to print.

You will then need to reduce the height of the detail band (or perhaps the page header) to compensate for the increase in height of the page footer.

Does that make sense?

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Hi,

Mike, I tried a lot but could not succeed. Is it possible if I can send you the image of the delivery challan with the marks on it? So that you can easily understand that what problem I am facing in page footer.

Thanks

Saif
 
Saif,

Yes, an image would be useful. But it would be better if you could attach it to a post in this forum. If that's difficult, have you got a public Dropbox folder, or something similar, that you could upload it to?

If all else fails, you can email it to me and I will attach it. Tek Tips does not allow email addresses to be posted in the forum, but you can find mine by clicking on the link in my signature, and then follow the links to the Contact page.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Hi,

Mike, I sent an email to you. Please check it. Is it self explanatory or not?

Thanks

Saif
 
Let me try:
In saif3 you measure 7cm from the bottom of the detail area to the page bottom.
In the VFP report you have about 4cm page footer. That doesn't match well, does it?

Nevertheless the "Printing Date & Time" prints quite at the bottom. I assume you have anchored that to the page bottom. You may not be able to print lower, because the printer needs a margin to feed the paper, that's a hardware limitation you can't overcome.

In most cases you can see a printable area in the report properties page layout tab. if you switch the option in the upper right print area box between printable page and whole page, you can see, what the driver says you can print on and what not. You may try to change that going from there into printer driver page setup via the button "PAge Setup". What you can set there depends on the printer driver.

In the end you might not be able to print where you want to right at the bottom page margin.

Bye, Olaf.
 
In saif3 you measure 7cm from the bottom of the detail area to the page bottom.
In the VFP report you have about 4cm page footer. That doesn't match well, does it?


Yes

Nevertheless the "Printing Date & Time" prints quite at the bottom. I assume you have anchored that to the page bottom. You may not be able to print lower, because the printer needs a margin to feed the paper, that's a hardware limitation you can't overcome.

Printing Date and time is not an issue, we can ignore it.

In most cases you can see a printable area in the report properties page layout tab. if you switch the option in the upper right print area box between printable page and whole page, you can see, what the driver says you can print on and what not. You may try to change that going from there into printer driver page setup via the button "PAge Setup". What you can set there depends on the printer driver.

If I am not wrong to select printable page and whole page is for the width of the report. But here width is not a problem only Total Quantity (qntymaj) sum of quantity in detail, Total weight (totwt) and total Size in coming in proper place as I marked in saif2.jpg and also want to print driver name and loaded by on to its place.

In the end you might not be able to print where you want to right at the bottom page margin.
Exactly!
 
If I am not wrong to select printable page and whole page is for the width of the report. But here width is not a problem only Total Quantity (qntymaj) sum of quantity in detail, Total weight (totwt) and total Size in coming in proper place as I marked in saif2.jpg and also want to print driver name and loaded by on to its place.

Sorry I want to say is not coming in proper place.

Thanks

Saif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top