Jump to content

How to design layout like this


klpang

Recommended Posts

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;
}
Link to comment
https://forums.phpfreaks.com/topic/3586-how-to-design-layout-like-this/
Share on other sites

  • 1 year later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.