<?php
ini_set('display_errors',1);
session_start();
include('script/condb.php');

$PID=$_GET['pd'];

$sql= "SELECT * FROM wall_calculation where blocktype ='9 inches Hollow Block' AND PID='$PID' ";
$result =mysqli_query($con, $sql);
while($rows =mysqli_fetch_array($result)){  
$A_5 =$rows["walllength"];	
}
//----------------blocksetting---------------

//------------receivedfromform-------------------------------
if(isset($_POST['trench'])){
$SomeLabourers_1B =$_POST['somelabourer_1B'];
$SomeLabourers_1C =$_POST['somelabourer_1C'];
$SomeLabourers_1D =$_POST['somelabourer_1D'];
	
$is44 ="SELECT * FROM upline_app_laboursettings WHERE ID='2'";
	$ise44 =mysqli_query($con, $is44);
		while($rec44=mysqli_fetch_array($ise44)){
	$SomeLabourers_1B=$rec44['SomeLabourers_1B']; $labourer_price=$rec44['labourer_price'];}
	
	/*$sql2= "SELECT * FROM upline_app_laboursettings where labour_name='Partition of Excavation'";
$result2 =mysqli_query($con, $sql2);
while($rows2 =mysqli_fetch_array($result2)){  
$SomeLabourers_1B2 =$rows2['SomeLabourers_1B'];
$labourer_price =$row2['labourer_price']; }*/
	
$partitionTrenches =number_format(($A_5/$SomeLabourers_1B),2);
	
$LabourerDescription ='Partition in Trench';
$COETotal =$labourer_price*$partitionTrenches;
	
//--------------results------------------------- somelabourer_1B
	$fl="INSERT INTO `foundation_labourer` (`PID`, `LabourerDescription`, `COEQuantity`, `BOQQuantity`, `Extra`, `Price`, `COETotal`, `BOQTotal`) VALUES('$PID', '$LabourerDescription','$partitionTrenches','0','0','$labourer_price','$COETotal','0')" ;
	$fl23 =mysqli_query($con, $fl);
	
	if($fl23){
		 header("Location:stagesofproject.php?id=$PID"); }
	
}





/*echo $A_5 .'<br>';
echo $SomeLabourers_1B. '<br>';
echo $partitionTrenches;*/

?>
