a:8:{i:0;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:24:"dye_grpcs_edit_ondo_grid";s:4:"nome";s:17:"DYE_ORDER_onClick";s:4:"tipo";s:1:"A";s:5:"parms";s:0:"";s:6:"codigo";s:234:"if({dye_order} == 0)
{
	{lbs_open}={lbs_recd};
	{lbs_used}=0;
	{dye_order_old}=null;
	{dye_order}=null;
}
else
{
	{lbs_open}=0;
	{lbs_used}={lbs_recd};
	{dye_order}=[var_p_o_number];
	{dye_order_old}=[var_p_o_number];
}
";}i:1;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:24:"dye_grpcs_edit_ondo_grid";s:4:"nome";s:13:"onAfterUpdate";s:4:"tipo";s:1:"E";s:5:"parms";s:0:"";s:6:"codigo";s:1230:"[var_total]=0;
sc_lookup(dataset0, "SELECT fin_lbs,cost_lb_d,gr_yield,gr_lbs_d,req_gr_yld FROM dyeorder WHERE p_o_number = [var_p_o_number]");
$finlbs = {dataset0[0][0]};
$costlbd = {dataset0[0][1]};
$gryld = {dataset0[0][2]};
$grlbsd = {dataset0[0][3]};
$reqgryld = {dataset0[0][4]};
sc_lookup(dataset1, "SELECT sum(lbs_used), sum(total_cost) FROM grpcs WHERE dye_order = [var_p_o_number]");
$lbs_on_do={dataset1[0][0]};
$totalcost={dataset1[0][1]};
$grlbsop = $lbs_on_do-$grlbsd;
if($grlbsd>0)
{	
	$workloss = ($grlbsd-$finlbs)/$grlbsd;
}
else
{
	$workloss=0;
}
if($lbs_on_do>0)
{
$costlbg=$totalcost/$lbs_on_do;
}
else
{
$costlbg=0;	
}
$grvalue=$costlbg*$grlbsop;
$costlbt=$costlbg+$costlbd;
if($gryld>0)
{
$costydt=$costlbt/$gryld;
}
else
{
$costydt=0;	
}
$estyards=$reqgryld*$lbs_on_do;
sc_exec_sql("UPDATE	dyeorder
             SET  gr_lbs_o = $lbs_on_do,
                  gr_lbs_op = $grlbsop,
				  gr_value = $grvalue,
				  work_loss = $workloss,
                  cost_lb_g = $costlbg,
			      cost_lb_t = $costlbt,
				  cost_yd_t = $costydt,
				  est_yards = $estyards
             WHERE p_o_number = '[var_p_o_number]'");
sc_redir(dye_grpcs_edit_ondo_grid);



";}i:2;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:24:"dye_grpcs_edit_ondo_grid";s:4:"nome";s:17:"onApplicationInit";s:4:"tipo";s:1:"E";s:5:"parms";s:0:"";s:6:"codigo";s:14:"[var_total]=0;";}i:3;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:24:"dye_grpcs_edit_ondo_grid";s:4:"nome";s:14:"onBeforeUpdate";s:4:"tipo";s:1:"E";s:5:"parms";s:0:"";s:6:"codigo";s:239:"if({dye_order} == 0)
{
	{lbs_open}={lbs_recd};
	{lbs_used}=0;
	{dye_order_old}='     ';
	{dye_order}='    ';
}
else
{
	{lbs_open}=0;
	{lbs_used}={lbs_recd};
	{dye_order}=[var_p_o_number];
	{dye_order_old}=[var_p_o_number];
}
";}i:4;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:24:"dye_grpcs_edit_ondo_grid";s:4:"nome";s:6:"onInit";s:4:"tipo";s:1:"E";s:5:"parms";s:0:"";s:6:"codigo";s:0:"";}i:5;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:24:"dye_grpcs_edit_ondo_grid";s:4:"nome";s:9:"onLoadAll";s:4:"tipo";s:1:"E";s:5:"parms";s:0:"";s:6:"codigo";s:0:"";}i:6;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:24:"dye_grpcs_edit_ondo_grid";s:4:"nome";s:10:"onNavigate";s:4:"tipo";s:1:"E";s:5:"parms";s:0:"";s:6:"codigo";s:0:"";}i:7;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:24:"dye_grpcs_edit_ondo_grid";s:4:"nome";s:8:"onRecord";s:4:"tipo";s:1:"E";s:5:"parms";s:0:"";s:6:"codigo";s:81:"[var_total]=[var_total]+{lbs_used};
{dye_order_old}={dye_order};
{dye_order}=1;";}}