retrieve($outId); if(isset($source->id) && $source->id != '') { $pos=$source->getPositionList(true); $focus->name = $source->name; /*echo '
';
	print_r($pos);
	echo '
';*/ foreach($pos as $pp){ $r=$GLOBALS[db]->fetchByAssoc($GLOBALS[db]->query("select quantity,price from ecminvoiceoutolditems where id='".$pp['item_id']."'")); if($pp['quantity']!=$r['quantity']){ $rprod=$GLOBALS[db]->fetchByAssoc($GLOBALS[db]->query("select name from ecmproducts where id='".$pp['id']."'")); $pname=$rprod['name']; $pp['name']=$pname; $pp['quantity']=$r['quantity']-$pp['quantity']; $ppos[]=$pp; } } /*echo '
';
	print_r($ppos);
	echo '
';*/ if(count($ppos) > 0) { $json = getJSONobj(); $focus->position_list = str_replace('"','\"',$json->encode($ppos)); } $focus->template_id = $source->template_id; $focus->template_name = $source->template_name; } ?>