Wireless File and Print Solutions for Windows Mobile, BlackBerry, iPhone, MIDP, Palm OS, Symbian UIQ and Nokia Series 60 Handhelds and Smartphones

   Downloads Products Support Purchase    News Partners Developers About Us
PrintBoy SDK Enterprise Edition

for Microsoft .NET Software Developers

Source Code Examples

Reports Edition Report Layout Example: This example prints a nicely formatted Customer Invoice


ReportLayout rpt = new ReportLayout();
		
if ( rpt.Create( "PRINTBOY_SDK_TRIAL" ) == 0 )
{
	String strFontName = "Times New Roman";
	rpt.Begin ( "Invoice Report" );
				
	// table is 100 pct of the page
	rpt.BeginTable( 100, 0 );

	rpt.BeginTableRow ();	
				
	// Customer and Invoice
	// left side is 60pct, right side is 40 pct

	rpt.AddTableCell ( "", 60,
	(int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  10, 0, 0, 0);
				
	rpt.AddTableCell ( "Invoice", 40, (int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  12, 1, 0, 1);
	rpt.EndTableRow ();

	rpt.BeginTableRow ();	
	rpt.AddTableCell ( "1735 County Road", 60, (int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  10, 0, 0, 0);
	rpt.AddTableCell ( "M100", 40, (int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  10, 0, 0, 0);
	rpt.EndTableRow ();

	rpt.BeginTableRow ();	
	rpt.AddTableCell ( "", 60, (int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  10, 0, 0, 0);
	rpt.AddTableCell ( "Date", 40, (int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  10, 0, 0, 0);
	rpt.EndTableRow ();

	rpt.BeginTableRow ();	
	rpt.AddTableCell ( "", 60, (int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  10, 0, 0, 0);
	rpt.AddTableCell ( "20 June 2002", 40, (int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  10, 0, 0, 0);
	rpt.EndTableRow ();

	rpt.BeginTableRow ();	
	rpt.AddTableCell ( "Bayshore", 60, (int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  10, 0, 0, 0);
	rpt.AddTableCell ( "", 40, (int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  10, 0, 0, 0);
	rpt.EndTableRow ();

	rpt.BeginTableRow ();	
	rpt.AddTableCell ( "CA", 60,
					(int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  10, 0, 0, 0);
	rpt.AddTableCell ( "", 40,
					(int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  10, 0, 0, 0);
	rpt.EndTableRow ();

	rpt.BeginTableRow ();	
	rpt.AddTableCell ( "94326", 60,
					(int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  10, 0, 0, 0);
	rpt.AddTableCell ( "", 40,
					(int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  10, 0, 0, 0);
	rpt.EndTableRow ();
				
	rpt.BeginTableRow ();	
	rpt.AddTableCell ( "US", 60,
					(int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  10, 0, 0, 0);
	rpt.AddTableCell ( "", 40,
					(int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  10, 0, 0, 0);
	rpt.EndTableRow ();

	// customer and invoice info are done
	rpt.EndTable ();

	rpt.AddTableCell ( "", 60,
					(int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  10, 0, 0, 0);

	// Bill To and Ship To
	// 50 pct each
	rpt.BeginTable ( 100, 0);

	rpt.BeginTableRow ();	
	rpt.AddTableCell ( "Bill To", 50,
					(int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  12, 1, 0, 1);
	rpt.AddTableCell ( "Ship To", 50,
					(int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  12, 1, 0, 1);
	rpt.EndTableRow ();

	rpt.BeginTableRow ();	
	rpt.AddTableCell ( "Kristy Abercrombie", 50,
					(int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  10, 0, 0, 0);
	rpt.AddTableCell ( "Kristy Abercrombie", 50,
				(int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  10, 0, 0, 0);
	rpt.EndTableRow ();
				
	rpt.BeginTableRow ();	
	rpt.AddTableCell ( "5647 Cypress Hill Rd", 50,
					(int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  10, 0, 0, 0);
	rpt.AddTableCell ( "5647 Cypress Hill Rd", 50,
					(int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  10, 0, 0, 0);
	rpt.EndTableRow ();
				
	rpt.BeginTableRow ();	
	rpt.AddTableCell ( "", 50,
					(int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  10, 0, 0, 0);
	rpt.AddTableCell ( "", 50,
					(int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  10, 0, 0, 0);
	rpt.EndTableRow ();
				
	rpt.BeginTableRow ();	
	rpt.AddTableCell ( "Bayshore", 50,
				(int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  10, 0, 0, 0);
	rpt.AddTableCell ( "Bayshore", 50,
					(int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  10, 0, 0, 0);
	rpt.EndTableRow ();
				
	rpt.BeginTableRow ();	
	rpt.AddTableCell ( "CA", 50,
					(int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  10, 0, 0, 0);
	rpt.AddTableCell ( "CA", 50,
					(int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  10, 0, 0, 0);
	rpt.EndTableRow ();
				
	rpt.BeginTableRow ();	
	rpt.AddTableCell ( "94326", 50,
					(int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  10, 0, 0, 0);
	rpt.AddTableCell ( "94326", 50,
					(int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  10, 0, 0, 0);
	rpt.EndTableRow ();

	// Bill To and Ship To are now done
	rpt.EndTable ();

	// table is 100 pct of the page
	rpt.BeginTable ( 100, 0);

	// PO/term, etc
	rpt.BeginTableRow ();	
	rpt.AddTableCell ( "PO", 20,
					(int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  10, 1, 0, 1);
	rpt.AddTableCell ( "Term", 15,
					(int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  10, 1, 0, 1);
	rpt.AddTableCell ( "Rep", 15,
					(int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  10, 1, 0, 1);
	rpt.AddTableCell ( "Ship", 20,
					(int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  10, 1, 0, 1);
	rpt.AddTableCell ( "Via", 15,
					(int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  10, 1, 0, 1);
	rpt.AddTableCell ( "FOB", 15,
					(int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  10, 1, 0, 1);
	rpt.EndTableRow ();

	rpt.BeginTableRow ();	
	rpt.AddTableCell ( "", 20,
					(int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  10, 0, 0, 1);
	rpt.AddTableCell ( "", 15,
					(int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  10, 0, 0, 1);
	rpt.AddTableCell ( "", 15,
					(int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  10, 0, 0, 1);
	rpt.AddTableCell ( "", 20,
					(int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  10, 0, 0, 1);
	rpt.AddTableCell ( "", 15,
					(int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  10, 0, 0, 1);
	rpt.AddTableCell ( "", 15,
					(int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  10, 0, 0, 1);
	rpt.EndTableRow ();

	// PO/Term are now done
	rpt.EndTable ();

	// Items table
	rpt.BeginTable ( 100, 0);

	rpt.BeginTableRow ();	
	rpt.AddTableCell ( "Qty", 10,
					(int)ReportLayout.CELL_ALIGN.ALIGN_RIGHT, strFontName,  10, 1, 0, 1);
	rpt.AddTableCell ( "Description", 50,
					(int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  10, 1, 0, 1);
	rpt.AddTableCell ( "Price", 20,
					(int)ReportLayout.CELL_ALIGN.ALIGN_RIGHT, strFontName,  10, 1, 0, 1);
	rpt.AddTableCell ( "Amount", 20,
					(int)ReportLayout.CELL_ALIGN.ALIGN_RIGHT, strFontName,  10, 1, 0, 1);
	rpt.EndTableRow ();

	rpt.BeginTableRow ();	
	rpt.AddTableCell ( "1", 10,
					(int)ReportLayout.CELL_ALIGN.ALIGN_RIGHT, strFontName,  10, 0, 0, 1);
	rpt.AddTableCell ( "Cabinets", 50,
					(int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  10, 0, 0, 1);
	rpt.AddTableCell ( "0.00", 20,
					(int)ReportLayout.CELL_ALIGN.ALIGN_RIGHT, strFontName,  10, 0, 0, 1);
	rpt.AddTableCell ( "0.00", 20,
					(int)ReportLayout.CELL_ALIGN.ALIGN_RIGHT, strFontName,  10, 0, 0, 1);
	rpt.EndTableRow ();

	rpt.BeginTableRow ();	
	rpt.AddTableCell ( "1", 10,
					(int)ReportLayout.CELL_ALIGN.ALIGN_RIGHT, strFontName,  10, 0, 0, 1);
	rpt.AddTableCell ( "standard interior door frame", 50,
					(int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  10, 0, 0, 1);
	rpt.AddTableCell ( "0.00", 20,
					(int)ReportLayout.CELL_ALIGN.ALIGN_RIGHT, strFontName,  10, 0, 0, 1);
	rpt.AddTableCell ( "0.00", 20,
					(int)ReportLayout.CELL_ALIGN.ALIGN_RIGHT, strFontName,  10, 0, 0, 1);
	rpt.EndTableRow ();

	rpt.BeginTableRow ();	
	rpt.AddTableCell ( "1", 10,
					(int)ReportLayout.CELL_ALIGN.ALIGN_RIGHT, strFontName,  10, 0, 0, 1);
	rpt.AddTableCell ( "Exterior wood door", 50,
					(int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  10, 0, 0, 1);
	rpt.AddTableCell ( "120.00", 20,
					(int)ReportLayout.CELL_ALIGN.ALIGN_RIGHT, strFontName,  10, 0, 0, 1);
	rpt.AddTableCell ( "120.00", 20,
					(int)ReportLayout.CELL_ALIGN.ALIGN_RIGHT, strFontName,  10, 0, 0, 1);
	rpt.EndTableRow ();

	// End Items table
	rpt.EndTable ();

	// Totals
	rpt.BeginTable ( 100, 0);

	rpt.BeginTableRow ();	

	rpt.AddTableCell ( "", 60,
					(int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  10, 0, 0, 1);
	rpt.AddTableCell ( "Sub Total", 20,
					(int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  10, 0, 0, 1);
	rpt.AddTableCell ( "120.00", 20,
					(int)ReportLayout.CELL_ALIGN.ALIGN_RIGHT, strFontName,  10, 0, 0, 1);
	rpt.EndTableRow ();

	rpt.BeginTableRow ();	
	rpt.AddTableCell ( "", 60,
					(int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  10, 0, 0, 0);
	rpt.AddTableCell ( "Tax", 20,
					(int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  10, 0, 0, 1);
	rpt.AddTableCell ( "9.30", 20,
					(int)ReportLayout.CELL_ALIGN.ALIGN_RIGHT, strFontName,  10, 0, 0, 1);
				rpt.EndTableRow ();

				rpt.BeginTableRow ();	
				rpt.AddTableCell ( "", 60,
					(int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  10, 1, 0, 0);
				rpt.AddTableCell ( "Total", 20,
					(int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  10, 1, 0, 1);
				rpt.AddTableCell ( "129.30", 20,
					(int)ReportLayout.CELL_ALIGN.ALIGN_RIGHT, strFontName,  10, 1, 0, 1);
				rpt.EndTableRow ();

				rpt.BeginTableRow ();	
				rpt.AddTableCell ( "", 60,
					(int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  10, 0, 0, 0);
				rpt.AddTableCell ( "Applied", 20,
					(int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  10, 0, 0, 1);
				rpt.AddTableCell ( "0.00", 20,
					(int)ReportLayout.CELL_ALIGN.ALIGN_RIGHT, strFontName,  10, 0, 0, 1);
				rpt.EndTableRow ();

				rpt.BeginTableRow ();	

				rpt.AddTableCell ( "", 60,
					(int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  10, 0, 0, 0);
				
				rpt.AddTableCell ( "Balance", 20,
					(int)ReportLayout.CELL_ALIGN.ALIGN_LEFT, strFontName,  10, 0, 0, 1);
				rpt.AddTableCell ( "129.30", 20,
					(int)ReportLayout.CELL_ALIGN.ALIGN_RIGHT, strFontName,  10, 0, 0, 1);
				rpt.EndTableRow ();

				// Totals are now done
				rpt.EndTable ();

				// end the report layout
				rpt.End ();

				// now execute the report!
				rpt.Execute ();
				
				// clean up
				rpt.Destroy ( );
			}
     

Copyright 2004 Bachmann Software & Services, LLC