Cost Allocation and PNR Edits

Simple Script to capture the Code into a UDID:

//Cost Allocation Code

var x=UserPnrData.UserBooking.CostAllocations.Allocation.Code;

{if(((UserPnrData.DataType=="new")||(UserPnrData.DataType=="purchase_hold")) && (x!=undefined))

{out.print("5.Z*UD61 " + x);}}

Simple Script to capture the Name into a UDID:  NOTE: if you have a Parent/Child relationship, we can ONLY capture the Child Name.

//Cost Allocation Name

var x=UserPnrData.UserBooking.CostAllocations.Allocation.Name;

{if(((UserPnrData.DataType=="new")||(UserPnrData.DataType=="purchase_hold")) && (x!=undefined))

{out.print("5.Z*UD62 " + x);}}


Sample of a Nested Cost Allocation: Project Number = Parent and Task Number = Child or Nested Allocation

//UDID 3 - Project Number (Placeholder)

//Temp placeholder for purchase_hold when cost allocation data isn't present

var x=UserPnrData.UserBooking.CostAllocations.Allocation.Name;

{if((UserPnrData.DataType=="purchase_hold" || UserPnrData.DataType=="new")&&(x==undefined))

{out.print("5.S*UD3 PENDING DEEM" + "\n" + "5H-UD3 PENDING DEEM" );}}

 

//UDID 4 - Task Number (Placeholder)

//Temp placeholder for purchase_hold when cost allocation data isn't present

var x=UserPnrData.UserBooking.CostAllocations.Allocation.Code;

{if((UserPnrData.DataType=="purchase_hold" || UserPnrData.DataType=="new")&&(x==undefined))

{out.print("5.S*UD4 PENDING DEEM" + "\n" + "5H-UD4 PENDING DEEM" );}}

 

Sample of a Non-Nested/Single Cost Allocation field:

 //UD 5 Project Cost Allocation/Project Code

var w = UserPnrData.UserBooking.CostAllocations.Allocation.Code;

if (((UserPnrData.DataType=="new") || (UserPnrData.DataType=="purchase_hold") ||

(UserPnrData.DataType=="change"))&&(w!=undefined))

{out.print("5.S*UD5 " + w );}

Sample of a Cost Allocation Project Code

//Cost Allocation/Project Code

var x=UserPnrData.UserBooking.CostAllocations.Allocation.Code;

{if(((UserPnrData.DataType=="new")||(UserPnrData.DataType=="purchase_hold")) && (x!=undefined))

{out.print("5.S*UD1 " + x);}}   

 Sample of a Project Code Remark

//Cost Allocation/Project Code remark

var e=UserPnrData.UserBooking.CostAllocations.Allocation.Code;

e=e.toUpperCase();

e=e.replace(/\$/g,"");

e=e.replace(/#/g, "");

e=e.replace(/-/g, " ");

e=e.replace(/_/g, " ");

e=e.replace(/\!/g," ");

e=e.replace(/\&/g,"");

e=e.replace(/%/g, " ");

if(((UserPnrData.DataType=="new")||(UserPnrData.DataType=="purchase_hold"))&&(e!=undefined)){out.print("5H-UD1 " + e);}

 

Cost Allocation Name and Code written to 1 script:

 //UD18/UD145  Project Cost Allocation/Project Code & Name

 var c = UserPnrData.UserBooking.CostAllocations.Allocation.Code;

 var n = UserPnrData.UserBooking.CostAllocations.Allocation.Name;

 if ((UserPnrData.DataType=="new") || (UserPnrData.DataType=="purchase_hold"))

 {out.print("5.S*UD18 " + n + "\n" + "5.S*UD145 " + c );}