
PK 
<?php
session_start();
require_once '../common/common.php';
require_once '../common/secure.php';
require_once("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(){
//alert("sd");
$("#exend_lnk").click(function(){
$("#table_exend").fadeIn("slow");
});
$("#exend_sub_lnk").click(function()
{
$("#table_exend_sub").fadeIn("slow");
});
$("#criteria_lnk").click(function(){
$("#table_exend_criteria").fadeIn("slow");
});
});
function getcat(obj)
{
var target_obj='#sub_' + obj.id;
$.ajax({
url: "ajax_get_cat.php?id=" + obj.value + "&time=" + new Date().getTime() + "&type=income" ,
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 createGridDocs()
{
var objTable = document.getElementById('table_exend');
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="<input type='text' name='category[]' id='category"+i+"' style='width:75px;' /><input type='hidden' name='is_category[]' id='is_category"+i+"' value='true' />";
var objTableRowCell1 = objTableRow.insertCell(1);
objTableRowCell1.innerHTML="<a href='#' onclick='removeRow2(this)'>Delete</a>";
}
function removeRow2(src)
{
var i=src.parentNode.parentNode.rowIndex;
var objTable = document.getElementById('table_exend');
var objTableRows = parseInt(objTable.rows.length);
if(objTableRows<=2)
{
$('#table_exend').fadeOut('fast');
}
var objLastRow;
document.getElementById("table_exend").deleteRow(i);
}
function createGridDocs3()
{
var objTable = document.getElementById('table_exend_sub');
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;'>"+"<?php
echo "<option value='select'>Select</option>";
$sql="SELECT id,name FROM income";
$result=mysql_query($sql);
while($row=mysql_fetch_array($result))
{
echo "<option value='".$row['id']."'>".$row['name']."</option>";
}
?></select><input type='hidden' name='is_sub_category[]' id='is_sub_category"+i+"' value='true' />";
var objTableRowCell1 = objTableRow.insertCell(1);
objTableRowCell1.innerHTML="<input type='text' name='sub_category[]' id='sub_category"+i+"' style='width:75px;' />";
var objTableRowCell2 = objTableRow.insertCell(2);
objTableRowCell2.innerHTML="<a href='#' onclick='removeRow3(this)'>Delete</a>";
}
function removeRow3(src)
{
var i=src.parentNode.parentNode.rowIndex;
var objTable = document.getElementById('table_exend_sub');
var objTableRows = parseInt(objTable.rows.length);
if(objTableRows<=2)
{
$('#table_exend_sub').fadeOut('fast');
}
var objLastRow;
document.getElementById("table_exend_sub").deleteRow(i);
}
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 income";
$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='amount_[]' id='amount_"+i+"' style='width:75px;' />";
var objTableRowCell4 = objTableRow.insertCell(4);
objTableRowCell4.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');
}
var objLastRow;
document.getElementById("table_exend_criteria").deleteRow(i);
}
</script>
<!-- <a href='index.php'>Back</a> -->
<!--<font color="#006699"><b>Acounts : PENDING PENDING PENDING PENDING </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>INCOME</strong></th>
</tr>
<tr>
<td valign="top">
<a href="#" onclick='createGridDocs();' id='exend_lnk'>Add Category</a> <a href='income_cat_list.php'>Edit</a>
<table id='table_exend' align="center" width="100%" border="4" cellpadding="3" style="display:none;">
<tr>
<th><strong>Category</strong></th>
<th><strong>Action</strong></th>
</tr>
</table>
</td>
<td valign="top">
<a href="#" onclick='createGridDocs3();' id='exend_sub_lnk'>Add SubCategory</a> <a href='income_subcat_list.php'>Edit</a>
<table id='table_exend_sub' border="4" cellpadding="3" style="display:none;">
<tr>
<th><strong>Category</strong></th>
<th><strong>SubCategory</strong></th>
<th><strong>Action</strong></th>
</tr>
</table>
</td>
<td valign="top">
<a href="#" onclick='createGridDocs4();' id="criteria_lnk">Add Criteria</a> <a href='accounts.php?searchin=income&action=edit&tmpkey=1'>Edit</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>Amount</strong></th>
<th><strong>Action</strong></th>
</tr>
</table>
</td>
</tr>
</table>
<div style='margin-left:-50px;' align="center"><input type='submit' id='submit' name='save_income' value='Save' /></div>
</form>
<?php
include ("../foot.php");
?>


PK 99