Program imp. doc. inventory lx22
Hello guru´s
I need to change the output of inventory document and I nedd to know wich is the printer program to modify by the developer.
The t.code that generated this document inventory is LX22
Thanks a lot
Best regars
did you ever use the menu in SAP?
directly above the transaction LX22 is the transaction LI04 which is the natural transaction to print inventory documents, while LX22 is and overview a kind of cockpit that allows multiple things.
But in LI04, you see all what you want to know directly in the initial screen
Similar Messages
-
How do I make Pages the default program for .doc files?
How do I make Pages the default program for .doc files without having the need to change the default program for each individual.doc file?
Navigate to a .doc file.
Ctrl click the file
Choose Open with and then go down the list, past pages, to other
Navigate to pages
Before you click Open make sure you click the 'Always open with' check box.
You should be okay.
You can do a similar think by selecting the file, Choosing File-Get Info
Then open the Open With Disclosure triangle.
select pages and then click CHANGE ALL
Hope this hleps.
M. -
Sample programs and docs on JNI
I am a green been to JNI, could you please point me to the sample source programs and docs to start reading from the basics. Thanks.
Sun's JNI docs:
http://java.sun.com/products/jdk/1.2/docs/guide/jni/spec/jniTOC.doc.html
if you're developing on Unix, this link is helpful:
http://ringlord.com/publications/jni-howto/
and of course step-by-step beginner's guide to 1st working JNI program:
http://java.sun.com/docs/books/tutorial/native1.1/index.html
This link also looks intersting for fast troubleshooting:
http://developer.java.sun.com/developer/onlineTraining/Programming/JDCBook/jni.html
Njoy! -
Program to check inventory report
Hi guys,
I need to send inventory report as idoc to customer on daily basis, bt they need customized fields located in SAP .. so i need is to extend the idoc.. insert the required segments and modify the user exit .. to pop the required fields in idoc.. untill here everything is fine..
Now my question is.. how should i configure to trigger the idoc to be sent daily... and to define output type as idoc...
Normally, if its standard application .....we will configure in NACE and schedule the program rseout00 .. bt in this case .. what should i do??Hi,
Go to program RSVTPROT in se38 transaction. There enter customzing object table as V_T001B and T001B. Thern enter the date range you want to evaluate,also customizng object or tables, select all output options BUT not archived logs and execute.
You will get the ALV report with user name,date and changes done
cya
udayakumar -
Set pages to be default program for *.doc files
Is it possible to set pages to be the default program which my computer will ALWAYS use to open a MS word document? In windows i could set default programs for specific file types, e.g. .jpg, .mpg, mp3. I did not have to assign a program to open the program every single time. As far as I can tell , I have had to request pages to open my word documents every time i open a word doc. for the first time. Although I can set pages to be the default program for that one file, i want it set to ALWAYS OPEN ALL WORD DOCS. , until further specified. Any suggestions?
thx.Highlight a known Word document in the Finder, highlight it & choose Get Info from the File menu. In the Get Info box, click the triangle next to "Open With." Click on this drop-down menu & choose Pages. If Pages is not a choice, choose "Other" & navigate to the Pages application. Now click the "Change" button under the text that asks if you want to open all documents like this with Pages. You can then double-click the Word documents & they will open in Pages. Note that the icon for the Word files will have a plain, white icon.
-
Bdc program for mi01(inventory) error
HI EXPERTS,
i have written a coding as per the requirement for inventory data upload by using transaction code 'MI01'.but it is always showing an error that " flat file is not found".please help me in solving this problem.
here is the coding.
report ZMM_RDD0009_MATERIAL_INVENTORY
no standard page heading line-size 255.
structure declaration.
types : begin of TY_UPLOAD ,
WERKS TYPE IKPF-WERKS,
LGORT TYPE IKPF-LGORT,
MATNR TYPE ISEG-MATNR,
END OF TY_UPLOAD.
INTERNAL TABLE DECLARATION.
internal table for upload the data.
data:t_upload type standard table of ty_upload initial size 0,
*internal table for bdcdata.
t_bdcdata type standard table of bdcdata initial size 0 ,
*internal table for bdcmsgcoll.
t_bdcmsgcoll type standard table of bdcmsgcoll initial size 0,
t_error type standard table of ty_upload initial size 0,
WORK-AREA DECLARATION.
work-area for upload the data.
w_upload type ty_upload,
bdcdata type bdcdata,
work-area for bdcmsgcoll.
w_bdcmsg type bdcmsgcoll,
*global variable declaration.
g_message(70) type c.
*include bdcrecx1.
start-of-selection.
call function 'GUI_UPLOAD'
exporting
filename = 'D:/FLATFILE.TXT'
filetype = 'ASC'
has_field_separator = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
IMPORTING
FILELENGTH =
HEADER =
tables
data_tab = t_upload.
EXCEPTIONS
call function 'BDC_OPEN_GROUP'
exporting
client = sy-mandt
DEST = FILLER8
group = 'ERROR_MAT'
HOLDDATE = ''
KEEP = 'X'
user = sy-uname
RECORD = FILLER1
prog = sy-cprog.
loop at t_upload into w_upload.
refresh t_bdcdata.
*perform open_group.
perform bdc_dynpro using 'SAPMM07I' '0700'.
perform bdc_field using 'BDC_CURSOR'
'IKPF-LGORT'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
*perform bdc_field using 'RM07I-BLDAT'
'W_UPLOAD-BLDAT'.
*perform bdc_field using 'RM07I-GIDAT'
'W_UPLOAD-GIDAT'.
perform bdc_field using 'IKPF-WERKS'
'W_UPLOAD-WERKS'.
perform bdc_field using 'IKPF-LGORT'
'W_UPLOAD-LGORT'.
perform bdc_field using 'RM07I-XLVOCA'
'X'.
perform bdc_dynpro using 'SAPMM07I' '0721'.
perform bdc_field using 'BDC_CURSOR'
'ISEG-MATNR(02)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'ISEG-MATNR(01)'
'W_UPLOAD-MATNR(01)'.
*perform bdc_field using 'ISEG-MATNR(02)'
'W_UPLOAD-MATNR(02)'.
perform bdc_dynpro using 'SAPMM07I' '0721'.
perform bdc_field using 'BDC_CURSOR'
'ISEG-MATNR(01)'.
perform bdc_field using 'BDC_OKCODE'
'=BU'.
*perform bdc_transaction using 'MI01'.
*perform close_group.
call transaction 'MI01' using t_bdcdata mode 'N' update 'S'
messages into t_bdcmsgcoll.
if sy-subrc <> 0.
*append w_upload to t_error.
call function 'BDC_INSERT'
exporting
tcode = 'MI01'
tables
dynprotab = t_bdcdata.
endif.
clear w_bdcmsg.
read table t_bdcmsgcoll into w_bdcmsg index 1.
call function 'FORMAT_MESSAGE'
exporting
id = w_bdcmsg-msgid
lang = sy-langu
no = w_bdcmsg-msgnr
v1 = w_bdcmsg-msgv1
v2 = w_bdcmsg-msgv2
v3 = w_bdcmsg-msgv3
v4 = w_bdcmsg-msgv4
importing
msg = g_message
exceptions
not_found = 1
others = 2.
if sy-subrc = 0.
write:/ w_upload-WERKS,'----', g_message.
refresh t_bdcmsgcoll.
endif.
endloop.
call function 'BDC_CLOSE_GROUP'.
EXCEPTIONS
NOT_OPEN = 1
QUEUE_ERROR = 2
OTHERS = 3
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
Start new screen *
form bdc_dynpro using program dynpro.
clear bdcdata.
bdcdata-program = program.
bdcdata-dynpro = dynpro.
bdcdata-dynbegin = 'X'.
append bdcdata to t_bdcdata.
clear bdcdata.
endform.
Insert field *
form bdc_field using fnam fval.
IF FVAL <> NODATA.
clear bdcdata.
bdcdata-fnam = fnam.
bdcdata-fval = fval.
append bdcdata to t_bdcdata.
clear bdcdata.
ENDIF.
endform.
Edited by: rohit on Jun 10, 2008 1:09 PM*& Report ZTEST_PRG6
report anirban no standard page heading line-size 255.
types : begin of ty_upload ,
werks type ikpf-werks,
lgort type ikpf-lgort,
matnr type iseg-matnr,
end of ty_upload.
parameters: p_file type localfile obligatory.
data:t_upload type standard table of ty_upload initial size 0,
*internal table for bdcdata.
t_bdcdata type standard table of bdcdata initial size 0 ,
*internal table for bdcmsgcoll.
t_bdcmsgcoll type standard table of bdcmsgcoll initial size 0,
t_error type standard table of ty_upload initial size 0,
w_upload type ty_upload,
w_file type string,
bdcdata type bdcdata,
w_bdcmsg type bdcmsgcoll,
*global variable declaration.
g_message(70) type c.
at selection-screen on value-request for p_file.
call function 'F4_FILENAME'
exporting
program_name = syst-cprog
dynpro_number = syst-dynnr
importing
file_name = p_file.
start-of-selection.
w_file = p_file.
call function 'GUI_UPLOAD'
exporting
filename = w_file
filetype = 'ASC'
has_field_separator = 'X'
tables
data_tab = t_upload.
check sy-subrc = 0.
call function 'BDC_OPEN_GROUP'
exporting
client = sy-mandt
group = 'ERROR_MAT'
user = sy-uname
prog = sy-cprog.
check sy-subrc = 0.
loop at t_upload into w_upload.
refresh t_bdcdata.
perform bdc_dynpro using 'SAPMM07I' '0700'.
perform bdc_field using 'BDC_CURSOR'
'IKPF-LGORT'.
perform bdc_field using 'BDC_OKCODE' '/00'.
perform bdc_field using 'IKPF-WERKS'
'W_UPLOAD-WERKS'.
perform bdc_field using 'IKPF-LGORT'
'W_UPLOAD-LGORT'.
perform bdc_field using 'RM07I-XLVOCA'
'X'.
perform bdc_dynpro using 'SAPMM07I' '0721'.
perform bdc_field using 'BDC_CURSOR'
'ISEG-MATNR(02)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'ISEG-MATNR(01)'
'W_UPLOAD-MATNR(01)'.
*perform bdc_field using 'ISEG-MATNR(02)'
perform bdc_dynpro using 'SAPMM07I' '0721'.
perform bdc_field using 'BDC_CURSOR'
'ISEG-MATNR(01)'.
perform bdc_field using 'BDC_OKCODE'
'=BU'.
call transaction 'MI01' using t_bdcdata mode 'N' update 'S'
messages into t_bdcmsgcoll.
if sy-subrc = 0.
call function 'BDC_INSERT'
exporting
tcode = 'MI01'
tables
dynprotab = t_bdcdata.
endif.
clear w_bdcmsg.
read table t_bdcmsgcoll into w_bdcmsg index 1.
call function 'FORMAT_MESSAGE'
exporting
id = w_bdcmsg-msgid
lang = sy-langu
no = w_bdcmsg-msgnr
v1 = w_bdcmsg-msgv1
v2 = w_bdcmsg-msgv2
v3 = w_bdcmsg-msgv3
v4 = w_bdcmsg-msgv4
importing
msg = g_message
exceptions
not_found = 1
others = 2.
if sy-subrc = 0.
write:/ w_upload-werks,'----', g_message.
refresh t_bdcmsgcoll.
endif.
endloop.
call function 'BDC_CLOSE_GROUP'.
* start new screen
form bdc_dynpro using program dynpro.
clear bdcdata.
bdcdata-program = program.
bdcdata-dynpro = dynpro.
bdcdata-dynbegin = 'X'.
append bdcdata to t_bdcdata.
clear bdcdata.
endform. "
*insert field *
form bdc_field using fnam fval.
* IF fval NODATA.
clear bdcdata.
bdcdata-fnam = fnam.
bdcdata-fval = fval.
append bdcdata to t_bdcdata.
clear bdcdata.
* ENDIF.
endform. "
Please change the program as above
Hope That Helps
Anirban M. -
Does anyone know how program a Computer Inventory in Java?
Im currently working on a school project with the following:
- A program that monitors Hardware installed in a computer and in a network. It makes an inventory of these in a MySQL database.
- A program that enumerates Desktop Applications located in a PC acquires information of the application's version.
- A program that actually knows when these applications are used by the user
- Finally it is suppposed to know when a certain hardware is experiencing performance problems.
I've been searching on how to do it for months.. i studied SNMP, RMI, MIBs, JMX, JDMK.. been all over textbooks and websites but nothing gave any clear tutorials and examples.. :( Im not even sure if im looking at the right Language to do all of these for me..
..Just looking for anyone who can help me step on the right foot.
ThanksThis cannot be done using pure Java. Look at a C solution, perhaps wrapped within a Java application to give a common interface. You'll need to be careful on the C front as much of the code that you write will be platform-specific.
-
Automatic Payment Program clearing docs created but no checks created
Hi All,
During APP open items are cleared but the checks are not been created, i found that if you do not enter the program variant(under printout/data medium) for the vendor housebank checks are not created.
Is there any way to always include the variant, at all times withot manually entering it.
Also can i make this field mandatory
Thanks
ShineHello,
The issue is in the variant, the values are not static, the entries like Payment Run Date and Identification Key needs to be changed every time that you run F110. Meaning that these values are to be replaced with your Payment Run Date and Identification Key and other details like House Bank, Account ID, if it is check payment, your check lot number, vendor account range etc. There is nothing these values comes automatically.
Regards,
Ravi -
SPACES: Can I have same program, different docs in different Spaces?
I'd like to have one OmniOutliner document open in Space #1, and a different OmniOutliner document open in Space #2. But I haven't yet figured out how to do this. Is there a way for me to have two different documents from the same program open in two different Spaces?
Spaces are generally designed to house a specific application in a specific space.
You can try dragging one of your documents to another space, provided that OmniOutliner hasn't been assigned to a certain space, however it is an application, not window based function. -
Help in word frequency program for .doc files
hi,,
can anybody help me...
i have implemented a prog to find word frequency of .txt files,
now i want to use the same prog for .doc files,
how can this be done???Hi,
I'm sure a few seconds on Google and you would have found the answer. But, take a look at Apache POI. This will allow you to extract the text from the doc files.
http://poi.apache.org/
Ben. -
Change associated program to .doc files
After I changed to Mountatin Lion I have got a new problem.
I use show info and tries to associate all .do files with OpenOffice. But it is not possible. Every time I dio and change to OpenOffice the system still change it back to the previwe program. I can change it to texteditor (the apple porgram) but not to OpenOffice. Why is it so??
/PerOk I understand. Its not sufficient with just OpenOffice. But when I try to do that I dont get that choice. I mean I dont get the choice OpenOffice writer only the choice OpenOffice.org.
Do I have to install OpenOffice in some special way or do I have to update OpenOffice. I am using 3.3. Haven found any never version at least not for swedish. -
Compare firts count for second count the doc.inventory
Hello,
I need of the SAP transaction to compare first and second count,in the process the inventory management.
In module MM.
tks,
Danilo Araujoincorporate mapping logic such that for every 999 item records create new IDoc node
check with this UDF for IDoc node mapping, item records will be input to UDF
int count = a.length;
int k=999;
result.addValue("");
for(int i=0;i<count;i++)
if (i>=k){
result.addValue(""); // if records > 999, add IDoc node
k=k+999;
Do rest of the mapping accordingly -
Anyone know why that is or how to correct it?
Thanks, Demo, I'll give that a shot. On the other hand, I really don't want to have some files in iBooks and other ones in Adobe Reader. If Adobe Reader will let me organize them in folders, it might be a great solution.
However, there's no ".pdf management" involved here. It's simply "Read the #%€\#^% .pdf file I gave you" and there is nothing to "manage". Whatever opinions Apple has about Adobe, .pdf is a fact of life and should not require any handstands and backsprings just to read a file. (Are you listening, Apple?) I refinanced my home with .pdf files; print it, sign it, scan it, e-mail it back. (OK, calm down, it'll be all right... Sigh...)
Whatever the result, I'll report back.
Thanks again.
Jeff B -
Inst_loc inventory pointer missing on second node in RAC
Hi,
I have installed Clusterware 11.1.0.6 on Windows 2003 on two nodes and I'd like to patch it to 11.1.0.7. However, when calling "opatch lsinventory -all" I noticed that it works on the first node (the node where the installation was performed), but doesn't work on the second node:
C:\product\11.1.0\crs\OPatch>opatch lsinventory -all
Invoking OPatch 11.1.0.6.0
Oracle Interim Patch Installer version 11.1.0.6.0
Copyright (c) 2007, Oracle Corporation. All rights reserved.
Oracle Home : C:\product\11.1.0\crs
Central Inventory : n/a
from : n/a
OPatch version : 11.1.0.6.0
OUI version : 11.1.0.6.0
OUI location : C:\product\11.1.0\crs\oui
Log file location : C:\product\11.1.0\crs\cfgtoollogs\opatch\opatch2010-11-28_10-22-19AM.log
OPatch cannot find a valid oraInst.loc file to locate Central Inventory.
OPatch failed with error code = 104
C:\product\11.1.0\crs\OPatch>I checked in the registry key "HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE" on both nodes and found out that the first node has an inventory pointer "inst_loc" wich points to "C:\Program Files\Oracle\Inventory", but on the second node this value is missing. If I manually set it on the second node, then "opatch lsinventory" works but I'm not sure if it's ok to set it manually?
I also checked the documentation and here http://download.oracle.com/docs/cd/B28359_01/em.111/b31207/oui5_cluster_environment.htm#OUICG267 it says: "After you click Next, the Oracle Universal Installer checks whether the remote inventories are set. If they are not set, the Oracle Universal Installer sets up the remote inventories by setting registry keys." So I suppose the registry key should exist also on the second node?
Thanks in advance for any answers.
Regards,
JureHi, mmm ... looks like remote operations fail during the installation process. Possible reasons for this error could be either a missing oraInst.loc file or permission issues with oraInst.loc file. Ensure user have read/write priviligies on orainst.loc file as well as on the actual path of orainventory location. If you could not fix the issue and if you know the inventory location you may want try following solution: "opatch apply -invPtrLoc C:\mypath\mypath\oraInst.loc" where "mypath" should be replaced by your windows locations. Also review you have all the oracle binaries in the 2nd. node.
Edited by: Jose Valerio on Nov 28, 2010 2:21 PM
Edited by: Jose Valerio on Nov 28, 2010 2:21 PM -
Optimizing a program (experts with a lot of time)
The following code is most of the code for a sale program. This is something i have been working on for a while now and it's almost finished. It does work, and with no errors that I have found so far, but it seems too complicated and long. I am asking that some of you more experienced programmers take a look at it and give me some advice or tips. It's quite a bit of code, so you don't have to look at all of it, just whatever you see.
This is the super class. It will soon be a full Log In for cashiers but right now it is just has two buttons for running the other two classes. It contains the open and save file methods that the others use to open the inventory file.
/** Java core packages*/
import java.util.*;
import java.text.*;
import java.awt.*;
import java.awt.event.*;
/** Java extension packages*/
import javax.swing.*;
import javax.swing.text.*;
import javax.swing.event.*;
import java.io.*;
/** This program is used to calculate the sale price
* of selected items and update the inventory with
* each sale. It opens and saves into a file "inventory.dat".
* @author Davin Green
public class LogIn extends JFrame
/** JTextField objects for the text fields that are used in these programs.*/
public JTextField jTextField1, jTextField2, jTextField3,
jTextField4, jTextField5, jTextField6;
/** JButton objects for the buttons that are used in these programs.*/
public JButton jButton1, jButton2, jButton3, jButton4,
jButton5, jButton6, jButton7;
/** JScrollPane object for the scrolling pane that is used in this program.*/
public JScrollPane jScrollPane1, jScrollPane2;
/** Label objects for the labels that are used in these programs.*/
public Label label1, label2, label3, label4,
label5, label6, label7;
/** Vector objects for the three vectors that are used in these programs.*/
public Vector id, qty, price, saleItems, saleItemsQty;
/** JList object for the list of Items from vector id used in this program.*/
public JList jList1;
private double salePrice;
/** Document objects for the three text fields that are used in this program.*/
public Document jText1, jText2, jText3;
/** DeciamlFormat object used to format display of money.*/
private DecimalFormat toMoney;
/** ObjectInputStream object for later inputing a stream.*/
private ObjectInputStream objectInput;
/** ObjectOutputStream object for later outputing a stream.*/
private ObjectOutputStream objectOutput;
private static LogIn window;
public static void main( String args[] )
window = new LogIn();
window.setSize(450, 400);
window.show();
public LogIn()
/** Get JFrames content pane and set layout to null.*/
Container container = getContentPane();
container.setLayout( new FlowLayout() );
jButton1 = new JButton();
jButton1.setText("Inventory Editor");
container.add(jButton1);
jButton2 = new JButton();
jButton2.setText("Make Sale");
container.add(jButton2);
jButton1.addActionListener(
new ActionListener()
public void actionPerformed( ActionEvent event )
Inventory inventory = new Inventory();
inventory.runInventory();
window.hide();
window = null;
jButton2.addActionListener(
new ActionListener()
public void actionPerformed( ActionEvent event )
Computer computer = new Computer();
computer.runComputer();
window.hide();
window = null;
public LogIn( String title )
super( title );
/** The openFile() method opens inventory.dat and saves it's information into three vectors.*/
public void openFile() throws IOException, ClassNotFoundException
Item item;
toMoney = new DecimalFormat( "0.00" );
id = new Vector();
qty = new Vector();
price = new Vector();
try {
int i = 0;
/** Opens file inventory.dat and saves data into buffer.*/
try {
objectInput = new ObjectInputStream( new FileInputStream( "C:/inventory.dat" ) );
catch ( FileNotFoundException fnfException )
objectOutput = new ObjectOutputStream( new FileOutputStream( "C:/inventory.dat" ) );
objectOutput.close();
objectInput = new ObjectInputStream( new FileInputStream( "C:/inventory.dat" ) );
JOptionPane.showMessageDialog( null, "Inventory file has been created.", "File Created", JOptionPane.INFORMATION_MESSAGE );
while ( true )
/** Reads one item object from inventory.dat.*/
item = ( Item ) objectInput.readObject();
String idString = item.getID();
String qtyString = "" + item.getQty();
String priceString = "" + toMoney.format (item.getPrice());
id.add( i, idString );
qty.add( i, qtyString );
price.add( i, priceString );
i++;
/** Closes file when end of file is reached.*/
catch ( EOFException eofException )
objectInput.close();
/** The Method exitForm() sets what to do when window is closed.*/
public void saveFile() throws IOException
/** Makes file inventory.dat.*/
objectOutput = new ObjectOutputStream( new FileOutputStream( "C:/inventory.dat" ));
/** Saves three vectors as objects of the Item class into inventory.dat.*/
for ( int i = 0; i < id.size(); i++ )
String idString = (String)id.get(i);
int qtyInt = Integer.parseInt( (String)qty.get(i) );
double priceDouble = Double.parseDouble( (String)price.get(i) );
Item item = new Item( idString, qtyInt, priceDouble );
objectOutput.writeObject( item );
/** Closes inventory.dat.*/
objectOutput.close();
}This is the computer class. It is used to calculate sale prices and print the reciept for each sale. It does everything it's supposed to except update the inventory, which I just haven't written the code for yet.
/** Java core packages*/
import java.util.*;
import java.text.*;
import java.awt.*;
import java.awt.event.*;
/** Java extension packages*/
import javax.swing.*;
import javax.swing.text.*;
import javax.swing.event.*;
import java.io.*;
/** This program is used to calculate the sale price
* of selected items and update the inventory with
* each sale. It opens and saves into a file "inventory.dat".
* @author Davin Green
public class Computer extends LogIn
private double salePrice;
private JTextArea jTextArea1;
private Choice choice1;
private JSeparator jSeparator1;
private static Computer window;
/** Default constructor.*/
public Computer()
super("Sale Program");
try{
try {
openFile();
createGUI();
registerCompEventHandlers();
salePrice = 0.0;
catch ( ClassNotFoundException e )
catch ( IOException e )
/** The createGUI() methods creates and displays GUI components in the JFrame.*/
private void createGUI()
jList1 = new JList();
saleItems = new Vector();
saleItemsQty = new Vector();
/** Get JFrames content pane and set layout to null.*/
Container container = getContentPane();
container.setLayout(null);
choice1 = new Choice();
makeChoiceMenu();
container.add(choice1);
choice1.setBounds(40, 50, 130, 20);
jButton1 = new JButton();
jButton1.setText("Add Item");
container.add(jButton1);
jButton1.setBounds(270, 50, 130, 20);
jButton2 = new JButton();
jButton2.setText("Remove Item");
container.add(jButton2);
jButton2.setBounds(270, 80, 130, 20);
jButton2.setEnabled( false );
jButton3 = new JButton();
jButton3.setText("Print Reciept");
container.add(jButton3);
jButton3.setBounds(270, 110, 130, 20);
jButton3.setEnabled( false );
jButton4 = new JButton();
jButton4.setText("New Sale");
container.add(jButton4);
jButton4.setBounds(270, 140, 130, 20);
jButton4.setEnabled( false );
jButton5 = new JButton();
jButton5.setText("Change Cashier");
container.add(jButton5);
jButton5.setBounds(410, 240, 130, 20);
jButton6 = new JButton();
jButton6.setText("Edit Inventory");
container.add(jButton6);
jButton6.setBounds(410, 270, 130, 20);
jButton7 = new JButton();
jButton7.setText("Edit Qty");
container.add(jButton7);
jButton7.setBounds(100, 80, 100, 20);
jButton7.setEnabled( false );
jScrollPane1 = new JScrollPane();
jTextArea1 = new JTextArea();
container.add(jScrollPane1);
jScrollPane1.setBounds(10, 190, 390, 100);
jScrollPane2 = new JScrollPane();
jScrollPane2.getViewport().add( jList1 );
container.add(jScrollPane2);
jScrollPane2.setBounds(410, 40, 130, 190);
jSeparator1 = new JSeparator();
container.add(jSeparator1);
jSeparator1.setBounds(10, 40, 390, 10);
jTextField1 = new JTextField();
jTextField1.setEditable(false);
jTextField1.setText("Cashier Name");
container.add(jTextField1);
jTextField1.setBounds(60, 10, 170, 20);
jTextField2 = new JTextField();
jTextField2.setEditable(false);
jTextField2.setBounds(240, 10, 80, 20);
jTextField3 = new JTextField();
jTextField3.setEditable(false);
DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.SHORT);
jTextField3.setText(dateFormat.format(new Date()));
container.add(jTextField3);
jTextField3.setBounds(330, 10, 70, 20);
jTextField4 = new JTextField();
jTextField4.setText("");
container.add(jTextField4);
jTextField4.setBounds(60, 80, 30, 20);
jText1 = jTextField4.getDocument();
jTextField5 = new JTextField();
jTextField5.setText("$0.00");
container.add(jTextField5);
jTextField5.setBounds(100, 140, 100, 20);
jTextField6 = new JTextField();
jTextField6.setEditable(false);
jTextField6.setText("$0.00");
container.add(jTextField6);
jTextField6.setBounds(100, 110, 100, 20);
label1 = new Label();
label1.setText("Cashier");
container.add(label1);
label1.setBounds(10, 10, 48, 20);
label2 = new Label();
label2.setText("Item");
container.add(label2);
label2.setBounds(10, 50, 28, 20);
label3 = new Label();
label3.setText("Selected Item");
container.add(label3);
label3.setBounds(410, 20, 90, 20);
label4 = new Label();
label4.setText("Reciept");
container.add(label4);
label4.setBounds(10, 170, 50, 20);
label5 = new Label();
label5.setText("Quantity");
container.add(label5);
label5.setBounds(10, 80, 50, 20);
label6 = new Label();
label6.setText("Amount Paid");
container.add(label6);
label6.setBounds(10, 140, 80, 20);
label7 = new Label();
label7.setText("Sale Price");
container.add(label7);
label7.setBounds(10, 110, 60, 20);
pack();
/** The method registerEventHandlers() sets what each GUI object does.*/
private void registerCompEventHandlers()
ActionListener al = new ActionListener(){
DateFormat fmt = DateFormat.getTimeInstance(DateFormat.SHORT);
public void actionPerformed(ActionEvent evt) {
jTextField2.setText(fmt.format(new Date()));
new javax.swing.Timer(1000, al).start();
getContentPane().add(jTextField2);
SwingUtilities.invokeLater(new Runnable(){
public void run() {
/** Sets program to call method exitForm() when window is closed.*/
addWindowListener( new WindowAdapter()
public void windowClosing(WindowEvent evt)
try {
saveFile();
System.exit(0);
catch ( IOException ioException )
/** Tells what to do when an item is selected on the drop down menu.*/
final ItemListener choiceListener;
choice1.addItemListener(
choiceListener = new ItemListener()
public void itemStateChanged( ItemEvent event )
boolean itemNotExist = true;
for ( int i = 0; i < saleItems.size(); i++ )
if ( choice1.getSelectedItem() == (String)saleItems.get( i ) )
itemNotExist = false;
jList1.setSelectedIndex( i );
jTextField4.setText( (String)saleItemsQty.get( i ) );
if ( itemNotExist == true )
jTextField4.setText( "" );
jButton1.setEnabled( itemNotExist );
jButton7.setEnabled( false );
/** When an item is selected, the items information is
* displayed in the corresponding text field.*/
jList1.addListSelectionListener(
new ListSelectionListener()
public void valueChanged( ListSelectionEvent event )
if ( event.getSource() == jList1 && !event.getValueIsAdjusting() )
int selection = 0;
String selectionQty;
try {
for ( int i = 0; i < choice1.getItemCount(); i++ )
if ( choice1.getItem(i) == jList1.getSelectedValue() )
selection = i;
selectionQty = (String)saleItemsQty.get( jList1.getSelectedIndex() );
choice1.select( selection );
catch ( ArrayIndexOutOfBoundsException aoobException )
selectionQty = "";
jTextField4.setText( selectionQty );
jButton1.setEnabled( false );
jButton2.setEnabled( true );
jButton3.setEnabled( true );
jButton4.setEnabled( true );
jButton7.setEnabled( false );
/** Listens to jTextField and detects changes. */
jText1.addDocumentListener(
new DocumentListener()
public void changedUpdate(DocumentEvent e)
if ( saleItems.size() > 0 )
for ( int i = 0; i < saleItems.size(); i++ )
if ( choice1.getSelectedItem() == (String)saleItems.get( i ) )
jButton1.setEnabled( false );
if ( jTextField4.getText() != saleItemsQty.get( i ) )
jButton7.setEnabled( true );
else
jButton7.setEnabled( false );
else
jButton1.setEnabled( true );
jButton7.setEnabled( false );
public void insertUpdate(DocumentEvent e)
if ( saleItems.size() > 0 )
for ( int i = 0; i < saleItems.size(); i++ )
if ( choice1.getSelectedItem() == (String)saleItems.get( i ) )
jButton1.setEnabled( false );
if ( jTextField4.getText() != saleItemsQty.get( i ) )
jButton7.setEnabled( true );
else
jButton7.setEnabled( false );
else
jButton1.setEnabled( true );
jButton7.setEnabled( false );
public void removeUpdate(DocumentEvent e)
if ( saleItems.size() > 0 )
for ( int i = 0; i < saleItems.size(); i++ )
if ( choice1.getSelectedItem() == (String)saleItems.get( i ) )
jButton1.setEnabled( false );
if ( jTextField4.getText() != saleItemsQty.get( i ) )
jButton7.setEnabled( true );
else
jButton7.setEnabled( false );
else
jButton1.setEnabled( true );
jButton7.setEnabled( false );
/** When "Add Item" button is clicked, a new element
* is added to each vector.*/
jButton1.addActionListener(
new ActionListener()
public void actionPerformed( ActionEvent event )
String quantity = jTextField4.getText();
jTextField4.setText( "" );
try{
for ( int i = 0; i < id.size(); i++ )
if ( (String)id.get(i) == choice1.getSelectedItem() )
salePrice += ( Double.parseDouble( (String)price.get(i) ) * Double.parseDouble( quantity ) );
String newPrice = "$" + salePrice;
saleItems.add( choice1.getSelectedItem() );
saleItemsQty.add( quantity );
jList1.setListData( saleItems );
jScrollPane2.revalidate();
jScrollPane2.repaint();
jTextField6.setText( newPrice );
jButton1.setEnabled( false );
catch ( NumberFormatException num )
JOptionPane.showMessageDialog( null, "Please enter a valid quantity!", "Error", JOptionPane.ERROR_MESSAGE );
jList1.setSelectedIndex( saleItems.size() - 1 );
/** When "Remove" button is clicked, the selected item is removed
* from all vectors.*/
jButton2.addActionListener(
new ActionListener()
public void actionPerformed( ActionEvent event )
try {
int selection = jList1.getSelectedIndex();
for ( int i = 0; i < id.size(); i++ )
if ( (String)id.get(i) == choice1.getSelectedItem() )
salePrice -= ( Double.parseDouble( (String)price.get(i) ) * Double.parseDouble( (String)saleItemsQty.get( selection ) ) );
String newPrice = "$" + salePrice;
saleItems.removeElementAt( selection );
saleItemsQty.removeElementAt( selection );
jList1.setListData( saleItems );
jScrollPane2.revalidate();
jScrollPane2.repaint();
jTextField6.setText( newPrice );
if( selection >= id.size() )
selection = id.size() - 1;
jList1.setSelectedIndex( selection );
catch ( ArrayIndexOutOfBoundsException exception )
JOptionPane.showMessageDialog( null, "Please select an item to remove!", "Error", JOptionPane.ERROR_MESSAGE );
if ( saleItems.size() == 0 )
jButton2.setEnabled( false );
else
jButton2.setEnabled( true );
/** When "Set Qty" button is clicked, the quantity of
* the selected item is changed to the integer in
* the qty text field.*/
jButton7.addActionListener(
new ActionListener()
public void actionPerformed( ActionEvent event )
int selection = jList1.getSelectedIndex();
String newQty = jTextField4.getText();
try {
int numbertest = Integer.parseInt( newQty );
for ( int i = 0; i < id.size(); i++ )
if ( (String)id.get(i) == choice1.getSelectedItem() )
salePrice -= ( Double.parseDouble( (String)price.get(i) ) * Double.parseDouble( (String)saleItemsQty.get( selection ) ) );
salePrice += ( Double.parseDouble( (String)price.get(i) ) * Double.parseDouble( newQty ) );
String newPrice = "$" + salePrice;
saleItems.set( selection, choice1.getSelectedItem() );
saleItemsQty.set( selection, newQty );
jScrollPane2.revalidate();
jScrollPane2.repaint();
jTextField6.setText( newPrice );
jButton7.setEnabled( false );
catch ( NumberFormatException badinput )
JOptionPane.showMessageDialog( null, "Please enter an integer!", "Error", JOptionPane.ERROR_MESSAGE );
/** When "Print Reciept" button is clicked, the price of
* the selected item is changed to the double in
* the price text field.*/
jButton3.addActionListener(
new ActionListener()
public void actionPerformed( ActionEvent event )
try{
String reciept = "\tStore Name";
String items = "";
String temp = jTextField5.getText();
String amountPaidString = "";
double amountPaid = 0.0;
double change;
for ( int i = 1; i < temp.length(); i++ )
char a = temp.charAt(0);
char b = temp.charAt(i);
if ( a == '$' )
amountPaidString += b;
else
amountPaidString = "Error";
amountPaid = Double.parseDouble( amountPaidString );
if (amountPaid >= salePrice)
change = amountPaid - salePrice;
reciept += "\nDate: " + jTextField3.getText()
+ "\t\tTime: " + jTextField2.getText()
+ "\nCashier: " + jTextField1.getText()
+ "\n\n\tItems:";
for ( int i = 0; i < saleItems.size(); i++ )
items += "\n" + saleItems.get( i ) + "\t\t$";
for ( int h = 0; h < id.size(); h++ )
if ( (String)id.get(h) == (String)saleItems.get( i ) )
items += ( Double.parseDouble( (String)price.get(h) ) * Double.parseDouble( (String)saleItemsQty.get(h) ) );
reciept += items + "\n\nTOTAL:\t$" + salePrice
+ "\nAmount Paid:\t$" + amountPaid
+ "\nChange:\t$" + change;
jTextArea1.setText( reciept );
jScrollPane1.getViewport().add( jTextArea1 );
jScrollPane1.revalidate();
jScrollPane1.repaint();
jButton1.setEnabled( false );
jButton2.setEnabled( false );
jButton3.setEnabled( false );
jButton7.setEnabled( false );
jTextField4.setEditable( false );
jTextField5.setEditable( false );
choice1.removeItemListener( choiceListener );
else
JOptionPane.showMessageDialog( null, "Amount Paid is not enough!", "Error", JOptionPane.ERROR_MESSAGE );
catch ( NumberFormatException badinput )
JOptionPane.showMessageDialog( null, "Please enter a valid amount paid!", "Error", JOptionPane.ERROR_MESSAGE );
jButton4.addActionListener(
new ActionListener()
public void actionPerformed( ActionEvent event )
int select = 3;
select = JOptionPane.showConfirmDialog( null, "Are you sure you want quit this sale?" );
if (select == 0)
String[] run = {"xxx","yyy"};
window.hide();
main( run );
jButton5.addActionListener(
new ActionListener()
public void actionPerformed( ActionEvent event )
/* Code for what to do when "Change Cashier" button is clicked*/ /*
jButton6.addActionListener(
new ActionListener()
public void actionPerformed( ActionEvent event )
Inventory inventory = new Inventory();
try{
saveFile();
catch ( IOException e )
window.hide();
inventory.runInventory();
window = null;
private void makeChoiceMenu()
for ( int i = 0; i < id.size(); i++ )
choice1.add( (String)id.get( i ) );
/** The main method.*/
public static void runComputer()
window = new Computer();
window.setSize(555, 335);
window.show();
}This is the inventory class. It's used to make and edit the items in the inventory and then save them into the inventory file.
/** Java core packages*/
import java.util.*;
import java.text.*;
import java.awt.*;
import java.awt.event.*;
/** Java extension packages*/
import javax.swing.*;
import javax.swing.text.*;
import javax.swing.event.*;
import java.io.*;
/** This program displays the inventory of a store and
* allows user to edit each items name, quantity, and
* price. It opens and saves into a file "inventory.dat".
* @author Davin Green
public class Inventory extends LogIn
private static Inventory window;
/** Default constructor.*/
public Inventory()
super("Inventory Editor");
try{
try{
openFile();
createInvGUI();
registerInvEventHandlers();
catch ( IOException e )
catch ( ClassNotFoundException e )
/** The createGUI() methods creates and displays GUI components in the JFrame.*/
private void createInvGUI() throws IOException
/** Get JFrames content pane and set layout to null.*/
Container container = getContentPane();
container.setLayout(null);
/** List of items displayed in scrolling pane.*/
jList1 = new JList( id );
/** Put JList into the scrolling pane, add scrolling pane
* to content pane, and set position and size.*/
jScrollPane1 = new JScrollPane();
jScrollPane1.getViewport().add( jList1 );
container.add(jScrollPane1);
jScrollPane1.setBounds(0, 0, 210, 370);
/** Button for adding a new item.*/
jButton1 = new JButton();
jButton1.setText("Add Item");
container.add(jButton1);
jButton1.setBounds(240, 10, 90, 30);
/** Button for deleting a selected item.*/
jButton2 = new JButton();
jButton2.setText("Delete");
container.add(jButton2);
jButton2.setBounds(290, 50, 90, 30);
/** Button for setting the quantity of an item.*/
jButton3 = new JButton();
jButton3.setText("Set Qty");
container.add(jButton3);
jButton3.setBounds(240, 100, 90, 30);
/** Button for setting the price of an item.*/
jButton4 = new JButton();
jButton4.setText("Set Price");
container.add(jButton4);
jButton4.setBounds(240, 150, 90, 30);
/** Text field for inputing and displaying the id (name) of an item.*/
jTextField1 = new JTextField();
container.add(jTextField1);
jTextField1.setBounds(340, 10, 93, 30);
jText1 = jTextField1.getDocument();
/** Text field for inputing and displaying the quantity of an item.*/
jTextField2 = new JTextField();
container.add(jTextField2);
jTextField2.setBounds(370, 100, 43, 30);
jText2 = jTextField2.getDocument();
/** Text field for inputing and displaying the price of an item.*/
jTextField3 = new JTextField();
container.add(jTextField3);
jTextField3.setBounds(370, 150, 43, 30);
jText3 = jTextField3.getDocument();
/** Displays "Qty" before the quantity text field.*/
label1 = new Label();
label1.setText("Qty");
container.add(label1);
label1.setBounds(350, 100, 20, 20);
/** Displays "Price" before the price text field.*/
label2 = new Label();
label2.setText("Price");
container.add(label2);
label2.setBounds(340, 150, 30, 20);
/** Button to change cashier (return to cashier log-in panel).*/
jButton5 = new JButton();
jButton5.setText("Change Cashier");
container.add(jButton5);
jButton5.setBounds(260, 270, 130, 30);
/** Button to make sell (open make sell panel).*/
jButton6 = new JButton();
/** JTextField objects for the text fields that are used in these programs.*/
public JTextField jTextField1, jTextField2, jTextField3,
jTextField4, jTextField5, jTextField6;Your variable names don't mean anything.
So the person who has to maintain this program when you leave has a difficult task.
If there was some indication that the operator would key in (say) a quantity, that would
make it easier. You might name it "quantityText" in that case, or something like that.
Maybe you are looking for
-
Hi I am facing problem in Sales Order I have created a Sales Order for four different material. Line item 10 XYZ with 6 quantity , but for this material ATP is not working. When i am clicking on ATP icon, in schedule lines tab, Order qty is coming 6,
-
Ipod 911--everything is broken!
My iPod was having battery problems, and it was connected to my computer but iTunes crashed when I foolishly tried to add a file to the iPod. This caused my computer to crash, and since then when I try to use the iPod, no songs show up at all (looks
-
Kerning Caution! It can kill your Motion file.
Kern carefully. There is a bug that can render your motion file un-openable! I will describe it in detail here to see if anyone else can reproduce it. I was able to reproduce it consistently, even with a new file. I wanted to adjust the beginning of
-
Yellow warning signs with ! in it
I am working in imovie-- do not know what I did-- but in my project libary one of my movies have the yellow warning sign with ! in it--- when I try to watch the movie all that comes is --sourse clip is missing, sign. Please help me as I want to keep
-
Trying to download Photoshop CS3 for Mac but keep getting error message (HTTP ERROR: 404 /support/downloads/dlm/main.jsp, RequestURI=/support/downloads/dlm/main.jsp)