View difference between Paste ID: gguHTqcz and q1VNPFs3
SHOW: | | - or go back to the newest paste.
1-
model:
1+
model:<?php
2
function lihat_outlet1($id_callsheet)
3
     {
4
        
5
		
6-
		$coba = $this->db->query("select * from tabel_callsheet a, tabel_rute b, tabel_outlet c, tabel_tipe_outlet d, tabel_callsheet_outlet e, tabel_brand f 
6+
		$coba0 = $this->db->query("select * from tabel_callsheet a, tabel_rute b, tabel_outlet c, tabel_tipe_outlet d, tabel_callsheet_outlet e, tabel_brand f 
7
		where a.id_rute=b.id_rute and b.id_rute=c.id_rute and c.id_tipe_outlet=d.id_tipe_outlet and a.id_callsheet=e.id_callsheet and e.id_brand=f.id_brand and 
8-
		e.id_outlet=c.id_outlet and a.id_callsheet='".$id_callsheet."' group by c.id_outlet")->row_array();
8+
		e.id_outlet=c.id_outlet and a.id_callsheet='".$id_callsheet."' group by c.id_outlet")->result_array();
9
		foreach($coba0 as $coba){
10-
		$detail = $this->db->query("select * from tabel_callsheet_outlet a, tabel_brand b where a.id_brand=b.id_brand and a.id_callsheet='".$coba['id_callsheet']."'
10+
		$detail[] = $this->db->query("select * from tabel_callsheet_outlet a, tabel_brand b where a.id_brand=b.id_brand and a.id_callsheet='".$coba['id_callsheet']."'
11
		and a.id_outlet='".$coba['id_outlet']."'");
12
		}
13
		return $detail;
14-
14+
15
?>
16
controller:
17
<?php 
18
public function input_callsheet($id_callsheet) 
19
	{
20
		$id_callsheet= $this->uri->segment(3);
21
		$this->load->model("model_brand",'',TRUE);
22
		$data['brand']=$this->model_brand->lihat();
23
		$data['notasi']=$this->model_brand->lihat();
24
		
25
		
26
		$this->load->model("model_callsheet");
27
		$data['callsheet'] = $this->model_callsheet->lihat_data($id_callsheet);
28
		$data['outlet']= $this->model_callsheet->lihat_outlet($id_callsheet);
29
		$data['detail']= $this->model_callsheet->lihat_outlet1($id_callsheet);
30
		
31
		$data['title']="PT. Surya Mustika Lampung";
32
		$data['user']=$this->session->userdata('username');
33
		$data['level']=$this->session->userdata('level');
34
	
35-
35+
36
	}
37-
<table width="200%">
37+
?>
38
view:
39
 <table width="200%">
40
		<tr align="center">
41
			<td width="1%" rowspan="2"><b>OPTION</b></td>
42
			<td width="1%" rowspan="2"><b>NO</b></td>
43
			<td width="2%" rowspan="2"><b>KODE OUTLET</b></td>
44
			<td width="5%" rowspan="2"><b>NAMA OUTLET</b></td>
45
			<td width="8%" rowspan="2"><b>ALAMAT</b></td>
46
			<td width="2%" rowspan="2"><b>TIPE OUTLET</b></td>
47
			<?php foreach($brand->result_array() as $brand){?>
48
			<td width="8%" Colspan="4" align="center"><?php echo $brand['nama_brand'];?></td>
49
			<?php } ?>
50
		</tr>
51
		<tr align="center">
52
		<?php foreach($notasi->result_array() as $notasi){?>
53
			<td width="2%">STOCK</td>
54
			<td width="2%">BUY</td>
55
			<td width="2%">NOTE</td>
56
			<td width="2%">VIS</td>
57
		<?php } ?>
58
		</tr>
59
		<?php
60
		foreach($outlet->result_array() as $outlet){
61
		$i++;
62
		?>
63
		<tr>
64
			<td align="center"><img src="<?php echo base_url();?>asset/images/tambah.gif" onclick="window.open('<?php echo base_url();?>callsheet/isi_data/<?php echo $tampil['id_callsheet'];?>/<?php echo $outlet['id_outlet'];?>', 'winpopup', 'toolbar=yes,statusbar=yes,menubar=yes,resizable=yes,scrollbars=yes,width=1200,height=800');" style="cursor:pointer"></td>
65
			<td align="center"><?php echo $i;?></td>
66
			<td><?php echo $outlet['kode_outlet'];?></td>
67
			<td><?php echo $outlet['nama_outlet'];?></td>
68
			<td><?php echo $outlet['alamat_outlet'];?></td>
69-
		foreach($detail->result_array() as $a){
69+
70
		<?php
71
		foreach($detail as $detail1){
72
//->result_array() as $a){
73
		$a=$detail1->result_array();
74
		?>	
75
			<td align="center"><?php echo $a['stock_outlet'];?></td>
76
			<td align="center"><?php echo $a['buy_outlet'];?></td>
77
			<td align="center"><?php echo $a['notasi_outlet'];?></td>
78
			<td align="center"><?php echo $a['visibility_outlet'];?></td>
79
		<?php } ?>	
80
		</tr>
81
		
82
		<?php } ?>
83
		</table>