The summation problem of an array for an item
Known quantity Group A:
Array (
0 =
Array (
' Stock_no ' = ' SU13080800340 ',
' Adress ' = ' B ',
' Arr_time ' = ' 2013-08-14 09:00:00 ',
' C_type ' = ' p32e ',
' Cust_no ' = ' 310f61va5a ',
' Mount_total ' = ' 1 ',
' Total ' = ' 16 ',
' C1_time ' = ' 2013-08-10 15:00:00 ',
' Packageno ' = ' CVT121015001 ',
),
1 =
Array (
' Stock_no ' = ' SU13080800340 ',
' Adress ' = ' B ',
' Arr_time ' = ' 2013-08-14 09:00:00 ',
' C_type ' = ' p32e ',
' Cust_no ' = ' 310f61va5b ',
' Mount_total ' = ' 2 ',
' Total ' = ' 32 ',
' C1_time ' = ' 2013-08-10 15:00:00 ',
' Packageno ' = ' CVT121015002 ',
),
2 =
Array (
' Stock_no ' = ' SU13080800340 ',
' Adress ' = ' B ',
' Arr_time ' = ' 2013-08-14 09:00:00 ',
' C_type ' = ' p32e ',
' Cust_no ' = ' 310f61va5b ',
' Mount_total ' = ' 2 ',
' Total ' = ' 32 ',
' C1_time ' = ' 2013-08-10 15:00:00 ',
' Packageno ' = ' CVT121226001 ',
),
)
How to obtain the results of the corresponding Packageno of the items in the array and the sum of the stock_no corresponding to the Mount_total and total items respectively? cust_no
Assuming that the cust_no is 310f61va5a, the corresponding Packageno is CVT121225001.
When the Cust_no is 310f61va5b, the corresponding Packageno is cvt121225002,cvt121226001.
When the Stock_no is SU13080800340, the mount_total result is 3 (1+2) and the total result is 48 (16+32).
How to achieve this effect?
Share to: