473,608 Members | 2,412 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

# of billing cycles

ML
hello

i need to write an sql which calculates # of billing cycles for an
order for which ive order start and end date. the first invoice will
be cut on the order start date. Also if i apply a coupon for lets say
one month (30 days) to that order i need to calculate how many billing
cycles that coupon will apply to.
ive start and end date of coupon ina diff table for that order

for eg: if an order was started on 1/15 and ended on 4/14 i have 3
billing cycles (the invoice was suppose to cut on. 1/15 , 2/15 and
3/15)
lets say on 3/15 if a users applied one month coupon which means he
didnt have to pay for billing cycle 3/15.

can someone help me with this logic

thank u
ml
Jul 20 '05 #1
1 2366
ML (mi*********@ya hoo.com) writes:
i need to write an sql which calculates # of billing cycles for an
order for which ive order start and end date. the first invoice will
be cut on the order start date. Also if i apply a coupon for lets say
one month (30 days) to that order i need to calculate how many billing
cycles that coupon will apply to.
ive start and end date of coupon ina diff table for that order

for eg: if an order was started on 1/15 and ended on 4/14 i have 3
billing cycles (the invoice was suppose to cut on. 1/15 , 2/15 and
3/15)
lets say on 3/15 if a users applied one month coupon which means he
didnt have to pay for billing cycle 3/15.

can someone help me with this logic


A general advice for this sort of questions is that you include:

o CREATE TABLE statements for the involved tables (simplified to
encompass the problem).
o INSERT statements with sample data.
o The desired output from that sample.

There is a little too much depending on how data is stored, to really
encourage me to just make up something, as may not be suitable at all.

--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
12990
by: Scott | last post by:
Not sure if this is the right place to post this or not, but I am in the process of trying to find a Web Hosting/Isp Billing system that is reasonable in price and uses Access or SQL Server for a backend DB. I have found a couple that seem to do what I want, but are using FILEMAKER for their DB. Looking for something that will handle reoccuring billing as well as per project billing. Keeping up with client info, etc.... Also needs to...
18
12796
by: Jeremy Weiss | last post by:
I'm trying to build a database that will handle the monthly billing needs of a small company. I'm charting everything out and here's what I see: table for customers sub table to track payments received. No biggie, right? Well, here's my problem. I don't know how to tell access to modify everyone's account balance each month. And I can't just always assume that their monthly bill is $16 just because their balance is $16. If I do that...
7
2574
by: Lalasa | last post by:
Hi, Can anybody tell me how many cpu cycles File.copy would take and how many cpu cycles File.Move would take? CFile::Rename in C++ takes just one cpu cycle. As there is no File.Rename in C#, I am worried about using File.copy or File.Move which would do the same job of renaming a file but I want it done in just one cpu cycle.
0
1430
by: job kazan | last post by:
Can anyone suggest the best and easiest platform for the following job, possible freelancer and approximate budget for this: "It must be a script that has as an input a long code from the "calling scratch card" that customers enters on our website. Script accepts the long code, validates it with a database, than offers a customer to create a login/pass to enter
0
8067
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8501
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8483
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8349
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6820
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5479
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4030
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2477
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1607
muto222
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.