I am having a little problem with a cfc that is not supposed to return any thing. Its only function is to insert information into a couple database tables. I am getting a generic message stating "The value returned from the PutLocSalesRegisterInfo function is not of type boolean.". Is there anyone who have had a similar problem and fixed it somehow? Here is my function below.
<cffunction name="PutLocSalesRegisterInfo" access="public" output="false" returntype="boolean">
<cfargument name="OrgID" required="yes" type="any">
<cfargument name="LocID" required="yes" type="any">
<cfargument name="RegNum" required="yes" type="any">
<cfargument name="userID" required="yes" type="any">
<cfargument name="firstName" required="yes" type="any" default="">
<cfargument name="LastName" required="yes" type="any" default="">
<cfargument name="effectiveDate" required="yes" type="any" default="">
<cfargument name="VisaAmount" required="no" type="any" default="0.00">
<cfargument name="VisaCount" required="no" type="any" default="0">
<cfargument name="discoverCount" required="no" type="any" default="0">
<cfargument name="discoverAmount" required="no" type="any" default="0.00">
<cfargument name="MasterCardCount" required="no" type="any" default="0">
<cfargument name="MasterCardAmount" required="no" type="any" default="0.00">
<cfargument name="debitCount" required="no" type="any" default="0">
<cfargument name="debitAmount" required="no" type="any" default="0.00">
<cfargument name="AmericanExpressCount" required="no" type="any" default="0">
<cfargument name="AmericanExpressAmount" required="no" type="any" default="0.00">
<cfargument name="ccCountTotal" required="no" type="any" default="0">
<cfargument name="ccAmtTotal" required="no" type="any" default="0.00">
<cfargument name="CheckCount" required="no" type="any" default="0">
<cfargument name="CheckAmount" required="no" type="any" default="0.00">
<cfargument name="CreditIssuedCount" required="no" type="any" default="0">
<cfargument name="CreditIssuedAmount" required="no" type="any" default="0.00">
<cfargument name="eChecksCount" required="no" type="any" default="0">
<cfargument name="eChecksAmount" required="no" type="any" default="0.00">
<cfargument name="CreditRedeemedCount" required="no" type="any" default="0">
<cfargument name="CreditRedeemedAmount" required="no" type="any" default="0.00">
<cfargument name="GiftCertIssuedCount" required="no" type="any" default="0">
<cfargument name="GiftCertIssuedAmount" required="no" type="any" default="0.00">
<cfargument name="GiftCardIssuedCount" required="no" type="any" default="0">
<cfargument name="GiftCardIssuedAmount" required="no" type="any" default="0.00">
<cfargument name="GiftCertRedeemedCount" required="no" type="any" default="0">
<cfargument name="GiftCertRedeemedAmount" required="no" type="any" default="0.00">
<cfargument name="GiftCardRedeemedCount" required="no" type="any" default="0">
<cfargument name="GiftCardRedeemedAmount" required="no" type="any" default="0.00">
<cfargument name="VouchersCount" required="no" type="any" default="0">
<cfargument name="VouchersAmount" required="no" type="any" default="0.00">
<cfargument name="cashDonationsCount" required="no" type="any" default="0">
<cfargument name="cashDonationsAmount" required="no" type="any" default="0.00">
<cfargument name="ChangeRndUpCount" required="no" type="any" default="0">
<cfargument name="ChangeRndUpAmount" required="no" type="any" default="0.00">
<cfargument name="ExpectedCashfromRegister" required="no" type="any" default="0.00">
<cfargument name="ExpectedCashFromDrawer" required="no" type="any" default="0.00">
<cfargument name="CashTotal" required="no" type="any" default="0.00">
<cfargument name="CashTotalAmountEntered" required="no" type="any" default="0.00">
<cfargument name="Cashadjust" required="no" type="any" default="0.00">
<cfargument name="ActualCashMinusChangeStock" required="no" type="any" default="0.00">
<cfargument name="transactions" required="no" type="any" default="0">
<!--- <cfargument name="totalSalesandTax" required="no" type="any" default="0.00"/> --->
<cfargument name="salesTaxadjustment" required="no" type="any" default="0.00">
<cfargument name="salesTax" required="no" type="any" default="0.00">
<cfargument name="totalSales" required="no" type="any" default="0.00">
<cfargument name="taxExemptSales" required="no" type="any" default="0.00">
<!--- <cfargument name="commercialGoods" required="no" type="any" default="0.00"/> --->
<cfargument name="changeStock" required="no" type="any" default="0.00">
<cfargument name="overshort" required="no" type="any" default="0.00">
<!--- local empty variables --->
<cfset var PutRegSalesInfo ="">
<cfset var PutRegisterBalanceDetail ="">
<cfset var PutSalesCategories ="">
<cfset var PutCCDetail ="">
<!--- Strip commas and dollar signs from the argument --->
<cfset OverShort = ReplaceNoCase(ReplaceNoCase(Arguments.overshort,',','','ALL'),'$','','ALL')>
<cfset ActualCashMinusChangeStock = ReplaceNoCase(ReplaceNoCase(Arguments.ActualCashMinusChangeStock,',','','ALL'),'$','','ALL')>
<cfset cashTotal = ReplaceNoCase(ReplaceNoCase(Arguments.cashTotal,',','','ALL'),'$','','ALL')>
<cfset totalSales = ReplaceNoCase(ReplaceNoCase(Arguments.totalSales,',','','ALL'),'$','','ALL')>
<cfset ExpectedCashFromDrawer = ReplaceNoCase(ReplaceNoCase(Arguments.ExpectedCashFromDrawer,',','','ALL'),'$','','ALL')>
<cftry>
<cftransaction>
<cfquery name="PutRegSalesInfo" datasource="#application.dsn.name#">
INSERT INTO Data_Org_Location_Register_Totals
(
nOrganizationID
,nLocationID
,nRegisterNumber
,cCashierFirstName
,cCashierLastName
,dTotalActualCash
,dTotalActualCashLessChangeStock
,nCountCreditCardTransactions
,dTotalCreditCards
,nCountChecks
,dTotalChecks
,nCountEChecks
,dTotalEChecks
,nCountCreditIssued
,dTotalCreditIssued
,nCountCreditRedeemed
,dTotalCreditRedeemed
,nCountGiftCertIssued
,dTotalGiftCertIssued
,nCountGiftCertRedeemed
,dTotalGiftCertRedeemed
,nCountGiftCardIssued
,dTotalGiftCardIssued
,nCountGiftCardRedeemed
,dTotalGiftCardRedeemed
,nCountVouchers
,dTotalVouchers
,nCountCashDonations
,dTotalCashDonations
,dTotalTaxExemptSales
,nCountTransactions
,dTotalSales
,dSalesTax
,dSalesTaxAdjustment
,tEffectiveDate
,nAvailable
,tCreationDate
,nActive
,tLastUpdate
,cChangedBy
)
VALUES(
<cfqueryparam cfsqltype="cf_sql_integer" value="#Arguments.OrgID#"/>,
<cfqueryparam cfsqltype="cf_sql_integer" value="#Arguments.LocID#"/>,
<cfqueryparam cfsqltype="cf_sql_integer" value="#Arguments.RegNum#"/>,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Arguments.firstName#"/>,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Arguments.LastName#"/>,
<cfqueryparam cfsqltype="cf_sql_decimal" value="#DecimalFormat(cashTotal)#"/>,
<cfqueryparam cfsqltype="cf_sql_decimal" value="#DecimalFormat(ActualCashMinusChangeStock)#"/>,
<cfqueryparam cfsqltype="cf_sql_integer" value="#Arguments.ccCountTotal#"/>,
<cfqueryparam cfsqltype="cf_sql_decimal" value="#DecimalFormat(Arguments.ccAmtTotal)#"/>,
<cfqueryparam cfsqltype="cf_sql_integer" value="#Arguments.CheckCount#"/>,
<cfqueryparam cfsqltype="cf_sql_decimal" value="#DecimalFormat(Arguments.CheckAmount)#">,
<cfqueryparam cfsqltype="cf_sql_integer" value="#Arguments.eChecksCount#"/>,
<cfqueryparam cfsqltype="cf_sql_decimal" value="#DecimalFormat(Arguments.eChecksAmount)#"/>,
<cfqueryparam cfsqltype="cf_sql_integer" value="#Arguments.CreditIssuedCount#"/>,
<cfqueryparam cfsqltype="cf_sql_decimal" value="#DecimalFormat(Arguments.CreditIssuedAmount)#"/>,
<cfqueryparam cfsqltype="cf_sql_integer" value="#Arguments.CreditRedeemedCount#"/>,
<cfqueryparam cfsqltype="cf_sql_decimal" value="#DecimalFormat(Arguments.CreditRedeemedAmount)#"/>,
<cfqueryparam cfsqltype="cf_sql_integer" value="#Arguments.GiftCertIssuedCount#"/>,
<cfqueryparam cfsqltype="cf_sql_decimal" value="#DecimalFormat(Arguments.GiftCertIssuedAmount)#"/>,
<cfqueryparam cfsqltype="cf_sql_integer" value="#Arguments.GiftCertRedeemedCount#"/>,
<cfqueryparam cfsqltype="cf_sql_decimal" value="#DecimalFormat(Arguments.GiftCertRedeemedAmount)#"/>,
<cfqueryparam cfsqltype="cf_sql_integer" value="#Arguments.GiftCardIssuedCount#"/>,
<cfqueryparam cfsqltype="cf_sql_decimal" value="#DecimalFormat(Arguments.GiftCardIssuedAmount)#"/>,
<cfqueryparam cfsqltype="cf_sql_integer" value="#Arguments.GiftCardRedeemedCount#"/>,
<cfqueryparam cfsqltype="cf_sql_decimal" value="#DecimalFormat(Arguments.GiftCardRedeemedAmount)#"/>,
<cfqueryparam cfsqltype="cf_sql_integer" value="#Arguments.VouchersCount#"/>,
<cfqueryparam cfsqltype="cf_sql_decimal" value="#DecimalFormat(Arguments.VouchersAmount)#"/>,
<cfqueryparam cfsqltype="cf_sql_integer" value="#Arguments.CashDonationsCount#"/>,
<cfqueryparam cfsqltype="cf_sql_decimal" value="#DecimalFormat(Arguments.CashDonationsAmount)#"/>,
<cfqueryparam cfsqltype="cf_sql_decimal" value="#DecimalFormat(Arguments.taxExemptSales)#"/>,
<cfqueryparam cfsqltype="cf_sql_integer" value="#Arguments.Transactions#"/>,
<cfqueryparam cfsqltype="cf_sql_decimal" value="#DecimalFormat(totalSales)#"/>,
<cfqueryparam cfsqltype="cf_sql_decimal" value="#DecimalFormat(Arguments.salesTax)#"/>,
<cfqueryparam cfsqltype="cf_sql_decimal" value="#DecimalFormat(Arguments.salesTaxadjustment)#"/>,
<cfqueryparam cfsqltype="cf_sql_date" value="#DateFormat(CreateODBCDateTime(Arguments.effectiveDate), 'dd/mm/yyyy')#"/>,
<cfqueryparam cfsqltype="cf_sql_integer" value="#val(1)#"/>,
GetDate(),
<cfqueryparam cfsqltype="cf_sql_integer" value="#val(1)#"/>,
GetDate(),
<cfqueryparam cfsqltype="cf_sql_integer" value="#Arguments.userID#"/>
)
SELECT SCOPE_IDENTITY() AS New_PutRegSalesInfo_ID
</cfquery>
<!--- Create random unique Ref number (dont know why this is needed if there is a PK)--->
<cfset local.random_part = Randomize(PutRegSalesInfo.New_PutRegSalesInfo_ID, "SHA1PRNG")>
<cfset local.UserRefToHash = Now() & "ref" & PutRegSalesInfo.New_PutRegSalesInfo_ID & ":" & local.random_part>
<cfset local.NewSalesInfoRefID = Hash(local.UserRefToHash, 'sha-256', 'iso-8859-1')>
<cfquery datasource="#application.dsn.name#" name="UpdateRegisterTotalsRef">
update Data_Org_Location_Register_Totals
set cRegisterTotalsRefID = <cfqueryparam cfsqltype="cf_sql_varchar" value="#local.NewSalesInfoRefID#"/>
where nID = <cfqueryparam cfsqltype="cf_sql_integer" value="#PutRegSalesInfo.New_PutRegSalesInfo_ID#"/>
</cfquery>
<cfquery datasource="#application.dsn.name#" name="PutRegisterBalanceDetail">
Insert into Data_Org_Location_Register_BalanceDetail (
nRegisterTotalsID,
nOrganizationID,
nLocationID,
dExpectedCashFromRegister,
dCashAdjustments,
dAdjustedExpectedCashFromRegister,
dChangeStock,
dOverShort,
tCreationDate,
nActive,
tLastUpdate,
cChangedBy
)
values (
<cfqueryparam cfsqltype="cf_sql_integer" value="#PutRegSalesInfo.New_PutRegSalesInfo_ID#"/>,
<cfqueryparam cfsqltype="cf_sql_integer" value="#Arguments.OrgID#"/>,
<cfqueryparam cfsqltype="cf_sql_integer" value="#Arguments.LocID#"/>,
<cfqueryparam cfsqltype="cf_sql_decimal" value="#DecimalFormat(Arguments.ExpectedCashFromRegister)#"/>,
<cfqueryparam cfsqltype="cf_sql_decimal" value="#Arguments.CashAdjust#"/>,
<cfqueryparam cfsqltype="cf_sql_decimal" value="#DecimalFormat(ExpectedCashFromDrawer)#"/>,
<cfqueryparam cfsqltype="cf_sql_decimal" value="#DecimalFormat(Arguments.ChangeStock)#"/>,
<cfqueryparam cfsqltype="cf_sql_decimal" value="#DecimalFormat(OverShort)#"/>,
GetDate(),
<cfqueryparam cfsqltype="cf_sql_integer" value="#val(1)#"/>,
GetDate(),
<cfqueryparam cfsqltype="cf_sql_integer" value="#Arguments.UserID#"/>
)
</cfquery>
<!--- Get the number of CategoryIDs from the list then loop that many times--->
<cfloop index="i" from="1" to="#ListLen(Arguments.CategoryList)#"><!--- loop through the category form fields --->
<cfquery name="PutSalesCategories" datasource="#application.dsn.name#">
INSERT INTO Data_Org_Location_Register_CategorySales
(nOrganizationID
,nLocationID
,nRegisterTotalsID
,nOrgCategoryID
,nCount
,dAmount
,dAdjustment
,dTotal
,nAvailable
,tCreationDate
,nActive
,tLastUpdate
,cChangedBy
)
VALUES(
<cfqueryparam cfsqltype="cf_sql_integer" value="#Arguments.OrgID#"/>,
<cfqueryparam cfsqltype="cf_sql_integer" value="#Arguments.LocID#"/>,
<cfqueryparam cfsqltype="cf_sql_integer" value="#PutRegSalesInfo.New_PutRegSalesInfo_ID#"/>,
<cfqueryparam cfsqltype="cf_sql_integer" value="#Arguments.categoryID[i]#"/>,
<cfqueryparam cfsqltype="cf_sql_integer" value="#Arguments.categoryCount[i]#"/>,
<cfqueryparam cfsqltype="cf_sql_decimal" value="#DecimalFormat(Arguments.Amount[i])#"/>,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Arguments.Adjustment[i]#"/>,
<cfqueryparam cfsqltype="cf_sql_decimal" value="#DecimalFormat(Arguments.total[i])#"/>,
<cfqueryparam cfsqltype="cf_sql_integer" value="#val(1)#"/>,
GetDate(),
<cfqueryparam cfsqltype="cf_sql_integer" value="#val(1)#"/>,
GetDate(),
<cfqueryparam cfsqltype="cf_sql_interger" value="#Arguments.UserID#"/>
)
</cfquery>
<cfset i = i + 1>
</cfloop>
<cfquery datasource="#application.dsn.name#" name="PutCCDetail">
INSERT INTO Data_Org_Location_Register_CreditCardDetail
(
nRegisterTotalsID
,nOrganizationID
,nLocationID
,nCountVisa
,dTotalVisa
,nCountMasterCard
,dTotalMasterCard
,nCountAmericanExpress
,dTotalAmericanExpress
,nCountDiscover
,dTotalDiscover
,nCountDebit
,dTotalDebit
,nAvailable
,tCreationDate
,nActive
,tLastUpdate
,cChangedBy
)
VALUES(
<cfqueryparam cfsqltype="cf_sql_integer" value="#PutRegSalesInfo.New_PutRegSalesInfo_ID#"/>,
<cfqueryparam cfsqltype="cf_sql_integer" value="#Arguments.OrgID#"/>,
<cfqueryparam cfsqltype="cf_sql_integer" value="#Arguments.LocID#"/>,
<cfqueryparam cfsqltype="cf_sql_integer" value="#Arguments.VisaCount#"/>,
<cfqueryparam cfsqltype="cf_sql_decimal" value="#DecimalFormat(Arguments.VisaAmount)#"/>,
<cfqueryparam cfsqltype="cf_sql_integer" value="#Arguments.MasterCardCount#"/>,
<cfqueryparam cfsqltype="cf_sql_decimal" value="#DecimalFormat(Arguments.MasterCardAmount)#"/>,
<cfqueryparam cfsqltype="cf_sql_integer" value="#Arguments.AmericanExpressCount#"/>,
<cfqueryparam cfsqltype="cf_sql_decimal" value="#DecimalFormat(Arguments.AmericanExpressAmount)#"/>,
<cfqueryparam cfsqltype="cf_sql_integer" value="#Arguments.DiscoverCount#"/>,
<cfqueryparam cfsqltype="cf_sql_decimal" value="#DecimalFormat(Arguments.DiscoverAmount)#"/>,
<cfqueryparam cfsqltype="cf_sql_integer" value="#Arguments.DebitCount#"/>,
<cfqueryparam cfsqltype="cf_sql_decimal" value="#DecimalFormat(Arguments.DebitAmount)#"/>,
<cfqueryparam cfsqltype="cf_sql_integer" value="#val(1)#"/>,
GetDate(),
<cfqueryparam cfsqltype="cf_sql_integer" value="#val(1)#"/>,
GetDate(),
<cfqueryparam cfsqltype="cf_sql_interger" value="#Arguments.UserID#"/>
)
</cfquery>
</cftransaction>
<cfreturn true>
<cfcatch>
<cfinvoke method="errorHandler" argumentcollection="#ARGUMENTS#" />
</cfcatch>
</cftry>
</cffunction>
If your catch block is executed, there would be no return. Maybe you want to return false as the last line of your cfcatch. Otherwise put the cfreturn true as the last line of the function. Can you verify that catch block is not being executed?