.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Post New Web Links

Calculate remaining for every customer

Posted By:      Posted Date: October 16, 2010    Points: 0   Category :Sql Server
 

Hello

This code calculates remaining for  customer

declare @Sales table
(
	id int identity(1,1),
	Doc_type varchar(100),
	amount int
)	
insert into @Sales values ('Invoice',400),('payment',250), ('Invoice',100),('payment',150),('payment',50),('Invoice',150)


declare @TotalAmtPaid int = (select SUM(amount) from @Sales where Doc_type = 'payment')

select *,
case
	when RunningAmount <= @TotalAmtPaid 
                                     
                                            
                                        

View Complete Post


More Related Resource Links

Calculate distance, bearing and more between Latitude/Longitude points

  
This page presents a variety of calculations for latitude/longitude points, with the formulæ and code fragments for implementing them.

All these formulæ are for calculations on the basis of a spherical earth (ignoring ellipsoidal effects) - which is accurate enough* for most purposes. [In fact, the earth is very slightly ellipsoidal; using a spherical model gives errors typically up to 0.3% - see notes for further details].

How to calculate the distance between two points on the Earth

  
We offer many Global Database Products that you can use with the below formulas to calculate distances and many other uses. Not sure how to use distance calculations or global databases within your company? See our Global Database Examples for more information on how to use our data within your industry. Be sure to Download a Free Sample of one of our many Global Database Products.

Logic to calculate business hours

  

Hi All,

I have tried searching all over the web for this logic. Got many but half of them did not match what i was looking for and half were malfunctioning.

I want to calculate business working hours between 2 datetime, where in I should be able to set the working hours as well as weekends and holidays should not be calculated.

 

Please help me guys... It will be a great help... 


ASP.NET: Collect Customer Order Information on an Internet Site Using XML and Web Forms

  

XML has quickly become the new data structure standard for everything from database access to cross-platform computing. XML is typically considered to be a vehicle for data exchange, dynamic data presentation, and data storage. However, the potential of XML far surpasses those limited applications. This article examines one new use: the gathering of data across a number of forms in an ASP.NET Beta 1 framework application. The sample program is a Web app used for ordering pizza. It uses ASP and C# to gather order information and then stores it in XML. To build the application, several concepts are explained, including data collection, order persistence using cookies, grouping input forms, and formatting the data for display.

Jeff Jorczak

MSDN Magazine September 2001


Calculate Client Height in javascript

  
The article Calculate Client Height in javascript was added by amoljk2009 on Monday, May 31, 2010.

Hi, Following code will help the developer to calculate exact client height in all browsers.script language="javascript" type="text/javascript">var winW = 630, winH = 460;if (parseInt(navigator.appVersion)>3) {if (navigator.appName

Design for Easy Integration into Customer's Sites

  

This is my second ASP.net project, and I'm looking for suggestions or approaches rather than specifics, but here goes.

The project, once done, will provide a "portal" into a limited portion of the client's database.  All clients are using a SQL database, but various server software products are involved (MSSQL, MySQL, and others). 

My question, however, has more to do with the "look and feel" of the finished product.  We want to be able to integrate our 'portal' easily into the client's websites and have it look as seamless as possible.  Obviously, placements of logos, etc. -- but also colors, fonts, etc.

Client sites tend to be simplistic in design.  We envision the customer placing a link to our site from theirs, and our site will be running on IIS on their server.  At least that's the plan.

The goal right now would be to make as much of this "parameter driven" as possible, so that a lot of the install can be accomplished through some simple settings, isolated in one or two files such that at installation time we can tweak those settings and be up-and-running in a short period of time with a site that integrates reasonably well with the customer's. 

But I'm uncertain as to whether there is a better approach.  Obviously, we could try to redes

calculate fields in a list

  

hi..

how do I go about generating formulas for something like this.

I have a field( choice ) that has three choices (Low, Medium and High ). If I choose Low, I need to add 5 days to the current date( excluding weekends ) and place it in the Target date field, the same goes for Medium = 3 days( exclude weekends) , High = 1 day, exclude weekends.

 

 


KPI to calculate list item clicked most ?

  

Hello All:


Is there anyway where we can use KPI list to attach to a SharePoint list and indicates which item was clicked the most ? Or any other way to find out the best 5 links based on how many times they were accessed by a user?

 

Thanks in advance


SharePoint Developer

Video: The Access Show: Recap of the SharePoint Developer Conference and Customer Demos

  
Steve Greenberg and Ryan McMinn just came back from the SharePoint conference in Las Vegas where they launched Access Services and wanted to give you an update as well as introduce some customers that have been using the technical preview and building web databases. (Length: 9:08)

Customer Segmentation based on purchase behavior

  
Hi I am trying to use MS clustering algorithm to segment our customers, just based on customer purchase behavior, we have two tables:   --customer table create table dm_msdm.scmolstp_city_mcc_accounts( olst_txn_acct_nbr character varying(19) NOT NULL ); --customer purchase table create table dm_msdm.scmolstp_city_mcc_aggregated( olst_txn_acct_nbr character varying(19) NOT NULL, olst_mcc_code numeric(4,0), olst_mcc_count integer, olst_mcc_total_amt numeric(11,2));   I learned that the MS_Sequence_clustering algorithm can deal with nest table , but in my case the sequence of stores(olst_mcc_code) is not important, how can I do this.   SQL Server 2008 GUI does not allow us to choose the MS_sequence_clustering algorithm, but only the clustering algorithm, does it mean if we use nest tables then MS_sequence_clustering algorithm is automatically chosen?

Customer Segmentation based on purchase behavior

  
Hi I am trying to use MS clustering algorithm to segment our customers, just based on customer purchase behavior, we have two tables:   --customer table create table dm_msdm.scmolstp_city_mcc_accounts( olst_txn_acct_nbr character varying(19) NOT NULL ); --customer purchase table create table dm_msdm.scmolstp_city_mcc_aggregated( olst_txn_acct_nbr character varying(19) NOT NULL, olst_mcc_code numeric(4,0), olst_mcc_count integer, olst_mcc_total_amt numeric(11,2));   I learned that the MS_Sequence_clustering algorithm can deal with nest table , but in my case the sequence of stores(olst_mcc_code) is not important, how can I do this.   SQL Server 2008 GUI does not allow us to choose the MS_sequence_clustering algorithm, but only the clustering algorithm, does it mean if we use nest tables then MS_sequence_clustering algorithm is automatically chosen?

Selecting the correct auto-generated ID associated with a given customer

  
I have the following two tables (among many) in an OLTP database: TABLE NAME: BusinessEntity TABLE FIELDS: BusinessEntityID, int, IDENTITY(1,1), NOT NULL, PRIMARY KEY BusinessEntityType, nvarchar(10), NULL TABLE NAME: Person TABLE FIELDS: BusinessEntityID, int, NOT NULL, PRIMARY KEY, FOREIGN KEY to BusinessEntity.BusinessEntityID FirstName, nvarchar(30), NULL LastName, nvarchar(30), NULL There is a 1-to-1 Identifying Relationship between the BusinessEntity and Person tables. When a new customer needs to be added to the database, I execute the following T-SQL statement: INSERT INTO BusinessEntity (BusinessEntityType) VALUES (‘Customer’); What I don’t know how to do is retrieve the value of BusinessEntity.BusinessEntityID that was automatically assigned to the new customer so I can then append it to Person.BusinessEntityID. While I know I can execute: SELECT MAX (BusinessEntityID) FROM BusinessEntity; there is no guarantee that the BusinessEntityID will be the one associated with the new customer I just added because it is possible that other new customers can be added to the BusinessEntity table by other users during the interim period between the time I execute the previously mentioned INSERT command and then SELECT command. Any help/guidance in resolving this issue would be greatly appreciated.  Thanks.

Customer Activity Designer Problem - "Could not generate view for VisualBasicValue`1"

  
I'm reading Bruce Bukovics Pro WF4 book and in chapter 16 - Advanced Customer Activites, he details emulating a Sequence activity along with a custom designer. When I drop the custom activity into a new xaml activity, I'm getting all sorts of wierdness. The custom sequence activity has a condition property that determines whether to schedule each child activity contained within. Once I set a value in the ExpressionTextBox for the activity, Visual Studio starts showing in red "Could not generate view for VisualBasicValue`1" along with this error showing up in my error window: The activity 'VisualBasicValue<Boolean>' cannot be referenced by activity 'MySequence' because the latter is not in another activity's implementation.  An activity can only be referenced by the implementation of an activity which specifies that activity as a child or import.  Activity 'VisualBasicValue<Boolean>' is declared by activity 'MySequence'. Here is the source for the activity itself: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Activities; using System.ComponentModel; using System.Collections.ObjectModel; namespace ActivityLibrary { [Designer(typeof(ActivityLibrary.Design.MySequenceDesigner))] public sealed class MySequence : NativeActivity { [Browsable(false)] public Collection<Activity&

Content authoring by the customer...

  
Hey all,We've developed a multilingual ASP.NET MVC 2 website. From the main navigation, we have "Home", "Catalog", "Publications", "Contact", "About us", a typical small SMB website. The product catalog is based on a small DB (20 tables or so) via that is read through EDF. Nothing fancy, typical school example so to speak. The "publications" tab is a place where the customer wants to post his realisations, PDF docs, etc, however this is a page that the customer wants to maintain themself. Also the home page contains text that the customer wants to edit as well as parts of the contact page.The above sounds like I would have to look at a CMS (which I did, umbraco, orchard, etc) however, most CMS's take ownership of the site and than I have to re-implement the catalog that is now working smoothly within ASP.NET  MVC 2 concept. Alternativly I thought about Expression Web, but after a very brief trial I saw that expression web doesn't like the ASP.NET MVC structure, master pages and css stuff (unless some1 did get it to work?)So, does any1 have an idea here, any options I could do?thnx

Performance Problems with calculate member in a cube

  
Hi,  I'm having performance issue with calculated member (Running total) which is created on one dimension in the cube.  Cube is having three dimension Product Details(Product Model, Product Type) , Time(Year & Month) & Qty type(In Qty & Out qty). See below for details Dimtime Year (Values 2000 to 2020) Month DimProd Product No Product Type Product Group DimQty Type In Qty Out Qty Fact Table Product No Year Month Qty Type of Qty( In Qty or Out Qty ) My MDX query for calculated member is  CREATE MEMBER [Qty Type].[Qty Type].[All].[Total] as      SUM(NULL:[TimeDim].[Hierarchy].CurrentMember , ([Qty Type].[Qty Type].[In Qty], Measures.[Qty]) - ([Qty Type].[Qty Type].[Out Qty], Measures.[Qty])  The formula is --> Total = Previous Period Total Qty + Inqty - Out Qty   This works perfectly when i browse at higher level (Qty Type on Rows & Time On Columns),   but when  i browse the cube adding dimension Product Details( Product group or Product Type) to Drill-through the In Qty & Out Qty,  the query is running and after one hour also it's not finished. Can anyone help me to solve this or propose new structure to resolve this issue.   

Measure - New Customer Count

  
I need to create a measure which counts the number of new customers for each time period. My fact table contains the customer number and its easy to create a distinct count of customers per month/week/year. I'm thinking I need to obtain the first order date for the given customer and compare if the select period is within the time frame, then include or exclude.  

how i can calculate date difference in oracle

  
how i can calculate the date diff in Oracle 10g using pl sql developer 7thank you
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend