a:1:{i:0;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:20:"fv2_greige_updateall";s:4:"nome";s:9:"onExecute";s:4:"tipo";s:1:"E";s:5:"parms";s:0:"";s:6:"codigo";s:968:"//****************************TOTAL UPDATES********************************
$update_ngo_grpcs= 
"
UPDATE ngo c
INNER JOIN 
(SELECT invoice, SUM(lbs_recd) as total
  FROM grpcs
  GROUP BY invoice)
x ON c.invoice = x.invoice
SET c.lbs = x.total
";
sc_exec_sql($update_ngo_grpcs);

$update_greigepo_grpcs= 
"
UPDATE greigepo c
INNER JOIN 
(SELECT p_o_number, SUM(lbs_open) as total,sum(lbs_used) as lbsused
  FROM grpcs
  GROUP BY p_o_number)
x ON c.p_o_number = x.p_o_number
SET c.pinv = x.total, c.lbs_dyed = x.lbsused
";
sc_exec_sql($update_greigepo_grpcs);

$update_greigepo_ngo= 
"
UPDATE greigepo c
INNER JOIN 
(SELECT p_o_number, SUM(lbs) as total,sum(totalkc) as tkc
  FROM ngo
  GROUP BY p_o_number)
x ON c.p_o_number = x.p_o_number
SET c.lbs = x.total, c.totalkc = x.tkc, c.inventory = (c.lbs-c.lbs_dyed+c.adjustment), c.lbs_open = c.lbs_ordere-c.lbs
";
sc_exec_sql($update_greigepo_ngo);
sc_redir('fv_greige_greigepo_grid');";}}