275 lines
6.1 KiB
Plaintext
275 lines
6.1 KiB
Plaintext
Subroutine Print_WO_Master_Scheduler(Date, Preview)
|
|
/********************************************************************************************************
|
|
|
|
This program is proprietary and is not to be used by or disclosed to others, nor is it to
|
|
be copied without written permission from SRP Computer Solutions, Inc.
|
|
|
|
Name : Print WO Master Scheduler
|
|
|
|
Description :
|
|
|
|
Tags : [SRP]
|
|
|
|
Parameters :
|
|
|
|
History (Date, Initials, Notes)
|
|
12/02/09 fjt Initial development
|
|
05/17/10 fjt Updated to select based on date span field
|
|
|
|
********************************************************************************************************/
|
|
|
|
$insert SRP_APP_INSERTS
|
|
$insert OIPI_FONTS
|
|
|
|
Declare subroutine Extract_SI_Keys, Update_Index
|
|
Declare function Init_OIPI, Set_Printer_Object
|
|
|
|
Process = 0
|
|
Loop
|
|
Process += 1
|
|
Utility("CURSOR", 'H')
|
|
On Process GoSub Init, Appts, OIPI, Pages, Term
|
|
Utility("CURSOR", 'A')
|
|
Until Term
|
|
Repeat
|
|
|
|
Return
|
|
|
|
|
|
!----- INTERNAL ROUTINES --------------------------------------------------------------------------------
|
|
|
|
|
|
Init:
|
|
If Assigned(Preview) else Preview = Yes$
|
|
If Assigned(Date) else Date = ""
|
|
|
|
If Date EQ "" then Date = Date()
|
|
|
|
Equ PageW$ to 08.00
|
|
Equ PageH$ to 10.50
|
|
Equ Sched_Win$ to "WO_MASTER_SCHEDULER"
|
|
Equ Ctrl$ to Sched_Win$:".OLE_SCHEDULE"
|
|
|
|
Table = "WO_MAST_SCHED"
|
|
Term = No$
|
|
rv = ""
|
|
rv2 = ""
|
|
rv3 = ""
|
|
Val = ""
|
|
Dates = ""
|
|
|
|
// Schedule data grid
|
|
Dim Appts(70,3)
|
|
Mat Appts = ""
|
|
|
|
// Three days to display
|
|
For i = 0 to 2
|
|
Dates<-1> = OConv(Date+i, "DWA") :" - ": OConv(Date+i, "DL")
|
|
Next i
|
|
return
|
|
|
|
|
|
Appts:
|
|
// Build list of keys that fall on the three days
|
|
Keys = ""
|
|
Field = "DATE_SPAN_XREF"
|
|
Update_Index(Table, Field, No$, Yes$)
|
|
For i = 0 to 2
|
|
Extract_SI_Keys(Table, Field, Date+i, rv)
|
|
Keys<-1> = rv
|
|
rv = ""
|
|
Next i
|
|
|
|
// Get the date for each appointment
|
|
Ctrl = @Window:".OLE_SCHEDULE"
|
|
For i = 1 to 3
|
|
Cnt = Count(Keys<i>, @VM) + (Keys<i> NE "")
|
|
For c = 1 to Cnt
|
|
rv = Get_Property(Ctrl$, "OLE.Appt[":Keys<i,c>:"]")
|
|
Desc = rv<7>
|
|
Swap Char(13):Char(10) with @VM in Desc
|
|
If Appts(rv<1>,i) EQ "" then
|
|
Appts(rv<1>,i) = rv<6> :@VM: Desc
|
|
end else
|
|
Appts(rv<1>,i) = Appts(rv<1>,i) :@RM: rv<6> :@VM: Desc
|
|
end
|
|
Next c
|
|
Next i
|
|
return
|
|
|
|
|
|
OIPI:
|
|
Title = "WOMS"
|
|
Param = ""
|
|
Param<1> = Preview
|
|
Param<02> = Title
|
|
Param<04> = 0 ;// Portrait
|
|
Param<05> = 0.25
|
|
Param<06> = 0.25
|
|
Param<07> = 0.25
|
|
Param<08> = 0.25
|
|
|
|
rv = Init_OIPI(Param)
|
|
If (rv NE Yes$) then Term = Yes$
|
|
return
|
|
|
|
|
|
Pages:
|
|
For p = 1 to 2
|
|
x = 0
|
|
y = 0
|
|
GoSub Header.1
|
|
GoSub Header.2
|
|
GoSub Schedule_Grid
|
|
GoSub Reactors
|
|
GoSub Appointments
|
|
If p EQ 1 then rv = Set_Printer("PAGEBREAK")
|
|
Next p
|
|
return
|
|
|
|
|
|
Term:
|
|
rv = Set_Printer("TERM")
|
|
Term = Yes$
|
|
return
|
|
|
|
|
|
!----- PAGE SECTIONS ------------------------------------------------------------------------------------
|
|
|
|
|
|
Header.1:
|
|
Range = Oconv(Date, "D4/") :" to ": Oconv(Date+3, "D4/")
|
|
|
|
rv = 0 :@VM: y :@VM: PageW$ :@VM: "^REACTOR MASTER SCHEDULE"
|
|
rv = Set_Printer_Object("T", rv, Tahoma(12,2))
|
|
|
|
y += 12/64
|
|
|
|
Begin Case
|
|
Case p EQ 1 ; Val = "Reactors 20-45"
|
|
Case p EQ 2 ; Val = "Reactors 46-69"
|
|
End Case
|
|
|
|
rv = 0 :@VM: y :@VM: PageW$ :@VM: "^" : Range : Space(2):Char(149):Space(2) : Val
|
|
rv = Set_Printer_Object("T", rv, Tahoma(9,1))
|
|
|
|
y += 12/64
|
|
return
|
|
|
|
|
|
Header.2:
|
|
ApptCol = (PageW$ - .50) / 3
|
|
|
|
Cols = ""
|
|
Cols<1> = .00 :@VM: .50 :@VM: "REACT"
|
|
Cols<2> = Cols<1,2> :@VM: Cols<1,2> + ApptCol :@VM: Dates<1>
|
|
Cols<3> = Cols<2,2> :@VM: Cols<2,2> + ApptCol :@VM: Dates<2>
|
|
Cols<4> = Cols<3,2> :@VM: Cols<3,2> + ApptCol :@VM: Dates<3>
|
|
|
|
For i = 1 to 4
|
|
w = ApptCol
|
|
If i EQ 1 then w = .50
|
|
|
|
rv := Cols<i,1> :@VM: y :@VM: Cols<i,2> :@VM: y + 12/64 :@FM
|
|
rv2 := Cols<i,1> :@VM: y + 1/64 :@VM: w :@VM: "^":Cols<i,3> :@FM
|
|
If i LT 4 then
|
|
rv3 := Cols<i,2> :@VM: y :@VM: Cols<i,2> :@VM: y + 12/64 :@FM
|
|
end
|
|
Next i
|
|
rv = Set_Printer_Object("R", rv, "", "", Black$)
|
|
rv2 = Set_Printer_Object("T", rv2, Arial_Narrow(8,5))
|
|
rv3 = Set_Printer_Object("L", rv3, "", "", White$)
|
|
|
|
y += 12/64
|
|
return
|
|
|
|
|
|
Schedule_Grid:
|
|
RH = (PageH$ - y) / 25
|
|
LH = RH / 4
|
|
Grid.Start = y
|
|
|
|
For i = 1 to 25
|
|
For c = 2 to 4
|
|
rv := Cols<c,1> :@VM: y :@VM: Cols<c,2> :@VM: y + RH :@FM
|
|
Next c
|
|
y += RH
|
|
Next i
|
|
x = Set_Printer("LINESTYLE", 0:@FM:1/2:@FM:Grey$)
|
|
rv = Set_Printer_Object("R", rv, "", "")
|
|
x = Set_Printer("LINESTYLE", 0:@FM:1:@FM:Black$)
|
|
return
|
|
|
|
|
|
Reactors:
|
|
y = Grid.Start
|
|
For i = 1 to 25
|
|
React = 19 + i
|
|
If p EQ 2 then React = 44 + i
|
|
rv := Cols<1,1> :@VM: y :@VM: Cols<1,2> :@VM: y + RH :@FM
|
|
rv2 := Cols<1,1> :@VM: y + 6/64 :@VM: Cols<1,2> :@VM: "^": React :@FM
|
|
y += RH
|
|
Next i
|
|
rv = Set_Printer_Object("R", rv, "", "", GREY$)
|
|
rv2 = Set_Printer_Object("T", rv2, Arial_Narrow(16,2))
|
|
return
|
|
|
|
|
|
Appointments:
|
|
y = Grid.Start
|
|
z = y
|
|
|
|
For i = 1 to 25
|
|
React = 19 + i
|
|
If p EQ 2 then React = 44 + i
|
|
For c = 1 to 3
|
|
z = y
|
|
Text = Appts(React, c)
|
|
|
|
MV = Count(Text, @RM) + (Text NE "")
|
|
Begin Case
|
|
Case MV EQ 1 ; GoSub Print_One
|
|
Case MV EQ 2 ; GoSub Print_Two
|
|
End Case
|
|
Next c
|
|
y += RH
|
|
Next i
|
|
return
|
|
|
|
|
|
Print_One:
|
|
If Text then
|
|
rv = Cols<c+1,1> :@VM: y :@VM: Cols<c+1,2> :@VM: y + RH
|
|
rv = Set_Printer_Object("R", rv)
|
|
For r = 1 to 4
|
|
rv = Cols<c+1,1> :@VM: z :@VM: w :@VM: "<":Text<0,r>
|
|
rv = Set_Printer_Object("T", rv, Tahoma(6,1))
|
|
z += 6/64
|
|
Next r
|
|
end
|
|
return
|
|
|
|
|
|
Print_Two:
|
|
For x = 1 to 2
|
|
z = y
|
|
Half = Cols<c+1,1> + (ApptCol / 2)
|
|
Begin Case
|
|
Case x EQ 1 ; rv = Cols<c+1,1> :@VM: y :@VM: Half :@VM: y + RH
|
|
Case x EQ 2 ; rv = Half :@VM: y :@VM: Cols<c+1,2> :@VM: y + RH
|
|
End Case
|
|
|
|
rv = Set_Printer_Object("R", rv)
|
|
Val = Field(Text, @RM, x)
|
|
For r = 1 to 4
|
|
Begin Case
|
|
Case x = 1 ; rv = Cols<c+1,1> :@VM: z :@VM: w / 2 :@VM: "<":Val<0,r>
|
|
Case x = 2 ; rv = Half :@VM: z :@VM: w / 2 :@VM: "<":Val<0,r>
|
|
End Case
|
|
rv = Set_Printer_Object("T", rv, Tahoma(6,1))
|
|
z += 6/64
|
|
Next r
|
|
Next x
|
|
return
|
|
|