Friday, May 31, 2013

5/31/2013

Select * from subquery

SELECT t.*, a+b AS total_sum FROM(SELECT SUM(column1)AS a, SUM(column2)AS b FROMtable) t

update cust
set CUSTSALESGRADE = SALESGRADE,CUSTGPGRADE=GPGRADE
from
(select INV_CUSTID,
      (CASE
            WHEN SUM(INV_SUBTOTAL)  < 5000                   THEN 'F'
            WHEN SUM(INV_SUBTOTAL) BETWEEN 5000 AND 15000    THEN 'E'
            WHEN SUM(INV_SUBTOTAL) BETWEEN 15000  AND 50000  THEN 'D'
            WHEN SUM(INV_SUBTOTAL) BETWEEN 50000  AND 100000 THEN 'C'
            WHEN SUM(INV_SUBTOTAL) BETWEEN 100000 AND 200000 THEN 'B'
            WHEN SUM(INV_SUBTOTAL) > 200000 THEN 'A'
      END) SALESGRADE,  
      (CASE
            WHEN SUM(INV_SUBTOTAL)-SUM(INV_COST)  < 5000                   THEN 'F'
            WHEN SUM(INV_SUBTOTAL)-SUM(INV_COST) BETWEEN 5000 AND 15000    THEN 'E'
            WHEN SUM(INV_SUBTOTAL)-SUM(INV_COST) BETWEEN 15000  AND 50000  THEN 'D'
            WHEN SUM(INV_SUBTOTAL)-SUM(INV_COST) BETWEEN 50000  AND 100000 THEN 'C'
            WHEN SUM(INV_SUBTOTAL)-SUM(INV_COST) BETWEEN 100000 AND 200000 THEN 'B'
            WHEN SUM(INV_SUBTOTAL)-SUM(INV_COST) > 200000 THEN 'A'
      END)  as GPGRADE
      from INV
      where INV_DATE>DATEADD(year,-1,(dateadd(month, datediff(month, -1, getdate()) - 1, -1) + 1))
      GROUP BY INV_CUSTID) sales
 inner join cust on sales.inv_custid = custid

Wednesday, May 29, 2013

5/29/2013

Add a Clone Function to an existing class

Public Class Person
    Public FirstName As String
    Public LastName As String

    Public Function Clone() As Person
        Return DirectCast(Me.MemberwiseClone(), Person)
    End Function
End Class

' Make a Person.
Dim per1 As New Person
per1.FirstName = txtFirstName.Text
per1.LastName = txtLastName.Text

' Clone.
Dim per2 As Person = per1.Clone()

' Display the new person.
lblFirstName.Text = per2.FirstName
lblLastName.Text = per2.LastName

 

 

Sunday, May 26, 2013

5/27/2013

Sort Array of Object

  Class CompareEmployeeID : Implements IComparer

        Public Function Compare(ByVal x As Object, ByVal y As Object) As Integer Implements System.Collections.IComparer.Compare

            Dim xEmployee As Employee = DirectCast(x, Employee)

            Dim yEmployee As Employee = DirectCast(y, Employee)

            Return New CaseInsensitiveComparer().Compare(xEmployee.SSNumber, yEmployee.SSNumber)

        End Function

    End Class

 

Dim objEmployeeArray() = objEmployeeList.ToArray 

Array.Sort(objEmployeeArray, New CompareEmployeeID)

5/26/2013

Scion TC Shift Knobs

http://www.ebay.com/itm/RED-FLAME-SHIFT-KNOB-FOR-MANUAL-SHORT-THROW-GEAR-SHIFTER-SELECTOR-M12X1-25-/200827986996?pt=Motors_Car_Truck_Parts_Accessories&fits=Year%3A2009%7CMake%3AScion%7CModel%3AtC%7CSubmodel%3ABase%7CEngine+-+Liter_Display%3A2.4L&hash=item2ec247e434&vxp=mtr

http://www.ebay.com/itm/NEW-IN-BOX-SKUNK2-WEIGHTED-BILLET-GEAR-SHIFT-KNOB-GEARKNOB-5-SPEED-M12-X-1-25-/321107517809?pt=Motors_Car_Truck_Parts_Accessories&hash=item4ac37fe171&vxp=mtr

http://www.ebay.com/itm/BLOX-RACING-490-SHIFT-KNOB-LIMITED-GOLD-SUBARU-TOYOTA-12X1-25MM-1-STOCK-NOW-/290883632134?pt=Motors_Car_Truck_Parts_Accessories&hash=item43ba03fc06&vxp=mtr

http://www.ebay.com/itm/Blox-Limited-490-Spherical-Shift-Knob-Gold-Subaru-WRX-/350472176556?pt=Motors_Car_Truck_Parts_Accessories&hash=item5199c503ac&vxp=mtr

http://www.vexmotorsports.com/Blox-Racing--Limited-Series-490-Shift-Knob--Electric-Blue--12x125mm_p_5855.html

http://www.vexmotorsports.com/search.asp?keyword=knob+12x1.25mm&search=GO

Wednesday, May 22, 2013

5/22/2013

A prenuptial agreement, antenuptial agreement, or premarital agreement, commonly abbreviated to prenup or prenupt, is a contract entered into prior to marriage, civil union or any other agreement prior to the main agreement by the people intending to marry or contract with each other. The content of a prenuptial agreement can vary widely, but commonly includes provisions for division of property and spousal support in the event of divorce or breakup of marriage. They may also include terms for the forfeiture of assets as a result of divorce on the grounds of adultery; further conditions of guardianship may be included as well.

 Why is the Government Buying Long-Term Bonds? http://www.dollarsandsense.org/archives/2011/0111reuss1.html

 The main way that the Fed influences interest rates is by buying and selling government bonds. It decides whether to increase or decrease interest rates depending on whether it aims to pump up or rein in overall demand for goods and services. When Fed policymakers decide that they want to raise interest rates, the Fed sells government bonds. This sale reduces the price of bonds and raises the interest rate on these bonds. (We can also think of this as the Fed reducing the money supply. This makes money less plentiful and drives up the price of borrowing.) When Fed policymakers decide they want to lower interest rates, the Fed buys government bonds. This purchase increases the price of bonds and lowers the interest rate on these bonds. (We can think of this as the Fed increasing the money supply, which makes money more plentiful and drives down the price of borrowing.)

 

Get Last Day of the Month:

DECLARE @dtDate as DATETIME
DECLARE @LastDay_AnyMonth as datetime
SET @dtDate = '04/01/2013'
set @LastDay_AnyMonth = (SELECT DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,@dtDate)+1,0)) )

select @LastDay_AnyMonth

Monday, May 20, 2013

5/20/2013

Stock Myth:

During the first week of May every year, the maxim, "Sell in May and Go Away," gets taken out, dusted off and powered up as a reason to sell stocks. The rhyme is more than just a catchy urban legend: June, July, August and September have historically been the weakest months of the year for the S&P 500 Index.

Sunday, May 19, 2013

5/19/2013

Select the higest total in each group.

SELECT MIN(x.id),  -- change to MAX if you want the highest

          x.customer,

          x.total

FROM PURCHASES x

JOIN (SELECT p.customer,

          MAX(total) AS max_total

          FROM PURCHASES p

          GROUP BY p.customer) y ON y.customer = x.customer

           AND y.max_total = x.total

GROUP BY x.customer, x.total

Friday, May 17, 2013

5/17/2013

a href adding target="_blank" will launch a new Tab.

 

 

Dim ds As New DataSet
Dim myURL As String = "http://api.zip-tax.com/request/v20?key=XXXXXX&postalcode=90265&state=CA&format=XML"
ds.ReadXml(myURL)

 

ZipCode by State:

0 = Connecticut (CT), Massachusetts (MA), Maine (ME), New Hampshire (NH), New Jersey (NJ), Puerto Rico (PR), Rhode Island (RI), Vermont (VT), Virgin Islands (VI)

1 = Delaware (DE), New York (NY), Pennsylvania (PA)

2 = District of Columbia (DC), Maryland (MD), North Carolina (NC), South Carolina (SC), Virginia (VA), West Virginia (WV)

3 = Alabama (AL), Florida (FL), Georgia (GA), Mississippi (MS), Tennessee (TN)

4 = Indiana (IN), Kentucky (KY), Michigan (MI), Ohio (OH)

5 = Iowa (IA), Minnesota (MN), Montana (MT), North Dakota (ND), South Dakota (SD), Wisconsin (WI)

6 = Illinois (IL), Kansas (KS), Missouri (MO), Nebraska (NE)

7 = Arkansas (AR), Louisiana (LA), Oklahoma (OK), Texas (TX)

8 = Arizona (AZ), Colorado (CO), Idaho (ID), New Mexico (NM), Nevada (NV), Utah (UT), Wyoming (WY)

9 = Alaska (AK), American Samoa (AS), California (CA), Guam (GU), Hawaii (HI), Oregon (OR), Washington (WA)

 

 

Wednesday, May 8, 2013

5/8/2013

Special dividends are one-time cash payouts to shareholders. Sometimes, when a company has extra cash on the books, rather than reinvest it back into the company, it will pay it out to shareholders on a one-off basis.

Special dividends are also known as one-time dividends. These payouts are made to shareholders and declared to be separate from regular dividends. They are typically one-off events and are thus not factored into a stock’s dividend yield.

 

 

 

Monday, May 6, 2013

5/6/2013

2013 Tax Reference Guide - http://www.jhannuities.com/media/usa/common/multimedia/pdf/TRGFLY.pdf

 The non-qualified annuity can avoid current tax on the investment gains if it is held in trust, or if it is acquired by an estate on the death of the owner. Non-qualified annuities held by charities--or those that originated before February 28, 1986--are not subject to capital gains taxes.

Wednesday, May 1, 2013

5/1/2013

Get Tax Juris Third Party

Zip-Tax http://www.zip-tax.com/pricing

Zip2Tax http://www.zip2tax.com/

Avalara http://www.avalara.com/products/avatax

USPS https://tools.usps.com/go/ZipLookupAction!input.action

 

The credit for child and dependent care expenses is a nonrefundable credit that allows taxpayers to reduce their tax liability by a percentage of their child and dependent care expenses.

The maximum expense amounts are $3,000 for one qualifying person and $6,000 for two or more qualifying persons.

The maximum credit rate is 35% of the taxpayer's expenses. A taxpayer must satisfy the five eligibility tests to qualify for the credit. The tests are the:

  • Qualifying person test
  • Earned income test
  • Work-related expense test
  • Joint return test
  • Provider identification test

The credit is calculated and reported on Form 2441.