Thursday, November 20, 2008 ..:: Forums ::.. Register  Login
 Forums Minimize
SearchForum Home
     
  Mainstream Forums  Help  Adding a field ...
 Re: Adding a field to the quote line items
 
support
2098 posts
1st
Joined
1/3/2006

Re: Adding a field to the quote line items
Posted: 07 Oct 07 11:24 AM

It really was not that difficult to add a custom field to the line items.  In the table, we added a new TemplateField column added the field to both the ItemTemplate and the EditItemTemplate.

<asp:TemplateField HeaderText="Service Date">
	<ItemTemplate><%# Eval("SERVICE_DATE_C") %></ItemTemplate>
	<EditItemTemplate>
		<asp:TextBox ID="SERVICE_DATE_C" Text='<%# Eval("SERVICE_DATE_C") %>' Width="60" autocomplete="off" runat="server" />
	</EditItemTemplate>
</asp:TemplateField>

We then added code to methods grdMain_RowUpdating and LoadLineItems.  We mostly just copied the code that managed the DESCRIPTION field and did the exact same thing for SERVICE_DATE_C.  Just search EditLineItemsView.ascx.cs for "DESCRIPTION" and add your custom field to the next line.

In order for the custom field to get updated when the Order is saved, you will have to use our function to add the custom field to the system.  The following function performs an alter table to add the actual field to the custom table, and it adds a record to the FIELDS_META_DATA table, which is required for automatic updating of custom fields.

exec dbo.spFIELDS_META_DATA_Insert null, null, 'SERVICE_DATE', 'Service Date', 'SERVICE_DATE', 'ORDERS_LINE_ITEMS', 'date', null, 0, 0, null, null, 0;

 

garf
81 posts
Joined
2/21/2007

Re: Adding a field to the quote line items
Posted: 09 Oct 07 12:57 AM

This is sweet! Thanks for posting this, it really helps. The part I couldn't figure out was the stored procedure to update the meta fields table. Would I just replace the the 'date' type with decimal to make mine work? I even created a java function to manage the onblur event of the field to update the subtotal with the discount %.

Still, I 'm curious why my  Discount field in the Quotes table updates correctly and yet the Discount_USDollar field is updating with the subtotal now? I know it's not the code. Any thoughts or ideas ideas what may have occured in the database?

 

 

 

 

 

support
2098 posts
1st
Joined
1/3/2006

Re: Adding a field to the quote line items
Posted: 09 Oct 07 1:35 AM

You may need to go directly to get database to confirm what you are saying about Discount_USDollar.  I still believe that the problem is not that the field is getting updated imporperly, but that the view is old and needs to be recompiled. 

Custom fields are not updated using a stored procedure.  We go directly to the _CSTM table.

 

garf
81 posts
Joined
2/21/2007

Re: Adding a field to the quote line items
Posted: 02 Nov 07 3:16 PM Modified By garf  on 11/2/2007 3:18:15 PM)
 support wrote

It really was not that difficult to add a custom field to the line items.  In the table, we added a new TemplateField column added the field to both the ItemTemplate and the EditItemTemplate.


	<%# Eval("SERVICE_DATE_C") %>
	
		
	

We then added code to methods grdMain_RowUpdating and LoadLineItems.  We mostly just copied the code that managed the DESCRIPTION field and did the exact same thing for SERVICE_DATE_C.  Just search EditLineItemsView.ascx.cs for "DESCRIPTION" and add your custom field to the next line.

In order for the custom field to get updated when the Order is saved, you will have to use our function to add the custom field to the system.  The following function performs an alter table to add the actual field to the custom table, and it adds a record to the FIELDS_META_DATA table, which is required for automatic updating of custom fields.

exec dbo.spFIELDS_META_DATA_Insert null, null, 'SERVICE_DATE', 'Service Date', 'SERVICE_DATE', 'ORDERS_LINE_ITEMS', 'date', null, 0, 0, null, null, 0;

 

 

OK, so I had a chance to go back and make this happen. Having a problem still updating the field using the function :

UpdateCustomFields(
SplendidControl ctlPARENT, IDbTransaction trn, Guid gID, string sCUSTOM_MODULE, DataTable dtCustomFields)

I modified dtcustomfields to pull only line item custom fields et.c.., but I get into difficulty running the funtion, as this part:

DynamicControl ctlCustomField = new DynamicControl(ctlPARENT, sNAME);
if ( ctlCustomField.Exists )........

......

causes me grief. Of course, the line item control is not in the ctlPARENT control and I'm not sure of a work around on this one?  Any suggestions?

Thanks again!

 

 

 

support
2098 posts
1st
Joined
1/3/2006

Re: Adding a field to the quote line items
Posted: 02 Nov 07 5:36 PM

Can you email the code to our support staff?  We might be able to spot the problem quickly if we have the source.

 

  Mainstream Forums  Help  Adding a field ...

Forum Home  Search       

Copyright (c) 2006-2008 SplendidCRM Software, Inc. All Rights Reserved.   Terms Of Use  Privacy Statement
DotNetNuke® is copyright 2002-2008 by Perpetual Motion Interactive Systems Inc.
SplendidCRM and SplendidCRM Software are trademarks of SplendidCRM Software, Inc. SugarCRM is a trademark of SugarCRM Inc. in the United States, the European Union and other countries. All other trademarks used in this web site are the property of their respective owners.