Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Expand
titleSQL statement
Code Block
select SELECT 	pay.PIN,
	       p01.Name,
	
       persorg.name as               AS Organization,
	
       pay.accountdim2 as            AS VesOrgID,
	isnull
       ISNULL(ves.name, 'N/A')   as AS 'Vessel Name',
	case when
       CASE 
            WHEN pay.ACCOUNTDIM3 isIS NULL orOR pay.ACCOUNTDIM3 = '' thenTHEN 'N/A'
		else
            ELSE pay.ACCOUNTDIM3
	end
       END 'Department',
	isnull       ISNULL(CAT.NAME, 'Other') as AS 'Category',
	       pay.CALCULATEDAMOUNT1 as      AS 'Amount',
       	pay.periodeused as            AS Period,
       	CONVERT(VARCHAR, PAY.ENTRYCODE) + ' ' + EC.TEXT AS 'Entry Code',
	case when
       CASE 
            WHEN pay.ACCOUNTNOOFCALCAMOUNT1<>ACCOUNTNOOFCALCAMOUNT1 <> '' THEN pay.ACCOUNTNOOFCALCAMOUNT1 + ' - ' + acc.ACCOUNTTEXT
		 when
            WHEN pay.ACCOUNTNOOFCALCAMOUNTCREDIT1<>ACCOUNTNOOFCALCAMOUNTCREDIT1 <> '' THEN pay.ACCOUNTNOOFCALCAMOUNTCREDIT1 + ' - ' + acc.ACCOUNTTEXT
    end   END 'Account No',
	case when pay.ACCOUNTNOOFCALCAMOUNT1<>0       CASE 
            WHEN pay.ACCOUNTNOOFCALCAMOUNT1 <> '' THEN 'DEBIT'
		 when
            WHEN pay.ACCOUNTNOOFCALCAMOUNTCREDIT1<>0ACCOUNTNOOFCALCAMOUNTCREDIT1 <> '' THEN 'CREDIT'
		 else
            ELSE                     'N/A'
     end  END 'Account type',
	       pay.rank as Rank,
	                   AS RANK,
       pay.currencyforpayment as    AS 'Payment Currency ',
	       p01.client                    numorgid,
	       p01.employmentstartdate,
	       p01.employmentenddate
fromFROM   pw001pay pay
left join
       LEFT JOIN pw001p01 p01 on
            ON  p01.pin = pay.pin and CALCULATEDAMOUNT1<>0
left join
            AND CALCULATEDAMOUNT1 <> 0
       LEFT JOIN pworg ves on
            ON  ves.numorgid = pay.accountdim2
left join       LEFT JOIN pyety001 ec on
            ON  ec.entrycode = pay.entrycode
left join
       LEFT JOIN pworg persorg
on            ON  persorg.numorgid = p01.client
     left  LEFT joinJOIN PW001C117 CAT on
            ON  ec.CATEGORY = CAT.SEQUENCENO
and            AND pay.ENTRYCODE = ec.ENTRYCODE
left join
       LEFT JOIN PY001ACC ACC on 
            ON  (ACC.ACCOUNTNO = pay.ACCOUNTNOOFCALCAMOUNT1) orOR (acc.ACCOUNTNO = pay.ACCOUNTNOOFCALCAMOUNTCREDIT1)

where CALCULATEDAMOUNT1<>0WHERE  CALCULATEDAMOUNT1 <> 0 

Fields Definition

...

View Configuration (Column/Raw/Data Fields)

...

Row/Column

Description/ Location in APM

PIN

The PIN from the Personal Details.

Name

The Full Name from the Personal Details.

Organization

The Employment Organization from the Personal Details.

VesOrgID

The ID of the vessel linked to the payment entry in Account Dim 2.

Vessel Name

The Name of the vessel linked to the payment entry Account Dim 2.

Department

The Code of the department linked to the payment entry Account Dim 3.

Category

The category of the payment entry.

Amount

The Amount (Entry Field 1) value of the payment entry.

Period

The Period of the payment entry.

Entry Code

The Code of payment entry.

Account No

The account number of calculatedamount1 on the payment entry.

Account Type

The account type of calculatedamount1 on the - either debit or credit.

Rank

The Name of the rank linked to the payment entry.

Payment Currency

The payment currency of the payment entry.

numorgid

The emplyment organization ID from the Personal Details.

employmentstratdate

The emplyment start date from the Personal Details.

employmentenddate

The emplyment end date from the Personal Details.

...