updated transaction interface
This commit is contained in:
		
							parent
							
								
									4eae82c7e1
								
							
						
					
					
						commit
						95ac6ebee3
					
				
					 2 changed files with 432 additions and 74 deletions
				
			
		|  | @ -1,6 +1,6 @@ | |||
| <?xml version="1.0" encoding="UTF-8" ?> | ||||
| 
 | ||||
| <Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo"> | ||||
| <Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo"> | ||||
|   <Properties> | ||||
|     <Property name="defaultCloseOperation" type="int" value="0"/> | ||||
|     <Property name="title" type="java.lang.String" value="POSware Lite: Transaction"/> | ||||
|  | @ -39,7 +39,7 @@ | |||
| 
 | ||||
|       <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/> | ||||
|       <SubComponents> | ||||
|         <Component class="javax.swing.JComboBox" name="jComboBox1"> | ||||
|         <Component class="javax.swing.JComboBox" name="jComboBox_Payment"> | ||||
|           <Properties> | ||||
|             <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor"> | ||||
|               <StringArray count="4"> | ||||
|  | @ -59,10 +59,27 @@ | |||
|             </Constraint> | ||||
|           </Constraints> | ||||
|         </Component> | ||||
|         <Component class="javax.swing.JLabel" name="jLabel1"> | ||||
|         <Component class="javax.swing.JLabel" name="jLabel_Status"> | ||||
|           <Properties> | ||||
|             <Property name="text" type="java.lang.String" value="jLabel1"/> | ||||
|             <Property name="horizontalAlignment" type="int" value="0"/> | ||||
|             <Property name="text" type="java.lang.String" value="Store"/> | ||||
|           </Properties> | ||||
|           <Constraints> | ||||
|             <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription"> | ||||
|               <BorderConstraints direction="Center"/> | ||||
|             </Constraint> | ||||
|           </Constraints> | ||||
|         </Component> | ||||
|         <Component class="javax.swing.JToggleButton" name="jToggleButton_Discard"> | ||||
|           <Properties> | ||||
|             <Property name="text" type="java.lang.String" value="Discard"/> | ||||
|           </Properties> | ||||
|           <Events> | ||||
|             <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jToggleButton_DiscardActionPerformed"/> | ||||
|           </Events> | ||||
|           <AuxValues> | ||||
|             <AuxValue name="JavaCodeGenerator_AddingCodePost" type="java.lang.String" value="jToggleButton_Discard.setVisible(interface_adjust_clear());"/> | ||||
|           </AuxValues> | ||||
|           <Constraints> | ||||
|             <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription"> | ||||
|               <BorderConstraints direction="Before"/> | ||||
|  | @ -129,7 +146,7 @@ | |||
|                   <SubComponents> | ||||
|                     <Component class="javax.swing.JLabel" name="jLabel_price_VAT"> | ||||
|                       <Properties> | ||||
|                         <Property name="text" type="java.lang.String" value="VAT"/> | ||||
|                         <Property name="text" type="java.lang.String" value="Tax"/> | ||||
|                       </Properties> | ||||
|                       <Constraints> | ||||
|                         <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> | ||||
|  | @ -168,6 +185,14 @@ | |||
|                       </Constraints> | ||||
|                     </Component> | ||||
|                     <Component class="javax.swing.JSpinner" name="jSpinner_price_tip_value"> | ||||
|                       <Properties> | ||||
|                         <Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor"> | ||||
|                           <Connection code="model_price" type="code"/> | ||||
|                         </Property> | ||||
|                       </Properties> | ||||
|                       <AuxValues> | ||||
|                         <AuxValue name="JavaCodeGenerator_AddingCodePost" type="java.lang.String" value="jSpinner_price_tip_value.addChangeListener(new ChangeListener() {
    public void stateChanged(ChangeEvent e) {
        cart_tip_add();
    }
});"/> | ||||
|                       </AuxValues> | ||||
|                       <Constraints> | ||||
|                         <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> | ||||
|                           <GridBagConstraints gridX="1" gridY="1" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="0.0"/> | ||||
|  | @ -177,7 +202,7 @@ | |||
|                     <Component class="javax.swing.JTextField" name="jTextField_price_VAT_value"> | ||||
|                       <Properties> | ||||
|                         <Property name="editable" type="boolean" value="false"/> | ||||
|                         <Property name="text" type="java.lang.String" value="0"/> | ||||
|                         <Property name="horizontalAlignment" type="int" value="11"/> | ||||
|                       </Properties> | ||||
|                       <Constraints> | ||||
|                         <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> | ||||
|  | @ -188,6 +213,7 @@ | |||
|                     <Component class="javax.swing.JTextField" name="jTextField_price_subtotal_value"> | ||||
|                       <Properties> | ||||
|                         <Property name="editable" type="boolean" value="false"/> | ||||
|                         <Property name="horizontalAlignment" type="int" value="11"/> | ||||
|                         <Property name="text" type="java.lang.String" value="0"/> | ||||
|                       </Properties> | ||||
|                       <Constraints> | ||||
|  | @ -202,8 +228,8 @@ | |||
|                         <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> | ||||
|                           <Font name="Dialog" size="20" style="1"/> | ||||
|                         </Property> | ||||
|                         <Property name="horizontalAlignment" type="int" value="11"/> | ||||
|                         <Property name="text" type="java.lang.String" value="0"/> | ||||
|                         <Property name="dragEnabled" type="boolean" value="false"/> | ||||
|                       </Properties> | ||||
|                       <Constraints> | ||||
|                         <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> | ||||
|  | @ -211,26 +237,6 @@ | |||
|                         </Constraint> | ||||
|                       </Constraints> | ||||
|                     </Component> | ||||
|                     <Component class="javax.swing.JComboBox" name="jComboBox_information_discount_selections"> | ||||
|                       <Properties> | ||||
|                         <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor"> | ||||
|                           <StringArray count="4"> | ||||
|                             <StringItem index="0" value="Item 1"/> | ||||
|                             <StringItem index="1" value="Item 2"/> | ||||
|                             <StringItem index="2" value="Item 3"/> | ||||
|                             <StringItem index="3" value="Item 4"/> | ||||
|                           </StringArray> | ||||
|                         </Property> | ||||
|                       </Properties> | ||||
|                       <AuxValues> | ||||
|                         <AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<String>"/> | ||||
|                       </AuxValues> | ||||
|                       <Constraints> | ||||
|                         <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> | ||||
|                           <GridBagConstraints gridX="1" gridY="2" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/> | ||||
|                         </Constraint> | ||||
|                       </Constraints> | ||||
|                     </Component> | ||||
|                     <Component class="javax.swing.JLabel" name="jLabel2_information_discount"> | ||||
|                       <Properties> | ||||
|                         <Property name="text" type="java.lang.String" value="Discount"/> | ||||
|  | @ -241,6 +247,17 @@ | |||
|                         </Constraint> | ||||
|                       </Constraints> | ||||
|                     </Component> | ||||
|                     <Component class="javax.swing.JTextField" name="jTextField_price_discounted"> | ||||
|                       <Properties> | ||||
|                         <Property name="editable" type="boolean" value="false"/> | ||||
|                         <Property name="horizontalAlignment" type="int" value="11"/> | ||||
|                       </Properties> | ||||
|                       <Constraints> | ||||
|                         <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> | ||||
|                           <GridBagConstraints gridX="1" gridY="2" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="0.0"/> | ||||
|                         </Constraint> | ||||
|                       </Constraints> | ||||
|                     </Component> | ||||
|                   </SubComponents> | ||||
|                 </Container> | ||||
|               </SubComponents> | ||||
|  | @ -259,14 +276,14 @@ | |||
| 
 | ||||
