Exemplo n.º 1
0
 public static function getRealTimeRates(ShippingRateCalculator $handler, Shipment $shipment)
 {
     $rates = new ShippingRateSet();
     $handler->setWeight($shipment->getChargeableWeight());
     $order = $shipment->order->get();
     if ($order->isMultiAddress->get()) {
         $address = $shipment->shippingAddress->get();
     } else {
         $address = $order->shippingAddress->get();
     }
     if (!$address) {
         return $rates;
     }
     $handler->setDestCountry($address->countryID->get());
     $handler->setDestState($address->state->get() ? $address->state->get()->code->get() : $address->stateName->get());
     $handler->setDestZip($address->postalCode->get());
     $config = $shipment->getApplication()->getConfig();
     $handler->setSourceCountry($config->get('STORE_COUNTRY'));
     $handler->setSourceZip($config->get('STORE_ZIP'));
     $handler->setSourceState($config->get('STORE_STATE'));
     foreach ($handler->getAllRates() as $k => $rate) {
         $newRate = new ShipmentDeliveryRate();
         $newRate->setApplication($shipment->getApplication());
         $newRate->setCost($rate->getCostAmount(), $rate->getCostCurrency());
         $newRate->setServiceName($rate->getServiceName());
         $newRate->setClassName($rate->getClassName());
         $newRate->setProviderName($rate->getProviderName());
         $newRate->setServiceId($rate->getClassName() . '_' . $k);
         $rates->add($newRate);
     }
     return $rates;
 }
Exemplo n.º 2
0
 /**
  * Displays the currently logged in user's account information
  */
 public function actionInfo()
 {
     // Get id of logged in user
     $user_id = Yii::app()->user->getId();
     $customer = Customer::model()->findByPk($user_id);
     $commande = Commande::model()->findAllByAttributes(array('bilkey' => $user_id));
     $service_details = Customer::model()->getCustomerServiceDetails($user_id);
     $shipment_details = Customer::model()->getShipmentsByCustomerBilkey($user_id);
     if (isset($_POST['Customer'])) {
         $customer->setScenario('user_edit');
         // Populate our new models from the input arrays
         $customer->attributes = $_POST['Customer'];
         // If a model saves, we know it's valid
         if ($customer->validate()) {
             // Send email to info@mailnetwork and client
             $customer->save();
             $this->actionEmailChanges('customer', $customer, $customer);
         }
     }
     $shipment_model = new Shipment('search');
     $shipment_model->unsetAttributes();
     // clear any default values
     $shipment_model->bilkey = $user_id;
     if (isset($_GET['Shipment'])) {
         $shipment_model->attributes = $_GET['Shipment'];
     }
     $this->render('//shared/user-info', array('customer_model' => $customer, 'customer' => $customer, 'commande' => $commande, 'service_details' => $service_details, 'shipment_details' => $shipment_details, 'shipment_model' => $shipment_model));
 }
Exemplo n.º 3
0
 /**
  * Create Shipment
  */
 static function createShipmentFromEntity($entity, $price = null)
 {
     $price = (double) is_null($price) ? $entity->getPrice() : $price;
     $shipment = new Shipment();
     $shipment->setId($entity->getId())->setPrice($price)->setIsDiscountable($entity->getIsDiscountable())->setIsTaxable($entity->getIsTaxable());
     return $shipment;
 }
Exemplo n.º 4
0
 function view_pdf($id)
 {
     $preferences_q = query("SELECT settings FROM `" . $this->user['database'] . "`.account_settings WHERE group_id='" . $this->user['group'] . "' ORDER BY id DESC");
     $preferences_r = fetch($preferences_q);
     $this->smarty->assign('preferences', json_decode($preferences_r['settings'], 1));
     $shipment = new Shipment($id, $this->user);
     $this->smarty->assign('shipment', $shipment->toArray());
     $this->html['shipon_content'] = $this->smarty->fetch('history/view_pdf.tpl') . $this->get_pdf_footer($id);
 }
Exemplo n.º 5
0
 private function getShipment()
 {
     $shipment = new Shipment();
     $shipment->setFromIsResidential(false)->setFromStateProvinceCode('IN')->setFromPostalCode('46205')->setFromCountryCode('US')->setToIsResidential(true)->setToPostalCode('20101')->setToCountryCode('US');
     $package = new Package();
     $package->setLength(12)->setWidth(4)->setHeight(3)->setWeight(3);
     $shipment->addPackage($package);
     return $shipment;
 }
Exemplo n.º 6
0
 /**
  * @param Shipment $dataObject
  * @return \Magento\Sales\Model\Order\Shipment
  * @throws \Exception
  */
 public function getModel(Shipment $dataObject)
 {
     $this->shipmentLoader->setOrderId($dataObject->getOrderId());
     $this->shipmentLoader->setShipmentId($dataObject->getEntityId());
     $items = [];
     foreach ($dataObject->getItems() as $item) {
         $items[$item->getOrderItemId()] = $item->getQty();
     }
     $shipmentItems = ['items' => $items];
     $this->shipmentLoader->setShipment($shipmentItems);
     $this->shipmentLoader->setTracking($dataObject->getTracks());
     return $this->shipmentLoader->load();
 }
 /**
  * Set shipment status to completed
  * 
  * @param Shipment $shipment
  * @param string $recepient_name
  */
 private function setJneStatusOrder(Shipment $shipment, $status, $recepient_name = '')
 {
     $event = new ShipmentEvent();
     $shipment->setScenario('event');
     $event->created = time();
     $event->event_time = $event->created;
     $event->shipment_id = $shipment->id;
     $event->user_id = User::USER_SYSTEM;
     switch (strtoupper($status)) {
         case 'DELIVERED':
             $event->status = ShipmentStatus::POD;
             $shipment->shipping_status = ShipmentStatus::POD;
             $shipment->event_time = $event->event_time;
             $shipment->recipient_name = $recepient_name;
             break;
         case 'MANIFESTED':
             $event->status = ShipmentStatus::MDE;
             $shipment->shipping_status = ShipmentStatus::MDE;
             $shipment->event_time = $event->event_time;
             break;
         case 'RECEIVED ON DESTINATION':
             $event->status = ShipmentStatus::ARR;
             $shipment->shipping_status = ShipmentStatus::ARR;
             $shipment->event_time = $event->event_time;
             break;
         case 'ON PROCESS':
             $event->status = ShipmentStatus::OTW;
             $shipment->shipping_status = ShipmentStatus::OTW;
             $shipment->event_time = $event->event_time;
             break;
     }
     try {
         $trans = Yii::app()->db->beginTransaction();
         if ($event->save()) {
             if ($shipment->save()) {
                 $trans->commit();
                 $this->printf('Shipment set to %s', $status);
                 return true;
             } else {
                 print_r($shipment->getErrors());
                 throw new CException();
             }
         } else {
             print_r($event->getErrors());
             throw new CException();
         }
     } catch (CException $e) {
         $trans->rollback();
         throw $e;
     }
 }
Exemplo n.º 8
0
 /**
  * @param \SimpleXMLElement $xml
  *
  * @return Response
  */
 public function fromXml(\SimpleXMLElement $xml)
 {
     foreach ($xml->Shipment as $xml) {
         $this->addShipment(Shipment::fromXml($xml));
     }
     return $this;
 }
Exemplo n.º 9
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate($shipment_id = '')
 {
     $model = new Booking();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     $awb = '';
     if (is_numeric($shipment_id)) {
         $shipment = Shipment::model()->findByPk($shipment_id);
         if ($shipment instanceof Shipment) {
             $model->address = $shipment->shipper_address;
             $model->city = $shipment->shipper_city;
             $model->postal = $shipment->shipper_postal;
             $model->country = $shipment->shipper_country;
             $model->phone = $shipment->shipper_phone;
             $model->shipment_id = $shipment->id;
             $awb = $shipment->awb;
         }
     }
     if (isset($_POST['Booking'])) {
         $model->attributes = $_POST['Booking'];
         $model->setAttribute('booking_code', dechex(time()));
         if ($model->save()) {
             if (!empty($model->shipment_id) || $model->shipment_id != '') {
                 $shipment->booking_id = $model->id;
                 $tes = $shipment->update();
             }
             Yii::app()->user->setFlash('success', 'Success to add new booking, ' . $model->booking_code);
             $this->redirect(array('index'));
         }
     }
     $this->render('create', array('model' => $model, 'awb' => $awb));
 }
Exemplo n.º 10
0
 public function __construct($data = [], $connection = null)
 {
     $this->connection = $connection;
     foreach (['id', 'order_reference', 'shop_system', 'customer_number', 'service_point_reference', 'weight_in_g'] as $prop) {
         if (isset($data[$prop])) {
             $this->{$prop} = $data[$prop];
         }
     }
     foreach (['recipient', 'billing_contact'] as $prop) {
         $this->{$prop} = isset($data[$prop]) ? new Address($data[$prop]) : null;
     }
     foreach (['subtotal', 'shipping_cost', 'tax_value'] as $prop) {
         $this->{$prop} = isset($data[$prop]) ? Money::import($data[$prop]) : null;
     }
     $this->product = isset($data['product']) ? new Product($data['product'], $this->connection) : null;
     if (isset($data['items'])) {
         $this->items = [];
         foreach ($data['items'] as $item_data) {
             $this->items[] = new Item($item_data);
         }
     }
     if (isset($data['shipments'])) {
         $this->shipments = [];
         foreach ($data['shipments'] as $url) {
             $this->shipments[] = Shipment::import($url, $this->connection);
         }
     }
 }
Exemplo n.º 11
0
 /**
  * Generate inventory reports by range
  */
 public function generateInventoryReportsByRange()
 {
     $from = Input::get('from');
     $to = Input::get('to');
     $stock_id = Input::get('stock');
     $data = Shipment::generateInventoryReport($from, $to, $stock_id);
     return $data;
 }
Exemplo n.º 12
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $shipped = Shipment::where('deliverytime', 'like', '2016-01-11%')->get();
     //print_r($shipped);
     foreach ($shipped as $shipment) {
         $is_there = Geolog::where('datetimestamp', '=', $shipment->deliverytime)->where('deliveryId', '=', $shipment->delivery_id)->where('sourceSensor', '=', 'gps')->get();
         if ($is_there) {
             print_r($is_there);
             $stay = array_pop($is_there->toArray());
             foreach ($is_there as $there) {
                 print 'there' . "\r\n";
                 print_r($there);
                 //$there->remove();
             }
             print 'stay' . "\r\n";
             print_r($stay);
             if ($stay) {
                 $stay->latitude = doubleval($shipment->latitude);
                 $stay->longitude = doubleval($shipment->longitude);
                 //$stay->save();
             }
         }
     }
     /*
     $dbox = Orderlog::where('pickupStatus','=',Config::get('jayon.trans_status_pickup'))
                         ->where('pickuptime','!=','0000-00-00 00:00:00')
                         ->orderBy('created_at','desc')
                         //->groupBy('created_at')
                         ->get();
     
     if($dbox){
         print count($dbox)."\r\n";
         foreach($dbox as $dbx){
     
             print_r(array($dbx->pickupStatus, $dbx->pickuptime) );
     
             $ship = Shipment::where('delivery_id','=',$dbx->deliveryId)
                         ->where('pickuptime','!=','0000-00-00 00:00:00')
                         ->first();
             if($ship){
                 print 'before : '.$ship->pickup_status."\r\n";
                 print 'before : '.$ship->pickuptime."\r\n";
     
                 $pickuptime = ($dbx->pickuptime == '0000-00-00 00:00:00')? date('Y-m-d H:i:s', $dbx->created_at->sec ) :$dbx->pickuptime;
     
                 $ship->pickup_status = $dbx->pickupStatus;
                 $ship->pickuptime = $pickuptime;
     
                 $ship->save();
                 //print_r( $ship->toArray());
     
                 print 'after : '.$ship->pickup_status."\r\n";
                 print 'after : '.$ship->pickuptime."\r\n";
             }
         }
     }
     */
 }
