Files
Work/cashflow/SCRAPS.TXT
2024-08-07 09:12:07 -04:00

83 lines
3.0 KiB
Plaintext

// ThreadMessage threadMessage(ThreadMessage::TM_USER,FooStart,0L);
// if(!mhDisplay||!mlpLedDisplay)return;
// if(mCounter>999)mCounter=0;
// mlpLedDisplay->setNumber(mCounter++);
// postMessage(threadMessage);
#if 0
void CalcDlg::generateFlows(void)
{
Block<PureCashFlow> cashFlows;
PurePassThru passThru;
CashFlow cashFlow;
String trmString;
String prnString;
String cpnString;
size_t numFlows;
getText(CALC_TERM,trmString);
getText(CALC_PRINCIPAL,prnString);
getText(CALC_COUPON,cpnString);
if(trmString.isNull()||prnString.isNull()||cpnString.isNull()){::MessageBeep(0);return;}
passThru.issBal(::atof((LPSTR)prnString));
passThru.wac(::atof((LPSTR)cpnString));
passThru.coupon(::atof((LPSTR)cpnString));
passThru.wam(::atol((LPSTR)trmString));
passThru.origTerm(::atol((LPSTR)trmString));
passThru.psa(0.00);
if(mPrePay.amount())cashFlow.generateCashFlows(passThru,cashFlows,mPrePay);
else cashFlow.generateCashFlows(passThru,cashFlows);
numFlows=cashFlows.size();
mlpCalcSheet->clearData();
mlpCalcSheet->setCurrentCell(1,1);
CursorControl cursorControl;
cursorControl.waitCursor(TRUE);
for(short itemIndex=0;itemIndex<numFlows;itemIndex++)
{
Block<String> itemStrings;
cashFlows[itemIndex].itemStrings(itemStrings);
mlpCalcSheet->setCellData(itemIndex,IssBal,itemStrings[IssBal]);
mlpCalcSheet->setCellData(itemIndex,SMM,itemStrings[SMM]);
mlpCalcSheet->setCellData(itemIndex,MtgPay,itemStrings[MtgPay]);
mlpCalcSheet->setCellData(itemIndex,NetIntPay,itemStrings[NetIntPay]);
mlpCalcSheet->setCellData(itemIndex,GrossInt,itemStrings[GrossInt]);
mlpCalcSheet->setCellData(itemIndex,SchPrn,itemStrings[SchPrn]);
mlpCalcSheet->setCellData(itemIndex,Prepay,itemStrings[Prepay]);
mlpCalcSheet->setCellData(itemIndex,TotPrin,itemStrings[TotPrin]);
mlpCalcSheet->setCellData(itemIndex,Cashflow,itemStrings[Cashflow]);
mlpCalcSheet->setCellData(itemIndex,Factor,itemStrings[Factor]);
}
cursorControl.waitCursor(FALSE);
::SetFocus(mlpCalcSheet->getHandle());
}
#endif
void GraphWindow::showFlows(Block<PureCashFlow> &pureCashFlows,PureVector<int> &vectorInt)
{
// PureVector<int> vectorInt;
PureVector<int> scrnInt;
int widthAdjust(5);
int xPoint;
// vectorInt.size(pureCashFlows.size());
// for(int itemIndex=0;itemIndex<pureCashFlows.size();itemIndex++)vectorInt[itemIndex]=int(pureCashFlows[itemIndex].totPrin());
clamp(vectorInt);
// WORD sizeFactor((((float)width()/(float)widthAdjust)/(float)vectorInt.size())*100.00);
WORD sizeFactor(((((float)width()-20)/(float)widthAdjust)/(float)360.00)*100.00);
SpacialTransform resample;
resample.transform(vectorInt,scrnInt,sizeFactor);
for(itemIndex=0,xPoint=widthAdjust;itemIndex<scrnInt.size();itemIndex++,xPoint+=widthAdjust)
{
Vector3D outerPlane(Point3D(xPoint,scrnInt[itemIndex]+1,0),
Point3D(xPoint+widthAdjust,scrnInt[itemIndex]+1,0),
Point3D(xPoint+widthAdjust,0,0),
Point3D(xPoint,0,0));
Rect3D rect3D(outerPlane,20);
mGraphRects.insert(&rect3D);
}
invalidate();
}