martedì 14 ottobre 2014

HOWTO: Create invent marking

Here an exaple for create a mark by code:

InventTrans issueInventTrans;
TmpInventTransMark tmpInventTransMask;
Map mapMarkNow;
container con;
real qty;
Map mapTmp;
MapEnumerator mapEnumerator;

InventTransOriginId issueInventTransOriginId = 
InventTransOrigin::findByInventTransId('Issue lot ID').RecId;

InventTransOriginId receiptInventTransOriginId = 
InventTransOrigin::findByInventTransId('Receipt lot ID').RecId;    

InventQty qtyToMark = 11;

ttsBegin;

issueInventTrans = InventTrans::findByInventTransOrigin(
issueInventTransOriginId);

[con, qty] = TmpInventTransMark::packTmpMark(
InventTransOrigin::find(issueInventTransOriginId),
issueInventTrans.inventDim(), 
issueInventTrans.Qty);

mapTmp = Map::create(con);
mapEnumerator = mapTmp.getEnumerator();
while (mapEnumerator.moveNext())
{
tmpInventTransMask = mapEnumerator.currentValue();

if (tmpInventTransMask.InventTransOrigin == receiptInventTransOriginId)
{
tmpInventTransMask.QtyMarkNow = qtyToMark;
tmpInventTransMask.QtyRemain -= tmpInventTransMask.QtyMarkNow;
mapMarkNow = new Map(Types::Int64, Types::Record);
mapMarkNow.insert(tmpInventTransMask.RecId, tmpInventTransMask);

TmpInventTransMark::updateTmpMark(
issueInventTransOriginId, 
issueInventTrans.inventDim(), 
-qtyToMark,
mapMarkNow.pack());

break;
}
}

ttsCommit;

giovedì 9 ottobre 2014

TIP: Automatic open an entity when double click on the info dialog

In this case the user can double click on info dialog to go directly on the production order

info(strfmt("Production order %1 was created", prodTable.ProdId),'', SysInfoAction_TableField::newBuffer(prodTable));

HOWTO: Create transfer order by code X++

NumberSeq numberSeq;
InventTransferTable inventTransferTable;
InventTransferLine inventTransferLine;
InventDim inventDim;
;

ttsbegin;
numberSeq = NumberSeq::newGetNum(InventParameters::numRefTransferId());

inventTransferTable.clear();
inventTransferTable.initValue();
inventTransferTable.TransferId = numberSeq.num();
numberSeq.used();

inventTransferTable.InventLocationIdFrom = _inventLocationIdFrom;
inventTransferTable.modifiedField(fieldNum(InventTransferTable,InventLocationIdFrom));
inventTransferTable.InventLocationIdTo = _inventLocationIdTo;
inventTransferTable.modifiedField(fieldNum(InventTransferTable,InventLocationIdTo));
inventTransferTable.insert();

inventTransferLine.clear();
inventTransferLine.initFromInventTransferTable(inventTransferTable, NoYes::Yes);
inventTransferLine.ItemId = _itemId;
inventTransferLine.initFromInventTable(InventTable::find(_itemId));
inventTransFerLine.LineNum = InventTransferLine::lastLineNum(inventTransferTable.TransferId) + 1;
inventTransferLine.QtyTransfer = _qty;
inventTransferLine.QtyRemainReceive = _qty;
inventTransferLine.QtyRemainShip = _qty;
inventTransferLine.QtyShipNow = 0;
inventTransferLine.QtyReceiveNow = 0;
inventDim = inventTransferLine.inventDim();
inventDim.InventSiteId = InventLocation::find(inventTransferTable.InventLocationIdFrom).InventSiteId;
inventDim.InventLocationId = inventTransferTable.InventLocationIdFrom;
inventTransferLine.InventDimId = inventDim::findOrCreate(inventDim).inventDimId;
inventTransferLine.insert();
ttscommit;

giovedì 2 ottobre 2014

HOWTO: SSRS show value only on last page in body of report

If you wont to display a value only on last page use a syntax like this on field exp:

=iif(Globals!PageNumber=Globals!TotalPages,data, nothing)

If you wont to hide a control only on a last page use a syntax like this on visibility exp:

=iif(Globals!PageNumber=Globals!TotalPages,false,true)

Remember you case use Global properties only on header and footer section

mercoledì 1 ottobre 2014

HOWTO: AX 2012, How to use Date range and Enum in query value

Use this piece of code for fiter datasource beetween two date:


qbds.addRange(fieldNum(EIRTenderRecordTable, StartDate))
        .value(SysQuery::range(_requisitionDate, dateNull()));

qbds.addRange(fieldNum(EIRTenderRecordTable, EndDate))
        .value(SysQuery::range(dateNull(), _requisitionDate));

AX 2012: The request was aborted: Could not create SSL/TLS secure channel

The error you're encountering, "The request was aborted: Could not create SSL/TLS secure channel," can occur due to various re...