Ejemplo n.º 1
0
 public function createForm($id_cm)
 {
     $kh = new Model_Caymoc();
     $caymoc = $kh->getWhere($id_cm);
     $this->setDisableLoadDefaultDecorators(true);
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'formnoindex/caymoc_layout.phtml')), 'Form'));
     $data = new My_Data();
     $opLoaiVai = $data->getOptionLoaiVai();
     $tencaymoc = $this->createElement('text', 'tencaymoc', array('decorators' => array('ViewHelper')));
     $sometvai = $this->createElement('text', 'sometvai', array('decorators' => array('ViewHelper')));
     $maloaivai = $this->createElement('select', 'maloaivai', array('multioptions' => $opLoaiVai, 'decorators' => array('ViewHelper')));
     $soluong = $this->createElement('text', 'soluong', array('decorators' => array('ViewHelper')));
     $them = $this->createElement('submit', 'them', array('decorators' => array('ViewHelper'), 'label' => 'Chỉnh sửa'));
     $tencaymoc->setAttrib('class', 'formEdit')->setValue($caymoc['TenCayMoc']);
     $sometvai->setAttrib('class', 'formEdit')->setValue($caymoc['SoMetVai']);
     $maloaivai->setAttrib('class', 'formEdit')->setValue($caymoc['MaLoaiVai']);
     $soluong->setAttrib('class', 'formEdit')->setValue($caymoc['SoLuongCayMoc']);
     $this->addElement($tencaymoc)->addElement($sometvai)->addElement($maloaivai)->addElement($soluong)->addElement($them);
 }
Ejemplo n.º 2
0
<?php

