403Webshell
Server IP : 104.21.80.248  /  Your IP : 172.71.28.156
Web Server : Apache/2.4.25 (Win32) OpenSSL/1.0.2j PHP/5.6.30
System : Windows NT WIN-ECQAAA40806 6.2 build 9200 (Windows Server 2012 Standard Edition) i586
User : SYSTEM ( 0)
PHP Version : 5.6.30
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  E:/Inetpub/www/supply_system/supplies/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : E:/Inetpub/www/supply_system/supplies/batch_add.php
<?php
include_once __DIR__ . '/../config.php';
include_once __DIR__ . '/../functions.php';
include_once __DIR__ . '/../includes/auth_check.php';
// requireRole(['admin', 'supply_manager']);

$page_title = "เพิ่มสต็อกพัสดุ (รับเข้า)";

// --- Fetch Supplies for Dropdown ---
$supplies_list = [];
$sql = "SELECT id, supply_code, supply_name, unit FROM supplies WHERE status = 'active' ORDER BY supply_code ASC";
$result = mysqli_query($conn, $sql);
if ($result) {
    while ($row = mysqli_fetch_assoc($result)) {
        $supplies_list[] = $row;
    }
    mysqli_free_result($result);
}
mysqli_close($conn); // Close connection after fetching dropdown data

// --- Include Header ---
include_once __DIR__ . '/../includes/header.php';
?>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/select2.min.css" rel="stylesheet" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/select2-bootstrap-5-theme.min.css" />
<style>
    /* Adjust Select2 height to match Bootstrap form controls */
    .select2-container--bootstrap-5 .select2-selection--single {
        height: calc(1.5em + .75rem + 2px) !important;
        padding: .375rem .75rem !important;
    }
    .select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
        line-height: 1.5 !important;
    }
    .select2-container--bootstrap-5 .select2-selection--single .select2-selection__arrow {
        height: calc(1.5em + .75rem) !important; /* Adjust arrow height */
    }
</style>

<?php
// --- Include Sidebar ---
include_once __DIR__ . '/../includes/sidebar_supply.php';
?>

<div class="container-fluid">
    <h1 class="mt-4"><?php echo $page_title; ?></h1>

    <div class="card mb-4">
        <div class="card-header">
            <i class="bi bi-box-arrow-in-down me-1"></i>
            กรอกข้อมูลการรับพัสดุ
        </div>
        <div class="card-body">
            <form action="action_batch_save.php" method="POST">
                <div class="row g-3">
                    <div class="col-md-6">
                        <label for="supply_id" class="form-label required-field">พัสดุ (ค้นหาได้)</label>
                        <select class="form-select" id="supply_id" name="supply_id" required>
                            <option value="">-- ค้นหาหรือเลือกพัสดุ --</option>
                            <?php foreach ($supplies_list as $item): ?>
                                <option value="<?php echo $item['id']; ?>">
                                    <?php echo htmlspecialchars($item['supply_code'] . ' - ' . $item['supply_name'] . ' (' . $item['unit'] . ')'); ?>
                                </option>
                            <?php endforeach; ?>
                        </select>
                    </div>
                     <div class="col-md-3">
                        <label for="quantity" class="form-label required-field">จำนวนที่รับ</label>
                        <input type="number" class="form-control" id="quantity" name="quantity" min="1" step="1" required>
                    </div>
                     <div class="col-md-3">
                        <label for="unit_price" class="form-label required-field">ราคาต่อหน่วย (บาท)</label>
                        <input type="number" class="form-control" id="unit_price" name="unit_price" min="0" step="0.01" required>
                    </div>
                    <div class="col-md-6">
                        <label for="supplier" class="form-label">ผู้จำหน่าย</label>
                        <input type="text" class="form-control" id="supplier" name="supplier" maxlength="200">
                    </div>
                     <div class="col-md-3">
                        <label for="invoice_no" class="form-label">เลขที่ใบส่งของ/ใบกำกับ</label>
                        <input type="text" class="form-control" id="invoice_no" name="invoice_no" maxlength="50">
                    </div>
                      <div class="col-md-3">
                        <label for="expiry_date" class="form-label">วันที่หมดอายุ (ถ้ามี)</label>
                        <input type="date" class="form-control" id="expiry_date" name="expiry_date">
                    </div>

                     <div class="col-12 mt-4">
                         <button type="submit" class="btn btn-primary"><i class="bi bi-save me-1"></i> บันทึกข้อมูลรับเข้า</button>
                         <a href="index.php" class="btn btn-secondary">ยกเลิก</a>
                     </div>
                </div>
            </form>
        </div>
    </div>
</div>

<?php
// --- Include Footer ---
include_once __DIR__ . '/../includes/footer.php';
?>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/select2.min.js"></script>

<script>
    // --- Initialize Select2 ---
    $(document).ready(function() {
        $('#supply_id').select2({
            theme: "bootstrap-5", // Use Bootstrap 5 theme
            width: $( this ).data( 'width' ) ? $( this ).data( 'width' ) : $( this ).hasClass( 'w-100' ) ? '100%' : 'style', // Adjust width automatically
            placeholder: $( this ).data( 'placeholder' ),
        });
    });
</script>

Youez - 2016 - github.com/yon3zu
LinuXploit