Skip to content

Command 41 — Update budgetsmulti-step

Same building blocks as command 40, applied to an existing BudgetGID. The field mapping of command 40 holds.

V2 checks an app permission on every call — V1 checked none — and a call whose permission is missing answers 400 with errorCode 15, the same status as an invalid payload (see 4.4). Grant these to the API user before porting the command; the names are the ones of the permission tree in flowww.

CallPermission
PUT /budget/{budgetGID}Sales - Quotes → Save
POST /budget/{budgetGID}/detail/product/{productID}Sales - Quotes → Add product
PUT /budget/{budgetGID}/detail/{budgetID}Sales - Quotes → Edit price
PUT /budget/{budgetGID}/detail/{budgetID}/commentSales - Quotes → Edit comments on a quote
DELETE /budget/{budgetGID}/detail/{budgetID}Sales - Quotes → Delete Product
DELETE /budget/{budgetGID}Sales - Quotes → Delete
GET /budget/{budgetGID}Sales - Quotes → Edit

An update is not one call either. The order is always the same: read it, change it, save the header whole.

  • 1GET /budget/{budgetGID}
    Read it before touching anything: the header comes back whole — you have to resend it whole — and each line in Details[] carries its BudgetID
    No V1 equivalent
  • 2POST /budget/{budgetGID}/detail/product/{productID}
    Lines, one call each: add here, change the price with PUT …/detail/{budgetID}, remove with DELETE …/detail/{budgetID}
    Products[] of Budgetdata
  • 3PUT /budget/{budgetGID}
    The header, always whole and without BudgetGStatus: date, validity, notes, salesperson, doctor
    The rest of Budgetdata
  • 4PUT /budget/{budgetGID}
    The status travels alone, {"BudgetGStatus": n}, never with the header
    Undocumented command 41b

Every change, call by call:

What you want to changeAPI V2 call
Date, validity, notes, salesperson, doctorPUT /budget/{budgetGID} with the whole header (without BudgetGStatus)
Status onlyPUT /budget/{budgetGID} with {"BudgetGStatus": n}
Add a linePOST /budget/{budgetGID}/detail/product/{productID}
Change the price of a linePUT /budget/{budgetGID}/detail/{budgetID} with {"BudgetPrice": …} (VAT included)
Change the units of a lineDelete the line and add it again with the new units.
Change the comment of a linePUT /budget/{budgetGID}/detail/{budgetID}/comment
Remove a lineDELETE /budget/{budgetGID}/detail/{budgetID}
Delete the whole budgetDELETE /budget/{budgetGID}

An update leaves nothing orphaned — the budget was already there — but it is not atomic either: each call is saved on its own, so a run that dies half-way leaves the budget half changed, with the lines you had already touched and a header still holding its old values.

There is nothing to delete: read it again with GET /budget/{budgetGID}, compare it with what you meant to leave, and finish the calls that are missing. A line you added and no longer want goes with DELETE /budget/{budgetGID}/detail/{budgetID}.

Retrying the whole update from the start is safe for the header — it is replaced whole — but not for the lines: adding them again adds them twice. Diff before you retry.

TopicAPI V1API V2
Budget idA new one on every update.The same one.
Sold or accepted budgetsThe old budget could not be deleted, so a duplicate was left.The header and the lines can still be edited, except when the budget has advances. Check the status (GET /budget/{budgetGID}) before editing a budget the client has already accepted.
Expired budgets—Saving an expired budget sets it back to Pending.
Status onlyUndocumented command 41b, with no checks.PUT with BudgetGStatus. Refused if the budget is sold or has advances.
CallAnswerMeaning
PUT /budget/{id}404 168BudgetGDate missing, budget sold, or not found.
PUT /budget/{id}404 493The budget has advances and can no longer be changed.
DELETE …/detail/{budgetID}404Line not found, budget from another clinic (send its clinicID), budget with advances, or a treatment line that cannot be removed.
DELETE /budget/{id}400 513 / 493The budget is accepted or sold / has advances.

Deleting a budget that is already used in a ticket hides it instead of deleting it.