Monday, September 21, 2009

Current Day Ledger Write Offs

The code below will give you current day ledger write offs by matter. The matter description udf and timekeeper name udf are used here. This is based on ledger code = 'WOFF'.

SELECT l.lindex AS 'Ledger Index',
l.lmatter AS 'Matter #',
clname1 AS 'Client Name',
dbo.udfMattDesc(l.lmatter) AS 'Matter Description',
mbillaty AS 'Bill Aty #',
dbo.udfTKFullName(mbillaty) AS 'Billing Attorney',
l.ldocumnt AS 'Document #',
l.ltradat AS 'Transaction Date',
l.llcode AS 'Ledger Code',
l1.lddesc AS 'Ledger Description',
sum(l.lamount) AS 'Amt Written Off'
FROM ledger l
INNER JOIN matter ON l.lmatter = mmatter
INNER JOIN client ON mclient = clnum
INNER JOIN timekeep ON mbillaty = tkinit
LEFT OUTER JOIN ledgdesc l1 ON l.lindex = l1.lindex AND ldline = 1
WHERE l.llcode in ('WOFF')
AND ltradat > getdate()-2
AND lzero <> 'R'
GROUP BY l.lindex, l.lmatter, clname1,
mbillaty, l.ldocumnt,
l.ltradat, l.llcode, l1.lddesc
ORDER BY l.lmatter ASC

1 comment:

  1. If you have a RETAINER then <> FEES will not always just bring in costs.