Am trying to do a Payroll Year-To-Date report. The report is showing everything except the expenses properly. The expense column can be a positive or negative cash value. The negative cash value can be for assorted deductions such as drug testing, tires that they have charged, etc. The positive cash value in the expence column would be for things like payroll adjustments where a price has increased, etc. The problem is, my DSum is not showing any 'negative' expenses like ($33.00) for a drug test, only the 'positive' ones like $14.23 for a job rate increase. The formula I am using is pulling from a query called ContractYTD and is as listed:
=DSum([curDeductAmt],'ContractYTD',"[strTKOwner]=Reports!ContractYTD.[strTKOwner] and [strDeductType]='Labor'"
Note: this is basically the same formula I am using for Health and Life, except the [strDeductType] value is either 'Health' or 'Life' based on which total I am looking for. Health and Life are working properly, but the values in them show as a positive number.
the text box I am using is formatted for currency.
the sql statement for the query is:
SELECT tblConpay.guidTKNO, tblDataTruckInfo.strTKOwner, tblConpay.datPayPeriod, tblConpay.guidDRID, tblDataDriver.strNAME, tblConpay.curHaul, tblConpay.guidPER, tblConpay.dblTicketQuan, tblConpay.curBroker, [dblTicketQuan]*[curHaul] AS gross, tblConpay.strDeductType, tblConpay.curDeductAmt, tblConpay.strDeductDesc
FROM tblDataTruckInfo INNER JOIN (tblDataDriver INNER JOIN tblConpay ON tblDataDriver.guidDRID = tblConpay.guidDRID) ON tblDataTruckInfo.guidTKNO = tblConpay.guidTKNO
ORDER BY tblConpay.guidTKNO, tblConpay.datPayPeriod;
all of the info is showing in the query, but when I go to see the report, it's not showing any data in that sum field if the value is a negative. I've never had this to come up before, so I am quite confused. The detail section is hidden, the subtotals by payperiod shows and the subtotals by truck owner shows.
The final report should look like this:
formula for Gross is =Sum([gross])
formula for Brokerage is =Sum([curBroker])
actual formula for health is =IIf(IsNull(DSum([curDeductAmt],'ContractYTD',"[strTKOwner]=Reports!ContractYTD.[strTKOwner] and [strDeductType]='Health'"
),0,Nz(DSum([curDeductAmt],'ContractYTD',"[strTKOwner]=Reports!ContractYTD.[strTKOwner] and [strDeductType]='Health'"
))
actual formula for life is =IIf(IsNull(DSum([curDeductAmt],'ContractYTD',"[strTKOwner]=Reports!ContractYTD.[strTKOwner] and [strDeductType]='Life'"
),0,Nz(DSum([curDeductAmt],'ContractYTD',"[strTKOwner]=Reports!ContractYTD.[strTKOwner] and [strDeductType]='Life'"
))
I have simplified the expense formula until I get it to working and then will add my IsNull and NZ to it
actual formula for net is =Sum([gross])-Sum([curBroker])- IIf(IsNull(DSum([curDeductAmt],'ContractYTD',"[strTKOwner]=Reports!ContractYTD.[strTKOwner] and [strDeductType]='Health'"
),0,Nz(DSum([curDeductAmt],'ContractYTD',"[strTKOwner]=Reports!ContractYTD.[strTKOwner] and [strDeductType]='Health'"
))
- IIf(IsNull(DSum([curDeductAmt],'ContractYTD',"[strTKOwner]=Reports!ContractYTD.[strTKOwner] and [strDeductType]='Life'"
),0,Nz(DSum([curDeductAmt],'ContractYTD',"[strTKOwner]=Reports!ContractYTD.[strTKOwner] and [strDeductType]='Life'"
))
+ expense
Everything is working properly except the expenses. I am trying to get this done in order to attach the report with our contractors 1099's at the end of the year so any advice would be appreciated.
Regina
=DSum([curDeductAmt],'ContractYTD',"[strTKOwner]=Reports!ContractYTD.[strTKOwner] and [strDeductType]='Labor'"
Note: this is basically the same formula I am using for Health and Life, except the [strDeductType] value is either 'Health' or 'Life' based on which total I am looking for. Health and Life are working properly, but the values in them show as a positive number.
the text box I am using is formatted for currency.
the sql statement for the query is:
SELECT tblConpay.guidTKNO, tblDataTruckInfo.strTKOwner, tblConpay.datPayPeriod, tblConpay.guidDRID, tblDataDriver.strNAME, tblConpay.curHaul, tblConpay.guidPER, tblConpay.dblTicketQuan, tblConpay.curBroker, [dblTicketQuan]*[curHaul] AS gross, tblConpay.strDeductType, tblConpay.curDeductAmt, tblConpay.strDeductDesc
FROM tblDataTruckInfo INNER JOIN (tblDataDriver INNER JOIN tblConpay ON tblDataDriver.guidDRID = tblConpay.guidDRID) ON tblDataTruckInfo.guidTKNO = tblConpay.guidTKNO
ORDER BY tblConpay.guidTKNO, tblConpay.datPayPeriod;
all of the info is showing in the query, but when I go to see the report, it's not showing any data in that sum field if the value is a negative. I've never had this to come up before, so I am quite confused. The detail section is hidden, the subtotals by payperiod shows and the subtotals by truck owner shows.
The final report should look like this:
Code:
truck owner 1 Payperiod 1
Gross Brokerage Health Life Expense Net
$2,000.00 $200.00 $150.00 $0.00 ($50.00) $1,600.00
truck owner 1 Payperiod 2
Gross Brokerage Health Life Expense Net
$3,000.00 $300.00 $0.00 $0.00 $15.00 $2,715.00
Grand Total Truck Owner 1
Gross Brokerage Health Life Expense Net
$5,000.00 $500.00 $150.00 $0.00 ($35.00) $4,315.00
Instead, it is looking like this:
truck owner 1 Payperiod 1
Gross Brokerage Health Life Expense Net
$2,000.00 $200.00 $150.00 $0.00 $0.00 $1,600.00
truck owner 1 Payperiod 2
Gross Brokerage Health Life Expense Net
$3,000.00 $300.00 $0.00 $0.00 $15.00 $2,715.00
Grand Total Truck Owner 1
Gross Brokerage Health Life Expense Net
$5,000.00 $500.00 $150.00 $0.00 $0.00 $4,315.00
formula for Gross is =Sum([gross])
formula for Brokerage is =Sum([curBroker])
actual formula for health is =IIf(IsNull(DSum([curDeductAmt],'ContractYTD',"[strTKOwner]=Reports!ContractYTD.[strTKOwner] and [strDeductType]='Health'"
actual formula for life is =IIf(IsNull(DSum([curDeductAmt],'ContractYTD',"[strTKOwner]=Reports!ContractYTD.[strTKOwner] and [strDeductType]='Life'"
I have simplified the expense formula until I get it to working and then will add my IsNull and NZ to it
actual formula for net is =Sum([gross])-Sum([curBroker])- IIf(IsNull(DSum([curDeductAmt],'ContractYTD',"[strTKOwner]=Reports!ContractYTD.[strTKOwner] and [strDeductType]='Health'"
- IIf(IsNull(DSum([curDeductAmt],'ContractYTD',"[strTKOwner]=Reports!ContractYTD.[strTKOwner] and [strDeductType]='Life'"
+ expense
Everything is working properly except the expenses. I am trying to get this done in order to attach the report with our contractors 1099's at the end of the year so any advice would be appreciated.
Regina