Professional Documents
Culture Documents
var keyLog = ' userId: ' + userId + ' recType: ' + recType + ' recId: ' + recId
+ ' bookId: ' + bookId;
try {
var subsidiary = transactionRecord.getFieldValue('subsidiary');
var trandate_str = transactionRecord.getFieldValue('trandate');
if (trandate_str){
if (subsidiary){
var trandateYear_N =
parseInt(nlapiStringToDate(trandate_str).getFullYear(),10);
if(subsidiaryConfigForTheYear){
var isRCHSupplementaryTaxCalculation = false;
if (book.isPrimary()){
GLLines.transactionInfo = {
userId: userId,
recType: recType,
recId: recId,
bookId: bookId
};
if (recId){
nlapiLogExecution('AUDIT', 'customizeGlImpact core ' +
keyLog, 'getting additional rch lines for transaction: ' + recId);
GLLines.supplementaryTaxCalculationGLLines =
getSupplementaryTaxLines(recId, recType, supportedCustomSegments);
if (GLLines.supplementaryTaxCalculationGLLines.length >
0){
isRCHSupplementaryTaxCalculation = true;
GLLines.isRCHSupplementaryTaxCalculation =
isRCHSupplementaryTaxCalculation;
}
//_CreateJSONFile('SupplementaryTaxLines' + recId,
GLLines.supplementaryTaxCalculationGLLines, folderIdForLogs);
var SupplementaryTaxLines_GrpByTaxCodeId = {};
var UniqueSupplementaryLineKey =
taxItemSegmentExtIdPrefix + '' + supplementaryTaxLine.taxItemId;
if (typeof
SupplementaryTaxLines_GrpByTaxCodeId[UniqueSupplementaryLineKey] == 'undefined'){
SupplementaryTaxLines_GrpByTaxCodeId[UniqueSupplementaryLineKey] = {};
SupplementaryTaxLines_GrpByTaxCodeId[UniqueSupplementaryLineKey].lines = [];
SupplementaryTaxLines_GrpByTaxCodeId[UniqueSupplementaryLineKey].totalVat = 0;
SupplementaryTaxLines_GrpByTaxCodeId[UniqueSupplementaryLineKey].vatAccount =
supplementaryTaxLine.accountId;
}
SupplementaryTaxLines_GrpByTaxCodeId[UniqueSupplementaryLineKey].lines.push(JSON.pa
rse(JSON.stringify(supplementaryTaxLine)));
SupplementaryTaxLines_GrpByTaxCodeId[UniqueSupplementaryLineKey].totalVat
+=supplementaryTaxLine.taxAmount;
}
//_CreateJSONFile('SupplementaryTaxLines_GrpByTaxCodeId' + recId,
SupplementaryTaxLines_GrpByTaxCodeId, folderIdForLogs);
var currentStandardGLLine =
standardLines.getLine(iCountStandardGLLines);
var mappedGlLine =
_mapGlLine(currentStandardGLLine, iCountStandardGLLines,supportedCustomSegments,
isRCHSupplementaryTaxCalculation, GLLines.supplementaryTaxCalculationGLLines,
recType, subsidiaryConfigForTheYear);
//nlapiLogExecution('AUDIT', 'customizeGlImpact
core ' + keyLog, 'mappedGlLine: ' + JSON.stringify(mappedGlLine));
if (mappedGlLine.lineIsEnabledForCalculation){
atLeast1LineIsSubJectedToProRate = true;
if (mappedGlLine.taxType == 'VAT'){
if
(mappedGlLine.taxItemFoundInCustomGLLines){
GLLines.VATGLLines.revCH.push(mappedGlLine)
} else {
GLLines.VATGLLines.standard.push(mappedGlLine)
}
} else {
if
(mappedGlLine.taxItemFoundInCustomGLLines){
GLLines.baseGLLines.revCH.push(mappedGlLine)
} else {
GLLines.baseGLLines.standard.push(mappedGlLine)
}
}
GLLines.allGLLines.push(mappedGlLine);
} else {
GLLines.excludedGLLines.push(mappedGlLine)
}
}
if (atLeast1LineIsSubJectedToProRate){
nlapiLogExecution('AUDIT', 'customizeGlImpact core
' + keyLog, 'At least 1 line is enabled for calculation: ' + recId);
GLLines.standardVATLinesMap = {};
for (var iCountVATStandardGlLines = 0;
iCountVATStandardGlLines < GLLines.VATGLLines.standard.length;
iCountVATStandardGlLines++){
var currentVatStandardGlLine =
GLLines.VATGLLines.standard[iCountVATStandardGlLines];
var TaxCodeId =
currentVatStandardGlLine.taxItemId;
var taxCodeKey = taxItemSegmentExtIdPrefix + ''
+ TaxCodeId;
if (typeof
GLLines.standardVATLinesMap[taxCodeKey] == 'undefined'){
GLLines.standardVATLinesMap[taxCodeKey] =
{};
GLLines.standardVATLinesMap[taxCodeKey].taxAmount = 0;
GLLines.standardVATLinesMap[taxCodeKey].vatAccount =
currentVatStandardGlLine.ACC_accountId;
}
GLLines.standardVATLinesMap[taxCodeKey].taxAmount += taxAmountN;
}
GLLines.RCHVATLinesMap = {};
for (var iCountVATStandardGlLines = 0;
iCountVATStandardGlLines < GLLines.VATGLLines.revCH.length;
iCountVATStandardGlLines++){
var currentVatRCHGlLine =
GLLines.VATGLLines.revCH[iCountVATStandardGlLines];
var TaxCodeId = currentVatRCHGlLine.taxItemId;
var taxCodeKey = taxItemSegmentExtIdPrefix + ''
+ TaxCodeId;
if (typeof GLLines.RCHVATLinesMap[taxCodeKey]
== 'undefined'){
GLLines.RCHVATLinesMap[taxCodeKey] = {};
GLLines.RCHVATLinesMap[taxCodeKey].taxAmount = 0;
}
var taxAmountN =
parseFloat(currentVatRCHGlLine.taxAmount);
GLLines.RCHVATLinesMap[taxCodeKey].taxAmount +=
taxAmountN;
}
//GLLines.JELines.revCH.standardTaxCodesMap =
{};
var taxCodeKey = taxItemSegmentExtIdPrefix + ''
+ currentBaseGLLine.taxItemId;
//nlapiLogExecution('AUDIT', 'customizeGlImpact
core ' + keyLog, 'taxCodeKey: ' + taxCodeKey);
if (typeof
GLLines.standardTaxCodesMap[taxCodeKey] == 'undefined'){
GLLines.allStandardTaxCodes.push(currentBaseGLLine.taxItemId);
GLLines.standardTaxCodesMap[taxCodeKey] =
{};
GLLines.standardTaxCodesMap[taxCodeKey].total = 0;
GLLines.standardTaxCodesMap[taxCodeKey].PRVAT_TaxCodeName =
currentBaseGLLine.PRVAT_TaxCodeName;
GLLines.standardTaxCodesMap[taxCodeKey].recType = recType;
GLLines.standardTaxCodesMap[taxCodeKey].taxItemId = currentBaseGLLine.taxItemId;
GLLines.standardTaxCodesMap[taxCodeKey].lines = [];
}
var conditionalBaseAmount = 0;
GLLines.standardTaxCodesMap[taxCodeKey].total
+= conditionalBaseAmount;
GLLines.standardTaxCodesMap[taxCodeKey].lines.push({
isRch: false,
recType: recType,
originalExpenseAccount:
currentBaseGLLine.ACC_accountId,
CustomSegmentsValues:
currentBaseGLLine.CustomSegmentsValues,
baseAmount: conditionalBaseAmount,
nonDeductiblePercentage:
currentBaseGLLine.PRVAT_nonDeductiblePercentage,
});
}
taxCode.TotalVATToPostAsCost = 0;
var currentTotalVAT = 0;
taxCodeLine.amountToPostToCost =
Math.round(safeparseFloat(taxCodeLine.reproportionedVATAmount
*taxCodeLine.nonDeductiblePercentage/100)*100)/100
taxCode.TotalVATToPostAsCost +=
taxCodeLine.amountToPostToCost;
taxCodeLine.calculatedVATAmount =
taxCodeLine.baseAmount * taxCodeRate/100; // START FROM taxCode.RealTotalVAT AND
weigthPercentageMaxPrecision
}
taxCode.TotalVATToPostAsCost =
Math.round(safeparseFloat(taxCode.TotalVATToPostAsCost)*100)/100
}
//GLLines.JELines.revCH.standardTaxCodesMap =
{};
var taxCodeKey = taxItemSegmentExtIdPrefix + ''
+ currentBaseRchGLLine.taxItemId;
//nlapiLogExecution('AUDIT', 'customizeGlImpact
core ' + keyLog, 'taxCodeKey: ' + taxCodeKey);
if (typeof GLLines.rchTaxCodesMap[taxCodeKey]
== 'undefined'){
GLLines.allRCHTaxCodes.push(currentBaseRchGLLine.taxItemId);
GLLines.rchTaxCodesMap[taxCodeKey] = {};
GLLines.rchTaxCodesMap[taxCodeKey].total =
0;
GLLines.rchTaxCodesMap[taxCodeKey].PRVAT_TaxCodeName =
currentBaseRchGLLine.PRVAT_TaxCodeName;
GLLines.rchTaxCodesMap[taxCodeKey].recType
= recType;
GLLines.rchTaxCodesMap[taxCodeKey].taxItemId = currentBaseRchGLLine.taxItemId;
GLLines.rchTaxCodesMap[taxCodeKey].lines =
[];
}
var conditionalBaseAmount = 0;
GLLines.rchTaxCodesMap[taxCodeKey].total +=
conditionalBaseAmount;
GLLines.rchTaxCodesMap[taxCodeKey].lines.push({
isRch: true,
recType: recType,
originalExpenseAccount:
currentBaseRchGLLine.ACC_accountId,
CustomSegmentsValues:
currentBaseRchGLLine.CustomSegmentsValues,
baseAmount: conditionalBaseAmount,
nonDeductiblePercentage:
currentBaseRchGLLine.PRVAT_nonDeductiblePercentage,
});
}
nlapiLogExecution('AUDIT', '_getTaxCodeIdFromMemo
core segmentation', 'GLLines.allRCHTaxCodes.length: ' +
GLLines.allRCHTaxCodes.length);
if (GLLines.allRCHTaxCodes.length > 0){
GLLines.RchTaxCodeRates =
getTaxCodeParentItemRate(GLLines.allRCHTaxCodes);
}
if (iCountTaxCodeLines ==
taxCode.lines.length-1){
taxCodeLine.reproportionedVATAmount =
taxCode.RealTotalVAT - currentTotalVAT;
} else {
// calculatedVATAmount :
weigthPercentageMaxPrecision = RealTotalVAT : 100
taxCodeLine.reproportionedVATAmount =
Math.round(safeparseFloat(taxCodeLine.weigthPercentageMaxPrecision *
taxCode.RealTotalVAT / 100)*100)/100;;
currentTotalVAT +=
taxCodeLine.reproportionedVATAmount
}
taxCodeLine.amountToPostToCost =
Math.round(safeparseFloat(taxCodeLine.reproportionedVATAmount
*taxCodeLine.nonDeductiblePercentage/100)*100)/100
taxCode.TotalVATToPostAsCost +=
taxCodeLine.amountToPostToCost;
taxCodeLine.calculatedVATAmount =
taxCodeLine.baseAmount * taxCodeRate/100;// START FROM taxCode.RealTotalVAT AND
weigthPercentageMaxPrecision
}
taxCode.TotalVATToPostAsCost =
Math.round(safeparseFloat(taxCode.TotalVATToPostAsCost)*100)/100
}
ProRateVATGLLines_GRPByExtIDS[taxCodeExtId].PRVAT_TaxCodeName =
GLLines.standardTaxCodesMap[taxCodeExtId].PRVAT_TaxCodeName;
ProRateVATGLLines_GRPByExtIDS[taxCodeExtId].taxItemId =
GLLines.standardTaxCodesMap[taxCodeExtId].taxItemId;;
};
//name
for (var taxCodeExtId in GLLines.rchTaxCodesMap){
ProRateVATGLLines_GRPByExtIDS[taxCodeExtId] =
{};
ProRateVATGLLines_GRPByExtIDS[taxCodeExtId].PRVAT_TaxCodeName =
GLLines.rchTaxCodesMap[taxCodeExtId].PRVAT_TaxCodeName;
ProRateVATGLLines_GRPByExtIDS[taxCodeExtId].taxItemId =
GLLines.rchTaxCodesMap[taxCodeExtId].taxItemId;
};
var ProRataSegments =
handleCustomTaxCodeSegmentIO(GLLines,
ProRateVATGLLinesExtIDS,ProRateVATGLLines_GRPByExtIDS, keyLog);
var ProRataVATSegmentation_GrpByExtId =
ProRataSegments.ProRataVATSegmentation_GrpByExtId;
if (actuallyCreateGlLine){
for (var taxCodeKey in GLLines.rchTaxCodesMap)
{
var taxCode =
GLLines.rchTaxCodesMap[taxCodeKey];
_addCustomGlLineNewMethod(customLines,
taxCode, ProRataVATSegmentation_GrpByExtId)
}
}
} else {
nlapiLogExecution('AUDIT', 'customizeGlImpact core
' + keyLog, 'No lines subjected to calculation: ' + recId);
}
} else {
nlapiLogExecution('AUDIT', 'customizeGlImpact core ' +
keyLog, 'Skipping, no record id: ' + keyLog);
}
} else {
nlapiLogExecution('AUDIT', 'customizeGlImpact core ' +
keyLog, 'Skipping, no primary book: ' + keyLog);
}
} else {
nlapiLogExecution('AUDIT', 'customizeGlImpact core ' + keyLog,
'subsidiary '+subsidiary+' and or year '+trandateYear_N+' not configured');
}
} else {
nlapiLogExecution('AUDIT', 'customizeGlImpact core ' + keyLog, 'No
subsidiary, skipping');
}
} else {
nlapiLogExecution('AUDIT', 'customizeGlImpact core ' + keyLog, 'No
transaction date, skipping');
}
} catch(exc){
nlapiLogExecution('SYSTEM', 'customizeGlImpact core ' + keyLog, 'An error
occurred generating the additional lines: ' + exc.toString());
}
if (parseInt(userId,10) == 3){
//throw 'Debugging for employee 3'
}
}
var TaxCodeSegmentValues_GrpByTaxCodeId =
_getCurrentTaxCodeSegmentValues(ProRateVATGLLinesExtIDS);
nlapiLogExecution('AUDIT', '_handleProRataVATSegmentation core
segmentation' + keyLog, 'TaxCodeSegmentValues_GrpByTaxCodeId: ' +
JSON.stringify(TaxCodeSegmentValues_GrpByTaxCodeId));
var taxCodeExtId =
ProRateVATGLLinesExtIDS[iCountTaxCodesSegmentValues];
var TaxCodeSegmentID =
TaxCodeSegmentValues_GrpByTaxCodeId[taxCodeExtId];
// I DONT HAVE THE SEGMENT CREATED YET
//nlapiLogExecution('DEBUG', '_handleProRataVATSegmentation core ' +
keyLog, 'Did I find the tax code with ext id?: ' + taxCodeExtId);
// nlapiLogExecution('DEBUG', '_handleProRataVATSegmentation core ' +
keyLog, 'Did I find the tax code with ext id?: ' + TaxCodeSegmentID);
} else {
nlapiLogExecution('AUDIT', '_handleProRataVATSegmentation core
segmentation' + keyLog, 'No Tax Codes Segments Found');
}
return {
ProRataVATSegmentation_GrpByExtId: ProRataVATSegmentation_GrpByExtId,
ProRateVATGLLines_GRPByExtIDS: ProRateVATGLLines_GRPByExtIDS,
};
};
return memo;
};
}
}
}
return TaxCodeRatesMap;
};
return TaxCodeRatesMap;
};
var _addCustomGlLineNewMethod = function(customLines, taxCode,
ProRataVATSegmentation_GrpByExtId){
nlapiLogExecution('DEBUG', 'customizeGlImpact core CustomGlLine', 'taxCode: ' +
JSON.stringify(taxCode));
nlapiLogExecution('DEBUG', 'customizeGlImpact core CustomGlLine',
'transactionType: ' + taxCode.recType);
proRateBookingCostLine.setDebitAmount(taxCodeLine.amountToPostToCost);
} else {
proRateBookingCostLine.setCreditAmount(taxCodeLine.amountToPostToCost);
}
proRateBookingCostLine.setAccountId(parseInt(taxCodeLine.originalExpenseAccount,10)
);
proRateBookingCostLine.setMemo('VAT ' + memo);
if (taxCodeLine.CustomSegmentsValues.department){
proRateBookingCostLine.setDepartmentId(taxCodeLine.CustomSegmentsValues.department)
;
}
if (taxCodeLine.CustomSegmentsValues.class){
proRateBookingCostLine.setClassId(taxCodeLine.CustomSegmentsValues.class);
}
if (taxCodeLine.CustomSegmentsValues.location){
proRateBookingCostLine.setLocationId(taxCodeLine.CustomSegmentsValues.location);
}
if (taxCodeSegmentId){
proRateBookingCostLine.setSegmentValueId(taxCodeCustomSegmentId,
parseInt(taxCodeSegmentId,10))
}
proRateBookingVatLine.setCreditAmount(taxCodeLine.amountToPostToCost);
} else {
proRateBookingVatLine.setDebitAmount(taxCodeLine.amountToPostToCost);
}
proRateBookingVatLine.setAccountId(parseInt(taxCodeLine.vatAccount,10));
proRateBookingVatLine.setMemo('VAT ' + memo);
if (taxCodeLine.CustomSegmentsValues.department){
proRateBookingVatLine.setDepartmentId(taxCodeLine.CustomSegmentsValues.department);
}
if (taxCodeLine.CustomSegmentsValues.class){
proRateBookingVatLine.setClassId(taxCodeLine.CustomSegmentsValues.class);
}
if (taxCodeLine.CustomSegmentsValues.location){
proRateBookingVatLine.setLocationId(taxCodeLine.CustomSegmentsValues.location);
}
if (taxCodeSegmentId){
proRateBookingVatLine.setSegmentValueId(taxCodeCustomSegmentId,
parseInt(taxCodeSegmentId,10))
}
} else {
nlapiLogExecution('AUDIT', 'customizeGlImpact core CustomGlLine
SKIPPING', 'SKIPPING Custom line credit/debit amount: ' +
taxCodeLine.amountToPostToCost + ' expense account: ' +
taxCodeLine.originalExpenseAccount);
}
};
var _addCustomGlLine = function(customLines, ProRateVATGLLine,
ProRataVATSegmentation_GrpByExtId){
nlapiLogExecution('DEBUG', 'customizeGlImpact core', 'ProRateVATGLLine: ' +
JSON.stringify(ProRateVATGLLine));
if (ProRateVATGLLine.PRVAT_notionalCostAmount){
if (taxCodeSegmentId){
proRateNewLine.setSegmentValueId(taxCodeCustomSegmentId,
parseInt(taxCodeSegmentId,10))
}
var accID =
parseInt(ProRateVATGLLine.PRVAT_ACC_notionalImpact_costaccount,10);
proRateNewLine_voidTheStandard.setDebitAmount(ProRateVATGLLine.PRVAT_notionalCostAm
ount);
proRateNewLine_voidTheStandard.setAccountId(accID);
if (taxCodeSegmentId){
proRateNewLine_voidTheStandard.setSegmentValueId(taxCodeCustomSegmentId,
parseInt(taxCodeSegmentId,10))
}
if (ProRateVATGLLine.isCustomGL == true){
if (ProRateVATGLLine.PRVAT_ACC_notionalImpact_costaccountRCH){
// DEBIT VAT ON SALES (218), CREDIT COST ACCOUNT
}
}
} else {
if (ProRateVATGLLine.PRVAT_notionalCostAmount){
proRateNewLine.setCreditAmount(ProRateVATGLLine.PRVAT_notionalCostAmount);
var accID =
parseInt(ProRateVATGLLine.PRVAT_ACC_notionalImpact_costaccount,10);
proRateNewLine.setAccountId(accID);
//proRateNewLine_voidTheStandard.setSegmentValueId(segmentId,
segmentValueId)
if (taxCodeSegmentId){
proRateNewLine.setSegmentValueId(taxCodeCustomSegmentId,
parseInt(taxCodeSegmentId,10))
}
proRateNewLine_voidTheStandard.setDebitAmount(ProRateVATGLLine.PRVAT_notionalCostAm
ount);
if (taxCodeSegmentId){
proRateNewLine_voidTheStandard.setSegmentValueId(taxCodeCustomSegmentId,
parseInt(taxCodeSegmentId,10))
}
}
if (ProRateVATGLLine.isCustomGL == true){
// DEBIT VAT ON PURCHASE, CREDIT COST ACCOUNT
if (ProRateVATGLLine.PRVAT_ACC_notionalImpact_costaccountRCH){
// CREDIT VAT ON SALES, DEBIT COST ACCOUNT
}
}
}
};
return recordID
return CurrentTaxCodeSegmentValues;
};
if (configYear){
if
(ConfigSRCH[iCountSrchResults].getValue('custrecord_delse_proratevat_folderid')){
folderIdForLogs =
ConfigSRCH[iCountSrchResults].getValue('custrecord_delse_proratevat_folderid');
}
if (currentSubsidiaryIsIncludedInSingleSubConfig ||
currentSubsidiaryIsIncludedInMultiSubConfig){
var taxCodeName =
ConfigSRCH[iCountSrchResults].getText('custrecord_delse_prorate_taxcode','custrecor
d_delse_prorate_mainconfig');
validLinesForTheYear.push({
taxCodeId:
ConfigSRCH[iCountSrchResults].getValue('custrecord_delse_prorate_taxcode','custreco
rd_delse_prorate_mainconfig'),
taxCodeName: taxCodeName,
costaccountRCH: -1,
costaccount: -1,
nonDeductiblePercentage:
ConfigSRCH[iCountSrchResults].getValue('custrecord_delse_proratevat_nondeductibl'),
configSupportedSegments: configSupportedSegments,
})
}
}
}
};
config = {
nonDeductiblePercentage:
validLinesForTheYear[0].nonDeductiblePercentage,
configSupportedSegments:
validLinesForTheYear[0].configSupportedSegments,
taxCodes: {}
};
config.taxCodes[tCodeId] = {
id: tCodeId,
name:
validLinesForTheYear[iCountSrchResults].taxCodeName,
costaccount:
validLinesForTheYear[iCountSrchResults].costaccount,
costaccountRCH:
validLinesForTheYear[iCountSrchResults].costaccountRCH,
};
return config;
};
SearchColumns.push(new
nlobjSearchColumn(supportedCustomSegments[iCountSupportedCustomSegments]));
}
var creditfxAmountString =
SRCH[iCountSrchResults].getValue('creditfxamount');
var creditAmountString =
SRCH[iCountSrchResults].getValue('creditamount');
var debitfxAmountString =
SRCH[iCountSrchResults].getValue('debitfxamount');
var debitAmountString =
SRCH[iCountSrchResults].getValue('debitamount');
var debitAmount =
Math.round(safeparseFloat(debitAmountString)*100)/100;
var debitfxAmount =
Math.round(safeparseFloat(debitfxAmountString)*100)/100;
var creditAmount =
Math.round(safeparseFloat(creditAmountString)*100)/100;
var creditfxAmount =
Math.round(safeparseFloat(creditfxAmountString)*100)/100;
return mappedResults
};
return currentLineTaxCodeReferenceId;
};
return {
notionalVATCreditAmount: notionalVATCreditAmount,
notionalVATDebitAmount: notionalVATDebitAmount,
notionalVATAccount: notionalVATAccount,
taxItemFoundInCustomGLLines: taxItemFoundInCustomGLLines
}
};
var mappedProRataGlLine_current =
_mapGlLineInProRateLine(GLLines.vatLinesToCondider[iCountCustomGLLines]);
ProRateVATGLLines.push(mappedProRataGlLine_current);
return ProRateVATGLLines
};
if (isRCHSupplementaryTaxCalculation){
var taxCodeSupplementaryRCHDetails =
_getTaxCodeSupplementaryRCHDetails(taxItemId, lineid, SupplementaryTaxLines);
taxItemFoundInCustomGLLines =
taxCodeSupplementaryRCHDetails.taxItemFoundInCustomGLLines;
if (currentSupportedSegmentId == 'class'){
nlapiLogExecution('DEBUG', '_getTaxCodeIdFromMemo core segmentation',
'getting value (NO RCH line) for class');
CustomSegmentsValues[currentSupportedSegmentId] =
currentStandardGLLine.getClassId();
} else {
if (currentSupportedSegmentId == 'department'){
nlapiLogExecution('DEBUG', '_getTaxCodeIdFromMemo core
segmentation', 'getting value (NO RCH line) for department');
CustomSegmentsValues[currentSupportedSegmentId] =
currentStandardGLLine.getDepartmentId();
} else {
if (currentSupportedSegmentId == 'location'){
nlapiLogExecution('DEBUG', '_getTaxCodeIdFromMemo core
segmentation', 'getting value (NO RCH line) for department');
CustomSegmentsValues[currentSupportedSegmentId] =
currentStandardGLLine.getLocationId();
} else {
nlapiLogExecution('DEBUG', '_getTaxCodeIdFromMemo core
segmentation', 'getting value (NO RCH line) for segment: ' +
currentSupportedSegmentId);
CustomSegmentsValues[currentSupportedSegmentId] =
currentStandardGLLine.getSegmentValueId(currentSupportedSegmentId)
}
var nonDeductiblePercentageStr =
subsidiaryConfigForTheYear.nonDeductiblePercentage;
var nonDeductiblePercentage = 0;
if(nonDeductiblePercentageStr){
nonDeductiblePercentage = parseFloat(nonDeductiblePercentageStr)
}
var taxCodeConfigKey = ''+taxItemId;
var taxCodeConfig = subsidiaryConfigForTheYear.taxCodes[taxCodeConfigKey];
return {
lineIsEnabledForCalculation: lineIsEnabledForCalculation,
lineSequence: iCountStandardGLLines,
entityId: entityId,
lineid: lineid,
subsidiaryid: subsidiaryid,
taxableAmount: taxableAmount,
taxAmount: taxAmount,
taxItemId: taxItemId,
taxType: taxType,
taxItemFoundInCustomGLLines: taxItemFoundInCustomGLLines,
creditAmount: creditAmount,
creditAmountString: creditAmountString,
debitAmount: debitAmount,
debitAmountString: debitAmountString,
ACC_accountId: accountId,
ACC_accountType: accountType,
PRVAT_transactionType: PRVAT_transactionType,
PRVAT_TaxCodeName: PRVAT_TaxCodeName,
PRVAT_nonDeductiblePercentage: PRVAT_nonDeductiblePercentage,
isPosting: isPosting,
isTaxable: isTaxable,
classId: classId,
departmentId: departmentId,
locationId: locationId,
memoLine: memoLine,
CustomSegmentsValues: CustomSegmentsValues,
}
};
return AccountTypeMap[accountId];
};
// EU