<?error_reporting(E_ALL^E_NOTICE);
if($ku['worker3_time']<=$time)
{
mysql_query("UPDATE `kolhoz_user` SET `worker3_time` = '',`worker3`='' WHERE `id` = '$ku[id]' LIMIT 1");
}
else
{
if($ku['worker3']==3)
{
$namew3='Петровичь';
}


if(mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_warehouse` WHERE `id_user` = '$ku[id]' AND `fish` = '0' AND `id_plant` != '$ku[last_food]'"),0)!=0)
{
$q=mysql_query("SELECT * FROM `kolhoz_warehouse` WHERE `id_user` = '$ku[id]' AND `fish` = '0' AND `count` != '$ku[last_food]'");
$cm=0;
while($post=mysql_fetch_array($q))
{
$plant=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_plant` WHERE `id` = '$post[id_plant]'"));
$m=floor(($plant['money']/$plant['count'])*$post['count']);
$cm=$cm+$m;
}
mysql_query("UPDATE `kolhoz_user` SET `money` = '".($ku['money']+$cm)."' WHERE `id` = '$ku[id]'");
mysql_query("DELETE FROM `kolhoz_warehouse` WHERE `id_user` = '$ku[id]'");
mysql_query("UPDATE `kolhoz_user` SET `umoney` = '$cm' WHERE `id` = '$ku[id]'");
if(isset($mc) && $mc['nalog']>0)
{
$nmoney=floor(($cm/100)*$mc['nalog']);
mysql_query("UPDATE `kolhoz_user` SET `money` = '".($ku['money']+$cm-$nmoney)."' WHERE `id` = '$ku[id]'");
mysql_query("INSERT INTO `kolhoz_collective_cash` SET `id_user` = '$ku[id]', `id_collective` = '$mc[id]', `count` = '$nmoney', `type` = 'money', `time` = '$time'");
mysql_query("UPDATE `kolhoz_collective` SET `money` = '".($mc['money']+$nmoney)."' WHERE `id` = '$mc[id]'");
}
echo"<div class='feedback'><ul class='feedbackPanel'><li class='feedbackPanelINFO'><span class='feedbackPanelINFO'>
<img width=\"16\" height=\"16\" src=\"images/icons/worker".$ku['worker3'].".png\" alt=\"\"> Работник ".$namew3." продал урожай в амбаре
</span></li></ul></div>";
}


if(mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_warehouse` WHERE `id_user` = '$ku[id]' AND `fish` = '1'"),0)!=0)
{
$q=mysql_query("SELECT * FROM `kolhoz_warehouse` WHERE `id_user` = '$ku[id]' AND `fish`='1'");
$cm=0;
while($post=mysql_fetch_array($q))
{
$plant=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_fish` WHERE `id` = '$post[id_plant]'"));
$m=floor(($plant['money']/$plant['count'])*$post['count']);
$cm=$cm+$m;
}
mysql_query("UPDATE `kolhoz_user` SET `money` = '".($ku['money']+$cm)."' WHERE `id` = '$ku[id]'");
mysql_query("DELETE FROM `kolhoz_warehouse` WHERE `id_user` = '$ku[id]' AND `fish`='1'");
mysql_query("UPDATE `kolhoz_user` SET `umoney` = '$cm' WHERE `id` = '$ku[id]'");
if(isset($mc) && $mc['nalog']>0)
{
$nmoney=floor(($cm/100)*$mc['nalog']);
mysql_query("UPDATE `kolhoz_user` SET `money` = '".($ku['money']+$cm-$nmoney)."' WHERE `id` = '$ku[id]'");
mysql_query("INSERT INTO `kolhoz_collective_cash` SET `id_user` = '$ku[id]', `id_collective` = '$mc[id]', `count` = '$nmoney', `type` = 'money', `time` = '$time'");
mysql_query("UPDATE `kolhoz_collective` SET `money` = '".($mc['money']+$nmoney)."' WHERE `id` = '$mc[id]'");
}
echo"<div class='feedback'><ul class='feedbackPanel'><li class='feedbackPanelINFO'><span class='feedbackPanelINFO'>
<img width=\"16\" height=\"16\" src=\"images/icons/worker".$ku['worker3'].".png\" alt=\"\"> Работник ".$namew3." продал рыбу в амбаре
</span></li></ul></div>";
}


}
?>