if (!empty($check_id)) { echo "SESSUION" . ($customer_id = $check_id); $FLAG_SITE_PICKED_UP = 1; } } //keep in sesson if (isset($_POST['sticker_id'])) { echo "SS" . strlen($_POST['first_sticker']); if (validate_size_barcode($_POST['first_sticker']) == 1) { echo "First sticker"; $sticky = 1; $first_sticker = set_first_sticker($_POST['first_sticker']); } } else { if (get_sticker_session()) { $first_sticker = get_sticker_session(); } } //echo $customer_id; //echo $FLAG_SITE_PICKED_UP; if ($customer_id == 0 and $FLAG_SITE_PICKED_UP == 1) { echo "redirecting to specify new customer"; // echo '<a href="customer.php">A </a>'; $FLAG_GO_CUSTOMER_DETAILS = 1; redirect("customer.php", 0); // header('Location: #customer-details'); die; } ?>
function generate_default_manifest_counter($SIZE_OF_MANIFEST) { //instead or preset size of manifest there may be a function checking the sub_cat maybe global $FLAG_MANIFEST_UNQ_NUMBER; //to be funny we take unique manifest_number as global :) asuuming it's correctly stored somewhere :) //if exist of course ;P //** $result_sub_categories = read_sub_categories(); //we ll read all no constraint //** dont know how many. needs to be extracted to manifest counter. leets check how many $number_of_subcategories_avl = mysqli_num_rows($result_sub_categories); //checking how many echo "NUMBER AVAIL: " . $number_of_subcategories_avl; //OK extracted 61 sub cat availible originally. assuming those the some drove on manifest. but here we //genereate the counter only to manifest size, the main varaiable for calculations. if (!empty($FLAG_MANIFEST_UNQ_NUMBER)) { $c = 0; echo "Generating counter table"; echo "Extatracting availible categoreis: " . $number_of_subcategories_avl . " -" . $SIZE_OF_MANIFEST; for ($i = 0; $i < $SIZE_OF_MANIFEST; $i++) { $row = mysqli_fetch_row($result_sub_categories); //gets one and put pointer ahead $sub_cat = $row[0]; //get manifest reg id //conversion of uniqu number for ai manifest id $manifest_id = read_manifest_id($FLAG_MANIFEST_UNQ_NUMBER); //lets do the transaction or not... //prepared statement instead //QTTY set 0 ;EXTRACT sub_cat real. old mode they are orgines 1 to n $sql = "INSERT INTO manifest_counter(manifest_counter,sub_cat,manifest_reg_idmanifest_reg,finished) VALUES('0','{$sub_cat}',{$manifest_id},'0')"; //state finished is 0 while manifest counter initialized. we give counter as order of items, doesnt matter, and sub_cat 0, cause nothing picked up yet. //we also leave space for further function for manifest_counter clonong. That comes with manifest site_has cat filling in real time. not sure of its purpose yet $result = query_selecti($sql); if ($result) { $c++; } } echo "done: " . $i . "==" . $c; if ($c == $i) { //here we put a sticker. good place $first_sticker = get_sticker_session(); $sql = "UPDATE manifest_reg SET start_dbs='{$first_sticker}' WHERE manifest_unq_num='{$FLAG_MANIFEST_UNQ_NUMBER}'"; //here w can switch as well to manifest_id query_selecti($sql); echo "Before site generatiion"; $last_site = dbi_generate_site(); //if initialized and generated manifest reg and counter than open a new site to write //here we update site manifest_counter set_site_id($last_site); // here we set session site id only if it was genereted correctly echo "Updating site " . $last_site; //site id temporary keep in session //$_SESSION['SITE_ID']=$last_site; echo $update = "UPDATE manifest_reg SET siteid='{$last_site}' WHERE idmanifest_reg='{$manifest_id}'"; $result = query_selecti($update); if ($result) { echo "Manifest Reg site updated"; } } } else { echo "Couldnt initialized manifest counter cause global FLAG_MANIFEST_REG not set, UNQ_NUM"; } }