Exemplo n.º 13
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $delivereds = Orderlog::where('appname', '=', Config::get('jex.tracker_app'))->where('status', '=', 'delivered')->orderBy('deliveryId', 'desc')->orderBy('created_at', 'desc')->groupBy('deliveryId')->get(array('deliveryId', 'merchantTransId', 'deliverytime'));
     /*
     $pendingan = Orderlog::where('appname','=',Config::get('jex.tracker_app'))
                     ->where('pendingCount','!=', strval(0))
                     ->orderBy('created_at','desc')
                     ->orderBy('deliveryId','desc')
                     ->groupBy('deliveryNote')
                     ->get(array( 'deliveryId', 'deliveryNote','status' ));
     */
     $count = 0;
     $data = '';
     foreach ($delivereds as $d) {
         $shipment = \Shipment::where('delivery_id', '=', $d->deliveryId)->first();
         if ($shipment) {
             if (date('Y-m-d', strtotime($d->deliverytime)) != date('Y-m-d', strtotime($shipment->deliverytime))) {
                 //print $d->deliveryId." ".$d->deliverytime." ".$shipment->deliverytime."\r\n";
                 $data .= '"' . $d->deliveryId . '","' . $d->merchantTransId . '","' . $d->deliverytime . '","' . $shipment->deliverytime . '"' . "\r\n";
                 $shipment->deliverytime = $d->deliverytime;
                 $shipment->save();
                 $count++;
             }
         }
     }
     print $data;
     //print "\r\ndifferent date : ".$count;
     /*
     $pc = array();
     foreach ($pendingan as $p) {
         if(isset($pc[$p->deliveryId])){
             if($p->status == 'pending'){
                 $pc[$p->deliveryId] = $pc[$p->deliveryId] + 1;
             }
         }else{
             $pc[$p->deliveryId] = 1;
         }
     }
     */
     //print_r($pc);
     /*
     foreach($pc as $d=>$c){
         //print $d->deliveryId." ".$d->deliverytime."\r\n";
         $count++;
         $shipment = \Shipment::where('delivery_id','=',$d)->first();
     
         if($shipment){
             $shipment->pending_count = $c;
             //$shipment->status = 'delivered';
             //$shipment->deliverytime = $d->deliverytime;
             //$shipment->save();
         }
     
         //print_r($d->toArray());
     }
     */
     print "\r\n" . $count;
 }
Exemplo n.º 14
0
 /**
  * Loads a shipment and its packages for a given order.
  *
  * @param array $order_id
  *   An order ID.
  *
  * @return \Drupal\uc_fulfillment\Shipment[]
  *   Array of shipment object for the given order.
  */
 public static function loadByOrder($order_id)
 {
     $shipments = array();
     $result = db_query('SELECT sid FROM {uc_shipments} WHERE order_id = :id', [':id' => $order_id]);
     while ($shipment_id = $result->fetchField()) {
         $shipments[] = Shipment::load($shipment_id);
     }
     return $shipments;
 }
Exemplo n.º 15
0
 public static function listPickup($shipmentId)
 {
     $criteria = new CDbCriteria();
     $criteria->condition = 'id = :id and shipping_status=11';
     $criteria->params[':id'] = $shipmentId;
     $model = Shipment::model()->find($criteria);
     if ($model == null) {
         return false;
     }
     return $model->awb;
 }
Exemplo n.º 16
0
 protected function SetupShipment()
 {
     // Lookup Object PK information from Query String (if applicable)
     // Set mode to Edit or New depending on what's found
     $intShipmentId = QApplication::QueryString('intShipmentId');
     if ($intShipmentId) {
         $this->objShipment = Shipment::Load($intShipmentId);
         if (!$this->objShipment) {
             throw new Exception('Could not find a Shipment object with PK arguments: ' . $intShipmentId);
         }
     }
 }
Exemplo n.º 17
0
 public static function getRealTimeRates(ShippingRateCalculator $handler, Shipment $shipment)
 {
     $rates = new ShippingRateSet();
     $handler->setWeight($shipment->getChargeableWeight());
     $order = $shipment->order->get();
     // TODO: fix issue when address has zip and country data, but are missing city, user and record id!
     //             (now workround - get address id, if $address has no id, load address by id)
     if ($order->isMultiAddress->get()) {
         $address = $shipment->shippingAddress->get();
         $arr = $shipment->toArray();
     } else {
         $address = $order->shippingAddress->get();
         $arr = $order->toArray();
     }
     if (!$address->getID() && array_key_exists('shippingAddressID', $arr)) {
         $address = ActiveRecordModel::getInstanceByID('UserAddress', $arr['shippingAddressID'], true);
     }
     if (!$address) {
         return $rates;
     }
     $handler->setDestCountry($address->countryID->get());
     $handler->setDestState($address->state->get() ? $address->state->get()->code->get() : $address->stateName->get());
     $handler->setDestZip($address->postalCode->get());
     $handler->setDestCity($address->city->get());
     $config = $shipment->getApplication()->getConfig();
     $handler->setSourceCountry($config->get('STORE_COUNTRY'));
     $handler->setSourceZip($config->get('STORE_ZIP'));
     $handler->setSourceState($config->get('STORE_STATE'));
     foreach ($handler->getAllRates() as $k => $rate) {
         $newRate = new ShipmentDeliveryRate();
         $newRate->setApplication($shipment->getApplication());
         $newRate->setCost($rate->getCostAmount(), $rate->getCostCurrency());
         $newRate->setServiceName($rate->getServiceName());
         $newRate->setClassName($rate->getClassName());
         $newRate->setProviderName($rate->getProviderName());
         $newRate->setServiceId($rate->getClassName() . '_' . $k);
         $rates->add($newRate);
     }
     return $rates;
 }
Exemplo n.º 18
0
 public function save($shipment)
 {
     if ($shipment->id) {
         $path = "shipments/" . $shipment->id;
     } else {
         $path = "shipments";
     }
     $response = $this->client()->post($path, ['json' => $shipment->toHash()]);
     if ($response->getStatusCode() == 200) {
         return Shipment::import(json_decode($response->getBody(), true), $this->connection);
     } else {
         $this->raiseError($response);
     }
 }
Exemplo n.º 19
0
 public function __construct()
 {
     $this->config = parse_ini_file('config.ini', true);
     Shipment::$database_connect = mysql_connect($this->config['database']['host'], $this->config['database']['user'], $this->config['database']['password']);
     if (!Shipment::$database_connect) {
         echo "Unable to connect to DB: " . mysql_error(Shipment::$database_connect);
         exit;
     }
     mysql_query("SET NAMES 'UTF8'", Shipment::$database_connect);
     if (!mysql_select_db($this->config['database']['name'], Shipment::$database_connect)) {
         echo "Unable to select mydbname: " . mysql_error(Shipment::$database_connect);
         exit;
     }
     //$this->startTime = date("Y-m-d 13:30:00",mktime(0, 0, 0, date("m"), date("d")-1, date("Y")));
 }
