示例#1
0
    public function footer()
    {
        echo '
				<div class="invfoot">
			      <div class="signature">
			        <p>Report Pulled By: <b>' . SessionManager::GetUsername() . '</b></p>
			      </div>
			      <div class="row" style="line-height:13px;font-size:10px;border-top: 2px solid #e4e4e4;padding-top:5px">
			        <div class="col-md-4 text-left">Copyright © ' . date('Y') . ' ' . $this->company->name . '</div>
			        <div class="col-md-8 text-right">Momentum ERP by <br><a href="#">QET Systems Ltd</a> [www.qet.co.ke]
			      </div> 
			    </div>			    
			   </div>
			  </div>
			</div>
			</div>
			<script type="text/javascript">
			  //window.print();
			  //window.onfocus=function(){ window.close();}
			</script>
			</body>
			</html>';
    }
示例#2
0
 public function update()
 {
     try {
         $sql = 'UPDATE payments SET cashier = "' . SessionManager::GetUsername() . '", datetime = "' . $this->date . '", stamp = ' . $this->stamp . ' WHERE id = ' . $this->id;
         DatabaseHandler::Execute($sql);
         return true;
     } catch (Exception $e) {
         return false;
     }
 }
示例#3
0
 function __construct($id, $txTypeName, $txId, $amount, $description, $date, $stamp)
 {
     $this->id = $id;
     $this->type = $txTypeName;
     $this->transactionId = $txId;
     $this->amount = $amount;
     $this->description = $description;
     $this->date = $date;
     $this->stamp = $stamp;
     $this->user = SessionManager::GetUsername();
 }
 function __construct($quoteId, $date, $clientId, $amount, $tax, $total, $user)
 {
     $this->id = $quoteId;
     $this->transactionId = $quoteId;
     $this->date = $date;
     $this->type = 'Quotation';
     $this->party = Client::GetClient($clientId);
     $this->amount = floatval($amount);
     $this->tax = floatval($tax);
     $this->total = floatval($total);
     $this->description = 'Quotation for ' . $this->party->name;
     if (is_null($user)) {
         $this->user = SessionManager::GetUsername();
     } else {
         $this->user = $user;
     }
     $this->lineItems = QuotationLine::GetQuoteItems($quoteId);
 }
示例#5
0
    public static function RecoverAdvance($empid, $month)
    {
        try {
            $employee = Employee::GetEmployee(intval($empid));
            $descr = "Advance recovered from " . $month . " salary.";
            //$d = explode('/', $date);
            //$month = $d[1].'/'.$d[2];
            $sql2 = 'SELECT * FROM advances_and_loans WHERE party_id = ' . $empid . ' and type = "Salary Advance" ORDER BY id DESC LIMIT 0,1';
            $entry = DatabaseHandler::GetRow($sql2);
            if (!empty($entry)) {
                $amount = $entry['balance'];
            } else {
                $amount = 0.0;
            }
            $amount = floatval($amount);
            if ($amount != 0.0) {
                $ledger = Account::GetAccount('PAYROLL');
                $sql = 'INSERT INTO advances_and_loans (party_id, month, type, effect, amount, ledger_id, balance, description) VALUES 
				(' . $employee->id . ', "' . $month . '", "Salary Advance", "cr", ' . $amount . ', ' . $ledger->ledgerId . ', 0.00, "Advance recovered from ' . $month . ' salary.")';
                DatabaseHandler::Execute($sql);
                $sqlb = 'SELECT * FROM payroll_entries WHERE party_id = ' . $empid . ' ORDER BY id DESC LIMIT 0,1';
                $latest = DatabaseHandler::GetRow($sqlb);
                $ladgerac = Account::GetAccount('LOANS AND ADVANCES');
                $sqla = 'INSERT INTO payroll_entries (party_id, month, type, effect, amount, ledger_id,description) VALUES 
				(' . $employee->id . ', "' . $month . '", "Salary Advance", "dr", ' . $amount . ', ' . $ladgerac->ledgerId . ', "Salary Advance for ' . $month . '.")';
                DatabaseHandler::Execute($sqla);
                $sql2 = 'SELECT * FROM payroll_entries WHERE party_id = ' . $empid . ' ORDER BY id DESC LIMIT 0,1';
                $entry = DatabaseHandler::GetRow($sql2);
                Logger::Log('Payroll', 'Passed', 'Salary advance for employee id: ' . $employee->id . ' for ' . $month . ' recovered');
                //return new PayrollTX($payment, 'Salary Payment');
                $txtype = AdvancesAndLoans::Recover($ledger->ledgerId, 'Advance Recovery');
                $tx = PayrollTX::Initialize($entry, $txtype, 'payroll_entries');
                $tx->post();
                $sql = 'UPDATE advances_and_loans SET tx_id = ' . $tx->transactionId . ', user = "******", datetime = "' . $tx->date . '", stamp = ' . $tx->stamp . ' WHERE id = ' . $latest['id'];
                DatabaseHandler::Execute($sql);
            } else {
            }
        } catch (Exception $e) {
            Logger::Log('Payroll', 'Failed', 'Salary advance for employee id: ' . $employee->id . ' for ' . $month . ' could not be recovered');
        }
    }