public static function getCustomerWeekSpend($id) { DynamicCall::getFranchiseName($id); $result = DynamicCall::getBmsCustomer(strtolower(Yii::app()->session['franchise']), $id, 'http://dev.jaspersonline.co.uk/soap/jaspers.wsdl'); // $result = DynamicCall::getBmsCustomer('chester', 90, 'http://dev.jaspersonline.co.uk/soap/jaspers.wsdl'); if (isset($result['wkspend'])) { echo $result['wkspend']; } }
public function actionTest() { // $franchises = DynamicCall::getBmsFranchise('http://orders.jaspersonline.co.uk/info/branchlist.php'); // $total = 0; // $total_updates = 0; // $total_not_updates = 0; // $errors = array(); // $customers = array(); // foreach ($franchises as $franchise) { // if (!$franchise instanceof Franchise) // continue; // foreach ($franchise->customers as $customer): //// $result = DynamicCall::getBmsCustomer('chester', 90, 'http://dev.jaspersonline.co.uk/soap/jaspers.wsdl'); // $result = DynamicCall::getBmsCustomer(strtolower($franchise->name), $customer->id, 'http://dev.jaspersonline.co.uk/soap/jaspers.wsdl'); // if ($result) { // $date1 = getFmtDate($customer->update_time, 'Y-m-d H:i:s', 0, 20); // $date2 = getFmtDate($result['update_time'], 'Y-m-d H:i:s', 0, 20); // if (($date1 > $date2) || !($customer->update_time)) { // $errors[] = CActiveForm::validate($customer); //// $customer->attributes = $result; // $customers[] = $customer->attributes; // ++$total_updates; // } else { // ++$total_not_updates; // } // ++$total; // } // endforeach; // } // e($customers, 0); // echo "total records Traversed = " . $total . "<br>"; // echo "total records Updated = " . $total_updates . "<br>"; // echo "total records Not Updated = " . $total_not_updates . "<br>"; //// echo print_r($errors); $franchises = DynamicCall::getBmsFranchise('http://orders.jaspersonline.co.uk/info/branchlist.php'); $total = 0; $total_updates = 0; $total_not_updates = 0; $errors = array(); foreach ($franchises as $franchise) { if (!$franchise instanceof Franchise) { continue; } foreach ($franchise->customers as $customer) { // $result = DynamicCall::getBmsCustomer('chester', 90, 'http://dev.jaspersonline.co.uk/soap/jaspers.wsdl'); // $result = DynamicCall::getBmsCustomer(strtolower($franchise->name), $customer->id, 'http://dev.jaspersonline.co.uk/soap/jaspers.wsdl'); $result = DynamicCall::getBmsCustomer('chester', $customer->id, 'http://dev.jaspersonline.co.uk/soap/jaspers.wsdl'); if ($result) { $date1 = getFmtDate($customer->update_time, 'Y-m-d H:i:s', 0, 20); $date2 = getFmtDate($result['update_time'], 'Y-m-d H:i:s', 0, 20); // if (($date1 > $date2) || !($customer->update_time)) { // remove htis echo "customer <br>"; e($customer->attributes, 0); echo "geting data <br>"; e($result, 0); echo "sync data <br>"; $customer->attributes = $result; // e($result,0); e($customer->attributes); // $customer->save(); $errors[] = CActiveForm::validate($customer); // e($errors); ++$total_updates; // } else { // uncomment else part // ++$total_not_updates; // } ++$total; } } } echo "total records Traversed = " . $total . "<br>"; echo "total records Updated = " . $total_updates . "<br>"; echo "total records Not Updated = " . $total_not_updates . "<br>"; echo print_r($errors); }
public static function getCustomerWeekSpend($id) { $customerData = DynamicCall::getFranchiseName($id); $result = DynamicCall::getBmsCustomer(strtolower($customerData['franchise_name']), $customerData['customer_id'], 'http://dev.jaspersonline.co.uk/soap/jaspers.wsdl'); // $result = DynamicCall::getBmsCustomer('chester', 90, 'http://dev.jaspersonline.co.uk/soap/jaspers.wsdl'); if (isset($result['wkspend'])) { echo $result['wkspend']; } else { echo 0; } }