
<?php 


	

include "common/config.php";






for($kode=1; $kode<2628; $kode++)
{
    
 $kode22  = mysql_fetch_array(mysql_query("select max(IFNULL(id_barcode,0))  as maxbarcode from barcode"));
	$maxbarcode = $kode22['maxbarcode'];
	if($maxbarcode == 0)
	{
		$maxbarcode = "000001";
	
	}
	else
	{
		$countbarcode = strlen($maxbarcode+1);
		$maxbarcode1 = $maxbarcode+1;
		if($countbarcode == 1)
		{
			$maxbarcode = '00000'.$maxbarcode1;
		}
		elseif($countbarcode == 2)
		{
			$maxbarcode = '0000'.$maxbarcode1;
		}
		elseif($countbarcode == 3)
		{
			$maxbarcode = '000'.$maxbarcode1;
		}
		elseif($countbarcode == 4)
		{
			$maxbarcode = '00'.$maxbarcode1;
		}
		elseif($countbarcode == 5)
		{
			$maxbarcode = '0'.$maxbarcode1;
		}
		else
		{
			$maxbarcode = $maxbarcode1;
		}
		
	}   
    
    
    
    
    
    
 $kode2="R".$kode;   
    
$insert = mysql_query("insert into inventory_rangka (kode_stock, barcodeno, status_stock, id_status, id_branch, id_supplier) values ('$kode2', '$maxbarcode', '1', '3', '1', '11')");
if($insert)
{
    $insert2 = mysql_query("insert into barcode (kode_stock) values ('$kode2')");

}

    
    
}



if($insert2)
{ echo "DONE"; }




/*
for ($x = 0; $x <= 10; $x++) {
    echo "The number is: $x <br>";
} 
*/

?>
	