I am developing a accounting third party C# form application for my company which bulk load the payments from external source, for prototype, I using an excel file for actual payment data.
Now that I have IRecievePaymenttoDeposit, I get all unpaid invoices with customer refs and by IInvoiceQuery I can get customers, but what is the reference keys for these two queries?
I will be getting a customer name, customer id and invoice no, how can I add the amount to the selected payment.
In order to apply a payment to an invoice, you need the TxnID of the invoice, which is different than the invoice number. You can use the invoice number, however to query for the invoice to get the TxnID.
IInvoiceQuery invQuery = MsgRequest.AppendInvoiceQueryRq();
invQuery.ORInvoiceQuery.InvoiceFilter.ORRefNumberFilter.RefNumberFilter.RefNumber.SetValue(invoiceNumber);
// Use either the full name of the customer or the ListID
invQuery.ORInvoiceQuery.InvoiceFilter.EntityFilter.OREntityFilter.FullNameList.Add(customerName);
invQuery.ORInvoiceQuery.InvoiceFilter.EntityFilter.OREntityFilter.ListIDList.Add(customerid);
Once you have the invoice, you get can get the TxnID. Then, when you create your ReceivePaymentAdd you specify the TxnID to apply the payment to:
// Create the payment add request
IReceivePaymentAdd pmtAdd = MsgRequest.AppendReceivePaymentAddRq();
// Create the AppliedToTxn request for the payment.
IAppliedToTxnAdd appAdd = pmtAdd.ORApplyPayment.AppliedToTxnAddList.Append();
// Set the invoice TxnID and amount of the payment to apply
appAdd.TxnID.SetValue(invoiceTxnID);
appAdd.PaymentAmount.SetValue(amountToApply);
Related
So I have a Customer model in my Rails app and whenever a new customer is created I am getting a number as input from the user and I want that number to become the id of the customer on my database instead of the default 1, 2, 3, and so on. Is it possible to do that? If so, how?
EDIT: Let me be a more clear about what I want: I have a Customer and A Brand model. A customer has_many brands and a brand belongs_to a customer. Whenever the user creates a new brand, I want to connect it to its customer using that number that the user entered for the customer. Right now, whenever the user creates a new brand, I ask him to enter the customer_id value to connect the brand to a customer, but that is the id number generated by Rails. How do I make that customer_id attribute refer to the specific number the user entered for a customer, instead of the customer id generated by Rails.
It's possible, but don't do that. Just allow Rails to manage the auto-generated ID itself, and add this number - whatever it is - as a separate attribute in your model and saved to a separate field in your database.
As smathy mentioned, you can do the following:
1.First, generate a migration that add your custom attribute
rails g migration AddCustomerIdToCustomers customer_id:integer
2.When user enter the id, you would want to do something like this:
#customer.customer_id=params[:customer_id]
#customer.save
3.Then you can retrieve the custom object as
#customer = Customer.find_by_customer_id(customer_id)
where customer_id is the id you want.
As the above answer suggests, it is better let Rails handle the id attribute, because it is used extensively in Rails to handle database relationships ActiveRecord queries, etc. You do not want the extra headache of modifying it yourself.
In order to minimize the number of joins that I have to execute in my application I decided to copy in my database the same field in several tables for example :
I have a User, Product and a Wishlist Table.
My Product pages shows the user who created the product, as the wishlists pages which also shows the user who created them.
So I added in my products and wishlists table all the users field needed to show the required informations.
How can I update the users related fields in my Products and Wishlists Table as soon as the user change his information ?
Here is a part of my model :
User Table
Full Name
UserName
Avatar URL
Product Table
Product Name
Product Price
User ID
User Full Name
Username
User Avatar URL
Wishlist Table
Wishlist Name
User ID
User Full Name
Username
User Avatar URL
Thanks in advance for your answers !
Firstly, by denormalizing the data in the way that you are, you are working against what relational databases are meant to do. They thrive on joins, and having each piece of data appear as few times as possible. So you really want to make sure that this is the schema that you want.
That being said, you can use the basic update_attibute syntax to update any field in any table. So, if a user edited his or her username, you would do:
User.update_attribute(:username, username)
Product.update_attribute(:username, username)
Wishlist.update_attribute(:username, username)
I am new to magento. I have added two text fileds(custom options) for products in magento admin panel.
When the customer purchasing products these two text fields are required. I need to load the collection for sales order to get this two fields.
Customer fields namely like:
1) domain name 2) activation code
Can any one give me guidance? How to get this text fields from magento sales order?
thanks
Below collection will get your products custom fields from sales order
I have tried my self and got the final result.
Note : These products custom fields values entered by the customer in the product details page.
$order = Mage::getModel('sales/order');
$orderItems = $order->getItemsCollection();
$orderItems->addFieldToFilter('product_options',array('like'=>'%'.$domain_name.'%'));
$data = $orderItems->getData();
How can I get a list of students from D2L? I want to get the grades of the students and when I get the classlist, I get both instructors and student marks.
You can use /d2l/api/lp/{ver}/enrollments/orgUnits/{orgUnitId}/users/. This will fetch a paged result set of all the users enrolled in the course offering identified by orgUnitId. Note that you can filter the result set with the roleId query parameter; if you know the role ID for students, you can provide that to fetch back just the users in the course with a student role:
https://your.lms/d2l/api/lp/1.0/enrollments/orgUnits/6784/users/?roleId=78&{all_auth_qparms}
Note that the enrollments API calls require certain role permissions of the calling user context. The calling user account needs 'View User Enrollments' permission, and to have the 'Search for <rolename>' permission for the enrolled user roles visible in the output:
Without 'View User Enrollments', you won't have any permission to query enrollments at all, and you'll likely get a 403 back (no permission, or forbidden).
If you don't have the 'Search for Student' or 'Search for Instructor' permission (or whatever your local roles are), then although you can make the enrollments call, the list of enrolled users you get back will get filtered down to only the roles you can 'Search for'.
Edit. I've fixed this answer; the default role ID for students was not 3 (that's the default OrgUnitID for course offerings, I think). On our test server the default student role ID is '78'.
Edit 2. I've added more information about the permissions required to get useful information from the enrollments call.
Im building an admin interface for a medical records management app.
My client has asked me for a way to easily select the patient the user wants to work with without having to select the patient everytime he wants to perform an action.
So, say for instance he wants to store a record for the patient's current status (weight, size, etc) and then assign the same patient to a different doctor or change the company the patient currently works for.. he doesnt want to select the same patient all three times... he wants a select dropdown for patients and perform the different actions for that patient.
Im thinking this should be somehow stored in a session variable.. I have a table of patients and Im using LinqtoSql classes.... what do you reccommend?? help please.
Sounds like you want to put something into Session--perhaps some of the basic "recent patient" information, such as a patient ID, patient name, etc.
Definitely take a look at this post on how to do it in a very graceful way.
You could use the session to keep a list of recently active patient records for a given users session. Every time the user selects a new patient simply add that patient's name to the "Recent" list. Since you can control the length of the session you could just allow the list to expire when the user's session does. As far as not making the user select a customer again, just have it auto-select the most recent (last entry) on the list of recent customers.
Personally I would consider caching as an option here. By the sounds of it you want to load ALL data for ALL patients which is fine for a small amount of data but will not scale gracefully.
Consider going to the database the FIRST time you need the patient's data, and getting your data from the cache for subsequent queries...
The best way is to have the id in the route.
Use something like this when registering routes:
routes.MapRoute(
"Standard",
"{controller}/{action}/{PatientId}",
new
{
controller = "home",
action = "index",
PatientId = ""
}
);
When you select a Patient you post to an action that sets the PatientID in the RouteParameterCollection and redirect to the the action that displays the form for changing the patient. this way you always have the patientID in the URL.
Using session has some drawbacks:
If you have 2 windows open both use
the same session. This might confuse
users.
You can not bookmark a page
Session is usually stored in memory
on the appserver. This might lead to
performance problems if extensively used.