Jump to content

Save search history for invoice control


Morenomdz
 Share

This topic is 2794 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hello there, I am building a invoice layout that get the records to display and calculate total from this method, I select the records then send the result to a printable layout. Ok.

 

What I want is to be able to save that result, that invoice, inside the db, probably on a separated table, that would track the generated find result as a new record, as a new invoice.

So, everytime I do a search and print, it will generate a new record on the affiliated table, give it a serial number and save the info from the records that I had selected (I need RecordID and AmountDue from the records), the thing is, how do I get the said record ID to save the find result on the other table using that solution? It saves the records I select on a global field, so all the records are inside a field, how do I relate that to the RecordID and then save on the other table?

 

Thanks!

Link to comment
Share on other sites

I would suggest you do it this way:

 

1. Find the items you want to include in the new invoice;

2. Go to a layout of Invoices and create a new record; store the InvoiceID value (an auto-entered serial number) in a variable;

3. Go back to the layout of the Items table, and populate the InvoiceID field in all found records with the value of the variable.

 

This is assuming an item can belong to one invoice only.

  • Like 1
Link to comment
Share on other sites

Is it possible to get the text from the RecordID field from all the records found, then copy it, insert to, a field on another table.

The script could run like

 

Get content from RecordID field on all found records

Create a new record with a auto generated serial number (payment ID) on another table ("Payment ID log/archive" table)

Insert into PaymentReport field the that table

Save the record.

 

That second table would have these fields, Payment ID, Payment Date, RecordIDs (Service Order numbers that were paid on that invoice), total paid.

 

Not sure how to get the info from all the RecordID fields and merge into a single one, well formated.

Thanks!

 

Edit: A record could be in more than one invoice.

Link to comment
Share on other sites

A record could be in more than one invoice.

 

In such case you need to do something like you described (and you already should have known how to do it from your other question, since the script I described there is very similar to the one needed here):

Go to Record [ First ]
Loop
  Set Variable [ $ids; Value: List ( $ids; Items::RecordID) ]
  Go to Record/Request/Page [ Next; Exit after last ]
End Loop
Go to Layout [ Payments ]
New Record
Set Field [ Payments::RecordIDs; $ids ]

Note:

This enables you to create a many-to-many relationship between Payments and Items, without creating a join table. This type of relationship has limited functionality: for example, you won't be able to create a report listing Items by Payment.

  • Like 1
Link to comment
Share on other sites

Newbie question, can I set a formating for the value inserted from the variable? It will set the text one under the other, can I set it to be separated by commas and stuff?

Got it to show the comma by adding & "," to the var, now need to have it in the same line without breaking to column! ><

Edited by Morenomdz
Link to comment
Share on other sites

IMHO, best practice would be to have a relationship between the individual items and the wrapper payment record. This would enable you to easily see which items are included in which payment and vice versa.  For this to work, you must have a return-separated list of the related items RecordID values in a field of the Payments table, to be used as the matchfield in the relationship.

 

If you want to show a comma-separated list of other values from the related items, you can use a calculation field =

Substitute ( List ( Items::Somefield ) ; ¶ ; ", " )

Note that this will work for building a list from values in a single field. As I said in your other thread, printing multiple values from multiple records as contiguous text is not a simple task.

Link to comment
Share on other sites

This topic is 2794 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.