a:7:{i:0;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:24:"fv2_beam_sets_multi_form";s:4:"nome";s:16:"onAfterDeleteAll";s:4:"tipo";s:1:"E";s:5:"parms";s:0:"";s:6:"codigo";s:19:"update_from_sets();";}i:1;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:24:"fv2_beam_sets_multi_form";s:4:"nome";s:13:"onAfterInsert";s:4:"tipo";s:1:"E";s:5:"parms";s:0:"";s:6:"codigo";s:0:"";}i:2;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:24:"fv2_beam_sets_multi_form";s:4:"nome";s:16:"onAfterInsertAll";s:4:"tipo";s:1:"E";s:5:"parms";s:0:"";s:6:"codigo";s:19:"update_from_sets();";}i:3;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:24:"fv2_beam_sets_multi_form";s:4:"nome";s:13:"onAfterUpdate";s:4:"tipo";s:1:"E";s:5:"parms";s:0:"";s:6:"codigo";s:0:"";}i:4;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:24:"fv2_beam_sets_multi_form";s:4:"nome";s:16:"onAfterUpdateAll";s:4:"tipo";s:1:"E";s:5:"parms";s:0:"";s:6:"codigo";s:19:"update_from_sets();";}i:5;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:24:"fv2_beam_sets_multi_form";s:4:"nome";s:8:"onRecord";s:4:"tipo";s:1:"E";s:5:"parms";s:0:"";s:6:"codigo";s:44:"[var_po]={p_o_number};
[var_setno]={setno};";}i:6;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:24:"fv2_beam_sets_multi_form";s:4:"nome";s:16:"update_from_sets";s:4:"tipo";s:1:"M";s:5:"parms";s:0:"";s:6:"codigo";s:1171:"sc_lookup(ds,"SELECT sum(set_lbs),count(*) from sets WHERE invoice = '{invoice}'");
if (isset({ds[0][0]}))     
{
    $totalsetlbs = {ds[0][0]};
	$nsets = {ds[0][1]};
   
}
		else     
{
	$totalsetlbs=0;
	$nsets=0;
	
}
$update_master=
"
UPDATE 
	wstemp
SET
	lbs_recd=$totalsetlbs
WHERE
	invoice='{invoice}'
";
sc_exec_sql($update_master);
sc_lookup(ds,"SELECT sum(lbs_recd),sum(amount) from wstemp WHERE p_o_number='{p_o_number}'");

if (isset({ds[0][0]}))     
{
    $totalrecdlbs = {ds[0][0]};
   
}
		else     
{
	$totalrecdlbs=0;
	
}
if (isset({ds[0][1]}))     
{
    $totalamt = {ds[0][1]};
   
}
		else     
{
	$totalamt=0;
	
}
$update_master=
"
UPDATE 
	warppo
SET
	lbs_recd=$totalrecdlbs,ns=$nsets,lbs_open=lbs_orderd-lbs_recd,inventory=lbs_recd-lbs_knit-lbs_sold-waste,
COST_LB_W = $totalamt/$totalrecdlbs,TCOST=(COST_LB_W+COST_LB_Y)*LBS_RECD,COST_LB_T=TCOST/(LBS_RECD-WASTE+1),tv=inventory*cost_lb_t,mdvalue=tv*markdown
WHERE
	p_o_number='{p_o_number}'
";
sc_exec_sql($update_master);
$master_field = 'lbs_recd';  // Field name on the master application
sc_master_value($master_field, $totalsetlbs);
	
";}}