function setFreeCall($id, $hiddenrecord, $note, $total, $discount) { global $db; //$discount = 0.5; $objResponse = new xajaxResponse(); $query = "SELECT * FROM mycdr WHERE id = {$id}"; $row = $db->getRow($query); //print_r($row);exit; if ($row['credit'] > 0 && $row['setfreecall'] != 'yes') { $total = $total - $row['credit']; } $query = "UPDATE mycdr SET note = '" . $note . "', setfreecall = 'yes' WHERE id = {$id}"; if ($db->query($query)) { if ($hiddenrecord == 'true') { $objResponse->addRemove('rcdr-' . $id); } else { $objResponse->addAssign("rprice-" . $id, "innerHTML", '0.00'); $objResponse->addAssign("rcdr-" . $id, "style.background", '#d5c59f'); } } $total_price = $total * (1 - $discount); $total_price = astercc::creditDigits($total_price, 2); $objResponse->addAssign("total_price", "innerHTML", $total_price); $objResponse->addAssign("total_price_ori", "value", $total); $objResponse->addAssign("formDiv", "style.visibility", "hidden"); $objResponse->addAssign("formDiv", "innerHTML", ''); return $objResponse; }
$content .= ' <td>' . $myreceipt['calldate'] . '</td> <td align="right">' . astercrm::FormatSec($myreceipt['billsec']) . '</td> <td align="right">' . $myreceipt['destination'] . '</td> <td align="right">' . $ratedesc . '</td> <td id="rprice-' . $myreceipt['id'] . '" align="right">' . astercc::creditDigits($myreceipt['credit']) . '</td> <td align="right">' . astercc::creditDigits($_REQUEST['discount'], 3) . '</td> </tr>'; echo $content; if ($myreceipt['setfreecall'] == 'no') { $total_price += $myreceipt['credit']; } } $total_price_ori = $total_price; $total_price = $total_price * (1 - $_REQUEST['discount']); $total_price = astercc::creditDigits($total_price, 2); ?> <tr><td><?php echo $locate->Translate("Total"); ?> :</td> <td colspan="5" align="right" id="total_price"><?php echo $total_price; ?> </td><input id="total_price_ori" type="hidden" value="<?php echo $total_price_ori; ?> "><input id="discount" type="hidden" value="<?php echo $_REQUEST['discount']; ?> ">