<!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>Cheque Display</title>
    </head>


    <body>

        <style type="text/css">
       
        </style>
        
<?php
session_start();
include './connection_sql.php';
if ($_SESSION["CURRENT_USER"] == "") { 
    exit('Please Logging Again..');
} 
if ($_SESSION['company'] == "") { 
    exit('Please Logging Again..');
} 
 

        $sql = "Select * from a_paymas where tmp_no='" . $_GET['tmp_no'] . "'  and COMPANY='" . $_SESSION["company"] . "'";
        $result = $conn->query($sql);
 
        if (!$row = $result->fetch()) {
            exit();
        }


        $txt_bea = $row['Barer'];

    $sql_rspaymas = "select * from a_cheque_setup where bank_code='" . $row['CODE'] . "'";
   
    
        foreach ($conn->query($sql_rspaymas) as $row_rspaymas) {

            echo "<style type=\"text/css\">

.cl" . $row_rspaymas["id"] . " {
	font-size: " . $row_rspaymas["font_size"] . "px;
	left:" . $row_rspaymas["left_loc"] . "px;
	top:" . $row_rspaymas["top_loc"] . "px;
	font-family:" . $row_rspaymas["font_name"] . ";
	position:absolute;
} 
</style>";

            $name = "cl" . $row_rspaymas["id"]; 
//            if(($row['CODE']!='1040') or ($row['CODE']!='1003') or ($row['CODE']!='1031')){
                if ($row_rspaymas["id"] == "15") {
                    echo "<div  id=\"" . $row_rspaymas["font_name"] . "\" class=\"" . $name . "\" />" . substr($row["chqdt"], 0, 1) . "</div>";
                }
    //            
                if ($row_rspaymas["id"] == "16") {
                    echo "<div  id=\"" . $row_rspaymas["font_name"] . "\" class=\"" . $name . "\" />" . substr($row["chqdt"], 1, 1) . "</div>";
                }
//            }else{
//                
//            }
            if ($row_rspaymas["id"] == "1") {
                echo "<div  id=\"" . $row_rspaymas["font_name"] . "\"    class=\"" . $name . "\" />" . substr($row["chqdt"], 2, 1) . "</div>";
            }

            if ($row_rspaymas["id"] == "2") {
                echo "<div  id=\"" . $row_rspaymas["font_name"] . "\" class=\"" . $name . "\" />" . substr($row["chqdt"], 3, 1) . "</div>";
            }

            if ($row_rspaymas["id"] == "3") {
                echo "<div  id=\"" . $row_rspaymas["font_name"] . "\" class=\"" . $name . "\" />" . substr($row["chqdt"], 5, 1) . "</div>";
            }

            if ($row_rspaymas["id"] == "4") {
                echo "<div  id=\"" . $row_rspaymas["font_name"] . "\" class=\"" . $name . "\" />" . substr($row["chqdt"], 6, 1) . "</div>";
            }

            if ($row_rspaymas["id"] == "5") {
                echo "<div  id=\"" . $row_rspaymas["font_name"] . "\" class=\"" . $name . "\" />" . substr($row["chqdt"], 8, 1) . "</div>";
            }

            if ($row_rspaymas["id"] == "6") {
                echo "<div  id=\"" . $row_rspaymas["font_name"] . "\" class=\"" . $name . "\" />" . substr($row["chqdt"], 9, 1) . "</div>";
            }

            if ($row_rspaymas["id"] == "7") {


                if ($row["AC_Payee"] == "1") {
                    echo "<div  id=\"" . $row_rspaymas["font_name"] . "\" class=\"" . $name . "\" />A/C Payee Only</div>";
                }
            }

            if ($row_rspaymas["id"] == "9") {
                echo "<div  id=\"" . $row_rspaymas["font_name"] . "\" class=\"" . $name . "\" />" . $txt_bea . "</div>";
            }
            $f = $_GET['txt_amo'];


            if ($row_rspaymas["id"] == "10") {
                // echo "<div  id=\"" . $row_rspaymas["font_name"] . "\" class=\"" . $name . "\" />" . $f . "</div>";
                echo "<div  id=\"" . $row_rspaymas["font_name"] . "\" class=\"" . $name . "\" />" . wordwrap($f, 52, "<br>\n<br>\n") . "</div>";
            }

            if ($row_rspaymas["id"] == "12") {
                echo "<div  id=\"" . $row_rspaymas["font_name"] . "\" class=\"" . $name . "\" />" . number_format($row["AMOUNT"], 2, ".", ",") . "</div>";
            }
        }
        ?>   

    </body>
</html>