Hi,
Let me know if understanding is correct.
You will provide two options to the user with cash and credit.
Based on the user input you either store the text as cash or credit and proceed further with your later process. If so, please update your code as following.
void clicked()
{
SalesFormLetter_Invoice _invoice;
SalesFormletter SalesFormletter;
SalesTable _SalesTable;
CustInvoiceJour custInvoiceJour;
HCSSalesInvoiceController controller;
HCSSalesInvoiceContract contract;
Args args;
Dialog dlg = new Dialog();
DialogGroup dlgGroup;
str inputvalue; // declare this variable
formBuildCommandButtonControl cancelButton, okButton;
dlg.addText("How would you like to do the payment?");
cancelButton = dlg.dialogForm().buildDesign().control('CancelButton');
okButton = dlg.dialogForm().buildDesign().control('okButton');
okButton.text("Cash");
cancelButton.text("Card");
;
if(dlg.run()) // Run method gets called on clicking Ok button, in our case its cash.
{
inputValue = "Cash";
}
else
{
inputValue = "Credit";
}
SalesTable = SalesTable::find(SalesTable.SalesId);
_invoice = SalesFormLetter::construct(DocumentStatus::Invoice);
custInvoiceJour.Field= inputValue; // Capturing dialog text
// Post the invoice of SO
_invoice.update(_SalesTable, SystemDateGet(), SalesUpdate::All,AccountOrder::None, false, false);
// Print the report
select firstOnly custInvoiceJour where custInvoiceJour.SalesId == SalesTable.SalesId;
args = new args();
args.record(custInvoiceJour);
controller = new HCSSalesInvoiceController();
contract = new HCSSalesInvoiceContract();
controller.parmArgs(args);
controller.parmReportName(ssrsReportStr(HCSSalesInvoiceReport, MIReport));
controller.prePromptModifyContract();
controller.parmShowDialog(false);
contract.parmRecId(custInvoiceJour.RecId);
controller.parmReportContract().parmRdpContract(contract);
controller.startOperation();
}
}
Hope this helps you.
Thanks,
Chaitanya Golla