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 init() { $this->setDisableLoadDefaultDecorators(true); $this->setDecorators(array(array('ViewScript', array('viewScript' => 'formmoi/chonlonhuom.phtml')), 'Form')); $ln = new Model_Lonhuom(); $lonhuomall = $ln->getWhere_trangthai(); foreach ($lonhuomall as $key => $item) { $them = $this->createElement('submit', '' . $item['MaLoNhuom'], array('decorators' => array('ViewHelper'), 'label' => 'Chọn')); $them->setAttrib('class', 'btn btn-primary'); $this->addElement($them); } }
public function createForm($id_lonhuom) { $kh = new Model_Lonhuom(); $lonhuom = $kh->getWhere($id_lonhuom); $this->setDisableLoadDefaultDecorators(true); $this->setDecorators(array(array('ViewScript', array('viewScript' => 'form/lonhuom_layout.phtml')), 'Form')); $data = new My_Data(); $opMau = $data->getOptionMau(); $tenlonhuom = $this->createElement('text', 'tenlonhuom', array('decorators' => array('ViewHelper'))); $ngaynhuom = $this->createElement('text', 'ngaynhuom', array('decorators' => array('ViewHelper'))); $mamau = $this->createElement('select', 'mamau', array('decorators' => array('ViewHelper'), 'multioptions' => $opMau)); $them = $this->createElement('submit', 'them', array('decorators' => array('ViewHelper'), 'label' => 'Chỉnh sửa')); $mydate = Zend_Locale_Format::getDate($lonhuom[0]['NgayNhuom'], array("date_format" => "yyyy.MM.dd")); $date_str = $mydate['day'] . "/" . $mydate['month'] . "/" . $mydate['year']; $tenlonhuom->setAttrib('class', 'formEdit')->setValue($lonhuom[0]['TenLoNhuom']); $ngaynhuom->setAttrib('class', 'formEdit')->setValue($date_str); $mamau->setAttrib('class', 'formEdit')->setValue($lonhuom[0]['MaMau']); $this->addElement($tenlonhuom)->addElement($ngaynhuom)->addElement($mamau)->addElement($them); }
<?php echo $this->headMeta(); echo $this->headLink(); $ln = new Model_Lonhuom(); $lonhuom = $ln->getWhere($this->param->getParam("malonhuom")); ?> <?php if (count($lonhuom) > 0) { ?> <div class = "qlykhachhang"> <div class="panel panel-success"> <div class="panel-heading" > <p style="font-size: 20px;"> Thông Tin Lô Nhuộm</p> </div> <!-- Table --> <table class="table"> <thread> <tr> <th>Tên Lô Nhuộm</th> <th>Ngày Nhuộm</th> <th>Màu</th> <th>Chỉnh Sửa</th> </tr> </thread> <tbody> <?php $data = new My_Data(); foreach ($lonhuom as $item) {
$caymoc = $cm->getWhere($mamoc); if ($caymoc) { $maincontent = array(); $title = array("Mã Mộc", "Loại Vải", "Số Mét Vải"); $loaivai = new Model_Loaivai(); $data = new My_Data(); $khohang = new Model_Khohang(); $loaivairow = $loaivai->getWhere($caymoc['MaVai']); $content = array($caymoc['MaMoc'], $loaivairow['TenLoaiVai'], $caymoc['SoMetVai']); $maincontent[] = $content; } $table = $data->createTable($title, $maincontent, "300px"); echo $table; // lo nhuom $mau = new Model_Mau(); $lonhuom = new Model_Lonhuom(); $malonhuom = $this->param->getParam("malonhuom"); if ($malonhuom == null) { $lonhuomall = $lonhuom->getAll(); $title = array("Tên Lô Nhuộm", "Ngày Nhuộm", "Màu", "Chọn"); $content = array(); foreach ($lonhuomall as $item) { $maurow = $mau->getWhereIdMau($item['MaMau']); $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);
<?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]); } } } }
echo $this->headMeta(); echo $this->headLink(); $data = new My_Data(); $mau = $data->getOpMau(); $form = new Form_Noindex_Lonhuom(); $form->createLonhuom($mau); if ($this->param->isPost()) { $param = $this->param->getPost(); $check = new Form_Valid_Lonhuom($param); // sua lai if ($check->valid($param)) { $mydate = Zend_Locale_Format::getDate($this->param->getParam("ngaynhuom"), array("date_format" => "dd.MM.yyyy")); $date_str = $mydate['year'] . "-" . $mydate['month'] . "-" . $mydate['day']; $data = array("MaLoNhuom" => null, "SoCayNhuom" => $this->param->getPost("socaynhuom"), "NgayNhuom" => $date_str, "MaMau" => $this->param->getPost("mamau")); $lonhuom = new Model_Lonhuom(); $lonhuom->insert_lonhuom($data); $lonhuom1 = $lonhuom->getAll(); $_redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector'); $_redirector->gotoUrl(HOST_PROJECT . "/index/xem/lonhuom/true"); } 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(); $id_ln = $this->param->getParam('malonhuom'); $id_hopdong = $this->param->getParam('mahopdong'); $fupdate = new Form_Update_Lonhuom(); $fupdate->createForm($id_ln); if ($this->param->isPost()) { $param = $this->param->getPost(); $check = new Form_Valid_Lonhuom($param); if ($check->valid($param)) { $mydate = Zend_Locale_Format::getDate($this->param->getParam("ngaynhuom"), array("date_format" => "dd.MM.yyyy")); $date_str = $mydate['year'] . "-" . $mydate['month'] . "-" . $mydate['day']; $data = array("MaLoNhuom" => $id_ln, "TenLoNhuom" => $this->param->getParam("tenlonhuom"), "NgayNhuom" => $date_str, "MaMau" => $this->param->getParam("mamau")); $kh = new Model_Lonhuom(); $kh->update_data($id_ln, $data); //echo "<script>window.location.href='".HOST_PROJECT."/index/main/lonhuom_detail/true/malonhuom/".$id_ln."/';</script>"; if (array_key_exists('option', $this->param->getParams())) { echo "<script>window.location.href='" . HOST_PROJECT . "/index/xem/lonhuom/true';</script>"; } else { echo "<script>window.location.href='" . HOST_PROJECT . "/index/main/hopdong_detail/true/mahopdong/" . $id_hopdong . "/right/lonhuom/malonhuom/" . $id_ln . "/';</script>"; } } else { echo $fupdate; foreach ($check->messages as $item) { echo $item . "<br/>"; } echo "</div>"; } } else {
<?php echo $this->headMeta(); echo $this->headLink(); $form = new Form_Searchs_Lonhuom(); echo $form; if ($this->param->isPost()) { $model = new Model_Lonhuom(); $key = $this->param->getParam("key"); $lonhuoms = $model->getWhereLike($key); if ($lonhuoms != false) { $title = array("Tên Lô Nhuộm", "Ngày Nhuộm", "Màu", "Tùy Chỉnh"); $data = new My_Data(); $maincontent = array(); foreach ($lonhuoms as $item) { $mydate = Zend_Locale_Format::getDate($item['NgayNhuom'], array("date_format" => "yyyy.MM.dd")); $date_str = $mydate['day'] . "/" . $mydate['month'] . "/" . $mydate['year']; $cm = new Model_Caymoc(); $caymoc = $cm->getWhere_lonhuom($item['MaLoNhuom']); // $tenlonhuom = "<a href='".HOST_PROJECT."/index/main/hopdong_detail/true/mahopdong/".$caymoc['MaHopDong']."/right/lonhuom/malonhuom/".$item['MaLoNhuom']."/'>". $item['TenLoNhuom']."</a>"; $content = array($item['TenLoNhuom'], $date_str, $data->getNameMau($item['MaMau']), '<a href="' . HOST_PROJECT . "/index/chinhsua/lonhuom/true/malonhuom/" . $item['MaLoNhuom'] . '/option/lonhuom">Sửa</a> | ' . '<a href="' . HOST_PROJECT . "/index/xoa/lonhuom/true/malonhuom/" . $item['MaLoNhuom'] . '/option/lonhuom" onclick="return confirm(' . "'bạn có chắc muốn xóa ?'" . ')">Xóa</a>'); $maincontent[] = $content; } $data = new My_Data(); $table = $data->createTable($title, $maincontent, "800px"); echo $table; } }
<?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>"; }
<?php echo $this->headMeta(); echo $this->headLink(); $ln = new Model_Lonhuom(); $lonhuomall = $ln->getAll(); if ($lonhuomall) { $maincontent = array(); $title = array("Mã Lô", "Ngày Nhuộm", "Màu", "Số Cây Nhuộm", "Tùy Chỉnh", "Trạng Thái"); $data = new My_Data(); foreach ($lonhuomall as $lonhuom) { if (!$lonhuom['TrangThai']) { $mydate = Zend_Locale_Format::getDate($lonhuom['NgayNhuom'], array("date_format" => "yyyy.MM.dd")); $date_str = $mydate['day'] . "/" . $mydate['month'] . "/" . $mydate['year']; $cm = new Model_Caymoc(); $caymoc = $cm->getWhere_lonhuom($lonhuom['MaLoNhuom']); $trangthai = "<a class ='buttontim' href='#'/>Đang Nhuộm</a>"; $content = array($lonhuom['MaLoNhuom'], $date_str, $data->getNameMau($lonhuom['MaMau']), $lonhuom['SoCayNhuom'], '<a href="' . HOST_PROJECT . "/index/chinhsua/lonhuom/true/malonhuom/" . $lonhuom['MaLoNhuom'] . '/option/lonhuom">Sửa</a> | ' . '<a href="' . HOST_PROJECT . "/index/xoa/lonhuom/true/malonhuom/" . $lonhuom['MaLoNhuom'] . '/option/lonhuom" onclick="return confirm(' . "'bạn có chắc muốn xóa ?'" . ')">Xóa</a>', $trangthai); $maincontent[] = $content; } } $table = $data->createTable($title, $maincontent, "730px"); echo $table; } else { echo "<div class='message'>"; echo "Chưa tồn tại Lô Nhuộm"; echo "</div>"; }
if ($right == "caymoc") { echo '<h1 class="title">Thông Tin Cây Mộc</h1>'; $title = array("Tên Cây Mộc", "Số Mét Vải", "Số Lượng Cây Mộc", "Loại Vải", "Thuộc Hợp Đồng", "Lô Nhuộm", "Tùy Chỉnh"); $data = new My_Data(); $cm = new Model_Caymoc(); $caymoc = $cm->getWhere($this->param->getParam("macaymoc")); $option = $data->getItemNameForCayMoc($caymoc['MaMoc']); $content = array($caymoc['TenCayMoc'], $caymoc['SoMetVai'], $caymoc['SoLuongCayMoc'], $option['TenLoaiVai'], $option['TenHopDong'], $option['TenLoNhuom'], '<a href="' . HOST_PROJECT . "/index/chinhsua/caymoc/true/mahopdong/" . $id_hopdong . "/macaymoc/" . $caymoc['MaMoc'] . "/" . '/">Sửa</a> | ' . '<a href="' . HOST_PROJECT . "/index/xoa/caymoc/true/mamoc/" . $caymoc['MaMoc'] . '/" 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 == "lonhuom") { echo '<h1 class="title">Thông Tin Lô Nhuộm</h1>'; $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']);
<?php echo $this->headMeta(); echo $this->headLink(); $mamau = $this->param->getParam('mamau'); $hd = new Model_Hopdong(); $hopdong = $hd->getWhere_mau($mamau); if ($hopdong) { echo "<div class='long_message'>"; echo "Không thể xóa màu vải đã được dùng trong hợp đồng!"; echo "</div>"; } else { $ln = new Model_Lonhuom(); $lonhuom = $ln->getWhere_mau($mamau); if ($lonhuom) { echo "<div class='long_message'>"; echo "Không thể xóa màu vải đã được dùng trong lô nhuộm!"; echo "</div>"; } else { $mau = new Model_Mau(); $mau->delete_mau($mamau); echo "<script>window.location.href='" . HOST_PROJECT . "/index/xem/mau/true';</script>"; } }
<?php echo $this->headMeta(); echo $this->headLink(); $id_lonhuom = $this->param->getParam('malonhuom'); $cm = new Model_Caymoc(); $caymoc = $cm->getWhere_lonhuom($id_lonhuom); if ($caymoc['MaCTP'] != null) { echo "<div class='long_message'>"; echo "Không thể xóa Lô Nhuộm đã tạo Cây Thành Phẩm!"; echo "</div>"; } else { $update = array("MaLoNhuom" => null); $caymoc1 = $cm->update_data($caymoc['MaMoc'], $update); $ln = new Model_Lonhuom(); $ln->delete_lonhuom($id_lonhuom); if (array_key_exists('option', $this->param->getParams())) { echo "<script>window.location.href='" . HOST_PROJECT . "/index/xem/lonhuom/true';</script>"; } else { echo "<script>window.location.href='" . HOST_PROJECT . "/index/main/hopdong_detail/true/mahopdong/" . $caymoc['MaHopDong'] . "/right/caymoc/macaymoc/" . $caymoc['MaMoc'] . "/';</script>"; } }