Esempio n. 1
0
 public function createForm($id_loaivai)
 {
     $lv = new Model_Loaivai();
     $loaivai = $lv->getWhere($id_loaivai);
     $this->setDisableLoadDefaultDecorators(true);
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'form/loaivai_layout.phtml')), 'Form'));
     $ls = new Model_Loaisoi();
     $arr = $ls->getAll();
     $options = array();
     foreach ($arr as $item) {
         $name = $item['MaSoi'];
         $options[$name] = $item['TenSoi'];
     }
     $tenloaivai = $this->createElement('text', 'tenloaivai', array('decorators' => array('ViewHelper')));
     $masoi = $this->createElement('select', 'masoi', array('multioptions' => $options, 'decorators' => array('ViewHelper')));
     $them = $this->createElement('submit', 'them', array('decorators' => array('ViewHelper'), 'label' => 'Chỉnh Sửa'));
     $tenloaivai->setAttrib('class', 'formEdit')->setValue($loaivai['TenLoaiVai']);
     $masoi->setAttrib('class', 'formEdit')->setValue($loaivai['MaSoi']);
     $this->addElement($tenloaivai)->addElement($masoi)->addElement($them);
 }
<?php

echo $this->headMeta();
echo $this->headLink();
$cm = new Model_Caymoc();
$caymocall = $cm->getAll();
if ($caymocall) {
    $maincontent = array();
    $title = array("Mã Mộc", "Loại Vải", "Số Mét Vải", "Mã Lô", "Tùy Chỉnh", "Nhập Kho");
    $loaivai = new Model_Loaivai();
    $data = new My_Data();
    $khohang = new Model_Khohang();
    foreach ($caymocall as $caymoc) {
        if (!$caymoc['MaKhoMoc']) {
            $loaivairow = $loaivai->getWhere($caymoc['MaVai']);
            $chinhsua = '<a href="' . HOST_PROJECT . "/index/chinhsua/caymoc/true/mamoc/" . $caymoc['MaMoc'] . '/option/caymoc/">Sửa</a>&nbsp|&nbsp' . '<a href="' . HOST_PROJECT . "/index/xoa/caymoc/true/mamoc/" . $caymoc['MaMoc'] . '/option/xem/" onclick="return confirm(' . "'bạn có chắc muốn xóa ?'" . ')">Xóa</a>';
            $button = "<a class ='thembutton' href='" . HOST_PROJECT . "/index/xem/caymoc_detail/true/mamoc/" . $caymoc['MaMoc'] . "'/>Nhập Kho</a>";
            $nhapkho = "";
            if ($caymoc['MaKhoMoc']) {
                $nhapkho = "&nbspĐã Nhập";
            } else {
                $nhapkho = $button;
            }
            //$khohangrow = $khohang->getWhere($caymoc['MaKho'])[0];
            $content = array($caymoc['MaMoc'], $loaivairow['TenLoaiVai'], $caymoc['SoMetVai'], $caymoc['MaLo'], $chinhsua, $nhapkho);
            $maincontent[] = $content;
        }
    }
    $table = $data->createTable($title, $maincontent, "600px");
    echo $table;
} else {
Esempio n. 3
0
echo $this->headMeta();
echo $this->headLink();
$form = new Form_Formmoi_Chonkhotp();
if ($this->param->isPost()) {
    $param = $this->param->getPost();
    $form->populate($param);
    echo $form;
    $makho = $this->param->getParam("mykhohang");
    $khotp = new Model_KhoThanhPham();
    $khotpall = $khotp->getWhere_khohang($makho);
    //         echo $makho;
    //         echo "<pre>";
    //         print_r($khotpall);
    //         echo "</pre>";
    $data = new My_Data();
    $loaivai = new Model_Loaivai();
    $mau = new Model_Mau();
    if ($khotpall) {
        $title = array("Loại Vải", "Màu Vải", "Tổng Số Mét", "Số Cây TP");
        $content = array();
        foreach ($khotpall as $item) {
            $loaivairow = $loaivai->getWhere($item['MaVai']);
            $maurow = $mau->getWhereIdMau($item['MaMau']);
            $subcontent = array($loaivairow['TenLoaiVai'], $maurow['TenMau'], $item['TongSoMet'], $item['SoCayTP']);
            $content[] = $subcontent;
        }
        $query = $data->createTable($title, $content, "450px");
        echo $query;
    } else {
        echo "<div class='message'>";
        echo "Kho Thành Phẩm Trống!";
<?php

echo $this->headMeta();
echo $this->headLink();
$lv = new Model_Loaivai();
$loaivaiall = $lv->getAll();
$lsoi = new Model_Loaisoi();
if ($loaivaiall) {
    $maincontent = array();
    $title = array("Tên Loại Vải", "Làm Từ Loại Sợi", "Tùy Chỉnh");
    $data = new My_Data();
    foreach ($loaivaiall as $loaivai) {
        $loaisoi = $lsoi->getWhere($loaivai['MaSoi']);
        $content = array($loaivai['TenLoaiVai'], $loaisoi['TenSoi'], '<a href="' . HOST_PROJECT . "/index/chinhsua/loaivai/true/maloaivai/" . $loaivai['MaVai'] . '/">Sửa</a>&nbsp|&nbsp' . '<a href="' . HOST_PROJECT . "/index/xoa/loaivai/true/maloaivai/" . $loaivai['MaVai'] . '/option/loaivai/" onclick="return confirm(' . "'bạn có chắc muốn xóa ?'" . ')">Xóa</a>');
        $maincontent[] = $content;
    }
    $table = $data->createTable($title, $maincontent, "500px");
    echo $table;
} else {
    echo "<div class='message'>";
    echo "Chưa tồn tại Loại Vải";
    echo "</div>";
}
Esempio n. 5
0
<?php

echo $this->headMeta();
echo $this->headLink();
$maloaivai = $this->param->getParam('maloaivai');
$fupdate = new Form_Update_Loaivai();
$fupdate->createForm($maloaivai);
if ($this->param->isPost()) {
    $param = $this->param->getPost();
    $check = new Form_Valid_Loaivai($param);
    if ($check->valid($param)) {
        $data = array("MaVai" => $maloaivai, "TenLoaiVai" => $this->param->getParam("tenloaivai"), "MaSoi" => $this->param->getParam("masoi"));
        $kh = new Model_Loaivai();
        $kh->update_data($maloaivai, $data);
        echo "<script>window.location.href='" . HOST_PROJECT . "/index/xem/loaivai/true';</script>";
    } else {
        echo $fupdate;
        echo "<div class='message'>";
        foreach ($check->messages as $item) {
            echo $item . "<br/>";
        }
        echo "</div>";
    }
} else {
    echo $fupdate;
}
Esempio n. 6
0
<?php

echo $this->headMeta();
echo $this->headLink();
$masoi = $this->param->getParam('masoi');
$lv = new Model_Loaivai();
$loaivai = $lv->getWhere_loaisoi($masoi);
if ($loaivai) {
    echo "<div class='long_message'>";
    echo "Không thể xóa loại sợi đã được dùng để dệt vải!";
    echo "</div>";
} else {
    $loaisoi = new Model_Loaisoi();
    $loaisoi->delete_loaisoi($masoi);
    echo "<script>window.location.href='" . HOST_PROJECT . "/index/xem/loaisoi/true';</script>";
}
Esempio n. 7
0
<?php

echo $this->headMeta();
echo $this->headLink();
$form = new Form_Loaivai();
//-----------
if ($this->param->isPost()) {
    $param = $this->param->getPost();
    $check = new Form_Valid_Loaivai($param);
    if ($check->valid($param)) {
        $data = new My_Data();
        if (!$data->isDupNameLoaiVai($this->param->getPost("tenloaivai"))) {
            $data = array("MaLoaiVai" => null, "TenLoaiVai" => $this->param->getPost("tenloaivai"), "MaSoi" => $this->param->getPost("masoi"));
            $tv = new Model_Loaivai();
            $tv->insert_loaivai($data);
            $_redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
            $_redirector->gotoUrl(HOST_PROJECT . "/index/xem/loaivai/true");
        } else {
            $form->populate($param);
            echo $form;
            echo "<div class='message'>";
            echo "Tên Loại Vải đã có";
            echo "</div>";
        }
    } else {
        $form->populate($param);
        echo $form;
        echo "<div class='message'>";
        foreach ($check->messages as $item) {
            echo $item . "<br/>";
        }
Esempio n. 8
0
 public function getKhomocDetail($makho)
 {
     $caymoc = new Model_Caymoc();
     $caymocall = $caymoc->getWhere_khomoc($makho);
     //         echo "<pre>";
     //         print_r($caymocall);
     //         echo "</pre>";
     $loaivai = new Model_Loaivai();
     $opkhomoc = array();
     foreach ($caymocall as $item) {
         $loaivairow = $loaivai->getWhere($item['MaVai']);
         $tenvai = $loaivairow['TenLoaiVai'];
         $sub = array('MaMoc' => $item['MaMoc'], 'TenVai' => $tenvai, 'SoMetVai' => $item['SoMetVai']);
         $opkhomoc[] = $sub;
     }
     return $opkhomoc;
 }
<?php

echo $this->headMeta();
echo $this->headLink();
$form = new Form_Formmoi_Donhang();
if ($this->param->isPost()) {
    $param = $this->param->getPost();
    $check = new Form_Valid_Donhang($param);
    if ($check->valid($param)) {
        $mydate = Zend_Locale_Format::getDate($this->param->getParam("ngaydathang"), array("date_format" => "dd.MM.yyyy"));
        $date_str = $mydate['year'] . "-" . $mydate['month'] . "-" . $mydate['day'];
        $mavai = $this->param->getParam("mavai");
        $sometvai = $this->param->getParam("sometvai");
        $vai = new Model_Loaivai();
        $loaivai = $vai->getWhere($mavai);
        $tongtien = $sometvai * $loaivai['Gia'];
        $data = array("MaDonHang" => null, "MaVai" => $mavai, "MaMau" => $this->param->getParam("mamau"), "NgayDat" => $date_str, "TienDatHang" => $tongtien, "SoMetVai" => $sometvai, "MaKhachHang" => $this->param->getParam("makhachhang"));
        $dh = new Model_Donhang();
        $dh->insert_donhang($data);
        $_redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
        $_redirector->gotoUrl(HOST_PROJECT . "/index/xem/donhang/true");
        //             if(array_key_exists('congty',$this->param->getParams()))
        //             {
        //                 $_redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
        //                 $_redirector->gotoUrl(HOST_PROJECT."/index/main/congty/true");
        //             }
        //             else if(!array_key_exists('option',$this->param->getParams()))
        //             {
        //                 $_redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
        //                 $_redirector->gotoUrl(HOST_PROJECT."/index/main/khachhang_detail/true/makhachhang/".$this->param->getParam("makhachhang"));
        //             }
Esempio n. 10
0
<?php

echo $this->headMeta();
echo $this->headLink();
$id_vai = $this->param->getParam('maloaivai');
$loaivai = new Model_Loaivai();
$cm = new Model_Caymoc();
$caymoc = $cm->getWhere_loaivai($id_vai);
if ($caymoc) {
    echo "<div class='long_message'>";
    echo "Không thể xóa Loại vải đã được dùng để dệt!";
    echo "</div>";
} else {
    $loaivai->delete_loaivai($id_vai);
    echo "<script>window.location.href='" . HOST_PROJECT . "/index/xem/loaivai/true';</script>";
}
Esempio n. 11
0
 public function getItemNameForContract($mahopdong)
 {
     $hd = new Model_Hopdong();
     $hopdong = $hd->getWhereIdHopDong($mahopdong);
     $options = array();
     $mau = new Model_Mau();
     $mau1 = $mau->getWhereIdMau($hopdong['MaMau']);
     $options['TenMau'] = $mau1['TenMau'];
     $dh = new Model_Donhang();
     $donhang = $dh->getWhere($hopdong['MaDonHang']);
     $options['TenDonHang'] = $donhang['TenDonHang'];
     $lv = new Model_Loaivai();
     $loaivai = $lv->getWhere($hopdong['MaLoaiVai']);
     $options['TenLoaiVai'] = $loaivai['TenLoaiVai'];
     $ncc = new Model_Nhacungcap();
     $ncc1 = $ncc->getWhere($hopdong['MaNhaCungCap']);
     $options['TenNhaCungCap'] = $ncc1['TenNhaCungCap'];
     return $options;
 }
            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;
$form = new Form_Formmoi_Chonkhotp();