QuickBooks Desktop Invoice Integration and InvoiceGroupLine Limitations - desktop

I have been Integrating Invoice module of Quickbooks Desktop Enterprise with an application using "qbxml", i encountered that with InvoiceLine i can send many fields including custom fields, But when it comes to InvoiceGroupLine i can't send the following which i need too:
1.Service Date field;
2.Other1;
3.Other2.
(all of the above mentioned fields to be added at the last row of GroupItem where description of it is placed as shown in picture below.)
Also attached picture shows the custom field called "Employee" was populated at the first line of this, which should be at the bottom where the last description is.
Secondly, you can see i was unable to pass through 'service date' and 'other1' which is 'Patient' and 'other2' which is 'MR Number' fields for GroupItem.
The reason why i asked about population on the bottom is because, only the last line of GroupItem copies to Print/Print Preview of Invoices in Quickbooks.
How can i able to achieve my goal of sending over these fields as i mentioned above to QuickBooks to their respective places/positions and fields? thanks.

Related

Acumatica - Creating Custom Usr Field on Purchase Orders for Weight Total

I am trying to add a new field through the customization browser to the Purchase Orders screen (PO301000). I created the field through the New Field button and edited the Data Access slightly to provide a default parameter for the field. Here is the code in the Data Access:
[PXDBDecimal]
[PXDefault(TypeCode.Decimal, "0.0")]
[PXUIField(DisplayName="Weight Total")]
This field will be used to calculate the total weight of the purchase order and I would like it to be stored in the database.
I get this error when publishing:
An error while publishing the database item POOrder
with the message:
Nullable object must have a value.
I have tried changing the PXDBDecimal to a PXDBQuantity. This has to be done through the customization browser and not the database itself because this project will be going on a SaaS hosted site where I do not have access to the database. I have also tried creating the field through the DAC only and I receive this error when trying to open the page:
Invalid column name 'UsrWeightTotal'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Invalid column name 'UsrWeightTotal'.
When reviewing the project xml for the POOrder table entry in the customization I found there were some extra/missing attributes required for a column type of decimal.
There was a MaxLength property and no DecimalLength property. I compared it to adding a new field of type decimal and looked at the project xml to come up with the following:
<Table TableName="POOrder">
<Column TableName="POOrder" ColumnName="UsrWeightTotal" ColumnType="decimal" AllowNull="True" DecimalPrecision="6" DecimalLength="19" IsNewColumn="True" IsUnicode="True" />
</Table>
I bet the error was complaining about the missing DecimalLength value (as a result was null but required for the publish process).

How to pass manytomany PKs to post or put

class AlbumSerializer(serializers.ModelSerializer):
tracks = serializers.PrimaryKeyRelatedField(many=True, queryset=Track.objects.all(), )
class Meta:
model = Album
fields = ('album_name', 'artist', 'tracks')
what is the format for adding multiple tracks
tracks is a manytomany field
tried array, comma separated but no luck
If I pass
track = "Track1"
where "Track1" is the primary key of Track 1
How to add ['Track1', 'Track2']
Actual code
class TreatmentTemplateSerializer(serializers.ModelSerializer):
icds = serializers.PrimaryKeyRelatedField(read_only=False, many=True, queryset=ICD_10.objects.all())
class Meta:
model = Treatment_template
Screenshot 1
Postman supports array in above format??
Screenshot 2
Screenshot 3
Sending plain JSON objects
I would suggest testing complex request data (including arrays or nested objects) by directly sending JSON rather than form-data or x-www-form-urlencoded. To do this click on raw and paste your JSON object there.
To get a well-formatted JSON object to start with I usually first issue a GET request for a resource that already exists. Then I can just copy the response, change the request method to PUT, click the raw button and paste the json. Then I can start modifying the object and test the endpoint.
In the example above, does the following work?
{
"uuid": "the-long-uuid-here",
"icds": [
"A00",
"A001"
]
}
Update: Put multiple m2m ids with x-www-form-urlencoded
As I wasn't completely happy with not providing an alternative I tested a bit more (with the latest Postman which looks differently).
You can pass multiple values using x-www-form-urlencoded. To do that, add multiple rows with the same label icds and one value at a time.
Notice that I tested it with an endpoint that provides books, which would be icds in your use case. The data in the screenshot will be transmitted as books=1&books=3&last_name=foobar which gets correctly picked up by the DRF endpoint.
Screenshot Postman

Generating image url using carrierwave in rails

