<?php

global $current_user;


$db = $GLOBALS ['db'];

$inv = $db->query ( "SELECT * FROM ecminvoiceouts where parent_payer_nip!='' and deleted=0" );

while ( $i = $db->fetchByAssoc($inv) ) {
	$a = new Account();
	$a->retrieve_by_string_fields(['to_vatid'=>$i['parent_payer_nip']]);
	$db->query ( "update ecmtransactions set parent_id='".$a->id."',parent_name='".$a->name."' where record_id='" . $i['id']. "'");
//	echo '<br>"; 
}

echo 'e';

?>