Example #1
0
function checksuspended()
{
    testremote();
    $db_a = tDataConnect();
    $m_conn = mDataConnect();
    $query_local = "select * from suspendedtoday";
    $query_remote = "select * from " . trim($_SESSION["mServer"]) . "." . trim($_SESSION["mDatabase"]) . ".dbo.suspendedtoday";
    $query = "select * from suspendedlist";
    if ($_SESSION["standalone"] == 1) {
        if ($_SESSION["remoteDBMS"] == "mssql") {
            $result = mssql_query($query_local, $db_a);
        } else {
            $result = mysql_query($query, $db_a);
        }
    } else {
        if ($_SESSION["remoteDBMS"] == "mssql") {
            $result = sql_query($query_remote, $db_a);
        } else {
            $result = mysql_query($query, $m_conn);
        }
    }
    $num_rows = sql_fetch_array($result);
    if ($num_rows == 0) {
        return 0;
    } else {
        return 1;
    }
    sql_close($db_a);
}
Example #2
0
function checksuspended()
{
    testremote();
    $db_a = tDataConnect();
    $m_conn = mDataConnect();
    $query_local = "select * from suspendedtoday";
    $query_remote = "select * from suspendedtoday";
    $query = "select * from suspendedlist";
    if ($_SESSION["standalone"] == 1) {
        if ($_SESSION["remoteDBMS"] == "mssql") {
            $result = mssql_query($query_local, $db_a);
        } else {
            $result = mysql_query($query, $db_a);
        }
    } else {
        if ($_SESSION["remoteDBMS"] == "mssql") {
            $result = sql_query($query_remote, $db_a);
        } else {
            $result = mysql_query($query_remote, $m_conn);
        }
    }
    # That's just not right, fix it later?
    #    $num_rows = sql_fetch_array($result);
    $num_rows = mysql_num_rows($result);
    if ($num_rows == 0) {
        return 0;
    } else {
        return 1;
    }
    sql_close($db_a);
}
Example #3
0
function couponcode($upc)
{
    $man_id = substr($upc, 3, 5);
    $fam = substr($upc, 8, 3);
    $val = substr($upc, -2);
    $db = pDataConnect();
    $query = "select * from couponcodes where code = '" . $val . "'";
    $result = sql_query($query, $db);
    $num_rows = sql_num_rows($result);
    if ($num_rows == 0) {
        boxMsg("coupon type unknown<br>please enter coupon<br>manually");
    } else {
        $row = sql_fetch_array($result);
        $value = $row["Value"];
        $qty = $row["Qty"];
        if ($fam == "992") {
            $value = truncate2($value);
            $_SESSION["couponupc"] = $upc;
            $_SESSION["couponamt"] = $value;
            maindisplay("coupondeptsearch.php");
        } else {
            sql_close($db);
            $fam = substr($fam, 0, 2);
            $query = "select " . "max(unitPrice) as total, " . "max(department) as department, " . "sum(ItemQtty) as qty, " . "sum(case when trans_status = 'C' then -1 else quantity end) as couponqtty " . "from localtemptrans where substring(upc, 4, 5) = '" . $man_id . "' " . "group by substring(upc, 4, 5)";
            $db = tDataConnect();
            $result = sql_query($query, $db);
            $num_rows = sql_num_rows($result);
            if ($num_rows > 0) {
                $row = sql_fetch_array($result);
                if ($row["couponqtty"] < 1) {
                    boxMsg("Coupon already applied<BR>for this item");
                } else {
                    $dept = $row["department"];
                    $act_qty = $row["qty"];
                    if ($qty <= $act_qty) {
                        if ($value == 0) {
                            $value = -1 * $row["total"];
                        }
                        $value = truncate2($value);
                        addcoupon($upc, $dept, $value);
                        lastpage();
                    } else {
                        boxMsg("coupon requires " . $qty . "items<BR>there are only " . $act_qty . " item(s)<BR>in this transaction");
                    }
                }
            } else {
                boxMsg("product not found<BR>in transaction");
            }
            // sql_close($db);
        }
    }
}
Example #4
0
function load()
{
    $query_member = "select * from custdata where CardNo = '205203'";
    $query_product = "select * from products where upc = '0000000000090'";
    $query_localtemptrans = "select * from localtemptrans";
    $bdat = pDataConnect();
    $result = sql_query($query_product, $bdat);
    $result_2 = sql_query($query_member, $bdat);
    sql_close($bdat);
    $trans = tDataConnect();
    $result_3 = sql_query($query_localtemptrans, $trans);
    sql_close($trans);
}
Example #5
0
function moveTempData()
{
    $connection = tDataConnect();
    //	sql_query("call movetempdata()", $connection);
    sql_query("update localtemptrans set trans_type = 'T' where trans_subtype = 'CP'", $connection);
    //	sql_query("update localtemptrans set trans_type = 'T', trans_subtype = 'IC' where upc in ('0000000008019', '0000000003031', '0000000001014')", $connection);
    sql_query("update localtemptrans set upc = 'DISCOUNT', description = upc, department = 0 where trans_status = 'S'", $connection);
    sql_query("insert into localtrans select * from localtemptrans", $connection);
    sql_query("insert into dtransactions select * from localtemptrans", $connection);
    sql_query("insert into activitylog select * from activitytemplog", $connection);
    sql_query("insert into alog select * from activitytemplog", $connection);
    sql_close($connection);
}
Example #6
0
function clubCard($intItemNum)
{
    $query = "select * from localtemptrans where trans_id = " . $intItemNum;
    $connection = tDataConnect();
    $result = sql_query($query, $connection);
    $row = sql_fetch_array($result);
    $num_rows = sql_num_rows($result);
    if ($num_rows > 0) {
        $strUPC = $row["upc"];
        $strDescription = $row["description"];
        $dblVolSpecial = $row["VolSpecial"];
        $dblquantity = -0.5 * $row["quantity"];
        $dblTotal = truncate2(-1 * 0.5 * $row["total"]);
        // invoked truncate2 rounding function to fix half-penny errors apbw 3/7/05
        $strCardNo = $_SESSION["memberID"];
        $dblDiscount = $row["discount"];
        $dblmemDiscount = $row["memDiscount"];
        $intDiscountable = $row["discountable"];
        $dblUnitPrice = $row["unitPrice"];
        $intScale = nullwrap($row["scale"]);
        if ($row["foodstamp"] != 0) {
            $intFoodStamp = 1;
        } else {
            $intFoodStamp = 0;
        }
        $intdiscounttype = nullwrap($row["discounttype"]);
        if ($row["voided"] == 20) {
            boxMsg("Discount already taken");
        } elseif ($row["trans_type"] == "T" or $row["trans_status"] == "D" or $row["trans_status"] == "V" or $row["trans_status"] == "C") {
            boxMsg("Item cannot be discounted");
        } elseif (strncasecmp($strDescription, "Club Card", 9) == 0) {
            //----- edited by abpw 2/15/05 -----
            boxMsg("Item cannot be discounted");
        } elseif ($_SESSION["tenderTotal"] < 0 and $intFoodStamp == 1 and -1 * $dblTotal > $_SESSION["fsEligible"]) {
            boxMsg("Item already paid for");
        } elseif ($_SESSION["tenderTotal"] < 0 and -1 * $dblTotal > $_SESSION["runningTotal"] - $_SESSION["taxTotal"]) {
            boxMsg("Item already paid for");
        } else {
            // --- added partial item desc to club card description - apbw 2/15/05 ---
            addItem($strUPC, "Club Card: " . substr($strDescription, 0, 19), "I", "", "J", $row["department"], $dblquantity, $dblUnitPrice, $dblTotal, 0.5 * $row["regPrice"], $intScale, $row["tax"], $intFoodStamp, $dblDiscount, $dblmemDiscount, $intDiscountable, $intdiscounttype, $dblquantity, $row["volDiscType"], $row["volume"], $dblVolSpecial, 0, 0, 0);
            $update = "update localtemptrans set voided = 20 where trans_id = " . $intItemNum;
            $connection = tDataConnect();
            sql_query($update, $connection);
            $_SESSION["TTLflag"] = 0;
            $_SESSION["TTLRequested"] = 0;
            lastpage();
        }
    }
}
Example #7
0
function setDrawerKickLater()
{
    // 	this more complex version can be modified to kick the drawer under whatever circumstances the FE Mgr sees fit
    //	it currently kicks the drawer *only* for cash in & out
    $db = tDataConnect();
    $query = "select * from localtemptrans where trans_subtype = 'CA' and total <> 0";
    $result = sql_query($query, $db);
    $num_rows = sql_num_rows($result);
    $row = sql_fetch_array($result);
    if ($num_rows != 0) {
        $_SESSION["kick"] = 1;
    } else {
        $_SESSION["kick"] = 0;
    }
}
Example #8
0
function loaddata()
{
    $query_local = "select * from localtemptrans";
    $query_product = "select * from products where upc='0000000000029'";
    $db_product = pDataConnect();
    $result_pro = sql_query($query_product, $db_product);
    $db_local = tDataConnect();
    $result_local = sql_query($query_local, $db_local);
    $num_rows_local = sql_num_rows($result_local);
    if ($num_rows_local > 0) {
        $row_local = sql_fetch_array($result_local);
        if ($row_local["card_no"] && strlen($row_local["card_no"]) > 0) {
            $_SESSION["memberID"] = $row_local["card_no"];
        }
    }
    if ($_SESSION["memberID"] == "0") {
        $query_member = "select * from custdata where CardNo = '205203'";
        $db_product = pDataConnect();
        sql_query($query_member, $db_product);
        $_SESSION["memType"] = 0;
        $_SESSION["percentDiscount"] = 0;
    } else {
        $query_member = "select * from custdata where CardNo = '" . $_SESSION["memberID"] . "'";
        $db_product = pDataConnect();
        $result = sql_query($query_member, $db_product);
        if (sql_num_rows($result) > 0) {
            $row = sql_fetch_array($result);
            $_SESSION["memMsg"] = $row["blueLine"];
            $_SESSION["memType"] = $row["memType"];
            $_SESSION["percentDiscount"] = $row["Discount"];
            if ($row["Type"] == "PC") {
                $_SESSION["isMember"] = 1;
            } else {
                $_SESSION["isMember"] = 0;
            }
            $_SESSION["isStaff"] = $row["staff"];
            $_SESSION["SSI"] = $row["SSI"];
            $_SESSION["discountcap"] = $row["MemDiscountLimit"];
            if ($_SESSION["SSI"] == 1) {
                $_SESSION["memMsg"] .= " #";
            }
        }
    }
    sql_close($db_local);
    sql_close($db_product);
}
Example #9
0
                var ieKey=e.keyCode;
                if (ieKey==13) {
                    document.selectform.submit();
                }
                else if (ieKey != 0 && ieKey != 38 && ieKey != 40) {
                    window.top.location = 'pos.php';
                };
            }
        </script>
    </head>
    <body onLoad='document.forms[0].elements[0].focus();'>
        <?php 
