Dogman
29th October 2005, 20:32
I would like to create a report where I could subtract articles sales quotations quantities from inventory on hand. I find that for that purpose I should use some temporary variable where to store this "decreasing" quantity and print it out on each line.
Can it be solved in sql query or layout script somewhere or isn't it possible?
For example:
Article: 1234567890 - Inventory on hand 5000
Del. Date - Qty - Left on hand
2005-10-30 - 1000 - 4000
2005-11-10 - 1000 - 3000
2005-12-05 - 1000 - 2000
mark_h
30th October 2005, 02:34
Yes - you can do this in the report script. Typically what I would do is sort the report by Item or in your case article. Make sure you have a layout for article. The layout can be empty but make sure it exists. Usually I would print the item or article in this layout.
declaration:
extern long on.hand.qty
before.article.1:
before.layout:
on.hand.qty = table.number
detail.1:
before.layout:
on.hand.qty = on.hand.qty - some.sold.qty
Then in your report you could print the on.hand.qty in the detail layout. Not sure if I go the coding above correct, but the concept works.
Dogman
1st November 2005, 08:38
Hey!
Since it is first time for me to create such a script and I do not know logic of this scripting quite yet then I must again ask for help. I do not have any errors in code anymore but now I have question - how can I get this "on.hand.qty" to be printed out? I guess I have to get it somehow to layout ttadv3131s000, but how? Do I have to predefine it somehow in "input fields session" or how can I do it? I have tried in many ways, but no luck so far :(
|******************************************************************************
|* tcsqlroee0002 VRC B40O c4 esto
|* 0-point calculation
|* eeeejaei
|* 31-10-05 [17:36]
|******************************************************************************
declaration:
extern long on.hand.qty
before.tdsls002.item.1:
before.layout:
on.hand.qty = tiitm001.stoc
detail.1:
before.layout:
on.hand.qty = on.hand.qty - tdsls002.oqua
bdittmar
1st November 2005, 13:53
Hello,
as you defined, put the field "on.hand.qty" with domain "tcmcs.long"
in the detail.1 section of the report layout.
| extern long on.hand.qty
extern domain tcmcs.long on.hand.qty
before.tdsls002.item.1:
before.layout:
on.hand.qty = tiitm001.stoc
detail.1:
before.layout:
on.hand.qty = on.hand.qty - tdsls002.oqua [/CODE][/QUOTE]
Dogman
1st November 2005, 14:00
Thanks for everybody - script and report working as they should be! :)