thanks for reply , i have added the controller class to the action menu , still it is showing the error ,please suggest me on this , i have added the controller class to the menu item below is my code
class ChequeDepositController extends SysOperationServiceController
{
public static void main(Args _args)
{
DepositController controller = ChequeDepositController::construct();
controller.parmDialogCaption("Export Cheque Deposits to File");
controller.parmShowDialog(false); // No dialog needed since no contract/input
//controller.parmBatchInfo(new BatchInfo()); // Enable batch support
//controller.parmBatchInfo().parmBatchExecute(true);
controller.parmArgs(_args);
controller.startOperation();
}
public static ChequeDepositController construct(SysOperationExecutionMode _executionMode = SysOperationExecutionMode::Synchronous)
{
ChequeDepositController controller = new ChequeDepositController();
controller.parmExecutionMode(_executionMode);
return controller;
}
public void new()
{
super(classStr(ChequeDepositService),
methodStr(ChequeDepositService, exportPDCToTxt),
SysOperationExecutionMode::Synchronous);
}
}
class ChequeDepositService
{
public void exportPDCToTxt()
{
ISLCustPDCRegister pdcRegister;
LedgerJournalTable journalTable;
LedgerJournalTrans journalTrans;
TextIo file;
FileIOPermission permission;
#File
str filePath, fileName, cid, folderPath;
int lineCounter = 0;
AmountCur totalAmount = 0;
Container lines;
str dataLine, headerLine;
UtcDateTime now = DateTimeUtil::getSystemDateTime();
TimeOfDay currentTime = DateTimeUtil::time(now);
str timestamp;
Date sessionDate;
AmountCur amount;
// Hardcoded or fixed path on AOS (not user machine!)
folderPath = @"C:\Users\Desktop\d365.txt"; // Must exist and be writable by AOS service account
CompanyInfo companyInfo = CompanyInfo::find();
cid = companyInfo.ARCIDNo;
//timestamp = strFmt('%1%2%3%4%5%6',
// strRFix(int2Str(dayOfMth(DateTimeUtil::date(now))), 2, '0'),
// strRFix(int2Str(mthOfYr(DateTimeUtil::date(now))), 2, '0'),
// strRFix(int2Str(year(DateTimeUtil::date(now))), 4, '0'),
// strRFix(int2Str(currentTime.hour), 2, '0'),
// strRFix(int2Str(currentTime.minute), 2, '0'),
// strRFix(int2Str(currentTime.second), 2, '0'));
timestamp = strFmt('%1%2%3%4%5%6',
strRFix(int2Str(dateDay(DateTimeUtil::date(now))), 2, '0'),
strRFix(int2Str(dateMonth(DateTimeUtil::date(now))), 2, '0'),
strRFix(int2Str(dateYear(DateTimeUtil::date(now))), 4, '0'),
strRFix(int2Str(timeHour(DateTimeUtil::time(now))), 2, '0'),
strRFix(int2Str(timeMinute(DateTimeUtil::time(now))), 2, '0'),
strRFix(int2Str(timeSecond(DateTimeUtil::time(now))), 2, '0'));
fileName = strFmt("CCSS_%1_%2.txt", cid, timestamp);
filePath = folderPath + "\\" + fileName;
permission = new FileIOPermission(filePath, #io_write);
permission.assert();
file = new TextIo(filePath, #io_write);
if (!file)
{
throw error("Unable to open file for writing.");
}
file.outFieldDelimiter(',');
sessionDate = DateTimeUtil::getToday(DateTimeUtil::getUserPreferredTimeZone());
while select ChqName_front,
ChqName_back,
CheckNumber,
MICRNumber,
MaturityDate,
PaymentReference
from pdcRegister
where pdcRegister.PDCStatus == ISLPDCStatus::Received
&& pdcRegister.MaturityDate <= sessionDate
join journalTable
where journalTable.JournalNum == pdcRegister.JournalNum
join Txt from journalTrans
where journalTrans.RecId == pdcRegister.LedgerJournalTrans
{
amount = pdcRegister.displayAmount();
lineCounter++;
totalAmount += amount;
dataLine = strFmt('%1,%2,%3,%4,%5,%6,%7,%8,%9',
lineCounter,
pdcRegister.ChqName_front,
pdcRegister.ChqName_back,
pdcRegister.CheckNumber,
pdcRegister.MICRNumber,
date2str(pdcRegister.MaturityDate, 123, 2, 1, 2, 1, 4),
amount,
pdcRegister.PaymentReference,
journalTrans.Txt);
lines += dataLine;
}
file.write("S.No", "CHQNAME_FRONT", "CHQNAME_BACK", "CHECKNUMBER", "MICRNUMBER", "MATURITYDATE", "Amount", "PaymentReference", "Txt");
for (int i = 1; i <= conLen(lines); i++)
{
file.write(conPeek(lines, i));
}
file.write("");
headerLine = strFmt("Total Records: %1, Total Amount: %2", lineCounter, totalAmount);
file.write(headerLine);
CodeAccessPermission::revertAssert();
info(strFmt("Export completed. %1 record(s) written to: %2", lineCounter, filePath));
}
}