示例#1
0
/**    Used to assign weights to particular atts groups
 * 
 * 
 * @global type $FLAG_SIZE_SUB_CAT
 * @param type $manifest_reg_id
 * @return array(small_att_assignment) Description
 */
function att_assignment($manifest_reg_id)
{
    global $FLAG_SIZE_SUB_CAT;
    $id_c = get_sub_cat_id()[0];
    //gets all id_c availible
    $small_att_weight = array();
    for ($i = 1; $i < $FLAG_SIZE_SUB_CAT + 1; $i++) {
        //+  echo  "</BR>Calculating: ";
        //+ echo $i;
        //+ echo " - ";
        // var_dump($id_c);
        $actual_weight_for_category = get_weight_for_calculations($id_c[$i])[0];
        //weight of sub_cat
        $actual_name_of_sub_cat = get_weight_for_calculations($id_c[$i])[1];
        //ident of sub cat
        $weight = $actual_weight_for_category;
        //alias
        //+    echo " - ";
        $actual_name_of_sub_cat;
        // echo  $actual_weight_for_category[1];
        //+    echo "</BR>";
        //+   echo "Active category: ";
        //$category_active=0;
        $category_active = check_category_assignment($actual_name_of_sub_cat);
        //here we calculate weights. We take actual sub_cat. check its weight actual and category actual for that moment on device. and check how many in counter
        //what is needed is to compare function of a counter with that actual ones taken fron sub_cat. Shall be the same
        //get qtty received for specific manifest_reg and sub_cat. one at a tine
        $qtty_rcvd = qtty_rcvd_manifest_counter_no_delay($manifest_reg_id, $actual_name_of_sub_cat);
        //+ echo "</br>received :";
        $qtty_rcvd;
        //calculations here
        //$weight * $qtty_rcvd;  //actual weight from universal tables times qtty rcved from counter. No real validation checks or casting sub_categories from sub_cat into conter
        //echo "total cat ";
        //echo $weee_weights_calculated;
        //check each sub_cat and get atts weights along_side
        $category_att;
        // This variable is used to store actual item att
        //  echo "</BR>".$actual_name_of_sub_cat." ATT: ".
        $category_att = small_att_assignment($actual_name_of_sub_cat);
        //this is to initialise another table
        //than assign the weight to active att category
        $small_att_assignment[$category_att] += $weight * $qtty_rcvd;
        //shall work we are using functionality of weight callculation  from site has subcat
        if ($small_att_assignment[$category_att] > 0) {
        }
        //  echo "Weight: ".$small_att_assignment[$category_att]." for ATT: ".$category_att;
    }
    return $small_att_assignment;
}
示例#2
0
function construct_table_draw_table($sql_load)
{
    //here we get all parameters needed to set a size of manifests
    $PARAMETER = "true";
    //just something
    get_size_of_manifest($sql_load);
    //yes here only once. Lets change it
    //ok no global db cause before connect local db glob
    connect_dbi();
    //here this query should be prepered and keep as one global passed to functons. Reference add to db needs to read first counter
    //* $sql="SELECT * from sub_cat ORDER BY id_c DESC";
    $sql = $sql_load;
    $NUM_DRAW = 0;
    echo '<table data-filter="true">';
    $result = query_selecti($sql);
    $counter_grid = 0;
    echo "<tr>";
    while ($rek = mysqli_fetch_array($result, MYSQL_BOTH)) {
        //here shall be checked counter_grid and a Size_of_manifest if any discrepancies than communicate. Serious error. This means that what is visible on manifest
        //is different of that what was logicly received from manifest size function that is the main one needes for calculation
        $counter_grid++;
        $NUM_DRAW++;
        //This variable is local to draw function and is used to get ordered row in table
        $rcvd_qtty = qtty_rcvd_manifest_counter_no_delay(extract_session_manifest_reg(), $rek['id_c']);
        $sub_cat_item_name = $rek['Name_sub'];
        //this is name of subcategory.
        $placeholder_sub_cat = $sub_cat_item_name;
        $placeholder_sub_cat .= "...QTTY...";
        /*   
           if(($counter_grid%2==0))
           echo '<td>1'; 
           else if($counter_grid%2==1)
           echo '<td>2';
        * 
        */
        //was #manifest
        echo '<td>';
        echo '<form action="" id="manifest' . $NUM_DRAW . '" method="POST" data-ajax="false" data-prefetch="false">';
        //taken numeric value out
        //$rek['id_c']." ".
        echo $rek['Name_sub'] . " " . visible($rek['kind']) . " " . get_weight($rek['id_c']) . " kgs ";
        echo ' QTTY: ' . $rcvd_qtty . ' </p>';
        echo '<input type="hidden" name="num_sub_cat_un" value="' . $rek['id_c'] . '">';
        //this hidden variable is used to generate universal post sub_category number and send it
        echo '<input type="hidden" name="no-delay" value="' . $rcvd_qtty . '">';
        //temoporary to send qtty without delay
        echo '<input type="submit" value="+" name="plus' . $NUM_DRAW . '" data-role="button" data-transition="flip" data-inline="true">';
        echo '<input type="submit" value="-" name="minus' . $NUM_DRAW . '" data-role="button" data-inline="true">';
        echo '<input type="text" name="qtty' . $NUM_DRAW . '" value="" placeholder="' . $placeholder_sub_cat . '"  >';
        echo '</td>';
        if ($counter_grid % 3 == 0) {
            echo '<tr></tr>';
        }
        echo '</form>';
    }
    echo '</table>';
}