Group of discounts all

Hello,
could you help me with this query, i want to see all groups of discounts, not only  groups which are >0.
Thank you,
jonmar7
declare @cus as char(15)
set @cus= (select T9.cardcode from .[ocrd] T9 where T9.cardcode = N'[%0]')
SELECT     'Group' AS 'Type Discount',
            OSPG.CardCode + '  '+ OCRD.CardName + CHAR(13) + OCRD.Address + CHAR(13)+ OCRD.ZipCode + '  ' + OCRD.City + CHAR(13) + 'Phone : ' + isnull(OCRD.Phone1,' ') + CHAR(13) + 'Fax : ' + isnull(OCRD.Fax,' ') + CHAR(13)+ 'VAT N° : ' + OCRD.LicTradNum + CHAR(13) + 'Kreditlimit : ' + CAST(CEILING(OCRD.CreditLine) AS nvarchar(19)) + CHAR(13) + 'Payment Terms : ' + OCTG.PymntGroup AS 'Business Partner',
            '' AS itemnumber,
            OITB.ItmsGrpNam AS 'ItemName',
            OSPG.Discount AS Discount,
            0 as price,
            '' as Currency,
            null AS Fromdate,
            null AS Todate
FROM         OSPG INNER JOIN
                      OITB ON OSPG.ObjKey = OITB.ItmsGrpCod INNER JOIN
                      OCRD ON OSPG.CardCode = OCRD.CardCode INNER JOIN
                      OCTG ON OCRD.GroupNum = OCTG.GroupNum
where ospg.cardcode = @cus
UNION ALL
SELECT     'Item' AS 'Type Discount', d.CardCode + ' ' + d.CardName + CHAR(13) + d.Address + CHAR(13) + d.ZipCode + ' ' + d.City + CHAR(13)
                      + 'Phone : ' + isnull(d.Phone1,' ') + CHAR(13) + ' Fax : ' + isnull(d.Fax,' ') + CHAR(13) + ' VAT N  : ' + d.LicTradNum + CHAR(13)
                      + ' Kreditlimit : ' + CAST(CEILING(d.CreditLine) AS nvarchar(19)) + CHAR(13) + ' Payment Terms :' + e.PymntGroup AS ' Business Partner ',
                      a.ItemCode AS itemnumber, c.ItemName AS itemName, CASE WHEN a.expand = 'Y' THEN b.discount ELSE a.discount END AS Discount,
                      CASE WHEN a.expand = 'Y' THEN b.price ELSE a.Price END AS Expr1, b.Currency, b.FromDate, b.ToDate
FROM         OSPP a LEFT OUTER JOIN
                      SPP1 b ON a.ItemCode = b.ItemCode AND a.CardCode = b.CardCode INNER JOIN
                      OITM c ON a.ItemCode = c.ItemCode INNER JOIN
                      OCRD d ON d.CardCode = a.CardCode INNER JOIN
                      OCTG e ON e.GroupNum = d.GroupNum
WHERE     (b.ToDate IS NULL OR
                      b.ToDate >= GETDATE()) AND (a.CardCode = @cus)
order by ItemName

