//Added to Upload GST Tax Rate-13/6/2017
public void Alle_UploadGSTTaxRate()
{
TaxRuntimeLookupCondition taxRuntimeLookupCondition;
TaxRuntimeLookupMeasureResultDetail taxRuntimeLookupMeasureResultDetail;
TaxRuntimeLookupMeasureResult taxRuntimeLookupMeasureResult;
Dialog dialog = new Dialog();
DialogField dialogField;
str Delimiter = ",";
str filePath,fileNameOnly,type;
AsciiIo importFile;
container record;
int totalRecords;
NumberSeq num;
TaxRuntimeLookup runTimeLookup;
TaxRuntimeDocComponentMeasure docComponentMeasure;
TaxRuntimeDocContext taxRuntimeDocContext;
TaxSolutionScopeSetup taxSolutionScopeSetup;
RefRecId ledger;
dialogField=dialog.addField(extendedTypeStr(FilenameOpen),"Select File to Import","Select file to import");
dialog.addText("File-Format Sequence: ConsumptionState, HSNCode, SAC, TransactionDateFrom, TransactionDateTo");
dialog.addText("NetPriceMin, NetPriceMax, PriceIncl, MRPMin, MRPMax");
dialog.caption("Import File");
dialog.filenameLookupFilter(['csv','*.csv']);
if(!dialog.run())
return;
[filePath, fileNameOnly, type] = fileNameSplit(dialogField.value());
importFile = new AsciiIo(dialogField.value(), 'R');
if((!importFile) || (importFile.status() != IO_Status::Ok))
{
warning("Error in opening import file");
throw(Exception::Error);
}
importFile.inFieldDelimiter(Delimiter);
if((!importFile) || (importFile.status() != IO_Status::Ok))
{
warning("Error in opening log file");
throw(Exception::Error);
}
ttsbegin;
try
{
record = importFile.read();
while(importFile.status() == IO_Status::Ok)
{
taxRuntimeLookupCondition.clear();
TaxRuntimeLookupMeasureResultDetail.clear();
taxRuntimeLookupMeasureResult.clear();
record = importFile.read();
if(!record)
break;
totalRecords = totalRecords + 1;
runTimeLookup = this.parmRuntimeLookup();
taxRuntimeLookupCondition.LookupVersion = lookup.RecId;
taxRuntimeLookupCondition.DimValue1 = conPeek(record,1); //State
taxRuntimeLookupCondition.DimValue2 = conPeek(record,2); //HSN
taxRuntimeLookupCondition.DimValue3 = conPeek(record,3); //SAC
taxRuntimeLookupCondition.DateRangeFrom1 = str2Date(conPeek(record,4),213); //TransDateFrom
taxRuntimeLookupCondition.DateRangeTo1 = str2Date(conPeek(record,5),213); //TransDateTo
taxRuntimeLookupCondition.ValueRangeFrom1 = conPeek(record,6); //NetPrice Min
taxRuntimeLookupCondition.ValueRangeTo1 = conPeek(record,7); //NetPrice Max
taxRuntimeLookupCondition.DimValue4 = conPeek(record,8); // Price Incl
taxRuntimeLookupCondition.ValueRangeFrom2 = conPeek(record,9); // MRP min
taxRuntimeLookupCondition.ValueRangeTo2 = conPeek(record,10); // MRP max
select firstOnly taxSolutionScopeSetup where
taxSolutionScopeSetup.TaxSolutionScope == taxruntimedoccontext::find(TaxRuntimeDocComponentMeasure::find
(runTimeLookup.LookupOwnerRecId).DocContext).TaxSolutionScope;
taxRuntimeLookupCondition.Ledger = taxSolutionScopeSetup.Ledger;
taxRuntimeLookupCondition.write();
try
{
conditionEditingHelper.writtenLookupCondition(taxRuntimeLookupCondition);
select firstOnly taxRuntimeLookupMeasureResult
join forUpdate taxRuntimeLookupMeasureResultDetail
where taxRuntimeLookupMeasureResult.LookupCondition == taxRuntimeLookupCondition.RecId
&& taxRuntimeLookupMeasureResultDetail.LookupMeasureResult == taxRuntimeLookupMeasureResult.RecId;
taxRuntimeLookupMeasureResultDetail.Value = conPeek(record,11);
taxRuntimeLookupMeasureResultDetail.write();
}
catch(Exception::Error)
{
throw(Exception::Error);
}
}
}
catch(Exception::Error)
{
Throw(Exception::Error);
}
ttsCommit;
info(strFmt("%1 Lines imported",totalRecords));
}
public void Alle_UploadGSTTaxRate()
{
TaxRuntimeLookupCondition taxRuntimeLookupCondition;
TaxRuntimeLookupMeasureResultDetail taxRuntimeLookupMeasureResultDetail;
TaxRuntimeLookupMeasureResult taxRuntimeLookupMeasureResult;
Dialog dialog = new Dialog();
DialogField dialogField;
str Delimiter = ",";
str filePath,fileNameOnly,type;
AsciiIo importFile;
container record;
int totalRecords;
NumberSeq num;
TaxRuntimeLookup runTimeLookup;
TaxRuntimeDocComponentMeasure docComponentMeasure;
TaxRuntimeDocContext taxRuntimeDocContext;
TaxSolutionScopeSetup taxSolutionScopeSetup;
RefRecId ledger;
dialogField=dialog.addField(extendedTypeStr(FilenameOpen),"Select File to Import","Select file to import");
dialog.addText("File-Format Sequence: ConsumptionState, HSNCode, SAC, TransactionDateFrom, TransactionDateTo");
dialog.addText("NetPriceMin, NetPriceMax, PriceIncl, MRPMin, MRPMax");
dialog.caption("Import File");
dialog.filenameLookupFilter(['csv','*.csv']);
if(!dialog.run())
return;
[filePath, fileNameOnly, type] = fileNameSplit(dialogField.value());
importFile = new AsciiIo(dialogField.value(), 'R');
if((!importFile) || (importFile.status() != IO_Status::Ok))
{
warning("Error in opening import file");
throw(Exception::Error);
}
importFile.inFieldDelimiter(Delimiter);
if((!importFile) || (importFile.status() != IO_Status::Ok))
{
warning("Error in opening log file");
throw(Exception::Error);
}
ttsbegin;
try
{
record = importFile.read();
while(importFile.status() == IO_Status::Ok)
{
taxRuntimeLookupCondition.clear();
TaxRuntimeLookupMeasureResultDetail.clear();
taxRuntimeLookupMeasureResult.clear();
record = importFile.read();
if(!record)
break;
totalRecords = totalRecords + 1;
runTimeLookup = this.parmRuntimeLookup();
taxRuntimeLookupCondition.LookupVersion = lookup.RecId;
taxRuntimeLookupCondition.DimValue1 = conPeek(record,1); //State
taxRuntimeLookupCondition.DimValue2 = conPeek(record,2); //HSN
taxRuntimeLookupCondition.DimValue3 = conPeek(record,3); //SAC
taxRuntimeLookupCondition.DateRangeFrom1 = str2Date(conPeek(record,4),213); //TransDateFrom
taxRuntimeLookupCondition.DateRangeTo1 = str2Date(conPeek(record,5),213); //TransDateTo
taxRuntimeLookupCondition.ValueRangeFrom1 = conPeek(record,6); //NetPrice Min
taxRuntimeLookupCondition.ValueRangeTo1 = conPeek(record,7); //NetPrice Max
taxRuntimeLookupCondition.DimValue4 = conPeek(record,8); // Price Incl
taxRuntimeLookupCondition.ValueRangeFrom2 = conPeek(record,9); // MRP min
taxRuntimeLookupCondition.ValueRangeTo2 = conPeek(record,10); // MRP max
select firstOnly taxSolutionScopeSetup where
taxSolutionScopeSetup.TaxSolutionScope == taxruntimedoccontext::find(TaxRuntimeDocComponentMeasure::find
(runTimeLookup.LookupOwnerRecId).DocContext).TaxSolutionScope;
taxRuntimeLookupCondition.Ledger = taxSolutionScopeSetup.Ledger;
taxRuntimeLookupCondition.write();
try
{
conditionEditingHelper.writtenLookupCondition(taxRuntimeLookupCondition);
select firstOnly taxRuntimeLookupMeasureResult
join forUpdate taxRuntimeLookupMeasureResultDetail
where taxRuntimeLookupMeasureResult.LookupCondition == taxRuntimeLookupCondition.RecId
&& taxRuntimeLookupMeasureResultDetail.LookupMeasureResult == taxRuntimeLookupMeasureResult.RecId;
taxRuntimeLookupMeasureResultDetail.Value = conPeek(record,11);
taxRuntimeLookupMeasureResultDetail.write();
}
catch(Exception::Error)
{
throw(Exception::Error);
}
}
}
catch(Exception::Error)
{
Throw(Exception::Error);
}
ttsCommit;
info(strFmt("%1 Lines imported",totalRecords));
}