This is somewhat related my question about joins here. By default when I use listing.image.name in my search results view, it does a full query to find the image for every listing in my results array. It even does an extra query just to check if the listing has any images. So to avoid this, I'm adding the following to my Thinking Sphinx query:
#ts_params[:sql][:joins] = "INNER JOIN listing_images ON listing_images.listing_id = listings.id AND listing_images.position = 0"
#ts_params[:sql][:select] = "listings.*, listing_images.image as image_name, listing_images.id as image_id"
This works, however I'm not sure how to generate the full image_url using carrierwave. Previously, where it was doing an extra query per result, I was using listing.image.image_url(:sizename). So, I can find the image name and ID from my join as above, but how to I convert this to a full image url via carrierwave? Is there a built-in method to retrieve the url, that doesn't require an 'image' object?
I tried listing.image_id.image_url(:sizename) but it gave an undefined method error as expected.
From carrierwave's perspective, the answer is obvious:
user.avatar.url
user.avatar.thumbnail.url
Here, user is an instance of a model, and avatar is the field on the model with mount_uploader called on it. In your case this would be something like:
listing_image.image_name.url
listing_image.image_name.thumbnail.url
That probably doesn't work, though, because it looks like you may be loading your listing_image fields into the Listing instead of through includes (or the dreaded N+1 non-eager loads). You may need to resolve your other stackoverflow question before this one will be possible.
Edit:
Per our discussion on your other issue, once you've got a has_one :main_image for just the one ListingImage you want, you're going to use something like #listing.main_image.image_name.url and, if you have a version named "thumbnail", #listing.main_image.image_name.thumbnail.url.
I had the similar issue when I was fetching image using query and wanted to build image url using db field instead of issuing full sql query for each image.
I found out that with couple of field fetched from related image table we can build image which will not run any sql for image if we have three fields id, updated_at and image_name this field should be from the table where image is being saved. It could be from the main table where image is saved as separate column or completely separate table use to specially for image here is a sample code
It can be in your helper or in decorator as per your choice
def logo_url(id, updated_at, name)
return if id.blank? || updated_at.blank? || name.blank?
Company.new(id: id, updated_at: updated_at, logo: name).logo
end
and in view you can call this helper method as
<%= logo_url(company.id, company.updated_at, company.logo).url %>
This way you can have your image with url without executing sql query on each image.

Sitecore Web Forms for Marketers and DMS - not recording campaigns, goals and dropout info

