if ($type == 3) { echo "Type 2. Bric-a-Brac"; $sql = "SELECT * from sub_cat WHERE kind=2 AND item_type=1 ORDER BY Name_sub ASC"; } $sql_load = $sql; //Lets load our statement into main sql_load. Than execute } else { } //if all, not type of tab set than use original sql load statement get_size_of_manifest($sql_load); //here we initialize one more time global variables that are gone to pass them to argument of generate manifest counter //commented only visible , lest count each one //$SIZE_OF_MANIFEST=$SIZE_VISIBLE; $SIZE_OF_MANIFEST = $SIZE_OF_MANIFEST; generate_default_manifest_counter($SIZE_OF_MANIFEST); $manifest_reg_id = read_manifest_id($FLAG_MANIFEST_UNQ_NUMBER); if (!empty($manifest_reg_id)) { $_SESSION['MANIFEST_REG_ID'] = $manifest_reg_id; } //lets keep from no on all the time current id manifest id, tha we use to add one //here we should have a wrapper to extract session id to local variable..check it state and compare throu dbi api. manitor the states // echo "SESSION: MANIFEST_REG: ".$_SESSION['MANIFEST_REG_ID']; $qtty_digit = 0; construct_table_draw_table($sql_load); //here probably is generated SIZEOF MANIFEST VISIBLE process_received(receive()); ?> </div>
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"; } }