Evaluate the effect: lazygc520 is used to edit the image at the end of this post from 2013-06-2817: 35: 24 as follows: can the effect be achieved? for example, when the total number is 240, the first cell in purple is 120, and the second cell is 240-120120. The relationship in the figure is as follows: one stockno corresponds to multiple rows, and the figure shows two rows. If a page corresponds to multiple stockno instances, evaluate the value of co corresponding to $ arrs.
This post was last edited by lazygc520 at 17:35:24
The image is as follows:
For example, when the total number is 240, the first cell in purple is 120, and the second cell is 240-120 = 120.
The relationship in the figure is as follows:
One stockno corresponds to multiple rows, and the figure shows two rows. If a page corresponds to multiple stockno instances, the total number of accounts corresponding to $ arrs removes the count value assigned to the first stockno, the remaining values are assigned to the values in the purple box corresponding to stockno.
The code is as follows:
$ SQL = "select DISTINCT B. packageno,. stock_no from 'stock _ detail 'as a, 'kw _ manage' as B where. stock_no = '". $ stockno [$ j-1]. "'and. cust_no = replace (B. cust_no ,'','')";
// Echo $ SQL .'
';
$ Result = mysql_query ($ SQL );
$ Res = array ();
While ($ row = mysql_fetch_array ($ result, MYSQL_ASSOC ))
{
$ Sql2 = "select lotno, count (lotno) from 'VP _ barcode_2d_y 'where packageno = '". $ row ['packageno']. "'group by lotno, packageno order by lotno asc ";
// Echo $ sql2 .'
';
$ Result2 = mysql_query ($ sql2 );
$ Var = array ();
While ($ row2 = mysql_fetch_array ($ result2, MYSQL_NUM ))
{
If (isset ($ res [$ row2 [0])
$ Res [$ row2 [0] ['count'] + = $ row2 [1];
Else
$ Res [$ row2 [0] = array ('lotno' => $ row2 [0], 'count' => $ row2 [1]);
}
}
Ksort ($ res );
$ Arrs = array ();
Foreach ($ res as $ v2)
{
$ Arrs [] = $ v2;
}
Print_r ($ arrs); // Array ([0] => Array ([lotno] => 3207 [count] => 240 ))
$ Sql4 = "select arr_time, c_type, cust_no, snp, mount, mount * snp as m_total from '". $ t. "'Where stock_no = '". $ stockno [$ j-1]. "'";
$ Result4 = mysql_query ($ sql4 );
$ A = array ();
While ($ var = mysql_fetch_array ($ result4, MYSQL_NUM ))
{
$ A [] = $ var;
}
Foreach ($ a as $ k => $ v) // display the result of two rows corresponding to 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'];