klpang Posted February 25, 2006 Share Posted February 25, 2006 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.002. 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.60I 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; } Quote Link to comment Share on other sites More sharing options...
Crew-Portal Posted July 20, 2007 Share Posted July 20, 2007 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! Quote Link to comment 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.