<?php

session_start();
if($_SESSION['dbName']==""){
header("location:../index.php");
}


include("config.inc.php");



$connection = mysql_connect($config['dbServer'],$config['dbUser'],$config['dbPass']) or die("Could not connect to DB");
mysql_select_db($_SESSION['dbName'],$connection) or die("Could not find DB");

print <<<HERE

<head>

<meta http-equiv="Content-Type" content="text/html; charset=windows-1256" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
		<meta name="viewport" content="width=device-width, initial-scale=1.0"> 
<LINK REL="stylesheet" TYPE="text/css" MEDIA="all" HREF="css/tabs.css">

<link rel="stylesheet" type="text/css" media="all" href="css-v2/style.css">
<script type="text/javascript" src="js/grid/jquery-1.9.1.js"></script>
<link type="text/css" href="js/calendar/jquery.datepick.css" rel="stylesheet">
<script type="text/javascript" src="js/calendar/jquery.datepick.js"></script>
<script type="text/javascript" language="javascript">
function SavePage(){
	if (document.Pmode.paymentmode_code.value ==''){
	var sactionmode = 'save';
	}
	else if(document.Pmode.paymentmode_code.value !=''){
	var sactionmode = 'edit';
	}
	
if (document.Pmode.pmcode.value =='' || document.Pmode.pmdesc.value ==''){
	alert("Please fill the Code and Description!")
}

else{
		document.Pmode.action= 'Form_Paymentmode_action.php?actionmode='+sactionmode;
		document.Pmode.submit();
}
}

function ClearPage(){
document.Pmode.pmcode.value = '';
document.Pmode.pmdesc.value = '';

	document.Pmode.action = 'Form_Paymentmode.php';
	document.Pmode.submit();
}

function Deleterec(payment){
	var dactionmode = 'delete';
	if (confirm("Are you sure you want to delete this?")){			
			document.Pmode.action= 'Form_Paymentmode_action.php?actionmode='+dactionmode+'&paymentmode_cod='+payment;
			document.Pmode.submit();
}
}

function setrow(set, set1){
	document.Pmode.pmcode.value=set;
	document.Pmode.paymentmode_code.value=set;
	document.Pmode.pmdesc.value=set1;
	document.Pmode.submit();
}

</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Payment Mode</title>

<style type="text/css">

body,td,th {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 11px;
}
body {
	margin-top: 2px;
	margin-left: 1px;
}
a:link {
	text-decoration: none;
	color: #0000FF;
}
a:visited {
	text-decoration: none;
	color: #0000FF;
}
a:hover {
	text-decoration: none;
	color: #0000FF;
}
a:active {
	text-decoration: none;
	color: #0000FF;
}

