-
Notifications
You must be signed in to change notification settings - Fork 0
/
fixhypsales.prg
259 lines (231 loc) · 5.3 KB
/
fixhypsales.prg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
*
* Correcting the parts in Hallmark's Hyundai/VW Sale History.
*
CLOSE DATABASES ALL
SET EXCLUSIVE OFF
SET SAFETY OFF
SET DELETE ON
*!* SET DEFAULT TO "N:\APPS\ACSS"
_VFP.CAPTION = "Fixing Hallmark's Hyundai/VW Sales History"
PRIVATE ival1, ival2, ival3, ival4, ival5, ival6, jpart, ppart, rpart, rpartindex
PRIVATE jpartindex, ppartindex, rpartindex
ival1 = 0
ival2 = 0
ival3 = 0
ival4 = 0
ival5 = 0
ival6 = 0
jpart = ""
ppart = ""
rpart = ""
jpartindex = ""
ppartindex = ""
rpartindex = ""
@04,2 SAY "This program will correct the Hallmark's Hyundai/VW Sales "
@05,2 SAY "History with the Orig. Hallmark's Sales History from the "
@06,2 SAY "uploaded data. Press [ESC] to quit."
@10,2 SAY "PRTADJ01 #1 (HYUN) = "
@11,2 SAY "PRTADJ02 #2 (HYUN) = "
@12,2 SAY "PRTINQ01 #1 (HYUN) = "
@13,2 SAY "PRTINQ02 #2 (HYUN) = "
@14,2 SAY "PSALES01 #1 (HYUN) = "
@15,2 SAY "PSALES02 #2 (HYUN) = "
SELECT 0
USE "N:\APPS\ACSS\pmast01.DBF" SHARED ALIAS p01 && Correct File
SELECT 0
USE "N:\APPS\ACSS\prtadj01.DBF" SHARED ALIAS p02 && Incorrect File
INDEX ON STRTRAN(UPPER(ALLTRIM(p02.pj_part)),'-') TO l
GO TOP
SELECT p01
DO WHILE !EOF()
IF ALLTRIM(p01.pm_source) != "HYUN"
SKIP
LOOP
ENDIF
jpart = STRTRAN(UPPER(ALLTRIM(p01.pm_part)),'-')
*!* IF jpart = "1J0863323R4TE"
*!* SET STEP ON
*!* ENDIF
SELECT p02
SEEK jpart
IF FOUND()
jpartindex = ALLTRIM(p02.pj_part)
DO WHILE jpartindex == ALLTRIM(p02.pj_part)
REPLACE p02.pj_part WITH p01.pm_part
* REPLACE p02.pm_oldsrc WITH ""
* REPLACE p02.pm_newsrc WITH ""
ival1 = ival1 + 1
@10,28 SAY ival1
SKIP
ENDDO
ENDIF
SELECT p01
SKIP
ENDDO
CLOSE DATA ALL
SELECT 0
USE "N:\APPS\ACSS\pmast02.DBF" SHARED ALIAS p01 && Correct File
SELECT 0
USE "N:\APPS\ACSS\prtadj02.DBF" SHARED ALIAS p02 && Incorrect File
INDEX ON STRTRAN(UPPER(ALLTRIM(p02.pj_part)),'-') TO l
GO TOP
SELECT p01
DO WHILE !EOF()
IF ALLTRIM(p01.pm_source) != "HYUN"
SKIP
LOOP
ENDIF
jpart = STRTRAN(UPPER(ALLTRIM(p01.pm_part)),'-')
*!* IF jpart = "1J0863323R4TE"
*!* SET STEP ON
*!* ENDIF
SELECT p02
SEEK jpart
IF FOUND()
jpartindex = ALLTRIM(p02.pj_part)
DO WHILE jpartindex == ALLTRIM(p02.pj_part)
REPLACE p02.pj_part WITH p01.pm_part
* REPLACE p02.pm_oldsrc WITH ""
* REPLACE p02.pm_newsrc WITH ""
ival2 = ival2 + 1
@11,28 SAY ival2
SKIP
ENDDO
ENDIF
SELECT p01
SKIP
ENDDO
CLOSE DATA ALL
SELECT 0
USE "N:\APPS\ACSS\pmast01.DBF" SHARED ALIAS p01 && Correct File
SELECT 0
USE "N:\APPS\ACSS\prtinq01.DBF" SHARED ALIAS p02 && Incorrect File
INDEX ON STRTRAN(UPPER(ALLTRIM(p02.pih_part)),'-') TO l
GO TOP
SELECT p01
DO WHILE !EOF()
IF ALLTRIM(p01.pm_source) != "HYUN"
SKIP
LOOP
ENDIF
ppart = STRTRAN(UPPER(ALLTRIM(p01.pm_part)),'-')
*!* IF ppart = "1J0863323R4TE"
*!* SET STEP ON
*!* ENDIF
SELECT p02
SEEK ppart
IF FOUND()
ppartindex = ALLTRIM(p02.pih_part)
DO WHILE ppartindex == ALLTRIM(p02.pih_part)
REPLACE p02.pih_part WITH p01.pm_part
REPLACE p02.pih_desc WITH p01.pm_desc
ival3 = ival3 + 1
@12,28 SAY ival3
SKIP
ENDDO
ENDIF
SELECT p01
SKIP
ENDDO
CLOSE DATA ALL
SELECT 0
USE "N:\APPS\ACSS\pmast02.DBF" SHARED ALIAS p01 && Correct File
SELECT 0
USE "N:\APPS\ACSS\prtinq02.DBF" SHARED ALIAS p02 && Incorrect File
INDEX ON STRTRAN(UPPER(ALLTRIM(p02.pih_part)),'-') TO l
GO TOP
SELECT p01
DO WHILE !EOF()
IF ALLTRIM(p01.pm_source) != "HYUN"
SKIP
LOOP
ENDIF
ppart = STRTRAN(UPPER(ALLTRIM(p01.pm_part)),'-')
*!* IF ppart = "1J0863323R4TE"
*!* SET STEP ON
*!* ENDIF
SELECT p02
SEEK ppart
IF FOUND()
ppartindex = ALLTRIM(p02.pih_part)
DO WHILE ppartindex == ALLTRIM(p02.pih_part)
REPLACE p02.pih_part WITH p01.pm_part
REPLACE p02.pih_desc WITH p01.pm_desc
ival4 = ival4 + 1
@13,28 SAY ival4
SKIP
ENDDO
ENDIF
SELECT p01
SKIP
ENDDO
CLOSE DATA ALL
SELECT 0
USE "N:\APPS\ACSS\pmast01.DBF" SHARED ALIAS p01 && Correct File
SELECT 0
USE "N:\APPS\ACSS\psales01.DBF" SHARED ALIAS p02 && Incorrect File
INDEX ON STRTRAN(UPPER(ALLTRIM(p02.ri_part)),'-') TO l
GO TOP
SELECT p01
DO WHILE !EOF()
IF ALLTRIM(p01.pm_source) != "HYUN"
SKIP
LOOP
ENDIF
rpart = STRTRAN(UPPER(ALLTRIM(p01.pm_part)),'-')
*!* IF rpart = "8340229031"
*!* SET STEP ON
*!* ENDIF
SELECT p02
SEEK rpart
IF FOUND()
rpartindex = ALLTRIM(p02.ri_part)
DO WHILE rpartindex == ALLTRIM(p02.ri_part)
REPLACE p02.ri_part WITH p01.pm_part
* REPLACE p02.ri_srce WITH p01.ri_srce
ival5 = ival5 + 1
@14,28 SAY ival5
SKIP
ENDDO
ENDIF
SELECT p01
SKIP
ENDDO
CLOSE DATA ALL
SELECT 0
USE "N:\APPS\ACSS\pmast02.DBF" SHARED ALIAS p01 && Correct File
SELECT 0
USE "N:\APPS\ACSS\psales02.DBF" SHARED ALIAS p02 && Incorrect File
INDEX ON STRTRAN(UPPER(ALLTRIM(p02.ri_part)),'-') TO l
GO TOP
SELECT p01
DO WHILE !EOF()
IF ALLTRIM(p01.pm_source) != "HYUN"
SKIP
LOOP
ENDIF
rpart = STRTRAN(UPPER(ALLTRIM(p01.pm_part)),'-')
*!* IF rpart = "8340229031"
*!* SET STEP ON
*!* ENDIF
SELECT p02
SEEK rpart
IF FOUND()
rpartindex = ALLTRIM(p02.ri_part)
DO WHILE rpartindex == ALLTRIM(p02.ri_part)
REPLACE p02.ri_part WITH p01.pm_part
* REPLACE p02.ri_srce WITH p01.pm_source
ival6 = ival6 + 1
@15,28 SAY ival6
SKIP
ENDDO
ENDIF
SELECT p01
SKIP
ENDDO
CLOSE DATA ALL
@17,2 SAY "The operation(s) is completed."
INKEY(5)
CLOSE DATABASES ALL
RETURN