Upload_instruction_transfer.js.bak 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. function issuance()
  2. {
  3. var registrarCode = Project.Variables.code.Value("codeRegister");
  4. var url = "C:\\Users\\vendor_qafusi2\\Documents\\EBAE Upload\\Upload Transfer\\transfer.str";
  5. var zip = "C:\\Users\\vendor_qafusi2\\Documents\\EBAE Upload\\Upload Transfer\\transfer.zip";
  6. var account1 = Project.Variables.getAccount1.Value("sid1");
  7. var account2 = Project.Variables.getAccount2.Value("sid2");
  8. var securityCode = Project.Variables.code.Value("instrumenLocalCode");
  9. var certif2 = Project.Variables.certificate.Value("certif2");
  10. var today = new Date();
  11. var dd = String(today.getDate()).padStart(2, '0');
  12. var mm = String(today.getMonth() + 1).padStart(2, '0'); //January is 0!
  13. var yyyy = today.getFullYear();
  14. today = yyyy + mm + dd;
  15. var template =
  16. '<Message>\n'+
  17. '<Record name="data">\n'+
  18. '<Field name="externalReference">'+certif2+'</Field>\n'+
  19. '<Field name="participantCode">'+registrarCode+'</Field>\n'+
  20. '<Field name="sourceAccount">'+account1+'</Field>\n'+
  21. '<Field name="targetAccount">'+account2+'</Field>\n'+
  22. '<Field name="securityCodeType">ISIN</Field>\n'+
  23. '<Field name="securityCode">'+securityCode+'</Field>\n'+
  24. '<Field name="numberOfSecurities">11</Field>\n'+
  25. '<Field name="settlementDate">'+today+'</Field>\n'+
  26. '<Field name="description">Testing</Field>\n'+
  27. '<List name="CertificateList">\n'+
  28. '<Field name="Certificate">'+certif2+'</Field>\n'+
  29. '</List>\n'+
  30. '<Field name="reason">TRAD</Field>\n'+
  31. '</Record>\n'+
  32. '</Message>' ;
  33. if (aqFile.Create(url) == 0)
  34. {
  35. aqFile.WriteToTextFile(url, template, aqFile.ctUTF8);
  36. Log.Message("File dibuat dan teks yang ditentukan berhasil ditulis.");
  37. }
  38. else
  39. {
  40. aqFile.Delete(url);
  41. aqFile.Delete(zip);
  42. if (aqFile.Create(url) == 0)
  43. {
  44. aqFile.WriteToTextFile(url, template, aqFile.ctUTF8);
  45. Log.Message("File dibuat dan teks yang ditentukan berhasil ditulis.");
  46. }
  47. }
  48. }