vaggelis wrote:
On 21 Ïêô, 21:50, 105 <corti... at (no spam) internode.on.net> wrote:
vaggelis wrote:
hello,
i have a problem that someone might be able to help me.
In my invoice layout, i have an add line item for my products. The
thing is that i want to make another addline item for my services and
this is where i have the problem.
i actually copied the way the first addline item works, by creating a
new table, make the proper relationships, duplicating the script( Sets
variable with INVOICE ID, Create new record, set INVOICE ID, and
return to original layout) for the addlineitem button but still when i
press the button it says "this operation cannot be completed because
the target is not part of a related table".
, is it a problem that i use the invoice id again?? any
suggestions???
it sounds like you created two line items tables? one for
productlineitems and one for service lineitems? And then hoped to see
them in the same portal? Probably not, but not clear from your description.
one line items table, and if there are 2 source tables (products,
services) that you want to reference, teh line item table:
lineitem_id
invoice_id
item_id ( ie product_id OR service_id)
type (prod, serv)
then you couuld have invoice::lineitems::products and
invoice::lineitems::services as branched hopped rels for displaying the
product/service details in teh lineitems portal.
If you are using a bts_lineitems layout:
parse product_id or service_id to variable ($_item)
set $_type = prod or serv as appropriate
parse invoice_id to $_inv
bo bts_invoicelines
new record
set invoicelines::invoice_id = $_inv
set invoicelines::item_id = $_item
set invoicelines::type = $_type
return to original layout
the add line item can be the same single script for both prod and serv,
it is only the input to the initial variables that is different, and
this is dependant on how you are selecting the product or service.
If it is a pop window with filtered portal ...
hello again and i really thank you for your quick answer!
I indeed created 2 addline item table , each for every portal but from
what i read , it's not gonna work!
So, you tell me to create 2 tables ( for products , and services) have
only one addline item table and modify the script ?
right?
yes to one lineitem tabl
maybe to individual product and services table
yes to modify the script
well you could have 2 lineitem tables (your 'created 2 addline item
table') , but that would mean you needed a portal for each, and what
would be the point? It would also be a design transgression, and
require calculating the invoice total as the sum of the line items in
each lineitem table...). An invoice has associated (related) lineitems.
The line items can be of different types. Simple.
So Invoice table:
invoice_id
company_id
date, subtotal, tax, total, (description)...
InvoiceLines table
invoiceLine_id
invoice_id
item_id
=/- sourceTBL/type
qty, cost, aec_cost_ext...
and a portal on the invoice form, invoice to invoiceLines using
invoice::invoice_id to invoiceLines::invoice_id
(this is a non-acrr rel)
a bts_invoiceLines table; used for the script creation of new invoice lines
script to create a new invoice line
As for the products/services. These can be one table (e.g. items) with a
type field (prod or serv), or 2 tables. There are advantages to each
approach, but one table is arguably better design, but 2 may be more
pragmatic in your situation.
How are you selecting the item (service or product) to add?