query("select * from TFCregisterdtl where tfcregid='$corporateid' and regdtlrecstatus='O'"); if($tfcsql->result) { //--init all DB connections -- $inputsql=new sql(); $tfcworksql=new tfcsql(); $db="(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 200.1.2.242)(PORT = 1521)))(CONNECT_DATA = (SID = CCHS1)))"; $conn=OCILogon("wpos","webpos",$db); //$db="(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 200.1.2.238)(PORT = 1521)))(CONNECT_DATA = (SID = CCHSDEV)))"; //$conn=OCILogon("cchsd","cchsd",$db); $batch=new batch(); $crrbatchno=$batch->batchno($hidd_termdbid); $jobno=$batch->jobno($hidd_termdbid); $posbatchid=$batch->posbatchid($hidd_termdbid,$crrbatchno); //--------------------------- for($i=0; $i < $tfcsql->count();$i++) { $carddeposit=0; $cardbal=0; $no_mfgno=mssql_result($tfcsql->result,$i,"trm_mfgno"); $tfcregserialno = mssql_result($tfcsql->result,$i,"tfcregserialno"); $stmt = ociparse($conn,"select carddeposit,cardbal,cardstatus from cardmaster where mfgno=$no_mfgno"); ociexecute($stmt); while(ocifetch($stmt)) { $carddeposit=ociresult($stmt,"CARDDEPOSIT"); if($carddeposit=="") $carddeposit=0; $cardbal=ociresult($stmt,"CARDBAL"); $cardstatus=ociresult($stmt,"CARDSTATUS"); } $trancounter++; $todaysdate=date("m/d/Y g:i:s A"); $fields="(Mfgno, Cardtranno, Trandatetime, Ttype, Spid, Location, Terminalid, Batchno, Drcrflag, Purseflag, Transactedamt, Aftcardbal, Cardissuer, Cardno,Corporateflag, Usercategory, Csccardtype, Errorcode, PosBatchID, MachineCode,transactionid)"; $postransvalues="$no_mfgno,$hidd_transno-1,'$todaysdate','11','$hidd_SPID','$hidd_locationID',$hidd_termdbid,'$crrbatchno','D','P',$cardbal,0,'$hidd_issuerid','$no_cardno','','','','0001',$posbatchid,'$hidd_hex',$trancounter"; $inputsql->query("insert into TempPosTransaction $fields values ($postransvalues)"); $postransvalues="$no_mfgno,$hidd_transno-1,'$todaysdate','31','$hidd_SPID','$hidd_locationID',$hidd_termdbid,'$crrbatchno','D','N',$carddeposit,0,'$hidd_issuerid','$no_cardno','','','','0001',$posbatchid,'$hidd_hex',$trancounter"; $inputsql->query("insert into TempPosTransaction $fields values ($postransvalues)"); $transtype="SCardReturnQty=SCardReturnQty +1, SCardReturnAmt=SCardReturnAmt+ $cardbal + $carddeposit"; $inputsql->query("update TMPPOSBatchMaster set $transtype where TerminalID=$hidd_termdbid and EOJDateTime=null"); $inputsql->query("update CustomerInfo set cardstatus='R' where mfgno=$no_mfgno"); echo "\n"; // ----Original update query to tfcregisterdtl - Remarked 14/01/2005 by Dalina // $tfcworksql->query("update tfcregisterdtl set TRM_newcardstatus='R', regdtlrecstatus='D', regdtlrecstatususerid='$username', regdtlrecstatusdatetime='$todaysdate' where tfcregid='$corporateid' and tfcregserialno=$tfcregserialno"); // ----New update query to tfcregisterdtl to cater for new column lastModifiedDate and LastModifiedUser // ----Added 14/01/2005 by Dalina $tfcworksql->query("update tfcregisterdtl set TRM_newcardstatus='R', regdtlrecstatus='D', regdtlrecstatususerid='$username', regdtlrecstatusdatetime='$todaysdate', LastModifiedDate='$todaysdate', LastModifiedUser='$username' where tfcregid='$corporateid' and tfcregserialno=$tfcregserialno"); echo "\n"; // ----Original update query to tfcacctmaster - Remarked 14/01/2005 by Dalina // $tfcworksql->query("update tfcacctmaster set noofcardsreturn=noofcardsreturn+1, tfcacctstatus='A', tfcacctstatususerid='$username', tfcacctstatusdatetime='$todaysdate' where tfcacctid=$txt_accountid"); // ----New update query to tfcacctmaster to cater for new column lastModifiedDate and LastModifiedUser // ----Added 14/01/2005 by Dalina $tfcworksql->query("update tfcacctmaster set noofcardsreturn=noofcardsreturn+1, tfcacctstatus='A', tfcacctstatususerid='$username', tfcacctstatusdatetime='$todaysdate', LastModifiedDate='$todaysdate', LastModifiedUser='$username' where tfcacctid=$txt_accountid"); // ----Original update query to tfcregisterhdr - Remarked 14/01/2005 by Dalina // $tfcworksql->query("update tfcregisterhdr set noofcardsdone=noofcardsdone +1 where tfcregid='$corporateid'"); // ----New update query to tfcregisterhdr to cater for new column lastModifiedDate and LastModifiedUser // ----Added 14/01/2005 by Dalina $tfcworksql->query("update tfcregisterhdr set noofcardsdone=noofcardsdone +1, LastModifiedDate='$todaysdate', LastModifiedUser='$username' where tfcregid='$corporateid'"); } // ----Original update query to tfcregisterhdr - Remarked 14/01/2005 by Dalina // $tfcworksql->query("update tfcregisterhdr set regstatus='4', laststschangeuserid='$username', laststschangedatetime='$todaysdate' where tfcregid='$corporateid'"); // ----New update query to tfcregisterhdr to cater for new column lastModifiedDate and LastModifiedUser // ----Added 14/01/2005 by Dalina $tfcworksql->query("update tfcregisterhdr set regstatus='4', laststschangeuserid='$username', laststschangedatetime='$todaysdate', LastModifiedDate='$todaysdate', LastModifiedUser='$username' where tfcregid='$corporateid'"); echo "\n"; echo "\n"; }else { echo "\n"; echo "\n"; } } echo "\n"; ?> Batch return Done!