<?php
  require_once __DIR__ . '/../../magic/auth.php';

$auth = bdr_require_privilege([1, 20], '../../logout.php');
$user = $auth['user_id'];
$father = $auth['user_id'];
$branch = $auth['branch'];
$conn = $auth['conn'];
$db = $auth['conn'];

$sanad = $_REQUEST['sanad'];
include "../../op/number_text.php";
$sql = $db->prepare('SELECT * from sanad_in where in_id = ? ');
    $sql->bindParam(1, $sanad);
    $sql->execute();
if ($sql->rowCount() > 0) {
	      $result = $sql->fetch(PDO::FETCH_ASSOC);
    }
$payy =  $result['payMethod'];
switch ($payy) {
	case "1":		$pay =  "كاش";		        break;
	case "2":		$pay =  "تحويل بنكي";		  break;
	case "3":		$pay =  "نقاط بيع";		    break;
	case "4":		$pay = "فواتير";		      break;
}
$money = $result['money_in'];
?>
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>طباعة سند</title>
  <link rel="stylesheet" href="css/print.css">
</head>
<body onload="javascript: window.print(); setTimeout(window.close, 1000);" >
  <section>
  <style>
    @media print {
        body, page {
          margin: 3.5cm 0.2cm 1.5cm 0.2cm;
              }
        .out_free{
          line-height: 0.77cm;
          }
      }    
  </style>
    <page size="Letter">
          <div class="row">
            <output class="out_free w3 t_left t_h " type="text" id="contract_id"><?php echo $result['contract_id']; ?></output>
            <output class="out_free w1 t_center t_h " type="text">قبض</output>
            <output class="out_free w2" type="text"></output>
            <output class="out_free w2 t_left t_h " type="text"  id="in_id"><?php echo $result['in_id']; ?></output>
          </div>
          <div class="row">
            <output class="out_free w2 t_left " type="text" id="date_out"><?php echo $result['date_out']; ?></output>
            <output class="out_free w4" type="text"></output>
            <output class="out_free w2 t_left " type="text"  id="sanad_date"><?php echo $result['sanad_date']; ?></output>
          </div>
          <br/>
          <div class="row">
            <output class="out_free w2 t_left" style="padding-left:20px" type="text" id="payMethod"><?php echo 	$pay; ?></output>
            <output class="out_free w4 t_right " type="text" id="money_text" ><?php echo samTXT($money) ?></output>
            <output class="out_free w2 t_left  t_h " type="text" id="money_in" ><?php echo $money; ?></output>
          </div>
          <div class="row">
            <output class="out_free w3 t_left t_h " style="padding-left:20px" type="text" id="comm"><?php echo $result['comm']; ?></output>
            <output class="out_free w4 t_center t_h " id="cust_name" type="text"><?php echo $result['cust_name']; ?></output>
            <output class="out_free w1" type="text"></output>
          </div>
          <div class="row">
            <output class="out_free w100 t_center" type="text" id="desc"><?php echo "ذلك جزء من إيجار ".$result['kind']." " .$result['numbers']." موديل " .$result['model'] ; ?></output>
          </div>
          <div class="row">
            <output class="out_free w4 t_right " type="text"></output>
            <output class="out_free w1 " type="text"></output>
            <output class="out_free w3 t_right " type="text"><?php echo $result['realName']; ?></output>
          </div>
    </page>
  </section> 
</body>
</html>