echo $this->headMeta();
echo $this->headLink();
$form = new Form_Formmoi_Chonkhomoc();
if ($this->param->isPost()) {
    $param = $this->param->getPost();
    // makhohang la ma cua kho moc se nhap
    $makhohang = $this->param->getParam("mykhohang");
    //ma moc la ma cay moc
    $mamoc = $this->param->getParam("mamoc");
    $caymoc = new Model_Caymoc();
    $caymocrow = $caymoc->getWhere($mamoc);
    $khosoi = new Model_Khosoi();
    $khosoirow = $khosoi->getWhere($caymocrow['MaKhoSoi']);
    if ($caymocrow['SoKgSoi'] / 1000 > $khosoirow['SoTanSoi']) {
        echo "<div class='message'>";
        echo "Trong kho chỉ còn " . $khosoirow['SoTanSoi'] * 1000 . "kg sợi! Xin vui lòng sửa số kg sợi hoặc nhập thêm!";
        echo "</div>";
    } else {
        // update kho moc cho cay moc
        $update = array("MaKhoMoc" => $makhohang);
        $caymoc->update_data($mamoc, $update);
        //update so kg cho kho soi
        $updatekho = array('SoTanSoi' => $khosoirow['SoTanSoi'] - $caymocrow['SoKgSoi'] / 1000);
        $khosoi->update_data($khosoirow['MaKhoSoi'], $updatekho);
        $khomoc = new Model_KhoMoc();
        $khomocrow = $khomoc->getWhere_khohang($makhohang);
        if ($khomocrow) {
            $makhomoc = "";
            foreach ($khomocrow as $item) {
Ejemplo n.º 3
0
<?php

echo $this->headMeta();
echo $this->headLink();
$mamoc = $this->param->getParam("mamoc");
$cm = new Model_Caymoc();
$caymoc = $cm->getWhere($mamoc);
if ($caymoc) {
    $maincontent = array();
    $title = array("Mã Mộc", "Loại Vải", "Số Mét Vải");
    $loaivai = new Model_Loaivai();
    $data = new My_Data();
    $khohang = new Model_Khohang();
    $loaivairow = $loaivai->getWhere($caymoc['MaVai']);
    $content = array($caymoc['MaMoc'], $loaivairow['TenLoaiVai'], $caymoc['SoMetVai']);
    $maincontent[] = $content;
}
$table = $data->createTable($title, $maincontent, "300px");
echo $table;
// lo nhuom
$mau = new Model_Mau();
$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);
Ejemplo n.º 4
0
 }
 if ($message == '') {
     // them cay tp
     $malonhuom = $param['malonhuom'];
     $formtp->createForm($malonhuom);
     $formtp->populate($param);
     echo $formtp;
     echo "nhap dung";
     foreach ($param as $key => $item) {
         if ($num->isValid($key)) {
             // them vao caytp
             $mydata = array('MaCTP' => null, 'SoMetVai' => $item, 'MaKhoTP' => $param['khotp']);
             $caytp->insert($mydata);
             //update caymoc
             $maxindex = $caytp->getMaxIndex();
             $caymocrow = $caymoc->getWhere($key);
             $update = array('MaLoNhuom' => $param['malonhuom'], 'MaCTP' => $maxindex);
             $caymoc->update_data($key, $update);
             echo "<script>window.location.href='" . HOST_PROJECT . "/index/xem/caythanhpham/true';</script>";
         }
     }
     $lonhuom->update_data($param['malonhuom'], array('TrangThai' => 1));
     unset($mysession->checked);
 } else {
     $malonhuom = $param['malonhuom'];
     $formtp->createForm($malonhuom);
     $formtp->populate($param);
     echo $formtp;
     echo "<div class='long_message' style='margin:auto !important;width:400px !important;'>";
     echo $message;
     echo "</div>";
Ejemplo n.º 5
0
<?php

echo $this->headMeta();
echo $this->headLink();
$id_moc = $this->param->getParam('mamoc');
$cm = new Model_Caymoc();
$caymoc = $cm->getWhere($id_moc);
if ($caymoc['MaLoNhuom'] != null) {
    echo "<div class='long_message'>";
    echo "Không thể xóa Cây Mộc đã tạo Lô Nhuộm!";
    echo "</div>";
} else {
    $caymoc1 = $cm->delete_caymoc($id_moc);
    if (array_key_exists('option', $this->param->getParams())) {
        echo "<script>window.location.href='" . HOST_PROJECT . "/index/xem/caymoc/true';</script>";
    } else {
        echo "<script>window.location.href='" . HOST_PROJECT . "/index/main/hopdong_detail/true/mahopdong/" . $caymoc['MaHopDong'] . "/right/hopdong/';</script>";
    }
}
Ejemplo n.º 6
0
     $mydate = Zend_Locale_Format::getDate($hopdong['NgayKy'], array("date_format" => "yyyy.MM.dd"));
     $date_str = $mydate['day'] . "/" . $mydate['month'] . "/" . $mydate['year'];
     $option = $data->getItemNameForContract($hopdong['MaHopDong']);
     $chinhsua = '<a href="' . HOST_PROJECT . "/index/chinhsua/hopdong/true/mahopdong/" . $hopdong['MaHopDong'] . '/">Sửa</a>&nbsp|&nbsp' . '<a href="' . HOST_PROJECT . "/index/xoa/hopdong/true/mahopdong/" . $hopdong['MaHopDong'] . '/" onclick="return confirm(' . "'bạn có chắc muốn xóa ?'" . ')">Xóa</a>';
     $button = '<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>';
     $content = array($hopdong['TenHopDong'], $hopdong['MoTa'], $date_str, $hopdong['SoTanSoi'], $hopdong['ThanhTien'], $option['TenMau'], $option['TenDonHang'], $option['TenLoaiVai'], $option['TenNhaCungCap'], $chinhsua, $button);
     $table = $data->createRightTable($title, $content, "450px");
     echo $table;
 } else {
     $right = $this->param->getParam("right");
     if ($right == "caymoc") {
         echo '<h1 class="title">Thông Tin Cây Mộc</h1>';
         $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>');