In WFFM there is an option so that, when someone abandons the form, any data that was entered in the form itself is recorded and should be accessible via the Dropout Report.
I have a WFFM for which I have turned on Analytics and turned on the dropout feature. Unfortunately I don't see any data being recorded in the DB and the Dropout Report is visible, but empty.
I see from the javascript code included in the WFFM folder that a series of AJAX calls are supposed to save the fields on blur events -- with calls to /sitecore modules/web/Web Forms for Marketers/Tracking.aspx
I tried debugging the Javascript code, but the method supposed to post the info to /sitecore modules/web/Web Forms for Marketers/Tracking.aspx is never being called. Can you think of any reasons for this code not to work? Also, does anyone know which table this information is supposed to be recorded? Is it the fields table in the WFFM DB?
Finally, even though I have turned on analytics on this particular WFFM form and I have associated a campaign and a goal to the submission of the form, none of these is being recorded. I see that the data entered in the form is stored successfully and is displaying in the Data Report, but no info about the Campaign nor the Goal are recorded in the DB.
I even checked manually directly in the DMS DB running:
select top 10
p.DateTime, p.UrlText, cp.CampaignName
,i.Url, vi.VisitId
from pages p
inner join ItemUrls i on p.ItemId = i.ItemId
inner join Visits vi on vi.VisitId = p.VisitId
inner join GeoIps g on vi.Ip = g.Ip
left join Campaigns cp on cp.CampaignId = vi.CampaignId
order by p.DateTime desc
This one shows that the page where the form is rendered is being hit, but no campaign is associated to the visit.
Then I tried the following:
select pe.datetime, ped.Name, pg.UrlText from PageEvents pe
inner join PageEventDefinitions ped on ped.PageEventDefinitionId = pe.PageEventDefinitionId
inner join Pages pg on pg.PageId = pe.PageId
order by pe.DateTime desc
But I don't see any entry for this particular campaign nor for the goal (while I see entries for other campaigns and goals associated to non-WFFM Sitecore items)
Any advice would be greatly appreciated!
Thanks,
Francesco
EDIT
The sc.webform.js file contains this method:
_create: function () {
var self = this,
options = this.options;
if (options.tracking) {
this.element.find("input[type!='submit'], select, textarea")
.bind('focus', function (e) { self.onFocusField(e, this) })
.bind('blur change', function (e) { self.onBlurField(e, this) });
this.element.find("select")
.change(function () { $scw.webform.controls.updateAnalyticsListValue(this) });
this.element.find("input[type='checkbox'], input[type='radio']")
.click(function () { $scw.webform.controls.updateAnalyticsListValue(this) });
}
this.element.find(".scfDatePickerTextBox").each(function () { $scw.webform.controls.datePicker(this) });
},
This is supposed to be called by the form on sc.webform widget initialization. It should bind the focus and blur change events for all input fields, drop downs and text areas. Unfortunately, when I tried to put a break point inside this method, it never gets called.
SECOND EDIT
Interesting. I figured out that the whole thing should start from this line of Javascript code embedded in the page that contains the WFFM form:
<script type="text/javascript">
$scwhead.ready(function() {
$scw('#form_A8BF483419174F97A2830E12CBCF7E4F').webform({formId: "{A8BF4834-1917-4F97-A283-0E12CBCF7E4F}",pageId: "{21C24144-B964-4FBA-8388-D9B90EBBC17C}",eventCountId: "pagecolumns_0_columncontent_0_bottomrow_0_form_A8BF483419174F97A2830E12CBCF7E4F_form_A8BF483419174F97A2830E12CBCF7E4F_eventcount",tracking: true})
});
</script>
Once I put a break point here, I was finally able to trace into the _create method of the jQuery.UI widget defined in sc.webform.js. The code that calls _create is actually inside the jQuery.UI library. Kinda makes sense, right?
Finally, the code inside _create is executed, the blur events are bound to the TrackEvents method, also defined within the widget:
_trackEvents: function(events) {
$scw.ajax({
type: 'POST',
url: "/sitecore modules/web/Web Forms for Marketers/Tracking.aspx" + location.search,
data: {track: JSON.stringify(events)},
dataType: 'json'
});
What doesn't make sense is that now, even though I can finally see trackEvents being called whenever I tab from field to field in the WFFM form (why wasn't working before it's a mistery to me), I don't see any data recorded in the WFFM DB. I even tried a quick query in the DB:
select f.Timestamp, f.StorageName, fi.Value, fi.FieldName
from Form f
inner join Field fi on f.Id = fi.FormId
order by f.Timestamp desc, FieldName
Does anybody know where is Tracking.aspx supposed to save the captured field informations?
This may be silly to ask, but did you configure the data source correctly for your WFFM? I mean, obviously, you're using WFFM..but is it set to use SQL or is it using the "file" that WFFM uses by default as it's database.
like this to use SQL:
<!-- MSSQL-->
<formsDataProvider type="Sitecore.Forms.Data.DataProviders.WFMDataProvider,Sitecore.Forms.Core">
<param desc="connection string">Database=Sitecore_WebForms;Data Source=xxx;user id=xxx;password=xxx;Connect Timeout=30</param>
</formsDataProvider>
<!-- SQLite -->
<!--<formsDataProvider type="Sitecore.Forms.Data.DataProviders.SQLite.SQLiteWFMDataProvider,Sitecore.Forms.Core">
<param desc="connection string">Data Source=/data/sitecore_webforms.db;version=3;BinaryGUID=true</param>
</formsDataProvider>-->
If you don't configure that correctly, I'm wondering if somehow data is being recorded in one place but not another? Also, another question I have is to ask if this is a dev environment, are you running webforms in live mode? It just seems to me like this is a configuration issue.
We are experiencing the exact same problem on 6.5 update 6 and WFFM 2.3.3 rev. 111209. We can see the asynchronous calls to the server including the probably well formed json object containing the correct event.
Example:
track:[{"fieldId":"{E0A0BCDD-85E1-4D8D-9E76-5ABD240423C9}","type":"Field Completed","value":"test","formId":"{0F3B57C1-1B6A-43B9-A5A6-2E958C168B31}","pageId":"{025AFF68-62B9-42CE-B49F-0C36311E1976}","ticks":16}]
We don't see any of the dropouts arrive in the database, though...
Have you made sure your campaigns and goals have been deployed? If you have switched databases they may not be. To redeploy do this:
For each Goal in System -> Marketing Center -> Goals
Change the workflow state to draft
Save
Then in the review ribbon click deploy.
This will create an entry in the pageeventdefinition table and allow
you to query.
Don't forget to do the same for campaigns.

Disabling only specific 'green plus' icons on auto generated forms

How do I disable the green icon on specific 'manytomany' or 'foreignkey' fields in automatically generated forms.
Using css as follows:
.add-another {
display: none;
}
disables all of them which I don't want.
An example would be the weekdays model (storing days from monday to sunday). A foreign key pointing to this model shows the green plus icon which would allow users to edit/corrupt the data in model.
Is there a way to disable this in the default generated forms (To save time in writing custom forms just to achieve this)?
Also, one can argue that most of the content in this model is static, so rather than creating a foreign key to point to this model, scrap this model and do something like this:
WEEK_DAYS = [
(MONDAY, 'monday')),
(TUESDAY, 'tuesday')),
#. . . so on
]
class AModel(models.Model):
weekday_dropdown = models.CharField(max_length=10, choices=WEEK_DAYS, default=ENABLED)
The problem now would be, what if the superuser/superadmin who will be a non-programmer want to remove saturday and sunday through the admin without going into the code?
Found the answer :)
Each person logging into the admin system has a set of permissions and groups managed through the django user manager area.
A person would not see the 'green plus icon' beside a drop down (foreign key / manytomany field) if he/she doesn't have permission (under django) to edit it.