<?php session_name('CAKEPHP'); session_start();
$PageSecurity = 4;
include('includes/session.inc');
include('includes/function_lib.php');
global $db;

$update=DB_query("update crm_lead_items set del_status=1 where id='".$_GET['id']."'",$db);


$data9="";




$data9.="<table align='center' width='100%;' border='1' cellpadding='3' cellspacing='0'>";
/*$data9.="<tr class='row1'><td class='tabledata' style='text-align:center;' colspan='13'>Item Details</td></tr>";
$data9.="<tr class='row1'>";
	$data9.="<td class='tabledata'>Sr. No.</td>";
	$data9.="<td class='tabledata'>&nbsp;</td>";
    $data9.="<td class='tabledata'>Item Code</td>";
    $data9.="<td class='tabledata'>Item Name</td>";
    $data9.="<td class='tabledata'>Qty.</td>";
    $data9.="<td class='tabledata'>Price</td>";
    $data9.="<td class='tabledata'>Per Unit</td>";
    $data9.="<td class='tabledata'>Value</td>";
    $data9.="<td class='tabledata'>Discount Type</td>";
	$data9.="<td class='tabledata'>Discount Per</td>";
	$data9.="<td class='tabledata'>Discount Price</td>";
	$data9.="<td class='tabledata'>Value After Discount</td>";
    $data9.="<td class='tabledata'>Total stock Qty</td>";
$data9.="</tr>";*/
 

$i=0; 
//echo "select * from crm_lead_items where mst_leadid='".$_REQUEST['site']."' and del_status=0 ";
$getitem=DB_query("select * from crm_lead_items where mst_leadid='".$_REQUEST['site']."' and del_status=0 ",$db);
while($row=DB_fetch_array($getitem))
{
$item_Codeas=$s->GetFieldValue('item_master',"id='".$row['item_code']."'",'StockID');
$item_names=$s->GetFieldValue('item_master',"id='".$row['item_code']."'",'item_name');
$data9.="<tr class='row1'>";
$data9.="<td style='white-space:nowrap;' class='tabledata'>
<input name='delitemdata[]' type='checkbox' value='' onclick='showdata(".$row['id'].")' /></td>";	
$data9.="<td class='tabledata'><input type='hidden' name='item_code[]' id='itemid_".$i."' value='".$row['item_code']."' /></td>";
$data9.="<td class='tabledata'><input type='text'     value='".$item_Codeas."'  />
<input type='hidden'   id='stockqty1_".$i."' size='9'  value='".$row['stock_qty']."'  /></td>";
$data9.="<td class='tabledata' style='white-space:nowrap'><input type='text'   id=''  value='".$item_names."'  /></td>";
$data9.="<td class='tabledata'><input type='text' name='stock_qty[]'  id='stock_qty1_".$i."' size='9' value='".$row['stock_qty']."'  onkeyup='calcValue(this.value,".$i.")'/></td>";
$data9.="<td class='tabledata'><input type='text' name='stock_price[]' value='".$row['stock_price']."' id='stock_price1_".$i."'  size='6'/></td>";
$data9.="<td class='tabledata'><input type='text' name='stock_perunit[]' onfocus='filldefaultAmt(this.value,this.id)' id='stock_perunit1_".$i."' size='9' value='".$row['stock_perunit']."'/></td>";
$data9.="<td class='tabledata'><input type='text' name='stock_value[]' value='".$row['stock_value']."' id='stock_value1_".$i."' size='9' onfocus='CalculateTotalLeadAmt1(this.value,this.id)'/></td>";
$data9.="<td class='tabledata'><select style='width:80px;' name='PerAmo[]' id='PerAmo1_".$i."' >
            <option value='Amount' >Amount</option>
            <option value='PercentAmt'>Percent Amt</option>
          </select></td>";
$data9.="<td class='tabledata'><input type='text' style='width:35px' name='Discount[]' id='Discount1_".$i."' onkeyup='DiscountAmount(this.value,".$i.")' /></td>";
$data9.="<td class='tabledata'><input type='text' style='width:35px' name='perc[]' id='perc1_".$i."'  readonly='true' style='width:100%;' /></td>";
$data9.="<td class='tabledata'><input type='text' style='width:35px' name='value_dis[]' id='value_dis1_".$i."'  readonly='true' style='width:100%;' /></td>";



$data9.="<td class='tabledata'><input type='text' name='total_stock[]' id='total_stock1_".$i."' style='width:50px;' value='".$row['total_stock']."'  readonly='true' /></td>";
$data9.="</tr>";
$i++;}
/*$data9.="</div>";
$data9.="<input type='hidden' name='' value='".$i."' id='edit_cnt' /> ";
 $data9.="<tbody id='dataTable'>";
 $data9.="<tr class='row1'>";
$data9.="<td style='white-space:nowrap;' class='tabledata'><input name='delitem[]' type='checkbox' value='' />
</td>";	
$data9.="<td class='tabledata'><input type='hidden' name='item_code[]' id='itemid' value='' /></td>";
$data9.="<td class='tabledata'><input type='text' name='' id='itemcode' value='' /></td>";
$data9.="<td class='tabledata' style='white-space:nowrap'><input type='text' name='item_name[]' id='itemname' value='' /></td>";
$data9.="<td class='tabledata'><input type='text' name='stock_qty[]'  id='stock_qty' size='9' onkeyup='calcValue1(this.value,this.id)'  /></td>";
$data9.="<td class='tabledata'><input type='text' name='stock_price[]'  id='stock_price' size='6'/></td>";
$data9.="<td class='tabledata'><input type='text' name='stock_perunit[]' onfocus='filldefaultAmt(this.value,this.id)' id='stock_perunit' size='9' value='1' /></td>";
$data9.="<td class='tabledata'><input type='text' name='stock_value[]'  id='stock_value' size='9' onfocus='CalculateTotalLeadAmt(this.value,this.id)'/></td>";
$data9.="<td class='tabledata'><select style='width:80px;' name='PerAmo[]' id='PerAmo' >
            <option value='Amount' >Amount</option>
            <option value='PercentAmt'>Percent Amt</option>
          </select></td>";
$data9.="<td class='tabledata'><input type='text' style='width:35px' name='Discount[]' id='Discount' onkeyup='DiscountAmount1(this.value,this.id)' /></td>";
$data9.="<td class='tabledata'><input type='text' style='width:35px' name='perc[]' id='perc'  readonly='true' style='width:100%;' /></td>";
$data9.="<td class='tabledata'><input type='text' style='width:35px' name='value_dis[]' id='value_dis'  readonly='true' style='width:100%;' /></td>";



$data9.="<td class='tabledata'><input type='text' name='total_stock[]' id='total_stock' style='width:50px;'   readonly='true' /></td>";
$data9.="</tr>";

$data9.="<input type='hidden' name='against_leadid' id='against_leadid' value='".$_REQUEST['branch']."'>";
$data9.="</tbody>";*/
$data9.="<input type='hidden' name='count1' id='count1' value='".$i."'>";

$data9.="</table>";





echo $data=$data9;
?>
  
