$o->currencyctrl = $simbizctrl->getSelectCurrency($o->currency_id, 'N', 'currency_id', "", "onchange='refreshUnitPrice(this.value)';calculatesummary()"); $o->debitcreditnotelinectrl = $o->debitcreditnotelinectrl . "<tr><th></th><th></th><th></th><th></th><th>Total:</th>\n\t\t\t\t<th><input value='{$o->originalamt}' name='originalamt' \n\t\t\t\t\tsize='12' maxlength='12' style='text-align:right' readonly></th>\n\t\t\t\t<th></th>\n\t\t\t\t\n\t\t\t\t</tr></tbody></table></th></tr>"; $o->getInputForm("edit", $o->debitcreditnote, $token); // $o->showDebitCreditNoteTable("WHERE piv.debitcreditnote_id>0 and piv.organization_id=$defaultorganization_id","ORDER BY piv.debitcreditnote_no, piv.totalpcs LIMIT 0,30"); } else { //if can't find particular organization from database, return error message redirect_header("debitcreditnote.php", 3, "Some error on viewing your debitcreditnote data, probably database corrupted"); } break; case "reactive": if ($o->fetchDebitCreditNote($o->debitcreditnote_id)) { //if data save successfully $o->iscomplete = 0; include_once "class/AccountsAPI.php"; $accapi = new AccountsAPI(); $result = $accapi->reverseBatch($o->batch_id); if ($result) { $o->iscomplete = 0; $o->batch_id = 0; $o->updateDebitCreditNote(); redirect_header("debitcreditnote.php?action=edit&debitcreditnote_id={$o->debitcreditnote_id}", $pausetime, "This record is reactivate successfully, redirect to edit this record."); } else { redirect_header("debitcreditnote.php?action=edit&debitcreditnote_id={$o->debitcreditnote_id}", $pausetime, "<b style='color:red'>This record can't reactivated due to internal error.</b>"); } } else { redirect_header("debitcreditnote.php?action=edit&debitcreditnote_id={$o->debitcreditnote_id}", $pausetime, "<b style='color:red'>Warning! Can't reactivate the data.</b>"); } break; //when user press save for change existing organization data //when user press save for change existing organization data case "update":
if ($o->posting()) { echo "<result><status>1</status><detail><msg>Record post successfully.</msg></detail></result>"; } else { echo "<result><status>0</status><detail><msg>Error, you cannot post record</msg></detail></result>"; } } else { echo "<result><status>0</status><detail><msg>Error, you cannot post record due to cannot fetch payment from database</msg></detail></result>"; } die; break; case "reactivate": $payment_id = $_POST['payment_id']; if ($o->fetchPayment($payment_id)) { include "../simbiz/class/AccountsAPI.php"; $acc = new AccountsAPI(); if ($acc->reverseBatch($o->batch_id)) { $o->iscomplete = 0; if ($xoopsDB->query("update sim_simbiz_payment set iscomplete=0 where payment_id=" . $payment_id)) { $arr = array("status" => 1); } else { $arr = array("status" => 0, "msg" => "cannot update payment status to not complete, probably due to sql error"); } } else { $arr = array("status" => 0, "msg" => "Cannot reverse transaction, probably due to financial year issue"); } } else { $arr = array("status" => 0, "msg" => "Cannot reverse transaction, fetch sql error"); } echo json_encode($arr); die; break;