· 7 years ago · Dec 28, 2018, 06:56 PM
1* Program....: clsaxexp.PRG
2* Version....: 1.0
3* Author.....: Gurinder Singh/Shibin/Venkat
4* Compiler...: Visual FoxPro 09.00.0000.3117 for Windows
5* Abstract...: BC GL -> Dynamics Export Process - TR 1103983
6* Changes....:
7
8
9#INCLUDE system.h
10
11DEFINE CLASS BPOAXEXPORTOUTBOUND AS BPOEDIBase &&Clsedi.prg
12 Name = "BPOAXEXPORTOUTBOUND"
13
14 cJobID = "AXEXPORTOUTBOUND"
15
16 cAxOutCur = ""
17 cJournalType = ""
18 cVersionCode = ""
19 oAx = null
20 lSuppressApiOutput = False
21 cFieldListForCSV = ""
22 cFieldListForCSVHdr = "" &&--- TechRec 1110276 09-Jan-2018 smullappilly ===
23
24 *============================================================
25
26 FUNCTION Init
27 LOCAL llRetVal, lnSelect
28
29 llRetVal = true
30 lnSelect = SELECT()
31 llRetVal = DoDefault()
32 WITH This
33 IF NOT ("CLSAXGL" $ UPPER(SET("Procedure")))
34 SET PROCEDURE TO clsaxgl ADDITIVE
35 ENDIF
36
37 IF NOT ("CLSAXAP" $ UPPER(SET("Procedure")))
38 SET PROCEDURE TO clsaxap ADDITIVE
39 ENDIF
40
41 ENDWITH
42
43 SELECT (lnSelect)
44 RETURN llRetVal
45 ENDFUNC
46
47 *============================================================
48
49 FUNCTION MainProcess && Main method
50 LPARAMETERS pcSQLFilterString
51
52 LOCAL llRetVal, lnSelect, lcProcessCursor, lcWorkAlias, lcSyslockTablePath, lcMessage, lcClass, lcOutboundDir
53
54 lnSelect = SELECT()
55 llRetVal = true
56 lcSyslockTablePath = ADDBS(goEnv.envLoginTablePath.Value)
57
58 IF NOT v_SysLock(lcSyslockTablePath+"SYSLOCK", This.cJobID, goEnv.cCompany)
59 This.lProcessLocked = true
60 RETURN false
61 ENDIF
62
63 WITH This
64 .lSuppressApiOutput = True
65 .cFilter = IIF(EMPTY(pcSQLFilterString), " (1=1) ", UPPER(pcSQLFilterString))
66
67 .oLog.OpenLog(.cJobID, I(.cJobID), .lScheduled)
68 .oLog.LogProgram("clsaxexp.prg")
69 .oLog.LogEntry("Filter Criteria: " + .cFilter)
70
71 .CreateFormProgressBar(.lScheduled)
72 .InitProgressBarTotal(100, "Dynamics Export Process")
73
74 lcOutboundDir = goEnv.SYSTEMPARM(SP_PATH_INTERFACEOB)
75 .oLog.LogEntry("Outbound directory should be: " + lcOutboundDir)
76
77 llRetval = llRetval And Directory(lcOutboundDir)
78
79 If llRetval && if outbound directory exists
80 .oLog.LogEntry("Outbound directory found")
81 Else
82 .oLog.LogWarning("Outbound directory not found")
83 .cMessage = "Outbound directory not found"
84 Endif
85
86 .oLog.LogEntry("Retrieving parameter BROs...")
87 llRetVal = llRetVal AND .RetrieveParamBROS()
88
89 .oLog.LogEntry("Preparing AXOut Cursor...")
90 llRetVal = llRetVal AND .PrepareAxOutCursor()
91
92 .oLog.LogEntry("Preparing Field list for CSV...")
93 llRetVal = llRetVal AND .PrepareFieldListForCSV()
94
95 .oLog.LogEntry("Load AX Object...")
96 llRetVal = llRetVal AND .LoadAXObjects()
97
98 .oLog.LogEntry("Create Work Temp Table...")
99 llRetval = llRetval AND .oAX.CreateWorkTempTable()
100 .AdvanceThermoTotal(20)
101
102 llRetval = llRetval AND (.oAX.lNoDataFound = .F.)
103
104 IF llRetval
105 IF .cJournalType != "BV"
106 llRetval = llRetval AND .oAX.SetSortString()
107 ENDIF
108 llRetVal = llRetVal AND .oAX.GetAXControl() &&--- TechRec 1110276 28-Dec-2017 smullappilly ===
109 llRetval = llRetval AND .oAX.FetchDimensions() &&--- TechRec 1110276 28-Dec-2017 smullappilly ===
110 llRetval = llRetval AND .oAX.ExportToAX()
111 llRetval = llRetval AND This.SendToAXExpInCSV()
112 ENDIF
113
114 IF llRetVal AND !EMPTY(.oAX.cMessage)
115 .cMessage = .oAX.cMessage
116 ENDIF
117
118 IF llRetVal
119 .cMessage = " Dynamics Export Process completed Successfully."
120 ELSE
121 IF EMPTY(.cMessage)
122 .cMessage = "There were no records to process."
123 ENDIF
124 .oLog.LogEntry(.cMessage, .T.)
125 ENDIF
126
127 .AdvanceThermo(80)
128 .AdvanceThermoTotal(80)
129
130 IF IsObject(.oFrmProgressBar, true)
131 .m_Close()
132 ENDIF
133
134 .oLog.LogResult(llRetVal)
135 .oLog.CloseLog()
136 ENDWITH
137
138 .SetMessage("")
139 .SetMousePointer(MOUSE_DEFAULT_DISPLAY)
140 v_SysUnLock(lcSyslockTablePath+"SYSLOCK", This.cJobId, "")
141
142 SELECT (lnSelect)
143 RETURN llRetVal
144
145 ENDFUNC
146
147** ----------------------------------------------------------------------------------------------------------- **
148
149 PROCEDURE RetrieveParamBROS
150 LOCAL llRetVal,lnSelect, lnIndex
151 *LOCAL lcDefaultSQLOrderString
152
153 llRetVal = .T.
154 lnSelect = SELECT()
155
156 WITH THIS
157 IF llRetVal
158 lnIndex = ASCAN(.aParamBROs,"PRM_JOURNAL_TYPE",1,ALEN(.aParamBROs,1),1,9)
159 IF llRetVal AND lnIndex > 0
160 .cJournalType = ALLTRIM(.aParamBROs[lnIndex, 2])
161 ELSE
162 .cJournalType = ""
163 ENDIF
164
165 .oLog.LogEntry("Journal Type Specified : "+ .cJournalType)
166
167 IF EMPTY(.cJournalType) OR NOT INLIST(.cJournalType,"BI","BC","BV") OR LEN(.cJournalType) > 2
168 .cMessage = "Invalid Journal Type."
169 .oLog.LogEntry(.cMessage)
170 llRetVal = .F.
171 ENDIF
172 ENDIF
173
174 IF llRetVal
175 IF .cJournalType != "BV"
176 IF "AP_INV" $ .cFilter
177 .cMessage = "Invalid filter for selected Journal Type - AP Invoice"
178 .oLog.LogEntry(.cMessage)
179 llRetVal = .F.
180 ENDIF
181 ENDIF
182 ENDIF
183
184 IF llRetVal
185 lnIndex = ASCAN(.aParamBROs,"PRM_VERS_CODE",1,ALEN(.aParamBROs,1),1,9)
186 IF llRetVal AND lnIndex > 0
187 .cVersionCode = ALLTRIM(.aParamBROs[lnIndex, 2])
188 ELSE
189 .cVersionCode = ""
190 ENDIF
191
192 .oLog.LogEntry("Version Code : "+ .cVersionCode)
193
194 IF EMPTY(.cVersionCode) OR NOT vl_map_version('AXEXPORT',,,.cVersionCode)
195 .cMessage = "Invalid Version Code."
196 .oLog.LogEntry(.cMessage)
197 llRetVal = .F.
198 ENDIF
199 ENDIF
200 ENDWITH
201
202 SELECT (lnSelect)
203 RETURN llRetVal
204 ENDPROC
205 **-----------------------------------------------------------------------------------------------------**
206
207 PROCEDURE PrepareAxOutCursor
208 LOCAL llRetVal, lnSelect, lcSQLString
209
210 llRetVal = true
211 lnSelect = SELECT()
212
213 WITH This
214 .cAxOutCur = "ZZGAXOUT_"+ GetUniqueFileName()
215
216 lcSQLString = "Select * from zzgaxout where 1 = 2 "
217
218 llRetVal = llRetVal and v_sqlExec(lcSQLString,.cAxOutCur)
219
220 ENDWITH
221
222 SELECT (lnSelect)
223 RETURN llRetVal
224 ENDPROC
225
226 **-----------------------------------------------------------------------------------------------------**
227
228 PROCEDURE PrepareFieldListForCSV
229 &&--- TechRec 1110276 28-Dec-2017 smullappilly === Added
230 LOCAL llRetVal, lnSelect, lcFieldCur, lcSQLString, lcfield_name, lcFormula
231
232 llRetVal = true
233 lnSelect = SELECT()
234
235 WITH This
236 lcFieldCur = GetUniqueFileName()
237 *--- TechRec 1110276 28-Dec-2017 smullappilly --- Added formula
238 lcSQLString = " select tbl_name, field_name, field_desc, output_pos, formula " + ;
239 " from zzyobrvd " + ;
240 " where map_code = 'AXEXPORT' " + ;
241 " and vers_code = " + SQLFormatChar(.cVersionCode) + ;
242 " order by output_pos "
243
244 llRetVal = llRetVal and v_sqlExec(lcSQLString,lcFieldCur)
245
246 SELECT (lcFieldCur)
247 SCAN
248 lcfield_name = UPPER(ALLTRIM(field_name))
249 lcFormula = ALLTRIM(formula) &&--- TechRec 1110276 28-Dec-2017 smullappilly ===
250
251 IF (.cJournalType == "BV") AND lcfield_name == "APPR_NUM"
252 LOOP
253 ENDIF
254
255 *--- TechRec 1110276 29-Dec-2017 smullappilly --- Commented below IF
256 *IF (.cJournalType == "BV") AND lcfield_name == "INV_TERMS"
257 * lcfield_name = "INV_TERMS AS TERMS_AP"
258 *ENDIF
259
260 *--- TechRec 1110276 28-Dec-2017 smullappilly ---
261 .cFieldListForCSVHdr = .cFieldListForCSVHdr + ALLTRIM(IIF(!EMPTY(.cFieldListForCSVHdr),","+lcfield_name, lcfield_name))
262
263 IF ALLTRIM(UPPER(tbl_name)) == "CUSTOM"
264 lcfield_name = lcFormula + ' As ' + lcfield_name
265 ELSE
266 IF INLIST(lcfield_name,"DOC_DATE","DUE_DATE","TRANS_DATE")
267 **-- Convert to Date to YYYY-MM-DD Format
268 lcfield_name = "CASE WHEN " + lcfield_name + " = '' THEN ' ' ELSE CONVERT(VARCHAR(10)," + lcfield_name + " , 120) END AS " + lcfield_name
269 ELSE
270 lcfield_name = lcfield_name + ' As ' + lcfield_name
271
272 IF (.cJournalType == "BV") AND UPPER(ALLTRIM(field_name)) == "INV_TERMS"
273 lcfield_name = "INV_TERMS AS TERMS_AP"
274 ENDIF
275 ENDIF
276 ENDIF
277 *=== TechRec 1110276 28-Dec-2017 smullappilly ===
278
279 .cFieldListForCSV = .cFieldListForCSV + ALLTRIM(IIF(!EMPTY(.cFieldListForCSV),", "+lcfield_name, lcfield_name))
280 ENDSCAN
281
282 ENDWITH
283
284 SELECT (lnSelect)
285 RETURN llRetVal
286 ENDPROC
287
288 **-----------------------------------------------------------------------------------------------------**
289
290 *--- TechRec 1103983 22-Aug-2017 vkrishnamurthy ---
291 *============================================================
292 FUNCTION LoadAXObjects
293 LOCAL llRetVal, lnSelect
294
295 llRetVal = true
296 lnSelect = SELECT()
297
298 WITH This
299 IF .cJournalType = "BV"
300 lcClass = "Exp_BPOAXAPOutbound"
301 ELSE
302 lcClass = "Exp_BPOAXLedgerOutbound"
303 ENDIF
304 .oAX = CREATEOBJECT(lcClass)
305 llRetVal = llRetVal AND IsObject(.oAX, true)
306
307 IF llRetVal
308 .oAX.oLog = This.oLog
309 .oAX.cFilter = This.cFilter
310 .oAX.lSuppressApiOutput = This.lSuppressApiOutput
311 .oAX.cJournalType = This.cJournalType
312 .oAX.cAxOutCur = This.cAxOutCur
313 .oAX.cFieldListForCSV = This.cFieldListForCSV
314 .oAX.cVersionCode = This.cVersionCode
315 ENDIF
316 ENDWITH
317
318 SELECT (lnSelect)
319 RETURN llRetVal
320 ENDFUNC
321 *=========================================================================
322 *=== TechRec 1103983 22-Aug-2017 vkrishnamurthy ===
323
324 PROCEDURE SendToAXExpInCSV
325
326 LOCAL llRetVal, lnSelect, lcSql, lnCount, lcDatetimeString, lcOutboundDir, lcOutboundFileName
327
328 llRetVal = true
329 lnSelect = SELECT()
330
331 WITH This
332
333 lcOutboundDir = goEnv.SYSTEMPARM(SP_PATH_INTERFACEOB)
334 lcDatetimeString = CurrentDateTimeAsString()
335
336 lnCount = v_nextcounter('ZZGAXOUT', 'BATCH_NUM')
337
338 SELECT(This.cAxOutCur)
339 Replace ALL pkey WITH RECNO(), batch_num WITH lnCount
340 *--- TechRec 1110276 19-Dec-2017 smullappilly ---
341 Replace ALL Import_Batch WITH ALLTRIM(STR(lnCount,20,0))
342 *=== TechRec 1110276 19-Dec-2017 smullappilly ===
343 LOCATE
344
345 *--- TechRec 1110276 29-Dec-2017 smullappilly ---
346 *lcOutboundFileName = "S"+SUBSTR(.cJournalType,2,1)+ALLTRIM(STR(lnCount,10,0))
347 lcOutboundFileName = ALLTRIM(.cJournalType)+ALLTRIM(STR(lnCount,10,0))
348 *=== TechRec 1110276 29-Dec-2017 smullappilly ===
349 lcOutboundFileName = lcOutboundFileName+"_"+ALLTRIM(lcDatetimeString)+".csv"
350 lcOutboundFileName = ADDBS(lcOutboundDir)+lcOutboundFileName
351
352 llRetVal = llRetVal AND This.generatesqltemptable(This.cAxOutCur) and This.populatesqltemptable(This.cAxOutCur) &&--- TechRec 1110276 29-Dec-2017 smullappilly ===
353
354 *--- TechRec 1110276 29-Dec-2017 smullappilly ---
355*!* lcSql = " Select " + This.cFieldListForCSV + ;
356*!* " from " + This.cAxOutCur + ;
357*!* " into Cursor Cur_AxoutCSV "
358*!*
359*!* &lcSql
360
361 lcSql = "Select " + This.cFieldListForCSV + " from " + This.cSQLTempTable + " Order by journal_type, curr_code, company, ref_num "
362
363 llRetVal = llRetVal and v_sqlExec(lcSql,"Cur_AxoutCSV")
364 *=== TechRec 1110276 29-Dec-2017 smullappilly ===
365
366 **-- Create the below cursor at the starting of this program.
367 llRetVal = llRetVal AND vl_map_version('AXEXPORT', ,"tcMapCursor" , This.cVersionCode)
368 llRetVal = llRetVal AND USED("tcMapCursor") AND RECCOUNT("tcMapCursor") > 0
369
370 IF llRetVal
371 lCSVHeaderRow = (SysGetFieldValue("tcMapCursor", "File_Hdr") = 'Y')
372 lcFileType = SysGetFieldValue("tcMapCursor", "File_Type")
373
374 SELECT Cur_AxoutCSV
375
376 lcDelimiter = SysGetFieldValue("tcMapCursor", "Separator")
377 lcDelimiter = IIF(EMPTY(lcDelimiter ),",",lcDelimiter )
378 IF lcDelimiter = "," THEN
379 llSuppressDblQuotes = SysGetFieldValue("tcMapCursor", "sup_dbl_quotes")='Y'
380 IF llSuppressDblQuotes
381 Copy To (lcOutboundFileName) TYPE DELIMITED WITH ""
382 .InsertDummyCSVHeader(lcOutboundFileName) &&--- TechRec 1110276 09-Jan-2018 smullappilly ===
383 ELSE
384 Copy To (lcOutboundFileName) Type CSV
385 ENDIF
386 ELSE
387 Copy To (lcOutboundFileName) Type DELIMITED WITH "" WITH CHARACTER &lcDelimiter
388 .InsertDummyCSVHeader(lcOutboundFileName) &&--- TechRec 1110276 09-Jan-2018 smullappilly ===
389 ENDIF
390 ENDIF
391
392 IF USED("Cur_AxoutCSV")
393 USE IN "Cur_AxoutCSV"
394 ENDIF
395
396 *--- TechRec 1110276 29-Dec-2017 smullappilly --- Commenting below line as it is handling above.
397 * llRetVal = llRetVal AND This.generatesqltemptable(This.cAxOutCur) and This.populatesqltemptable(This.cAxOutCur)
398
399 loSB = NEWOBJECT("SQLStringBuilder","clsgnstr.fxp")
400 WITH loSB
401 .SB_Reset()
402 .cSB_Target = "ZZGAXOUT"
403 .cSB_Source = This.cSQLTempTable
404 .cSB_SourceAlias = "T"
405
406 llRetVal = .SB_GenerateSQLInsertString()
407 llRetVal = llRetVal AND v_SQLExec(.cSQLString)
408 ENDWITH
409
410 ENDWITH
411
412 SELECT (lnSelect)
413 RETURN llRetVal
414 ENDPROC
415 *=========================================================================
416
417 *--- TechRec 1110276 09-Jan-2018 smullappilly ---
418 FUNCTION InsertDummyCSVHeader
419 LPARAMETERS tcSourceFile
420
421 LOCAL llRetVal
422 LOCAL lnReadBlock, lnSourceFileHandle, lnEnd, lnTop
423 LOCAL lcError, lcTargetFile, lcReadBuffer
424
425 llRetVal = .T.
426 lnReadBlock = 512 * 1024
427
428 lcTargetFile = ADDBS(JUSTPATH(tcSourceFile)) + SYS(3) +".tmp"
429
430 lnSourceFileHandle = FOPEN(tcSourceFile, 0)
431 IF (lnSourceFileHandle = -1)
432 llRetVal = .F.
433 lcError = "Could not open source file"
434 ENDIF
435
436 lnEnd = FSEEK(lnSourceFileHandle, 0, 2) && Move pointer to EOF
437 lnTop = FSEEK(lnSourceFileHandle, 0) && Move pointer to BOF
438
439 IF (lnEnd < 1) && is file empty?
440 llRetVal = .F.
441 lcError = "File is empty"
442 ENDIF
443
444 IF (llRetVal)
445 lnTargetFileHandle = FCREATE(lcTargetFile)
446 IF (lnTargetFileHandle = -1)
447 llRetVal = .F.
448 lcError = "Could not create temp file"
449 ENDIF
450 ENDIF
451
452 lRetVal = llRetVal AND (FWRITE(lnTargetFileHandle, This.cFieldListForCSVHdr)>0)
453
454 IF (llRetVal)
455
456 IF NOT (FPUTS(lnTargetFileHandle, "") = 2)
457 llRetVal = .F.
458 ENDIF
459 IF NOT (llRetVal)
460 lcError = "Failed to Create Dummy Header " + lcTargetFile
461 ENDIF
462
463 DO WHILE (llRetVal) AND NOT FEOF(lnSourceFileHandle)
464 lcReadBuffer = FREAD(lnSourceFileHandle, lnReadBlock)
465 IF FWRITE(lnTargetFileHandle, lcReadBuffer) < LEN(lcReadBuffer)
466 llRetVal = .f.
467 lcError = "Failed to Write to " + lcTargetFile
468 ENDIF
469 ENDDO
470 ENDIF
471
472 IF (llRetVAl)
473 FCLOSE(lnSourceFileHandle)
474 FCLOSE(lnTargetFileHandle)
475
476 ERASE "&tcSourceFile"
477 tcSourceFile = UPPER(tcSourceFile)
478 RENAME "&lcTargetFile" TO "&tcSourceFile"
479 ELSE
480 FCLOSE(lnSourceFileHandle)
481
482 This.oLog.LogEntry("Couldn't Insert Dummy Header because " + lcError)
483 ENDIF
484
485 RETURN (llRetVal)
486 ENDFUNC
487 *=== TechRec 1110276 09-Jan-2018 smullappilly ===
488
489ENDDEFINE
490
491
492*--- TechRec 1103983 21-Aug-2017 vkrishnamurthy ---
493*============================================================
494DEFINE CLASS Exp_BPOAXLedgerOutbound as BPOAXLedgerOutbound
495
496 PROCEDURE PopulateAxOutCursor
497 &&--- TechRec 1110276 26-Dec-2017 smullappilly === Added tcAcctNum as second Parameter
498 &&--- TechRec 1110276 27-Dec-2017 smullappilly === Moved 'tcAxOutCur' as first parameter
499 &&--- TechRec 1110276 27-Dec-2017 smullappilly === Added 'tdDueDate', 'tnAmount'
500 LPARAMETERS tcAxOutCur, toDetail, tcAcctNum, tnTrxType, tcPayMode, tdDueDate, tnAmount
501
502 LOCAL llRetVal, lnSelect
503
504 llRetVal = true
505 lnSelect = SELECT()
506
507 WITH This
508
509 *--- TechRec 1110276 27-Dec-2017 smullappilly ---Commented IF
510 *IF VARTYPE(tcPayMode) = 'L'
511 * tcPayMode = ""
512 *ENDIF
513 *=== TechRec 1110276 27-Dec-2017 smullappilly ===
514
515 SELECT (tcAxOutCur)
516 APPEND BLANK
517 toDetail.Debit_Amt = 0 &&--- TechRec 1110276 29-Dec-2017 smullappilly ===
518 toDetail.Credit_Amt = 0 &&--- TechRec 1110276 29-Dec-2017 smullappilly ===
519 GATHER NAME toDetail MEMO &&--- TechRec 1110276 29-Dec-2017 smullappilly ===
520
521 *--- TechRec 1110276 29-Dec-2017 smullappilly --- Commenting below REPLACE as GATHER statement using above.
522*!* REPLACE Import_Batch WITH toDetail.Import_Batch, Journal_Type WITH toDetail.Journal_Type, ;
523*!* Company WITH toDetail.Company, Debit_Amt WITH toDetail.Debit_Amt, Credit_Amt WITH toDetail.Credit_Amt, ;
524*!* Curr_Code WITH toDetail.Curr_Code, Ref_Num WITH toDetail.Ref_Num, Acct_Num WITH toDetail.Acct_Num, ;
525*!* Trans_date WITH toDetail.Trans_date, Inv_Terms WITH toDetail.Inv_Terms
526
527 Replace Doc_Num WITH toDetail.Ref_Num, DOC_Date WITH toDetail.Trans_date, Due_Date WITH tdDueDate, ;
528 Acct_Num WITH tcAcctNum, Inv_Terms WITH toDetail.Inv_Terms
529
530 IF ALLTRIM(UPPER(toDetail.debit_credit)) == "DB"
531 Replace Debit_Amt WITH tnAmount
532 ELSE
533 Replace Credit_Amt WITH tnAmount
534 ENDIF
535 *=== TechRec 1110276 29-Dec-2017 smullappilly ===
536
537 REPLACE Acct_Type WITH tnTrxType, Pay_Mode WITH tcPayMode
538 ENDWITH
539
540 SELECT (lnSelect)
541 RETURN llRetVal
542 ENDPROC
543
544ENDDEFINE
545*=========================================================================
546DEFINE CLASS Exp_BPOAXAPOutbound as BPOAXAPOutbound
547
548 PROCEDURE PopulateAxOutCursor
549 &&--- TechRec 1110276 26-Dec-2017 smullappilly === Added tcAcctNum as second Parameter
550 &&--- TechRec 1110276 27-Dec-2017 smullappilly === Moved 'tcAxOutCur' as first parameter
551 &&--- TechRec 1110276 27-Dec-2017 smullappilly === Added 'tdDueDate', 'tnAmount'
552 LPARAMETERS tcAxOutCur, toDetail, tcAcctNum, tnTrxType, tcPayMode, tdDueDate, tnAmount
553
554 LOCAL llRetVal, lnSelect
555
556 llRetVal = true
557 lnSelect = SELECT()
558
559 WITH This
560
561 *--- TechRec 1110276 27-Dec-2017 smullappilly --- Commented IF
562 *IF VARTYPE(tcPayMode) = 'L'
563 * tcPayMode = ""
564 *ENDIF
565 *=== TechRec 1110276 27-Dec-2017 smullappilly ===
566
567 SELECT (tcAxOutCur)
568 APPEND BLANK
569 toDetail.Debit_Amt = 0 &&--- TechRec 1110276 29-Dec-2017 smullappilly ===
570 toDetail.Credit_Amt = 0 &&--- TechRec 1110276 29-Dec-2017 smullappilly ===
571 GATHER NAME toDetail MEMO &&--- TechRec 1110276 29-Dec-2017 smullappilly ===
572
573 *--- TechRec 1110276 29-Dec-2017 smullappilly --- Commenting below REPLACE as GATHER statement using above.
574*!* REPLACE Import_Batch WITH toDetail.Import_Batch, Journal_Type WITH toDetail.Journal_Type, ;
575*!* Company WITH toDetail.Company, Debit_Amt WITH toDetail.Debit_Amt, Credit_Amt WITH toDetail.Credit_Amt, ;
576*!* Curr_Code WITH toDetail.Curr_Code, Ref_Num WITH toDetail.Ref_Num, Acct_Num WITH toDetail.Acct_Num, ;
577*!* Trans_date WITH toDetail.Trans_date, Inv_Terms WITH toDetail.terms_ap, ;
578*!* ap_qty WITH toDetail.ap_qty
579
580 Replace Doc_Num WITH toDetail.ref_num, DOC_Date WITH toDetail.ap_date, Due_Date WITH tdDueDate, ;
581 Acct_Num WITH tcAcctNum, Inv_Terms WITH toDetail.terms_ap, ref_num WITH toDetail.ap_inv
582
583 IF ALLTRIM(UPPER(toDetail.debit_credit)) == "DB"
584 Replace Debit_Amt WITH tnAmount
585 ELSE
586 Replace Credit_Amt WITH tnAmount
587 ENDIF
588 *=== TechRec 1110276 29-Dec-2017 smullappilly ===
589
590 REPLACE Acct_Type WITH tnTrxType, Pay_Mode WITH tcPayMode
591
592 ENDWITH
593
594 SELECT (lnSelect)
595 RETURN llRetVal
596 ENDPROC
597
598ENDDEFINE
599*=========================================================================
600*=== TechRec 1103983 21-Aug-2017 vkrishnamurthy ===