<?

  header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");             // Date in the past
  header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
  header("Cache-Control: no-cache, must-revalidate");           // HTTP/1.1
  header("Pragma: no-cache");                                   // HTTP/1.0


 $number="1502246";
 $cost=10;
 $payment=2;
 $fromcl="Иванов";
 $tocl="Петров Сидоров еавыф фывафвы ";
 $place=1;
 $totalplaces=1;
 $cityfrom="Киев а/в";
 $cityto="Днепропетровск";
 $tf = "КХ-3 на 11.03.2003";

 $tf = substr($tf,0,5).substr($tf,8,-4).substr($tf,-2,2);

$a = fopen("com1", "a");
# $num = sprintf("%012d",$number);

# $fromcl1 = addslashes(substr(stripslashes(str_replace("\r\n"," ",stripslashes(urldecode($fromcl)))),0,9));
# $fromcl2 = addslashes(substr(stripslashes(str_replace("\r\n"," ",stripslashes(urldecode($fromcl)))),9,9));
$tocl1 = addslashes(substr(stripslashes(str_replace("\r\n"," ",stripslashes(urldecode($tocl)))),0,12));
$tocl2 = addslashes(substr(stripslashes(str_replace("\r\n"," ",stripslashes(urldecode($tocl)))),12,18));

$cityfrom=rawurldecode($cityfrom);
$cityto = substr(rawurldecode($cityto),0,14);


    $placecost="A280,240,0,b,1,1,";
    if ($cost==1)
    {
        $placecost.="N,\"Служебный\"\n";

    } else
    if ($payment==0) 
    {
      $placecost.="N,\"Опл: $cost грн\"\n";
    } else
    if ($payment==1)
    {
      $placecost.="N,\"Б/н: $cost грн\"\n";

    } else

    if ($payment==2)
    {
      $placecost.="R,\"Н/о: $cost грн\"\n";
    }


for ($place=1; $place<=$totalplaces; $place++)
{


fwrite($a,"\n
N\n
\n

A0,0,0,d,2,1,N,\"$tf\"\n
A0,36,0,c,3,3,N,\"$number\"\n

A20,144,0,b,1,1,N,\"Место:\"\n
A140,145,0,4,1,1,R,\"$place/$totalplaces\"\n

GG215,121,\"LOGO1\"\n

LO1,186,445,1\n
A20,192,0,b,1,1,N,\"Получатель:\"\n
A180,187,0,c,1,1,N,\"$tocl1\"\n
A20,219,0,c,1,1,N,\"$tocl2\"\n
LO1,257,445,1\n
\n

\n

$placecost
\n

A30,280,0,c,1,1,N,\"$cityfrom\"\n
A200,280,0,c,1,1,R,\"$cityto\"\n



P1\n");
}
fclose($a);

#  
?>

<html>
<body onLoad="window.close();">

</body>
</html>
