Ejemplo n.º 1
0
<?php

require_once '/wamp/www/DemoRest/common/define.php';
require_once '/wamp/www/DemoRest/common/SmartySetup.class.php';
require_once '/wamp/www/DemoRest_data/common/DbMgr.php';
//require_once('/wamp/www/DemoRest/calendar/classes/tc_calendar.php');
//require_once('calendar/classes/tc_calendar.php');
session_start();
//$errorMessage = '';
//Select Data and set in Table
$sql1 = "SELECT supplier_id, supplier_name, supply_material, delivery_date, payment_pending, paid_amount FROM supplier_master";
try {
    $dbh1 = DbMgr::getDB();
    $stmt1 = $dbh1->prepare($sql1);
    $ret1 = $stmt1->execute();
    if (!$ret1) {
        print "Error in Selection";
        exit;
    }
} catch (Exception $e) {
    print 'Error:' . $e->getMessage();
    die;
}
$result = array();
$number = 0;
while ($row = $stmt1->fetch(PDO::FETCH_ASSOC)) {
    $number = $number + 1;
    $result[] = array('number' => $number, 's_ID' => $row['supplier_id'], 's_name' => $row['supplier_name'], 's_material' => $row['supply_material'], 'd_date' => $row['delivery_date'], 'payment_pen' => $row['payment_pending'], 'pd_amount' => $row['paid_amount']);
}
$smartyObj = new SmartySetup();
$smartyObj->assign('userdata_json', json_encode($result, JSON_UNESCAPED_UNICODE));
Ejemplo n.º 2
0
        $vendtype = $_POST["ventype"];
        $vendor_id_selected = $_POST["vendor_id_select"];
        $pending_payment1 = $_POST["paymentpen1"];
        $paid_amount1 = $_POST["paydone1"];
        $pay_recieved1 = $_POST["payreceived1"];
        unset($_SESSION['ventype']);
        unset($_SESSION['vendor_id_select']);
        unset($_SESSION['paymentpen1']);
        unset($_SESSION['paydone1']);
        unset($_SESSION['payreceived1']);
        session_destroy();
        echo $vendtype;
        echo $vendor_id_selected;
        $sql = "INSERT INTO daily_transaction(transaction_date, vendor_type, vendor_id,pay_pending,pay_done,pay_received) VALUES (\n\tNow(),'{$vendtype}','{$vendor_id_selected}','{$pending_payment1}','{$paid_amount1}','{$pay_recieved1}')";
        try {
            $dbh = DbMgr::getDB();
            $stmt = $dbh->prepare($sql);
            $ret = $stmt->execute();
            if (!$ret) {
                print "Error in Registraion";
                exit;
            }
        } catch (Exception $e) {
            print 'Error:' . $e->getMessage();
            die;
        }
    }
}
header("Location: ./vendor_transaction.php");
//$smartyObj = new SmartySetup();
//$smartyObj->assign('userdata_json', json_encode($result,JSON_UNESCAPED_UNICODE));