Snippet to calculate doses for oral antibiotics used for treating pyelonephritis in pediatric patients (as per Bugs and drugs):
{note: trim=yes}
Antibiotic: {formmenu: Cefixime; Clavulin; name=abx}
{endnote}
{if: abx = "Cefixime"}
{note: trim=yes}
Pyelonephritis - Cefixime
Weight: {formtext: name=weight} kg
Times per day: {formmenu: QD; BID; name=dosing}
Ref: Bugs and Drugs
{endnote}
{note: trim=yes; preview=no}
{if: dosing = "QD"}{n=1}{elseif: dosing="BID"}{n=2}{endif}
{total_daily_dose=weight * 8}
{if: total_daily_dose > 400}{dose=400}{else}{dose=total_daily_dose}{endif}
{endnote}
Cefixime 8mg/kg/d PO div q12-24h x 7-10 days (maximum 400mg/day)
Weight: {=weight} kg
Rx: Cefixime {=dose / n; format=,.0f} PO {=dosing} x 7-10 days
{elseif: abx = "Clavulin"}
{note: trim=yes}
Pyelonephritis - Clavulin
Weight: {formtext: name=weight} kg
Ref: Bugs and Drugs
{endnote}
{note: preview=no; trim=yes}
{wt_dose=(weight * 40)}
{if: wt_dose > 1750}{dose=1750}{else}{dose=wt_dose}{endif}
{endnote: trim=no}
Amoxicillin-clavulanate 40mg/kg/d PO div TID x 7-10 days (maximum 1,750 mg/day)
Weight: {=weight} kg
Rx: Amoxicillin-clavulanate {=dose / 3; format=,.0f} mg PO div TID x 7-10 days
{endif}