$query_local = "select register_no, emp_no, trans_no, sum(total) as total from suspendedtoday " . "group by register_no, emp_no, trans_no";
$query_remote = "select register_no, emp_no, trans_no, sum(total) as total from suspendedtoday " . "group by register_no, emp_no, trans_no";
$query = "select * from suspendedlist";
$db_a = tDataConnect();
$m_conn = mDataConnect();
if ($_SESSION["standalone"] == 1) {
    if ($_SESSION["remoteDBMS"] == "mssql") {
        $result = mssql_query($query_local, $db_a);
    } else {
        $result = mysql_query($query, $db_a);
    }
} else {
    if ($_SESSION["remoteDBMS"] == "mssql") {
        $result = mssql_query($query_remote, $db_a);
    } else {
        $result = mysql_query($query_remote, $m_conn);
    }
}
$num_rows = sql_num_rows($result);
Example #10
0
 }
 $_SESSION["memMsg"] = blueLine($row);
 sql_close($connID);
 if ($_SESSION["isMember"] == 1) {
     $_SESSION["yousaved"] = number_format($_SESSION["transDiscount"] + $_SESSION["discounttotal"] + $_SESSION["memSpecial"] + $_SESSION["memCouponTTL"], 2);
     $_SESSION["couldhavesaved"] = 0;
     $_SESSION["specials"] = number_format($_SESSION["discounttotal"] + $_SESSION["memSpecial"], 2);
 } else {
     $dblyousaved = number_format($_SESSION["memSpecial"], 2);
     $_SESSION["yousaved"] = $_SESSION["discounttotal"];
     $_SESSION["couldhavesaved"] = number_format($_SESSION["memSpecial"], 2);
     $_SESSION["specials"] = $_SESSION["discounttotal"];
 }
 //    call to transLog, the body of the receipt comes from the view 'receipt'
 $query = "select * from rp_receipt where register_no = " . $laneno . " and emp_no = " . $cashierNo . " and trans_no = " . $transno . " order by trans_id";
 $db = tDataConnect();
 $result = sql_query($query, $db);
 $num_rows = sql_num_rows($result);
 $receipt = $title . printReceiptHeader($dateTimeStamp, $ref);
 //    loop through the results to generate the items listing.
 for ($i = 0; $i < $num_rows; $i++) {
     $row = sql_fetch_array($result);
     $receipt .= $row["linetoprint"] . "\n";
 }
 // The Nitty Gritty:
 $member = "Member " . trim($_SESSION["memberID"]);
 $your_discount = $_SESSION["transDiscount"] + $_SESSION["memCouponTTL"];
 if ($_SESSION["transDiscount"] + $_SESSION["memCouponTTL"] + $_SESSION["specials"] > 0) {
     $receipt .= "\n" . centerString("------------------ YOUR SAVINGS -------------------") . "\n";
     if ($your_discount > 0) {
         $receipt .= "    DISCOUNTS: \$" . number_format($your_discount, 2) . "\n";
Example #11
0
function printReceipt($arg1)
{
    $receipt = "";
    setDrawerKick();
    if ($arg1 == "full" and $_SESSION["kick"] != 0) {
        // ---- apbw 03/29/05 Drawer Kick Patch
        writeLine(chr(27) . chr(112) . chr(0) . chr(48) . "0");
    }
    /* --------------------------------------------------------------
      turn off staff charge receipt printing if toggled - apbw 2/1/05 
      ---------------------------------------------------------------- */
    if ($_SESSION["TenderType"] == "MI" and ($_SESSION["receiptToggle"] == 0 or $_SESSION["SCReceipt"] == 0)) {
        $_SESSION["noreceipt"] = 1;
    }
    // apbw 2/15/05 SCR
    $dateTimeStamp = time();
    // moved by apbw 2/15/05 SCR
    // -- Our Reference number for the transaction.
    $ref = trim($_SESSION["CashierNo"]) . "-" . trim($_SESSION["laneno"]) . "-" . trim($_SESSION["transno"]);
    $_SESSION["noreceipt"] = ($_SESSION["receiptToggle"] + 1) % 2;
    if ($_SESSION["noreceipt"] != 1) {
        $receipt = printReceiptHeader($dateTimeStamp, $ref);
        //	call to transLog, the body of the receipt comes from the view 'receipt'
        $query = "SELECT * from receipt";
        $db = tDataConnect();
        $result = sql_query($query, $db);
        $num_rows = sql_num_rows($result);
        //	loop through the results to generate the items listing.
        for ($i = 0; $i < $num_rows; $i++) {
            $row = sql_fetch_array($result);
            $receipt .= $row[0] . "\n";
        }
        // The Nitty Gritty:
        if ($arg1 == "full") {
            $member = "Member " . trim($_SESSION["memberID"]);
            $your_discount = $_SESSION["transDiscount"] + $_SESSION["memCouponTTL"];
            if ($_SESSION["transDiscount"] + $_SESSION["memCouponTTL"] + $_SESSION["specials"] > 0) {
                $receipt .= "\n" . centerString("------------------ YOUR SAVINGS -------------------") . "\n";
                if ($your_discount > 0) {
                    $receipt .= "    DISCOUNTS: \$" . number_format($your_discount, 2) . "\n";
                }
                if ($_SESSION["specials"] > 0) {
                    $receipt .= "    SPECIALS: \$" . number_format($_SESSION["specials"], 2) . "\n";
                }
                $receipt .= centerString("---------------------------------------------------") . "\n";
            }
            $receipt .= "\n";
            // ccm-rle - will need to modify this to equal whatever we choose for non-member  I changed the code because we aren't currently using memberships
            if (trim($_SESSION["memberID"]) != 2) {
                //	mem# 99999 = NON-MEMBER
                //			$receipt .= centerString("Thank You - ".$member)."\n";
                $receipt .= centerString("Thank You!") . "\n";
            } else {
                $receipt .= centerString("Thank You!") . "\n";
            }
            if ($_SESSION["yousaved"] > 0) {
                $receipt .= centerString("You Saved \$" . number_format($_SESSION["yousaved"], 2)) . "\n";
            }
            if ($_SESSION["couldhavesaved"] > 0 && $_SESSION["yousaved"] > 0) {
                $receipt .= centerString("You could have saved an additional \$" . number_format($_SESSION["couldhavesaved"], 2)) . "\n";
            } elseif ($_SESSION["couldhavesaved"] > 0) {
                $receipt .= centerString("You could have saved \$" . number_format($_SESSION["couldhavesaved"], 2)) . "\n";
            }
            $receipt .= centerString($_SESSION["receiptFooter1"]) . "\n" . centerString($_SESSION["receiptFooter2"]) . "\n" . centerString($_SESSION["receiptFooter3"]) . "\n" . centerString($_SESSION["receiptFooter4"]) . "\n";
            // --- apbw 2/15/05 SCR ---
            if ($_SESSION["chargetender"] == 1) {
                $receipt = $receipt . printChargeFooterCust($dateTimeStamp, $ref);
            }
            if ($_SESSION["ccTender"] == 1) {
                $receipt = $receipt . printCCFooter($dateTimeStamp, $ref);
            }
            if ($_SESSION["promoMsg"] == 1) {
                promoMsg();
            }
            $_SESSION["headerprinted"] = 0;
        } else {
            $dashes = "\n" . centerString("----------------------------------------------") . "\n";
            if ($arg1 == "partial") {
                $receipt .= $dashes . centerString("*    P A R T I A L  T R A N S A C T I O N    *") . $dashes;
            } elseif ($arg1 == "cancelled") {
                $receipt .= $dashes . centerString("*  T R A N S A C T I O N  C A N C E L L E D  *") . $dashes;
            } elseif ($arg1 == "resume") {
                $receipt .= $dashes . centerString("*    T R A N S A C T I O N  R E S U M E D    *") . $dashes . centerString("A complete receipt will be printed\n") . centerString("at the end of the transaction");
            } elseif ($arg1 == "suspended") {
                $receipt .= $dashes . centerString("*  T R A N S A C T I O N  S U S P E N D E D  *") . $dashes . $option . centerString($ref);
            }
        }
    }
    /* --------------------------------------------------------------
      print store copy of charge slip regardless of receipt print setting - apbw 2/14/05 
      ---------------------------------------------------------------- */
    if ($_SESSION["chargetender"] == 1) {
        if ($_SESSION["noreceipt"] == 1) {
            $receipt = printChargeFooterStore($dateTimeStamp, $ref);
        } else {
            $receipt = $receipt . printChargeFooterStore($dateTimeStamp, $ref);
        }
    }
    //-------------------------------------------------------------------
    $receipt = $receipt . "\n\n\n\n\n\n\n";
    if ($_SESSION["noreceipt"] == 0) {
        writeLine($receipt . chr(27) . chr(105));
    }
    $receipt = "";
    $_SESSION["noreceipt"] = 1;
    // apbw 2/15/05 SCR - 9/25/09 ccm-rle commented out and a variable with noreceipt = 0 set at top to see if it turns of receipt printing while still enabling manual receipt printing
    $_SESSION["kick"] = 1;
    // apbw 05/03/05 KickFix
}
Example #12
0
function uploadtable($table)
{
    $output = "";
    //	openlog("is4c_connect", LOG_PID | LOG_PERROR, LOG_LOCAL0);
    if ($_SESSION["localPass"] == "") {
        $localpass = "";
    } else {
        $localpass = "******" . $_SESSION["localPass"];
    }
    if ($_SESSION["mPass"] == "") {
        $serverpass = "";
    } else {
        $serverpass = "******" . $_SESSION["mPass"];
    }
    $upload = "mysqldump -u " . $_SESSION['localUser'] . " " . $localpass . " -t " . $_SESSION['tDatabase'] . " " . $table . " | mysql -h " . $_SESSION['mServer'] . " -u " . $_SESSION["mUser"] . " " . $serverpass . " " . $_SESSION['mDatabase'] . " 2>&1";
    //	echo $upload;
    // ccm-rle 9-21-09 added below to create upload logfile
    // $newfile="connectlog.txt";
    // $file = fopen ($newfile, "a");
    // fwrite($file,$upload);
    // fclose($file);
    exec($upload, $aResult);
    $error = 0;
    $output = 0;
    foreach ($aResult as $errormsg) {
        if ($errormsg && strlen($errormsg) > 0) {
            $output = $output . "\n" . $errormsg;
            $error = 1;
        }
    }
    if ($error == 1) {
        syslog(LOG_WARNING, "uploadtable({$table}) failed; rc: errormsg: '{$output}'");
        return 0;
    } else {
        $t_conn = tDataConnect();
        mysql_query("TRUNCATE TABLE " . $table, $t_conn);
        return 1;
    }
}
Example #13
0
function voidupc($upc)
{
    $lastpageflag = 1;
    $deliflag = 0;
    if (strpos($upc, "*") && (strpos($upc, "**") || strpos($upc, "*") == 0 || strpos($upc, "*") == strlen($upc) - 1)) {
        $upc = "stop";
    } elseif (strpos($upc, "*")) {
        $voidupc = explode("*", $upc);
        if (!is_numeric($voidupc[0])) {
            $upc = "stop";
        } else {
            $quantity = $voidupc[0];
            $upc = $voidupc[1];
            $weight = 0;
        }
    } elseif (!is_numeric($upc) && !strpos($upc, "DP")) {
        $upc = "stop";
    } else {
        $quantity = 1;
        $weight = $_SESSION["weight"];
    }
    if (is_numeric($upc)) {
        $upc = substr("0000000000000" . $upc, -13);
        if (substr($upc, 0, 3) == "002" && substr($upc, -5) != "00000") {
            $scaleprice = substr($upc, 10, 4) / 100;
            $upc = substr($upc, 0, 8) . "0000";
            $deliflag = 1;
        } elseif (substr($upc, 0, 3) == "002" && substr($upc, -5) == "00000") {
            $scaleprice = $_SESSION["scaleprice"];
            $deliflag = 1;
        }
    }
    if ($upc == "stop") {
        inputUnknown();
    } else {
        $db = tDataConnect();
        if ($_SESSION["discounttype"] == 3) {
            $query = "select sum(quantity) as voidable, max(scale), as scale, max(volDiscType) as volDiscType " . "from localtemptrans where upc = '" . $upc . "' and discounttype = 3 and unitPrice = " . $_SESSION["caseprice"] . " group by upc";
        } elseif ($deliflag == 0) {
            $query = "select sum(ItemQtty) as voidable, sum(quantity) as vquantity, max(scale) as scale, " . "max(volDiscType) as volDiscType from localtemptrans where upc = '" . $upc . "' and discounttype <> 3 group by upc, discounttype";
        } else {
            $query = "select sum(ItemQtty) as voidable, sum(quantity) as vquantity, max(scale) as scale, " . "max(volDiscType) as volDiscType from localtemptrans where upc = '" . $upc . "' and unitPrice = " . $scaleprice . " and discounttype <> 3 group by upc";
        }
        if ($_SESSION["ddNotify"] == 1) {
            $query = "select sum(ItemQtty) as voidable, sum(quantity) as vquantity, max(scale) as scale, " . "max(volDiscType) as volDiscType from localtemptrans where upc = '" . $upc . "' and discounttype <> 3 and discountable = " . $_SESSION["discountable"] . " group by upc, discounttype, discountable";
        }
        $result = sql_query($query, $db);
        $num_rows = sql_num_rows($result);
        if ($num_rows == 0) {
            boxMsg("Item not found");
        } else {
            $row = sql_fetch_array($result);
            if ($row["scale"] == 1 && $weight > 0) {
                $quantity = $weight - $_SESSION["tare"];
                $_SESSION["tare"] = 0;
            }
            $volDiscType = $row["volDiscType"];
            $voidable = nullwrap($row["voidable"]);
            $VolSpecial = 0;
            $volume = 0;
            $scale = nullwrap($row["scale"]);
            if ($voidable == 0 && $quantity == 1) {
                boxMsg("Items already voided");
            } elseif ($voidable == 0 && $quantity > 1) {
                boxMsg("Items already voided");
            } elseif ($scale == 1 && $quantity < 0) {
                boxMsg("tare weight cannot be greater than item weight");
            } elseif ($voidable < $quantity && $row["scale"] == 1) {
                $message = "Void request exceeds<br />weight of item rung in<p><b>You can void up to " . $row["voidable"] . " lb</b></p>";
                boxMsg($message);
            } elseif ($voidable < $quantity) {
                $message = "Void request exceeds<br />number of items rung in<p><b>You can void up to " . $row["voidable"] . "</b></p>";
                boxMsg($message);
            } else {
                unset($result);
                //--------------------------------Void Item----------------------------
                if ($_SESSION["discounttype"] == 3) {
                    $query_upc = "select * from localtemptrans where upc = '" . $upc . "' and discounttype = 3 and unitPrice = " . $_SESSION["caseprice"];
                } elseif ($deliflag == 0) {
                    $query_upc = "select * from localtemptrans where upc = '" . $upc . "' and discounttype <> 3";
                } else {
                    $query_upc = "select * from localtemptrans where upc = '" . $upc . "' and unitPrice = " . $scaleprice;
                }
                $_SESSION["discounttype"] = 9;
                $result = sql_query($query_upc, $db);
                $row = sql_fetch_array($result);
                $ItemQtty = $row["ItemQtty"];
                $foodstamp = nullwrap($row["foodstamp"]);
                $discounttype = nullwrap($row["discounttype"]);
                $mixMatch = nullwrap($row["mixMatch"]);
                if ($_SESSION["isMember"] != 1 && $row["discounttype"] == 2 || $_SESSION["isStaff"] == 0 && $row["discounttype"] == 4) {
                    $unitPrice = $row["regPrice"];
                } elseif (($_SESSION["isMember"] == 1 && $row["discounttype"] == 2 || $_SESSION["isStaff"] != 0 && $row["discounttype"] == 4) && $row["unitPrice"] == $row["regPrice"]) {
                    $db_p = pDataConnect();
                    $query_p = "select * from products where upc = '" . $upc . "'";
                    $result_p = sql_query($query_p, $db_p);
                    $row_p = sql_fetch_array($result_p);
                    $unitPrice = $row_p["special_price"];
                    sql_close($db_p);
                } else {
                    $unitPrice = $row["unitPrice"];
                }
                $discount = -1 * $row["discount"];
                $memDiscount = -1 * $row["memDiscount"];
                $discountable = $row["discountable"];
                $cost = 0;
                if ($_SESSION["ddNotify"] == 1) {
                    $discountable = $_SESSION["discountable"];
                }
                //----------------------mix match---------------------
                if ($volDiscType >= 1) {
                    $db_mm = tDataConnect();
                    $query_mm = "select sum(ItemQtty) as mmqtty from localtemptrans where mixMatch = " . $mixMatch;
                    $result_mm = sql_query($query_mm, $db_mm);
                    $row_mm = sql_fetch_array($result_mm);
                    $mmqtty = nullwrap($row_mm["mmqtty"]);
                    sql_close($db_mm);
                    $db_pq = pDataConnect();
                    $query_pq = "select * from products where upc = '" . $upc . "'";
                    $result_pq = sql_query($query_pq, $db_pq);
                    $row_pq = sql_fetch_array($result_pq);
                    if ($volDiscType == 1) {
                        $unitPrice = truncate2($row_pq["groupprice"] / $row_pq["quantity"]);
                    } elseif ($discounttype == 1) {
                        $unitPrice = $row_pq["special_price"];
                        $VolSpecial = nullwrap($row_pq["specialgroupprice"]);
                    } else {
                        $unitPrice = $row_pq["normal_price"];
                        $VolSpecial = nullwrap($row_pq["groupprice"]);
                    }
                    if ($row_pq["advertised"] == 0) {
                        $volume = nullwrap($row_pq["quantity"]);
                    } else {
                        $volume = nullwrap($row_pq["specialquantity"]);
                    }
                    sql_close($db_pq);
                    $volmulti = (int) ($quantity / $volume);
                    $vmremainder = $quantity % $volume;
                    if ($mixMatch == 0) {
                        $mm = (int) ($voidable / $volume);
                        $mmremainder = $voidable % $volume;
                    } else {
                        $mm = (int) ($mmqtty / $volume);
                        $mmremainder = $mmqtty % $volume;
                    }
                    if ($volmulti > 0) {
                        addItem($upc, $row["description"], $row["trans_type"], $row["trans_subtype"], "V", $row["department"], $cost, -1 * $volmulti, $VolSpecial, -1 * $volmulti * $VolSpecial, $VolSpecial, 0, $row["tax"], $foodstamp, $discount, $memDiscount, $discountable, $discounttype, -1 * $volmulti * $volume, $volDiscType, $volume, $VolSpecial, $mixMatch, -1 * $volume * $volmulti, 1, 0, '');
                        $quantity = $vmremainder;
                    }
                    if ($vmremainder > $mmremainder) {
                        $voladj = $row["VolSpecial"] - $unitPrice * ($volume - 1);
                        addItem($upc, $row["description"], $row["trans_type"], $row["trans_subtype"], "V", $row["department"], $cost, -1, $voladj, -1 * $voladj, $voladj, 0, $row["tax"], $foodstamp, $discount, $memDiscount, $discountable, $discounttype, -1, $volDiscType, $volume, $VolSpecial, $mixMatch, -1 * $volume, 1, 0, '');
                        $quantity = $quantity - 1;
                    }
                }
                $quantity = -1 * $quantity;
                $total = truncate2($quantity * $unitPrice);
                $CardNo = $_SESSION["memberID"];
                $discounttype = nullwrap($row["discounttype"]);
                if ($discounttype == 3) {
                    $quantity = -1 * $ItemQtty;
                }
                if ($_SESSION["tenderTotal"] < 0 && $foodstamp == 1 && -1 * $total > $_SESSION["fsEligible"]) {
                    boxMsg("Item already paid for");
                    $lastpageflag = 0;
                } elseif ($_SESSION["tenderTotal"] < 0 && -1 * $total > $_SESSION["runningTotal"] - $_SESSION["taxTotal"]) {
                    boxMsg("Item already paid for");
                    $lastpageflag = 0;
                } elseif ($quantity != 0) {
                    addItem($upc, $row["description"], $row["trans_type"], $row["trans_subtype"], "V", $row["department"], $cost, $quantity, $unitPrice, $total, $row["regPrice"], $scale, $row["tax"], $foodstamp, $discount, $memDiscount, $discountable, $discounttype, $quantity, $volDiscType, $volume, $VolSpecial, $mixMatch, 0, 1, 0, '');
                    if ($row["trans_type"] != "T") {
                        $_SESSION["ttlflag"] = 0;
                        $_SESSION["ttlrequested"] = 0;
                        $_SESSION["discounttype"] = 0;
                    }
                }
                if ($lastpageflag == 1) {
                    lastpage();
                } else {
                    $lastpageflag = 1;
                }
            }
        }
    }
}
Example #14
0
function datareload()
{
    $query_mem = "select * from custdata where CardNo='205203'";
    $query_prod = "select * from products where upc='0000000000090'";
    $query_temp = "select * from localtemptrans";
    $db_bdat = pDataConnect();
    sql_query($query_prod, $db_bdat);
    sql_query($query_mem, $db_bdat);
    sql_close($db_bdat);
    $db_trans = tDataConnect();
    sql_query($query_temp, $db_trans);
    sql_close($db_trans);
    $_SESSION["datetimestamp"] = strftime("%Y-%m-%m/%d/%y %T", time());
}
Example #15
0
function drawitems($top_item, $rows, $highlight)
{
    printheaderb();
    $query = "select count(*) as count from localtemptrans";
    $db = tDataConnect();
    $result = sql_query($query, $db);
    $row = sql_fetch_array($result);
    $rowCount = $row["count"];
    sql_close($db);
    if ($rowCount == 0) {
        if ($_SESSION["training"] != 1) {
            plainmsg($_SESSION["welcomeMsg1"] . "<br />" . $_SESSION["welcomeMsg2"] . "<br />" . $_SESSION["welcomeMsg3"]);
        } else {
            plainmsg($_SESSION["trainingMsg1"] . "<br />" . $_SESSION["trainingMsg2"]);
        }
    } else {
        $query_range = "select * from screendisplay where trans_id >= " . $top_item . " and trans_id <= " . ($top_item + $rows) . " order by trans_id";
        $db_range = tDataConnect();
        $result_range = sql_query($query_range, $db_range);
        $num_rows = sql_num_rows($result_range);
        echo "<tr><td width='600' colspan='3'>&nbsp;</td></tr>\n";
        for ($i = 0; $i < $num_rows; $i++) {
            $row = sql_fetch_array($result_range);
            $trans_id = $row["trans_id"];
            $description = $row["description"];
            $total = $row["total"];
            $comment = $row["comment"];
            $tf = $row["status"];
            $color = $row["lineColor"];
            if ($trans_id == $highlight) {
                if ($color == "") {
                    printitemhilite($description, $comment, $total, $tf);
                } else {
                    printitemcolorhilite($color, $description, $comment, $total, $tf);
                }
            } else {
                if ($color == "") {
                    printitem($description, $comment, $total, $tf);
                } else {
                    printitemcolor($color, $description, $comment, $total, $tf);
                }
            }
        }
        sql_close($db_range);
    }
}
Example #16
0
/**
 * Return a thingie based on $paramie
 * @param boolean $activity 
 * @return integer|babyclass
 */
function addactivity($activity)
{
    $timeNow = time();
    if ($_SESSION["CashierNo"] > 0 && $_SESSION["CashierNo"] < 256) {
        $intcashier = $_SESSION["CashierNo"];
    } else {
        $intcashier = 0;
    }
    if ($_SESSION["DBMS"] == "mssql") {
        $strqtime = "select max(datetime) as maxDateTime, getdate() as rightNow from activitytemplog";
    } else {
        $strqtime = "select max(datetime) as maxDateTime, now() as rightNow from activitytemplog";
    }
    $db = tDataConnect();
    $result = sql_query($strqtime, $db);
    $row = sql_fetch_array($result);
    if (!$row || !$row[0]) {
        $interval = 0;
    } else {
        $interval = strtotime($row["rightNow"]) - strtotime($row["maxDateTime"]);
    }
    $_SESSION["datetimestamp"] = strftime("%Y-%m-%d %H:%M:%S", $timeNow);
    $strq = "insert into activitytemplog values (" . "'" . nullwrap($_SESSION["datetimestamp"]) . "', " . nullwrap($_SESSION["laneno"]) . ", " . nullwrap($intcashier) . ", " . nullwrap($_SESSION["transno"]) . ", " . nullwrap($activity) . ", " . nullwrap($interval) . ")";
    // echo $strq;
    $result = sql_query($strq, $db);
    // $_SESSION["datetimestamp"] = time();
    sql_close($db);
}
Example #17
0
function insertltt($register_no, $emp_no, $trans_no)
{
    $inserted = 0;
    $conn = tDataConnect();
    mysql_query("truncate table localtemptrans", $conn);
    $query = "insert into localtemptrans " . "(datetime, register_no, emp_no, trans_no, upc, description, trans_type, trans_subtype, " . "trans_status, department, quantity, scale, unitPrice, total, regPrice, tax, foodstamp, " . "discount, memDiscount, discountable, discounttype, voided, percentDiscount, ItemQtty, " . "volDiscType, volume, VolSpecial, mixMatch, matched, card_no, memType, staff) " . "select " . "datetime, register_no, emp_no, trans_no, upc, description, trans_type, trans_subtype, " . "trans_status, department, quantity, scale, unitPrice, total, regPrice, tax, foodstamp, " . "discount, memDiscount, discountable, discounttype, voided, percentDiscount, ItemQtty, " . "volDiscType, volume, VolSpecial, mixMatch, matched, card_no, memType, staff " . "from is4c_log.suspended where register_no = " . $register_no . " and emp_no = " . $emp_no . " and trans_no = " . $trans_no;
    // ccm-rle 10-1-2009  This is trying to capture the code from above to see if it is being ran
    //        echo $query;
    //        $myFile = "querytestlog.txt";
    //        $fh = fopen($myFile, 'w');
    //        fwrite($fh, $query);
    //        fclose($fh);
    if (mysql_query($query, $conn)) {
        if (mysql_query("truncate table is4c_log.suspended", $conn)) {
            $inserted = 1;
        }
    }
    return $inserted;
}
Example #18
0
function uploadtable($table)
{
    $output = "";
    if ($_SESSION["localPass"] == "") {
        $localpass = "";
    } else {
        $localpass = "******" . $_SESSION["localPass"];
    }
    if ($_SESSION["mPass"] == "") {
        $serverpass = "";
    } else {
        $serverpass = "******" . $_SESSION["mPass"];
    }
    $upload = "mysqldump -u " . $_SESSION['localUser'] . " " . $localpass . " -t " . $_SESSION['tDatabase'] . " " . $table . " | mysql -h " . $_SESSION['mServer'] . " -u " . $_SESSION["mUser"] . " " . $serverpass . " " . $_SESSION['mDatabase'] . " 2>&1";
    exec($upload, $aResult);
    $error = 0;
    $output = 0;
    foreach ($aResult as $errormsg) {
        if ($errormsg && strlen($errormsg) > 0) {
            $output = $output . "\n" . $errormsg;
            $error = 1;
        }
    }
    if ($error == 1) {
        syslog(LOG_WARNING, "uploadtable({$table}) failed; rc: errormsg: '{$output}'");
        return 0;
    } else {
        $t_conn = tDataConnect();
        mysql_query("TRUNCATE TABLE " . $table, $t_conn);
        return 1;
    }
}
Example #19
0
function wmdiscount()
{
    $sconn = mDataConnect();
    $conn2 = tDataConnect();
    $volQ = "SELECT * FROM is4c_op.volunteerDiscounts WHERE CardNo = " . $_SESSION["memberID"];
    $volR = sql_query($volQ, $sconn);
    $row = sql_fetch_array($volR);
    $total = $row["total"];
    if ($row["staff"] == 3) {
        if ($_SESSION["discountableTotal"] > $total) {
            $a = $total * 0.15;
            // apply 15% disocunt
            $b = ($_SESSION["discountableTotal"] - $total) * 0.02;
            // apply 2% discount
            $c = $a + $b;
            $aggdisc = number_format($c / $_SESSION["discountableTotal"] * 100, 2);
            // aggregate discount
            $_SESSION["transDiscount"] = $c;
            $_SESSION["percentDiscount"] = $aggdisc;
        } elseif ($_SESSION["discountableTotal"] <= $total) {
            $_SESSION["percentDiscount"] = 15;
            $_SESSION["transDiscount"] = $_SESSION["discountableTotal"] * 0.15;
        }
    } elseif ($row["staff"] == 6) {
        if ($_SESSION["discountableTotal"] > $total) {
            $a = $total * 0.05;
            // apply 15% disocunt
            $aggdisc = number_format($a / $_SESSION["discountableTotal"] * 100, 2);
            // aggregate discount
            $_SESSION["transDiscount"] = $a;
            $_SESSION["percentDiscount"] = $aggdisc;
        } elseif ($_SESSION["discountableTotal"] <= $total) {
            $_SESSION["percentDiscount"] = 5;
            $_SESSION["transDiscount"] = $_SESSION["discountableTotal"] * 0.05;
        }
    }
    sql_query("update localtemptrans set percentDiscount = " . $_SESSION["percentDiscount"], $conn2);
    if ($_SESSION["discountableTotal"] < $total) {
        $a = number_format($_SESSION["discountableTotal"] / 20, 2);
        $arr = explode(".", $a);
        if ($arr[1] >= 75 && $arr[1] != 00) {
            $dec = 75;
        } elseif ($arr[1] >= 50 && $arr[1] < 75) {
            $dec = 50;
        } elseif ($arr[1] >= 25 && $arr[1] < 50) {
            $dec = 25;
        } elseif ($arr[1] >= 00 && $arr[1] < 25) {
            $dec = 00;
        }
        $_SESSION["volunteerDiscount"] = $arr[0] . "." . $dec;
    } else {
        $_SESSION["volunteerDiscount"] = $total / 20;
    }
}
Example #20
0
function couponTotal()
{
    $db = tDataConnect();
    $query = "select sum(total) as couponTotal from localtemptrans where upc = '0000000008005'";
    $result = sql_query($query, $db);
    $num_rows = sql_num_rows($result);
    if ($num_rows > 0) {
        $row = sql_fetch_array($result);
        $couponTotal = nullwrap($row["couponTotal"]);
    } else {
        $couponTotal = 0;
    }
    sql_close($db);
}
Example #21
0
function insertltt($register_no, $emp_no, $trans_no)
{
    $inserted = 0;
    $conn = tDataConnect();
    mysql_query("truncate table localtemptrans", $conn);
    $query = "insert into localtemptrans " . "(datetime, register_no, emp_no, trans_no, upc, description, trans_type, trans_subtype, " . "trans_status, department, quantity, scale, unitPrice, total, regPrice, tax, foodstamp, " . "discount, memDiscount, discountable, discounttype, voided, percentDiscount, ItemQtty, " . "volDiscType, volume, VolSpecial, mixMatch, matched, card_no, memType, staff) " . "select " . "datetime, register_no, emp_no, trans_no, upc, description, trans_type, trans_subtype, " . "trans_status, department, quantity, scale, unitPrice, total, regPrice, tax, foodstamp, " . "discount, memDiscount, discountable, discounttype, voided, percentDiscount, ItemQtty, " . "volDiscType, volume, VolSpecial, mixMatch, matched, card_no, memType, staff " . "from translog.suspended where register_no = " . $register_no . " and emp_no = " . $emp_no . " and trans_no = " . $trans_no;
    if (mysql_query($query, $conn)) {
        if (mysql_query("truncate table is4c_log.suspended", $conn)) {
            $inserted = 1;
        }
    }
    return $inserted;
}