static void ETK_EPLREFCreation_Clearing_Clearing(Args _args)
#{
# ProjTable projTable;
# SMAAgreementTable smaAgreementTable;
# SalesTable salesTableProcess,salesTable;
# SalesLine salesLine,salesLineProcess;
# CustTable custTable;
# SMAServiceObjectTable smaServiceObjectTable;
# SalesFormLetter letter = SalesFormLetter::construct(DocumentStatus::Confirmation);
# Exception Exception;
# SMArepairLine repairLine;
# ETK_CoreParameters etk_CoreParameters = ETK_CoreParameters::find();
# ETK_EpurseProcess process = new ETK_EpurseProcess();
# ETK_BESalesHeader beSalesHeader = ETK_BESalesHeader::construct();
# ETK_BESalesProductInfo beSalesProductInfo = ETK_BESalesProductInfo::construct();
# ETK_BESalesLineExtCollection beSalesLineExtColl = ETK_BESalesLineExtCollection::construct();
# ETK_BESalesLineExt beSalesLineExt = ETK_BESalesLineExt::construct();
# ETK_BESalesOrder beSalesOrder = new ETK_BESalesOrder();
# ETK_BESalesPaymOptions beSalesPaymentOptions = ETK_BESalesPaymOptions::construct();
# ETK_ServiceOrder ServiceOrder = ETK_ServiceOrder::construct();
# ETK_BESalesProductInfo productInfo = ETK_BESalesProductInfo::construct();
# ETK_FieldDescriptorCollection fieldescColl = ETK_FieldDescriptorCollection::construct();
# ETK_BESalesPaymOptions salesPaym = ETK_BESalesPaymOptions::construct();
# ETK_OutboundStagingEpurseLoad outboundStagingEpurseLoad;
# ProjProposalId proposalId1 ;
# #File
# TextIo io;
# container salesValue;
# FileIoPermission perm;
# Dialog dlg;
# DialogField dlgPath;
# DialogText ddt;
# TextBuffer textBuffer;
# str textString;
# String255 jobinput;
# String255 logDescription;
# str clearText,shareFilePath,datestr;
# int newLinePos;
# str line,ledgerTvalue;
# str 30 field1,field2,field3,field4,field5;
# counter row;
# CommaTextIo commaTextIo;
# FileIOPermission permission,outFilePermission;
# container containFromRead;
# int x;
# int cols;
# boolean ret;
# #ETK_Macro
# //#define.delimiterSemicolon(';')
# FileName outFileName;
# Set permissionSet = new set(types::Class);
# TextBuffer settlementExtractBfr = new TextBuffer();
# ;
# dlg =new Dialog("Create EPL-REF Order");
# dlgPath =dlg.addField(extendedTypeStr(FilenameOpen),'Enter the path of the Text file with .CSV extension');
# ddt = dlg.addText("**Note: File Format = GSN,amount(positive only), incident/work around/GoEPL/York");// 5/17/2107
# if(!dlg.run())
# {
# return;
# }
# perm = new FileIoPermission(dlgPath.value(), #io_read);
# perm.assert();
# commaTextIo = new CommaTextIO(dlgPath.value(),'R');
#
# containFromRead = commaTextIo.read();
#
# While(containFromRead)
# {
# cols = conLen(containFromRead);
# if(cols>1)
# {
# field1 = conpeek(containFromRead,1); //GSN
# field2 = conpeek(containFromRead,2); //amount
# field3 = conpeek(containFromRead,3); //Go-EPL or York-CoFare
#
# // Create a sales order with EPL-REF item
#
# smaServiceObjectTable = SMAServiceObjectTable::ETK_findByVisibleId(field1,ETK_MediaType::FARECARD,'GnD');
# if(smaServiceObjectTable.RecId)
# {
# select firstonly repairLine
# where repairLine.ServiceObjectId == smaServiceObjectTable.ServiceObjectId
# && repairLine.ConditionId == etk_CoreParameters.CardStatus;
#
# if(repairLine.ResolutionId == etk_CoreParameters.ActivatedResolutionId)
# {
# custTable = CustTable::find( smaServiceObjectTable.etk_custAccount());
#
# beSalesLineExtColl = ETK_BESalesLineExtCollection::construct();
#
# beSalesHeader.parmCustAccount(custTable.AccountNum);
# beSalesHeader.parmDeliveryAddress('');
# beSalesHeader.parmSalesStatus(SalesStatus::None);
# beSalesHeader.parmSalesType(SalesType::Sales);
# beSalesHeader.parmSalesOriginId(#FeedbackCallCenter);
#
# productInfo.parmProductId('EPL-REF');
# productInfo.parmProductInstanceAttributes(fieldescColl);
#
# beSalesLineExt.parmCustAccount(custTable.AccountNum);
# beSalesLineExt.parmCurrencyCode('CAD');
# beSalesLineExt.parmVisibleMediaId(field1);
#
# beSalesLineExt.parmSalesQty(-(any2real(field2)));
# beSalesLineExt.parmSalesProductInfo(productInfo);
# beSalesLineExt.parmSalesPrice(ETK_ProductCatalogBDAL::getSalesPriceByProductId(productInfo.parmProductId()));
# beSalesLineExt.parmValidityStartDate(datetimeutil::utcNow());
# beSalesLineExt.parmValidityEndDate(datetimeutil::addMonths(datetimeutil::utcNow(),1));
#
# beSalesLineExtColl.add(beSalesLineExt);
#
# beSalesOrder.parmSalesLineExtCollection(beSalesLineExtColl);
# beSalesOrder.parmSalesPaymOptions(salesPaym);
# beSalesOrder.parmSalesHeader(beSalesHeader);
# ttsBegin;
#
# salesTableProcess = SalesTable::find(serviceOrder.createSalesOrder(beSalesOrder));
#
# salesTableProcess.selectForUpdate(true);
# salesTableProcess.PurchOrderFormNum = field3;
# salesTableProcess.SalesGroup = '';
# salesTableProcess.doUpdate();
#
# select forupdate salesLineProcess where salesLineProcess.SalesId == salesTableProcess.SalesId;
# salesLineProcess.LedgerDimension = AxdDimensionUtil::getLedgerAccountId([103100, 103100, 0]);
# salesLineProcess.SalesGroup = '';
# salesLineProcess.ETK_SendingDateTime = DateTimeUtil::utcNow();
# salesLineProcess.doUpdate();
#
# letter.update(salesTableProcess,systemDateGet());
#
# // Invoice the EPl-REF sales order
# salesFormLetter::construct(DocumentStatus::Invoice).update(salesTableProcess) ;
#
# salesTableProcess.reread();
# salesTableProcess.selectForUpdate(true);
# salesTableProcess.SalesGroup = 'EP_RefundA';
# salesTableProcess.doUpdate();
#
# salesLineProcess.reread();
# salesLineProcess.selectForUpdate(true);
# salesLineProcess.SalesGroup = 'EP_RefundA';
# salesLineProcess.doUpdate();
#
# ttscommit;
# salesTableProcess.etk_sendElectronically(true, salesLineProcess.LineNum);
#
# //Override ExpirationDate to 2 years in EpurseLoad OutboundStaging table.
# select ExpirationDateTime from outboundStagingEpurseLoad
# where outboundStagingEpurseLoad.SalesId == (salesTableProcess.SalesId + ':' + (strFmt("%1",salesLineProcess.LineNum)));
#
# if(outboundStagingEpurseLoad.ExpirationDateTime)
# {
# ttsBegin;
# outboundStagingEpurseLoad.reread();
# outboundStagingEpurseLoad.selectForUpdate(true);
# outboundStagingEpurseLoad.ExpirationDateTime = DateTimeUtil::addYears(outboundStagingEpurseLoad.SendingDateTime,2);
# outboundStagingEpurseLoad.doUpdate();
# ttsCommit;
# }
#
# // info(strfmt("Sales Order %1 has been created",salesTableProcess.SalesId));
# info (strfmt('%1,%2,%3\n',field1,field2,salesTableProcess.SalesId));
# }
# else
# {
# error (strfmt('%1,%2,%3\n',field1,field2,"Card Expired/Hotlisted/Not Activate"));
# }
# }
# else
# {
# error (strfmt('%1,%2,%3\n',field1,field2,"Invalid Card"));
# }
# }//if end
# // info(strfmt('%1 - %2 - %3 - %4 - %5',field1,field2,field3,field4,field5));
# containFromRead = commaTextIo.read();
# }//while end
# CodeAccessPermission::revertAssert();
#
# datestr = ETK_GlobalFareManagement::dateFormat();
# datestr = strReplace(datestr,'/',' ');
#
# outFileName = strfmt('%1%2_%3_%4%5',
# "D:\\GOEPL\\Output\\",
# "GO_EPL",
# datestr,
# "CMP",
# #csv);
#
# outFilePermission = new FileIOPermission(outFileName,'rw');
# permissionset.add(outFilePermission);
# outFilePermission.assert();
#
# settlementExtractBfr.toFile(outFileName);
# CodeAccessPermission::revertAssert();
# info("Done");
# //enhanced for job logging by sravanthi
# jobinput = strFmt("%1",field1);
# logDescription = strfmt('%1,%2,%3\n',field1,field2,salesTableProcess.SalesId);
# ETK_Global::AOTjobLogging("ETK_EPLREFCreation_ClearingToClearing",jobinput,logDescription);
#
#}
#{
# ProjTable projTable;
# SMAAgreementTable smaAgreementTable;
# SalesTable salesTableProcess,salesTable;
# SalesLine salesLine,salesLineProcess;
# CustTable custTable;
# SMAServiceObjectTable smaServiceObjectTable;
# SalesFormLetter letter = SalesFormLetter::construct(DocumentStatus::Confirmation);
# Exception Exception;
# SMArepairLine repairLine;
# ETK_CoreParameters etk_CoreParameters = ETK_CoreParameters::find();
# ETK_EpurseProcess process = new ETK_EpurseProcess();
# ETK_BESalesHeader beSalesHeader = ETK_BESalesHeader::construct();
# ETK_BESalesProductInfo beSalesProductInfo = ETK_BESalesProductInfo::construct();
# ETK_BESalesLineExtCollection beSalesLineExtColl = ETK_BESalesLineExtCollection::construct();
# ETK_BESalesLineExt beSalesLineExt = ETK_BESalesLineExt::construct();
# ETK_BESalesOrder beSalesOrder = new ETK_BESalesOrder();
# ETK_BESalesPaymOptions beSalesPaymentOptions = ETK_BESalesPaymOptions::construct();
# ETK_ServiceOrder ServiceOrder = ETK_ServiceOrder::construct();
# ETK_BESalesProductInfo productInfo = ETK_BESalesProductInfo::construct();
# ETK_FieldDescriptorCollection fieldescColl = ETK_FieldDescriptorCollection::construct();
# ETK_BESalesPaymOptions salesPaym = ETK_BESalesPaymOptions::construct();
# ETK_OutboundStagingEpurseLoad outboundStagingEpurseLoad;
# ProjProposalId proposalId1 ;
# #File
# TextIo io;
# container salesValue;
# FileIoPermission perm;
# Dialog dlg;
# DialogField dlgPath;
# DialogText ddt;
# TextBuffer textBuffer;
# str textString;
# String255 jobinput;
# String255 logDescription;
# str clearText,shareFilePath,datestr;
# int newLinePos;
# str line,ledgerTvalue;
# str 30 field1,field2,field3,field4,field5;
# counter row;
# CommaTextIo commaTextIo;
# FileIOPermission permission,outFilePermission;
# container containFromRead;
# int x;
# int cols;
# boolean ret;
# #ETK_Macro
# //#define.delimiterSemicolon(';')
# FileName outFileName;
# Set permissionSet = new set(types::Class);
# TextBuffer settlementExtractBfr = new TextBuffer();
# ;
# dlg =new Dialog("Create EPL-REF Order");
# dlgPath =dlg.addField(extendedTypeStr(FilenameOpen),'Enter the path of the Text file with .CSV extension');
# ddt = dlg.addText("**Note: File Format = GSN,amount(positive only), incident/work around/GoEPL/York");// 5/17/2107
# if(!dlg.run())
# {
# return;
# }
# perm = new FileIoPermission(dlgPath.value(), #io_read);
# perm.assert();
# commaTextIo = new CommaTextIO(dlgPath.value(),'R');
#
# containFromRead = commaTextIo.read();
#
# While(containFromRead)
# {
# cols = conLen(containFromRead);
# if(cols>1)
# {
# field1 = conpeek(containFromRead,1); //GSN
# field2 = conpeek(containFromRead,2); //amount
# field3 = conpeek(containFromRead,3); //Go-EPL or York-CoFare
#
# // Create a sales order with EPL-REF item
#
# smaServiceObjectTable = SMAServiceObjectTable::ETK_findByVisibleId(field1,ETK_MediaType::FARECARD,'GnD');
# if(smaServiceObjectTable.RecId)
# {
# select firstonly repairLine
# where repairLine.ServiceObjectId == smaServiceObjectTable.ServiceObjectId
# && repairLine.ConditionId == etk_CoreParameters.CardStatus;
#
# if(repairLine.ResolutionId == etk_CoreParameters.ActivatedResolutionId)
# {
# custTable = CustTable::find( smaServiceObjectTable.etk_custAccount());
#
# beSalesLineExtColl = ETK_BESalesLineExtCollection::construct();
#
# beSalesHeader.parmCustAccount(custTable.AccountNum);
# beSalesHeader.parmDeliveryAddress('');
# beSalesHeader.parmSalesStatus(SalesStatus::None);
# beSalesHeader.parmSalesType(SalesType::Sales);
# beSalesHeader.parmSalesOriginId(#FeedbackCallCenter);
#
# productInfo.parmProductId('EPL-REF');
# productInfo.parmProductInstanceAttributes(fieldescColl);
#
# beSalesLineExt.parmCustAccount(custTable.AccountNum);
# beSalesLineExt.parmCurrencyCode('CAD');
# beSalesLineExt.parmVisibleMediaId(field1);
#
# beSalesLineExt.parmSalesQty(-(any2real(field2)));
# beSalesLineExt.parmSalesProductInfo(productInfo);
# beSalesLineExt.parmSalesPrice(ETK_ProductCatalogBDAL::getSalesPriceByProductId(productInfo.parmProductId()));
# beSalesLineExt.parmValidityStartDate(datetimeutil::utcNow());
# beSalesLineExt.parmValidityEndDate(datetimeutil::addMonths(datetimeutil::utcNow(),1));
#
# beSalesLineExtColl.add(beSalesLineExt);
#
# beSalesOrder.parmSalesLineExtCollection(beSalesLineExtColl);
# beSalesOrder.parmSalesPaymOptions(salesPaym);
# beSalesOrder.parmSalesHeader(beSalesHeader);
# ttsBegin;
#
# salesTableProcess = SalesTable::find(serviceOrder.createSalesOrder(beSalesOrder));
#
# salesTableProcess.selectForUpdate(true);
# salesTableProcess.PurchOrderFormNum = field3;
# salesTableProcess.SalesGroup = '';
# salesTableProcess.doUpdate();
#
# select forupdate salesLineProcess where salesLineProcess.SalesId == salesTableProcess.SalesId;
# salesLineProcess.LedgerDimension = AxdDimensionUtil::getLedgerAccountId([103100, 103100, 0]);
# salesLineProcess.SalesGroup = '';
# salesLineProcess.ETK_SendingDateTime = DateTimeUtil::utcNow();
# salesLineProcess.doUpdate();
#
# letter.update(salesTableProcess,systemDateGet());
#
# // Invoice the EPl-REF sales order
# salesFormLetter::construct(DocumentStatus::Invoice).update(salesTableProcess) ;
#
# salesTableProcess.reread();
# salesTableProcess.selectForUpdate(true);
# salesTableProcess.SalesGroup = 'EP_RefundA';
# salesTableProcess.doUpdate();
#
# salesLineProcess.reread();
# salesLineProcess.selectForUpdate(true);
# salesLineProcess.SalesGroup = 'EP_RefundA';
# salesLineProcess.doUpdate();
#
# ttscommit;
# salesTableProcess.etk_sendElectronically(true, salesLineProcess.LineNum);
#
# //Override ExpirationDate to 2 years in EpurseLoad OutboundStaging table.
# select ExpirationDateTime from outboundStagingEpurseLoad
# where outboundStagingEpurseLoad.SalesId == (salesTableProcess.SalesId + ':' + (strFmt("%1",salesLineProcess.LineNum)));
#
# if(outboundStagingEpurseLoad.ExpirationDateTime)
# {
# ttsBegin;
# outboundStagingEpurseLoad.reread();
# outboundStagingEpurseLoad.selectForUpdate(true);
# outboundStagingEpurseLoad.ExpirationDateTime = DateTimeUtil::addYears(outboundStagingEpurseLoad.SendingDateTime,2);
# outboundStagingEpurseLoad.doUpdate();
# ttsCommit;
# }
#
# // info(strfmt("Sales Order %1 has been created",salesTableProcess.SalesId));
# info (strfmt('%1,%2,%3\n',field1,field2,salesTableProcess.SalesId));
# }
# else
# {
# error (strfmt('%1,%2,%3\n',field1,field2,"Card Expired/Hotlisted/Not Activate"));
# }
# }
# else
# {
# error (strfmt('%1,%2,%3\n',field1,field2,"Invalid Card"));
# }
# }//if end
# // info(strfmt('%1 - %2 - %3 - %4 - %5',field1,field2,field3,field4,field5));
# containFromRead = commaTextIo.read();
# }//while end
# CodeAccessPermission::revertAssert();
#
# datestr = ETK_GlobalFareManagement::dateFormat();
# datestr = strReplace(datestr,'/',' ');
#
# outFileName = strfmt('%1%2_%3_%4%5',
# "D:\\GOEPL\\Output\\",
# "GO_EPL",
# datestr,
# "CMP",
# #csv);
#
# outFilePermission = new FileIOPermission(outFileName,'rw');
# permissionset.add(outFilePermission);
# outFilePermission.assert();
#
# settlementExtractBfr.toFile(outFileName);
# CodeAccessPermission::revertAssert();
# info("Done");
# //enhanced for job logging by sravanthi
# jobinput = strFmt("%1",field1);
# logDescription = strfmt('%1,%2,%3\n',field1,field2,salesTableProcess.SalesId);
# ETK_Global::AOTjobLogging("ETK_EPLREFCreation_ClearingToClearing",jobinput,logDescription);
#
#}
No comments:
Post a Comment