} else { $return .= "<div style='width: 100%;background: green;' >No Down Payment Needed</div>\n <script>global_task.submit_flowchartTask('{$value}' , '{$chart_assign_id}' ,'order', '{$module_id}', '{$target}' , '', '{$module_id}' , { target: '{$target}'});\$('#payment_parrent_div').remove();</script>"; } } else { $return .= "<div style='width: 100%;background: red;' >" . $card["error"] . "</div>"; } } else { $tmp1 = $this->db->fetch_assoc($this->db->query("SELECT shipping_charges , grant_total , state_tax , county_tax , stadium_tax , total_tax FROM erp_order WHERE order_id = {$module_id}")); $full = $tmp1["grant_total"]; $bill_amount = $full; $total_arr = $this->db->fetch_assoc($this->db->query("SELECT SUM( amount ) total FROM `payments` WHERE for_module_name = 'order' AND for_module_id = '{$module_id}' AND refund='no'")); $already_payed = $total_arr["total"]; if (round($bill_amount, 2) > round($already_payed, 2)) { $bill_amount = round(round($bill_amount, 2) - round($already_payed, 2), 2); $workorder = new WorkOrder(); $tax = $workorder->calculate_tax($module_id, '0'); $pa = array(); $pa["payee_module_name"] = "contacts"; $pa["payee_module_id"] = $args["contact_id"]; $pa["for_module_name"] = "order"; $pa["for_module_id"] = $module_id; $pa["chart_assign_id"] = $args["chart_assign_id"]; $pa["amount"] = $bill_amount; $pa["curency"] = "USD"; $pa["payment_module"] = $payment_type; $pa["payment_module_id"] = $args["ccid"]; $pa["payment_type"] = "final"; $pa["state_tax"] = $tmp1["state_tax"]; $pa["county_tax"] = $tmp1["county_tax"]; $pa["stadium_tax"] = $tmp1["stadium_tax"]; $pa["total_tax"] = $tmp1["total_tax"];