
<style>
.style1 {border-top: solid 1px;border-top-color: #CCCCCC;}
.style21 {border-bottom: solid 1px;border-bottom-color: #CCCCCC;}
.style5 {border-left: solid 1px;border-left-color: #CCCCCC;}
.style3{ border-right: solid 1px;border-right-color: #CCCCCC; }
.style4 {border-bottom: solid 1px;border-bottom-color: #CCCCCC;}
.text{ font-family: Verdana; font-size:13px;}
#tot_amt::-webkit-input-placeholder { color:#666; }
</style>
<?php error_reporting(0);
/***************************** PREVIOUS NEXT CODING ****************************************/
include("../../include/db.php");
ob_start();
session_start();
 $user_id11 = $_SESSION['login_user_id'];

  $edit_ids=$_POST['edit_id']; 
  $book_no=$_POST['book_no'];
  $sql="select * from  jobcard_sublist where job_id='$_POST[edit_id]' ";
  $rs=mysql_query($sql);
  while($rsdata=mysql_fetch_array($rs))
  {
       $sno=$sno+1;
	   $job_id=$rsdata['job_id'];
	   $jobcard_no=$rsdata['jobcard_no'];
	   $quotation_no22=$rsdata['quotation_no'];
   	   $particulars1=$rsdata['particulars'];
	   $width1=$rsdata['width'];
	   $height1=$rsdata['height'];
	   $rate1=$rsdata['rate'];
	   $amount1=$rsdata['amount'];
	   $conformed_amt1=$rsdata['conformed_amt'];
	   $qtyss=$rsdata['qty'];
	   $jobcard_valuesss=$rsdata['jobcard_values'];
	   }
 ?>
<div style="height:220px; width:78%; padding-left:0px;  overflow-x:hidden; overflow-y:scroll; white-space:nowrap; ">
<table width="100%" border="0" cellpadding="0" cellspacing="0" align="center" >
  <tr  bgcolor="#F2F2F2">
    <td width="42" height="25" class="text style5 style1 style21"><strong>&nbsp;S.No&nbsp;</strong></td>
    <td width="588" class="text style1 style5 style21"><strong>&nbsp;&nbsp;Particulars</strong>
      <div id="particulars_validation_div" style="color:#F00"></div></td>
    <td width="159" class="text style1 style5 style21" align="right"><strong>Width</strong><div id="width_validation_div" style="color:#F00"></div>    </td>
    <td width="162" class="text style1 style5 style21" align="right"><strong>Height&nbsp;&nbsp;</strong><div id="height_validation_div" style="color:#F00"></div></td>
    <td width="145" class="text style1 style5 style21" align="right"><strong>Rate&nbsp;&nbsp;</strong><div id="rate_validation_div" style="color:#F00"></div>    </td>
        <td width="145" class="text style1 style5 style21" align="right"><strong>Amt&nbsp;&nbsp;</strong><div id="amt_validation_div" style="color:#F00"></div>        </td>
    <td width="145" class="text style1 style5 style21" align="right"><strong>Confirmed Amt&nbsp;&nbsp;</strong><div id="confirm_amt_validation_div" style="color:#F00"></div>    </td>

    <td width="145" class="text style1 style5 style21" align="right"><strong>Confirmed rate&nbsp;&nbsp;</strong><div id="confirm_rate_validation_div" style="color:#F00"></div>    </td>


    <td width="145" class="text style1 style5 style21" align="right"><strong>Qty&nbsp;&nbsp;</strong><div id="qty_validation_div" style="color:#F00"></div>    </td>
    <td width="145" class="text style1 style5 style21" align="right"><strong>Value&nbsp;&nbsp;</strong><div id="values_validation_div" style="color:#F00"></div>    </td>

    <td width="124" class="text style1 style5 style3 style21" align="center"><strong>Action</strong></td>
 </tr>
   <?php
    $jobcard_no=$_GET['jobcard_no'];
    $jobcard_no1=$_POST['jobcard_no'];
   $quotation_no=$_GET['quotation_no'];
  /* if(($quotation_no=='')||($_POST['quotation_no']==''))
   {
  echo  $sql="select * from   jobcard_sublist where (jobcard_no='$jobcard_no1' or jobcard_no='$jobcard_no' )";
   }
   else
   {  echo  $sql="select * from   jobcard_sublist where (quotation_no='$quotation_no' or quotation_no='$_POST[quotation_no]' or jobcard_no='$jobcard_no1' or jobcard_no='$jobcard_no' )";

   }*/
  
       $sql="select * from   jobcard_sublist where (jobcard_no='$jobcard_no1' or jobcard_no='$jobcard_no')";
  /* }
   else if($_GET['source_frm']=='jobcard_quotation')
   {
	echo    $sql="select * from   jobcard_sublist where quotation_no='$quotation_no' and (jobcard_no='$jobcard_no1' or jobcard_no='$jobcard_no')";
   }*/

    $rs=mysql_query($sql);
	$sno=0;
   		while($rsdata=mysql_fetch_array($rs))
  			{ 
   				$sno=$sno+1;
   				$job_id=$rsdata['job_id'];
     			$jobcard_no=$rsdata['jobcard_no'];
				$quotation_no=$rsdata['quotation_no'];
				$particulars=$rsdata['particulars'];
   				$width=$rsdata['width'];
				$height=$rsdata['height'];
				$rate=$rsdata['rate'];
				$amount=$rsdata['amount'];
				$conformed_amt=$rsdata['conformed_amt'];
        $conformed_rate=$rsdata['conformed_rate'];
        $customer_rate=$rsdata['customer_rate'];
				$qty=$rsdata['qty'];
				$jobcard_values=$rsdata['jobcard_values'];
				if($weight_kg=="0.00")
				{
					$weight_kg_res='';
				}
				else
				{
					$weight_kg_res=$weight_kg;
				}
				$kg_rate=$rsdata['kg_rate'];
				
				if($kg_rate=="0.00")
				{
					$kg_rate_res='';
				}
				else
				{
					$kg_rate_res=$kg_rate;
				}
				$frieght_charge=$rsdata['frieght_charge'];
				$conformed_rate=($conformed_amt)/($width*$height); 
				$row=$row+1;
								  $row1=$row%2;
								  if($row1==0)
								  {
								  $class='style="background-color:#f6faff;border-bottom:solid 1px;border-color:#E2E2E2"';
								  }
								  else
								  {
								  $class='style="background-color:#f3f3ff;border-bottom:solid 1px;border-color:#E2E2E2"';
								  }
  ?>
   <tr>
      <td width="42" height="27"  align="center" class="text style4  style5"><?php echo $sno; ?></td>
      <td width="588" align="left" class="text style5 style4" style="padding-left:2px;">&nbsp;&nbsp;<?php echo $particulars;?></td>
      <td width="159" align="right" class="text style5 style4"><?php echo $width;?>&nbsp;&nbsp;</td>
      <td width="162" align="right" class="text style5 style4"><?php echo $height;?>&nbsp;&nbsp;</td>
      <td width="145" align="right" class="text style5 style4"><?php echo number_format($rate,4);?>&nbsp;&nbsp;</td>
      <td width="145" align="right" class="text style5 style4"><?php echo $amount;?>&nbsp;&nbsp;</td>
      <td width="145" align="right" class="text style5 style4"><?php echo $conformed_amt;?>&nbsp;&nbsp;</td>

      <td width="145" align="right" class="text style5 style4"><?php echo number_format($conformed_rate, 3);?>&nbsp;&nbsp;</td>

      <td width="145" align="right" class="text style5 style4"><?php echo number_format($qty,2);?>&nbsp;&nbsp;</td>
      <td width="145" align="right" class="text style5 style4"><?php echo number_format($jobcard_values,2);?>&nbsp;&nbsp;</td>
      <?php if(($user_id11=='1')||($user_id11=='3'))
	 { 
	 ?><td width="124" colspan="2"  align="center" class="style5 style3 style4" > <img src="img/edit-icon.png" onClick="edit_jobcard_sub('<?php echo $job_id;?>','<?php echo $jobcard_no; ?>','<?php echo $_GET['quotation_no']; ?>','<?php echo $_GET['source_frm']; ?>')" width="18px" height="18px">&nbsp;&nbsp;&nbsp;<img src="img/cross-small.png"  title="Delete" onClick="del_jobcard_sub('<?php echo $job_id;?>','<?php echo $jobcard_no; ?>')" width="20px" height="20px"></td><?php } ?>
  </tr>
    <?php 
    $qty1+=$qty;
    $jobcard_values1+=$jobcard_values;
    $width12+=$width;
    $height12+=$height;

	} ?>
 <tr height="20px">
    <td width="42" height="28"  align="center" class="text style4 style5" ><?php echo $sno+1; ?></td>
      <td width="588" align="left" class="style5" ><input type="text" class="types_class1" name="particulars" id="particulars" tabindex="10" onkeypress="enterevent(event,'jobcard_width','particulars')" onkeyup="jobcard_sub_clear_validation(this.value)" style="width:100%; height:100%;"  
    value="<?php if($edit_ids!=''){ echo $particulars1; } ?>" /></td>
    <td align="center" class="style5 "><input type="text" class="types_class1" name="jobcard_width" id="jobcard_width" tabindex="11" onKeyUp="get_jobcard_amt(this.value,jobcard_height.value,rate.value)" onKeyPress="if ((event.keyCode &lt; 46) || (event.keyCode &gt; 57)) event.returnValue = false,enterevent(event,'jobcard_height','jobcard_width')"  style="width:100%; height:100%;"  
    value="<?php if($edit_ids!=''){ echo $width1; } ?>" /></td>
    <td align="center" class="style5 "><input type="text" name="jobcard_height" id="jobcard_height"  class="types_class1" tabindex="12"  onKeyUp="get_jobcard_amt(jobcard_width.value,this.value,rate.value)" onKeyPress="if ((event.keyCode &lt; 46) || (event.keyCode &gt; 57)) event.returnValue = false,enterevent(event,'rate','jobcard_height')" style="width:100%; height:100%;"  
    value="<?php if($edit_ids!=''){ echo $height1; } ?>" /></td>
    <td align="center" class="style5 "><input type="text" name="rate" id="rate" onKeyUp="get_jobcard_amt(jobcard_width.value,jobcard_height.value,this.value)" onkeypress="enterevent(event,'conformed_amt','rate')" tabindex="13"  class="types_class1"  style="width:100%; height:100%;"  
    value="<?php if($edit_ids!=''){ echo number_format($rate1,4); } ?>" />
  </td>
    <td align="center" class="style5 "><input type="text" name="amount" id="amount" onKeyUp="jobcard_sub_clear_validation(this.value)"  class="types_class1"  style="width:100%; height:100%;"  
    value="<?php if($edit_ids!=''){ echo $amount1; } ?>" readonly/></td>

   <td align="center" class="style5">
    <input type="text" 
           name="conformed_amt" 
           id="conformed_amt" 
           onkeyup="get_jobcard_tot(this.value, qty.value); get_jobcard_amt_tot(jobcard_width.value,jobcard_height.value,this.value);" 
           onkeypress="enterevent(event,'qty','conformed_amt')" 
           tabindex="14"  
           class="types_class1"  
           style="width:100%; height:100%;"  
           value="<?php if($edit_ids!=''){ echo $conformed_amt1; } ?>" />
</td>

        <input type="hidden" name="ratetrrrr" id="ratetrrrr"  value="<?php if($edit_ids!=''){ echo $customer_rate; } ?>"/>


 <td align="center" class="style5 "><input type="text" name="conform_rate" id="conform_rate" onKeyUp="jobcard_sub_clear_validation(this.value)"  class="types_class1"  style="width:100%; height:100%;"  
    value="<?php if($edit_ids!=''){ echo number_format($conformed_rate, 3);} ?>" readonly/></td>




    <?php $sql_user_1="select * from media_sub_list where jobcard_no='$jobcard_no'";
	  $rs_user_1=mysql_query($sql_user_1);
	  $rs_count_1=mysql_num_rows($rs_user_1); if($rs_count_1 == '0'){?>

    <td align="center" class="style5 "><input type="text" name="qty" id="qty" onKeyUp="get_jobcard_tot(conformed_amt.value,this.value)" onkeypress="enterevent(event,'add','qty')" tabindex="15"  class="types_class1"  style="width:100%; height:100%;"  
    value="<?php if($edit_ids!=''){ echo $qtyss; }?>" /></td>
    <?php } else { ?> <td align="center" class="style5 "><input type="text" name="qty" id="qty" onKeyUp="get_jobcard_tot(conformed_amt.value,this.value)" onkeypress="enterevent(event,'add','qty')" tabindex="15"  class="types_class1"  style="width:100%; height:100%;"  
    value="<?php if($edit_ids!=''){ echo $qtyss; }?>" readonly onclick="javascript:alert_job_details_12()"; /></td>
    <?php } ?>


    <td align="center" class="style5 "><input type="text" name="values" id="values" readonly onKeyUp="jobcard_sub_clear_validation(this.value)" onkeypress="enterevent(event,'add','freight_rs')"   class="types_class1"  style="width:100%; height:100%;"  
    value="<?php if($edit_ids!=''){ echo $jobcard_valuesss; } ?>" /></td>
    <td colspan="2"><input type="button" name="add" id="add" tabindex="16" value="<?php if($edit_ids!='') { echo "EDIT"; } else { echo "ADD"; } ?>" style="width:100%; height:120%;" onClick="jobcard_sub_list(jobcard_no.value,entry_time.value,created_by.value,cust_po_no.value,customer_name.value,jobtype.value,fabric_type.value,hsn_code.value,particulars.value,jobcard_width.value,jobcard_height.value,rate.value,amount.value,conformed_amt.value,conform_rate.value,qty.value,ratetrrrr.value,values.value,'<?php echo $edit_ids;?>','<?php if($_GET['quotation_no']!='') { echo $_GET['quotation_no']; } else { echo  $_POST['quotation_no'];  }?>',this.value),enterevent(event,'tax','add'),reload_div();"></td>
  </tr>
  <tr>
  <td class="style5"></td>
  <td><div id="book_particulars_valid_div" style="color:#F00"></div></td>
  <td>  </td>
    <td></td>
    <td></td>
    <td></td>
    <td></td>
    <td></td>
    <td></td>

    <td class="style3"><input type="hidden" name="overal_tot" id="overal_tot"  value="<?php  echo $jobcard_values1; ?>" /></td>
    <td class="style3"><input type="hidden" name="overal_width" id="overal_width"  value="<?php  echo $width12; ?>" /></td>
    <td class="style3"><input type="hidden" name="overal_height" id="overal_height"  value="<?php  echo $height12; ?>" /></td>
     <td class="style3"><input type="hidden" name="overal_qty" id="overal_qty"  value="<?php  echo $qty12; ?>" /></td>
    </tr>
 <tr height="160px">
   <td colspan="10"  align="center" class="style4 style3 style5" ><table width="100%" border="0" cellpadding="0" cellspacing="0">
    
   </table></td>
   </tr>
    <tr>    </tr>
    </table>
   
</div>
  <table width="119%">
     <tr >
   <td colspan="6"  align="center" ></td>
      <td width="9%"></td>
    <td width="9%"><span class="text" style="font-size: 14px;"><strong><strong>Total</strong></strong></span></td>
    <td width="15%"  class="text" style="font-size: 14px;">&nbsp;</td>
    <td width="7%" class="text" style="font-size: 14px;"><strong><?php echo number_format($qty1,2);?></strong></td>
        <td width="12%" class="text" style="font-size: 14px;"><strong><?php echo number_format($jobcard_values1,2);?></strong><input type="hidden" name="net_amt" id="net_amt" class="types_class1" value="<?php echo $jobcard_values1;?>" readonly style="width:124px; font-weight:bold; font-size: 18px"></td>
    <td width="24%"></td>

   </tr>


    </table>

    <script>

function alert_job_details_12()
{
alert('already inserted media entry');
}

    </script>