Normal Topic SOLines problems:  FormView to TableView (Read 1197 times)
lksseven
Full Member
***
Offline



Posts: 416
Location: Southwest
Joined: Jan 26th, 2009
SOLines problems:  FormView to TableView
Apr 21st, 2010 at 4:50am
Print Post Print Post  
I'm attempting to retrieve a group of sales orders and print invoices using the Sales Order parent form plus the SOLines subform (which presents initially in FormView) by looping through each sales order, setting up the form for invoicing (making some fields visible, others not visible, etc), and making the SOLines subform visible.  So far, so good.

The problem is with this one line of code that changes SOLines from formview to tableview (necessary so that all the line items will be displayed on the printed invoice):  [color=#ff0000]FormViewType("SOLines", 1)[/color] .  Inclusion of this line allows the first invoice to print correctly, but then throws off sbasic runtime error messages, and won't print the remainder, and will sometimes then crash Sesame.  

I have run into this before with subforms:  they do not like to be told via code to switch from FormView to TableView and then back again --- unless the subform is made active and a field in the subform is entered and modified, or a command button in the subform is pressed.  If one of those things is done before the subform goes into tableview, then all is well.  But if one of those things isn't done first, then runtime errors left and right.    On individual forms, I've got a work around.  But my work around won't work when printing invoices in a batch.

Getting this to work will save my accounting staff about 60% of their data entry labor, so I'm desperate to get it working.

Any help is most appreciated (below is posted the section of code that includes the form massaging for printing)



                                                     CreateAProcess("RUNDLL32 PRINTUI.DLL,PrintUIEntry /y /n hp6300")   //wcOrderL")
                                                 Loiter(1000)

                                               For vLoop = 1 To vCount
                                                     ResultSetCurrentPosition(vLoop)
                       
                                                     FormFieldValue("", "InvoiceDate", vLoop, vIDate)
                                                     FormFieldValue("", "PorM", vLoop, "M")
                                                     Visibility(ClientID2, 0)
                                                     Visibility(LE9, 0)
                                                     Visibility(InternalFlag1, 0)
                                                     Visibility(SOCostTotal, 0)
                                                     Visibility(SOProfitTotal, 0)
                                                     Visibility(LE2, 0)
                                                     Visibility(LE3, 0)
                                                     Visibility(LE4, 0)
                                                     Visibility(LE20, 0)
                                                     Visibility(SOTime, 0)
                                                     Visibility(ClientEmail, 0)
                                                     Visibility(SOTotal, 0)
                                                     Visibility(LE8, 0)
                                                     Visibility(UserID, 0)
                                                     Attribute(LE1, ATTR_ID_LABEL, "WordCom, Inc")
                                                     Attribute(SONum, ATTR_ID_LABEL, "InvoiceNum")
                                                     Visibility(WhosePage, 1)
                                                     FormFieldValue("", "WhosePage", vLoop, "Client INVOICE")
                                                     
                                                     Visibility(SOTotalShadow, 1)
                                                     Visibility(SOTaxTotal, 1)
                                                     Visibility(SOTotalPlusTax, 1)

                                                     RGBColor(ClientName, 255, 0, 0, 255, 255, 255)
                                                     RGBColor(ClientAddress1, 255, 0, 0, 255, 255, 255)
                                                     RGBColor(ClientAddress2, 255, 0, 0, 255, 255, 255)
                                                     RGBColor(ClientCity, 255, 0, 0, 255, 255, 255)
                                                     RGBColor(ClientState, 255, 0, 0, 255, 255, 255)
                                                     RGBColor(ClientZip, 255, 0, 0, 255, 255, 255)
                                                     RGBColor(ClientPO, 255, 0, 0, 255, 255, 255)
                                                     RGBColor(SONum, 0, 0, 255, 255, 255, 255)
                                                     RGBColor(InvoiceDate, 0, 0, 255, 255, 255, 255)
                                                     
                                                     
                                                     SubFormVisibility("LE0", 1)
                                                     

                                                     FormAttribute("SOLines", "PriceShadow", ATTR_ID_VISIBILITY, "0")
                                                     FormAttribute("SOLines", "ItemPrice", ATTR_ID_VISIBILITY, "1")
                                                     FormAttribute("SOLines", "LineItemTotalShadow", ATTR_ID_VISIBILITY, "0")
                                                     FormAttribute("SOLines", "LineItemTotal", ATTR_ID_VISIBILITY, "1")
                                                     FormAttribute("SOLines", "ItemCost", ATTR_ID_VISIBILITY, "0")
                                                     FormAttribute("SOLines", "Margin", ATTR_ID_VISIBILITY, "0")
                                                     FormAttribute("SOLines", "PrevPrice", ATTR_ID_VISIBILITY, "0")
                                                     

                                                     [color=#ff0000]FormViewType("SOLines", 1)[/color]
                                                     

                                                     Loiter(1000)

                                                     vPrt = @PrintAForm(0, 1, 1, 0, 28, -1, -1, -1, -1, 1, 1)
                                                     
                                                     FormFieldValue("Orders", "SORep", vLoop, "Y")
                                                     
                                                     Attribute(LE1, ATTR_ID_LABEL, "WordCom Inc Sales Order")
                                                     Attribute(SONum, ATTR_ID_LABEL, "SONum")
                                                     Visibility(SOTotal, 1)
                                                     RGBColor(ClientName, 0, 0, 0, 255, 255, 255)
                                                     RGBColor(ClientAddress1, 0, 0, 0, 255, 255, 255)
                                                     RGBColor(ClientAddress2, 0, 0, 0, 255, 255, 255)
                                                     RGBColor(ClientCity, 0, 0, 0, 255, 255, 255)
                                                     RGBColor(ClientState, 0, 0, 0, 255, 255, 255)
                                                     RGBColor(ClientZip, 0, 0, 0, 255, 255, 255)
                                                     RGBColor(ClientPO, 0, 0, 0, 255, 255, 255)
                                                     RGBColor(SONum, 255, 0, 0, 255, 255, 255)
                                                     

                                                     FormFieldValue("", "WhosePage", vLoop, "")

                                                     FormCommit("")
                       
                                               Next
                                                         Writeln((vCount) + " records were invoiced. The Order/Invoice #s were " + vAnswer)
                                               CreateAProcess("RUNDLL32 PRINTUI.DLL,PrintUIEntry /y /n wcLaser1")
  

Larry
Back to top
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1350
Location: New Hampshire
Joined: Mar 11th, 2003
Re: SOLines problems:  FormView to TableView
Reply #1 - Apr 21st, 2010 at 11:34am
Print Post Print Post  
[quote author=lksseven link=1271825437/0#0 date=1271825437]...unless the subform is made active and a field in the subform is entered... [/quote]
Yes, sometimes I need to place focus in the subform also, in order for certain things to work properly (e.g. updating a value in the subforms via XResultSetValue, etc.) Try something like the following line, in there somewhere.

FormResultSetCurrentPosition(sSubformName, @FormResultSetTotal(sSubformName))
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
lksseven
Full Member
***
Offline



Posts: 416
Location: Southwest
Joined: Jan 26th, 2009
Re: SOLines problems:  FormView to TableView
Reply #2 - Apr 21st, 2010 at 1:40pm
Print Post Print Post  
Hi Carl,

Will try that today.  Thank you.
  

Larry
Back to top
IP Logged
 
lksseven
Full Member
***
Offline



Posts: 416
Location: Southwest
Joined: Jan 26th, 2009
Solved: SOLines problems:  FormView to TableView
Reply #3 - Apr 21st, 2010 at 2:44pm
Print Post Print Post  
Carl,

You're the man!  That worked.  If I was a smoker, I'd definitely be lighting up right now.

Thanks so much.
  

Larry
Back to top
IP Logged