while ( (( pi=ContainerSearch(serial,&ci)) != NULL) && (++loopexit < MAXLOOPS) )
vector<SERIAL> vecContainer = contsp.getData(serial); for ( ci = 0; ci < vecContainer.size(); ci++)
int getsubamount(int serial, short id){	int loopexit=0,total=0;	int ci=0;	P_ITEM pi;	while ( (( pi=ContainerSearch(serial,&ci)) != NULL) && (++loopexit < MAXLOOPS) )	{		if (pi->id()==id) total+=pi->amount;		if (pi->type==1) total+=getsubamount(pi->serial, id);	}	return total;}