<?php
session_name("AUTHENUSER");
session_start();
$USERNAME = $_SESSION['SES_USERNAME'];
if(!session_name("AUTHENUSER"))
	{
?>
						<script language="javascript">
						 alert("Waktu Login telah habis.Silahkan Login Kembali");
						document.location="index.php";
						</script>
<?php
	}
if(!$USERNAME)
	{
?>
						<script language="javascript">
						 alert("Harap Login Dahulu.");
						document.location="index.php";
						</script>
<?php
	}
	?>
	<?php include "common/config.php";
	include "include/head.php"; ?>
    <?php
	$act  = $_REQUEST['act'];
	
	?>
 <script type="text/javascript">

// JK Pop up image viewer script- By JavaScriptKit.com
// Visit JavaScript Kit (http://javascriptkit.com)
// for free JavaScript tutorials and scripts
// This notice must stay intact for use

var popbackground="white" //specify backcolor or background image for pop window
var windowtitle="Image Window"  //pop window title

function detectexist(obj){
return (typeof obj !="undefined")
}

function jkpopimage(imgpath, popwidth, popheight, textdescription){

function getpos(){
leftpos=(detectexist(window.screenLeft))? screenLeft+document.body.clientWidth/2-popwidth/2 : detectexist(window.screenX)? screenX+innerWidth/2-popwidth/2 : 0
toppos=(detectexist(window.screenTop))? screenTop+document.body.clientHeight/2-popheight/2 : detectexist(window.screenY)? screenY+innerHeight/2-popheight/2 : 0
if (window.opera){
leftpos-=screenLeft
toppos-=screenTop
}
}

getpos()
var winattributes='width='+popwidth+',height='+popheight+',resizable=yes,left='+leftpos+',top='+toppos
var bodyattribute=(popbackground.indexOf(".")!=-1)? 'background="'+popbackground+'"' : 'bgcolor="'+popbackground+'"'
if (typeof jkpopwin=="undefined" || jkpopwin.closed)
jkpopwin=window.open("","",winattributes)
else{
//getpos() //uncomment these 2 lines if you wish subsequent popups to be centered too
//jkpopwin.moveTo(leftpos, toppos)
jkpopwin.resizeTo(popwidth, popheight+30)
}
jkpopwin.document.open()
jkpopwin.document.write('<html><title>'+windowtitle+'</title><body '+bodyattribute+'><img src="'+imgpath+'" style="margin-bottom: 0.5em"></html>')
jkpopwin.document.close()
jkpopwin.focus()
}

</script>  
<body>
<?php include "include/head2.php"; ?>
<?php include "include/leftmenu.php"; ?>
<?php include "include/top.php"; ?>
   
  <h1><i class="icon-picture"></i> Photo Album</h1>
