<?php 
if($_REQUEST['action']=='View')
{
	$condition="id='".$_REQUEST['TVID']."'";
	$GetRec=$s->GetRecordById('technician_visit_entry',  $condition);
	$GetRecRow=DB_fetch_array($GetRec);
	extract($GetRecRow);
}

?>
<link rel="stylesheet" href="css/new_mxerp.css">
<div class="body_contain">
<div class="tab_div">
<h1>Technician Visit entry</h1>
<h3 style="text-align:right; margin-right:10px;"><a href="#" onclick="popup('TechVisitDetails-print.php?tvid=<?php echo $_REQUEST['TVID'];?>&modid=<?php echo $_REQUEST['modid'];?>&frmid=<?php echo $_REQUEST['frmid'];?>&print=Buyer',1200,600)"><b>Print</b></a></h3>

<h3 align="center">General Details</h3>
<table width="100%" border="1" cellpadding="3" cellspacing="0" style="border-collapse:collapse; border:#666666 solid 1px;">
<tr>
<td class="tabledata" scope="row" style="width:146px;">Branch Name</td>
<td><?php echo $branch_name; ?></td>
<td class="tabledata">Visit Date</td>
<td><?php echo ConvertSQLDate($visit_date); ?></td>
</tr>
<tr>
<td class="tabledata">Visit No.</td>
<td><?php echo $visit_no ; ?></td>
<td class="tabledata">Party Name</td>
<td><?php echo $s->GetFieldValue('clientmaster',"id='".$party_name."'",'c_name'); ?></td>
</tr>
<tr>
<td class="tabledata">Job Card No</td>
<td><?php echo $s->GetFieldValue('trouble_ticket_jobcard',"id='".$job_card_no."'",'job_card_number'); ?></td>
<td class="tabledata">Product name</td>
<td><?php echo $s->GetFieldValue('item_master',"id='".$product_name."'",'item_name'); ?></td>
</tr>

<tr>
<td class="tabledata">TT No.</td>
<td><?php echo $s->GetFieldValue('trouble_ticket_creation',"id='".$tt_no."'",'ticket_number'); ?></td>
<td class="tabledata">Invoice No</td>
<td><?php echo $invoice_no; ?></td>
</tr>
<tr>
<td class="tabledata">Serial No</td>
<td><?php echo $serial_no; ?></td>
<td class="tabledata">Technician</td>
<td><?php echo $s->GetFieldValue('technicians',"id='".$technician."'",'technician'); ?></td>
</tr>
<tr>
<td class="tabledata">Scope of Service</td>
<td><?php if($scope_of_services==1){echo 'Complaint';}
						  if($scope_of_services==2){echo 'Installation';}
						  if($scope_of_services==3){echo 'De-Installation';}
						  if($scope_of_services==4){echo 'Re-Installation';}
						  if($scope_of_services==5){echo 'Preventive';}
						  if($scope_of_services==6){echo 'Service';}
						  if($scope_of_services==7){echo 'Site Survey';} ?></td>
<td class="tabledata">Status</td>
<td><?php if($status='2'){echo 'In Process';} ?></td>
</tr>
</table>
<h3 align="center">Fault Descriptions</h3>

<table width="100%" border="1" cellpadding="3" cellspacing="0" style="border-collapse:collapse; border:#666666 solid 1px;">
<tr>
<td class="tabledata" style="width:146px;">Fault Details</td>
<td colspan="3"><?php echo $fault_details; ?></td>
</tr>
<tr>
<td class="tabledata">Current Status</td>
<td colspan="3"><?php echo $current_status; ?></td>
</tr>