|           <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"/> | ||||
|           <SubComponents> | ||||
|             <Container class="javax.swing.JPanel" name="jPanel2"> | ||||
|             <Container class="javax.swing.JPanel" name="jPanel_Inventory"> | ||||
| 
 | ||||
|               <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/> | ||||
|               <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> | ||||
|               <SubComponents> | ||||
|                 <Container class="javax.swing.JPanel" name="jPanel_Inventory_Actions"> | ||||
|                   <Constraints> | ||||
|                     <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription"> | ||||
|                       <BorderConstraints direction="South"/> | ||||
|                     <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> | ||||
|                       <GridBagConstraints gridX="0" gridY="2" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="0.0"/> | ||||
|                     </Constraint> | ||||
|                   </Constraints> | ||||
| 
 | ||||
|  | @ -289,6 +306,11 @@ | |||
|                       </Constraints> | ||||
|                     </Component> | ||||
|                     <Component class="javax.swing.JSpinner" name="jSpinner_item_quantity"> | ||||
|                       <Properties> | ||||
|                         <Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor"> | ||||
|                           <Connection code="model_counting" type="code"/> | ||||
|                         </Property> | ||||
|                       </Properties> | ||||
|                       <Constraints> | ||||
|                         <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription"> | ||||
|                           <BorderConstraints direction="Center"/> | ||||
|  | @ -318,8 +340,8 @@ | |||
|                     <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> | ||||
|                   </AuxValues> | ||||
|                   <Constraints> | ||||
|                     <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription"> | ||||
|                       <BorderConstraints direction="Center"/> | ||||
|                     <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> | ||||
|                       <GridBagConstraints gridX="0" gridY="0" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="1.0"/> | ||||
|                     </Constraint> | ||||
|                   </Constraints> | ||||
| 
 | ||||
|  | @ -327,22 +349,93 @@ | |||
|                   <SubComponents> | ||||
|                     <Component class="javax.swing.JList" name="jList1_Inventory"> | ||||
|                       <Properties> | ||||
|                         <Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor"> | ||||
|                           <StringArray count="5"> | ||||
|                             <StringItem index="0" value="Item 1"/> | ||||
|                             <StringItem index="1" value="Item 2"/> | ||||
|                             <StringItem index="2" value="Item 3"/> | ||||
|                             <StringItem index="3" value="Item 4"/> | ||||
|                             <StringItem index="4" value="Item 5"/> | ||||
|                           </StringArray> | ||||
|                         <Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor"> | ||||
|                           <Connection code="refresh_inventory_list()" type="code"/> | ||||
|                         </Property> | ||||
|                       </Properties> | ||||
|                       <Events> | ||||
|                         <EventHandler event="valueChanged" listener="javax.swing.event.ListSelectionListener" parameters="javax.swing.event.ListSelectionEvent" handler="jList1_InventoryValueChanged"/> | ||||
|                       </Events> | ||||
|                       <AuxValues> | ||||
|                         <AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<String>"/> | ||||
|                       </AuxValues> | ||||
|                     </Component> | ||||
|                   </SubComponents> | ||||
|                 </Container> | ||||
|                 <Container class="javax.swing.JPanel" name="jPanel_ItemDetails"> | ||||
|                   <Constraints> | ||||
|                     <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> | ||||
|                       <GridBagConstraints gridX="0" gridY="1" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="0.0"/> | ||||
|                     </Constraint> | ||||
|                   </Constraints> | ||||
| 
 | ||||