Exemplo n.º 20
0
 public function postLast()
 {
     $in = Input::get();
     $orderid = trim($in['orderId']);
     $orderff = trim($in['orderFf']);
     $delivery_id = trim($in['delivery_id']);
     if (isset($in['delivery_id'])) {
         $order = Shipment::where('fulfillment_code', '=', $orderff)->where('no_sales_order', '=', $orderid)->where('delivery_id', '=', $delivery_id)->orderBy('pick_up_date', 'desc')->first();
     } else {
         $order = Shipment::where('fulfillment_code', '=', $orderff)->where('no_sales_order', '=', $orderid)->orderBy('pick_up_date', 'desc')->first();
     }
     $statuses = array();
     if ($order) {
         if ($order->logistic_type == 'external') {
             $conf = Config::get('cs.' . $order->consignee_olshop_cust);
             if (!isset($conf['status'])) {
                 $conf = Config::get('cs.default');
             }
             $mdl = Threeplstatuses::where($conf['awb'], '=', strval($order->{$conf['order_awb']}))->where(function ($q) use($order) {
                 $q->where('consignee_olshop_cust', '=', strval($order->consignee_olshop_cust))->orWhere('consignee_logistic_id', '=', strval($order->consignee_olshop_cust));
             });
             if (count($conf['group']) > 0) {
                 foreach ($conf['group'] as $g) {
                     $mdl = $mdl->groupBy($g);
                 }
             }
             $mdl = $mdl->orderBy($conf['order'], 'desc');
             if ($conf['status'] == 'single') {
                 //$statuses = $mdl->take(1)->timeout(-1)->get();
                 $statuses = $mdl->timeout(-1)->first();
             } else {
                 if (count($conf['get']) > 0) {
                     $statuses = $mdl->timeout(-1)->get($conf['get']);
                 } else {
                     $statuses = $mdl->timeout(-1)->get();
                 }
             }
             if ($statuses) {
                 $statuses = $statuses->toArray();
             } else {
                 $statuses = array();
             }
             //print_r($statuses);
         }
         $order->picList = $this->picList($order);
     }
     return View::make('cs.lastdetail')->with('order', $order)->with('status', $statuses)->render();
 }
Exemplo n.º 21
0
 protected function SetupShipment()
 {
     // Lookup Object PK information from Query String (if applicable)
     // Set mode to Edit or New depending on what's found
     $intShipmentId = QApplication::QueryString('intShipmentId');
     if ($intShipmentId) {
         $this->objShipment = Shipment::Load($intShipmentId);
         if (!$this->objShipment) {
             throw new Exception('Could not find a Shipment object with PK arguments: ' . $intShipmentId);
         }
         $this->strTitleVerb = QApplication::Translate('Edit');
         $this->blnEditMode = true;
     } else {
         $this->objShipment = new Shipment();
         $this->strTitleVerb = QApplication::Translate('Create');
         $this->blnEditMode = false;
     }
 }
Exemplo n.º 22
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $count = Shipment::where('consignee_olshop_cust', '=', '1400000655')->where('logistic_status', 'regexp', '/^DELIVERED/i')->where('status', '!=', 'delivered')->count();
     print $count;
     $orders = Shipment::where('consignee_olshop_cust', '=', '1400000655')->where('logistic_status', 'regexp', '/^DELIVERED/i')->where('status', '!=', 'delivered')->get();
     foreach ($orders as $ord) {
         //print_r($ord->toArray());
         $lstat = $ord->logistic_raw_status;
         //print_r($lstat);
         $ord->status = 'delivered';
         $ord->delivered_time = $lstat['delivered_date'] . ' ' . $lstat['delivered_time'];
         print $ord->delivered_time . ' ' . $ord->status . "\r\n";
         //$ord->save();
     }
     $fl_status = Shipment::distinct('logistic_status')->where('logistic', '=', 'FL')->get();
     print_r($fl_status->toArray());
     //
 }
Exemplo n.º 23
0
 /**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id the ID of the model to be updated
  */
 public function actionUpdate($shipment_id)
 {
     $model = Pickup::model()->findByAttributes(array('shipment_id' => $shipment_id));
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     $shipment = Shipment::model()->findByPk($shipment_id);
     $criteria = new CDbCriteria();
     $criteria->with = array('user', 'pickup');
     $driver_list_available = new CActiveDataProvider('Driver', array('criteria' => $criteria));
     if (isset($_GET['driver_id'])) {
         $model->driver_id = $_GET['driver_id'];
         $model->shipment_id = $shipment_id;
         $trans = Yii::app()->db->beginTransaction();
         try {
             if ($model->save()) {
                 $event = new ShipmentEvent();
                 $event->shipment_id = $shipment_id;
                 $event->event_time = time();
                 $event->with_mde = 0;
                 $event->user_id = Yii::app()->user->id;
                 $event->status = 11;
                 $event->setScenario('order');
                 if ($event->save()) {
                     $shipment->shipping_status = 11;
                     $shipment->setScenario('event');
                     if ($shipment->save()) {
                         $trans->commit();
                         $this->redirect(array('shipment/operation'));
                     } else {
                         throw new CException($shipment->getErrors());
                     }
                 } else {
                     throw new CException($event->getErrors());
                 }
             } else {
                 throw new CException($model->getErrors());
             }
         } catch (CException $e) {
             $trans->rollback();
             throw $e;
         }
     }
     $this->render('update', array('model' => $model, 'driver_list_available' => $driver_list_available, 'shipment_id' => $shipment_id));
 }
Exemplo n.º 24
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $orders = Shipment::where('buyerdeliveryzone', '=', '')->orderBy('created', 'desc')->get();
     if ($orders) {
         $cities = array();
         foreach ($orders as $order) {
             $cities[] = $order->buyerdeliverycity;
         }
         $cities = array_unique($cities);
         $districts = Coverage::whereIn('city', $cities)->get();
         $district_list = array();
         foreach ($districts as $d) {
             $district_list[$d->city][] = $d->district;
             if (strpos($d->city, 'Jakarta')) {
                 $district['Jakarta'][] = $d->district;
             }
         }
         //print_r($district_list);
         $matches = 0;
         foreach ($orders as $order) {
             print $order->delivery_id . ' ' . $order->buyerdeliverycity . ' ' . $order->buyerdeliveryzone . "\r\n";
             if (isset($district_list[$order->buyerdeliverycity])) {
                 $cd = $district_list[$order->buyerdeliverycity];
                 print_r($cd);
                 foreach ($cd as $d) {
                     if (preg_match('/' . $d . '/i', $order->shipping_address)) {
                         print $d . ' ================' . "\r\n";
                         print 'match ' . $d . ' for ' . $order->delivery_id . ' ' . $order->shipping_address;
                         print "\r\n";
                         $order->buyerdeliveryzone = $d;
                         $order->save();
                         $matches++;
                     }
                     # code...
                 }
             }
         }
         print 'found ' . $matches . ' matches';
     } else {
         print 'nothing to fill in';
     }
 }
