function DepositeProfit() { $Tafsilis = array(); $keys = array_keys($_POST); foreach ($keys as $key) { if (strpos($key, "chk_") !== false) { $Tafsilis[] = substr($key, 4) * 1; } } if (count($Tafsilis) == 0) { echo Response::createObjectiveResponse(false, "هیچ ردیفی انتخاب نشده است"); die; } $ToDate = DateModules::shamsi_to_miladi($_POST["ToDate"]); ComputeDepositeProfit($ToDate, $Tafsilis); die; }
<?php //----------------------------- // Programmer : SH.Jafarkhani // Date : 94.06 //----------------------------- require_once '../header.inc.php'; require_once '../docs/import.data.php'; $dataTable = ComputeDepositeProfit(DateModules::shamsi_to_miladi($_REQUEST["ToDate"]), array($_REQUEST["TafsiliID"]), true); $dataTable = $dataTable[$_REQUEST["TafsiliID"]]; echo '<META http-equiv=Content-Type content="text/html; charset=UTF-8" ><body dir="rtl">'; echo '<link rel="stylesheet" type="text/css" href="/generalUI/fonts/fonts.css" />'; echo "<style>\r\n\t\ttable { border-collapse:collapse; width:100%}\r\n\t\t#header {background-color : blue; color : white; font-weight:bold}\r\n\t\t#footer {background-color : #bbb;}\r\n\t\ttd {font-family : nazanin; font-size:16px; padding:4px}\r\n\t</style>"; echo "<table></table>"; echo "<table border=1>\r\n\t<tr id=header>\r\n\t\t<td>تاریخ</td>\r\n\t\t<td>مبلغ گردش</td>\r\n\t\t<td>مانده حساب</td>\r\n\t\t<td>تعداد روز</td>\r\n\t\t<td>سود</td>\r\n\t</tr>"; $amount = 0; $sumProfit = 0; for ($i = 0; $i < count($dataTable) - 1; $i++) { $row = $dataTable[$i]; $nextRow = $i + 1 < count($dataTable) ? $dataTable[$i + 1] : null; $amount += $row["row"]["amount"] * 1; $sumProfit += $nextRow ? $nextRow["profit"] : 0; echo "<tr>\r\n\t\t\t<td>" . DateModules::miladi_to_shamsi($row["row"]["DocDate"]) . "</td>\r\n\t\t\t<td>" . number_format($row["row"]["amount"]) . "</td>\r\n\t\t\t<td>" . number_format($amount) . "</td>\r\n\t\t\t<td>" . ($nextRow ? $nextRow["days"] : 0) . "</td>\r\n\t\t\t<td>" . number_format($nextRow ? $nextRow["profit"] : 0) . "</td>\r\n\t\t</tr>"; } echo "<tr id=footer>\r\n\t\t<td colspan=4>جمع</td>\r\n\t\t<td>" . number_format($sumProfit) . "</td>\r\n\t</tr>"; echo "</table>";