Jump to content


Photo

How to design layout like this


  • Please log in to reply
1 reply to this topic

#1 klpang

klpang
  • Members
  • PipPip
  • Member
  • 24 posts

Posted 25 February 2006 - 03:44 PM

how do i design a layout as below : -

Item Description Serial Number Qty Unit Price Amount(RM)
1. ABC 3956, 3957 2 8.00 16.00
2. ABD 4235, 4236, 4237, 18 16.00 288.00
4238, 4239, 4240,
4241, 4242, 4243,
4244, 4245, 4246,
4247, 4248, 4249,
4251, 4253, 4254
total 254.00
commission 10% 25.40
Grand Total 229.60


I have already done a part of the php script just lack how to fit unit price and amount in the coding.
Below is the script that i have done, please help me to modify the script to design the layout as above. please advise.Thanks a lot.

$count = 1;

$result3 = mysql_query("SELECT package, serialNo FROM orderdetail WHERE resellerID = '$resellerID' AND orderNo='$orderNo' ORDER BY package, serialNo");
$data = array();

// build array of serial numbers for each package
while (list($p, $s) = mysql_fetch_row($result3))
{
$data[$p][]= $s;
}

echo "<TABLE WIDTH='100%' BORDER ='1'>";
echo "<TR>";
echo "<TD WIDTH='10%' ALIGN='center'><FONT CLASS = 'View'><B>Item</B></FONT></TD>
<TD WIDTH='30%' ALIGN='center'><FONT CLASS = 'View'><B>Description</B></FONT></TD>
<TD WIDTH='10%' ALIGN='center'><FONT CLASS = 'View'><B>Quantity</B></FONT></TD>
<TD WIDTH='50%' ALIGN='center'><FONT CLASS = 'View'><B>Serial</B></FONT></TD>";

foreach($data as $pkg => $s_array)
{
$num = count($s_array);
$gserial = listSerNums($s_array,0);

echo "<TR valign='top'>
<TD><FONT CLASS='normalText'>$count</FONT></TD>
<TD><FONT CLASS='normalText'>$pkg</FONT></TD>
<TD><FONT CLASS='normalText'>$num</FONT></TD>
<TD><FONT CLASS='normalText'>" . listSerNums($s_array, 6) . "</FONT></TD>
</TR>";
$count++;
}

echo "</TABLE>";

function listSerNums($sers, $n)
{
$i = 1;
$j = 1;
$x = count($sers);
foreach ($sers as $s)
{
if ($j++ == $x)
{
$res .= $s;
}
else
{
$res .= $s . ', ';
}
if ($n != 0)
{
if ($i++ % $n == 0) $res .= '<br />';
}
}
return $res;
}


#2 Crew-Portal

Crew-Portal
  • Members
  • PipPipPip
  • Advanced Member
  • 516 posts
  • LocationWinnipeg

Posted 20 July 2007 - 03:26 PM

Is this even a valid script?
It doent look like it?
Sorry But I have no advice but what always works is to delete your script and work all over again! This normally helps you see the errors!

logo.png

 

PHP: 5.5.6 | MySQL: 5.6.14 | Operating System: Windows 7[64BIT] | Display: 2x47in 1920x1080p Sony Bravia (Extended Display) | Browser: Mozilla Firefox 27





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users