|                   <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> | ||||
|                   <SubComponents> | ||||
|                     <Component class="javax.swing.JLabel" name="jLabel_ItemDetails_SKU"> | ||||
|                       <Properties> | ||||
|                         <Property name="text" type="java.lang.String" value="SKU"/> | ||||
|                       </Properties> | ||||
|                       <Constraints> | ||||
|                         <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> | ||||
|                           <GridBagConstraints gridX="0" gridY="0" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/> | ||||
|                         </Constraint> | ||||
|                       </Constraints> | ||||
|                     </Component> | ||||
|                     <Component class="javax.swing.JTextField" name="jTextField_ItemDetails_SKU"> | ||||
|                       <Properties> | ||||
|                         <Property name="editable" type="boolean" value="false"/> | ||||
|                         <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> | ||||
|                           <Font name="Dialog" size="18" style="0"/> | ||||
|                         </Property> | ||||
|                       </Properties> | ||||
|                       <Constraints> | ||||
|                         <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> | ||||
|                           <GridBagConstraints gridX="1" gridY="0" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="0.0"/> | ||||
|                         </Constraint> | ||||
|                       </Constraints> | ||||
|                     </Component> | ||||
|                     <Component class="javax.swing.JLabel" name="jLabel_ItemDetails_UnitPrice"> | ||||
|                       <Properties> | ||||
|                         <Property name="text" type="java.lang.String" value="Unit Price"/> | ||||
|                       </Properties> | ||||
|                       <Constraints> | ||||
|                         <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> | ||||
|                           <GridBagConstraints gridX="0" gridY="1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/> | ||||
|                         </Constraint> | ||||
|                       </Constraints> | ||||
|                     </Component> | ||||
|                     <Component class="javax.swing.JTextField" name="jTextField_ItemDetails_UnitPrice"> | ||||
|                       <Properties> | ||||
|                         <Property name="editable" type="boolean" value="false"/> | ||||
|                       </Properties> | ||||
|                       <Constraints> | ||||
|                         <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> | ||||
|                           <GridBagConstraints gridX="1" gridY="1" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="0.0"/> | ||||
|                         </Constraint> | ||||
|                       </Constraints> | ||||
|                     </Component> | ||||
|                     <Component class="javax.swing.JLabel" name="jLabel_ItemDetails_Discount"> | ||||
|                       <Properties> | ||||
|                         <Property name="text" type="java.lang.String" value="Discount"/> | ||||
|                       </Properties> | ||||
|                       <Constraints> | ||||
|                         <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> | ||||
|                           <GridBagConstraints gridX="0" gridY="2" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/> | ||||
|                         </Constraint> | ||||
|                       </Constraints> | ||||
|                     </Component> | ||||
|                     <Component class="javax.swing.JTextField" name="jTextField_ItemDetails_Discount"> | ||||
|                       <Properties> | ||||
|                         <Property name="editable" type="boolean" value="false"/> | ||||
|                       </Properties> | ||||
|                       <Constraints> | ||||
|                         <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> | ||||
|                           <GridBagConstraints gridX="1" gridY="2" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="0.0"/> | ||||
|                         </Constraint> | ||||
|                       </Constraints> | ||||
|                     </Component> | ||||
|                   </SubComponents> | ||||
|                 </Container> | ||||
|               </SubComponents> | ||||
|             </Container> | ||||
|           </SubComponents> | ||||
|  |  | |||
|  | @ -3,8 +3,13 @@ | |||
|  * Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template | ||||
|  */ | ||||
| package tech.iBeans.POSware.Lite; | ||||
| import java.util.*; | ||||
| import javax.swing.*; | ||||
| import javax.swing.event.*; | ||||
| import tech.iBeans.POSware.Lite.transaction; | ||||
| import tech.iBeans.POSware.Lite.transact; | ||||
| import tech.iBeans.POSware.Lite.WindowManagement; | ||||
| import tech.iBeans.POSware.Lite.receipt; | ||||
| 
 | ||||
| /** | ||||
|  * | ||||
|  | @ -16,6 +21,7 @@ public class OnTransact extends javax.swing.JFrame { | |||
|      * Creates new form OnTransact | ||||
|      */ | ||||
|     private OnTransact() { | ||||
|         transact.init(); | ||||
|         initComponents(); | ||||
|     } | ||||
| 
 | ||||
