INSERT INTO i01
(nr01, p01, p02, p03, p04, p013, p011, p022, p05, p012, p610, p0601, pd01, pd101, 
remdate, remtime, remuser, remfdate, remftime, remfuser)
SELECT peg_new_nr01('i01', 1) as nr01, 
       i07.p02 as p01, 
       i07.vp02 as p02, 
       i07.p06 as p03, 
       i07.p04 as p04, 
       '{odbcdtos(np_dt)}' as p013, 
       round(i07.p06*i07.p04, 2) as p011, 
       round(i07.p06*i07.p04, 2) as p022, 
       {np_kk} as p05, 
       1 as p012, 
       i07.p01 as p610, 
       '{peg_str1}' as p0601, 
       '{peg_str2}' as pd01, 
       'i07' as pd101, 
       
       curdate() as remdate, 
       curtime() as remtime, 
       '{user_pswd}' as remuser, 
       curdate() as remfdate, 
       curtime() as remftime, 
       '{user_pswd}' as remfuser
FROM i07 
WHERE i07.p06<>0
   && i07.pc01=''
   && i07.pm01=''
   && i07.p010=''
   && i07.p011='';
/*peg_end*/   
