Claude-skill-registry create-purchase-order
Create purchase order (PO) in NexERP database
install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/create-purchase-order" ~/.claude/skills/majiayu000-claude-skill-registry-create-purchase-order && rm -rf "$T"
manifest:
skills/data/create-purchase-order/SKILL.mdsource content
Create Purchase Order Skill
Creates a purchase order (PO) record in the NexERP system. A purchase order represents goods/services to be ordered from a supplier.
Usage
python main.py \ --supplier-name "ACTION BOLT" \ --order-date "2025-10-26" \ --items '[{"product_name": "WIRE D1.2", "quantity": 100, "unit_price": 10.50}]' \ --json
Required Fields
: Supplier name (fuzzy match supported)--supplier-name
: Order date (YYYY-MM-DD format)--order-date
: JSON array of line items--items
Item Fields
Each item must have:
: Product name or SKU (fuzzy match supported)product_name
: Quantity to order (positive number)quantity
: Price per unitunit_price
Optional item fields:
: Line discount percentage (0-100)discount
: Line item remark/notesremark
Optional PO Fields
: Supplier's reference number--supplier-ref
: PO expiry date (YYYY-MM-DD)--expiry-date
: Tax rate as decimal (default: 0.06 for 6% tax)--tax-rate
: PO remark/notes--remark
Output
Returns JSON with PO details:
{ "success": true, "po_number": "PO25100036", "txn_id": 2126, "supplier": "ACTION BOLT & NUTS SDN BHD", "order_date": "2025-10-26", "items_count": 1, "subtotal": 1050.00, "tax": 63.00, "grand_total": 1113.00, "status": "Pending" }
Error Handling
Returns error JSON if:
- Supplier not found (suggests alternatives)
- Product not found for any item
- Invalid date format
- Invalid amounts or quantities
- Database connection fails
Database Tables
Writes to 3 tables:
- PO headertbl_porder_txn
- Line itemstbl_porder_item
- Stock movement trackingtbl_porder_movement
Document Number Format
PO numbers follow pattern:
PO{YY}{MM}{NNNN}
- Example:
= October 2025, PO #36PO25100036
Business Rules
- Supplier must exist and be active (Status_i = 1)
- Products must exist in tbl_product_code
- Order date must be valid date format
- Quantities must be positive
- Amounts rounded to 2 decimal places
- Default tax rate: 6% (for purchase orders)
- PO status defaults to 'P' (Pending)
- Automatic calculation: SubTotal + Tax = GrandTotal
PO Status Values
: Pending (default)P
: ApprovedA
: ConfirmedC
: ReceivedR
: CancelledX
Integration
This skill is called by the Database Agent when processing purchase order documents.
Examples
Single Item PO
python main.py \ --supplier-name "ACTION" \ --order-date "2025-10-26" \ --items '[{"product_name": "WIRE D1.2-L105.8", "quantity": 100, "unit_price": 10.50}]' \ --json
Multi-Item PO with Expiry Date
python main.py \ --supplier-name "NINGBO" \ --order-date "2025-10-26" \ --expiry-date "2025-11-26" \ --supplier-ref "REF-2025-ABC" \ --items '[ {"product_name": "WIRE D1.2", "quantity": 200, "unit_price": 5.00}, {"product_name": "BOLT M10", "quantity": 1000, "unit_price": 0.50, "discount": 15} ]' \ --remark "Urgent order - deliver by Nov 15" \ --json
With Custom Tax Rate
python main.py \ --supplier-name "Dell" \ --order-date "2025-10-26" \ --items '[{"product_name": "Laptop", "quantity": 5, "unit_price": 3500.00}]' \ --tax-rate 0.08 \ --json
Testing
# Test with verbose output python main.py --supplier-name "ACTION" --order-date "2025-10-26" \ --items '[{"product_name": "WIRE", "quantity": 50, "unit_price": 10.00}]' \ --verbose --json # Test error handling (invalid supplier) python main.py --supplier-name "XYZ_NONEXISTENT" --order-date "2025-10-26" \ --items '[{"product_name": "WIRE", "quantity": 50, "unit_price": 10.00}]' \ --json
Exit Codes
: Success0
: Error (invalid input, database error)1
: Not found (supplier/product not found)2