$methods = array('cash' => 'Cash', 'change' => 'Change', 'credit' => 'Credit Card', 'square' => 'Square', 'stripe' => 'Stripe', 'dwolla' => 'Dwolla', 'gift' => 'Gift Card', 'check' => 'Check', 'discount' => 'Discount', 'bad' => 'Bad Debt'); $payments = txn_load_payments($db, $id); if (count($payments)) { foreach ($payments as $payment) { if ($payment['method'] == 'discount' && $payment['discount']) { $method = sprintf("Discount (%d%%)", $payment['discount']); } else { $method = $methods[$payment['method']]; } echo '<tr>', '<td class="right" colspan="3">', $method, ':</td>', '<td class="price">', amount($payment['amount']), "</td></tr>\n"; } ?> <tr class="total"> <td class="right" colspan="3">Total Due:</td> <td class="price"><?php echo amount($details['total'] - $details['total_paid']); ?> </td> </tr> <?php } ?> </tbody> </table> <div id="store_footer"> <?php if ($details['type'] != 'vendor') { ?> Items purchased from stock may be returned in original condition and packaging within 30 days with receipt. No returns without original receipt. <br><br>
<tr><th>Card Type</th><td><?php echo $payment['cc_type']; ?> </td></tr> <tr><th>Card Number</th><td><?php echo str_repeat('#', !strcmp($payment['cc_type'], 'AmericanExpress') ? 11 : 12); echo $payment['cc_lastfour']; ?> </td></tr> <tr><th>Expiration</th><td>##/##</td></tr> <tr><th>Approval</th><td><?php echo $payment['cc_approval']; ?> </td></tr> <tr><th>Amount</th><td><?php echo amount($payment['amount']); ?> </td></tr> </table> <div id="signature"> <br> <div style="font-size: 2em; padding-top: 2em; padding-bottom: 0.25em; margin-bottom: 0.25em; border-bottom: 4px solid black; text-align: left; page-break-before: always;">×</div> Cardmember agrees to pay total in accordance with agreement governing use of such card. </div> <div id="doc_info"> MERCHANT COPY <br> Invoice <?php echo ashtml($payment['invoice']); ?>
function escrow_free_escrow_address($address, $balance, $secondarypassword) { global $outgoingaddress, $blockchainfee; //$balance = escrow_get_address_balance($address); if ($balance > 5 * $blockchainmovebetweenwalletsfee) { $tx_hash = escrow_make_bitcoin_payment($outgoingaddress, amount($balance - $blockchainfee), $address, $secondarypassword); if ($tx_hash) { change_address_status_by_address($address, ADDRESS_FREE); escrow_update_address_balance($address, 0); } } else { change_address_status_by_address($address, ADDRESS_FREE); } }
function expand_field($data, $class) { switch ($class) { case '$txn': list($id, $type, $number) = preg_split('/\\|/', $data); $desc = array('correction' => 'Correction', 'drawer' => 'Till Count', 'customer' => 'Invoice', 'vendor' => 'Purchase Order'); if ($type == 'customer') { return '<a href="./?number=' . ashtml($number) . '">' . $desc[$type] . ' ' . ashtml($number) . '</a>'; } else { return '<a href="txn.php?id=' . ashtml($id) . '">' . $desc[$type] . ' ' . ashtml($number) . '</a>'; } case '$person': list($id, $company, $name) = preg_split('/\\|/', $data, 3); if (!$id) { return ''; } return '<a href="person.php?id=' . ashtml($id) . '">' . ashtml($company) . ($name && $company ? " (" : "") . ashtml($name) . ($name && $company ? ")" : "") . '</a>'; case '$item': return '<a href="item.php?code=' . ashtml($data) . '">' . ashtml($data) . '</a>'; case '$dollar': if ($data == null) { return $data; } return amount($data); case '$payment': $desc = array('cash' => 'Cash', 'change' => 'Change', 'credit' => 'Credit Card', 'square' => 'Square', 'stripe' => 'Stripe', 'gift' => 'Gift Card', 'check' => 'Check', 'dwolla' => 'Dwolla', 'discount' => 'Discount', 'withdrawal' => 'Withdrawal', 'bad' => 'Bad Debt'); return $desc[$data]; case '$bool': if ($data) { return '<i data-truth="1" class="fa fa-check-square-o"></i>'; } else { return '<i data-truth="0" class="fa fa-square-o"></i>'; } case '$html': return $data; default: return ashtml($data); } }
head("Daily Flow @ Scat", true); $q = "SELECT DATE_FORMAT(processed, '%Y-%m-%d %a') AS date,\n method, cc_type, SUM(amount) amount\n FROM payment\n WHERE processed > DATE(NOW() - INTERVAL 8 DAY)\n GROUP BY date, method, cc_type\n ORDER BY date DESC"; $r = $db->query($q) or die($db->error); bcscale(2); ?> <table class="table table-striped sortable" style="width: auto"> <thead> <tr><th>Date</th><th>Cash</th><th>Credit</th><th>Amex</th><th>Other</th></tr> </thead> <tbody> <?php $day = null; $cash = $credit = $amex = $other = 0.0; while ($row = $r->fetch_assoc()) { if ($row['date'] != $day && $day) { echo '<tr><td>', ashtml($day), '</td><td align="right">', amount($cash), '</td><td align="right">', amount($credit), '</td><td align="right">', amount($amex), '</td><td align="right">', amount($other), "</td></tr>\n"; $cash = $credit = $amex = $other = 0.0; } switch ($row['method']) { case 'cash': case 'change': $cash = bcadd($cash, $row['amount']); break; case 'credit': if ($row['cc_type'] == 'AmericanExpress') { $amex = bcadd($amex, $row['amount']); } else { $credit = bcadd($credit, $row['amount']); } break; case 'withdrawal':
?> <table> <tr><th>Cash</th><td><?php echo amount(abs($cash['amount'])); ?> </td></tr> <?php while ($check = $r->fetch_assoc()) { $total += $check['amount']; ?> <tr><th>Check</th><td><?php echo amount($check['amount']); ?> </td></tr> <?php } ?> <tr class="total"><th>Total</th><td><?php echo amount($total); ?> </td></tr> </table> <div id="doc_info"> <?php echo BANK_DEPOSIT_INFO; ?> </div> </body> </html>