<?

  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 = "11.03.2003";
#  $uid = "11388dfe3461";


# 


$number1 = substr($number,0,3);
$number2 = substr($number,3);


# $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,18));
$tocl2 = addslashes(substr(stripslashes(str_replace("\r\n"," ",stripslashes(urldecode($tocl)))),18,18));

$cityfrom=rawurldecode($cityfrom);
$cityto = substr(rawurldecode($cityto),0,14);
 
  if ($draw_barcode = ($cityto == "ÄÍÅÏÐÎÏÅÒÐÎÂÑÊ" or $cityto == "ÎÄÅÑÑÀ")) { $uid = "a".$uid."ux"; } else { $tf = substr($tf,0,5).substr($tf,8,-4).substr($tf,-2,2); }
# 
  





    $placecost="A250,240,0,b,1,1,";
    if ($cost==1)
    {
        $placecost.="N,\"Ñëóæåáíûé\"\n";

    } else
    if ($payment==0) 
    {
      $placecost.="N,\"Îïë: $cost ".($ttcost?"[$ttcost] ":"")."ãðí\"\n";
    } else
    if ($payment==1)
    {
      $placecost.="N,\"Á/í: $cost ".($ttcost?"[$ttcost] ":"")."ãðí\"\n";

    } else

    if ($payment==2)
    {
      $placecost.="R,\"Í/î: $cost ".($ttcost?"[$ttcost] ":"")."ãðí\"\n";
    }


for ($place=1; $place<=$totalplaces; $place++)
{
$a = fopen("lpt1", "a");



if (!$draw_barcode) {

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

A0,0,0,d,2,1,N,\"$tf\"\n


A0,36,0,c,3,3,R,\"$number1\"\n
A200,36,0,c,3,3,N,\"$number2\"\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");

} else {

$newuid = $uid.$place;

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


A0,5,0,c,3,3,R,\"$number1\"\n
A200,5,0,c,3,3,N,\"$number2\"\n

A320,3,0,2,1,1,N,\"$tf\"\n


B10,110,0,1,2,7,60,B,\"$newuid\"\n

LO265,186,445,1\n

A290,171,0,b,1,1,N,\"Ïîëó÷àòåëü:\"\n


GG5,196,\"LOGO2\"\n
LO175,195,1,60\n
A180,194,0,b,1,1,N,\"$tocl1\"\n
A180,216,0,b,1,1,N,\"$tocl2\"\n
LO1,257,445,1\n
\n

A10,243,0,b,1,1,N,\"Ìåñòî:\"\n
A110,249,0,3,1,1,R,\"$place/$totalplaces\"\n


\n

$placecost
\n

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



P1\n");


}

fclose($a);
sleep(1);

}


#  
?>

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

</body>
</html>
