Beispiel #1
0
function dbi_write_att($site_id, $att, $stream_id)
{
    $date = date("Y-m-d");
    $user = convert_driver_id(get_driver_session());
    if (isset($_SESSION['MOD_DATE'])) {
        $date = get_mod_date_session();
        //only id even once session mod date set we are gona use it after using would be goood to unset it
    }
    echo $sql = "INSERT INTO delivery(Trans_Category_Category_id,Site_site_id,date,picker1,trans_ref_num,closed,att_num) VALUES('{$stream_id}','{$site_id}','{$date}',{$user},'1','0','{$att}')";
    $result = query_selecti($sql);
    //var_dump($result);
    mysqli_affected_rows($result);
}
Beispiel #2
0
function initialize_manifest_reg()
{
    //can be only generated if there is site_ung_number first
    global $FLAG_MANIFEST_UNQ_NUMBER;
    //generate once if not generate
    echo "initialising manifest_reg";
    //first extract from session
    if (isset($_SESSION['MANIFEST_UNQ_NUMBER'])) {
        echo "Getting number form seesion";
        $manifest_unq_number = $_SESSION['MANIFEST_UNQ_NUMBER'];
    } else {
        echo "generating fresh num";
        $manifest_unq_number = generate_manifest_unq_number();
        //here each time is different. we need to check if already is not setr the same
    }
    //go set the session
    //if not set yet, good chance to initialized it once
    if (check_manifest_unq_num_set($manifest_unq_number) == 1) {
        echo "Set man_unq_num";
    } else {
        //if not yet generated
        $_SESSION['MANIFEST_UNQ_NUMBER'] = $manifest_unq_number;
    }
    $start_dbs = 1;
    $date_today = date("Y-m-d");
    //state of manifest
    $state = MANIFEST_INITIALISED;
    $driver_num = get_driver_session();
    //here for driver num
    //didnt work so we go a new solution
    $driver_num = convert_driver_id(get_driver_session());
    $sql = "INSERT INTO manifest_reg(manifest_unq_num,date_manifest,driver_num,hash_serial,group1,start_dbs,closed) VALUES('{$manifest_unq_number}','{$date_today}','{$driver_num}','0','95','{$start_dbs}',{$state})";
    //here we query prepared statement
    if (check_manifest_state($manifest_unq_number) == MANIFEST_INITIALISED) {
        //run the query if and only if MANIFEST IS ALREADY INITIALISED. HERE OR SOMEWHERE ELSE checking last ten device local manifest if running or other states
        //but first implement flow
        //CORRECTION: this initialisation will be done only if already initialized. incorrect
    } else {
        if (check_manifest_state($manifest_unq_num) == MANIFEST_NOT_FINISHED) {
            $result = query_selecti($sql);
            $FLAG_MANIFEST_UNQ_NUMBER = $manifest_unq_num;
            //asignment done only once when new seesion of second api starts. generation of manifest unq id is its part
            //if done set a flag manifest_ung num ; load unload to session, header..etc
            $manifest_unq_num = $FLAG_MANIFEST_UNQ_NUMBER;
        }
    }
    if ($result) {
        echo $manifest_unq_number;
        return $manifest_unq_number;
        //or last inserted id
    }
}