All pastes #22260 Raw Edit

Someone

public text v1 · immutable
#22260 ·published 2005-09-07 01:43 UTC
rendered paste body
$_asdtxt This report displays a portfolio's Monthly, Quarterly, or Yearly Balances by Asset Class

$gline ;
cfuse y
rsetup pennies showai fxflip
slines n
$zero 0
#freq 1
#amttype 1
management
DIALOG
ASCG_TEXT
ASCG_PORT
ACC %date1, ADDS_EDIT,, "Begin Date" 8 6
ACC %cutdate, ADDS_EDIT, [CHK] Z, "End Date    " 8 6
ACC #freq, ADDS_RADIO, "1", "&Monthly" "Balance Frequency", 20 3
ACC #freq, ADDS_RADIO, "2", "&Quarterly"
ACC #freq, ADDS_RADIO, "3", "&Annually"

ACC #amttype, ADDS_RADIO, "1", "&Dollars" "Show Balances in:", 20 2
ACC #amttype, ADDS_RADIO, "2", "&Percent"



ASCG_OKCAN
ASCG_CONSOLIDATE
ASCG_BROWSE
ASCG_SENS
END

endmonth #date1
endmonth #cutdate
comma y

$title BALANCES BY ASSET CLASS
$name2 ?
$name3 ?
;$dcf Discounted Cash Flow Method
$yldmeth n
$prop ?y???????
#zero     0
#one      1
#hundred  100
#minus   -1
$tot tot
$star *
$totportt Total Portfolio
$totport totport

$seven x       ; seven blanks, half of column width
$seven $1seven
$leftmar; will add to leftmar as number of columns increases
;set #numcol and #numcls
#numcol 0
$_class class000
label x;=========================================================================
$class $:curclass
if $class " " =*!
  #numcol #numcol 1+
  $$_class $class
  bump $_class
  $leftmar $leftmar$seven
  goto x
$leftmar $7leftmar
#numcls #numcol
#numcol #numcol 1+; plus totals column
#width  #numcol 16* 20+ 30+
;#width  #numcol 14* 20+
format c #width
$_culine x -------------------;
;$_culine x -------------;
$_culine $1_culine; column underlines

;~xxxxxxxxxxxx20xxxxxx~            ~             ~             ~             ~             ~             ~             ~
~xxxxxxxxxxxx20xxxxxx~                  ~                   ~                   ~                   ~                   ~                   ~                   ~

$period ITD
#savdat1 #date1
load cli ?y* "ep

pbreak
head
if $firm "<none>" =*!
  .$^firm\n
if #freq 1 =
  cvt $title MONTHLY $title
else
  if #freq 2 =
    cvt $title QUARTERLY $title
  else
    cvt $title ANNUAL $title
.$^title\n
.$^name\n
if $name2 "?" =*!
  .$^name2\n
if $name3 "?" =*!
  .$^name3\n
cvt $h From %date1 to %cutdate
.$^h\n
cvt $filenm ($:fileo)
.$^filenm\n
.\n\n
.~
label y
if $:curclass " " =*!
  . $^20:cclass
  goto y
. $^13totportt\n
call u; print underlines
.\n\n
head

#_stdate #stdate

call g_newlabel
;================================================================================
label a_another period;========================================================
if $period "ITD" =*
  if #date1 #stdate <=
    #date1 #stdate
cvt $period %date1
#_date0 #date1
#_date1 #cutdate
oneside n
cfperiod #date1 #cutdate
lump #date1
sum #date1

perf $acb
split y
movdate1 y
#_igdate #date1 1-
endmonth #_igdate
iread sec.inf
pread 1 #cutdate

ext .cli

$file $:file
#gmval1  #zero

#_ccdate1 #date1
get * ?y* "ep;$_file ?y* "ep
#date1 #_ccdate1
if #stdate #date1>
  goto s_next cli
iread sec.inf
pread 1 #cutdate
#x #date1
endmonth +#x
call p_Init row vars
;================================================================================
label i; for each asset class;===================================================
$class $:curclass
if $class " " =*
  goto j; break out of asset class loop

call q_Clear row vars

$whichty $prop$star
load type $whichty
if $:bysl "y" =*
  call b_bysl
else
  if $:iscash "y" =*
    call c_cash
  else
    call d_kurr
next type
call k_Bump row vars
goto i; next asset class

