How to perform a recursive inventory search with recipe, and find the lowest 'single' value of the recipe ingredients for user notice, I have the following tables
QkjN6m2snH8
m226f2reF28
`estoque`
[0] => [id=>1, nome=>i1, link=>A156, saida=>10, senha=> das165]
[1] => [id=>2, nome=>i2, link=>A160, saida=>3, senha=> das164]
[2] => [id=>3, nome=>i3, link=>A157, saida=>4, senha=> das163]
[3] => [id=>4, nome=>i4, link=>A156, saida=>6, senha=> das162]
[4] => [id=>5, nome=>i5, link=>, saida=>1, senha=> das161]
[4] => [id=>6, nome=>i6, link=>, saida=>1, senha=> das160]
[5] => [id=>7, nome=>i7, link=>A161, saida=>3, senha=> das171]
`receita`
[0] => [id=>1, nome=>p1.1, link=>A156, quantidade=>10, porcao=>0.035]
[1] => [id=>2, nome=>p1.2, link=>A156, quantidade=>3, porcao=>0.028]
[2] => [id=>3, nome=>p2.1, link=>A160, quantidade=>3, porcao=>0.003]
[3] => [id=>4, nome=>p2.2, link=>A160, quantidade=>6, porcao=>0.025]
[4] => [id=>5, nome=>p2.3, link=>A160, quantidade=>3, porcao=>0.029]
[5] => [id=>6, nome=>p3.1, link=>A157, quantidade=>1, porcao=>0.003]103]
[6] => [id=>7, nome=>p3.2, link=>A157, quantidade=>3, porcao=>0.021]
[7] => [id=>8, nome=>p4.1, link=>A156, quantidade=>1, porcao=>0.001]
[8] => [id=>8, nome=>p5.1, link=>A161, quantidade=>1, porcao=>0.010]
[9] => [id=>8, nome=>p5.2, link=>A161, quantidade=>2, porcao=>0.100]
`estoqueMovimento`
[0] => [id=>1, senha=>das164, entrada=> 0.400]
[1] => [id=>2, senha=>das162, entrada=> 0.400]
[2] => [id=>3, senha=>das163, entrada=> 0.400]
[3] => [id=>4, senha=>das161, entrada=> 0.400]
[4] => [id=>5, senha=>das165, entrada=> 0.400]
[5] => [id=>6, senha=>das161, entrada=> 0.400]
[6] => [id=>7, senha=>das160, entrada=> 0.400]
[7] => [id=>8, senha=>das165, entrada=> 0.400]
[8] => [id=>9, senha=>das164, entrada=> 0.400]
[9] => [id=>10, senha=>das171, entrada=> 0.400]
[10] => [id=>11, senha=>das160, entrada=> 0.400]
[11] => [id=>12, senha=>das171, entrada=> 0.400]
in case I need to list the stock and check the link to assemble the recipe only for the items that have a link reminding that they may contain recipe within the recipe
final anwser:
[0] => [id=>1, nome=>i1, link=>A156, estoque=>1 receita]
[1] => [id=>2, nome=>i2, link=>A160, estoque=>0.33 receita]
[2] => [id=>3, nome=>i3, link=>A157, estoque=>2 receitas]
[3] => [id=>4, nome=>i4, link=>A156, estoque=>999.56 receitas]
[4] => [id=>5, nome=>i5, link=>, estoque=> 0.200]
[5] => [id=>6, nome=>i6, link=>, estoque=> 0.300]
[6] => [id=>7, nome=>i7, link=>A161, estoque=> 1 receita]
SELECT bro.nome,bro.tipo,bro.senha,bro.shanlink,bro.estoqueValido,
IF(estoqueValido, 0, bro.minimo) as minimo,
IF(estoqueValido, 0, COALESCE(SUM(clt.entrada),0)-bro.saida) as estoqueAtual,
/*(COALESCE(SUM(clt.entrada),0)-usr.saida)/(bro.quantidade*bro.porcao) as receita,*/
CASE
WHEN COALESCE(SUM(clt.entrada),0)-bro.saida > bro.minimo THEN 2
WHEN COALESCE(SUM(clt.entrada),0)-bro.saida <= bro.minimo && COALESCE(SUM(clt.entrada),0)-bro.saida > 0 THEN 1
ELSE 0
END as estoqueStatus
FROM estoque as bro
LEFT JOIN estoquemovimento as clt ON (bro.senha = clt.senha)
GROUP BY bro.senha ORDER BY bro.shanlink DESC, bro.nome ASC
i receive ban in brasil thks... qnkuBUAwfe0
Hello I'm working on a woocommerce car rental shop and I have the following issue that I'm trying to fix.
Given the following case:
A client comes to rent a car with a date period of October 29 11:00 to November 12 11:00 with a total of 15 days of rentals.
The base price of a car for rent is 17 euros/day with an extra fee of 5 euros/day for October and 17 euros/day with an extra fee of 10 euros/day for November.
So now I have the following dump that shows the same example :
Base Price: 17
Array
(
[10] => Array
(
[fee] => 5.00
[days] => 3
)
[11] => Array
(
[fee] => 10.00
[days] => 12
)
)
When I do the math I'm getting 66 euros for first period 29 October to 31 October and 324 euros for 1 November - 12 November period with a total of 390 euro.
If I were to do an average price 390 / 15 and then set that as price for the car the total would be incorrect.
How could I change the way wocommerce calculates total to calcule the price for the car + other options for rental. ?
Here is a realy basic example
$price = '17.00';
$period_range = array(
'10' => array(
'fee' => 5.00,
'days' => 3
),
'11' => array(
'fee' => 10.00,
'days' => 12
)
);
$charge = array();
foreach($period_range as $range) {
$charge[] = round($range['fee'] * $range['days']);
}
$total = array_sum($charge) + $price;
echo $total;
//this will return 152
In aprioi algorithm i am getting the following results, however, i want just 1 item in lhs as in observation 108, is there any method to do so ?
[104] {205,220} => {1338} 0.001439682 0.277148253 5.856511 587
[105] {272,1338} => {220} 0.001172347 0.248569943 5.776527 478
[106] {205,1215} => {1366} 0.001035001 0.156180607 5.702459 422
[107] {220,272} => {1338} 0.001172347 0.264088398 5.580539 478
[108] {351} => {1366} 0.003676462 0.151720648 5.539617 1499
In the R package arules, you can limit the number of items in the rule to 2 when you call apriori().
apriori(data, parameter = list(minlen = 2, maxlen = 2))
I am trying to load a WordPress blog list with the following structure.
this is my code
enter image description here
(div class="left-wrap)
post-1
post-4
post-7
(div class="right-wrap)
post-2
post-3
post-5
post-6
(/div)
POST 1 | POST 2 , POST 3
POST 4 | POST 5 , POST 6
POST 7 | POST 8 , POST 7
Thank you for your help.
Populate the post array like the below and separately loop through for the left and right section
<?php
$posts = ["one", "two", "three", "four", "five","six", "seven", "eight", "nine", "ten"];
$left_array = [];
$right_array = [];
foreach($posts as $key => $post){
if(($key+1) % 3 == 1){
$left_array[] = $post;
}
else{
$right_array[] = $post;
}
}
print_r($left_array);
print_r($right_array);
?>
OUTPUT
LEFT ARRAY
Array
(
[0] => one
[1] => four
[2] => seven
[3] => ten
)
RIGHT ARRAY
Array
(
[0] => two
[1] => three
[2] => five
[3] => six
[4] => eight
[5] => nine
)