|  | @ -30,8 +36,9 @@ public class OnTransact extends javax.swing.JFrame { | |||
|         java.awt.GridBagConstraints gridBagConstraints; | ||||
| 
 | ||||
|         jPanel_statusinfo = new javax.swing.JPanel(); | ||||
|         jComboBox1 = new javax.swing.JComboBox<>(); | ||||
|         jLabel1 = new javax.swing.JLabel(); | ||||
|         jComboBox_Payment = new javax.swing.JComboBox<>(); | ||||
|         jLabel_Status = new javax.swing.JLabel(); | ||||
|         jToggleButton_Discard = new javax.swing.JToggleButton(); | ||||
|         jPanel_Main = new javax.swing.JPanel(); | ||||
|         jPanel_Items = new javax.swing.JPanel(); | ||||
|         jScrollPane1 = new javax.swing.JScrollPane(); | ||||
|  | @ -46,16 +53,23 @@ public class OnTransact extends javax.swing.JFrame { | |||
|         jTextField_price_VAT_value = new javax.swing.JTextField(); | ||||
|         jTextField_price_subtotal_value = new javax.swing.JTextField(); | ||||
|         jTextField_price_total_value = new javax.swing.JTextField(); | ||||
|         jComboBox_information_discount_selections = new javax.swing.JComboBox<>(); | ||||
|         jLabel2_information_discount = new javax.swing.JLabel(); | ||||
|         jTextField_price_discounted = new javax.swing.JTextField(); | ||||
|         jToolBar_Inventory = new javax.swing.JToolBar(); | ||||
|         jPanel2 = new javax.swing.JPanel(); | ||||
|         jPanel_Inventory = new javax.swing.JPanel(); | ||||
|         jPanel_Inventory_Actions = new javax.swing.JPanel(); | ||||
|         jButton_item_void = new javax.swing.JButton(); | ||||
|         jSpinner_item_quantity = new javax.swing.JSpinner(); | ||||
|         jButton_item_add = new javax.swing.JButton(); | ||||
|         jScrollPane_Inventory = new javax.swing.JScrollPane(); | ||||
|         jList1_Inventory = new javax.swing.JList<>(); | ||||
|         jPanel_ItemDetails = new javax.swing.JPanel(); | ||||
|         jLabel_ItemDetails_SKU = new javax.swing.JLabel(); | ||||
|         jTextField_ItemDetails_SKU = new javax.swing.JTextField(); | ||||
|         jLabel_ItemDetails_UnitPrice = new javax.swing.JLabel(); | ||||
|         jTextField_ItemDetails_UnitPrice = new javax.swing.JTextField(); | ||||
|         jLabel_ItemDetails_Discount = new javax.swing.JLabel(); | ||||
|         jTextField_ItemDetails_Discount = new javax.swing.JTextField(); | ||||
| 
 | ||||
|         setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE); | ||||
|         setTitle("POSware Lite: Transaction"); | ||||
|  | @ -68,11 +82,21 @@ public class OnTransact extends javax.swing.JFrame { | |||
| 
 | ||||
|         jPanel_statusinfo.setLayout(new java.awt.BorderLayout()); | ||||
| 
 | ||||
|         jComboBox1.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); | ||||
|         jPanel_statusinfo.add(jComboBox1, java.awt.BorderLayout.EAST); | ||||
|         jComboBox_Payment.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); | ||||
|         jPanel_statusinfo.add(jComboBox_Payment, java.awt.BorderLayout.EAST); | ||||
| 
 | ||||
|         jLabel1.setText("jLabel1"); | ||||
|         jPanel_statusinfo.add(jLabel1, java.awt.BorderLayout.LINE_START); | ||||
|         jLabel_Status.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); | ||||
|         jLabel_Status.setText("Store"); | ||||
|         jPanel_statusinfo.add(jLabel_Status, java.awt.BorderLayout.CENTER); | ||||
| 
 | ||||
|         jToggleButton_Discard.setText("Discard"); | ||||
|         jToggleButton_Discard.addActionListener(new java.awt.event.ActionListener() { | ||||
|             public void actionPerformed(java.awt.event.ActionEvent evt) { | ||||
|                 jToggleButton_DiscardActionPerformed(evt); | ||||
|             } | ||||
|         }); | ||||
|         jPanel_statusinfo.add(jToggleButton_Discard, java.awt.BorderLayout.LINE_START); | ||||
|         jToggleButton_Discard.setVisible(interface_adjust_clear()); | ||||
| 
 | ||||
|         getContentPane().add(jPanel_statusinfo, java.awt.BorderLayout.PAGE_END); | ||||
| 
 | ||||
