473,473 Members | 1,604 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to obtain previous charge

2 New Member
All,
I have the following two tables:
billConDetail(Bill Consultant Detail) and billInvMaster (Bill Invoice Master)
Bill Consultant Detail have the following fields:
(InvoiceID, Project,Task,SubTask,Vendor,FromDate,ToDate)
Bill Consultant Detail have the following fields:
(InvoiceID,Project,Task,SubTask,Vendor,Amount)
I have want to produce a report that have the following columns:
Input Parameters(Project,FromDate,ToDate)
Task
[Vendor] [Current Charge] [Previous
Charge] [Charges to Date]
---------------------------------------------------------------------------------------------------------------------------
To get the Current charge, and Charges to Date was straight forward for me. However, my mind stop working when I try to obtain the previous Charge column.
Can someone please help me out with this.
Input parameters:
Project = 1, FromDate = 05/01/2006, ToDate = 05/31/2006
---------------------------------------------------------------------------------------------------------------------------

Given the above input, and the bellow Sample Data; My question is how do I know that my previous amount was 200, and not 300.
Also from my sample data bellow I only have one task, but in the real table I can have multiple tasks for a given project. For a selected period, if we happen didn’t invoice the client for a certain task(s), because there was no activity for that task(s) I need to also able to display previous charge as 0.
---------------------------------------------------------------------------------------------------------------------------

Sample Data:
Invoice Project Task SubTask FromDate ToDate
---------------------------------------------------------------------------------------------------------------------------

[AAAB1] [1] [1] [0] [05/01/2006] [05/31/2006]
[AACD2] [1] [1] [0] [04/01/2006] [04/30/2006]
[AAMZ3] [1] [1] [0] [03/01/2006] [03/31/2006]
---------------------------------------------------------------------------------------------------------------------------

Invoice Project Task SubTask Vendor Amount
---------------------------------------------------------------------------------------------------------------------------

[AAAB1] [1] [1] [0] [A] [100]
[AACD2] [1] [1] [0] [A] [200]
[AAMZ3] [1] [1] [0] [A] [300]
Nov 12 '07 #1
3 1440
iburyak
1,017 Recognized Expert Top Contributor
Try using this structure:

Expand|Select|Wrap|Line Numbers
  1. Select top 1 …. List of columns here
  2. From table1
  3. Join table2 on table1.Invoice = table2.Invoice
  4. Where ToDate < @FromeDate 
  5. Order by ToDate Asc
Good Luck.
Nov 13 '07 #2
dnguyen77
2 New Member
Hi,

Yes your suggested method would work, if I only have one task in a record. In my case a project can have one or more tasks & sub tasks.

Thanks,
AN
Nov 13 '07 #3
iburyak
1,017 Recognized Expert Top Contributor
It would be a good idea to provide more Sample data and desired result.

In a meanwhile try this:
Expand|Select|Wrap|Line Numbers
  1. Select top 1 .....
  2. from billConDetail a
  3. join billInvMaster b on a.invoice = b.invoice and a.Project = b.Project and a.Task = b.Task and a.SubTask = b.SubTask
  4. where a.Project = @Project 
  5. ToDate < @FromeDate 
  6. Order by ToDate Asc
Good Luck.
Nov 13 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Daniel Heiserer | last post by:
Hi, I got the following compiling/linking error, but I have no clue what it is about. Can anybody help me? thanks, daniel
7
by: Dario Kampkaspar | last post by:
Hi, need your help again. Compiling a code gives me the following: home/phlox/sources/msw/server/einspieler.cc:430: undefined reference to `ObjektFehler::~ObjektFehler ()'...
3
by: el_roachmeister | last post by:
Is it customary to charge a flat price for a script for a client? What about fixing bugs, would I be responsible for that assuming the client has no knowledge of php? Do I include it in the price...
3
by: Philipp Schumann | last post by:
Hi, I have several nested layers of <node> element that are processed by an XSLT template. Is there any possibility to determine the depth of a node in the overall nesting hierarchy? For...
2
by: Charles Rouse | last post by:
How can I automatically add a weekly charge of $2.00 for each client in drug treatment? I have a "financial" table linked with the client table with 4 fields: clientID, date, charge, paid. Every...
4
by: RC | last post by:
I just got my first Access project that I am getting paid for. I have done other Access work for non-profits that I did not get paid for. I definitely have the work but we did not settle the...
2
by: vermilk | last post by:
I am considering creating an Access db application for a nearby company and I'm not sure how to charge them. Should I go by the hour or flat charge? If by the hour, how much would be reasonable? ...
1
by: dfetrow410 | last post by:
A local community collage called me to teach 2 1 1/2 hour classes on Basic .net ideas. I am not sure what to charge. Anyone have experience in this? Dave
7
by: dmitrey | last post by:
Hi all, I guess this question was asked many times before, but I don't know keywords for web search. Thank you in advance, D.
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.