0

I am having the below lines of code in which I am trying to subtract two results to get the third result, but I am getting an error. Please tell me how I will perform the subtraction in Pug.

Code:

 mixin dispatch-summary(dispatched)
  - var count = 0
  table
    caption.align-left.font-bold DISPATCHED RECORDS
      tr
        th.align-center.font-bold S.NO
        th.align-center.font-bold Dispatch Id
        th.align-center.font-bold Projects
        th.align-center.font-bold HardwareBoxes
        th.align-center.font-bold PanelBoxes
        th.align-center.font-bold TotalParts
        th.align-center.font-bold DispatchedParts
        th.align-center.font-bold PendingParts
        th.align-center.font-bold TotalHardware
        th.align-center.font-bold TotalHardwareDispatched
        th.align-center.font-bold TotalHardwarePending


        each task in dispatched
          -var dispatch_id= task.dispatch_id
          -var project = task.project
          -var hardware_boxes = task.hardware_boxes
          -var panel_boxes = task.Panel_boxes
          -var total_parts = task.total_parts
          -var dispatched_parts = task.dispatched_parts
          -var pending_parts = (task.total_parts)-(task.dispatched_parts)
          -var total_hardware = task.total_hardware
          -var total_hardware_dispatched = task.total_hardware_dispatched
          -var total_hardware_pending =(task.total_hardware)-(task.total_hardware_dispatched)

          tr
            td.font-bold=++count
            td.align-left= dispatch_id
            td.align-left= project
            td.align-left= hardware_boxes
            td.align-left= panel_boxes
            td.align-left= total_parts
            td.align-left= dispatched_parts
            td.align-left= pending_parts
            td.align-left= total_hardware
            td.align-left= total_hardware_dispatched
            td.align-left= total_hardware_pending

Note: In the above code I want to subtract total_parts and dispatched_parts to get total pending_parts like

-var pending_parts =(task.total_parts)-(task.dispatched_parts)

  • Did you try `-var pending_parts = total_parts-dispatched_parts` and `-var total_hardware_pending = total_hardware-total_hardware_dispatched`? Please let me know whether this works. – Gibin Ealias Mar 05 '18 at 12:57
  • You might have to coerce those values into numbers—they may be interpreted as strings – Sean Mar 27 '18 at 20:30

0 Answers0