a:4:{i:0;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:21:"beam_bysale_edit_grid";s:4:"nome";s:13:"onAfterDelete";s:4:"tipo";s:1:"E";s:5:"parms";s:0:"";s:6:"codigo";s:12:"updMaster();";}i:1;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:21:"beam_bysale_edit_grid";s:4:"nome";s:13:"onAfterInsert";s:4:"tipo";s:1:"E";s:5:"parms";s:0:"";s:6:"codigo";s:12:"updMaster();";}i:2;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:21:"beam_bysale_edit_grid";s:4:"nome";s:13:"onAfterUpdate";s:4:"tipo";s:1:"E";s:5:"parms";s:0:"";s:6:"codigo";s:12:"updMaster();";}i:3;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:21:"beam_bysale_edit_grid";s:4:"nome";s:9:"updMaster";s:4:"tipo";s:1:"M";s:5:"parms";s:0:"";s:6:"codigo";s:1024:"sc_lookup(dataset,"SELECT SUM(lbs_sold)
                  FROM bysale
                   WHERE p_o_number = {p_o_number}");
$master_lbssold = {dataset[0][0]};
sc_master_value('lbs_sold', $master_lbssold);
sc_lookup(dataset,"SELECT lbs_knit, waste, lbs_recd, cost_lb_t
                  FROM warppo
                   WHERE p_o_number = {p_o_number}");
$master_lbsknit = {dataset[0][0]};
$master_waste = {dataset[0][1]};
$master_lbsrecd = {dataset[0][2]};
$master_costlbt = {dataset[0][3]};	
$master_inventory = round($master_lbsrecd - $master_lbsknit - $master_waste - $master_lbssold,1);
$master_tv = round($master_inventory * $master_costlbt,2);
sc_master_value('lbs_sold', $master_lbssold);
sc_master_value('inventory', $master_inventory);
sc_master_value('tv', $master_tv);
sc_exec_sql("UPDATE warppo
             SET lbs_sold = $master_lbssold,	
			     inventory = $master_inventory,
                 tv = $master_inventory * $master_costlbt		    
             WHERE P_O_NUMBER = {P_O_NUMBER}");
";}}