Inventory period open checking using X++



public boolean isInventPeriodOpen(TransDate              testDate,
                                 boolean                onDateOk = false,
                                 InventTransCurrency_RU _inventTransCurrency = InventTransCurrency_RU::PrimaryCur)
{
    #ISOCountryRegionCodes
    TransDate closingDate = InventClosing::closingDate(false, _inventTransCurrency);

    if (!SysCountryRegionCode::isLegalEntityInCountryRegion([#isoRU]) || testDate)
    {

        if ((testDate <= closingDate && !onDateOk) ||
            (testDate <  closingDate &&  onDateOk))
        {
            return checkFailed(strFmt("Inventory is closed for physical and financial transactions until %1.",date2StrUsr( closingDate, DateFlags::FormatAll)));
            
        }

    }
    return true;
}

Comments

Popular posts from this blog

Sales order invoice posting using X++ with custom SalesParmLine fields

Create a custom lookup with multiple data sources on form using X++

SalesTable2Line custom field update prompt on Sales order in AX 2012