a:15:{i:0;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:33:"fv2_greige_grpcs_keyoff_multiform";s:4:"nome";s:14:"Remove_onClick";s:4:"tipo";s:1:"A";s:5:"parms";s:0:"";s:6:"codigo";s:172:"$varinvoice=strtoupper([var_invoice]);
if({invoice}<>$varinvoice)
{	
	$inv_change=$varinvoice;
	;
}
else
	{
	$inv_change=''			;
		}
{invoice}=$inv_change;

	
	";}i:1;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:33:"fv2_greige_grpcs_keyoff_multiform";s:4:"nome";s:11:"calc_fields";s:4:"tipo";s:1:"M";s:5:"parms";s:0:"";s:6:"codigo";s:202:"{rpd}={racks}/{defects};
$check_sql = "SELECT cost_lb FROM greigepo
WHERE greigepo.p_o_number = '[var_po]'";
sc_lookup(erg,$check_sql);
{cost_lb_g}={erg[0][0]};
{total_cost}={cost_lb_g}*{lbs_recd};";}i:2;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:33:"fv2_greige_grpcs_keyoff_multiform";s:4:"nome";s:14:"default_values";s:4:"tipo";s:1:"M";s:5:"parms";s:0:"";s:6:"codigo";s:67:"{style}=[var_style];
{p_o_number}=[var_po];
{old_po}=[var_oldpo];";}i:3;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:33:"fv2_greige_grpcs_keyoff_multiform";s:4:"nome";s:13:"onAfterDelete";s:4:"tipo";s:1:"E";s:5:"parms";s:0:"";s:6:"codigo";s:17:"update_master3();";}i:4;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:33:"fv2_greige_grpcs_keyoff_multiform";s:4:"nome";s:16:"onAfterDeleteAll";s:4:"tipo";s:1:"E";s:5:"parms";s:0:"";s:6:"codigo";s:17:"update_master3();";}i:5;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:33:"fv2_greige_grpcs_keyoff_multiform";s:4:"nome";s:13:"onAfterInsert";s:4:"tipo";s:1:"E";s:5:"parms";s:0:"";s:6:"codigo";s:17:"update_master3();";}i:6;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:33:"fv2_greige_grpcs_keyoff_multiform";s:4:"nome";s:16:"onAfterInsertAll";s:4:"tipo";s:1:"E";s:5:"parms";s:0:"";s:6:"codigo";s:17:"update_master3();";}i:7;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:33:"fv2_greige_grpcs_keyoff_multiform";s:4:"nome";s:13:"onAfterUpdate";s:4:"tipo";s:1:"E";s:5:"parms";s:0:"";s:6:"codigo";s:17:"update_master3();";}i:8;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:33:"fv2_greige_grpcs_keyoff_multiform";s:4:"nome";s:16:"onAfterUpdateAll";s:4:"tipo";s:1:"E";s:5:"parms";s:0:"";s:6:"codigo";s:17:"update_master3();";}i:9;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:33:"fv2_greige_grpcs_keyoff_multiform";s:4:"nome";s:14:"onBeforeInsert";s:4:"tipo";s:1:"E";s:5:"parms";s:0:"";s:6:"codigo";s:0:"";}i:10;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:33:"fv2_greige_grpcs_keyoff_multiform";s:4:"nome";s:17:"onBeforeInsertAll";s:4:"tipo";s:1:"E";s:5:"parms";s:0:"";s:6:"codigo";s:0:"";}i:11;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:33:"fv2_greige_grpcs_keyoff_multiform";s:4:"nome";s:9:"onLoadAll";s:4:"tipo";s:1:"E";s:5:"parms";s:0:"";s:6:"codigo";s:0:"";}i:12;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:33:"fv2_greige_grpcs_keyoff_multiform";s:4:"nome";s:8:"onRecord";s:4:"tipo";s:1:"E";s:5:"parms";s:0:"";s:6:"codigo";s:17:"default_values();";}i:13;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:33:"fv2_greige_grpcs_keyoff_multiform";s:4:"nome";s:10:"onValidate";s:4:"tipo";s:1:"E";s:5:"parms";s:0:"";s:6:"codigo";s:14:"calc_fields();";}i:14;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:33:"fv2_greige_grpcs_keyoff_multiform";s:4:"nome";s:14:"update_master3";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);
}

";}}