Jump to content

Formatting output from php/mssql for printing. Very new to Programming


Recommended Posts

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>
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.