Example #1
0
 public function testEditCustomer()
 {
     Client::Update(2, 'Alex Mbaka', '0727596600', '*****@*****.**', 'Suite 602, Marafique Arcade. Kenyatta Avenue');
     $client = Client::GetClient(2);
     $this->assertInstanceOf('Client', $client);
     $this->assertTrue($client->telephone == '0727596600');
 }
Example #2
0
    public static function MinorWorksReceipts()
    {
        $client = Client::GetClient($_GET['sid']);
        //, $_GET['period'], $_GET['all']
        echo '
				<div class="logo">
				  <h5 style="margin-bottom:-15px;margin-top:0px;font-size:14px;">Date: ' . date('d/m/Y') . '</h5>
				  <h4>MINOR WORKS PAYMENTS FOR ' . $client->name . '</h4>';
        /*if ($_GET['period'] != '' && $_GET['period'] ) {
        			echo '<h5 style="margin-top:-10px">Period: '.$_GET['period'].'</h5>';
        		}	*/
        echo '</div>';
        $payments = ReceiptVoucher::GetWorksReceipts($_GET['sid']);
        echo '<h5>RECEIVED PAYMENTS</h5>
					<table class="table table-bordered table-striped" style="text-align:center;margin-left:0;margin-right:0;width:760px;font-size:12px;">
			      <thead class="title">
			        <tr>
			          <td>REC. NO</td>
			          <td>DATE</td>
			          <td>AMOUNT</td>
			          <td>VOUCHER</td>
			          <td>DESCRIPTION</td>			  
			        </tr>
			      </thead>
			      <tbody>';
        $amount = 0.0;
        if (count($payments) > 0) {
            foreach ($payments as $payment) {
                echo '<tr>
					    <td>' . $payment['id'] . '</td>
					    <td>' . $payment['datetime'] . '</td>
					    <td><script>document.writeln((' . $payment['amount'] . ').formatMoney(2, \'.\', \',\'));</script></td>
					    <td>' . $payment['voucher_no'] . '</td>
					    <td>' . $payment['description'] . '</td>					    
					   </tr>';
                $amount += $payment['amount'];
            }
        }
        echo '</tbody>
			    </table>
			    <div class="logo">
			    <h5 style="margin: 5px 0 0 5px;float:right">Total Received: <b>Ksh. <script>document.writeln((' . $amount . ').formatMoney(2, \'.\', \',\'));</script></b></h5>				    
			   </div>';
    }
Example #3
0
 public function getClient($id)
 {
     if ($this->validateAdmin()) {
         echo json_encode(Client::GetClient($id));
     } else {
         echo 0;
     }
 }
Example #4
0
 function __construct($id, $clientid, $name, $type, $serial, $parcel, $details, $status, $lastUpdated, $timestamp, $file, $thumbnail)
 {
     $this->id = $id;
     $this->client = Client::GetClient($clientid);
     $this->name = $name;
     $this->type = DocumentType::Get($type);
     $this->serial = $serial;
     $this->parcel = $parcel;
     $this->details = $details;
     $this->status = $status;
     $this->lastUpdated = $lastUpdated;
     $this->timestamp = $timestamp;
     $this->file = $file;
     $this->thumbnail = $thumbnail;
 }
Example #5
0
 public function generateQuote($clientid, $items)
 {
     $client = Client::GetClient($clientid);
     $quotation = Quotation::CreateQuotation($client);
     foreach ($items as $item) {
         $ql = QuotationLine::Create($quotation->id, $item['service'], $item['task'], $item['qty'], $item['price'], $item['tax']);
         $quotation->addToQuote($ql);
     }
     if ($quotation->generate()) {
         echo 1;
     } else {
         echo 0;
     }
 }
 public static function RaiseSalesArrearsInvoice($clientId, $amount)
 {
     $client = Client::GetClient($clientId);
     $descr = "Sales balance B/F";
     $pid = 0;
     $discount = 0;
     $quotes = null;
     $invoice = Invoice::CreateInvoice($client, $pid, $quotes, $descr, $discount);
     $invoice->addToInvoice(InvoiceLine::Create($invoice->id, 'Balances brought forward', 'System migration', 1, $amount->amount, 0));
     if ($invoice->generate()) {
         return new InvoiceTX($invoice, 'Sales Balance B/F Invoice');
     } else {
         Logger::Log('InvoiceTX', 'Failed', 'Sales balance B/F invoice transaction with id:' . $invoice->id . ' and tx id:' . $this->transactionId . ' could not be completed');
         return false;
     }
 }
Example #7
0
 public function setClient($id)
 {
     $this->party = Client::GetClient($id);
 }
Example #8
0
 public static function GenerateCashCreditNote($clientid, $invoice, $credit, $description)
 {
     $client = Client::GetClient($clientid);
     $description = 'Credit Note (Inv: ' . $invoice . ') - ' . $description;
     $inv = SalesInvoice::GetInvoice($invoice);
     if ($inv->total->amount < $inv->credit->amount + $credit) {
         return false;
     }
     $crnote = CreditNote::CreateCashCreditNote($client, $invoice, $credit, $description);
     if ($crnote->generate()) {
         return new SalesTX($crnote, 'Credit Note');
     } else {
         Logger::Log('SalesTX', 'Failed', 'Credit Note transaction with id:' . $crnote->id . ' and tx id:' . $this->transactionId . ' could not be completed');
         return false;
     }
 }
Example #9
0
 public function testFileReport()
 {
     $client = Client::GetClient(2);
     $projects = Project::GetAll($client->id);
     $project = $projects[0];
     $pactivs = $project->getActivities();
     $pactiv = $pactivs[0];
     $tasks = $pactiv->id;
     $pactiv = $pactivs[1];
     $tasks += ', ' . $pactiv->id;
     $emp1 = Employee::GetClient(3);
     $personell = $emp1->id;
     $emp2 = Employee::GetClient(4);
     $personell += $emp2->id;
     $expvoucher = ExpenseVoucher::CreateEmpty();
     $expvoucher->addExpense('descr', 'expense account id', 'amount');
     $expvoucher->addExpense('descr', 'expense account id', 'amount');
     $project->fileReport($tasks, $personell, 'action report', $expvoucher->id);
 }