Пример #1
0
EOF;
        break;
    case "repost":
        $batch_id = $_POST['batch_id'];
        $batchno = $_POST['batchno'];
        $newamt = $_POST['newamt'] * -1;
        $financialyearline_id = $_POST['financialyearline_id'];
        $reactivateresult = "failed";
        include "class/AccountsAPI.php";
        $api = new AccountsAPI();
        if ($batch_id > 0) {
            if ($api->reActivateBatch($batch_id)) {
                $arraytrans_id = $l->getRetainEarningTransaction($batch_id);
                $trans1 = $arraytrans_id[0];
                $trans2 = $arraytrans_id[1];
                if ($api->updateTransactionAmount($batch_id, $newamt, $arraytrans_id, array($newamt, $newamt * -1))) {
                    $reactivateresult = "success";
                }
            }
        }
        $newamt = $newamt * -1;
        if ($newamt == 0) {
            $newamt = 0;
        }
        echo <<<EOF

      <script type="text/javascript">

\t//alert("reactivate {$reactivateresult}, then repost {$newamt}, {$batch_id},{$financialyearline_id}, t:{$trans1}, {$trans2} ");
        self.parent.document.getElementById("divperiod{$financialyearline_id}").innerHTML="<A href='batch.php?action=view&batch_id={$batch_id}'>{$batchno}: {$newamt} (Posted)</A>";