Show pageOld revisionsBacklinksExport to PDFFold/unfold allBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== pears.GetTempMargin ====== <WRAP center round info> Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace. </WRAP> ===== Original SQL ===== <code sql> create function "pears"."GetTempMargin"( /* Application Maintained Function / Procedure - DO NOT EDIT*/ in "chargerate" double,in "payrate" double,in "temp" smallint,in "taxmethod" smallint,in "directengagement" smallint, in "actualNotPercent" smallint,in "holpayPercent" double,in "NIPercent" double,in "NIonHolpay" smallint ) returns char(10) deterministic begin declare "margin" double; declare "HolidayCost" double; declare "NICost" double; if "isnull"("temp",0) = 0 then return null end if; set "margin" = "chargerate"-"isnull"("payrate",0.0); if "isnull"("taxmethod",1) = 1 and "isnull"("directengagement",0) = 0 and "payrate" is not null then set "HolidayCost" = "isnull"("holpayPercent",0)*"PayRate"/100; set "NICost" = "isnull"("NIPercent",0)*(if "isnull"("NIonHolPay",0) = 1 then "PayRate"+"HolidayCost" else "PayRate" endif)/100; set "margin" = "margin"-("HolidayCost"+"NICost") end if; if "isnull"("actualNotPercent",0) = 1 or "isnull"("Margin",0) = 0 or "isnull"("chargerate",0) = 0 then return "str"("Margin",10,2) else return "string"("str"(("Margin"/"ChargeRate")*100,8,2),' %') end if end </code> database/functions/pears_gettempmargin.txt Last modified: 2026/08/07 19:24by 127.0.0.1