</div>


   <div class="main-content">
   
            <div class="widget">
            <div class="widget-content-white glossed">
                    <div class="padded">
                      <form role="form" class="form-horizontal" method="post" action="photoalbum.php?inventory=<?php echo $inventory; ?>&act=1">
                        <div class="form-group">
                            <label>Inventory</label>
                               <select name="inventory" id="inventory" class="form-control">
                              <option value="Diamond" <?php if($inventory == "Diamond") { ?> selected="selected" <?php } ?>>Diamond</option>
                              <option value="Gold" <?php if($inventory == "Gold") { ?> selected="selected" <?php } ?>>Gold</option>
                              <option value="LogamMulia" <?php if($inventory == "LogamMulia") { ?> selected="selected" <?php } ?>>LogamMulia</option>
                               <option value="ReadyItem" <?php if($inventory == "ReadyItem") { ?> selected="selected" <?php } ?>>ReadyItem</option>
                              <option value="Services" <?php if($inventory == "Services") { ?> selected="selected" <?php } ?>>Services</option>
                                <option value="Cincin" <?php if($inventory == "Cincin") { ?> selected="selected" <?php } ?>>Cincin</option>
                           <option value="Mastura" <?php if($inventory == "Mastura") { ?> selected="selected" <?php } ?>>Mastura</option>
                           <option value="Liontin" <?php if($inventory == "Liontin") { ?> selected="selected" <?php } ?>>Liontin</option>
                            <option value="Kerabu" <?php if($inventory == "Kerabu") { ?> selected="selected" <?php } ?>>Kerabu</option>
                           <option value="GKGR" <?php if($inventory == "GKGR") { ?> selected="selected" <?php } ?>>Gelang Kaku Gelang Rantai</option>
                           <option value="Rangka" <?php if($inventory == "Rangka") { ?> selected="selected" <?php } ?>>Rangka</option>
                            </select>
                        </div>
                    
                        <button class="btn btn-primary" type="submit">Submit</button>
                        <button class="btn btn-default" type="reset">Reset</button>
                      </form>
                    </div>
             </div>
               <div class="row">
                     <?php
					 if($act == 1) {
					$inventory  = $_REQUEST['inventory'];
				  $sql = mysql_query("select * from
								  (
								  select 'Diamond' as type,kode_stock,barcodeno,id_stock,id_supplier,id_branch,'' as picture from  inventory_diamond where status_stock=1 and id_status = 3
								  union all
								  select 'Gold' as type,kode_stock,barcodeno,id_stock,id_supplier,id_branch,picture from  inventory_gold  where status_stock=1 and id_status = 3
								  union all
								  select 'LogamMulia' as type,kode_stock,barcodeno,id_stock,id_supplier,id_branch,'' as picture from  inventory_logam  where status_stock=1 and id_status = 3
								  union all
								  
								  select 'ReadyItem' as type,kode_stock,barcodeno,id_stock,id_supplier,id_branch,picture from  inventory_readyitem  where status_stock=1 and id_status = 3
								   union all
									  select 'Cincin' as type,kode_stock,barcodeno,id_stock,id_supplier,id_branch,picture from  inventory_cincin  where status_stock=1  and id_status = 3							
									  union all
									  select 'Mastura' as type,kode_stock,barcodeno,id_stock,id_supplier,id_branch,picture from  inventory_mastura  where status_stock=1 and id_status = 3
									   union all
									  select 'Liontin' as type,kode_stock,barcodeno,id_stock,id_supplier,id_branch,picture from  inventory_liontin  where status_stock=1 and id_status = 3
									  union all
									  select 'Kerabu' as type,kode_stock,barcodeno,id_stock,id_supplier,id_branch,picture from  inventory_kerabu  where  status_stock=1 and id_status = 3
									  union all
										select 'GKGR' as type,kode_stock,barcodeno,id_stock,id_supplier,id_branch,picture from  inventory_gkgr  where status_stock=1 and id_status = 3
									  union all
									  select 'Rangka' as type,kode_stock,barcodeno,id_stock,id_supplier,id_branch,picture from  inventory_rangka  where status_stock=1 and id_status = 3) a
									inner join tbl_supplier c on a.id_supplier = c.id_supplier
									left join tbl_branch d on a.id_branch = d.id_branch and status_branch = 1
									where a.type = '$inventory'
								  order by a.id_stock");
			 
						while($fetch = mysql_fetch_array($sql))
						{
								$barcodeno = $fetch['barcodeno'];
								$kode_stock = $fetch['kode_stock'];
								$status = $fetch['status'];
								$type = $fetch['type'];
								$picture = $fetch['picture'];
						if($type == "Diamond")
						{
							//$certificate_name  = $fetch3['certificate_name'];
							$loc = "certificate/";
							$all = $loc.$certificate_name; 
						}
						elseif($type == "ReadyItem")
						{
							//$picture = $fetch3['picture'];
							$loc = "readyitem/";
							$all = $loc.$picture; 
						}
						elseif($type == "Cincin")
						{
							//$picture = $fetch3['picture'];
							$loc = "cincin/";
							$all = $loc.$picture; 
						}
						elseif($type == "Liontin")
						{
							//$picture = $fetch3['picture'];
							$loc = "liontin/";
							$all = $loc.$picture; 
						}
						elseif($type == "Mastura")
						{
							//$picture = $fetch3['picture'];
							$loc = "mastura/";
							$all = $loc.$picture; 
						}
						elseif($type == "Kerabu")
						{
							//$picture = $fetch3['picture'];
							$loc = "kerabu/";
							$all = $loc.$picture; 
						}
						elseif($type == "GKGR")
						{
							//$picture = $fetch3['picture'];
							$loc = "gkgr/";
							$all = $loc.$picture; 
						}
						elseif($type == "Rangka")
						{
							//$picture = $fetch3['picture'];
							$loc = "rangka/";
							$all = $loc.$picture; 
						}
						elseif($type == "Gold")
						{
							//$picture = $fetch3['picture'];
							$loc = "gold/";
							$all = $loc.$picture; 
						}
								
					?>
                    
                        
                            <div class="col-lg-3 col-md-4 col-sm-6 text-center">
                              <div class="widget-content-blue-wrapper changed-up">
                                <div class="widget-content-blue-inner padded">
                                  <div class="pre-value-block"><a href="detailsphoto.php?type=<?php echo $type; ?>&kode_stock=<?php echo $kode_stock; ?>" onClick="javascript:void window.open('detailsphoto.php?type=<?php echo $type; ?>&kode_stock=<?php echo $kode_stock; ?>','1400404854683','width=300,height=300,toolbar=0,menubar=0,location=0,status=1,scrollbars=1,resizable=1,left=0,top=0');return false;"><?php echo $kode_stock; ?></a></div>
                                  <div class="value-block">
                                    <div class="value-self"> <a class="image" href="<?php echo $all; ?>" onClick="jkpopimage('<?php echo $all;?>', 640, 480); return false" >
							<img src="<?php echo $all; ?>" alt="" height="60" width="60"/></a></div>
                                  </div>
                                </div>
                              </div>
                            </div>
                           
                       <?php
						}
			 			 }
						?>
                         </div>
                
            </div>
          </div>
        </div>
      </div>

    </div>
  </div>
</div>       

<?php include "include/foot.php"; ?>
<script src='assets/js/for_pages/dashboard.js'></script>
</body>

</html>