<?

  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="1022 Лв";
 $cost=10;
 $payment=2;
 $fromcl="Иванов";
 $tocl="Петров Сидоров еавыф фывафвы ";
 $place=1;
 $totalplaces=1;
 $cityfrom="Киев а/в";
 $cityto="Днепропетровск";
 $tf = "КХ-3 на 11.03.2003";

# $tf = substr($tf,0,-5);

$a = fopen("lpt1", "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="A270,232,0,b,1,1,";
    if ($payment==0) 
    {
      $placecost.="N,\"Опл: $cost грн\"\n";
    }
    if ($payment==1)
    {
      $placecost.="N,\"Б/н: $cost грн\"\n";

    }

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


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


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

A0,0,0,c,4,3,N,\"$number\"\n

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

GG223,89,\"LOGO1\"\n

LO1,154,445,1\n
A20,160,0,b,1,1,N,\"Получатель:\"\n
A180,155,0,c,1,1,N,\"$tocl1\"\n
A20,187,0,c,1,1,N,\"$tocl2\"\n
LO1,225,445,1\n
\n

\n
A40,232,0,b,1,1,N,\"$tf\"\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>
