Thursday 2 August 2007

Making a form resizeable

To enable your users to resize a form, set the WIDTH and HEIGHT properties of the form design to be 'column width' and 'column height' respectively.
For any controls that appear on the form (i.e. groups, tabs, grids) that you want to resize in line with the main form, you will need to set the width and height of each control in turn to be 'column width' and 'column height', then they will resize along with the grid.

Running a report with no user intervention

If you want to create a report that runs without any prompts appearing (i.e. print and query prompts) then remember to set the 'INTERACTIVE' property on both your report and your query to 'NO'

Monday 12 March 2007

How to get Axapta (3.0 SP4 KR2) to use fixed exchange rates in CRM Quotations and Sales Orders.

What's the problem? Well in Axapta 3.0 SP4 KR2 there is a field on both the CRM quotations form and on the Sales Order form that is used to fix the exchange rate for the quotation / sales order. At least that's what the what's this info box indicates.

Unfortunately the only time the system actually uses the exchange rate that is entered into the fixed exchange rate field is when posting the invoice for a sales order the rest of the time this field is ignored and the default exchange rate for currency is used instead.

In order to get the system to take notice of this field involves modifying, 1 Map (SalesPurchLine), 1 Class (PriceDisc), 2 Tables (smmQuotationLine, SalesLine)

First off a new field is added to the smmQuotationLine and SalesLine tables of type SalesFixedExchRate called FixedExchRate.

We now need to make sure this is populated correctly. I've modified the initFromSmmQuoationTable method of the smmQuotationLine table to add the following line of code:

this.FixedExchRate = _smmQuotationTable.FixedExchRate;

The same piece of code will need to be added to the initFromSalesTable method of the SalesLine table.

this.FixedExchRate = _salesLine.FixedExchRate;

Ok, now that we've got a place to store the data we now need to modify the SalesPurchLine map to include the fixed exchange rate field into the map. So we first add the new field FixedExchRate to the fields in the map and then modify the mapping lines for the SalesLine and smmQuotationLine tables to include this new field.

Now we need to modify the PriceDisc class to use the new fixed exchange rate field, to do this we need to modify the following:

classDeclaration

Add the following variable declaration:

SalesFixedExchRate fixedExchRate;

newFromSalesPurchLine method should be changed as below:

static PriceDisc newFromSalesPurchLine( SalesPurchLine _salesPurchLine,InventDim _inventDim = _salesPurchLine.inventDim())
{
return new PriceDisc(_salesPurchLine.moduleType(),
_salesPurchLine.itemId,
_inventDim,
_salesPurchLine.purchSalesUnit,
systemdateGet(),
_salesPurchLine.salesPurchQty,
_salesPurchLine.orderAccount(),
_salesPurchLine.currencyCode,
_salesPurchLine.FixedExchRate);
}

new method should be changed as below:

void new(ModuleInventPurchSales _moduleType,ItemId _itemId,inventDim _inventDim,
UnitID _unitID,TransDate _discDate,Qty _qty, CustVendAC _accountId,
CurrencyCode _currency = Companyinfo::standardCurrency(),
SalesFixedExchRate _exchRate = 0)
{
moduleType = _moduleType;
itemId = _itemId;
unitID = _unitID;
inventDim = _inventDim;
discDate = _discDate;
qty = _qty;
accountId = _accountId;
currency = _currency;
fixedExchRate = _exchRate;

priceParameters = PriceParameters::find();
}

findItemPrice method should be changed as follows:

the calls to Currency:curPrice and Currency:curAmount before return (price!=0);

should be changed from

price = Currency::curPrice(price,currency,discDate);
markup = Currency::curAmount(markup,currency,discDate);

to

price = Currency::curPrice(price,currency,discDate,UnknownNoYes::Unknown,fixedExchRate);
markup = Currency::curAmount(markup,currency,discDate,UnknownNoYes::Unknown,fixedExchRate);

Now try a CRM quotation or Sales Order in a currency other than your company's base currency and Axapta should now respect the fixed exchange rate field.

Tuesday 13 February 2007

The Obligatory First Post

Do you program Axapta or Dynamics Ax as it's now called, do you find yourself thinking that it should be easier than this, surely to God they really didn't mean to leave so many gaping holes in this not so cheap ERP system. Well you're not alone anymore, as we think this most days.

We'll be posting entries with example code, gotcha's and un-gotcha's and rants and raves no doubt.

The first useful post should appear soon....