a:10:{i:0;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:27:"fv2_greige_grpcs_edit_grid2";s:4:"nome";s:0:"";s:4:"tipo";s:0:"";s:5:"parms";s:0:"";s:6:"codigo";s:4:"

";}i:1;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:27:"fv2_greige_grpcs_edit_grid2";s:4:"nome";s:16:"DEFECTS_onChange";s:4:"tipo";s:1:"A";s:5:"parms";s:0:"";s:6:"codigo";s:9:"ch_rpd();";}i:2;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:27:"fv2_greige_grpcs_edit_grid2";s:4:"nome";s:17:"LBS_RECD_onChange";s:4:"tipo";s:1:"A";s:5:"parms";s:0:"";s:6:"codigo";s:120:"if ({dye_order} == '')
{
{lbs_open}={lbs_recd};
{lbs_used}=0;
}
else
{
{lbs_used}={lbs_recd};
{lbs_open} = 0;
}";}i:3;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:27:"fv2_greige_grpcs_edit_grid2";s:4:"nome";s:14:"RACKS_onChange";s:4:"tipo";s:1:"A";s:5:"parms";s:0:"";s:6:"codigo";s:9:"ch_rpd();";}i:4;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:27:"fv2_greige_grpcs_edit_grid2";s:4:"nome";s:6:"ch_rpd";s:4:"tipo";s:1:"M";s:5:"parms";s:0:"";s:6:"codigo";s:26:"{rpd} = {racks}/{defects};";}i:5;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:27:"fv2_greige_grpcs_edit_grid2";s:4:"nome";s:13:"onAfterDelete";s:4:"tipo";s:1:"E";s:5:"parms";s:0:"";s:6:"codigo";s:17:"update_master2();";}i:6;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:27:"fv2_greige_grpcs_edit_grid2";s:4:"nome";s:13:"onAfterInsert";s:4:"tipo";s:1:"E";s:5:"parms";s:0:"";s:6:"codigo";s:17:"update_master2();";}i:7;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:27:"fv2_greige_grpcs_edit_grid2";s:4:"nome";s:13:"onAfterUpdate";s:4:"tipo";s:1:"E";s:5:"parms";s:0:"";s:6:"codigo";s:17:"update_master2();";}i:8;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:27:"fv2_greige_grpcs_edit_grid2";s:4:"nome";s:9:"onLoadAll";s:4:"tipo";s:1:"E";s:5:"parms";s:0:"";s:6:"codigo";s:0:"";}i:9;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:27:"fv2_greige_grpcs_edit_grid2";s:4:"nome";s:14:"update_master2";s:4:"tipo";s:1:"M";s:5:"parms";s:0:"";s:6:"codigo";s:1596:"//NOT-THIS CODE TESTED AND WORKS-CS 05/15/2016

$inv={invoice};
$po={p_o_number};

$check_sql = "SELECT SUM(lbs_recd) FROM grpcs
WHERE grpcs.invoice = '{invoice}'";
sc_lookup(erg,$check_sql);

if(isset({erg[0][0]}))
{
$new_lbs={erg[0][0]};
$update_phrase = "
UPDATE ngo 
set lbs = '{$new_lbs}'
WHERE ngo.invoice = '{invoice}'
";
sc_exec_sql($update_phrase);
}	

$check_sql = "SELECT SUM(lbs),sum(totalkc) FROM ngo
WHERE ngo.p_o_number = '{p_o_number}'";
sc_lookup(erg,$check_sql);
if(isset({erg[0][0]}))
{
$new_lbs={erg[0][0]};
$tkc={erg[0][1]};
$update_phrase = "
UPDATE greigepo 
set lbs = '{$new_lbs}',lbs_open=lbs_ordere-lbs,totalkc='{$tkc}',cost_lb_k=totalkc/lbs
WHERE greigepo.p_o_number = '{p_o_number}'
";
sc_exec_sql($update_phrase);
}	

$check_sql = "SELECT SUM(lbs_recd),sum(lbs_used) FROM grpcs
WHERE (grpcs.p_o_number = '{p_o_number}') AND 
(grpcs.dye_order='')";
sc_lookup(erg,$check_sql);
if(isset({erg[0][0]}))
{
$new_lbs={erg[0][0]};
$new_dye_lbs={erg[0][1]};
$update_phrase = "
UPDATE greigepo 
set pinv = '{$new_lbs}',lbs_dyed='{$new_dye_lbs}',inventory=lbs-lbs_dyed
WHERE greigepo.p_o_number = '{p_o_number}'
";
sc_exec_sql($update_phrase);
}	
$check_sql = "SELECT SUM(lbs_used) FROM grpcs
WHERE (grpcs.p_o_number = '{p_o_number}') AND 
(grpcs.dye_order<>'')";
sc_lookup(erg,$check_sql);
if(isset({erg[0][0]}))
{
$new_lbs={erg[0][0]};
$update_phrase = "
UPDATE greigepo 
set lbs_dyed = '{$new_lbs}',inventory=lbs-lbs_dyed+adjustment
WHERE greigepo.p_o_number = '{p_o_number}'
";
sc_exec_sql($update_phrase);
}

";}}