Bank cheque report customization in D365
Customize bank cheque payment report in D365
Lets say, we need to add a column Description in SlipText field on the report that is generated dynamically from code. In order to customize the field we need to make COC of few methods of class CustVendChequeSlipTextCalculator.
class CustVendChequeSlipTextCalculator is responsible for calculating slip text area required during printing of cheque and adding dynamic columns and values in the field.
Note: Cheque layout is sensitive to the area of printing. We need to be careful in order to modify a design while customizing as each and every field added to the report contains limited area of printing which is a risk to disturb as it can effect the size and length of report. Slip text is also calculated according to the size of the cheque in millimeters.
We need to create COC of following methods to add a new column in SlipText field.
We have to add header and then value.
Before creating COC for SlipText we need to first add Description field in table BankChequePaymTrans.
Note: We need to create extension of the table and add Description field in BankChequePaymTrans.
After that we need to create a COC of method InitBankChequePaymentTransFromVendTrans of class CustVendCheque to fill description field as this field has to be populated from ledger transaction of vendor payment.
[ExtensionOf(classStr(CustVendCheque))]
internal final class CustVendCheque_Extension
{
Protected BankChequePaymTrans
initBankChequePaymentTransFromVendTrans
(SpecTrans _specTrans, CustVendPaym _custVendPaym, AmountCur
_paymAmount)
BankChequePaymTrans bankChequePaymTrans;
bankChequePaymTrans.Description =
}
Now we need to use this description field of BankChequePaymTrans in SlipText value.
1) For Header column we need to create COC of method determineSlipTextTitleAndEndLinesAdjustmentForColumnHeaders.
[ExtensionOf(classStr(CustVendChequeSlipTextCalculator))]
internal final class CustVendChequeSlipTextCalculator_Extension
{
ChequeSlipTxt chequeSlipText;
Counter endLines;
switch (_chequeFormType)
{
case ChequeFormType::USStyle:
chequeSlipText = strFmt(
'\n\n\n%1 %2 %3 %4 %5\n\n',
"@SYS14204", "@SYS80056", "@SYS41042",
endLines = -2;
break;
}
return [chequeSlipText, endLines];
}
2) Now adding column value in slip text. We need to create COC of method determinSlipTextAndEndLinesAdjustmentForBankChequePaymTrans.
{
ChequeSlipTxt chequeSlipText;
Counter endLines;
FromDate invoiceDate = bankChequePaymTrans.InvoiceDate;
chequeSlipText = strFmt(
'%1 %2 %3 %4 %5\n',
strLFix(bankChequePaymTrans.InvoiceId, 12),
strLFix(date2StrUsr(invoiceDate), 10),
strLFix(bankChequePaymTrans.Description, 36),
strRFix(num2str(-
endLines = -1;
return [chequeSlipText, endLines];
}
Also, if we need to move a value we can use strLFix and strRFix.
strLFix moves value from left side
strRFix moves value from right side
I need to move total amount of SlipText to a bit of right side to adjust accordingly, so we need to create another COC of method determineSlipTextTitleAndEndLinesForSubTotalOrTotal of same class above,
that is responsible for adjusting total amount of slipText.
Note: I changed strLFix(_args.chequeSlipTxtLabel, 66) to trLFix(_args.chequeSlipTxtLabel, 75) in below method.
Comments
Post a Comment