Beispiel #1
0
 public function createForm($idkhosoi)
 {
     $ks = new Model_Khosoi();
     $khosoirow = $ks->getWhere($idkhosoi);
     $this->setDisableLoadDefaultDecorators(true);
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'formmoi/caymoc_layout.phtml')), 'Form'));
     $data = new My_Data();
     $loaisoi = new Model_Loaisoi();
     $loaisoirow = $loaisoi->getWhere($khosoirow['MaSoi']);
     $kho = new Model_Khohang();
     $khohang = $kho->getWhere($khosoirow['MaKho']);
     $opvai = $data->getOpLoaiVaiWithIdSoi($khosoirow['MaSoi']);
     $khosoi = $this->createElement('text', 'makho', array('decorators' => array('ViewHelper')));
     $loaisoi = $this->createElement('text', 'masoi', array('decorators' => array('ViewHelper')));
     $sokgsoi = $this->createElement('text', 'sokgsoi', array('decorators' => array('ViewHelper')));
     $loaivai = $this->createElement('select', 'mavai', array('multioptions' => $opvai, 'decorators' => array('ViewHelper')));
     $sometvai = $this->createElement('text', 'sometvai', array('decorators' => array('ViewHelper')));
     $them = $this->createElement('submit', 'them', array('decorators' => array('ViewHelper'), 'label' => 'Thêm'));
     $khosoi->setAttrib('class', 'formEdit')->setValue($khohang['TenKho']);
     $loaisoi->setAttrib('class', 'formEdit')->setValue($loaisoirow['TenSoi']);
     $loaivai->setAttrib('class', 'formEdit')->setAttrib('id', 'idvai');
     $sokgsoi->setAttrib('class', 'smallfield');
     $sometvai->setAttrib('class', 'formEdit');
     $this->addElement($loaisoi)->addElement($loaivai)->addElement($sometvai)->addElement($sokgsoi)->addElement($khosoi)->addElement($them);
 }
 public function createForm($id_loaisoi)
 {
     $ls = new Model_Loaisoi();
     $loaisoi = $ls->getWhere($id_loaisoi);
     $this->setDisableLoadDefaultDecorators(true);
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'form/loaisoi_layout.phtml')), 'Form'));
     $tenloaisoi = $this->createElement('text', 'tenloaisoi', array('decorators' => array('ViewHelper')));
     $them = $this->createElement('submit', 'them', array('decorators' => array('ViewHelper'), 'label' => 'Chỉnh Sửa'));
     $tenloaisoi->setAttrib('class', 'formEdit')->setValue($loaisoi['TenSoi']);
     $this->addElement($tenloaisoi)->addElement($them);
 }
 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);
 }
 public function init()
 {
     $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' => 'Thêm'));
     $masoi->setAttrib('class', 'formEdit');
     $this->addElement($tenloaivai)->addElement($masoi)->addElement($them);
     //         $this->addElement('submit', 'nhap', array(
     //                 'decorators' => array(
     //                         'ViewHelper'
     //                 ),
     //                 'label' => 'Nhập'
     //         ));
 }
<?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>";
}
<?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>";
}
 public function getOpHopdong($masoi, $makho, $mancc)
 {
     $op = array();
     $soi = new Model_Loaisoi();
     $loaisoi = $soi->getWhere($masoi);
     $op['tensoi'] = $loaisoi['TenSoi'];
     $kho = new Model_Khohang();
     $khohang = $kho->getWhere($makho);
     $op['tenkho'] = $khohang['TenKho'];
     $ncc = new Model_Nhacungcap();
     $myncc = $ncc->getWhere($mancc);
     $op['tenncc'] = $myncc['TenNhaCungCap'];
     return $op;
 }
<?php

