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
Share on other sites

  • 1 year later...
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.