diff --git a/C4_ARCHITECTURE.md b/C4_ARCHITECTURE.md
new file mode 100644
index 0000000..6d46378
--- /dev/null
+++ b/C4_ARCHITECTURE.md
@@ -0,0 +1,729 @@
+# Unicenta oPOS - C4 Architecture Diagram
+
+## Overview
+
+Unicenta oPOS (v5.4.0) is an enterprise-level Point of Sale system built with Java. It provides comprehensive sales, inventory, customer, and reporting management capabilities with support for multiple operating systems (Windows, Linux, macOS).
+
+---
+
+## Level 1: System Context Diagram
+
+```mermaid
+graph TB
+ user["👤 POS Operators/Staff"]
+
+ system["📱 Unicenta oPOS System
Java Desktop Application
v5.4.0"]
+
+ devices["🖨️ Peripheral Devices
Printer • Scale
Barcode Scanner
Card Reader"]
+
+ db["💾 Database
MySQL • Derby
SQLite • PostgreSQL"]
+
+ fs["📂 File System
Reports • Templates
Locales • Config"]
+
+ user -->|interacts| system
+ system -->|controls| devices
+ system -->|reads/writes| db
+ system -->|reads/writes| fs
+ devices -.->|feedback| system
+
+ style system fill:#4A90E2,stroke:#2E5C8A,color:#fff,stroke-width:3px
+ style user fill:#50C878,stroke:#2D7A4A,color:#fff
+ style devices fill:#FF6B6B,stroke:#A53D3D,color:#fff
+ style db fill:#FFB84D,stroke:#8B6914,color:#fff
+ style fs fill:#9B59B6,stroke:#5B2C6F,color:#fff
+```
+
+---
+
+## Level 2: Container Architecture
+
+```mermaid
+graph TB
+ subgraph app["🏗️ UNICENTA oPOS APPLICATION"]
+ subgraph ui["PRESENTATION LAYER
(Swing/JavaFX)"]
+ ui1["StartPOS Entry Point"]
+ ui2["Sales Screens
Simple • Restaurant
Shared Modes"]
+ ui3["Admin Panels
User Mgmt • Settings"]
+ ui4["Forms & Dialogs
Customers • Suppliers
Inventory"]
+ ui5["Reporting Dashboards
JFreeChart"]
+ end
+
+ subgraph service["SERVICE LAYER
(Business Logic)"]
+ svc1["Sales Service"]
+ svc2["Inventory Service"]
+ svc3["Customer Service"]
+ svc4["Payment Service"]
+ svc5["Reporting Service"]
+ svc6["Config/Admin Service"]
+ end
+
+ subgraph dao["DATA ACCESS LAYER
(DAOs)"]
+ dao1["ProductDAO"]
+ dao2["TicketDAO"]
+ dao3["CustomerDAO"]
+ dao4["EmployeeDAO"]
+ dao5["CompanyDAO"]
+ dao6["SupplierDAO"]
+ end
+
+ subgraph peripheral["PERIPHERAL INTEGRATION
(Drivers & APIs)"]
+ per1["Printer Drivers
ESC-POS • JavaPOS"]
+ per2["Scale Reader
Serial Comm"]
+ per3["Barcode Scanner
ZXing"]
+ per4["Card Reader
USB/Serial"]
+ end
+
+ subgraph utils["UTILITIES & SUPPORT"]
+ util1["Logging
Logback"]
+ util2["Formatting
Date • Currency"]
+ util3["Localization
i18n"]
+ util4["Reporting
JasperReports"]
+ util5["Scripting
BeanShell"]
+ util6["Plugins"]
+ end
+ end
+
+ subgraph external["📦 EXTERNAL SYSTEMS"]
+ extdb["💾 Database
MySQL/Derby/SQLite
PostgreSQL"]
+ extfs["📂 File System
Configs • Templates
Locales • Reports"]
+ devices["🖨️ Physical Devices
Printers • Scales
Scanners • Card Readers"]
+ end
+
+ ui -->|calls| service
+ service -->|uses| dao
+ service -->|uses| peripheral
+ service -->|uses| utils
+ ui -->|uses| utils
+
+ dao -->|reads/writes| extdb
+ peripheral -->|controls| devices
+ service -->|reads/writes| extfs
+ ui -->|reads/writes| extfs
+
+ style app fill:#E8F4F8,stroke:#2E5C8A,stroke-width:2px
+ style ui fill:#4A90E2,stroke:#2E5C8A,color:#fff
+ style service fill:#50C878,stroke:#2D7A4A,color:#fff
+ style dao fill:#FF9F43,stroke:#B8690F,color:#fff
+ style peripheral fill:#FF6B6B,stroke:#A53D3D,color:#fff
+ style utils fill:#9B59B6,stroke:#5B2C6F,color:#fff
+ style external fill:#F0F0F0,stroke:#666
+ style extdb fill:#FFB84D,stroke:#8B6914,color:#fff
+ style extfs fill:#9B59B6,stroke:#5B2C6F,color:#fff
+ style devices fill:#FF6B6B,stroke:#A53D3D,color:#fff
+```
+
+---
+
+## Level 3: Component Architecture
+
+### Sales Module
+
+```mermaid
+graph LR
+ subgraph sales["com.unicenta.pos.sales"]
+ simple["simple/
Simple POS Mode"]
+ restaurant["restaurant/
Table/Order Mode"]
+ shared["shared/
Shared Ticket Logic"]
+ end
+
+ simple -.-> shared
+ restaurant -.-> shared
+
+ style sales fill:#4A90E2,stroke:#2E5C8A,color:#fff
+ style simple fill:#5BA3D0,stroke:#2E5C8A,color:#fff
+ style restaurant fill:#5BA3D0,stroke:#2E5C8A,color:#fff
+ style shared fill:#6BB3E0,stroke:#2E5C8A,color:#fff
+```
+
+### Inventory & Catalog Modules
+
+```mermaid
+graph TB
+ subgraph inventory["com.unicenta.pos.inventory"]
+ inv_prod["Product Management"]
+ inv_stock["Stock Tracking"]
+ inv_cat["Category Management"]
+ end
+
+ subgraph catalog["com.unicenta.pos.catalog"]
+ cat_prod["Product Categorization"]
+ cat_search["Product Search/Filter"]
+ cat_display["Display Management"]
+ end
+
+ inv_prod ---|shared data| cat_prod
+ inv_cat ---|manages| cat_display
+
+ style inventory fill:#50C878,stroke:#2D7A4A,color:#fff
+ style catalog fill:#50C878,stroke:#2D7A4A,color:#fff
+ style inv_prod fill:#68D989,stroke:#2D7A4A,color:#fff
+ style inv_stock fill:#68D989,stroke:#2D7A4A,color:#fff
+ style inv_cat fill:#68D989,stroke:#2D7A4A,color:#fff
+ style cat_prod fill:#68D989,stroke:#2D7A4A,color:#fff
+ style cat_search fill:#68D989,stroke:#2D7A4A,color:#fff
+ style cat_display fill:#68D989,stroke:#2D7A4A,color:#fff
+```
+
+### Ticket & Payment Processing
+
+```mermaid
+graph TB
+ subgraph ticket["com.unicenta.pos.ticket"]
+ ticket_create["Ticket Creation"]
+ ticket_items["Line Items Mgmt"]
+ ticket_lifecycle["Lifecycle Management"]
+ end
+
+ subgraph payment["com.unicenta.pos.payment"]
+ pay_method["Payment Methods"]
+ pay_process["Payment Processing"]
+ pay_card["Card Integration"]
+ end
+
+ ticket_create -->|on completion| pay_method
+ ticket_items -->|on finalize| pay_process
+ pay_process -->|if card| pay_card
+
+ style ticket fill:#FF9F43,stroke:#B8690F,color:#fff
+ style payment fill:#FF9F43,stroke:#B8690F,color:#fff
+ style ticket_create fill:#FDB44B,stroke:#B8690F,color:#fff
+ style ticket_items fill:#FDB44B,stroke:#B8690F,color:#fff
+ style ticket_lifecycle fill:#FDB44B,stroke:#B8690F,color:#fff
+ style pay_method fill:#FDB44B,stroke:#B8690F,color:#fff
+ style pay_process fill:#FDB44B,stroke:#B8690F,color:#fff
+ style pay_card fill:#FDB44B,stroke:#B8690F,color:#fff
+```
+
+### Reporting & Administration
+
+```mermaid
+graph TB
+ subgraph reports["com.unicenta.pos.reports"]
+ report_gen["Report Generation"]
+ report_chart["Chart Generation
JFreeChart"]
+ report_export["PDF/Excel Export"]
+ end
+
+ subgraph admin["com.unicenta.pos.admin"]
+ admin_user["User Management"]
+ admin_config["System Configuration"]
+ admin_security["Access Control"]
+ end
+
+ report_gen -->|uses| report_chart
+ report_chart -->|renders to| report_export
+ admin_user -->|applies| admin_security
+
+ style reports fill:#9B59B6,stroke:#5B2C6F,color:#fff
+ style admin fill:#9B59B6,stroke:#5B2C6F,color:#fff
+ style report_gen fill:#B76AC2,stroke:#5B2C6F,color:#fff
+ style report_chart fill:#B76AC2,stroke:#5B2C6F,color:#fff
+ style report_export fill:#B76AC2,stroke:#5B2C6F,color:#fff
+ style admin_user fill:#B76AC2,stroke:#5B2C6F,color:#fff
+ style admin_config fill:#B76AC2,stroke:#5B2C6F,color:#fff
+ style admin_security fill:#B76AC2,stroke:#5B2C6F,color:#fff
+```
+
+### Printer System
+
+```mermaid
+graph LR
+ subgraph printer["com.unicenta.pos.printer"]
+ escpos["escpos/
ESC-POS Driver"]
+ javapos["javapos/
JavaPOS Driver"]
+ screen["screen/
Screen Preview"]
+ end
+
+ reports["JasperReports
JFreeChart"]
+
+ reports -->|routes to| escpos
+ reports -->|routes to| javapos
+ reports -->|routes to| screen
+
+ style printer fill:#FF6B6B,stroke:#A53D3D,color:#fff
+ style escpos fill:#FF8E8E,stroke:#A53D3D,color:#fff
+ style javapos fill:#FF8E8E,stroke:#A53D3D,color:#fff
+ style screen fill:#FF8E8E,stroke:#A53D3D,color:#fff
+ style reports fill:#9B59B6,stroke:#5B2C6F,color:#fff
+```
+
+### Communication & Integration
+
+```mermaid
+graph TB
+ subgraph comm["com.unicenta.pos.comm"]
+ serial["Serial Communication
RXTX • jSerialComm"]
+ usb["USB Communication
USB4Java"]
+ end
+
+ scale["Scale Reader"]
+ scanner["Barcode Scanner
ZXing"]
+ reader["Card Reader"]
+
+ serial -->|reads| scale
+ serial -->|reads| scanner
+ usb -->|reads| reader
+
+ style comm fill:#FF6B6B,stroke:#A53D3D,color:#fff
+ style serial fill:#FF8E8E,stroke:#A53D3D,color:#fff
+ style usb fill:#FF8E8E,stroke:#A53D3D,color:#fff
+ style scale fill:#D9534F,stroke:#A53D3D,color:#fff
+ style scanner fill:#D9534F,stroke:#A53D3D,color:#fff
+ style reader fill:#D9534F,stroke:#A53D3D,color:#fff
+```
+
+---
+
+## Level 4: Data Flow Diagrams
+
+### Sales Transaction Flow
+
+```mermaid
+sequenceDiagram
+ actor User as POS Operator
+ participant UI as Sales Screen
+ participant Service as Sales Service
+ participant DAO as TicketDAO
+ participant DB as Database
+ participant Payment as Payment Service
+ participant Printer as Printer Service
+
+ User->>UI: Create/Edit Ticket
+ UI->>Service: Process Ticket
+ Service->>DAO: Save Ticket
+ DAO->>DB: INSERT/UPDATE
+ DB-->>DAO: Confirm
+ DAO-->>Service: Ticket ID
+ User->>UI: Process Payment
+ UI->>Service: Payment Request
+ Service->>Payment: Process Payment
+ Payment-->>Service: Payment Confirmed
+ Service->>Printer: Print Receipt
+ Printer-->>Service: Print Complete
+ Service-->>UI: Transaction Complete
+ UI-->>User: Display Confirmation
+```
+
+### Product Lookup Flow
+
+```mermaid
+sequenceDiagram
+ actor Device as Barcode Scanner
+ participant UI as Sales Screen
+ participant DAO as ProductDAO
+ participant DB as Database
+
+ Device->>UI: Scan Barcode
+ UI->>DAO: Query Product
+ DAO->>DB: SELECT Product
+ DB-->>DAO: Product Data
+ DAO-->>UI: Product Details
+ UI-->>Device: Display Product Info
+```
+
+### Report Generation Flow
+
+```mermaid
+sequenceDiagram
+ actor User as Admin/Manager
+ participant UI as Admin Panel
+ participant Service as Reporting Service
+ participant JasperReports as JasperReports Engine
+ participant DB as Database
+ participant FileSystem as File System
+
+ User->>UI: Request Report
+ UI->>Service: Generate Report
+ Service->>DB: Query Data
+ DB-->>Service: Report Data
+ Service->>JasperReports: Render Report
+ JasperReports->>FileSystem: Generate PDF/Excel
+ FileSystem-->>JasperReports: File Path
+ JasperReports-->>Service: Report Ready
+ Service-->>UI: Display/Download
+ UI-->>User: Provide Report
+```
+
+---
+
+## Level 5: Package Structure
+
+```mermaid
+graph TB
+ com["com.unicenta"]
+
+ com -->|core| basic["basic
Exception Handling
Logging"]
+ com -->|ui| beans["beans
Custom UI Components
Dialogs • Date Pickers
Number Pads"]
+ com -->|ui| orderpop["orderpop
Order Popup Module"]
+ com -->|plugins| plugins["plugins
Plugin Architecture
Metrics System"]
+
+ pos["com.unicenta.pos"]
+ com -->|main| pos
+
+ pos -->|sales| sales["sales
Simple • Restaurant
Shared Modes"]
+ pos -->|inventory| inventory["inventory
Products • Stock
Categories"]
+ pos -->|customers| customers["customers
Customer Management
Loyalty Programs"]
+ pos -->|catalog| catalog["catalog
Product Catalog
Display Management"]
+ pos -->|ticket| ticket["ticket
Ticket Lifecycle
Line Items"]
+ pos -->|payment| payment["payment
Payment Methods
Card Integration
Cash Handling"]
+ pos -->|reports| reports["reports
JasperReports
JFreeChart
PDF/Excel Export"]
+ pos -->|admin| admin["admin
User Management
System Configuration
Access Control"]
+ pos -->|printer| printer["printer
ESC-POS • JavaPOS
Screen Preview"]
+ pos -->|comm| comm["comm
Serial • USB
Scale • Scanner
Card Reader"]
+ pos -->|scripting| scripting["scripting
BeanShell
Custom Logic"]
+ pos -->|forms| forms["forms
Main UI
Data Entry Forms"]
+ pos -->|config| config["config
Configuration Mgmt
Settings"]
+ pos -->|instance| instance["instance
Instance Management
Singleton Patterns"]
+ pos -->|mant| mant["mant
Maintenance
Utilities"]
+
+ style com fill:#E8F4F8,stroke:#2E5C8A
+ style pos fill:#4A90E2,stroke:#2E5C8A,color:#fff
+ style basic fill:#5BA3D0,stroke:#2E5C8A,color:#fff
+ style beans fill:#5BA3D0,stroke:#2E5C8A,color:#fff
+ style orderpop fill:#5BA3D0,stroke:#2E5C8A,color:#fff
+ style plugins fill:#5BA3D0,stroke:#2E5C8A,color:#fff
+ style sales fill:#50C878,stroke:#2D7A4A,color:#fff
+ style inventory fill:#50C878,stroke:#2D7A4A,color:#fff
+ style customers fill:#50C878,stroke:#2D7A4A,color:#fff
+ style catalog fill:#50C878,stroke:#2D7A4A,color:#fff
+ style ticket fill:#FF9F43,stroke:#B8690F,color:#fff
+ style payment fill:#FF9F43,stroke:#B8690F,color:#fff
+ style reports fill:#9B59B6,stroke:#5B2C6F,color:#fff
+ style admin fill:#9B59B6,stroke:#5B2C6F,color:#fff
+ style printer fill:#FF6B6B,stroke:#A53D3D,color:#fff
+ style comm fill:#FF6B6B,stroke:#A53D3D,color:#fff
+ style scripting fill:#FFB84D,stroke:#8B6914,color:#fff
+ style forms fill:#4A90E2,stroke:#2E5C8A,color:#fff
+ style config fill:#4A90E2,stroke:#2E5C8A,color:#fff
+ style instance fill:#4A90E2,stroke:#2E5C8A,color:#fff
+ style mant fill:#4A90E2,stroke:#2E5C8A,color:#fff
+```
+
+---
+
+## Level 6: Database Schema Overview
+
+```mermaid
+graph TB
+ subgraph core["CORE ENTITIES"]
+ company["COMPANY
company_id
name
code"]
+ location["LOCATION
location_id
name
address"]
+ products["PRODUCTS
product_id
name
code
price"]
+ categories["CATEGORIES
category_id
name
description"]
+ end
+
+ subgraph transactions["TRANSACTION ENTITIES"]
+ tickets["TICKETS
ticket_id
number
date
customer_id"]
+ lines["TICKETLINES
line_id
ticket_id
product_id
qty"]
+ payments["PAYMENTS
payment_id
ticket_id
method
amount"]
+ end
+
+ subgraph master["MASTER DATA"]
+ customers["CUSTOMERS
customer_id
name
email
phone"]
+ suppliers["SUPPLIERS
supplier_id
name
contact
products"]
+ employees["EMPLOYEES
employee_id
name
role
access_level"]
+ taxes["TAXCATEGORIES
tax_id
name
rate"]
+ end
+
+ subgraph inventory["INVENTORY ENTITIES"]
+ stock["STOCK
stock_id
product_id
location_id
quantity"]
+ movements["STOCKMOVEMENTS
movement_id
product_id
qty
type"]
+ end
+
+ company -->|operates| location
+ location -->|manages| products
+ products -->|in| categories
+ location -->|in| stock
+ products -->|in| stock
+
+ customers -->|creates| tickets
+ employees -->|processes| tickets
+ products -->|in| lines
+ tickets -->|contains| lines
+ tickets -->|has| payments
+ tickets -->|has| taxes
+
+ products -->|from| suppliers
+ stock -->|tracks| movements
+
+ style core fill:#4A90E2,stroke:#2E5C8A,color:#fff
+ style transactions fill:#FF9F43,stroke:#B8690F,color:#fff
+ style master fill:#50C878,stroke:#2D7A4A,color:#fff
+ style inventory fill:#9B59B6,stroke:#5B2C6F,color:#fff
+ style company fill:#5BA3D0,stroke:#2E5C8A,color:#fff
+ style location fill:#5BA3D0,stroke:#2E5C8A,color:#fff
+ style products fill:#5BA3D0,stroke:#2E5C8A,color:#fff
+ style categories fill:#5BA3D0,stroke:#2E5C8A,color:#fff
+ style tickets fill:#FDB44B,stroke:#B8690F,color:#fff
+ style lines fill:#FDB44B,stroke:#B8690F,color:#fff
+ style payments fill:#FDB44B,stroke:#B8690F,color:#fff
+ style customers fill:#68D989,stroke:#2D7A4A,color:#fff
+ style suppliers fill:#68D989,stroke:#2D7A4A,color:#fff
+ style employees fill:#68D989,stroke:#2D7A4A,color:#fff
+ style taxes fill:#68D989,stroke:#2D7A4A,color:#fff
+ style stock fill:#B76AC2,stroke:#5B2C6F,color:#fff
+ style movements fill:#B76AC2,stroke:#5B2C6F,color:#fff
+```
+
+---
+
+## Technology Stack
+
+```mermaid
+graph TB
+ subgraph frontend["FRONTEND"]
+ swing["Swing
Traditional UI"]
+ javafx["JavaFX
Modern UI"]
+ flatlaf["FlatLAF
Modern Look & Feel"]
+ end
+
+ subgraph backend["BACKEND"]
+ java["Java 8+
Core Logic"]
+ lombok["Lombok
Boilerplate Reduction"]
+ beanshell["BeanShell
Dynamic Scripting"]
+ end
+
+ subgraph data["DATA & PERSISTENCE"]
+ jdbc["JDBC
Database Abstraction"]
+ mysql["MySQL
Primary Database"]
+ derby["Derby
Embedded DB"]
+ sqlite["SQLite
Lightweight DB"]
+ postgres["PostgreSQL
Enterprise DB"]
+ end
+
+ subgraph reporting["REPORTING & ANALYTICS"]
+ jasper["JasperReports
Report Generation"]
+ jfreechart["JFreeChart
Charts & Graphs"]
+ poi["Apache POI
Excel Export"]
+ itext["iText
PDF Generation"]
+ end
+
+ subgraph devices["DEVICE INTEGRATION"]
+ rxtx["RXTX/jSerialComm
Serial Communication"]
+ usb4j["USB4Java
USB Communication"]
+ zxing["ZXing
Barcode Processing"]
+ jpos["JavaPOS
POS Device Standard"]
+ end
+
+ subgraph support["SUPPORT LIBRARIES"]
+ logback["Logback
Logging"]
+ gson["GSON
JSON Processing"]
+ xstream["XStream
XML Serialization"]
+ velocity["Apache Velocity
Template Engine"]
+ end
+
+ style frontend fill:#4A90E2,stroke:#2E5C8A,color:#fff
+ style backend fill:#50C878,stroke:#2D7A4A,color:#fff
+ style data fill:#FF9F43,stroke:#B8690F,color:#fff
+ style reporting fill:#9B59B6,stroke:#5B2C6F,color:#fff
+ style devices fill:#FF6B6B,stroke:#A53D3D,color:#fff
+ style support fill:#FFB84D,stroke:#8B6914,color:#fff
+
+ style swing fill:#5BA3D0,stroke:#2E5C8A,color:#fff
+ style javafx fill:#5BA3D0,stroke:#2E5C8A,color:#fff
+ style flatlaf fill:#5BA3D0,stroke:#2E5C8A,color:#fff
+ style java fill:#68D989,stroke:#2D7A4A,color:#fff
+ style lombok fill:#68D989,stroke:#2D7A4A,color:#fff
+ style beanshell fill:#68D989,stroke:#2D7A4A,color:#fff
+ style jdbc fill:#FDB44B,stroke:#B8690F,color:#fff
+ style mysql fill:#FDB44B,stroke:#B8690F,color:#fff
+ style derby fill:#FDB44B,stroke:#B8690F,color:#fff
+ style sqlite fill:#FDB44B,stroke:#B8690F,color:#fff
+ style postgres fill:#FDB44B,stroke:#B8690F,color:#fff
+ style jasper fill:#B76AC2,stroke:#5B2C6F,color:#fff
+ style jfreechart fill:#B76AC2,stroke:#5B2C6F,color:#fff
+ style poi fill:#B76AC2,stroke:#5B2C6F,color:#fff
+ style itext fill:#B76AC2,stroke:#5B2C6F,color:#fff
+ style rxtx fill:#FF8E8E,stroke:#A53D3D,color:#fff
+ style usb4j fill:#FF8E8E,stroke:#A53D3D,color:#fff
+ style zxing fill:#FF8E8E,stroke:#A53D3D,color:#fff
+ style jpos fill:#FF8E8E,stroke:#A53D3D,color:#fff
+ style logback fill:#F5B041,stroke:#8B6914,color:#fff
+ style gson fill:#F5B041,stroke:#8B6914,color:#fff
+ style xstream fill:#F5B041,stroke:#8B6914,color:#fff
+ style velocity fill:#F5B041,stroke:#8B6914,color:#fff
+```
+
+---
+
+## Key Architectural Patterns
+
+```mermaid
+graph TB
+ subgraph patterns["DESIGN PATTERNS"]
+ dao_pat["📋 DAO Pattern
Data Abstraction"]
+ service_pat["🔧 Service Pattern
Business Logic"]
+ singleton_pat["🎯 Singleton Pattern
Resource Management"]
+ factory_pat["🏭 Factory Pattern
Object Creation"]
+ plugin_pat["🔌 Plugin Pattern
Extensibility"]
+ end
+
+ subgraph layers["ARCHITECTURAL LAYERS"]
+ presentation["📱 Presentation
UI Components"]
+ business["💼 Business Logic
Services"]
+ data["💾 Data Access
DAOs & Queries"]
+ external["🔌 External Integration
Devices & Files"]
+ end
+
+ subgraph principles["DESIGN PRINCIPLES"]
+ sep_concern["Separation of Concerns
Distinct responsibilities"]
+ loose_coupling["Loose Coupling
Independent modules"]
+ high_cohesion["High Cohesion
Related functionality"]
+ abstraction["Abstraction
Hide complexity"]
+ end
+
+ presentation -->|calls| business
+ business -->|uses| data
+ business -->|uses| external
+
+ dao_pat -->|implements| data
+ service_pat -->|implements| business
+ singleton_pat -->|ensures| resource_management["Resource
Management"]
+ factory_pat -->|creates| objects["Objects"]
+ plugin_pat -->|enables| extensions["Extensions"]
+
+ style patterns fill:#4A90E2,stroke:#2E5C8A,color:#fff
+ style layers fill:#50C878,stroke:#2D7A4A,color:#fff
+ style principles fill:#9B59B6,stroke:#5B2C6F,color:#fff
+ style dao_pat fill:#5BA3D0,stroke:#2E5C8A,color:#fff
+ style service_pat fill:#5BA3D0,stroke:#2E5C8A,color:#fff
+ style singleton_pat fill:#5BA3D0,stroke:#2E5C8A,color:#fff
+ style factory_pat fill:#5BA3D0,stroke:#2E5C8A,color:#fff
+ style plugin_pat fill:#5BA3D0,stroke:#2E5C8A,color:#fff
+ style presentation fill:#68D989,stroke:#2D7A4A,color:#fff
+ style business fill:#68D989,stroke:#2D7A4A,color:#fff
+ style data fill:#68D989,stroke:#2D7A4A,color:#fff
+ style external fill:#68D989,stroke:#2D7A4A,color:#fff
+ style sep_concern fill:#B76AC2,stroke:#5B2C6F,color:#fff
+ style loose_coupling fill:#B76AC2,stroke:#5B2C6F,color:#fff
+ style high_cohesion fill:#B76AC2,stroke:#5B2C6F,color:#fff
+ style abstraction fill:#B76AC2,stroke:#5B2C6F,color:#fff
+ style resource_management fill:#FFB84D,stroke:#8B6914,color:#fff
+ style objects fill:#FFB84D,stroke:#8B6914,color:#fff
+ style extensions fill:#FFB84D,stroke:#8B6914,color:#fff
+```
+
+---
+
+## Core Features Architecture
+
+```mermaid
+graph TB
+ system["🏪 Unicenta oPOS
Enterprise POS System"]
+
+ system -->|Sales Management| sales_feat["Sales Processing
Multiple modes
Ticket management
Payment handling"]
+
+ system -->|Inventory Management| inventory_feat["Product Management
Stock tracking
Category organization
Quantity monitoring"]
+
+ system -->|Customer Management| customer_feat["Customer Database
Transaction history
Loyalty programs
Communication"]
+
+ system -->|Supplier Management| supplier_feat["Supplier Directory
Purchase orders
Product sourcing
Vendor info"]
+
+ system -->|Employee Management| employee_feat["User Accounts
Access Control
Role Assignment
Activity Logging"]
+
+ system -->|Reporting & Analytics| reporting_feat["Sales Reports
Inventory Reports
Financial Reports
Charts & Graphs"]
+
+ system -->|Device Integration| device_feat["Thermal Printers
Barcode Scanners
Weight Scales
Card Readers"]
+
+ system -->|Multi-platform| platform_feat["Windows Support
Linux Support
macOS Support
Cross-platform UI"]
+
+ style system fill:#4A90E2,stroke:#2E5C8A,color:#fff,stroke-width:3px
+ style sales_feat fill:#50C878,stroke:#2D7A4A,color:#fff
+ style inventory_feat fill:#50C878,stroke:#2D7A4A,color:#fff
+ style customer_feat fill:#50C878,stroke:#2D7A4A,color:#fff
+ style supplier_feat fill:#50C878,stroke:#2D7A4A,color:#fff
+ style employee_feat fill:#9B59B6,stroke:#5B2C6F,color:#fff
+ style reporting_feat fill:#9B59B6,stroke:#5B2C6F,color:#fff
+ style device_feat fill:#FF6B6B,stroke:#A53D3D,color:#fff
+ style platform_feat fill:#FFB84D,stroke:#8B6914,color:#fff
+```
+
+---
+
+## Deployment Architecture
+
+```mermaid
+graph TB
+ subgraph client["CLIENT TIER"]
+ desktop["💻 Desktop Machine
Windows • Linux • macOS
Java Runtime (JRE 8+)"]
+ end
+
+ subgraph app_tier["APPLICATION TIER"]
+ jar["📦 unicentaopos.jar
Version 5.4.0
Java Swing/JavaFX"]
+ end
+
+ subgraph data_tier["DATA TIER"]
+ db_choice["Database Engine
MySQL 5.x
Derby
SQLite
PostgreSQL"]
+ db_instance["Database Instance
Schema: unicentaopos
Tables & Indexes"]
+ end
+
+ subgraph files["FILE STORAGE"]
+ reports_dir["📁 Reports Directory
Generated PDFs
Excel Files"]
+ config_dir["📁 Config Directory
Application Settings
User Preferences"]
+ templates["📁 Templates
Report Templates
Print Layouts"]
+ locales["📁 Localization
Language Files
i18n Resources"]
+ end
+
+ desktop -->|runs| jar
+ jar -->|connects to| db_choice
+ db_choice -->|manages| db_instance
+ jar -->|reads/writes| reports_dir
+ jar -->|reads/writes| config_dir
+ jar -->|reads| templates
+ jar -->|reads| locales
+
+ style client fill:#E8F4F8,stroke:#2E5C8A,stroke-width:2px
+ style app_tier fill:#4A90E2,stroke:#2E5C8A,color:#fff,stroke-width:2px
+ style data_tier fill:#FF9F43,stroke:#B8690F,color:#fff,stroke-width:2px
+ style files fill:#9B59B6,stroke:#5B2C6F,color:#fff,stroke-width:2px
+ style desktop fill:#5BA3D0,stroke:#2E5C8A,color:#fff
+ style jar fill:#5BA3D0,stroke:#2E5C8A,color:#fff
+ style db_choice fill:#FDB44B,stroke:#B8690F,color:#fff
+ style db_instance fill:#FDB44B,stroke:#B8690F,color:#fff
+ style reports_dir fill:#B76AC2,stroke:#5B2C6F,color:#fff
+ style config_dir fill:#B76AC2,stroke:#5B2C6F,color:#fff
+ style templates fill:#B76AC2,stroke:#5B2C6F,color:#fff
+ style locales fill:#B76AC2,stroke:#5B2C6F,color:#fff
+```
+
+---
+
+## Quick Start
+
+### Prerequisites
+
+- Java 8+ (JRE)
+- MySQL 5.x (or Derby/SQLite/PostgreSQL)
+- Create database schema: `unicentaopos`
+
+### Build
+
+```bash
+mvn clean package
+```
+
+### Run
+
+```bash
+java -jar ./target/unicentaopos.jar
+```
+
+### Platform Support
+
+- ✅ Windows
+- ✅ Linux
+- ✅ macOS
+
+---
+
+## Summary
+
+**Unicenta oPOS** is a layered, modular Java desktop application with clear separation between:
+
+1. **Presentation Layer** - Swing/JavaFX UI
+2. **Service Layer** - Business logic & orchestration
+3. **Data Access Layer** - DAO pattern for database abstraction
+4. **Peripheral Integration** - Hardware device drivers
+5. **Support Layer** - Utilities, logging, plugins
+
+The architecture supports **multi-database backends**, **multiple POS sales modes** (simple, restaurant), **comprehensive reporting**, and **extensive peripheral device integration**, making it a flexible, enterprise-grade point-of-sale system.
diff --git a/src/main/java/com/unicenta/pos/payment/PaymentInfoCash.java b/src/main/java/com/unicenta/pos/payment/PaymentInfoCash.java
index 88e67f1..aaf01e6 100644
--- a/src/main/java/com/unicenta/pos/payment/PaymentInfoCash.java
+++ b/src/main/java/com/unicenta/pos/payment/PaymentInfoCash.java
@@ -23,111 +23,121 @@ import com.unicenta.format.Formats;
public class PaymentInfoCash extends PaymentInfo {
- private double prePayAmount = 0.0;
- private double m_dPaid;
- private double m_dTotal;
- private double m_dTendered;
- private String m_dCardName =null;
-// private double m_dTip;
-
- /**
- * Creates a new instance of PaymentInfoCash
- * @param dTotal
- * @param dPaid
- * @param dTendered
- */
- public PaymentInfoCash(double dTotal, double dPaid, double dTendered) {
- m_dTotal = dTotal;
- m_dPaid = dPaid;
- m_dTendered = dTendered;
- }
+ private double prePayAmount = 0.0;
+ private double m_dPaid;
+ private double m_dTotal;
+ private double m_dTendered;
+ private String m_dCardName = null;
+ private String m_sName = "cash";
+ // private double m_dTip;
- /**
- * Creates a new instance of PaymentInfoCash
- * @param dTotal
- * @param dPaid
- * @param dTendered
- * @param prePayAmount
- */
- public PaymentInfoCash(double dTotal, double dPaid, double dTendered, double prePayAmount) {
- this(dTotal, dTendered, dPaid);
- this.prePayAmount = prePayAmount;
- }
-
- /** Creates a new instance of PaymentInfoCash
- * @param dTotal
- * @param dPaid */
- public PaymentInfoCash(double dTotal, double dPaid) {
- m_dTotal = dTotal;
- m_dPaid = dPaid;
- }
-
- @Override
- public PaymentInfo copyPayment() {
- return new PaymentInfoCash(m_dTotal, m_dPaid, m_dTendered, prePayAmount);
-// return new PaymentInfoCash(m_dTotal, m_dPaid, prePayAmount);
- }
+ /**
+ * Creates a new instance of PaymentInfoCash
+ *
+ * @param dTotal
+ * @param dPaid
+ * @param dTendered
+ */
+ public PaymentInfoCash(double dTotal, double dPaid, double dTendered) {
+ m_dTotal = dTotal;
+ m_dPaid = dPaid;
+ m_dTendered = dTendered;
+ }
- @Override
- public String getTransactionID() {
- return "no ID";
- }
-
- @Override
- public String getName() {
- return "cash";
- }
- @Override
- public double getTotal() {
- return m_dTotal;
- }
-// public double getTip() {
-// return m_dTip;
-// }
- @Override
- public double getPaid() {
- return m_dPaid;
- }
+ /**
+ * Creates a new instance of PaymentInfoCash
+ *
+ * @param dTotal
+ * @param dPaid
+ * @param dTendered
+ * @param prePayAmount
+ */
+ public PaymentInfoCash(double dTotal, double dPaid, double dTendered, double prePayAmount) {
+ this(dTotal, dTendered, dPaid);
+ this.prePayAmount = prePayAmount;
+ }
- @Override
- public double getTendered() {
- return m_dTendered;
+ /**
+ * Creates a new instance of PaymentInfoCash
+ *
+ * @param dTotal
+ * @param dPaid
+ */
+ public PaymentInfoCash(double dTotal, double dPaid) {
+ m_dTotal = dTotal;
+ m_dPaid = dPaid;
+ }
+
+ @Override
+ public PaymentInfo copyPayment() {
+ return new PaymentInfoCash(m_dTotal, m_dPaid, m_dTendered, prePayAmount);
+ // return new PaymentInfoCash(m_dTotal, m_dPaid, prePayAmount);
+ }
+
+ @Override
+ public String getTransactionID() {
+ return "no ID";
+ }
+
+ @Override
+ public String getName() {
+ return "cash";
+ }
+
+ @Override
+ public double getTotal() {
+ return m_dTotal;
+ }
+
+ // public double getTip() {
+ // return m_dTip;
+ // }
+ @Override
+ public double getPaid() {
+ return m_dPaid;
+ }
+
+ @Override
+ public double getTendered() {
+ return m_dTendered;
+ }
+
+ @Override
+ public double getChange() {
+ return m_dPaid - m_dTotal;
+ }
+
+ @Override
+ public String getCardName() {
+ return m_dCardName;
+ }
+
+ public boolean hasPrePay() {
+ if (prePayAmount > 0) {
+ return true;
}
+ return false;
+ }
- @Override
- public double getChange(){
- return m_dPaid - m_dTotal;
- }
+ public double getPrePaid() {
+ return prePayAmount;
+ }
- @Override
- public String getCardName() {
- return m_dCardName;
- }
+ public String printTendered() {
+ return Formats.CURRENCY.formatValue(m_dTendered);
+ }
- public boolean hasPrePay() {
- if (prePayAmount > 0) {
- return true;
- }
- return false;
- }
+ public String printPaid() {
+ return Formats.CURRENCY.formatValue(m_dPaid);
+ }
- public double getPrePaid() {
- return prePayAmount;
- }
+ public String printChange() {
+ return Formats.CURRENCY.formatValue(m_dPaid - m_dTotal);
+ }
- public String printTendered() {
- return Formats.CURRENCY.formatValue(m_dTendered);
- }
- public String printPaid() {
- return Formats.CURRENCY.formatValue(m_dPaid);
- }
- public String printChange() {
- return Formats.CURRENCY.formatValue(m_dPaid - m_dTotal);
- }
+ @Override
+ public String getVoucher() {
+ return null;
+ }
- @Override
- public String getVoucher() {
- return null;
- }
-
}
diff --git a/src/main/java/com/unicenta/pos/payment/PaymentInfoCash_original.java b/src/main/java/com/unicenta/pos/payment/PaymentInfoCash_original.java
index 9703cf8..575c8c7 100644
--- a/src/main/java/com/unicenta/pos/payment/PaymentInfoCash_original.java
+++ b/src/main/java/com/unicenta/pos/payment/PaymentInfoCash_original.java
@@ -26,73 +26,83 @@ import com.unicenta.format.Formats;
* @author JG uniCenta
*/
public class PaymentInfoCash_original extends PaymentInfo {
-
- private final double m_dPaid;
- private final double m_dTotal;
- private double m_dTendered;
- private final String m_dCardName =null;
-// private double m_dTip;
-
- /** Creates a new instance of PaymentInfoCash
- * @param dTotal
- * @param dPaid */
- public PaymentInfoCash_original(double dTotal, double dPaid) {
- m_dTotal = dTotal;
- m_dPaid = dPaid;
- }
-
- @Override
- public PaymentInfo copyPayment(){
- return new PaymentInfoCash_original(m_dTotal, m_dPaid);
- }
-
- @Override
- public String getTransactionID(){
- return "no ID";
- }
- @Override
- public String getName() {
- return "cash";
- }
- @Override
- public double getTotal() {
- return m_dTotal;
- }
-/** public double getTip() {
- return m_dTip;
- }
- * @return
-*/
- @Override
- public double getPaid() {
- return m_dPaid;
- }
+ private final double m_dPaid;
+ private final double m_dTotal;
+ private double m_dTendered;
+ private final String m_dCardName = null;
+ private String m_sName = "cash";
+ // private double m_dTip;
- @Override
- public double getTendered() {
- return m_dTendered;
- }
+ /**
+ * Creates a new instance of PaymentInfoCash
+ *
+ * @param dTotal
+ * @param dPaid
+ */
+ public PaymentInfoCash_original(double dTotal, double dPaid) {
+ m_dTotal = dTotal;
+ m_dPaid = dPaid;
+ }
- @Override
- public double getChange(){
- return m_dPaid - m_dTotal;
- }
+ @Override
+ public PaymentInfo copyPayment() {
+ return new PaymentInfoCash_original(m_dTotal, m_dPaid);
+ }
- @Override
- public String getCardName() {
- return m_dCardName;
- }
- public String printPaid() {
- return Formats.CURRENCY.formatValue(m_dPaid);
- }
- public String printChange() {
- return Formats.CURRENCY.formatValue(m_dPaid - m_dTotal);
- }
+ @Override
+ public String getTransactionID() {
+ return "no ID";
+ }
+
+ @Override
+ public String getName() {
+ return "cash";
+ }
+
+ @Override
+ public double getTotal() {
+ return m_dTotal;
+ }
+
+ /**
+ * public double getTip() {
+ * return m_dTip;
+ * }
+ *
+ * @return
+ */
+ @Override
+ public double getPaid() {
+ return m_dPaid;
+ }
+
+ @Override
+ public double getTendered() {
+ return m_dTendered;
+ }
+
+ @Override
+ public double getChange() {
+ return m_dPaid - m_dTotal;
+ }
+
+ @Override
+ public String getCardName() {
+ return m_dCardName;
+ }
+
+ public String printPaid() {
+ return Formats.CURRENCY.formatValue(m_dPaid);
+ }
+
+ public String printChange() {
+ return Formats.CURRENCY.formatValue(m_dPaid - m_dTotal);
+ }
+
+ @Override
+ public String getVoucher() {
+ return null;
+ }
- @Override
- public String getVoucher() {
- return null;
- }
-
}
diff --git a/src/main/java/com/unicenta/pos/payment/PaymentInfoMagcard.java b/src/main/java/com/unicenta/pos/payment/PaymentInfoMagcard.java
index 29f9898..7fe7992 100644
--- a/src/main/java/com/unicenta/pos/payment/PaymentInfoMagcard.java
+++ b/src/main/java/com/unicenta/pos/payment/PaymentInfoMagcard.java
@@ -21,290 +21,292 @@ package com.unicenta.pos.payment;
public class PaymentInfoMagcard extends PaymentInfo {
- protected double m_dTotal;
- protected double m_dTip;
- protected String m_sHolderName;
- protected String m_sCardNumber;
- protected String m_sExpirationDate;
- protected String track1;
- protected String track2;
- protected String track3;
- protected String m_sTransactionID;
- protected String m_sAuthorization;
- protected String m_sErrorMessage;
- protected String m_sReturnMessage;
- //JG Jan 2018
- protected String encryptedTrack;
- protected String encryptionKey;
- protected String m_dCardName =null;
+ private String m_sName = "creditcard";
+ protected double m_dTotal;
+ protected double m_dTip;
+ protected String m_sHolderName;
+ protected String m_sCardNumber;
+ protected String m_sExpirationDate;
+ protected String track1;
+ protected String track2;
+ protected String track3;
+ protected String m_sTransactionID;
+ protected String m_sAuthorization;
+ protected String m_sErrorMessage;
+ protected String m_sReturnMessage;
+ // JG Jan 2018
+ protected String encryptedTrack;
+ protected String encryptionKey;
+ protected String m_dCardName = null;
- protected Boolean chipAndPin = Boolean.FALSE;
- protected String verification;
- protected String lastFourDigits;
+ protected Boolean chipAndPin = Boolean.FALSE;
+ protected String verification;
+ protected String lastFourDigits;
- /**
- * Creates a new instance of PaymentInfoMagcard
- * @param sHolderName
- * @param sCardNumber
- * @param sExpirationDate
- * @param track1
- * @param track2
- * @param track3
- * @param encryptedCard
- * @param encryptKey
- * @param sTransactionID
- * @param dTotal
- */
- public PaymentInfoMagcard(String sHolderName, String sCardNumber,
- String sExpirationDate, String track1, String track2, String track3, String encryptedCard, String encryptKey,
- String sTransactionID, double dTotal) {
- m_sHolderName = sHolderName;
- m_sCardNumber = sCardNumber;
- m_sExpirationDate = sExpirationDate;
- this.track1 = track1;
- this.track2 = track2;
- this.track3 = track3;
- encryptedTrack = encryptedCard;
- encryptionKey = encryptKey;
- m_sTransactionID = sTransactionID;
- m_dTotal = dTotal;
+ /**
+ * Creates a new instance of PaymentInfoMagcard
+ *
+ * @param sHolderName
+ * @param sCardNumber
+ * @param sExpirationDate
+ * @param track1
+ * @param track2
+ * @param track3
+ * @param encryptedCard
+ * @param encryptKey
+ * @param sTransactionID
+ * @param dTotal
+ */
+ public PaymentInfoMagcard(String sHolderName, String sCardNumber,
+ String sExpirationDate, String track1, String track2, String track3, String encryptedCard, String encryptKey,
+ String sTransactionID, double dTotal) {
+ m_sHolderName = sHolderName;
+ m_sCardNumber = sCardNumber;
+ m_sExpirationDate = sExpirationDate;
+ this.track1 = track1;
+ this.track2 = track2;
+ this.track3 = track3;
+ encryptedTrack = encryptedCard;
+ encryptionKey = encryptKey;
+ m_sTransactionID = sTransactionID;
+ m_dTotal = dTotal;
+ m_sAuthorization = null;
+ m_sErrorMessage = null;
+ m_sReturnMessage = null;
+ }
- m_sAuthorization = null;
- m_sErrorMessage = null;
- m_sReturnMessage = null;
+ /**
+ * Creates a new instance of PaymentInfoMagcard
+ *
+ * @param sHolderName
+ * @param sCardNumber
+ * @param sExpirationDate
+ * @param sTransactionID
+ * @param dTotal
+ */
+ public PaymentInfoMagcard(String sHolderName, String sCardNumber,
+ String sExpirationDate, String sTransactionID, double dTotal) {
+ this(sHolderName, sCardNumber, sExpirationDate,
+ null, null, null, null, null, sTransactionID, dTotal);
+ }
+
+ @Override
+ public PaymentInfo copyPayment() {
+ PaymentInfoMagcard p = new PaymentInfoMagcard(m_sHolderName,
+ m_sCardNumber, m_sExpirationDate, track1, track2,
+ track3, encryptedTrack, encryptionKey, m_sTransactionID, m_dTotal);
+ p.m_sAuthorization = m_sAuthorization;
+ p.m_sErrorMessage = m_sErrorMessage;
+ return p;
+ }
+
+ public String getName() {
+ // return "magcard";
+ return "ccard";
+ }
+
+ @Override
+ public double getTotal() {
+ return m_dTotal;
+ }
+
+ public double getTip() {
+ return m_dTip;
+ }
+
+ public boolean isPaymentOK() {
+ return m_sAuthorization != null;
+ }
+
+ public String getHolderName() {
+ return m_sHolderName;
+ }
+
+ @Override
+ public String getCardName() {
+ if (chipAndPin) {
+ return m_dCardName;
}
+ return getCardType(m_sCardNumber);
+ }
- /**
- * Creates a new instance of PaymentInfoMagcard
- * @param sHolderName
- * @param sCardNumber
- * @param sExpirationDate
- * @param sTransactionID
- * @param dTotal
- */
- public PaymentInfoMagcard(String sHolderName, String sCardNumber,
- String sExpirationDate, String sTransactionID, double dTotal) {
- this(sHolderName, sCardNumber, sExpirationDate,
- null, null, null, null, null, sTransactionID, dTotal);
+ public String getCardNumber() {
+ return m_sCardNumber;
+ }
+
+ public String getExpirationDate() {
+ return m_sExpirationDate;
+ }
+
+ @Override
+ public String getTransactionID() {
+ return m_sTransactionID;
+ }
+
+ /**
+ * Get tracks of magnetic card. Framing characters: - start sentinel (SS) -
+ * end sentinel (ES) - LRC
+ *
+ * @return tracks of the magnetic card
+ */
+ public String getEncryptedCardData() {
+ return encryptedTrack;
+ }
+
+ public String getEncryptionKey() {
+ return encryptionKey;
+ }
+
+ /**
+ * @param sCardNumber
+ * @return
+ */
+ public String getCardType(String sCardNumber) {
+ String c = "UNKNOWN";
+
+ if (sCardNumber.startsWith("4")) {
+ c = "VISA";
+ } else if (sCardNumber.startsWith("6")) {
+ c = "DISC";
+ } else if (sCardNumber.startsWith("5")) {
+ c = "MAST";
+ } else if (sCardNumber.startsWith("34") || sCardNumber.startsWith("37")) {
+ c = "AMEX";
+ } else if (sCardNumber.startsWith("3528") || sCardNumber.startsWith("3589")) {
+ c = "JCB";
+ } else if (sCardNumber.startsWith("3")) {
+ c = "DINE";
}
+ m_sCardNumber = c;
+ return c;
+ }
- @Override
- public PaymentInfo copyPayment() {
- PaymentInfoMagcard p = new PaymentInfoMagcard(m_sHolderName,
- m_sCardNumber, m_sExpirationDate, track1, track2,
- track3, encryptedTrack, encryptionKey, m_sTransactionID, m_dTotal);
- p.m_sAuthorization = m_sAuthorization;
- p.m_sErrorMessage = m_sErrorMessage;
- return p;
+ public String getTrack1(boolean framingChar) {
+ return (framingChar)
+ ? track1
+ : track1.substring(1, track1.length() - 2);
+ }
+
+ public String getTrack2(boolean framingChar) {
+ return (framingChar)
+ ? track2
+ : track2.substring(1, track2.length() - 2);
+ }
+
+ public String getTrack3(boolean framingChar) {
+ return (framingChar)
+ ? track3
+ : track3.substring(1, track3.length() - 2);
+ }
+
+ public String getAuthorization() {
+ return m_sAuthorization;
+ }
+
+ public String getMessage() {
+ return m_sErrorMessage;
+ }
+
+ public void paymentError(String sMessage, String moreInfo) {
+ m_sAuthorization = null;
+ m_sErrorMessage = sMessage + "\n" + moreInfo;
+ }
+
+ public void setReturnMessage(String returnMessage) {
+ m_sReturnMessage = returnMessage;
+ }
+
+ public String getReturnMessage() {
+ return m_sReturnMessage;
+ }
+
+ public void paymentOK(String sAuthorization, String sTransactionId, String sReturnMessage) {
+ m_sAuthorization = sAuthorization;
+ m_sTransactionID = sTransactionId;
+ m_sReturnMessage = sReturnMessage;
+ m_sErrorMessage = null;
+ }
+
+ public String printCardNumber() {
+ System.out.println(m_sCardNumber);
+ if (m_sCardNumber.length() > 4) {
+ return m_sCardNumber.substring(0, m_sCardNumber.length() - 4).replaceAll("\\.", "*")
+ + m_sCardNumber.substring(m_sCardNumber.length() - 4);
+ } else {
+ return "****";
}
+ }
- public String getName() {
-// return "magcard";
- return "ccard";
- }
+ public String printExpirationDate() {
+ return m_sExpirationDate;
+ }
- @Override
- public double getTotal() {
- return m_dTotal;
- }
+ public String printAuthorization() {
+ return m_sAuthorization;
+ }
- public double getTip() {
- return m_dTip;
- }
+ public String printTransactionID() {
+ return m_sTransactionID;
+ }
- public boolean isPaymentOK() {
- return m_sAuthorization != null;
- }
+ public boolean getIsProcessed() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
- public String getHolderName() {
- return m_sHolderName;
- }
+ public void setIsProcessed(boolean value) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
- @Override
- public String getCardName() {
- if (chipAndPin){
- return m_dCardName;
- }
- return getCardType(m_sCardNumber);
- }
+ @Override
+ public double getPaid() {
+ return (0.0);
+ }
- public String getCardNumber() {
- return m_sCardNumber;
- }
+ @Override
+ public double getChange() {
+ return 0.00;
+ }
- public String getExpirationDate() {
- return m_sExpirationDate;
- }
+ @Override
+ public double getTendered() {
+ return 0.00;
+ }
- @Override
- public String getTransactionID() {
- return m_sTransactionID;
- }
+ @Override
+ public String getVoucher() {
+ return null;
+ }
- /**
- * Get tracks of magnetic card. Framing characters: - start sentinel (SS) -
- * end sentinel (ES) - LRC
- *
- * @return tracks of the magnetic card
- */
- public String getEncryptedCardData() {
- return encryptedTrack;
- }
+ public void setCardName(String m_dCardName) {
+ this.m_dCardName = m_dCardName;
+ }
- public String getEncryptionKey() {
- return encryptionKey;
- }
+ public Boolean isChipAndPin() {
+ return chipAndPin;
+ }
- /** @param sCardNumber
- * @return
- */
- public String getCardType(String sCardNumber){
- String c = "UNKNOWN";
+ public void setChipAndPin(Boolean chipAndPin) {
+ this.chipAndPin = chipAndPin;
+ }
- if (sCardNumber.startsWith("4")) {
- c = "VISA";
- } else if (sCardNumber.startsWith("6")) {
- c = "DISC";
- } else if (sCardNumber.startsWith("5")) {
- c = "MAST";
- } else if (sCardNumber.startsWith("34") || sCardNumber.startsWith("37")) {
- c = "AMEX";
- } else if (sCardNumber.startsWith("3528") || sCardNumber.startsWith("3589")) {
- c = "JCB";
- } else if (sCardNumber.startsWith("3")) {
- c = "DINE";
- }
- m_sCardNumber = c;
- return c;
- }
+ public String printVerification() {
+ return verification;
+ }
- public String getTrack1(boolean framingChar) {
- return (framingChar)
- ? track1
- : track1.substring(1, track1.length() - 2);
- }
+ public void setVerification(String verification) {
+ this.verification = verification;
+ }
- public String getTrack2(boolean framingChar) {
- return (framingChar)
- ? track2
- : track2.substring(1, track2.length() - 2);
- }
+ public String getLastFourDigits() {
+ return lastFourDigits;
+ }
- public String getTrack3(boolean framingChar) {
- return (framingChar)
- ? track3
- : track3.substring(1, track3.length() - 2);
- }
+ public String printLastFourDigits() {
+ return lastFourDigits;
+ }
- public String getAuthorization() {
- return m_sAuthorization;
- }
-
- public String getMessage() {
- return m_sErrorMessage;
- }
-
- public void paymentError(String sMessage, String moreInfo) {
- m_sAuthorization = null;
- m_sErrorMessage = sMessage + "\n" + moreInfo;
- }
-
- public void setReturnMessage(String returnMessage) {
- m_sReturnMessage = returnMessage;
- }
-
- public String getReturnMessage() {
- return m_sReturnMessage;
- }
-
- public void paymentOK(String sAuthorization, String sTransactionId, String sReturnMessage) {
- m_sAuthorization = sAuthorization;
- m_sTransactionID = sTransactionId;
- m_sReturnMessage = sReturnMessage;
- m_sErrorMessage = null;
- }
-
- public String printCardNumber() {
- System.out.println(m_sCardNumber);
- if (m_sCardNumber.length() > 4) {
- return m_sCardNumber.substring(0, m_sCardNumber.length() - 4).replaceAll("\\.", "*")
- + m_sCardNumber.substring(m_sCardNumber.length() - 4);
- } else {
- return "****";
- }
- }
-
- public String printExpirationDate() {
- return m_sExpirationDate;
- }
-
- public String printAuthorization() {
- return m_sAuthorization;
- }
-
- public String printTransactionID() {
- return m_sTransactionID;
- }
-
- public boolean getIsProcessed() {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
-
- public void setIsProcessed(boolean value) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public double getPaid() {
- return (0.0);
- }
-
- @Override
- public double getChange(){
- return 0.00;
- }
-
- @Override
- public double getTendered() {
- return 0.00;
- }
-
- @Override
- public String getVoucher() {
- return null;
- }
-
- public void setCardName(String m_dCardName){
- this.m_dCardName = m_dCardName;
- }
-
- public Boolean isChipAndPin() {
- return chipAndPin;
- }
-
- public void setChipAndPin(Boolean chipAndPin) {
- this.chipAndPin = chipAndPin;
- }
-
- public String printVerification() {
- return verification;
- }
-
- public void setVerification(String verification) {
- this.verification = verification;
- }
-
- public String getLastFourDigits() {
- return lastFourDigits;
- }
-
- public String printLastFourDigits() {
- return lastFourDigits;
- }
-
- public void setLastFourDigits(String lastFourDigits) {
- this.lastFourDigits = lastFourDigits;
- }
-}
\ No newline at end of file
+ public void setLastFourDigits(String lastFourDigits) {
+ this.lastFourDigits = lastFourDigits;
+ }
+}
diff --git a/src/main/java/com/unicenta/pos/sales/JPanelTicket.java b/src/main/java/com/unicenta/pos/sales/JPanelTicket.java
index b55afd1..695a068 100644
--- a/src/main/java/com/unicenta/pos/sales/JPanelTicket.java
+++ b/src/main/java/com/unicenta/pos/sales/JPanelTicket.java
@@ -26,6 +26,7 @@ import com.alee.extended.time.WebClock;
import com.alee.managers.notification.NotificationIcon;
import com.alee.managers.notification.NotificationManager;
import com.alee.managers.notification.WebNotification;
+import com.google.gson.Gson;
import com.unicenta.basic.BasicException;
import com.unicenta.beans.JNumberPop;
import com.unicenta.data.gui.ComboBoxValModel;
@@ -74,7 +75,6 @@ import java.util.*;
import static java.awt.Window.getWindows;
-
/**
* @author JG uniCenta
*/
@@ -155,7 +155,6 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
private Integer oCount = 0;
private Boolean pinOK;
-
/**
* Creates new form JTicketView
*/
@@ -182,8 +181,8 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
dlCustomers = (DataLogicCustomers) m_App.getBean("com.unicenta.pos.customers.DataLogicCustomers");
dlReceipts = (DataLogicReceipts) app.getBean("com.unicenta.pos.sales.DataLogicReceipts");
-
- /* uniCenta Feb 2018
+ /*
+ * uniCenta Feb 2018
* Changed for 4.3
* Set up main toolbar area with two rows to add cater for additional scripts
* else over-crowding and some dynamic buttons off screen/not visible
@@ -191,16 +190,17 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
* Resources>Menu.Root
*/
-// Set Configuration>General>Tickets toolbar simple : standard : restaurant option
+ // Set Configuration>General>Tickets toolbar simple : standard : restaurant
+ // option
m_ticketsbag = getJTicketsBag();
m_jPanelBag.add(m_ticketsbag.getBagComponent(), BorderLayout.LINE_START);
add(m_ticketsbag.getNullComponent(), "null");
-// Script event buttons
+ // Script event buttons
m_jbtnconfig = new JPanelButtons("Ticket.Buttons", this);
m_jButtonsExt.add(m_jbtnconfig);
-// Configuration>Peripheral options
+ // Configuration>Peripheral options
if (!m_App.getDeviceScale().existsScale()) {
m_jbtnScale.setVisible(false);
}
@@ -327,7 +327,6 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
}
}
-
}
@Override
@@ -386,9 +385,9 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
if (currentTicket != null) {
try {
dlReceipts.updateSharedTicket(currentTicket, m_oTicket, m_oTicket.getPickupId());
-// } catch (BasicException e) {
-// new MessageInf(e).show(this);
-// }
+ // } catch (BasicException e) {
+ // new MessageInf(e).show(this);
+ // }
} catch (BasicException ex) {
log.error(ex.getMessage());
}
@@ -517,17 +516,17 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
m_oTicket.setDate(new Date());
if ("restaurant".equals(m_App.getProperties().getProperty("machine.ticketsbag"))
- && !oTicket.getOldTicket()) {
+ && !oTicket.getOldTicket()) {
if (restDB.getCustomerNameInTable(oTicketExt.toString()) == null) {
if (m_oTicket.getCustomer() != null) {
restDB.setCustomerNameInTable(m_oTicket.getCustomer().toString(),
- oTicketExt.toString());
+ oTicketExt.toString());
}
}
if (restDB.getWaiterNameInTable(oTicketExt.toString()) == null
- || "".equals(restDB.getWaiterNameInTable(oTicketExt.toString()))) {
+ || "".equals(restDB.getWaiterNameInTable(oTicketExt.toString()))) {
restDB.setWaiterNameInTable(m_App.getAppUserView().getUser().getName(),
- oTicketExt.toString());
+ oTicketExt.toString());
}
restDB.setTicketIdInTable(m_oTicket.getId(), oTicketExt.toString());
@@ -537,14 +536,14 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
}
if ((m_oTicket != null) && (((Boolean.parseBoolean(m_App.getProperties()
- .getProperty("table.showwaiterdetails")))
- || (Boolean.valueOf(m_App.getProperties().getProperty(
+ .getProperty("table.showwaiterdetails")))
+ || (Boolean.valueOf(m_App.getProperties().getProperty(
"table.showcustomerdetails")))))) {
}
if ((m_oTicket != null) && (((Boolean.valueOf(m_App.getProperties()
- .getProperty("table.showcustomerdetails"))) ||
- (Boolean.parseBoolean(m_App.getProperties().getProperty("table.showwaiterdetails")))))) {
+ .getProperty("table.showcustomerdetails"))) ||
+ (Boolean.parseBoolean(m_App.getProperties().getProperty("table.showwaiterdetails")))))) {
if (restDB.getTableMovedFlag(m_oTicket.getId())) {
restDB.moveCustomer(oTicketExt.toString(), m_oTicket.getId());
}
@@ -600,7 +599,7 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
m_oTicket.getLines().forEach((line) -> {
line.setTaxInfo(taxeslogic.getTaxInfo(line
- .getProductTaxCategoryID(), m_oTicket.getCustomer()));
+ .getProductTaxCategoryID(), m_oTicket.getCustomer()));
});
m_jTicketId.setText(m_oTicket.getName(m_oTicketExt));
@@ -609,7 +608,7 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
for (int i = 0; i < m_oTicket.getLinesCount(); i++) {
m_ticketlines.addTicketLine(m_oTicket.getLine(i));
}
-// set line here?
+ // set line here?
countArticles();
printPartialTotals();
@@ -632,13 +631,13 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
}
private void countArticles() {
- oCount = count; // existing line before change
- count = (int) m_oTicket.getArticlesCount(); //existing line after change
+ oCount = count; // existing line before change
+ count = (int) m_oTicket.getArticlesCount(); // existing line after change
if (m_oTicket != null) {
for (int i = 0; i < m_oTicket.getLinesCount(); i++) {
if (m_App.getAppUserView().getUser().hasPermission("sales.Total")
- && m_oTicket.getArticlesCount() > 1) {
+ && m_oTicket.getArticlesCount() > 1) {
btnSplit.setEnabled(true);
} else {
btnSplit.setEnabled(false);
@@ -660,7 +659,7 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
if (iValue == null ? secret == null : iValue.equals(secret)) {
pinOK = true;
JOptionPane.showMessageDialog(this, "Units changed from "
- + count + " to " + oCount);
+ + count + " to " + oCount);
return pinOK;
} else {
@@ -689,13 +688,13 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
private void paintTicketLine(int index, TicketLineInfo oLine) {
if (executeEventAndRefresh("ticket.setline",
- new ScriptArg("index", index), new ScriptArg("line", oLine)) == null) {
+ new ScriptArg("index", index), new ScriptArg("line", oLine)) == null) {
m_oTicket.setLine(index, oLine);
m_ticketlines.setTicketLine(index, oLine);
m_ticketlines.setSelectedIndex(index);
- oCount = count; // pass line old multiplier value
+ oCount = count; // pass line old multiplier value
countArticles();
visorTicketLine(oLine);
@@ -708,7 +707,7 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
private void addTicketLine(ProductInfoExt oProduct, double dMul, double dPrice) {
-// if (oProduct.isVprice() || oProduct.getID().equals("xxx999_999xxx_x9x9x9")){
+ // if (oProduct.isVprice() || oProduct.getID().equals("xxx999_999xxx_x9x9x9")){
if (oProduct.isVprice()) {
TaxInfo tax = taxeslogic.getTaxInfo(oProduct.getTaxCategoryID(), m_oTicket.getCustomer());
@@ -717,13 +716,13 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
}
addTicketLine(new TicketLineInfo(oProduct, dMul, dPrice, tax,
- (java.util.Properties) (oProduct.getProperties().clone())));
+ (java.util.Properties) (oProduct.getProperties().clone())));
} else if (oProduct.getID().equals("xxx998_998xxx_x8x8x8")) {
if (m_App.getProperties().getProperty("till.SCOnOff").equals("true")) {
TaxInfo tax = taxeslogic.getTaxInfo(oProduct.getTaxCategoryID(),
- m_oTicket.getCustomer());
+ m_oTicket.getCustomer());
String SCRate = (m_App.getProperties().getProperty("till.SCRate"));
double scharge;
@@ -731,22 +730,22 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
scharge = m_oTicket.getTotal() * (scharge / 100);
addTicketLine(new TicketLineInfo(oProduct, 1, scharge, tax,
- (java.util.Properties) (oProduct.getProperties().clone())));
+ (java.util.Properties) (oProduct.getProperties().clone())));
} else {
JOptionPane.showMessageDialog(this, "Service Charge Not Enabled");
}
} else {
-// get the line product tax
+ // get the line product tax
TaxInfo tax = taxeslogic.getTaxInfo(oProduct.getTaxCategoryID(), m_oTicket.getCustomer());
addTicketLine(new TicketLineInfo(oProduct, dMul, dPrice, tax,
- (java.util.Properties) (oProduct.getProperties().clone())));
+ (java.util.Properties) (oProduct.getProperties().clone())));
-// if (oProduct.getID().equals("xxx999_999xxx_x9x9x9")){
-// m_jEditLine.doClick();
-// }
+ // if (oProduct.getID().equals("xxx999_999xxx_x9x9x9")){
+ // m_jEditLine.doClick();
+ // }
refreshTicket();
}
@@ -799,7 +798,7 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
} catch (BasicException ex) {
MessageInf msg = new MessageInf(MessageInf.SGN_WARNING,
- AppLocal.getIntString("message.cannotfindattributes"), ex);
+ AppLocal.getIntString("message.cannotfindattributes"), ex);
msg.show(this);
}
}
@@ -816,12 +815,10 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
private void removeTicketLine(int i) {
-// if (m_App.getProperties().getProperty("override.check").equals("true")) {
+ // if (m_App.getProperties().getProperty("override.check").equals("true")) {
if (!m_oTicket.getLine(i).getUpdated()) {
- JOptionPane.showMessageDialog(this
- , AppLocal.getIntString("message.deletelinesent")
- , AppLocal.getIntString("label.deleteline")
- , JOptionPane.WARNING_MESSAGE);
+ JOptionPane.showMessageDialog(this, AppLocal.getIntString("message.deletelinesent"),
+ AppLocal.getIntString("label.deleteline"), JOptionPane.WARNING_MESSAGE);
} else {
if (executeEventAndRefresh("ticket.removeline", new ScriptArg("index", i)) == null) {
String ticketID = Integer.toString(m_oTicket.getTicketId());
@@ -829,14 +826,13 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
ticketID = "Void";
}
dlSystem.execLineRemoved(
- new Object[]{
- m_App.getAppUserView().getUser().getName(),
- ticketID,
- m_oTicket.getLine(i).getProductID(),
- m_oTicket.getLine(i).getProductName(),
- m_oTicket.getLine(i).getMultiply()
- }
- );
+ new Object[] {
+ m_App.getAppUserView().getUser().getName(),
+ ticketID,
+ m_oTicket.getLine(i).getProductID(),
+ m_oTicket.getLine(i).getProductName(),
+ m_oTicket.getLine(i).getMultiply()
+ });
if (m_oTicket.getLine(i).isProductCom()) {
m_oTicket.removeLine(i);
@@ -846,8 +842,8 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
if (m_App.getAppUserView().getUser().hasPermission("sales.DeleteLines")) {
int input = JOptionPane.showConfirmDialog(this,
- AppLocal.getIntString("message.deletelineyes")
- , AppLocal.getIntString("label.deleteline"), JOptionPane.YES_NO_OPTION);
+ AppLocal.getIntString("message.deletelineyes"), AppLocal.getIntString("label.deleteline"),
+ JOptionPane.YES_NO_OPTION);
if (input == 0) {
m_oTicket.removeLine(i);
@@ -855,8 +851,8 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
}
} else {
JOptionPane.showMessageDialog(this,
- AppLocal.getIntString("message.deletelineno")
- , AppLocal.getIntString("label.deleteline"), JOptionPane.WARNING_MESSAGE);
+ AppLocal.getIntString("message.deletelineno"), AppLocal.getIntString("label.deleteline"),
+ JOptionPane.WARNING_MESSAGE);
}
} else {
m_oTicket.removeLine(i);
@@ -878,18 +874,18 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
executeEventAndRefresh("ticket.change");
}
}
-// }
+ // }
}
private ProductInfoExt getInputProduct() {
ProductInfoExt oProduct = new ProductInfoExt();
-// Always add Default Prod ID + Add Name to Misc. if empty
+ // Always add Default Prod ID + Add Name to Misc. if empty
oProduct.setID("xxx999_999xxx_x9x9x9");
oProduct.setReference("xxx999");
oProduct.setCode("xxx999");
oProduct.setName("***");
oProduct.setTaxCategoryID(((TaxCategoryInfo) taxcategoriesmodel
- .getSelectedItem()).getID());
+ .getSelectedItem()).getID());
oProduct.setPriceSell(includeTaxes(oProduct.getTaxCategoryID(), getInputValue()));
return oProduct;
@@ -911,7 +907,6 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
return dValue / (1.0 + dTaxRate);
}
-
private double getInputValue() {
try {
return Double.parseDouble(m_jPrice.getText());
@@ -947,8 +942,8 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
if (oProduct == null) {
Toolkit.getDefaultToolkit().beep();
JOptionPane.showMessageDialog(null,
- sCode + " - " + AppLocal.getIntString("message.noproduct"),
- "Check", JOptionPane.WARNING_MESSAGE);
+ sCode + " - " + AppLocal.getIntString("message.noproduct"),
+ "Check", JOptionPane.WARNING_MESSAGE);
stateToZero();
} else {
incProduct(oProduct);
@@ -966,7 +961,7 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
if (oProduct == null) {
Toolkit.getDefaultToolkit().beep();
new MessageInf(MessageInf.SGN_WARNING, AppLocal
- .getIntString("message.noproduct")).show(this);
+ .getIntString("message.noproduct")).show(this);
stateToZero();
} else {
if (m_jaddtax.isSelected()) {
@@ -993,7 +988,7 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
} catch (ScaleException e) {
Toolkit.getDefaultToolkit().beep();
new MessageInf(MessageInf.SGN_WARNING, AppLocal
- .getIntString("message.noweight"), e).show(this);
+ .getIntString("message.noweight"), e).show(this);
stateToZero();
}
} else {
@@ -1002,7 +997,7 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
} else {
Toolkit.getDefaultToolkit().beep();
JOptionPane.showMessageDialog(null,
- AppLocal.getIntString("message.novprice"));
+ AppLocal.getIntString("message.novprice"));
}
}
}
@@ -1040,17 +1035,17 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
if (m_sBarcode.length() > 0) {
String sCode = m_sBarcode.toString();
- String sCodetype = "EAN"; // Declare EAN. It's default
+ String sCodetype = "EAN"; // Declare EAN. It's default
if ("true".equals(m_App.getProperties()
- .getProperty("machine.barcodetype"))) {
+ .getProperty("machine.barcodetype"))) {
sCodetype = "UPC";
} else {
- sCodetype = "EAN"; // Ensure not null
+ sCodetype = "EAN"; // Ensure not null
}
if (sCode.startsWith("C")
- || sCode.startsWith("c")) {
+ || sCode.startsWith("c")) {
try {
String card = sCode;
CustomerInfoExt newcustomer = dlSales.findCustomerExt(card);
@@ -1058,7 +1053,7 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
if (newcustomer == null) {
Toolkit.getDefaultToolkit().beep();
new MessageInf(MessageInf.SGN_WARNING, AppLocal
- .getIntString("message.nocustomer")).show(this);
+ .getIntString("message.nocustomer")).show(this);
} else {
m_oTicket.setCustomer(newcustomer);
m_jTicketId.setText(m_oTicket.getName(m_oTicketExt));
@@ -1066,202 +1061,190 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
} catch (BasicException e) {
Toolkit.getDefaultToolkit().beep();
new MessageInf(MessageInf.SGN_WARNING, AppLocal
- .getIntString("message.nocustomer"), e).show(this);
+ .getIntString("message.nocustomer"), e).show(this);
}
stateToZero();
} else if (sCode.startsWith(";")) {
stateToZero();
-
// START OF BARCODE PARSING
- /* This block is deliberately verbose and is base for future scanner handling
- * Some scanners inject a CR+LF... some don't...
- * stateTransition() must allow for this as these add characters to .length()
- * First 3 digits are GS1 CountryCode OR Retailer internal use
+ /*
+ * This block is deliberately verbose and is base for future scanner handling
+ * Some scanners inject a CR+LF... some don't...
+ * stateTransition() must allow for this as these add characters to .length()
+ * First 3 digits are GS1 CountryCode OR Retailer internal use
*
- * Prefix ManCodeProdCode CheckCode
- * PPP MMMMMCCCCC K
- * 012 3456789012 K
- * Barcode CCCCC must be unique
- * Notes:
- * ManufacturerCode and ProductCode must be exactly 10 digits
- * If code begins with 0 then is actually a UPC-A with prepended 0
+ * Prefix ManCodeProdCode CheckCode
+ * PPP MMMMMCCCCC K
+ * 012 3456789012 K
+ * Barcode CCCCC must be unique
+ * Notes:
+ * ManufacturerCode and ProductCode must be exactly 10 digits
+ * If code begins with 0 then is actually a UPC-A with prepended 0
*
- * uniCenta oPOS Retailer instore uses these RULES
- * Prefixes 020 to 029 are set aside for Retailer internal use
- * This means that CCCC becomes price/weight values
- * Prefixes 978 and 979 are set aside for ISBN - Future use
+ * uniCenta oPOS Retailer instore uses these RULES
+ * Prefixes 020 to 029 are set aside for Retailer internal use
+ * This means that CCCC becomes price/weight values
+ * Prefixes 978 and 979 are set aside for ISBN - Future use
*
- * Prefix ManCode ProdCode CheckCode
- * PPP MMMMM CCCCC K Format
- * 012 34567 89012 K Human
+ * Prefix ManCode ProdCode CheckCode
+ * PPP MMMMM CCCCC K Format
+ * 012 34567 89012 K Human
*
*/
} else if ("EAN".equals(sCodetype)
- && ((sCode.startsWith("2")) || (sCode.startsWith("02"))) // check code prefix
- && ((sCode.length() == 13) || (sCode.length() == 12))) { // check code length variances
+ && ((sCode.startsWith("2")) || (sCode.startsWith("02"))) // check code prefix
+ && ((sCode.length() == 13) || (sCode.length() == 12))) { // check code length variances
try {
- ProductInfoExt oProduct // get product(s) with PMMMMM
- = dlSales.getProductInfoByShortCode(sCode);
+ ProductInfoExt oProduct // get product(s) with PMMMMM
+ = dlSales.getProductInfoByShortCode(sCode);
- if (oProduct == null) { // nothing returned so display message to user
+ if (oProduct == null) { // nothing returned so display message to user
Toolkit.getDefaultToolkit().beep();
JOptionPane.showMessageDialog(null,
- sCode + " - "
- + AppLocal.getIntString("message.noproduct"),
- "Check", JOptionPane.WARNING_MESSAGE);
- stateToZero(); // clear the user input
+ sCode + " - "
+ + AppLocal.getIntString("message.noproduct"),
+ "Check", JOptionPane.WARNING_MESSAGE);
+ stateToZero(); // clear the user input
- } else if ("EAN-13".equals(oProduct.getCodetype())) { // have a valid barcode
- oProduct.setProperty("product.barcode", sCode); // set the screen's barcode from input
- double dPriceSell = oProduct.getPriceSell(); // default price for product
- double weight = 0; // used if barcode includes weight of product
- double dUnits = 0; // used for pro-rata unit
- String sVariableTypePrefix = sCode.substring(0, 2); // get first two PPP digits
- String sVariableNum; // CCCCC variable value of barcode
+ } else if ("EAN-13".equals(oProduct.getCodetype())) { // have a valid barcode
+ oProduct.setProperty("product.barcode", sCode); // set the screen's barcode from input
+ double dPriceSell = oProduct.getPriceSell(); // default price for product
+ double weight = 0; // used if barcode includes weight of product
+ double dUnits = 0; // used for pro-rata unit
+ String sVariableTypePrefix = sCode.substring(0, 2); // get first two PPP digits
+ String sVariableNum; // CCCCC variable value of barcode
- if (sCode.length() == 13) { // full barcode from scanner
- sVariableNum = sCode.substring(8, 12); // get the 5 CCCCC digits
- } else { // barcode can be any length
- sVariableNum = sCode.substring(7, 11); // get the 5 CCCCC digits
- } // scanner has dropped 1st digit so shift get to left
+ if (sCode.length() == 13) { // full barcode from scanner
+ sVariableNum = sCode.substring(8, 12); // get the 5 CCCCC digits
+ } else { // barcode can be any length
+ sVariableNum = sCode.substring(7, 11); // get the 5 CCCCC digits
+ } // scanner has dropped 1st digit so shift get to left
-// PRICE - SET value decimals
- switch (sVariableTypePrefix) { // Use CCCCC value of 01049 as example
- case "02": // first 2 PPP digits determine decimal position
- dUnits = (Double.parseDouble(sVariableNum) // position decimal in CCC.CC
- / 100) / oProduct.getPriceSell(); // 2 decimal = 010.49
+ // PRICE - SET value decimals
+ switch (sVariableTypePrefix) { // Use CCCCC value of 01049 as example
+ case "02": // first 2 PPP digits determine decimal position
+ dUnits = (Double.parseDouble(sVariableNum) // position decimal in CCC.CC
+ / 100) / oProduct.getPriceSell(); // 2 decimal = 010.49
break;
case "20":
- dUnits = (Double.parseDouble(sVariableNum) // position decimal in CCC.CC
- / 100) / oProduct.getPriceSell(); // 2 decimal = 010.49
+ dUnits = (Double.parseDouble(sVariableNum) // position decimal in CCC.CC
+ / 100) / oProduct.getPriceSell(); // 2 decimal = 010.49
break;
case "21":
- dUnits = (Double.parseDouble(sVariableNum) // position decimal in CC.CCC
- / 10) / oProduct.getPriceSell(); // 2 decimal = 0104.9
+ dUnits = (Double.parseDouble(sVariableNum) // position decimal in CC.CCC
+ / 10) / oProduct.getPriceSell(); // 2 decimal = 0104.9
break;
case "22":
- dUnits = Double.parseDouble(sVariableNum) // position decimal in CCCC.C
- / oProduct.getPriceSell(); // Price = 01049.
+ dUnits = Double.parseDouble(sVariableNum) // position decimal in CCCC.C
+ / oProduct.getPriceSell(); // Price = 01049.
break;
-// WEIGHT - SET value decimals
- case "23": // Use CCCCC 01049kg as example
+ // WEIGHT - SET value decimals
+ case "23": // Use CCCCC 01049kg as example
weight = Double.parseDouble(sVariableNum)
- / 1000; // Weight = 01.049
- dUnits = weight; // set Units for price calculation
+ / 1000; // Weight = 01.049
+ dUnits = weight; // set Units for price calculation
break;
case "24":
weight = Double.parseDouble(sVariableNum)
- / 100; // Weight = 010.49
- dUnits = weight; // set Units for price calculation
+ / 100; // Weight = 010.49
+ dUnits = weight; // set Units for price calculation
break;
case "25":
weight = Double.parseDouble(sVariableNum)
- / 10; // Weight = 0104.9
- dUnits = weight; // set Units for price calculation
+ / 10; // Weight = 0104.9
+ dUnits = weight; // set Units for price calculation
break;
default:
break;
}
- TaxInfo tax = taxeslogic // get the TaxRate for the product
- .getTaxInfo(oProduct.getTaxCategoryID()
- , m_oTicket.getCustomer()); // calculate if ticket has a Customer
+ TaxInfo tax = taxeslogic // get the TaxRate for the product
+ .getTaxInfo(oProduct.getTaxCategoryID(), m_oTicket.getCustomer()); // calculate if ticket has a
+ // Customer
switch (sVariableTypePrefix) {
-// PRICE - Assign var's
- case "02": // now we need to calculate some values
+ // PRICE - Assign var's
+ case "02": // now we need to calculate some values
dPriceSell = oProduct.getPriceSellTax(tax)
- / (1.0 + tax.getRate()); // selling price with tax
+ / (1.0 + tax.getRate()); // selling price with tax
dUnits = (Double.parseDouble(sVariableNum)
- / 100) / oProduct.getPriceSellTax(tax); // Units as proportion of selling price
- oProduct.setProperty("product.price"
- , Double.toString(oProduct.getPriceSell())); // push to screen
+ / 100) / oProduct.getPriceSellTax(tax); // Units as proportion of selling price
+ oProduct.setProperty("product.price", Double.toString(oProduct.getPriceSell())); // push to screen
break;
- case "20": // as above
+ case "20": // as above
dPriceSell = oProduct.getPriceSellTax(tax)
- / (1.0 + tax.getRate());
+ / (1.0 + tax.getRate());
dUnits = (Double.parseDouble(sVariableNum)
- / 100) / oProduct.getPriceSellTax(tax);
- oProduct.setProperty("product.price"
- , Double.toString(oProduct.getPriceSellTax(tax)));
+ / 100) / oProduct.getPriceSellTax(tax);
+ oProduct.setProperty("product.price", Double.toString(oProduct.getPriceSellTax(tax)));
break;
case "21":
dPriceSell = oProduct.getPriceSellTax(tax)
- / (1.0 + tax.getRate());
+ / (1.0 + tax.getRate());
dUnits = (Double.parseDouble(sVariableNum)
- / 10) / oProduct.getPriceSellTax(tax);
- oProduct.setProperty("product.price"
- , Double.toString(oProduct.getPriceSell()));
+ / 10) / oProduct.getPriceSellTax(tax);
+ oProduct.setProperty("product.price", Double.toString(oProduct.getPriceSell()));
break;
case "22":
dPriceSell = oProduct.getPriceSellTax(tax)
- / (1.0 + tax.getRate());
+ / (1.0 + tax.getRate());
dUnits = (Double.parseDouble(sVariableNum)
- / 1) / oProduct.getPriceSellTax(tax);
- oProduct.setProperty("product.price"
- , Double.toString(oProduct.getPriceSell()));
+ / 1) / oProduct.getPriceSellTax(tax);
+ oProduct.setProperty("product.price", Double.toString(oProduct.getPriceSell()));
break;
-// WEIGHT - Assign variable to Unit
+ // WEIGHT - Assign variable to Unit
case "23":
weight = Double.parseDouble(sVariableNum)
- / 1000; // 3 decimals = 01.049 kg
- dUnits = weight; // which represents 1gramme Units
- oProduct.setProperty("product.weight"
- , Double.toString(weight));
- oProduct.setProperty("product.price"
- , Double.toString(dPriceSell));
+ / 1000; // 3 decimals = 01.049 kg
+ dUnits = weight; // which represents 1gramme Units
+ oProduct.setProperty("product.weight", Double.toString(weight));
+ oProduct.setProperty("product.price", Double.toString(dPriceSell));
break;
case "24":
weight = Double.parseDouble(sVariableNum)
- / 100; // 2 decimals = 010.49 kg
- dUnits = weight; // which represents 10gramme Units
- oProduct.setProperty("product.weight"
- , Double.toString(weight));
- oProduct.setProperty("product.price"
- , Double.toString(dPriceSell));
+ / 100; // 2 decimals = 010.49 kg
+ dUnits = weight; // which represents 10gramme Units
+ oProduct.setProperty("product.weight", Double.toString(weight));
+ oProduct.setProperty("product.price", Double.toString(dPriceSell));
break;
case "25":
weight = Double.parseDouble(sVariableNum)
- / 10; // 1 decimal = 0104.9 kg
- dUnits = weight; // which represents 100gramme Units
- oProduct.setProperty("product.weight"
- , Double.toString(weight));
- oProduct.setProperty("product.price"
- , Double.toString(dPriceSell));
+ / 10; // 1 decimal = 0104.9 kg
+ dUnits = weight; // which represents 100gramme Units
+ oProduct.setProperty("product.weight", Double.toString(weight));
+ oProduct.setProperty("product.price", Double.toString(dPriceSell));
break;
-/*
- * Some countries use different barcode prefix 26-29 or 250 etc.
- * Use this section to add more case statements but these are not mandatory
- * If you have your own internal or other barcode schema then...
- * Example:
- case "28":
- {
- // price has tax. Remove it from sPriceSell
- TaxInfo tax = taxeslogic.getTaxInfo(oProduct.getTaxCategoryID(), m_oTicket.getCustomer());
- dPriceSell /= (1.0 + tax.getRate());
- oProduct.setProperty("product.price", Double.toString(dPriceSell));
- weight = -1.0;
- break;
-*/
+ /*
+ * Some countries use different barcode prefix 26-29 or 250 etc.
+ * Use this section to add more case statements but these are not mandatory
+ * If you have your own internal or other barcode schema then...
+ * Example:
+ * case "28":
+ * {
+ * // price has tax. Remove it from sPriceSell
+ * TaxInfo tax = taxeslogic.getTaxInfo(oProduct.getTaxCategoryID(),
+ * m_oTicket.getCustomer());
+ * dPriceSell /= (1.0 + tax.getRate());
+ * oProduct.setProperty("product.price", Double.toString(dPriceSell));
+ * weight = -1.0;
+ * break;
+ */
default:
break;
}
if (m_jaddtax.isSelected()) {
- addTicketLine(oProduct
- , dUnits //weight
- , dPriceSell = oProduct.getPriceSellTax(tax));
+ addTicketLine(oProduct, dUnits // weight
+ , dPriceSell = oProduct.getPriceSellTax(tax));
} else {
- addTicketLine(oProduct
- , dUnits
- , dPriceSell);
+ addTicketLine(oProduct, dUnits, dPriceSell);
}
}
} catch (BasicException eData) {
@@ -1269,80 +1252,75 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
new MessageInf(eData).show(this);
}
-// UPC-A
-/* Note: if begins 02 then its a standard
-// UPC-A max value limitation is 4 digit price
-// UPC-A Extended uses State digit to give 5 digit price
-// uniCenta oPOS does not support UPC-A Extended at this time
-// Identifier Prod State Cost CheckCode
-// I PPPPP S CCCC K
-// 1 23456 7 8901 2
-
- * 0 = Standard UPC number (must have a zero to do zero-suppressed numbers)
- * 1 = Reserved
- * 2 = Random-weight items (fruits, vegetables, meats, etc.)
- * 3 = Pharmaceuticals
- * 4 = In-store marketing for retailers (Other stores will not understand)
- * 5 = Coupons
- * 6 = Standard UPC number
- * 7 = Standard UPC number
- * 8 = Reserved
- * 9 = Reserved
-*/
+ // UPC-A
+ /*
+ * Note: if begins 02 then its a standard
+ * // UPC-A max value limitation is 4 digit price
+ * // UPC-A Extended uses State digit to give 5 digit price
+ * // uniCenta oPOS does not support UPC-A Extended at this time
+ * // Identifier Prod State Cost CheckCode
+ * // I PPPPP S CCCC K
+ * // 1 23456 7 8901 2
+ *
+ * 0 = Standard UPC number (must have a zero to do zero-suppressed numbers)
+ * 1 = Reserved
+ * 2 = Random-weight items (fruits, vegetables, meats, etc.)
+ * 3 = Pharmaceuticals
+ * 4 = In-store marketing for retailers (Other stores will not understand)
+ * 5 = Coupons
+ * 6 = Standard UPC number
+ * 7 = Standard UPC number
+ * 8 = Reserved
+ * 9 = Reserved
+ */
} else if ("UPC".equals(sCodetype)
- && (sCode.startsWith("2"))
- && (sCode.length() == 12)) {
+ && (sCode.startsWith("2"))
+ && (sCode.length() == 12)) {
try {
- ProductInfoExt oProduct
- = dlSales.getProductInfoByUShortCode(sCode); // Return only UPC product
+ ProductInfoExt oProduct = dlSales.getProductInfoByUShortCode(sCode); // Return only UPC product
if (oProduct == null) {
Toolkit.getDefaultToolkit().beep();
JOptionPane.showMessageDialog(null,
- sCode + " - "
- + AppLocal.getIntString("message.noproduct"),
- "Check", JOptionPane.WARNING_MESSAGE);
+ sCode + " - "
+ + AppLocal.getIntString("message.noproduct"),
+ "Check", JOptionPane.WARNING_MESSAGE);
stateToZero();
} else if ("Upc-A".equals(oProduct.getCodetype())) {
oProduct.setProperty("product.barcode", sCode);
- double dPriceSell = oProduct.getPriceSell(); // default price for product
- double weight = 0; // used if barcode includes weight of product
- double dUnits = 0; // used for pro-rata unit
- String sVariableNum = sCode.substring(7, 11); // grab the value from the code only using 4 digit price
+ double dPriceSell = oProduct.getPriceSell(); // default price for product
+ double weight = 0; // used if barcode includes weight of product
+ double dUnits = 0; // used for pro-rata unit
+ String sVariableNum = sCode.substring(7, 11); // grab the value from the code only using 4 digit price
- TaxInfo tax = taxeslogic // get the TaxRate for the product
- .getTaxInfo(oProduct.getTaxCategoryID()
- , m_oTicket.getCustomer());
+ TaxInfo tax = taxeslogic // get the TaxRate for the product
+ .getTaxInfo(oProduct.getTaxCategoryID(), m_oTicket.getCustomer());
- if (oProduct.getPriceSell() != 0.0) { // we have a weight barcode
- weight = Double.parseDouble(sVariableNum) / 100; // 2 decimals (e.g. 10.49 kg)
- dUnits = weight; // Units is now transformed to weight
+ if (oProduct.getPriceSell() != 0.0) { // we have a weight barcode
+ weight = Double.parseDouble(sVariableNum) / 100; // 2 decimals (e.g. 10.49 kg)
+ dUnits = weight; // Units is now transformed to weight
- oProduct.setProperty("product.weight" // catch-all for weight
- , Double.toString(weight));
- oProduct.setProperty("product.price" // get the prod sellprice
- , Double.toString(oProduct.getPriceSell()));
- dPriceSell = oProduct.getPriceSellTax(tax); // calculate the tax on sellprice
- dUnits = (Double.parseDouble(sVariableNum) // calculate Units in sellprice with Tax
- / 100)
- / oProduct.getPriceSellTax(tax);
+ oProduct.setProperty("product.weight" // catch-all for weight
+ , Double.toString(weight));
+ oProduct.setProperty("product.price" // get the prod sellprice
+ , Double.toString(oProduct.getPriceSell()));
+ dPriceSell = oProduct.getPriceSellTax(tax); // calculate the tax on sellprice
+ dUnits = (Double.parseDouble(sVariableNum) // calculate Units in sellprice with Tax
+ / 100)
+ / oProduct.getPriceSellTax(tax);
- } else { // no sellprice so we have a price barcode
- dPriceSell = (Double.parseDouble(sVariableNum) // calculate Units in sellprice with Tax
- / 100);
- dUnits = 1; // no sellprice to calculate so must be 1 Unit
+ } else { // no sellprice so we have a price barcode
+ dPriceSell = (Double.parseDouble(sVariableNum) // calculate Units in sellprice with Tax
+ / 100);
+ dUnits = 1; // no sellprice to calculate so must be 1 Unit
}
if (m_jaddtax.isSelected()) {
- addTicketLine(oProduct
- , dUnits
- , dPriceSell);
+ addTicketLine(oProduct, dUnits, dPriceSell);
} else {
- addTicketLine(oProduct
- , dUnits
- , dPriceSell / (1.0 + tax.getRate()));
+ addTicketLine(oProduct, dUnits, dPriceSell / (1.0 + tax.getRate()));
}
}
} catch (BasicException eData) {
@@ -1351,9 +1329,9 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
}
} else {
- incProductByCode(sCode); // returned is standard so go get it
+ incProductByCode(sCode); // returned is standard so go get it
}
-// END OF BARCODE
+ // END OF BARCODE
} else {
Toolkit.getDefaultToolkit().beep();
@@ -1370,9 +1348,9 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
m_jPrice.setText(Character.toString('0'));
} else if ((cTrans == '1' || cTrans == '2' || cTrans == '3'
- || cTrans == '4' || cTrans == '5' || cTrans == '6'
- || cTrans == '7' || cTrans == '8' || cTrans == '9')
- && (m_iNumberStatus == NUMBER_INPUTZERO)) {
+ || cTrans == '4' || cTrans == '5' || cTrans == '6'
+ || cTrans == '7' || cTrans == '8' || cTrans == '9')
+ && (m_iNumberStatus == NUMBER_INPUTZERO)) {
if (!priceWith00) {
m_jPrice.setText(m_jPrice.getText() + cTrans);
@@ -1384,10 +1362,10 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
m_iNumberStatusInput = NUMBERVALID;
} else if ((cTrans == '0' || cTrans == '1' || cTrans == '2'
- || cTrans == '3' || cTrans == '4' || cTrans == '5'
- || cTrans == '6' || cTrans == '7' || cTrans == '8'
- || cTrans == '9')
- && (m_iNumberStatus == NUMBER_INPUTINT)) {
+ || cTrans == '3' || cTrans == '4' || cTrans == '5'
+ || cTrans == '6' || cTrans == '7' || cTrans == '8'
+ || cTrans == '9')
+ && (m_iNumberStatus == NUMBER_INPUTINT)) {
if (!priceWith00) {
m_jPrice.setText(m_jPrice.getText() + cTrans);
@@ -1395,21 +1373,20 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
m_jPrice.setText(setTempjPrice(m_jPrice.getText() + cTrans));
}
-
} else if (cTrans == '.'
- && m_iNumberStatus == NUMBER_INPUTZERO && !priceWith00) {
+ && m_iNumberStatus == NUMBER_INPUTZERO && !priceWith00) {
m_jPrice.setText("0.");
m_iNumberStatus = NUMBER_INPUTZERODEC;
} else if (cTrans == '.'
- && m_iNumberStatus == NUMBER_INPUTZERO) {
+ && m_iNumberStatus == NUMBER_INPUTZERO) {
m_jPrice.setText("");
m_iNumberStatus = NUMBER_INPUTZERO;
} else if (cTrans == '.'
- && m_iNumberStatus == NUMBER_INPUTINT && !priceWith00) {
+ && m_iNumberStatus == NUMBER_INPUTINT && !priceWith00) {
m_jPrice.setText(m_jPrice.getText() + ".");
m_iNumberStatus = NUMBER_INPUTDEC;
} else if (cTrans == '.'
- && m_iNumberStatus == NUMBER_INPUTINT) {
+ && m_iNumberStatus == NUMBER_INPUTINT) {
if (!priceWith00) {
m_jPrice.setText(m_jPrice.getText() + "00");
@@ -1420,7 +1397,7 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
m_iNumberStatus = NUMBER_INPUTINT;
} else if ((cTrans == '0')
- && (m_iNumberStatus == NUMBER_INPUTZERODEC
+ && (m_iNumberStatus == NUMBER_INPUTZERODEC
|| m_iNumberStatus == NUMBER_INPUTDEC)) {
if (!priceWith00) {
@@ -1430,9 +1407,9 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
}
} else if ((cTrans == '1' || cTrans == '2' || cTrans == '3'
- || cTrans == '4' || cTrans == '5' || cTrans == '6'
- || cTrans == '7' || cTrans == '8' || cTrans == '9')
- && (m_iNumberStatus == NUMBER_INPUTZERODEC
+ || cTrans == '4' || cTrans == '5' || cTrans == '6'
+ || cTrans == '7' || cTrans == '8' || cTrans == '9')
+ && (m_iNumberStatus == NUMBER_INPUTZERODEC
|| m_iNumberStatus == NUMBER_INPUTDEC)) {
m_jPrice.setText(m_jPrice.getText() + cTrans);
@@ -1440,71 +1417,71 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
m_iNumberStatusInput = NUMBERVALID;
} else if (cTrans == '*'
- && (m_iNumberStatus == NUMBER_INPUTINT
+ && (m_iNumberStatus == NUMBER_INPUTINT
|| m_iNumberStatus == NUMBER_INPUTDEC)) {
m_jPor.setText("x");
m_iNumberStatus = NUMBER_PORZERO;
} else if (cTrans == '*'
- && (m_iNumberStatus == NUMBER_INPUTZERO
+ && (m_iNumberStatus == NUMBER_INPUTZERO
|| m_iNumberStatus == NUMBER_INPUTZERODEC)) {
m_jPrice.setText("0");
m_jPor.setText("x");
m_iNumberStatus = NUMBER_PORZERO;
} else if ((cTrans == '0')
- && (m_iNumberStatus == NUMBER_PORZERO)) {
+ && (m_iNumberStatus == NUMBER_PORZERO)) {
m_jPor.setText("x0");
} else if ((cTrans == '1' || cTrans == '2' || cTrans == '3'
- || cTrans == '4' || cTrans == '5' || cTrans == '6'
- || cTrans == '7' || cTrans == '8' || cTrans == '9')
- && (m_iNumberStatus == NUMBER_PORZERO)) {
+ || cTrans == '4' || cTrans == '5' || cTrans == '6'
+ || cTrans == '7' || cTrans == '8' || cTrans == '9')
+ && (m_iNumberStatus == NUMBER_PORZERO)) {
m_jPor.setText("x" + Character.toString(cTrans));
m_iNumberStatus = NUMBER_PORINT;
m_iNumberStatusPor = NUMBERVALID;
} else if ((cTrans == '0' || cTrans == '1' || cTrans == '2'
- || cTrans == '3' || cTrans == '4' || cTrans == '5'
- || cTrans == '6' || cTrans == '7' || cTrans == '8'
- || cTrans == '9') && (m_iNumberStatus == NUMBER_PORINT)) {
+ || cTrans == '3' || cTrans == '4' || cTrans == '5'
+ || cTrans == '6' || cTrans == '7' || cTrans == '8'
+ || cTrans == '9') && (m_iNumberStatus == NUMBER_PORINT)) {
m_jPor.setText(m_jPor.getText() + cTrans);
} else if (cTrans == '.'
- && m_iNumberStatus == NUMBER_PORZERO && !priceWith00) {
+ && m_iNumberStatus == NUMBER_PORZERO && !priceWith00) {
m_jPor.setText("x0.");
m_iNumberStatus = NUMBER_PORZERODEC;
} else if (cTrans == '.'
- && m_iNumberStatus == NUMBER_PORZERO) {
+ && m_iNumberStatus == NUMBER_PORZERO) {
m_jPor.setText("x");
m_iNumberStatus = NUMBERVALID;
} else if (cTrans == '.'
- && m_iNumberStatus == NUMBER_PORINT && !priceWith00) {
+ && m_iNumberStatus == NUMBER_PORINT && !priceWith00) {
m_jPor.setText(m_jPor.getText() + ".");
m_iNumberStatus = NUMBER_PORDEC;
} else if (cTrans == '.'
- && m_iNumberStatus == NUMBER_PORINT) {
+ && m_iNumberStatus == NUMBER_PORINT) {
m_jPor.setText(m_jPor.getText() + "00");
m_iNumberStatus = NUMBERVALID;
} else if ((cTrans == '0')
- && (m_iNumberStatus == NUMBER_PORZERODEC
+ && (m_iNumberStatus == NUMBER_PORZERODEC
|| m_iNumberStatus == NUMBER_PORDEC)) {
m_jPor.setText(m_jPor.getText() + cTrans);
} else if ((cTrans == '1' || cTrans == '2' || cTrans == '3'
- || cTrans == '4' || cTrans == '5' || cTrans == '6'
- || cTrans == '7' || cTrans == '8' || cTrans == '9')
- && (m_iNumberStatus == NUMBER_PORZERODEC || m_iNumberStatus == NUMBER_PORDEC)) {
+ || cTrans == '4' || cTrans == '5' || cTrans == '6'
+ || cTrans == '7' || cTrans == '8' || cTrans == '9')
+ && (m_iNumberStatus == NUMBER_PORZERODEC || m_iNumberStatus == NUMBER_PORDEC)) {
m_jPor.setText(m_jPor.getText() + cTrans);
m_iNumberStatus = NUMBER_PORDEC;
m_iNumberStatusPor = NUMBERVALID;
} else if (cTrans == '\u00a7'
- && m_iNumberStatusInput == NUMBERVALID
- && m_iNumberStatusPor == NUMBERZERO) {
+ && m_iNumberStatusInput == NUMBERVALID
+ && m_iNumberStatusPor == NUMBERZERO) {
if (m_App.getDeviceScale().existsScale()
- && m_App.getAppUserView().getUser().hasPermission("sales.EditLines")) {
+ && m_App.getAppUserView().getUser().hasPermission("sales.EditLines")) {
try {
Double value = m_App.getDeviceScale().readWeight();
if (value != null) {
@@ -1521,8 +1498,8 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
Toolkit.getDefaultToolkit().beep();
}
} else if (cTrans == '\u00a7'
- && m_iNumberStatusInput == NUMBERZERO
- && m_iNumberStatusPor == NUMBERZERO) {
+ && m_iNumberStatusInput == NUMBERZERO
+ && m_iNumberStatusPor == NUMBERZERO) {
int i = m_ticketlines.getSelectedIndex();
if (i < 0) {
@@ -1547,18 +1524,18 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
}
} else if (cTrans == '+'
- && m_iNumberStatusInput == NUMBERZERO
- && m_iNumberStatusPor == NUMBERZERO) {
+ && m_iNumberStatusInput == NUMBERZERO
+ && m_iNumberStatusPor == NUMBERZERO) {
int i = m_ticketlines.getSelectedIndex();
if (i < 0) {
Toolkit.getDefaultToolkit().beep();
} else {
TicketLineInfo newline = new TicketLineInfo(m_oTicket.getLine(i));
- //If it's a refund + button means one unit less
+ // If it's a refund + button means one unit less
if (m_oTicket.getTicketType() == TicketInfo.RECEIPT_REFUND) {
if (m_App.getProperties().getProperty("override.check").equals("true")) {
- oCount = count - 1; //increment existing line
+ oCount = count - 1; // increment existing line
pinOK = false;
changeCount(pinOK);
newline.setMultiply(newline.getMultiply() - 1.0);
@@ -1571,7 +1548,7 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
}
} else {
if (m_App.getProperties().getProperty("override.check").equals("true")) {
- oCount = count + 1; //increment existing line
+ oCount = count + 1; // increment existing line
pinOK = false;
if (changeCount(pinOK)) {
newline.setMultiply(newline.getMultiply() + 1.0);
@@ -1586,9 +1563,9 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
}
}
} else if (cTrans == '-'
- && m_iNumberStatusInput == NUMBERZERO
- && m_iNumberStatusPor == NUMBERZERO
- && m_App.getAppUserView().getUser().hasPermission("sales.EditLines")) {
+ && m_iNumberStatusInput == NUMBERZERO
+ && m_iNumberStatusPor == NUMBERZERO
+ && m_App.getAppUserView().getUser().hasPermission("sales.EditLines")) {
int i = m_ticketlines.getSelectedIndex();
if (i < 0) {
@@ -1598,7 +1575,7 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
if (m_oTicket.getTicketType() == TicketInfo.RECEIPT_REFUND) {
if (m_App.getProperties().getProperty("override.check").equals("true")) {
- oCount = count - 1; //increment existing line
+ oCount = count - 1; // increment existing line
pinOK = false;
changeCount(pinOK);
newline.setMultiply(newline.getMultiply() - 1.0);
@@ -1617,7 +1594,7 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
}
} else {
if (m_App.getProperties().getProperty("override.check").equals("true")) {
- oCount = count - 1; //increment existing line
+ oCount = count - 1; // increment existing line
pinOK = false;
if (changeCount(pinOK)) {
newline.setMultiply(newline.getMultiply() - 1.0);
@@ -1639,8 +1616,8 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
}
} else if (cTrans == '+'
- && m_iNumberStatusInput == NUMBERZERO
- && m_iNumberStatusPor == NUMBERVALID) {
+ && m_iNumberStatusInput == NUMBERZERO
+ && m_iNumberStatusPor == NUMBERVALID) {
int i = m_ticketlines.getSelectedIndex();
if (i < 0) {
@@ -1651,7 +1628,7 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
if (m_oTicket.getTicketType() == TicketInfo.RECEIPT_REFUND) {
if (m_App.getProperties().getProperty("override.check").equals("true")) {
- oCount = count - 1; //increment existing line
+ oCount = count - 1; // increment existing line
pinOK = false;
changeCount(pinOK);
newline.setMultiply(-dPor);
@@ -1666,7 +1643,7 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
}
} else {
if (m_App.getProperties().getProperty("override.check").equals("true")) {
- oCount = count + 1; //increment existing line
+ oCount = count + 1; // increment existing line
pinOK = false;
if (changeCount(pinOK)) {
newline.setMultiply(dPor);
@@ -1683,9 +1660,9 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
}
}
} else if (cTrans == '-'
- && m_iNumberStatusInput == NUMBERZERO
- && m_iNumberStatusPor == NUMBERVALID
- && m_App.getAppUserView().getUser().hasPermission("sales.EditLines")) {
+ && m_iNumberStatusInput == NUMBERZERO
+ && m_iNumberStatusPor == NUMBERVALID
+ && m_App.getAppUserView().getUser().hasPermission("sales.EditLines")) {
int i = m_ticketlines.getSelectedIndex();
if (i < 0) {
@@ -1696,7 +1673,7 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
if (m_oTicket.getTicketType() == TicketInfo.RECEIPT_REFUND) {
if (m_App.getProperties().getProperty("override.check").equals("true")) {
- oCount = count - 1; //increment existing line
+ oCount = count - 1; // increment existing line
pinOK = false;
changeCount(pinOK);
newline.setMultiply(-dPor);
@@ -1711,7 +1688,7 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
}
} else {
if (m_App.getProperties().getProperty("override.check").equals("true")) {
- oCount = count - 1; //increment existing line
+ oCount = count - 1; // increment existing line
pinOK = false;
if (changeCount(pinOK)) {
newline.setMultiply(dPor);
@@ -1728,32 +1705,32 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
}
}
} else if (cTrans == '+'
- && m_iNumberStatusInput == NUMBERVALID
- && m_iNumberStatusPor == NUMBERZERO
- && m_App.getAppUserView().getUser().hasPermission("sales.EditLines")) {
+ && m_iNumberStatusInput == NUMBERVALID
+ && m_iNumberStatusPor == NUMBERZERO
+ && m_App.getAppUserView().getUser().hasPermission("sales.EditLines")) {
ProductInfoExt product = getInputProduct();
addTicketLine(product, 1.0, product.getPriceSell());
m_jEditLine.doClick();
} else if (cTrans == '-'
- && m_iNumberStatusInput == NUMBERVALID
- && m_iNumberStatusPor == NUMBERZERO
- && m_App.getAppUserView().getUser().hasPermission("sales.EditLines")) {
+ && m_iNumberStatusInput == NUMBERVALID
+ && m_iNumberStatusPor == NUMBERZERO
+ && m_App.getAppUserView().getUser().hasPermission("sales.EditLines")) {
ProductInfoExt product = getInputProduct();
addTicketLine(product, 1.0, -product.getPriceSell());
m_jEditLine.doClick();
} else if (cTrans == '+'
- && m_iNumberStatusInput == NUMBERVALID
- && m_iNumberStatusPor == NUMBERVALID
- && m_App.getAppUserView().getUser().hasPermission("sales.EditLines")) {
+ && m_iNumberStatusInput == NUMBERVALID
+ && m_iNumberStatusPor == NUMBERVALID
+ && m_App.getAppUserView().getUser().hasPermission("sales.EditLines")) {
ProductInfoExt product = getInputProduct();
addTicketLine(product, getPorValue(), product.getPriceSell());
} else if (cTrans == '-'
- && m_iNumberStatusInput == NUMBERVALID
- && m_iNumberStatusPor == NUMBERVALID
- && m_App.getAppUserView().getUser().hasPermission("sales.EditLines")) {
+ && m_iNumberStatusInput == NUMBERVALID
+ && m_iNumberStatusPor == NUMBERVALID
+ && m_App.getAppUserView().getUser().hasPermission("sales.EditLines")) {
ProductInfoExt product = getInputProduct();
addTicketLine(product, getPorValue(), -product.getPriceSell());
@@ -1765,8 +1742,8 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
if (autoLogoff != null) {
if (autoLogoff.equals("true")) {
if ("restaurant".equals(
- m_App.getProperties().getProperty("machine.ticketsbag"))
- && ("true".equals(m_App.getProperties().getProperty("till.autoLogoffrestaurant")))) {
+ m_App.getProperties().getProperty("machine.ticketsbag"))
+ && ("true".equals(m_App.getProperties().getProperty("till.autoLogoffrestaurant")))) {
deactivate();
setActiveTicket(null, null);
} else {
@@ -1785,9 +1762,8 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
}
}
-
private Window getActiveWindow() {
- for (Window window: getWindows()) {
+ for (Window window : getWindows()) {
if (window instanceof JRootFrame) {
return window;
}
@@ -1824,8 +1800,8 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
log.debug("Show Payment Dialog");
JPaymentSelect paymentdialog = ticket.getTicketType() == TicketInfo.RECEIPT_NORMAL
- ? paymentdialogreceipt
- : paymentdialogrefund;
+ ? paymentdialogreceipt
+ : paymentdialogrefund;
paymentdialog.setPrintSelected("true".equals(m_jbtnconfig.getProperty("printselected", "true")));
paymentdialog.setTransactionID(ticket.getTransactionID());
@@ -1849,31 +1825,35 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
m_config.setLastTicket(lastTicketNumber, lastTicketType);
} catch (BasicException eData) {
- MessageInf msg = new MessageInf(MessageInf.SGN_NOTICE, AppLocal.getIntString("message.nosaveticket"), eData);
+ MessageInf msg = new MessageInf(MessageInf.SGN_NOTICE, AppLocal.getIntString("message.nosaveticket"),
+ eData);
msg.show(this);
} catch (IOException ex) {
log.error(ex.getMessage());
}
- if (m_config.getProperty("till.digital-receipt") != null && m_config.getProperty("till.digital-receipt").equals("true")){
+ if (m_config.getProperty("till.digital-receipt") != null
+ && m_config.getProperty("till.digital-receipt").equals("true")) {
log.debug("Send digital receipt");
String xml = dlSystem.getResourceAsXML("Printer.Ticket");
new Application().sendReceipt(ticket, xml, getActiveWindow());
}
+ log.info(new Gson().toJson(ticket));
executeEvent(ticket, ticketext, "ticket.close",
- new ScriptArg("print", paymentdialog.isPrintSelected()));
+ new ScriptArg("print", paymentdialog.isPrintSelected()));
printTicket(paymentdialog.isPrintSelected() || warrantyPrint
- ? "Printer.Ticket"
- : "Printer.Ticket2", ticket, ticketext);
+ ? "Printer.Ticket"
+ : "Printer.Ticket2", ticket, ticketext);
Notify(AppLocal.getIntString("notify.printing"));
resultok = true;
if ("restaurant".equals(m_App.getProperties()
- .getProperty("machine.ticketsbag")) && !ticket.getOldTicket()) {
- /* Deliberately Explicit to allow for reassignments - future
+ .getProperty("machine.ticketsbag")) && !ticket.getOldTicket()) {
+ /*
+ * Deliberately Explicit to allow for reassignments - future
* even though we could do a single SQL statment sweep for reset
*/
restDB.clearCustomerNameInTable(ticketext.toString());
@@ -1885,7 +1865,7 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
}
} catch (TaxesException e) {
MessageInf msg = new MessageInf(MessageInf.SGN_WARNING,
- AppLocal.getIntString("message.cannotcalculatetaxes"));
+ AppLocal.getIntString("message.cannotcalculatetaxes"));
msg.show(this);
resultok = false;
}
@@ -1932,7 +1912,6 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
return (tmpPickupId);
}
-
private void printTicket(String sresourcename, TicketInfo ticket, Object ticketext) {
String sresource = dlSystem.getResourceAsXML(sresourcename);
@@ -1974,14 +1953,14 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
}
public void printTicket(String resource) {
-// this method is intended to be called only from JPanelButtons.
+ // this method is intended to be called only from JPanelButtons.
if (resource == null) {
MessageInf msg = new MessageInf(MessageInf.SGN_WARNING, AppLocal.getIntString("message.cannotexecute"));
msg.show(this);
} else {
-// JG 5 Jul 17 calculate taxes disabled as causing incorrect tax recalc
-// taxeslogic.calculateTaxes(m_oTicket);
+ // JG 5 Jul 17 calculate taxes disabled as causing incorrect tax recalc
+ // taxeslogic.calculateTaxes(m_oTicket);
printTicket(resource, m_oTicket, m_oTicketExt);
}
@@ -2032,7 +2011,6 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
}
}
-
Map reportparams = new HashMap();
try {
@@ -2045,7 +2023,8 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
reportfields.put("TICKET", ticket);
reportfields.put("PLACE", ticketext);
- JasperPrint jp = JasperFillManager.fillReport(jr, reportparams, new JRMapArrayDataSource(new Object[]{reportfields}));
+ JasperPrint jp = JasperFillManager.fillReport(jr, reportparams,
+ new JRMapArrayDataSource(new Object[] { reportfields }));
PrintService service = ReportUtils.getPrintService(m_App.getProperties().getProperty("machine.printername"));
@@ -2124,7 +2103,6 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
}
}
-
private Object executeEvent(TicketInfo ticket, Object ticketext, String eventkey, ScriptArg... args) {
String resource = m_jbtnconfig.getEvent(eventkey);
@@ -2194,7 +2172,7 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
private String setTempjPrice(String jPrice) {
jPrice = jPrice.replace(".", "");
-// remove all leading zeros from the string
+ // remove all leading zeros from the string
long tempL = Long.parseLong(jPrice);
jPrice = Long.toString(tempL);
@@ -2260,15 +2238,14 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
}
content = "" +
- "" + AppLocal.getIntString("label.vip") + " : " + "" + vip + "
" +
- "" + AppLocal.getIntString("label.discount") + " : " + "" + discount + "
";
-
+ "" + AppLocal.getIntString("label.vip") + " : " + "" + vip + "
" +
+ "" + AppLocal.getIntString("label.discount") + " : " + "" + discount + "
";
JFrame frame = new JFrame();
JOptionPane.showMessageDialog(frame,
- content,
- "Info",
- JOptionPane.WARNING_MESSAGE);
+ content,
+ "Info",
+ JOptionPane.WARNING_MESSAGE);
}
}
@@ -2367,14 +2344,14 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
}
}
-
/**
* This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the FormEditor.
*/
- // //GEN-BEGIN:initComponents
+ // //GEN-BEGIN:initComponents
private void initComponents() {
m_jPanContainer = new javax.swing.JPanel();
@@ -2401,7 +2378,8 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
jCheckStock = new javax.swing.JButton();
m_jPanelCentral = new javax.swing.JPanel();
jPanel4 = new javax.swing.JPanel();
- filler2 = new javax.swing.Box.Filler(new java.awt.Dimension(5, 0), new java.awt.Dimension(5, 0), new java.awt.Dimension(5, 32767));
+ filler2 = new javax.swing.Box.Filler(new java.awt.Dimension(5, 0), new java.awt.Dimension(5, 0),
+ new java.awt.Dimension(5, 32767));
m_jTicketId = new javax.swing.JLabel();
m_jPanTotals = new javax.swing.JPanel();
m_jLblTotalEuros3 = new javax.swing.JLabel();
@@ -2543,29 +2521,35 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
javax.swing.GroupLayout m_jButtonsLayout = new javax.swing.GroupLayout(m_jButtons);
m_jButtons.setLayout(m_jButtonsLayout);
m_jButtonsLayout.setHorizontalGroup(
- m_jButtonsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(m_jButtonsLayout.createSequentialGroup()
- .addContainerGap()
- .addComponent(jBtnCustomer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(btnSplit, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(j_btnRemotePrt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(btnReprint1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
- );
+ m_jButtonsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(m_jButtonsLayout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(jBtnCustomer, javax.swing.GroupLayout.PREFERRED_SIZE,
+ javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(btnSplit, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
+ javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(j_btnRemotePrt, javax.swing.GroupLayout.PREFERRED_SIZE,
+ javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(btnReprint1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
+ javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
m_jButtonsLayout.setVerticalGroup(
- m_jButtonsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(m_jButtonsLayout.createSequentialGroup()
- .addGap(5, 5, 5)
- .addGroup(m_jButtonsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
- .addComponent(j_btnRemotePrt, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(btnSplit, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(btnReprint1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(jBtnCustomer, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
- .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
- );
+ m_jButtonsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(m_jButtonsLayout.createSequentialGroup()
+ .addGap(5, 5, 5)
+ .addGroup(m_jButtonsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
+ .addComponent(j_btnRemotePrt, javax.swing.GroupLayout.DEFAULT_SIZE,
+ javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(btnSplit, javax.swing.GroupLayout.Alignment.TRAILING,
+ javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(btnReprint1, javax.swing.GroupLayout.Alignment.TRAILING,
+ javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(jBtnCustomer, javax.swing.GroupLayout.DEFAULT_SIZE,
+ javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
m_jPanelBag.add(m_jButtons);
@@ -2808,7 +2792,9 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
m_jPrice.setFont(new java.awt.Font("Arial", 1, 16)); // NOI18N
m_jPrice.setForeground(new java.awt.Color(76, 197, 237));
m_jPrice.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
- m_jPrice.setBorder(javax.swing.BorderFactory.createCompoundBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(76, 197, 237)), javax.swing.BorderFactory.createEmptyBorder(1, 4, 1, 4)));
+ m_jPrice.setBorder(javax.swing.BorderFactory.createCompoundBorder(
+ javax.swing.BorderFactory.createLineBorder(new java.awt.Color(76, 197, 237)),
+ javax.swing.BorderFactory.createEmptyBorder(1, 4, 1, 4)));
m_jPrice.setOpaque(true);
m_jPrice.setPreferredSize(new java.awt.Dimension(100, 25));
m_jPrice.setRequestFocusEnabled(false);
@@ -2854,40 +2840,50 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
jPanel9.setLayout(jPanel9Layout);
jPanel9Layout.setHorizontalGroup(
- jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel9Layout.createSequentialGroup()
+ .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
+ .addComponent(m_jPor)
+ .addComponent(m_jKeyFactory, javax.swing.GroupLayout.DEFAULT_SIZE,
+ javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 7, Short.MAX_VALUE)
+ .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel9Layout.createSequentialGroup()
- .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
- .addComponent(m_jPor)
- .addComponent(m_jKeyFactory, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 7, Short.MAX_VALUE)
- .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(jPanel9Layout.createSequentialGroup()
- .addComponent(m_jaddtax, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addGap(7, 7, 7)
- .addComponent(m_jTax, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))
- .addGroup(jPanel9Layout.createSequentialGroup()
- .addComponent(m_jPrice, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addGap(5, 5, 5)))
- .addComponent(m_jEnter, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addContainerGap())
- );
+ .addComponent(m_jaddtax, javax.swing.GroupLayout.DEFAULT_SIZE,
+ javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addGap(7, 7, 7)
+ .addComponent(m_jTax, javax.swing.GroupLayout.PREFERRED_SIZE, 128,
+ javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))
+ .addGroup(jPanel9Layout.createSequentialGroup()
+ .addComponent(m_jPrice, javax.swing.GroupLayout.DEFAULT_SIZE,
+ javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addGap(5, 5, 5)))
+ .addComponent(m_jEnter, javax.swing.GroupLayout.PREFERRED_SIZE, 71,
+ javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap()));
jPanel9Layout.setVerticalGroup(
- jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(jPanel9Layout.createSequentialGroup()
- .addComponent(m_jEnter, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGap(0, 0, Short.MAX_VALUE))
- .addGroup(jPanel9Layout.createSequentialGroup()
- .addComponent(m_jPrice, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 7, Short.MAX_VALUE)
- .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(m_jTax, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(m_jaddtax, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel9Layout.createSequentialGroup()
- .addComponent(m_jPor)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(m_jKeyFactory, javax.swing.GroupLayout.PREFERRED_SIZE, 1, javax.swing.GroupLayout.PREFERRED_SIZE))
- );
+ jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel9Layout.createSequentialGroup()
+ .addComponent(m_jEnter, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
+ javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(0, 0, Short.MAX_VALUE))
+ .addGroup(jPanel9Layout.createSequentialGroup()
+ .addComponent(m_jPrice, javax.swing.GroupLayout.PREFERRED_SIZE, 44,
+ javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 7, Short.MAX_VALUE)
+ .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(m_jTax, javax.swing.GroupLayout.Alignment.TRAILING,
+ javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(m_jaddtax, javax.swing.GroupLayout.Alignment.TRAILING,
+ javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
+ javax.swing.GroupLayout.PREFERRED_SIZE)))
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel9Layout.createSequentialGroup()
+ .addComponent(m_jPor)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
+ javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(m_jKeyFactory, javax.swing.GroupLayout.PREFERRED_SIZE, 1,
+ javax.swing.GroupLayout.PREFERRED_SIZE)));
m_jPanEntries.add(jPanel9);
@@ -2906,15 +2902,15 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
add(m_jPanContainer, "ticket");
}// //GEN-END:initComponents
- private void m_jbtnScaleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jbtnScaleActionPerformed
+ private void m_jbtnScaleActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_m_jbtnScaleActionPerformed
stateTransition('\u00a7');
- }//GEN-LAST:event_m_jbtnScaleActionPerformed
+ }// GEN-LAST:event_m_jbtnScaleActionPerformed
- private void m_jEditLineActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jEditLineActionPerformed
+ private void m_jEditLineActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_m_jEditLineActionPerformed
- count = (int) m_oTicket.getArticlesCount(); // get existing line value
+ count = (int) m_oTicket.getArticlesCount(); // get existing line value
int i = m_ticketlines.getSelectedIndex();
@@ -2932,32 +2928,32 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
}
}
- }//GEN-LAST:event_m_jEditLineActionPerformed
+ }// GEN-LAST:event_m_jEditLineActionPerformed
- private void m_jEnterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jEnterActionPerformed
+ private void m_jEnterActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_m_jEnterActionPerformed
stateTransition('\n');
- }//GEN-LAST:event_m_jEnterActionPerformed
+ }// GEN-LAST:event_m_jEnterActionPerformed
- private void m_jNumberKeysKeyPerformed(com.unicenta.beans.JNumberEvent evt) {//GEN-FIRST:event_m_jNumberKeysKeyPerformed
+ private void m_jNumberKeysKeyPerformed(com.unicenta.beans.JNumberEvent evt) {// GEN-FIRST:event_m_jNumberKeysKeyPerformed
stateTransition(evt.getKey());
j_btnRemotePrt.setEnabled(true);
j_btnRemotePrt.revalidate();
- }//GEN-LAST:event_m_jNumberKeysKeyPerformed
+ }// GEN-LAST:event_m_jNumberKeysKeyPerformed
- private void m_jKeyFactoryKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_m_jKeyFactoryKeyTyped
+ private void m_jKeyFactoryKeyTyped(java.awt.event.KeyEvent evt) {// GEN-FIRST:event_m_jKeyFactoryKeyTyped
m_jKeyFactory.setText(null);
stateTransition(evt.getKeyChar());
- }//GEN-LAST:event_m_jKeyFactoryKeyTyped
+ }// GEN-LAST:event_m_jKeyFactoryKeyTyped
- private void m_jDeleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jDeleteActionPerformed
+ private void m_jDeleteActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_m_jDeleteActionPerformed
int i = m_ticketlines.getSelectedIndex();
if (m_App.getProperties().getProperty("override.check").equals("true")) {
pinOK = false;
@@ -2977,18 +2973,18 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
jCheckStock.setText("");
}
}
- }//GEN-LAST:event_m_jDeleteActionPerformed
+ }// GEN-LAST:event_m_jDeleteActionPerformed
- private void m_jListActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jListActionPerformed
+ private void m_jListActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_m_jListActionPerformed
ProductInfoExt prod = JProductFinder.showMessage(JPanelTicket.this, dlSales);
if (prod != null) {
buttonTransition(prod);
}
- }//GEN-LAST:event_m_jListActionPerformed
+ }// GEN-LAST:event_m_jListActionPerformed
- private void jEditAttributesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jEditAttributesActionPerformed
+ private void jEditAttributesActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_jEditAttributesActionPerformed
if (listener != null) {
listener.stop();
}
@@ -3008,19 +3004,19 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
}
} catch (BasicException ex) {
JOptionPane.showMessageDialog(this,
- AppLocal.getIntString("message.cannotfindattributes"),
- AppLocal.getIntString("message.title"),
- JOptionPane.INFORMATION_MESSAGE);
+ AppLocal.getIntString("message.cannotfindattributes"),
+ AppLocal.getIntString("message.title"),
+ JOptionPane.INFORMATION_MESSAGE);
}
}
if (listener != null) {
listener.restart();
}
- }//GEN-LAST:event_jEditAttributesActionPerformed
+ }// GEN-LAST:event_jEditAttributesActionPerformed
- private void jbtnMooringActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnMooringActionPerformed
-// Display vessel selection box on screen if reply is good add to the ticket
+ private void jbtnMooringActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_jbtnMooringActionPerformed
+ // Display vessel selection box on screen if reply is good add to the ticket
if (listener != null) {
listener.stop();
}
@@ -3048,9 +3044,9 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
}
}
refreshTicket();
- }//GEN-LAST:event_jbtnMooringActionPerformed
+ }// GEN-LAST:event_jbtnMooringActionPerformed
- private void j_btnRemotePrtActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_j_btnRemotePrtActionPerformed
+ private void j_btnRemotePrtActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_j_btnRemotePrtActionPerformed
String rScript = (dlSystem.getResourceAsText("script.SendOrder"));
@@ -3071,20 +3067,20 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
remoteOrderDisplay();
- }//GEN-LAST:event_j_btnRemotePrtActionPerformed
+ }// GEN-LAST:event_j_btnRemotePrtActionPerformed
- private void btnReprint1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnReprint1ActionPerformed
+ private void btnReprint1ActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnReprint1ActionPerformed
if (m_config.getProperty("lastticket.number") != null) {
try {
TicketInfo ticket = dlSales.loadTicket(
- Integer.parseInt((m_config.getProperty("lastticket.type"))),
- Integer.parseInt((m_config.getProperty("lastticket.number"))));
+ Integer.parseInt((m_config.getProperty("lastticket.type"))),
+ Integer.parseInt((m_config.getProperty("lastticket.number"))));
if (ticket == null) {
JFrame frame = new JFrame();
JOptionPane.showMessageDialog(frame,
- AppLocal.getIntString("message.notexiststicket"),
- AppLocal.getIntString("message.notexiststickettitle"),
- JOptionPane.WARNING_MESSAGE);
+ AppLocal.getIntString("message.notexiststicket"),
+ AppLocal.getIntString("message.notexiststickettitle"),
+ JOptionPane.WARNING_MESSAGE);
} else {
m_ticket = ticket;
m_ticketCopy = null;
@@ -3101,28 +3097,28 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
msg.show(this);
}
}
- }//GEN-LAST:event_btnReprint1ActionPerformed
+ }// GEN-LAST:event_btnReprint1ActionPerformed
- private void btnSplitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSplitActionPerformed
+ private void btnSplitActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnSplitActionPerformed
if (m_oTicket.getLinesCount() > 0) {
ReceiptSplit splitdialog = ReceiptSplit.getDialog(this,
- dlSystem.getResourceAsXML("Ticket.Line"), dlSales, dlCustomers, taxeslogic);
+ dlSystem.getResourceAsXML("Ticket.Line"), dlSales, dlCustomers, taxeslogic);
TicketInfo ticket1 = m_oTicket.copyTicket();
TicketInfo ticket2 = new TicketInfo();
ticket2.setCustomer(m_oTicket.getCustomer());
if (splitdialog.showDialog(ticket1, ticket2, m_oTicketExt)) {
- if (closeTicket(ticket2, m_oTicketExt)) { // already checked that number of lines > 0
+ if (closeTicket(ticket2, m_oTicketExt)) { // already checked that number of lines > 0
setActiveTicket(ticket1, m_oTicketExt);// set result ticket
}
}
}
- }//GEN-LAST:event_btnSplitActionPerformed
+ }// GEN-LAST:event_btnSplitActionPerformed
- private void jCheckStockActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckStockActionPerformed
+ private void jCheckStockActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_jCheckStockActionPerformed
if (listener != null) {
listener.stop();
@@ -3153,9 +3149,9 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
content = AppLocal.getIntString("message.location.current");
JFrame frame = new JFrame();
JOptionPane.showMessageDialog(frame,
- content,
- "Info",
- JOptionPane.INFORMATION_MESSAGE);
+ content,
+ "Info",
+ JOptionPane.INFORMATION_MESSAGE);
} else {
double dUnits = checkProduct.getUnits();
int iUnits;
@@ -3175,9 +3171,9 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
if (listener != null) {
listener.restart();
}
- }//GEN-LAST:event_jCheckStockActionPerformed
+ }// GEN-LAST:event_jCheckStockActionPerformed
- private void jCheckStockMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jCheckStockMouseClicked
+ private void jCheckStockMouseClicked(java.awt.event.MouseEvent evt) {// GEN-FIRST:event_jCheckStockMouseClicked
if (evt.getClickCount() == 2) {
if (listener != null) {
listener.stop();
@@ -3204,9 +3200,9 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
content = AppLocal.getIntString("message.location.current");
JFrame frame = new JFrame();
JOptionPane.showMessageDialog(frame,
- content,
- "Info",
- JOptionPane.INFORMATION_MESSAGE);
+ content,
+ "Info",
+ JOptionPane.INFORMATION_MESSAGE);
} else {
if (checkProduct.getMinimum() != null) {
pMin = checkProduct.getMinimum();
@@ -3230,20 +3226,20 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
}
content = "" +
- "" + AppLocal.getIntString("label.currentstock") +
- " : " + "" + checkProduct.getUnits() + "
" +
- "" + AppLocal.getIntString("label.maximum") +
- " : " + "" + pMax + "
" +
- "" + AppLocal.getIntString("label.minimum") +
- " : " + "" + pMin + "
" +
- "" + AppLocal.getIntString("label.proddate") +
- " : " + "" + pMemoDate + "
";
+ "" + AppLocal.getIntString("label.currentstock") +
+ " : " + "" + checkProduct.getUnits() + "
" +
+ "" + AppLocal.getIntString("label.maximum") +
+ " : " + "" + pMax + "
" +
+ "" + AppLocal.getIntString("label.minimum") +
+ " : " + "" + pMin + "
" +
+ "" + AppLocal.getIntString("label.proddate") +
+ " : " + "" + pMemoDate + "
";
JFrame frame = new JFrame();
JOptionPane.showMessageDialog(frame,
- content,
- "Info",
- JOptionPane.INFORMATION_MESSAGE);
+ content,
+ "Info",
+ JOptionPane.INFORMATION_MESSAGE);
}
} catch (BasicException ex) {
log.error(ex.getMessage());
@@ -3254,13 +3250,13 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
listener.restart();
}
}
- }//GEN-LAST:event_jCheckStockMouseClicked
+ }// GEN-LAST:event_jCheckStockMouseClicked
- private void m_jaddtaxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jaddtaxActionPerformed
+ private void m_jaddtaxActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_m_jaddtaxActionPerformed
m_jKeyFactory.requestFocus();
- }//GEN-LAST:event_m_jaddtaxActionPerformed
+ }// GEN-LAST:event_m_jaddtaxActionPerformed
- private void jTBtnShowActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTBtnShowActionPerformed
+ private void jTBtnShowActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_jTBtnShowActionPerformed
if (jTBtnShow.isSelected()) {
m_jPanelScripts.setVisible(true);
m_jButtonsExt.setVisible(true);
@@ -3270,26 +3266,26 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
}
refreshTicket();
m_jKeyFactory.requestFocus();
- }//GEN-LAST:event_jTBtnShowActionPerformed
+ }// GEN-LAST:event_jTBtnShowActionPerformed
- private void jBtnCustomerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnCustomerActionPerformed
+ private void jBtnCustomerActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_jBtnCustomerActionPerformed
if (listener != null) {
listener.stop();
}
Object[] options = {
- AppLocal.getIntString("label.create"),
- AppLocal.getIntString("label.find"),
- AppLocal.getIntString("label.cancel")
+ AppLocal.getIntString("label.create"),
+ AppLocal.getIntString("label.find"),
+ AppLocal.getIntString("label.cancel")
};
int n = JOptionPane.showOptionDialog(null,
- AppLocal.getIntString("message.customeradd"),
- AppLocal.getIntString("label.customer"),
- JOptionPane.YES_NO_CANCEL_OPTION,
- JOptionPane.QUESTION_MESSAGE,
- null,
- options,
- options[2]);
+ AppLocal.getIntString("message.customeradd"),
+ AppLocal.getIntString("label.customer"),
+ JOptionPane.YES_NO_CANCEL_OPTION,
+ JOptionPane.QUESTION_MESSAGE,
+ null,
+ options,
+ options[2]);
if (n == 0) {
JDialogNewCustomer dialog = JDialogNewCustomer.getDialog(this, m_App);
@@ -3298,8 +3294,7 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
CustomerInfoExt m_customerInfo = dialog.getSelectedCustomer();
if (dialog.getSelectedCustomer() != null) {
try {
- m_oTicket.setCustomer(dlSales.loadCustomerExt
- (dialog.getSelectedCustomer().getId()));
+ m_oTicket.setCustomer(dlSales.loadCustomerExt(dialog.getSelectedCustomer().getId()));
} catch (BasicException ex) {
log.error(ex.getMessage());
}
@@ -3317,11 +3312,10 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
if (finder.getSelectedCustomer() != null) {
try {
- m_oTicket.setCustomer(dlSales.loadCustomerExt
- (finder.getSelectedCustomer().getId()));
+ m_oTicket.setCustomer(dlSales.loadCustomerExt(finder.getSelectedCustomer().getId()));
if ("restaurant".equals(m_App.getProperties().getProperty("machine.ticketsbag"))) {
- restDB.setCustomerNameInTableByTicketId(dlSales.loadCustomerExt
- (finder.getSelectedCustomer().getId()).toString(), m_oTicket.getId());
+ restDB.setCustomerNameInTableByTicketId(
+ dlSales.loadCustomerExt(finder.getSelectedCustomer().getId()).toString(), m_oTicket.getId());
}
checkCustomer();
@@ -3330,7 +3324,7 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
} catch (BasicException e) {
MessageInf msg = new MessageInf(MessageInf.SGN_WARNING,
- AppLocal.getIntString("message.cannotfindcustomer"), e);
+ AppLocal.getIntString("message.cannotfindcustomer"), e);
msg.show(this);
}
} else {
@@ -3341,9 +3335,9 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
} else {
if (JOptionPane.showConfirmDialog(this,
- AppLocal.getIntString("message.customerchange"),
- AppLocal.getIntString("title.editor"),
- JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
+ AppLocal.getIntString("message.customerchange"),
+ AppLocal.getIntString("title.editor"),
+ JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
finder.setAppView(m_App);
finder.search(m_oTicket.getCustomer());
@@ -3352,11 +3346,10 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
if (finder.getSelectedCustomer() != null) {
try {
- m_oTicket.setCustomer(dlSales.loadCustomerExt
- (finder.getSelectedCustomer().getId()));
+ m_oTicket.setCustomer(dlSales.loadCustomerExt(finder.getSelectedCustomer().getId()));
if ("restaurant".equals(m_App.getProperties().getProperty("machine.ticketsbag"))) {
- restDB.setCustomerNameInTableByTicketId(dlSales.loadCustomerExt
- (finder.getSelectedCustomer().getId()).toString(), m_oTicket.getId());
+ restDB.setCustomerNameInTableByTicketId(
+ dlSales.loadCustomerExt(finder.getSelectedCustomer().getId()).toString(), m_oTicket.getId());
}
checkCustomer();
@@ -3365,7 +3358,7 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
} catch (BasicException e) {
MessageInf msg = new MessageInf(MessageInf.SGN_WARNING,
- AppLocal.getIntString("message.cannotfindcustomer"), e);
+ AppLocal.getIntString("message.cannotfindcustomer"), e);
msg.show(this);
}
} else {
@@ -3378,11 +3371,11 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
refreshTicket();
- }//GEN-LAST:event_jBtnCustomerActionPerformed
+ }// GEN-LAST:event_jBtnCustomerActionPerformed
- private void m_jPanContainerFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_m_jPanContainerFocusLost
+ private void m_jPanContainerFocusLost(java.awt.event.FocusEvent evt) {// GEN-FIRST:event_m_jPanContainerFocusLost
jPanContainerFocusLost(evt);
- }//GEN-LAST:event_m_jPanContainerFocusLost
+ }// GEN-LAST:event_m_jPanContainerFocusLost
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnReprint1;
@@ -3432,10 +3425,11 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
private javax.swing.JButton m_jbtnScale;
// End of variables declaration//GEN-END:variables
-/* Remote Orders Display
- We only know about uniCenta oPOS orders and won't try and handle any
- that are injected from an external source
-*/
+ /*
+ * Remote Orders Display
+ * We only know about uniCenta oPOS orders and won't try and handle any
+ * that are injected from an external source
+ */
public void remoteOrderDisplay() {
remoteOrderDisplay(remoteOrderId(), 1, true);
@@ -3485,37 +3479,31 @@ public abstract class JPanelTicket extends JPanel implements JPanelView, BeanFac
try {
if (primary) {
if ((m_oTicket.getLine(i).getProperty("display") == null)
- || ("".equals(m_oTicket.getLine(i).getProperty("display")))) {
+ || ("".equals(m_oTicket.getLine(i).getProperty("display")))) {
display = 1;
} else {
display = Integer.parseInt(m_oTicket.getLine(i).getProperty("display"));
}
}
- dlSystem.addOrder(getPickupString(m_oTicket)
- , (int) m_oTicket.getLine(i).getMultiply()
- , m_oTicket.getLine(i).getProductName()
- , m_oTicket.getLine(i).getProductAttSetInstDesc()
- , m_oTicket.getLine(i).getProperty("notes")
- , id
- , null
- , display
- , null
- , null);
+ dlSystem.addOrder(getPickupString(m_oTicket), (int) m_oTicket.getLine(i).getMultiply(),
+ m_oTicket.getLine(i).getProductName(), m_oTicket.getLine(i).getProductAttSetInstDesc(),
+ m_oTicket.getLine(i).getProperty("notes"), id, null, display, null, null);
-/* this block for future - right now we're deleting all ticketlines
- and resending for consistency with actual ticketlines
- dlSystem.updateOrder(getPickupString(m_oTicket)
- , (int) m_oTicket.getLine(i).getMultiply()
- , m_oTicket.getLine(i).getProductName()
- , m_oTicket.getLine(i).getProductAttSetInstDesc()
- , m_oTicket.getLine(i).getProperty("notes")
- , id
- , null
- , display
- , null
- , null);
-*/
+ /*
+ * this block for future - right now we're deleting all ticketlines
+ * and resending for consistency with actual ticketlines
+ * dlSystem.updateOrder(getPickupString(m_oTicket)
+ * , (int) m_oTicket.getLine(i).getMultiply()
+ * , m_oTicket.getLine(i).getProductName()
+ * , m_oTicket.getLine(i).getProductAttSetInstDesc()
+ * , m_oTicket.getLine(i).getProperty("notes")
+ * , id
+ * , null
+ * , display
+ * , null
+ * , null);
+ */
} catch (BasicException ex) {
log.error(ex.getMessage());
diff --git a/src/main/java/com/unicenta/pos/ticket/TicketInfo.java b/src/main/java/com/unicenta/pos/ticket/TicketInfo.java
index 1c98c86..6fc8c6d 100644
--- a/src/main/java/com/unicenta/pos/ticket/TicketInfo.java
+++ b/src/main/java/com/unicenta/pos/ticket/TicketInfo.java
@@ -41,743 +41,739 @@ import java.util.*;
*/
public final class TicketInfo implements SerializableRead, Externalizable {
- private static final long serialVersionUID = 2765650092387265178L;
+ private static final long serialVersionUID = 2765650092387265178L;
- public static final int RECEIPT_NORMAL = 0;
- public static final int RECEIPT_REFUND = 1;
- public static final int RECEIPT_PAYMENT = 2;
- public static final int RECEIPT_NOSALE = 3;
-
-// JG Jun 2017 - contain partial/full refunds
- public static final int REFUND_NOT = 0; // is a non-refunded ticket
- public static final int REFUND_PARTIAL = 1;
- public static final int REFUND_ALL = 2;
-
- private static final DateFormat m_dateformat = new SimpleDateFormat("hh:mm");
+ public static final int RECEIPT_NORMAL = 0;
+ public static final int RECEIPT_REFUND = 1;
+ public static final int RECEIPT_PAYMENT = 2;
+ public static final int RECEIPT_NOSALE = 3;
- private String m_sHost;
- private String m_sId;
- private int tickettype;
- private int m_iTicketId;
- private int m_iPickupId;
- private java.util.Date m_dDate;
- private Properties attributes;
- private UserInfo m_User;
- private Double multiply;
- private CustomerInfoExt m_Customer;
- private String m_sActiveCash;
- private List m_aLines;
- private List payments;
- private List taxes;
- private final String m_sResponse;
- private String loyaltyCardNumber;
- private Boolean oldTicket;
- private boolean tip;
- private PaymentInfoTicket m_paymentInfo;
- private boolean m_isProcessed;
- private final String m_locked;
- private Double nsum;
- private int ticketstatus;
+ // JG Jun 2017 - contain partial/full refunds
+ public static final int REFUND_NOT = 0; // is a non-refunded ticket
+ public static final int REFUND_PARTIAL = 1;
+ public static final int REFUND_ALL = 2;
- private static String hostname;
+ private static final DateFormat m_dateformat = new SimpleDateFormat("hh:mm");
- public static void setHostname(String name) {
- hostname =name;
+ private String m_sHost;
+ private String m_sId;
+ private int tickettype;
+ private int m_iTicketId;
+ private int m_iPickupId;
+ private java.util.Date m_dDate;
+ private Properties attributes;
+ private UserInfo m_User;
+ private Double multiply;
+ private CustomerInfoExt m_Customer;
+ private String m_sActiveCash;
+ private List m_aLines;
+ private List payments;
+ private List taxes;
+ private final String m_sResponse;
+ private String loyaltyCardNumber;
+ private Boolean oldTicket;
+ private boolean tip;
+ private PaymentInfoTicket m_paymentInfo;
+ private boolean m_isProcessed;
+ private final String m_locked;
+ private Double nsum;
+ private int ticketstatus;
+
+ private static String hostname;
+
+ public static void setHostname(String name) {
+ hostname = name;
+ }
+
+ public static String getHostname() {
+ return hostname;
+ }
+
+ /** Creates new TicketModel */
+ public TicketInfo() {
+ m_sId = UUID.randomUUID().toString();
+ tickettype = RECEIPT_NORMAL;
+ m_iTicketId = 0; // incrementamos
+ m_dDate = new Date();
+ attributes = new Properties();
+ m_User = null;
+ m_Customer = null;
+ m_sActiveCash = null;
+ m_aLines = new ArrayList<>();
+ payments = new ArrayList<>();
+ taxes = null;
+ m_sResponse = null;
+ oldTicket = false;
+
+ AppConfig config = new AppConfig(new File(new File(
+ System.getProperty("user.home")), AppLocal.APP_ID + ".properties"));
+ config.load();
+ tip = Boolean.valueOf(config.getProperty("machine.showTip"));
+ m_isProcessed = false;
+ m_locked = null;
+ ticketstatus = 0;
+ m_sHost = String.valueOf(config.getProperty("machine.hostname"));
+ }
+
+ @Override
+ public void writeExternal(ObjectOutput out) throws IOException {
+ out.writeObject(m_sId);
+ out.writeInt(tickettype);
+ out.writeInt(m_iTicketId);
+ out.writeObject(m_Customer);
+ out.writeObject(m_dDate);
+ out.writeObject(attributes);
+ out.writeObject(m_aLines);
+
+ out.writeInt(ticketstatus);
+ }
+
+ @Override
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ m_sId = (String) in.readObject();
+ tickettype = in.readInt();
+ m_iTicketId = in.readInt();
+ m_Customer = (CustomerInfoExt) in.readObject();
+ m_dDate = (Date) in.readObject();
+ attributes = (Properties) in.readObject();
+ m_aLines = (List) in.readObject();
+ m_User = null;
+ m_sActiveCash = null;
+ payments = new ArrayList<>(); // JG June 2102 diamond inference
+ taxes = null;
+
+ ticketstatus = in.readInt();
+ }
+
+ /**
+ *
+ * @param dr
+ * @throws BasicException
+ */
+ @Override
+ public void readValues(DataRead dr) throws BasicException {
+ m_sId = dr.getString(1);
+ tickettype = dr.getInt(2);
+ m_iTicketId = dr.getInt(3);
+ m_dDate = dr.getTimestamp(4);
+ m_sActiveCash = dr.getString(5);
+ try {
+ byte[] img = dr.getBytes(6);
+ if (img != null) {
+ attributes.loadFromXML(new ByteArrayInputStream(img));
+ }
+ } catch (IOException e) {
+ }
+ m_User = new UserInfo(dr.getString(7), dr.getString(8));
+ m_Customer = new CustomerInfoExt(dr.getString(9));
+ m_aLines = new ArrayList<>();
+ payments = new ArrayList<>();
+ taxes = null;
+
+ ticketstatus = dr.getInt(10);
+ }
+
+ /**
+ *
+ * @return
+ */
+ public TicketInfo copyTicket() {
+ TicketInfo t = new TicketInfo();
+
+ t.tickettype = tickettype;
+ t.m_iTicketId = m_iTicketId;
+ t.m_dDate = m_dDate;
+ t.m_sActiveCash = m_sActiveCash;
+ t.attributes = (Properties) attributes.clone();
+ t.m_User = m_User;
+ t.m_Customer = m_Customer;
+
+ t.m_aLines = new ArrayList<>(); // JG June 2102 diamond inference
+ m_aLines.forEach((l) -> {
+ t.m_aLines.add(l.copyTicketLine());
+ });
+ t.refreshLines();
+
+ t.payments = new LinkedList<>(); // JG June 2102 diamond inference
+ payments.forEach((p) -> {
+ t.payments.add(p.copyPayment());
+ });
+ t.oldTicket = oldTicket;
+ // taxes are not copied, must be calculated again.
+
+ t.ticketstatus = ticketstatus;
+
+ return t;
+ }
+
+ public String getId() {
+ return m_sId;
+ }
+
+ public int getTicketType() {
+ return tickettype;
+ }
+
+ public void setTicketType(int tickettype) {
+ this.tickettype = tickettype;
+ }
+
+ public int getTicketId() {
+ return m_iTicketId;
+ }
+
+ public void setTicketId(int iTicketId) {
+ m_iTicketId = iTicketId;
+ }
+
+ public int getTicketStatus() {
+ return ticketstatus;
+ }
+
+ public void setTicketStatus(int ticketstatus) {
+ if (m_iTicketId > 0) {
+ this.ticketstatus = m_iTicketId;
+ } else {
+ this.ticketstatus = ticketstatus;
+ }
+ }
+
+ public void setPickupId(int iTicketId) {
+ m_iPickupId = iTicketId;
+ }
+
+ public int getPickupId() {
+ return m_iPickupId;
+ }
+
+ public String getName(Object info) {
+ // JG Aug 2014 - Add User info
+ List name = new ArrayList<>();
+
+ String nameprop = getProperty("name");
+ if (nameprop != null) {
+ name.add(nameprop);
}
- public static String getHostname() {
- return hostname;
+ if (m_User != null) {
+ name.add(m_User.getName());
}
- /** Creates new TicketModel */
- public TicketInfo() {
- m_sId = UUID.randomUUID().toString();
- tickettype = RECEIPT_NORMAL;
- m_iTicketId = 0; // incrementamos
- m_dDate = new Date();
- attributes = new Properties();
- m_User = null;
- m_Customer = null;
- m_sActiveCash = null;
- m_aLines = new ArrayList<>();
- payments = new ArrayList<>();
- taxes = null;
- m_sResponse = null;
- oldTicket=false;
-
- AppConfig config = new AppConfig(new File(new File(
- System.getProperty("user.home")), AppLocal.APP_ID + ".properties"));
- config.load();
- tip = Boolean.valueOf(config.getProperty("machine.showTip"));
- m_isProcessed = false;
- m_locked = null;
- ticketstatus = 0;
+ if (info == null) {
+ if (m_iTicketId == 0) {
+ name.add("(" + m_dateformat.format(m_dDate) + " "
+ + Long.toString(m_dDate.getTime() % 1000) + ")");
+ } else {
+ name.add(Integer.toString(m_iTicketId));
+ }
+ } else {
+ name.add(info.toString());
}
- @Override
- public void writeExternal(ObjectOutput out) throws IOException {
- out.writeObject(m_sId);
- out.writeInt(tickettype);
- out.writeInt(m_iTicketId);
- out.writeObject(m_Customer);
- out.writeObject(m_dDate);
- out.writeObject(attributes);
- out.writeObject(m_aLines);
-
- out.writeInt(ticketstatus);
+ if (m_Customer != null) {
+ name.add(m_Customer.getName());
}
- @Override
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- m_sId = (String) in.readObject();
- tickettype = in.readInt();
- m_iTicketId = in.readInt();
- m_Customer = (CustomerInfoExt) in.readObject();
- m_dDate = (Date) in.readObject();
- attributes = (Properties) in.readObject();
- m_aLines = (List) in.readObject();
- m_User = null;
- m_sActiveCash = null;
- payments = new ArrayList<>(); // JG June 2102 diamond inference
- taxes = null;
+ return org.apache.commons.lang.StringUtils.join(name, " - ");
+ }
- ticketstatus = in.readInt();
+ public String getName() {
+ return getName(null);
+ }
+
+ public java.util.Date getDate() {
+ return m_dDate;
+ }
+
+ public void setDate(java.util.Date dDate) {
+ m_dDate = dDate;
+ }
+
+ public String getHost() {
+ AppConfig m_config_host = new AppConfig(new File((System.getProperty("user.home")),
+ AppLocal.APP_ID + ".properties"));
+ m_config_host.load();
+ String machineHostname = (m_config_host.getProperty("machine.hostname"));
+ m_config_host = null;
+ return machineHostname;
+ }
+
+ public UserInfo getUser() {
+ return m_User;
+ }
+
+ public void setUser(UserInfo value) {
+ m_User = value;
+ }
+
+ public CustomerInfoExt getCustomer() {
+ return m_Customer;
+ }
+
+ public void setCustomer(CustomerInfoExt value) {
+ m_Customer = value;
+ }
+
+ public String getCustomerId() {
+ if (m_Customer == null) {
+ return null;
+ } else {
+ return m_Customer.getId();
+ }
+ }
+
+ public String getTransactionID() {
+ return (getPayments().size() > 0)
+ ? (getPayments().get(getPayments().size() - 1)).getTransactionID()
+ : StringUtils.getCardNumber(); // random transaction ID
+ }
+
+ public String getReturnMessage() {
+ return ((getPayments().get(getPayments().size() - 1)) instanceof PaymentInfoMagcard)
+ ? ((PaymentInfoMagcard) (getPayments().get(getPayments().size() - 1))).getReturnMessage()
+ : LocalRes.getIntString("button.OK");
+ }
+
+ public void setActiveCash(String value) {
+ m_sActiveCash = value;
+ }
+
+ public String getActiveCash() {
+ return m_sActiveCash;
+ }
+
+ public String getProperty(String key) {
+ return attributes.getProperty(key);
+ }
+
+ public String getProperty(String key, String defaultvalue) {
+ return attributes.getProperty(key, defaultvalue);
+ }
+
+ public void setProperty(String key, String value) {
+ attributes.setProperty(key, value);
+ }
+
+ public Properties getProperties() {
+ return attributes;
+ }
+
+ public TicketLineInfo getLine(int index) {
+ return m_aLines.get(index);
+ }
+
+ public void addLine(TicketLineInfo oLine) {
+ oLine.setTicket(m_sId, m_aLines.size());
+ m_aLines.add(oLine);
+ }
+
+ public void insertLine(int index, TicketLineInfo oLine) {
+ m_aLines.add(index, oLine);
+ refreshLines();
+ }
+
+ public void setLine(int index, TicketLineInfo oLine) {
+ oLine.setTicket(m_sId, index);
+ m_aLines.set(index, oLine);
+ }
+
+ public void removeLine(int index) {
+ m_aLines.remove(index);
+ refreshLines();
+
+ }
+
+ public void refreshLines() {
+ for (int i = 0; i < m_aLines.size(); i++) {
+ getLine(i).setTicket(m_sId, i);
+ }
+ }
+
+ public int getLinesCount() {
+ return m_aLines.size();
+ }
+
+ public double getArticlesCount() {
+ double dArticles = 0.0;
+ TicketLineInfo oLine;
+
+ for (Iterator i = m_aLines.iterator(); i.hasNext();) {
+ oLine = i.next();
+ dArticles += oLine.getMultiply();
}
- /**
- *
- * @param dr
- * @throws BasicException
- */
- @Override
- public void readValues(DataRead dr) throws BasicException {
- m_sId = dr.getString(1);
- tickettype = dr.getInt(2);
- m_iTicketId = dr.getInt(3);
- m_dDate = dr.getTimestamp(4);
- m_sActiveCash = dr.getString(5);
- try {
- byte[] img = dr.getBytes(6);
- if (img != null) {
- attributes.loadFromXML(new ByteArrayInputStream(img));
- }
- } catch (IOException e) {
+ return dArticles;
+ }
+
+ public double getSubTotal() {
+ double sum = 0.0;
+ sum = m_aLines.stream().map((line) -> line.getSubValue()).reduce(sum, (accumulator, _item) -> accumulator + _item);
+ return sum;
+ }
+
+ public double getTax() {
+
+ double sum = 0.0;
+ if (hasTaxesCalculated()) {
+ for (TicketTaxInfo tax : taxes) {
+ sum += tax.getTax(); // Taxes are already rounded...
+ nsum = sum;
+ }
+ } else {
+ sum = m_aLines.stream().map((line) -> line.getTax()).reduce(sum, (accumulator, _item) -> accumulator + _item);
+ }
+ return sum;
+ }
+
+ public double getTotal() {
+ return getSubTotal() + getTax();
+
+ }
+
+ public double getServiceCharge() {
+ return (getTotal() + getTax());
+
+ }
+
+ public double getTotalPaid() {
+ double sum = 0.0;
+ sum = payments.stream().filter((p) -> (!"debtpaid".equals(p.getName()))).map((p) -> p.getTotal()).reduce(sum,
+ (accumulator, _item) -> accumulator + _item);
+ return sum;
+ }
+
+ public double getTendered() {
+ return getTotalPaid();
+ }
+
+ public List getLines() {
+ return m_aLines;
+ }
+
+ public void setLines(List l) {
+ m_aLines = l;
+ }
+
+ public List getPayments() {
+ return payments;
+ }
+
+ public void setPayments(List l) {
+ payments = l;
+ }
+
+ public void resetPayments() {
+ payments = new ArrayList<>(); // JG June 2102 diamond inference
+ }
+
+ public List getTaxes() {
+ return taxes;
+ }
+
+ public boolean hasTaxesCalculated() {
+ return taxes != null;
+ }
+
+ public void setTaxes(List l) {
+ taxes = l;
+ }
+
+ public void resetTaxes() {
+ taxes = null;
+ }
+
+ public void setTip(boolean tips) {
+ tip = tips;
+ }
+
+ public boolean hasTip() {
+ return tip;
+ }
+
+ public void setIsProcessed(boolean isP) {
+ m_isProcessed = isP;
+ }
+
+ public TicketTaxInfo getTaxLine(TaxInfo tax) {
+
+ for (TicketTaxInfo taxline : taxes) {
+ if (tax.getId().equals(taxline.getTaxInfo().getId())) {
+ return taxline;
+ }
+ }
+
+ return new TicketTaxInfo(tax);
+ }
+
+ public TicketTaxInfo[] getTaxLines() {
+
+ Map m = new HashMap<>();
+
+ TicketLineInfo oLine;
+ for (Iterator i = m_aLines.iterator(); i.hasNext();) {
+ oLine = i.next();
+
+ TicketTaxInfo t = m.get(oLine.getTaxInfo().getId());
+ if (t == null) {
+ t = new TicketTaxInfo(oLine.getTaxInfo());
+ m.put(t.getTaxInfo().getId(), t);
+ }
+ t.add(oLine.getSubValue());
+ }
+
+ // return dSuma;
+ Collection avalues = m.values();
+ return avalues.toArray(new TicketTaxInfo[avalues.size()]);
+ }
+
+ public String printId() {
+
+ AppConfig m_config = new AppConfig(new File(
+ (System.getProperty("user.home")), AppLocal.APP_ID + ".properties"));
+ m_config.load();
+ String receiptSize = (m_config.getProperty("till.receiptsize"));
+ String receiptPrefix = (m_config.getProperty("till.receiptprefix"));
+
+ m_config = null;
+
+ if (m_iTicketId > 0) {
+ String tmpTicketId = Integer.toString(m_iTicketId);
+ if (receiptSize == null || (Integer.parseInt(receiptSize) <= tmpTicketId.length())) {
+ if (receiptPrefix != null) {
+ tmpTicketId = receiptPrefix + tmpTicketId;
}
- m_User = new UserInfo(dr.getString(7), dr.getString(8));
- m_Customer = new CustomerInfoExt(dr.getString(9));
- m_aLines = new ArrayList<>();
- payments = new ArrayList<>();
- taxes = null;
-
- ticketstatus = dr.getInt(10);
- }
-
- /**
- *
- * @return
- */
- public TicketInfo copyTicket() {
- TicketInfo t = new TicketInfo();
-
- t.tickettype = tickettype;
- t.m_iTicketId = m_iTicketId;
- t.m_dDate = m_dDate;
- t.m_sActiveCash = m_sActiveCash;
- t.attributes = (Properties) attributes.clone();
- t.m_User = m_User;
- t.m_Customer = m_Customer;
-
- t.m_aLines = new ArrayList<>(); // JG June 2102 diamond inference
- m_aLines.forEach((l) -> {
- t.m_aLines.add(l.copyTicketLine());
- });
- t.refreshLines();
-
- t.payments = new LinkedList<>(); // JG June 2102 diamond inference
- payments.forEach((p) -> {
- t.payments.add(p.copyPayment());
- });
- t.oldTicket=oldTicket;
- // taxes are not copied, must be calculated again.
-
- t.ticketstatus = ticketstatus;
-
- return t;
- }
-
- public String getId() {
- return m_sId;
- }
-
- public int getTicketType() {
- return tickettype;
- }
- public void setTicketType(int tickettype) {
- this.tickettype = tickettype;
- }
-
- public int getTicketId() {
- return m_iTicketId;
- }
- public void setTicketId(int iTicketId) {
- m_iTicketId = iTicketId;
- }
-
- public int getTicketStatus() {
- return ticketstatus;
- }
- public void setTicketStatus(int ticketstatus) {
- if (m_iTicketId >0) {
- this.ticketstatus = m_iTicketId;
- }else{
- this.ticketstatus = ticketstatus;
- }
- }
-
- public void setPickupId(int iTicketId) {
- m_iPickupId = iTicketId;
- }
-
- public int getPickupId() {
- return m_iPickupId;
- }
-
- public String getName(Object info) {
-// JG Aug 2014 - Add User info
- List name = new ArrayList<>();
-
- String nameprop = getProperty("name");
- if (nameprop != null) {
- name.add(nameprop);
- }
-
- if (m_User != null) {
- name.add(m_User.getName());
- }
-
- if (info == null) {
- if (m_iTicketId == 0) {
- name.add("(" + m_dateformat.format(m_dDate) + " "
- + Long.toString(m_dDate.getTime() % 1000) + ")");
- } else {
- name.add(Integer.toString(m_iTicketId));
- }
- } else {
- name.add(info.toString());
- }
-
- if (m_Customer != null) {
- name.add(m_Customer.getName());
- }
-
- return org.apache.commons.lang.StringUtils.join(name, " - ");
- }
-
- public String getName() {
- return getName(null);
- }
-
- public java.util.Date getDate() {
- return m_dDate;
- }
-
- public void setDate(java.util.Date dDate) {
- m_dDate = dDate;
- }
-
- public String getHost() {
- AppConfig m_config_host = new AppConfig(new File((System.getProperty("user.home")),
- AppLocal.APP_ID + ".properties"));
- m_config_host.load();
- String machineHostname =(m_config_host.getProperty("machine.hostname"));
- m_config_host = null;
- return machineHostname;
- }
-
- public UserInfo getUser() {
- return m_User;
- }
-
- public void setUser(UserInfo value) {
- m_User = value;
- }
-
- public CustomerInfoExt getCustomer() {
- return m_Customer;
- }
-
- public void setCustomer(CustomerInfoExt value) {
- m_Customer = value;
- }
-
- public String getCustomerId() {
- if (m_Customer == null) {
- return null;
- } else {
- return m_Customer.getId();
- }
- }
-
- public String getTransactionID(){
- return (getPayments().size()>0)
- ? ( getPayments().get(getPayments().size()-1) ).getTransactionID()
- : StringUtils.getCardNumber(); //random transaction ID
- }
-
- public String getReturnMessage(){
- return ( (getPayments().get(getPayments().size()-1)) instanceof PaymentInfoMagcard )
- ? ((PaymentInfoMagcard)(getPayments().get(getPayments().size()-1))).getReturnMessage()
- : LocalRes.getIntString("button.OK");
- }
-
- public void setActiveCash(String value) {
- m_sActiveCash = value;
- }
-
- public String getActiveCash() {
- return m_sActiveCash;
- }
-
- public String getProperty(String key) {
- return attributes.getProperty(key);
- }
-
- public String getProperty(String key, String defaultvalue) {
- return attributes.getProperty(key, defaultvalue);
- }
-
- public void setProperty(String key, String value) {
- attributes.setProperty(key, value);
- }
-
- public Properties getProperties() {
- return attributes;
- }
-
- public TicketLineInfo getLine(int index) {
- return m_aLines.get(index);
- }
-
- public void addLine(TicketLineInfo oLine) {
- oLine.setTicket(m_sId, m_aLines.size());
- m_aLines.add(oLine);
- }
-
- public void insertLine(int index, TicketLineInfo oLine) {
- m_aLines.add(index, oLine);
- refreshLines();
- }
-
- public void setLine(int index, TicketLineInfo oLine) {
- oLine.setTicket(m_sId, index);
- m_aLines.set(index, oLine);
- }
-
- public void removeLine(int index) {
- m_aLines.remove(index);
- refreshLines();
-
- }
-
- public void refreshLines() {
- for (int i = 0; i < m_aLines.size(); i++) {
- getLine(i).setTicket(m_sId, i);
- }
- }
-
- public int getLinesCount() {
- return m_aLines.size();
- }
-
- public double getArticlesCount() {
- double dArticles = 0.0;
- TicketLineInfo oLine;
-
- for (Iterator i = m_aLines.iterator(); i.hasNext();) {
- oLine = i.next();
- dArticles += oLine.getMultiply();
- }
-
- return dArticles;
- }
-
- public double getSubTotal() {
- double sum = 0.0;
- sum = m_aLines.stream().map((line) ->
- line.getSubValue()).reduce(sum, (accumulator, _item) ->
- accumulator + _item);
- return sum;
- }
-
- public double getTax() {
-
- double sum = 0.0;
- if (hasTaxesCalculated()) {
- for (TicketTaxInfo tax : taxes) {
- sum += tax.getTax(); // Taxes are already rounded...
- nsum = sum;
- }
- } else {
- sum = m_aLines.stream().map((line) ->
- line.getTax()).reduce(sum, (accumulator, _item) ->
- accumulator + _item);
- }
- return sum;
- }
-
- public double getTotal() {
- return getSubTotal() + getTax();
-
- }
-
- public double getServiceCharge() {
- return (getTotal() + getTax());
-
- }
-
- public double getTotalPaid() {
- double sum = 0.0;
- sum = payments.stream().filter((p) ->
- (!"debtpaid".equals(p.getName()))).map((p) ->
- p.getTotal()).reduce(sum, (accumulator, _item) ->
- accumulator + _item);
- return sum;
- }
-
- public double getTendered() {
- return getTotalPaid();
- }
-
- public List getLines() {
- return m_aLines;
- }
-
- public void setLines(List l) {
- m_aLines = l;
- }
-
- public List getPayments() {
- return payments;
- }
-
- public void setPayments(List l) {
- payments = l;
- }
+ return tmpTicketId;
+ }
+ while (tmpTicketId.length() < Integer.parseInt(receiptSize)) {
+ tmpTicketId = "0" + tmpTicketId;
+ }
+ if (receiptPrefix != null) {
+ tmpTicketId = receiptPrefix + tmpTicketId;
+ }
+ return tmpTicketId;
+ } else {
+ return "";
+ }
+ }
+
+ public String printDate() {
+ return Formats.TIMESTAMP.formatValue(m_dDate);
+ }
+
+ public String printUser() {
+ return m_User == null ? "" : m_User.getName();
+
+ }
+
+ public String printHost() {
+ return m_sHost;
+ }
+
+ // Added JDL 28.05.13 for loyalty card functions
+
+ /**
+ *
+ */
+ public void clearCardNumber() {
+ loyaltyCardNumber = null;
+ }
+
+ /**
+ *
+ * @param cardNumber
+ */
+ public void setLoyaltyCardNumber(String cardNumber) {
+ loyaltyCardNumber = cardNumber;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getLoyaltyCardNumber() {
+ return (loyaltyCardNumber);
+ }
+
+ public String printCustomer() {
+ return m_Customer == null ? "" : m_Customer.getName();
+ }
+
+ public String printPhone1() {
+ return m_Customer == null ? "" : m_Customer.getPhone1();
+ }
+
+ public String printArticlesCount() {
+ return Formats.DOUBLE.formatValue(getArticlesCount());
+ }
+
+ public String printSubTotal() {
+ return Formats.CURRENCY.formatValue(getSubTotal());
+ }
+
+ public String printTax() {
+ return Formats.CURRENCY.formatValue(getTax());
+ }
+
+ public String printTotal() {
+ return Formats.CURRENCY.formatValue(getTotal());
+ }
+
+ public String printTotalPaid() {
+ return Formats.CURRENCY.formatValue(getTotalPaid());
+ }
+
+ public String printTendered() {
+ return Formats.CURRENCY.formatValue(getTendered());
+ }
+
+ public String VoucherReturned() {
+ return Formats.CURRENCY.formatValue(getTotalPaid() - getTotal());
+ }
+
+ public boolean getOldTicket() {
+ return (oldTicket);
+ }
+
+ public void setOldTicket(Boolean otState) {
+ oldTicket = otState;
+ }
+
+ public String getTicketHeaderFooterData(String data) {
+ AppConfig m_config = new AppConfig(new File((System.getProperty("user.home")), AppLocal.APP_ID + ".properties"));
+ m_config.load();
+ String row = (m_config.getProperty("tkt." + data));
+
+ return row;
+ }
- public void resetPayments() {
- payments = new ArrayList<>(); // JG June 2102 diamond inference
- }
+ public String printQRCode(String nameHeader, String vatHeader, String vatLabel) {
+ String name = getTicketHeaderFooterData(nameHeader);
+ String vatNumberHeader = getTicketHeaderFooterData(vatHeader);
+ String vatNumber = vatNumberHeader.split(vatLabel)[1];
+ String date = new SimpleDateFormat("yyyy-mm-dd hh:mm:ss").format(getDate());
+ String total = String.valueOf(getTotal());
+ String vatValue = String.valueOf(getTax());
+ return name + "," + vatNumber + "," + date + "," + total + "," + vatValue;
+ }
- public List getTaxes() {
- return taxes;
- }
-
- public boolean hasTaxesCalculated() {
- return taxes != null;
- }
+ public String printTicketHeaderLine1() {
+ String lineData = getTicketHeaderFooterData("header1");
- public void setTaxes(List l) {
- taxes = l;
+ if (lineData != null) {
+ return lineData;
+ } else {
+ return "";
}
+ }
- public void resetTaxes() {
- taxes = null;
- }
+ public String printTicketHeaderLine2() {
+ String lineData = getTicketHeaderFooterData("header2");
- public void setTip(boolean tips) {
- tip = tips;
+ if (lineData != null) {
+ return lineData;
+ } else {
+ return "";
}
+ }
- public boolean hasTip() {
- return tip;
- }
+ public String printTicketHeaderLine3() {
+ String lineData = getTicketHeaderFooterData("header3");
- public void setIsProcessed(boolean isP) {
- m_isProcessed = isP;
+ if (lineData != null) {
+ return lineData;
+ } else {
+ return "";
}
+ }
- public TicketTaxInfo getTaxLine(TaxInfo tax) {
+ public String printTicketHeaderLine4() {
+ String lineData = getTicketHeaderFooterData("header4");
- for (TicketTaxInfo taxline : taxes) {
- if (tax.getId().equals(taxline.getTaxInfo().getId())) {
- return taxline;
- }
- }
-
- return new TicketTaxInfo(tax);
+ if (lineData != null) {
+ return lineData;
+ } else {
+ return "";
}
+ }
- public TicketTaxInfo[] getTaxLines() {
-
- Map m = new HashMap<>();
+ public String printTicketHeaderLine5() {
+ String lineData = getTicketHeaderFooterData("header5");
- TicketLineInfo oLine;
- for (Iterator i = m_aLines.iterator(); i.hasNext();) {
- oLine = i.next();
-
- TicketTaxInfo t = m.get(oLine.getTaxInfo().getId());
- if (t == null) {
- t = new TicketTaxInfo(oLine.getTaxInfo());
- m.put(t.getTaxInfo().getId(), t);
- }
- t.add(oLine.getSubValue());
- }
-
- // return dSuma;
- Collection avalues = m.values();
- return avalues.toArray(new TicketTaxInfo[avalues.size()]);
+ if (lineData != null) {
+ return lineData;
+ } else {
+ return "";
}
+ }
- public String printId() {
-
- AppConfig m_config = new AppConfig(new File(
- (System.getProperty("user.home")), AppLocal.APP_ID + ".properties"));
- m_config.load();
- String receiptSize =(m_config.getProperty("till.receiptsize"));
- String receiptPrefix =(m_config.getProperty("till.receiptprefix"));
-
- m_config =null;
-
- if (m_iTicketId > 0) {
- String tmpTicketId=Integer.toString(m_iTicketId);
- if (receiptSize == null || (Integer.parseInt(receiptSize) <= tmpTicketId.length())){
- if (receiptPrefix != null){
- tmpTicketId=receiptPrefix+tmpTicketId;
- }
- return tmpTicketId;
- }
- while (tmpTicketId.length()