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);
 }
Esempio n. 2
0
<?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>&nbsp|&nbsp' . '<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>";
}
Esempio n. 4
0
 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;
 }
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>&nbsp|&nbsp' . '<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;
    }
}