Unlock AI power-ups — upgrade and save 20%!
Use code STUBE20OFF during your first month after signup. Upgrade now →

By SiAmir Uyelindo
Published Loading...
N/A views
N/A likes
Transaction Finalization and Immutability
📌 Implemented a "Permanent Save" (Simpan Permanen) feature to finalize transactions, which prevents further edits or deletions to prevent potential misappropriation of garments.
⚙️ A new `simpan` column (with values 0 or 1) was added to the `transaksi` table to track the finalization status (0 for pending, 1 for permanent).
🔄 Upon clicking "Permanent Save," a script updates the `simpan` status from 0 to 1, invalidating any further modification attempts on that transaction.
User Interface and Conditional Display
🖥️ The logic now checks the `simpan` status using a custom function (`cek_simpan_transaksi`) based on the transaction ID (`$_GET['q']`).
🚫 If the transaction is finalized (`simpan = 1`), the "Add Item" and "Save" buttons are hidden, and a "Print Receipt" (Cetak Nota) button is displayed instead.
🖨️ A "Print Receipt" link is conditionally shown when the transaction is finalized, directing the user to the report display page.
Detail Calculation and Display Logic
🔢 Line item total is now dynamically calculated as Weight × Unit Price within the loop.
💰 The Grand Total is calculated by summing the line item totals across all records in the transaction using a running variable (`$GT`) initialized to 0.
🏷️ Item names (e.g., Nama Jenis Cucian) and currency formatting (Indonesian Rupiah) were integrated into the display for better reporting.
Key Points & Insights
➡️ Method Consistency is Crucial: When submitting the permanent save form, ensure the HTTP method (e.g., `POST`) in the front-end matches how the receiving script (`simpanpermanen_transaksi.php`) attempts to capture the data (`$_POST`).
➡️ Data Integrity via Status Flags: Using a database flag (like `simpan = 1`) is essential for enforcing business rules, such as making completed transactions immutable (non-deletable/non-editable).
➡️ Dynamic Reporting Display: Leverage conditional PHP logic within the HTML structure to dynamically show or hide interface elements (buttons, input fields) based on real-time database status checks.
📸 Video summarized with SummaryTube.com on Nov 20, 2025, 00:57 UTC
Find relevant products on Amazon related to this video
As an Amazon Associate, we earn from qualifying purchases
Full video URL: youtube.com/watch?v=oNFAtlrF0Lg
Duration: 40:35

Summarize youtube video with AI directly from any YouTube video page. Save Time.
Install our free Chrome extension. Get expert level summaries with one click.