Advertisement
Guest User

Untitled

a guest
Jan 17th, 2020
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.84 KB | None | 0 0
  1. /// <reference path="./../../../../../../nes-app/app/scripts/references.d.ts" />
  2. /// <reference path="./../services/line.ts" />
  3.  
  4. import {
  5. Screen,
  6. Scr,
  7. ScrView,
  8. ScreenOptions
  9. } from 'nes2/screen';
  10. import {NesKendoDataSource, ConfigService } from 'nes2/services';
  11. import {LifecycleEvent} from 'angular2/angular2';
  12. import app from 'nes2/app';
  13. import {tllrTxn} from '../services/tllrTxn';
  14. import {TllrLdTxn} from '../services/tllrLdTxn';
  15. import { ld } from 'screens/LD-B/services/ld';
  16. import {TmwSv} from '../../TMW-M/services/tmwSv';
  17.  
  18. @Scr({
  19. type: TLLRA354,
  20. selector: 'TLLR-A-354'
  21. })
  22.  
  23. @ScrView({
  24. templateUrl: "TLLR-A-354"
  25. })
  26. export default class TLLRA354 extends Screen {
  27.  
  28. tllrTxn: tllrTxn = new tllrTxn(this);
  29. isEnableTxn: boolean = false;
  30. ldTxn: TllrLdTxn = new TllrLdTxn(this);
  31. tmwSv: TmwSv = new TmwSv();
  32. config = new ConfigService();
  33. ld: ld = new ld();
  34.  
  35. model: any = { txnAmount: 0, contAmount: 0, princ: 0 };
  36. dealCode: string;
  37. operation: number = 0;
  38. isGetAcntInfo: boolean = false;
  39. //13600703 өөрчлөх !!!
  40. size: number = 12;
  41. extraCode: number;
  42. txnCode: string = "LD_EXEC_DEAL";
  43. office: string;
  44. ddlAction: NesDropDown;
  45. dealStatus: string;
  46. rateType: string;
  47. filterStatus: string = "";
  48. contCurCode: string;
  49. dialogResult: any;
  50. isDescRequired: number = 0;
  51. isChange: number = 1;
  52. sourceType: string = 'TLLR';
  53. cashBankNote: any = [];
  54. changeBankNotes: any = [];
  55. sumTotalAmount: number = 0;
  56. correctionAmt: number = -1;
  57. isGetAcntInfo1: boolean = false;
  58. curCode: string;
  59.  
  60. brwsTxnAcntCode: NesBrowse;
  61. brwsContAcntCode: NesBrowse;
  62. ddlAcntType: NesDropdown;
  63. ddlCurCode: NesDropdown;
  64. ddlContCurCode: NesDropdown;
  65. ddlRateType: NesDropdown;
  66. numContAmount: NesNumeric;
  67. numContRate: NesNumeric;
  68. numRate: NesNumeric;
  69. numTxnAmount: NesNumeric;
  70. rdNonCash: NesRadio;
  71. rdCash: NesRadio;
  72.  
  73. constructor(options: ScreenOptions) {
  74. super(options);
  75. }
  76.  
  77. onControlsInit() {
  78. this.ddlAction = <NesDropDown>this.getControl('formTLLRA354/dropdownAction');
  79. if (this.param != undefined && !this.param.empty) {
  80. let paramObj = this.param.get(0);
  81. this.sourceType = paramObj.sourceType;
  82.  
  83. if (this.sourceType == 'TMWM120') {
  84. this.formDisabled(true);
  85.  
  86. this.isChange = 0;
  87. this.tllrTxn.detailPendJrnl(paramObj.jrno)
  88. .then((data) => {
  89. data.addParams = JSON.parse(data.addParams);
  90. data.addition = JSON.parse(data.addition);
  91. data.dealCode = data.addParams.DEALCODE;
  92. data.action = data.addition.action;
  93. this.model = data;
  94. }, (err) => { this.error(err); });
  95. } else {
  96. if (this.param.get(0).dealCode !== undefined){
  97. this.findControl("browseDealCode").value = this.param.get(0).dealcode;
  98. this.model.dealCode = this.param.get(0).dealCode;
  99. this.findControl("browseDealCode").disabled = true;
  100. }
  101. if(this.param.get(0).action !== undefined){
  102. this.model.action = this.param.get(0).action;
  103. this.ddlAction.disabled = true;
  104. this.changeAction();
  105. }
  106. }
  107. }
  108. }
  109.  
  110. afterInit() {
  111. this.checkRequired();
  112. if (!this.param.empty && this.param.get(0).dealCode)
  113. this.model.dealCode = this.param.get(0).dealCode;
  114. }
  115.  
  116. doTran(isPreview: number, e: any) {
  117. if (e)
  118. e.preventDefault();
  119.  
  120. if (this.controls.formTLLRA354.valid) {
  121. this.tllrTxn.disableTxnBtn(this, true);
  122. if (!isPreview && !confirm("Гүйлгээ хийхдээ итгэлтэй байна уу?")){
  123. this.tllrTxn.disableTxnBtn(this, false);
  124. return false;
  125. }
  126.  
  127. if(this.ddlAction.value === "START")
  128. if (this.model.type === "M") {
  129. if (this.model.prodType == 'PLACEMENT')
  130. this.operation = 13600274;
  131. else
  132. this.operation = 13600700;
  133. this.doTransaction(isPreview);
  134. }
  135. else {
  136. this.operation = 13600712;
  137. this.ldTxn.getMmRollTxnAmt(this.model.rollOrdId, this.model.dealCode)
  138. .then((txnAmount) => {
  139. if ((this.model.prodType == 'PLACEMENT' && txnAmount > 0)
  140. || (this.model.prodType == 'BORROWING' && txnAmount < 0)) {
  141. this.operation = 13600279;
  142. }
  143. this.doTransaction(isPreview);
  144. }, (err) => { this.error(err); });
  145. }
  146. if(this.ddlAction.value === "CLOSE")
  147. if(this.dealStatus === "D") {
  148. if (this.model.prodType == 'PLACEMENT')
  149. this.operation = 13600282;
  150. else
  151. this.operation = 13600703;
  152. this.doTransaction(isPreview);
  153. }
  154. else{
  155. this.warn("Хэлцлийн төлөв хийгдсэн үед л хэлцэл хаана.");
  156. return;
  157. }
  158.  
  159. if(this.ddlAction.value === "CANCEL"){
  160. this.operation = 13600701;
  161. if(this.dealStatus != "O") {
  162. this.warn("Хэлцлийн нээлттэй үед л цуцлана.");
  163. return;
  164. }
  165. this.doTransaction(isPreview);
  166. }
  167. }
  168. }
  169.  
  170. doTransaction(isPreview: number) {
  171. let data = this.controls.formTLLRA354.value;
  172. var txnParam = {
  173. txnAcntCode: this.model.acntNo,
  174. isPreview: isPreview,
  175. isTmw: 1,
  176. txnDesc: this.model.txnDesc,
  177. txnDefCode: this.model.txnDefCode,
  178. addParams: {
  179. dealCode: this.model.dealCode,
  180. action: this.ddlAction.value
  181. }
  182. };
  183. txnParam.addition = txnParam.addParams;
  184.  
  185. let isPreviewFee = this.config.get(this.scrCode, this.extraCode + "_fee");
  186. txnParam.isPreviewFee = isPreviewFee ? isPreviewFee : 0;
  187. if(this.operation === 0)
  188. {
  189. this.warn("Гүйлгээ хийж чадсангүй.");
  190. return;
  191. }
  192. this.extraCode = this.operation;
  193. this.tllrTxn.executeDealTxn(txnParam, this.operation)
  194. .then((response) => {
  195. if (txnParam.isPreviewFee) {
  196. this.showFee(txnParam, response.txnPreview, response.feesPreview);
  197. return;
  198. }
  199. if (response.isPreview) {
  200. txnParam.isPreview = 0;
  201. this.showTran([{ operCode: this.operation,
  202. txnParam: txnParam,
  203. txnPreview: response.txnPreview,
  204. txnAcntCode: this.model.acntNo,
  205. isSupervisor: response.isSupervisor,
  206. pendReason: response.pendReason,
  207. cfgPrefix: this.scrCode,
  208. isDescRequired: this.isDescRequired
  209. }]);
  210. }
  211. else{
  212. switch (response.isSupervisor) {
  213. case 1: {
  214. let data = [];
  215. data.push(response.txnJrno);
  216. data.push(response.pendReason);
  217. data.push('TLLR');
  218. if(response.unDelegated)
  219. data.push(response.unDelegated);
  220. this.success("Хүлээлгэх гүйлгээ бүртгэгдлээ (" + response.txnJrno +")");
  221. this.tmwSv.showSv(data).then((dialogResult) => {
  222. if(dialogResult)
  223. this.clear();
  224. }, (err) => {
  225. this.error(err);
  226. });
  227. break;
  228. }
  229. case 0: {
  230. if(response.warningMsg)
  231. this.warn(response.warningMsg + " ("+ response.txnJrno + ")");
  232. else
  233. {
  234. this.tllrTxn.disableTxnBtn(this, false);
  235. this.success("Амжилттай (" + response.txnJrno + ")");
  236. }
  237. this.dialogResult = response.txnJrno;
  238.  
  239. if (this.config.get(this.scrCode, this.txnCode) == 1) {
  240. app.screen({
  241. name: "DOT-S-113",
  242. parameter: {
  243. sysNo: 1360,
  244. txnCode: this.operation,
  245. descRequired: this.isDescRequired,
  246. expType: "HTML",
  247. data: [{
  248. paramType: 0,
  249. paramCode: "TXN_JRNO",
  250. value: response.txnJrno
  251. }]
  252. },
  253. parent: this,
  254. onClose: (dialogResult) => {
  255. if (dialogResult)
  256. {
  257. this.clear();
  258. }
  259. }
  260. });
  261. }
  262. else
  263. this.clear();
  264. }
  265. }
  266. }
  267. }, (err) => { this.tllrTxn.disableTxnBtn(this, false); this.error(err); });
  268. }
  269.  
  270. showTran(data: any) {
  271. this.tllrTxn.disableTxnBtn(this, false);
  272. app.screen({
  273. name: "TLLR-A-600",
  274. parameter: data,
  275. parent: this,
  276. parentScreen: this,
  277. onClose: (dialogResult) => { this.tllrTxn.disableTxnBtn(this, false);
  278. if (dialogResult)
  279. {
  280. this.clear();
  281. }
  282. }
  283. });
  284. }
  285.  
  286. browseDeal() {
  287. app.screen({
  288. name: "MM-B-112",
  289. parameter: [{status: this.filterStatus}],
  290. parent: this,
  291. parentScreen: this,
  292. onClose: (dialogResult) => {
  293. if (dialogResult) {
  294. this.isGetAcntInfo = true;
  295. this.model.dealCode = dialogResult.get("dealCode");
  296. this.model.type = dialogResult.get("type");
  297. this.model.prodType = dialogResult.get('prodType');
  298. this.model.rollOrdId = dialogResult.get('rollOrdId');
  299. document.getElementById('dealName').innerHTML = dialogResult.get("name");
  300. this.findControl("browseDealCode").value = dialogResult.get("dealCode");
  301. this.isGetAcntInfo = false;
  302. this.findControl("browseDealCode").trigger("change");
  303. }
  304. }
  305. });
  306. }
  307.  
  308. isChanged() {
  309. if (!this.isGetAcntInfo && !this.model.txnJrno) {
  310. if (this.findControl("browseDealCode") && this.findControl("browseDealCode").value)
  311. this.tllrTxn.getLdDealDetail(this.findControl("browseDealCode").value)
  312. .then((data) => {
  313. this.office = data.office;
  314. this.dealStatus = data.status;
  315. this.isGetAcntInfo = true;
  316. this.model.acntNo = data.ldAcntCode;
  317. this.model.dealCode = data.dealCode;
  318. this.model.type = data.type;
  319. this.model.prodType = data.prodType;
  320. this.model.rollOrdId = data.rollOrdId;
  321. this.findControl("browseDealCode").value = data.dealCode;
  322. document.getElementById('dealName').innerHTML = data.name;
  323. this.isGetAcntInfo = false;
  324. },
  325. (err) => {
  326. this.error(err);
  327. });
  328. }
  329. this.isGetAcntInfo = false;
  330. }
  331.  
  332. changeAction() {
  333. if(this.model.action === "START" || this.model.action === "CANCEL")
  334. this.filterStatus = "O";
  335. if(this.model.action === "CLOSE")
  336. this.filterStatus = "D";
  337. }
  338.  
  339. formDisabled(disabled: boolean) {
  340. $('.btn-tran').prop("disabled", true);
  341. $('.btn-cancel').prop("disabled", true);
  342. this.findControl("browseDealCode").disabled = true;
  343. this.findControl("textareaTxnDesc").disabled = true;
  344. this.findControl("dropDownAction").disabled = true;
  345.  
  346. let params = [this.sourceType];
  347. let paramSrc = params[0];
  348. _.each(this.controls.formTLLRA354.controls, function (control, idx) {
  349. if ("disabled" in control) {
  350. if(paramSrc == 'TKT' && (control.name == 'cancel' || control.name == 'doTran' || control.name == 'doTxn' || control.name == 'txnDesc' || control.name == 'getSig'))
  351. control.disabled = false;
  352. else
  353. control.disabled = disabled;
  354. }
  355. }, params); this.tllrTxn.disableTxnBtn(this, false);
  356. }
  357.  
  358. dealDetail(e) {
  359. e.preventDefault();
  360. app.screen({
  361. name: "TLLR-A-610",
  362. parameter: ["",this.model.dealCode],
  363. parent: this
  364. });
  365. }
  366.  
  367. clear() {
  368. this.office = "";
  369. this.model = {};
  370. document.getElementById('dealName').innerHTML = "";
  371. }
  372.  
  373. clickSettings() {
  374. app.screen({
  375. name: "TLLR-A-200",
  376. parameter: [this.txnCode, "Хэлцлийн гүйлгээ хийх", 1315, 1],
  377. parent: this
  378. });
  379. }
  380.  
  381. showFee(txnParam: any, txnPreview: any, fees: any) {
  382. this.tllrTxn.disableTxnBtn(this, false);
  383. app.screen({
  384. name: "TLLR-A-337",
  385. parameter: [{ txnAcntCode: txnParam.txnAcntCode, txnParam: txnParam, txnPreview: txnPreview, fees: fees, cfgPrefix: this.scrCode, operCode: this.extraCode, isDescRequired: this.isDescRequired }],
  386. parent: this,
  387. onClose: (dialogResult) => {
  388. if (dialogResult)
  389. this.clear();
  390. }
  391. });
  392. }
  393.  
  394. checkRequired() {
  395. var param;
  396. param = [
  397. [{
  398. _iField: "SCR_CODE",
  399. _iOperation: "=",
  400. _iValue: this.scrCode,
  401. _iType: 3
  402. }], 0, -1
  403. ];
  404.  
  405. this.tllrTxn.selectScrCfg(param)
  406. .then((data) => {
  407. if (data) {
  408. data.forEach((m) => {
  409. switch (m.fieldCode) {
  410. case 'TCUSTREGISTER':
  411. if (!m.isRequired) {
  412. this.controls.formTLLRA354.disableValidity("tcustRegisterMask");
  413. this.controls.formTLLRA354.disableValidity("tcustRegister");
  414. }
  415. break;
  416. case 'TXNDEFCODE':
  417. if (!m.isRequired) {
  418. this.controls.formTLLRA354.disableValidity("txnDefCode");
  419. }
  420. break;
  421. case 'TEMPDESCREQUIRED':
  422. this.isDescRequired = m.isRequired;
  423. break;
  424. default:
  425. break;
  426. }
  427. });
  428. }
  429. },
  430. (err) => {
  431. this.error(err);
  432. });
  433. }
  434.  
  435. curCodeBound(isTxnCurCode: boolean) {
  436. let ddlCurCode = isTxnCurCode ? this.ddlCurCode : this.ddlContCurCode;
  437. if (this.curCode && !ddlCurCode.value) {
  438. ddlCurCode.value = this.curCode;
  439. ddlCurCode.trigger("change");
  440. }
  441. }
  442.  
  443. radioChange(isCash: boolean) {
  444. if (this.isChange) {
  445. this.ddlCurCode.disabled = !isCash;
  446. this.ddlContCurCode.disabled = !isCash;
  447. }
  448.  
  449. this.setOperCode();
  450.  
  451. if (isCash) {
  452. this.rdNonCash.checked = "false";
  453.  
  454. if (this.isChange && this.ddlContCurCode.value !== this.contCurCode)
  455. this.ddlCurCode.disabled = true;
  456. }
  457. else {
  458. this.rdCash.checked = "false";
  459.  
  460. if (this.isChange && this.brwsTxnAcntCode.value && this.model.prodType)
  461. this.getCssiAcnt(this.brwsTxnAcntCode.value);
  462. }
  463. this.toggleContAcnt(!isCash);
  464. }
  465.  
  466. toggleContAcnt(isShow: boolean) {
  467.  
  468. if (isShow) {
  469. $('.cont-acnt').show();
  470. $("#lblTxnAcnt").text("Хүлээн авах данс");
  471. this.toggleContAmount(true);
  472. }
  473. else {
  474. $('.cont-acnt').hide();
  475. $("#lblTxnAcnt").text("Данс");
  476. this.showOrHide(false);
  477. this.toggleContAmount(this.ddlContCurCode.value !== this.ddlCurCode.value);
  478. }
  479.  
  480. if(!this.isChange)
  481. return;
  482.  
  483. this.ddlAcntType.disabled = this.rdCash.checked;
  484. this.ddlAcntType.value = null;
  485. this.ddlAcntType.trigger("change");
  486.  
  487. this.controls.formTLLRA354.updateValidity();
  488. }
  489.  
  490. toggleContAmount(isShow: boolean) {
  491. if (this.isChange) {
  492. this.ddlContCurCode.disabled = !isShow;
  493. this.numContRate.disabled = !isShow;
  494. this.ddlRateType.disabled = !isShow;
  495. }
  496.  
  497. if (isShow) {
  498. $('.cont-amount').show();
  499. $('#lblTxn').text(this.rdCash.checked ? "Кассын гүйлгээний дүн" : "Гүйлгээний дүн");
  500. if (this.isChange && this.rdNonCash.checked) {
  501. this.ddlCurCode.disabled = true;
  502. this.ddlContCurCode.disabled = this.model.acntType != "4";
  503. }
  504. }
  505. else
  506. $('.cont-amount').hide();
  507.  
  508. this.controls.formTLLRA354.updateValidity();
  509. }
  510.  
  511. showOrHide(isBuyCurCode: boolean) {
  512. if (this.isChange && ((isBuyCurCode && !this.model.txnAmount)
  513. || (!isBuyCurCode && !this.model.contAmount))) {
  514. // this.numTxnAmount.value = 0;
  515. this.model.contAmount = 0;
  516. this.numContAmount.value = 0;
  517. }
  518.  
  519. if (this.rdCash.checked) {
  520. if (isBuyCurCode) {
  521. if (this.ddlCurCode.value !== this.contCurCode) {
  522. this.model.contCurCode = this.ddlCurCode.value;
  523. this.ddlContCurCode.value = this.ddlCurCode.value;
  524. this.model.curCode = this.contCurCode;
  525. this.ddlCurCode.value = this.contCurCode;
  526. this.changeRate(false);
  527. }
  528.  
  529. this.ddlCurCode.disabled = !this.isChange || this.ddlContCurCode.value !== this.ddlCurCode.value;
  530. this.changeRate(true);
  531. }
  532. else {
  533. if (this.ddlContCurCode.value === this.contCurCode) {
  534. this.model.curCode = this.contCurCode;
  535. this.ddlCurCode.value = this.contCurCode;
  536. this.ddlRateType.value = this.rateType;
  537. this.model.contAmount = this.model.txnAmount;
  538. this.model.contRate = this.model.rate;
  539. }
  540. this.ddlCurCode.disabled = !this.isChange || this.ddlContCurCode.value !== this.contCurCode;
  541. this.changeRate(this.ddlContCurCode.value === this.contCurCode);
  542. }
  543.  
  544.  
  545. this.controls.formTLLRA354.updateValidity();
  546. this.toggleContAmount(this.ddlCurCode.value !== this.ddlContCurCode.value);
  547. }
  548. else {
  549. if (!this.ddlRateType.value)
  550. for (var i = 0; i < this.ddlRateType.dataSource._pristineData.length; i++) {
  551. if (this.ddlRateType.dataSource._pristineData[i].extra == "1") {
  552. this.ddlRateType.value = this.ddlRateType.dataSource._pristineData[i].id;
  553. this.ddlRateType.trigger("change");
  554. break;
  555. }
  556. }
  557. this.toggleContAmount(true);
  558. this.changeRate(isBuyCurCode);
  559. }
  560. this.clearBankNotes();
  561. }
  562.  
  563. clearBankNotes() {
  564. this.sumTotalAmount = 0;
  565. this.cashBankNote = [];
  566. this.changeBankNotes = [];
  567. }
  568.  
  569. changeRate(isBuyRate: boolean) {
  570. if (!this.isChange)
  571. return;
  572.  
  573. if (this.rdCash.checked) {
  574. this.changeRateCash(isBuyRate);
  575. }
  576. else {
  577. this.changeRateNonCash(isBuyRate);
  578. }
  579. }
  580.  
  581. changeRateCash(isBuyRate: boolean) {
  582. if (!isBuyRate) {
  583. if (!this.ddlContCurCode.value || !this.ddlRateType.value)
  584. return;
  585. else {
  586. this.tllrTxn.getBuyRate(this.ddlRateType.value, this.ddlContCurCode.value)
  587. .then((response) => {
  588. this.model.contRate = response;
  589. this.numContRate.value = response;
  590. this.changeAmount();
  591. }, (err) => { this.error(err); });
  592. }
  593. }
  594. if (isBuyRate || this.ddlCurCode.value != this.ddlContCurCode.value) {
  595. if (!this.ddlCurCode.value || !this.ddlRateType.value)
  596. return;
  597.  
  598. this.tllrTxn.getSellRate(this.ddlRateType.value, this.ddlCurCode.value)
  599. .then((response) => {
  600. this.model.rate = response;
  601. this.numRate.value = response;
  602.  
  603. if (this.ddlCurCode.value == this.ddlContCurCode.value) {
  604. this.model.contRate = this.model.rate;
  605. this.numContRate.value = this.numRate.value;
  606. this.changeAmount();
  607. }
  608. this.changeAmount();
  609. }, (err) => { this.error(err); });
  610. }
  611. }
  612.  
  613. changeRateNonCash(isBuyRate: boolean) {
  614. if (!isBuyRate || !this.numContRate.value) {
  615. if (!this.ddlContCurCode.value || !this.ddlRateType.value)
  616. return;
  617. else {
  618. this.tllrTxn.getBuyRate(this.ddlRateType.value, this.ddlContCurCode.value)
  619. .then((response) => {
  620. this.model.contRate = response;
  621. this.numContRate.value = response;
  622. if (this.ddlCurCode.value == this.ddlContCurCode.value) {
  623. this.model.rate = this.model.contRate;
  624. this.numRate.value = this.numContRate.value;
  625. }
  626. this.changeAmount();
  627. }, (err) => { this.error(err); });
  628. }
  629. }
  630. if (isBuyRate || this.ddlCurCode.value != this.ddlContCurCode.value) {
  631. if (!this.ddlCurCode.value || !this.ddlRateType.value)
  632. return;
  633. else if (this.ddlCurCode.value == this.ddlContCurCode.value && this.numContRate.value) {
  634. this.model.rate = this.model.contRate;
  635. this.numRate.value = this.numContRate.value;
  636. this.changeAmount();
  637. }
  638. else {
  639. this.tllrTxn.getSellRate(this.ddlRateType.value, this.ddlCurCode.value)
  640. .then((response) => {
  641. this.model.rate = response;
  642. this.numRate.value = response;
  643. this.changeAmount();
  644. // this.changeAmount(false);
  645. }, (err) => { this.error(err); });
  646. }
  647. }
  648. }
  649.  
  650. changeAmount() {
  651. if (this.numRate.value && this.numContRate.value)
  652. this.model.contAmount = Math.round((this.model.txnAmount - this.model.discountAmount) * this.numRate.value * 100 / this.numContRate.value) / 100;
  653. else
  654. this.model.contAmount = 0;
  655. this.clearBankNotes();
  656. this.correctionAmt = -1;
  657. }
  658.  
  659. setOperCode() {
  660. let option = "BORR_";
  661. if (this.model.prodType === 'PLACEMENT') {
  662. option = 'PL_';
  663. }
  664. if (!this.rdCash.checked) {
  665. option += 'NON';
  666. }
  667. option += 'CASH';
  668.  
  669. this.extraCode = this.ldTxn.opStartAcnt[option];
  670. }
  671.  
  672. getCssiAcnt(acntCode: string) {
  673. this.ld.getCssiAcnt(acntCode, this.model.prodType == "BORROWING" ? "F" : "T", this.module)
  674. .then((data) => {
  675. if (data) {
  676. this.isGetAcntInfo1 = true;
  677.  
  678. if (data.typeCode == "LOCALBANK_GB" || data.typeCode == "LOCALBANK" || data.typeCode == "CENTRAL_BANK")
  679. this.model.contBankCode = data.bankCode;
  680.  
  681. if (data.typeCode == "LOCALBANK_GB" || data.typeCode == "LOCALBANK") {
  682. this.model.contBankAcntCode = data.acntCode;``
  683. this.model.rcvBankBrchCode = data.bankBrchCode;
  684. this.model.contBankAcntName = data.benName;
  685. this.model.contAcntName = null;
  686. }
  687.  
  688. if (data.typeCode != "LOCALBANK_GB" && data.typeCode != "LOCALBANK" && data.typeCode != "CENTRAL_BANK") {
  689. this.model.contAcntCode = data.acntCode;
  690. this.model.contAcntName = data.acntName;
  691. this.brwsContAcntCode.disabled = false;
  692. }
  693.  
  694. this.isGetAcntInfo1 = false;
  695.  
  696. switch (data.typeCode) {
  697. case "LOCALBANK_GB":
  698. case "LOCALBANK":
  699. this.model.sysNo = 1318;
  700. break;
  701. case "CENTRAL_BANK":
  702. this.model.sysNo = 1368;
  703. break;
  704. default:
  705. this.model.sysNo = Number(data.acntSysNo);
  706. break;
  707. }
  708.  
  709. this.setAcntType(this.model.sysNo.toString());
  710.  
  711. this.ddlContCurCode.value = data.acntCurCode;
  712. this.ddlContCurCode.trigger("change");
  713. this.model.contCurCode = data.acntCurCode;
  714. }
  715. else {
  716. this.ddlAcntType.value = null;
  717. this.ddlAcntType.trigger("change");
  718. }
  719. }, (err) => {
  720. this.error(err);
  721. this.ddlAcntType.value = null;
  722. this.ddlAcntType.trigger("change");
  723. });
  724. }
  725.  
  726. setAcntType(sysNo: string) {
  727.  
  728. this.model.acntType = this.acntType[sysNo];
  729. this.setSysNo(this.model.acntType);
  730.  
  731. if (!this.model.acntType)
  732. this.warn("Хүлээн авах данс буруу байна");
  733. this.controls.formTLLRA354.updateValidity();
  734. }
  735.  
  736. setSysNo(acntType: string) {
  737. switch (acntType) {
  738. case "1":
  739. this.model.sysNo = 1305;
  740. break;
  741. case "3":
  742. this.model.sysNo = 1301;
  743. break;
  744. case "4":
  745. this.model.sysNo = 1318;
  746. break;
  747. case "5":
  748. this.model.sysNo = 1368;
  749. break;
  750. default:
  751. this.model.sysNo = null;
  752. break;
  753. }
  754. }
  755. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement