Example #1
0
* @copyright		Copyright 2003-2005, Fabio De Pascale
* @copyright	Copyright 2006-2012, Gjergj Sheldija
*/
$inizio = microtime();
define('ROOTDIR', '..');
require ROOTDIR . "/include/manage/mgmt_funs.php";
require ROOTDIR . "/include/manage/mgmt_start.php";
if (!access_allowed(USER_BIT_ACCOUNTING)) {
    $command = 'access_denied';
}
switch ($command) {
    case 'access_denied':
        echo access_denied_admin();
        break;
    case "show":
        show_receipt($start_id);
        break;
    case "delete":
        if (isset($_GET['deleteconfirm'])) {
            $deleteconfirm = $_GET['deleteconfirm'];
        } elseif (isset($_POST['deleteconfirm'])) {
            $deleteconfirm = $_POST['deleteconfirm'];
        }
        if ($deleteconfirm) {
            $delete = $_SESSION["delete"];
            unset($_SESSION["delete"]);
            delete_receipt_rows($delete);
            delete_log_rows($delete);
        } else {
            if (isset($_GET['delete'])) {
                $delete = $_GET['delete'];
 public function get_form()
 {
     if ($this->charge_status != null) {
         require_once plugin_dir_path(dirname(__FILE__)) . 'lib/form-helpers/post-show-receipt.php';
         show_receipt($this->thank_you, $this->charge_status);
     } elseif ($this->page_status == "new") {
         require_once plugin_dir_path(dirname(__FILE__)) . 'lib/make-form.php';
         $form = new Form_Form($this);
         echo $form->make();
     } else {
         throw new Exception("Unexpected load scenario. Try reload the page.");
     }
 }
<?php

require "../settings.php";
$OUTPUT = show_receipt($_GET);
require "../tmpl-print.php";
function show_receipt($_GET)
{
    extract($_GET);
    if (!isset($recid) or strlen($recid) < 1) {
        return "<li class='err'>Invalid use of module. Invalid Receipt ID.</li>";
    }
    db_connect();
    $get_rec = "SELECT * FROM cashbook WHERE cashid = '{$recid}' LIMIT 1";
    $run_rec = db_exec($get_rec) or errDie("Unable to get receipt information.");
    if (pg_numrows($run_rec) < 1) {
        return "<li class='err'>Receipt information not found.</li>";
    } else {
        $cash_arr = pg_fetch_array($run_rec);
        #get customer information
        $get_cust = "SELECT accno,surname,paddr1 FROM customers WHERE cusnum = '{$cash_arr['cusnum']}' LIMIT 1";
        $run_cust = db_exec($get_cust) or errDie("Unable to get customer information.");
        if (pg_numrows($run_cust) < 1) {
            $cus_addr = "";
            $cus_accno = "";
        } else {
            $cus_arr = pg_fetch_array($run_cust);
            $cus_addr = $cus_arr['paddr1'];
            $cus_accno = $cus_arr['accno'];
        }
        $inv_ids = explode("|", $cash_arr['rinvids']);
        $inv_amts = explode("|", $cash_arr['amounts']);