Exemplo n.º 25
0
 public function __toStringWithLink()
 {
     // Shipment
     if ($this->TransactionTypeId == 6) {
         $objShipment = Shipment::LoadByTransactionId($this->TransactionId);
         if ($objShipment) {
             $strToReturn = sprintf('<a href="../shipping/shipment_edit.php?intShipmentId=%s">Ship</a>', $objShipment->ShipmentId);
         } else {
             $strToReturn = '';
         }
     } elseif ($this->TransactionTypeId == 7) {
         $objReceipt = Receipt::LoadByTransactionId($this->TransactionId);
         if ($objReceipt) {
             $strToReturn = sprintf('<a href="../receiving/receipt_edit.php?intReceiptId=%s">Receipt</a>', $objReceipt->ReceiptId);
         } else {
             $strToReturn = '';
         }
     } else {
         $strToReturn = sprintf('<a href="../common/transaction_edit.php?intTransactionId=%s">%s</a>', $this->TransactionId, $this->TransactionType->__toString());
     }
     return $strToReturn;
 }
Exemplo n.º 26
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $key = Input::get('key');
     $order_id = Input::get('orderid');
     $ff_id = Input::get('ffid');
     if (is_null($key) || $key == '') {
         $actor = 'no id : no name';
         \Event::fire('log.api', array($this->controller_name, 'post', $actor, 'empty key'));
         return \Response::json(array('status' => 'ERR:EMPTYKEY', 'timestamp' => time(), 'message' => 'Empty Key'));
     }
     $app = \Application::where('key', '=', $key)->first();
     if ($app) {
         if ($order_id != '' && $ff_id != '') {
             $order = \Shipment::where('merchant_trans_id', '=', trim($order_id))->where('fulfillment_code', '=', trim($ff_id))->where('application_key', '=', trim($key))->first();
         } else {
             if ($order_id != '' && $ff_id == '') {
                 $order = \Shipment::where('merchant_trans_id', '=', trim($order_id))->where('application_key', '=', trim($key))->first();
             } else {
                 $order = false;
             }
         }
         if ($order) {
             //print_r($order);
             $actor = 'merchant id :' . $app->merchant_id;
             \Event::fire('log.api', array($this->controller_name, 'post', $actor, 'awb ' . $order->delivery_id));
             return \Response::json(array('status' => 'OK', 'awb' => $order->delivery_id, 'timestamp' => date('Y-m-d H:i:s', time()), 'pending' => $order->pending_count, 'order_status' => $order->status, 'note' => $order->delivery_note));
         } else {
             $actor = 'merchant id :' . $app->merchant_id;
             \Event::fire('log.api', array($this->controller_name, 'post', $actor, 'order not found'));
             return \Response::json(array('status' => 'ERR:NOTFOUND', 'timestamp' => time(), 'message' => 'Record Not Found'));
         }
     } else {
         $actor = 'no id : no name';
         \Event::fire('log.api', array($this->controller_name, 'post', $actor, 'account not found'));
         return \Response::json(array('status' => 'ERR:INVALIDACC', 'timestamp' => time(), 'message' => 'Invalid Account'));
     }
     //
 }
Exemplo n.º 27
0
 public function testSetSingleAddress()
 {
     $this->order->addProduct($this->products[0], 1);
     $this->controller->setOrder($this->order);
     $this->controller->setMultiAddress();
     $shipment1 = Shipment::getNewInstance($this->order);
     $shipment1->save();
     $shipment2 = Shipment::getNewInstance($this->order);
     $shipment2->save();
     $this->order->addProduct($this->products[0], 1, true, $shipment1);
     $this->order->addProduct($this->products[1], 2, true, $shipment2);
     $this->order->save();
     $order = $this->reloadOrder($this->order);
     $this->assertEqual($order->getShipments()->size(), 2);
     $this->assertEqual(count($order->getOrderedItems()), 3);
     $this->controller->setOrder($order = $this->reloadOrder($this->order));
     $response = $this->controller->setSingleAddress();
     $order = $this->reloadOrder($order);
     $this->assertIsA($response, 'ActionRedirectResponse');
     $this->assertEqual($order->isMultiAddress->get(), '0');
     $this->assertEqual($order->getShipments()->size(), 1);
     $this->assertEqual(count($order->getOrderedItems()), 2);
 }
Exemplo n.º 28
0
 /**
  *  Update product quantities
  */
 public function update()
 {
     // TOS
     if ($this->isTosInCartPage()) {
         $this->session->set('tos', $this->request->get('tos'));
     }
     // coupon code
     if ($this->request->get('coupon')) {
         $code = $this->request->get('coupon');
         if ($condition = DiscountCondition::getInstanceByCoupon($code)) {
             if (!$this->order->hasCoupon($code)) {
                 $coupon = OrderCoupon::getNewInstance($this->order, $code);
                 $coupon->save();
                 $this->order->getCoupons(true);
                 if ($this->order->hasCoupon($code)) {
                     $this->setMessage($this->makeText('_coupon_added', array($code)));
                 }
             }
         } else {
             $this->setErrorMessage($this->makeText('_coupon_not_found', array($code)));
         }
         $this->order->getCoupons(true);
     }
     $this->updateEstimateAddress();
     $this->order->loadItemData();
     $validator = $this->buildCartValidator($this->order, $this->getItemOptions());
     if (!$validator->isValid()) {
         return new ActionRedirectResponse('order', 'index');
     }
     $this->order->loadRequestData($this->request);
     foreach ($this->order->getOrderedItems() as $item) {
         if ($this->request->isValueSet('item_' . $item->getID())) {
             foreach ($item->getProduct()->getOptions(true) as $option) {
                 $this->modifyItemOption($item, $option, $this->request, $this->getFormFieldName($item, $option));
             }
             $item->save();
             $this->order->updateCount($item, $this->request->get('item_' . $item->getID(), 0));
         }
     }
     if ($this->order->isMultiAddress->get()) {
         $addresses = $this->user->getShippingAddressSet();
         $this->order->getShipments();
         foreach ($this->order->getOrderedItems() as $item) {
             if ($addressId = $this->request->get('address_' . $item->getID())) {
                 if (!$item->shipment->get() || !$item->shipment->get()->shippingAddress->get() || $item->shipment->get()->shippingAddress->get()->getID() != $addressId) {
                     foreach ($this->order->getShipments() as $shipment) {
                         if ($shipment->shippingAddress->get() && $shipment->shippingAddress->get()->getID() == $addressId) {
                             if (!$item->shipment->get() || $item->shipment->get()->getID() != $shipment->getID()) {
                                 if ($item->shipment->get()) {
                                     $item->shipment->get()->removeItem($item);
                                 }
                                 $shipment->addItem($item);
                                 break;
                             }
                         }
                         $shipment = null;
                     }
                     if (!isset($shipment) || !$shipment) {
                         $address = ActiveRecordModel::getInstanceById('UserAddress', $addressId, true);
                         $shipment = Shipment::getNewInstance($this->order);
                         $shipment->shippingAddress->set($address);
                         $shipment->save();
                         $this->order->addShipment($shipment);
                         $shipment->addItem($item);
                     }
                     $item->save();
                 }
             }
             if ($item->shipment->get()) {
                 $item->shipment->get()->shippingAmount->set(0);
                 $item->shipment->get()->shippingServiceData->set(null);
                 $item->shipment->get()->save();
             }
         }
     }
     $this->order->mergeItems();
     SessionOrder::save($this->order);
     // proceed with the checkout
     if ($this->request->get('proceed')) {
         return new ActionRedirectResponse('checkout', 'index');
     }
     // redirect to payment gateway
     if ($url = $this->request->get('redirect')) {
         return new RedirectResponse($url);
     }
     return new ActionRedirectResponse('order', 'index', array('query' => 'return=' . $this->request->get('return')));
 }
Exemplo n.º 29
0
 /**
  * Load an array of Item objects by ShipmentId
  *
  * @param string $intShipmentId
  * @return Array
  */
 public static function LoadArrayByShipmentId($intShipmentId, $strOrderBy = null, $strLimit = null, $objExpansionMap = null)
 {
     Item::ArrayQueryHelper($strOrderBy, $strLimit, $strLimitPrefix, $strLimitSuffix, $objDatabase);
     $objShipment = Shipment::Load($intShipmentId);
     $strQuery = sprintf("\r\n\t\t\t\tSELECT \r\n\t\t\t\t\tasset_model.short_description AS short_description,\r\n\t\t\t\t\tasset.asset_code AS code,\r\n\t\t\t\t\t'1' AS quantity,\r\n\t\t\t\t\t(\r\n\t\t\t\t\tSELECT \r\n\t\t\t\t\t\treceipt.receipt_number \r\n\t\t\t\t\tFROM \r\n\t\t\t\t\t\treceipt,\r\n\t\t\t\t\t\ttransaction,\r\n\t\t\t\t\t\tasset_transaction at\r\n\t\t\t\t\tWHERE\r\n\t\t\t\t\t\treceipt.transaction_id = transaction.transaction_id\r\n\t\t\t\t\tAND\r\n\t\t\t\t\t\tat.transaction_id = transaction.transaction_id\r\n\t\t\t\t\tAND\r\n\t\t\t\t\t\tat.parent_asset_transaction_id = asset_transaction.asset_transaction_id\t\t\t\t\t\r\n\t\t\t\t\t) AS receipt_number\r\n\t\t\t\tFROM \r\n\t\t\t\t\tasset_transaction \r\n\t\t\t\t\tLEFT JOIN asset ON asset_transaction.asset_id = asset.asset_id\r\n\t\t\t\t\tLEFT JOIN asset_model ON asset.asset_model_id = asset_model.asset_model_id\r\n\t\t\t\tWHERE\r\n\t\t\t\t\tasset_transaction.transaction_id = %s\r\n\t\t\t\tUNION\r\n\t\t\t\tSELECT \r\n\t\t\t\t\tinventory_model.short_description AS short_description, \r\n\t\t\t\t\tinventory_model.inventory_model_code AS code, \r\n\t\t\t\t\tinventory_transaction.quantity AS quantity,\r\n\t\t\t\t\t'' AS receipt_number\r\n\t\t\t\tFROM \r\n\t\t\t\t\tinventory_transaction\r\n\t\t\t\t\tLEFT JOIN inventory_location ON inventory_transaction.inventory_location_id = inventory_location.inventory_location_id\r\n\t\t\t\t\tLEFT JOIN inventory_model ON inventory_location.inventory_model_id = inventory_model.inventory_model_id\r\n\t\t\t\tWHERE \r\n\t\t\t\t\tinventory_transaction.transaction_id = %s\r\n\t\t\t", $objShipment->TransactionId, $objShipment->TransactionId);
     $objDbResult = $objDatabase->Query($strQuery);
     return Item::InstantiateDbResult($objDbResult);
 }
Exemplo n.º 30
0
 public function order_save($indata, $api_key, $transaction_id)
 {
     date_default_timezone_set('Asia/Jakarta');
     $args = '';
     //$api_key = $this->get('key');
     //$transaction_id = $this->get('trx');
     if (is_null($api_key)) {
         $result = json_encode(array('status' => 'ERR:NOKEY', 'timestamp' => now()));
         return $result;
     } else {
         $app = \Prefs::get_key_info(trim($api_key));
         if ($app == false) {
             $result = json_encode(array('status' => 'ERR:INVALIDKEY', 'timestamp' => now()));
             return $result;
         } else {
             //$in = $this->input->post('transaction_detail');
             //$in = file_get_contents('php://input');
             $in = $indata;
             //print $in;
             $buyer_id = 1;
             $args = 'p=' . $in;
             $in = json_decode($in);
             //print "order input to save: \r\n";
             //print_r($in);
             $is_new = false;
             $in->phone = isset($in->phone) && $in->phone != '' ? \Prefs::normalphone($in->phone) : '';
             $in->mobile1 = isset($in->mobile1) && $in->mobile1 != '' ? \Prefs::normalphone($in->mobile1) : '';
             $in->mobile2 = isset($in->mobile2) && $in->mobile2 != '' ? \Prefs::normalphone($in->mobile2) : '';
             if (isset($in->buyer_id) && $in->buyer_id != '' && $in->buyer_id > 1) {
                 $buyer_id = $in->buyer_id;
                 $is_new = false;
             } else {
                 if ($in->email == '' || $in->email == '-' || !isset($in->email) || $in->email == 'noemail') {
                     $in->email = 'noemail';
                     $is_new = true;
                     if (trim($in->phone . $in->mobile1 . $in->mobile2) != '') {
                         if ($buyer = \Prefs::check_phone($in->phone, $in->mobile1, $in->mobile2)) {
                             $buyer_id = $buyer['id'];
                             $is_new = false;
                         }
                     }
                 } else {
                     if ($buyer = \Prefs::check_email($in->email)) {
                         $buyer_id = $buyer['id'];
                         $is_new = false;
                     } else {
                         if ($buyer = \Prefs::check_phone($in->phone, $in->mobile1, $in->mobile2)) {
                             $buyer_id = $buyer['id'];
                             $is_new = false;
                         }
                     }
                 }
             }
             if (isset($in->merchant_trans_id) && $in->merchant_trans_id != "") {
                 $transaction_id = $in->merchant_trans_id;
             }
             if ($is_new) {
                 $random_string = str_random(5);
                 $buyer_username = substr(strtolower(str_replace(' ', '', $in->buyer_name)), 0, 6) . $random_string;
                 $dataset['username'] = $buyer_username;
                 $dataset['email'] = $in->email;
                 $dataset['phone'] = $in->phone;
                 $dataset['mobile1'] = $in->mobile1;
                 $dataset['mobile2'] = $in->mobile2;
                 $dataset['fullname'] = $in->buyer_name;
                 $password = str_random(8);
                 $dataset['password'] = $password;
                 $dataset['created'] = date('Y-m-d H:i:s', time());
                 /*
                 $dataset['province'] =
                 $dataset['mobile']
                 */
                 $dataset['street'] = $in->shipping_address;
                 $dataset['district'] = $in->buyerdeliveryzone;
                 $dataset['city'] = $in->buyerdeliverycity;
                 $dataset['country'] = 'Indonesia';
                 $dataset['zip'] = isset($in->zip) ? $in->zip : '';
                 //$buyer_id = $this->register_buyer($dataset);
                 $is_new = true;
             }
             $order['created'] = date('Y-m-d H:i:s', time());
             $order['ordertime'] = date('Y-m-d H:i:s', time());
             $order['application_id'] = $app->id;
             $order['application_key'] = $app->key;
             $order['buyer_id'] = $buyer_id;
             $order['merchant_id'] = $app->merchant_id;
             $order['merchant_trans_id'] = trim($transaction_id);
             $order['buyer_name'] = $in->buyer_name;
             $order['recipient_name'] = $in->recipient_name;
             $order['email'] = $in->email;
             $order['directions'] = $in->directions;
             //$order['dir_lat'] = $in->dir_lat;
             //$order['dir_lon'] = $in->dir_lon;
             $order['buyerdeliverytime'] = $in->buyerdeliverytime;
             $order['buyerdeliveryslot'] = $in->buyerdeliveryslot;
             $order['buyerdeliveryzone'] = $in->buyerdeliveryzone;
             $order['buyerdeliverycity'] = is_null($in->buyerdeliverycity) || $in->buyerdeliverycity == '' ? 'Jakarta' : $in->buyerdeliverycity;
             $order['currency'] = $in->currency;
             $order['total_price'] = isset($in->total_price) ? $in->total_price : 0;
             $order['total_discount'] = isset($in->total_discount) ? $in->total_discount : 0;
             $order['total_tax'] = isset($in->total_tax) ? $in->total_tax : 0;
             if (in_array(strtoupper(trim($in->delivery_type)), array('COD', 'CCOD', 'PS', 'DO', 'DELIVERY ONLY'))) {
                 $in->delivery_type = 'COD';
             }
             $order['delivery_type'] = $in->delivery_type;
             if ($in->delivery_type == 'DO' || $in->delivery_type == 'Delivery Only') {
                 $order['cod_cost'] = 0;
             } else {
                 $order['cod_cost'] = \Prefs::get_cod_tariff($order['total_price'], $app->id);
             }
             $order['box_count'] = isset($in->box_count) ? $in->box_count : 1;
             $order['pending_count'] = isset($in->pending_count) ? $in->pending_count : 0;
             $order['delivery_note'] = isset($in->delivery_note) ? $in->delivery_note : '';
             $order['shipping_address'] = $in->shipping_address;
             $order['shipping_zip'] = $in->shipping_zip;
             $order['phone'] = $in->phone;
             $order['mobile1'] = $in->mobile1;
             $order['mobile2'] = $in->mobile2;
             $order['status'] = $in->status;
             $order['width'] = $in->width;
             $order['height'] = $in->height;
             $order['length'] = $in->length;
             $order['weight'] = isset($in->weight) ? $in->weight : 0;
             $order['actual_weight'] = isset($in->actual_weight) ? $in->actual_weight : 0;
             $order['delivery_cost'] = $order['weight'];
             $order['cod_bearer'] = isset($in->cod_bearer) ? $in->cod_bearer : 'merchant';
             $order['delivery_bearer'] = isset($in->delivery_bearer) ? $in->delivery_bearer : 'merchant';
             $order['cod_method'] = isset($in->cod_method) ? $in->cod_method : 'cash';
             $order['ccod_method'] = isset($in->ccod_method) ? $in->ccod_method : 'full';
             $order['fulfillment_code'] = isset($in->fulfillment_code) ? $in->fulfillment_code : '';
             // check out who is bearing the cost
             if ($order['delivery_type'] == 'COD' || $order['delivery_type'] == 'CCOD') {
                 if ($order['delivery_bearer'] == 'merchant') {
                     $dcost = 0;
                 } else {
                     $dcost = $order['delivery_cost'];
                 }
                 if ($order['cod_bearer'] == 'merchant') {
                     $codcost = 0;
                 } else {
                     $codcost = $order['cod_cost'];
                 }
                 $order['chargeable_amount'] = $order['total_price'] + $dcost + $codcost;
             } else {
                 if ($order['delivery_bearer'] == 'merchant') {
                     $dcost = 0;
                 } else {
                     $dcost = $order['delivery_cost'];
                 }
                 $order['chargeable_amount'] = $dcost;
             }
             if (isset($in->show_shop)) {
                 $order['show_shop'] = $in->show_shop;
             }
             if (isset($in->show_merchant)) {
                 $order['show_merchant'] = $in->show_merchant;
             }
             $order['is_api'] = 1;
             $ship = new \Shipment();
             foreach ($order as $k => $v) {
                 $ship->{$k} = $v;
             }
             $ship->save();
             $sequence = $ship->id;
             if (isset($in->delivery_id)) {
                 if (is_null($in->delivery_id) || $in->delivery_id == '') {
                     $delivery_id = \Prefs::get_delivery_id($sequence, $app->merchant_id);
                 } else {
                     $delivery_id = \Prefs::get_delivery_id($sequence, $app->merchant_id, $in->delivery_id);
                 }
             } else {
                 $delivery_id = \Prefs::get_delivery_id($sequence, $app->merchant_id);
             }
             $ship->delivery_id = $delivery_id;
             //print_r($ship);
             $ship->save();
             //die();
             if (isset($in->box_count)) {
                 $box_count = $in->box_count;
             } else {
                 $box_count = 1;
             }
             \Prefs::save_box($delivery_id, trim($transaction_id), $order['fulfillment_code'], $box_count);
             $nedata['fullname'] = $in->buyer_name;
             $nedata['merchant_trx_id'] = trim($transaction_id);
             $nedata['delivery_id'] = $delivery_id;
             $nedata['merchantname'] = $app->application_name;
             $nedata['app'] = $app;
             $order['delivery_id'] = $delivery_id;
             $buyer_id = \Prefs::save_buyer($order);
             /*
             $this->db->where('id',$sequence)->update($this->config->item('incoming_delivery_table'),array('delivery_id'=>$delivery_id));
             */
             /*
                 $this->table_tpl = array(
                     'table_open' => '<table border="0" cellpadding="4" cellspacing="0" class="dataTable">'
                 );
                 $this->table->set_template($this->table_tpl);
             
             
                 $this->table->set_heading(
                     'No.',
                     'Description',
                     'Quantity',
                     'Total'
                     ); // Setting headings for the table
             */
             $d = 0;
             $gt = 0;
             if ($in->trx_detail) {
                 $seq = 0;
                 foreach ($in->trx_detail as $it) {
                     $item = new \Deliverydetail();
                     $item->ordertime = $order['ordertime'];
                     $item->delivery_id = $delivery_id;
                     $item->unit_sequence = $seq++;
                     $item->unit_description = $it->unit_description;
                     $item->unit_price = $it->unit_price;
                     $item->unit_quantity = $it->unit_quantity;
                     $item->unit_total = $it->unit_total;
                     $item->unit_discount = $it->unit_discount;
                     $item->save();
                     /*
                     $this->table->add_row(
                         (int)$item['unit_sequence'] + 1,
                         $item['unit_description'],
                         $item['unit_quantity'],
                         $item['unit_total']
                     );
                     
                     $u_total = str_replace(array(',','.'), '', $item['unit_total']);
                     $u_discount = str_replace(array(',','.'), '', $item['unit_discount']);
                     $gt += (int)$u_total;
                     $d += (int)$u_discount;
                     */
                 }
                 $total = isset($in->total_price) && $in->total_price > 0 ? $in->total_price : 0;
                 $total = str_replace(array(',', '.'), '', $total);
                 $total = (int) $total;
                 $gt = $total < $gt ? $gt : $total;
                 $disc = isset($in->total_discount) ? $in->total_discount : 0;
                 $tax = isset($in->total_tax) ? $in->total_tax : 0;
                 $cod = isset($in->cod_cost) ? $in->cod_cost : 'Paid by merchant';
                 $disc = str_replace(array(',', '.'), '', $disc);
                 $tax = str_replace(array(',', '.'), '', $tax);
                 $cod = str_replace(array(',', '.'), '', $cod);
                 $disc = (int) $disc;
                 $tax = (int) $tax;
                 $cod = (int) $cod;
                 $chg = $gt - $disc + $tax + $cod;
                 /*
                 $this->table->add_row(
                     '',
                     '',
                     'Total Price',
                     number_format($gt,2,',','.')
                 );
                 
                 $this->table->add_row(
                     '',
                     '',
                     'Total Discount',
                     number_format($disc,2,',','.')
                 );
                 
                 $this->table->add_row(
                     '',
                     '',
                     'Total Tax',
                     number_format($tax,2,',','.')
                 );
                 
                 
                 if($cod == 0){
                     $this->table->add_row(
                         '',
                         '',
                         'COD Charges',
                         'Paid by Merchant'
                     );
                 }else{
                     $this->table->add_row(
                         '',
                         '',
                         'COD Charges',
                         number_format($cod,2,',','.')
                     );
                 }
                 
                 
                 $this->table->add_row(
                     '',
                     '',
                     'Total Charges',
                     number_format($chg,2,',','.')
                 );
                 
                 $nedata['detail'] = $this->table;
                 
                 
                 $result = json_encode(array('status'=>'OK:ORDERPOSTED','timestamp'=>now(),'delivery_id'=>$delivery_id,'buyer_id'=>$buyer_id));
                 */
                 //return $ship->toArray();
             } else {
                 //$nedata['detail'] = false;
                 //$result = json_encode(array('status'=>'OK:ORDERPOSTEDNODETAIL','timestamp'=>now(),'delivery_id'=>$delivery_id));
                 //return $order;
             }
             return $ship->toArray();
             //print_r($app);
             /*
             
                             if($app->notify_on_new_order == 1){
                                 send_notification('New Delivery Order - Jayon Express COD Service',$in->email,$app->cc_to,$app->reply_to,'order_submit',$nedata,null);
                             }
             
                             if($is_new == true){
                                 $edata['fullname'] = $dataset['fullname'];
                                 $edata['username'] = $buyer_username;
                                 $edata['password'] = $password;
                                 if($app->notify_on_new_member == 1 && $in->email != 'noemail'){
                                     send_notification('New Member Registration - Jayon Express COD Service',$in->email,null,null,'new_member',$edata,null);
                                 }
             
                             }*/
         }
     }
     //$this->log_access($api_key, __METHOD__ ,$result,$args);
 }