update FA date - ref pepper
static void UpdateFADates(Args _args)
{
AssetBook assetBook;
AssetId assetId;
CommaTextIo file;
int faCount;
LogisticsLocation logisticsLocation;
TaxInformation_IN taxInformation_IN;
RefRecId refrecid;
CommaIo commaIo;
Filename fileName;
FileIOPermission permission;
container con;
int i;
#File
fileName = WinAPI::getOpenFileName(0, ['CSV File', '*.csv'], '', "Import File");
if (!WinAPI::fileExists(fileName))
{
throw error(strfmt("@SYS18678", fileName));
}
commaIo = new CommaIo(fileName, #io_read);
if (!commaIo)
{
throw error(strfmt("@SYS19312", fileName));
}
ttsBegin;
while (commaIo.status() == IO_Status::Ok)
{
con = commaIo.read();
if(con)
{
i++;
assetId = conPeek(con, 1);
if (assetId)
{
try
{
while select forUpdate assetBook
where assetBook.AssetId == assetId
{
assetBook.UsedFromDate = str2Date(conPeek(con, 2), 213);
assetBook.LastDepreciationDate = str2Date(conPeek(con, 3), 213);
assetBook.LifeTimeRest = conPeek(con, 4);
assetBook.update();
}
}
catch(Exception::Error)
{
info(assetBook.AssetId);
}
}
}
}
ttsCommit;
}
static void UpdateFADates(Args _args)
{
AssetBook assetBook;
AssetId assetId;
CommaTextIo file;
int faCount;
LogisticsLocation logisticsLocation;
TaxInformation_IN taxInformation_IN;
RefRecId refrecid;
CommaIo commaIo;
Filename fileName;
FileIOPermission permission;
container con;
int i;
#File
fileName = WinAPI::getOpenFileName(0, ['CSV File', '*.csv'], '', "Import File");
if (!WinAPI::fileExists(fileName))
{
throw error(strfmt("@SYS18678", fileName));
}
commaIo = new CommaIo(fileName, #io_read);
if (!commaIo)
{
throw error(strfmt("@SYS19312", fileName));
}
ttsBegin;
while (commaIo.status() == IO_Status::Ok)
{
con = commaIo.read();
if(con)
{
i++;
assetId = conPeek(con, 1);
if (assetId)
{
try
{
while select forUpdate assetBook
where assetBook.AssetId == assetId
{
assetBook.UsedFromDate = str2Date(conPeek(con, 2), 213);
assetBook.LastDepreciationDate = str2Date(conPeek(con, 3), 213);
assetBook.LifeTimeRest = conPeek(con, 4);
assetBook.update();
}
}
catch(Exception::Error)
{
info(assetBook.AssetId);
}
}
}
}
ttsCommit;
}
No comments:
Post a Comment