I am developing a billing application in which the user enters the product and quantity using text fields into a tableView. I want the tableView to generate the total cost(product price X quantity) and display it in a third column. I am having an entity class named Cart which contains fields for product and quantity and the method for finding the total cost resided in another class called CartManager.
You should take a look at the Bindings
Specifically, your Cart should contain a field DoubleProperty or IntegerProperty.
The code would look something like this:
DoubleProperty cost = new SimpleDoubleProperty();
cost.bind(quantity.multiply(price));
quantity and price should already be Double-/IntegerProperties if they are shown in the TableView. The cost should be shown in the TableView the same way as quantity and price.
Related
In Odoo 13 I have added a custom field to the product.template model that is displayed on order lines.
Some products will use the sliding price scale dependent on quantity.
I have created a pricelist in a different currency that refers to my base pricelist.
I am trying to include my custom field in the pricelist methods that retrieve the sliding scale price and/or the converted currency value.
I have looked at overriding various methods but have not been successful because it seems many of the base methods have the product price field hardcoded as the value to use.
AM I missing something simple? Is there an easier way of including my custom field, or would I have to override many methods to include my custom field?
I'm working on a shoe store. Each shoe has some a product attributes: the brand, size, model,...
However each shoe always only has 1 brand.
So i want to display the brand attribute beneath the product name in the product list.
I added a screenshot for more clarity. http://imgur.com/a/41HLS
You have the product name 'boots / enkellaarzen'.
Under that you have the brand name 'baci'. This name has to be dynamicly 'retrieved'.
Is this possible? If so, how do i do this?
Tldr: what is the shortcode to retrieve a product attribute in prestashop?
If it's a brand wouldn't it make more sense that the brand is manufacturer and not attribute?
You can set it in the product tab Associations at the bottom and display it in the template product-list.tpl with
{$product.manufacturer_name|escape:'htmlall':'utf8'}
The default List layout uses column headers with columns of data beneath them. This will not work for my report. I need to create an employee profile report that will return about 75 fields (job title, location, tax status, payroll deductions, etc.). This is a report that I want to be able to print on a single page for each employee. Using the The default List layout extends the data out in columns beyond the limits of a printed page, even in landscape.
How can I get my report to display in rows instead of columns, so that the field headers go from the top of the page to the bottom, with the data to the right of the headers. Even this will not be long enough to fit on a single page (that is easily readable), so I will need a second list to the right of the first. Like this:
Name: data Company: data
Location: data Employee Number: data
Job Title: data Date Hired: data
Thanks!
You can use a Repeater Table object to do what you want. This should be available in your toolbox. You group on the value you want to repeat on, likely an employee identifier in your case, and section on that value. That will produce one table per unique identifier value. In the table itself you can configure the number of rows and columns to fit the layout you want to produce and you are free to drag and drop objects from the model or query into the cells as needed.
I have two forms that are related and I would to combine them in a view control. Not that difficult. This is for a "1 to Many" type scenario.
Say I have a customer view with the columns customerID and Customer Name. Then I have a view showing the "many" documents that has the columns masterCustomerID, orderNumber, orderDate.
On the XPage I create a view control of the many documents and add the columns masterCustomerID, orderNumber, orderDate. Then I add a column in the front to do a DbLookup to pull in the actual name of the customer. Nothing too fancy really.
My question is, in this situation, where the lookup column is the FIRST column. What are the strategies to sort the view column by that column. By default it would sort by the Key Value in the order view which is likely different then the Name values.
I'm not averse to using repeat controls if that would be easier.
My first thought would be to employ TreeMaps somehow, but I don't know if that's practical in the event that there might be a LOT of documents. Maybe there's something I'm missing...
Any advice would be appreciated. Thanks
Use view with (Customer name, Customer ID) structure as main view. Then based on Customer ID populate other columns by lookup from view with structure (Customer ID, Order ID, Order date). Hence it is 1:N relationship, you can't use single view component, but two nested - repeat inside view column would do.
I hope you are aware of performance impact (orders looked up for every customer row), so don't try to show too many customers at once.
I'm starting to learn and practice some CoreData, with no programming experience.
After searching in Web, looking for Apple samples and reading some books, I´m still stucked in one point.
I have two entities (Expenses and Month) with reciprocal relationships called "monthsOfExpense" and "expensesOfmonth" and I'm showing in a tableView the expenses of a single month.
My problem is to insert new expenses and save them: I've a view to insert new expenses where the user can insert the name of Expense, the value and the months that expense is valid (associated with the monthsOfExpense relationship, i hope).
I'm ok saving the name and the value of Expense entity, taking the string and NSDecimal number from the textFields.
My problem is how to associate that expense to a particular or several months? How can I save a textField.text as a relationship, indicating to what month an Expense belongs?
I'm starting with a textField where the user can insert a month, assuming that an Expense is valid for one month only (for learning purposes and simplification).
My idea is to allow the user to select several months (using maybe another tableView with selectable months) and association of an Expense to different months.
I know that a relationship comes as a NSSet, but I'm not being competent to save the attributes and the relationship from a View, at the same time.
Hope was cleared and many thanks in advance for trying to help.
OK. In Core data, you define your "Expense" entity, create a relationship to "Month" entity. Now create class files for these 2 entities. Then you use it by
Expense *expense1 = [NSEntityDescription insertNewObjectForEntityName:#"Expense" ....
Month *month1 = [context executeFetchRequest:......];
expense1.month = month1;
...
[context save];
In your situation, you can predefine 12 "Month" objects, giving the month name as the text property.
Then you can lookup these month objects using NSFetchRequest. Add the relevant month objects to your expense using
[expense addMonthObject:month]
Then save your managed object context.
You message the managed object for its mutableSetValueForKey:RelationshipKey,
then you add the to-many managed objects to that set. CoreData completes the other half of the relationship data.