Пример #1
0
function cleartemptrans()
{
    $db = tDataConnect();
    if ($_SESSION["msg"] == 2) {
        $_SESSION["msg"] = 99;
        sql_query("update localtemptrans set trans_status = 'X'", $db);
    }
    if ($_SESSION["DBMS"] == "mssql") {
        sql_query("exec clearTempTables", $db);
    } else {
        moveTempData();
        truncateTempTables();
    }
    sql_close($db);
    testremote();
    loadglobalvalues();
    $_SESSION["transno"] = $_SESSION["transno"] + 1;
    setglobalvalue("TransNo", $_SESSION["transno"]);
    if ($_SESSION["TaxExempt"] != 0) {
        $_SESSION["TaxExempt"] = 0;
        setglobalvalue("TaxExempt", 0);
    }
    memberReset();
    transReset();
    printReset();
    getsubtotals();
    delete_file(remote_oux());
    delete_file(local_inx());
    return 1;
}
Пример #2
0
if (!function_exists("pDataConnect")) {
    include "connect.php";
}
if (!function_exists("tender")) {
    include "prehkeys.php";
}
if (!function_exists("maindisplay")) {
    include "maindisplay.php";
}
if (!function_exists("boxMsgscreen")) {
    include "clientscripts.php";
}
include "ccLib.php";
printheaderb();
$user = $_SESSION["CashierNo"];
$remote_oux = remote_oux();
$value = '=';
$track = $_SESSION["strRemembered"];
$equal = strpos($track, $value);
$equalFour = $equal - 4;
$four = substr($track, $equalFour, 4);
//check to see if the file exists
if (file_exists($remote_oux)) {
    $today = date('mdYHis');
    $emp = $_SESSION['CashierNo'];
    $trans = $_SESSION['transno'];
    $stamp = $today . "_" . $emp . "_" . $trans;
    $local = 'OUX/' . $stamp;
    copy_file($remote_oux, $local);
    $amountIn = $_SESSION["ccAmt"];
    $_SESSION["ccAmt"] = 0;
Пример #3
0
function ccXML()
{
    $inxUploaded = 0;
    //$connect = pDataConnect(); // no longer used? --atf 5/24/07
    // cache filenames
    $remote_inx = remote_inx();
    $remote_oux = remote_oux();
    $local_inx = local_inx();
    // check if PCCharge has both #.inx and #.pro (for any #, not just CashierNo) -- stuck queue, alert FEC --atf 5/24/07
    // also note a new return value for ccXML(): -1 means stuck-queue, 0 means some other file copy error
    $testcmd = "for %f in (\\" . $_SESSION["ccServer"] . "\\" . $_SESSION["ccShare"] . "\\temp\\*.pro) do @if exist \"\\" . $_SESSION["ccServer"] . "\\" . $_SESSION["ccShare"] . "\\temp\\%%~nf.inx\" echo 1";
    $teststuck = shell_exec($testcmd);
    if ($teststuck != "") {
        return -1;
    }
    // end stuck-queue-check
    $input = $_SESSION["ccSwipe"];
    $transno = ccTicket();
    $amountIn = $_SESSION["ccAmt"];
    $aCCInput = explode("=", $input);
    // ***** CvR 09/22/05 test for forced transactions ***** END
    // $input comes from SESSION[ccSwipe] which has track2 data: these characters could not be there, and all digits up to '=' are the card num --atf 5/24/07
    $CC = $aCCInput[0];
    /*
    if(substr($input,0,1) == 'F' || substr($input,0,1) == 'f'){
       $CC = substr($aCCInput[0], -17);
    }else{
       $CC = substr($aCCInput[0], -16);
    }
    */
    $expYear = substr($aCCInput[1], 0, 2);
    $expMonth = substr($aCCInput[1], 2, 2);
    //-----added 03/31/05 CvR
    if ($amountIn > 0) {
        $command = "1";
        //action code for transaction sale = 1
    } else {
        $command = "2";
        //action code for return = 2
    }
    //-----
    // in the PCCharge DevKit manual, 'MANUAL_FLAG' is defined as '0=manual, 1=swiped'  --atf 5/18/07
    $manual = 1;
    if ($_SESSION["ccManual"] != 0) {
        $manual = 0;
        $_SESSION["ccManual"] = 0;
    }
    $expDate = $expMonth . $expYear;
    //set expDate
    $present = 1;
    //card present
    $proc = 'BPAS';
    //processor (will be set to CCRD when done testing)
    $TID = merchantNum();
    //merchant ID for processor
    $user = $_SESSION["CashierNo"];
    $trackII = $_SESSION["ccSwipe"];
    $amount = truncate2(abs($amountIn));
    // $string_out creates the string that will be saved to the *.inx file
    // of the XML format that PC Charge expects
    // Note: ref to x-schema requires specific order sequence
    // could not resolve 'Incomplete Trans' errors; last resort, just turn off XML validation --atf 5/18/07
    //'<XML_FILE xmlns="x-schema:.\dtd\stnd.xdr">
    $string_out = '<XML_FILE>
	<XML_REQUEST>
		<USER_ID>' . $user . '</USER_ID>
		<COMMAND>' . $command . '</COMMAND>
		<PROCESSOR_ID>' . $proc . '</PROCESSOR_ID>
		<MERCH_NUM>' . $TID . '</MERCH_NUM>
		<ACCT_NUM>' . $CC . '</ACCT_NUM>
		<EXP_DATE>' . $expDate . '</EXP_DATE>
		<MANUAL_FLAG>' . $manual . '</MANUAL_FLAG>
		<TRANS_AMOUNT>' . $amount . '</TRANS_AMOUNT>';
    if ($manual == 1) {
        // counter-intuitive: manual==1 means swiped, not manual, so pass the track data --atf 5/24/07
        $string_out .= '
		<TRACK_DATA>' . $trackII . '</TRACK_DATA>';
    }
    $string_out .= '
		<TICKET_NUM>' . $transno . '</TICKET_NUM> 
		<PRESENT_FLAG>1</PRESENT_FLAG>
	</XML_REQUEST>
</XML_FILE>
';
    //------added 04/01/05 Tak & CvR-----provide for voiding CC entry on receipt
    if (substr($input, 0, 1) == 'V' || substr($input, 0, 1) == 'v') {
        $troutd = $getCCOutW[2];
        $command = 3;
        $string_out = '<XML_FILE xmlns="x-schema:.\\dtd\\stnd.xdr">
	<XML_REQUEST>
		<USER_ID>' . $user . '</USER_ID>
		<COMMAND>' . $command . '</COMMAND>
		<TROUTD>' . $troutd . '</TROUTD>
	</XML_REQUEST>
</XML_FILE>
';
        // echo $string_out;
    }
    //----
    //below added to log .inx info. To be tested on lane9, etc
    //added 07/07/05 CvR
    $trans_id = $_SESSION["LastID"] + 1;
    $lane = $_SESSION["laneno"];
    $trans_no = $_SESSION["transno"];
    $now = date('Y-m-d H:i:s');
    $dbinx = tDataconnect();
    $inxQ = "INSERT INTO INX\r\n         VALUES('{$user}','{$command}','{$proc}','{$TID}','{$CC}','{$expDate}','{$manual}','{$trackII}','{$transno}',1,{$amount},'','{$now}','{$trans_id}','{$trans_no}','{$lane}')";
    if (sql_query($inxQ, $dbinx)) {
        //---------
        // changed all filename functions (remote_oux(), local_inx(), etc) to variables, cached up top --atf 5/24/07
        delete_file($local_inx);
        // ***** changed local_inx function to variable abpw 3/05/07 *****
        $fp = fopen($local_inx, 'w');
        // open the file with write permissions -- ***** changed local_inx function to variable abpw 3/05/07 *****
        fwrite($fp, $string_out);
        // write $string_out to the *.inx file
        fclose($fp);
        // close the file
        delete_file($remote_inx);
        delete_file($remote_oux);
        $inxUploaded = copy_file($local_inx, $remote_inx);
        //***** changed local_inx function to variable abpw 3/05/07 *****
    }
    return $inxUploaded;
}