a:10:{i:0;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:18:"dye_doco_edit_grid";s:4:"nome";s:14:"YARDS_onChange";s:4:"tipo";s:1:"A";s:5:"parms";s:0:"";s:6:"codigo";s:374:"/**
 * Selecting a field from another table
 */

// Check for record
$check_sql = "SELECT req_gr_yld"
   . " FROM dyeorder"
   . " WHERE p_o_number = '" . [var_dyeorder] . "'";
sc_lookup(rs, $check_sql);
if (isset({rs[0][0]}))     // Row found
{
	$gryld={rs[0][0]};
	$lbs={yards}/$gryld;
    {lbs} = $lbs;
}
		else     // No row found
{
		    {lbs} = '';
}";}i:1;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:18:"dye_doco_edit_grid";s:4:"nome";s:13:"onAfterDelete";s:4:"tipo";s:1:"E";s:5:"parms";s:0:"";s:6:"codigo";s:24:"updatedo();
updateco();";}i:2;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:18:"dye_doco_edit_grid";s:4:"nome";s:13:"onAfterInsert";s:4:"tipo";s:1:"E";s:5:"parms";s:0:"";s:6:"codigo";s:26:"updatedo();
updateco();
";}i:3;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:18:"dye_doco_edit_grid";s:4:"nome";s:13:"onAfterUpdate";s:4:"tipo";s:1:"E";s:5:"parms";s:0:"";s:6:"codigo";s:24:"updatedo();
updateco();";}i:4;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:18:"dye_doco_edit_grid";s:4:"nome";s:14:"onBeforeDelete";s:4:"tipo";s:1:"E";s:5:"parms";s:0:"";s:6:"codigo";s:27:"[var_oldorder]={our_order};";}i:5;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:18:"dye_doco_edit_grid";s:4:"nome";s:14:"onBeforeInsert";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:18:"dye_doco_edit_grid";s:4:"nome";s:14:"onBeforeUpdate";s:4:"tipo";s:1:"E";s:5:"parms";s:0:"";s:6:"codigo";s:27:"[var_oldorder]={our_order};";}i:7;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:18:"dye_doco_edit_grid";s:4:"nome";s:15:"order2_onChange";s:4:"tipo";s:1:"A";s:5:"parms";s:0:"";s:6:"codigo";s:318:"$check_sql = "SELECT our_order,bcode"
   . " FROM asst"
   . " WHERE our_order = '" . {order2} . "'";
sc_lookup(rs, $check_sql);

if (isset({rs[0][0]}))     // Row found
{
    {our_order} = {rs[0][0]};
	{customer} = {rs[0][1]};
}
		else     // No row found
{
		    {our_order} = '';
			{customer} = '';
}";}i:8;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:18:"dye_doco_edit_grid";s:4:"nome";s:8:"updateco";s:4:"tipo";s:1:"M";s:5:"parms";s:0:"";s:6:"codigo";s:1228:"// for efficiency you should probably put something in here to only do the update
// if neworder<>oldorder or newyards<>oldyards
$neworder={our_order};
$newmorder=substr({our_order},0,5);
$oldorder=[var_oldorder];
$oldmorder=substr([var_oldorder],0,5);
sc_lookup(dataset1, "SELECT sum(yards)FROM doco WHERE our_order = [var_oldorder]");
$oldyards={dataset1[0][0]};
sc_exec_sql("UPDATE	asst
             SET  yid = $oldyards
             WHERE our_order = '[var_oldorder]'");	
sc_lookup(dataset2, "SELECT sum(yards)FROM doco WHERE our_order = $neworder");	
$newyards={dataset2[0][0]};
sc_exec_sql("UPDATE	asst
             SET  yid = $newyards
             WHERE our_order = '$neworder'");
sc_lookup(dataset3, "SELECT sum(yards)FROM doco WHERE LEFT(our_order,5) = $oldmorder");
$totaloldyards={dataset3[0][0]};
sc_exec_sql("UPDATE	`order`
             SET  dye = $totaloldyards
             WHERE `order` = $oldmorder");
sc_lookup(dataset4, "SELECT sum(yards)FROM doco WHERE LEFT(our_order,5) = $newmorder");
$totalnewyards={dataset4[0][0]};
sc_exec_sql("UPDATE	`order`
             SET  dye = $totalnewyards
             WHERE `order` = $newmorder");
sc_alert("CUSTOMER ORDER FILE WAS UPDATED!");


";}i:9;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:18:"dye_doco_edit_grid";s:4:"nome";s:8:"updatedo";s:4:"tipo";s:1:"M";s:5:"parms";s:0:"";s:6:"codigo";s:446:"//this won't work until new fields used below are created in the table
// ydsalloc
// lbsalloc
// sc_lookup(dataset1, "SELECT sum(yards), sum(lbs) FROM doco WHERE p_o_number = [var_dyeorder]");
// $ydsallocated={dataset1[0][0]};
// $lbsallocated={dataset1[0][1]};
// sc_exec_sql("UPDATE	dyeorder
//             SET  ydsalloc = $ydsallocated,
//                  lbsalloc = $lbsallocated
//	         WHERE p_o_number = '[var_dyeorder]'");";}}