function collectUser($userId) { $minYear = 2006; $dwSum = $dwDays = $oldWeek = 0; for ($y = $minYear; $y <= date('Y'); $y++) { $qSum = $qDays = $oldQuarter = 0; for ($m = 1; $m < 13; $m++) { if ($oldQuarter != quarter($m)) { if ($qDays > 0) { setWeight($userId, sprintf("Q%04d-%d", $y, $oldQuarter), $qSum / $qDays, 'q'); } $qSum = $qDays = 0; $oldQuarter = quarter($m); } if (sprintf('%04d%02d', $y, $m) > date('Ym')) { break; } $days = date('t', mktime(0, 0, 0, $m, 1, $y)); $sum = $qty = 0; for ($i = 1; $i <= $days; $i++) { if ($oldWeek != doubleWeek($y, $m, $i)) { if ($dwDays > 0) { setWeight($userId, sprintf("D%s", $oldWeek), $dwSum / $dwDays, 'dw'); } $dwDays = $dwSum = 0; $oldWeek = doubleWeek($y, $m, $i); } $a = getKoeff($userId, date('o.W', mktime(0, 0, 0, $m, $i, $y))); if ($a > 0) { $sum += $a; $qSum += $a; $dwSum += $a; $qDays++; $qty++; $dwDays++; } } if ($qty > 0) { // printf("%04d-%02d sum: %d\n",$y,$m,$sum); setWeight($userId, sprintf("%04d-%02d", $y, $m), $sum / $qty); } } if ($qDays > 0) { setWeight($userId, sprintf("Q%04d-%d", $y, $oldQuarter), $qSum / $qDays, 'q'); } } if ($dwDays > 0) { setWeight($userId, sprintf("D%s", $oldWeek), $dwSum / $dwDays, 'dw'); } }
protected function setInfoShopperpress() { $product = ''; include_once PLUGIN_PATH_SHIPWORKSWORDPRESS . 'functions/shopperpress/functionsShopperpress.php'; $this->itemID = getItemInformation($this->row, $this->k, "SKU"); $this->productID = getItemInformation($this->row, $this->k, "SKU"); $this->code = getItemInformation($this->row, $this->k, "SKU"); $this->sku = getItemInformation($this->row, $this->k, "SKU"); if ($sku != '') { $product = $sku; } else { $product = $items['product']; } $this->name = getItemInformation($this->row, $this->k, "Name"); $this->quantity = getItemInformation($this->row, $this->k, "Qty"); $this->price = getItemInformation($this->row, $this->k, "Price"); $this->unitprice = (double) substr($this->price, 3, strlen($this->price) - 2) / (double) $this->quantity; $this->weight = setWeight($this->sku); }
familyName("Hanif", "Lab"); familyName("Suges", "Home"); familyName("Ayu", "Puskom"); familyName("Ulvie", "405"); familyName("Wong", "411A"); ?> <br><br> <?php function setWeight($minweight = 50) { echo "The weight is : {$minweight} <br>"; } setWeight(65); setWeight(); setWeight(73); setWeight(80); ?> <br><br> <?php function sum($x, $y) { $z = $x + $y; return $z; } echo "123 + 17 = " . sum(123, 17) . "<br>"; echo "7 + 13 = " . sum(7, 13) . "<br>"; echo "345 + 465 = " . sum(345, 465); ?> </body> </htm