PHP Code:
<?php
include 'config.php';
$query "SELECT * FROM clt_transact WHERE clt_no = '$clt_no'";
            
$result_no mysql_query($query);
            if(
$result_no)
                {
                if(
mysql_num_rows($result_no) > 0)
                    {
                    
                    
$spreading_input 0;
                    
$clicking_output 0;
                    
                    
$query  "SELECT SUM(t.input_qty) AS spreading_input FROM clt_traceability t, clt_transact p WHERE t.clt_transact_id = p.clt_transact_id AND t.operation_name='Total1' AND p.clt_no = '$clt_no'";
                    
$resultyield mysql_query($query);
                    if(
$resultyield)
                        {
                        if(
mysql_num_rows($resultyield) > 0$spreading_input mysql_result($resultyield,0,"spreading_input");
                        }
                    
                    
$query  "SELECT SUM(t.output_qty) AS clicking_output FROM clt_traceability t, clt_transact p WHERE t.clt_transact_id = p.clt_transact_id AND t.operation_name='Total2' AND  p.clt_no = '$clt_no'";
                    
$resultyield mysql_query($query);
                    if(
$resultyield)
                        {
                        if(
mysql_num_rows($resultyield) > 0$clicking_output mysql_result($resultyield,0,"clicking_output");
                        }
                        
                          
                        
                      
$query  "SELECT cloth_type FROM clt_transact WHERE cloth_type IN ('AAA', 'BBB', 'CCC')";
                       
$record mysql_query($query);
                       
$result mysql_fetch_assoc($record);
                       
$cloth_type $result['cloth_type']; 
                       if (
$cloth_type == 'AAA' || $cloth_type == 'BBB' || $cloth_type == 'CCC') {
                        
$CLT_yield = @($clicking_output / ($spreading_input 8.8)) * 100;
                        }     
                       else {
                        
$CLT_yield = @($clicking_output / ($spreading_input 9)) * 100;
                        }
?>

Last edited by shabbir; 4Jan2011 at 14:40.. Reason: Code blocks