Hi,
Try:
declare @cus as char(15)
set @cus= (select T9.cardcode from dbo.ocrd T9 where T9.cardcode = N'[%0]')
SELECT 'Group' AS 'Type Discount',
OSPG.CardCode + ' '+ OCRD.CardName + CHAR(13) + OCRD.Address + CHAR(13)+ OCRD.ZipCode + ' ' + OCRD.City + CHAR(13) + 'Phone : ' + isnull(OCRD.Phone1,' ') + CHAR(13) + 'Fax : ' + isnull(OCRD.Fax,' ') + CHAR(13)+ 'VAT N° : ' + OCRD.LicTradNum + CHAR(13) + 'Kreditlimit : ' + CAST(CEILING(OCRD.CreditLine) AS nvarchar(19)) + CHAR(13) + 'Payment Terms : ' + OCTG.PymntGroup AS 'Business Partner',
'' AS itemnumber,
OITB.ItmsGrpNam AS 'ItemName',
OSPG.Discount AS Discount,
0 as price,
'' as Currency,
null AS Fromdate,
null AS Todate
FROM OSPG LEFT JOIN
OITB ON OSPG.ObjKey = OITB.ItmsGrpCod LEFT JOIN
OCRD ON OSPG.CardCode = OCRD.CardCode LEFT JOIN
OCTG ON OCRD.GroupNum = OCTG.GroupNum
where ospg.cardcode = @cus
UNION ALL
SELECT 'Item' AS 'Type Discount', d.CardCode + ' ' + d.CardName + CHAR(13) + d.Address + CHAR(13) + d.ZipCode + ' ' + d.City + CHAR(13)
+ 'Phone : ' + isnull(d.Phone1,' ') + CHAR(13) + ' Fax : ' + isnull(d.Fax,' ') + CHAR(13) + ' VAT N : ' + d.LicTradNum + CHAR(13)
+ ' Kreditlimit : ' + CAST(CEILING(d.CreditLine) AS nvarchar(19)) + CHAR(13) + ' Payment Terms :' + e.PymntGroup AS ' Business Partner ',
a.ItemCode AS itemnumber, c.ItemName AS itemName, CASE WHEN a.expand = 'Y' THEN b.discount ELSE a.discount END AS Discount,
CASE WHEN a.expand = 'Y' THEN b.price ELSE a.Price END AS Expr1, b.Currency, b.FromDate, b.ToDate
FROM OSPP a LEFT JOIN
SPP1 b ON a.ItemCode = b.ItemCode AND a.CardCode = b.CardCode AND  (b.ToDate IS NULL OR
b.ToDate >= GETDATE()) LEFT JOIN
OITM c ON a.ItemCode = c.ItemCode LEFT JOIN
OCRD d ON d.CardCode = a.CardCode LEFT JOIN
OCTG e ON e.GroupNum = d.GroupNum
WHERE (a.CardCode =@cus)
order by ItemName
Thanks,
Gordon

