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_donhang)
 {
     $kh = new Model_Donhang();
     $donhang = $kh->getWhere($id_donhang);
     $this->setDisableLoadDefaultDecorators(true);
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'formnoindex/donhang_layout.phtml')), 'Form'));
     $tendonhang = $this->createElement('text', 'tendonhang', array('decorators' => array('ViewHelper')));
     $ngaydathang = $this->createElement('text', 'ngaydathang', array('decorators' => array('ViewHelper')));
     $tiendathang = $this->createElement('text', 'tiendathang', array('decorators' => array('ViewHelper')));
     $sometvai = $this->createElement('text', 'sometvai', array('decorators' => array('ViewHelper')));
     $them = $this->createElement('submit', 'them', array('decorators' => array('ViewHelper'), 'label' => 'Chỉnh sửa'));
     $tendonhang->setAttrib('class', 'textmedium')->setValue($donhang['TenDonHang']);
     $mydate = Zend_Locale_Format::getDate($donhang['NgayDat'], array("date_format" => "yyyy.MM.dd"));
     $date_str = $mydate['day'] . "/" . $mydate['month'] . "/" . $mydate['year'];
     $ngaydathang->setAttrib('class', 'textmedium')->setValue($date_str);
     $tiendathang->setAttrib('class', 'textmedium')->setValue($donhang['TienDatHang']);
     $sometvai->setAttrib('class', 'textmedium')->setValue($donhang['SoMetVai']);
     $this->addElement($tendonhang)->addElement($ngaydathang)->addElement($tiendathang)->addElement($sometvai)->addElement($them);
 }
예제 #3
0
 public function getNameKhachHang($mahopdong)
 {
     $hd = new Model_Hopdong();
     $hopdong = $hd->getWhereIdHopDong($mahopdong);
     $madonhang = $hopdong['MaDonHang'];
     $dh = new Model_Donhang();
     $donhang = $dh->getWhere($madonhang);
     $kh = new Model_Khachhang();
     $khachhang = $kh->getWhere($donhang['MaKhachHang'])[0];
     return $khachhang['TenKhachHang'];
 }
예제 #4
0
<?php

echo $this->headMeta();
echo $this->headLink();
$id_hopdong = $this->param->getParam('mahopdong');
$cm = new Model_Caymoc();
$caymoc = $cm->getWhere_IdHopdong($id_hopdong);
if ($caymoc) {
    echo "<div class='long_message'>";
    echo "Không thể xóa Hợp Đồng đã tạo Cây Mộc !";
    echo "</div>";
} else {
    $hd = new Model_Hopdong();
    $id_donhang = $hd->getWhereIdHopDong($id_hopdong)['MaDonHang'];
    $dh = new Model_Donhang();
    $id_khachhang = $dh->getWhere($id_donhang)['MaKhachHang'];
    $hopdong = $hd->delete_hopdong($id_hopdong);
    if (array_key_exists('option', $this->param->getParams())) {
        echo "<script>window.location.href='" . HOST_PROJECT . "/index/xem/hopdong/true';</script>";
    } else {
        echo "<script>window.location.href='" . HOST_PROJECT . "/index/main/khachhang_detail/true/makhachhang/" . $id_khachhang . "/';</script>";
    }
}
예제 #5
0
        foreach ($param as $key => $item) {
            if ($num->isValid($key) && $item == 1 && in_array($key, $mysession->checktp)) {
                foreach ($mysession->checktp as $skey => $sitem) {
                    if ($key == $sitem) {
                        unset($mysession->checktp[$skey]);
                    }
                }
            }
        }
    }
}
//     echo "<pre>";
//     print_r($mysession->checktp);
//     echo "</pre>";
$dh = new Model_Donhang();
$donhang = $dh->getWhere($madonhang);
$loaivai = new Model_Loaivai();
$mau = new Model_Mau();
$kh = new Model_Khachhang();
$data = new My_Data();
// thong tin don hang
$title = array("Mã Đơn Hàng", "Loại Vải", "Màu Vải", "Số Mét Vải", "Ngày Đặt", "Tiền Đặt Hàng", "Khách Hàng");
$loaivairow = $loaivai->getWhere($donhang['MaVai']);
$maurow = $mau->getWhereIdMau($donhang['MaMau']);
$khachhang = $kh->getWhere($donhang['MaKhachHang']);
$mydate = Zend_Locale_Format::getDate($donhang['NgayDat'], array("date_format" => "yyyy.MM.dd"));
$date_str = $mydate['day'] . "/" . $mydate['month'] . "/" . $mydate['year'];
$tien = $data->convertCurrency($donhang['TienDatHang']);
$content = array($donhang['MaDonHang'], $loaivairow['TenLoaiVai'], $maurow['TenMau'], $donhang['SoMetVai'], $date_str, $tien, $khachhang['TenKhachHang']);
$query = $data->createTable($title, $content, '750');
echo $query;