// sale.rhai // Create a sale item let sale_item = new_sale_item() .product_id(1) .name("Super Product") .quantity(2) .unit_price(99.99) .subtotal(199.98) .service_active_until(1735689600); // Future timestamp print("New Sale Item:"); print(sale_item); // Create a sale and add the item let new_sale = new_sale() .company_id(1) .buyer_id(2) .transaction_id(12345) .total_amount(199.98) .status("Completed") .sale_date(1672531200) // Past timestamp .add_item(sale_item) .notes("This is a test sale.") .save_sale(); print("\nNew Sale:"); print(new_sale);