Example #1
0
 private function getStatementOfWork(&$ticket)
 {
     $data = "<div class='row-fluid'>";
     $sow = $this->query("SELECT * from sows WHERE ticket_id='{$ticket['id']}'")[0];
     if (!$sow) {
         $sdata .= "<h5>No Statement of Work Found</h5>\n\t\t\t\t\t<p>A statement of work is a quote for work to be completed. The statement of work can be used as an invoice for clients who require an invoice before payment is made. aTikit generated invoices generally\n\t\t\t\t\tafter a payment has been made, therefore this system allows clients to have the proper paperwork in order to process payment on their end.</p>";
     } else {
         // Get SOW Details
         if (!$sow['sow_accepted']) {
             $sdata .= base::alert('warning', 'Statement Pending', "This statement of work has not been approved.");
         }
         $items = [];
         $items[] = ['label' => 'Created/Updated:', 'content' => $this->fbTime($sow['sow_updated'])];
         $items[] = ['label' => 'Created By', 'content' => $this->getUserByID($sow['sow_updatedby'])];
         if ($sow['sow_accepted']) {
             $items[] = ['label' => 'Accepted On:', 'content' => $this->fbTime($sow['sow_acceptts'])];
             $items[] = ['label' => 'Accepted By:', 'content' => $this->getUserById($sow['sow_acceptuid'])];
             $sdata .= base::alert("success", "Statement Accepted", "The client has accepted this statement of work and you can begin work.");
         }
         $sdata .= base::itemPairs($items);
     }
     $items = $this->decode($sow['sow_meta']);
     if (!is_array($items)) {
         $items = [];
     }
     $headers = ['Description', 'Price', 'QTY', 'Ext. Price'];
     $rows = [];
     $ttl = 0;
     foreach ($items as $ix => $item) {
         $del = $this->isProvidingCompany() ? " &nbsp;&nbsp; <a class='get' href='/sow/remove/{$sow['id']}/{$ix}/'><i class='icon-remove'></i></a>" : null;
         $rows[] = [$item['desc'] . $del, "\$" . number_format($item['price'], 2), $item['qty'], "\$" . number_format($item['extprice'], 2)];
         $ttl += $item['extprice'];
     }
     $rows[] = [null, null, "<span class='pull-right'><b>Total:</span>", "<b>\$" . number_format($ttl, 2) . "</b>", 'blue'];
     $table = table::init()->headers($headers)->rows($rows)->id('sowTable')->render();
     $modifyButton = null;
     if ($this->isProvidingCompany()) {
         $modifyButton .= button::init()->text('Add to Statement')->icon('edit')->isModalLauncher()->url('#addSOW')->addStyle('btn-warning')->render();
         $saveStatement = button::init()->text('Add Item')->icon('ok')->formid('addSOWForm')->addStyle('btn-primary')->addStyle('mpost')->postVar('addSOWItem')->id($ticket['id'])->message('Updating Statement of Work')->render();
         $this->exportModal(modal::init()->id('addSOW')->header('Update Statement of Work')->content($this->addStatementForm($sow))->footer($saveStatement)->render());
     }
     $loc = "/download/sow/{$sow['id']}/";
     $modifyButton .= button::init()->text("Download Statement")->icon('arrow-down')->url($loc)->addStyle('btn-success')->render();
     if ($this->isProvidingCompany()) {
         $sendNow = button::init()->addStyle('btn-danger')->addStyle('get')->text('Send Statement to Client')->url("/send/{$ticket['id']}/")->render();
     }
     $resendButton = button::init()->addStyle('btn-success')->addStyle('get')->text('Re-Send Statement to Client')->url("/send/{$ticket['id']}/")->render();
     $sowSent = $sow['sow_sent'] ? base::alert("success", "Statement Sent", "This statement of work has been sent to the customer.<br/>{$resendButton}", true) : base::alert("error", "Statement has not been E-mailed", "This statement has not been sent to the client.<br/>{$sendNow}", true);
     $header = $sow['sow_title'] ? $sow['sow_title'] : 'Modify Statement of Work';
     if (!$sow || !$this->isProvidingCompany()) {
         $sowSent = null;
     }
     $data .= widget::init()->span(8)->icon('cogs')->header($header)->rightHeader($modifyButton)->content($table)->footer($sowSent)->render();
     $data .= widget::init()->span(4)->icon('share')->header('Statement Status')->content($sdata)->render();
     $data .= "</div>";
     return $data;
 }
Example #2
0
 private function dwollaMain()
 {
     // Do we have an authorized Dwolla Account? If no, then display a hero-like unit with two options. Create Account or Authorize Your Account
     if (!$this->company->company_dwollatoken) {
         return $this->dwollaAuthorizeOrCreate();
     }
     $myid = $this->company->id;
     $Dwolla = new DwollaRestClient($this->getSetting('dwolla_app_key'), $this->getSetting('dwolla_app_secret'), $this->getSetting('atikit_url') . "dwauth/{$myid}/");
     $Dwolla->setToken($this->company->company_dwollatoken);
     // Create a list of Funding Sources and an Add Button
     $fundingSources = $Dwolla->fundingSources();
     $rows = [];
     foreach ($fundingSources as $source) {
         $color = $source['Verified'] ? "green" : "red";
         $verified = $source['Verified'] ? "Yes" : "No";
         $row = [$source['Name'], $source['Type'], $verified, $color];
         $rows[] = $row;
     }
     $headers = ['Source Name', 'Type', 'Verified'];
     $table = table::init()->headers($headers)->rows($rows)->render();
     $add = button::init()->text("Add Bank Account")->isModalLauncher()->addStyle('btn-info')->icon('plus')->url('#addAccount')->render();
     $saveAccount = button::init()->text("Save Account")->addStyle('mpost')->icon('ok')->addStyle('btn-success')->postVar('addAccount')->formid('addAccountForm')->render();
     $this->exportModal(modal::init()->id('addAccount')->header("Add Bank Account to Dwolla")->content($this->addBankAccountForm())->footer($saveAccount)->render());
     $table .= base::alert('info', "Removing Accounts", "If you wish to remove your bank account from Dwolla, you must login to dwolla.com and remove.");
     return widget::init()->header('Funding Sources')->content($table)->span(8)->rightHeader($add)->isTable()->render();
 }