[Vantage 6.10] Email alert to second level PO approver?

This is an example of an alert I send to different users base on how much over standard cost they issued a PO for. It should easily be adapted for what you want to do. I added it in a BAM folder on the vantage group.

I started with the BAM_Alert_OrderRel_DropShip.zip from the file section. it has instruction on where to put the .p program.

Greg Payne

Code Below here.

{ud/GlbAlert.i &TableName = "PODetail"}

ASSIGN SendEmail = FALSE.

/* Calc Impact and format Email Text */


define variable TotQty as decimal no-undo initial 0.
define variable TotStd as decimal no-undo initial 0.
define variable CostAtStd as decimal no-undo initial 0.
define variable CostAtPO as decimal no-undo initial 0.
define variable POQty as decimal no-undo initial 0.
define variable STDVariance as decimal no-undo initial 0.
define variable STDMaterialCost as decimal no-undo initial 0.
define variable EmailAddress as Character no-undo initial '':U.
define variable UserName as Character no-undo initial '':U.

define variable vFrom as character no-undo initial '':U.
define variable vTo as character no-undo initial '':U.
define variable vCC as character no-undo initial '':U.
define variable vSubject as character no-undo initial '':U.
define variable vBody as character no-undo initial '':U.


for each PartTran where PartTran.Company = PODetail.Company
and PartTran.PartNum = PODetail.PartNum
and PartTran.TranDate >= (today - 365)
and PartTran.TranType BEGINS "PUR-STK"
no-lock:
assign TotQty = TotQty + PartTran.TranQty.

end.



Message "DEBUG - In Test Email Tot Qty = " + string(TotQty).


find PartCost where PartCost.Company = PODetail.Company and PartCost.PartNum = PODetail.PartNum no-lock no-error.
if available PartCost then do:
Assign CostAtStd = TotQty * PartCost.StdMaterialCost.
Assign TotStd = partCost.StdBurdenCost + PartCost.StdLaborCost + PartCost.StdMaterialCost + PartCost.StdMtlBurCost + Partcost.StdSubContCost.
Assign StdMaterialCost = PartCost.StdMaterialCost.
end.
assign CostAtPO = TotQty * PODetail.UnitCost.

Find UserFile where UserFile.DCDUserID = DCD-UserID no-error.


Find Vendor no-lock where Vendor.company = PODetail.Company and Vendor.VendorNum = PODetail.VendorNum.

Find UDCodes no-lock where UDCodes.Company = PODetail.Company and PODetail.ShortChar01 = UDCodes.CodeID.


assign STDVariance = CostAtPO - CostAtStd.

Message "DEBUG Email - PO Quantity = " + string(PODetail.XOrderQty).

Assign vBody = "Cost above Material Standard on " + PODetail.PartNum + " by " + UserFile.Name +
"~n~n~tVendor " + Vendor.VendorID +
"~n~n~tItem " + PODetail.PartNum + " " + PODetail.LineDesc +
"~n~n~tQty " + trim(string(PODetail.XOrderQty)) +
"~n~n~tMA Cost ~t" + string(PartCost.StdMaterialCost,"$>>>,>>>,>>9.99") + "~tExtended Cost " + trim(string(PartCost.StdMaterialCost * PODetail.XOrderQty,"$>>>,>>>,>>9.99")) +
"~n~tPO Cost ~t" + string(PODetail.UnitCost,"$>>>,>>>,>>9.99") + "~tExtended Cost " + TRIM(string(PODetail.UnitCost * PODetail.XOrderQty,"$>>>,>>>,>>9.99")) +
"~n~n~t12 Months Usage " + string(TotQty,">>>,>>>,>>9.99") +
"~n~n~tImpact $ " + string(CostAtPO - CostAtStd,"$>>>,>>>,>>9.99") +
"~n~n~tReason: " + UDCodes.LongDesc +
"~n~n~tTotal StandardCost: " + string(TotStd,"$>>>,>>>,>>9.99") +
"~n~n~tPurchase Order Number: " + string(PODetail.PONUM) + "~tLine Number: " + string(PODetail.POLine).



assign vTO = "xxx@...;"
vCC = "info@...;".

if (CostAtPO - CostAtStd) > 50 then do:
assign vTO = vTO + "info@...;".
end.

if (CostAtPO - CostAtStd) > 1000 then do:
assign vCC = vCC + "pmgr@...;".
end.

Message "DEBUG Email - vTO = " + vTO.

assign EMAIL-From = UserFile.EmailAddress.
EMAIL-To = vTO.
EMAIL-CC = vCC + EMAIL-From.
assign EMAIL-Subject = 'Epicor Reason: ' + UDCodes.CodeDesc.
assign EMAIL-Text = vBody.
assign SendEmail = true.




From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of tmsover
Sent: Friday, August 17, 2012 9:57 AM
To: vantage@yahoogroups.com
Subject: [Vantage] [Vantage 6.10] Email alert to second level PO approver?



When a buyer creates a PO where the dollar amount is above their approval limit, Vantage will ask if they want to send it to their approval person. We have a BAM program that monitors the ApprovalStatus field in the POHeader table to cause an email to be sent to the buyers approval person when the status changes from U (anapproved) to P (pending). This alerts person2 that they need to go to Vantage and approve the PO.

If the amount is over person2's limit, they are also prompted by Vantage to send the PO to their approver. However, the ApprovalStatus is already at P so the BAM program is not activated to send an email to person2's approval person alerting them they need to approve the PO in Vantage.

Has anyone discovered a way or a field available in BAM that could be monitored to activate sending an email to person2's approval person?

Any help is appreciated,

Dale Norris
IT Manager
Bullen


________________________________
CONFIDENTIALITY NOTICE

The information contained in this communication, including attachments, is privileged and confidential. It is intended only for the exclusive use of the addressee. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivering it to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us at (727) 578-6258 and immediately delete the communication.

"This (document/presentation) may contain technical data as defined in the International Traffic In Arms Regulations (ITAR) 22 CFR 120.10. Export of this material is restricted by the Arms Export Control Act (22 U.S.C. 2751 et seq.) and may not be exported to foreign persons without prior approval form the U.S. Department of State."


[Non-text portions of this message have been removed]
When a buyer creates a PO where the dollar amount is above their approval limit, Vantage will ask if they want to send it to their approval person. We have a BAM program that monitors the ApprovalStatus field in the POHeader table to cause an email to be sent to the buyers approval person when the status changes from U (anapproved) to P (pending). This alerts person2 that they need to go to Vantage and approve the PO.

If the amount is over person2's limit, they are also prompted by Vantage to send the PO to their approver. However, the ApprovalStatus is already at P so the BAM program is not activated to send an email to person2's approval person alerting them they need to approve the PO in Vantage.

Has anyone discovered a way or a field available in BAM that could be monitored to activate sending an email to person2's approval person?

Any help is appreciated,

Dale Norris
IT Manager
Bullen