function finish_content() { if (!empty($this->errors)) { return $this->errors; } $ret = ''; $trans_no = DTrans::getTransNo($this->connection, $this->CORRECTION_CASHIER, $this->CORRECTION_LANE); $params = array('card_no' => $this->cn1, 'register_no' => $this->CORRECTION_LANE, 'emp_no' => $this->CORRECTION_CASHIER); DTrans::addOpenRing($this->connection, $this->CORRECTION_DEPT, -1 * $this->amt, $trans_no, $params); $comment = FormLib::get('correction-comment'); if (!empty($comment)) { $params = array('description' => $comment, 'trans_type' => 'C', 'trans_subtype' => 'CM', 'card_no' => $this->cn1, 'register_no' => $this->CORRECTION_LANE, 'emp_no' => $this->CORRECTION_CASHIER); DTrans::addItem($this->connection, $trans_no, $params); } $ret .= sprintf("Receipt #1: %s", $this->CORRECTION_CASHIER . '-' . $this->CORRECTION_LANE . '-' . $trans_no); $trans_no = DTrans::getTransNo($this->connection, $this->CORRECTION_CASHIER, $this->CORRECTION_LANE); $params = array('card_no' => $this->cn2, 'register_no' => $this->CORRECTION_LANE, 'emp_no' => $this->CORRECTION_CASHIER); DTrans::addOpenRing($this->connection, $this->CORRECTION_DEPT, $this->amt, $trans_no, $params); if (!empty($comment)) { $params = array('description' => $comment, 'trans_type' => 'C', 'trans_subtype' => 'CM', 'card_no' => $this->cn2, 'register_no' => $this->CORRECTION_LANE, 'emp_no' => $this->CORRECTION_CASHIER); DTrans::addItem($this->connection, $trans_no, $params); } $ret .= "<br /><br />"; $ret .= sprintf("Receipt #2: %s", $this->CORRECTION_CASHIER . '-' . $this->CORRECTION_LANE . '-' . $trans_no); $ret .= '<hr />'; $ret .= '<a href="../MemCorrectionIndex.php">Home</a>'; return $ret; }
function finish_content() { if (!empty($this->errors)) { return $this->errors; } $ret = ''; $trans_no = DTrans::getTransNo($this->connection, $this->CORRECTION_CASHIER, $this->CORRECTION_LANE); $params = array('card_no' => $this->cn, 'register_no' => $this->CORRECTION_LANE, 'emp_no' => $this->CORRECTION_CASHIER); DTrans::addOpenRing($this->connection, $this->dept1, -1 * $this->amount, $trans_no, $params); DTrans::addOpenRing($this->connection, $this->dept2, $this->amount, $trans_no, $params); $comment = FormLib::get_form_value('comment'); if (!empty($comment)) { $params = array('description' => $comment, 'trans_type' => 'C', 'trans_subtype' => 'CM', 'card_no' => $this->cn, 'register_no' => $this->CORRECTION_LANE, 'emp_no' => $this->CORRECTION_CASHIER); DTrans::addItem($this->connection, $trans_no, $params); } $ret .= sprintf("Receipt #1: %s", $this->CORRECTION_CASHIER . '-' . $this->CORRECTION_LANE . '-' . $trans_no); return $ret; }
function post_id_handler() { global $FANNIE_OP_DB, $FANNIE_TRANS_DB; $sql = FannieDB::get($FANNIE_TRANS_DB); $amount = FormLib::get_form_value('amount'); $desc = FormLib::get_form_value('desc'); $json = array('msg' => '', 'billed' => 0); if ($amount === '') { $json['msg'] = "Amount is required"; echo json_encode($json); return false; } elseif ($desc === '') { $json['msg'] = "Description is required"; echo json_encode($json); return false; } $desc = str_replace("'", "''", $desc); $trans_no = DTrans::getTransNo($sql, $this->EMP_NO, $this->LANE_NO); $params = array('card_no' => $this->id, 'register_no' => $this->LANE_NO, 'emp_no' => $this->EMP_NO); DTrans::addOpenRing($sql, $this->DEPT, $amount, $trans_no, $params); $params['description'] = 'InStore Charges'; $params['trans_type'] = 'T'; $params['trans_subtype'] = 'MI'; $params['total'] = -1 * $amount; DTrans::addItem($sql, $trans_no, $params); $json['msg'] = sprintf("Member <b>%d</b> billed <b>\$%.2f</b>.<br />\n Receipt is %d-%d-%d.", $this->id, $amount, $this->EMP_NO, $this->LANE_NO, $t_no); $json['billed'] = 1; echo json_encode($json); return false; }