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);
 }
예제 #2
0
 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) {
예제 #4
0
$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);
    $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);
            }
        }
    }
}
?>
            <div class="main">
                <div style='float: left'>
                <?php 
$formlonhuom = new Form_Formmoi_Chonnhuom();
echo $formlonhuom;
if ($this->param->isPost()) {
    // chon lo nhuom
    if (in_array("Chọn", $param)) {
        foreach ($param as $key => $item) {
            if ($item == "Chọn") {
                $lonhuomrow = $lonhuom->getWhere($key);
                if ($lonhuomrow['SoCayNhuom'] < count($mysession->checked)) {
                    echo "<div class='message'>";
                    echo "Số cây nhuộm vượt quá số lượng có thể nhuộm";
                    echo "</div>";
                } else {
                    //echo "xu ly lo nhuom";
                    $formtp->createForm($key);
                    echo $formtp;
                }
            }
        }
    } else {
        if (array_key_exists('them', $param)) {
            // them cay thanh pham
            $message = '';
<?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>";
}
     $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>&nbsp|&nbsp' . '<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>&nbsp|&nbsp' . '<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>&nbsp|&nbsp' . '<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");