Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2020
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 10.20 KB | None | 0 0
  1. <?php require_once './connect.php';
  2. $connection = DB();
  3. session_start();
  4.  
  5. // query CUstomers
  6. $sqlCus = "select  c.id ,c.firstname , r.customer_id
  7. FROM customers as c left join rooms as r
  8. ON c.id = r.id
  9. WHERE r.customer_id = 0
  10. ORDER BY c.id DESC";
  11. $queryCus = mysqli_query($connection, $sqlCus);
  12.  
  13. // Query Buildings
  14. $sqlBuild = "SELECT id , name from buildings";
  15. $qrBuild = mysqli_query($connection, $sqlBuild);
  16. // Query Rooms
  17. $sqlR = "SELECT id , name from rooms WHERE customer_id = 0";
  18. $qrRooms = mysqli_query($connection, $sqlR);
  19.  
  20. // Contact types
  21. $sqlConT = "SELECT id , description from contract_types";
  22. $qrConT = mysqli_query($connection, $sqlConT);
  23.  
  24. // Contact Status
  25. // $sqlConS = "SELECT status from contracts";
  26. // $qrConS = mysqli_query($connection,$sqlConS);
  27.  
  28. // Contact No.
  29. $number = 1;
  30. $pad = str_pad($number, 3, "0", STR_PAD_LEFT);
  31. $date = date("Ymd") . $pad;
  32. // echo $date;
  33.  
  34. // $sqlConno = "SELECT contract_no from contracts";
  35. // $queryConno = mysqli_query($connection,$sqlConno);
  36.  
  37.  
  38. ?>
  39.  
  40.  
  41.  
  42. <!doctype html>
  43. <html lang="en">
  44.  
  45. <head>
  46.     <!-- Required meta tags -->
  47.     <meta charset="utf-8">
  48.     <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  49.  
  50.     <!-- Bootstrap CSS -->
  51.     <link rel="stylesheet" href="https://unpkg.com/bootstrap-material-design@4.1.1/dist/css/bootstrap-material-design.min.css" integrity="sha384-wXznGJNEXNG1NFsbm0ugrLFMQPWswR3lds2VeinahP8N0zJw9VWSopbjv2x7WCvX" crossorigin="anonymous">
  52.  
  53.     <!-- css -->
  54.     <link rel="stylesheet" href="style.css">
  55.  
  56.     <!-- awesome Font -->
  57.     <script src="https://kit.fontawesome.com/c1e251547b.js" crossorigin="anonymous"></script>
  58.  
  59.  
  60.     <title>Home</title>
  61. </head>
  62.  
  63. <body>
  64.     <!-- menu -->
  65.     <div class="container">
  66.         <div class="row">
  67.             <div class="col-md-12">
  68.                 <nav class="navbar navbar-inverse">
  69.                     <div class="container-fluid">
  70.                         <div class="navbar-header">
  71.                             <a class="navbar-brand" href="#">Mollis Condo</a>
  72.                         </div>
  73.                         <ul class="nav navbar-nav">
  74.                             <li class="active"><a href="home.php">Home</a></li>
  75.                         </ul>
  76.                         <ul class="nav navbar-nav navbar-right">
  77.                             <li><a href="index.php"><span class="glyphicon glyphicon-log-in"></span> Logout</a></li>
  78.                             <li class="name"><span> ยินดีต้อนรับ <?= $_SESSION['name'] ?> </span></li>
  79.                         </ul>
  80.                     </div>
  81.                 </nav>
  82.             </div>
  83.         </div>
  84.     </div>
  85.     <!-- end menu -->
  86.     <br>
  87.  
  88.     <!-- vertical Menu -->
  89.     <div id="first" class="container">
  90.         <div class="row">
  91.             <!-- 3 ไว้แสดง Menu -->
  92.             <div class="mt-4 col-md-3">
  93.                 <div class="row">
  94.                     <div class="col-6">
  95.                         <a href="">
  96.                             <i class="fas fa-2x fa-file-signature"></i>
  97.                             ทำสัญญา</a>
  98.                     </div>
  99.                     <div class="col-md-6">
  100.                         <a href="payment.php">
  101.                             <i class="fas fa-2x fa-clipboard"></i>
  102.                             บันทึกค่าใช้จ่าย</a><br>
  103.                     </div>
  104.  
  105.                     <div class="mt-4 col-md-6">
  106.                         <a href="water.php">
  107.                             <i class="fas fa-2x fa-tint"></i>
  108.                             บันทึกค่าน้ำ</a>
  109.                     </div>
  110.  
  111.                     <div class="mt-4 col-md-6">
  112.                         <a href="bill.php">
  113.                             <i class="fas fa-2x fa-file-invoice"></i>
  114.                             บิล</a>
  115.                     </div>
  116.  
  117.                     <div class="mt-4 col-md-6">
  118.                         <a href="data.php">
  119.                             <i class="fas fa-2x fa-database"></i>
  120.                             ข้อมูล</a>
  121.                     </div>
  122.  
  123.                     <div class="mt-4 col-md-6">
  124.                         <a href="report.php">
  125.                             <i class="far fa-2x fa-sticky-note"></i>
  126.                             รายงาน</a>
  127.                     </div>
  128.  
  129.                     <div class="mt-4 col-md-6">
  130.                         <a href="">
  131.                             <i class="fas fa-2x fa-users-cog"></i>
  132.                             แอดมิน</a>
  133.                     </div>
  134.  
  135.                 </div>
  136.             </div>
  137.  
  138.  
  139.             <!-- 9 ไว้แสดง Content -->
  140.             <div id="md11" class="mt-4 col-md-9">
  141.                 <h3 class="text-center">สัญญา</h3>
  142.                 <div class="container">
  143.                     <form action="contactSave.php" method="POST">
  144.                         <div class="form-group">
  145.                             <a href="custAdd.php" class="btn btn-success" title="กรณีที่ยังไม่มีข้อมูลของลูกค้า">กรอกข้อมูลลูกค้า</a><br>
  146.  
  147.                             <!-- Customer -->
  148.                             <label for="cus" class="btn btn-primary">ลูกค้า</label>
  149.                             <select class="form-control" name="cus" id="cus">
  150.                                 <?php while ($row = mysqli_fetch_assoc($queryCus)) : ?>
  151.                                     <option value="<?= $row['id'] ?>"><?= $row['firstname'] ?></option>
  152.                                 <?php endwhile; ?>
  153.                             </select> <br>
  154.  
  155.                             <!-- Building -->
  156.                             <label for="building" class="btn btn-primary">ตึก</label>
  157.                             <select class="form-control" name="building" id="building">
  158.                                 <?php while ($row = mysqli_fetch_assoc($qrBuild)) : ?>
  159.                                     <option value="<?= $row['id'] ?>"><?= $row['name'] ?></option>
  160.                                 <?php endwhile; ?>
  161.                             </select> <br>
  162.  
  163.                             <!-- ROOM -->
  164.                             <label for="room" class="btn btn-primary">ห้อง</label>
  165.                             <select class="form-control" name="room" id="room">
  166.                                 <?php while ($row = mysqli_fetch_assoc($qrRooms)) : ?>
  167.                                     <option value="<?= $row['id'] ?>"><?= $row['name'] ?></option>
  168.                                 <?php endwhile; ?>
  169.                             </select> <br>
  170.  
  171.                             <label for="con" class="btn btn-primary">เลขที่สัญญา</label>
  172.                             <input type="text" name="con" id="con" value="<?= $date ?>"> <br> <br>
  173.  
  174.                             <label for="datebegin" class="btn btn-primary">วันที่สัญญา</label>
  175.                             <input type="date" name="datebegin" id="datebegin" value="<?php echo date("Y-m-d"); ?>">
  176.                             <!-- date("Y/m/d") -->
  177.  
  178.                             <label for="dateend" class="btn btn-primary">วันที่สิ้นสุดสัญญา</label>
  179.                             <input type="date" name="dateend" id="dateend" required="required" title="d"> <br><br>
  180.  
  181.                             <label for="price" class="btn btn-primary">ราคาห้อง</label>
  182.                             <input type="number" size="100" min="0" max="1000000" step="1" name="price" id="price" required="required"> <br><br>
  183.  
  184.                             <label for="earnest" class="btn btn-primary">ค่ามัดจำ</label>
  185.                             <input type="number" min="0" max="1000000" step="1" name="earnest" id="earnest" required="required"> <br><br>
  186.  
  187.                             <label for="status" class="btn btn-primary">สถานะ</label>
  188.                             <select class="form-control" name="status" id="status">
  189.                                 <option value="1">อนุมัติ</option>
  190.                                 <option value="0">รออนุมัติ</option>
  191.                             </select>
  192.  
  193.                             <!-- contact type -->
  194.                             <label for="type" class="btn btn-primary">ประเภท</label>
  195.                             <select class="form-control" name="type" id="type">
  196.                                 <?php while ($row = mysqli_fetch_assoc($qrConT)) : ?>
  197.                                     <option value="<?= $row['id'] ?>"><?= $row['description'] ?></option>
  198.                                 <?php endwhile; ?>
  199.                             </select> <br>
  200.  
  201.                             <label for="user" class="btn btn-primary">พนักงาน</label>
  202.                             <input type="hidden" name="iduser" id="iduser" value="<?= $_SESSION['id'] ?>">
  203.                             <input type="text" name="user" id="user" placeholder="<?= $_SESSION['name'] ?>">
  204.  
  205.                             <br><br><br>
  206.  
  207.                             <button type="submit" class="btn btn-success float-right" name="insertCont" value="submit">ยืนยัน</button>
  208.  
  209.  
  210.  
  211.                         </div>
  212.                     </form>
  213.                 </div>
  214.  
  215.  
  216.  
  217.  
  218.             </div>
  219.         </div>
  220.     </div>
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.     <!-- Optional JavaScript -->
  229.     <!-- jQuery first, then Popper.js, then Bootstrap JS -->
  230.     <script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
  231.     <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
  232.     <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
  233. </body>
  234.  
  235.  
  236.  
  237. <?php
  238. mysqli_close($connection);
  239. ?>
  240.  
  241. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement