> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vinmake.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Cost Sheet

> Update an existing cost sheet (partial update) with action-based state transitions.

**Path Parameters:**
- **costing_id**: The document ID of the cost sheet to update

**Request Body (camelCase, all fields optional):**
- **action**: State transition: "draft", "submit_for_review", "withdraw", "approve" (manager), "reject" (manager)
- **costSheetName**: Updated name
- **clientId**: Updated client reference
- **styleId**: Updated style reference
- **mainCurrency**: Updated currency
- **bomItems**: Replace all BOM items (see POST for field details)
- **processingItems**: Replace all processing items
- **overheadTier3Items**: Replace all overhead items
- **profitScenarios**: Replace all profit scenarios

**Headers:**
- **X-User-Id**: The ID of the user making the update
- **X-Org-Id**: Organization override if not in user context

**Example Request:**
```json
{
  "action": "draft",
  "costSheetName": "Updated Name",
  "bomItems": [
    {
      "materialName": "Silk Fabric",
      "materialType": "Fabric",
      "consumption": 2.0,
      "unit": "meter",
      "unitCost": 25.00
    }
  ]
}
```



## OpenAPI

````yaml /api/openapi-cutmake.json patch /costings/{costing_id}
openapi: 3.1.0
info:
  title: VM App API
  version: 0.1.0
servers:
  - url: https://vinmake-erp.onrender.com
security: []
paths:
  /costings/{costing_id}:
    patch:
      tags:
        - Costing Management
      summary: Update Cost Sheet
      description: >-
        Update an existing cost sheet (partial update) with action-based state
        transitions.


        **Path Parameters:**

        - **costing_id**: The document ID of the cost sheet to update


        **Request Body (camelCase, all fields optional):**

        - **action**: State transition: "draft", "submit_for_review",
        "withdraw", "approve" (manager), "reject" (manager)

        - **costSheetName**: Updated name

        - **clientId**: Updated client reference

        - **styleId**: Updated style reference

        - **mainCurrency**: Updated currency

        - **bomItems**: Replace all BOM items (see POST for field details)

        - **processingItems**: Replace all processing items

        - **overheadTier3Items**: Replace all overhead items

        - **profitScenarios**: Replace all profit scenarios


        **Headers:**

        - **X-User-Id**: The ID of the user making the update

        - **X-Org-Id**: Organization override if not in user context


        **Example Request:**

        ```json

        {
          "action": "draft",
          "costSheetName": "Updated Name",
          "bomItems": [
            {
              "materialName": "Silk Fabric",
              "materialType": "Fabric",
              "consumption": 2.0,
              "unit": "meter",
              "unitCost": 25.00
            }
          ]
        }

        ```
      operationId: update_cost_sheet_costings__costing_id__patch
      parameters:
        - name: costing_id
          in: path
          required: true
          schema:
            type: string
            description: The costing document ID (e.g., CS-2024-001)
            title: Costing Id
          description: The costing document ID (e.g., CS-2024-001)
        - name: X-User-Id
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-User-Id
        - name: X-Org-Id
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Org-Id
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CostSheetUpdateInput'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CostSheetUpdateResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - OAuth2PasswordBearer: []
components:
  schemas:
    CostSheetUpdateInput:
      properties:
        action:
          anyOf:
            - $ref: '#/components/schemas/CostSheetAction'
            - type: 'null'
        reason:
          anyOf:
            - type: string
            - type: 'null'
          title: Reason
        comments:
          anyOf:
            - type: string
            - type: 'null'
          title: Comments
        versionNumber:
          anyOf:
            - type: integer
            - type: 'null'
          title: Versionnumber
        status:
          anyOf:
            - type: string
            - type: 'null'
          title: Status
        costSheetName:
          anyOf:
            - type: string
            - type: 'null'
          title: Costsheetname
        clientId:
          anyOf:
            - type: string
            - type: 'null'
          title: Clientid
        styleId:
          anyOf:
            - type: string
            - type: 'null'
          title: Styleid
        skuId:
          anyOf:
            - type: string
            - type: 'null'
          title: Skuid
        mainCurrency:
          anyOf:
            - type: string
            - type: 'null'
          title: Maincurrency
        orderQuantity:
          anyOf:
            - type: number
            - type: 'null'
          title: Orderquantity
        bomItems:
          anyOf:
            - items:
                $ref: '#/components/schemas/BOMLineItemInput'
              type: array
            - type: 'null'
          title: Bomitems
        processingItems:
          anyOf:
            - items:
                $ref: '#/components/schemas/ProcessingLineItemInput'
              type: array
            - type: 'null'
          title: Processingitems
        logisticsItems:
          anyOf:
            - items:
                $ref: '#/components/schemas/LogisticsLineItemInput'
              type: array
            - type: 'null'
          title: Logisticsitems
        overheadTier3Items:
          anyOf:
            - items:
                $ref: '#/components/schemas/OverheadTier3Input'
              type: array
            - type: 'null'
          title: Overheadtier3Items
        profitScenarios:
          anyOf:
            - items:
                $ref: '#/components/schemas/ProfitScenarioInput'
              type: array
            - type: 'null'
          title: Profitscenarios
      type: object
      title: CostSheetUpdateInput
      description: >-
        Input schema for updating a cost sheet (PATCH /costings/{id}).

        All fields are optional - only provided fields will be updated.


        Use 'action' to trigger state transitions:

        - draft: Save changes without validation

        - submit_for_review: Validate and change status to Under Review (from
        Draft)

        - resubmit: Send a rejected cost sheet back Under Review

        - withdraw: Revert from Under Review/Approved/Rejected back to Draft

        - approve: Manager only - change status to Approved

        - reject: Manager only - change status to Rejected
    CostSheetUpdateResponse:
      properties:
        success:
          type: boolean
          title: Success
        message:
          type: string
          title: Message
        cost_sheet_id:
          type: string
          title: Cost Sheet Id
        document_id:
          type: string
          title: Document Id
        version_number:
          type: integer
          title: Version Number
        status:
          type: string
          title: Status
      type: object
      required:
        - success
        - message
        - cost_sheet_id
        - document_id
        - version_number
        - status
      title: CostSheetUpdateResponse
      description: Response after updating a cost sheet
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    CostSheetAction:
      type: string
      enum:
        - draft
        - submit_for_review
        - withdraw
        - approve
        - reject
        - resubmit
      title: CostSheetAction
      description: |-
        Actions for cost sheet state transitions

        Permissions:
        - draft, submit_for_review, withdraw: Any authenticated user
        - approve, reject: Manager or Admin only
    BOMLineItemInput:
      properties:
        id:
          anyOf:
            - type: string
            - type: 'null'
          title: Id
        materialId:
          anyOf:
            - type: string
            - type: 'null'
          title: Materialid
        materialName:
          type: string
          title: Materialname
        materialType:
          type: string
          title: Materialtype
        materialSkuId:
          anyOf:
            - type: string
            - type: 'null'
          title: Materialskuid
        consumption:
          type: number
          title: Consumption
        tolerancePercent:
          type: number
          minimum: 0
          title: Tolerancepercent
          default: 0
        unit:
          type: string
          title: Unit
        unitCost:
          type: number
          title: Unitcost
        currency:
          type: string
          title: Currency
          default: USD
        exchangeRate:
          type: number
          title: Exchangerate
          default: 1
      type: object
      required:
        - materialName
        - materialType
        - consumption
        - unit
        - unitCost
      title: BOMLineItemInput
      description: BOM line item for form input
    ProcessingLineItemInput:
      properties:
        id:
          anyOf:
            - type: string
            - type: 'null'
          title: Id
        processingType:
          type: string
          title: Processingtype
        vendorName:
          anyOf:
            - type: string
            - type: 'null'
          title: Vendorname
        supplierId:
          anyOf:
            - type: string
            - type: 'null'
          title: Supplierid
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        quantity:
          type: number
          title: Quantity
          default: 1
        unit:
          type: string
          title: Unit
          default: piece
        unitCost:
          anyOf:
            - type: number
            - type: 'null'
          title: Unitcost
        costAmount:
          type: number
          title: Costamount
        currency:
          type: string
          title: Currency
          default: USD
        exchangeRate:
          type: number
          title: Exchangerate
          default: 1
      type: object
      required:
        - processingType
        - costAmount
      title: ProcessingLineItemInput
      description: Processing cost item for form input
    LogisticsLineItemInput:
      properties:
        id:
          anyOf:
            - type: string
            - type: 'null'
          title: Id
        calculationMode:
          type: string
          title: Calculationmode
          default: estimate
        transportMode:
          type: string
          title: Transportmode
          default: air
        basis:
          anyOf:
            - type: string
            - type: 'null'
          title: Basis
        quantity:
          type: number
          title: Quantity
          default: 0
        rate:
          type: number
          title: Rate
          default: 0
        handlingFee:
          type: number
          title: Handlingfee
          default: 0
        baseCost:
          type: number
          title: Basecost
          default: 0
        contingencyPercent:
          type: number
          minimum: 0
          title: Contingencypercent
          default: 0
        contingencyAmount:
          type: number
          title: Contingencyamount
          default: 0
        shipmentTotal:
          anyOf:
            - type: number
            - type: 'null'
          title: Shipmenttotal
        orderQuantity:
          anyOf:
            - type: number
            - type: 'null'
          title: Orderquantity
        unitCost:
          anyOf:
            - type: number
            - type: 'null'
          title: Unitcost
        costAmount:
          type: number
          minimum: 0
          title: Costamount
        currency:
          type: string
          title: Currency
          default: USD
        exchangeRate:
          type: number
          title: Exchangerate
          default: 1
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        notes:
          anyOf:
            - type: string
            - type: 'null'
          title: Notes
      type: object
      required:
        - costAmount
      title: LogisticsLineItemInput
      description: Manual or assisted logistics estimate for a cost sheet
    OverheadTier3Input:
      properties:
        id:
          anyOf:
            - type: string
            - type: 'null'
          title: Id
        overheadType:
          type: string
          title: Overheadtype
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        costAmount:
          type: number
          title: Costamount
        currency:
          type: string
          title: Currency
          default: USD
        exchangeRate:
          type: number
          title: Exchangerate
          default: 1
      type: object
      required:
        - overheadType
        - costAmount
      title: OverheadTier3Input
      description: Tier 3 overhead (fixed amount per unit)
    ProfitScenarioInput:
      properties:
        id:
          anyOf:
            - type: string
            - type: 'null'
          title: Id
        quotedPrice:
          type: number
          title: Quotedprice
        quotedCurrency:
          type: string
          title: Quotedcurrency
          default: USD
        expectedGrossMargin:
          type: number
          title: Expectedgrossmargin
          default: 0
        expectedGrossProfit:
          type: number
          title: Expectedgrossprofit
          default: 0
        expectedNetMargin:
          type: number
          title: Expectednetmargin
          default: 0
        expectedNetProfit:
          type: number
          title: Expectednetprofit
          default: 0
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
      type: object
      required:
        - quotedPrice
      title: ProfitScenarioInput
      description: Profit scenario for quoted price analysis
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    OAuth2PasswordBearer:
      type: oauth2
      flows:
        password:
          scopes: {}
          tokenUrl: /auth/login

````