static void ledgerjournaltrans_fixed(Args _args)
{
LedgerJournalTrans_Asset LedgerJournalTrans_Asset;
DimensionValue DisplayValue;
DimensionDisplayValue DimensionDisplayValue;
LedgerJournalTrans LedgerJournalTrans;
SysOperationProgress simpleProgress;
DimensionAttributeValueCombination DimensionAttributeValueCombination;
DimensionAttributeValueSet DimensionAttributeValueSet;
FileIOPermission permission;
CommaIO csvFile;
container readCon;
counter icount,inserted;
Dialog dialog;
DialogField dfFileName;
FileName fileName;
str contactperson;
str 70 TransType,dates;
DimensionAttributeValueSetItem DimensionAttributeValueSetItem;
BinData binData;
inserted =0;
#File
dialog = new Dialog("Pick the file");
dfFileName = dialog.addField(extendedTypeStr(FileNameOpen));
dialog.filenameLookupFilter(["All files", #AllFiles]);
if (dialog.run())
{
filename = dfFileName.value();
}
csvFile = new CommaIO(filename, 'r');
if (csvFile)
{
readCon = csvFile.read();
while (csvFile.status() == IO_Status::OK)
{
readCon = csvFile.read();
icount++;
if (readCon)
{
LedgerJournalTrans.clear();
ttsBegin;
LedgerJournalTrans.AccountType = LedgerJournalACType::FixedAssets;
dates = conPeek(readCon,1);
LedgerJournalTrans.AcknowledgementDate = str2Date(dates,123);
LedgerJournalTrans.AmountCurDebit = conPeek(readCon,2);
LedgerJournalTrans.Company = conPeek(readCon,3);
LedgerJournalTrans.CurrencyCode = conPeek(readCon,4);
LedgerJournalTrans.ExchRate = conPeek(readCon,5);
LedgerJournalTrans.JournalNum = conPeek(readCon,6);
///////////////////////////////////LEDGER DIMENSION/////////////////////
DisplayValue = conPeek(readCon,7);
select * from DimensionAttributeValueCombination where DimensionAttributeValueCombination.DisplayValue == DisplayValue;
LedgerJournalTrans.LedgerDimension = DimensionAttributeValueCombination.RecId;
///////////////////////////////////////////////////////////////////////
LedgerJournalTrans.LineNum = conPeek(readCon,8);
LedgerJournalTrans.OffsetAccountType = LedgerJournalACType::Ledger;
LedgerJournalTrans.OffsetCompany = conPeek(readCon,10);
/////////////////////////OFFSETDEFAULTDIMENSION///////////////
DisplayValue = conPeek(readCon,11);
select * from DimensionAttributeValueSetItem where DimensionAttributeValueSetItem.DisplayValue == DisplayValue;
LedgerJournalTrans.OffsetDefaultDimension = DimensionAttributeValueSetItem.RecId;
////////////////////////////////////////
////////////////////////////////OFSETLEDGERDIMENSION//////////////////////////
DisplayValue = conPeek(readCon,12);
select * from DimensionAttributeValueCombination where DimensionAttributeValueCombination.DisplayValue == DisplayValue;
LedgerJournalTrans.OffsetLedgerDimension = DimensionAttributeValueCombination.RecId;
///////////////////////////////////////////////////////////////////////////////
LedgerJournalTrans.Price = conPeek(readCon,13);
LedgerJournalTrans.Qty = conPeek(readCon,14);
LedgerJournalTrans.TaxItemGroup = conPeek(readCon,15);
LedgerJournalTrans.Voucher = conPeek(readCon,16);
// LedgerJournalTrans.dataAreaId = conPeek(readCon,17);
dates = conPeek(readCon,18);
LedgerJournalTrans.TransDate = str2Date(dates,123);
LedgerJournalTrans.Txt = conPeek(readCon,19);
LedgerJournalTrans.CurrencyCode = conPeek(readCon,20);
LedgerJournalTrans.AmountCurDebit = conPeek(readCon,21);
//LedgerJournalTrans.insert();
ttsCommit;
}
}
}
info(strfmt("%1 records inserted out of %2",inserted,icount));
}
No comments:
Post a Comment