source: WorldVistAEHR/trunk/r/VOLUNTARY_TIMEKEEPING-ABSV/ABSVMRV1.m@ 1087

Last change on this file since 1087 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 3.5 KB
Line 
1ABSVMRV1 ;OAKLANDFO/DPC-VSS MIGRATION;7/23/2002
2 ;;4.0;VOLUNTARY TIMEKEEPING;*31*;Jul 1994
3 ;
4 ;Reference file validation
5ORGVAL(FLAG,VALRES) ;
6 N ORGIEN,ORG0,ORGIDEN
7 N CODE
8 K ^TMP("ABSVM",$J,"ORGCODES")
9 S VALRES("ERRCNT")=0
10 S VALRES("DA")=$$CRERRLOG^ABSVMUT1("G",$G(FLAG))
11 I VALRES("DA")=0 W !,"There was an error creating VALIDATION RESULTS entry for Organizations." Q
12 S ORGIEN=899
13 F S ORGIEN=$O(^ABS(503334,ORGIEN)) Q:ORGIEN="" D
14 . N ERRS
15 . S ERRS=0
16 . S ORG0=$G(^ABS(503334,ORGIEN,0))
17 . S ORGIDEN="Volunteer Organizations Codes record #"_ORGIEN
18 . I ORG0="" D ADDERR^ABSVMVV1(ORGIDEN_" does not exist.",.ERRS) Q
19 . ;CODE
20 . D
21 . . S CODE=$P(ORG0,U)
22 . . I CODE="" D ADDERR^ABSVMVV1(ORGIDEN_" is missing a Code.",.ERRS) Q
23 . . I CODE'?3N D ADDERR^ABSVMVV1(ORGIDEN_" has an incorrect Code.",.ERRS) Q
24 . . I $D(^TMP("ABSVM",$J,"ORGCODES",CODE)) D ADDERR^ABSVMVV1(ORGIDEN_" has a duplicate Code of "_CODE_" with record #"_$G(^TMP("ABSVM",$J,"ORGOCDES",CODE))_".",.ERRS) Q
25 . . S ^TMP("ABSVM",$J,"ORGCODES",CODE)=ORGIEN ;array of local org codes.
26 . . S OCDS(ORGIEN)="" ;array of acceptable Org Code entries.
27 . ;ORG NAME
28 . I $P(ORG0,U,2)="" D ADDERR^ABSVMVV1(ORGIDEN_" is missing an organization name.",.ERRS)
29 . I $L($P(ORG0,U,2))>35 D ADDERR^ABSVMVV1(ORGIDEN_" has an Organization Name that is longer than 35 characters.",.ERRS)
30 . ;ABBREV.
31 . I $L($P(ORG0,U,3))>6!($L($P(ORG0,U,4))>6) D ADDERR^ABSVMVV1(ORGIDEN_" has an Abbreviation longer than 6 characters.",.ERRS)
32 . ;INACTIVE
33 . I ",0,1,,"'[(","_$P(ORG0,U,5)_",") D ADDERR^ABSVMVV1(ORGIDEN_" has an invalid Inactive Code.",.ERRS)
34 . I ERRS>0 D RECERR^ABSVMUT1(.VALRES,.ERRS) Q
35 . S OCDS(ORGIEN)="" ;Array of good org IENS for validating hours.
36 . I $G(FLAG)["S" S ^XTMP("ABSVMORG","IEN",ORGIEN)=""
37 . Q
38 D ERRCNT^ABSVMUT1(.VALRES)
39 K ^TMP("ABSVM",$J,"ORGCODE")
40 Q
41 ;
42SRVVAL(FLAG,VALRES) ;
43 N SRVIEN,SRV0,SRVIDEN
44 N CODE,SRVNAME
45 K ^TMP("ABSVM",$J,"SRVCODES")
46 S VALRES("ERRCNT")=0
47 S VALRES("DA")=$$CRERRLOG^ABSVMUT1("S",$G(FLAG))
48 I VALRES("DA")=0 W !,"There was an error creating VALIDATION RESULTS entry for Services." Q
49 S SRVIEN=0
50 F S SRVIEN=$O(^ABS(503332,SRVIEN)) Q:SRVIEN="" D
51 . N ERRS,LOWCODE
52 . S ERRS=0
53 . S SRV0=$G(^ABS(503332,SRVIEN,0))
54 . S SRVIDEN="Voluntary Service Assignment Codes record #"_SRVIEN
55 . I SRV0="" D ADDERR^ABSVMVV1(SRVIDEN_" does not exist.",.ERRS) Q
56 . ;CODE
57 . D Q:LOWCODE
58 . . S LOWCODE=0
59 . . S CODE=$P(SRV0,U)
60 . . I CODE="" D ADDERR^ABSVMVV1(SRVIDEN_" is missing a Code.",.ERRS) Q
61 . . I CODE'?3N.1A D ADDERR^ABSVMVV1(SRVIDEN_" has an incorrect Code.",.ERRS) Q
62 . . I CODE<800 S LOWCODE=1 Q
63 . . I $D(^TMP("ABSVM",$J,"SRVCODES",CODE)) D ADDERR^ABSVMVV1(SRVIDEN_" has a duplicate Code of "_CODE_" with record #"_^TMP("ABSVM",$J,"SRVCODES",CODE)_".",.ERRS) Q
64 . . S ^TMP("ABSVM",$J,"SRVCODES",CODE)=SRVIEN ;Array of local service codes.
65 . . S SCDS(SRVIEN)="" ;Array of usable service code IENs
66 . ;SERVICE NAME
67 . S SRVNAME=$P(SRV0,U,2)
68 . I SRVNAME="" D ADDERR^ABSVMVV1(SRVIDEN_" is missing service name.",.ERRS)
69 . I $L($P(SRVNAME,"-"))>35 D ADDERR^ABSVMVV1(SRVIDEN_" has Service Name that is longer than 35 characters.",.ERRS)
70 . I $L($P(SRVNAME,"-",2))>30 D ADDERR^ABSVMVV1(SRVIDEN_" has a Service Subdivision longer than 30 characters.",.ERRS)
71 . ;ABBREV.
72 . I $L($P(SRV0,U,3))>7 D ADDERR^ABSVMVV1(SRVIDEN_" has an Abbreviation longer than 6 characters.",.ERRS)
73 . I ERRS>0 D RECERR^ABSVMUT1(.VALRES,.ERRS) Q
74 . S SCDS(SRVIEN)="" ;Array of good service IENS used in hours' validation.
75 . I $G(FLAG)="S" S ^XTMP("ABSVMSERV","IEN",SRVIEN)=""
76 . Q
77 D ERRCNT^ABSVMUT1(.VALRES)
78 K ^TMP("ABSVM",$J,"SRVCODE")
79 Q
Note: See TracBrowser for help on using the repository browser.