<?php # enter_openingbalance.php displays a form that allows the entry of a opening balance # All Accounts which have BANK or CASH in their AC3 get listed require "accrp.php"; session_start(); require "security/secure.php"; pt_register('POST', 'submitnow'); # others are not needed, they get accessed by $_POST (see line 33) beginDocument("Enter OpeningBalance", $sess_user); if ($submitnow == 1) { $db = getDBConnection(); $query_part1 = "INSERT INTO TRANS (VR_NO, VR_DT, VR_TP, AC_ID1, AC_ID2, AC_ID3, AC_ID4, AC_ID5, DR_CR, CHQ_NO, AMOUNT, PARTY, REMARKS, T_DT, DEPT) VALUES "; $today = get_today_srd_string(); $accounts = new BankAndCashAccounts("1", "0000-00-00", "c"); while ($row = $accounts->getNext()) { $ac1 = $row["AC_ID1"]; $ac2 = $row["AC_ID2"]; $ac3 = $row["AC_ID3"]; $ac4 = $row["AC_ID4"]; $ac5 = $row["AC_ID5"]; $field_name = "account_field_" . $ac5; $field_desc = $accounts->getActualCodeName(); $amount = $_POST[$field_name]; if ($amount == "") { echo "Warning: Field {$field_desc} has zero Amount!<br>"; continue; } $amount = $_POST[$field_name]; $vr_no = get_new_vrno(); # insert voucher
endPrettyTable(); # Receipts beginPrettyTable("4", "Receipts"); printRow(array("Code Number", "Description", "Amount")); while ($receiptsAccounts->getNext()) { if ($receiptsAccounts->getActualBalance() == "") { continue; } printRow(array($receiptsAccounts->getActualCodeString(), $receiptsAccounts->getActualCodeName(), $receiptsAccounts->getActualBalance()), "abwechselnd"); } printRow(array("", "Total", $receiptsAccounts->getSum())); endPrettyTable(); # Closing Balance beginPrettyTable("4", "Closing Balance"); printRow(array("Code Number", "Description", "Amount")); while ($closingAccounts->getNext()) { printRow(array($closingAccounts->getActualCodeString(), $closingAccounts->getActualCodeName(), $closingAccounts->getActualBalance()), "abwechselnd"); } printRow(array("", "Total", $closingAccounts->getSum())); endPrettyTable(); } else { $ac_array = get_ac_array(1); $ac_array[0] = "ALL PROJECTS"; openForm("enter Date", $PHP_SELF); beginPrettyTable("2", "Project Balances"); makeDropBox("ac_id1", $ac_array, "Project"); makeTextField("startdate", get_today_hrd_string(), "Start Date:"); makeTextField("enddate", get_today_hrd_string(), "End Date:"); makeSubmitter(); endPrettyTable(); closeForm();