Ejemplo n.º 1
0
function runBilling()
{
    global $results;
    $b = new Billing();
    $t = new Treatment();
    $a = new Admin();
    // For getting list of patients
    $patients = $a->getAllPatients();
    $pid = array_search('BTEST1', $patients);
    // Create billing account
    // Prereq: Patient exists (uses PTEST1)
    $new = array('pid' => $pid, 'insname' => 'test', 'insacct' => '1337');
    $results['billing_newAcct'] = $b->addAccount($new);
    // Update Billing account
    // Prereq: Billing account exists
    $new = array('pid' => $pid, 'insname' => 'MooCows Inc.');
    $results['billing_updateAcct'] = $b->updateAccount($new);
    // Get Bill
    // Prereq: Billing account exists.
    $results['billing_getBill'] = $b->getBill($pid);
    //Process EDT record
    //Prereq: Unprocessed EDT record exists for patient, billing account exists.
    $edts = $t->getUnprocessedEDTs($pid);
    $edt = $edts[0]['edtid'];
    $results['billing_processEDT'] = $b->processEDT($edt);
    //Receive a payment
    //Prereq: Billing account exists.
    $results['billing_receivePayment'] = $b->receivePayment(array('pid' => $pid, 'amnt' => 10));
    // Close Account
    // Prereq: Account exists.
    // 		- For testing purposes, balance should be negative as to avoid two-stage process (manually tested).
    $results['billing_closeAccount'] = $b->closeAccount($pid);
}
 public function processPayment()
 {
     $v = Validator::make(["amount" => Input::get("amount"), "email" => Input::get("email")], ["amount" => "required|integer", "email" => "required|email"]);
     if ($v->passes()) {
         $billing = new Billing();
         $billing->name = Input::get("name");
         $billing->address = Input::get("address");
         $billing->city = Input::get("city");
         $billing->state = Input::get("state");
         $billing->zip = Input::get("zip");
         $billing->email = Input::get("email");
         $billing->phone = Input::get("phone");
         $billing->save();
         $order = new Order();
         $order->amount = Input::get("amount");
         $order->billing_id = $billing->id;
         $order->save();
         $bitcoinRedirectURL = URL::to("/");
         if (Input::get('type') == "bitpay") {
             try {
                 $bitpayResponse = $this->bitpayRequestCurl($order->id, $order->amount, $billing);
             } catch (\Exception $e) {
                 Session::flash("error_msg", $e->getMessage());
                 return Redirect::back();
             }
             //Set order status to pending since user didnt paid yet and serialize the response maybe useful later
             $order->type = "bitpay";
             $order->status = "Pending";
             $order->response = serialize($bitpayResponse);
             $bitcoinRedirectURL = $bitpayResponse->url;
         }
         if (Input::get('type') == "coinbase") {
             try {
                 $coinbaseResponse = $this->coinbaseRequestCurl($order->id, $order->amount);
             } catch (\Exception $e) {
                 Session::flash("error_msg", $e->getMessage());
                 return Redirect::back();
             }
             $order->type = "coinbase";
             $order->status = "Pending";
             $order->response = serialize($coinbaseResponse);
             $bitcoinRedirectURL = "https://www.coinbase.com/checkouts/" . $coinbaseResponse->button->code;
         }
         return Redirect::to($bitcoinRedirectURL);
     } else {
         $response = "";
         $messages = $v->messages()->all();
         foreach ($messages as $message) {
             $response .= "<li style='margin-left:10px;'>{$message}</li>";
         }
         Session::flash("error_msg", $response);
         return Redirect::back()->withInput();
     }
 }
 public function postCheckEncounter()
 {
     $eid = Session::get('eid');
     $error = "";
     $hpi = Hpi::find($eid);
     $pe = Pe::find($eid);
     $assessment = Assessment::find($eid);
     $encounter = Encounters::find($eid);
     $billing = Billing::where('eid', '=', $eid)->first();
     if (!$hpi) {
         $error .= "Missing History of Present Illness<br>";
     }
     if ($encounter->encounter_template == 'standardmedical') {
         if (!$pe) {
             $error .= "Missing Physical Exam<br>";
         }
     }
     if (!$assessment) {
         $error .= "Missing Assessment<br>";
     }
     if (!$billing) {
         $error .= "Missing Billing<br>";
     }
     echo $error;
 }
Ejemplo n.º 4
0
 public function filterReglab()
 {
     $filterreglab = Input::get('noreglab');
     //Untuk pencarian berdasarkan tanggal periksa
     $bils = Billing::where('NoRegLab', '=', $filterreglab)->orWhere('nama', 'LIKE', '%' . $filterreglab . '%')->orderBy('Tgl_Periksa')->paginate(5);
     return View::make('billing.filterbil')->with('bils', $bils);
 }
Ejemplo n.º 5
0
 /**
  * Show the form for editing the specified resource.
  * GET /medications/{id}/edit
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $test_items = Billing::select('id', 'item')->where('type', '=', 'Laboratory Test')->get();
     $prescription_items = Billing::select('id', 'item')->where('type', '=', 'Medication')->get();
     $medication = Medication::find($id);
     $test = Test::find($id);
     return View::make('medications.edit', compact('medication', 'test_items', 'prescription_items', 'test'));
 }
Ejemplo n.º 6
0
 protected static function init()
 {
     if (self::$_isInit) {
         return;
     }
     $prices = K_TreeQuery::gOne('/payment/accountscost/', 'prices');
     self::$_adminCost = $prices['admin_cost'];
     self::$_userCost = $prices['user_cost'];
     self::$_isInit = true;
 }
Ejemplo n.º 7
0
 public function __construct()
 {
     parent::__construct();
     $cur = $this->userauth->current(TRUE);
     if (empty($cur)) {
         $this->_return_json(array('status' => C('status.auth.login_timeout'), 'msg' => '登录超时,请重新登录'));
     } else {
         self::$user_info = $cur;
     }
     $this->load->library(array('form_validation'));
 }
Ejemplo n.º 8
0
 public function setUp()
 {
     $cfg = new MerchantConfig('MERCHANT_CODE', 'SECRET_KEY', 'RO');
     $user = new User('127.0.0.1');
     $order = new Order();
     $order->withBackRef('http://path/to/your/returnUrlScript')->withOrderRef('MerchantOrderRef')->withCurrency('RON')->withOrderDate('2014-09-19 10:00:00')->withOrderTimeout(1000)->withPayMethod('CCVISAMC')->withInstallmentsNumber(2)->withCampaignType('EXTRA_INSTALLMENTS');
     $product = new Product();
     $product->withCode('PCODE01')->withName('PNAME01')->withPrice(100.0)->withVAT(24.0)->withQuantity(1);
     $order->addProduct($product);
     $product = new Product();
     $product->withCode('PCODE02')->withName('PNAME02')->withPrice(200.0)->withVAT(24.0)->withQuantity(1);
     $order->addProduct($product);
     $billing = new Billing();
     $billing->withAddressLine1('ADDRESS1')->withAddressLine2('ADDRESS2')->withCity('Bucuresti')->withCountryCode('RO')->withEmail('*****@*****.**')->withFirstName('John')->withLastName('Doe')->withPhoneNumber('0755167887')->withIdentityCardNumber('324322');
     $delivery = new Delivery();
     $delivery->withAddressLine1('ADDRESS1')->withAddressLine2('ADDRESS2')->withCity('Bucuresti')->withCountryCode('RO')->withEmail('*****@*****.**')->withFirstName('John')->withLastName('Doe')->withPhoneNumber('0755167887');
     $card = new Card('5431210111111111', '11', 2016, 123, 'test');
     $this->request = new Request($cfg, $order, $billing, $delivery, $user);
     $this->request->setCard($card);
 }
Ejemplo n.º 9
0
 public function testAfterSave()
 {
     $addressId = 1;
     $attributeCode = 'attribute_code';
     $defaultBilling = 'default billing address';
     $object = $this->getMockBuilder('Magento\\Framework\\Object')->disableOriginalConstructor()->setMethods(array('getDefaultBilling', 'getAddresses', 'setDefaultBilling'))->getMock();
     $address = $this->getMockBuilder('Magento\\Framework\\Object')->disableOriginalConstructor()->setMethods(array('getPostIndex', 'getId'))->getMock();
     $attribute = $this->getMockBuilder('Magento\\Eav\\Model\\Entity\\Attribute\\AbstractAttribute')->setMethods(array('__wakeup', 'getEntity', 'getAttributeCode'))->disableOriginalConstructor()->getMockForAbstractClass();
     $entity = $this->getMockBuilder('Magento\\Eav\\Model\\Entity\\AbstractEntity')->setMethods(array('saveAttribute'))->disableOriginalConstructor()->getMockForAbstractClass();
     $attribute->expects($this->once())->method('getEntity')->will($this->returnValue($entity));
     $attribute->expects($this->once())->method('getAttributeCode')->will($this->returnValue($attributeCode));
     $entity->expects($this->once())->method('saveAttribute')->with($this->logicalOr($object, $attributeCode));
     $address->expects($this->once())->method('getPostIndex')->will($this->returnValue($defaultBilling));
     $address->expects($this->once())->method('getId')->will($this->returnValue($addressId));
     $object->expects($this->once())->method('getDefaultBilling')->will($this->returnValue($defaultBilling));
     $object->expects($this->once())->method('setDefaultBilling')->with($addressId)->will($this->returnSelf());
     $object->expects($this->once())->method('getAddresses')->will($this->returnValue(array($address)));
     /** @var \Magento\Framework\Object $object */
     /** @var \Magento\Eav\Model\Entity\Attribute\AbstractAttribute $attribute */
     $this->testable->setAttribute($attribute);
     $this->testable->afterSave($object);
 }
Ejemplo n.º 10
0
                    <tr>
                      <td><span class="extra bold totalamout">Total :</span></td>
                      <td><span class="bold totalamout"><?php 
    echo Yii::app()->params['adminCurrency'];
    echo $grandTotalFinal;
    ?>
</span></td>
                    </tr>
                    </tbody>
                  </table>


            <?php 
    if (Yii::app()->user->id != '') {
        $user_id = Yii::app()->user->id;
        $chkBillExist = Billing::model()->find('user_id = :user_id', array(':user_id' => $user_id));
        if (empty($chkBillExist)) {
            //dont show the place order button, flash msg to add billing address
        } else {
            ?>

        <?php 
        }
    }
    ?>
                  
           
           <input type="submit"  onclick="window.location.href='index.php?r=shoppingCart/thank'"  value="Place Order" class="btn btn-orange pull-right">

            <input type="submit" onclick="window.location.href='index.php'" value="Continue Shopping" class="btn btn-orange pull-right mr10">
                  
 function customers_list()
 {
     global $Shopp, $Customers, $wpdb;
     $db = DB::get();
     $defaults = array('page' => false, 'deleting' => false, 'selected' => false, 'update' => false, 'newstatus' => false, 'pagenum' => 1, 'per_page' => false, 'start' => '', 'end' => '', 'status' => false, 's' => '', 'range' => '', 'startdate' => '', 'enddate' => '');
     $args = array_merge($defaults, $_GET);
     extract($args, EXTR_SKIP);
     if ($page == "shopp-customers" && !empty($deleting) && !empty($selected) && is_array($selected)) {
         foreach ($selected as $deletion) {
             $Customer = new Customer($deletion);
             $Billing = new Billing($Customer->id, 'customer');
             $Billing->delete();
             $Shipping = new Shipping($Customer->id, 'customer');
             $Shipping->delete();
             $Customer->delete();
         }
     }
     if (!empty($_POST['save'])) {
         check_admin_referer('shopp-save-customer');
         if ($_POST['id'] != "new") {
             $Customer = new Customer($_POST['id']);
             $Billing = new Billing($Customer->id, 'customer');
             $Shipping = new Shipping($Customer->id, 'customer');
         } else {
             $Customer = new Customer();
         }
         $Customer->updates($_POST);
         if (!empty($_POST['new-password']) && !empty($_POST['confirm-password']) && $_POST['new-password'] == $_POST['confirm-password']) {
             $Customer->password = wp_hash_password($_POST['new-password']);
             if (!empty($Customer->wpuser)) {
                 wp_set_password($_POST['new-password'], $Customer->wpuser);
             }
         }
         $Customer->save();
         $Billing->updates($_POST['billing']);
         $Billing->save();
         $Shipping->updates($_POST['shipping']);
         $Shipping->save();
     }
     $pagenum = absint($pagenum);
     if (empty($pagenum)) {
         $pagenum = 1;
     }
     if (!$per_page || $per_page < 0) {
         $per_page = 20;
     }
     $index = $per_page * ($pagenum - 1);
     if (!empty($start)) {
         $startdate = $start;
         list($month, $day, $year) = explode("/", $startdate);
         $starts = mktime(0, 0, 0, $month, $day, $year);
     }
     if (!empty($end)) {
         $enddate = $end;
         list($month, $day, $year) = explode("/", $enddate);
         $ends = mktime(23, 59, 59, $month, $day, $year);
     }
     $customer_table = DatabaseObject::tablename(Customer::$table);
     $billing_table = DatabaseObject::tablename(Billing::$table);
     $purchase_table = DatabaseObject::tablename(Purchase::$table);
     $users_table = $wpdb->users;
     $where = '';
     if (!empty($s)) {
         $s = stripslashes($s);
         if (preg_match_all('/(\\w+?)\\:(?="(.+?)"|(.+?)\\b)/', $s, $props, PREG_SET_ORDER)) {
             foreach ($props as $search) {
                 $keyword = !empty($search[2]) ? $search[2] : $search[3];
                 switch (strtolower($search[1])) {
                     case "company":
                         $where .= (empty($where) ? "WHERE " : " AND ") . "c.company LIKE '%{$keyword}%'";
                         break;
                     case "login":
                         $where .= (empty($where) ? "WHERE " : " AND ") . "u.user_login LIKE '%{$keyword}%'";
                         break;
                     case "address":
                         $where .= (empty($where) ? "WHERE " : " AND ") . "(b.address LIKE '%{$keyword}%' OR b.xaddress='%{$keyword}%')";
                         break;
                     case "city":
                         $where .= (empty($where) ? "WHERE " : " AND ") . "b.city LIKE '%{$keyword}%'";
                         break;
                     case "province":
                     case "state":
                         $where .= (empty($where) ? "WHERE " : " AND ") . "b.state='{$keyword}'";
                         break;
                     case "zip":
                     case "zipcode":
                     case "postcode":
                         $where .= (empty($where) ? "WHERE " : " AND ") . "b.postcode='{$keyword}'";
                         break;
                     case "country":
                         $where .= (empty($where) ? "WHERE " : " AND ") . "b.country='{$keyword}'";
                         break;
                 }
             }
         } elseif (strpos($s, '@') !== false) {
             $where .= (empty($where) ? "WHERE " : " AND ") . "c.email='{$s}'";
         } else {
             $where .= (empty($where) ? "WHERE " : " AND ") . " (c.id='{$s}' OR CONCAT(c.firstname,' ',c.lastname) LIKE '%{$s}%' OR c.company LIKE '%{$s}%')";
         }
     }
     if (!empty($starts) && !empty($ends)) {
         $where .= (empty($where) ? "WHERE " : " AND ") . ' (UNIX_TIMESTAMP(c.created) >= ' . $starts . ' AND UNIX_TIMESTAMP(c.created) <= ' . $ends . ')';
     }
     $customercount = $db->query("SELECT count(*) as total FROM {$customer_table} AS c {$where}");
     $query = "SELECT c.*,b.city,b.state,b.country, u.user_login, SUM(p.total) AS total,count(distinct p.id) AS orders FROM {$customer_table} AS c LEFT JOIN {$purchase_table} AS p ON p.customer=c.id LEFT JOIN {$billing_table} AS b ON b.customer=c.id LEFT JOIN {$users_table} AS u ON u.ID=c.wpuser AND (c.wpuser IS NULL OR c.wpuser !=0) {$where} GROUP BY c.id ORDER BY c.created DESC LIMIT {$index},{$per_page}";
     $Customers = $db->query($query, AS_ARRAY);
     $num_pages = ceil($customercount->total / $per_page);
     $page_links = paginate_links(array('base' => add_query_arg('pagenum', '%#%'), 'format' => '', 'total' => $num_pages, 'current' => $pagenum));
     $ranges = array('all' => __('Show New Customers', 'Shopp'), 'today' => __('Today', 'Shopp'), 'week' => __('This Week', 'Shopp'), 'month' => __('This Month', 'Shopp'), 'quarter' => __('This Quarter', 'Shopp'), 'year' => __('This Year', 'Shopp'), 'yesterday' => __('Yesterday', 'Shopp'), 'lastweek' => __('Last Week', 'Shopp'), 'last30' => __('Last 30 Days', 'Shopp'), 'last90' => __('Last 3 Months', 'Shopp'), 'lastmonth' => __('Last Month', 'Shopp'), 'lastquarter' => __('Last Quarter', 'Shopp'), 'lastyear' => __('Last Year', 'Shopp'), 'lastexport' => __('Last Export', 'Shopp'), 'custom' => __('Custom Dates', 'Shopp'));
     $exports = array('tab' => __('Tab-separated.txt', 'Shopp'), 'csv' => __('Comma-separated.csv', 'Shopp'), 'xls' => __('Microsoft&reg; Excel.xls', 'Shopp'));
     $formatPref = $Shopp->Settings->get('customerexport_format');
     if (!$formatPref) {
         $formatPref = 'tab';
     }
     $columns = array_merge(Customer::exportcolumns(), Billing::exportcolumns(), Shipping::exportcolumns());
     $selected = $Shopp->Settings->get('customerexport_columns');
     if (empty($selected)) {
         $selected = array_keys($columns);
     }
     $authentication = $Shopp->Settings->get('account_system');
     include "{$this->basepath}/core/ui/customers/customers.php";
 }
Ejemplo n.º 12
0
 public function billAction()
 {
     //validate params
     if (!$this->validateParams() || $this->_getParam("pToken") == null) {
         $this->redirectError();
         return;
     }
     $token = new vng_zingme_payment_thrift_T_Token();
     $pToken = $this->_getParam("pToken");
     $token->pToken = DataFormat::hex2str($pToken);
     $this->updateTokenCached();
     $billing = new Billing($this->_getParam("appID"), $this->_getParam("data"), $token, $_SERVER['REMOTE_ADDR']);
     $resCode = $billing->bill();
     $this->view->billNo = $this->_getParam("refID");
     $this->view->title = "Ví Zing Me - Kết quả xác nhận thanh toán sản phẩm";
     $this->view->billresult = $resCode->code;
     $this->view->refID = $resCode->refNo;
     //sure that this is 3th time when server finish process user's bill
     ScriberPayment::sendLogStep3($this->userID, $this->_getParam("appID"), $this->_getParam("refID"), $resCode->code, $resCode->refNo);
     if ($resCode->code != 0) {
         $this->render('billingfail');
     } else {
         $this->view->success = 1;
         $appCache = $this->getAppCache($this->userID, $this->_getParam("appID"));
         if ($appCache && $appCache == '1') {
             $this->view->isLite = 1;
         }
         $this->render('billingresult');
     }
 }
