<?php
/**********************************************************************
***********************************************************************/

function can_process_est_boq_item($bogi)
{    
    
    if(!($bogi['est_project_id'] > 0 ))
    {
        $message = ( _("Please Select a Project."));
        $set_focus = ('code');
        return array("success"=>false, "set_focus"=>$set_focus, "message"=>$message);  
    }
    $cod = $bogi['code'];  
    if(!(strlen($cod) > 0))
    {
        $message = ( _("Please Enter Code."));
        $set_focus = ('code');
        return array("success"=>false, "set_focus"=>$set_focus, "message"=>$message);  
    }
    $des = $bogi['description'];   
    if(!(strlen($des) > 0))
    {
        $message = ( _("Please Enter Description."));
        $set_focus = ('description');
        return array("success"=>false, "set_focus"=>$set_focus, "message"=>$message);  
    }
      
    if(!($bogi['billing_type'] > 0 ))
    {
        $message = ( _("Please Select a Billing type."));
        $set_focus = ('billing_type');
        return array("success"=>false, "set_focus"=>$set_focus, "message"=>$message);  
    }
    $rt = $bogi['rate']; 
    if(!($rt > 0 && is_numeric($rt)))
    {
        $message = ( _("Rate must be Numerica and Positive."));
        $set_focus = ('rate');
        return array("success"=>false, "set_focus"=>$set_focus, "message"=>$message);  
    }
      
    $max = $bogi['max_quantity']; 
    if(!($max > 0 && is_numeric($max)))
    {
        $message = ( _("Quantity must be numeric and positive"));
        $set_focus = ('max_quantity');
        return array("success"=>false, "set_focus"=>$set_focus, "message"=>$message);  
    }
      
    if(!($bogi['tax_group_id'] > 0 ))
    {
        $message = ( _("Rate must be Numerica and Positive."));
        $set_focus = ('tax_group_id');
        return array("success"=>false, "set_focus"=>$set_focus, "message"=>$message);  
    }
      
    
    $count = get_existing_code_from_est_project_boq_items($bogi['est_project_id'], $bogi['code'], $bogi['id']);
    if($count > 0)
    {
        $message = ( _("Entered code already exists."));
        $set_focus = ('code');
        return array("success"=>false, "set_focus"=>$set_focus, "message"=>$message);         
    }
    
    return array("success"=>true, "set_focus"=>"", "message"=>"");  
    
}

?>












































