To find a fill value effect
This post was last edited by lazygc520 on 2013-06-28 17:35:24
The picture is as follows:
The effect that can be achieved, such as when the total quantity is 240, the first cell of the purple is 120, and the second cell is 240-120=120.
The diagram has the following relationship:
A stockno corresponds to multiple rows, and two rows in the figure. If a page corresponds to more than one stockno, the total count of $arrs corresponds to the count value assigned to the first Stockno, and the remaining value is assigned to the value in the next stockno corresponding purple box.
The code shown is as follows:
$sql = "Select DISTINCT b.packageno,a.stock_no from ' Stock_detail ' as a, ' kw_manage ' as B where a.stock_no = '". $stockno [$j -1]. "' and a.cust_no = replace (b.cust_no, ' ', ')";
echo $sql. '
';
$result = mysql_query ($sql);
$res = Array ();
while ($row = Mysql_fetch_array ($result, MYSQL_ASSOC))
{
$sql 2 = "Select Lotno,count (Lotno) from ' vp_barcode_2d_y ' where Packageno = '". $row [' Packageno ']. "' GROUP by Lotno,package No ORDER BY lotno ASC ";
echo $sql 2. '
';
$result 2 = mysql_query ($sql 2);
$var = Array ();
while ($row 2 = mysql_fetch_array ($result 2,mysql_num))
{
if (Isset ($res [$row 2[0]))
$res [$row 2[0]][' count '] + = $row 2[1];
Else
$res [$row 2[0]] = Array (' lotno ' = = $row 2[0], ' count ' = $row 2[1]);
}
}
Ksort ($res);
$arrs = Array ();
foreach ($res as $v 2)
{
$arrs [] = $v 2;
}
Print_r ($arrs);//array ([0] = = Array ([Lotno] = 3207 [count] = 240))
$sql 4 = "Select Arr_time,c_type,cust_no,snp,mount,mount*snp as M_total from". $t. " ' Where Stock_no = '. $stockno [$j-1]. "'";
$result 4 = mysql_query ($sql 4);
$a = array ();
while ($var = mysql_fetch_array ($result 4,mysql_num))
{
$a [] = $var;
}
foreach ($a as $k + $v)//displays two rows of results for a stockno
{
Echo '
'. ($k + 1). '';
?>
echo $v [' 0 '];
?>
echo $v [' 1 '];
?>
echo $v [' 2 '];
?>
$sql = "Select type from ' Kw_info ' where cust_no = '". $v [' 2 ']. "'";
$result = mysql_query ($sql);
$row = Mysql_fetch_array ($result, MYSQL_ASSOC);
echo $row [' type '];