public function createForm($makho, $madonhang) { $this->setDisableLoadDefaultDecorators(true); $this->setDecorators(array(array('ViewScript', array('viewScript' => 'formmoi/choncaytp.phtml')), 'Form')); $donhang = new Model_Donhang(); $donhangrow = $donhang->getWhere($madonhang); $caymoc = new Model_Caymoc(); $caytp = new Model_Caythanhpham(); $lonhuom = new Model_Lonhuom(); $caytpall = $caytp->getWhere_khohang($makho); $optp = array(); foreach ($caytpall as $key => $item) { $caymocrow = $caymoc->getWhere_ctp($item['MaCTP']); $lonhuomrow = $lonhuom->getWhere($caymocrow['MaLoNhuom']); if ($caymocrow['MaVai'] == $donhangrow['MaVai'] && $lonhuomrow['MaMau'] == $donhangrow['MaMau']) { $optp[] = $item['MaCTP']; } } if ($optp) { foreach ($optp as $item) { $row = $this->createElement('checkbox', $item . '', array('decorators' => array('ViewHelper'))); $row->setAttrib('class', 'checkbox'); $this->addElement($row); } $them = $this->createElement('submit', 'chon', array('decorators' => array('ViewHelper'), 'label' => 'Chọn')); $them->setAttrib('class', 'btn btn-primary'); $this->addElement($them); } $donhangform = $this->createElement('hidden', 'mydonhang', array('decorators' => array('ViewHelper'))); $donhangform->setValue($madonhang); $this->addElement($donhangform); $khotpform = $this->createElement('hidden', 'mykhohang', array('decorators' => array('ViewHelper'))); $khotpform->setValue($makho); $this->addElement($khotpform); }
public function createForm($id_ctp) { $ctp = new Model_Caythanhpham(); $caytp = $ctp->getWhere($id_ctp); $this->setDisableLoadDefaultDecorators(true); $this->setDecorators(array(array('ViewScript', array('viewScript' => 'formnoindex/caythanhpham_layout.phtml')), 'Form')); $tenctp = $this->createElement('text', 'TenCTP', array('decorators' => array('ViewHelper'))); $sometvai = $this->createElement('text', 'sometvai', array('decorators' => array('ViewHelper'))); $them = $this->createElement('submit', 'them', array('decorators' => array('ViewHelper'), 'label' => 'Chỉnh sửa')); $tenctp->setAttrib('class', 'formEdit')->setValue($caytp[0]['TenCTP']); $sometvai->setAttrib('class', 'formEdit')->setValue($caytp[0]['SoMetVai']); $this->addElement($tenctp)->addElement($sometvai)->addElement($them); }
<?php echo $this->headMeta(); echo $this->headLink(); Zend_Session::start(); $mysession = new Zend_Session_Namespace('Zend_Auth'); $router = Zend_Controller_Front::getInstance()->getRouter(); $num = new Zend_Validate_Digits(); $data = new My_Data(); $num = new Zend_Validate_Digits(); $caymoc = new Model_Caymoc(); $lonhuom = new Model_Lonhuom(); $caytp = new Model_Caythanhpham(); $loaivai = new Model_Loaivai(); $param = $this->param->getPost(); $formtp = new Form_Formmoi_Taotp(); if ($this->param->isPost()) { // echo "<pre>"; // print_r($param); // echo "</pre>"; if (array_key_exists('bochon', $param)) { // bo chon trong session foreach ($param as $key => $item) { if ($item == 1 && $num->isValid($key) && in_array($key, $mysession->checked)) { foreach ($mysession->checked as $skey => $sitem) { if ($sitem == $key) { unset($mysession->checked[$skey]); } } } }
<?php echo $this->headMeta(); echo $this->headLink(); $id_ctp = $this->param->getParam('mactp'); $ctp = new Model_Caythanhpham(); $caythanhpham = $ctp->getWhere($id_ctp)[0]; if ($caythanhpham['MaKho'] != null) { echo "<div class='long_message'>"; echo "Không thể xóa cây thành phẩm đã nhập vào kho hàng!"; echo "</div>"; } else { $cm = new Model_Caymoc(); $caymoc = $cm->getWhere_ctp($id_ctp); $mamoc = $caymoc['MaMoc']; $update = array("MaCTP" => null); $cm->update_data($mamoc, $update); $ctp->delete_ctp($id_ctp); $caymoc1 = $cm->getWhere($mamoc); if (array_key_exists('option', $this->param->getParams())) { echo "<script>window.location.href='" . HOST_PROJECT . "/index/xem/caythanhpham/true';</script>"; } else { echo "<script>window.location.href='" . HOST_PROJECT . "/index/main/hopdong_detail/true/mahopdong/" . $caymoc1['MaHopDong'] . "/right/lonhuom/malonhuom/" . $caymoc1['MaLoNhuom'] . "/';</script>"; } }
<?php echo $this->headMeta(); echo $this->headLink(); $ctp = new Model_Caythanhpham(); $loaivai = new Model_Loaivai(); $lonhuom = new Model_Lonhuom(); $mau = new Model_Mau(); $caymoc = new Model_Caymoc(); $caythanhphamall = $ctp->getAll(); if ($caythanhphamall) { $maincontent = array(); $title = array("Mã Cây TP", "Loại Vải", "Màu Vải", "Số Mét Vải", "Tùy Chỉnh", "Nhập Kho"); $data = new My_Data(); foreach ($caythanhphamall as $caytp) { $caymocrow = $caymoc->getWhere_ctp($caytp['MaCTP']); $loaivairow = $loaivai->getWhere($caymocrow['MaVai']); $lonhuomrow = $lonhuom->getWhere($caymocrow['MaLoNhuom']); $maurow = $mau->getWhereIdMau($lonhuomrow['MaMau']); $chinhsua = '<a href="' . HOST_PROJECT . "/index/chinhsua/caytp/true/mactp/" . $caytp['MaCTP'] . '/option/caytp/">Sửa</a> | ' . '<a href="' . HOST_PROJECT . "/index/xoa/caytp/true/mactp/" . $caytp['MaCTP'] . '/option/ctp/" onclick="return confirm(' . "'bạn có chắc muốn xóa ?'" . ')">Xóa</a>'; $button = "<a class ='thembutton' href='" . HOST_PROJECT . "/index/xem/ctp_detail/true/mactp/" . $caytp['MaCTP'] . "'/>Nhập Kho</a>"; $content = array($caytp['MaCTP'], $loaivairow['TenLoaiVai'], $maurow['TenMau'], $caytp['SoMetVai'], $chinhsua, $button); $maincontent[] = $content; } $table = $data->createTable($title, $maincontent, "700px"); echo $table; } else { echo "<div class='message'>"; echo "Chưa tồn tại Cây Thành Phẩm"; echo "</div>"; }
public function getQLKho($makho) { $option = array(); $title = array("Cây Thành Phẩm", "Số Mét Vải", "Số cây nhập kho", "Số cây xuất kho", "Số cây còn lại", "Người đặt hàng", "Đơn xuất", "Ngày Xuất", "Số lượng xuất"); $option['title'] = $title; $content = array(); $ctp = new Model_Caythanhpham(); $cm = new Model_Caymoc(); $dx = new Model_Donxuat(); $caythanhpham = $ctp->getWhere_khohang($makho); $i = 0; foreach ($caythanhpham as $item) { $subcontent = array(); $subcontent[] = $item['TenCTP']; $subcontent[] = $item['SoMetVai']; $caymoc = $cm->getWhere_ctp($item['MaCTP']); $tenkhachhang = $this->getNameKhachHang($caymoc['MaHopDong']); $slnhap = $caymoc['SoLuongCayMoc']; $madonxuat = $item['MaDonXuat']; $subcontent[] = $slnhap; if ($madonxuat == null) { $subcontent[] = "0"; $subcontent[] = $slnhap; $subcontent[] = $tenkhachhang; $subcontent[] = "Chưa xuất"; $subcontent[] = ""; $subcontent[] = ""; } else { $subcontent[] = "0"; $subcontent[] = $slnhap; $subcontent[] = $tenkhachhang; $donxuat = $dx->getWhere($madonxuat)[0]; $mydate = Zend_Locale_Format::getDate($donxuat['NgayXuat'], array("date_format" => "yyyy.MM.dd")); $date_str = $mydate['day'] . "/" . $mydate['month'] . "/" . $mydate['year']; $subcontent[] = $donxuat['TenDonXuat']; $subcontent[] = $date_str; $subcontent[] = "0"; } $content[] = $subcontent; } $option['content'] = $content; return $option; }
$form = new Form_Noindex_Donxuat(); //sua lai if ($this->param->isPost()) { $param = $this->param->getPost(); $check = new Form_Valid_Donxuat($param); // sua lai if ($check->valid($param)) { $mydate = Zend_Locale_Format::getDate($this->param->getParam("ngayxuat"), array("date_format" => "dd.MM.yyyy")); $date_str = $mydate['year'] . "-" . $mydate['month'] . "-" . $mydate['day']; $data = array("MaDonXuat" => null, "TenDonXuat" => $this->param->getParam("tendonxuat"), "NgayXuat" => $date_str, "MaHopDong" => $this->param->getParam("mahopdong")); $dx = new Model_Donxuat(); $dx->insert_donxuat($data); $donxuat = $dx->getAll(); $dx_new = $dx->getMaxIndex(); $update = array('MaDonXuat' => $dx_new); $ctp = new Model_Caythanhpham(); $ctp->update_data($this->param->getParam("mactp"), $update); $_redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector'); $_redirector->gotoUrl(HOST_PROJECT . "/index/main/hopdong_detail/true/mahopdong/" . $this->param->getParam("mahopdong") . "/right/donxuat/madonxuat/" . $dx_new); } else { $form->populate($param); echo $form; echo "<div class='message'>"; foreach ($check->messages as $item) { echo $item . "<br/>"; } echo "</div>"; } } else { echo $form; }
<?php echo $this->headMeta(); echo $this->headLink(); $madonxuat = $this->param->getParam('madonxuat'); $mahopdong = $this->param->getParam('mahopdong'); $ctp = new Model_Caythanhpham(); $caythanhpham = $ctp->getWhere_donxuat($madonxuat)[0]; $update = array("MaDonXuat" => null); $ctp->update_data($caythanhpham['MaCTP'], $update); $dx = new Model_Donxuat(); $dx->delete_donxuat($madonxuat); if (array_key_exists('option', $this->param->getParams())) { echo "<script>window.location.href='" . HOST_PROJECT . "/index/xem/donxuat/true';</script>"; } else { echo "<script>window.location.href='" . HOST_PROJECT . "/index/main/hopdong_detail/true/mahopdong/" . $mahopdong . "/right/khohang/mactp/" . $caythanhpham['MaCTP'] . "/makho/" . $caythanhpham['MaKho'] . "/';</script>"; }
$title = array("Tên Lô Nhuộm", "Ngày Nhuộm", "Màu", "Tùy Chỉnh"); $data = new My_Data(); $ln = new Model_Lonhuom(); $id_lonhuom = $this->param->getParam("malonhuom"); $lonhuom = $ln->getWhere($id_lonhuom); $mydate = Zend_Locale_Format::getDate($lonhuom[0]['NgayNhuom'], array("date_format" => "yyyy.MM.dd")); $date_str = $mydate['day'] . "/" . $mydate['month'] . "/" . $mydate['year']; $content = array($lonhuom[0]['TenLoNhuom'], $date_str, $data->getNameMau($lonhuom[0]['MaMau']), '<a href="' . HOST_PROJECT . "/index/chinhsua/lonhuom/true/mahopdong/" . $id_hopdong . "/malonhuom/" . $lonhuom[0]['MaLoNhuom'] . '/">Sửa</a> | ' . '<a href="' . HOST_PROJECT . "/index/xoa/lonhuom/true/malonhuom/" . $lonhuom[0]['MaLoNhuom'] . '/" onclick="return confirm(' . "'bạn có chắc muốn xóa ?'" . ')">Xóa</a>'); $table = $data->createRightTable($title, $content, "450px"); echo $table; } if ($right == "caythanhpham") { echo '<h1 class="title">Thông Tin Cây Thành Phẩm</h1>'; $title = array("Cây Thành Phẩm", "Số Mét Vải", "Tên Kho", "Tên Đơn Xuất", "Tùy Chỉnh"); $data = new My_Data(); $ctp = new Model_Caythanhpham(); $caytp = $ctp->getWhere($this->param->getParam("mactp"))[0]; $options = $data->getItemNameForCTP($caytp['MaCTP']); $content = array($caytp['TenCTP'], $caytp['SoMetVai'], $options['TenKho'], $options['TenDonXuat'], '<a href="' . HOST_PROJECT . "/index/chinhsua/caytp/true/mahopdong/" . $id_hopdong . "/mactp/" . $caytp['MaCTP'] . '/">Sửa</a> | ' . '<a href="' . HOST_PROJECT . "/index/xoa/caytp/true/mactp/" . $caytp['MaCTP'] . '/" onclick="return confirm(' . "'bạn có chắc muốn xóa ?'" . ')">Xóa</a>'); $table = $data->createRightTable($title, $content, "450px"); echo $table; } if ($right == "khohang") { echo '<h1 class="title">Thông Tin Kho Hàng</h1>'; $title = array("Tên Kho", "Địa Chỉ", "Số Điện Thoại", "Tùy Chỉnh"); $data = new My_Data(); $khang = new Model_Khohang(); $khohang = $khang->getWhere($this->param->getParam("makho"))[0]; $content = array($khohang['TenKho'], $khohang['Diachi'], $khohang['sdt'], '<a href="' . HOST_PROJECT . "/index/chinhsua/chonkhohang/true/mahopdong/" . $id_hopdong . "/makho/" . $khohang['MaKho'] . "/mactp/" . $this->param->getParam("mactp") . '"/">Chọn Kho Khác</a> | ' . '<a href="' . HOST_PROJECT . "/index/xoa/chonkhohang/true/mahopdong/" . $id_hopdong . "/mactp/" . $this->param->getParam("mactp") . "/makho/" . $khohang['MaKho'] . '/" onclick="return confirm(' . "'bạn có chắc muốn Hủy ?'" . ')">Hủy Nhập Kho</a>'); $table = $data->createRightTable($title, $content, "450px"); echo $table;
$socayvai = ""; $page1->drawText("Ten Don Xuat: " . $tendx, 50, 480, 'UTF-8'); $page1->drawText("Ngay Xuat: " . $ngayxuat, 50, 460, 'UTF-8'); $page1->drawText("Tong So Met Vai: " . $sometvai, 50, 440, 'UTF-8'); $page1->drawText("Tong So Cay Vai: " . $socayvai, 50, 420, 'UTF-8'); $page1->drawText("Gia Tien Moi Met Vai: ", 50, 400, 'UTF-8'); $page1->drawLine(40, 380, $page2->getWidth() - 10, 380); //Thoong tin cay vai $page1->drawText("THONG TIN CAY VAI", 50, 360, 'UTF-8'); // TH table $page1->drawText("Ma Cay Vai", 50, 340, 'UTF-8'); $page1->drawText("Mau", $page1->getWidth() / 3, 340, 'UTF-8'); $page1->drawText("So Met Vai", $page1->getWidth() / 3 * 2, 340, 'UTF-8'); // Thoong tin cay vai dua vao thong tin ma don xuat // Get information flow MaDonXuat = 1; $modelCtp = new Model_Caythanhpham(); $idmadx = 1; // Du lieu gia $thongtinctp = $modelCtp->getByMaDX($idmadx); foreach ($thongtinctp as $data) { // print_r($data); static $page = 20; $mactp = $data['MaCTP']; $Mau = ""; $sometvai = $data['SoMetVai']; $y = 340 - $page; if ($y > 150) { $page1->setStyle($style)->drawText($mactp, 50, $y, $charEncoding = 'UTF-8')->drawText($Mau, $page1->getWidth() / 3, $y, $charEncoding = 'UTF-8')->drawText($sometvai, $page1->getWidth() / 3 * 2, $y, $charEncoding = 'UTF-8'); $page = $page + 20; } else { static $paged = 20;
<?php echo $this->headMeta(); echo $this->headLink(); $id_khohang = $this->param->getParam('chonkhohang'); $id_ctp = $this->param->getParam('mactp'); $ctp = new Model_Caythanhpham(); $caythanhpham = $ctp->getWhere($id_ctp)[0]; if ($caythanhpham['MaDonXuat'] != null) { echo "<div class='long_message'>"; echo "Không thể hủy nhập kho vì đã tạo đơn xuất!"; echo "</div>"; } else { $update = array("MaKho" => null); $ctp->update_data($id_ctp, $update); if (array_key_exists('option', $this->param->getParams())) { echo "<script>window.location.href='" . HOST_PROJECT . "/index/xem/khohang/true';</script>"; } else { echo "<script>window.location.href='" . HOST_PROJECT . "/index/main/hopdong_detail/true/mahopdong/" . $this->param->getParam('mahopdong') . "/right/caythanhpham/mactp/" . $id_ctp . "';</script>"; } }
<?php echo $this->headMeta(); echo $this->headLink(); $form = new Form_Noindex_ChonKhoHang(); $id_ctp = $this->param->getParam("mactp"); if ($this->param->isPost()) { $param = $this->param->getPost(); $ctp = new Model_Caythanhpham(); $ctp1 = $ctp->getWhere($this->param->getParam("mactp")); $data_update = array(); $data_update['MaKho'] = $param["chonkhohang"]; $ctp->update_data($id_ctp, $data_update); $_redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector'); $_redirector->gotoUrl(HOST_PROJECT . "/index/main/hopdong_detail/true/mahopdong/" . $this->param->getParam("mahopdong") . "/right/khohang/mactp/" . $id_ctp . "/makho/" . $param["chonkhohang"] . "/"); } else { echo $form; }
<?php echo $this->headMeta(); echo $this->headLink(); $form = new Form_Searchs_Caythanhpham(); echo $form; if ($this->param->isPost()) { $cm = new Model_Caythanhpham(); $loaivai = new Model_Loaivai(); $lonhuom = new Model_Lonhuom(); $mau = new Model_Mau(); $caymoc = new Model_Caymoc(); $cmchose = $this->param->getParam("caythanhphamtim"); $caythanhphams = $cm->getWhereLike($cmchose); if ($caythanhphams) { $title = array("Mã Cây TP", "Loại Vải", "Màu Vải", "Số Mét Vải", "Tùy Chỉnh", "Nhập Kho"); $maincontent = array(); foreach ($caythanhphams as $item) { $caymocrow = $caymoc->getWhere_ctp($item['MaCTP']); $loaivairow = $loaivai->getWhere($caymocrow['MaVai']); $lonhuomrow = $lonhuom->getWhere($caymocrow['MaLoNhuom']); $maurow = $mau->getWhereIdMau($lonhuomrow['MaMau']); $chinhsua = '<a href="' . HOST_PROJECT . "/index/chinhsua/caytp/true/mactp/" . $item['MaCTP'] . '/option/caytp/">Sửa</a> | ' . '<a href="' . HOST_PROJECT . "/index/xoa/caytp/true/mactp/" . $item['MaCTP'] . '/option/ctp/" onclick="return confirm(' . "'bạn có chắc muốn xóa ?'" . ')">Xóa</a>'; $button = "<a class ='thembutton' href='" . HOST_PROJECT . "/index/xem/ctp_detail/true/mactp/" . $item['MaCTP'] . "'/>Nhập Kho</a>"; $content = array($item['MaCTP'], $loaivairow['TenLoaiVai'], $maurow['TenMau'], $item['SoMetVai'], $chinhsua, $button); $maincontent[] = $content; } $data = new My_Data(); $table = $data->createTable($title, $maincontent, "800px"); echo $table; }
$button = "<a class ='thembutton' href='" . HOST_PROJECT . "/index/xem/taoctp/true/option/them/mamoc/" . $mamoc . "/malonhuom/" . $item['MaLoNhuom'] . "'/>Chọn</a>"; $subcontent = array($item['TenLoNhuom'], $item['NgayNhuom'], $maurow['TenMau'], $button); $content[] = $subcontent; } $table = $data->createTable($title, $content, "500px"); echo $table; } else { $lonhuomall = $lonhuom->getWhere($malonhuom); $title = array("Tên Lô Nhuộm", "Ngày Nhuộm", "Màu"); $content = array(); foreach ($lonhuomall as $item) { $maurow = $mau->getWhereIdMau($item['MaMau']); $subcontent = array($item['TenLoNhuom'], $item['NgayNhuom'], $maurow['TenMau']); $content[] = $subcontent; } $table = $data->createTable($title, $content, "400px"); echo $table; $form = new Form_Formmoi_Caythanhpham(); if ($this->param->isPost()) { $sometvai = $this->param->getPost("sometvai"); $data = array("MaCTP" => null, "SoMetVai" => $sometvai); $ctp = new Model_Caythanhpham(); $ctp->insert_ctp($data); $mactp = $ctp->getMaxIndex(); $update = array("MaCTP" => $mactp, "MaLoNhuom" => $malonhuom); $cm->update_data($caymoc['MaMoc'], $update); echo "<script>window.location.href='" . HOST_PROJECT . "/index/xem/caythanhpham/true/';</script>"; } else { echo $form; } }
<?php echo $this->headMeta(); echo $this->headLink(); $form = new Form_Formmoi_Chonkhotp(); if ($this->param->isPost()) { $param = $this->param->getPost(); // echo "<pre>"; // print_r($param); // echo "</pre>"; $form->populate($param); echo $form; $makho = $this->param->getParam("mykhohang"); $ctp = new Model_Caythanhpham(); $loaivai = new Model_Loaivai(); $lonhuom = new Model_Lonhuom(); $mau = new Model_Mau(); $caymoc = new Model_Caymoc(); $khohang = new Model_Khohang(); $caythanhphamall = $ctp->getWhere_khohang($makho); if ($caythanhphamall) { $maincontent = array(); $title = array("Mã Cây TP", "Loại Vải", "Màu Vải", "Số Mét Vải", "Tùy Chỉnh"); $data = new My_Data(); $khotp = $khohang->getWhere($makho); echo '<h1 class="title">' . $khotp['TenKho'] . '</h1>'; foreach ($caythanhphamall as $caytp) { $caymocrow = $caymoc->getWhere_ctp($caytp['MaCTP']); $loaivairow = $loaivai->getWhere($caymocrow['MaVai']); $lonhuomrow = $lonhuom->getWhere($caymocrow['MaLoNhuom']); $maurow = $mau->getWhereIdMau($lonhuomrow['MaMau']);
<?php echo $this->headMeta(); echo $this->headLink(); $id_kho = $this->param->getParam('makho'); $ctp = new Model_Caythanhpham(); $caytp = $ctp->getWhere_khohang($id_kho); if ($caytp) { echo "<div class='long_message'>"; echo "Không thể xóa Kho hàng đã được sử dụng!"; echo "</div>"; } else { $khohang = new Model_Khohang(); $khohang->delete_kho($id_kho); echo "<script>window.location.href='" . HOST_PROJECT . "/index/xem/khohang/true';</script>"; }
<?php echo $this->headMeta(); echo $this->headLink(); $ctp = new Model_Caythanhpham(); $caythanhpham = $ctp->getWhere($this->param->getParam("mactp")); ?> <?php if (count($caythanhpham) > 0) { ?> <div class = "qlykhachhang"> <div class="panel panel-success"> <div class="panel-heading" > <p style="font-size: 20px;"> Thông Tin Cây Thành Phẩm</p> </div> <!-- Table --> <table class="table"> <thread> <tr> <th>Tên Cây Thành Phẩm</th> <th>Số Mét Vải</th> <th>Tên Kho</th> <th>Tên Đơn Xuất</th> <th>Chỉnh Sửa</th> </tr> </thread> <tbody> <?php $data = new My_Data();
<?php echo $this->headMeta(); echo $this->headLink(); $id_ctp = $this->param->getParam('mactp'); $id_hopdong = $this->param->getParam('mahopdong'); $fupdate = new Form_Update_Caythanhpham(); $fupdate->createForm($id_ctp); if ($this->param->isPost()) { $param = $this->param->getPost(); $check = new Form_Valid_Caythanhpham($param); if ($check->valid($param)) { $data = array("MaCTP" => $id_ctp, "TenCTP" => $this->param->getParam("TenCTP"), "SoMetVai" => $this->param->getParam("sometvai")); $kh = new Model_Caythanhpham(); $kh->update_data($id_ctp, $data); //echo "<script>window.location.href='".HOST_PROJECT."/index/main/ctp_detail/true/mactp/".$id_ctp."/';</script>"; if (array_key_exists('option', $this->param->getParams())) { echo "<script>window.location.href='" . HOST_PROJECT . "/index/xem/caythanhpham/true';</script>"; } else { echo "<script>window.location.href='" . HOST_PROJECT . "/index/main/hopdong_detail/true/mahopdong/" . $id_hopdong . "/right/caythanhpham/mactp/" . $id_ctp . "/';</script>"; } } else { echo $fupdate; echo "<div class='message'>"; foreach ($check->messages as $item) { echo $item . "<br/>"; } echo "</div>"; } } else { echo $fupdate;
$caymocrow = $caymoc->getWhere_ctp($ctprow['MaCTP']); $loaivairow = $loaivai->getWhere($caymocrow['MaVai']); $lonhuomrow = $lonhuom->getWhere($caymocrow['MaLoNhuom']); $maurow = $mau->getWhereIdMau($lonhuomrow['MaMau']); $content = array($ctprow['MaCTP'], $loaivairow['TenLoaiVai'], $maurow['TenMau'], $ctprow['SoMetVai']); $data = new My_Data(); $table = $data->createTable($title, $content, "450px"); echo $table; //require_once APPLICATION_PATH.'/layouts/nhap/chonkhotp.php'; $form = new Form_Formmoi_Chonkhotp(); if ($this->param->isPost()) { $param = $this->param->getPost(); // makhohang la ma cua kho cay thanh pham se nhap $makhohang = $this->param->getParam("mykhohang"); $mactp = $this->param->getParam("mactp"); $caytp = new Model_Caythanhpham(); $caytprow = $caytp->getWhere($mactp); // update kho tp cho caytp $update = array("MaKho" => $makhohang); $caytp->update_data($caytprow['MaCTP'], $update); $khotp = new Model_KhoThanhPham(); $khotprow = $khotp->getWhere_loaivai_mauvai($loaivairow['MaVai'], $maurow['MaMau']); if ($khotprow) { $update = array("TongSoMet" => $khotprow['TongSoMet'] + $caytprow['SoMetVai'], "SoCayTP" => $khotprow['SoCayTP'] + 1); $khotp->update_data($khotprow['MaKhoTP'], $update); } else { // neu khong co loai vai trong kho moc thi them moi $data = array("MaKhoTP" => null, "MaVai" => $loaivairow['MaVai'], "MaMau" => $maurow['MaMau'], "TongSoMet" => $caytprow['SoMetVai'], "SoCayTP" => 1, "MaKho" => $makhohang); $khotp->insert_kho($data); } echo "<script>window.location.href='" . HOST_PROJECT . "/index/xem/caythanhpham/true';</script>";