validate detail from master using recordset on validate calling php function

this code is giving me _apl.php for example
Parse error: syntax error, unexpected ‘$this’ (T_VARIABLE) in /opt/NetMake/v81/wwwroot/scriptcase/app/***_apl.php on line 9470
which is not related to this code

on validate event
$msg = check_stock();
if (!$msg == ‘valid’)
{
sc_error_message($msg);
sc_error_exit();
}

check_stock()

if ({job_status} == ‘CLOSED’){
/**

  • Selecting a field from another table using the recordset
    */

// Check for record
$check_sql = "SELECT part_id,part_qty FROM job_card_part WHERE job_id = " . {job_id};
echo $check_sql;
sc_set_fetchmode(0);
sc_select(rs, "SELECT part_id,part_qty FROM job_card_part WHERE job_id = " . {job_id});

while(!$rs->EOF)
{
$flag = true;
if ($rs->fields[part_qty] > 0)
{
// Check for stock balance start
$check_sql = “SELECT stk_bal "
. " FROM sc_stock”
. " WHERE part_id = $rs->fields[part_id] and service_center_id = [service_center_id]";
sc_lookup(rs, $check_sql);

        if ({rs} === false)
        {
            $msg = "Access error. Message=". {rs_erro} . $check_sql;
            $flag = false;
            $rs->Close();
            break;
        }
        elseif (empty({rs}))
        {
            $msg = "No Stock Available for this Part ";
            $flag = false;
            break;                
        }
        else
        {
            if ($rs->fields[part_qty] > {rs[0][0]})
            {
                $msg = 'Part does not have sufficient balance. Available stock :' .{rs[0][0]};
                $flag = false;
                break;
            }
        }

            // Check for stock balance end
        }


            $rs->MoveNext();
        }
        $rs->Close();

}
if ($flag)
{
return “valid”;
}
else
{
return $msg;
}