;================================================================================
label j; process data prior to printing;=========================================
;row vars now point to total portfolio
call r_Dup current row vars
call q_Clear row vars
call p_Init row vars
#c #numcls
;================================================================================
label Next asset class;==========================================================
;add asset class columns to form total portfolio column
#$__mval1  #$__mval1     #$_mval1    +
cvt $var tot%date1
#$var #$__mval1
;screen
;.$_mval1 $__mval1 $var #$var\n
;screen

#c #c #minus +
if #c #zero >
  call k_Bump row vars
  goto Next asset class

call p_Init row vars

#c #numcol
$_class class000
;================================================================================
label f_other class;===========================================================
#c #c #minus +
if #c #zero >
  $$category $$_class
  #$tdate1   #date1
  #$tmval1   #$_mval1
  $$tperiod $period
  call h_bump labels
  bump $_mval1
  bump $_class

  goto f_other class

$$category totport
#$tdate1 #date1
#$tmval1 #$_mval1

$$tperiod $period

call h_bumplabel

endmonth +#date1
#x #date1 31 %
;screen
;.x=#x\n
;screen
if #x 30 =!  ;not a month-end
  #date0 30 #x- #date1+  ;set next date to month-end after first date entered
else
  if #freq 1 =
    #date0 #date1 31+
  else
    if #freq 2 =
      #date0 #date1 93+
    else
      #date0 #date1 372+
#date1 #date0
endmonth #date1
;screen
;.date1=%date1\n
;screen
if #date1 #cutdate >
  goto s_next cli
dealloc
goto a_another period

label s_next cli;==============================================================
oneside y
perf n
split n
#date1 #savdat1
if $category "cat000" =*!
  $$category finished
call g_newlabel
$perprint zzz
call e_print results

$period ITD
$name2 ?
$name3 ?
lump #zero
sum #zero
next cli
fclose
slines n
end

;********************************************************************************
label e_print results;=========================================================
sline n
undeferr n

if $$tperiod $perprint =*!
  .         %4$tdate1~
  $perprint $$tperiod


if #amttype 2 = ;percentages
  cvt $var tot%$tdate1
  #pct #$tmval1 #$var / 100*
  .#~2pct
else
  .#~2$tmval1

if $$category "totport" =*
  .\n

cvt $date #$tdate1
#dateb #$tdate1
call h_bumplabel
if $$category "finished" =*!
  #datea #$tdate1
  if #datea #dateb =!
    cvt $cdate2 #dateb
  goto e_print results
undeferr y
return from e_print resutls
;===========================================================================
label u_print #numcol underlines;================================================
.~
#j 0
label v
if #j #numcol <
  .$_culine
  #j #j 1+
  goto v
return

;================================================================================
label c_cash;======================================================================
load tran
if $:aclass $class =*!
  goto o not in class
#$_mval1 #$_mval1 #:bucks+~
label o not in class
next tran
return

;================================================================================
label d_kurr ******************************************************************
load tran
if $:aclass $class =*!
  goto m not in class
#mval1   #::mzal0 #::ai0 +~
#$_mval1 #$_mval1 #mval1+~
label m not in class
next tran
return

;================================================================================
label b_bysl;======================================================================
load tran
if $:aclass $class =*!
  goto not in class
#mval1    #::mzal0 #::ai0 +~
#$_mval1  #$_mval1 #mval1+~
label not in class
next tran
return

;================================================================================
label p_Init row vars;========================================================
$_mval1   _mval1a
return
;================================================================================
label q_Clear row vars;=======================================================
#$_mval1  #zero
return

;================================================================================
label k_Bump row vars
bump $_mval1
return

;**************************************************
label r_Dup current row vars
$__mval1     $_mval1
return

;*********************************************
label g_newlabel
$category cat000
$tdate1 dat000
$tmval1 val1000
$tperiod tperiod000
return from g_newlabel

;*********************************************
label h_bumplabel
bump $category
bump $tdate1
bump $tmval1
bump $tperiod
return from h_bumplabel

;************************************************
label Z Check Dates
$_chkid ;
$_chkmsg ;
endmonth +#cutdate
endmonth +#date1
;endmonth +#date1
;#x1 #date1 31 %
;#x2 #cutdate 31 %

#diff #cutdate #date1 -
;screen
;.cutdate=%4cutdate date1=%4date1 diff=#diff x1=#x1 x2=#x2\n
;screen
#diff #cutdate #date1 -
if #freq 1 = #diff 31 < &
  $_chkmsg Date range must be at least 1 month

if #freq 2 = #diff 93 < &
  $_chkmsg Date range must be at least 1 quarter

if #freq 3 = #diff 372 < &
  $_chkmsg Date range must be at least 1 year
return

trailer