echo $this->headMeta();
echo $this->headLink();
$ls = new Model_Loaisoi();
$loaisoiall = $ls->getAll();
if ($loaisoiall) {
    $maincontent = array();
    $title = array("Tên Sợi", "Chỉnh Sửa");
    $data = new My_Data();
    foreach ($loaisoiall as $loaisoi) {
        $content = array($loaisoi['TenSoi'], '<a href="' . HOST_PROJECT . "/index/chinhsua/loaisoi/true/masoi/" . $loaisoi['MaSoi'] . '/">Sửa</a>&nbsp|&nbsp' . '<a href="' . HOST_PROJECT . "/index/xoa/loaisoi/true/masoi/" . $loaisoi['MaSoi'] . '/option/caymoc/" onclick="return confirm(' . "'bạn có chắc muốn xóa ?'" . ')">Xóa</a>');
        $maincontent[] = $content;
    }
    $table = $data->createTable($title, $maincontent, "300px");
    echo $table;
} else {
    echo "<div class='message'>";
    echo "Chưa tồn tại Loại Sợi";
    echo "</div>";
}
<?php

echo $this->headMeta();
echo $this->headLink();
$form = new Form_Formmoi_Xemkhosoi();
if ($this->param->isPost()) {
    $param = $this->param->getPost();
    $form->populate($param);
    echo $form;
    $makhohang = $this->param->getParam("mykhohang");
    $khosoi = new Model_Khosoi();
    $khosoiall = $khosoi->getWhere_khohang($makhohang);
    $data = new My_Data();
    $loaisoi = new Model_Loaisoi();
    $title = array("Loại Sợi", "Số tấn sợi", "Chọn");
    $content = array();
    foreach ($khosoiall as $item) {
        $button = "<a class ='thembutton' href='" . HOST_PROJECT . "/index/xem/caymoc/true/option/them/makhoisoi/" . $item['MaKhoSoi'] . "/'/>Chọn</a>";
        $loaisoirow = $loaisoi->getWhere($item['MaSoi']);
        $subcontent = array($loaisoirow['TenSoi'], $item['SoTanSoi'], $button);
        $content[] = $subcontent;
    }
    $query = $data->createTable($title, $content, "300px");
    ?>
        <h1 class="title">Chọn Nguyên Liệu</h1>
        <?php 
    echo $query;
} else {
    echo $form;
}
Beispiel #10
0
<?php

echo $this->headMeta();
echo $this->headLink();
$masoi = $this->param->getParam('masoi');
$fupdate = new Form_Update_Loaisoi();
$fupdate->createForm($masoi);
if ($this->param->isPost()) {
    $param = $this->param->getPost();
    $check = new Form_Valid_Loaisoi($param);
    if ($check->valid($param)) {
        $data = array("MaSoi" => $masoi, "TenSoi" => $this->param->getParam("tenloaisoi"));
        $kh = new Model_Loaisoi();
        $kh->update_data($masoi, $data);
        echo "<script>window.location.href='" . HOST_PROJECT . "/index/xem/loaisoi/true';</script>";
    } else {
        echo $fupdate;
        echo "<div class='message'>";
        foreach ($check->messages as $item) {
            echo $item . "<br/>";
        }
        echo "</div>";
    }
} else {
    echo $fupdate;
}
Beispiel #11
0
<?php

echo $this->headMeta();
echo $this->headLink();
$form = new Form_Loaisoi();
//-----------
if ($this->param->isPost()) {
    $param = $this->param->getPost();
    echo "<pre>";
    print_r($param);
    echo "</pre>";
    $check = new Form_Valid_Loaisoi($param);
    //-----------
    if ($check->valid($param)) {
        $data = array("MaSoi" => null, "TenSoi" => $this->param->getPost("tenloaisoi"));
        $tv = new Model_Loaisoi();
        $tv->insert_loaisoi($data);
        echo "<div class='message'>";
        echo "Them thanh cong";
        echo "</div>";
        $_redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
        $_redirector->gotoUrl(HOST_PROJECT . "/index/xem/loaisoi/true");
    } else {
        $form->populate($param);
        echo $form;
        echo "<div class='message'>";
        foreach ($check->messages as $item) {
            echo $item . "<br/>";
        }
        echo "</div>";
    }