/** * Exports the object as an array. * * You can specify the key type of the array by passing one of the class * type constants. * * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME, * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. * * @return array an associative array containing the field names (as keys) and field values */ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) { if (isset($alreadyDumpedObjects['SaleProduct'][$this->getPrimaryKey()])) { return '*RECURSION*'; } $alreadyDumpedObjects['SaleProduct'][$this->getPrimaryKey()] = true; $keys = SaleProductTableMap::getFieldNames($keyType); $result = array($keys[0] => $this->getId(), $keys[1] => $this->getSaleId(), $keys[2] => $this->getProductId(), $keys[3] => $this->getAttributeAvId()); $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } if ($includeForeignObjects) { if (null !== $this->aSale) { $result['Sale'] = $this->aSale->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } if (null !== $this->aProduct) { $result['Product'] = $this->aProduct->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } if (null !== $this->aAttributeAv) { $result['AttributeAv'] = $this->aAttributeAv->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } } return $result; }
public function __construct() { parent::__construct(); $this->load->model('purchase_statistics_model'); $this->load->helper('db_helper'); $this->template->add_js('static/js/sorttable.js'); }
public function run() { $faker = Faker::create(); foreach (range(1, 10) as $index) { Sale::create(['branch_id' => $faker->numberBetween($min = 1, $max = 10), 'cashier_sales_id' => $faker->numberBetween($min = 1, $max = 10), 'sales_total' => $faker->numberBetween($min = 100, $max = 1000), 'customer_change' => $faker->numberBetween($min = 1, $max = 100), 'number_of_items' => $faker->numberBetween($min = 1, $max = 10), 'vat_sales' => $faker->numberBetween($min = 5, $max = 12)]); } }
public function __construct() { parent::__construct(); $this->load->model('quality_testing_model'); $this->load->model('order_model'); $this->load->library('form_validation'); }
public function __construct() { parent::__construct(); $this->load->helper('taobao'); $this->load->model('taobao_model'); $this->load->model('order_model'); $this->load->library('form_validation'); }
public function __construct() { parent::__construct(); $this->load->model('ebay_model'); $this->load->model('order_model'); $this->load->model('product_model'); $this->load->model('sale_order_model'); }
/** * Generate sales report by range * */ public static function generateSalesByRange() { $from = Input::get('from') . ' 00:00:00'; $to = Input::get('to') . ' 23:59:59'; $by = Input::get('cashier'); // $to = '2015-09-01 16:07:39'; $data = Sale::generateByRange($from, $to, $by); return $data; }
function loadSale($ID) { $db = DB::GetConn(); $id_con = $db->quoteInto("ID = ?", $ID); $getQuery = "SELECT * FROM `Sale` WHERE {$id_con} limit 1;"; $res = $db->query($getQuery); $obj = $res->fetchObject(); return Sale::loadSaleFromObject($obj); }
public function __construct() { parent::__construct(); $this->load->model('sale_model'); $this->load->model('sale_order_model'); $this->load->model('product_model'); $this->load->model('shipping_code_model'); $this->load->model('stock_model'); $this->load->library('form_validation'); }
public function test_getBySaleItemId() { /** === Test Data === */ $ID = 32; /** === Mock object itself === */ $this->obj = \Mockery::mock(Sale::class . '[get]', $this->objArgs); /** === Setup Mocks === */ // $rows = $this->get($where); $mRow = 'init data'; $mRows = [$mRow]; $this->obj->shouldReceive('get')->once()->with('=' . $ID)->andReturn($mRows); // $item = $this->_manObj->create(\Praxigento\Warehouse\Data\Entity\Quantity\Sale::class, ['arg1' => $row]); $mItem = 'item'; $this->mManObj->shouldReceive('create')->once()->with(\Praxigento\Warehouse\Data\Entity\Quantity\Sale::class, ['arg1' => $mRow])->andReturn($mItem); /** === Call and asserts === */ $res = $this->obj->getBySaleItemId($ID); $this->assertTrue(is_array($res)); $this->assertEquals($mItem, current($res)); }
public function __construct() { parent::__construct(); if (!session_id()) { session_start(); } $this->load->model('ebay_model'); $this->load->model('order_model'); $this->load->model('product_model'); $this->load->model('sale_order_model'); $this->load->config('config_ebay'); }
public function __construct() { parent::__construct(); $this->load->helper('solr'); $this->load->model('solr/catalog_statistic_model'); $this->load->model('user_model'); $this->load->model('rate_model'); $this->load->model('order_model'); $rates = $this->order_model->fetch_currency(); foreach ($rates as $rate) { $this->cur_rates[$rate->name_en] = $rate->ex_rate; } }
public function __construct() { parent::__construct(); $this->load->library('form_validation'); $this->load->helper('purchase_order_helper'); $this->load->model('product_model'); $this->load->model('purchase_order_model'); $this->load->model('shipping_code_model'); $this->load->model('order_role_model'); $this->load->model('order_model'); $this->load->model('sale_order_model'); $this->load->model('user_model'); $this->config->load('config_ebay'); }
public function test_accessors() { /** === Test Data === */ $LOT_REF = 'lot ref'; $SALE_ITEM_REF = 'sale item ref'; $TOTAL = 'total'; /** === Call and asserts === */ $this->obj->setLotRef($LOT_REF); $this->obj->setSaleItemRef($SALE_ITEM_REF); $this->obj->setTotal($TOTAL); $this->assertEquals($LOT_REF, $this->obj->getLotRef()); $this->assertEquals($SALE_ITEM_REF, $this->obj->getSaleItemRef()); $this->assertEquals($TOTAL, $this->obj->getTotal()); }
public function actionModify($flag) { $model = Sale::model()->findByPk(1); $oldpic =''; switch($flag){ case 'top': $oldpic = $model->bgtop;$field='bgtop';break; case 'ttit': $oldpic = $model->titletuan;$field='titletuan';break; case 'tbg': $oldpic = $model->bgtuan;$field='bgtuan';break; case 'stit': $oldpic = $model->titlesale;$field='titlesale';break; case 'sbg': $oldpic = $model->bgsale;$field='bgsale';break; case 'bottom': $oldpic = $model->bgbottom;$field='bgbottom';break; } if(isset($_POST['Sale'])){ $newpic = CUploadedFile::getInstance($model,$field); if($newpic){ //删除原来的图片 if(file_exists('./'.$oldpic)){ @unlink('./'.$oldpic); } //上传新的图片 $preRand = 'img_'.$now.mt_rand(100,999); $imgName = $preRand.'.'.$newpic->extensionName; $dir = date('Ymd',$now); if(!is_dir('uploads/'.$dir)) { mkdir('uploads/'.$dir); } $newpic->saveAs('uploads/'.$dir.'/'.$imgName); $_POST['Sale'][$mykey] = '/uploads/'.$dir.'/'.$imgName;//成功,返回路径 $model->attributes = $_POST['Sale']; if($model->save(false)){ $this->redirect(array('index')); } } } $this->render('modify',array( 'oldpic'=>$oldpic, 'field'=>$field, )); }
public function __construct() { parent::__construct(); require_once APPPATH . 'libraries/taobao/TopSdk.php'; $product_mode = FALSE; // TRUE or FALSE to toggle for product mode or sandbox mode. $this->config->load('config_taobao', TRUE); if ($product_mode) { $config = $this->config->item('product', 'config_taobao'); } else { $config = $this->config->item('sandbox', 'config_taobao'); } var_dump($config); $this->top_client = new TopClient($product_mode); $this->top_client->appkey = $config['app_key']; $this->top_client->secretKey = $config['app_secret']; }
function completeSale($saleID, $buyerID) { $sale = Sale::loadSale($saleID); $buyer = User::load($buyerID); $seller = User::load($sale->SellerID); if ($sale->ItemType == "Weapon") { //spend money $buyer->debit($sale->Price); $seller->credit($sale->Price); //transfer Item $sale->Item->UserID = $buyerID; $sale->Item->save(); //send message to seller userController::sendMessage($seller->ID, $buyer->ID, "Your shop item " . $sale->Item->Name . " sold to " . $buyer->username . " for " . $sale->Price . "gp.", "What if you need that later?", 2); //delete sale $sale->delete(); } }
public function __construct() { parent::__construct(); $this->load->model('sale_model'); $this->load->model('product_model'); $this->load->model('product_packing_model'); $this->load->model('order_model'); $this->load->library('form_validation'); $this->load->helper('validation'); $this->load->model('fee_price_model'); $this->load->model('shipping_company_model'); $this->load->model('shipping_function_model'); $this->load->model('shipping_subarea_model'); $this->load->model('shipping_subarea_group_model'); $this->load->model('shipping_type_model'); $this->load->model('shipping_code_model'); $this->load->helper('shipping_helper'); $this->load->helper('db_helper'); }
public function processPayment() { // Set your secret key: remember to change this to your live secret key in production // See your keys here https://dashboard.stripe.com/account/apikeys Stripe::setApiKey("sk_live_NharL7KTJBPcvdVrbQIXr3MS"); // Get the credit card details submitted by the form $token = Input::get('stripeToken'); // Create the charge on Stripe's servers - this will charge the user's card try { if (Shipping::where('cart_id', Session::get('cart_id'))->pluck('payment_status') == 'Paid') { return Redirect::route('alreadyPaid'); } $charge = Charge::create(array("amount" => Input::get('data-description'), "currency" => "usd", "source" => $token, "description" => Session::get('cart_id'))); } catch (\Stripe\Error\Card $e) { // The card has been declined } $cart_id = Session::get('cart_id'); $markPaid = Shipping::where('cart_id', Session::get('cart_id'))->first(); $markPaid->payment_status = 'Paid'; $markPaid->shipped_status = 'Not Shipped'; $markPaid->save(); //inventorytime // foreach(Cart::where('customer_id', $cart_id)->get() as $purgeCarts) // { // $inventory = Inventory::where('product_id', $purgeCarts->item)->pluck($purgeCarts->size); // $newsize = $inventory - $purgeCarts->quantity; // DB::table('inventories')->where('product_id', $purgeCarts->item)->update(array($purgeCarts->size => $newsize)); // } Mail::send('emails.Newsale', array('cart' => $cart_id, 'customer' => Shipping::where('cart_id', $cart_id)->first()), function ($message) { $checkoutAmt = Session::get('checkoutAmt'); $message->to(Shipping::where('cart_id', Session::get('cart_id'))->pluck('email'))->subject("Your Eternally Nocturnal Order"); }); Mail::send('emails.Newsaleadmin', array('cart' => $cart_id, 'customer' => Shipping::where('cart_id', $cart_id)->first()), function ($message) { $checkoutAmt = Session::get('checkoutAmt'); $message->to('*****@*****.**')->subject("NEW SALE \$" . substr($checkoutAmt, 0, -2) . "." . substr($checkoutAmt, -2)); }); Sale::create(array('customer_id' => $markPaid->email, 'cart_id' => Session::get('cart_id'))); Session::forget('cart_id'); Session::forget('checkoutAmt'); return Redirect::route('transSuccess'); }
/** * Exports the object as an array. * * You can specify the key type of the array by passing one of the class * type constants. * * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME, * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. * Defaults to TableMap::TYPE_PHPNAME. * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. * * @return array an associative array containing the field names (as keys) and field values */ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) { if (isset($alreadyDumpedObjects['SaleOffsetCurrency'][serialize($this->getPrimaryKey())])) { return '*RECURSION*'; } $alreadyDumpedObjects['SaleOffsetCurrency'][serialize($this->getPrimaryKey())] = true; $keys = SaleOffsetCurrencyTableMap::getFieldNames($keyType); $result = array($keys[0] => $this->getSaleId(), $keys[1] => $this->getCurrencyId(), $keys[2] => $this->getPriceOffsetValue()); $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } if ($includeForeignObjects) { if (null !== $this->aSale) { $result['Sale'] = $this->aSale->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } if (null !== $this->aCurrency) { $result['Currency'] = $this->aCurrency->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } } return $result; }
/** * GetSales() cleans up the result of the raw SOAP call. PHP::SOAP does some wierd things that * make parsing difficult; mainly single results vs. multiple results are handled differently. * This function takes the raw result and cleans it up, returning an array of Client objects, * with all their fields initialized * @param int $saleID The exact sale ID * @param DateTime $saleStartDate The start date to retrieve sales * @param DateTime $saleEndDate The end date to retrieve sales * @param int $paymentMethodID The ID of the payment method that must have been used on the sales. * @param SourceCredentials $credentials A source credentials object to use with this call * @param string $XMLDetail * @param int $PageSize * @param int $CurrentPage * @param string $Fields * @return An array of Sale objects that match the current filter settings */ public function GetSales($saleID, $saleStartDate, $saleEndDate, $paymentMethodID, SourceCredentials $credentials = null, $XMLDetail = XMLDetail::Full, $PageSize = NULL, $CurrentPage = NULL, $Fields = NULL) { $result = $this->GetSalesRaw($saleID, $saleStartDate, $saleEndDate, $paymentMethodID, $credentials, $XMLDetail, $PageSize, $CurrentPage, $Fields); $properties = get_object_vars($result->GetSalesResult->Sales); if (empty($properties)) { $return = array(); } else { if (is_array($result->GetSalesResult->Sales->Sale)) { // Multiple results returned foreach ($result->GetSalesResult->Sales->Sale as $sale) { $return[] = Sale::ConvertFromstdClass($sale); } } else { // Only a single result $return[] = Sale::ConvertFromstdClass($result->GetSalesResult->Sales->Sale); } } if ($this->debug) { echo '<h2>GetSales Result</h2><pre>'; print_r($return); echo "</pre>"; } return $return; }
public function actionElement($param) { //Если параметр текст - это каталог, если число - элемент $paramArr = explode("/", $param); $paramArr = array_pop($paramArr); if (is_numeric($paramArr)) { //Число - это элемент $model = Sale::model()->findByPk((int) $paramArr); //Смотрим, нужно ли вставить фотогалерею $model->description = $this->addPhotogalery($model->description); $render = 'view'; } else { //Список новостей категории $modelGroup = SaleGroup::model()->find('url LIKE "' . $paramArr . '"'); $model = array(); $model['group'] = array(); $model['no_group'] = Sale::model()->findAll(array("condition" => "status!=0 AND group_id = " . $modelGroup->id, "order" => "id DESC")); $render = 'index'; } if (empty($model)) { throw new CHttpException(404, 'The page can not be found.'); } $this->render($render, array('model' => $model)); }
function opalo_solicitudes_sugar() { parent::Sale(); }
public function actionDeleteSale($sale_id) { $result_id = Sale::model()->deleteSale($sale_id, 'Cancel Suspended Sale', Yii::app()->wshoppingCart->getEmployee()); if ($result_id === -1) { Yii::app()->user->setFlash(TbHtml::ALERT_COLOR_SUCCESS, '<strong>Oh snap!</strong> Change a few things up and try submitting again.'); } else { Yii::app()->wshoppingCart->clearAll(); Yii::app()->user->setFlash(TbHtml::ALERT_COLOR_SUCCESS, '<strong>Well done!</strong> Invoice Id ' . $sale_id . 'have been deleted successfully!'); $this->redirect('ListSuspendedSale'); } }
<?php set_include_path(dirname(_FILE_) . '/../'); require_once 'class/Object.class.php'; require_once 'class/Period.class.php'; require_once 'class/Sale.class.php'; /* //Pour créer une vente, on a besoin d'un objet et d'une période $Objet = new Object(2); $Period = new Period(11); echo '<h2>Création</h2>'; $Sale = new Sale(0, $Objet, $Period, 'vente 2'); echo $Sale->getState(); echo $Sale->getId(); echo $Sale->getName(); echo $Sale->getObject()->getName(); echo $Sale->getPeriod()->getDateEnd(); */ echo '<h2>Lecture</h2>'; $Sale = new Sale(1); //echo $Sale->setPeriod(new Period(2)); echo $Sale->setName('toto'); echo $Sale->getState(); echo $Sale->getId(); echo $Sale->getName(); echo $Sale->getObject()->getName(); echo $Sale->getPeriod()->getDateEnd();
function addSale() { include_once "../model/Sale.php"; $product_id = $_REQUEST['product_id']; $product_price = $_REQUEST['product_price']; $quantity_sold = $_REQUEST['quantity_sold']; $total_cost = $_REQUEST['total_cost']; $buyer_phone = $_REQUEST['buyer_phone']; $seller_username = $_SESSION['username']; $mysale = new Sale(); if (!$mysale->addSale($product_id, $product_price, $quantity_sold, $total_cost, $buyer_phone, $seller_username)) { echo '{"result": 0, "message": "Could not add sale"}'; return; } echo '{"result": 1, "message": "Sale has been recorded"}'; return; }
public function copyEntireSuspendSale($sale_id) { $this->clearAll(); $sale = Sale::model()->findbyPk($sale_id); $sale_item = SaleItem::model()->getSaleItem($sale_id); $payments = SalePayment::model()->getPayment($sale_id); foreach ($sale_item as $row) { if ($row->discount_type == '$') { $discount_amount = $row->discount_type . $row->discount_amount; } else { $discount_amount = $row->discount_amount; } $this->addItem($row->item_id, $row->quantity, $discount_amount, $row->price, $row->description); } foreach ($payments as $row) { $this->addPayment($row->payment_type, $row->payment_amount); } $this->setCustomer($sale->client_id); $this->setComment($sale->remark); $this->setTotalDiscount($sale->discount_amount); $this->setSaleId($sale_id); }
public function __construct() { parent::__construct(); $this->load->model('waiting_for_perfect_model'); }
/** * Declares an association between this object and a Sale object. * * @param Sale $v * @return ProductHasSale The current object (for fluent API support) * @throws PropelException */ public function setSale(Sale $v = null) { if ($v === null) { $this->setSaleId(NULL); } else { $this->setSaleId($v->getId()); } $this->aSale = $v; // Add binding for other direction of this n:n relationship. // If this object has already been added to the Sale object, it will not be re-added. if ($v !== null) { $v->addProductHasSale($this); } return $this; }
/** * ajoute une nouvelle vente en reprennant le nom de la periode pour simplifier * @param int $obj_id * @param int $per_id * @return String $csvResult */ public function addSale($obj_id, $per_id) { $rtn = new ComplexData(); $obj = new Object($obj_id); if ($obj->getState() != 1) { $rtn->addLine(array($obj->getState(), 0)); return $rtn->csvArrays(); } $per = new Period($per_id); if ($per->getState() != 1) { $rtn->addLine(array($per->getState(), 0)); return $rtn->csvArrays(); } $sale = new Sale(0, $obj, $per, $per->getName()); $rtn->addLine(array($sale->getState(), $sale->getId())); return $rtn->csvArrays(); }