Advertisement
Guest User

Untitled

a guest
Jan 16th, 2019
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. select grid3_f
  2. if reccount() = 0
  3.     return
  4. endif
  5. issue_d = strtran(this.parent.issue_da.text,"/","")
  6. ser_no_o = alltrim(this.parent.ser_no.text)
  7. sql = "delete fas.dbo.drawing_issue where prj_no = '" + prj_no_i + "' and ddr_no = '" + ser_no_o + "'"
  8. res = sqlexec(han3,sql)
  9. if res < 0
  10.     =messagebox("Delete Issue table error : " + alltrim(message()) + chr(13) + sql,16,"錯誤訊息")
  11. endif
  12. idx= 3
  13. select grid3_f
  14. go top
  15. do while !eof()
  16.     scatter memvar
  17.     sql1 = "update fas.dbo.xmitl_dtl set kao_iss_flag = 'Y' where prj_no = '" + prj_no_i
  18.     sql2 = "' and equip_no = '" + m.equ_no + "' and ctci_no = '" + m.dwg_no + "' and iss_rev = '" + m.rev_no + "'"
  19.     sql = sql1 + sql2
  20.     res = sqlexec(han3,sql)
  21.     if res < 0
  22.         =messagebox("Update DWG Xmitl table error : " + chr(13) + alltrim(message()) + chr(13) + sql,16,"Error Message Window")
  23.     endif
  24.     for i = 1 to 28
  25.         idx1 = idx + i
  26.         sec_s = 'm.sect' + alltrim(str(i,2))
  27.         col_s = 'thisform.grid2.column' + alltrim(str(idx1,2)) + '.header1.caption'
  28.         sel_na = &col_s
  29.  
  30.         select cpy_set_f
  31.         go top
  32.         locate for alltrim(dept_na) == alltrim(sel_na)
  33.         if found()
  34.             dept_cd1 = cpy_set_f.dept_cd
  35.             if cpy_set_f.hand_sw = 1
  36.                 han_sw = 1
  37.                 tel_no_t = ' '
  38.             else
  39.                 han_sw = 0
  40.                 tel_no_t = alltrim(cpy_set_f.tel_txt)
  41.             endif      
  42.         else
  43.             dept_cd1 = '9999'
  44.             han_sw = 1
  45.             tel_no_t = ''
  46.         endif
  47.         sec_qty_s = &sec_s
  48.         if len(alltrim(sec_qty_s)) > 0 and dept_cd1 <> '9999'
  49.             j = at('P',sec_qty_s)
  50.             if j > 0
  51.                 m.qty = val(left(sec_qty_s,j-1))
  52.             else
  53.                 m.qty = val(sec_qty_s)
  54.             endif
  55.             sql1 = "insert fas.dbo.drawing_issue (prj_no,ctci_no,iss_rev,iss_date_eg,"
  56.             sql2 = "dept_cd,dept_qty,hand_sw,tel_nos,ddr_no,equip_no) values('" + prj_no_i + "','" + alltrim(m.dwg_no)
  57.             sql3 = "','" + alltrim(m.rev_no) + "','" + alltrim(issue_d) + "','"
  58.             sql4 = dept_cd1 + "'," + str(m.qty) + "," + str(han_sw,1) + ",'" + tel_no_t
  59.             sql5 = "','" + ser_no_o + "','" + m.equ_no + "')"
  60.             sql = sql1 + sql2 + sql3 + sql4 + sql5
  61.             res = sqlexec(han3,sql)
  62.             if res < 0
  63.                 =messagebox("Insert DWG Issue table error : " + chr(13) + alltrim(message()) + chr(13) + sql,16,"Error message Window")
  64.             endif
  65.         endif
  66.     next
  67.     select grid3_f
  68.     skip
  69. enddo
  70. this.parent.cmdPrint.enabled = .t.
  71. this.parent.pj_no.enabled = .t.
  72. thisform.preview_chk.enabled = .t.
  73. save_sw = 1
  74. thisform.refresh
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement