' xprint_checks.pb — Check printing layout simulation
#COMPILE EXE
#DIM ALL

FUNCTION PBMAIN() AS LONG
    LOCAL checkNum AS LONG
    LOCAL payeeID AS LONG
    LOCAL amountCents AS LONG
    LOCAL amountDollars AS LONG
    LOCAL centsPart AS LONG
    LOCAL dollarPart AS LONG
    LOCAL memoID AS LONG
    LOCAL i AS LONG
    LOCAL j AS LONG
    LOCAL totalAmount AS LONG
    LOCAL checkCount AS LONG
    LOCAL payeeStr AS STRING
    LOCAL memoStr AS STRING
    LOCAL dateStr AS STRING
    LOCAL amountStr AS STRING
    LOCAL linePos AS LONG
    LOCAL totalChecks AS LONG
    LOCAL maxChecks AS LONG
    LOCAL runningTotal AS LONG

    maxChecks = 8

    PRINT "=== Check Printing System ==="
    PRINT "Layout: 3.5 x 8.5 inches"

    FOR checkCount = 1 TO maxChecks
        checkNum = 1000 + checkCount
        payeeID = checkCount
        amountCents = checkCount * 500 + 99
        dollarPart = amountCents / 100
        centsPart = amountCents - dollarPart * 100
        memoID = checkCount MOD 3

        IF payeeID = 1 THEN payeeStr = "Electric Company"
        IF payeeID = 2 THEN payeeStr = "Water Utility"
        IF payeeID = 3 THEN payeeStr = "Internet Provider"
        IF payeeID = 4 THEN payeeStr = "Phone Service"
        IF payeeID = 5 THEN payeeStr = "Insurance Co"
        IF payeeID = 6 THEN payeeStr = "Rental Office"
        IF payeeID = 7 THEN payeeStr = "Credit Card"
        IF payeeID = 8 THEN payeeStr = "Gas Company"

        IF memoID = 0 THEN memoStr = "Monthly payment"
        IF memoID = 1 THEN memoStr = "Invoice #" + STR$(checkNum)
        IF memoID = 2 THEN memoStr = "Service charge"

        PRINT "--- Check #" + STR$(checkNum) + " ---"
        PRINT "  Payee: " + payeeStr
        PRINT "  Amount: $" + STR$(dollarPart) + "." + STR$(centsPart)
        PRINT "  Memo: " + memoStr
        PRINT "  Date: 2026-06-" + STR$(checkCount + 10)
        PRINT "  Signature line: _________________"

        runningTotal = runningTotal + amountCents
        totalAmount = totalAmount + amountCents
    NEXT checkCount

    PRINT "--- Summary ---"
    PRINT "Total checks: " + STR$(maxChecks)
    PRINT "Total amount: $" + STR$(totalAmount / 100) + "." + STR$(totalAmount - totalAmount / 100 * 100)
    PRINT "=== End Check Print ==="
    FUNCTION = 0
END FUNCTION
