예제 #1
0
    public static function PurchaseInvoices()
    {
        $collection = PurchaseInvoice::GetAllInvoices($_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>ALL PURCHASE INVOICES</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>GRN NO</td>
			          <td>INV NO</td>
			          <td>COMPANY</td>
					  <td>TOTAL</td>
			        </tr>
			      </thead>
			      <tbody>';
        $total = 0.0;
        $itms = 0;
        foreach ($collection as $item) {
            $party = Supplier::GetSupplier($item['party_id']);
            echo '<tr>
			      <td>' . $item['date'] . '</td>
			      <td>' . $item['id'] . '</td>
			      <td>' . $item['invno'] . '</td>
			      <td>' . $party->name . '</td>
				<td class="text-right" style="padding: 0 5px;"><script>document.writeln((' . $item['total'] . ').formatMoney(2, \'.\', \',\'));</script></td>
			    </tr>';
            $total += $item['total'];
            ++$itms;
        }
        echo '</tbody>
			    </table>
			    <div class="logo">
			    	<p style="margin: 5px 0 0 5px">Total Invoices: <b>' . $itms . '</b></p>
					<p style="margin: 5px 0 0 5px">Total Invoiced: <b>Ksh. <script>document.writeln((' . $total . ').formatMoney(2, \'.\', \',\'));</script></b></p>
				</div>';
    }
예제 #2
0
 public function setSupplier($id)
 {
     $this->party = Supplier::GetSupplier($id);
 }
예제 #3
0
    public static function MakePayment($party, $scope, $supplierid, $amount, $ledgerId, $mode, $voucher, $descr)
    {
        try {
            $supplier = Supplier::GetSupplier($supplierid);
            $grns = "";
            /*foreach ($payments as $key => $payment) {
            			$grns .= $key.",";
            		}*/
            $descr .= ' (' . $voucher . ')';
            $sql = 'INSERT INTO payments (party_id, grns, amount, ledger_id, mode, voucher_no, description, status) VALUES 
			(' . $supplierid . ', "' . $grns . '", ' . $amount . ', ' . $ledgerId . ', "' . $mode . '", "' . $voucher . '", "' . $descr . '", 0)';
            DatabaseHandler::Execute($sql);
            $sql2 = 'SELECT * FROM payments WHERE party_id = ' . $supplierid . ' ORDER BY id DESC LIMIT 0,1';
            $res = DatabaseHandler::GetRow($sql2);
            $acc = Account::GetAccountByNo($supplierid, 'suppliers', 'Creditors');
            $expv = ExpenseVoucher::CreateSupplierProjectExpense($party, $scope, $amount, $acc->ledgerId, $voucher, $descr);
            if ($expv) {
                $tx = self::initialize($res);
                $tx->expVoucher = $expv;
                return $tx;
            } else {
                return false;
            }
            return self::initialize($res);
        } catch (Exception $e) {
        }
    }
예제 #4
0
 public function generatePurchaseOrder($supplierid, $date, $items)
 {
     $supplier = Supplier::GetSupplier($supplierid);
     $order = PurchaseOrder::CreateOrder($supplier, $date);
     foreach ($items as $item) {
         $ql = PurchaseOrderLine::Create($order->id, $item['item'], $item['qty'], $item['price']);
         $order->addToOrder($ql);
     }
     $voucher = $order->generate();
     if ($voucher) {
         echo json_encode($voucher);
     } else {
         echo 0;
     }
 }