public static function PayrollSummary() { $payroll = Payroll::PreviewPayroll($_GET['month']); echo ' <div class="logo"> <h5 style="margin-bottom:-15px;margin-top:0px;font-size:14px;">Date: ' . date('d/m/Y') . '</h5> <h4>PAYROLL SUMMARY</h4> <h5 style="margin-top:-10px">Month: ' . $_GET['month'] . '</h5> </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>NAME</td> <td>ROLE</td> <td>BASIC SALARY</td> <td>ADDITIONS</td> <td>DEDUCTIONS</td> <td>NET PAY</td> </tr> </thead> <tbody>'; $totsalary = 0.0; $totadd = 0.0; $totded = 0.0; $totnet = 0.0; foreach ($payroll->slips as $slip) { echo '<tr> <td style="width:90px">' . $slip->employee->name . '</td> <td style="width: 100px">' . $slip->employee->position . ' [Department: ' . $slip->employee->department . ']</td> <td style="width: 100px"><script>document.writeln((' . $slip->salary . ').formatMoney(2, \'.\', \',\'));</script></td> <td style="width: 100px"><script>document.writeln((' . $slip->t_additions . ').formatMoney(2, \'.\', \',\'));</script></td> <td style="width: 100px"><script>document.writeln((' . $slip->t_deductions . ').formatMoney(2, \'.\', \',\'));</script></td> <td style="width: 100px"><script>document.writeln((' . $slip->netpay . ').formatMoney(2, \'.\', \',\'));</script></td> </tr>'; $totsalary += $slip->salary; $totadd += $slip->t_additions; $totded += $slip->t_deductions; $totnet += $slip->netpay; } echo '</tbody> <tfoot> <tr> <td></td> <td>TOTALS:</td> <td><script>document.writeln((' . $totsalary . ').formatMoney(2, \'.\', \',\'));</script></td> <td><script>document.writeln((' . $totadd . ').formatMoney(2, \'.\', \',\'));</script></td> <td><script>document.writeln((' . $totded . ').formatMoney(2, \'.\', \',\'));</script></td> <td><script>document.writeln((' . $totnet . ').formatMoney(2, \'.\', \',\'));</script></td> </tr> </tfoot> </table> <div class="logo"> <p style="margin: 5px 0 0 5px">Total Payable for ' . $_GET['month'] . ': <b>Ksh. <script>document.writeln((' . $totnet . ').formatMoney(2, \'.\', \',\'));</script></b></p> </div>'; }
public function createUserPayrollDetails() { $all = Input::all(); $pay = Payroll::where('user_id', '=', $all['user_id']); if (count($pay->get()) > 0) { $pay->update($all); } else { Payroll::create($all); } return Response::jsend('success', 'Users Payroll successfully created.'); }
public function paySalary($empid, $slipid, $ledger, $mode, $voucher, $amount) { $tx = Payroll::PaySalary($empid, $slipid, $ledger, $mode, $voucher, $amount); $voucher = $tx->post(); if ($voucher) { echo json_encode($voucher); } else { echo 0; } }
/** * Display the specified branch. * * @param int $id * @return Response */ public function show($id) { $payroll = Payroll::findOrFail($id); return View::make('payroll.show', compact('payroll')); }
function getPayrolls($start, $end) { $companyid = getCompanyID(); $conn = Doctrine_Manager::connection(); $query = "SELECT * FROM payroll AS p where p.`companyid` = '" . $companyid . "' AND MONTH(p.startdate) = MONTH('" . $start . "') "; // debugMessage($query); $result = $conn->fetchRow($query); if (!$result) { $payroll = new Payroll(); $result = $payroll->toArray(); } // debugMessage($result); return $result; }
<?php namespace inviqa; require "../vendor/autoload.php"; $aOptions = getopt("", array("s:", "f:", "o:")); // Get the starting date $iStartDate = (array_key_exists("s", $aOptions) and strtotime($aOptions["s"])) ? strtotime($aOptions["s"]) : strtotime("first day of this month"); // Get the end date $iEndData = (array_key_exists("f", $aOptions) and strtotime($aOptions["f"])) ? strtotime($aOptions["f"]) : strtotime("+11 months", $iStartDate); // Get the output file name $sOutputFilename = (array_key_exists("o", $aOptions) and strlen($aOptions["o"]) > 0) ? $aOptions["o"] : "output"; // Generate the pay data $oPayroll = new Payroll(); $aDates = $oPayroll->generate($iStartDate, $iEndData); // Output the data in the required format $oOutput = new Output\Csv(); if ($oOutput->output($aDates, $sOutputFilename)) { echo "Success" . PHP_EOL; }
public function withdraw($id) { $payroll = Payroll::find($id); $payroll->taken = 1; $payroll->save(); }
public function issuepayslipsAction() { $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(TRUE); $session = SessionWrapper::getInstance(); $formvalues = $this->_getAllParams(); // debugMessage($formvalues); exit; $config = Zend_Registry::get("config"); // generate the payslips silently via ajax $payroll = new Payroll(); $payroll->populate($this->_getParam('id')); $employees = $payroll->getdetails(); // debugMessage($employees->toArray()); foreach ($employees as $employee) { if ($employee->getIsIgnored() != 1 && $employee->getNetPay() > 0) { // ignore users who are skipped on payroll or have 0 netpay $payrolldetailid = $employee->getID(); $path = $employee->getPDFPath(); $pdfurl = $this->view->serverUrl($this->view->baseUrl('user/view/id/' . encode($employee->getUserID()) . '/tab/payment/payrollid/' . $payrolldetailid . '/ref/view/print/1/pgc/1/payslipview/1/pdf/1/source/payroll')); // debugMessage($pdfurl); $pdfresult = trim(file_get_contents($pdfurl)); $html = decode($pdfresult); // debugMessage($html); // exit; if (!isEmptyString($html)) { try { $mpdfpath = BASE_PATH . DIRECTORY_SEPARATOR . 'application' . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'mpdf' . DIRECTORY_SEPARATOR . 'mpdf.php'; // debugMessage('pdf '.$mpdfpath); ini_set('memory_limit', '128M'); require_once $mpdfpath; // ob_get_clean(); $mpdf = new mPDF('win-1252', 'A4', '', '', 20, 15, 40, 20, 10, 10); $mpdf->useOnlyCoreFonts = true; // false is default $mpdf->SetProtection(array('print')); $mpdf->SetTitle("Payslip - " . $employee->getUser()->Name()); $mpdf->SetAuthor(getAppName()); $mpdf->SetWatermarkText(getCompanyName()); $mpdf->showWatermarkText = true; $mpdf->watermark_font = 'DejaVuSansCondensed'; $mpdf->watermarkTextAlpha = 0.1; $mpdf->SetDisplayMode('fullpage'); $mpdf->WriteHTML($html); $mpdf->Output($path); // $mpdf->Output($employee->getPDFName().'.pdf', 'I'); } catch (Exception $e) { debugMessage('error ' . $e->getMessage()); } if (file_exists($path)) { debugMessage('pdf ' . $employee->getPDFName() . ' created '); // $employee->afterPayslipGeneration(); } else { debugMessage('pdf missing'); } } } } $session->setVar("issuepayslips", '0'); // reset flag for determining if payslips are sent }
public function deleteAction() { $this->_setParam("action", ACTION_DELETE); $session = SessionWrapper::getInstance(); $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(TRUE); $formvalues = $this->_getAllParams(); // debugMessage($formvalues); // exit; $successurl = decode($formvalues[URL_SUCCESS]); if (!isArrayKeyAnEmptyString(SUCCESS_MESSAGE, $formvalues)) { $successmessage = decode($formvalues[SUCCESS_MESSAGE]); } // debugMessage($successurl); $payroll = new Payroll(); $id = is_numeric($formvalues['id']) ? $formvalues['id'] : decode($formvalues['id']); // debugMessage($id); $payroll->populate($id); debugMessage($payroll->toArray()); $deletetrxns = $payroll->getLedgerDeleteTrxns(); if ($deletetrxns->count() > 0) { $deletetrxns->delete(); } /* debugMessage($payroll->getLedgerDeleteTrxns()->toArray()); exit(); */ if ($payroll->delete()) { $session->setVar(SUCCESS_MESSAGE, $this->_translate->translate("global_delete_success")); $successmessage = $this->_getParam(SUCCESS_MESSAGE); if (!isEmptyString($successmessage)) { $session->setVar(SUCCESS_MESSAGE, $successmessage); } } $this->_helper->redirector->gotoUrl($successurl); }
<?php require_once "../../php/appUtil.php"; include_once "PayrollClassLib.php"; if (!isset($_SESSION['token'])) { session_start(); } $db = Database::getInstance(); $connect = $db->getConnection(); $userId = $_SESSION['token']; $data = json_decode($_GET["details"]); $operationObject = new Payroll(); switch ($data->operation) { case 'createYear': $connect->beginTransaction(); $status = $operationObject->createYear($data, $userId); if ($status == 1) { $connect->commit(); echo AppUtil::getReturnStatus("success", "Year Created Successfully...!!!"); } else { if ($status == 0) { $connect->rollBack(); echo AppUtil::getReturnStatus("failure", "Could Not Create Year"); } else { echo AppUtil::getReturnStatus("failure", "Year with Same Date Range Already Exist"); } } break; case "getCurrentYearHolidayDetails": $operationObject->getCurrentYearHolidayDetails(); break;
public static function CommitPayroll($month) { $payroll = new Payroll($month); $employees = Employee::GetAllEmployees(); foreach ($employees as $employee) { $slip = new PaySlip($employee, $month); try { $d = explode('/', $month); $ustamp = $d[1] . $d[0] . '31239999' + 1; $lstamp = $d[1] . $d[0] . '00999999' + 1; self::PostSalary($employee->id, $employee->salary->amount, $month); self::RecoverAdvance($employee->id, $month); //stamp >= '.$lstamp.' AND stamp <= '.$ustamp.' $sql = 'SELECT * FROM payroll_entries WHERE party_id = ' . $employee->id . ' AND status <> 2 AND type <> "Salary Payment" ORDER BY type ASC, id DESC'; $entries = DatabaseHandler::GetAll($sql); foreach ($entries as $entry) { if ($entry['type'] != 'Basic Salary') { $slip->includeEntry($entry['type'], $entry['effect'], $entry['amount']); } $sql = 'UPDATE payroll_entries SET status = 2, month = "' . $month . '" WHERE id = ' . $entry['id']; DatabaseHandler::Execute($sql); } } catch (Exception $e) { //Logger::Log('Payroll', 'Failed', 'Allowance for employee id: '.$employee->id.' for '.$month.'could not be posted'); return false; } $slip->compile(); $slip->commit(); $payroll->addPayslip($slip); } $payroll->setStatus('COMMITED'); return $payroll; }