<?php 
if (count($hopdong) > 0) {
    echo '<div class="main">';
    echo '<div class = "left">';
    echo '<h1 class="title">Thông Tin Hợp Đồng</h1>';
    $title = array("Tên Hợp Đồng", "Tạo Cây Mộc");
    $content = array("<a href='" . HOST_PROJECT . "/index/main/hopdong_detail/true/mahopdong/" . $hopdong['MaHopDong'] . "/right/hopdong'>" . $hopdong['TenHopDong'] . "</a>", '<button type="button" class="btn btn-success"><a class ="axem" href="' . HOST_PROJECT . "/index/nhaplieu/caymoc/true/mahopdong/" . $hopdong['MaHopDong'] . '/">Tạo Cây Mộc</a></button>');
    $data = new My_Data();
    $table = $data->createTable($title, $content, "400px");
    echo $table;
    ?>
    
    <?php 
    $data = new My_Data();
    //echo $this->param->getParam("makhachhang");
    $cm = $data->getCayMoc($this->param->getParam("mahopdong"));
    if ($cm) {
        $title = array("Cây Mộc", "Lô Nhuộm", "Cây Thành Phẩm", "Kho Hàng", "Đơn Xuất");
        $maincontent = array();
        foreach ($cm as $item) {
            $content = array();
            //$content[] = "<a href='".HOST_PROJECT."/index/main/caymoc_detail/true/macaymoc/".$item['MaMoc']."/'>".$item['TenCayMoc']."</a>";
            $content[] = "<a href='" . HOST_PROJECT . "/index/main/hopdong_detail/true/mahopdong/" . $id_hopdong . "/right/caymoc/macaymoc/" . $item['MaMoc'] . "/'>" . $item['TenCayMoc'] . "</a>";
            // Lô Nhuộm
            if ($item['MaLoNhuom'] == null) {
                $content[] = '<button type="button" class="btn btn-success"><a class ="axem" href="' . HOST_PROJECT . "/index/nhaplieu/lonhuom/true/mamoc/" . $item['MaMoc'] . "/mahopdong/" . $this->param->getParam("mahopdong") . '\\">Tạo Lô Nhuộm</a></button>';
            } else {
                $ln = new Model_Lonhuom();
                $lonhuom = $ln->getWhere($item['MaLoNhuom']);
                //$content[] = "<a href='".HOST_PROJECT."/index/main/lonhuom_detail/true/malonhuom/".$lonhuom[0]['MaLoNhuom']."/'>".$lonhuom[0]['TenLoNhuom']."</a>";
                $content[] = "<a href='" . HOST_PROJECT . "/index/main/hopdong_detail/true/mahopdong/" . $id_hopdong . "/right/lonhuom/malonhuom/" . $lonhuom[0]['MaLoNhuom'] . "/'>" . $lonhuom[0]['TenLoNhuom'] . "</a>";