Example #1
0
 private function createContactRow($orderID)
 {
     $dbc = $this->connection;
     $dbc->selectDB($this->config->get('TRANS_DB'));
     $TRANS = $this->config->get('TRANS_DB') . $dbc->sep();
     $so_order = new SpecialOrdersModel($dbc);
     $so_order->specialOrderID($orderID);
     $so_order->firstName('');
     $so_order->lastName('');
     $so_order->street('');
     $so_order->city('');
     $so_order->state('');
     $so_order->zip('');
     $so_order->phone('');
     $so_order->altPhone('');
     $so_order->email('');
     $so_order->save();
     $dbc->selectDB($this->config->get('OP_DB'));
 }
Example #2
0
function getCustomerNonForm($orderID)
{
    global $FANNIE_OP_DB, $TRANS, $FANNIE_TRANS_DB;
    $dbc = FannieDB::get($FANNIE_OP_DB);
    $names = array();
    $pn = 1;
    $status_row = array('Type' => 'REG', 'status' => '');
    $dbc = FannieDB::get($FANNIE_TRANS_DB);
    $orderModel = new SpecialOrdersModel($dbc);
    $orderModel->specialOrderID($orderID);
    $orderModel->load();
    $dbc = FannieDB::get($FANNIE_OP_DB);
    // look up member id
    $memNum = 0;
    $findMem = $dbc->prepare_statement("SELECT card_no,voided FROM {$TRANS}CompleteSpecialOrder WHERE order_id=?");
    $memR = $dbc->exec_statement($findMem, array($orderID));
    if ($dbc->num_rows($memR) > 0) {
        $memW = $dbc->fetch_row($memR);
        $memNum = $memW['card_no'];
        $pn = $memW['voided'];
    }
    // Get member info from custdata, non-member info from SpecialOrders
    if ($memNum != 0) {
        $namesP = $dbc->prepare_statement("SELECT personNum,FirstName,LastName FROM custdata\n            WHERE CardNo=? ORDER BY personNum");
        $namesR = $dbc->exec_statement($namesP, array($memNum));
        while ($namesW = $dbc->fetch_row($namesR)) {
            $names[$namesW['personNum']] = array($namesW['FirstName'], $namesW['LastName']);
        }
        $statusQ = $dbc->prepare_statement("SELECT Type FROM custdata WHERE CardNo=?");
        $statusR = $dbc->exec_statement($statusQ, array($memNum));
        $status_row = $dbc->fetch_row($statusR);
        if ($status_row['Type'] == 'INACT') {
            $status_row['status'] = 'Inactive';
        } elseif ($status_row['Type'] == 'INACT2') {
            $status_row['status'] = 'Inactive';
        } elseif ($status_row['Type'] == 'TERM') {
            $status_row['status'] = 'Terminated';
        }
    }
    $q = $dbc->prepare_statement("SELECT entry_date FROM {$TRANS}SpecialOrderHistory \n            WHERE order_id=? AND entry_type='CONFIRMED'");
    $r = $dbc->exec_statement($q, array($orderID));
    $confirm_date = "";
    if ($dbc->num_rows($r) > 0) {
        $confirm_date = array_pop($dbc->fetch_row($r));
    }
    $callback = 1;
    $user = '******';
    $orderDate = '';
    $q = $dbc->prepare_statement("SELECT datetime,numflag,mixMatch FROM \n            {$TRANS}CompleteSpecialOrder WHERE order_id=? AND trans_id=0");
    $r = $dbc->exec_statement($q, array($orderID));
    if ($dbc->num_rows($r) > 0) {
        list($orderDate, $callback, $user) = $dbc->fetch_row($r);
    }
    $ret = "";
    $ret .= sprintf('<input type="hidden" id="orderID" value="%d" />', $orderID);
    $ret .= '<table width="95%" cellpadding="4" cellspacing=4" border="0">';
    $ret .= '<tr><td align="left" valign="top">';
    $ret .= sprintf('<b>Owner Number</b>: %s', $memNum == 0 ? '' : $memNum);
    $ret .= '<br />';
    $ret .= '<b>Owner</b>: ' . ($status_row['Type'] == 'PC' ? 'Yes' : 'No');
    $ret .= '<br />';
    if (!empty($status_row['status'])) {
        $ret .= '<b>Account status</b>: ' . $status_row['status'];
        $ret .= '<br />';
    }
    $ret .= "<b>Taken by</b>: " . $user . "<br />";
    $ret .= "<b>On</b>: " . date("M j, Y g:ia", strtotime($orderDate)) . "<br />";
    $ret .= '</td><td align="right" valign="top">';
    $ret .= '<b>Call to Confirm</b>: ';
    if ($callback == 1) {
        $ret .= 'Yes';
    } else {
        $ret .= 'No';
    }
    $ret .= '<br />';
    $ret .= '<span id="confDateSpan">' . (!empty($confirm_date) ? 'Confirmed ' . $confirm_date : 'Not confirmed') . "</span> ";
    $ret .= '<br />';
    $ret .= "<input type=\"submit\" value=\"Done\"\n        onclick=\"location='index.php';\" />";
    $ret .= '</td></tr></table>';
    $ret .= '<table cellspacing="0" cellpadding="4" border="1">';
    // names
    if (empty($names)) {
        $ret .= sprintf('<tr><th>First Name</th><td>%s
                </td>', $orderModel->firstName(), $orderID);
        $ret .= sprintf('<th>Last Name</th><td>%s
                </td>', $orderModel->lastName(), $orderID);
    } else {
        $ret .= '<tr><th>Name</th><td colspan="2">';
        foreach ($names as $p => $n) {
            if ($p == $pn) {
                $ret .= $n[0] . ' ' . $n[1];
            }
        }
        $ret .= '</td>';
        $ret .= '<td>&nbsp;</td>';
    }
    $ret .= sprintf('<td colspan="4">Notes for:
        <select id="nDept">
        <option value="0">Choose...</option>', $orderID);
    $sQ = $dbc->prepare_statement("select superID,super_name \n        from MasterSuperDepts\n        where superID > 0\n        group by superID,super_name\n        order by super_name");
    $sR = $dbc->exec_statement($sQ);
    while ($sW = $dbc->fetch_row($sR)) {
        $ret .= sprintf('<option value="%d" %s>%s</option>', $sW['superID'], $sW['superID'] == $orderModel->noteSuperID() ? 'selected' : '', $sW['super_name']);
    }
    $ret .= "</select></td></tr>";
    // address
    $street = $orderModel->street();
    $street2 = '';
    if (strstr($street, "\n")) {
        list($street, $street2) = explode("\n", $street, 2);
    }
    $ret .= sprintf('<tr><th>Address</th><td>%s
        </td><th>E-mail</th><td>%s</td>
        <td rowspan="2" colspan="4">%s
        </td></tr>
        <tr><th>Addr (2)</th><td>%s
        </td><th>City</th><td>%s
        </td></tr>
        <tr><th>Phone</th><td>%s</td>
        <th>Alt. Phone</th><td>%s</td>
        <th>State</th>
        <td>%s</td>
        <th>Zip</th><td>%s</td></tr>', $street, $orderModel->email(), $orderModel->notes(), $street2, $orderModel->city(), $orderModel->phone(), $orderModel->altPhone(), $orderModel->state(), $orderModel->zip());
    $ret .= '</table>';
    return $ret;
}
Example #3
0
 public function get_orderID_customer_handler()
 {
     $dbc = $this->connection;
     $dbc->selectDB($this->config->get('OP_DB'));
     $TRANS = $this->config->get('TRANS_DB') . $dbc->sep();
     $orderID = $this->orderID;
     $names = array();
     $pn = 1;
     $status_row = array('Type' => 'REG', 'status' => '');
     $dbc->selectDB($this->config->get('TRANS_DB'));
     $orderModel = new SpecialOrdersModel($dbc);
     $orderModel->specialOrderID($orderID);
     $orderModel->load();
     $dbc->selectDB($this->config->get('OP_DB'));
     // look up member id
     $memNum = 0;
     $findMem = $dbc->prepare_statement("SELECT card_no,voided FROM {$TRANS}CompleteSpecialOrder WHERE order_id=?");
     $memR = $dbc->exec_statement($findMem, array($orderID));
     if ($dbc->num_rows($memR) > 0) {
         $memW = $dbc->fetch_row($memR);
         $memNum = $memW['card_no'];
         $pn = $memW['voided'];
     }
     // Get member info from custdata, non-member info from SpecialOrders
     if ($memNum != 0) {
         $namesP = $dbc->prepare_statement("SELECT personNum,FirstName,LastName FROM custdata\n                WHERE CardNo=? ORDER BY personNum");
         $namesR = $dbc->exec_statement($namesP, array($memNum));
         while ($namesW = $dbc->fetch_row($namesR)) {
             $names[$namesW['personNum']] = array($namesW['FirstName'], $namesW['LastName']);
         }
         $statusQ = $dbc->prepare_statement("SELECT Type FROM custdata WHERE CardNo=?");
         $statusR = $dbc->exec_statement($statusQ, array($memNum));
         $status_row = $dbc->fetch_row($statusR);
         if ($status_row['Type'] == 'INACT') {
             $status_row['status'] = 'Inactive';
         } elseif ($status_row['Type'] == 'INACT2') {
             $status_row['status'] = 'Inactive';
         } elseif ($status_row['Type'] == 'TERM') {
             $status_row['status'] = 'Terminated';
         }
     }
     $q = $dbc->prepare_statement("SELECT entry_date FROM {$TRANS}SpecialOrderHistory \n                WHERE order_id=? AND entry_type='CONFIRMED'");
     $r = $dbc->exec_statement($q, array($orderID));
     $confirm_date = "";
     if ($dbc->num_rows($r) > 0) {
         $confirm_date = array_pop($dbc->fetch_row($r));
     }
     $callback = 1;
     $user = '******';
     $orderDate = '';
     $q = $dbc->prepare_statement("SELECT datetime,numflag,mixMatch FROM \n                {$TRANS}CompleteSpecialOrder WHERE order_id=? AND trans_id=0");
     $r = $dbc->exec_statement($q, array($orderID));
     if ($dbc->num_rows($r) > 0) {
         list($orderDate, $callback, $user) = $dbc->fetch_row($r);
     }
     $ret = "";
     $ret .= sprintf('<input type="hidden" id="orderID" value="%d" />', $orderID);
     $ret .= '<div class="row">
         <div class="col-sm-6 text-left">';
     $ret .= sprintf('<b>Owner Number</b>: %s', $memNum == 0 ? '' : $memNum);
     $ret .= '<br />';
     $ret .= '<b>Owner</b>: ' . ($status_row['Type'] == 'PC' ? 'Yes' : 'No');
     $ret .= '<br />';
     if (!empty($status_row['status'])) {
         $ret .= '<b>Account status</b>: ' . $status_row['status'];
         $ret .= '<br />';
     }
     $ret .= "<b>Taken by</b>: " . $user . "<br />";
     $ret .= "<b>On</b>: " . date("M j, Y g:ia", strtotime($orderDate)) . "<br />";
     $ret .= '</div>
         <div class="col-sm-6 text-right">';
     $ret .= '<b>Call to Confirm</b>: ';
     if ($callback == 1) {
         $ret .= 'Yes';
     } else {
         $ret .= 'No';
     }
     $ret .= '<br />';
     $ret .= '<span id="confDateSpan">' . (!empty($confirm_date) ? 'Confirmed ' . $confirm_date : 'Not confirmed') . "</span> ";
     $ret .= '<br />';
     $ret .= '<a href="index.php" class="btn btn-default">Done</a>';
     $ret .= '</div></div>';
     $ret .= '<table class="table table-bordered table-striped">';
     // names
     if (empty($names)) {
         $ret .= sprintf('<tr><th>First Name</th><td>%s
                 </td>', $orderModel->firstName(), $orderID);
         $ret .= sprintf('<th>Last Name</th><td>%s
                 </td>', $orderModel->lastName(), $orderID);
     } else {
         $ret .= '<tr><th>Name</th><td colspan="2">';
         foreach ($names as $p => $n) {
             if ($p == $pn) {
                 $ret .= $n[0] . ' ' . $n[1];
             }
         }
         $ret .= '</td>';
         $ret .= '<td>&nbsp;</td>';
     }
     $super = new SuperDeptNamesModel($dbc);
     $super->superID($orderModel->noteSuperID());
     $super->load();
     $ret .= '<td colspan="4">Notes for: ' . $super->super_name() . '</td></tr>';
     // address
     $street = $orderModel->street();
     $street2 = '';
     if (strstr($street, "\n")) {
         list($street, $street2) = explode("\n", $street, 2);
     }
     $ret .= sprintf('<tr><th>Address</th><td>%s
         </td><th>E-mail</th><td>%s</td>
         <td rowspan="2" colspan="4">%s
         </td></tr>
         <tr><th>Addr (2)</th><td>%s
         </td><th>City</th><td>%s
         </td></tr>
         <tr><th>Phone</th><td>%s</td>
         <th>Alt. Phone</th><td>%s</td>
         <th>State</th>
         <td>%s</td>
         <th>Zip</th><td>%s</td></tr>', $street, $orderModel->email(), $orderModel->notes(), $street2, $orderModel->city(), $orderModel->phone(), $orderModel->altPhone(), $orderModel->state(), $orderModel->zip());
     $ret .= '</table>';
     echo $ret;
     return false;
 }