static void sendabsenceEmailmail(Payperiod _Payperiod)
{
SysMailer mailer = new SysMailer();
SysEmailParameters parameters = SysEmailParameters::find();
str 500 String;
HRMParameters HRMParameters;
MSCpayperiod mscpayperiod;
;
select * from MSCpayperiod where MSCpayperiod.Payperiod == _Payperiod;
if (parameters.SMTPRelayServerName)
{
mailer.SMTPRelayServer(parameters.SMTPRelayServerName,
parameters.SMTPPortNumber,
parameters.SMTPUserName,
SysEmailParameters::password(),
parameters.NTLM);
}
else
{
mailer.SMTPRelayServer(parameters.SMTPServerIPAddress,
parameters.SMTPPortNumber,
parameters.SMTPUserName,
SysEmailParameters::password(),
parameters.NTLM);
}
mailer.subject(mscpayperiod.Description + " 2013 payroll needs to have approval");
HRMParameters = HRMParameters::find();
mailer.fromAddress(parameters.MSCSMTPEmail);//"somanna@msc-consulting.com.sg");
mailer.ccs().appendAddress(Parameters.MSCSMTPEmail);
//mailer.ccs().appendAddress(HRMParameters.AccountEmail);
//mailer.ccs().appendAddress(CCemail);
mailer.tos().appendAddress(HRMParameters.MSCHRMCIO);
String = "Approved payroll ";
mailer.htmlBody(String);
mailer.attachments().add("c:\\mscpayroll\\SR_paysReport.pdf");
if(HRMParameters.MSCHRMCIO == "")
{
info(strFmt("Email can't be sent as Email Address for the CIO is not set in HRM parameters"));
}
else
{
mailer.sendMail();
info(strFmt("Email is sent to CIO -> %1",HRMParameters.MSCHRMCIO));
}
}
...............................................................................................................................................................
static void SR_SaveReportToPDFFromController(Payperiod _payperiod)
{
MSCpayrollApprovalController MSCpayrollApprovalController;
mscPayrollApprovalContract mscPayrollApprovalContract;
Args args = new Args();
SrsReportRunImpl srsReportRun;
CustInvoiceJour custInvoiceJour;
ReportName reportName = "mscpayrollApprove.AutoDesign";
;
select firstOnly custInvoiceJour;
args.record(custInvoiceJour);
MSCpayrollApprovalController = new MSCpayrollApprovalController();
MSCpayrollApprovalController.parmReportName(reportName);
mscPayrollApprovalContract = MSCpayrollApprovalController.parmReportContract().parmRdpContract();
mscPayrollApprovalContract.parmPayPeriod(_payperiod);
//mscPayrollApprovalContract.parmHcmWorkerRecId(5637144576);
srsReportRun = MSCpayrollApprovalController.parmReportRun() as SrsReportRunImpl;
MSCpayrollApprovalController.parmReportRun(srsReportRun);
MSCpayrollApprovalController.parmReportContract().parmPrintSettings().printMediumType(SRSPrintMediumType::File);
MSCpayrollApprovalController.parmReportContract().parmPrintSettings().overwriteFile(true);
MSCpayrollApprovalController.parmReportContract().parmPrintSettings().fileFormat(SRSReportFileFormat::PDF);
MSCpayrollApprovalController.parmReportContract().parmPrintSettings().fileName("c:\\mscpayroll\\SR_paysReport.pdf");
MSCpayrollApprovalController.runReport();
}
...................................................................................................................................................................
{
SysMailer mailer = new SysMailer();
SysEmailParameters parameters = SysEmailParameters::find();
str 500 String;
HRMParameters HRMParameters;
MSCpayperiod mscpayperiod;
;
select * from MSCpayperiod where MSCpayperiod.Payperiod == _Payperiod;
if (parameters.SMTPRelayServerName)
{
mailer.SMTPRelayServer(parameters.SMTPRelayServerName,
parameters.SMTPPortNumber,
parameters.SMTPUserName,
SysEmailParameters::password(),
parameters.NTLM);
}
else
{
mailer.SMTPRelayServer(parameters.SMTPServerIPAddress,
parameters.SMTPPortNumber,
parameters.SMTPUserName,
SysEmailParameters::password(),
parameters.NTLM);
}
mailer.subject(mscpayperiod.Description + " 2013 payroll needs to have approval");
HRMParameters = HRMParameters::find();
mailer.fromAddress(parameters.MSCSMTPEmail);//"somanna@msc-consulting.com.sg");
mailer.ccs().appendAddress(Parameters.MSCSMTPEmail);
//mailer.ccs().appendAddress(HRMParameters.AccountEmail);
//mailer.ccs().appendAddress(CCemail);
mailer.tos().appendAddress(HRMParameters.MSCHRMCIO);
String = "Approved payroll ";
mailer.htmlBody(String);
mailer.attachments().add("c:\\mscpayroll\\SR_paysReport.pdf");
if(HRMParameters.MSCHRMCIO == "")
{
info(strFmt("Email can't be sent as Email Address for the CIO is not set in HRM parameters"));
}
else
{
mailer.sendMail();
info(strFmt("Email is sent to CIO -> %1",HRMParameters.MSCHRMCIO));
}
}
...............................................................................................................................................................
static void SR_SaveReportToPDFFromController(Payperiod _payperiod)
{
MSCpayrollApprovalController MSCpayrollApprovalController;
mscPayrollApprovalContract mscPayrollApprovalContract;
Args args = new Args();
SrsReportRunImpl srsReportRun;
CustInvoiceJour custInvoiceJour;
ReportName reportName = "mscpayrollApprove.AutoDesign";
;
select firstOnly custInvoiceJour;
args.record(custInvoiceJour);
MSCpayrollApprovalController = new MSCpayrollApprovalController();
MSCpayrollApprovalController.parmReportName(reportName);
mscPayrollApprovalContract = MSCpayrollApprovalController.parmReportContract().parmRdpContract();
mscPayrollApprovalContract.parmPayPeriod(_payperiod);
//mscPayrollApprovalContract.parmHcmWorkerRecId(5637144576);
srsReportRun = MSCpayrollApprovalController.parmReportRun() as SrsReportRunImpl;
MSCpayrollApprovalController.parmReportRun(srsReportRun);
MSCpayrollApprovalController.parmReportContract().parmPrintSettings().printMediumType(SRSPrintMediumType::File);
MSCpayrollApprovalController.parmReportContract().parmPrintSettings().overwriteFile(true);
MSCpayrollApprovalController.parmReportContract().parmPrintSettings().fileFormat(SRSReportFileFormat::PDF);
MSCpayrollApprovalController.parmReportContract().parmPrintSettings().fileName("c:\\mscpayroll\\SR_paysReport.pdf");
MSCpayrollApprovalController.runReport();
}
...................................................................................................................................................................
No comments:
Post a Comment