kat35601 Posted January 7, 2015 Share Posted January 7, 2015 I have this report that I have written and it looks fine on the screen but the printed output is to big for the page and very ugly. How would I reformat it so it prints better. <html> <head> <title>Load Report</title> </head> <body> <h1>Load Report</h1> <?php $load=$_POST["Load_ID"]; $connect =odbc_connect("removed"); if(!$connect) { exit("Connection Failed: " . $connect); } $sql="SELECT m1_DC.dbo.SalesOrders.UOMPDROPSEQUENCE ,m1_DC.dbo.organizationlocations.cmlPhoneNumber ,m1_DC.dbo.organizationlocations.cmlName ,m1_DC.dbo.organizationlocations.UCMLSTOREHOURSTXT ,m1_DC.dbo.SalesOrders.OMPSHIPPINGMETHODID ,m1_DC.dbo.SalesOrders.UOMPTRUCKNUMBER ,m1_DC.dbo.SalesOrders.ompCustomerPO ,m1_DC.dbo.SalesOrders.UOMPTOTALBOXCOUNT ,m1_DC.dbo.SalesOrders.UOMPVOLUMETOTAL ,m1_DC.dbo.organizationlocations.CMLADDRESSLINE1 ,m1_DC.dbo.organizationlocations.CMLADDRESSLINE2 ,m1_DC.dbo.organizationlocations.CMLCITY ,m1_DC.dbo.organizationlocations.CMLSTATE ,m1_DC.dbo.organizationlocations.CMLPOSTCODE ,m1_DC.dbo.SalesOrders.OMPREQUESTEDSHIPDATE ,m1_DC.dbo.SalesOrders.ompSalesOrderID ,m1_DC.dbo.SalesOrders.ompOrderTotalBase ,convert(varchar(10),m1_DC.dbo.SalesOrders.uompbuilddate,110) as BuildDate FROM m1_DC.dbo.SalesOrders LEFT OUTER JOIN m1_DC.dbo.organizationlocations ON ompshiporganizationid = cmlorganizationid AND ompshiplocationid = cmllocationid WHERE m1_DC.dbo.SalesOrders.UOMPTRUCKNUMBER='$load' Union All SELECT m1_KF.dbo.SalesOrders.UOMPDROPSEQUENCE ,m1_KF.dbo.organizationlocations.cmlPhoneNumber ,m1_KF.dbo.organizationlocations.cmlName ,m1_KF.dbo.organizationlocations.UCMLSTOREHOURSTXT ,m1_KF.dbo.SalesOrders.OMPSHIPPINGMETHODID ,m1_KF.dbo.SalesOrders.UOMPTRUCKNUMBER ,m1_KF.dbo.SalesOrders.ompCustomerPO ,m1_KF.dbo.SalesOrders.UOMPTOTALBOXCOUNT ,m1_KF.dbo.SalesOrders.UOMPVOLUMETOTAL ,m1_KF.dbo.organizationlocations.CMLADDRESSLINE1 ,m1_KF.dbo.organizationlocations.CMLADDRESSLINE2 ,m1_KF.dbo.organizationlocations.CMLCITY ,m1_KF.dbo.organizationlocations.CMLSTATE ,m1_KF.dbo.organizationlocations.CMLPOSTCODE ,m1_KF.dbo.SalesOrders.OMPREQUESTEDSHIPDATE ,m1_KF.dbo.SalesOrders.ompSalesOrderID ,m1_KF.dbo.SalesOrders.ompOrderTotalBase ,convert(varchar(10),m1_KF.dbo.SalesOrders.uompbuilddate,110) FROM m1_KF.dbo.SalesOrders LEFT OUTER JOIN m1_KF.dbo.organizationlocations ON ompshiporganizationid = cmlorganizationid AND ompshiplocationid = cmllocationid WHERE m1_KF.dbo.SalesOrders.UOMPTRUCKNUMBER='$load' order by UOMPDROPSEQUENCE"; $result =odbc_exec($connect,$sql); if(!$result){ exit("Error in SQL"); } $data= ''; while (odbc_fetch_row($result)) { $UOMPDROPSEQUENCE=odbc_result($result,"UOMPDROPSEQUENCE"); $cmlName=odbc_result($result,"cmlName"); $cmlPhoneNumber=odbc_result($result,"cmlPhoneNumber"); $UCMLSTOREHOURSTXT=odbc_result($result,"UCMLSTOREHOURSTXT"); $ompCustomerPO=odbc_result($result,"ompCustomerPO"); $UOMPTOTALBOXCOUNT=odbc_result($result,"UOMPTOTALBOXCOUNT"); $UOMPVOLUMETOTAL=odbc_result($result,"UOMPVOLUMETOTAL"); $CMLADDRESSLINE1=odbc_result($result,"CMLADDRESSLINE1"); $CMLADDRESSLINE2=odbc_result($result,"CMLADDRESSLINE2"); $CMLCITY=odbc_result($result,"CMLCITY"); $CMLSTATE=odbc_result($result,"CMLSTATE"); $CMLPOSTCODE=odbc_result($result,"CMLPOSTCODE"); $ompSalesOrderID=odbc_result($result,"ompSalesOrderID"); $ompOrderTotalBase=odbc_result($result,"ompOrderTotalBase"); $uompbuilddate=odbc_result($result,"BuildDate"); { { if($UOMPDROPSEQUENCE % 2 == 0 ) {$style = '#FFFAFA';} else {$style = '#D3D3D3';}} } $data .= "<tr bgcolor=$style><th>$UOMPDROPSEQUENCE</th>"; $data .= "<th style='text-align:left' height='10'>$cmlName</th>"; $data .= "<td style='text-align:left' height='10'>$UCMLSTOREHOURSTXT</td>"; $data .= "<td style='text-align:center' height='10'>$ompCustomerPO</td>"; $data .= "<td style='text-align:center' height='10'>$UOMPTOTALBOXCOUNT</td>"; $data .= "<td style='text-align:center' height='10'> $UOMPVOLUMETOTAL</td>"; $data .= "<td style='text-align:center' height='10'> $CMLADDRESSLINE1</td>"; $data .= "<td style='text-align:center' height='10'> $CMLADDRESSLINE2</td>"; $data .= "<td style='text-align:center' height='10'> $CMLCITY</td>"; $data .= "<td style='text-align:center' height='10'> $CMLSTATE</td>"; $data .= "<td style='text-align:center' height='10'> $CMLPOSTCODE</td>"; $data .= "<td style='text-align:center' height='10'>$ompSalesOrderID</td>"; $data .= "<td style='text-align:center' height='10'>$ompOrderTotalBase</td>"; //$data .= "<td style='text-align:center'>$uompbuilddate</td>"; $data .= "<td style='text-align:center' height='10'>$cmlPhoneNumber</td></tr>"; } echo "<table><tr>"; echo "<th>Load $load</th><tr>"; echo "<th>Drop</th>"; echo "<th>Name</th>"; echo "<th>Note</th>"; echo "<th>PO</th>"; echo "<th>Box_count</th>"; echo "<th>Cubes</th>"; echo "<th>ADDRESSLINE</th>"; echo "<th>ADDRESS2</th>"; echo "<th>CITY</th>"; echo "<th>STATE</th>"; echo "<th>ZIP</th>"; echo "<th>Order_ID</th>"; echo "<th>Order_Total</th>"; //echo "<th>Build-Date</th>"; echo "<th> Phone </th></tr>"; echo $data; odbc_close($connect); ?> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/293735-formatting-output-from-phpmssql-for-printing-very-new-to-programming/ Share on other sites More sharing options...
cyberRobot Posted January 7, 2015 Share Posted January 7, 2015 Have you tried creating a print stylesheet? More information can be found here: http://www.smashingmagazine.com/2011/11/24/how-to-set-up-a-print-style-sheet/ Quote Link to comment https://forums.phpfreaks.com/topic/293735-formatting-output-from-phpmssql-for-printing-very-new-to-programming/#findComment-1502051 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.