<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Untitled Document</title>
        <style type="text/css" >

            body {
                margin-left: 0px;
                margin-top: 0px;
                margin-right: 0px;
                margin-bottom: 0px;
            }
            .mainbarcode {
                height: 200px;
                width: 300px;
                margin: 0px;
                padding: 0px;

            }
            .price {
                width: 100px;
                float: left;

                margin-top:35px;
                margin-left:10px;

                font-size: 40px;
                font-weight:bold;
                text-align:center;
            }
            .parcodeimage {
                float: right;
                margin-right: 0px;
                margin-top: 23px;
            }

            .barcodnum {
                float: right;
                text-align: center;
                margin-right: 8px;
                margin-left: 0px;
                margin-bottom: 10px;
                font-size: 29px;
                font-weight: bold;
                margin-top: -25px;
                font-weight: bold;
            }


            .barcodnum2 {
                float: right;
                text-align: center;
                margin-right: 8px;
                margin-left: 0px;
                margin-bottom: 10px;
                font-size: 29px;
                font-weight: bold;
                margin-top: -25px;
                font-weight: bold;
            }



            .single {
                height: 90px;
                float: right;

                width: 300px;
                border-bottom-width: medium;
                border-bottom-style: dotted;
                border-bottom-color: #000;
                margin-bottom: 5px;
                margin-top: 5px;
            }
            .single2 {
                height: 105px;
                float: right;

                width: 300px;
                border-bottom-width: medium;
                border-bottom-style: dotted;
                border-bottom-color: #000;
                margin-bottom: 5px;
                margin-top: 5px;
                padding-right:10px;
            }
            .companyname {
                font-weight: bold;
                float: left;
                position: relative;
                font-size: 20px;
                left: -90px;
                font-family: Verdana,Geneva,sans-serif;

            }
            .productname{
                background-color: #FFF;
                margin: 65px -14px 0px 140px;
                font-size: 23px;
                font-weight: bold;
                width: 200px;
                height: 20px;
                text-align: left;
            }



            .barcodnum1 {
                position: relative;
                background-color: #FFF;

                font-size: 16px;
                font-weight: bold;
                width: 100%;
                margin-top:-25px;
                left:0px;
                text-align: center;
            }








            .barcodnum11 {
                position: relative;
                background-color: #FFF;
                font-size: 16px;
                font-weight: bold;
                width: 48%;
                margin-top: -3px;
                left: -14px;
                text-align: center;
                float: right;
            }
        </style>
        <style>
            @media all {
                .page-break {
                    display: none;
                    margin:0;
                    padding:0;
                }
            }
            @media print {
                .page-break {
                    display: block;
                    page-break-before: always;
                }
            }
        </style>
        <style type="text/css" media="print">
            a{
                visibility:hidden;
                display:none;
            }
        </style>
        <style type="text/css">
            body {
                margin-left: 0px;
                margin-top: 0px;
                margin-right: 0px;
                margin-bottom: 0px;
            }
        </style>
    </head>
    <script src="../views/default/assets/js/jquery.js"></script>
    <body>
        <script>
            $(document).ready(function (e) {
                window.print();
                setTimeout(window.close, 0);
            });
        </script>
        <?
        define (__TRACE_ENABLED__, false);
        define (__DEBUG_ENABLED__, false);

        require("../library/barcode/barcode.php");
        require("../library/barcode/i25object.php");
        require("../library/barcode/c39object.php");
        require("../library/barcode/c128aobject.php");
        require("../library/barcode/c128bobject.php");
        require("../library/barcode/c128cobject.php");


        $itr=$_POST["itr"];

        //echo $checkbx ;
        for($i=1;$i<=$itr;$i++)
        {
        //'parcode'.$i.''
        $Qty=$_POST['productnum'.$i.''];
        $barcode=$_POST['productbarcode'.$i.''];
        $name=$_POST['productname'.$i.''];
        //print_r($name."<br>");
        $price=$_POST['price'.$i.''];
        //print_r($price."<br>");
        }
        $name22=$_POST['name'];
        // echo $name22 ;
        /*$barcode=$_GET["parcode"];
        $name=$_GET["name"];
        $price=$_GET["price"];	*/
        $drawtext="off";
        $type     = "C128B";
        $width    = "190";
        $height   = "40";
        $xres     = "2";
        $font     = "4";
        $output   = "png";

        //$today=date("dm");
        //$barcode=$barcode.$today;
        //print($today);
        if (isset($barcode) && strlen($barcode)>0) {
        $style  = BCS_ALIGN_CENTER;
        $style |= ($output  == "png" ) ? BCS_IMAGE_PNG  : 0;
        $style |= ($output  == "jpeg") ? BCS_IMAGE_JPEG : 0;
        $style |= ($border  == "on"  ) ? BCS_BORDER 	  :10;
        $style |= ($drawtext== "on"  ) ? BCS_DRAW_TEXT  : 0;
        $style |= ($stretchtext== "on" ) ? BCS_STRETCH_TEXT  : 0;
        $style |= ($negative== "on"  ) ? BCS_REVERSE_COLOR  : 0;

        switch ($type)
        {
        case "I25":
        $obj = new I25Object(250, 120, $style, $barcode);
        break;
        case "C39":
        $obj = new C39Object(250, 120, $style, $barcode);
        break;
        case "C128A":
        $obj = new C128AObject(250, 120, $style, $barcode);
        break;
        case "C128B":
        $obj = new C128BObject(250, 120, $style, $barcode);
        break;
        case "C128C":
        $obj = new C128CObject(250, 120, $style, $barcode);
        break;
        default:
        $obj = false;
        }
        if ($obj) {
        if ($obj->DrawObject($xres)) {
        $checkbx=$_POST['speparcode'];
        $priceoption=$_POST["pricOption"];
        $priceoption1=$_POST["pricOption1"];
        $double = $_POST['double'];
        $cat = $_POST['cat'];


        if($checkbx=="1"){

        if ($double=="1"){

        //echo '<div class="mainbarcode">	 ';
        for($i=1;$i<=$itr;$i++)
        {

        for($x=0;$x<$_POST['productnum'.$i.''];$x++){
        if(($x%2==0)){

        echo '  <div class="mainbarcode">';
        }

        echo '
        <div class="single2">
        <div class="price">'.$_POST['price'.$i.''].'</div>

        <div class="companyname">'.$name22.'</div>

        <div class="barcodnum">'.$_POST['productbarcode'.$i.''].'</div>

        <div class="parcodeimage"><img style="margin-top:-40px;" src="../library/barcode/image.php?code='.$_POST['productbarcode'.$i.''].'&style='.$style.'&type='.$type.'&width='.$width."&height=".$height.'&xres='.$xres.'&font='.$font.'"></div>
        <div class="productname">';
        if ($cat=="1")
        {
        echo $_POST['catname'.$i.''].'/';
        }

        echo $_POST['productname'.$i.''].'</div>
        </div>
        ';
        if($x%2==1){

        echo '</div>';

        }

        }



        }

        }else{


        $width = 100;
        $drawtext="on";
        $height=45;
        $xxx=" ".$prog->currancy;

        for($i=1;$i<=$itr;$i++)
        {
        for($x=0;$x<$_POST['productnum'.$i.''];$x++){


        echo '<div style="width:152px; margin-top:0px;padding-top:25px;">
        <span style="width:135px;font-size:16px;margin-left:5px;font-weight: bold;float: left;text-align: center;">';
        if ($cat=="1")
        {
        echo $_POST['catname'.$i.''].'/';
        }

        echo $_POST['productname'.$i.''].'</span>
        <span style="font-size:20px;float:left;margin-left:2px;margin-bottom:10px;margin-top:20px;font-weight: bold;">'.$_POST['price'.$i.''].' </span>


        <div align="center" ><img style="" src="../library/barcode/image.php?code='.$_POST['productbarcode'.$i.''].'&style='.$style.'&type='.$type.'&width='.$width."&height=".$height.'&xres=1&font=2"/><div class="barcodnum11">'.$_POST['productbarcode'.$i.''].'</div></div>
        <span style="padding-right: 28px;font-size:15px;float:left;margin-left:10px;font-weight: bold;margin-top:-55px;">'.$xxx.' </span>';

        if($priceoption1=="1")
        {


        echo'
        <span style="font-size:11px;float:left;margin-left:10px;position:absolute;padding-top:53px;margin-left:-120px;">'.($_POST['pricen'.$i]+10).'<span/>';

        }


        echo'</div><div style="visibility:hidden">/n</div>';


        }
        }}

        }else{



        ?>
        <link href="../views/default/assets/css/print.css" rel="stylesheet">
            <div style="width:760px; padding-left:28px; padding-right:28px; padding-top:30px;  margin:auto; " align="center">
                <?php
                $drawtext = "on";

                $width = 128;
                $xres = 1;
                $height = 75;
//print_r('pricOption'.$pricOption);
                if ($priceoption != "1") {


                    for ($i = 1; $i <= $itr; $i++) {

                        for ($x = 0; $x < $_POST['productnum' . $i . '']; $x++) {

                            echo '<div style="width:152px;float:right"><span style="font-size:11px;float:right;margin-right:15px;">';
                            if ($cat == "1") {
                                echo $_POST['catname' . $i . ''] . '/';
                            }

                            echo $_POST['productname' . $i . ''] . '</span>

	 <img src="../library/barcode/image.php?code=' . $_POST['productbarcode' . $i . ''] . '&style=' . $style . '&type=' . $type . '&width=' . $width . "&height=" . $height . '&xres=' . $xres . '&font=' . $font . '">

	 <div style="float:right; margin-right:11px;margin-left:12px;padding:0px">

</div></div>';
                            if ($checkbx == "1") {
                                echo'<span style="visibility:hidden">f</span><div class="page-break"></div>';
                            }
                        }
                    }
                } else {


                    for ($i = 1; $i <= $itr; $i++) {
                        for ($x = 0; $x < $_POST['productnum' . $i . '']; $x++) {
                            echo '<div style="width:152px;float:right">
	  <span style="font-size:11px;float:left;margin-left:10px;">' . $_POST['price' . $i . ''] . '.LE
	 <span style="font-size:11px;float:right;margin-right:15px;">';
                            if ($cat == "1") {
                                echo $_POST['catname' . $i . ''] . '/';
                            }

                            echo $_POST['productname' . $i . ''] . '</span>

	 <img src="../library/barcode/image.php?code=' . $_POST['productbarcode' . $i . ''] . '&style=' . $style . '&type=' . $type . '&width=' . $width . "&height=" . $height . '&xres=' . $xres . '&font=' . $font . '"> ';
                            if ($priceoption1 == "1") {
                                echo '
	  <span style="font-size:11px;float:left;margin-left:10px;position:absolute;padding-top:53px;margin-left:-120px;">' . ($_POST['pricen' . $i] + 10) . '';
                            }
                            echo '
	 <div style="float:right; margin-right:11px;margin-left:12px;padding:0px">
	 </span>

</div></div>';
                        }
                    }
                }

// <span style="font-size:11px;float:left;margin-left:10px;">'.$_GET['price'].' L.E</span>



                }
                }
                }
                }
                ?>
                <a href="productController.php?do=showbarcode">
                    <input name="" value="رجوع"  type="button"  class="noprint"/>
                </a>
                </body>
                </html>
