function laydatacongty($idl) { $lhang = new LoaiHang(); $cty = new CongTy(); $lhang->set_idloai($idl); return $lhang->listcongty(); }
<?php require_once '../../../libraries/oop.php'; require_once '../../../libraries/loaihang.php'; $a = new LoaiHang(); $id = $_GET['id']; $ten = $_GET['ten']; $a->set_tenloai($ten); $a->set_idloai($id); if ($a->update_loaihang()) { echo "2"; } else { echo "0"; }
<div id="main"> <div id="left"> <h1>Sản Phẩm</h1> <ul id="verticalmenu"> <?php require_once 'libraries/oop.php'; require_once 'libraries/loaihang.php'; require_once 'libraries/hanghoa.php'; $a = new LoaiHang(); $data = $a->listloaihang(); foreach ($data as $item) { echo "<li><a href='index.php?module=hanghoa&act=lhhloai&idloai={$item['idLoaiHang']}'>{$item['TenLoai']} </a>"; echo "<ul>"; $a->set_idloai($item['idLoaiHang']); $datact = $a->listcongty(); foreach ($datact as $itemct) { echo "<li><a href='index.php?module=hanghoa&act=lhhcongty&idcongty={$itemct['idCongTy']}'>{$itemct['TenCongTy']}</a></li>"; } echo "</ul>"; echo "</li>"; } ?> </ul> <div class="timkiem"> <form action="index.php?module=tim&act=tim" method="post" > <input type="text" name="txttim" size="19" /><br /> <input type="submit" name="ok" value="Tìm" style="margin-left:50px;" /> </form> </div><!-- close div tim kiem -->
<div align="center"> <table align="center" width="600px" id="tableloaihang" > <tr height="20px"> <td class=title width="100px">STT</td> <td class=title width="300px">Tên Loại</td> <td class=title width="100px">Sửa</td> <td class=title width="100px">Xóa</td> </tr> <?php require_once '../../../libraries/oop.php'; require_once '../../../libraries/loaihang.php'; $a = new LoaiHang(); $data = $a->listloaihang(); $stt = 0; foreach ($data as $item) { $stt++; echo "<tr height='20px'>"; echo "<td align=center width='100px'>{$stt}</td>"; echo "<td align=center width='300px'><input type='text' id='{$item['idLoaiHang']}' value='{$item['TenLoai']}' size='25'/></td>"; echo "<td align=center width='100px'><a href='#' onclick='sualoaihang({$item['idLoaiHang']},document.getElementById({$item['idLoaiHang']}).value)'>Sửa</a></td>"; echo "<td align=center width='100px'><a href='#' onclick='xoaloaihang({$item['idLoaiHang']})'>Xóa</a></td>"; echo "</tr>"; } ?> </table> <div id='them'></div><br /> <div id="thongbao"></div> <a href="#" onclick="themdong('loaihang',<?php echo ++$stt; ?> )" >Thêm </a>
<td class=title width="100px">Tên Loại</td> <td class=title width="130px">Tên Công Ty</td> <td class=title width="170px">Tên Hàng Hóa</td> <td class=title width="50px">Chi Tiết</td> <td class=title width="50px">Sửa</td> <td class=title width="50px">Xóa</td> </tr> <?php //ini_set( "display_errors", 0); require_once '../../../libraries/oop.php'; require_once '../../../libraries/congty.php'; require_once '../../../libraries/loaihang.php'; require_once '../../../libraries/hanghoa.php'; $hanghoa = new HangHoa(); $congty = new CongTy(); $loaihang = new LoaiHang(); $data_loaihang = $loaihang->listloaihang(); $data_congty = $congty->listcongty(); $data_hanghoa = $hanghoa->listhanghoa(); $stt = 0; foreach ($data_hanghoa as $item_hanghoa) { $stt++; echo "<tr height='20px'>"; echo "<td align=center width='100px'>{$stt}</td>"; echo "<td align=center width='100px'><select id='loaihangct" . $stt . "'> "; foreach ($data_congty as $item_congty) { if ($item_hanghoa['idCongTy'] == $item_congty['idCongTy']) { foreach ($data_loaihang as $item_loaihang) { if ($item_loaihang['idLoaiHang'] == $item_congty['idLoaiHang']) { $selected = " selected "; } else {
<?php require_once '../../../libraries/oop.php'; require_once '../../../libraries/loaihang.php'; $a = new LoaiHang(); $id = $_GET['id']; $a->set_idloai($id); $a->delete_loaihang(); ?> <div align="center"> <table align="center" width="600" id="tableloaihang" > <tr> <td class=title>STT</td> <td class=title>Tên Loại</td> <td class=title>Sửa</td> <td class=title>Xóa</td> </tr> <?php $data = $a->listloaihang(); $stt = 0; foreach ($data as $item) { $stt++; echo "<tr>"; echo "<td align=center>{$stt}</td>"; echo "<td align=center><input type='text' id='{$item['idLoaiHang']}' value='{$item['TenLoai']}' size='25'/></td>"; echo "<td align=center><a href='#' onclick='sualoaihang({$item['idLoaiHang']},document.getElementById({$item['idLoaiHang']}).value)'>Sửa</a></td>"; echo "<td align=center><a href='#' onclick='xoaloaihang({$item['idLoaiHang']})'>Xóa</a></td>"; echo "</tr>"; } ?> </table>
require_once '../../../libraries/oop.php'; require_once '../../../libraries/congty.php'; require_once '../../../libraries/loaihang.php'; require_once '../../../libraries/hanghoa.php'; require_once '../../../libraries/function.php'; $idhang = $_GET['idhang']; $a = new HangHoa(); $a->set_idhang($idhang); $data = $a->getdata(); $hinh = $data[UrlHinh]; $tenhang = $data[TenHang]; $mota = $data[MoTa]; $congty = new CongTy(); $congty->set_idcongty($data['idCongTy']); $data_congty = $congty->getdata(); $loaihang = new LoaiHang(); $loaihang->set_idloai($data_congty['idLoaiHang']); $data_loaihang = $loaihang->getdata(); $thumuc = locdau($data_loaihang[TenLoai]); $duongdan = "../../../images/" . $thumuc . "/"; if (isset($_POST['ok'])) { if ($_FILES['img']['name'] != "" || $_POST['txtfull'] != "") { if ($_FILES['img']['name'] != "") { if (!is_dir($duongdan)) { mkdir($duongdan); } move_uploaded_file($_FILES['img']['tmp_name'], $duongdan . $_FILES['img']['name']); if ($hinh != "" || $hinh != "none") { unlink($hinh); } $image = "images/" . $thumuc . "/" . $_FILES['img']['name'];
<?php require_once '../../../libraries/oop.php'; require_once '../../../libraries/loaihang.php'; require_once '../../../libraries/function.php'; $a = new LoaiHang(); $id = $_GET['id']; $a->set_idloai($id); $data = $a->getdata(); $tenloai = $data[TenLoai]; $duongdan = "../../../images/" . locdau($tenloai); if (is_dir($duongdan)) { rmdir($duongdan); } $a->delete_loaihang(); echo '5'; ?>
<?php ini_set("display_errors", 0); require_once '../../../libraries/oop.php'; require_once '../../../libraries/loaihang.php'; require_once '../../../libraries/congty.php'; $idloai = $_GET['idloai']; $loaihang = new LoaiHang(); $loaihang->set_idloai($idloai); $data_congty = $loaihang->listcongty(); echo "<option value='-1'>----Chọn----</option>"; foreach ($data_congty as $item_congty) { ?> <option value='<?php echo $item_congty['idCongTy']; ?> '><?php echo $item_congty['TenCongTy']; ?> </option> <?php } ?>
<?php require_once '../../../libraries/oop.php'; require_once '../../../libraries/loaihang.php'; $a = new LoaiHang(); $id = $_GET['id']; $ten = $_GET['ten']; $a->set_tenloai($ten); $a->set_idloai($id); $a->delete_loaihang(); echo "Welcome Link {$id} {$ten}";
<?php $tenloai = $_GET['tenloai']; require_once '../../../libraries/oop.php'; require_once '../../../libraries/loaihang.php'; require_once '../../../libraries/function.php'; $a = new LoaiHang(); $a->set_tenloai($tenloai); $duongdan = "../../../images/" . locdau($tenloai); if (!is_dir($duongdan)) { mkdir($duongdan, 0700); } if ($a->insert_loaihang()) { echo "1"; } else { echo "0"; }