Exemplo n.º 1
0
*
* License:
*	 GPL v3 or above
*
* Website:
* 	http://www.simpleinvoices.org
*/
#table
//stop the direct browsing to this file - let index.php handle which files get displayed
checkLogin();
#get the invoice id
$master_invoice_id = $_GET['id'];
$invoice = getInvoice($master_invoice_id);
$invoiceItems = invoice::getInvoiceItems($master_invoice_id);
//var_dump($invoiceItems);
$customers = getActiveCustomers();
$preference = getPreference($invoice['preference_id']);
$billers = getActiveBillers();
//$taxes = getActiveTaxes(); <--- look into this
$defaults = getSystemDefaults();
$taxes = getTaxes();
$preferences = getActivePreferences();
$products = getActiveProducts();
for ($i = 1; $i <= 4; $i++) {
    $customFields[$i] = show_custom_field("invoice_cf{$i}", $invoice["custom_field{$i}"], "write", '', "details_screen", '', '', '');
}
$smarty->assign("invoice", $invoice);
$smarty->assign("defaults", $defaults);
$smarty->assign("invoiceItems", $invoiceItems);
$smarty->assign("customers", $customers);
$smarty->assign("preference", $preference);
Exemplo n.º 2
0
     echo "<li class='stat-count'><span style='font-size:12px;'>" . substr(implode("", getMostUsers("descr")), 0, 29) . "...</span><span>Most User's Customer</span></li>";
 } else {
     echo "<li class='stat-count'><span>" . substr(implode("", getMostUsers("descr")), 0, 23) . "...</span><span>Most User's Customer</span></li>";
 }
 $usernum = "SUBSTRING_INDEX(SUBSTRING_INDEX(dbserial, '-', 2), '-', -1)";
 echo "                <li class='stat-percent'><span class='text-success stat-percent'>" . implode("", getMostUsers("{$usernum}")) . "</span></li>\r\n                    </ul>\r\n                  </div>\r\n                </div>\r\n                <div class='span3 '>\r\n                    <div class='stat-block'>\r\n                        <ul>";
 if (strlen(implode("", getLongestCust("descr"))) > 10) {
     echo "<li class='stat-count'><span style='font-size:12px;'>" . substr(implode("", getLongestCust("descr")), 0, 29) . "...</span><span>Services from " . implode("", getLongestCust("updatefrom")) . "</span></li>";
 } else {
     echo "<li class='stat-count'><span>" . substr(implode("", getLongestCust("descr")), 0, 23) . "...</span><span>Services from</span></li>";
 }
 echo "                  <li class='stat-percent'><span class='text-success stat-percent'>" . (implode("", getLongestCust("updateto")) - implode("", getLongestCust("updatefrom"))) . "</span></li>\r\n                        </ul>\r\n                    </div>\r\n                </div>\r\n            </div>\r\n            <div class='row-fluid'>\r\n                <div class='span9'>";
 $this->beginWidget('zii.widgets.CPortlet', array('title' => '<span class="icon-picture"></span>Operations Chart', 'titleCssClass' => ''));
 echo "          <div>\r\n                        <canvas id='canvas' height='275' width='1030'></canvas>\r\n                    </div>";
 $this->endWidget();
 echo "      </div>\r\n                <div class='span3'>\r\n                    <div class='summary'>\r\n                        <ul>\r\n                            <li>\r\n                                <span class='summary-icon'>\r\n                                <img src='" . $baseUrl . "/img/credit.png' width='36' height='36' alt='Monthly Income'>\r\n                                </span>\r\n                                <span class='summary-number'>" . (implode("", getActiveCustomers()) + implode("", getActiveContracts())) . "</span>\r\n                                <span class='summary-title'> Active Services</span>\r\n                            </li>\r\n                            <li>\r\n                                <span class='summary-icon'>\r\n                                        <img src='" . $baseUrl . "/img/page_white_edit.png' width='36' height='36' alt='Open Invoices'>\r\n                                </span>\r\n                                <span class='summary-number'>" . implode("", getActiveContracts()) . "</span>\r\n                                <span class='summary-title'> Open Contracts</span>\r\n                            </li>\r\n                            <li>\r\n                                <span class='summary-icon'>\r\n                                        <img src='" . $baseUrl . "/img/page_white_excel.png' width='36' height='36' alt='Open Quotes<'>\r\n                                </span>\r\n                                <span class='summary-number'>" . implode("", getActiveCustomers()) . "</span>\r\n                                <span class='summary-title'> Active Customers</span>\r\n                            </li>\r\n                            <li>\r\n                                <span class='summary-icon'>\r\n                                        <img src='" . $baseUrl . "/img/group.png' width='36' height='36' alt='Active Members'>\r\n                                </span>\r\n                                <span class='summary-number'>" . implode("", getTotalUsers()) . "</span>\r\n                                <span class='summary-title'> Active Members</span>\r\n                            </li>\r\n                            <li>\r\n                                <span class='summary-icon'>\r\n                                        <img src='" . $baseUrl . "/img/folder_page.png' width='36' height='36' alt='Recent Conversions'>\r\n                                </span>\r\n                                <span class='summary-number'>" . implode("", getAllCustomers()) . "</span>\r\n                                <span class='summary-title'> Total Customers</span>\r\n                            </li>\r\n                        </ul>\r\n                    </div>\r\n                </div>\r\n            </div>\r\n            <div class='row-fluid'>\r\n                <div class='span6'>";
 $this->beginWidget('zii.widgets.CPortlet', array('title' => '<span class="icon-th-list"></span>Major customers with most users'));
 $dataProvider1 = new CActiveDataProvider('AlmabCustomers', array('criteria' => array('condition' => 'descr IS NOT NULL', 'order' => 'cast(SUBSTRING_INDEX(SUBSTRING_INDEX(dbserial, "-", 2), "-", -1)AS UNSIGNED) DESC'), 'pagination' => array('pageSize' => 20)));
 $this->widget('zii.widgets.grid.CGridView', array('id' => 'megaloi pelates', 'htmlOptions' => array('class' => 'table table-striped table-bordered table-condensed'), 'dataProvider' => $dataProvider1, 'template' => "{items}", 'columns' => array(array('name' => 'id', 'value' => 'CHtml::link($data->id,Yii::app()->createUrl("AlmabCustomers/view",array("id"=>$data->primaryKey)))', 'type' => 'raw'), array('name' => 'Customer Name', 'value' => '$data->descr'), 'email', array('name' => 'Expire', 'value' => 'date("M j, Y", strtotime($data->updateto))'), array('name' => 'Version', 'value' => 'substr($data->dbserial, 0, -20)'))));
 $this->endWidget();
 echo "      </div>\r\n                <div class='span6'>";
 $this->beginWidget('zii.widgets.CPortlet', array('title' => '<span class="icon-th-list"></span>Expiring customer service'));
 $dataProvider2 = new CActiveDataProvider('AlmabCustomers', array('criteria' => array('condition' => 'updateto>NOW()', 'order' => 'updateto'), 'pagination' => array('pageSize' => 20)));
 $this->widget('zii.widgets.grid.CGridView', array('htmlOptions' => array('class' => 'table table-striped table-bordered table-condensed'), 'dataProvider' => $dataProvider2, 'template' => "{items}", 'columns' => array(array('name' => 'id', 'value' => 'CHtml::link($data->id,Yii::app()->createUrl("AlmabCustomers/view",array("id"=>$data->primaryKey)))', 'type' => 'raw'), array('name' => 'Customer Name', 'value' => '$data->descr'), 'email', array('name' => 'Expire', 'value' => 'date("M j, Y", strtotime($data->updateto))'), array('name' => 'Version', 'value' => 'substr($data->dbserial, 0, -20)'))));
 $this->endWidget();
 echo "      </div>\r\n            </div>\r\n            <div class='row-fluid'>\r\n                <div class='span6'>";
 $this->beginWidget('zii.widgets.CPortlet', array('title' => '<span class="icon-th-large"></span>Product Sales', 'titleCssClass' => ''));
 echo "          <div id='canvas-holder'>\r\n                        <canvas id='chart-area1' width='500' height='500'/>\r\n                    </div>";
 $this->endWidget();
 echo "      </div>\r\n                <div class='span6'>";
 $this->beginWidget('zii.widgets.CPortlet', array('title' => '<span class="icon-th-list"></span>Active Product Sales', 'titleCssClass' => ''));
Exemplo n.º 3
0
//stop the direct browsing to this file - let index.php handle which files get displayed
checkLogin();
#get the invoice id
$customer_id = $_GET['id'];
$customer = getCustomer($customer_id);
$customer['wording_for_enabled'] = $customer['enabled'] == 1 ? $LANG['enabled'] : $LANG['disabled'];
$sub_customers = getSubCustomers($customer_id);
//TODO: Perhaps possible a bit nicer?
$stuff = null;
$stuff['total'] = calc_customer_total($customer['id']);
#amount paid calc - start
$stuff['paid'] = calc_customer_paid($customer['id']);
#amount paid calc - end
#amount owing calc - start
$stuff['owing'] = $stuff['total'] - $stuff['paid'];
#get custom field labels
$customFieldLabel = getCustomFieldLabels();
$invoices = getCustomerInvoices($customer_id);
$parent_customers = getActiveCustomers();
$smarty->assign('parent_customers', $parent_customers);
//$customFieldLabel = getCustomFieldLabels("biller");
$smarty->assign("stuff", $stuff);
$smarty->assign('customer', $customer);
$smarty->assign('sub_customers', $sub_customers);
$smarty->assign('invoices', $invoices);
$smarty->assign('customFieldLabel', $customFieldLabel);
$smarty->assign('pageActive', 'customer');
$subPageActive = $_GET['action'] == "view" ? "customer_view" : "customer_edit";
$smarty->assign('subPageActive', $subPageActive);
$smarty->assign('pageActive', 'customer');
$smarty->assign('active_tab', '#people');
Exemplo n.º 4
0
        $ActiveCustomers = Yii::app()->db->createCommand()->select(array('count(*)'))->from('almab_customers')->where('updateto > NOW()')->queryRow();
        return $ActiveCustomers;
    }
    //Inactive Customers
    function getInactiveCustomers()
    {
        $InactiveCustomers = Yii::app()->db->createCommand()->select(array('count(*)'))->from('almab_customers')->where('updateto < NOW()')->queryRow();
        return $InactiveCustomers;
    }
    //Users
    function getTotalUsers()
    {
        $TotalUsers = Yii::app()->db->createCommand()->select(array('sum(SUBSTRING_INDEX(SUBSTRING_INDEX(dbserial, "-", 2), "-", -1))'))->from('almab_customers')->where('descr IS NOT NULL')->queryRow();
        return $TotalUsers;
    }
    echo "<table class='table table-striped table-bordered'>\r\n                <tbody>\r\n                  <tr>\r\n                    <td width='50%'>Bandwith Usage</td>\r\n                    <td>\r\n                      <div class='progress progress-danger'>\r\n                        <div class='bar' style='width: " . $speed * 100 / 4 . "%'></div>\r\n                      </div>\r\n                    </td>\r\n                  </tr>\r\n                  <tr>\r\n                    <td>Disk Space</td>\r\n                    <td>\r\n                      <div class='progress progress-warning'>\r\n                        <div class='bar' style='width: " . $df * 100 / $ds . "%'></div>\r\n                      </div>\r\n                    </td>\r\n                  </tr>\r\n                  <tr>\r\n                    <td>Memory Usage</td>\r\n                    <td>\r\n                      <div class='progress progress-success'>\r\n                        <div class='bar' style='width: " . $memuse * 100 / 128 . "%'></div>\r\n                      </div>\r\n                    </td>\r\n                  </tr>\r\n                  <tr>\r\n                    <td>CPU load</td>\r\n                    <td>\r\n                      <div class='progress progress-info'>\r\n                        <div class='bar' style='width: " . get_server_cpu_usage() . "%'></div>\r\n                      </div>\r\n                    </td>\r\n                  </tr>\r\n                </tbody>\r\n              </table>     \r\n\t<div class='well'>\r\n                <dl class='dl-horizontal'>\r\n                  <dt>Total Customers</dt>\r\n                  <dd>" . implode("", getAllCustomers()) . "</dd>\r\n                  <dt>Ongoing Services</dt>\r\n                  <dd>" . implode("", getActiveCustomers()) . "</dd>\r\n                  <dt>Overdue Services</dt>\r\n                  <dd>" . implode("", getInactiveCustomers()) . "</dd>\r\n                  <dt>Total Users</dt>\r\n                  <dd>" . implode("", getTotalUsers()) . "</dd>\r\n                </dl>\r\n            </div>";
}
?>
    </div><!--/span-->
    <div <?php 
Yii::app()->user->isSuperuser ? print 'class="span9"' : (print '');
?>
>
    
    <?php 
if (isset($this->breadcrumbs)) {
    ?>
		<?php 
    $this->widget('zii.widgets.CBreadcrumbs', array('links' => $this->breadcrumbs, 'homeLink' => CHtml::link('Dashboard', Yii::app()->homeUrl), 'htmlOptions' => array('class' => 'breadcrumb')));
    ?>
<!-- breadcrumbs -->