Advertisement
Guest User

controllernya

a guest
Oct 23rd, 2014
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.46 KB | None | 0 0
  1. <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  2. class Qutation extends CI_Controller {
  3. public function __construct() {
  4. parent::__construct();
  5. $this->load->model('m_crud');
  6. }
  7.  
  8. public function index() {
  9. //$this->load->model('m_crud');
  10. //$data['judul'] = 'Data Barang';
  11. //$data['daftar'] = $this->m_crud->get_crud_all();
  12. $this->load->model('m_crud');
  13. $data['cs'] = $this->m_crud->get_crud_all_cus();
  14. $data['salespic'] =$this->m_crud->get_crud_all_salespic();
  15. $data['chasis'] =$this->m_crud->get_crud_all_chasis();
  16. $data['produk'] =$this->m_crud->get_crud_all_produk();
  17. $data['satuan'] =$this->m_crud->get_crud_all_stn();
  18. $this->load->view('sb/ok');
  19. $this->load->view('trx/quotation_view', $data);
  20. $this->load->view('sb/footer');
  21. }
  22.  
  23. function tambah() {
  24. $data = array(
  25. 'TxnQuotHdrID' => $this->input->post('TxnQuotHdrID'),
  26. 'TxnQuotHdrNo' => $this->input->post('TxnQuotHdrNo'),
  27. 'TxnQuotHdrNoRev' => $this->input->post('TxnQuotHdrNoRev'),
  28. 'TxnQuotHdrDate' => $this->input->post('TxnQuotHdrDate'),
  29. 'TxnQuotHdrRE' => $this->input->post('TxnQuotHdrRE'),
  30. 'TxnQuotHdrTermsTxt' => $this->input->post('TxnQuotHdrTermsTxt'),
  31. 'TxnQuotHdrDiscount' => $this->input->post('TxnQuotHdrDiscount'),
  32. 'TxnQuotHdrRemarks' => $this->input->post('TypeTrn'),
  33. 'TxnDrawHdrID' => $this->input->post('TxnDrawHdrID'),
  34. 'MstCustID' => $this->input->post('MstCustID'),
  35. 'MstSalesPICID' => $this->input->post('MstSalesPICID'),
  36. 'MstApprID' => $this->input->post('MstApprID'),
  37. 'MstEmp'=>$this->input->post('MstEmp')
  38.  
  39. );
  40. $this->db->insert('txnquothdr', $data);
  41.  
  42. $id = $this->db->insert_id($query);
  43. $kp2 = $this->input->post('TxnQuotHdrID');
  44. $data2[] = array();
  45. foreach($kp2 AS $c => $val){
  46. $data2[] = array(
  47. 'TxnQuotDtlID' => $_POST['TxnQuotDtlID'][$c],
  48. 'TxnQuotDtlNo' => $_POST['TxnQuotDtlNo'][$c],
  49. 'TxnQuotHdrNoRev' => $_POST['TxnQuotHdrNoRev'][$c],
  50. 'TxnQuotDtlQty' => $_POST['TxnQuotDtlQty'][$c],
  51. 'TxnQuotDtlUnitPrice' => $_POST['TxnQuotDtlUnitPrice'][$c],
  52. 'TxnQuotDtlDiscount' => $_POST['TxnQuotDtlDiscount'][$c],
  53. 'TxnQuotDtlDrawNo' => $_POST['TxnQuotDtlDrawNo'][$c],
  54. 'TxnQuotDtlDrawDate' => $_POST['TxnQuotDtlDrawDate'][$c],
  55. 'TxnQuotDtlRepair' => $_POST['TxnQuotDtlRepair'][$c],
  56. 'MstChasID' => $_POST['MstChasID'][$c],
  57. 'MstProductID' => $_POST['MstProductID'][$c],
  58. 'TxnQuotHdrID' => $_POST['TxnQuotHdrID'][$c],
  59. 'MstTypeOrderID' => $_POST['MstTypeOrderID'][$c],
  60. 'MstSatID' => $_POST['MstSatID'][$c],
  61. 'MstEmp' => $_POST['MstEmp'][$c]
  62.  
  63. );
  64. }
  65. $this->db->insert_batch('txnquotdtl', $data2);
  66. $id_detail = $this->db->insert_id();
  67.  
  68. redirect('qutation');
  69. }
  70. function form() {
  71. $this->load->view('tambah.php' );
  72. }
  73.  
  74. public function viewquo() {
  75. $this->load->model('m_crud');
  76. $data['quot'] =$this->m_crud->get_all_detailquo();
  77. $this->load->view('sb/ok');
  78. $this->load->view('master/quoview', $data);
  79. $this->load->view('sb/footer');
  80. }
  81.  
  82. public function detail_quo($id) {
  83. $this->load->model('m_crud');
  84. $data['quots'] =$this->m_crud->get_all_detailquos($id);
  85. $this->load->view('sb/ok');
  86. $this->load->view('master/detail_quo', $data);
  87. $this->load->view('sb/footer');
  88. }
  89.  
  90. }
  91. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement