if(($store_planogram[$row["id"]] ?? 0)>0 or $_SESSION["show_planogram_0"]==1) {
$difference=($store_planogram[$row["id"]] ?? 0)-($values_in[$row["id"]]["quantity"] ?? 0);
if(!empty($store_planogram[$row["id"]])) $difference_percent=100-round(100*$difference/$store_planogram[$row["id"]]);
-else $difference_percent="";
+else $difference_percent=0;
echo"<tr style=\"";
if($difference_percent<0) $difference_percent=">".abs($difference_percent);
if(!empty($store_planogram[$row["id"]]) and !empty($difference_percent)) $difference_percent .="%";
-else $difference_percent ="";
+else $difference_percent =0;
echo'">'.$difference.'</td>
<td class="tdcntr bg-default">'.$difference_percent.'</td>';
if($color!="NULL") $color=str_replace('"','',$color);
else $color='';
-$sql = "INSERT INTO store_products_fact (store_id, product_id, date_id, color, quantity) VALUES ('$store_id','$product_id','$date_id','$color','$quantity')"
+$sql = "INSERT INTO store_products_fact (store_id, product_id, date_id, color, quantity, quantity_polnogramm, difference, difference_percent) VALUES ('$store_id','$product_id','$date_id','$color','$quantity', 0, 0, 0)"
. " ON CONFLICT(date_id, product_id, color, store_id) DO UPDATE SET quantity=$quantity";
//echo"<br><br>++$color++$sql";
$db::sql($sql);