Ejemplo n.º 13
0
 /**
  * Remove the specified resource from storage.
  * DELETE /billings/{id}
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy(Billing $billing)
 {
     $billing->delete();
     return Redirect::route('billings-item-get')->with('global', 'Item deleted successfully');
 }
Ejemplo n.º 14
0
include_once "../../../includes/bootstrap.php";
include "../../../classes/Cart.php";
include "../../../classes/Products.php";
include "../../../classes/Client.php";
include "../../../classes/Coupon.php";
include "../../../classes/Shipping.php";
include "../../../classes/Billing.php";
include "../../../classes/ShippingRate.php";
include "../../../classes/AdminAction.php";
include "../../../includes/security.funcs.inc";
include_once "../../../includes/Pagination.php";
$myCart = Cart::findCartByOrderID($_REQUEST['id']);
$clients = Client::findClient($myCart->fldCartClientID);
$shipping = Shipping::findShippingClient($clients->fldClientID);
$shippingRate = ShippingRate::findShippingRateByOrderCode($_REQUEST['id']);
$billing = Billing::findBillingClient($clients->fldClientID);
?>
<!DOCTYPE html>  
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us" lang="en-us">  
<head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
  <link rel="stylesheet" type="text/css" media="screen" href="<?php 
echo $ROOT_URL;
?>
_admin/_assets/css/core3.css" /> 
  <link rel="stylesheet" type="text/css" media="screen" href="<?php 
echo $ROOT_URL;
?>
_admin/_assets/css/modules.css" /> 
</head>
Ejemplo n.º 15
0
 /**
  * ecartregcust::add_user()
  * 
  * @param mixed $data
  * @return
  */
 private function add_user()
 {
     require_once(ABSPATH."/wp-includes/registration.php");
     
     $Errors =& EcartErrors();
     $Errors->reset();
     if (empty($_POST['customer']['email'])) 
     {
         $this->form_error = 'Email address is required.';
         return false;
     }
     if ($this->email_exists($_POST['customer']['email'])) 
     {
         $this->form_error = 'Email address is already registered with another customer.';
         return false;
     }
     if (empty($_POST['customer']['password'])) 
     {
         $this->form_error = 'Password is required.';
         return false;
     }
     if ($_POST['customer']['password'] !== $_POST['customer']['confirm-password']) 
     {
         $this->form_error = 'Passwords do not match.';
         return false;
     } 
     if ($this->ecart_account_type == 'wordpress')
     {
         if (empty($_POST['customer']['loginname'])) 
         {
             $this->form_error = 'Username is already registered.';
             return false;                
         }
         if (email_exists($_POST['customer']['email']))
         {
             $this->form_error = 'Email address is already registered with another user.';
             return false;                 
         }
     }
     if ($this->show_billing)
     {
         if (empty($_POST['billing']['address']))
         {
             $this->form_error = 'Street address is required.';
             return false;                
         }
         if (empty($_POST['billing']['city']))
         {
             $this->form_error = 'City is required.';
             return false;                
         }
         if (empty($_POST['billing']['state']))
         {
             $this->form_error = 'State is required.';
             return false;                
         }
         if (empty($_POST['billing']['postcode']))
         {
             $this->form_error = 'Postcode is required.';
             return false;                
         }
     }
     
     $customer_data = $_POST['customer'];
     
     $ecart_customer = new Customer();
     $ecart_customer->updates($customer_data);
     
     if ($this->ecart_account_type == 'wordpress') 
     {
         $ecart_customer->create_wpuser(); // not logged in, create new account
         $customer_data['wpuser'] = $ecart_customer->wpuser;
         unset($ecart_customer->password);
         if ($Errors->exist(ECART_ERR)) 
         {
             $ecart_error = $Errors->get(ECART_ERR);
             $this->form_error = implode(', ', $ecart_error[0]->messages);
             return false;
         }
     }
     else
     {       
         $ecart_customer->password = wp_hash_password($data['password']);
     }        
     $ecart_customer->save();
     
     if ($Errors->exist(ECART_ERR)) 
     {
         $ecart_error = $Errors->get(ECART_ERR);
         $this->form_error = implode(', ', $ecart_error[0]->messages);
         return false;
     }                
     if ($this->show_billing)
     {
         $billing_data = $_POST['billing'];
         $ecart_billing = new Billing();  
         $ecart_billing->updates($billing_data);
         $ecart_billing->customer = $ecart_customer->id;
         $ecart_billing->save();
     }        
     
     return $customer_data;
 }
 public function actionThank()
 {
     $user_id = Yii::app()->user->id;
     //check the billing / shipping values coresponding to this user
     $chkBillExist = Billing::model()->find('user_id = :user_id', array(':user_id' => $user_id));
     //echo "<pre>";
     //print_r($chkBillExist);
     if (empty($chkBillExist)) {
         //redirect back to checkout page
         Yii::app()->user->setFlash('showMsg', 'Your billing details are empty.');
         $this->redirect(array('shoppingCart/checkout'));
     }
     $chkShipExist = Shipping::model()->find('user_id = :user_id', array(':user_id' => $user_id));
     if (empty($chkShipExist)) {
         Yii::app()->user->setFlash('showMsg', 'Please fill your shipping details.');
         $this->redirect(array('shoppingCart/checkout'));
     }
     //end
     $model = new Reward();
     $orderModel = new Order();
     //check the session exist
     //check billing/ shipping session exist
     //finally placed the order
     //insert the cart in order table
     if (count($_SESSION['items']) > 0) {
         //get billing/shipping ids of login user
         $chkBillExist = Billing::model()->find('user_id = :user_id', array(':user_id' => $user_id));
         if (empty($chkBillExist)) {
         } else {
             $billAddId = $chkBillExist['id'];
         }
         //get shipping ids of login user
         $chkShipExist = Shipping::model()->find('user_id = :user_id', array(':user_id' => $user_id));
         if (empty($chkShipExist)) {
         } else {
             $shipAddId = $chkShipExist['id'];
         }
         $insertOrders = Yii::app()->db->createCommand()->insert('shop_order', array('user_id' => $user_id, 'shipping_address_id' => $billAddId, 'billing_address_id' => $shipAddId, 'ordering_done' => 1, 'grandtotal' => $_SESSION['grandTotalFinal']));
         $order_id = Yii::app()->db->getLastInsertID();
         foreach ($_SESSION['items'] as $key => $data) {
             //insert into order detail table
             $insertOrders = Yii::app()->db->createCommand()->insert('shop_order_detail', array('order_id' => $order_id, 'reward_id' => $data['id'], 'quantity' => $data['quantity']));
             $productRewardId = $data['id'];
             //get the existing quantity from db and add the posted quanity in it
             $getQuantity = "SELECT instock from reward where id = {$productRewardId}";
             $getQtyValue = Yii::app()->db->createCommand($getQuantity)->queryRow();
             $finalQuantity = $getQtyValue['instock'] - $data['quantity'];
             //update the quantity of each product shop by user
             $getResult = Yii::app()->db->createCommand()->update('reward', array('instock' => $finalQuantity), 'id=' . $data['id']);
         }
         //send email to admin and user
         $this->sendEmailToAll($order_id, $user_id);
         //end
         if (isset($_SESSION['items'])) {
             unset($_SESSION['items']);
             unset($_SESSION['grandTotalFinal']);
         }
     } else {
         Yii::app()->user->setFlash('showMsg', 'Shopping cart is empty.');
         $this->redirect(array('shoppingCart/view'));
     }
     //echo  Yii::app()->db->lastInsertID;
     //echo "----";
     //echo $last_id = Yii::app()->db->getLastInsertID();
     $this->render('thank', array('model' => $orderModel));
 }
Ejemplo n.º 17
0
	function CustomersExport () {
		global $Ecart;

		$this->customer_cols = Customer::exportcolumns();
		$this->billing_cols = Billing::exportcolumns();
		$this->shipping_cols = Shipping::exportcolumns();
		$this->defined = array_merge($this->customer_cols,$this->billing_cols,$this->shipping_cols);

		$this->sitename = get_bloginfo('name');
		$this->headings = ($Ecart->Settings->get('customerexport_headers') == "on");
		$this->selected = $Ecart->Settings->get('customerexport_columns');
		$Ecart->Settings->save('customerexport_lastexport',mktime());
	}
Ejemplo n.º 18
0
 /**
  * Consultation helper function
  *
  * @return float
  */
 public function getFixedCharges()
 {
     return Billing::where('type', '=', 'Fixed Charges')->get();
 }
Ejemplo n.º 19
0
        $patients = $b->getPatients(true);
        if (!$patients) {
            echo "<p class='notice'>There are no patients with billing accounts.</p>";
        }
        $form = array('form_action' => 'receivePayment', 'submit_text' => 'Update Bill', '_dropdown1' => array('label' => 'Patient', 'name' => 'pid', $patients), 'amnt' => array('label' => 'Amount $', 'value' => 0));
        buildForm($form);
        ?>
		
		<a name='getBill'></a>
		<h2><?php 
        echo $items['getBill'];
        ?>
</h2>
		<p>View the current bill for the patient.</p>
		<?php 
        $b = new Billing();
        $patients = $b->getPatients(true);
        if (!$patients) {
            echo "<p class='notice'>There are no patients with billing accounts.</p>";
        }
        $form = array('form_action' => 'getBill', 'submit_text' => 'Get Bill', '_dropdown1' => array('label' => 'Patient', 'name' => 'pid', $patients));
        buildForm($form);
        ?>
		
		
	
		<?php 
        break;
        // Default index page
    // Default index page
    default:
