Quantcast
Channel: Microsoft Dynamics AX Forum - Recent Threads
Viewing all articles
Browse latest Browse all 175888

RE: Purchase order Report Customization.

$
0
0

dear Boye Walters,

I am Customizing the Price2Amount Like This.

client server static AmountCur price2Amount(PriceCur price,
PriceUnit priceUnit,
DiscAmount discAmount,
Qty qtyNow,
Qty qty,
MarkupAmount markup,
DiscPct discPercent,
CurrencyCode currencyCode,
Amount amount,
DiscAmount LocationdiscAmount = 0,
DiscAmount RegionaldiscAmount = 0,
DiscPct LocationdiscPercent = 0,
DiscPct RegionaldiscPercent = 0,
boolean forceAmountCalculation = false)

{
Amount returnAmount;
// <GEEPL>
#ISOCountryRegionCodes
// </GEEPL>
;

if (!price && !discAmount && !discPercent /*&& !LocationdiscAmount && !LocationdiscPercent && !RegionaldiscAmount && !RegionaldiscPercent*/ && !markup && !forceAmountCalculation)
{
if (qtyNow == qty)
return amount;
else
price = PriceDisc::amount2Price(amount,
discPercent,
markup,
qty,
discAmount,
priceUnit,
currencyCode,
price);
}

if (price || discAmount || discPercent || markup || forceAmountCalculation)
{
if (!priceUnit)
priceUnit = 1;

// <GEEPL>
if (SysCountryRegionCode::isLegalEntityInCountryRegion([#isoPL]) &&
SalesParameters::find().LineDiscCalculation_PL == PlLineDiscCalcType::PcsPrice &&
(discAmount || markup || discPercent))
{
returnAmount = (qtyNow / priceUnit) * Currency::amount((price - discAmount + markup) * (100 - discPercent) / 100, currencyCode);
}
else
{
// </GEEPL>
returnAmount = (qtyNow * ((price - discAmount) / priceUnit) + (qtyNow >= 0 ? markup : -markup) ) * (100 - discPercent) / 100;
// <GEEPL>
}
returnAmount = Currency::amount(returnAmount, currencyCode);
}
else
{
returnAmount = amount;
}

/*
if (!price && !LocationdiscAmount && !LocationdiscPercent && !markup && !forceAmountCalculation)
{
if (qtyNow == qty)
return amount;
else
price = PriceDisc::amount2Price(amount,
discPercent,
markup,
qty,
discAmount,
priceUnit,
currencyCode,
LocationdiscAmount,
LocationdiscPercent,
price);

}

if (price || LocationdiscAmount || LocationdiscPercent || markup || forceAmountCalculation)
{
if (!priceUnit)
priceUnit = 1;

//srini
if (SysCountryRegionCode::isLegalEntityInCountryRegion([#isoPL]) &&
SalesParameters::find().LineDiscCalculation_PL == PlLineDiscCalcType::PcsPrice &&
(LocationdiscAmount || markup || LocationdiscPercent))
{
returnAmount = (qtyNow / priceUnit) * Currency::amount((price - LocationdiscAmount + markup) * (100 - LocationdiscPercent) / 100, currencyCode);
}
else
{
// </GEEPL>
returnAmount = (qtyNow * ((price - LocationdiscAmount) / priceUnit) + (qtyNow >= 0 ? markup : -markup) ) * (100 - LocationdiscPercent) / 100;
// <GEEPL>
}
returnAmount = Currency::amount(returnAmount, currencyCode);
}
else
{
returnAmount = amount;
}

if (!price && !RegionaldiscAmount && !RegionaldiscPercent && !markup && !forceAmountCalculation)
{
if (qtyNow == qty)
return amount;
else
price = PriceDisc::amount2Price(amount,
discPercent,
//LocationdiscAmount,
RegionaldiscAmount,
markup,
qty,
discAmount,
//LocationdiscPercent,
RegionaldiscPercent,
priceUnit,
currencyCode,
price);
}

if (price || RegionaldiscAmount || RegionaldiscPercent || markup || forceAmountCalculation)
{
if (!priceUnit)
priceUnit = 1;

//srini
if (SysCountryRegionCode::isLegalEntityInCountryRegion([#isoPL]) &&
SalesParameters::find().LineDiscCalculation_PL == PlLineDiscCalcType::PcsPrice &&
(RegionaldiscAmount || markup || RegionaldiscPercent))
{
returnAmount = (qtyNow / priceUnit) * Currency::amount((price - RegionaldiscAmount + markup) * (100 - RegionaldiscPercent) / 100, currencyCode);
}
else
{
// </GEEPL>
returnAmount = (qtyNow * ((price - RegionaldiscAmount) / priceUnit) + (qtyNow >= 0 ? markup : -markup) ) * (100 - RegionaldiscPercent) / 100;
// <GEEPL>
}

//srini
// </GEEPL>
returnAmount = Currency::amount(returnAmount, currencyCode);
}
else
{
returnAmount = amount;
}

*/
return returnAmount;
}

how to solve this Error


Viewing all articles
Browse latest Browse all 175888

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>