a:9:{i:0;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:28:"fv2_beam_wstemp_form_restore";s:4:"nome";s:15:"AMOUNT_onChange";s:4:"tipo";s:1:"A";s:5:"parms";s:0:"";s:6:"codigo";s:16:"update_costlb();";}i:1;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:28:"fv2_beam_wstemp_form_restore";s:4:"nome";s:14:"invoice_update";s:4:"tipo";s:1:"M";s:5:"parms";s:0:"";s:6:"codigo";s:675:"$updatesets="
UPDATE 
	sets
SET
	invoice='{invoice}'
WHERE
	invoice='[var_invoice]'
";
sc_lookup(ds,"SELECT sum(AMOUNT),sum(LBS_RECD) FROM wstemp WHERE p_o_number='{p_o_number}'");
if (isset({ds[0][0]}))     
{
    $totalamt = {ds[0][0]};
   
}
		else     
{
	$totalamt=0;
}	
if (isset({ds[0][1]}))     
{
    $totallbs = {ds[0][1]};
   
}
		else     
{
	$totallbs=1;	
	
}
sc_exec_sql($updatesets);
$updatepo="
UPDATE 
	warppo
SET
	COST_LB_W = $totalamt/$totallbs,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($updatepo);";}i:2;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:28:"fv2_beam_wstemp_form_restore";s:4:"nome";s:13:"onAfterDelete";s:4:"tipo";s:1:"E";s:5:"parms";s:0:"";s:6:"codigo";N;}i:3;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:28:"fv2_beam_wstemp_form_restore";s:4:"nome";s:13:"onAfterInsert";s:4:"tipo";s:1:"E";s:5:"parms";s:0:"";s:6:"codigo";N;}i:4;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:28:"fv2_beam_wstemp_form_restore";s:4:"nome";s:13:"onAfterUpdate";s:4:"tipo";s:1:"E";s:5:"parms";s:0:"";s:6:"codigo";s:17:"invoice_update();";}i:5;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:28:"fv2_beam_wstemp_form_restore";s:4:"nome";s:14:"onBeforeDelete";s:4:"tipo";s:1:"E";s:5:"parms";s:0:"";s:6:"codigo";s:14:"sets_delete();";}i:6;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:28:"fv2_beam_wstemp_form_restore";s:4:"nome";s:9:"onLoadAll";s:4:"tipo";s:1:"E";s:5:"parms";s:0:"";s:6:"codigo";s:338:"[var_invoice]={invoice};
[var_po]={p_o_number};
[var_to]=[var_to];
[var_shipto]=[var_shipto];
[var_size]=[var_size];
[var_bs]=[var_bs];
[var_date]={DATE};
[var_epb]=[var_epb];
[var_den]=[var_den];
[var_fil]=[var_fil];
[var_luster]=[var_luster];
[var_producer]=[var_producer];
[var_fiber]=[var_fiber];
[var_merge]=[var_merge];";}i:7;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:28:"fv2_beam_wstemp_form_restore";s:4:"nome";s:11:"sets_delete";s:4:"tipo";s:1:"M";s:5:"parms";s:0:"";s:6:"codigo";s:737:"$setsdelete="
DELETE FROM
	sets
WHERE
	invoice='[var_invoice]'
";
sc_exec_sql($setsdelete);
sc_lookup(ds,"SELECT sum(set_lbs), count(*) from sets WHERE p_o_number='[var_po]'");

if (isset({ds[0][0]}))     
{
    $totalrecdlbs = {ds[0][0]};
   
}
		else     
{
	$totalrecdlbs=0;
	
}
if (isset({ds[0][1]}))     
{
    $totalns = {ds[0][1]};
   
}
		else     
{
	$totalns=0;
	
}
$update_master=
"
UPDATE 
	warppo
SET
	lbs_recd=$totalrecdlbs,ns=$totalns
 WHERE
	p_o_number='[var_po]'
";
sc_exec_sql($update_master);
$master_field = 'lbs_recd';  // Field name on the master application
sc_master_value($master_field, $totalrecdlbs);
$master_field = 'ns';
sc_master_value($master_field,$totalns);
	
";}i:8;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:28:"fv2_beam_wstemp_form_restore";s:4:"nome";s:13:"update_costlb";s:4:"tipo";s:1:"M";s:5:"parms";s:0:"";s:6:"codigo";s:31:"{PRICE_LB}={AMOUNT}/{LBS_RECD};";}}