|  | @ -92,7 +116,7 @@ public class OnTransact extends javax.swing.JFrame { | |||
| 
 | ||||
|         jPanel_Information.setLayout(new java.awt.GridBagLayout()); | ||||
| 
 | ||||
|         jLabel_price_VAT.setText("VAT"); | ||||
|         jLabel_price_VAT.setText("Tax"); | ||||
|         gridBagConstraints = new java.awt.GridBagConstraints(); | ||||
|         gridBagConstraints.gridx = 0; | ||||
|         gridBagConstraints.gridy = 0; | ||||
|  | @ -116,15 +140,22 @@ public class OnTransact extends javax.swing.JFrame { | |||
|         gridBagConstraints.gridy = 1; | ||||
|         gridBagConstraints.gridheight = 2; | ||||
|         jPanel_Information.add(jLabel_price_total, gridBagConstraints); | ||||
| 
 | ||||
|         jSpinner_price_tip_value.setModel(model_price); | ||||
|         gridBagConstraints = new java.awt.GridBagConstraints(); | ||||
|         gridBagConstraints.gridx = 1; | ||||
|         gridBagConstraints.gridy = 1; | ||||
|         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; | ||||
|         gridBagConstraints.weightx = 1.0; | ||||
|         jPanel_Information.add(jSpinner_price_tip_value, gridBagConstraints); | ||||
|         jSpinner_price_tip_value.addChangeListener(new ChangeListener() { | ||||
|             public void stateChanged(ChangeEvent e) { | ||||
|                 cart_tip_add(); | ||||
|             } | ||||
|         }); | ||||
| 
 | ||||
|         jTextField_price_VAT_value.setEditable(false); | ||||
|         jTextField_price_VAT_value.setText("0"); | ||||
|         jTextField_price_VAT_value.setHorizontalAlignment(javax.swing.JTextField.TRAILING); | ||||
|         gridBagConstraints = new java.awt.GridBagConstraints(); | ||||
|         gridBagConstraints.gridx = 1; | ||||
|         gridBagConstraints.gridy = 0; | ||||
|  | @ -133,6 +164,7 @@ public class OnTransact extends javax.swing.JFrame { | |||
|         jPanel_Information.add(jTextField_price_VAT_value, gridBagConstraints); | ||||
| 
 | ||||
|         jTextField_price_subtotal_value.setEditable(false); | ||||
|         jTextField_price_subtotal_value.setHorizontalAlignment(javax.swing.JTextField.TRAILING); | ||||
|         jTextField_price_subtotal_value.setText("0"); | ||||
|         gridBagConstraints = new java.awt.GridBagConstraints(); | ||||
|         gridBagConstraints.gridx = 3; | ||||
|  | @ -143,8 +175,8 @@ public class OnTransact extends javax.swing.JFrame { | |||
| 
 | ||||
|         jTextField_price_total_value.setEditable(false); | ||||
|         jTextField_price_total_value.setFont(new java.awt.Font("Dialog", 1, 20)); // NOI18N | ||||
|         jTextField_price_total_value.setHorizontalAlignment(javax.swing.JTextField.TRAILING); | ||||
|         jTextField_price_total_value.setText("0"); | ||||
|         jTextField_price_total_value.setDragEnabled(false); | ||||
|         gridBagConstraints = new java.awt.GridBagConstraints(); | ||||
|         gridBagConstraints.gridx = 3; | ||||
|         gridBagConstraints.gridy = 1; | ||||
|  | @ -153,19 +185,21 @@ public class OnTransact extends javax.swing.JFrame { | |||
|         gridBagConstraints.weightx = 1.0; | ||||
|         jPanel_Information.add(jTextField_price_total_value, gridBagConstraints); | ||||
| 
 | ||||
|         jComboBox_information_discount_selections.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); | ||||
|         gridBagConstraints = new java.awt.GridBagConstraints(); | ||||
|         gridBagConstraints.gridx = 1; | ||||
|         gridBagConstraints.gridy = 2; | ||||
|         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; | ||||
|         jPanel_Information.add(jComboBox_information_discount_selections, gridBagConstraints); | ||||
| 
 | ||||
|         jLabel2_information_discount.setText("Discount"); | ||||
|         gridBagConstraints = new java.awt.GridBagConstraints(); | ||||
|         gridBagConstraints.gridx = 0; | ||||
|         gridBagConstraints.gridy = 2; | ||||
|         jPanel_Information.add(jLabel2_information_discount, gridBagConstraints); | ||||
| 
 | ||||
|         jTextField_price_discounted.setEditable(false); | ||||
|         jTextField_price_discounted.setHorizontalAlignment(javax.swing.JTextField.TRAILING); | ||||
|         gridBagConstraints = new java.awt.GridBagConstraints(); | ||||
|         gridBagConstraints.gridx = 1; | ||||
|         gridBagConstraints.gridy = 2; | ||||
|         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; | ||||
|         gridBagConstraints.weightx = 1.0; | ||||
|         jPanel_Information.add(jTextField_price_discounted, gridBagConstraints); | ||||
| 
 | ||||
|         jToolBar_Information.add(jPanel_Information); | ||||
| 
 | ||||
|         jPanel_Items.add(jToolBar_Information, java.awt.BorderLayout.SOUTH); | ||||
|  | @ -174,7 +208,7 @@ public class OnTransact extends javax.swing.JFrame { | |||
| 
 | ||||
|         jToolBar_Inventory.setRollover(true); | ||||
| 
 | ||||
|         jPanel2.setLayout(new java.awt.BorderLayout()); | ||||
|         jPanel_Inventory.setLayout(new java.awt.GridBagLayout()); | ||||
| 
 | ||||
|         jPanel_Inventory_Actions.setLayout(new java.awt.BorderLayout()); | ||||
| 
 | ||||
|  | @ -188,6 +222,8 @@ public class OnTransact extends javax.swing.JFrame { | |||
|             } | ||||
|         }); | ||||
|         jPanel_Inventory_Actions.add(jButton_item_void, java.awt.BorderLayout.LINE_START); | ||||
| 
 | ||||
|         jSpinner_item_quantity.setModel(model_counting); | ||||
|         jPanel_Inventory_Actions.add(jSpinner_item_quantity, java.awt.BorderLayout.CENTER); | ||||
| 
 | ||||
|         jButton_item_add.setText("Add"); | ||||
|  | @ -201,18 +237,82 @@ public class OnTransact extends javax.swing.JFrame { | |||
|         }); | ||||
|         jPanel_Inventory_Actions.add(jButton_item_add, java.awt.BorderLayout.LINE_END); | ||||
| 
 | ||||
|         jPanel2.add(jPanel_Inventory_Actions, java.awt.BorderLayout.SOUTH); | ||||
|         gridBagConstraints = new java.awt.GridBagConstraints(); | ||||
|         gridBagConstraints.gridx = 0; | ||||
|         gridBagConstraints.gridy = 2; | ||||
|         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; | ||||
|         gridBagConstraints.weightx = 1.0; | ||||
|         jPanel_Inventory.add(jPanel_Inventory_Actions, gridBagConstraints); | ||||
| 
 | ||||
|         jList1_Inventory.setModel(new javax.swing.AbstractListModel<String>() { | ||||
|             String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" }; | ||||
|             public int getSize() { return strings.length; } | ||||
|             public String getElementAt(int i) { return strings[i]; } | ||||
|         jList1_Inventory.setModel(refresh_inventory_list()); | ||||
|         jList1_Inventory.addListSelectionListener(new javax.swing.event.ListSelectionListener() { | ||||
|             public void valueChanged(javax.swing.event.ListSelectionEvent evt) { | ||||
|                 jList1_InventoryValueChanged(evt); | ||||
|             } | ||||
|         }); | ||||
|         jScrollPane_Inventory.setViewportView(jList1_Inventory); | ||||
| 
 | ||||
|         jPanel2.add(jScrollPane_Inventory, java.awt.BorderLayout.CENTER); | ||||
|         gridBagConstraints = new java.awt.GridBagConstraints(); | ||||
|         gridBagConstraints.gridx = 0; | ||||
|         gridBagConstraints.gridy = 0; | ||||
|         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; | ||||
|         gridBagConstraints.weightx = 1.0; | ||||
|         gridBagConstraints.weighty = 1.0; | ||||
|         jPanel_Inventory.add(jScrollPane_Inventory, gridBagConstraints); | ||||
| 
 | ||||
|         jToolBar_Inventory.add(jPanel2); | ||||
|         jPanel_ItemDetails.setLayout(new java.awt.GridBagLayout()); | ||||
| 
 | ||||
|         jLabel_ItemDetails_SKU.setText("SKU"); | ||||
|         gridBagConstraints = new java.awt.GridBagConstraints(); | ||||
|         gridBagConstraints.gridx = 0; | ||||
|         gridBagConstraints.gridy = 0; | ||||
|         jPanel_ItemDetails.add(jLabel_ItemDetails_SKU, gridBagConstraints); | ||||
| 
 | ||||
|         jTextField_ItemDetails_SKU.setEditable(false); | ||||
|         jTextField_ItemDetails_SKU.setFont(new java.awt.Font("Dialog", 0, 18)); // NOI18N | ||||
|         gridBagConstraints = new java.awt.GridBagConstraints(); | ||||
|         gridBagConstraints.gridx = 1; | ||||
|         gridBagConstraints.gridy = 0; | ||||
|         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; | ||||
|         gridBagConstraints.weightx = 1.0; | ||||
|         jPanel_ItemDetails.add(jTextField_ItemDetails_SKU, gridBagConstraints); | ||||
| 
 | ||||
|         jLabel_ItemDetails_UnitPrice.setText("Unit Price"); | ||||
|         gridBagConstraints = new java.awt.GridBagConstraints(); | ||||
|         gridBagConstraints.gridx = 0; | ||||
|         gridBagConstraints.gridy = 1; | ||||
|         jPanel_ItemDetails.add(jLabel_ItemDetails_UnitPrice, gridBagConstraints); | ||||
| 
 | ||||
|         jTextField_ItemDetails_UnitPrice.setEditable(false); | ||||
|         gridBagConstraints = new java.awt.GridBagConstraints(); | ||||
|         gridBagConstraints.gridx = 1; | ||||
|         gridBagConstraints.gridy = 1; | ||||
|         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; | ||||
|         gridBagConstraints.weightx = 1.0; | ||||
|         jPanel_ItemDetails.add(jTextField_ItemDetails_UnitPrice, gridBagConstraints); | ||||
| 
 | ||||
|         jLabel_ItemDetails_Discount.setText("Discount"); | ||||
|         gridBagConstraints = new java.awt.GridBagConstraints(); | ||||
|         gridBagConstraints.gridx = 0; | ||||
|         gridBagConstraints.gridy = 2; | ||||
|         jPanel_ItemDetails.add(jLabel_ItemDetails_Discount, gridBagConstraints); | ||||
| 
 | ||||
|         jTextField_ItemDetails_Discount.setEditable(false); | ||||
|         gridBagConstraints = new java.awt.GridBagConstraints(); | ||||
|         gridBagConstraints.gridx = 1; | ||||
|         gridBagConstraints.gridy = 2; | ||||
|         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; | ||||
|         gridBagConstraints.weightx = 1.0; | ||||
|         jPanel_ItemDetails.add(jTextField_ItemDetails_Discount, gridBagConstraints); | ||||
| 
 | ||||
|         gridBagConstraints = new java.awt.GridBagConstraints(); | ||||
|         gridBagConstraints.gridx = 0; | ||||
|         gridBagConstraints.gridy = 1; | ||||
|         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; | ||||
|         gridBagConstraints.weightx = 1.0; | ||||
|         jPanel_Inventory.add(jPanel_ItemDetails, gridBagConstraints); | ||||
| 
 | ||||
|         jToolBar_Inventory.add(jPanel_Inventory); | ||||
| 
 | ||||
|         jPanel_Main.add(jToolBar_Inventory, java.awt.BorderLayout.EAST); | ||||
| 
 | ||||
|  | @ -222,17 +322,17 @@ public class OnTransact extends javax.swing.JFrame { | |||
|     }// </editor-fold>//GEN-END:initComponents | ||||
| 
 | ||||
|     private void jButton_item_voidActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_item_voidActionPerformed | ||||
|         // TODO add your handling code here: | ||||
|         cart_remove(); | ||||
|     }//GEN-LAST:event_jButton_item_voidActionPerformed | ||||
| 
 | ||||
|     private void jButton_item_addActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_item_addActionPerformed | ||||
|         // TODO add your handling code here: | ||||
|         cart_add(); | ||||
|     }//GEN-LAST:event_jButton_item_addActionPerformed | ||||
| 
 | ||||
|     private void transaction_check(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_transaction_check | ||||
|         boolean CLOSING_STATE = false;  | ||||
|          | ||||
|         if (transaction.items_count.size() <= 0) { | ||||
|         if (transact.items.size() <= 0) { | ||||
|             CLOSING_STATE = true; | ||||
|         } else { | ||||
|             CLOSING_STATE = confirm_discard(); | ||||
|  | @ -241,6 +341,15 @@ public class OnTransact extends javax.swing.JFrame { | |||
|         if (CLOSING_STATE) {evt.getWindow().dispose();}; | ||||
|     }//GEN-LAST:event_transaction_check | ||||
| 
 | ||||
|     private void jList1_InventoryValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_jList1_InventoryValueChanged | ||||
|         // TODO add your handling code here: | ||||
|         product_information_refresh(); | ||||
|     }//GEN-LAST:event_jList1_InventoryValueChanged | ||||
| 
 | ||||
|     private void jToggleButton_DiscardActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jToggleButton_DiscardActionPerformed | ||||
|         init(); | ||||
|     }//GEN-LAST:event_jToggleButton_DiscardActionPerformed | ||||
| 
 | ||||
|     /** | ||||
|      * @param args the command line arguments | ||||
|      */ | ||||
|  | @ -282,6 +391,9 @@ public class OnTransact extends javax.swing.JFrame { | |||
|         display(); | ||||
|     } | ||||
|      | ||||
|     private SpinnerNumberModel model_price = new SpinnerNumberModel(0, 0, Integer.MAX_VALUE, .01); | ||||
|     private SpinnerNumberModel model_counting = new SpinnerNumberModel(1, 1, Integer.MAX_VALUE, 1); | ||||
|      | ||||
|     private static boolean confirm_discard() { | ||||
|         /* Confirm discarding items.  | ||||
|          | ||||
|  | @ -293,21 +405,169 @@ public class OnTransact extends javax.swing.JFrame { | |||
|         return (USER_CHOICE); | ||||
|     }; | ||||
|      | ||||
|     private boolean interface_adjust_clear() { | ||||
|         /* Adjust the ability to reset.  | ||||
|          | ||||
|         Returns: (boolean) the new state of the appearance | ||||
|         */ | ||||
|          | ||||
|         boolean CLEARABLE_STATE = (transact.items.size() > 0);  | ||||
|         jToggleButton_Discard.setVisible(CLEARABLE_STATE); | ||||
|         return (jToggleButton_Discard.isVisible()); | ||||
|     }; | ||||
|      | ||||
|     private AbstractListModel<String> refresh_inventory_list() { | ||||
|         /* Pull the list from inventory.  | ||||
|         */ | ||||
|          | ||||
|         AbstractListModel<String> INVENTORY_LIST = new javax.swing.AbstractListModel<String>() { | ||||
|             String[] strings = ((ArrayList<String>)inventory.collate()).toArray(new String[0]); | ||||
|             public int getSize() { return strings.length; } | ||||
|             public String getElementAt(int i) { return strings[i]; } | ||||
|         }; | ||||
|          | ||||
|         return(INVENTORY_LIST); | ||||
|     }; | ||||
|      | ||||
|     private void cart_calculation_refresh() { | ||||
|         /* Refresh the cart's details, such as the total cost. */ | ||||
|         Dictionary<String, String> prices = transact.calculate();  | ||||
|          | ||||
|         // TODO fix text formatting. Perhaps to be done in a different function, not here.   | ||||
|          | ||||
|         jTextField_price_subtotal_value.setText(String.valueOf(prices.get("subtotal"))); | ||||
|         jTextField_price_total_value.setText(String.valueOf(prices.get("total"))); | ||||
|         jTextField_price_discounted.setText(String.valueOf(prices.get("discount"))); | ||||
|         jTextField_price_VAT_value.setText(String.valueOf(prices.get("tax"))); | ||||
|          | ||||
|         interface_adjust_clear(); | ||||
|     }; | ||||
|      | ||||
|     private boolean product_information_refresh() { | ||||
|         /* Refresh the select product information's details. */ | ||||
|         Integer ITEM_SELECTED = jList1_Inventory.getSelectedIndex(); | ||||
|          | ||||
|         if (ITEM_SELECTED == null) {return false;}; | ||||
|          | ||||
|         Dictionary<String, String> ITEM_SELECTED_DETAILS_PROCESSED = new Hashtable<>(); | ||||
|          | ||||
|         // Get the selected details.  | ||||
|         Dictionary ITEM_SELECTED_DETAILS = inventory.find(ITEM_SELECTED); | ||||
|         if (ITEM_SELECTED_DETAILS == null) {return (false);}; | ||||
|         ITEM_SELECTED_DETAILS_PROCESSED.put("SKU", inventory.list().get(ITEM_SELECTED).toString()); | ||||
|          | ||||
|         // Get the unit price.  | ||||
|         ITEM_SELECTED_DETAILS_PROCESSED.put("Unit Price", String.valueOf(ITEM_SELECTED_DETAILS.get("Price"))); | ||||
|          | ||||
|         // Get the discount.  | ||||
|         if (ITEM_SELECTED_DETAILS.get("Discount") != null) { | ||||
|             if ((int) ITEM_SELECTED_DETAILS.get("Discount") != 0) { | ||||
|                 ITEM_SELECTED_DETAILS_PROCESSED.put("Discount", (String.valueOf((int) ITEM_SELECTED_DETAILS.get("Discount"))).concat("%")); | ||||
|             }; | ||||
|         } else { | ||||
|             ITEM_SELECTED_DETAILS_PROCESSED.put("Discount",""); | ||||
|         }; | ||||
|          | ||||
|         // Place the corresponding information.  | ||||
|         jTextField_ItemDetails_SKU.setText(ITEM_SELECTED_DETAILS_PROCESSED.get("SKU")); | ||||
|         jTextField_ItemDetails_UnitPrice.setText(ITEM_SELECTED_DETAILS_PROCESSED.get("Unit Price")); | ||||
|         jTextField_ItemDetails_Discount.setText(ITEM_SELECTED_DETAILS_PROCESSED.get("Discount")); | ||||
|         return (true); | ||||
|     }; | ||||
|       | ||||
|     private void cart_tip_add() { | ||||
|         /* Add a tip. */ | ||||
|          | ||||
|         transact.price.put("tip", (double) jSpinner_price_tip_value.getValue()); | ||||
|         transact.calculate(); | ||||
|         cart_calculation_refresh(); | ||||
|     }; | ||||
|      | ||||
|     private boolean cart_add() { | ||||
|         /* Add the item to the cart.  | ||||
|          | ||||
|         Returns: (boolean) whether the item had been successfully added to the cart or not | ||||
|         */ | ||||
|         boolean state = false;  | ||||
|          | ||||
|         int ITEM_SELECTED = jList1_Inventory.getSelectedIndex(); | ||||
|         int ITEM_SELECTED_QUANTITY = (int) jSpinner_item_quantity.getValue(); | ||||
|          | ||||
|         if (ITEM_SELECTED >= 0) { | ||||
|             // Get the selected details.  | ||||
|             Dictionary ITEM_SELECTED_DETAILS = inventory.find(ITEM_SELECTED); | ||||
|             if (ITEM_SELECTED_DETAILS == null) {return (false);}; | ||||
|             String ITEM_SELECTED_SKU = inventory.list().get(ITEM_SELECTED).toString(); | ||||
| 
 | ||||
|             // Add to cart.  | ||||
|             state = transact.add(ITEM_SELECTED_SKU, ITEM_SELECTED_QUANTITY); | ||||
| 
 | ||||
|             // Refresh the data.  | ||||
|             cart_calculation_refresh(); | ||||
|         }; | ||||
|         return(state); | ||||
|     }; | ||||
|      | ||||
|     private boolean cart_remove() { | ||||
|         /* Remove the item to the cart.  | ||||
|          | ||||
|         Returns: (boolean) whether the item had been successfully removed from the cart or not | ||||
|         */ | ||||
|         boolean state = false;  | ||||
|          | ||||
|         int ITEM_SELECTED = jList1_Inventory.getSelectedIndex(); | ||||
|         int ITEM_SELECTED_QUANTITY = (int) jSpinner_item_quantity.getValue(); | ||||
|          | ||||
|         if (ITEM_SELECTED >= 0) { | ||||
|             // Get the selected details.  | ||||
|             Dictionary ITEM_SELECTED_DETAILS = inventory.find(ITEM_SELECTED); | ||||
|             if (ITEM_SELECTED_DETAILS == null) {return (false);}; | ||||
|             String ITEM_SELECTED_SKU = inventory.list().get(ITEM_SELECTED).toString(); | ||||
| 
 | ||||
|             // Add to cart.  | ||||
|             state = transact.remove(ITEM_SELECTED_SKU, ITEM_SELECTED_QUANTITY); | ||||
| 
 | ||||
|             // Refresh the data.  | ||||
|             cart_calculation_refresh(); | ||||
|         }; | ||||
|         return(state); | ||||
|     }; | ||||
|      | ||||
|     private void init() { | ||||
|         Boolean DISCARD_STATE = confirm_discard(); | ||||
|         if (DISCARD_STATE) { | ||||
|             transact.init(); | ||||
|             refresh_inventory_list(); | ||||
|             cart_calculation_refresh(); | ||||
|             receipt.init(); | ||||
|             receipt.headers(); | ||||
|             receipt_refresh(); | ||||
|         }; | ||||
|     }; | ||||
|      | ||||
|      | ||||
|     private void receipt_refresh() { | ||||
|         jTextArea1.setText(receipt.content); | ||||
|     }; | ||||
| 
 | ||||
|     // Variables declaration - do not modify//GEN-BEGIN:variables | ||||
|     private javax.swing.JButton jButton_item_add; | ||||
|     private javax.swing.JButton jButton_item_void; | ||||
|     private javax.swing.JComboBox<String> jComboBox1; | ||||
|     private javax.swing.JComboBox<String> jComboBox_information_discount_selections; | ||||
|     private javax.swing.JLabel jLabel1; | ||||
|     private javax.swing.JComboBox<String> jComboBox_Payment; | ||||
|     private javax.swing.JLabel jLabel2_information_discount; | ||||
|     private javax.swing.JLabel jLabel_ItemDetails_Discount; | ||||
|     private javax.swing.JLabel jLabel_ItemDetails_SKU; | ||||
|     private javax.swing.JLabel jLabel_ItemDetails_UnitPrice; | ||||
|     private javax.swing.JLabel jLabel_Status; | ||||
|     private javax.swing.JLabel jLabel_price_VAT; | ||||
|     private javax.swing.JLabel jLabel_price_subtotal; | ||||
|     private javax.swing.JLabel jLabel_price_tip; | ||||
|     private javax.swing.JLabel jLabel_price_total; | ||||
|     private javax.swing.JList<String> jList1_Inventory; | ||||
|     private javax.swing.JPanel jPanel2; | ||||
|     private javax.swing.JPanel jPanel_Information; | ||||
|     private javax.swing.JPanel jPanel_Inventory; | ||||
|     private javax.swing.JPanel jPanel_Inventory_Actions; | ||||
|     private javax.swing.JPanel jPanel_ItemDetails; | ||||
|     private javax.swing.JPanel jPanel_Items; | ||||
|     private javax.swing.JPanel jPanel_Main; | ||||
|     private javax.swing.JPanel jPanel_statusinfo; | ||||
|  | @ -316,9 +576,14 @@ public class OnTransact extends javax.swing.JFrame { | |||
|     private javax.swing.JSpinner jSpinner_item_quantity; | ||||
|     private javax.swing.JSpinner jSpinner_price_tip_value; | ||||
|     private javax.swing.JTextArea jTextArea1; | ||||
|     private javax.swing.JTextField jTextField_ItemDetails_Discount; | ||||
|     private javax.swing.JTextField jTextField_ItemDetails_SKU; | ||||
|     private javax.swing.JTextField jTextField_ItemDetails_UnitPrice; | ||||
|     private javax.swing.JTextField jTextField_price_VAT_value; | ||||
|     private javax.swing.JTextField jTextField_price_discounted; | ||||
|     private javax.swing.JTextField jTextField_price_subtotal_value; | ||||
|     private javax.swing.JTextField jTextField_price_total_value; | ||||
|     private javax.swing.JToggleButton jToggleButton_Discard; | ||||
|     private javax.swing.JToolBar jToolBar_Information; | ||||
|     private javax.swing.JToolBar jToolBar_Inventory; | ||||
|     // End of variables declaration//GEN-END:variables | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue