ATG - Can an Order Level Discount be applied to Items? - atg

Consider I have two items in my cart 50 USD each , I also have a coupon '20 USD off 100'. when I apply this my cart will look like below (for simplicity and focus I am eliminating tax and shipping)
Item 1 50 X1 = 50
Item 2 50 X1 = 50
subtotal =100
discount (-)20
**Total 80
now I have multiple cases where I have to split this 20 USD to items so that returns at third party are easy , also in situations where the two items will be fulfilled by two independent vendors.
I understand that ATG's ReturnManager class provide wealth of methods to calculate returns and does consider all item shipping order discounts and taxes.
but is there a way I can split the order discount to items Out of the Box based on weighted average algorithm.
Thanks

The simplest way to do this would be, to do the splitting algorithm in a Order Pipeline Processor (custom processor) store the split Item Level Discount Shares in a ApportionmentInfo repository item. Whenever, a return occurs you need to access this repository item through the order and display it to the user.
Regards,
Gaurav E

You Can't
Basically OrderPricingEngine will set adjusment against OrderPriceInfo. you cant do apportionment that to item level because the trigger is on order.
Best practice is expose a reprice Order as service to thirdparty. Re run the calculation
and identify the return value. If you customize per promotion level it will open up pandora box of reprice order issue.

Related

Tableau Mixed Data

I've been tasked to set up a Tableau worksheet of counts of data (ultimately to create percentages) where the contrived incoming data looks like the following.
id fruit
1 apple
1 orange
1 lemon
2 apple
2 orange
3 apple
3 orange
4 lemon
4 orange
The worksheet needs to look something like the following:
Count of ids
2 Lemons
2 No lemons
I've only been using Tableau for about 4 hours, so is this doable? Can anyone point me in the right direction?
The data is coming in from a SQL Server database in a format that I can control if that helps contribute towards a solution.
Alex's solution based on sets are very good for this scenario, but I would like to show that LODs can be more flexible if you need to extend your solution to include more categories.
for the current scenario, create a calculation with below formula and create text table using COUNTD(Id)
{FIXED [Id]:IF MAX([Fruit]='lemon') THEN 'Lemon' ELSE 'No Lemon' END}
Now for the extension part, you are considering below list where you want to count IDs with Lemon, Apple and others. Since no double counting of Ids are allowed, categorization will follow the order. (This kind of precedence will be a headache without LODs)
Now you can change your calculation as below:
{FIXED [Id]:IF MAX([Fruit]='lemon') THEN 'Lemon'
ELSEIF MAX([Fruit]='apple') THEN 'Apple'
ELSE 'No Lemon or Apple' END}
Now your visualization automatically changes to include the new category. This can be extended for any number of fruits.
This is a good use for a set.
In the data pane on the left sidebar, right click on the Id field and create a set named "Ids that contain at least one lemon" (or use a shorter less precise name)
In the set definition dialog panel, define the set by choosing "Use all" from the General tab, and then on the Condition tab, define the condition by the formula max([Fruit]="lemon")
There are many ways to think of a set, but the most abstract is just as a mathematical set of Ids that satisfy the condition. Remember each Id has many data rows, so the condition is a function of many data rows and uses the aggregation function MAX(). For booleans, True is treated as greater than False, so MAX() will return True if at least one of the data rows satifies the condition. By contrast, MIN() is True only if ALL (non-null) data rows satisfy the condition.
Once you have a set that separates your ids into Lemon scented Ids and others, then you can use that set in many ways - in calculated fields, in filters, in combination with other sets to make new sets, and of course on shelves to make visualizations.
To get a result like your question seeks, you could put your new set on the Row shelf, and put CNTD(ID) on the text shelf or columns shelf. Make sure you understand why you need count distinct (CNTD) instead of SUM([Number of Records]) here.
BTW, the LOD calculation { fixed [Id] : max([Fruit]="lemon") } is effectively the same solution.

How To EXPRESSION with WHERE " count Orders WHERE customer = Mr. Smith "?

I am a beginner in iReport and I cant program Java so I hope you can give me an idea.
I've already managed to make a chart that displays how often all customers have ordered in february, march,... etc.
Thats how I did it:
In category expression I have: $F{Month}
In value expression I have : $F{count(Orders)}
But I want to display how often only one customer (for example customer a) has ordered in february, march,... etc.
I have the following values which i can use:
Month, Orders and Customers(here are all customer names saved)
-------//-----------UPDATE--------------//-----------------------------------
I want to display a chart which represents the total orders per month of a customer. But iam trying to display my 3 customers (my database has only 3) in only one chart (stacked).
For example(see picture above): I want to display the total orders from Customer A (yellow) in february. And I want to display the total orders from Customer B (blue) in february and the same for customer C.
The customers should be displayed stacked (3 in every month) and every customer should have a different color plus the total orders from every customer should be displayed ...like in picture above for example:
customer A(yellow) made 3 total orders in february, Customer B(blue) made 2 total orders in february, customer C..etc.
it is very important that every month displays 3 customers...stacked.
How do I do this?
I appreciate every idea.
From what I have understood from your question, you want to show a chart which represents the total orders per month of a customer.
You need not use stacked bar graph for this purpose.
You may want to use bar graph which would serve your purpose.
If you want to see the chart per customer, create one parameter $P{customer} and pass it into your query.
Refer document iReport-Ultimate-Guide-3 on how to create parameters and to use it in queries.
e.g:
select customer,month,count(orders)
from <your table>
where customer=$P{customer}
group by month
The above approach would work if you want to see the details for only one customer.
**Here is my solution after your update.**
From your update, it seems like you want to represent the total orders per month for all the customers.And you want to use stacked chart for the same.
Then what you have done is correct but have missed to add a field to your 'Series Expression'
Add your field customer to your series expression and this will resolve your problem i.e,
Series Expression : $F{customer}
Category expression : $F{Month}
Value expression : $F{count(Orders)}
This will display the chart in the format you have specified.
Create a paramter that takes your customer name $P{customerName}
and another takes month $P{month}
pass these two paramters to your sql like that
SELECT customer_name, order_count FROM customers
bla.. bla..
WHERE customer_name=$P{customerName} and month=$P{month}
then create a chart with only one serie to show one customer as one color. Not like yours with 3 colors.
Fell free to ask for more specific detail.

Paypal IPN using PHP to get customized Quantity and Amount

I have downloaded the sample paypal IPN script using php and customised with the email for the buyout option and it has also some hidden paramaters such as amount, quantity,return_url, notify_url like this. My main idea is to do the buyout option for the product purchase in my website.The current calculation for the product purchase is as follows:
Item Price:$20
Quantity :10
Total amount $200
I need the calculation to some different way as our site have some static set of quantities and prices, so our point of calculation is as follows:
Item Price:$20
Quantity :10
Total amount:$20
So, the total amount needs to be the same for the given number of quantities.The IPN configuration doesn't allow me to change the quantity field by this way, please suggest some ideas to overcome this issue.
The item price is price per item, the quantity is of course multiplied by the item price. Your second example should have $2 as the --Item-- price. If you want to sell "10 items for $20", I think you will need to make a new item for that combo and just but the actual quantity in a custom field.
If you want to use the same item and paypal's quantity field, I think you need to look into calculating a discount and making that part of the parameters (discount_amount_cart or discount_amount_X for item X I think).

Can I Move fields in a Crystal Report to another position when run?

I am generating an invoice for various clients. Some clients have a sales allowance. For those clients I want to display an extra sales allowance unit and total cost column.
If any maximum sales cost total is = 0 I want to move the fields to the left and display the sales allowance on the right side
When the client has sales allowance
------------------Headings extend all the way across the report-----------------------------
Description Qty UOW Client Unit Cost Client Cost Sales Unit Cost Sales Cost
============================================================================================
Something 5 Each $11.00 $55.00 $5.00 $25.00
More Stuff 2 Each $20.00 $40.00 $5.00 $10.00
============================================================================================
Totals $55.00 $35.00
When the client does not have sales allowance
------------------Headings extend all the way across the report-----------------------------
Description Qty UOW Client Unit Cost Client Cost
============================================================================================
Something 5 Each $11.00 $55.00
More Stuff 2 Each $20.00 $40.00
============================================================================================
Totals $95.00
The goal is to put this functionality into a single report rather than having to know which report to run for which client if and when they get a sales allowance.
I know we can supress fields and when I tried to incorporate that I got whitespace on either the right of middle depending on where I placed the fields and the result was not acceptable. Is there a way to move a field to a different LEFT position when conditions are met? This would be report wide, not evalutated on each detail record.
It would be easier if you create two header sections and two detail sections with the fields and headers that you want in each. Suppress the relevant header/detail section based on the presence of a value in the sales-allowance field (Isnull({table.sales_allowance}). If this can't be determined, use a parameter field to drive the suppression formulae.
** edit **
the report will have two header sections (HA & HB) and two detail sections (DA & DB). HA & DA work in combination, as do HB & DB. Use the 'A' set for customers with a sales allowance; use the 'B' set for customers without. Add the relevant fields to each section and header; space accordingly.
Set the suppression formula for HA & DA to:
//suppress section if there IS NOT a sales allowance
Not(Isnull({table.sales_allowance}))
Set the suppression formula for HB & DB to:
//suppress section if there IS a sales allowance
Isnull({table.sales_allowance})
You do NOT need to suppress any individual fields with this approach, thus eliminating the spacing issue.
** edit **
while crystal report objects do have X (left), Y (top), width, and height properties, only X and width support conditional formulae (CF). you could move a field by setting the conditional formula of a field's X property to another value.
this approach would be harder to maintain, however. each field's CF would need to 'remember' two positions: visible and hidden. moreover, if another field was added in the future, each 'moveable' field would need to be reviewed to ensure that the positioning in its CF is accurate.

Paypal Discount When purchasing two + items (not two instances of same object)

Paypal has listed out methods for discounts such as :
discount_amount
Optional
Discount amount associated with an item.
It must be less than the selling price of the item. If you specify discount_amount and discount_amount2 is not defined, then this flat amount is applied regardless of the quantity of items purchased.
Valid only for Buy Now and Add to Cart buttons.
discount_amount2
Optional
Discount amount associated with each additional quantity of the item.
It must be equal to or less than the selling price of the item. A discount_amount must also be specified as greater than or equal to 0 for discount_amount2 to take effect.
Valid only for Buy Now and Add to Cart buttons.
I understand that you can have a discount associated with the amount of the same object inside of the cart. I'm wondering if anyone knows a way or method to allow a discount to show up if you say add 3 items or 5 items. Basically the situation is users have the option of signing up for either 1-4 courses. If a user signs up for 1 normal price(lets say 30) occurs. If a second is added they would receive a 10 dollar discount on the tuition(50). Than if a third is added it would show up as the regular method (resulting in 90) However if a fourth is added it would be a charge of 3 courses plus 50. (95). Is there any solution to presenting this to paypal to update based on amount of items (each being different items[different course dates and names]) included in your cart?
If it's for the whole cart and not just the item use discount_amount_cart
Remember discount_amount_1 has to be less in value than amount_1