a:1:{i:0;a:7:{s:7:"cod_prj";s:7:"Veratex";s:6:"versao";s:1:"1";s:7:"cod_apl";s:17:"fv2_orders_import";s:4:"nome";s:9:"onExecute";s:4:"tipo";s:1:"E";s:5:"parms";s:0:"";s:6:"codigo";s:1426:"//THIS IS BEING DONE BY mysql CRON JOB ON ls4
// set out the fields to copy splitting grpo into order and asst so you can have
//multiple assortments.
$clear_table = 'Truncate table fairlanevrtx2.order';
$import_table = "Insert into fairlanevrtx2.order 
(
IFOR,DATE,BCODE,SCODE,SHIP_VIA,SALESMAN,TERMS,AMOUNT,QUANTITY,BP,
STATUS,ROLLS,SPEC,WIDTH,STYLE,`ORDER`,BILL_DESCR
) select
IFOR,DATE,BCODE,SCODE,SHIP_VIA,SALESMAN,TERMS,ORDER_AMT,LBS_ORDERE,KNIT_PRICE,
STATUS,ROLL_SIZE,SPEC,WIDTH,NEW_STYLE,OURPO,concat(DESC1,' ',DESC2)
from fairlanevrtx.grpo";
$update_table="
UPDATE
	fairlanevrtx2.order
SET
	LIN_SQ='LIN',NATWEST='N'
";
sc_exec_sql($clear_table);
sc_exec_sql($import_table);
sc_exec_sql($update_table);
echo "Orders table initialized.";
$clear_table = 'Truncate table asst';
$import_table = "Insert into asst (
`ORDER`,STYLE,DATE,COLOR,YARDS,DELIVERY,PRICE,STAT,WIDTH,BCODE,C_O_NUMBER
) select 
OURPO,NEW_STYLE,DATE,COLOR,LBS_ORDERE,DELIVERY,KNIT_PRICE,STATUS,WIDTH,BCODE,P_O_NUMBER
from fairlanevrtx.grpo";
sc_exec_sql($clear_table);
sc_exec_sql($import_table);
$update_table="
UPDATE
	asst
SET
	assortment='1',our_order=`order`,amount=yards*price,LIN_SQ='LIN',ADATE=DATE,EDATE=DATE
";
sc_exec_sql($update_table);
echo "Asst table initialzied.";
$table_clean="
DELETE FROM
asst
WHERE
`ORDER`=''
";
sc_exec_sql($table_clean);
echo "Customer Order Tables Initialized.";

";}}