Günü Sözü
"Hiçbir şey bilmeyen cahildir, ama bilip de susan ahlaksızdır. " Bertolt Brecht.
"İyilik yapabildiğim zaman mutlu olurum; ama en büyük mutluluk yapılan bir haksızlığı düzeltmektir." Tolstoy
"İyilik yapabildiğim zaman mutlu olurum; ama en büyük mutluluk yapılan bir haksızlığı düzeltmektir." Tolstoy
4 Aralık 2014 Perşembe
Ax2012 Import Fixed Assets Table, csv,excel den sabit kıymetlere import
public void _createAssetTable(
AssetId _assetId
, AssetGroupId _assetGroupId
, AssetName _assetName
, AssetLocationId _assetLocationId
, Num _num
, AssetType _assetType
, AssetNameAlias _assetNameAlias
, AssetNotes _assetNotes
, AssetMajorTypeId _assetMajorTypeId)
{
AxAssetTable axAssetTable;
;
axAssetTable = new AxAssetTable();
axAssetTable.validateInput(true);
axAssetTable.parmAssetId(_assetId);
axAssetTable.parmAssetGroup(_assetGroupId ?_assetGroupId : assetGroupId);
axAssetTable.parmName(_assetName);
axAssetTable.parmLocation(_assetLocationId);
axAssetTable.parmSerialNum(_num);
axAssetTable.parmAssetType(_assetType);
axAssetTable.parmNameAlias(_assetNameAlias);
axAssetTable.parmNotes(_assetNotes);
axAssetTable.parmMajorType(_assetMajorTypeId);
axAssetTable.save();
}
// creates the Assets book
protected void CreateAssetBook(container _conLine)
{
#Define.AssetId(1)
#Define.BookId(2)
#Define.PostingProfile(9)
#Define.LifeTime(11)
#Define.LifeTimeRest(12)
#Define.DepreciationStartDate(16)
#Define.LastDepreciationDate(18)
#Define.AcquisitionDate(27)
AssetBook assetBook;
AxAssetBook axAssetBook = AxAssetBook::construct();
SysDictClass sysDictClassAxAssetBook = new SysDictClass(classIdGet(AxAssetBook));
;
assetBook = AssetBook::find(this.getLineValue(_conLine, #AssetId), this.getLineValue(_conLine, #BookId), true);
if(assetBook)
{
axAssetBook = AxAssetBook::newAssetBook(assetBook);
// AssetId
axAssetBook.parmAssetId(this.getLineValue(_conLine,#AssetId))
// BookId
axAssetBook.parmBookId(this.getLineValue(_conLine,#BookId));
// PostingProfile
axAssetBook.parmPostingProfile( this.getLineValue(_conLine, #PostingProfile) );
// LifeTime
axAssetBook.parmLifeTimes(str2num(this.getLineValue(_conLine,#LifeTime)));
// LifeTimeRest
axAssetBook.parmLifeTimeRest(str2num(this.getLineValue(_conLine,#LifeTimeRest)));
// DepreciationStartDate
axAssetBook.parmDepreciationStartDate(str2date((this.getLineValue(_conLine,#DepreciationStartDate),123));
// LastDepreciationDate
axAssetBook.parmLastDepreciationDate(str2dat(this.getLineValue(_conLine,#LastDepreciationDate),123));
// AcquisitionDate
axAssetBook.parmAcquisitionDate(str2date(this.getLineValue(_conLine,#AcquisitionDate),123));
axAssetBook.save();
}
else
{
throw error(strFmt(AssetBook::txtNotExist(), this.getLineValue(_conLine, #AssetId),
this.getLineValue(_conLine, #BookId)));
}
}
// gets the value from the container
protected anytype getLineValue(container _conLine,
int _columnNum,
Types _valueType = Types::String,
EnumId _enumId = 0)
{
str strValue;
anytype anyTypeValue;
DictEnum dictEnum;
strValue = conPeek(_conLine,
_columnNum);
switch(_valueType)
{
case Types::String :
anyTypeValue = strValue;
break;
case Types::Integer :
if(strValue)
{
anyTypeValue = str2int(strValue);
}
else
{
anyTypeValue = 0;
}
break;
case Types::Real :
if(strValue)
{
anyTypeValue = str2num(strValue);
}
else
{
anyTypeValue = 0.00;
}
break;
case Types::Enum :
if(!_enumId)
{
throw error(strFmt("@SYS22828", funcName()));
}
dictEnum = new DictEnum(_enumId);
if(!dictEnum)
{
throw error(strFmt("@SYS22828", funcName()));
}
if(strValue)
{
anyTypeValue = dictEnum.name2Value(strValue);
}
else
{
anyTypeValue = 0;
}
break;
case Types::Date :
if(strValue)
{
anyTypeValue = str2date(strValue,123);
}
else
{
anyTypeValue = dateNull();
}
break;
case Types::UtcDateTime :
if(strValue)
{
anyTypeValue = DateTimeUtil::parse(strValue);
}
else
{
anyTypeValue = utcDateTimeNull();
}
break;
default :
throw error(strFmt("@SYS26908", _valueType));
}
return anyTypeValue;
}
1 Aralık 2014 Pazartesi
Asset Table, Asset Book, Asset Trans insert,update,import
static void _assetbookCreate(Args _args)
{
AssetBook _assetBook;
AssetTrans _assetTrans;
try
{
ttsbegin;
_assetBook.clear();
_assetBook = AssetBook::find('assetid','assetbokid',true);
if(!_assetBook)
{
info('asset id yok');
// continue;
}
else
{
_assetBook.AssetId = 'asset id';
_assetBook.AcquisitionDate =26\06\2014;
_assetBook.VendAccount ='';
_assetBook.AssetGroup ='254-1';
_assetBook.VendInvoiceId ='';
_assetBook.AcquisitionPrice =0.00;
// _assetBook.DefaultDimension = ''; //22565574414;
_assetBook.DepreciationStartDate =26\06\2014;
_assetBook.LifeTime =5;
_assetBook.UsedFromDate = 26\06\2015;
_assetBook.LifeTime =60;
_assetBook.LifeTimeRest =60;
_assetBook.PostingProfile = 'NORMAL';
_assetBook.BookId='NORMAL';
_assetBook.Status = AssetStatus::NoAcquisition;
//_assetBook.Depreciation = NoYes::Yes;
_assetBook.insert();
}
ttscommit;
info("işlem başarıyla tamamlandı. hadi hayırlı olsun.");
}
catch
{
info(strFmt(" : %1 ",_assetBook.AssetId));
info("işlem sırsaında bir hata oluştu :(");
}
try
{
ttsbegin;
_assetTrans.clear();
_assetTrans.AssetId = 'asset id';
_assetTrans.TransDate = 26\06\2014;
_assetTrans.Voucher ='FIS no';
_assetTrans.AssetGroup ='grup no';
_assetTrans.TransType = 1;
_assetTrans.Txt ='Alım';
_assetTrans.CurrencyCode='TRY';
_assetTrans.BookId='NORMAL';
_assetTrans.AmountMST=4100;
_assetTrans.AmountCur=4100;
_assetTrans.DefaultDimension = 22565574414;
_assetTrans.insert();
ttscommit;
info("işlem başarıyla tamamlandı. hadi hayırlı olsun.");
}
catch
{
info(strFmt(" : %1 ",_assetTrans.AssetId));
info("işlem sırsaında bir hata oluştu :(");
}
}
Kaydol:
Yorumlar (Atom)