Here is my code
Code:
void bghCalculatedValues::getBillDisplayParam(
bghVantiveDescription &newVantiveDesc,
bghVecContractParameters &vecContractParam,
bghContract& contract)
{
#ifdef DEBUGADONIS
cout << "Hera newVantiveDesc.PackageMemberID: " << newVantiveDesc.PackageMemberID<< endl ;
cout << "Hera partnumber: " <<newVantiveDesc.PartNumber<< endl ;
cout << "Hera ParamDetails: " << ParamDetails<< endl ;
cout << "Hera ParamDetails.exists: " << ParamDetails.exists (newVantiveDesc.PartNumber )<< endl ;
#endif
jTime tmpBSDate = Invoice.Date(PERIODSTART);
jTime tmpBEDate = Invoice.Date(PERIODEND);
//herahoe not required
if ( ParamDetails.exists (newVantiveDesc.PartNumber))//herahoe change newVantiveDesc.PackageMemberID to newVantiveDesc.PartNumber
{
#ifdef DEBUGADONIS
cout << "Adding the package member id" << newVantiveDesc.PackageMemberID<< endl ;
cout << "Hera Adding the part number: " << newVantiveDesc.PartNumber<< endl ;
#endif
billparamvec &ParamRef = ParamDetails(newVantiveDesc.PartNumber);//herahoe change newVantiveDesc.PackageMemberID to newVantiveDesc.PartNumber
for (unsigned int i=0; i<ParamRef.billParamVector.length() ; i++)//herahoe ParamRef.billParamVector.length() to vecContractParam.length()
{
#ifdef DEBUGADONIS
cout << "Adding param vector :" << newVantiveDesc.PackageMemberID<< endl ;
cout <<"LABEL "<<ParamRef.billParamVector[i].paramEntryLabel<<endl;
cout <<"Hera at label vecContractParam.length() "<<vecContractParam.length()<<endl;
cout <<"Hera ParamRef.billParamVector.length(): "<<ParamRef.billParamVector.length()<<endl;
#endif
int iConParam = 0;
bool displayonce = false;
bool enterhere = false;
int paramCheck = 0;
char buff[100];
// paramCheck = vecContractParam.length() + 5;
for ( iConParam = 0; iConParam < vecContractParam.length() ; iConParam++ )
{
#ifdef DEBUGADONIS
cout << "hera iConParam :" << iConParam<< endl ;
cout << "hera2 vecContractParam.length() :" << vecContractParam.length()<< endl ;
#endif
if ( displayonce )
{
break;
}
#ifdef DEBUGADONIS
cout << "hera ParamRef.billParamVector[i].paramType :" << ParamRef.billParamVector[i].paramType<< endl ;
cout << "hera newVantiveDesc.PartNumber :" << newVantiveDesc.PartNumber<< endl ;
#endif
//jString::intValue(ParamRef.billParamVector[i].paramType)
// if ( jString::intValue(ParamRef.billParamVector[i].paramType) == newVantiveDesc.PartNumber) //herahoe change ParamRef.billParamVector[i].paramType == vecContractParam[iConParam].paramType to vecContractParam[iConParam].paramType == newVantiveDesc.PartNumber
//{herahoe remove it
#ifdef DEBUGADONIS
cout << "hera param comes here " << endl ;
#endif
if (( vecContractParam[iConParam].EndDate >= tmpBSDate ) )
{
#ifdef DEBUGADONIS
cout << "hera vecContractParam[iConParam].EndDate :" << vecContractParam[iConParam].EndDate<< endl ;
cout << "hera tmpBSDate :" << tmpBSDate<< endl ;
#endif
/*Vengat for WR00939 */
if ( vecContractParam[iConParam].paramValue == DEFNONEVALUE )
{
break;
}
/*Vengat for WR00939 */
if ( ParamRef.billParamVector[i].DisplayFlag == 0 )
{
displayonce = true;
}
vecContractParam[iConParam].bParamDetail = &ParamRef.billParamVector[i];
#ifdef DEBUGADONIS
cout << "hera param start date :" << (const char *) vecContractParam[iConParam].StartDate.format("%Y%m%d")<< endl ;
cout << "hera param end date :" << (const char *) vecContractParam[iConParam].EndDate.format("%Y%m%d")<< endl ;
cout << "hera param type :" << (const char *) vecContractParam[iConParam].paramType << " Label: "<<ParamRef.billParamVector[i].paramEntryLabel <<" Partnumber: "<< newVantiveDesc.PartNumber<< endl ;
#endif
/*herahoe start add (const char *)*/sprintf ( buff, "%05d%010d%s%s", ParamRef.billParamVector[i].paramBillSequence , (const char *) vecContractParam[iConParam].paramType , (const char *) vecContractParam[iConParam].StartDate.format("%Y%m%d"), (const char *) vecContractParam[iConParam].EndDate.format("%Y%m%d") );
//herahoe add
//partnumber
const char *paramTypeP = strrchr((const char *) vecContractParam[iConParam].paramType, '+'); //get partnumber value from last + sign onwards
jString paramTypeP2 = paramTypeP;
jStringV newParamTypeP = paramTypeP2.split('+');
//partnumber end
//label
jString newParamTypeL = (const char *)vecContractParam[iConParam].paramType;
jStringV ParamTypeL = newParamTypeL.split(paramTypeP);
#ifdef DEBUGADONIS
cout << "Hera not in paramTypeP: "<<paramTypeP<< endl;
cout << "Hera not in newParamTypeP: "<<newParamTypeP[1]<< endl;//partnumber
cout << "Hera not in ParamTypeL: "<<ParamTypeL[0]<< endl;//Label
cout << "Hera contract.vecContractParam.exists(jString(buff)): "<<contract.vecContractParam.exists(jString(buff))<< endl;//Label
#endif
if ( !contract.vecContractParam.exists(jString(buff)) && (ParamRef.billParamVector[i].paramEntryLabel == ParamTypeL[0] && newVantiveDesc.PartNumber == newParamTypeP[1]) )
{
contract.vecContractParam.add(jString(buff), vecContractParam[iConParam]);
}
else if(!contract.vecContractParam.exists(jString(buff)) && !(ParamRef.billParamVector[i].paramEntryLabel == ParamTypeL[0] && newVantiveDesc.PartNumber == newParamTypeP[1]))
{
if (iConParam > 0 )
{
++iConParam;
enterhere = true;
#ifdef DEBUGADONIS
cout << "iConParam: "<<iConParam<< endl;
#endif
}
}
else
{
break;
}
}
}
}
}
return;
}