Ejemplo n.º 20
0
 public function stateAction()
 {
     $date = new Zend_Date('2010-03-15 00:00:00');
     $date1 = new Zend_Date();
     require_once APPLICATION_PATH . '/models/Billing.php';
     require_once ROOT_PATH . '/util/Period.php';
     $period = new Period($date, $date1);
     $userID = $this->_getParam('userID');
     $accountNo = $this->_getParam('userNo');
     $bill = new Billing();
     $rows = $bill->getStatement($userID, $accountNo, $period);
     $this->view->rows = $rows;
     $this->render('billing');
 }
Ejemplo n.º 21
0
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/
/**
 * Register route bindings
 * FYI - Should be done in the service providers
 */
// Start a new visit
Route::bind('patient', function ($value, $route) {
    return $patient = Patient::find($value);
});
// Destroy a billing item
Route::bind('billing', function ($value, $route) {
    return Billing::where('id', $value)->first();
});
// Destroy a client
Route::bind('bima', function ($value, $route) {
    return Bima::find($value);
});
/**
 * Homepage
 */
Route::get('/', array('as' => 'home', 'uses' => 'HomeController@home'));
/**
 * Authenticated Users
 */
Route::group(array('before' => 'auth'), function () {
    /**
     * CSRF protection group
Ejemplo n.º 22
0
            }
            break;
        case 'getBill':
            $b = new Billing();
            $b->displayBill($data['pid']);
            break;
            // Do nothing
        // Do nothing
        default:
            printError("Nothing was done...");
    }
    // ==================================================
    // Special cases
    // Process an individual EDT
} elseif (array_key_exists('processEDT', $_GET) && $_GET['processEDT']) {
    $b = new Billing();
    $t = new Treatment();
    if ($b->processEDT($_GET['processEDT'])) {
        header('Location: index.php?billing&success=b');
    } else {
        printError("Failed to process EDT record.");
    }
    // For first run of this HMS (index.php)
} elseif ($_SERVER['QUERY_STRING'] == 'insertEmployees') {
    $db = new Database();
    if ($db->query("SELECT sin FROM Employees")) {
        echo "<p class='notice'>This employee already exists.</p>";
    } else {
        $employee = array('ename' => 'Emp1', 'sin' => 1337, 'address' => '1 Hello Wrld.');
        $job = array('jname' => 'OB', 'jtype' => 'C');
        if ($db->insert('Employees', $employee)) {
Ejemplo n.º 23
0
 /**
  * get or create attribute data for given object
  *
  * @param Billing $object
  * @return \Shopware\Models\Attribute\CustomerBilling
  * @throws Exception 
  */
 public function getOrCreateBillingAttribute($object)
 {
     if ($attribute = $object->getAttribute()) {
         return $attribute;
     }
     if ($object instanceof Shopware\Models\Customer\Billing) {
         if (!($attribute = Shopware()->Models()->getRepository('Shopware\\Models\\Attribute\\CustomerBilling')->findOneBy(array('customerBillingId' => $object->getId())))) {
             $attribute = new Shopware\Models\Attribute\CustomerBilling();
         }
     } else {
         throw new Exception('Unknown attribute base class');
     }
     $object->setAttribute($attribute);
     return $attribute;
 }
 /**
  * order()
  * Handles new order notifications from Google */
 function order($XML)
 {
     global $Shopp;
     $db = DB::get();
     // Check if this is a Shopp order or not
     $origin = $XML->getElementContent('shopping-cart-agent');
     if (empty($origin) || substr($origin, 0, strpos("/", SHOPP_GATEWAY_USERAGENT)) == SHOPP_GATEWAY_USERAGENT) {
         return true;
     }
     $buyer = $XML->getElement('buyer-billing-address');
     $buyer = $buyer['CHILDREN'];
     $Customer = new Customer();
     $name = $XML->getElement('structured-name');
     $Customer->firstname = $buyer['structured-name']['CHILDREN']['first-name']['CONTENT'];
     $Customer->lastname = $buyer['structured-name']['CHILDREN']['last-name']['CONTENT'];
     if (empty($name)) {
         $name = $buyer['contact-name']['CONTENT'];
         $names = explode(" ", $name);
         $Customer->firstname = $names[0];
         $Customer->lastname = $names[count($names) - 1];
     }
     $Customer->email = $buyer['email']['CONTENT'];
     $Customer->phone = $buyer['phone']['CONTENT'];
     $Customer->save();
     $Billing = new Billing();
     $Billing->customer = $Customer->id;
     $Billing->address = $buyer['address1']['CONTENT'];
     $Billing->xaddress = $buyer['address2']['CONTENT'];
     $Billing->city = $buyer['city']['CONTENT'];
     $Billing->state = $buyer['region']['CONTENT'];
     $Billing->country = $buyer['country-code']['CONTENT'];
     $Billing->postcode = $buyer['postal-code']['CONTENT'];
     $Billing->save();
     $shipto = $XML->getElement('buyer-shipping-address');
     $shipto = $shipto['CHILDREN'];
     $Shipping = new Shipping();
     $Shipping->customer = $Customer->id;
     $Shipping->address = $shipto['address1']['CONTENT'];
     $Shipping->xaddress = $shipto['address2']['CONTENT'];
     $Shipping->city = $shipto['city']['CONTENT'];
     $Shipping->state = $shipto['region']['CONTENT'];
     $Shipping->country = $shipto['country-code']['CONTENT'];
     $Shipping->postcode = $shipto['postal-code']['CONTENT'];
     $Shipping->save();
     $Purchase = new Purchase();
     $Purchase->customer = $Customer->id;
     $Purchase->billing = $Billing->id;
     $Purchase->shipping = $Shipping->id;
     $Purchase->copydata($Customer);
     $Purchase->copydata($Billing);
     $Purchase->copydata($Shipping, 'ship');
     $Purchase->freight = $XML->getElementContent('shipping-cost');
     $Purchase->tax = $XML->getElementContent('total-tax');
     $Purchase->total = $XML->getElementContent('order-total');
     $Purchase->subtotal = $Purchase->total - $Purchase->frieght - $Purchase->tax;
     $Purchase->gateway = "Google Checkout";
     $Purchase->transactionid = $XML->getElementContent('google-order-number');
     $Purchase->transtatus = $XML->getElementContent('financial-order-state');
     $Purchase->ip = $XML->getElementContent('customer-ip');
     $orderdata = $XML->getElement('shopp-order-data');
     $data = array();
     if (is_array($orderdata) && count($orderdata) > 0) {
         foreach ($orderdata as $input) {
             $data[$input['ATTRS']['name']] = $input['CONTENT'];
         }
     }
     $Purchase->data = $data;
     $Purchase->save();
     $items = $XML->getElement('item');
     if (key($items) === "CHILDREN") {
         $items = array($items);
     }
     foreach ($items as $item) {
         $xml = $item['CHILDREN'];
         $itemdata = $xml['merchant-private-item-data']['CHILDREN'];
         $inputdata = $itemdata['shopp-item-data-list']['CHILDREN']['shopp-item-data'];
         $data = array();
         if (is_array($inputdata) && count($inputdata) > 0) {
             foreach ($inputdata as $input) {
                 $data[$input['ATTRS']['name']] = $input['CONTENT'];
             }
         }
         $Product = new Product($itemdata['shopp-product-id']['CONTENT']);
         $Item = new Item($Product, $itemdata['shopp-price-id']['CONTENT'], false, $data);
         $Item->quantity($xml['quantity']['CONTENT']);
         $Purchased = new Purchased();
         $Purchased->copydata($Item);
         $Purchased->purchase = $Purchase->id;
         if (!empty($Purchased->download)) {
             $Purchased->keygen();
         }
         $Purchased->save();
         if ($Item->inventory) {
             $Item->unstock();
         }
     }
 }
		
?>
<style>
	td {padding:5px 5px;}
</style>
<p>&nbsp;</p>	<p>&nbsp;</p>	
<form method="post" action="<?=$ROOT_URL?>order-confirmation.html">
<table width="713" border="0">
<tr>
	<td width="361">
    	<table width="347" border="0" cellpadding="1" cellspacing="1" bgcolor="#666666">
        	<tr>
            	<td height="25" style="font-family:Arial, Helvetica, sans-serif; font-size:12px; color:#FFF">Billing Information</td>                
          </tr>
          <? 
		  	$client = Billing::findBillingClient($client_id);
		  ?>
          <tr bgcolor="#FFFFFF">
          	<td>
            	<table border="0">
                	<tr>
                        <td width="96" height="25">Name</td>
         	            <td width="11" height="25">:</td>
                        <td width="215" height="25"><?=$client->fldBillingFirstName . ' ' . $client->fldBillingLastname?></td>
		             </tr>
                     <tr>
                        <td height="25">Address</td>
         	            <td height="25">:</td>
                        <td height="25"><?=$client->fldBillingAddress . ' ' . $client->fldBillingAddress1 . ' ' . $client->fldBillingCity . ' ' . $client->fldBillingState . ' ' . $client->fldBillingCountry?></td>
		             </tr>
                     <tr>
Ejemplo n.º 26
0
 /**
  * @return array
  */
 private function transformObject2Array()
 {
     $this->internalArray = array();
     $this->internalArray['MERCHANT'] = $this->merchantConfig->getMerchantCode();
     $this->internalArray['ORDER_REF'] = $this->order->getOrderRef();
     $this->internalArray['ORDER_DATE'] = $this->order->getOrderDate();
     $cnt = 0;
     /**
      * @var Product $product
      */
     foreach ($this->order->getProducts() as $product) {
         $this->internalArray['ORDER_PNAME'][$cnt] = $product->getName();
         $this->internalArray['ORDER_PGROUP'][$cnt] = $product->getProductGroup();
         $this->internalArray['ORDER_PCODE'][$cnt] = $product->getCode();
         $this->internalArray['ORDER_PINFO'][$cnt] = $product->getInfo();
         $this->internalArray['ORDER_PRICE'][$cnt] = $product->getPrice();
         $this->internalArray['ORDER_QTY'][$cnt] = $product->getQuantity();
         $this->internalArray['ORDER_MPLACE_MERCHANT'][$cnt] = $product->getMarketPlaceMerchantCode();
         $this->internalArray['ORDER_VER'][$cnt] = $product->getProductVersion();
         $cnt++;
     }
     $this->internalArray['ORDER_SHIPPING'] = $this->order->getShippingCost();
     $this->internalArray['PRICES_CURRENCY'] = $this->order->getCurrency();
     $this->internalArray['DISCOUNT'] = $this->order->getDiscount();
     $this->internalArray['PAY_METHOD'] = $this->order->getPayMethod();
     if (!is_null($this->card) && is_null($this->cardToken)) {
         $this->internalArray['CC_NUMBER'] = $this->card->getCardNumber();
         $this->internalArray['EXP_MONTH'] = $this->card->getCardExpirationMonth();
         $this->internalArray['EXP_YEAR'] = $this->card->getCardExpirationYear();
         $this->internalArray['CC_CVV'] = $this->card->getCardCVV();
         $this->internalArray['CC_OWNER'] = $this->card->getCardOwnerName();
         if ($this->card->isEnableTokenCreation()) {
             $this->internalArray['LU_ENABLE_TOKEN'] = '1';
         }
     }
     $this->internalArray['SELECTED_INSTALLMENTS_NUMBER'] = $this->order->getInstallmentsNumber();
     $this->internalArray['CARD_PROGRAM_NAME'] = $this->order->getCardProgramName();
     if (is_null($this->card) && !is_null($this->cardToken)) {
         $this->internalArray['CC_TOKEN'] = $this->cardToken->getToken();
         if ($this->cardToken->hasCvv()) {
             $this->internalArray['CC_CVV'] = $this->cardToken->getCvv();
         }
     }
     $this->internalArray['BACK_REF'] = $this->order->getBackRef();
     $this->internalArray['ALIAS'] = $this->order->getAlias();
     if (!empty($this->user)) {
         $this->internalArray['CLIENT_IP'] = $this->user->getUserIPAddress();
         $this->internalArray['CLIENT_TIME'] = $this->user->getClientTime();
     }
     $this->internalArray['BILL_LNAME'] = $this->billingData->getLastName();
     $this->internalArray['BILL_FNAME'] = $this->billingData->getFirstName();
     $this->internalArray['BILL_CISERIAL'] = $this->billingData->getIdentityCardSeries();
     $this->internalArray['BILL_CINUMBER'] = $this->billingData->getIdentityCardNumber();
     $this->internalArray['BILL_CIISSUER'] = $this->billingData->getIdentityCardIssuer();
     $this->internalArray['BILL_CNP'] = $this->billingData->getPersonalNumericCode();
     $this->internalArray['BILL_COMPANY'] = $this->billingData->getCompany();
     $this->internalArray['BILL_FISCALCODE'] = $this->billingData->getCompanyFiscalCode();
     $this->internalArray['BILL_REGNUMBER'] = $this->billingData->getCompanyRegistrationNumber();
     $this->internalArray['BILL_BANK'] = $this->billingData->getCompanyBank();
     $this->internalArray['BILL_BANKACCOUNT'] = $this->billingData->getCompanyBankAccountNumber();
     $this->internalArray['BILL_EMAIL'] = $this->billingData->getEmail();
     $this->internalArray['BILL_PHONE'] = $this->billingData->getPhoneNumber();
     $this->internalArray['BILL_FAX'] = $this->billingData->getFaxNumber();
     $this->internalArray['BILL_ADDRESS'] = $this->billingData->getAddressLine1();
     $this->internalArray['BILL_ADDRESS2'] = $this->billingData->getAddressLine2();
     $this->internalArray['BILL_ZIPCODE'] = $this->billingData->getZipCode();
     $this->internalArray['BILL_CITY'] = $this->billingData->getCity();
     $this->internalArray['BILL_STATE'] = $this->billingData->getState();
     $this->internalArray['BILL_COUNTRYCODE'] = $this->billingData->getCountryCode();
     if (!empty($this->deliveryData)) {
         $this->internalArray['DELIVERY_LNAME'] = $this->deliveryData->getLastName();
         $this->internalArray['DELIVERY_FNAME'] = $this->deliveryData->getFirstName();
         $this->internalArray['DELIVERY_COMPANY'] = $this->deliveryData->getCompany();
         $this->internalArray['DELIVERY_PHONE'] = $this->deliveryData->getPhoneNumber();
         $this->internalArray['DELIVERY_ADDRESS'] = $this->deliveryData->getAddressLine1();
         $this->internalArray['DELIVERY_ADDRESS2'] = $this->deliveryData->getAddressLine2();
         $this->internalArray['DELIVERY_ZIPCODE'] = $this->deliveryData->getZipCode();
         $this->internalArray['DELIVERY_CITY'] = $this->deliveryData->getState();
         $this->internalArray['DELIVERY_STATE'] = $this->deliveryData->getState();
         $this->internalArray['DELIVERY_COUNTRYCODE'] = $this->deliveryData->getCountryCode();
         $this->internalArray['DELIVERY_EMAIL'] = $this->deliveryData->getEmail();
     }
     $this->internalArray['CC_NUMBER_RECIPIENT'] = $this->order->getCcNumberRecipient();
     $this->internalArray['USE_LOYALTY_POINTS'] = $this->order->getUseLoyaltyPoints();
     $this->internalArray['LOYALTY_POINTS_AMOUNT'] = $this->order->getLoyaltyPointsAmount();
     $this->internalArray['CAMPAIGN_TYPE'] = $this->order->getCampaignType();
     if (is_array($this->order->getCustomParams())) {
         foreach ($this->order->getCustomParams() as $paramName => $paramValue) {
             $this->internalArray[$paramName] = $paramValue;
         }
     }
     ksort($this->internalArray);
     return $this->internalArray;
 }
Ejemplo n.º 27
0
	/**
	 * Delivers customer export files to the browser
	 *	 
	 * @since 1.1
	 *
	 * @return void
	 **/
	function export_customers () {
		if (!current_user_can('ecart_export_customers')) exit();
		if (!isset($_POST['settings']['customerexport_columns'])) {
			$Customer = Customer::exportcolumns();
			$Billing = Billing::exportcolumns();
			$Shipping = Shipping::exportcolumns();
			$_POST['settings']['customerexport_columns'] =
			 	array_keys(array_merge($Customer,$Billing,$Shipping));
			$_POST['settings']['customerexport_headers'] = "on";
		}

		$this->Settings->saveform();

		$format = $this->Settings->get('customerexport_format');
		if (empty($format)) $format = 'tab';

		switch ($format) {
			case "csv": new CustomersCSVExport(); break;
			case "xls": new CustomersXLSExport(); break;
			default: new CustomersTabExport();
		}
		exit();
	}
Ejemplo n.º 28
0
|
*/
//login
Route::get('test', function () {
    $kelurahan = Kelurahan::all();
    $kepalaKeluarga = KepalaKeluarga::where('nama_kk', '=', 'Helmi')->first();
    return $kepalaKeluarga->kelurahan->nama_kelurahan;
});
Route::group(array('before' => 'auth'), function () {
    Route::get('logout', array('uses' => 'UserController@logout'));
    // Route yang ingin diproteksi simpan disini
    Route::get('/', function () {
        date_default_timezone_set("Asia/Bangkok");
        $tgl_reg = date("Y-m-d");
        $transdat = DB::table('v_datapasien')->where('tgl_reg', '=', $tgl_reg)->count();
        $transbil = Billing::where('tgl_reg', '=', $tgl_reg)->count();
        $transruj = ViewRujukandetail::where('tgl_reg', '=', $tgl_reg)->count();
        return View::make('index', compact('transbil', 'transruj', 'transdat'));
    });
    //dashboard
    Route::get('dashboard', 'DashboardController@index');
    //profile
    Route::get('profile', 'ProfileController@index');
    //bantuan
    Route::get('bantuan', 'BantuanController@index');
    //Satuan
    Route::get('satuan', 'SatuanController@index');
    Route::get('satuan/create', 'SatuanController@create');
    Route::post('satuan/create', 'SatuanController@handleCreate');
    Route::get('satuan/edit/{KdSatuan}', 'SatuanController@edit');
    Route::post('satuan/edit', 'SatuanController@handleEdit');
 /**
  * lookups ()
  * Provides fast db lookups with as little overhead as possible */
 function lookups($wp)
 {
     $db =& DB::get();
     // Grab query requests from permalink rewriting query vars
     $admin = false;
     $download = isset($wp->query_vars['shopp_download']) ? $wp->query_vars['shopp_download'] : '';
     $lookup = isset($wp->query_vars['shopp_lookup']) ? $wp->query_vars['shopp_lookup'] : '';
     // Admin Lookups
     if (isset($_GET['page']) && $_GET['page'] == "shopp-lookup") {
         $admin = true;
         $image = $_GET['id'];
         $download = $_GET['download'];
     }
     if (!empty($download)) {
         $lookup = "download";
     }
     if (empty($lookup)) {
         $lookup = isset($_GET['lookup']) ? $_GET['lookup'] : '';
     }
     switch ($lookup) {
         case "purchaselog":
             if (!defined('WP_ADMIN') || !is_user_logged_in() || !current_user_can('manage_options')) {
                 die('-1');
             }
             $db =& DB::get();
             if (!isset($_POST['settings']['purchaselog_columns'])) {
                 $_POST['settings']['purchaselog_columns'] = array_keys(array_merge($Purchase, $Purchased));
                 $_POST['settings']['purchaselog_headers'] = "on";
             }
             $this->Flow->settings_save();
             $format = $this->Settings->get('purchaselog_format');
             if (empty($format)) {
                 $format = 'tab';
             }
             switch ($format) {
                 case "csv":
                     new PurchasesCSVExport();
                     break;
                 case "xls":
                     new PurchasesXLSExport();
                     break;
                 case "iif":
                     new PurchasesIIFExport();
                     break;
                 default:
                     new PurchasesTabExport();
             }
             exit;
             break;
         case "customerexport":
             if (!defined('WP_ADMIN') || !is_user_logged_in() || !current_user_can('manage_options')) {
                 die('-1');
             }
             $db =& DB::get();
             if (!isset($_POST['settings']['customerexport_columns'])) {
                 $Customer = Customer::exportcolumns();
                 $Billing = Billing::exportcolumns();
                 $Shipping = Shipping::exportcolumns();
                 $_POST['settings']['customerexport_columns'] = array_keys(array_merge($Customer, $Billing, $Shipping));
                 $_POST['settings']['customerexport_headers'] = "on";
             }
             $this->Flow->settings_save();
             $format = $this->Settings->get('customerexport_format');
             if (empty($format)) {
                 $format = 'tab';
             }
             switch ($format) {
                 case "csv":
                     new CustomersCSVExport();
                     break;
                 case "xls":
                     new CustomersXLSExport();
                     break;
                 default:
                     new CustomersTabExport();
             }
             exit;
             break;
         case "receipt":
             if (!defined('WP_ADMIN') || !is_user_logged_in() || !current_user_can('manage_options')) {
                 die('-1');
             }
             if (preg_match("/\\d+/", $_GET['id'])) {
                 $this->Cart->data->Purchase = new Purchase($_GET['id']);
                 $this->Cart->data->Purchase->load_purchased();
             } else {
                 die('-1');
             }
             echo "<html><head>";
             echo '<style type="text/css">body { padding: 20px; font-family: Arial,Helvetica,sans-serif; }</style>';
             echo "<link rel='stylesheet' href='" . SHOPP_TEMPLATES_URI . "/shopp.css' type='text/css' />";
             echo "</head><body>";
             echo $this->Flow->order_receipt();
             if (isset($_GET['print']) && $_GET['print'] == 'auto') {
                 echo '<script type="text/javascript">window.onload = function () { window.print(); window.close(); }</script>';
             }
             echo "</body></html>";
             exit;
             break;
         case "zones":
             $zones = $this->Settings->get('zones');
             if (isset($_GET['country'])) {
                 echo json_encode($zones[$_GET['country']]);
             }
             exit;
             break;
         case "shipcost":
             @session_start();
             $this->ShipCalcs = new ShipCalcs($this->path);
             if (isset($_GET['method'])) {
                 $this->Cart->data->Order->Shipping->method = $_GET['method'];
                 $this->Cart->retotal = true;
                 $this->Cart->updated();
                 $this->Cart->totals();
                 echo json_encode($this->Cart->data->Totals);
             }
             exit;
             break;
         case "category-menu":
             echo $this->Flow->category_menu();
             exit;
             break;
         case "category-products-menu":
             echo $this->Flow->category_products();
             exit;
             break;
         case "spectemplate":
             $db = DB::get();
             $table = DatabaseObject::tablename(Category::$table);
             $result = $db->query("SELECT specs FROM {$table} WHERE id='{$_GET['cat']}' AND spectemplate='on'");
             echo json_encode(unserialize($result->specs));
             exit;
             break;
         case "optionstemplate":
             $db = DB::get();
             $table = DatabaseObject::tablename(Category::$table);
             $result = $db->query("SELECT options,prices FROM {$table} WHERE id='{$_GET['cat']}' AND variations='on'");
             if (empty($result)) {
                 exit;
             }
             $result->options = unserialize($result->options);
             $result->prices = unserialize($result->prices);
             foreach ($result->options as &$menu) {
                 foreach ($menu['options'] as &$option) {
                     $option['id'] += $_GET['cat'];
                 }
             }
             foreach ($result->prices as &$price) {
                 $optionids = explode(",", $price['options']);
                 foreach ($optionids as &$id) {
                     $id += $_GET['cat'];
                 }
                 $price['options'] = join(",", $optionids);
                 $price['optionkey'] = "";
             }
             echo json_encode($result);
             exit;
             break;
         case "newproducts-rss":
             $NewProducts = new NewProducts(array('show' => 5000));
             header("Content-type: application/rss+xml; charset=utf-8");
             echo shopp_rss($NewProducts->rss());
             exit;
             break;
         case "category-rss":
             $this->catalog($wp);
             header("Content-type: application/rss+xml; charset=utf-8");
             echo shopp_rss($this->Category->rss());
             exit;
             break;
         case "download":
             if (empty($download)) {
                 break;
             }
             if ($admin) {
                 $Asset = new Asset($download);
             } else {
                 $db = DB::get();
                 $pricetable = DatabaseObject::tablename(Purchase::$table);
                 $pricetable = DatabaseObject::tablename(Price::$table);
                 $assettable = DatabaseObject::tablename(Asset::$table);
                 require_once "core/model/Purchased.php";
                 $Purchased = new Purchased($download, "dkey");
                 $Purchase = new Purchase($Purchased->purchase);
                 $target = $db->query("SELECT target.* FROM {$assettable} AS target LEFT JOIN {$pricetable} AS pricing ON pricing.id=target.parent AND target.context='price' WHERE pricing.id={$Purchased->price} AND target.datatype='download'");
                 $Asset = new Asset();
                 $Asset->populate($target);
                 $forbidden = false;
                 // Purchase Completion check
                 if ($Purchase->transtatus != "CHARGED" && !SHOPP_PREPAYMENT_DOWNLOADS) {
                     new ShoppError(__('This file cannot be downloaded because payment has not been received yet.', 'Shopp'), 'shopp_download_limit');
                     $forbidden = true;
                 }
                 // Account restriction checks
                 if ($this->Settings->get('account_system') != "none" && (!$this->Cart->data->login || $this->Cart->data->Order->Customer->id != $Purchase->customer)) {
                     new ShoppError(__('You must login to access this download.', 'Shopp'), 'shopp_download_limit', SHOPP_ERR);
                     header('Location: ' . $this->link('account'));
                     exit;
                 }
                 // Download limit checking
                 if ($this->Settings->get('download_limit') && $Purchased->downloads + 1 > $this->Settings->get('download_limit')) {
                     new ShoppError(__('This file can no longer be downloaded because the download limit has been reached.', 'Shopp'), 'shopp_download_limit');
                     $forbidden = true;
                 }
                 // Download expiration checking
                 if ($this->Settings->get('download_timelimit') && $Purchased->created + $this->Settings->get('download_timelimit') < mktime()) {
                     new ShoppError(__('This file can no longer be downloaded because it has expired.', 'Shopp'), 'shopp_download_limit');
                     $forbidden = true;
                 }
                 // IP restriction checks
                 if ($this->Settings->get('download_restriction') == "ip" && !empty($Purchase->ip) && $Purchase->ip != $_SERVER['REMOTE_ADDR']) {
                     new ShoppError(__('The file cannot be downloaded because this computer could not be verified as the system the file was purchased from.', 'Shopp'), 'shopp_download_limit');
                     $forbidden = true;
                 }
                 do_action_ref_array('shopp_download_request', array(&$Purchased));
             }
             if ($forbidden) {
                 header("Status: 403 Forbidden");
                 return;
             }
             if ($Asset->download($download)) {
                 $Purchased->downloads++;
                 $Purchased->save();
                 do_action_ref_array('shopp_download_success', array(&$Purchased));
                 exit;
             }
             break;
     }
 }
Ejemplo n.º 30
0
	

	//update the order id

	Cart::updateCartStatus($order_id,$trans_id);
	
	$myOrder = Cart::findCartByOrderID($order_id);

	//$clients = Client::findClient($myOrder->fldCartClientID);

	$shipping = Shipping::findShippingClient($clients->fldClientID);

	$shippingRate = ShippingRate::findShippingRateByOrderCode($order_id);
	
	$clients = Billing::findBillingClient($myOrder->fldCartClientID);
	 
	 
	$message = "<table width=100% border=0 cellpadding=1 cellspacing=1 bgcolor=#333300>";
			  $message .= "<tr>";
				$message .= "<td height=25 align=center>&nbsp;</td>";
				$message .= "<td height=25 align=center><font face=Arial, Helvetica, sans-serif size=2 color=#FFFFFF><b>Product Name</b></font></td>";
				$message .= "<td height=25 align=center><font face=Arial, Helvetica, sans-serif size=2 color=#FFFFFF><b>Amount</b></font></td>";
				$message .= "<td height=25 align=center><font face=Arial, Helvetica, sans-serif size=2 color=#FFFFFF><b>Quantity</b></font></td>";
				$message .= "<td height=25 align=center><font face=Arial, Helvetica, sans-serif size=2 color=#FFFFFF><b>Total Amount</b></font></td>";
			  $message .= "</tr>";
			  
										//display the shopping cart							
										$date = date('Y-m-d');
										$condition = "fldTempCartClientID='$client_id' AND fldTempCartDate='$date'";