Ejemplo n.º 1
0
function validate_barcode($in)
{
    $in = swap_back($in);
    //chech trim here
    //$in=trim($in); maybe doubles?
    $connect = mysql_connect('localhost', 'root', 'krasnal') or die(mysql_error());
    mysql_select_db('dbs3');
    echo '</br> barcode in validate' . $in;
    $sql = "SELECT * FROM Barcode Where Barcode='{$in}'";
    echo "valid";
    $result = mysql_query($sql) or die("SELECT BAR Wrong");
    echo '<BR>va' . $in;
    global $V_BAR_EX;
    global $v_bar_exist;
    global $barcode_id;
    $rek = 0;
    //$in=  addslashes($in);
    if ($rek = mysql_fetch_array($result, 1)) {
        if ($rek['Barcode'] == $in) {
            echo 'taki barcode istnieje';
            $barcode_id = $rek["id_Barcode"];
            $v_bar_exist = 1;
            echo "as:" . $in;
            $V_BAR_EX = $rek["Barcode"];
            //exit();
            return 0;
            //return zero but why?
        } else {
            echo 'nierowne';
            //dangerous cause if nierowne than going to insert new neds an instans in sesjon messaging system.hm seems function fill fields see that valuse an get message but this tottally dont
            echo ' Porownaj Barcoe[]' . $rek['Barcode'] . ' in ' . $in;
            $v_bar_exist = 3;
            $V_BAR_EX = $in;
            //$rek['Barcode'];
            return $in;
        }
    } else {
        $v_bar_exist = 0;
        $V_BAR_EX = $in;
        echo 'nieistnieje';
        return $in;
    }
}
Ejemplo n.º 2
0
 while ($row = sqlsrv_fetch_array($result)) {
     echo "<td> " . $row[0] . "</td><td> " . $row[1] . "</td> <td>" . $row[2] . "</td><td> " . $row[3] . "</td><td> " . $row[5] . "</td><td> " . $row[6] . "</td><td> " . $row[7] . "</BR>" . $row[8] . "</td><td> " . $row[9] . "</BR>" . $row[10] . "</BR> " . $row[11] . "</td><td> " . $row[12] . "</td><td> " . $row[13] . "</td><td> " . $row[14] . "</BR> " . $row[15] . " </br>";
     $u_barcode = swap_back($row[2]);
     //this a stoc number in reality
     $ebaid = $row[16];
     $ebairef = $row[17];
     $tracking_number = $row[6];
     $user = 1;
     $date = $row[4];
     $item_id = $row[0];
     $itemid;
     $firstname = str_replace("'", "a", $row[7]);
     $lastname = str_replace("'", "a", $row[8]);
     //echo $itemid;
     echo $lastname;
     $unique = swap_back($_POST['un_barcode']);
     echo $unique;
     echo $firstname;
     $address1 = str_replace("'", "a", $row[9]);
     $address2 = str_replace("'", "a", $row[10]);
     $address3 = str_replace("'", "a", $row[11]);
     echo $address1;
     echo $address2;
     echo $address3;
     $city = $row[12];
     $state = $row[13];
     $postalcode = $row[14];
     $country = $row[15];
     $ebaysales = $row[18];
     $date_s = $row[4]->format('Y-m-d');
     $price = $row[19];
Ejemplo n.º 3
0
Archivo: six.php Proyecto: bruce28/vip
 }
 //while($rek_list=sqlsrv_fetch_array($result,SQLSRV_FETCH_BOTH))
 //    echo $rek_list[0];
 //$result_list=mysql_query($select_list)or die(mysql_error());
 // $num_list_row= sqlsrv_num_rows($result);
 // echo $num_list_row;
 $i = -1;
 $state = 0;
 // for($i=0;$i<$num_list_row;$i++)
 while ($rek_list = sqlsrv_fetch_array($result)) {
     //echo "</br>";
     //echo $i;
     $i++;
     // echo $rek_list[0];
     //echo "<form action='manifest_rep_print.php' method='POST'";
     $stock_nr = swap_back($rek_list[2]);
     $check_sql = "SELECT * FROM six_barcode WHERE stock_number='{$stock_nr}'";
     $result_my = mysql_query($check_sql);
     $rek_ch = mysql_fetch_array($result_my);
     if ($rek_ch[6] == $stock_nr) {
         $state = 12;
     }
     //  echo $rek_ch[6].$stock_nr;
     echo "<table><tr><td>" . ($i + 1) . ".</td><td> for: <b>";
     echo $rek_list[7] . " " . $rek_list[8];
     echo "</b></td><td>item: <b>";
     echo $rek_list[1];
     echo "</b>  ";
     if ($state == 1) {
         echo "Sold on Ebay";
     }
Ejemplo n.º 4
0
function validate_barcode($in)
{
    //function changes backslash to hash to allow to write/read to database in hash format
    $in = swap_back($in);
    //connect to database
    $connect = mysql_connect('localhost', 'root', 'krasnal') or die(mysql_error());
    //select database dbs3
    mysql_select_db('dbs3');
    echo '</br> barcode in validate' . $in;
    global $MESSG;
    //six barcode
    $sel_six = "SELECT * FROM six_barcode Where u_barcode={$in}";
    $res_six = mysql_query($sel_six);
    $rek_six = mysql_fetch_array($res_six);
    if ($res_six != 0) {
        $MESSG = 11;
    }
    /////////////////just section of messag 3 and 4
    $sql_12 = "SELECT * FROM waste_barcode                       \r\n     Where Barcode_waste='{$in}'";
    $res_12 = mysql_query($sql_12) or die(mysql_error());
    $res_12_fetch = mysql_fetch_array($res_12);
    if ($res_12_fetch["Barcode"] == $in) {
        $MESSG = 5;
        //changed by night
        $sql_121 = "SELECT * FROM waste_barcode \r\n                    Where Barcode_waste='{$in}' ";
        $res_121 = mysql_query($sql_121) or die(mysql_error());
        $res_121_fetch = mysql_fetch_array($res_121);
        if ($res_121_fetch["Barcode"] == $in) {
            $MESSG = 3;
        }
    } else {
        $MESSG = 4;
    }
    /////////////////
    //
    //
    /// HERE WE CHANGE To INNER JOIN if it also exist in test
    /////But the second instance is that item must have passa test otherwise is disposed
    //ADDING AND PASS
    $sql = "SELECT * FROM waste_barcode \r\n     Where Barcode_waste='{$in}' AND stock_out=1";
    echo "valid";
    $result = mysql_query($sql) or die("SELECT BAR Wrong");
    //check if bar exist in barcode in stock
    echo '<BR>va' . $in;
    //variable written globaly/ modified $V_BAR_EX stores barcode read from database. It exists. $v_bar_exist defines the state of existance in db of bc
    global $V_BAR_EX;
    global $v_bar_exist;
    //reads only once so a bug may be there if any double barcodes are already in database. Controled ower input validation
    if ($rek = mysql_fetch_array($result, 1)) {
        //comparing with hash format
        if ($rek["Barcode"] == $in) {
            echo 'taki barcode istnieje';
            //$MESSG=3;
            //inform system that barcode already exists
            $v_bar_exist = 0;
            echo "as:" . $in;
            //assignt existing barcode read from database to global variable $V_BAR_EX. Latar passed to the form add_stock.
            $V_BAR_EX = $rek["Barcode"];
            //exit();
            // return 0. Function does not return any barcode
            return 0;
        } else {
            //barcode exist in db, but something is wrong. doesnt fit hash code
            echo 'nierowne';
            echo ' Porownaj Barcoe[]' . $rek[Barcode] . ' in ' . $in;
            // return barcode in hash form and set global $v_bar_exist as 0. That means that barcode does not exist in db. $$$shall be 1.
            $v_bar_exist = 0;
            return $in;
        }
    } else {
        //No result given, that means no barcode given on input to that function in database. Return barcode in hash form. $$$$Input barcode assigned as V_BAR_EX. Return it
        $v_bar_exist = 1;
        $V_BAR_EX = $in;
        //$MESSG=4;
        echo 'nieistnieje';
        return $in;
    }
}
Ejemplo n.º 5
0
function validate_barcode($in)
{
    //function changes backslash to hash to allow to write/read to database in hash format
    echo "swaPb " . ($in = swap_back($in));
    global $V_BAR_EX;
    global $v_bar_exist;
    //connect to database
    $connect = mysql_connect('localhost', 'root', 'krasnal') or die(mysql_error());
    //select database dbs3
    mysql_select_db('dbs3');
    echo '</br> barcode in validate' . $in;
    global $MESSG;
    if ($in == -2) {
        $MESSG = 17;
        $v_bar_exist = 1;
        //$V_BAR_EX=1;
        return 0;
    }
    if (empty($in)) {
        echo 'bARCODE DOES NOT EXIST IN SERIALISATION SET';
        $MESSG = 16;
        //inform system that barcode already exists
        $v_bar_exist = 1;
        //$V_BAR_EX=1;
        echo "as:" . $in;
        //assignt existing barcode read from database to global variable $V_BAR_EX. Latar passed to the form add_stock.
        //$V_BAR_EX=$rek["Barcode"];
        return 0;
    }
    $sql = "SELECT * FROM Barcode Where Barcode='{$in}'";
    echo "valid";
    $result = mysql_query($sql) or die("SELECT BAR Wrong");
    echo '<BR>va' . $in;
    //variable written globaly/ modified $V_BAR_EX stores barcode read from database. It exists. $v_bar_exist defines the state of existance in db of bc
    //reads only once so a bug may be there if any double barcodes are already in database. Controled ower input validation
    if ($rek = mysql_fetch_array($result, 1)) {
        //comparing with hash format
        if ($rek["Barcode"] == $in) {
            echo 'taki barcode istnieje';
            $MESSG = 2;
            //inform system that barcode already exists
            $v_bar_exist = 1;
            echo "as:" . $in;
            //assignt existing barcode read from database to global variable $V_BAR_EX. Latar passed to the form add_stock.
            $V_BAR_EX = $rek["Barcode"];
            return 0;
        } else {
            //barcode exist in db, but something is wrong. doesnt fit hash code
            echo 'nierowne';
            echo ' Porownaj Barcoe[]' . $rek[Barcode] . ' in ' . $in;
            // return barcode in hash form and set global $v_bar_exist as 0. That means that barcode does not exist in db. $$$shall be 1.
            $v_bar_exist = 3;
            printf($rek['Barcode']);
            $V_BAR_EX = $rek['Barcode'];
            return $in;
        }
    } else {
        //No result given, that means no barcode given on input to that function in database. Return barcode in hash form. $$$$Input barcode assigned as V_BAR_EX. Return it
        $v_bar_exist = 0;
        $V_BAR_EX = $in;
        echo 'nieistnieje';
        $MESSG = 3;
        return $in;
    }
}
Ejemplo n.º 6
0
function insert_six_barcode_sells($itemid, $buyerid, $barcode, $conn)
{
    connect_db();
    // $row = sqlsrv_fetch_array($stmt);
    //echo "User login: "******"</br>";
    $result = sqlsrv_query($conn, "select distinct Items.ItemID, Items.Title, Inventory.SKU, Orders.BuyerID, \r\nSales.SaleDate, Orders.StatusID, Shipments.TrackingNumber, Addresses.FirstName, Addresses.LastName,\r\nAddresses.AddressLine1,Addresses.AddressLine2,Addresses.AddressLine3,Addresses.City,\r\nAddresses.State,Addresses.PostalCode, Addresses.Country, Sales.eCommerceID, Sales.TransactionID, Orders.ExternalOrderID, Sales.SalePrice\r\nfrom Orders \r\nleft join Shipments on Shipments.OrderID=Orders.OrderID \r\nleft join Sales on Sales.ShipmentID = Shipments.ShipmentID \r\nINNER JOIN SalesPurchases ON SalesPurchases.SaleID=Sales.SaleID \r\nINNER JOIN Purchases ON Purchases.PurchaseID = SalesPurchases.PurchaseID  \r\nInner Join Inventory ON Inventory.InventoryID = Purchases.InventoryID\r\nINNER Join Addresses ON Addresses.AddressID=Shipments.ShippingAddressID\r\nINNER JOIN Items ON Items.ItemID = Inventory.ItemID where Orders.StatusID='100000' AND Items.ItemID='{$itemid}' AND Orders.BuyerID='{$buyerid}'");
    //Sales.SaleDate > '2013-11-29' AND Shipments.TrackingNumber='' AND
    if (!$result) {
        die('Query failed.');
    }
    $i = 0;
    echo "<table border='2'>";
    while ($row = sqlsrv_fetch_array($result)) {
        //echo "<td> ".$row[0]."</td><td> ".$row[1]."</td> <td>".$row[2]."</td><td> ".$row[3]."</td><td> ".$row[5]."</td><td> ".$row[6]."</td><td> ".$row[7]."</BR>".$row[8]."</td><td> ".$row[9]."</BR>".$row[10]."</BR> ".$row[11]."</td><td> ".$row[12]."</td><td> ".$row[13]."</td><td> ".$row[14]."</BR> ".$row[15]." </br>";
        $u_barcode = swap_back($row[2]);
        //this a stoc number in reality
        $ebaid = $row[16];
        $ebairef = $row[17];
        $tracking_number = $row[6];
        $user = 1;
        $date = $row[4];
        $item_id = $row[0];
        $itemid;
        $firstname = str_replace("'", "a", $row[7]);
        $lastname = str_replace("'", "a", $row[8]);
        //echo $itemid;
        echo $lastname;
        $unique = swap_back($_POST['un_barcode']);
        echo $unique;
        echo $firstname;
        $address1 = str_replace("'", "a", $row[9]);
        $address2 = str_replace("'", "a", $row[10]);
        $address3 = str_replace("'", "a", $row[11]);
        echo $address1;
        echo $address2;
        echo $address3;
        $city = $row[12];
        $state = $row[13];
        $postalcode = $row[14];
        $country = $row[15];
        $ebaysales = $row[18];
        $date_s = $row[4]->format('Y-m-d');
        $price = $row[19];
        //$date_s=$row[4];
        echo $date_s;
        $id_barcode = get_barcode_id($barcode);
        echo $id_Barcode;
        $FLAG_RDT_TO_GO = 0;
        global $BARCODE_COMM;
        if (empty($id_barcode)) {
            //empty barcode id. Means barcode does not exists in barcode table, Though does not exist
            $BARCODE_COMM = " Empty Barcode";
        } else {
            $FLAG_RDT_TO_GO = 1;
        }
        //checking ebay. Already sold
        //check if tested and passed test
        $test_result = check_barcode_test($id_barcode);
        if ($test_result == 1) {
            $FLAG_RDT_TO_GO = 1;
            echo "Tested it";
        } else {
            $FLAG_RDT_TO_GO = 0;
        }
        if ($FLAG_RDT_TO_GO == 1) {
            $result_ebay = check_barcode_ebay($barcode);
            if ($result_ebay == 1) {
                $FLAG_RDT_TO_GO = 1;
            } else {
                $FLAG_RDT_TO_GO = 0;
            }
        }
        //here we consider a case that needs current day to help tracking how many disposed that day
        $date_disposed = date("Y-m-d");
        //echo "</BR>ass ".$address1=explode(',',preg_replace('/^\[(.*)\]$/','$1',$address1));
        //here we take care of special characters conversion
        echo "first: " . $firstname;
        echo "last:" . $lastname;
        echo $lastname = str_replace(")", "", $lastname);
        //here is a problem (EMPA NW LTD)) No string compatibel
        echo $lastname = mysql_real_escape_string($lastname);
        $address1 = mysql_real_escape_string($address1);
        $address2 = mysql_real_escape_string($address2);
        $address3 = mysql_real_escape_string($address3);
        $city = mysql_real_escape_string($city);
        $state - mysql_real_escape_string($state);
        echo $insert = "INSERT INTO six_barcode(u_barcode, barcode_id_Barcode,ebayid, ebayref, tracking_num, parceler" . ",stock_number,date_ship,item_id,name,surname,address1,address2,address3,city,state,postalcode, country, ebaysales,price,date_disposed) VALUES('{$barcode}','{$id_barcode}','{$ebaid}','{$ebairef}','{$tracking_number}','{$id_user}','{$u_barcode}','{$date_s}','{$item_id}','{$firstname}','{$lastname}','{$address1}','{$address2}','{$address3}','{$city}','{$state}','{$postalcode}','{$country}','{$ebaysales}','{$price}','{$date_disposed}')";
        //echo $insert;
        if ($FLAG_RDT_TO_GO == 1) {
            $result = mysql_query($insert) or die(mysql_error());
        }
        echo $BARCODE_COMM;
        if ($result and $FLAG_RDT_TO_GO == 1) {
            return 1;
        } else {
            return 0;
        }
    }
}
Ejemplo n.º 7
0
function validate_barcode_strip($in)
{
    //function changes backslash to hash to allow to write/read to database in hash format
    $in = swap_back($in);
    global $DISMANTLE_FACTOR;
    //connect to database
    $connect = mysql_connect('localhost', 'root', 'krasnal') or die(mysql_error());
    //select database dbs3
    mysql_select_db('dbs3');
    // echo '</br> barcode in validate'.$in;
    $sql = "SELECT * FROM Barcode Where Barcode='{$in}'";
    //echo "INI".$in;
    //echo "valid";
    $result = mysql_query($sql) or die("SELECT BAR Wrong");
    //variable written globaly/ modified $V_BAR_EX stores barcode read from database. It exists. $v_bar_exist defines the state of existance in db of bc
    //reads only once so a bug may be there if any double barcodes are already in database. Controled ower input validation
    if ($rek = mysql_fetch_array($result, MYSQL_BOTH)) {
        //comparing with hash format
        if (strcmp($rek["Barcode"], $in)) {
            //  echo 'taki barcode istnieje';
            $MESSG = 2;
            //inform system that barcode already exists
            $v_bar_exist = 1;
            //    echo "as:".$in;
            //assignt existing barcode read from database to global variable $V_BAR_EX. Latar passed to the form add_stock.
            $rek["Barcode"];
            $DISMANTLE_FACTOR = 12;
            return -1;
        } else {
            //barcode exist in db, but something is wrong. doesnt fit hash code
            //   echo 'nierowne';
            //  echo ' Porownaj Barcoe[]'.$rek['Barcode'].' in '.$in;
            // return barcode in hash form and set global $v_bar_exist as 0. That means that barcode does not exist in db. $$$shall be 1.
            $v_bar_exist = 3;
            // printf($rek['Barcode']);
            $V_BAR_EX = $rek['Barcode'];
            $DISMANTLE_FACTOR = 12;
            return -1;
        }
    } else {
        $DISMANTLE_FACTOR = 12;
        return 0;
    }
}