Mail_notification:
import PT_MCF_MAIL:*;
class Mail_Notification
method send_email(&bu As
string, &Invoice As string, &transactionid As string, &status As
string) Returns boolean;
method send_email_py(&bu As
string, &item As string, &transactionid As string, &status As
string) Returns boolean;
end-class;
method send_email_py
/+ &bu as String, +/
/+ &item as String, +/
/+ &transactionid as String,
+/
/+ &status as String +/
/+ Returns Boolean +/
Local
PT_MCF_MAIL:MCFOutboundEmail &email = create
PT_MCF_MAIL:MCFOutboundEmail();
&email.From =
"gerphelpdesk@ntt.com";
Local string &email_rec;
SQLExec(" SELECT STRING_TEXT
FROM PS_STRINGS_TBL WHERE PROGRAM_ID = 'NTT_INTF' AND STRING_ID =
'EMAILID'", &email_rec);
&email.Recipients =
&email_rec;
Local string &plain_text;
&email.Subject =
"Payment Integration Notification From GERP Application";
If &status = "E"
Then
&plain_text = "The
Item " | &item | " with Transaction ID " |
&transactionid | " has been marked as " | &status | ".
Kindly Check the Item and make a suitable action";
End-If;
If &status = "X"
Then
&plain_text =
"Following Item's " | &item | " has been marked as " |
&status | ". Kindly Check the Item's and make a suitable action";
End-If;
rem Local PT_MCF_MAIL:MCFBodyPart
&text = create PT_MCF_MAIL:MCFBodyPart();
&email.Text = &plain_text;
Local integer &resp =
&email.Send();
Local boolean &done;
Evaluate &resp
When %ObEmail_Delivered
/* every thing ok */
&done = True;
Return &done;
Break;
When %ObEmail_NotDelivered
/*-- Check
&email.InvalidAddresses, &email.ValidSentAddresses
and &email.ValidUnsentAddresses */
&done = False;
Return &done;
Break;
When %ObEmail_PartiallyDelivered
/* Check
&email.InvalidAddresses, &email.ValidSentAddresses
and &email.ValidUnsentAddresses; */
&done = True;
Return &done;
Break;
When %ObEmail_FailedBeforeSending
/* Get the Message Set Number,
message number;
Or just get the formatted messages from &email.ErrorDescription,
&email.ErrorDetails;*/
&done = False;
Return &done;
Break;
End-Evaluate;
end-method;
method send_email
/+ &bu as String, +/
/+ &Invoice as String, +/
/+ &transactionid as String,
+/
/+ &status as String +/
/+ Returns Boolean +/
Local
PT_MCF_MAIL:MCFOutboundEmail &email = create
PT_MCF_MAIL:MCFOutboundEmail();
&email.From =
"gerphelpdesk@ntt.com";
Local string &email_rec;
SQLExec(" SELECT STRING_TEXT
FROM PS_STRINGS_TBL WHERE PROGRAM_ID = 'NTT_INTF' AND STRING_ID =
'EMAILID'", &email_rec);
&email.Recipients =
&email_rec;
Local string &plain_text;
&email.Subject =
"Billing Integration Notification From GERP Application";
If &status = "E"
Then
&plain_text = "The
Invoice " | &Invoice | " with Transaction ID " |
&transactionid | " has been marked as " | &status | ".
Kindly Check the Invoice and make a suitable action";
End-If;
If &status = "X"
Then
&plain_text =
"Following Invoice's " | &Invoice | " has been marked as
" | &status | ". Kindly Check the Invoice's and make a suitable
action";
End-If;
&email.Text =
&plain_text;
Local integer &resp =
&email.Send();
Local boolean &done;
Evaluate &resp
When %ObEmail_Delivered
/* every thing ok */
&done = True;
Return &done;
Break;
When %ObEmail_NotDelivered
/*-- Check
&email.InvalidAddresses, &email.ValidSentAddresses
and &email.ValidUnsentAddresses */
&done = False;
Return &done;
Break;
When %ObEmail_PartiallyDelivered
/* Check
&email.InvalidAddresses, &email.ValidSentAddresses
and &email.ValidUnsentAddresses; */
&done = True;
Return &done;
Break;
When %ObEmail_FailedBeforeSending
/* Get the Message Set Number,
message number;
Or just get the formatted messages from &email.ErrorDescription,
&email.ErrorDetails;*/
&done = False;
Return &done;
Break;
End-Evaluate;
end-method;
RESP_HANDLER:
import PS_PT:Integration:IRequestHandler;
class RESP_HANDLER implements PS_PT:Integration:IRequestHandler
method onRequest(&MSG As
Message) Returns Message;
end-class;
method onRequest
/+ &MSG as Message +/
/+ Returns Message +/
/+ Extends/implements
PS_PT:Integration:IRequestHandler.OnRequest +/
Local XmlDoc
&xmlDocFromPython;
Local XmlNode
&requestRootNode, &rootnode;
&xmlDocFromPython =
&MSG.GetXmlDoc();
&requestRootNode =
&xmlDocFromPython.DocumentElement;
/* Setup response xml body */
Local Message &response;
&response =
CreateMessage(Operation.NTT_BI_INTFC, %IntBroker_Response);
Local XmlDoc &xmldoc;
Local XmlNode &childNode;
&xmldoc =
CreateXmlDoc("<?xml version='1.0'?><ResponseMessage/>");
&rootnode =
&xmldoc.DocumentElement.AddElement("SYNC1_RESP");
&childNode =
&rootnode.AddElement("NAME");
Evaluate
(&requestRootNode.NodeName)
When = "SYNC1"
&childNode =
&rootnode.AddElement("Person").AddText(&MSG.TransactionId);
Break;
When-Other
&childNode =
&rootnode.AddElement("SEND_NEXT_FLAG").AddText("Y");
Break;
End-Evaluate;
&response.SetXmlDoc(&xmldoc);
Return &response;
end-method;
Resp_handler_py:
import PS_PT:Integration:IRequestHandler;
class REsp_HANDLER_PY implements PS_PT:Integration:IRequestHandler
method onRequest(&MSG As
Message) Returns Message;
end-class;
method onRequest
/+ &MSG as Message +/
/+ Returns Message +/
/+ Extends/implements
PS_PT:Integration:IRequestHandler.OnRequest +/
Local XmlDoc
&xmlDocFromPython;
Local XmlNode
&requestRootNode, &rootnode;
&xmlDocFromPython =
&MSG.GetXmlDoc();
&requestRootNode =
&xmlDocFromPython.DocumentElement;
/* Setup response xml body */
Local Message &response;
&response =
CreateMessage(Operation.NTT_PY_INTFC, %IntBroker_Response);
Local XmlDoc &xmldoc;
Local XmlNode &childNode;
rem &xmlrespdata =
"<?xml version='1.0'?><ResponseMessage/>";
&xmldoc =
CreateXmlDoc("<?xml version='1.0'?><ResponseMessage/>");
rem &xmlout =
CreateXmlDoc("<?xml version='1.0'?><SYNC1_RESP>");
&rootnode =
&xmldoc.DocumentElement.AddElement("SYNC1_RESP");
&childNode =
&rootnode.AddElement("NAME");
Evaluate
(&requestRootNode.NodeName)
When = "SYNC1"
&childNode =
&rootnode.AddElement("Person").AddText(&MSG.TransactionId);
Break;
When-Other
&childNode = &rootnode.AddElement("SEND_NEXT_FLAG").AddText("Y");
Break;
End-Evaluate;
&response.SetXmlDoc(&xmldoc);
Return &response;
end-method;
Rec_insert:
/****************************** Billing and Payment Interface Program
**************************/
class Rec_Insert
method insert_trigger(&rec As
Record, &PRCSINSTANCE As number, &retry As number, &trn_dtl As
string) Returns Message;
end-class;
method insert_trigger
/+ &rec as Record, +/
/+ &PRCSINSTANCE as Number,
+/
/+ &retry as Number, +/
/+ &trn_dtl as String +/
/+ Returns Message +/
/*
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
Local Record &recTgt =
CreateRecord(Record.NTT_BI_INTFC);
Local string &transactionid;
Local XmlNode &rootNode,
&childNode2, &childNode2line, &childNode22line;
Local XmlNode &tt, &yy,
&qq;
Local XmlDoc &inXMLDoc;
Local number &i;
Local SQL &sqlline;
Local Record &recline;
Local Message &MSG;
Local string &string;
&recline =
CreateRecord(Record.BI_LINE);
&recTgt.BUSINESS_UNIT.Value =
&rec.BUSINESS_UNIT.Value;
&recTgt.INVOICE.Value =
&rec.INVOICE.Value;
&recTgt.EDI_SENT_FLG.Value =
"W";
&transactionid =
&rec.BUSINESS_UNIT.Value | &rec.BILL_TO_CUST_ID.Value |
&rec.INVOICE.Value;
&recTgt.TRANSACTION_DTL.Value
= &transactionid;
rem DoSaveNow();
&recTgt.PRCSINSTANCE.Value =
&PRCSINSTANCE;
&recTgt.RETRYCOUNT.Value =
&retry;
If (&trn_dtl = " "
Or
&trn_dtl =
"") Then
&recTgt.Insert();
Else
&recTgt.Update();
End-If;
&inXMLDoc =
CreateXmlDoc("");
&rootNode =
&inXMLDoc.CreateDocumentElement(&rec.Name);
&childNode2 =
&rootNode.AddElement("XML_TXN_ID");
&tt =
&childNode2.AddText(&transactionid);
For &i = 1 To
&rec.FieldCount
&childNode2 =
&rootNode.AddElement((&rec.GetField(&i).Name));
Evaluate
(&rec.GetField(&i).Type)
When "DATE"
&string =
DateTimeToLocalizedString(&rec.GetField(&i).Value,
"dd/MM/yyyy");
&qq =
&childNode2.AddText(&string);
When "DATETIME"
&string =
DateTimeToLocalizedString(&rec.GetField(&i).Value, "dd/MM/yyyy
hh:mm aaa");
&qq =
&childNode2.AddText(&string);
When-Other
&qq =
&childNode2.AddText(&rec.GetField(&i).Value);
End-Evaluate;
End-For;
Local SQL &sqlnote;
Local string &stringnote;
Local Record &recnote =
CreateRecord(Record.BI_HDR_NOTE);
Local XmlNode
&childNode2linenote, &childNode22linenote, &yy_note;
&sqlnote =
CreateSQL("%Selectall(BI_HDR_NOTE) where business_unit = :1 and invoice = :2 order by notes_seq_num",
&rec.BUSINESS_UNIT.Value, &rec.INVOICE.Value);
While
&sqlnote.Fetch(&recnote)
&childNode2linenote =
&rootNode.AddElement((&recnote.Name));
For &i = 1 To
&recnote.FieldCount
&childNode22linenote =
&childNode2linenote.AddElement((&recnote.GetField(&i).Name));
Evaluate
(&recnote.GetField(&i).Type)
When "DATE"
&stringnote =
DateTimeToLocalizedString(&recnote.GetField(&i).Value,
"dd/MM/yyyy");
&yy_note =
&childNode22linenote.AddText(&stringnote);
When "DATETIME"
&stringnote =
DateTimeToLocalizedString(&recnote.GetField(&i).Value, "dd/MM/yyyy
hh:mm aaa");
&yy_note =
&childNode22linenote.AddText(&stringnote);
When-Other
&yy_note =
&childNode22linenote.AddText(&recnote.GetField(&i).Value);
End-Evaluate;
End-For;
End-While;
&sqlline =
CreateSQL("%Selectall(BI_LINE) where business_unit = :1 and invoice = :2 order by line_seq_num",
&rec.BUSINESS_UNIT.Value, &rec.INVOICE.Value);
While
&sqlline.Fetch(&recline)
&childNode2line =
&rootNode.AddElement((&recline.Name));
For &i = 1 To
&recline.FieldCount
&childNode22line =
&childNode2line.AddElement((&recline.GetField(&i).Name));
Evaluate
(&recline.GetField(&i).Type)
When "DATE"
&string =
DateTimeToLocalizedString(&recline.GetField(&i).Value,
"dd/MM/yyyy");
&yy =
&childNode22line.AddText(&string);
When "DATETIME"
&string =
DateTimeToLocalizedString(&recline.GetField(&i).Value, "dd/MM/yyyy
hh:mm aaa");
&yy =
&childNode22line.AddText(&string);
When-Other
&yy =
&childNode22line.AddText(&recline.GetField(&i).Value);
End-Evaluate;
End-For;
Local SQL &sqllinenote;
Local string
&stringlinenote;
Local Record &reclinenote
= CreateRecord(Record.BI_LINE_NOTE);
Local XmlNode
&Billlinenote, &Billline22note, &yy_linenote;
&sqllinenote = CreateSQL("%Selectall(BI_LINE_NOTE)
where business_unit = :1 and invoice =
:2 and line_seq_num = :3 order by notes_seq_num",
&rec.BUSINESS_UNIT.Value, &rec.INVOICE.Value,
&recline.LINE_SEQ_NUM.Value);
While
&sqllinenote.Fetch(&reclinenote)
&Billlinenote =
&childNode2line.AddElement((&reclinenote.Name));
For &i = 1 To
&reclinenote.FieldCount
&Billline22note =
&Billlinenote.AddElement((&reclinenote.GetField(&i).Name));
Evaluate
(&reclinenote.GetField(&i).Type)
When "DATE"
&stringlinenote =
DateTimeToLocalizedString(&reclinenote.GetField(&i).Value,
"dd/MM/yyyy");
&yy_linenote =
&Billline22note.AddText(&stringlinenote);
When
"DATETIME"
&stringlinenote =
DateTimeToLocalizedString(&reclinenote.GetField(&i).Value,
"dd/MM/yyyy hh:mm aaa");
&yy_linenote =
&Billline22note.AddText(&stringlinenote);
When-Other
&yy_linenote =
&Billline22note.AddText(&reclinenote.GetField(&i).Value);
End-Evaluate;
End-For;
End-While;
End-While;
&MSG =
CreateMessage(Operation.NTT_BI_INTFC);
&MSG.SetXmlDoc(&inXMLDoc);
Return &MSG;
end-method;
rec_insert_py:
class Rec_Insert_Py
method insert_trigger(&rec_py
As Record, &PRCSINSTANCE As number, &retry As number, &minimum As
number, &maximum As number) Returns Message;
method
get_transactionid(&rec_py_trns As Record) Returns string;
end-class;
method get_transactionid
/+ &rec_py_trns as Record +/
/+ Returns String +/
Local string &minimum_tr,
&maximum_tr, &transactionid;
SQLExec("select
min(item_seq_num),max(item_seq_num) from ps_item_activity where (business_unit ,cust_id,item,item_seq_num )
not in (select business_unit
,cust_id,item,item_seq_num from
ps_ntt_py_intfc where edi_sent_flg in
('X','E')) and business_unit = :1
and ITEM = :2 order by
item_seq_num", &rec_py_trns.BUSINESS_UNIT.Value,
&rec_py_trns.ITEM.Value, &minimum_tr, &maximum_tr);
&transactionid =
&rec_py_trns.BUSINESS_UNIT.Value | &rec_py_trns.CUST_ID.Value |
&rec_py_trns.ITEM.Value | &minimum_tr | &maximum_tr;
Return &transactionid;
end-method;
method insert_trigger
/+ &rec_py as Record, +/
/+ &PRCSINSTANCE as Number,
+/
/+ &retry as Number, +/
/+ &minimum as Number, +/
/+ &maximum as Number +/
/+ Returns Message +/
/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
*/
Local Record &recTgt =
CreateRecord(Record.NTT_PY_INTFC);
Local string &transactionid;
Local XmlNode &rootNode,
&childNode2, &childNode2line, &childNode22line;
Local XmlNode &tt, &yy,
&qq;
Local XmlDoc &inXMLDoc;
Local number &i;
Local SQL &sqlline,
&sqlline_py;
Local Record &recline_py;
Local Message &MSG;
Local string &string;
&sqlline_py =
CreateSQL("%Selectall(ITEM_ACTIVITY) where business_unit = :1 and ITEM = :2 and cust_id between :3 and :4
", &rec_py.BUSINESS_UNIT.Value, &rec_py.ITEM.Value, &minimum,
&maximum);
&recline_py =
CreateRecord(Record.ITEM_ACTIVITY);
While
&sqlline_py.Fetch(&recline_py)
&recTgt.BUSINESS_UNIT.Value = &recline_py.BUSINESS_UNIT.Value;
&recTgt.ITEM.Value =
&recline_py.ITEM.Value;
&recTgt.EDI_SENT_FLG.Value
= "W";
&transactionid =
&recline_py.BUSINESS_UNIT.Value | &recline_py.CUST_ID.Value |
&recline_py.ITEM.Value | &minimum | &maximum;
&recTgt.TRANSACTION_DTL.Value = &transactionid;
&recTgt.DATETIME_SENT.Value = %Datetime;
&recTgt.PRCSINSTANCE.Value
= &PRCSINSTANCE;
&recTgt.RETRYCOUNT.Value =
&retry;
&recTgt.CUST_ID.Value =
&recline_py.CUST_ID.Value;
&recTgt.ITEM_SEQ_NUM.Value
= &recline_py.ITEM_SEQ_NUM.Value;
&recTgt.ITEM_LINE.Value =
&recline_py.ITEM_LINE.Value;
&recTgt.MINIMUM.Value =
&minimum;
&recTgt.MAXIMUM.Value =
&maximum;
&recTgt.Insert();
End-While;
&transactionid =
&rec_py.BUSINESS_UNIT.Value | &rec_py.CUST_ID.Value |
&rec_py.ITEM.Value | &minimum | &maximum;
&inXMLDoc =
CreateXmlDoc("");
&rootNode =
&inXMLDoc.CreateDocumentElement("PAYMENT");
&childNode2 =
&rootNode.AddElement("XML_TXN_ID");
&tt =
&childNode2.AddText(&transactionid);
&childNode2 =
&rootNode.AddElement("ITEM_EXIST_FLG");
If &minimum = 1 Then
&tt =
&childNode2.AddText("INSERT");
Else
&tt = &childNode2.AddText("UPDATE");
End-If;
Local Record &rechdr;
&rechdr =
CreateRecord(Record.ITEM);
&rechdr.BUSINESS_UNIT.Value =
&rec_py.BUSINESS_UNIT.Value;
&rechdr.ITEM.Value =
&rec_py.ITEM.Value;
&rechdr.CUST_ID.Value =
&rec_py.CUST_ID.Value;
&rechdr.ITEM_LINE.Value = 0;
&rechdr.SelectByKey();
For &i = 1 To
&rechdr.FieldCount
&childNode2 =
&rootNode.AddElement((&rechdr.GetField(&i).Name));
Evaluate
(&rechdr.GetField(&i).Type)
When "DATE"
&string =
DateTimeToLocalizedString(&rechdr.GetField(&i).Value,
"dd/MM/yyyy");
&qq =
&childNode2.AddText(&string);
When "DATETIME"
&string =
DateTimeToLocalizedString(&rechdr.GetField(&i).Value, "dd/MM/yyyy
hh:mm aaa");
&qq =
&childNode2.AddText(&string);
When-Other
&qq =
&childNode2.AddText(&rechdr.GetField(&i).Value);
End-Evaluate;
End-For;
&sqlline =
CreateSQL("%Selectall(ITEM_ACTIVITY) where business_unit = :1 and cust_id = :2 and
ITEM = :3 and item_seq_num between :4 and :5 order by
business_unit,cust_id,item,item_seq_num", &rec_py.BUSINESS_UNIT.Value,
&rec_py.CUST_ID.Value, &rec_py.ITEM.Value, &minimum, &maximum);
Local Record &recline =
CreateRecord(Record.ITEM_ACTIVITY);
While
&sqlline.Fetch(&recline)
&recTgt.BUSINESS_UNIT.Value = &recline.BUSINESS_UNIT.Value;
&recTgt.ITEM.Value =
&recline.ITEM.Value;
&recTgt.EDI_SENT_FLG.Value
= "W";
&transactionid =
&recline.BUSINESS_UNIT.Value | &recline.CUST_ID.Value |
&recline.ITEM.Value | &minimum | &maximum;
&recTgt.TRANSACTION_DTL.Value = &transactionid;
&recTgt.DATETIME_SENT.Value = %Datetime;
&recTgt.PRCSINSTANCE.Value
= &PRCSINSTANCE;
&recTgt.RETRYCOUNT.Value =
&retry;
&recTgt.CUST_ID.Value =
&recline.CUST_ID.Value;
&recTgt.ITEM_SEQ_NUM.Value
= &recline.ITEM_SEQ_NUM.Value;
&recTgt.ITEM_LINE.Value =
&recline.ITEM_LINE.Value;
&recTgt.MINIMUM.Value =
&minimum;
&recTgt.MAXIMUM.Value =
&maximum;
&recTgt.Insert();
&childNode2line =
&rootNode.AddElement(("PAYMENT_ACTIVITY"));
For &i = 1 To
&recline_py.FieldCount
&childNode22line =
&childNode2line.AddElement((&recline.GetField(&i).Name));
Evaluate
(&recline_py.GetField(&i).Type)
When "DATE"
&string =
DateTimeToLocalizedString(&recline.GetField(&i).Value,
"dd/MM/yyyy");
&yy =
&childNode22line.AddText(&string);
When "DATETIME"
&string =
DateTimeToLocalizedString(&recline.GetField(&i).Value, "dd/MM/yyyy
hh:mm aaa");
&yy =
&childNode22line.AddText(&string);
When-Other
&yy =
&childNode22line.AddText(&recline.GetField(&i).Value);
End-Evaluate;
End-For;
End-While;
&MSG =
CreateMessage(Operation.NTT_PY_INTFC);
&MSG.SetXmlDoc(&inXMLDoc);
Return &MSG;
end-method;
rec_upd_onl_py:
class Rec_Upd_Py_Onl
method
Update_Trigger_Onl_Py(&rec_py As Record, &recline_min_item_seq As
integer, &recline_max_item_seq As integer, &PRCSINSTANCE As integer)
Returns Message;
end-class;
method Update_Trigger_Onl_Py
/+ &rec_py as Record, +/
/+ &recline_min_item_seq as
Integer, +/
/+ &recline_max_item_seq as
Integer, +/
/+ &PRCSINSTANCE as Integer
+/
/+ Returns Message +/
Local Record &recTgt =
CreateRecord(Record.NTT_PY_INTFC);
Local integer &uu, &i;
Local string &transactionid;
Local XmlNode &rootNode,
&childNode2, &childNode2line, &childNode22line;
Local XmlNode &tt, &yy,
&qq;
Local XmlDoc &inXMLDoc;
Local Message &MSG;
Local Record &rec_activity;
&transactionid =
&rec_py.BUSINESS_UNIT.Value | &rec_py.CUST_ID.Value |
&rec_py.ITEM.Value | &recline_min_item_seq | &recline_max_item_seq;
&inXMLDoc =
CreateXmlDoc("");
&rootNode =
&inXMLDoc.CreateDocumentElement("PAYMENT");
&childNode2 = &rootNode.AddElement("XML_TXN_ID");
&tt =
&childNode2.AddText(&transactionid);
&childNode2 =
&rootNode.AddElement("ITEM_EXIST_FLG");
If &recline_min_item_seq = 1
Then
&tt =
&childNode2.AddText("INSERT");
Else
&tt =
&childNode2.AddText("UPDATE");
End-If;
Local Record &rechdr;
&rechdr =
CreateRecord(Record.ITEM);
&rechdr.BUSINESS_UNIT.Value =
&rec_py.BUSINESS_UNIT.Value;
&rechdr.ITEM.Value =
&rec_py.ITEM.Value;
&rechdr.CUST_ID.Value =
&rec_py.CUST_ID.Value;
&rechdr.ITEM_LINE.Value = 0;
&rechdr.SelectByKey();
Local string &string;
For &i = 1 To
&rechdr.FieldCount
&childNode2 =
&rootNode.AddElement((&rechdr.GetField(&i).Name));
Evaluate
(&rechdr.GetField(&i).Type)
When "DATE"
&string = DateTimeToLocalizedString(&rechdr.GetField(&i).Value,
"dd/MM/yyyy");
&qq =
&childNode2.AddText(&string);
When "DATETIME"
&string =
DateTimeToLocalizedString(&rechdr.GetField(&i).Value, "dd/MM/yyyy
hh:mm aaa");
&qq =
&childNode2.AddText(&string);
When-Other
&qq =
&childNode2.AddText(&rechdr.GetField(&i).Value);
End-Evaluate;
End-For;
Local Record &rec_pyline =
CreateRecord(Record.ITEM_ACTIVITY);
Local SQL &sqlline;
&sqlline =
CreateSQL("%Selectall(ITEM_ACTIVITY) where business_unit = :1 and ITEM = :2 and cust_id = :3 and item_seq_num
between :4 and :5 ", &rec_py.BUSINESS_UNIT.Value,
&rec_py.ITEM.Value, &rec_py.CUST_ID.Value, &recline_min_item_seq,
&recline_max_item_seq);
While
&sqlline.Fetch(&rec_pyline)
&childNode2line =
&rootNode.AddElement("PAYMENT_ACTIVITY");
For &i = 1 To
&rec_pyline.FieldCount
&childNode22line =
&childNode2line.AddElement((&rec_pyline.GetField(&i).Name));
Evaluate
(&rec_pyline.GetField(&i).Type)
When "DATE"
&string =
DateTimeToLocalizedString(&rec_pyline.GetField(&i).Value,
"dd/MM/yyyy");
&yy =
&childNode22line.AddText(&string);
When "DATETIME"
&string =
DateTimeToLocalizedString(&rec_pyline.GetField(&i).Value,
"dd/MM/yyyy hh:mm aaa");
&yy =
&childNode22line.AddText(&string);
When-Other
&yy =
&childNode22line.AddText(&rec_pyline.GetField(&i).Value);
End-Evaluate;
End-For;
End-While;
&MSG =
CreateMessage(Operation.NTT_PY_INTFC);
&MSG.SetXmlDoc(&inXMLDoc);
Return &MSG;
end-method;
Rec_upd:
/****************************** Billing and Payment Interface Program **************************/
class Rec_Update
method update_trigger(&rec As
Record, &PRCSINSTANCE As number, &retry As number) Returns Message;
end-class;
method update_trigger
/+ &rec as Record, +/
/+ &PRCSINSTANCE as Number,
+/
/+ &retry as Number +/
/+ Returns Message +/
Local Record &recTgt =
CreateRecord(Record.NTT_BI_INTFC);
Local string &transactionid;
Local XmlNode &rootNode,
&childNode2, &childNode2line, &childNode22line;
Local XmlNode &tt, &yy,
&qq;
Local XmlDoc &inXMLDoc;
Local number &i;
Local SQL &sqlline;
Local Record &recline;
Local Message &MSG;
&recline =
CreateRecord(Record.BI_LINE);
&transactionid =
&rec.BUSINESS_UNIT.Value | &rec.BILL_TO_CUST_ID.Value |
&rec.INVOICE.Value;
&inXMLDoc =
CreateXmlDoc("");
&rootNode =
&inXMLDoc.CreateDocumentElement(&rec.Name);
&childNode2 =
&rootNode.AddElement("XML_TXN_ID");
&tt =
&childNode2.AddText(&transactionid);
Local string &string;
For &i = 1 To
&rec.FieldCount
&childNode2 =
&rootNode.AddElement((&rec.GetField(&i).Name));
Evaluate
(&rec.GetField(&i).Type)
When "DATE"
&string =
DateTimeToLocalizedString(&rec.GetField(&i).Value,
"dd/MM/yyyy");
&qq =
&childNode2.AddText(&string);
When "DATETIME"
&string =
DateTimeToLocalizedString(&rec.GetField(&i).Value, "dd/MM/yyyy
hh:mm aaa");
&qq =
&childNode2.AddText(&string);
When-Other
&qq =
&childNode2.AddText(&rec.GetField(&i).Value);
End-Evaluate;
End-For;
Local SQL &sqlnote;
Local string &stringnote;
Local Record &recnote =
CreateRecord(Record.BI_HDR_NOTE);
Local XmlNode
&childNode2linenote, &childNode22linenote, &yy_note;
&sqlnote =
CreateSQL("%Selectall(BI_HDR_NOTE) where business_unit = :1 and invoice = :2 order by notes_seq_num",
&rec.BUSINESS_UNIT.Value, &rec.INVOICE.Value);
While
&sqlnote.Fetch(&recnote)
&childNode2linenote =
&rootNode.AddElement((&recnote.Name));
For &i = 1 To
&recnote.FieldCount
&childNode22linenote =
&childNode2linenote.AddElement((&recnote.GetField(&i).Name));
Evaluate
(&recnote.GetField(&i).Type)
When "DATE"
&stringnote =
DateTimeToLocalizedString(&recnote.GetField(&i).Value,
"dd/MM/yyyy");
&yy_note =
&childNode22linenote.AddText(&stringnote);
When "DATETIME"
&stringnote =
DateTimeToLocalizedString(&recnote.GetField(&i).Value, "dd/MM/yyyy
hh:mm aaa");
&yy_note =
&childNode22linenote.AddText(&stringnote);
When-Other
&yy_note =
&childNode22linenote.AddText(&recnote.GetField(&i).Value);
End-Evaluate;
End-For;
End-While;
&sqlline =
CreateSQL("%Selectall(BI_LINE) where business_unit = :1 and INVOICE = :2 order by business_unit,INVOICE
,line_seq_num", &rec.BUSINESS_UNIT.Value, &rec.INVOICE.Value);
While
&sqlline.Fetch(&recline)
&childNode2line =
&rootNode.AddElement((&recline.Name));
For &i = 1 To
&recline.FieldCount
&childNode22line =
&childNode2line.AddElement((&recline.GetField(&i).Name));
Evaluate
(&recline.GetField(&i).Type)
When "DATE"
&string =
DateTimeToLocalizedString(&recline.GetField(&i).Value,
"dd/MM/yyyy");
&yy =
&childNode22line.AddText(&string);
When "DATETIME"
&string =
DateTimeToLocalizedString(&recline.GetField(&i).Value, "dd/MM/yyyy
hh:mm aaa");
&yy =
&childNode22line.AddText(&string);
When-Other
&yy =
&childNode22line.AddText(&recline.GetField(&i).Value);
End-Evaluate;
End-For;
Local SQL &sqllinenote;
Local string &stringlinenote;
Local Record &reclinenote
= CreateRecord(Record.BI_LINE_NOTE);
Local XmlNode
&Billlinenote, &Billline22note, &yy_linenote;
&sqllinenote =
CreateSQL("%Selectall(BI_LINE_NOTE) where business_unit = :1 and invoice = :2 and line_seq_num = :3 order by
notes_seq_num", &rec.BUSINESS_UNIT.Value, &rec.INVOICE.Value,
&recline.LINE_SEQ_NUM.Value);
While
&sqllinenote.Fetch(&reclinenote)
&Billlinenote =
&childNode2line.AddElement((&reclinenote.Name));
For &i = 1 To
&reclinenote.FieldCount
&Billline22note =
&Billlinenote.AddElement((&reclinenote.GetField(&i).Name));
Evaluate
(&reclinenote.GetField(&i).Type)
When "DATE"
&stringlinenote =
DateTimeToLocalizedString(&reclinenote.GetField(&i).Value,
"dd/MM/yyyy");
&yy_linenote =
&Billline22note.AddText(&stringlinenote);
When
"DATETIME"
&stringlinenote =
DateTimeToLocalizedString(&reclinenote.GetField(&i).Value,
"dd/MM/yyyy hh:mm aaa");
&yy_linenote =
&Billline22note.AddText(&stringlinenote);
When-Other
&yy_linenote =
&Billline22note.AddText(&reclinenote.GetField(&i).Value);
End-Evaluate;
End-For;
End-While;
End-While;
&MSG =
CreateMessage(Operation.NTT_BI_INTFC);
&MSG.SetXmlDoc(&inXMLDoc);
Return &MSG;
end-method;
Rec_upd_py:
import NTT_GY_TEST_RESP:Rec_Insert_Py;
class Rec_Update_Py
method
update_trigger_py(&rec_py As Record, &PRCSINSTANCE As number,
&retry As number, &minimum As number, &maximum As number) Returns
Message;
end-class;
method update_trigger_py
/+ &rec_py as Record, +/
/+ &PRCSINSTANCE as Number,
+/
/+ &retry as Number, +/
/+ &minimum as Number, +/
/+ &maximum as Number +/
/+ Returns Message +/
Local Record &rec_pyTgt =
CreateRecord(Record.NTT_PY_INTFC);
Local string &transactionid;
Local XmlNode &rootNode,
&childNode2, &childNode2line, &childNode22line;
Local XmlNode &tt, &yy,
&qq;
Local XmlDoc &inXMLDoc;
Local number &i;
Local SQL &sqlline;
Local Record &rec_pyline;
Local Message &MSG;
&rec_pyline =
CreateRecord(Record.ITEM_ACTIVITY);
&inXMLDoc =
CreateXmlDoc("");
&rootNode =
&inXMLDoc.CreateDocumentElement("PAYMENT");
&childNode2 =
&rootNode.AddElement("XML_TXN_ID");
&transactionid =
&rec_py.BUSINESS_UNIT.Value | &rec_py.CUST_ID.Value |
&rec_py.ITEM.Value | &minimum | &maximum;
&tt =
&childNode2.AddText(&transactionid);
&childNode2 =
&rootNode.AddElement("ITEM_EXIST_FLG");
If &minimum = 1 Then
&tt = &childNode2.AddText("INSERT");
Else
&tt =
&childNode2.AddText("UPDATE");
End-If;
Local string &string;
Local Record &rechdr;
&rechdr =
CreateRecord(Record.ITEM);
&rechdr.BUSINESS_UNIT.Value =
&rec_py.BUSINESS_UNIT.Value;
&rechdr.ITEM.Value =
&rec_py.ITEM.Value;
&rechdr.CUST_ID.Value =
&rec_py.CUST_ID.Value;
&rechdr.ITEM_LINE.Value = 0;
&rechdr.SelectByKey();
For &i = 1 To
&rechdr.FieldCount
&childNode2 =
&rootNode.AddElement((&rechdr.GetField(&i).Name));
Evaluate
(&rechdr.GetField(&i).Type)
When "DATE"
&string =
DateTimeToLocalizedString(&rechdr.GetField(&i).Value,
"dd/MM/yyyy");
&qq =
&childNode2.AddText(&string);
When "DATETIME"
&string = DateTimeToLocalizedString(&rechdr.GetField(&i).Value,
"dd/MM/yyyy hh:mm aaa");
&qq =
&childNode2.AddText(&string);
When-Other
&qq =
&childNode2.AddText(&rechdr.GetField(&i).Value);
End-Evaluate;
End-For;
&sqlline =
CreateSQL("%Selectall(ITEM_ACTIVITY) where business_unit = :1 and ITEM = :2 and cust_id = :3 and item_seq_num
between :4 and :5 ", &rec_py.BUSINESS_UNIT.Value,
&rec_py.ITEM.Value, &rec_py.CUST_ID.Value, &minimum, &maximum);
While &sqlline.Fetch(&rec_pyline)
&childNode2line =
&rootNode.AddElement("PAYMENT_ACTIVITY");
For &i = 1 To
&rec_pyline.FieldCount
&childNode22line =
&childNode2line.AddElement((&rec_pyline.GetField(&i).Name));
Evaluate (&rec_pyline.GetField(&i).Type)
When "DATE"
&string =
DateTimeToLocalizedString(&rec_pyline.GetField(&i).Value,
"dd/MM/yyyy");
&yy =
&childNode22line.AddText(&string);
When "DATETIME"
&string =
DateTimeToLocalizedString(&rec_pyline.GetField(&i).Value,
"dd/MM/yyyy hh:mm aaa");
&yy =
&childNode22line.AddText(&string);
When-Other
&yy =
&childNode22line.AddText(&rec_pyline.GetField(&i).Value);
End-Evaluate;
End-For;
End-While;
&MSG =
CreateMessage(Operation.NTT_PY_INTFC);
&MSG.SetXmlDoc(&inXMLDoc);
Return &MSG;
end-method;
Trigger_ib_msg:
class TRIGGER_IB_MSG
method
call_service_operation(&MSG As Message) Returns Message;
end-class;
method call_service_operation
/+ &MSG as Message +/
/+ Returns Message +/
/*
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
/* Do not alter or create your
own lines that start with /+
*/
/* These lines are special lines
inserted by the application class
*/
/* when the application class is saved and the
method has parameters */
/* defined in the class section */
/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
*/
Local Message &response;
&response =
%IntBroker.SyncRequest(&MSG);
Return &response;
end-method;
