Exemple #1
0
    public static function ClaimsPerEmployee()
    {
        $statement = FinancialStatements::LedgerStatement($_GET['sid'], $_GET['period'], $_GET['all']);
        $ledger = Account::GetLedger($_GET['sid']);
        echo '
				<div class="logo">
				  <h5 style="margin-bottom:-15px;margin-top:0px;font-size:14px;">Date: ' . date('d/m/Y') . '</h5>
				  <h4 style="text-transform:uppercase">' . $ledger->ledgerName . ' LEDGER STATEMENT</h4>';
        if ($_GET['period'] != '' && $_GET['period']) {
            echo '<h5 style="margin-top:-10px">Period: ' . $_GET['period'] . '</h5>';
        }
        echo '</div>

				<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>DATE</td>
			          <td>TX ID</td>
			          <td>DR</td>
			          <td>CR</td>
			          <td>DESCRIPTION</td>
			          <td>BALANCE</td>
			        </tr>
			      </thead>
			      <tbody>';
        $cr = 0.0;
        $dr = 0.0;
        foreach ($statement as $item) {
            echo '<tr>
			      <td style="width:90px">' . $item['when_booked'] . '</td>
			      <td style="width: 100px">' . $item['transaction_id'] . '</td>';
            if ($item['effect'] == 'cr') {
                $cr += $item['amount'];
                echo '<td style="width: 100px"></td>
			      	<td style="width: 100px"><script>document.writeln((' . $item['amount'] . ').formatMoney(2, \'.\', \',\'));</script></td>';
            } else {
                $dr += $item['amount'];
                echo '<td style="width: 100px"><script>document.writeln((' . $item['amount'] . ').formatMoney(2, \'.\', \',\'));</script></td>
			      	<td style="width: 100px"></td>';
            }
            echo '<td style="max-width: 220px;">' . $item['description'] . '</td>
			      <td class="text-right" style="padding: 0 5px;"><script>document.writeln((' . $item['balance'] . ').formatMoney(2, \'.\', \',\'));</script></td>
			    </tr>';
        }
        echo '</tbody>
			    </table>
			    <div class="logo">
				    <p style="margin: 5px 0 0 5px">Total Debits: <b>Ksh. <script>document.writeln((' . $dr . ').formatMoney(2, \'.\', \',\'));</script></b></p>
				    <p style="margin: 5px 0 0 5px">Total Credits: <b>Ksh. <script>document.writeln((' . $cr . ').formatMoney(2, \'.\', \',\'));</script></b></p>			    
				    <p style="margin: 5px 0 0 5px">Balance: <b>Ksh. <script>document.writeln((' . ($dr - $cr) . ').formatMoney(2, \'.\', \',\'));</script></b></p>
				</div>';
    }
Exemple #2
0
 private function prepare()
 {
     if ($this->transactionType->name == 'General Purchase Invoice' || $this->transactionType->name == 'Purchase Order Invoice') {
         $this->transactionType->drAccounts = [];
         $this->transactionType->drRatios = [];
         foreach ($this->invoice->lineItems as $invoiceLine) {
             $amount = $invoiceLine->quantity * $invoiceLine->unitPrice;
             $taxamt = $amount * ($invoiceLine->tax / 100);
             $discamt = ($amount + $taxamt) * ($invoiceLine->discount / 100);
             $lineTotal = $amount + $taxamt - $discamt;
             $this->transactionType->drAccounts[] = Account::GetLedger($invoiceLine->ledgerId);
             $this->transactionType->drRatios[] = floatval($lineTotal / $this->amount->amount);
             Logger::Log(get_class($this), 'Test', 'Credit: ' . $this->amount->amount . ', Ratio:' . floatval($lineTotal / $this->amount->amount));
         }
     }
     for ($i = 0; $i < count($this->transactionType->drAccounts); $i++) {
         $amount = new Money(floatval($this->amount->amount * $this->transactionType->drRatios[$i]), $this->amount->unit);
         $this->add(new AccountEntry($this, $this->transactionType->drAccounts[$i], $amount, $this->date, 'dr'));
     }
     for ($i = 0; $i < count($this->transactionType->crAccounts); $i++) {
         $amount = new Money(floatval($this->amount->amount * $this->transactionType->crRatios[$i]), $this->amount->unit);
         $this->add(new AccountEntry($this, $this->transactionType->crAccounts[$i], $amount, $this->date, 'cr'));
     }
     return true;
 }
Exemple #3
0
 function __construct($ledgerId, $clientId)
 {
     parent::__construct("Sales Receipt");
     $this->drAccounts[] = Account::GetLedger($ledgerId);
     $this->drRatios[] = 1;
     $this->crAccounts[] = Account::GetAccountByNo($clientId, 'clients', 'Debtors');
     $this->crRatios[] = 1;
     //this info should originate from the database, insert ignore protocol included
     //$this->code = self::GetCode('PayPal');
     //parent::__construct();
 }
 private function prepare()
 {
     foreach ($this->txentries as $entry) {
         if ($entry['effect'] == 'dr') {
             $amount = new Money(floatval($entry['amount']), $this->amount->unit);
             $this->add(new AccountEntry($this, Account::GetLedger($entry['lid']), $amount, $this->date, 'dr'));
         } else {
             if ($entry['effect'] == 'cr') {
                 $amount = new Money(floatval($entry['amount']), $this->amount->unit);
                 $this->add(new AccountEntry($this, Account::GetLedger($entry['lid']), $amount, $this->date, 'cr'));
             }
         }
     }
     return true;
 }
Exemple #5
0
 function __construct($ledgerId, $employeeId, $type)
 {
     parent::__construct("Employee Benefit - " . $type);
     $this->drAccounts[] = Account::GetAccountByNo($employeeId, 'employees', 'PAYROLL');
     $this->drRatios[] = 1;
     $this->crAccounts[] = Account::GetLedger($ledgerId);
     $this->crRatios[] = 1;
 }