$count = $row['count']; if ($count > 0) { $total_pages = ceil($count / $limit); } else { $total_pages = 0; } if ($page > $total_pages) { $page = $total_pages; } $start = $limit * $page - $limit; // do not put $limit*($page - 1) if ($start < 0) { $start = 0; } $SQL .= "ORDER BY {$sidx} {$sord}\nLIMIT {$start}, {$limit}\n"; dumpFile($SQL, 'Search SQL', 'w'); $result = mysql_query($SQL) or die("Couldn t execute query." . mysql_error()); if (stristr($_SERVER["HTTP_ACCEPT"], "application/xhtml+xml")) { header("Content-type: application/xhtml+xml;charset=utf-8"); } else { header("Content-type: text/xml;charset=utf-8"); } $et = ">"; $s = "<?xml version='1.0' encoding='utf-8'?{$et}\n"; $s .= "<rows>"; $s .= "<page>{$page}</page>"; $s .= "<total>{$total_pages}</total>"; $s .= "<records>{$count}</records>"; // be sure to put text data in CDATA while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $s .= "<row party_code='{$row['party_code']}'>";
if ($table == 'item_category' && $oper == 'add') { $sql = "SELECT max(new_id)+1 FROM item_category"; $result = mysql_query($sql) or die("Couldn t execute query." . mysql_error()); $row = mysql_fetch_array($result); $new_id = $row[0]; $colval = $colval . $seprator . "new_id = {$new_id}"; } else { if ($table == 'item_master') { mysql_query("INSERT INTO gears(item) VALUES('update lov')"); } } } } } $finalcurd = $firstpart . $colval . $lastpart; dumpFile($finalcurd, 'Final SQL', 'w'); $result = mysql_query($finalcurd) or die("Couldn t execute query." . mysql_error()); if ($table == 'chart_of_account') { $id = ""; if ($_POST['oper'] == 'add') { $id = mysql_insert_id(); } else { $id = $_POST['id']; } $year_id = getValue("year_id", "sys_financial_year", "company_ref_id = {$_GET['comp']} AND is_active = 'Yes'"); $result = mysql_query("SELECT account_opening_balance_id FROM account_opening_balance WHERE account_code = {$id} AND year_id = {$year_id}") or die("Couldn t execute query." . mysql_error()); $num = mysql_num_rows($result); $sql = ""; if ($num > 0) { $key = mysql_fetch_row($result); $key = $key[0];
function df(&$var) { if (is_user_logged_in()) { dumpFile($var); } }
} } $finalcurd = $firstpart . $colval . $lastpart; if (strlen($finalcurd) > 0) { dumpFile($finalcurd, 'Final SQL', 'a'); $result = mysql_query($finalcurd); dumpFile($result, 'Final Result'); $error = mysql_error(); dumpFile($error, 'Final Error'); if ($table == 'cheque_post' && $_POST['cheque_status'] == 'Clear') { include_once 'connecti.php'; $master = $_POST['id']; if ($oper == 'add') { $master = mysql_insert_id(); } $voucher_id = getValue("voucher_id", "cheque_post", "cheque_post_id = {$master}"); if (strlen($voucher_id) > 0) { $db = "UPDATE voucher_detail SET debit_amount = {$_POST['cheque_amount']}, account_ref_id = {$_POST['bank_ref_id']} WHERE voucher_id = {$voucher_id} AND remarks = 'Debit'"; dumpFile($db, 'Debit', 'a'); mysql_query($db); $cr = "UPDATE voucher_detail SET credit_amount = {$_POST['cheque_amount']}, account_ref_id = {$_POST['party_ref_id']} WHERE voucher_id = {$voucher_id} AND remarks = 'Credit'"; dumpFile($cr, 'Credit', 'a'); mysql_query($cr); } else { $year_id = getValue("year_id", "sys_financial_year", "company_ref_id = {$_GET['comp']} AND is_active = 'Yes'"); $debug = createVoucher($_GET['comp'], $year_id, $_POST['bank_ref_id'], $_POST['party_ref_id'], $_POST['cheque_amount'], 'Cheque Cleared', $master, 'CQ', $_POST['cheque_date'], $_SESSION['user_id']); dumpFile($debug, 'Create Voucher', 'a'); } } } }
pieErrorImage(); } imagecopyresized($resized, $original, 0, 0, 0, 0, $nw, $nh, $ow, $oh); imagegif($resized, $path); dumpFile($path, $type); break; case 'image/jpeg': if (!function_exists('imagecreatefromjpeg')) { dumpFile($name, $type); } if (!($original = imagecreatefromjpeg($name))) { pieErrorImage(); } imagecopyresized($resized, $original, 0, 0, 0, 0, $nw, $nh, $ow, $oh); imagejpeg($resized, $path); dumpFile($path, $type); break; case 'image/png': if (!function_exists('imagecreatefrompng')) { dumpFile($name, $type); } if (!($original = imagecreatefrompng($name))) { pieErrorImage(); } imagecopyresized($resized, $original, 0, 0, 0, 0, $nw, $nh, $ow, $oh); imagepng($resized, $path); dumpFile($path, $type); break; default: pieErrorImage(); }
function stackFile($level = 1) { $s = debug_backtrace(); global $MAX_DUMP_LEVEL; $oldLevel = $MAX_DUMP_LEVEL; $MAX_DUMP_LEVEL = $level; dumpFile($s); $MAX_DUMP_LEVEL = $oldLevel; }
if ($key == 'cat_id') { $val = getValue("cat_id", "item_category", "cat_name = (SELECT cat_name FROM item_category WHERE cat_id = {$val}) AND company_ref_id = 3"); } else { if ($key == 'vehicle_id') { $val = getValue("sys_codes_ref_id", "sys_codes", "code = (SELECT code FROM sys_codes WHERE sys_codes_ref_id = {$val}) AND company_ref_id = 3"); } } } $val = trim($val); if ($val == '#NULL#') { $colval = $colval . $seprator . $key . " = NULL"; } else { $colval = $colval . $seprator . $key . " = '" . $val . "'"; } $seprator = ', '; } } $colval = $colval . $seprator . "company_ref_id = '3'"; $finalcurd = $firstpart . $colval . $lastpart; dumpFile($finalcurd, 'Final Item SQL', 'a'); $result = oci_parse($conn, $finalcurd); oci_execute($result); dumpFile($result, 'Final Item Result'); $error = oci_error(); dumpFile($error, 'Final Item Error'); if ($table == 'item_master') { oci_parse($conn, "INSERT INTO gears(item, company_ref_id) VALUES('Items', '3')"); } } } }