<?
$GLOBALS['db']->query("truncate table ecmprices");
$w=$GLOBALS['db']->query("select pricebook.* from pricebook inner join crmentity on crmentity.crmid=pricebook.pricebookid where crmentity.deleted='0'");
while($r=$GLOBALS['db']->fetchByAssoc($w)) {
	if($r['currency']==1)$er="bea4e045-359e-1d69-20af-48f2f98b0ca1";
	if($r['currency']==2)$er="def7187b-9f88-4e6f-a513-48f2f98d01ba";
	if($r['currency']==3)$er="-99";
	if($GLOBALS['db']->query("insert into ecmprices values('".$r['pricebookid']."','".$r['bookname']."','".date("Y-m-d H:i:s")."','".date("Y-m-d H:i:s")."','1','1','1','0','".$r['active']."','".$r['description']."','','".$er."','','','','','')"))print "ok";
	else print "no";
	print "<br>";
}
?>
