Exemplo n.º 1
0
 public function get_view()
 {
     $dbc = FannieDB::getReadOnly($this->config->get('OP_DB'));
     $code = new ReasoncodesModel($dbc);
     $ret = '<form method="post">
         <p><button type="submit" class="btn btn-default">Save Reasons</button></p>
         <table class="table table-bordered">
         <tr>
             <th>#</th>
             <th>Reason</th>
             <th>Current Accounts</th>
         </tr>';
     $countP = $dbc->prepare('
         SELECT COUNT(*)
         FROM suspensions
         WHERE (reasoncode & ?) <> 0
     ');
     for ($i = 0; $i < 30; $i++) {
         $code->mask(1 << $i);
         $count = $dbc->getValue($countP, array(1 << $i));
         $reason = $code->load() ? $code->textStr() : '';
         $ret .= sprintf('<tr>
             <td>%d<input type="hidden" name="mask[]" value="%d" /></td>
             <td><input type="text" class="form-control" name="reason[]" value="%s" />
             <td>%d</td>
             </tr>', $i + 1, 1 << $i, $reason, $count);
     }
     $ret .= '</table>';
     $ret .= '<p><button type="submit" class="btn btn-default">Save Reasons</button></p>';
     $ret .= '</form>';
     return $ret;
 }
Exemplo n.º 2
0
 /**
   Route: get<id>
   Show suspension history for member <id>
   
   Route: get<id><edit>
   Show current suspension status for member <id>
   as editable form
 
   Route: post<id>
   Update suspension status for member <id> then
   redirect to PIMemberPage.php
 
   Route get<id><fixaddress>
   Special case clear suspension for bad address only
 */
 function preprocess()
 {
     global $FANNIE_OP_DB;
     $rc = new ReasoncodesModel(FannieDB::get($FANNIE_OP_DB));
     $this->__models['codes'] = $rc->find('mask');
     if (FormLib::get_form_value('id', False) !== False) {
         $this->card_no = FormLib::get_form_value('id');
         $susp = $this->get_model(FannieDB::get($FANNIE_OP_DB), 'SuspensionsModel', array('cardno' => $this->card_no));
         if ($susp->load()) {
             $this->__models['suspended'] = $susp;
         }
     }
     $this->__routes[] = 'get<id><edit>';
     $this->__routes[] = 'get<id><fixaddress>';
     return parent::preprocess();
 }
Exemplo n.º 3
0
 public function form_content()
 {
     $ret = '
         <form method="get" action="' . $_SERVER['PHP_SELF'] . '">
         <div class="row">
         <div class="col-sm-4">
             <div class="form-group">
                 <label for="date1">Start Date</label>
                 <input type="text" name="date1" id="date1" 
                     class="form-control date-field" required />
             </div>
             <div class="form-group">
                 <label for="date2">End Date</label>
                 <input type="text" name="date2" id="date2"
                     class="form-control date-field" required />
             </div>
             <div class="panel panel-default">
                 <div class="panel panel-heading">List Subtotals for some Inactive account reasons</div>
                 <div class="panel panel-body">';
     $reasons = new ReasoncodesModel($this->connection);
     foreach ($reasons->find('textStr') as $r) {
         $ret .= sprintf('<p><label>
             <input type="checkbox" name="reasons[]" value="%d" />
             %s</label></p>', $r->mask(), $r->textStr());
     }
     $ret .= '   </div>
             </div>
         </div>
         <div class="col-sm-5">
             ' . FormLib::dateRangePicker() . '
         </div>
         </div>
         <p><button type="submit" class="btn btn-default">Get Report</button></p>
         </form>';
     return $ret;
 }
Exemplo n.º 4
0
    function form_content()
    {
        $dbc = $this->connection;
        $dbc->selectDB($this->config->get('OP_DB'));
        $codes = new ReasoncodesModel($dbc);
        ob_start();
        ?>
<form method = "get" action="<?php 
        echo $_SERVER['PHP_SELF'];
        ?>
">
<div class="col-sm-4">
    <div class="form-group"> 
        <label>Reason</label>
        <select name="reason" class="form-control">
            <option value="0">Any Reason</option>
            <?php 
        foreach ($codes->find() as $obj) {
            printf('<option value="%d">%s</option>', $obj->mask(), $obj->textStr());
        }
        ?>
        </select>
    </div>
    <div class="form-group"> 
        <label>Date Start</label>
        <input type=text id=date1 name=date1 required
            class="form-control date-field" />
    </div>
    <div class="form-group"> 
        <label>Date End</label>
        <input type=text id=date2 name=date2 required
            class="form-control date-field" />
    </div>
    <div class="form-group"> 
        <input type="checkbox" name="excel" id="excel" value="xls" />
        <label for="excel">Excel</label>
    </div>
    <div class="form-group"> 
        <button type=submit name=submit value="Submit"
            class="btn btn-default">Submit</button>
        <button type=reset name=reset value="Start Over"
            class="btn btn-default">Start Over</button>
    </div>
</div>
<div class="col-sm-4">
    <?php 
        echo FormLib::date_range_picker();
        ?>
</div>
</form>
<?php 
        return ob_get_clean();
    }
Exemplo n.º 5
0
 public function get_id_view()
 {
     $dbc = FannieDB::getReadOnly($this->config->get('OP_DB'));
     $codes = new ReasoncodesModel($dbc);
     $plan = new EquityPaymentPlansModel($dbc);
     $plan->equityPaymentPlanID($this->id);
     if (!$plan->load()) {
         return '<div class="alert alert-danger">Error: plan does not exist</div>';
     }
     $ret = '<script type="text/javascript">
     function validateBillingCycle()
     {
         var val = $(\'input[name=cycle]\').val();
         if (val.match(/^\\s*\\d+[dDwWmMyY]\\s*$/)) {
             $(\'#billing-cycle-valid\').addClass(\'collapse\');
             return true;
         } else {
             $(\'#billing-cycle-valid\').removeClass(\'collapse\');
             $(\'#billing-cycle-valid\').html(\'<div class="alert alert-danger">Invalid Entry</div>\');
             $(\'input[name=cycle]\').focus();
             return false;
         }
     }
     </script>';
     $ret .= '<form method="post" onsubmit="return validateBillingCycle();">';
     $ret .= sprintf('
         <div class="form-group">
             <label>Name</label>
             <input class="form-control" type="text" name="name" value="%s" />
         </div>', $plan->name());
     $ret .= sprintf('
         <div class="form-group">
             <label>Total Equity Required</label>
             <div class="input-group">
                 <span class="input-group-addon">$</span>
                 <input type="text" class="form-control" name="final" value="%.2f" />
             </div>
         </div>', $plan->finalBalance());
     $ret .= sprintf('
         <div class="form-group">
             <label>Initial Payment</label>
             <div class="input-group">
                 <span class="input-group-addon">$</span>
                 <input type="text" class="form-control" name="initial" value="%.2f" />
             </div>
         </div>', $plan->initialPayment());
     $ret .= sprintf('
         <div class="form-group">
             <label>Recurring Payment</label>
             <div class="input-group">
                 <span class="input-group-addon">$</span>
                 <input type="text" class="form-control" name="recurring" value="%.2f" />
             </div>
         </div>', $plan->recurringPayment());
     $ret .= sprintf('
         <div class="form-group">
             <div id="billing-cycle-valid" class="collapse"></div>
             <label>Billing Cycle %s</label>
             <input class="form-control" type="text" name="cycle" value="%s" onchange="validateBillingCycle();" />
         </div>', \COREPOS\Fannie\API\lib\FannieHelp::toolTip('Enter a number followed by D, W, M, or Y for days, weeks, months, or years'), $plan->billingCycle());
     $ret .= sprintf('<div class="form-group">
         <label>Calculate Next Due Date based on</label>
         <select name="basis" class="form-control">
             <option value="0" %s>Join Date</option>
             <option value="1" %s>Date of Last Equity Payment</option>
         </select>
         </div>', $plan->dueDateBasis() == 0 ? 'selected' : '', $plan->dueDateBasis() == 1 ? 'selected' : '');
     $ret .= sprintf('
         <div class="form-group">
             <label>Overdue Limit (in days)</label>
             <input class="form-control" type="text" name="overdue" value="%d" />
         </div>', $plan->overDueLimit());
     $ret .= '<div class="form-group">
         <label>Reason Label for Overdue Accounts</label>
         <select class="form-control" name="reason">';
     $ret .= $codes->toOptions($plan->reasonMask());
     $ret .= '</select></div>';
     $ret .= sprintf('<input type="hidden" name="id" value="%d" />', $plan->equityPaymentPlanID());
     $ret .= '<p><button type="submit" class="btn btn-default">Save Plan</button></p>
         </form>';
     return $ret;
 }
Exemplo n.º 6
0
 protected function get_id_view()
 {
     global $FANNIE_OP_DB, $FANNIE_URL;
     $dbc = FannieDB::get($FANNIE_OP_DB);
     $limitedEdit = $this->auth_mode == 'Full' ? False : True;
     ob_start();
     echo '<form action="PIMemberPage.php" ';
     if (FormLib::get_form_value('edit', False) === False) {
         echo 'method="get">';
     } else {
         echo 'method="post">';
     }
     echo '<input type="hidden" name="id" value="' . $this->card_no . '" />';
     echo "<table>";
     echo "<tr>";
     echo "<td class=\"greenbg yellowtxt\">Owner Num</td>";
     echo "<td class=\"greenbg yellowtxt\">" . $this->card_no . "</td>";
     $status = $this->account['activeStatus'];
     if ($status == '') {
         $status = $this->account['memberStatus'];
     }
     switch ($status) {
         case 'PC':
             $status = 'ACTIVE';
             break;
         case 'REG':
             $status = 'NONMEM';
             break;
         case 'INACT2':
             $status = 'TERM (PENDING)';
             break;
     }
     if (isset($this->__models['suspended'])) {
         echo "<td bgcolor='#cc66cc'>{$status}</td>";
         echo "<td colspan=1>";
         if ($this->__models['suspended']->reason() != '') {
             echo $this->__models['suspended']->reason();
         } else {
             $reasons = new ReasoncodesModel($dbc);
             foreach ($reasons->find('mask') as $r) {
                 if (((int) $r->mask() & (int) $this->__models['suspended']->reasoncode()) != 0) {
                     echo $r->textStr() . ' ';
                 }
             }
         }
         echo '</td>';
     } else {
         echo "<td>{$status}</td>";
     }
     echo "<td colspan=2><a href=PISuspensionPage.php?id=" . $this->card_no . ">History</a>";
     if ($this->auth_mode == 'Full') {
         echo '&nbsp;&nbsp;&nbsp;<a href="PISuspensionPage.php?edit=1&id=' . $this->card_no . '">Change Status</a>';
     } else {
         if ($this->auth_mode == 'Limited' && isset($this->__models['suspended']) && $this->__models['suspended']->reasoncode() == 16) {
             echo '&nbsp;&nbsp;&nbsp;<a href="PISuspensionPage.php?fixaddress=1&id=' . $this->card_no . '"
             onclick="return confirm(\'Address is correct?\');">Address Corrected</a>';
         }
     }
     echo '</td>';
     echo "<td><a href=\"{$FANNIE_URL}ordering/clearinghouse.php?card_no=" . $this->card_no . "\">Special Orders</a></td>";
     if (FannieAuth::validateUserQuiet('GiveUsMoney')) {
         echo "<td><a href=\"{$FANNIE_URL}modules/plugins2.0/GiveUsMoneyPlugin/GumMainPage.php?id=" . $this->card_no . "\">Owner Loans</a></td>";
     }
     echo "</tr>";
     echo "<tr>";
     echo '<input type="hidden" name="customerID" value="' . $this->primary_customer['customerID'] . '" />';
     echo "<td class=\"yellowbg\">First Name: </td>";
     echo '<td>' . $this->text_or_field('FirstName', $this->primary_customer['firstName']) . '</td>';
     echo "<td class=\"yellowbg\">Last Name: </td>";
     echo '<td>' . $this->text_or_field('LastName', $this->primary_customer['lastName']) . '</td>';
     echo '</tr>';
     echo "<tr>";
     echo "<td class=\"yellowbg\">Address1: </td>";
     echo '<td>' . $this->text_or_field('address1', $this->account['addressFirstLine']) . '</td>';
     echo "<td class=\"yellowbg\">Gets mailings: </td>";
     echo '<td>' . $this->text_or_select('mailflag', $this->account['contactAllowed'], array(1, 0), array('Yes', 'No')) . '</td>';
     echo "</tr>";
     echo "<tr>";
     echo "<td class=\"yellowbg\">Address2: </td>";
     echo '<td>' . $this->text_or_field('address2', $this->account['addressSecondLine']) . '</td>';
     echo "<td class=\"yellowbg\">UPC: </td>";
     echo '<td colspan=\\"2\\">' . $this->text_or_field('upc', $this->account['idCardUPC']) . '</td>';
     echo "</tr>";
     echo "<tr>";
     echo "<td class=\"yellowbg\">City: </td>";
     echo '<td>' . $this->text_or_field('city', $this->account['city']) . '</td>';
     echo "<td class=\"yellowbg\">State: </td>";
     echo '<td>' . $this->text_or_field('state', $this->account['state']) . '</td>';
     echo "<td class=\"yellowbg\">Zip: </td>";
     echo '<td>' . $this->text_or_field('zip', $this->account['zip']) . '</td>';
     echo "</tr>";
     echo "<tr>";
     echo "<td class=\"yellowbg\">Phone Number: </td>";
     echo '<td>' . $this->text_or_field('phone', $this->primary_customer['phone']) . '</td>';
     echo "<td class=\"yellowbg\">Start Date: </td>";
     $start = $this->account['startDate'];
     if (strstr($start, ' ') !== False) {
         list($start, $junk) = explode(' ', $start, 2);
     }
     if ($start == '1900-01-01') {
         echo '<input type="hidden" name="nonBlankStart" value="' . $start . '" />';
     }
     if ($start == '1900-01-01' || $start == '0000-00-00') {
         $start = '';
     }
     echo '<td>' . $this->text_or_field('start_date', $start, array(), $limitedEdit) . '</td>';
     echo "<td class=\"yellowbg\">End Date: </td>";
     $end = $this->account['endDate'];
     if (strstr($end, ' ') !== False) {
         list($end, $junk) = explode(' ', $end, 2);
     }
     if ($end == '1900-01-01' || $end == '0000-00-00') {
         $end = '';
     }
     echo '<td>' . $this->text_or_field('end_date', $end, array(), $limitedEdit) . '</td>';
     echo "</tr>";
     echo "<tr>";
     echo "<td class=\"yellowbg\">Alt. Phone: </td>";
     echo '<td>' . $this->text_or_field('phone2', $this->primary_customer['altPhone']) . '</td>';
     echo "<td class=\"yellowbg\">E-mail: </td>";
     echo '<td>' . $this->text_or_field('email', $this->primary_customer['email']) . '</td>';
     echo "</tr>";
     echo "<tr>";
     echo "<td class=\"yellowbg\">Stock Purchased: </td>";
     echo "<td>" . sprintf('%.2f', $this->__models['equity']->payments()) . '</td>';
     echo "<td class=\"yellowbg\">Mem Type: </td>";
     $labels = array();
     $opts = array();
     $memtypes = new MemtypeModel($dbc);
     foreach ($memtypes->find('memtype') as $mt) {
         $labels[] = $mt->memDesc();
         $opts[] = $mt->memtype();
     }
     echo '<td>' . $this->text_or_select('memType', $this->account['customerTypeID'], $opts, $labels, array(), $limitedEdit) . '</td>';
     echo "<td class=\"yellowbg\">Discount: </td>";
     echo '<td>' . $this->primary_customer['discount'] . '</td>';
     echo "</tr>";
     echo "<tr>";
     echo "<td class=\"yellowbg\">Charge Limit: </td>";
     echo '<td>' . $this->text_or_field('chargelimit', $this->account['chargeLimit'], array(), $limitedEdit) . '</td>';
     echo "<td class=\"yellowbg\">Current Balance: </td>";
     echo '<td>' . sprintf('%.2f', $this->__models['ar']->balance()) . '</td>';
     echo "</tr>";
     echo "<tr class=\"yellowbg\"><td colspan=6></td></tr>";
     echo "<tr>";
     echo '<td colspan="2" class="greenbg yellowtxt">Additional household members</td>';
     echo '<td></td>';
     echo '<td class="greenbg yellowtxt">Additional Notes</td>';
     echo "<td><a href=PINoteHistoryPage.php?id=" . $this->card_no . ">Notes history</a></td>";
     echo "</tr>";
     echo "<tr>";
     echo '<td></td>';
     echo '<td class="yellowbg">First Name</td>';
     echo '<td class="yellowbg">Last Name</td>';
     echo "<td colspan=4 width=\"300px\" valign=\"top\" rowspan=8>";
     echo $this->text_or_area('notetext', $this->__models['note'], array('rows' => 7, 'cols' => 50), 2);
     echo "</td>";
     echo '</tr>';
     $i = 0;
     foreach ($this->account['customers'] as $c) {
         if ($c['accountHolder']) {
             continue;
         }
         echo '<tr>';
         echo '<td class="yellowbg">' . ($i + 1) . '</td>';
         echo '<td>' . $this->text_or_field('fn[]', $c['firstName']) . '</td>';
         echo '<td>' . $this->text_or_field('ln[]', $c['lastName']) . '</td>';
         echo '<input type="hidden" name="hhID[]" value="' . $c['customerID'] . '" />';
         $i++;
     }
     for ($i; $i < 3; $i++) {
         echo '<tr>';
         echo '<td class="yellowbg">' . ($i + 1) . '</td>';
         echo '<td>' . $this->text_or_field('fn[]', '') . '</td>';
         echo '<td>' . $this->text_or_field('ln[]', '') . '</td>';
         echo '<input type="hidden" name="hhID[]" value="0" />';
     }
     echo '</tr>';
     echo '<tr>';
     echo '<td colspan="3">';
     if (FormLib::get_form_value('edit', False) === False) {
         if ($this->current_user) {
             echo '<input type="hidden" name="edit" />';
             echo '<input type="submit" value="Edit Member" />';
         } else {
             echo '<input type="hidden" name="login" />';
             echo '<input type="submit" value="Log In" />';
         }
         echo '&nbsp;&nbsp;';
         echo '<a href="PIMemberPage.php?id=' . ($this->card_no - 1) . '">Prev Mem</a>';
         echo '&nbsp;&nbsp;';
         echo '<a href="PIMemberPage.php?id=' . ($this->card_no + 1) . '">Next Mem</a>';
     } else {
         echo '<input type="submit" value="Save Member" />';
     }
     echo '</td>';
     echo '</tr>';
     echo "</table>";
     return ob_get_clean();
 }