Similar Messages

  • How can I set up an SMS group so that all group members can dial a group number and have a text sent out to all members of the group

    How can I set up an SMS group so that all group members can dial a group number and have a text sent out to all members of the group
    This would be an SMS group similar to an email listserv but running on the SMS network
    I have seen private individuals offering this service
    It seems strange to me that no internet site like Apple, Yahoo or Google offers this as a free service much as the email group services are free services.
    Steve

    I think the app GroupMe might do what you want. You might also try contacting your carrier. My carrier offered some fancy group texting service for a while but they never really advertised it so, unless you asked, you never would have known. But, GroupMe is available in the app store. There are lots of other apps that also do group texting but it seems to be the one that gets recommended the most.

  • Cant join group calls at all

    Hello, i am not able to join a group call at all. Even if my friends try to add me to call, they said they are not able to. I use to be able to, but now i cant. I have googled and tried almost every solution.

    This is the message that i get in the chatbox. I cant even type in the group or anything, it is very annoying please help. I am also on windows 8.1 & the latest skype version
    Attachments:
    Skype issue.JPG ‏19 KB

  • A distribution group with "require all senders are authenticated" checked still receives external mail

    a distribution group with "require all senders are authenticated" checked still receives external mail.  this does not happen for any other DG i am aware of.  this also happens from multiple external senders.
    please assist.
    thanks

    Hi,
    From your description, I would like to verify if the problematic Distribution Group is a member of other distribution groups that don't check "require all senders are authenticated".
    What's more, please check if there is any difference between this problematic distribution group and other normal distribution groups.
    Hope this can be helpful to you.
    Best regards,
    Amy Wang
    TechNet Community Support

  • When I send email to a group, it shows all members addresses even though that option is turned off in the preferences.

    When I send email to a group, it shows all members addresses even though that option is turned off in the preferences. This just started happening on all my devices. I have the latest update instaled.

    That doesn't work on Mavericks. Follow Tuttle's advice.

  • Retrieving user detail, group name for all users

    Hi,
    How can I retrieve User name, email, authentication, user group name
    for all users using SDK.
    It is possible to create this report in webi or CR?
    Thank you for reply,
    Gregor

    Use the following code to retrieve this information:
    IInfoObjects users = oInfoStore.query("select * from ci_systemobjects where si_kind='user'");
    for (int i=0; i<users.size(); i++)
             IUser user = (IUser)users.get(i);
             // user.getTitle(); for user name
             // user.getFullName(); for user's full name
             //  user.getEmailAddress(); for user's email address
             //  for authentication type:
             IUserAliases alises = user.getAliases();
             for(int j=0; j<aliases.size();j++)
                       IUserAlias alias = alises.get(j);
                       // alias.getAuthentication() for authentication associated with this alias, since same user can have more than 1 authentication. e.g. Enterprise and Ldap.
             // for user group memberships:
             java.util.Set groups = user.getGroups();        
             // the groups Set object will contain SI_ID of all the user groups that this uses is member of. You need to query by the SI_ID of the usergroup to get the group names.
    //  e.g.
    //    oInfoStore.query("select si_id, si_name from ci_systemobjects where si_kind='usergroup' and si_id in (a,b,c....)");
    where a,b,c are the SI_IDs of the usergroups.
    To create a report based on the above fetched data, there are several methods such as:
    you can use Java resultset where in you create the report structure in designer and push the data at runtime using java result set objects. Another way is to push this info in Excel or Access and design your report based on that excel\access.

  • Caution: Mail group send shows all contacts!!!

    Beware: Behaviour change in the current version of Mail (OSX 10.9.2)
    Mail exposes smart group recipients to ALL other recipients. This has proved very embarrassing and rather unacceptable that this behaviour has changed.
    This in my opinion is one of the worst software errors APPLE has made in my 20 years usage as it has trashed the privacy of my group.

    I can't replicate what you are seeing.
    I start a new email, start to type the first letters of the group name (on the To: line) and the field populates with the group name only, no addressees are shown. (To, CC and BCC behave identically here). See below
    I get identical behaviour if I open Contacts, ctl-click on the group name and select 'Send Email' from the menu.
    In Mail>Preferences>Composing: how is this set?
    This behaviour predates 10.9 by some time, (at least for me)

  • Group pricing discount

    Hi team,
    We wanted to know if there is a way to group all the items of a same family together and make sure that discounts for the family are done in a global level rather than a plant level and maintain conditions for this
    Regards
    Nevin

    Hi Nevin ,
    If your objective is to group materials ( family ) and then apply certain discount , here is what I suggest :
    - Group the materials using material group - MATKL field available in mat master so that all material in that family can be grouped under one umbrella
    - Create access sequence where you use this as one of condition fields apart from other fields you might want to use
    - Create condition records based on this access and system will apply discount to all such material falling in that group 
    Thanks ,

  • Skype does not want to join group calls at all.

    Hello.I recently got this very unusual problem with Skype. While I was talking in a group conversation, my internet bugged out, and as a result, of course, it kicked me out of the call. Afterwards, the internet started working just fine,  but now it doesn't even let me call anyone, and I can't join group chats. When I call someone, it says that they were not called, or when I try to join a group call, it just stays silent for a couple of seconds, and kicks me out. My friends on the other side of the call say that I'm just ringing, but not joining the call.I have reinstalled Skype at least 5 times, restarted my computer, deleted Skype and reinstalled it yet again, and even got an error 3-4 times saying that the installation could not compelte correctly.I don't have a clue what the problem could be. And my headphones work just fine, so it can't be that. Any help would be appreciated.

     
    Yeah i'm with you there. plus, haven't you seen the new skype in web browser now. Its in a beta right now and probably going to be legit. First of all, Fix your program first. We don't need more pieces of useless **bleep** for skype. We just need it fixed. so stop sitting with your thumbs up your ass and actually make your program not a piece of **bleep**. Before skype was amazing bit now, like everything else microsoft has made, it went down fast. So please do us and yourself a favor fixed this bug already. 
    YoutubeEez wrote:
    Will you people at microsoft will ever bother to fix your program? It's passed enough time for a huge bug to be fixed. And don't give us crappy solutions like "HEY ERASE YOUR FULL SKYPE HISTORY INCLUDING CHAT AND CALLS, BUT YOU CAN MANUALLY GET IT BACK BECAUSE I TOLD YOU TO RENAME THE FOLDER SKYPE_OLD" which isn't a fix but a smelly workaround?
    D A M N, get to work, and instead of releasing 70540 new versions of it, just fix the current versions already.
    I have to bother everytime the call creator and kindly ask him to close the whole conversation for everyone and make a new one, otherwise I can't join back.
    Get to work and fix this.
     

  • AP Groups VLAN showing all SSIDs - Need help.....

    Hey everyone!
         I am hoping I can find some help with configuring the AP Groups VLAN feature on a WiSM + WCS ver 4.2 environment. I enabled and setup AP Groups VLAN for a campus type network acording to the guide here:
    http://www.cisco.com/en/US/tech/tk722/tk809/technologies_configuration_example09186a008073c723.shtml
    The issue I am having is that even though I enabled and setup the AP Group VLAN as well as assigned the interface / network the AP to the group, all the SSIDs still broadcast on that AP where I only want one SSID to be present. I am testing this in a building that is an extension of another and only have 1 AP thus far so I know I am not picking up the SSIDs from other APs. 
    Anyone have any suggestions or can help? I would greatly appreciate it.....
    Thank You!
    Ed

    Hi Ed,
    The feature you are looking for is called WLAN Override in 4.x release versions
    Enabling WLAN Override
    By default, access points transmit all defined WLANs on the controller. However, you can use the WLAN Override option to select which WLANs are transmitted and which ones are not on a per access point basis. For example, you can use WLAN override to control where in the network the guest WLAN is transmitted or you can use it to disable a specific WLAN in a certain area of the network.
    From this doc;
    http://www.cisco.com/en/US/docs/wireless/controller/4.0/configuration/guide/c40wlan.html#wp1114777
    Once you create a new WLAN, the WLAN > Edit page for the new WLAN appears. In this page you can define various parameters specific to this WLAN including General Policies, RADIUS Servers, Security Policies, and 802.1x Parameters.
    **Check Admin Status under General Policies to enable the WLAN. If you want the AP to broadcast the SSID in its beacon frames, check Broadcast SSID.
    Note: You can configure up to sixteen WLANs on the controller. The Cisco WLAN Solution can control up to sixteen WLANs for Lightweight APs. Each WLAN has a separate WLAN ID (1 through 16), a separate WLAN SSID (WLAN name), and can be assigned unique security policies. Lightweight APs broadcast all active Cisco WLAN Solution WLAN SSIDs and enforce the policies that you define for each WLAN.
    From this good doc;
    http://www.cisco.com/en/US/tech/tk722/tk809/technologies_configuration_example09186a0080665d18.shtml#c3
    Hope this helps!
    Rob

  • Sort by grouping whilst seeing ALL album art (list view)

    I recently bought all of the ABBA albums *The Albums (Bonus Track Version) [Remastered]* which unfortunately all have the same album name and the individual albums are denoted using grouping...
    Is there any way to view all the albums with their separate album covers in list view or am I going to have to edit the album info...?
    http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewAlbum?i=293980603&id=29398 0601&s=143444

    Bennal wrote:
    Two and a half years on, the album artist feature is still not supported by iPods? What the ****? Is this even on a 'todo' list at Apple?
    I'm really happy with iTunes, the album artist feature is a godsend, but seriously, why can't iPods support it?
    I quite agree... In the meantime you might find my previous post on Grouping Tracks Into Albums useful, it details workarounds for this and other quirks in the iTunes/iPod system.
    tt2

  • Tolerance Group--Cash discount Adjustment

    Dear All,
    Pleasse help me to understand the "Cash discnt adj.to" setting in the configuration for tolerance:
    I have the following setting:
    Amount per document                1,000,000,000,000.00
    Amount per open item account item      99999,999,999.00
    Cash discount per line item                       5.000 %
                  Amount      Percent   Cash discnt adj.to
    Revenue        20.00       2.0 %        10.00
    Expense        20.00       2.0 %        10.00
    I want to know the function of "Cash discnt adj.to"
    In my system I post a customer Invoice of Rs1000 Payterms have discount of 1%.The customer makes payment within due date.So ideally customer should pay 990.But in case of overpayment upto Rs 2 that is 992 the cash discount is adjusted and above that the payment diff account is hit (ZDI)
    The same is happening for underpayment.
    Can some one please help why system give 2 for adjustment where as I have mentioed 10.
    Regards
    Raju

    Dear Chetan,
    I have doubt only regarding the Cash disct Adjusmtment:
    My Setting is:
    Revenue 20.00 2.0 % 10.00
    Expense 20.00 2.0 % 10.00
    say For revenue:I understand that if there overpayment but what is role of cash discount Adjustment?
    You say:
    When clearing payments, any payment differences up to the amount specified are corrected with the cash discount posting as +long as the cash discount amount is large enough for the adjustment.--Cannoy understand when you say --as long as...adjustment.
    The value you specify in amount is used for differences that represent a gain.-I understand this
    Can you please expain with a simple scenario.
    Regards
    Raju

  • Today my pinned apps, tab groups and history ALL disappeared, and my settings were changed to "Clear history when Firefox closes." How can this happen!?

    I've had several pinned apps, tab groups etc that always reappeared when I closed and opened Firefox. I always had history stored without a problem.
    Today I opened Firefox, and my pinned apps, tab groups, and history were all gone, and the option to Clear history when Firefox closed was checked. I did NOT do that. How could that happen? I definitely need to avoid this happening again!!
    Please help! Thanks!

    If you didn't do that yourself and nobody else has used the computer then an extension may have made that change.
    I see in your list that you have some Norton extensions (toolbars) installed that could cause it, but others may do this as well.
    * [[Troubleshooting extensions and themes]]

  • Sync group down? All my agents from different locations offline in same time.

    Now is 2014-10-17, 10:22PM EST. Portal shows all my agents from 3 different locations offline. The last sync was done at around 8:30. I've confirmed my agents are online, and they can successfully ping service. Last nite was another nightmare, it look more
    than half an hour for a sync cycle. Went back to normal all the suddent at 4am early morning.
    What's going on?
    Thanks,
    Dan

    Hi,
    Thanks for your reply.
    The service went back to normal at 1AM EST. It was down for 4 hours 30mins. But the service interruption is just too sudden and frequence as I said it went down on Thursday (16th Oct)  night as well. 
    Here's my sync group info.
    Sync group ID : a0d2cc7b-3a3e-481f-a3b5-be26a373fd5a_Southeast Asia
    Region : Southeast Asia
    Date time of the issue : 17th OCT 8:30PM EST to 18th OCT 1:00AM EST
    Traing ID : No error found from logs since the sync group didn't work at all. It showed all of my agents offlined. And the sync group showed "Warning"
    Please let me know if you need additional info. Thanks.
    Dan

  • TS2755 Remove yourself from specific group message, not all group messages?

    How do you block or stop receiving a group message from a specific thread of people, without disabling all group messaging?  I got put on a thread of 10 people and can't stop receiving all the messages.  I'd still like to keep group messaging enabled though as there are other group messages I use. 
    Thanks

    As a recipient in the thread, you have no control about receiving messages. The person that starts the thread is the only one in control, as they add people to the post. You need to ask all of the people in the thread to delete the thread and use a different one, and ask the starter not to add you to a group message.

Maybe you are looking for

  • A network-related error has occurred where Connecting to Hive ODBC by Linked Server

    1) I have created Hive ODBC Driver (Succesfully Tested) 2) I have created Linked Server on SQL Server 2014 (Succesfully Tested) 3) SELECT * FROM OpenQuery([SQLHive], 'SELECT * FROM hivesampletable;') ERROR: OLE DB provider "SQLNCLI11" for linked serv

  • Output plsql variable to command window

    I am executing a PLSQL stored procedure from my java class. I want to know how to output a variable within the PLSQL to the command window? thanks

  • Cannot create file when trying to download

    Have an early 2006 iMac 17 inch with Intel chip running OSX 10-47 using Safari Quite suddenly, when I try to download anything (widgets, any applications etc) I now get the error message "Cannot create file" and am unable to download. Safari used to

  • Maintenance Window Question

    Hello Experts, i'm sorry if its been already answered, I have a question on MW. CollectionA---> has a MW set between 6PM - 6AM ( Monday - Sunday) ( which is set to ->This Schedule Applies to all deployments) CollectionA---> has another MW 8PM-10PM (

  • SOAP sender endpoint problem

    Hi all, I'm now fighting for quite a time with a SOAP sender channel. I generated a WSDL in the configuration. I used this wsdl in XMLSPY in order to send a request to XI. And I must confess that I'm totally confused with the URLs. Which one do I nee