<?php
session_start();
include '../db_connect.php';
$ms_type='';
if(isset($_POST['ms_type'])&&!empty($_POST['ms_type']))
$ms_type=$_POST['ms_type'];

$fltselect='';
if(isset($_POST['fltselect'])&&!empty($_POST['fltselect']))
$fltselect=$_POST['fltselect'];

if($fltselect=="clt")
{
	$query = "";
	if($_POST['prodgencode']!='')
	$query = "where gencode = '$_POST[prodgencode]'";
$result = mysqli_query($con, "SELECT * FROM  `prodreg` $query  order by gencode");

echo "<table id='msview' width='2000' class='descrip' cellspacing='0'><thead><tr><th>Pro. Code</th><th>Gencode</th><th>Color</th><th>Description</th><th>Category</th><th >Sizesetcode</th><th >Stock</th><th >Reorder</th><th >Set</th><th >Unit</th><th >Ptotal</th><th >Pdiscount</th><th >Pamount</th><th >Vat</th><th >Gtotal</th><th ></th><th ></th></tr></thead>";

echo "<tr class='new_entry'><td style='display:none'><textarea name='id' class='id' placeholder='new record'></textarea></td><td><textarea name='code' class='code' placeholder='new record'></textarea></td><td><textarea name='gencode' class='gencode' placeholder='new record'></textarea></td><td><textarea name='color' class='color' placeholder='new record'></textarea></td><td><textarea name='desc' class='desc' placeholder='new record'></textarea></td><td ><textarea name='cat' class='cat' placeholder='new record'></textarea></td><td ><textarea name='sizesetcode' class='sizesetcode' placeholder='new record'></textarea></td><td ><textarea name='stock' class='stock' placeholder='new record'></textarea></td><td ><textarea name='reorder' class='reorder' placeholder='new record'></textarea></td><td ><textarea name='set' class='set' placeholder='new record'></textarea></td><td ><textarea name='unit' class='unit' placeholder='new record'></textarea></td><td ><textarea name='ptotal' class='ptotal' placeholder='new record'></textarea></td><td ><textarea name='pdiscount' class='pdiscount' placeholder='new record'></textarea></td><td ><textarea name='pnamount' class='pnamount' placeholder='new record'></textarea></td><td ><textarea name='vat' class='vat' placeholder='new record'></textarea></td><td ><textarea name='gtotal' class='gtotal' placeholder='new record'></textarea></td><td > <div> <input type='button'  id='prod_new' style='display:none' class='filter_table' value='Save' /></div></td><td width='5%'></td></tr>";
while($row = mysqli_fetch_array($result))
 echo "<tr><td style='display:none'><textarea name='id' class='id'>$row[id]</textarea></td><td><textarea name='code' class='code'>$row[code]</textarea></td><td><textarea name='gencode' class='gencode'>$row[gencode]</textarea></td><td><textarea name='color' class='color'>$row[color]</textarea></td><td><textarea name='desc' class='desc'>$row[desc]</textarea></td><td ><textarea name='cat' class='cat'>$row[cat]</textarea></td><td ><textarea name='sizesetcode' class='sizesetcode'>$row[sizesetcode]</textarea></td><td ><textarea name='stock' class='stock'>$row[stock]</textarea></td><td ><textarea name='reorder' class='reorder'>$row[reorder]</textarea></td><td ><textarea name='set' class='set'>$row[set]</textarea></td><td ><textarea name='unit' class='unit'>$row[unit]</textarea></td><td ><textarea name='ptotal' class='ptotal'>$row[ptotal]</textarea></td><td ><textarea name='pdiscount' class='pdiscount'>$row[pdiscount]</textarea></td><td ><textarea name='pnamount' class='pnamount'>$row[pnamount]</textarea></td><td ><textarea name='vat' class='vat'>$row[vat]</textarea></td><td ><textarea name='gtotal' class='gtotal'>$row[gtotal]</textarea></td><td > <div> <input type='button' class='filter_table prod_edit' style='display:none' class='filter_table' value='Save' /></div></td><td align='center' width='5%'><input type='button'    class='delete_product delete_row' value='X' /></td></tr>";
 
 
echo "</table>"; 
}

else if($fltselect=="led")
{
	$query = "";
	if($_POST['ledval']!='')
	$query = "where alias = '$_POST[ledval]'";	
$result = mysqli_query($con, "SELECT * FROM  `ledgerreg` $query order by id ");

	echo "<table id='msview' class='led' width='100%' cellspacing='0'><thead><tr><th >LEDGER</th><th >ALIAS</th><th >LEDTYPE</th><th >OPENINGBAL</th><th width='5%'></th><th width='5%'></th></tr></thead>";
//echo $row[det1'];
while($row = mysqli_fetch_array($result))
	{
		echo "<tr><td style='display:none'><textarea name='ID' class='ID'>$row[id]</textarea></td><td><textarea name='ledger' class='ledger'>$row[ledger]</textarea></td><td><textarea name='alias' class='alias'>$row[alias]</textarea></td><td><textarea name='ledtype' class='ledtype'>$row[ledtype]</textarea></td><td><textarea name='openingbal' class='openingbal'>$row[openingbal]</textarea></td><td width='5%'> <div> <input type='button' name='prod_save' id='led_master_edit' class='filter_table' style='display:none' value='Save' /></div></td><td align='center' width='5%'><input type='button'    class='delete_master_led delete_row' value='X' /></td></tr>";
		}
		
		echo "<tr class='new_entry'><td><textarea name='ledger' class='ledger' placeholder='new record'></textarea></td><td><textarea name='alias' class='alias' placeholder='new record'></textarea></td><td><textarea name='ledtype' class='ledtype' placeholder='new record'></textarea></td><td><textarea name='openingbal' class='openingbal'></textarea></td><td width='5%'> <div> <input type='button' name='prod_save' id='led_master_new' class='filter_table' style='display:none' value='Save' /></div></td><td width='5%'></td></tr>";
		
		echo "</table>";

}

else if($fltselect=="empinfo")
{
	
	$query = "";
	if($_POST['empinfoval']!='')
	$query = "where ECode = '$_POST[empinfoval]'";
	if($result=mysqli_query($con,"SELECT * FROM  `empinfo` $query order by EntryID"))
	{

	echo "<table id='msview' class='empinfo' width='2800' cellspacing='0'><thead><tr><th >ECode</th><th >Password</th><th >CMP</th><th >Name</th><th >DOB</th><th >Address</th><th >Age</th><th>EDEmployed</th><th >Designation</th><th >Department</th><th >Status</th><th >Gender</th><th >CivilStatus</th>
	<th >ContactNumber</th><th >reptime</th><th >closetime</th><th >salary</th><th>holidays</th><th >other1</th><th >other2</th><th >HRA</th><th >Conveyance</th><th >Medical</th><th >Bonus</th><th>basicsalary</th><th >otallowance</th><th >daallowance</th><th >cpf</th><th >clic</th><th >epf</th><th >elic</th><th >pTax</th><th width='3%'></th><th width='1%'></th></tr></thead>";
	
	while($row=mysqli_fetch_array($result))
	{
		echo "<tr><td style='display:none'><textarea name='EntryID'>$row[EntryID]</textarea></td><td><a href='masterempinfoedit.php?EntryID=$row[EntryID]' onClick='positionedPopup(this.href,650,500);return false'><textarea name='ECode' class='ECode'>$row[ECode]</textarea></a></td><td><input type='password' name='password' class='pwd nocaps' style='height:100%' value='$row[password]'/></td><td><textarea name='CMP' class='CMP'>$row[CMP]</textarea></td><td><textarea name='EName' class='EName' >$row[EName]</textarea></td><td><textarea name='EBdate' class='EBdate'>$row[EBdate]</textarea></td><td><textarea name='EAddress' class='EAddress'>$row[EAddress]</textarea></td><td><textarea name='EAge' class='EAge'>$row[EAge]</textarea></td><td><textarea name='EDEmployed' class='EDEmployed'>$row[EDEmployed]</textarea></td><td><textarea name='Designation' class='Designation'>$row[Designation]</textarea></td><td><textarea name='Department' class='Department'>$row[Department]</textarea></td><td><textarea name='Status' class='Status'>$row[Status]</textarea></td><td><textarea name='EGender' class='EGender'>$row[EGender]</textarea></td><td><textarea name='ECivilStatus' class='ECivilStatus'>$row[ECivilStatus]</textarea></td>
		
		<td><textarea name='ContactNumber' class='ContactNumber'>$row[ContactNumber]</textarea></td><td><textarea name='reptime' class='reptime'>$row[reptime]</textarea></td><td><textarea name='closetime' class='closetime'  >$row[closetime]</textarea></td><td><textarea name='salary' class='salary'>$row[salary]</textarea></td><td><textarea name='holidays' class='holidays'>$row[holidays]</textarea></td><td><textarea name='other1' class='other1'>$row[other1]</textarea></td><td><textarea name='other2' class='other2'>$row[other2]</textarea></td><td><textarea name='HRA' class='HRA'>$row[HRA]</textarea></td><td><textarea name='Conveyance' class='Conveyance'>$row[Conveyance]</textarea></td><td><textarea name='Medical' class='Medical'>$row[Medical]</textarea></td><td><textarea name='Bonus' class='Bonus'>$row[Bonus]</textarea></td><td><textarea name='basicsalary' class='basicsalary'>$row[basicsalary]</textarea></td>
		
		<td><textarea name='otallowance' class='otallowance'>$row[otallowance]</textarea></td><td><textarea name='daallowance' class='daallowance'>$row[daallowance]</textarea></td><td><textarea name='cpf' class='cpf'  >$row[cpf]</textarea></td><td><textarea name='clic' class='clic'>$row[clic]</textarea></td><td><textarea name='epf' class='epf'>$row[epf]</textarea></td><td><textarea name='elic' class='elic'>$row[elic]</textarea></td><td><textarea name='pTax' class='pTax'>$row[pTax]</textarea></td>
		
		
		<td width='3%'> <div> <input type='button' name='prod_save' id='empinfo_master_edit' class='button' style='display:none' value='Save' /></div></td><td align='center' width='1%'><input type='button'    class='delete_master_empinfo delete_row' value='X' /></td></tr>";
		}
		
				echo "<tr><td style='display:none'><textarea name='EntryID'></textarea></td><td><a href='masterempinfoedit.php' onClick='positionedPopup(this.href,650,500);return false'><textarea name='ECode' class='ECode'></textarea></a></td><td><textarea name='CMP' class='CMP'></textarea></td><td><input type='password' name='password' class='pwd nocaps' style='height:100%'/></td><td><textarea name='EName' class='EName' ></textarea></td><td><textarea name='EBdate' class='EBdate'></textarea></td><td><textarea name='EAddress' class='EAddress'></textarea></td><td><textarea name='EAge' class='EAge'></textarea></td><td><textarea name='EDEmployed' class='EDEmployed'></textarea></td><td><textarea name='Designation' class='Designation'></textarea></td><td><textarea name='Department' class='Department'></textarea></td><td><textarea name='Status' class='Status'></textarea></td><td><textarea name='EGender' class='EGender'></textarea></td><td><textarea name='ECivilStatus' class='ECivilStatus'></textarea></td>
		
		<td><textarea name='ContactNumber' class='ContactNumber'></textarea></td><td><textarea name='reptime' class='reptime'></textarea></td><td><textarea name='closetime' class='closetime'  ></textarea></td><td><textarea name='salary' class='salary'></textarea></td><td><textarea name='holidays' class='holidays'></textarea></td><td><textarea name='other1' class='other1'></textarea></td><td><textarea name='other2' class='other2'></textarea></td><td><textarea name='HRA' class='HRA'></textarea></td><td><textarea name='Conveyance' class='Conveyance'></textarea></td><td><textarea name='Medical' class='Medical'></textarea></td><td><textarea name='Bonus' class='Bonus'></textarea></td><td><textarea name='basicsalary' class='basicsalary'></textarea></td>
		
		<td><textarea name='otallowance' class='otallowance'></textarea></td><td><textarea name='daallowance' class='daallowance'></textarea></td><td><textarea name='cpf' class='cpf'  ></textarea></td><td><textarea name='clic' class='clic'></textarea></td><td><textarea name='epf' class='epf'></textarea></td><td><textarea name='elic' class='elic'></textarea></td><td><textarea name='pTax' class='pTax'></textarea></td>
		
		
		<td width='3%'> <div> <input type='button' name='prod_save' id='empinfo_master_new' class='button' style='display:none' value='Save' /></div></td><td align='center' width='1%'><input type='button'    class='delete_master_empinfo delete_row' value='X' /></td></tr>";
		
		echo "</table>";

	
	}
	else 
	echo "Error:".mysqli_error($con);
}
 else if($fltselect=="Row")
{
    $query = "";
	if($_POST['rowval']!='')
	$query = "where code = '$_POST[rowval]'";	
	
$result = mysqli_query($con, "SELECT `entryid`, `code`,`skuid`,`category`, `desc`,`color`, `size`, `agent`, `qty`, `unit`, `psrate`, `pamount`, `remarks`  FROM `rawmatreg` $query ");

	echo "<table id='msview' class='led' width='100%' cellspacing='0'><thead><tr><th >Rmcode</th><th >Skuid</th><th >Category</th><th >Description</th><th >Color</th><th >Size</th><th >Qty</th><th >Unit</th><th >Rate</th><th >Amount</th><th width='5%'></th><th width='5%'></th></tr></thead>";
//echo $row[det1'];
while($row = mysqli_fetch_array($result))
	{
		echo "<tr><td style='display:none'><textarea name='entryid' class='entryid'>$row[entryid]</textarea></td><td><textarea name='code' class='code'>$row[code]</textarea></td><td><textarea name='skuid' class='skuid'>$row[skuid]</textarea></td><td><textarea name='cate' class='cate'>$row[category]</textarea></td><td><textarea name='desc' class='desc'>$row[desc]</textarea></td><td><textarea name='color' class='color'>$row[color]</textarea></td><td><textarea name='size' class='size'>$row[size]</textarea></td><td><textarea name='qty' class='qty'>$row[qty]</textarea></td><td><textarea name='unit' class='unit'>$row[unit]</textarea></td><td><textarea name='psrate' class='psrate'>$row[psrate]</textarea></td><td><textarea name='pamount' class='pamount'>$row[pamount]</textarea></td><td width='5%'> <div> <input type='button' name='rawmat_edit' id='rawmat_edit' class='filter_table' style='display:none' value='Save' /></div></td><td align='center' width='5%'><input type='button'    class='delete_master delete_row' value='X' /></td></tr>";
		}
		
		echo "<tr class='new_entry'><td><textarea name='code' class='code' placeholder='new record'></textarea></td><td><textarea name='skuid' class='skuid' placeholder='new record'></textarea></td><td><textarea name='cate' class='cate' placeholder='new record'></textarea></td><td><textarea name='desc' class='desc' placeholder='new record'></textarea></td><td><textarea name='color' class='color' placeholder='new record'></textarea></td><td><textarea name='size' class='size' placeholder='new record'></textarea></td><td><textarea name='qty' class='qty' placeholder='new record'></textarea></td><td><textarea name='unit' class='unit'></textarea></td><td><textarea name='psrate' class='psrate'></textarea></td><td><textarea name='pamount' class='pamount'></textarea></td><td width='5%'> <div> <input type='button' name='rawmat_new' id='rawmat_new' class='filter_table' style='display:none' value='Save' /></div></td><td width='5%'></td></tr>";
		
		echo "</table>";

}

else if($ms_type=="veh")
{
$result = mysqli_query($con, "SELECT * 
FROM  `master` 
WHERE  `mstype` LIKE  '$ms_type'");

echo "<table id='msview' width='100%' class='veh' cellspacing='0'><thead><tr><th>MSTYPE</th><th>CODE</th><th>VEHICLE</th><th>CATEGORY</th><th width='5%'></th><th width='5%'></th></tr></thead>";
//echo $row[det1'];
while($row = mysqli_fetch_array($result))
 echo "<tr><td style='display:none'><textarea name='entryid' class='entryid'>$row[entryid]</textarea></td><td><textarea name='mstype' class='mstype'>$row[mstype]</textarea></td><td><textarea name='code' class='code'>$row[code]</textarea></td><td><textarea name='desc' class='desc'>$row[desc]</textarea></td><td><textarea name='det1' class='det1'>$row[det1]</textarea></td><td width='5%'> <div> <input type='button'  id='master_edit' style='display:none' class='filter_table' value='Save' /></div></td><td align='center' width='5%'><input type='button'    class='delete_master delete_row' value='X' /></td></tr>";
 
  echo "<tr class='new_entry'><td style='display:none'><textarea name='entryid' class='entryid' placeholder='new record'></textarea></td><td><textarea name='mstype' class='mstype'>VEH</textarea></td><td><textarea name='code' class='code' placeholder='new record'></textarea></td><td><textarea name='desc' class='desc' placeholder='new record'></textarea></td><td><textarea name='det1' class='det1'></textarea></td><td width='5%'> <div> <input type='button'  id='master_new' style='display:none' class='filter_table' value='Save' /></div></td><td width='5%'></td></tr>";
 echo "</table>"; 

}

else if($ms_type=="color")
{
$result = mysqli_query($con, "SELECT * 
FROM  `master` 
WHERE  `mstype` LIKE  '$ms_type'");

echo "<table id='msview' width='100%' class='color' cellspacing='0'><thead><tr><th>MSTYPE</th><th>CODE</th><th>Color</th><th>CATEGORY</th><th width='5%'></th><th width='5%'></th></tr></thead>";
//echo $row[det1'];
while($row = mysqli_fetch_array($result))
 echo "<tr><td style='display:none'><textarea name='entryid' class='entryid'>$row[entryid]</textarea></td><td><textarea name='mstype' class='mstype'>$row[mstype]</textarea></td><td><textarea name='code' class='code'>$row[code]</textarea></td><td><textarea name='desc' class='desc'>$row[desc]</textarea></td><td><textarea name='det1' class='det1'>$row[det1]</textarea></td><td width='5%'> <div> <input type='button'  id='master_edit' style='display:none' class='filter_table' value='Save' /></div></td><td align='center' width='5%'><input type='button'    class='delete_master delete_row' value='X' /></td></tr>";
 
  echo "<tr class='new_entry'><td style='display:none'><textarea name='entryid' class='entryid' placeholder='new record'></textarea></td><td><textarea name='mstype' class='mstype'>COLOR</textarea></td><td><textarea name='code' class='code' placeholder='new record'></textarea></td><td><textarea name='desc' class='desc' placeholder='new record'></textarea></td><td><textarea name='det1' class='det1'></textarea></td><td width='5%'> <div> <input type='button'  id='master_new' style='display:none' class='filter_table' value='Save' /></div></td><td width='5%'></td></tr>";
 echo "</table>"; 

}


else if($ms_type=="engtyp")
{
$result = mysqli_query($con, "SELECT * 
FROM  `master` 
WHERE  `mstype` LIKE  '$ms_type'");

echo "<table id='msview' width='100%' class='engtyp' cellspacing='0'><thead><tr><th>MSTYPE</th><th>CODE</th><th>Engine Type</th><th>CATEGORY</th><th width='5%'></th><th width='5%'></th></tr></thead>";
//echo $row[det1'];
while($row = mysqli_fetch_array($result))
 echo "<tr><td style='display:none'><textarea name='entryid' class='entryid'>$row[entryid]</textarea></td><td><textarea name='mstype' class='mstype'>$row[mstype]</textarea></td><td><textarea name='code' class='code'>$row[code]</textarea></td><td><textarea name='desc' class='desc'>$row[desc]</textarea></td><td><textarea name='det1' class='det1'>$row[det1]</textarea></td><td width='5%'> <div> <input type='button'  id='master_edit' style='display:none' class='filter_table' value='Save' /></div></td><td align='center' width='5%'><input type='button'    class='delete_master delete_row' value='X' /></td></tr>";
 
  echo "<tr class='new_entry'><td style='display:none'><textarea name='entryid' class='entryid' placeholder='new record'></textarea></td><td><textarea name='mstype' class='mstype'>ENGTYP</textarea></td><td><textarea name='code' class='code' placeholder='new record'></textarea></td><td><textarea name='desc' class='desc' placeholder='new record'></textarea></td><td><textarea name='det1' class='det1'></textarea></td><td width='5%'> <div> <input type='button'  id='master_new' style='display:none' class='filter_table' value='Save' /></div></td><td width='5%'></td></tr>";
 echo "</table>"; 

}

else if($ms_type=="inc")
{
$result = mysqli_query($con, "SELECT * 
FROM  `master` 
WHERE  `mstype` LIKE  '$ms_type'");

echo "<table id='msview' width='100%' class='inc' cellspacing='0'><thead><tr><th>MSTYPE</th><th>CODE</th><th>Inc. Comp.</th><th>CATEGORY</th><th width='5%'></th><th width='5%'></th></tr></thead>";
//echo $row[det1'];
while($row = mysqli_fetch_array($result))
 echo "<tr><td style='display:none'><textarea name='entryid' class='entryid'>$row[entryid]</textarea></td><td><textarea name='mstype' class='mstype'>$row[mstype]</textarea></td><td><textarea name='code' class='code'>$row[code]</textarea></td><td><textarea name='desc' class='desc'>$row[desc]</textarea></td><td><textarea name='det1' class='det1'>$row[det1]</textarea></td><td width='5%'> <div> <input type='button'  id='master_edit' style='display:none' class='filter_table' value='Save' /></div></td><td align='center' width='5%'><input type='button'    class='delete_master delete_row' value='X' /></td></tr>";
 
  echo "<tr class='new_entry'><td style='display:none'><textarea name='entryid' class='entryid' placeholder='new record'></textarea></td><td><textarea name='mstype' class='mstype'>INC</textarea></td><td><textarea name='code' class='code' placeholder='new record'></textarea></td><td><textarea name='desc' class='desc' placeholder='new record'></textarea></td><td><textarea name='det1' class='det1'></textarea></td><td width='5%'> <div> <input type='button'  id='master_new' style='display:none' class='filter_table' value='Save' /></div></td><td width='5%'></td></tr>";
 echo "</table>"; 

}

else if($ms_type=="make")
{
$result = mysqli_query($con, "SELECT * 
FROM  `master` 
WHERE  `mstype` LIKE  '$ms_type'");

echo "<table id='msview' width='100%' class='make' cellspacing='0'><thead><tr><th>MSTYPE</th><th>CODE</th><th>MAKE</th><th>CATEGORY</th><th width='5%'></th><th width='5%'></th></tr></thead>";
//echo $row[det1'];
while($row = mysqli_fetch_array($result))
 echo "<tr><td style='display:none'><textarea name='entryid' class='entryid'>$row[entryid]</textarea></td><td><textarea name='mstype' class='mstype'>$row[mstype]</textarea></td><td><textarea name='code' class='code'>$row[code]</textarea></td><td><textarea name='desc' class='desc'>$row[desc]</textarea></td><td><textarea name='det1' class='det1'>$row[det1]</textarea></td><td width='5%'> <div> <input type='button'  id='master_edit' style='display:none' class='filter_table' value='Save' /></div></td><td align='center' width='5%'><input type='button'    class='delete_master delete_row' value='X' /></td></tr>";
 
  echo "<tr class='new_entry'><td style='display:none'><textarea name='entryid' class='entryid' placeholder='new record'></textarea></td><td><textarea name='mstype' class='mstype'>MAKE</textarea></td><td><textarea name='code' class='code' placeholder='new record'></textarea></td><td><textarea name='desc' class='desc' placeholder='new record'></textarea></td><td><textarea name='det1' class='det1'></textarea></td><td width='5%'> <div> <input type='button'  id='master_new' style='display:none' class='filter_table' value='Save' /></div></td><td width='5%'></td></tr>";
 echo "</table>"; 

}


else if($ms_type=="cty")
{
$result = mysqli_query($con, "SELECT * 
FROM  `master` 
WHERE  `mstype` LIKE  '$ms_type'");

echo "<table id='msview' width='100%' class='cty' cellspacing='0'><thead><tr><th>MSTYPE</th><th>CODE</th><th>CITY</th><th width='5%'></th><th width='5%'></th></tr></thead>";
//echo $row[det1'];
while($row = mysqli_fetch_array($result))
 echo "<tr><td style='display:none'><textarea name='entryid' class='entryid'>$row[entryid]</textarea></td><td><textarea name='mstype' class='mstype'>$row[mstype]</textarea></td><td><textarea name='code' class='code'>$row[code]</textarea></td><td><textarea name='desc' class='desc'>$row[desc]</textarea></td><td width='5%'> <div> <input type='button'  id='master_edit' style='display:none' class='filter_table' value='Save' /></div></td><td align='center' width='5%'><input type='button'    class='delete_master delete_row' value='X' /></td></tr>";
 
  echo "<tr class='new_entry'><td style='display:none'><textarea name='entryid' class='entryid' placeholder='new record'></textarea></td><td><textarea name='mstype' class='mstype'>CTY</textarea></td><td><textarea name='code' class='code' placeholder='new record'></textarea></td><td><textarea name='desc' class='desc' placeholder='new record'></textarea></td><td width='5%'> <div> <input type='button'  id='master_new' style='display:none' class='filter_table' value='Save' /></div></td><td width='5%'></td></tr>";
 echo "</table>"; 

}

else if($ms_type=="dsg")
{
$result = mysqli_query($con, "SELECT * 
FROM  `master` 
WHERE  `mstype` LIKE  '$ms_type'");

echo "<table id='msview' width='100%' class='dsg' cellspacing='0'><thead><tr><th>MSTYPE</th><th>CODE</th><th>DESIGNATION</th><th width='5%'></th><th width='5%'></th></tr></thead>";
//echo $row[det1'];
while($row = mysqli_fetch_array($result))
 echo "<tr><td style='display:none'><textarea name='entryid' class='entryid'>$row[entryid]</textarea></td><td><textarea name='mstype' class='mstype'>$row[mstype]</textarea></td><td><textarea name='code' class='code'>$row[code]</textarea></td><td><textarea name='desc' class='desc'>$row[desc]</textarea></td><td width='5%'> <div> <input type='button'  id='master_edit' style='display:none' class='filter_table' value='Save' /></div></td><td align='center' width='5%'><input type='button'    class='delete_master delete_row' value='X' /></td></tr>";
 
  echo "<tr class='new_entry'><td style='display:none'><textarea name='entryid' class='entryid' placeholder='new record'></textarea></td><td><textarea name='mstype' class='mstype'>DSG</textarea></td><td><textarea name='code' class='code' placeholder='new record'></textarea></td><td><textarea name='desc' class='desc' placeholder='new record'></textarea></td><td width='5%'> <div> <input type='button'  id='master_new' style='display:none' class='filter_table' value='Save' /></div></td><td width='5%'></td></tr>";
 echo "</table>"; 

}

else if($ms_type=="jtp")
{
$result = mysqli_query($con, "SELECT * FROM  `servicemst` ");

echo "<table id='msview' width='100%' class='jtp' cellspacing='0'><thead><tr><th>CODE</th><th>Description</th><th>Amount</th><th width='5%'></th><th width='5%'></th></tr></thead>";
//echo $row[det1'];
while($row = mysqli_fetch_array($result))
 echo "<tr><td style='display:none'><textarea name='entryid' class='entryid'>$row[entryid]</textarea></td><td><textarea name='code' class='code'>$row[code]</textarea></td><td><textarea name='desc' class='desc'>$row[desc]</textarea></td><td><textarea name='det' class='det'>$row[det]</textarea></td><td width='5%'> <div> <input type='button'  id='service_edit' style='display:none' class='filter_table service_edit' value='Save' /></div></td><td align='center' width='5%'><input type='button'    class='delete_serv_mas delete_row' value='X' /></td></tr>";
 
 echo "<tr class='new_entry'><td style='display:none'><textarea name='entryid' class='entryid' placeholder='new record'></textarea></td><td><textarea name='code' class='code' placeholder='new record'></textarea></td><td><textarea name='desc' class='desc' placeholder='new record'></textarea></td><td><textarea name='det' class='det' placeholder='new record'></textarea></td><td width='5%'> <div> <input type='button'  id='ser_master_new' style='display:none' class='filter_table' value='Save' /></div></td><td width='5%'></td></tr>";
 echo "</table>"; 

}
else if($ms_type=="dvr")
{
$result = mysqli_query($con, "SELECT * 
FROM  `master` 
WHERE  `mstype` LIKE  '$ms_type'");

echo "<table id='msview' width='100%' class='dvr' cellspacing='0'><thead><tr><th>MSTYPE</th><th>CODE</th><th>DRIVER NAME</th><th width='5%'></th><th width='5%'></th></tr></thead>";
//echo $row[det1'];
while($row = mysqli_fetch_array($result))
 echo "<tr><td style='display:none'><textarea name='entryid' class='entryid'>$row[entryid]</textarea></td><td><textarea name='mstype' class='mstype'>$row[mstype]</textarea></td><td><textarea name='code' class='code'>$row[code]</textarea></td><td><textarea name='desc' class='desc'>$row[desc]</textarea></td><td width='5%'> <div> <input type='button'  id='master_edit' style='display:none' class='filter_table' value='Save' /></div></td><td align='center' width='5%'><input type='button'    class='delete_master delete_row' value='X' /></td></tr>";
 
  echo "<tr class='new_entry'><td style='display:none'><textarea name='entryid' class='entryid' placeholder='new record'></textarea></td><td><textarea name='mstype' class='mstype'>DVR</textarea></td><td><textarea name='code' class='code' placeholder='new record'></textarea></td><td><textarea name='desc' class='desc' placeholder='new record'></textarea></td><td width='5%'> <div> <input type='button'  id='master_new' style='display:none' class='filter_table' value='Save' /></div></td><td width='5%'></td></tr>";
 echo "</table>"; 

}
else if($ms_type=="sub")
{
$result = mysqli_query($con, "SELECT * 
FROM  `master` 
WHERE  `mstype` LIKE  '$ms_type'");

echo "<table id='msview' width='100%' class='sub' cellspacing='0'><thead><tr><th>MSTYPE</th><th>CODE</th><th>SUBJECT</th><th width='5%'></th><th width='5%'></th></tr></thead>";
//echo $row[det1'];
while($row = mysqli_fetch_array($result))
 echo "<tr><td style='display:none'><textarea name='entryid' class='entryid'>$row[entryid]</textarea></td><td><textarea name='mstype' class='mstype'>$row[mstype]</textarea></td><td><textarea name='code' class='code'>$row[code]</textarea></td><td><textarea name='desc' class='desc'>$row[desc]</textarea></td><td width='5%'> <div> <input type='button'  id='master_edit' style='display:none' class='filter_table' value='Save' /></div></td><td align='center' width='5%'><input type='button'    class='delete_master delete_row' value='X' /></td></tr>";
 
  echo "<tr class='new_entry'><td style='display:none'><textarea name='entryid' class='entryid' placeholder='new record'></textarea></td><td><textarea name='mstype' class='mstype'>SUB</textarea></td><td><textarea name='code' class='code' placeholder='new record'></textarea></td><td><textarea name='desc' class='desc' placeholder='new record'></textarea></td><td width='5%'> <div> <input type='button'  id='master_new' style='display:none' class='filter_table' value='Save' /></div></td><td width='5%'></td></tr>";
 echo "</table>"; 
 

}
else if($ms_type=="mis")
{
$result = mysqli_query($con, "SELECT * 
FROM  `master` 
WHERE  `mstype` LIKE  '$ms_type'");

echo "<table id='msview' width='100%' class='mis' cellspacing='0'><thead><tr><th>MSTYPE</th><th>CODE</th><th>MISC TYPE</th><th width='5%'></th><th width='5%'></th></tr></thead>";
//echo $row[det1'];
while($row = mysqli_fetch_array($result))
 echo "<tr><td style='display:none'><textarea name='entryid' class='entryid'>$row[entryid]</textarea></td><td><textarea name='mstype' class='mstype'>$row[mstype]</textarea></td><td><textarea name='code' class='code'>$row[code]</textarea></td><td><textarea name='desc' class='desc'>$row[desc]</textarea></td><td width='5%'> <div> <input type='button'  id='master_edit' style='display:none' class='filter_table' value='Save' /></div></td><td align='center' width='5%'><input type='button'    class='delete_master delete_row' value='X' /></td></tr>";
  echo "<tr class='new_entry'><td style='display:none'><textarea name='entryid' class='entryid' placeholder='new record'></textarea></td><td><textarea name='mstype' class='mstype'>MIS</textarea></td><td><textarea name='code' class='code' placeholder='new record'></textarea></td><td><textarea name='desc' class='desc' placeholder='new record'></textarea></td><td width='5%'> <div> <input type='button'  id='master_new' style='display:none' class='filter_table' value='Save' /></div></td><td width='5%'></td></tr>";
 echo "</table>"; 

}
else if($ms_type=="dis")
{
$result = mysqli_query($con, "SELECT * 
FROM  `master` 
WHERE  `mstype` LIKE  '$ms_type'");

echo "<table id='msview' width='100%' class='dis' cellspacing='0'><thead><tr><th>MSTYPE</th><th>CODE</th><th>DISCLAIMER</th><th width='5%'></th><th width='5%'></th></tr></thead>";
//echo $row[det1'];
while($row = mysqli_fetch_array($result))
 echo "<tr><td style='display:none'><textarea name='entryid' class='entryid'>$row[entryid]</textarea></td><td><textarea name='mstype' class='mstype'>$row[mstype]</textarea></td><td><textarea name='code' class='code'>$row[code]</textarea></td><td><textarea name='desc' class='desc'>$row[desc]</textarea></td><td width='5%'> <div> <input type='button'  id='master_edit' style='display:none' class='filter_table' value='Save' /></div></td><td align='center' width='5%'><input type='button'    class='delete_master delete_row' value='X' /></td></tr>";
 
  echo "<tr class='new_entry'><td style='display:none'><textarea name='entryid' class='entryid' placeholder='new record'></textarea></td><td><textarea name='mstype' class='mstype'>DIS</textarea></td><td><textarea name='code' class='code' placeholder='new record'></textarea></td><td><textarea name='desc' class='desc' placeholder='new record'></textarea></td><td width='5%'> <div> <input type='button'  id='master_new' style='display:none' class='filter_table' value='Save' /></div></td><td width='5%'></td></tr>";
 echo "</table>"; 

}

else if($ms_type=="stp")
{
$result = mysqli_query($con, "SELECT * 
FROM  `master` 
WHERE  `mstype` LIKE  '$ms_type'");

echo "<table id='msview' width='100%' class='stp' cellspacing='0'><thead><tr><th>MSTYPE</th><th>CODE</th><th>TAX</th><th width='5%'></th><th width='5%'></th></tr></thead>";
//echo $row[det1'];
while($row = mysqli_fetch_array($result))
 echo "<tr><td style='display:none'><textarea name='entryid' class='entryid'>$row[entryid]</textarea></td><td><textarea name='mstype' class='mstype'>$row[mstype]</textarea></td><td><textarea name='code' class='code'>$row[code]</textarea></td><td><textarea name='desc' class='desc'>$row[desc]</textarea></td><td width='5%'> <div> <input type='button'  id='master_edit' style='display:none' class='filter_table' value='Save' /></div></td><td align='center' width='5%'><input type='button'    class='delete_master delete_row' value='X' /></td></tr>";
 
  echo "<tr class='new_entry'><td style='display:none'><textarea name='entryid' class='entryid' placeholder='new record'></textarea></td><td><textarea name='mstype' class='mstype'>STP</textarea></td><td><textarea name='code' class='code' placeholder='new record'></textarea></td><td><textarea name='desc' class='desc' placeholder='new record'></textarea></td><td width='5%'> <div> <input type='button'  id='master_new' style='display:none' class='filter_table' value='Save' /></div></td><td width='5%'></td></tr>";
 
 echo "</table>"; 

}
else if($ms_type=="typ")
{
$result = mysqli_query($con, "SELECT * 
FROM  `master` 
WHERE  `mstype` LIKE  '$ms_type'");

echo "<table id='msview' width='100%' class='typ' cellspacing='0'><thead><tr><th>MSTYPE</th><th>CODE</th><th>TYPE</th><th width='5%'></th><th width='5%'></th></tr></thead>";
//echo $row[det1'];
while($row = mysqli_fetch_array($result))
 echo "<tr><td style='display:none'><textarea name='entryid' class='entryid'>$row[entryid]</textarea></td><td><textarea name='mstype' class='mstype'>$row[mstype]</textarea></td><td><textarea name='code' class='code'>$row[code]</textarea></td><td><textarea name='desc' class='desc'>$row[desc]</textarea></td><td width='5%'> <div> <input type='button'  id='master_edit' style='display:none' class='filter_table' value='Save' /></div></td><td align='center' width='5%'><input type='button'    class='delete_master delete_row' value='X' /></td></tr>";
 
  echo "<tr class='new_entry'><td style='display:none'><textarea name='entryid' class='entryid' placeholder='new record'></textarea></td><td><textarea name='mstype' class='mstype'>TYP</textarea></td><td><textarea name='code' class='code' placeholder='new record'></textarea></td><td><textarea name='desc' class='desc' placeholder='new record'></textarea></td><td width='5%'> <div> <input type='button'  id='master_new' style='display:none' class='filter_table' value='Save' /></div></td><td width='5%'></td></tr>";
 echo "</table>"; 

}

else if($ms_type=="ptm")
{
$result = mysqli_query($con, "SELECT * 
FROM  `master` 
WHERE  `mstype` LIKE  '$ms_type'");

echo "<table id='msview' width='100%' class='ptm' cellspacing='0'><thead><tr><th>MSTYPE</th><th>CODE</th><th>PAY TERMS</th><th width='5%'></th><th width='5%'></th></tr></thead>";
//echo $row[det1'];
while($row = mysqli_fetch_array($result))
 echo "<tr><td style='display:none'><textarea name='entryid' class='entryid'>$row[entryid]</textarea></td><td><textarea name='mstype' class='mstype'>$row[mstype]</textarea></td><td><textarea name='code' class='code'>$row[code]</textarea></td><td><textarea name='desc' class='desc'>$row[desc]</textarea></td><td width='5%'> <div> <input type='button'  id='master_edit' style='display:none' class='filter_table' value='Save' /></div></td><td align='center' width='5%'><input type='button'    class='delete_master delete_row' value='X' /></td></tr>";
 
  echo "<tr class='new_entry'><td style='display:none'><textarea name='entryid' class='entryid' placeholder='new record'></textarea></td><td><textarea name='mstype' class='mstype'>PTM</textarea></td><td><textarea name='code' class='code' placeholder='new record'></textarea></td><td><textarea name='desc' class='desc' placeholder='new record'></textarea></td><td width='5%'> <div> <input type='button'  id='master_new' style='display:none' class='filter_table' value='Save' /></div></td><td width='5%'></td></tr>";
 echo "</table>"; 

}


else if($ms_type=="cmpmst")
{
	$qry_part='';
	if(isset($_POST[search_com])&&!empty($_POST[search_com]))
	{
		$qry_part= "where compid like '%$_POST[search_com]%'";
		}
	
$result = mysqli_query($con, "SELECT * FROM  `commst` $qry_part order by compid");

	echo "<table id='msview' class='cmpmst' width='100%' cellspacing='0'><thead><tr><th >COMPID</th><th >NAME</th><th >ADDRESS</th><th >CITY</th><th >GST OPTION</th><th >TELEPHONE</th><th >EMAIL</th><th >CONT. PERSON</th><th >TYPE</th><th width='5%'></th><th width='5%'></th></tr></thead>";
//echo $row[det1'];
while($row = mysqli_fetch_array($result))
	{
		echo "<tr><td style='display:none'><textarea name='ID' class='ID'>$row[id]</textarea></td><td><a href='mastercmpedit.php?ID=$row[id]' onClick='positionedPopup(this.href,700,600);return false'><textarea name='compid' class='compid'>$row[compid]</textarea></a></td><td><textarea name='name' class='name'>$row[name]</textarea></td><td><textarea name='address' class='address'>$row[address]</textarea></td><td><textarea name='city' class='city'>$row[cmpcity]</textarea></td><td><textarea name='incstax' class='incstax'>$row[incstax]</textarea></td><td><textarea name='telephone' class='telephone'>$row[telephone]</textarea></td><td><textarea name='email' class='email nocaps'>$row[email]</textarea></td><td><textarea name='conper' class='conper'>$row[conper]</textarea></td><td><textarea name='type' class='type'>$row[type]</textarea></td><td width='5%'> <div> <input type='button' name='prod_save' id='cmp_master_edit' class='filter_table' style='display:none' value='Save' /></div></td><td align='center' width='5%'><input type='button' class='delete_master_cmp delete_row' value='X' /></td></tr>";
		}
		
		echo "<tr class='new_entry'><td><a href='mastercmpedit.php' onClick='positionedPopup(this.href,700,600);return false'><textarea name='compid' class='compid' placeholder='new record'></textarea></a></td><td><textarea name='name' class='name' placeholder='new record'></textarea></td><td ><textarea name='address' class='address' placeholder='new record'></textarea></td><td><textarea name='city' class='city' placeholder='new record'></textarea></td><td><textarea name='incstax' class='incstax' placeholder='new record'></textarea></td><td><textarea name='telephone' class='telephone' placeholder='new record'></textarea></td><td><textarea name='email' class='email nocaps' placeholder='new record'></textarea></td><td><textarea name='conper' class='conper'></textarea></td><td><textarea name='type' class='type' placeholder='new record'></textarea></td><td width='5%'> <div> <input type='button' id='cmp_master_new' class='filter_table'  style='display:none' value='Save' /></div></td><td width='5%'></td></tr>";
		
		echo "</table>";

}

else if($ms_type=="consignee")
{
$qry_part='';
	if(isset($_POST[search_com])&&!empty($_POST[search_com]))
	{
		$qry_part= "and compid like '%$_POST[search_com]%'";
		}
	
$result = mysqli_query($con, "SELECT * FROM  `commst` where type = 'CONSIGNEE'  $qry_part  order by compid");

	echo "<table id='msview' class='cmpmst' width='100%' cellspacing='0'><thead><tr><th >COMPID</th><th >NAME</th><th >ADDRESS</th><th >CITY</th><th >GST OPTION</th><th >TELEPHONE</th><th >EMAIL</th><th >CONT. PERSON</th><th >TYPE</th><th width='5%'></th><th width='5%'></th></tr></thead>";
//echo $row[det1'];
while($row = mysqli_fetch_array($result))
	{
		echo "<tr><td style='display:none'><textarea name='ID' class='ID'>$row[id]</textarea></td><td><a href='mastercmpedit.php?ID=$row[id]' onClick='positionedPopup(this.href,700,600);return false'><textarea name='compid' class='compid'>$row[compid]</textarea></a></td><td><textarea name='name' class='name'>$row[name]</textarea></td><td><textarea name='address' class='address'>$row[address]</textarea></td><td><textarea name='city' class='city'>$row[cmpcity]</textarea></td><td><textarea name='incstax' class='incstax'>$row[incstax]</textarea></td><td><textarea name='telephone' class='telephone'>$row[telephone]</textarea></td><td><textarea name='email' class='email nocaps'>$row[email]</textarea></td><td><textarea name='conper' class='conper'>$row[conper]</textarea></td><td><textarea name='type' class='type'>$row[type]</textarea></td><td width='5%'> <div> <input type='button' name='prod_save' id='cmp_master_edit' class='filter_table' style='display:none' value='Save' /></div></td><td align='center' width='5%'><input type='button' class='delete_master_cmp delete_row' value='X' /></td></tr>";
		}
		
		echo "<tr class='new_entry'><td><a href='mastercmpedit.php?type=CONSIGNEE' onClick='positionedPopup(this.href,700,600);return false'><textarea name='compid' class='compid' placeholder='new record'></textarea></a></td><td><textarea name='name' class='name' placeholder='new record'></textarea></td><td ><textarea name='address' class='address' placeholder='new record'></textarea></td><td><textarea name='city' class='city' placeholder='new record'></textarea></td><td><textarea name='incstax' class='incstax' placeholder='new record'></textarea></td><td><textarea name='telephone' class='telephone' placeholder='new record'></textarea></td><td><textarea name='email' class='email nocaps' placeholder='new record'></textarea></td><td><textarea name='conper' class='conper'></textarea></td><td><textarea name='type' class='type' placeholder='new record'></textarea></td><td width='5%'> <div> <input type='button' id='cmp_master_new' class='filter_table'  style='display:none' value='Save' /></div></td><td width='5%'></td></tr>";
		
		echo "</table>";

}


else if($ms_type=="agency")
{
$qry_part='';
	if(isset($_POST[search_com])&&!empty($_POST[search_com]))
	{
		$qry_part= "and compid like '%$_POST[search_com]%'";
		}
	
$result = mysqli_query($con, "SELECT * FROM  `commst` where type = 'AGENCY'  $qry_part  order by compid");

	echo "<table id='msview' class='cmpmst' width='100%' cellspacing='0'><thead><tr><th >COMPID</th><th >NAME</th><th >ADDRESS</th><th >CITY</th><th >GST OPTION</th><th >TELEPHONE</th><th >EMAIL</th><th >CONT. PERSON</th><th >TYPE</th><th width='5%'></th><th width='5%'></th></tr></thead>";
//echo $row[det1'];
while($row = mysqli_fetch_array($result))
	{
		echo "<tr><td style='display:none'><textarea name='ID' class='ID'>$row[id]</textarea></td><td><a href='mastercmpedit.php?ID=$row[id]' onClick='positionedPopup(this.href,700,600);return false'><textarea name='compid' class='compid'>$row[compid]</textarea></a></td><td><textarea name='name' class='name'>$row[name]</textarea></td><td><textarea name='address' class='address'>$row[address]</textarea></td><td><textarea name='city' class='city'>$row[cmpcity]</textarea></td><td><textarea name='incstax' class='incstax'>$row[incstax]</textarea></td><td><textarea name='telephone' class='telephone'>$row[telephone]</textarea></td><td><textarea name='email' class='email nocaps'>$row[email]</textarea></td><td><textarea name='conper' class='conper'>$row[conper]</textarea></td><td><textarea name='type' class='type'>$row[type]</textarea></td><td width='5%'> <div> <input type='button' name='prod_save' id='cmp_master_edit' class='filter_table' style='display:none' value='Save' /></div></td><td align='center' width='5%'><input type='button' class='delete_master_cmp delete_row' value='X' /></td></tr>";
		}
		
		echo "<tr class='new_entry'><td><a href='mastercmpedit.php?type=AGENCY' onClick='positionedPopup(this.href,700,600);return false'><textarea name='compid' class='compid' placeholder='new record'></textarea></a></td><td><textarea name='name' class='name' placeholder='new record'></textarea></td><td ><textarea name='address' class='address' placeholder='new record'></textarea></td><td><textarea name='city' class='city' placeholder='new record'></textarea></td><td><textarea name='incstax' class='incstax' placeholder='new record'></textarea></td><td><textarea name='telephone' class='telephone' placeholder='new record'></textarea></td><td><textarea name='email' class='email nocaps' placeholder='new record'></textarea></td><td><textarea name='conper' class='conper'></textarea></td><td><textarea name='type' class='type' placeholder='new record'></textarea></td><td width='5%'> <div> <input type='button' id='cmp_master_new' class='filter_table'  style='display:none' value='Save' /></div></td><td width='5%'></td></tr>";
		
		echo "</table>";

}


else if($ms_type=="distributor")
{
$qry_part='';
	if(isset($_POST[search_com])&&!empty($_POST[search_com]))
	{
		$qry_part= "and compid like '%$_POST[search_com]%'";
		}
	
$result = mysqli_query($con, "SELECT * FROM  `commst` where type = 'DISTRIBUTOR'  $qry_part  order by compid");

	echo "<table id='msview' class='cmpmst' width='100%' cellspacing='0'><thead><tr><th >COMPID</th><th >NAME</th><th >ADDRESS</th><th >CITY</th><th >GST OPTION</th><th >TELEPHONE</th><th >EMAIL</th><th >CONT. PERSON</th><th >TYPE</th><th width='5%'></th><th width='5%'></th></tr></thead>";
//echo $row[det1'];
while($row = mysqli_fetch_array($result))
	{
		echo "<tr><td style='display:none'><textarea name='ID' class='ID'>$row[id]</textarea></td><td><a href='mastercmpedit.php?ID=$row[id]' onClick='positionedPopup(this.href,700,600);return false'><textarea name='compid' class='compid'>$row[compid]</textarea></a></td><td><textarea name='name' class='name'>$row[name]</textarea></td><td><textarea name='address' class='address'>$row[address]</textarea></td><td><textarea name='city' class='city'>$row[cmpcity]</textarea></td><td><textarea name='incstax' class='incstax'>$row[incstax]</textarea></td><td><textarea name='telephone' class='telephone'>$row[telephone]</textarea></td><td><textarea name='email' class='email nocaps'>$row[email]</textarea></td><td><textarea name='conper' class='conper'>$row[conper]</textarea></td><td><textarea name='type' class='type'>$row[type]</textarea></td><td width='5%'> <div> <input type='button' name='prod_save' id='cmp_master_edit' class='filter_table' style='display:none' value='Save' /></div></td><td align='center' width='5%'><input type='button' class='delete_master_cmp delete_row' value='X' /></td></tr>";
		}
		
		echo "<tr class='new_entry'><td><a href='mastercmpedit.php?type=DISTRIBUTOR' onClick='positionedPopup(this.href,700,600);return false'><textarea name='compid' class='compid' placeholder='new record'></textarea></a></td><td><textarea name='name' class='name' placeholder='new record'></textarea></td><td ><textarea name='address' class='address' placeholder='new record'></textarea></td><td><textarea name='city' class='city' placeholder='new record'></textarea></td><td><textarea name='incstax' class='incstax' placeholder='new record'></textarea></td><td><textarea name='telephone' class='telephone' placeholder='new record'></textarea></td><td><textarea name='email' class='email nocaps' placeholder='new record'></textarea></td><td><textarea name='conper' class='conper'></textarea></td><td><textarea name='type' class='type' placeholder='new record'></textarea></td><td width='5%'> <div> <input type='button' id='cmp_master_new' class='filter_table'  style='display:none' value='Save' /></div></td><td width='5%'></td></tr>";
		
		echo "</table>";

}

else if($ms_type=="agent")
{
$qry_part='';
	if(isset($_POST[search_com])&&!empty($_POST[search_com]))
	{
		$qry_part= "and compid like '%$_POST[search_com]%'";
		}
	
$result = mysqli_query($con, "SELECT * FROM  `commst` where type = 'AGENT'  $qry_part  order by compid");

	echo "<table id='msview' class='cmpmst' width='100%' cellspacing='0'><thead><tr><th >COMPID</th><th >NAME</th><th >ADDRESS</th><th >CITY</th><th >GST OPTION</th><th >TELEPHONE</th><th >EMAIL</th><th >CONT. PERSON</th><th >TYPE</th><th width='5%'></th><th width='5%'></th></tr></thead>";
//echo $row[det1'];
while($row = mysqli_fetch_array($result))
	{
		echo "<tr><td style='display:none'><textarea name='ID' class='ID'>$row[id]</textarea></td><td><a href='mastercmpedit.php?ID=$row[id]' onClick='positionedPopup(this.href,700,600);return false'><textarea name='compid' class='compid'>$row[compid]</textarea></a></td><td><textarea name='name' class='name'>$row[name]</textarea></td><td><textarea name='address' class='address'>$row[address]</textarea></td><td><textarea name='city' class='city'>$row[cmpcity]</textarea></td><td><textarea name='incstax' class='incstax'>$row[incstax]</textarea></td><td><textarea name='telephone' class='telephone'>$row[telephone]</textarea></td><td><textarea name='email' class='email nocaps'>$row[email]</textarea></td><td><textarea name='conper' class='conper'>$row[conper]</textarea></td><td><textarea name='type' class='type'>$row[type]</textarea></td><td width='5%'> <div> <input type='button' name='prod_save' id='cmp_master_edit' class='filter_table' style='display:none' value='Save' /></div></td><td align='center' width='5%'><input type='button' class='delete_master_cmp delete_row' value='X' /></td></tr>";
		}
		
		echo "<tr class='new_entry'><td><a href='mastercmpedit.php?type=AGENT' onClick='positionedPopup(this.href,700,600);return false'><textarea name='compid' class='compid' placeholder='new record'></textarea></a></td><td><textarea name='name' class='name' placeholder='new record'></textarea></td><td ><textarea name='address' class='address' placeholder='new record'></textarea></td><td><textarea name='city' class='city' placeholder='new record'></textarea></td><td><textarea name='incstax' class='incstax' placeholder='new record'></textarea></td><td><textarea name='telephone' class='telephone' placeholder='new record'></textarea></td><td><textarea name='email' class='email nocaps' placeholder='new record'></textarea></td><td><textarea name='conper' class='conper'></textarea></td><td><textarea name='type' class='type' placeholder='new record'></textarea></td><td width='5%'> <div> <input type='button' id='cmp_master_new' class='filter_table'  style='display:none' value='Save' /></div></td><td width='5%'></td></tr>";
		
		echo "</table>";

}

else if($ms_type=="vendor")
{
$qry_part='';
	if(isset($_POST[search_com])&&!empty($_POST[search_com]))
	{
		$qry_part= "and compid like '%$_POST[search_com]%'";
		}
	
$result = mysqli_query($con, "SELECT * FROM  `commst` where type = 'VENDOR'  $qry_part  order by compid");

	echo "<table id='msview' class='cmpmst' width='100%' cellspacing='0'><thead><tr><th >COMPID</th><th >NAME</th><th >ADDRESS</th><th >CITY</th><th >GST OPTION</th><th >TELEPHONE</th><th >EMAIL</th><th >CONT. PERSON</th><th >TYPE</th><th width='5%'></th><th width='5%'></th></tr></thead>";
//echo $row[det1'];
while($row = mysqli_fetch_array($result))
	{
		echo "<tr><td style='display:none'><textarea name='ID' class='ID'>$row[id]</textarea></td><td><a href='mastercmpedit.php?ID=$row[id]' onClick='positionedPopup(this.href,700,600);return false'><textarea name='compid' class='compid'>$row[compid]</textarea></a></td><td><textarea name='name' class='name'>$row[name]</textarea></td><td><textarea name='address' class='address'>$row[address]</textarea></td><td><textarea name='city' class='city'>$row[cmpcity]</textarea></td><td><textarea name='incstax' class='incstax'>$row[incstax]</textarea></td><td><textarea name='telephone' class='telephone'>$row[telephone]</textarea></td><td><textarea name='email' class='email nocaps'>$row[email]</textarea></td><td><textarea name='conper' class='conper'>$row[conper]</textarea></td><td><textarea name='type' class='type'>$row[type]</textarea></td><td width='5%'> <div> <input type='button' name='prod_save' id='cmp_master_edit' class='filter_table' style='display:none' value='Save' /></div></td><td align='center' width='5%'><input type='button' class='delete_master_cmp delete_row' value='X' /></td></tr>";
		}
		
		echo "<tr class='new_entry'><td><a href='mastercmpedit.php?type=VENDOR' onClick='positionedPopup(this.href,700,600);return false'><textarea name='compid' class='compid' placeholder='new record'></textarea></a></td><td><textarea name='name' class='name' placeholder='new record'></textarea></td><td ><textarea name='address' class='address' placeholder='new record'></textarea></td><td><textarea name='city' class='city' placeholder='new record'></textarea></td><td><textarea name='incstax' class='incstax' placeholder='new record'></textarea></td><td><textarea name='telephone' class='telephone' placeholder='new record'></textarea></td><td><textarea name='email' class='email nocaps' placeholder='new record'></textarea></td><td><textarea name='conper' class='conper'></textarea></td><td><textarea name='type' class='type' placeholder='new record'></textarea></td><td width='5%'> <div> <input type='button' id='cmp_master_new' class='filter_table'  style='display:none' value='Save' /></div></td><td width='5%'></td></tr>";
		
		echo "</table>";

}

else if($ms_type=="usr")
{
	if($_SESSION['SESS_BRANCH']=='HO')
	$sql_qry="SELECT * FROM  `usermst` order by id";
	else
	$sql_qry="SELECT * FROM  `usermst` where branch='$_SESSION[SESS_CMPC]' order by id";

	
	if($result=mysqli_query($con,$sql_qry))
	{

	echo "<table id='msview' class='usr' width='100%' cellspacing='0'><thead><tr><th width='5%'>USER ID</th><th width='8%'>LOGIN NAME</th><th width='8%'>PASS WORD</th><th width='8%'>DEPARTMENT</th><th width='8%'>DESIGNATION</th><th width='8%'>BRANCH</th><th width='8%'>CALLREG</th><th width='8%'>BILLING</th><th width='8%'>REPORTS</th><th width='8%'>MASTERS</th><th width='8%'>PAYROLL</th><th width='8%'>VOUCHER</th><th width='4%'></th><th width='3%'></th></tr></thead>";
	
	while($row=mysqli_fetch_array($result))
	{
		echo "<tr><td style='display:none'><textarea name='ID' class='ID'>$row[id]</textarea></td><td width='5%'><textarea name='userid' class='userid'>$row[userid]</textarea></td><td width='8%'><textarea name='loginname' class='loginname nocaps'>$row[loginname]</textarea></td><td width='8%'><input type='password' name='pwd' class='pwd nocaps' style='height:100%' value='$row[pwd]'/></td><td width='8%'><textarea name='dept' class='dept'>$row[dept]</textarea></td><td width='8%'><textarea name='design' class='design'>$row[design]</textarea></td>
<td width='8%'><textarea name='branch' class='branch'>$row[branch]</textarea></td><td width='8%'><textarea name='booking' class='booking'>$row[callreg]</textarea></td><td width='8%'><textarea name='billing' class='billing'>$row[billing]</textarea></td><td width='8%'><textarea name='report' class='report'>$row[report]</textarea></td><td width='8%'><textarea name='masters' class='masters'>$row[masters]</textarea></td><td width='8%'><textarea name='payroll' class='payroll'>$row[payroll]</textarea></td><td width='8%'><textarea name='voucher' class='voucher'>$row[voucher]</textarea></td><td width='4%'> <div> <input type='button' name='prod_save' id='usr_master_edit' class='button' style='display:none' value='Save' /></div></td><td align='center' width='3%'><input type='button'    class='delete_master_usr delete_row' value='X' /></td></tr>";
		}
		
		echo "<tr><td width='5%'><textarea name='userid' class='userid'></textarea></td><td width='8%'><textarea name='loginname' class='loginname nocaps'></textarea></td><td width='8%'><input type='password' name='pwd' class='pwd nocaps' style='height:100%' /></td><td width='8%'><textarea name='dept' class='dept'></textarea></td><td width='8%'><textarea name='design' class='design'></textarea></td>
<td width='8%'><textarea name='branch' class='branch'></textarea></td><td width='8%'><textarea name='booking' class='booking'></textarea></td><td width='8%'><textarea name='billing' class='billing'></textarea></td><td width='8%'><textarea name='report' class='report'></textarea></td><td width='8%'><textarea name='masters' class='masters'></textarea></td><td width='8%'><textarea name='payroll' class='payroll'></textarea></td><td width='8%'><textarea name='voucher' class='voucher'></textarea></td><td width='4%'> <div> <input type='button' id='usr_master_new' class='button'  style='display:none' value='Save' /></div></td><td width='3%'></td></tr>";
		
		echo "</table>";

	
	}
	else 
	echo "Error:".mysqli_error($con);
}

else if($ms_type=="mst")
{
	
	$compid='';
if(isset($_POST['compid'])&&!empty($_POST['compid']))
$compid="where mstype like '$_POST[compid]'";

$result = mysqli_query($con, "SELECT `entryid`, `mstype`, `code`, `desc`, `det`, `det1`, `det2`, `det3`, `det4` FROM `master` $compid");

   if($_POST['ms_value']=="DEPT"){
	echo "<table id='msview' class='led' width='100%' cellspacing='0'><thead><tr><th >MSTYPE</th><th >CODE</th><th >DEPARTMENT</th><th >SUPPLIER</th><th >CONT.</th><th width='5%'></th><th width='5%'></th></tr></thead>";
	while($row = mysqli_fetch_array($result))
	{
		echo "<tr><td style='display:none'><textarea name='entryid' class='entryid'>$row[entryid]</textarea></td><td><textarea name='mstype' class='mstype'>$row[mstype]</textarea></td><td><textarea name='code' class='code'>$row[code]</textarea></td><td><textarea name='desc' class='desc'>$row[desc]</textarea></td><td><textarea name='det' class='det'>$row[det]</textarea></td><td><textarea name='det1' class='det1'>$row[det1]</textarea></td><td width='5%'> <div> <input type='button' name='master_edit' id='master_edit' class='filter_table' style='display:none' value='Save' /></div></td><td align='center' width='5%'><input type='button'    class='delete_master delete_row' value='X' /></td></tr>";
		}
		
		echo "<tr class='new_entry'><td><textarea name='mstype' class='mstype' placeholder='new record'>$_POST[compid]</textarea></td><td><textarea name='code' class='code' placeholder='new record'></textarea></td><td><textarea name='desc' class='desc' placeholder='new record'></textarea></td><td><textarea name='det' class='det'></textarea></td><td><textarea name='det1' class='det1'></textarea></td><td width='5%'> <div> <input type='button' name='master_new' id='master_new' class='filter_table' style='display:none' value='Save' /></div></td><td width='5%'></td></tr>";
		
		echo "</table>";
   }
   
   
   
     else if($_POST['ms_value']=="CAT"){
	echo "<table id='msview' class='led' width='100%' cellspacing='0'><thead><tr><th >MSTYPE</th><th >CODE</th><th >DESCRIPTION</th><th >SIZE SET</th><th >RATIO</th><th >Diff Price</th><th >Diff MRP</th><th width='5%'></th><th width='5%'></th></tr></thead>";
	while($row = mysqli_fetch_array($result))
	{
		echo "<tr><td style='display:none'><textarea name='entryid' class='entryid'>$row[entryid]</textarea></td><td><textarea name='mstype' class='mstype'>$row[mstype]</textarea></td><td><textarea name='code' class='code'>$row[code]</textarea></td><td><textarea name='desc' class='desc'>$row[desc]</textarea></td><td><textarea name='det' class='det'>$row[det]</textarea></td><td><textarea name='det1' class='det1'>$row[det1]</textarea></td><td><textarea name='det2' class='det2'>$row[det2]</textarea></td><td><textarea name='det3' class='det3'>$row[det3]</textarea></td><td width='5%'> <div> <input type='button' name='master_edit' id='master_edit' class='filter_table' style='display:none' value='Save' /></div></td><td align='center' width='5%'><input type='button'    class='delete_master delete_row' value='X' /></td></tr>";
		}
		
		echo "<tr class='new_entry'><td><textarea name='mstype' class='mstype' placeholder='new record'>$_POST[compid]</textarea></td><td><textarea name='code' class='code' placeholder='new record'></textarea></td><td><textarea name='desc' class='desc' placeholder='new record'></textarea></td><td><textarea name='det' class='det'></textarea></td><td><textarea name='det1' class='det1'></textarea></td><td><textarea name='det2' class='det2'></textarea></td><td><textarea name='det3' class='det3'></textarea></td><td width='5%'> <div> <input type='button' name='master_new' id='master_new' class='filter_table' style='display:none' value='Save' /></div></td><td width='5%'></td></tr>";
		
		echo "</table>";
   }
   else if($_POST['ms_value']=="TAXTYPE")
{
$result = mysqli_query($con, "SELECT * 
FROM  `master` 
WHERE  `mstype` LIKE  '$_POST[ms_value]' ");

	echo "<table id='msview' class='led' width='100%' cellspacing='0'><thead><tr><th >MSTYPE</th><th >CODE</th><th >RATE</th><th >TAX</th><th width='5%'></th><th width='5%'></th></tr></thead>";
//echo $row[det1'];
while($row = mysqli_fetch_array($result))
	{
		echo "<tr><td style='display:none'><textarea name='entryid' class='entryid'>$row[entryid]</textarea></td><td><textarea name='mstype' class='mstype'>$row[mstype]</textarea></td><td><textarea name='code' class='code'>$row[code]</textarea></td><td><textarea name='desc' class='desc'>$row[desc]</textarea></td><td><textarea name='det1' class='det1'>$row[det1]</textarea></td><td width='5%'> <div> <input type='button'  id='master_edit' style='display:none' class='filter_table' value='Save' /></div></td><td align='center' width='5%'><input type='button'    class='delete_master delete_row' value='X' /></td></tr>";
	}
  echo "<tr class='new_entry'><td style='display:none'><textarea name='entryid' class='entryid' placeholder='new record'></textarea></td><td><textarea name='mstype' class='mstype' placeholder='new record'>$_POST[ms_value]</textarea></td><td><textarea name='code' class='code' placeholder='new record'></textarea></td><td><textarea name='desc' class='desc' placeholder='new record'></textarea></td><td><textarea name='det1' class='det1' placeholder='new record'></textarea></td><td width='5%'> <div> <input type='button'  id='master_new' style='display:none' class='filter_table' value='Save' /></div></td><td width='5%'></td></tr>";

		
		echo "</table>";

}
   
    else if($_POST['ms_value']=="SSC"){
	  echo "<table id='msview' class='led' width='100%' cellspacing='0'><thead><tr><th >MSTYPE</th><th >CODE</th><th >SIZE SET</th><th >RATIO</th><th >RATIO TOTAL</th><th >Diff PRICE</th><th > Diff MRP</th><th width='5%'></th><th width='5%'></th></tr></thead>"; 
	  while($row = mysqli_fetch_array($result))
	{
		echo "<tr><td style='display:none'><textarea name='entryid' class='entryid'>$row[entryid]</textarea></td><td><textarea name='mstype' class='mstype'>$row[mstype]</textarea></td><td><textarea name='code' class='code'>$row[code]</textarea></td><td><textarea name='desc' class='desc'>$row[desc]</textarea></td><td><textarea name='det' class='det'>$row[det]</textarea></td><td><textarea name='det1' class='det1'>$row[det1]</textarea></td><td><textarea name='det2' class='det2'>$row[det2]</textarea></td><td><textarea name='det3' class='det3'>$row[det3]</textarea></td><td width='5%'> <div> <input type='button' name='master_edit' id='master_edit' class='filter_table' style='display:none' value='Save' /></div></td><td align='center' width='5%'><input type='button'    class='delete_master delete_row' value='X' /></td></tr>";
		}
		
		echo "<tr class='new_entry'><td><textarea name='mstype' class='mstype' placeholder='new record'>$_POST[compid]</textarea></td><td><textarea name='code' class='code' placeholder='new record'></textarea></td><td><textarea name='desc' class='desc' placeholder='new record'></textarea></td><td><textarea name='det' class='det'></textarea></td><td><textarea name='det1' class='det1'></textarea></td><td><textarea name='det2' class='det2'></textarea></td><td><textarea name='det3' class='det3'></textarea></td><td width='5%'> <div> <input type='button' name='master_new' id='master_new' class='filter_table' style='display:none' value='Save' /></div></td><td width='5%'></td></tr>";
		
		echo "</table>";
	   }
   else if($_POST['ms_value']=="Row")
{
$query = "";
	if($_POST['rowval']!='')
	$query = "where code = '$_POST[rowval]'";	
	
$result = mysqli_query($con, "SELECT `entryid`, `code`,`skuid`,`category`, `desc`,`color`, `size`, `agent`, `qty`, `unit`, `psrate`, `pamount`, `remarks`  FROM `rawmatreg` $query ");

	echo "<table id='msview' class='led' width='100%' cellspacing='0'><thead><tr><th >Rmcode</th><th >Skuid</th><th >Category</th><th >Description</th><th >Color</th><th >Size</th><th >Qty</th><th >Unit</th><th >Rate</th><th >Amount</th><th width='5%'></th><th width='5%'></th></tr></thead>";
//echo $row[det1'];
while($row = mysqli_fetch_array($result))
	{
		echo "<tr><td style='display:none'><textarea name='entryid' class='entryid'>$row[entryid]</textarea></td><td><textarea name='code' class='code'>$row[code]</textarea></td><td><textarea name='skuid' class='skuid'>$row[skuid]</textarea></td><td><textarea name='cate' class='cate'>$row[category]</textarea></td><td><textarea name='desc' class='desc'>$row[desc]</textarea></td><td><textarea name='color' class='color'>$row[color]</textarea></td><td><textarea name='size' class='size'>$row[size]</textarea></td><td><textarea name='qty' class='qty'>$row[qty]</textarea></td><td><textarea name='unit' class='unit'>$row[unit]</textarea></td><td><textarea name='psrate' class='psrate'>$row[psrate]</textarea></td><td><textarea name='pamount' class='pamount'>$row[pamount]</textarea></td><td width='5%'> <div> <input type='button' name='rawmat_edit' id='rawmat_edit' class='filter_table' style='display:none' value='Save' /></div></td><td align='center' width='5%'><input type='button'    class='delete_master delete_row' value='X' /></td></tr>";
		}
		
		echo "<tr class='new_entry'><td><textarea name='code' class='code' placeholder='new record'></textarea></td><td><textarea name='skuid' class='skuid' placeholder='new record'></textarea></td><td><textarea name='cate' class='cate' placeholder='new record'></textarea></td><td><textarea name='desc' class='desc' placeholder='new record'></textarea></td><td><textarea name='color' class='color' placeholder='new record'></textarea></td><td><textarea name='size' class='size' placeholder='new record'></textarea></td><td><textarea name='qty' class='qty' placeholder='new record'></textarea></td><td><textarea name='unit' class='unit'></textarea></td><td><textarea name='psrate' class='psrate'></textarea></td><td><textarea name='pamount' class='pamount'></textarea></td><td width='5%'> <div> <input type='button' name='rawmat_new' id='rawmat_new' class='filter_table' style='display:none' value='Save' /></div></td><td width='5%'></td></tr>";
		
		echo "</table>";

}
   else{
	  echo "<table id='msview' class='led' width='100%' cellspacing='0'><thead><tr><th >MSTYPE</th><th >CODE</th><th >DESC</th><th >DET</th><th >DET1</th><th width='5%'></th><th width='5%'></th></tr></thead>"; 
	  while($row = mysqli_fetch_array($result))
	{
		echo "<tr><td style='display:none'><textarea name='entryid' class='entryid'>$row[entryid]</textarea></td><td><textarea name='mstype' class='mstype'>$row[mstype]</textarea></td><td><textarea name='code' class='code'>$row[code]</textarea></td><td><textarea name='desc' class='desc'>$row[desc]</textarea></td><td><textarea name='det' class='det'>$row[det]</textarea></td><td><textarea name='det1' class='det1'>$row[det1]</textarea></td><td width='5%'> <div> <input type='button' name='master_edit' id='master_edit' class='filter_table' style='display:none' value='Save' /></div></td><td align='center' width='5%'><input type='button'    class='delete_master delete_row' value='X' /></td></tr>";
		}
		
		echo "<tr class='new_entry'><td><textarea name='mstype' class='mstype' placeholder='new record'>$_POST[compid]</textarea></td><td><textarea name='code' class='code' placeholder='new record'></textarea></td><td><textarea name='desc' class='desc' placeholder='new record'></textarea></td><td><textarea name='det' class='det'></textarea></td><td><textarea name='det1' class='det1'></textarea></td><td width='5%'> <div> <input type='button' name='master_new' id='master_new' class='filter_table' style='display:none' value='Save' /></div></td><td width='5%'></td></tr>";
		
		echo "</table>";
	   }
//echo $row[det1'];


}




?>
