query("select count(*) as count from TMPPOSBatchMaster where TerminalID=$termdbid and batchno=$batchno"); if($inputsql->result) if(mssql_result($inputsql->result,0,"count")>0) // -- not closed -- { $postrantable="TempPosTransaction"; $batchtable="TMPPOSBatchMaster"; $posstrocktable="TempPosStockTransaction"; $temptable="Temp2PosTransaction"; }else { $inputsql->query("select count(*) as count from POSBatchMaster where TerminalID=$termdbid and batchno=$batchno"); if($inputsql->result) if(mssql_result($inputsql->result,0,"count")>0) // -- closed -- { $inputsql->query("select batchgendatetime from POSBatchMaster where TerminalID=$termdbid and batchno=$batchno"); if(mssql_result($inputsql->result,0,"batchgendatetime")!="") // -- batchfile generated -- { $inputsql->query("select count(*) as count from postransactionerrorlog where cardtranno=$tranno-1 AND mfgno=$mfgno AND batchno=$batchno AND Errorcode='0001'"); if($inputsql->result) if(mssql_result($inputsql->result,0,"count")>0) // -- good log exists -- { $inputsql->query("insert into parkpostransaction select * from postransactionerrorlog where cardtranno=$tranno-1 AND mfgno=$mfgno AND batchno=$batchno AND Errorcode='0001'"); if ($inputsql->result) //--- transaction successfully moved from log into trans table -- { $inputsql->query("delete from postransactionerrorlog where cardtranno=$tranno-1 AND mfgno=$mfgno AND batchno=$batchno AND Errorcode='0001'"); return true; } return false; //--- query failed -- }else { //-- no good log in DB -- $inputsql->query("insert into parkpostransaction select Top 2 * from postransactionerrorlog where cardtranno=$tranno-1 AND mfgno=$mfgno AND batchno=$batchno order by trandatetime DESC"); if($inputsql->result) return true; } return false; // -- query failed -- }else { $postrantable="PosTransaction"; $batchtable="POSBatchMaster"; $posstrocktable="PosStockTransaction"; $temptable="PosTransactionerrorlog"; } } else return false; // -- cant find batch -- else return false; //--sql error-- } else return false; //--sql error-- //---end check whether batch has been closed --- //---begin operation ----- $inputsql->query("select count(*) as count from $postrantable where cardtranno=$tranno-1 AND mfgno=$mfgno AND batchno=$batchno"); if($inputsql->result) if(mssql_result($inputsql->result,0,"count")>0) // --- is transaction already in db? --- { $inputsql->query("delete from $temptable where cardtranno=$tranno-1 AND mfgno=$mfgno AND batchno=$batchno AND Errorcode='0001'"); //-- fleetcard DB -- $tfcsql = new tfcsql(); $tfcsql->query("select count(*) as ct from tfcedconlinetrans where tfcregid='$corporateid' and tfcregserialno=$tfcregserial and mfgno=$mfgno"); if($tfcsql->result) if(mssql_result($tfcsql->result,0,"ct")==0) { $inputsql->query("select trandatetime from $postrantable where cardtranno=$tranno-1 AND mfgno=$mfgno AND batchno=$batchno"); $todaysdate=mssql_result($inputsql->result,0,"trandatetime"); // ----Original update query to tfcregisterdtl - Remarked 14/01/2005 by Dalina // $tfcsql->query("update tfcregisterdtl set apl_newmfgno=$mfgno, regdtlrecstatus='D', regdtlrecstatususerid='Recovered', regdtlrecstatusdatetime='$todaysdate' where tfcregid='$corporateid' and tfcregserialno=$tfcregserial"); // ----New update query to tfcregisterdtl to cater for new column lastModifiedDate and LastModifiedUser // ----Added 14/01/2005 by Dalina $tfcsql->query("update tfcregisterdtl set apl_newmfgno=$mfgno, regdtlrecstatus='D', regdtlrecstatususerid='Recovered', regdtlrecstatusdatetime='$todaysdate', LastModifiedDate='$todaysdate', LastModifiedUser='$username' where tfcregid='$corporateid' and tfcregserialno=$tfcregserial"); // ----Original update query to tfcregisterhdr - Remarked 14/01/2005 by Dalina // $tfcsql->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 $tfcsql->query("update tfcregisterhdr set noofcardsdone=noofcardsdone+1, LastModifiedDate='$todaysdate', LastModifiedUser='$username' where tfcregid='$corporateid'"); // ----Original update query to tfcacctmaster - Remarked 14/01/2005 by Dalina // $tfcsql->query("update tfcacctmaster set totalnoofcards=totalnoofcards+1,tfcacctstatus='A', tfcacctstatususerid='$Recovered', tfcacctstatusdatetime='$todaysdate' where tfcacctid=$accountid"); // ----New update query to tfcacctmaster to cater for new column lastModifiedDate and LastModifiedUser // ----Added 14/01/2005 by Dalina $tfcsql->query("update tfcacctmaster set totalnoofcards=totalnoofcards+1,tfcacctstatus='A', tfcacctstatususerid='$Recovered', tfcacctstatusdatetime='$todaysdate', LastModifiedDate='$todaysdate', LastModifiedUser='$username' where tfcacctid=$accountid"); // ----Original insert query to tfcacctdtl - Remarked 14/01/2005 by Dalina // $tfcsql->query("insert into tfcacctdtl values($accountid,$mfgno,'$bname','$vregno','$icno',999999,'$todaysdate','$todaysdate','" . date("m/d") . "/" . (date("Y")+1) . "')"); // ----New insert query to tfcacctdtl to cater for new column Creation Date, LastModifiedDate, Creation User and LastModifiedUser // ----Added 14/01/2005 by Dalina $tfcsql->query("insert into tfcacctdtl values($accountid,$mfgno,'$bname','$vregno','$icno',999999,'$todaysdate','$todaysdate','" . date("m/d") . "/" . (date("Y")+1) . "','$todaysdate','$todaysdate','$username','$username')"); $tfcsql->query("insert into tfcedconlinetrans values ('$corporateid',$tfcregserial,$mfgno,999999,'49','$todaysdate',$no_annualfee,'Recovered','A','U',null,null,null,null)"); $tfcsql->query("insert into tfcedconlinetrans values ('$corporateid',$tfcregserial,$mfgno,$tranno -1,'45','$todaysdate',$amount,'Recovered','A','U',null,null,null,null)"); $tfcsql->query("select noofcardsdone,noofcardsrequest from tfcregisterhdr where tfcregid='$corporateid'"); if($tfcsql->result) { $no_applied = mssql_result($tfcsql->result,0,"noofcardsrequest"); $no_encoded = mssql_result($tfcsql->result,0,"noofcardsdone"); $todaysdate=date("m/d/Y g:i:s A");//-- reset date to today's date -- if ($no_applied == $no_encoded) { // ----Original update query to tfcregisterhdr - Remarked 14/01/2005 by Dalina // $tfcsql->query("update tfcregisterhdr set regstatus='4', laststschangeuserid='Recovered', laststschangedatetime='$todaysdate' where tfcregid='$corporateid'"); // ----New update query to tfcregisterhdr to cater for new column lastModifiedDate and LastModifiedUser // ----Added 14/01/2005 by Dalina $tfcsql->query("update tfcregisterhdr set regstatus='4', laststschangeuserid='Recovered', laststschangedatetime='$todaysdate', LastModifiedDate='$todaysdate', LastModifiedUser='$username' where tfcregid='$corporateid'"); }else if ($no_applied > $no_encoded) { // ----Original update query to tfcregisterhdr - Remarked 14/01/2005 by Dalina // $tfcsql->query("update tfcregisterhdr set regstatus='3', laststschangeuserid='Recovered', laststschangedatetime='$todaysdate' where tfcregid='$corporateid'"); // ----New update query to tfcregisterhdr to cater for new column lastModifiedDate and LastModifiedUser // ----Added 14/01/2005 by Dalina $tfcsql->query("update tfcregisterhdr set regstatus='3', laststschangeuserid='Recovered', laststschangedatetime='$todaysdate', LastModifiedDate='$todaysdate', LastModifiedUser='$username' where tfcregid='$corporateid'"); } } } return true; }else { $inputsql->query("select count(*) as count from $temptable where cardtranno=$tranno-1 AND mfgno=$mfgno AND batchno=$batchno"); if($inputsql->result) if(mssql_result($inputsql->result,0,"count")>0) //-- is the tranasction in the log? -- { $inputsql->query("select count(*) as count from $temptable where cardtranno=$tranno-1 AND mfgno=$mfgno AND batchno=$batchno AND Errorcode='0001'"); if($inputsql->result) { if(mssql_result($inputsql->result,0,"count")>0) //-- is the tranasction in the log Good? -- { $inputsql->query("insert into $postrantable select top 2 * from $temptable where cardtranno=$tranno-1 AND mfgno=$mfgno AND batchno=$batchno AND Errorcode='0001' order by trandatetime desc"); if ($inputsql->result) $inputsql->query("delete from $temptable where cardtranno=$tranno-1 AND mfgno=$mfgno AND batchno=$batchno AND Errorcode='0001'"); $inputsql->query("update $postrantable set cardtranno=999999 where cardtranno=$tranno-1 AND mfgno=$mfgno AND batchno=$batchno AND Errorcode='0001' and ttype='49'"); } else { //-- Transaction in log is BAD -- $inputsql->query("insert into $postrantable select Top 2 * from $temptable where cardtranno=$tranno-1 AND mfgno=$mfgno AND batchno=$batchno order by trandatetime DESC"); if ($inputsql->result) $inputsql->query("update $postrantable set Errorcode='0001' where cardtranno=$tranno-1 AND mfgno=$mfgno AND batchno=$batchno"); $inputsql->query("update $postrantable set cardtranno=999999 where cardtranno=$tranno-1 AND mfgno=$mfgno AND batchno=$batchno AND Errorcode='0001' and ttype='49'"); } if ($inputsql->result) //--- transaction successfully moved from log into trans table -- { $inputsql->query("select trandatetime from $postrantable where mfgno=$mfgno and batchno=$batchno and cardtranno=$tranno-1"); if ($inputsql->result) { $todaysdate=mssql_result($inputsql->result,0,"trandatetime"); }else { $todaysdate=date("m/d/Y g:i:s A"); } $q="update CustomerInfo set cardstatus='S', name='RECOVERED FLEET CARD OFFLINE TRANSACTION' where mfgno=$mfgno"; $inputsql->query($q); $transtype="SCCardSalesQty=SCCardSalesQty+1, SCCardSaleAmt=SCCardSaleAmt+$amount "; $inputsql->query("update $batchtable set $transtype where TerminalID=$termdbid and batchno=$batchno"); $inputsql->query("update $posstrocktable set CardOutCnt=CardOutCnt+1 where TerminalID=$termdbid and Batchno=$batchno"); $inputsql->query("update PosLocation set TotalStockCount=TotalStockCount-1 where LocationID='$locationid'"); //-- fleetcard DB -- $tfcsql = new tfcsql(); // ----Original update query to tfcregisterdtl - Remarked 14/01/2005 by Dalina // $tfcsql->query("update tfcregisterdtl set apl_newmfgno=$mfgno, regdtlrecstatus='D', regdtlrecstatususerid='Recovered', regdtlrecstatusdatetime='$todaysdate' where tfcregid='$corporateid' and tfcregserialno=$tfcregserial"); // ----New update query to tfcregisterdtl to cater for new column lastModifiedDate and LastModifiedUser // ----Added 14/01/2005 by Dalina $tfcsql->query("update tfcregisterdtl set apl_newmfgno=$mfgno, regdtlrecstatus='D', regdtlrecstatususerid='Recovered', regdtlrecstatusdatetime='$todaysdate', LastModifiedDate='$todaysdate', LastModifiedUser='$username' where tfcregid='$corporateid' and tfcregserialno=$tfcregserial"); // ----Original update query to tfcregisterhdr - Remarked 14/01/2005 by Dalina // $tfcsql->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 $tfcsql->query("update tfcregisterhdr set noofcardsdone=noofcardsdone+1, LastModifiedDate='$todaysdate', LastModifiedUser='$username' where tfcregid='$corporateid'"); // ----Original update query to tfcacctmaster - Remarked 14/01/2005 by Dalina // $tfcsql->query("update tfcacctmaster set totalnoofcards=totalnoofcards+1,tfcacctstatus='A', tfcacctstatususerid='$Recovered', tfcacctstatusdatetime='$todaysdate' where tfcacctid=$accountid"); // ----New update query to tfcacctmaster to cater for new column lastModifiedDate and LastModifiedUser // ----Added 14/01/2005 by Dalina $tfcsql->query("update tfcacctmaster set totalnoofcards=totalnoofcards+1,tfcacctstatus='A', tfcacctstatususerid='$Recovered', tfcacctstatusdatetime='$todaysdate', LastModifiedDate='$todaysdate', LastModifiedUser='$username' where tfcacctid=$accountid"); // ----Original insert query to tfcacctdtl - Remarked 14/01/2005 by Dalina // $tfcsql->query("insert into tfcacctdtl values($accountid,$mfgno,'$bname','$vregno','$icno',999999,'$todaysdate','$todaysdate','" . date("m/d") . "/" . (date("Y")+1) . "')"); // ----New insert query to tfcacctdtl to cater for new column Creation Date, LastModifiedDate, Creation User and LastModifiedUser // ----Added 14/01/2005 by Dalina $tfcsql->query("insert into tfcacctdtl values($accountid,$mfgno,'$bname','$vregno','$icno',999999,'$todaysdate','$todaysdate','" . date("m/d") . "/" . (date("Y")+1) . "','$todaysdate','$todaysdate','$username','$username')"); $tfcsql->query("insert into tfcedconlinetrans values ('$corporateid',$tfcregserial,$mfgno,999999,'49','$todaysdate',$no_annualfee,'Recovered','A','U',null,null,null,null)"); $tfcsql->query("insert into tfcedconlinetrans values ('$corporateid',$tfcregserial,$mfgno,$tranno -1,'45','$todaysdate',$amount,'Recovered','A','U',null,null,null,null)"); $tfcsql->query("select noofcardsdone,noofcardsrequest from tfcregisterhdr where tfcregid='$corporateid'"); if($tfcsql->result) { $no_applied = mssql_result($tfcsql->result,0,"noofcardsrequest"); $no_encoded = mssql_result($tfcsql->result,0,"noofcardsdone"); $todaysdate=date("m/d/Y g:i:s A");//-- reset date to today's date -- if ($no_applied == $no_encoded) { // ----Original update query to tfcregisterhdr - Remarked 14/01/2005 by Dalina // $tfcsql->query("update tfcregisterhdr set regstatus='4', laststschangeuserid='Recovered', laststschangedatetime='$todaysdate' where tfcregid='$corporateid'"); // ----New update query to tfcregisterhdr to cater for new column lastModifiedDate and LastModifiedUser // ----Added 14/01/2005 by Dalina $tfcsql->query("update tfcregisterhdr set regstatus='4', laststschangeuserid='Recovered', laststschangedatetime='$todaysdate', LastModifiedDate='$todaysdate', LastModifiedUser='$username' where tfcregid='$corporateid'"); }else if ($no_applied > $no_encoded) { // ----Original update query to tfcregisterhdr - Remarked 14/01/2005 by Dalina // $tfcsql->query("update tfcregisterhdr set regstatus='3', laststschangeuserid='Recovered', laststschangedatetime='$todaysdate' where tfcregid='$corporateid'"); // ----New update query to tfcregisterhdr to cater for new column lastModifiedDate and LastModifiedUser // ----Added 14/01/2005 by Dalina $tfcsql->query("update tfcregisterhdr set regstatus='3', laststschangeuserid='Recovered', laststschangedatetime='$todaysdate', LastModifiedDate='$todaysdate', LastModifiedUser='$username' where tfcregid='$corporateid'"); } } return true; }else return false; //-- sql error -- }else return false; // -- SQL ERROR -- } return false; //--sql error or Transaction not in LOG -- } else return false; //--sql error-- }//-----end sale()------ function fleetreturn($mfgno,$batchno,$tranno,$termdbid,$locationid,$amount,$deposit,$corporateid,$tfcregserial,$accountid) { $inputsql=new sql(); //---check whether batch has been closed -- $inputsql->query("select count(*) as count from TMPPOSBatchMaster where TerminalID=$termdbid and batchno=$batchno"); if($inputsql->result) if(mssql_result($inputsql->result,0,"count")>0) // -- not closed -- { $postrantable="TempPosTransaction"; $batchtable="TMPPOSBatchMaster"; $posstrocktable="TempPosStockTransaction"; $temptable="Temp2PosTransaction"; }else { $inputsql->query("select count(*) as count from POSBatchMaster where TerminalID=$termdbid and batchno=$batchno"); if($inputsql->result) if(mssql_result($inputsql->result,0,"count")>0) // -- closed -- { $inputsql->query("select batchgendatetime from POSBatchMaster where TerminalID=$termdbid and batchno=$batchno"); if(mssql_result($inputsql->result,0,"batchgendatetime")!="") // -- batchfile generated -- { $inputsql->query("select count(*) as count from postransactionerrorlog where cardtranno=$tranno-1 AND mfgno=$mfgno AND batchno=$batchno AND Errorcode='0001'"); if($inputsql->result) if(mssql_result($inputsql->result,0,"count")>0) // -- good log exists -- { $inputsql->query("insert into parkpostransaction select * from postransactionerrorlog where cardtranno=$tranno-1 AND mfgno=$mfgno AND batchno=$batchno AND Errorcode='0001'"); if ($inputsql->result) //--- transaction successfully moved from log into trans table -- { $inputsql->query("delete from postransactionerrorlog where cardtranno=$tranno-1 AND mfgno=$mfgno AND batchno=$batchno AND Errorcode='0001'"); return true; } return false; //--- query failed -- }else { //-- no good log in DB -- $inputsql->query("insert into parkpostransaction select Top 2 * from postransactionerrorlog where cardtranno=$tranno-1 AND mfgno=$mfgno AND batchno=$batchno order by trandatetime DESC"); if($inputsql->result) return true; } return false; // -- query failed -- }else { $postrantable="PosTransaction"; $batchtable="POSBatchMaster"; $posstrocktable="PosStockTransaction"; $temptable="PosTransactionerrorlog"; } } else return false; // -- cant find batch -- else return false; //--sql error-- } else return false; //--sql error-- //---end check whether batch has been closed --- //---begin operation ----- $inputsql->query("select count(*) as count from $postrantable where cardtranno=$tranno-1 AND mfgno=$mfgno AND batchno=$batchno"); if($inputsql->result) if(mssql_result($inputsql->result,0,"count")>0) // --- is transaction already in db? --- { $inputsql->query("delete from $temptable where cardtranno=$tranno-1 AND mfgno=$mfgno AND batchno=$batchno AND Errorcode='0001'"); //-- fleetcard DB -- $tfcsql = new tfcsql(); $tfcsql->query("select count(TRM_newcardstatus) as ct from tfcregisterdtl where TRM_newcardstatus='R' and regdtlrecstatus='D' where tfcregid='$corporateid' and trm_mfgno=$mfgno"); if($tfcsql->result) if(mssql_result($tfcsql->result,0,"ct")==0) { $inputsql->query("select trandatetime from $postrantable where cardtranno=$tranno-1 AND mfgno=$mfgno AND batchno=$batchno"); $todaysdate=mssql_result($inputsql->result,0,"trandatetime"); // ----Original update query to tfcregisterdtl - Remarked 14/01/2005 by Dalina // $tfcsql->query("update tfcregisterdtl set TRM_newcardstatus='R', regdtlrecstatus='D', regdtlrecstatususerid='Recovered', regdtlrecstatusdatetime='$todaysdate' where tfcregid='$corporateid' and trm_mfgno=$mfgno"); // ----New update query to tfcregisterdtl to cater for new column lastModifiedDate and LastModifiedUser // ----Added 14/01/2005 by Dalina $tfcsql->query("update tfcregisterdtl set TRM_newcardstatus='R', regdtlrecstatus='D', regdtlrecstatususerid='Recovered', regdtlrecstatusdatetime='$todaysdate', LastModifiedDate='$todaysdate', LastModifiedUser='$username' where tfcregid='$corporateid' and trm_mfgno=$mfgno"); // ----Original update query to tfcacctmaster - Remarked 14/01/2005 by Dalina // $tfcsql->query("update tfcacctmaster set noofcardsreturn=noofcardsreturn+1, tfcacctstatus='A', tfcacctstatususerid='Recovered', tfcacctstatusdatetime='$todaysdate' where tfcacctid=$accountid"); // ----New update query to tfcacctmaster to cater for new column lastModifiedDate and LastModifiedUser // ----Added 14/01/2005 by Dalina $tfcsql->query("update tfcacctmaster set noofcardsreturn=noofcardsreturn+1, tfcacctstatus='A', tfcacctstatususerid='Recovered', tfcacctstatusdatetime='$todaysdate', LastModifiedDate='$todaysdate', LastModifiedUser='$username' where tfcacctid=$accountid"); // ----Original update query to tfcregisterhdr - Remarked 14/01/2005 by Dalina // $tfcsql->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 $tfcsql->query("update tfcregisterhdr set noofcardsdone=noofcardsdone +1, LastModifiedDate='$todaysdate', LastModifiedUser='$username' where tfcregid='$corporateid'"); $tfcsql->query("select noofcardsdone,noofcardsrequest from tfcregisterhdr where tfcregid='$corporateid'"); if($tfcsql->result) { $no_applied = mssql_result($tfcsql->result,0,"noofcardsrequest"); $no_encoded = mssql_result($tfcsql->result,0,"noofcardsdone"); $todaysdate=date("m/d/Y g:i:s A");//-- reset date to today's date -- if ($no_applied == $no_encoded) { // ----Original update query to tfcregisterhdr - Remarked 14/01/2005 by Dalina // $tfcsql->query("update tfcregisterhdr set regstatus='4', laststschangeuserid='Recovered', laststschangedatetime='$todaysdate' where tfcregid='$corporateid'"); // ----New update query to tfcregisterhdr to cater for new column lastModifiedDate and LastModifiedUser // ----Added 14/01/2005 by Dalina $tfcsql->query("update tfcregisterhdr set regstatus='4', laststschangeuserid='Recovered', laststschangedatetime='$todaysdate', LastModifiedDate='$todaysdate', LastModifiedUser='$username' where tfcregid='$corporateid'"); }else if ($no_applied > $no_encoded) { // ----Original update query to tfcregisterhdr - Remarked 14/01/2005 by Dalina // $tfcsql->query("update tfcregisterhdr set regstatus='3', laststschangeuserid='Recovered', laststschangedatetime='$todaysdate' where tfcregid='$corporateid'"); // ----New update query to tfcregisterhdr to cater for new column lastModifiedDate and LastModifiedUser // ----Added 14/01/2005 by Dalina $tfcsql->query("update tfcregisterhdr set regstatus='3', laststschangeuserid='Recovered', laststschangedatetime='$todaysdate', LastModifiedDate='$todaysdate', LastModifiedUser='$username' where tfcregid='$corporateid'"); } } } return true; }else { $inputsql->query("select count(*) as count from $temptable where cardtranno=$tranno-1 AND mfgno=$mfgno AND batchno=$batchno"); if($inputsql->result) if(mssql_result($inputsql->result,0,"count")>0) //-- is the tranasction in the log? -- { $inputsql->query("select count(*) as count from $temptable where cardtranno=$tranno-1 AND mfgno=$mfgno AND batchno=$batchno AND Errorcode='0001'"); if($inputsql->result) { if(mssql_result($inputsql->result,0,"count")>0) //-- is the tranasction in the log Good? -- { $inputsql->query("insert into $postrantable select TOP 2 * from $temptable where cardtranno=$tranno-1 AND mfgno=$mfgno AND batchno=$batchno AND Errorcode='0001' order by trandatetime desc"); if ($inputsql->result) $inputsql->query("delete from $temptable where cardtranno=$tranno-1 AND mfgno=$mfgno AND batchno=$batchno AND Errorcode='0001'"); } else { //-- Transaction in log is BAD -- $inputsql->query("insert into $postrantable select Top 2 * from $temptable where cardtranno=$tranno-1 AND mfgno=$mfgno AND batchno=$batchno order by trandatetime DESC"); if ($inputsql->result) $inputsql->query("update $postrantable set Errorcode='0001' where cardtranno=$tranno-1 AND mfgno=$mfgno AND batchno=$batchno"); } if ($inputsql->result) //--- transaction successfully moved from log into trans table -- { $inputsql->query("select trandatetime from $postrantable where mfgno=$mfgno and batchno=$batchno and cardtranno=$tranno-1"); if ($inputsql->result) { $todaysdate=mssql_result($inputsql->result,0,"trandatetime"); }else { $todaysdate=date("m/d/Y g:i:s A"); } $q="update CustomerInfo set cardstatus='R' where mfgno=$mfgno"; $inputsql->query($q); $transtype="SCCardSalesQty=SCCardSalesQty+1, SCCardSaleAmt=SCCardSaleAmt+$amount "; $inputsql->query("update $batchtable set $transtype where TerminalID=$termdbid and batchno=$batchno"); $inputsql->query("update $posstrocktable set CardOutCnt=CardOutCnt+1 where TerminalID=$termdbid and Batchno=$batchno"); $inputsql->query("update PosLocation set TotalStockCount=TotalStockCount-1 where LocationID='$locationid'"); //-- fleetcard DB -- $tfcsql = new tfcsql(); // ----Original update query to tfcregisterdtl - Remarked 14/01/2005 by Dalina // $tfcsql->query("update tfcregisterdtl set TRM_newcardstatus='R', regdtlrecstatus='D', regdtlrecstatususerid='Recovered', regdtlrecstatusdatetime='$todaysdate' where tfcregid='$corporateid' and trm_mfgno=$mfgno"); // ----New update query to tfcregisterdtl to cater for new column lastModifiedDate and LastModifiedUser // ----Added 14/01/2005 by Dalina $tfcsql->query("update tfcregisterdtl set TRM_newcardstatus='R', regdtlrecstatus='D', regdtlrecstatususerid='Recovered', regdtlrecstatusdatetime='$todaysdate', LastModifiedDate='$todaysdate', LastModifiedUser='$username' where tfcregid='$corporateid' and trm_mfgno=$mfgno"); // ----Original update query to tfcacctmaster - Remarked 14/01/2005 by Dalina // $tfcsql->query("update tfcacctmaster set noofcardsreturn=noofcardsreturn+1, tfcacctstatus='A', tfcacctstatususerid='Recovered', tfcacctstatusdatetime='$todaysdate' where tfcacctid=$accountid"); // ----New update query to tfcacctmaster to cater for new column lastModifiedDate and LastModifiedUser // ----Added 14/01/2005 by Dalina $tfcsql->query("update tfcacctmaster set noofcardsreturn=noofcardsreturn+1, tfcacctstatus='A', tfcacctstatususerid='Recovered', tfcacctstatusdatetime='$todaysdate', LastModifiedDate='$todaysdate', LastModifiedUser='$username' where tfcacctid=$accountid"); // ----Original update query to tfcregisterhdr - Remarked 14/01/2005 by Dalina // $tfcsql->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 $tfcsql->query("update tfcregisterhdr set noofcardsdone=noofcardsdone +1, LastModifiedDate='$todaysdate', LastModifiedUser='$username' where tfcregid='$corporateid'"); $tfcsql->query("select noofcardsdone,noofcardsrequest from tfcregisterhdr where tfcregid='$corporateid'"); if($tfcsql->result) { $no_applied = mssql_result($tfcsql->result,0,"noofcardsrequest"); $no_encoded = mssql_result($tfcsql->result,0,"noofcardsdone"); $todaysdate=date("m/d/Y g:i:s A");//-- reset date to today's date -- if ($no_applied == $no_encoded) { // ----Original update query to tfcregisterhdr - Remarked 14/01/2005 by Dalina // $tfcsql->query("update tfcregisterhdr set regstatus='4', laststschangeuserid='Recovered', laststschangedatetime='$todaysdate' where tfcregid='$corporateid'"); // ----New update query to tfcregisterhdr to cater for new column lastModifiedDate and LastModifiedUser // ----Added 14/01/2005 by Dalina $tfcsql->query("update tfcregisterhdr set regstatus='4', laststschangeuserid='Recovered', laststschangedatetime='$todaysdate', LastModifiedDate='$todaysdate', LastModifiedUser='$username' where tfcregid='$corporateid'"); }else if ($no_applied > $no_encoded) { // ----Original update query to tfcregisterhdr - Remarked 14/01/2005 by Dalina // $tfcsql->query("update tfcregisterhdr set regstatus='3', laststschangeuserid='Recovered', laststschangedatetime='$todaysdate' where tfcregid='$corporateid'"); // ----New update query to tfcregisterhdr to cater for new column lastModifiedDate and LastModifiedUser // ----Added 14/01/2005 by Dalina $tfcsql->query("update tfcregisterhdr set regstatus='3', laststschangeuserid='Recovered', laststschangedatetime='$todaysdate', LastModifiedDate='$todaysdate', LastModifiedUser='$username' where tfcregid='$corporateid'"); } } return true; }else return false; //-- sql error -- }else return false; // -- SQL ERROR -- } return false; //--sql error or Transaction not in LOG -- } else return false; //--sql error-- }//-----end fleetreturn()------ // Important!! for fleetreplacement, only transaction for old card is in tmp table cos // new card info is not available before encoding to card. Therefore, new card info is written // here during offline transaction. function fleetreplacement($mfgno,$batchno,$tranno,$termdbid,$locationid,$amount,$no_amountdue,$corporateid,$tfcregserial,$accountid,$bname,$vregno,$icno,$hidd_newmfgno,$hidd_trannonewcard) { $inputsql=new sql(); //---check whether batch has been closed -- $inputsql->query("select count(*) as count from TMPPOSBatchMaster where TerminalID=$termdbid and batchno=$batchno"); if($inputsql->result) if(mssql_result($inputsql->result,0,"count")>0) // -- not closed -- { $postrantable="TempPosTransaction"; $batchtable="TMPPOSBatchMaster"; $posstrocktable="TempPosStockTransaction"; $temptable="Temp2PosTransaction"; }else { $inputsql->query("select count(*) as count from POSBatchMaster where TerminalID=$termdbid and batchno=$batchno"); if($inputsql->result) if(mssql_result($inputsql->result,0,"count")>0) // -- closed -- { $inputsql->query("select batchgendatetime from POSBatchMaster where TerminalID=$termdbid and batchno=$batchno"); if(mssql_result($inputsql->result,0,"batchgendatetime")!="") // -- batchfile generated -- { $inputsql->query("select count(*) as count from postransactionerrorlog where cardtranno=$tranno-1 AND mfgno=$mfgno AND batchno=$batchno AND Errorcode='0001'"); if($inputsql->result) if(mssql_result($inputsql->result,0,"count")>0) // -- good log exists -- { $inputsql->query("insert into parkpostransaction select * from postransactionerrorlog where cardtranno=$tranno-1 AND mfgno=$mfgno AND batchno=$batchno AND Errorcode='0001'"); if ($inputsql->result) //--- transaction successfully moved from log into trans table -- { $inputsql->query("delete from postransactionerrorlog where cardtranno=$tranno-1 AND mfgno=$mfgno AND batchno=$batchno AND Errorcode='0001'"); return true; } return false; //--- query failed -- }else { //-- no good log in DB -- $inputsql->query("insert into parkpostransaction select Top 1 * from postransactionerrorlog where cardtranno=$tranno-1 AND mfgno=$mfgno AND batchno=$batchno order by trandatetime DESC"); if($inputsql->result) return true; } return false; // -- query failed -- }else { $postrantable="PosTransaction"; $batchtable="POSBatchMaster"; $posstrocktable="PosStockTransaction"; $temptable="PosTransactionerrorlog"; } } else return false; // -- cant find batch -- else return false; //--sql error-- } else return false; //--sql error-- //---end check whether batch has been closed --- //---begin operation ----- $inputsql->query("select count(*) as count from $postrantable where cardtranno=$tranno-1 AND mfgno=$mfgno AND batchno=$batchno"); if($inputsql->result) if(mssql_result($inputsql->result,0,"count")>0) // --- is transaction already in db? --- { $inputsql->query("delete from $temptable where cardtranno=$tranno-1 AND mfgno=$mfgno AND batchno=$batchno AND Errorcode='0001'"); //-- fleetcard DB -- $tfcsql = new tfcsql(); $tfcsql->query("select count(*) as ct from tfcedconlinetrans where tfcregid='$corporateid' and tfcregserialno=$tfcregserial and mfgno=$hidd_newmfgno"); if($tfcsql->result) if(mssql_result($tfcsql->result,0,"ct")==0) { $inputsql->query("select trandatetime from $postrantable where cardtranno=$tranno-1 AND mfgno=$mfgno AND batchno=$batchno"); $todaysdate=mssql_result($inputsql->result,0,"trandatetime"); // ----Original update query to tfcregisterdtl - Remarked 14/01/2005 by Dalina // $tfcsql->query("update tfcregisterdtl set rpl_newmfgno=$hidd_newmfgno, regdtlrecstatus='D', regdtlrecstatususerid='Recovered', regdtlrecstatusdatetime='$todaysdate' where tfcregid='$corporateid' and rpl_oldmfgno=$mfgno"); // ----New update query to tfcregisterdtl to cater for new column lastModifiedDate and LastModifiedUser // ----Added 14/01/2005 by Dalina $tfcsql->query("update tfcregisterdtl set rpl_newmfgno=$hidd_newmfgno, regdtlrecstatus='D', regdtlrecstatususerid='Recovered', regdtlrecstatusdatetime='$todaysdate', LastModifiedDate='$todaysdate', LastModifiedUser='$username' where tfcregid='$corporateid' and rpl_oldmfgno=$mfgno"); // ----Original update query to tfcacctmaster - Remarked 14/01/2005 by Dalina // $tfcsql->query("update tfcacctmaster set noofcardsreturn=noofcardsreturn+1,totalnoofcards=totalnoofcards+1, tfcacctstatus='A', tfcacctstatususerid='Recovered', tfcacctstatusdatetime='$todaysdate' where tfcacctid=$accountid"); // ----New update query to tfcacctmaster to cater for new column lastModifiedDate and LastModifiedUser // ----Added 14/01/2005 by Dalina $tfcsql->query("update tfcacctmaster set noofcardsreturn=noofcardsreturn+1,totalnoofcards=totalnoofcards+1, tfcacctstatus='A', tfcacctstatususerid='Recovered', tfcacctstatusdatetime='$todaysdate', LastModifiedDate='$todaysdate', LastModifiedUser='$username' where tfcacctid=$accountid"); // ----Original update query to tfcregisterhdr - Remarked 14/01/2005 by Dalina // $tfcsql->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 $tfcsql->query("update tfcregisterhdr set noofcardsdone=noofcardsdone +1, LastModifiedDate='$todaysdate', LastModifiedUser='$username' where tfcregid='$corporateid'"); // ----Original insert query to tfcacctdtl - Remarked 14/01/2005 by Dalina // $tfcsql->query("insert into tfcacctdtl values($accountid,$hidd_newmfgno,'$bname','$vregno','$icno',999999,'$todaysdate','$todaysdate','" . date("m/d") . "/" . (date("Y")+1) . "')"); // ----New insert query to tfcacctdtl to cater for new column Creation Date, LastModifiedDate, Creation User and LastModifiedUser // ----Added 14/01/2005 by Dalina $tfcsql->query("insert into tfcacctdtl values($accountid,$hidd_newmfgno,'$bname','$vregno','$icno',999999,'$todaysdate','$todaysdate','" . date("m/d") . "/" . (date("Y")+1) . "','$todaysdate','$todaysdate','$username','$username')"); $tfcsql->query("insert into tfcedconlinetrans values ('$corporateid',$tfcregserial,$hidd_newmfgno,999999,'48','$todaysdate',$no_amountdue,'Recovered','A','U',null,null,null,null)"); $tfcsql->query("select noofcardsdone,noofcardsrequest from tfcregisterhdr where tfcregid='$corporateid'"); if($tfcsql->result) { $no_applied = mssql_result($tfcsql->result,0,"noofcardsrequest"); $no_encoded = mssql_result($tfcsql->result,0,"noofcardsdone"); $todaysdate=date("m/d/Y g:i:s A");//-- reset date to today's date -- if ($no_applied == $no_encoded) { $tfcsql->query("select count(*) as ct from tfcedconlinetrans where tfcregid='$corporateid'"); if(mssql_result($tfcsql->result,0,"ct") >0) { // ----Original update query to tfcregisterhdr - Remarked 14/01/2005 by Dalina // $tfcsql->query("update tfcregisterhdr set regstatus='4', laststschangeuserid='Recovered', laststschangedatetime='$todaysdate' where tfcregid='$corporateid'"); // ----New update query to tfcregisterhdr to cater for new column lastModifiedDate and LastModifiedUser // ----Added 14/01/2005 by Dalina $tfcsql->query("update tfcregisterhdr set regstatus='4', laststschangeuserid='Recovered', laststschangedatetime='$todaysdate', LastModifiedDate='$todaysdate', LastModifiedUser='$username' where tfcregid='$corporateid'"); }else { // ----Original update query to tfcregisterhdr - Remarked 14/01/2005 by Dalina // $tfcsql->query("update tfcregisterhdr set regstatus='5', laststschangeuserid='Recovered', laststschangedatetime='$todaysdate' where tfcregid='$corporateid'"); // ----New update query to tfcregisterhdr to cater for new column lastModifiedDate and LastModifiedUser // ----Added 14/01/2005 by Dalina $tfcsql->query("update tfcregisterhdr set regstatus='5', laststschangeuserid='Recovered', laststschangedatetime='$todaysdate', LastModifiedDate='$todaysdate', LastModifiedUser='$username' where tfcregid='$corporateid'"); } }else if ($no_applied > $no_encoded) { // ----Original update query to tfcregisterhdr - Remarked 14/01/2005 by Dalina // $tfcsql->query("update tfcregisterhdr set regstatus='3', laststschangeuserid='Recovered', laststschangedatetime='$todaysdate' where tfcregid='$corporateid'"); // ----New update query to tfcregisterhdr to cater for new column lastModifiedDate and LastModifiedUser // ----Added 14/01/2005 by Dalina $tfcsql->query("update tfcregisterhdr set regstatus='3', laststschangeuserid='Recovered', laststschangedatetime='$todaysdate', LastModifiedDate='$todaysdate', LastModifiedUser='$username' where tfcregid='$corporateid'"); } } } return true; }else { $inputsql->query("select count(*) as count from $temptable where cardtranno=$tranno-1 AND mfgno=$mfgno AND batchno=$batchno"); if($inputsql->result) if(mssql_result($inputsql->result,0,"count")>0) //-- is the tranasction in the log? -- { $inputsql->query("select count(*) as count from $temptable where cardtranno=$tranno-1 AND mfgno=$mfgno AND batchno=$batchno AND Errorcode='0001'"); if($inputsql->result) { if(mssql_result($inputsql->result,0,"count")>0) //-- is the tranasction in the log Good? -- { $inputsql->query("select * from $temptable where cardtranno=$tranno-1 AND mfgno=$mfgno AND batchno=$batchno AND Errorcode='0001'"); if($inputsql->result) if($inputsql->count() >0) { $trancounter=mssql_result($inputsql->result,0,"transactionid"); $machinecode=mssql_result($inputsql->result,0,"machinecode"); $posbatchid=mssql_result($inputsql->result,0,"posbatchid"); $trandatetime=mssql_result($inputsql->result,0,"trandatetime"); $spid=mssql_result($inputsql->result,0,"spid"); $inputsql->query("insert into $postrantable values($hidd_newmfgno,$hidd_trannonewcard-1,'$trandatetime','46','$spid','$locationid',$termdbid,'$batchno','C','P',$amount,$amount,'$spid','0','C','N','C','0001',$posbatchid,'$machinecode',$trancounter)"); $inputsql->query("insert into $postrantable values($hidd_newmfgno,$hidd_trannonewcard-1,'$trandatetime','48','$spid','$locationid',$termdbid,'$batchno','C','N',$no_amountdue,$amount,'$spid','0','C','N','C','0001',$posbatchid,'$machinecode',$trancounter)"); } $inputsql->query("insert into $postrantable select TOP 3 * from $temptable where cardtranno=$tranno-1 AND mfgno=$mfgno AND batchno=$batchno AND Errorcode='0001' order by trandatetime desc"); if ($inputsql->result) $inputsql->query("delete from $temptable where cardtranno=$tranno-1 AND mfgno=$mfgno AND batchno=$batchno AND Errorcode='0001'"); } else { //-- Transaction in log is BAD -- $inputsql->query("select * from $temptable where cardtranno=$tranno-1 AND mfgno=$mfgno AND batchno=$batchno AND Errorcode='0001'"); if($inputsql->result) if($inputsql->count() >0) { $trancounter=mssql_result($inputsql->result,0,"transactionid"); $machinecode=mssql_result($inputsql->result,0,"machinecode"); $posbatchid=mssql_result($inputsql->result,0,"posbatchid"); $trandatetime=mssql_result($inputsql->result,0,"trandatetime"); $spid=mssql_result($inputsql->result,0,"spid"); $inputsql->query("insert into $postrantable values($hidd_newmfgno,$hidd_trannonewcard-1,'$trandatetime','46','$spid','$locationid',$termdbid,'$batchno','C','P',$amount,$amount,'$spid','0','C','N','C','0001',$posbatchid,'$machinecode',$trancounter)"); $inputsql->query("insert into $postrantable values($hidd_newmfgno,$hidd_trannonewcard-1,'$trandatetime','48','$spid','$locationid',$termdbid,'$batchno','C','N',$no_amountdue,$amount,'$spid','0','C','N','C','0001',$posbatchid,'$machinecode',$trancounter)"); } $inputsql->query("insert into $postrantable select Top 1 * from $temptable where cardtranno=$tranno-1 AND mfgno=$mfgno AND batchno=$batchno order by trandatetime DESC"); if ($inputsql->result) $inputsql->query("update $postrantable set Errorcode='0001' where cardtranno=$tranno-1 AND mfgno=$mfgno AND batchno=$batchno"); } if ($inputsql->result) //--- transaction successfully moved from log into trans table -- { $inputsql->query("select trandatetime from $postrantable where mfgno=$mfgno and batchno=$batchno and cardtranno=$tranno-1"); if ($inputsql->result) { $todaysdate=mssql_result($inputsql->result,0,"trandatetime"); }else { $todaysdate=date("m/d/Y g:i:s A"); } $q="update CustomerInfo set cardstatus='S', name='RECOVERED FLEET CARD OFFLINE TRANSACTION' where mfgno=$hidd_newmfgno"; $inputsql->query($q); $q="update CustomerInfo set cardstatus='U' where mfgno=$mfgno"; $inputsql->query($q); $transtype="SCCardSalesQty=SCCardSalesQty+1, SCCardSaleAmt=SCCardSaleAmt+$amount "; $inputsql->query("update $batchtable set $transtype where TerminalID=$termdbid and batchno=$batchno"); $inputsql->query("update $posstrocktable set CardOutCnt=CardOutCnt+1 where TerminalID=$termdbid and Batchno=$batchno"); $inputsql->query("update PosLocation set TotalStockCount=TotalStockCount-1 where LocationID='$locationid'"); $inputsql->query("insert into Reptransaction (trandatetime,oldmfgno,newmfgno) Values ('$todaysdate',$mfgno,$hidd_newmfgno)"); //-- fleetcard DB -- $tfcsql = new tfcsql(); // ----Original update query to tfcregisterdtl - Remarked 14/01/2005 by Dalina // $tfcsql->query("update tfcregisterdtl set rpl_newmfgno=$hidd_newmfgno, regdtlrecstatus='D', regdtlrecstatususerid='Recovered', regdtlrecstatusdatetime='$todaysdate' where tfcregid='$corporateid' and rpl_oldmfgno=$mfgno"); // ----New update query to tfcregisterdtl to cater for new column lastModifiedDate and LastModifiedUser // ----Added 14/01/2005 by Dalina $tfcsql->query("update tfcregisterdtl set rpl_newmfgno=$hidd_newmfgno, regdtlrecstatus='D', regdtlrecstatususerid='Recovered', regdtlrecstatusdatetime='$todaysdate', LastModifiedDate='$todaysdate', LastModifiedUser='$username' where tfcregid='$corporateid' and rpl_oldmfgno=$mfgno"); // ----Original update query to tfcacctmaster - Remarked 14/01/2005 by Dalina // $tfcsql->query("update tfcacctmaster set noofcardsreturn=noofcardsreturn+1,totalnoofcards=totalnoofcards+1, tfcacctstatus='A', tfcacctstatususerid='Recovered', tfcacctstatusdatetime='$todaysdate' where tfcacctid=$accountid"); // ----New update query to tfcacctmaster to cater for new column lastModifiedDate and LastModifiedUser // ----Added 14/01/2005 by Dalina $tfcsql->query("update tfcacctmaster set noofcardsreturn=noofcardsreturn+1,totalnoofcards=totalnoofcards+1, tfcacctstatus='A', tfcacctstatususerid='Recovered', tfcacctstatusdatetime='$todaysdate', LastModifiedDate='$todaysdate', LastModifiedUser='$username' where tfcacctid=$accountid"); // ----Original update query to tfcregisterhdr - Remarked 14/01/2005 by Dalina // $tfcsql->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 $tfcsql->query("update tfcregisterhdr set noofcardsdone=noofcardsdone +1, LastModifiedDate='$todaysdate', LastModifiedUser='$username' where tfcregid='$corporateid'"); // ----Original insert query to tfcacctdtl - Remarked 14/01/2005 by Dalina // $tfcsql->query("insert into tfcacctdtl values($accountid,$hidd_newmfgno,'$bname','$vregno','$icno',999999,'$todaysdate','$todaysdate','" . date("m/d") . "/" . (date("Y")+1) . "')"); // ----New insert query to tfcacctdtl to cater for new column Creation Date, LastModifiedDate, Creation User and LastModifiedUser // ----Added 14/01/2005 by Dalina $tfcsql->query("insert into tfcacctdtl values($accountid,$hidd_newmfgno,'$bname','$vregno','$icno',999999,'$todaysdate','$todaysdate','" . date("m/d") . "/" . (date("Y")+1) . "','$todaysdate','$todaysdate','$username','$username')"); $tfcsql->query("insert into tfcedconlinetrans values ('$corporateid',$tfcregserial,$hidd_newmfgno,999999,'48','$todaysdate',$no_amountdue,'Recovered','A','U',null,null,null,null)"); $tfcsql->query("select noofcardsdone,noofcardsrequest from tfcregisterhdr where tfcregid='$corporateid'"); if($tfcsql->result) { $no_applied = mssql_result($tfcsql->result,0,"noofcardsrequest"); $no_encoded = mssql_result($tfcsql->result,0,"noofcardsdone"); $todaysdate=date("m/d/Y g:i:s A");//-- reset date to today's date -- if ($no_applied == $no_encoded) { $tfcsql->query("select count(*) as ct from tfcedconlinetrans where tfcregid='$corporateid'"); if(mssql_result($tfcsql->result,0,"ct") >0) { // ----Original update query to tfcregisterhdr - Remarked 14/01/2005 by Dalina // $tfcsql->query("update tfcregisterhdr set regstatus='4', laststschangeuserid='Recovered', laststschangedatetime='$todaysdate' where tfcregid='$corporateid'"); // ----New update query to tfcregisterhdr to cater for new column lastModifiedDate and LastModifiedUser // ----Added 14/01/2005 by Dalina $tfcsql->query("update tfcregisterhdr set regstatus='4', laststschangeuserid='Recovered', laststschangedatetime='$todaysdate', LastModifiedDate='$todaysdate', LastModifiedUser='$username' where tfcregid='$corporateid'"); }else { // ----Original update query to tfcregisterhdr - Remarked 14/01/2005 by Dalina // $tfcsql->query("update tfcregisterhdr set regstatus='4', laststschangeuserid='Recovered', laststschangedatetime='$todaysdate' where tfcregid='$corporateid'"); // ----New update query to tfcregisterhdr to cater for new column lastModifiedDate and LastModifiedUser // ----Added 14/01/2005 by Dalina $tfcsql->query("update tfcregisterhdr set regstatus='4', laststschangeuserid='Recovered', laststschangedatetime='$todaysdate', LastModifiedDate='$todaysdate', LastModifiedUser='$username' where tfcregid='$corporateid'"); } }else if ($no_applied > $no_encoded) { // ----Original update query to tfcregisterhdr - Remarked 14/01/2005 by Dalina // $tfcsql->query("update tfcregisterhdr set regstatus='3', laststschangeuserid='Recovered', laststschangedatetime='$todaysdate' where tfcregid='$corporateid'"); // ----New update query to tfcregisterhdr to cater for new column lastModifiedDate and LastModifiedUser // ----Added 14/01/2005 by Dalina $tfcsql->query("update tfcregisterhdr set regstatus='3', laststschangeuserid='Recovered', laststschangedatetime='$todaysdate', LastModifiedDate='$todaysdate', LastModifiedUser='$username' where tfcregid='$corporateid'"); } } return true; }else return false; //-- sql error -- }else return false; // -- SQL ERROR -- } return false; //--sql error or Transaction not in LOG -- } else return false; //--sql error-- }//-----end fleetreplacement()------ function fleetdenomod($mfgno,$batchno,$tranno,$termdbid,$locationid,$amount,$no_amountdue,$corporateid,$tfcregserial,$accountid,$bname,$vregno,$icno) { $inputsql= new sql(); //-- fleetcard DB -- $tfcsql = new tfcsql(); $todaysdate=date("m/d/Y g:i:s A"); $tfcsql->query("select count(*) as ct from tfcregisterdtl where dmd_mfgno=$mfgno and tfcregid='$corporateid' and regdtlrecstatus='D'"); if (mssql_result($tfcsql->result,0,"ct") ==0) { // ----Original update query to tfcregisterdtl - Remarked 14/01/2005 by Dalina // $tfcsql->query("update tfcregisterdtl set regdtlrecstatus='D', regdtlrecstatususerid='Recovered', regdtlrecstatusdatetime='$todaysdate' where tfcregid='$corporateid' and dmd_mfgno=$mfgno"); // ----New update query to tfcregisterdtl to cater for new column lastModifiedDate and LastModifiedUser // ----Added 14/01/2005 by Dalina $tfcsql->query("update tfcregisterdtl set regdtlrecstatus='D', regdtlrecstatususerid='Recovered', regdtlrecstatusdatetime='$todaysdate', LastModifiedDate='$todaysdate', LastModifiedUser='$username' where tfcregid='$corporateid' and dmd_mfgno=$mfgno"); // ----Original update query to tfcregisterhdr - Remarked 14/01/2005 by Dalina // $tfcsql->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 $tfcsql->query("update tfcregisterhdr set noofcardsdone=noofcardsdone +1, LastModifiedDate='$todaysdate', LastModifiedUser='$username' where tfcregid='$corporateid'"); $tfcsql->query("select noofcardsdone,noofcardsrequest from tfcregisterhdr where tfcregid='$corporateid'"); if($tfcsql->result) { $no_applied = mssql_result($tfcsql->result,0,"noofcardsrequest"); $no_encoded = mssql_result($tfcsql->result,0,"noofcardsdone"); $todaysdate=date("m/d/Y g:i:s A");//-- reset date to today's date -- if ($no_applied == $no_encoded) { // ----Original update query to tfcregisterhdr - Remarked 14/01/2005 by Dalina // $tfcsql->query("update tfcregisterhdr set regstatus='5', laststschangeuserid='Recovered', laststschangedatetime='$todaysdate' where tfcregid='$corporateid'"); // ----New update query to tfcregisterhdr to cater for new column lastModifiedDate and LastModifiedUser // ----Added 14/01/2005 by Dalina $tfcsql->query("update tfcregisterhdr set regstatus='5', laststschangeuserid='Recovered', laststschangedatetime='$todaysdate', LastModifiedDate='$todaysdate', LastModifiedUser='$username' where tfcregid='$corporateid'"); }else if ($no_applied > $no_encoded) { // ----Original update query to tfcregisterhdr - Remarked 14/01/2005 by Dalina // $tfcsql->query("update tfcregisterhdr set regstatus='3', laststschangeuserid='Recovered', laststschangedatetime='$todaysdate' where tfcregid='$corporateid'"); // ----New update query to tfcregisterhdr to cater for new column lastModifiedDate and LastModifiedUser // ----Added 14/01/2005 by Dalina $tfcsql->query("update tfcregisterhdr set regstatus='3', laststschangeuserid='Recovered', laststschangedatetime='$todaysdate', LastModifiedDate='$todaysdate', LastModifiedUser='$username' where tfcregid='$corporateid'"); } } $inputsql->query("update customerinfo set refillthreshold=$no_amountdue where mfgno=$mfgno"); }else return true; return true; }//-----end fleetdenomod()------ ?> Processing....
 
Uploading last transaction.