<?php echo $this->headMeta(); echo $this->headLink(); $dx = new Model_Donxuat(); $donxuatall = $dx->getAll(); if ($donxuatall) { $maincontent = array(); $title = array("Tên Đơn Xuất", "Ngày Xuất", "Thuộc Hợp Đồng", "Tùy Chỉnh"); $data = new My_Data(); foreach ($donxuatall as $donxuat) { $mydate = Zend_Locale_Format::getDate($donxuat['NgayXuat'], array("date_format" => "yyyy.MM.dd")); $date_str = $mydate['day'] . "/" . $mydate['month'] . "/" . $mydate['year']; $hd = new Model_Hopdong(); $myhopdong = $hd->getWhereIdHopDong($donxuat['MaHopDong']); $tendonxuat = "<a href='" . HOST_PROJECT . "/index/main/hopdong_detail/true/mahopdong/" . $myhopdong['MaHopDong'] . "/right/donxuat/madonxuat/" . $donxuat['MaDonXuat'] . "/'>" . $donxuat['TenDonXuat'] . "</a>"; $content = array($tendonxuat, $date_str, $myhopdong['TenHopDong'], '<a href="' . HOST_PROJECT . "/index/chinhsua/donxuat/true/madonxuat/" . $donxuat['MaDonXuat'] . '/option/donxuat/">Sửa</a> | ' . '<a href="' . HOST_PROJECT . "/index/xoa/donxuat/true/mahopdong/" . $myhopdong['TenHopDong'] . "/madonxuat/" . $donxuat['MaDonXuat'] . '/option/donxuat/" onclick="return confirm(' . "'bạn có chắc muốn xóa ?'" . ')">Xóa</a>'); $maincontent[] = $content; } $table = $data->createTable($title, $maincontent, "600px"); echo $table; } else { echo "<div class='message'>"; echo "Chưa tồn tại Đơn Xuất"; echo "</div>"; }
echo $this->headMeta(); echo $this->headLink(); $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>"; }