1. select Payslip
  2. locate for SPERIOD = ldSperiod
  3. if found()
  4. select a.*,JOBTYPE,NAME,TAX_UNIT,GL_ACCOUNT,RANK ;&&included RANK by FDF April 21, 2009
  5. from Payslip a ;
  6. inner join Empmas b on a.E_EMPNO = b.E_EMPNO ;
  7. order by NAME,a.SECTION_CO,JOBTYPE,a.E_EMPNO ;
  8. into cursor crPayslip
  9. sele crPayslip
  10. index on NAME to a
  11.  
  12. select distinct a.EARNCODE ;
  13. from Earndetl a;
  14. inner join Earncode b on a.EARNCODE = b.EARNCODE ;
  15. where a.E_EMPNO in (select E_EMPNO from crPayslip) and upper(POSTED) = 'Y' and upper(TAXABLE) <> 'Y';
  16. order by a.EARNCODE ;
  17. into cursor crNonTaxEarnlist
  18. Sele crNonTaxEarnlist
  19. index on EARNCODE to b
  20. scan
  21.  
  22. endscan
  23.  
  24. select distinct a.EARNCODE ;
  25. from Earndetl a;
  26. inner join Earncode b on a.EARNCODE = b.EARNCODE ;
  27. where a.E_EMPNO in (select E_EMPNO from crPayslip) and upper(POSTED) = 'Y' and upper(TAXABLE) = 'Y';
  28. order by a.EARNCODE ;
  29. into cursor crTaxEarnlist
  30. Sele crTaxEarnlist
  31. index on EARNCODE to c
  32.  
  33.  
  34. select distinct DEDCODE ;
  35. from Ded_detl a;
  36. inner join Empmas b on a.E_EMPNO = b.E_EMPNO ;
  37. where upper(POSTED) = 'Y' ;
  38. order by DEDCODE ;
  39. into cursor crDedlist
  40. Sele crDedlist
  41. index on DEDCODE to d
  42.  
  43. select a.E_EMPNO,EARNCODE,sum(AMOUNT) as AMOUNT ;
  44. from Earndetl a;
  45. inner join crPayslip b on a.E_EMPNO = b.E_EMPNO ;
  46. where upper(POSTED) = 'Y' ;
  47. order by a.E_EMPNO,EARNCODE ;
  48. group by a.E_EMPNO,EARNCODE ; && Jan 25, 2005 by RLA
  49. into cursor crEarndetl
  50. Sele crEarndetl
  51. index on E_EMPNO+EARNCODE to e
  52.  
  53. select a.E_EMPNO,DEDCODE,sum(AMOUNT) as AMOUNT ;
  54. from Ded_detl a;
  55. inner join crPayslip b on a.E_EMPNO = b.E_EMPNO ;
  56. where upper(POSTED) = 'Y' ;
  57. order by a.E_EMPNO,DEDCODE ;
  58. group by a.E_EMPNO,DEDCODE ; && Jan 25, 2005 by RLA
  59. into cursor crDed_detl
  60. sele crDed_detl
  61. index on E_EMPNO+DEDCODE to f
  62.  
  63. select a.* ;
  64. from Timesht a;
  65. inner join crPayslip b on a.E_EMPNO = b.E_EMPNO ;
  66. where DISREGARD <> 'Y' ;
  67. order by a.E_EMPNO ;
  68. into cursor crTimesht
  69. sele crTimesht
  70. index on E_EMPNO to g
  71.  
  72. select a.* ;
  73. from Overtime a;
  74. inner join crPayslip b on a.E_EMPNO = b.E_EMPNO ;
  75. where DISREGARD <> 'Y' ;
  76. order by a.E_EMPNO ;
  77. into cursor crOvertime
  78. Sele crOvertime
  79. index on E_EMPNO to h
  80. endif
  81.  
  82. * tpos papasok sya sa isang method ito naman gagawin
  83. select crNonTaxEarnlist
  84. scan
  85. select crEarndetl
  86. locate for E_EMPNO+EARNCODE = crPayslip.E_EMPNO+crNonTaxEarnlist.EARNCODE
  87. This.is_uploaded(.f.,@lnCtr,crNonTaxEarnlist.EARNCODE)
  88. endscan
  89.  
  90. select crTaxEarnlist
  91. scan
  92. select crEarndetl
  93. locate for E_EMPNO+EARNCODE = crPayslip.E_EMPNO+crTaxEarnlist.EARNCODE
  94. This.is_uploaded(.f.,@lnCtr,crTaxEarnlist.EARNCODE)
  95. endscan
  96.  
  97. select crDedlist
  98. scan
  99. select crDed_detl
  100. locate for E_EMPNO+DEDCODE = crPayslip.E_EMPNO+crDedlist.DEDCODE
  101. goXLApp.ActiveSheet.cells(pnSheet1Ctr,lnCtr).value = iif(found(),AMOUNT,0)
  102. lnCtr = lnCtr + 1
  103. endscan