.style12 {
	font-size: 9px;
	color: #999999;
	font-weight: bold;
}
.style15 {color: #5151FF; font-size: 10px;}
.style16 {
	font-size: 16px;
	color: #FF0000;
	font-weight: bold;
	font-family: "Times New Roman", Times, serif;
}
.style17 {font-size: 9px}
.style25 {color: #999999; font-weight: bold; font-size: 10px; }
.style26 {color: #FF0000}
.style27 {color: #999999 ;font-size: 10px;}
.style28 {color: #FFFFFF ;font-size: 10px;}
		
</style>

<link type="text/css" rel="stylesheet" href="dhtmlgoodies_calendar.css?random=20051112" media="screen"></LINK>
<SCRIPT type="text/javascript" src="dhtmlgoodies_calendar.js?random=20060118"></script>

</head>
<body >
<form name='Pmode' method='post'>
<input type='hidden' name='actionmode' value='$actionmode'>
<input type='hidden' name='paymentmode_code' value='$paymentmode_code'>

HERE;



echo"<table cellpadding='0' cellspacing='0' border='0'  align='center' class='layout-width'>";
include_once("header.php");
echo" <tr><td  valign='top'>";

include_once("sidemenu.php");
echo"  </td></tr>";


echo" <tr style='height:26px;'>
		<td  valign='top' id='content-top'>
			<table border='0' cellpadding='0' cellspacing='0' style='table-layout:fixed; height:26px;' class='layout-width'>
			<tr style='height:26px;'>
				<td style='width:38px; height:26px;'>&nbsp;</td>
				<td valign='middle' style='width:300px; height:26px;'><span class='title' style='text-transform: uppercase'>Payment Mode</span></td>
				<td class='message' valign='middle' style='height:26px;'>".htmlspecialchars($message, ENT_QUOTES)."</td>
			</tr></table>
		</td>
	  </tr>";

echo"<tr>
		<td  height='34'  valign='top' id='content-top2'>
			<table border='0' cellpadding='0' cellspacing='0' class='layout-width' width='1100px'>
				<col width='450'>
				<col width='120'>
				<col width='150'>
				<col width='250'>
				<col width='200'>
				<col width='200'>
				<tr>
					<td valign='middle' height='34' style='padding-left:40px'>";
echo"				<button type='button' id='btnSave' name='btnSave' onclick='SavePage();' title='Save Page'><span><span>Save</span></span></button>";
echo"				<button type='button' id='btnClear' name='btnClear' onclick='ClearPage();' title='Clear Page'><span><span>Clear</span></span></button>";

echo"				</td>					
					<td align='left' width='263px'> ";
echo"				</td>
					<td colspan=2 align='left'>";
echo"  				 </td>
				</tr>
			</table>
		</td>
		
	</tr>";
echo"	<tr>
		<td id='content-body'>";		
echo"			<table border='0'  align='center' valign='top' width=1100px class='tablecontent'>";
echo"   			<tr bgcolor='#F7F7F7'>";
echo"   				<td valign='top'>
							<table style='table-layout:fixed' align='left' valign='top' width='1100px' border=0>
								<col width=150>
								<col width=250><col width=700>";
echo "<tr><td><span class='style1'>Payment Code </span></td><td><input type='text' name='pmcode' id='pmcode' value='$pmcode' style='width:120px;' ></td><td></td></tr>";

echo "<tr><td><span class='style1'>Payment Description </span></td><td><input type='text' name='pmdesc' id='pmdesc' value='$pmdesc'  style='width:120px;' ></td><td></td></tr>";
echo "<tr height='20px' style='background-color:rgba(169, 169, 169, 0.52);'></tr>"; 

echo"<tr><td id='content-body'>";				
echo"<table border='0'  align='center' valign='top'  class='tablecontent' >
	<col width=64%>";

echo"<tr bgcolor='#F7F7F7'  ><td valign='top' align='left'>";	 
echo"<table style='width:480px;' border='0' cellspacing=0><col width=30><col width=170><col width=180>

	 <tr ><td>
	 &nbsp;</td><td align='center' ><span size = '40'><b>Code</b></span></td><td align='center' ><span size = '40'><b>Description</b></span></td></tr>";

echo"<tr><td  colspan=4 ><div style='overflow-y:scroll;height:150px;width:470px;border:0px solid #000000;padding-left:5px;'><table  border='0' width='452px'>
	<col width=30><col width=170><col width=162>";
	
	$sqlt = " select paymentmode_code, paymentmode_desc
			from payment_mode";
$resultt=mysql_query($sqlt,$connection) or die(mysql_error());
while($rows=mysql_fetch_array($resultt)){
	extract($rows);
echo"<tr><td><img src='img/c_delete.png' onclick='Deleterec(\"".$rows[0]."\")' title='Delete record' style = 'cursor:pointer'></td>
	<td style = 'cursor:pointer'onclick=\"setrow('$paymentmode_code','$paymentmode_desc');\">$paymentmode_code</td> 
	<td style = 'cursor:pointer'onclick=\"setrow('$paymentmode_code','$paymentmode_desc');\">$paymentmode_desc</td></tr>";
} 

echo "</table></div></td></tr>";
echo "</table></td></tr>";
echo "</table></td></tr>";
echo "</table></tr></table></tr>";


//echo" </table></td></tr>";	  

echo" <tr height='30'><td align='center' id='content-bottom' ></td></tr>";
include("footer.php");
print <<<HERE
</form>
</body>

HERE;

?>






