a:1:{i:0;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:16:"fv2_dye_initiate";s:4:"nome";s:9:"onExecute";s:4:"tipo";s:1:"E";s:5:"parms";s:0:"";s:6:"codigo";s:1635:"// this is done in mysql cron job on ls4

$clear_table = 'Truncate table fairlanevrtx2.dyeorder';
$import_table = 'INSERT INTO fairlanevrtx2.dyeorder SELECT * FROM fairlanevrtx.dyeorder';
sc_exec_sql($clear_table);
sc_exec_sql($import_table);
echo 'Dyeorder table initialized.';

$clear_table = 'Truncate table fairlanevrtx2.dorec';
$import_table = 'INSERT INTO fairlanevrtx2.dorec SELECT * FROM fairlanevrtx.dorec';
sc_exec_sql($clear_table);
sc_exec_sql($import_table);
echo 'Dorec table initialized.';

$clear_table = 'Truncate table fairlanevrtx2.fgstock';
$import_table = 'INSERT INTO fairlanevrtx2.fgstock SELECT * FROM fairlanevrtx.fgstock';
sc_exec_sql($clear_table);
sc_exec_sql($import_table);
echo 'Fgstock table initialized.';

$clear_table = 'Truncate table fairlanevrtx2.n3case';
$import_table = 'INSERT INTO fairlanevrtx2.n3case SELECT * FROM fairlanevrtx.n3case';
sc_exec_sql($clear_table);
sc_exec_sql($import_table);
$clear_out=
"
DELETE FROM n3case WHERE (p_o_number>10000 AND p_o_number<>'NA')
";
sc_exec_sql($clear_out);

$clear_out=
"
DELETE FROM n3case WHERE (grade='11' OR grade = '12')
";
sc_exec_sql($clear_out);
echo 'N3case table initialized.';
$clear_out=
"
DELETE FROM dyeorder WHERE (p_o_number=000001 OR p_o_number='01233')
";
sc_exec_sql($clear_out);


$clear_out=
"
DELETE FROM dorec WHERE (dye_lot='') or (yards_recd=0)
";
sc_exec_sql($clear_out);
$update_sql="
UPDATE n3case
INNER JOIN item ON n3case.invoice = item.invoice
SET n3case.it=item.item,n3case.smit=item.smit
";
sc_exec_sql($update_sql);
echo 'Dye processing tables initiated.';


";}}