There was a post last week showing how to add a column to a grid to add the Partent Part to Time Phase Grid. While playing with that idea, I found way to add this information with a BPM (much faster).
The following BPM modifies the "Source" Column in Time Phase to concatenate the Customer Name if the row is a Sales Order, the Vendor Name if the row is a PO and the Parent Part if the row is a component to a Job. Since planned job numbers are so long, I replace the value in the "Source" column with "Job:" and the Parent part for firm jobs and "Plan:" and the Parent Part for planned Jobs (we set planned jobs to start with "PL" in Company). The job number column shows the job number so info is not really lost.
My users love this so they don't have to open other screens just to get this simple information.
Here is the code, Post Processing for the TimePhas.GoProcessTimePhase method if anyone has suggestions to improve, please advise.
/*Update TimePhase Source Field with Customer Name for Sales Orders, Supplier Name for POs
and Parent Part Numbers for Jobs where the Part is a component to another Job*/
/*DS 4/20/2011*/
/*For Sales Orders Concatenate Customer Name to Source String*/
For each ttTimePhas.
If ttTimePhas.OrderNum > 0 Then Do:
Find OrderHed Where OrderHed.Company = CUR-COMP and OrderHed.OrderNum = ttTimePhas.OrderNum no-lock no-error.
If Available OrderHed Then Do:
Find Customer Where Customer.Company = CUR-COMP and Customer.CustNum = OrderHed.CustNum no-lock no-error.
If Available Customer Then Assign ttTimePhas.SourceName = ttTimePhas.SourceName + " " + Customer.Name.
End.
End.
/*For Jobs Replace Source (too long already), with Parent Part*/
If ttTimePhas.JobNum > "" Then Do:
Find JobHead Where JobHead.Company = CUR-COMP and JobHead.JobNum = ttTimePhas.JobNum no-lock no-error.
If Available JobHead and JobHead.PartNum <> ttTimePhas.PartNum Then Do: /*leave it when making this part*/
If SubString(JobHead.JobNum,1,2) = "PL" Then Assign ttTimePhas.SourceName = "Plan: " + JobHead.PartNum.
Else Assign ttTimePhas.SourceName = "Job: " + JobHead.PartNum.
End.
End.
/*For POs, concatentate Supplier Name*/
If ttTimePhas.PONum > 0 Then Do:
Find POHeader Where POHeader.Company = CUR-COMP and POHeader.PONum = ttTimePhas.PONum no-lock no-error.
If Available POHeader Then Do:
Find Vendor Where Vendor.Company = CUR-COMP and Vendor.VendorNum = POHeader.VendorNum no-lock no-error.
If Available Vendor Then Assign ttTimePhas.SourceName = ttTimePhas.SourceName + " " + Vendor.Name.
End.
End.
End.
The following BPM modifies the "Source" Column in Time Phase to concatenate the Customer Name if the row is a Sales Order, the Vendor Name if the row is a PO and the Parent Part if the row is a component to a Job. Since planned job numbers are so long, I replace the value in the "Source" column with "Job:" and the Parent part for firm jobs and "Plan:" and the Parent Part for planned Jobs (we set planned jobs to start with "PL" in Company). The job number column shows the job number so info is not really lost.
My users love this so they don't have to open other screens just to get this simple information.
Here is the code, Post Processing for the TimePhas.GoProcessTimePhase method if anyone has suggestions to improve, please advise.
/*Update TimePhase Source Field with Customer Name for Sales Orders, Supplier Name for POs
and Parent Part Numbers for Jobs where the Part is a component to another Job*/
/*DS 4/20/2011*/
/*For Sales Orders Concatenate Customer Name to Source String*/
For each ttTimePhas.
If ttTimePhas.OrderNum > 0 Then Do:
Find OrderHed Where OrderHed.Company = CUR-COMP and OrderHed.OrderNum = ttTimePhas.OrderNum no-lock no-error.
If Available OrderHed Then Do:
Find Customer Where Customer.Company = CUR-COMP and Customer.CustNum = OrderHed.CustNum no-lock no-error.
If Available Customer Then Assign ttTimePhas.SourceName = ttTimePhas.SourceName + " " + Customer.Name.
End.
End.
/*For Jobs Replace Source (too long already), with Parent Part*/
If ttTimePhas.JobNum > "" Then Do:
Find JobHead Where JobHead.Company = CUR-COMP and JobHead.JobNum = ttTimePhas.JobNum no-lock no-error.
If Available JobHead and JobHead.PartNum <> ttTimePhas.PartNum Then Do: /*leave it when making this part*/
If SubString(JobHead.JobNum,1,2) = "PL" Then Assign ttTimePhas.SourceName = "Plan: " + JobHead.PartNum.
Else Assign ttTimePhas.SourceName = "Job: " + JobHead.PartNum.
End.
End.
/*For POs, concatentate Supplier Name*/
If ttTimePhas.PONum > 0 Then Do:
Find POHeader Where POHeader.Company = CUR-COMP and POHeader.PONum = ttTimePhas.PONum no-lock no-error.
If Available POHeader Then Do:
Find Vendor Where Vendor.Company = CUR-COMP and Vendor.VendorNum = POHeader.VendorNum no-lock no-error.
If Available Vendor Then Assign ttTimePhas.SourceName = ttTimePhas.SourceName + " " + Vendor.Name.
End.
End.
End.