Files
Work/cashflow/PURECFLO.CPP
2024-08-07 09:12:07 -04:00

88 lines
2.7 KiB
C++

#include <stdio.h>
#include <cashflow/purecflo.hpp>
#include <common/block.hpp>
void PureCashFlow::operator=(const PureCashFlow &somePureCashFlow)
{
mBeginBal=somePureCashFlow.mBeginBal;
mSMM=somePureCashFlow.mSMM;
mMtgPay=somePureCashFlow.mMtgPay;
mNetIntPay=somePureCashFlow.mNetIntPay;
mGrossIntPay=somePureCashFlow.mGrossIntPay;
mSchedPrinPay=somePureCashFlow.mSchedPrinPay;
mPrepayment=somePureCashFlow.mPrepayment;
mTotPrin=somePureCashFlow.mTotPrin;
mCashFlow=somePureCashFlow.mCashFlow;
mFactor=somePureCashFlow.mFactor;
}
WORD PureCashFlow::operator==(const PureCashFlow &somePureCashFlow)const
{
if(!(mBeginBal==somePureCashFlow.mBeginBal))return FALSE;
if(!(mSMM==somePureCashFlow.mSMM))return FALSE;
if(!(mMtgPay==somePureCashFlow.mMtgPay))return FALSE;
if(!(mNetIntPay==somePureCashFlow.mNetIntPay))return FALSE;
if(!(mGrossIntPay==somePureCashFlow.mGrossIntPay))return FALSE;
if(!(mSchedPrinPay==somePureCashFlow.mSchedPrinPay))return FALSE;
if(!(mPrepayment==somePureCashFlow.mPrepayment))return FALSE;
if(!(mTotPrin==somePureCashFlow.mTotPrin))return FALSE;
if(!(mCashFlow==somePureCashFlow.mCashFlow))return FALSE;
if(!(mFactor==somePureCashFlow.mFactor))return FALSE;
return TRUE;
}
strstream &PureCashFlow::operator>>(strstream &stream)const
{
char commaString[]=",";
stream << mBeginBal << commaString << mSMM << commaString << mMtgPay <<
commaString << mNetIntPay << commaString << mGrossIntPay << commaString <<
mSchedPrinPay << commaString << mPrepayment << commaString << mTotPrin <<
commaString << mCashFlow << commaString << mFactor << endl;
return stream;
}
void PureCashFlow::operator>>(String &someString)const
{
someString.reserve(String::MaxString);
::sprintf(someString,"%12.2lf %9.7lf %9.2lf %9.2lf %9.2lf %9.2lf %9.2lf %9.2lf %9.2lf %12.10lf",
mBeginBal,
mSMM,
mMtgPay,
mNetIntPay,
mGrossIntPay,
mSchedPrinPay,
mPrepayment,
mTotPrin,
mCashFlow,
mFactor);
}
void PureCashFlow::itemStrings(Block<String> &strBlock)
{
String itemString;
strBlock.remove();
::sprintf(itemString,"%12.2lf",mBeginBal);
strBlock.insert(&itemString);
::sprintf(itemString,"%9.7lf",mSMM);
strBlock.insert(&itemString);
::sprintf(itemString,"%9.2lf",mMtgPay);
strBlock.insert(&itemString);
::sprintf(itemString,"%9.2lf",mNetIntPay);
strBlock.insert(&itemString);
::sprintf(itemString,"%9.2lf",mGrossIntPay);
strBlock.insert(&itemString);
::sprintf(itemString,"%9.2lf",mSchedPrinPay);
strBlock.insert(&itemString);
::sprintf(itemString,"%9.2lf",mPrepayment);
strBlock.insert(&itemString);
::sprintf(itemString,"%9.2lf",mTotPrin);
strBlock.insert(&itemString);
::sprintf(itemString,"%9.2lf",mCashFlow);
strBlock.insert(&itemString);
::sprintf(itemString,"%12.10lf",mFactor);
strBlock.insert(&itemString);
}