Without line numbers? Open your file opt/NetMake/v81/wwwroot/scriptcase/app/***_apl.php andlook at the source code. The error is around that given line… So for these kinds of errors you need to look at the GENERATED code. That will go a lot quicker.

if i remove the above code application work fine and there is no error on this code so it confusing.

Parse error: syntax error, unexpected ‘$this’ (T_VARIABLE) in /opt/NetMake/v81/wwwroot/scriptcase/app/wahlindia/ff_job_card/ff_job_card_apl.php on line 9501
i had also attached the file

9466| function discount_amount_onChange()
9467| {
9468| $_SESSION[‘scriptcase’][‘ff_job_card’][‘contr_erro’] = ‘on’;
9469| if (!isset($this->sc_temp_sl_discper)) {$this->sc_temp_sl_discper = (isset($_SESSION[‘sl_discper’])) ? $_SESSION[‘sl_discper’] : “”;}
9470|
9471| $original_discount_amount = $this->discount_amount;
9472| $original_part_charge = $this->part_charge;
9473| $original_discount_per = $this->discount_per;
9474| $original_sub_total = $this->sub_total;
9475| $original_vat_per = $this->vat_per;
9476| $original_st_per = $this->st_per;
9477| $original_job_charge = $this->job_charge;
9478| $original_vat_amount = $this->vat_amount;
9479| $original_st_amount = $this->st_amount;
9480| $original_roundoff = $this->roundoff;
9481| $original_total_amount = $this->total_amount;
9482|
9483| $this->discount_amount = $this->discount_amount ;
9484| $ldec_grossamt = $this->part_charge ;
9485| if ($this->discount_amount == Null)
9486| {
9487| $discount_amount=0;
9488| }
9489|
9490| If ($this->discount_amount <> 0)
9491| {
9492| $this->discount_amount = round($this->discount_amount,2);
9493| $this->discount_per = $this->discount_amount / $ldec_grossamt * 100;
9494| $this->discount_per = round($this->discount_per,2);
9495| $this->discount_per = $this->discount_per;
9496| }
9497| else
9498| {
9499| $this->discount_per = 0;
9500| }
9501| $this->sc_temp_sl_discper = $this->discount_per;
9502| $this->sub_total = $ldec_grossamt - $this->discount_amount;
9503| $this->sub_total = round($this->sub_total,2);
9504| $this->sub_total = $this->sub_total; $this->calculate_tax();
9505|
9506|
9507| if (isset($this->sc_temp_sl_discper)) { $_SESSION[‘sl_discper’] = $this->sc_temp_sl_discper;}
9508| $_SESSION[‘scriptcase’][‘ff_job_card’][‘contr_erro’] = ‘off’;
9509| $modificado_discount_amount = $this->discount_amount;
9510| $modificado_part_charge = $this->part_charge;
9511| $modificado_discount_per = $this->discount_per;
9512| $modificado_sub_total = $this->sub_total;
9513| $modificado_vat_per = $this->vat_per;
9514| $modificado_st_per = $this->st_per;
9515| $modificado_job_charge = $this->job_charge;
9516| $modificado_vat_amount = $this->vat_amount;
9517| $modificado_st_amount = $this->st_amount;
9518| $modificado_roundoff = $this->roundoff;
9519| $modificado_total_amount = $this->total_amount;
9520| $this->nm_formatar_campos(‘discount_amount’, ‘part_charge’, ‘discount_per’, ‘sub_total’, ‘vat_per’, ‘st_per’, ‘job_charge’, ‘vat_amount’, ‘st_amount’, ‘roundoff’, ‘total_amount’);
9521| if ($original_discount_amount !== $modificado_discount_amount || (isset($bFlagRead_discount_amount) && $bFlagRead_discount_amount))
9522| {
9523| $this->ajax_return_values_discount_amount(true);
9524| }
9525| if ($original_part_charge !== $modificado_part_charge || (isset($bFlagRead_part_charge) && $bFlagRead_part_charge))
9526| {
9527| $this->ajax_return_values_part_charge(true);
9528| }
9529| if ($original_discount_per !== $modificado_discount_per || (isset($bFlagRead_discount_per) && $bFlagRead_discount_per))
9530| {
9531| $this->ajax_return_values_discount_per(true);
9532| }
9533| if ($original_sub_total !== $modificado_sub_total || (isset($bFlagRead_sub_total) && $bFlagRead_sub_total))
9534| {
9535| $this->ajax_return_values_sub_total(true);
9536| }
9537| if ($original_vat_per !== $modificado_vat_per || (isset($bFlagRead_vat_per) && $bFlagRead_vat_per))
9538| {
9539| $this->ajax_return_values_vat_per(true);
9540| }
9541| if ($original_st_per !== $modificado_st_per || (isset($bFlagRead_st_per) && $bFlagRead_st_per))
9542| {
9543| $this->ajax_return_values_st_per(true);
9544| }
9545| if ($original_job_charge !== $modificado_job_charge || (isset($bFlagRead_job_charge) && $bFlagRead_job_charge))
9546| {
9547| $this->ajax_return_values_job_charge(true);
9548| }
9549| if ($original_vat_amount !== $modificado_vat_amount || (isset($bFlagRead_vat_amount) && $bFlagRead_vat_amount))
9550| {
9551| $this->ajax_return_values_vat_amount(true);
9552| }
9553| if ($original_st_amount !== $modificado_st_amount || (isset($bFlagRead_st_amount) && $bFlagRead_st_amount))
9554| {
9555| $this->ajax_return_values_st_amount(true);
9556| }
9557| if ($original_roundoff !== $modificado_roundoff || (isset($bFlagRead_roundoff) && $bFlagRead_roundoff))
9558| {
9559| $this->ajax_return_values_roundoff(true);
9560| }
9561| if ($original_total_amount !== $modificado_total_amount || (isset($bFlagRead_total_amount) && $bFlagRead_total_amount))
9562| {
9563| $this->ajax_return_values_total_amount(true);
9564| }
9565| ff_job_card_pack_ajax_response();
9566| exit;
9567| }

I dont directly see it. I suggest you comment out all your custom code and line by line uncomment + generate it…
Mostly it is some comma, { or whatever that is not correct.