<tr>
<td class="tabledata">Problem Remarks</td>
<td colspan="3"><?php echo $problem_remark; ?></td>
</tr>
</table>
<h3 align="center">Spare Parts & services Details</h3>
<div style="width:auto; overflow:auto; border:#006699 solid 2px;">
        <p align="left" style="padding-top:5px; padding-bottom:5px;">
        </p>
		<h3 align="center">Spare Parts</h3>
        <div style="width:auto; overflow:auto;">
          <div id="showdata">
            <table width="100%" border="1" cellspacing="0" cellpadding="3">
              <tr>
                <td width="58" class="tabledata">S. No.</td>
                <td width="166" class="tabledata">Item Name</td>
               <!-- <td class="tabledata">Qty in Stock </td>-->
                <td width="172" class="tabledata">Req. Qty.</td>
                <td width="192" class="tabledata">Price</td>
                <td width="176" class="tabledata">Total amount</td>
              </tr>
              <tbody id="dataTable">
			  <?php 
			  $i=0;
		$ItemList=DB_query("select * from technician_visit_entry_details where parant_id='".$_REQUEST['TVID']."'",$db);			  
			  while($ItemRow=DB_fetch_array($ItemList)) {?>
                <tr bgcolor="#c1c1c1">
                  <td><?php echo $i+1; ?></td>
                  <td><?php echo $s->GetFieldValue('item_master',"id='".$ItemRow['item_name']."'",'item_name'); ?></td>
                <!--  <td>&nbsp;</td>-->
                  <td><?php echo $ItemRow['req_qty']; ?></td>
                  <td><?php echo $ItemRow['price']; ?></td>
                  <td><?php echo $ItemRow['tptal_amt']; ?></td>
                </tr>
				<?php $i++;} ?>
              </tbody>
            </table>
          </div>
        </div>
	<?php  $Service = DB_query("SELECT * FROM technician_service_visit where parant_id='".$_REQUEST['TVID']."'",$db);
			 if(DB_num_rows($Service)>0){ ?>
		<h3 align="center">services Details</h3>
		<div style="width:auto; overflow:auto;">
			<div id="back">
					<table width="100%" border="1" cellspacing="0" cellpadding="0" style="border:#666666 solid 1px;">
				   <tr>
					<td width="76" class="tabledata">S. No.</td>
					<td width="229" class="tabledata">&nbsp;</td>
					<td width="229" class="tabledata">Service Type</td>
					<td width="251" class="tabledata">Service Description</td>
					<td width="151" class="tabledata">Billable</td>
					<td width="240" class="tabledata">Service Amount</td>
				  </tr>
				  <tbody id="serviceID">
				   <?php $i=0; while($ServiceRow=DB_fetch_array($Service)) { ?>
					<tr bgcolor="#c1c1c1">
				  <td><?php echo $i+1; ?></td>
				  <td><?php echo $ServiceRow['service_name']; ?></td>
				  <td><?php echo $s->GetFieldValue('services_type',"id='".$ServiceRow['service_type']."'",'service_type'); ?></td>
				  <td><?php echo $s->GetFieldValue('services_description',"id='".$ServiceRow['service_description']."'",'service_description'); ?></td>
				   <td><?php if($ServiceRow['billable']=='Y'){echo 'YES';}if($ServiceRow['billable']=='N'){echo 'NO';} ?></td>
				  <td><?php echo $ServiceRow['service_amt']; ?></td>
					</tr>
					<?php $i++;} ?>
				  </tbody>
			</table>
			</div>
		</div>
		<?php } ?>
        </p>
        <div style="width:32%; float:right;">
          <table width="100%" border="1" cellspacing="0" cellpadding="3" style="border:#999999 solid 1px;">
            <tr>
              <td class="tabledata" style="width:120px;">Material Total  Amt</td>
              <td><?php echo $Total_material_Amt; ?></td>
            </tr>
             <tr>
              <td class="tabledata">Vat/Cst</td>
              <td>
			  <?php echo $s->GetFieldValue('sales_tax_master',"salestax_id='".$vat_cst."'",'tax_code')." | ".$VatCstValue; ?>
              </td>
            </tr>
           <tr>
		   <td class="tabledata">Service Total Amt</td>
		   <td><?php echo $service_total_amt; ?></td>
		   </tr>
		    <tr>
              <td class="tabledata">Service Tax</td>
      <td><?php echo $s->GetFieldValue('service_tax_master',"id='".$service_tax."'",'tax_code')." | ".$service_tax_value; ?></td>
            </tr>
			 <tr>
		   <td class="tabledata">Other Amt</td>
		   <td><?php echo $other_charges; ?></td>
		   </tr>
            <tr>
              <td class="tabledata">Grand Total</td>
              <td><?php echo $grand_total; ?></td>
            </tr>
          </table>
        </div>
        <div class="cl"></div>
      </div>
<table width="100%" border="1" cellpadding="3" cellspacing="0" style="border-collapse:collapse; border:#666666 solid 1px;">
<tr>
<td class="tabledata" style="width:146px;">Client Remarks</td>
<td colspan="3"><?php echo $client_remark; ?></td>
</tr>
<tr>
<td class="tabledata">Remarks by Technician</td>
<td colspan="3"><?php echo $remark_by_technician; ?></td>
</tr>
</table>
</div></div>

