PK

ADDRLIN : /home/anibklip/pcfcindia.com/24-25/accounts/
FLL :
Current File : /home/anibklip/pcfcindia.com/24-25/accounts/addregularexpenditure.php

<?php
	session_start();
	require_once ('../common/common.php');
	require_once ('../common/secure.php');
	include("connection.php");
	include ("../head_account.php");

	/*
	 $sql="SELECT p.pid, inv.invid AS invoice, p.pmode, sum( p.pamount ) AS totalAmount, p.tds, DATE_FORMAT( p.pdate, '%d-%m-%Y' ) AS pdate, p.pdetail, p.branch
				FROM payments p, invoices inv
			WHERE p.invoice = inv.invid AND inv.invstatus = 'paid'
		  GROUP BY inv.invid";
	 	 
	$res=mysql_query($sql);
	$row=mysql_fetch_array($res);*/

?>
	<script type="text/javascript">
			$(document).ready(function(){
				$("#criteria_lnk").click(function(){
					$("#table_exend_criteria").fadeIn("slow");
					$("#tr_btn").fadeIn("fast");
				});
			});

			function getcat(obj) 
			{
					var target_obj='#sub_' + obj.id;
					$.ajax({
						url: "ajax_get_cat.php?id=" + obj.value + "&time=" + new Date().getTime(),
						type: "GET",
						error: function (xhr, desc, exceptionobj) {
						alert(xhr.responseText);
						},
						success: function(data){
							if (data.error) {
								alert(data.error);
								return;
							}
							//alert(data);
							var x = data.split(',');
							var op = '<option value=select>Select</option>';
							for (var i = 0; i < x.length-1; i++)
							{
								var y=x[i].split(':');
								op = op + '<option value=' + y[0] + '>' + y[1] + '</option>';
							}
							
							$(target_obj).html(op);
						}
					});
			}	    


			
	</script>	

	<script type="text/javascript">
		//document.table_exend.style.display="none"; // this is for hiding
		//document.form1.table_exend.style.display=""; // this is for showing
		
		function createGridDocs4()
		{
			var objTable = document.getElementById('table_exend_criteria');
			var tablerows=parseInt(objTable.rows.length);
			var objTableRow = objTable.insertRow(tablerows);
			var tabrow = tablerows;
			var i = tablerows;
			objTableRow.id = "row_c_"+i;

			var objTableRowCell0 = objTableRow.insertCell(0);
			objTableRowCell0.innerHTML="<select name='category_[]' id='category_"+i+"' style='width:75px;'  onchange='getcat(this)'>"+"<?php
						echo "<option value='select'>Select</option>";
						$sql="SELECT id,name FROM expenditure";					
						$result=mysql_query($sql);
						while($row=mysql_fetch_array($result))
						{
							echo "<option value='".$row['id']."'>".$row['name']."</option>";
						}
											?></select><input type='hidden' name='is_criteria[]' id='is_criteria"+i+"' value='true' />";

			var objTableRowCell1 = objTableRow.insertCell(1);
			objTableRowCell1.innerHTML="<select name='sub_category_[]' id='sub_category_"+i+"' style='width:75px;'><option value='select'>Select</select>";

			var objTableRowCell2 = objTableRow.insertCell(2);
			objTableRowCell2.innerHTML="<input type='text' name='details_[]' id='details_"+i+"' style='width:75px;' />";

			var objTableRowCell3 = objTableRow.insertCell(3);
			objTableRowCell3.innerHTML="<input type='text' name='tax_[]' id='tax_"+i+"' style='width:75px;' />";
			
			var objTableRowCell4 = objTableRow.insertCell(4);
			objTableRowCell4.innerHTML="<input type='text' name='amount_[]' id='amount_"+i+"' style='width:75px;' />";

			
			
			var objTableRowCell5 = objTableRow.insertCell(5);
			objTableRowCell5.innerHTML="<a href='#' onclick='removeRow4(this)'>Delete</a>";
		}
		function removeRow4(src)
		{
			var i=src.parentNode.parentNode.rowIndex;
			var objTable = document.getElementById('table_exend_criteria');
			var objTableRows = parseInt(objTable.rows.length);
			if(objTableRows<=2)
			{
				$('#table_exend_criteria').fadeOut('fast');
				$("#tr_btn").fadeOut('fast');
			}
			var objLastRow;
			document.getElementById("table_exend_criteria").deleteRow(i);
    	}
		
	</script>

	<!--  <a href='index.php'>Back</a>-->
	<!--  <font color="#006699"><b>Acounts :</b></font>-->
	<form method="post" action="accounts_action.php" name='form1' id='form1'>
		
		<table cellspacing="3" align="center"  width="80%"  border="4" cellpadding="3">
			<tr>
				  <th colspan='3'><strong>EXPENDITURE</strong></th>
			</tr>
			<tr>
			  	<td valign="top">
			   		<a href="#" onclick='createGridDocs4();' id="criteria_lnk">Add Criteria</a> 			  		
			  		<table id='table_exend_criteria' border="4" cellpadding="3" style="display:none;">
				  		<tr>
				  			<th><strong>Category</strong></th>
				  			<th><strong>SubCategory</strong></th>
				  			<th><strong>Details</strong></th>
				  			<th><strong>Tax</strong></th>
				  			<th><strong>Amount</strong></th>
				  			<th><strong>Action</strong></th>
						</tr>
			  		</table>
			    </td>
			</tr>
			<tr id="tr_btn" style='display:none;'>
				<td>
					<div style='margin-left:150px;' align="left" ><input type='submit' id='submit' name='save' value='Save' /></div>
				</td>
			</tr>
		</table>
		
	</form>
<?php
	include ("../foot.php");
?>


PK 99