SHARE
TWEET

Untitled

a guest Apr 10th, 2018 145 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. thisform.dwg_no_txt.value = ''
  2. thisform.eqp_no_txt.value = ''
  3. thisform.dwg_title_txt.value = ''
  4. thisform.sch_issue.value = ''
  5. thisform.rev_no.value = ''
  6. thisform.rece_date.value = ''
  7. thisform.cmdERS.enabled = .f.
  8. thisform.cmdExcel.enabled = .f.
  9. thisform.cmdInsert.enabled = .f.
  10. thisform.cmdEdit.enabled = .f.
  11. thisform.cmdDel.enabled = .f.
  12. thisform.cmdDelAll.enabled = .f.
  13. thisform.cmdSave.enabled = .f.
  14. thisform.cmdCancel.enabled = .f.
  15. thisform.cmdExit.enabled = .t.
  16. thisform.dwg_no_txt.enabled = .f.
  17. thisform.eqp_no_txt.enabled = .f.
  18. thisform.dwg_title_txt.enabled = .f.
  19. thisform.sch_issue.enabled = .f.
  20. thisform.rev_no.enabled = .f.
  21. thisform.rece_date.enabled = .f.
  22. prj_no_i = upper(this.displayvalue)
  23.  
  24. thisform.label2.caption = prj_no_lst.prj_desc
  25. pj_desc = prj_no_lst.prj_desc
  26. select dwg_grid
  27. zap
  28. store '' to title_ar,old_dwg_no,old_eqp_no,old_title,iss_d,rev0a_d,rev0b_d,rev0_d,rev1_d,rev2_d
  29. store space(10) to rev3_d,rev4_d,rev5_d,rev6_d,rev7_d,rev8_d,rev9_d,rev10_d,rev11_d,rev12_d,rev13_d,rev14_d,rev15_d
  30. store 0 to title_idx
  31. sql1 = "select prj_no,equip_no,ctci_no,iss_rev,iss_date_eg rece_d,"
  32. sql2 = "isnull((select dwg_desc from fas.dbo.drawing_master where prj_no = a.prj_no and equip_no = a.equip_no and ctci_no = a.ctci_no and dwg_id = a.dwg_id),'') dwg_desc,"
  33. sql3 = "isnull((select sch_iss_d from fas.dbo.drawing_master where prj_no = a.prj_no and equip_no = a.equip_no and ctci_no = a.ctci_no and dwg_id = a.dwg_id),'') sch_date,"
  34. sql4 = "isnull((select rev_iss_d from fas.dbo.drawing_master where prj_no = a.prj_no and equip_no = a.equip_no and ctci_no = a.ctci_no and dwg_id = a.dwg_id),'') rev_date"
  35. sql5 = " from fas.dbo.xmitl_dtl a where prj_no = '" + prj_no_i + "' order by equip_no,ctci_no,iss_rev"
  36. sql = sql1 + sql2 + sql3 + sql4 + sql5
  37. res = sqlexec(han2,sql,'curs2')
  38. if res > 0 and !empty(curs2.prj_no)
  39.     select curs2
  40.     go top
  41.     old_dwg_no = curs2.ctci_no
  42.     old_eqp_no = curs2.equip_no
  43.     old_title = alltrim(curs2.dwg_desc)
  44.     if len(alltrim(curs2.rev_date)) > 0
  45.         iss_d = left(curs2.rev_date,4) + '/' + substr(curs2.rev_date,5,2) + '/' + substr(curs2.rev_date,7,2)
  46.     else
  47.         if len(alltrim(curs2.sch_date)) > 0
  48.             iss_d = left(curs2.sch_date,4) + '/' + substr(curs2.sch_date,5,2) + '/' + substr(curs2.sch_date,7,2)
  49.         else
  50.             iss_d = ''
  51.         endif
  52.     endif
  53.     do while !eof()
  54.         scatter memvar
  55.         m.rev_no = strtran(m.iss_rev," ","")
  56.         m.rev_no = left(m.rev_no + space(2),2)
  57.         if old_eqp_no <> m.equip_no
  58.             if title_idx > 0
  59.                 rev0_d = title_ar(1,2) + '(' + left(title_ar(1,1),2) + ')'
  60.                 if title_idx > 6
  61.                     idx_base = title_idx - 5
  62.                 else
  63.                     idx_base = 2
  64.                 endif
  65.                 idx = 0
  66.                 for i = idx_base to title_idx
  67.                     idx = idx + 1
  68.                     if idx > 15
  69.                         idx = 15
  70.                     endif
  71.                     r_f = 'rev' + alltrim(str(idx)) + '_d'
  72.                     &r_f = title_ar(i,2) + '(' + left(title_ar(i,1),2) + ')'
  73.                 next
  74.                 insert into dwg_grid values(old_dwg_no,old_eqp_no,old_title,iss_d,rev0_d, ;
  75.                     rev1_d,rev2_d,rev3_d,rev4_d,rev5_d,rev6_d,rev7_d,rev8_d,rev9_d,rev10_d,;
  76.                     rev11_d,rev12_d,rev13_d,rev14_d,rev15_d)
  77.             endif
  78.             store '' to title_ar,old_dwg_no,old_title,iss_d,rev0_d,rev1_d,rev2_d,rev3_d,rev4_d,rev5_d
  79.             store space(10) to rev6_d,rev7_d,rev8_d,rev9_d,rev10_d,rev11_d,rev12_d,rev13_d,rev14_d,rev15_d
  80.             title_idx = 0
  81.             old_dwg_no = m.ctci_no
  82.             old_eqp_no = m.equip_no
  83.             old_title = alltrim(m.dwg_desc)
  84.             if len(alltrim(m.rev_date)) > 0
  85.                 iss_d = left(m.rev_date,4) + '/' + substr(m.rev_date,5,2) + '/' + substr(m.rev_date,7,2)
  86.             else
  87.                 if len(alltrim(m.sch_date)) > 0
  88.                     iss_d = left(m.sch_date,4) + '/' + substr(m.sch_date,5,2) + '/' + substr(m.sch_date,7,2)
  89.                 else
  90.                     iss_d = ''
  91.                 endif
  92.             endif
  93.         endif
  94.         if old_dwg_no <> m.ctci_no
  95.             if title_idx > 0
  96.                 first_d = title_ar(1,2)
  97.                 first_no = title_ar(1,1)
  98.                 rev0_d = title_ar(1,2) + '(' + left(title_ar(1,1),2) + ')'
  99.                 if title_idx > 6
  100.                     idx_base = title_idx - 5
  101.                 else
  102.                     idx_base = 2
  103.                 endif
  104.                 idx = 0
  105.                 for i = idx_base to title_idx
  106.                     idx = idx + 1
  107.                     if idx > 15
  108.                         idx = 15
  109.                     endif
  110.                     r_f = 'rev' + alltrim(str(idx)) + '_d'
  111.                     &r_f = title_ar(i,2) + '(' + left(title_ar(i,1),2) + ')'
  112.                 next
  113.                 insert into dwg_grid values(old_dwg_no,old_eqp_no,old_title,iss_d,rev0_d, ;
  114.                     rev1_d,rev2_d,rev3_d,rev4_d,rev5_d,rev6_d,rev7_d,rev8_d,rev9_d,rev10_d,;
  115.                     rev11_d,rev12_d,rev13_d,rev14_d,rev15_d)
  116.             endif
  117.             store '' to title_ar,old_dwg_no,old_title,iss_d,rev0_d,rev1_d,rev2_d,rev3_d,rev4_d,rev5_d
  118.             store space(10) to rev6_d,rev7_d,rev8_d,rev9_d,rev10_d,rev11_d,rev12_d,rev13_d,rev14_d,rev15_d
  119.             store 0 to title_idx
  120.             old_dwg_no = m.ctci_no
  121.             old_eqp_no = m.equip_no
  122.             old_title = alltrim(m.dwg_desc)
  123.             if len(alltrim(m.rev_date)) > 0
  124.                 iss_d = left(m.rev_date,4) + '/' + substr(m.rev_date,5,2) + '/' + substr(m.rev_date,7,2)
  125.             else
  126.                 if len(alltrim(m.sch_date)) > 0
  127.                     iss_d = left(m.sch_date,4) + '/' + substr(m.sch_date,5,2) + '/' + substr(m.sch_date,7,2)
  128.                 else
  129.                     iss_d = ''
  130.                 endif
  131.             endif
  132.         endif
  133.         m.rece_d = left(m.rece_d,4) + '/' + substr(m.rece_d,5,2) + '/' + substr(m.rece_d,7,2)
  134.         tit_idx = 0
  135.         for i = 1 to title_idx
  136.             if title_ar(i,1) = m.rev_no
  137.                 tit_idx = i
  138.                 i = title_idx
  139.             endif
  140.         next
  141.         if tit_idx > 0
  142.             title_ar(tit_idx,2) = m.rece_d
  143.         else
  144.             title_idx = title_idx + 1
  145.             title_ar(title_idx,1) = m.rev_no
  146.             title_ar(title_idx,2) = m.rece_d
  147.         endif
  148.         select curs2
  149.         skip
  150.     enddo
  151.     if len(alltrim(old_dwg_no)) > 0
  152.         if title_idx > 0
  153.             first_d = title_ar(1,2)
  154.             first_no = title_ar(1,1)
  155.             rev0_d = title_ar(1,2) + '(' + left(title_ar(1,1),2) + ')'
  156.             if title_idx > 6
  157.                 idx_base = title_idx - 5
  158.             else
  159.                 idx_base = 2
  160.             endif
  161.             idx = 0
  162.             for i = idx_base to title_idx
  163.                 idx = idx + 1
  164.                 if idx > 15
  165.                     idx = 15
  166.                 endif
  167.                 r_f = 'rev' + alltrim(str(idx)) + '_d'
  168.                 &r_f = title_ar(i,2) + '(' + left(title_ar(i,1),2) + ')'
  169.             next
  170.             insert into dwg_grid values(old_dwg_no,old_eqp_no,old_title,iss_d,rev0_d, ;
  171.                 rev1_d,rev2_d,rev3_d,rev4_d,rev5_d,rev6_d,rev7_d,rev8_d,rev9_d,rev10_d,;
  172.                 rev11_d,rev12_d,rev13_d,rev14_d,rev15_d)
  173.         endif
  174.     endif
  175. endif
  176. select dwg_grid
  177. go top
  178. thisform.grid1.enabled = .t.
  179. if reccount() = 0
  180.     thisform.cmdInsert.enabled = .t.
  181.     thisform.cmdEdit.enabled = .f.
  182.     thisform.cmdDel.enabled = .f.
  183.     thisform.cmdSave.enabled = .f.
  184.     thisform.cmdCancel.enabled = .f.
  185. else
  186.     thisform.cmdInsert.enabled = .t.
  187.     thisform.cmdEdit.enabled = .t.
  188.     thisform.cmdDel.enabled = .t.
  189.     thisform.cmdSave.enabled = .f.
  190.     thisform.cmdCancel.enabled = .f.
  191. endif
  192. thisform.cmdExit.enabled = .t.
  193. keyboard "{Tab}"
  194. store 0 to ins_sw,edit_sw,del_sw
  195. thisform.refresh
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top