[IMP] change simple if condition
[IMP] optimize code and change field name total to amount_total ,invoiced to amount_invoiced ,tobe_invoice to amount_tobe_invoice