/** * Update currencies. * * Callback for 'wp_currencies_update' action. * * @since 1.4.0 */ public function update_currencies() { //if ( defined( 'DOING_CRON' ) ) { do_action('wp_currencies_before_update', time()); $rates = new Rates(); $rates->update(); //} }
public function actionAdd() { if (Yii::app()->request->isPostRequest) { $rate = new Rates(); $rate->comment_id = (int) Yii::app()->request->getParam('comment_id'); $rate->rate = (int) Yii::app()->request->getParam('rate'); if ($rate->save()) { echo $rate->getRate($rate->comment_id); } else { echo 'error'; } } else { throw new CHttpException(400, 'Invalid request. Please do not repeat this request again.'); } }
public function doRefreshRates() { $valCur = array('USD' => 840, 'EUR' => 978, 'RUB' => 643); $idVal = Input::get('id'); $valCurrency = Input::get('currency'); $client = new RatesClient("Currency"); $client->call("getCurrencyRate", array("type" => 0, "currencyId" => $valCur[$valCurrency])); $client->getCurrencyRateParse(); $client->call("getCurrencyRate", array("type" => 1, "currencyId" => $valCur[$valCurrency])); $alfaBuy = $client->getCurrencyRateParse(); $client->call("getCurrencyRate", array("type" => 2, "currencyId" => $valCur[$valCurrency])); $alfaSale = $client->getCurrencyRateParse(); if ($alfaBuy > 0 && $alfaSale > 0) { $ratesOld = Rates::where('id', $idVal)->get(); foreach ($ratesOld as $rate) { $saleOld = $rate->sale; $buyOld = $rate->buy; $updateTime = $rate->updated_at; } $saleInequality = $alfaSale - $saleOld; $buyInequality = $alfaBuy - $buyOld; if (date('Y-m-d', strtotime($updateTime)) != date('Y-m-d')) { $ratesNew = Rates::where('id', $idVal)->update(array('sale_old' => round($saleOld, 2), 'buy_old' => round($buyOld, 2), 'sale_inequality' => round($saleInequality, 2), 'buy_inequality' => round($buyInequality, 2), 'sale' => round($alfaSale, 2), 'buy' => round($alfaBuy, 2))); } if ($ratesNew == "1") { return Response::json(array('status' => true)); } } else { return Response::json(array('status' => false)); } }
public function fire() { $valCur = array('6' => 840, '9' => 978, '4' => 643); foreach ($valCur as $key => $value) { $client = new RatesClient("Currency"); $client->call("getCurrencyRate", array("type" => 0, "currencyId" => $value)); $client->getCurrencyRateParse(); $client->call("getCurrencyRate", array("type" => 1, "currencyId" => $value)); $alfaBuy = $client->getCurrencyRateParse(); $client->call("getCurrencyRate", array("type" => 2, "currencyId" => $value)); $alfaSale = $client->getCurrencyRateParse(); if ($alfaBuy > 0 && $alfaSale > 0) { $ratesOld = Rates::where('id', $key)->get(); foreach ($ratesOld as $rate) { $saleOld = $rate->sale; $buyOld = $rate->buy; $updateTime = $rate->updated_at; } $saleInequality = round($alfaSale, 2) - round($saleOld, 2); $buyInequality = round($alfaBuy, 2) - round($buyOld, 2); if (date('Y-m-d', strtotime($updateTime)) != date('Y-m-d')) { Rates::where('id', $key)->update(array('sale_old' => round($saleOld, 2), 'buy_old' => round($buyOld, 2), 'sale_inequality' => round($saleInequality, 2), 'buy_inequality' => round($buyInequality, 2), 'sale' => round($alfaSale, 2), 'buy' => round($alfaBuy, 2))); } } } }
public static function displayRates() { require_once GSPLUGINPATH . 'rates/rates.class.php'; $text = '<div class="rates">'; $rates = new Rates(); $categories = $rates->getRates(); foreach ($categories as $category) { $text .= self::addCategory($category); $nrates = count($category["rates"]); foreach ($category["rates"] as $rate) { $lastRate = !--$nrates; $odd = $nrates % 2 == 0; $text .= self::addRate($rate, $lastRate, $odd); } } $text .= '</div>'; echo $text; }
return $html; } ///////////////////////////////////////// ///////////// AJAX METHODS ///////////// ///////////// /////////////////////////// public function load_rates_async() { $data = $_POST; $resp = new ajax_response($data['action'], true); $resp->set_status(true); $resp->set_data(array('loadable_content' => $this->get_all_rates())); echo $resp->encode_response(); die; } public function update_rates() { $data = $_POST; $resp = new ajax_response($data['action'], true); if ($data['hotel_id'] != null) { $hotel = new Hotel((int) $data['hotel_id']); if ($hotel instanceof Hotel) { $result = $hotel->save_rate_data($data); $result ? $resp->set_status(true) : ''; } } echo $resp->encode_response(); die; } } $rates = new Rates(); $rates->init_actions();
$rate = $columns[0]->plaintext; $buy = $columns[3]->plaintext; $sell = $columns[2]->plaintext; if ($this->db->get_count($this->_table_rate, array('bank' => $bank_name, 'name' => $rate, 'last_update' => $last_update)) == 0) { $data = array('bank' => $bank_name, 'last_update' => $last_update, 'name' => $rate, 'sell' => $sell, 'buy' => $buy); $this->db->insert($this->_table_rate, $data); echo 'Insert ' . $rate . ' for ' . $bank_name . ' ' . $last_update . PHP_EOL; } $i++; } //update last update $bank_last_update = array('last_update' => $last_update); echo 'Update bank ' . $bank_name . ' last update for ' . $last_update . PHP_EOL; if ($this->db->get_count($this->_table_bank, array('bank' => $bank_name))) { $this->db->update($this->_table_bank, $bank_last_update, array('bank' => $bank_name)); } else { $bank_last_update['bank'] = $bank_name; $this->db->insert($this->_table_bank, $bank_last_update); } } } echo 'Calling script...' . PHP_EOL; $run = new Rates(); $run->get_bca_rates(); $run->get_mandiri_rates(); $run->get_bni_rates(); $run->get_bri_rates(); /* * filename : rates.php * location: /rates.php */
function getVote($comment, $user) { $vote = Rates::model()->find('comment_id=:comment and user_id=:user', array(':comment' => $comment, ':user' => $user)); return $vote->rate; }
function jo_preview($office_id = '', $period = '') { $this->Employee->fields = array('id', 'employee_id', 'office_id', 'lname', 'fname', 'mname', 'tax_status', 'dependents'); $this->Employee->employment_type = 4; $rows = $this->Employee->get_employee_list($office_id, ''); $o = new Office_m(); $o->get_by_office_id($office_id); $disbursing_officer = $o->disbursing_officer; $str = $o->office_name; if (strlen($str) % 2 == 1) { $str .= ' '; } $length = strlen($str) / 2; $arr2 = str_split($str, $length); $office_page1 = $arr2[0]; $office_page2 = $arr2[1]; list($month, $day1, $day2, $year) = explode("-", $period); $month_name = $this->Helps->get_month_name($month); $period_text = 'For the Month of ' . $month_name . ' ' . $day1 . '-' . $day2 . ', ' . $year; if (strlen($period_text) % 2 == 1) { $period_text .= ' '; } $length = strlen($period_text) / 2; $period_text_arr = str_split($period_text, $length); $period_page1 = $period_text_arr[0]; $period_page2 = $period_text_arr[1]; $agency_accountant = Setting::getField('agency_accountant'); $agency_accountant_position = Setting::getField('agency_accountant_position'); $head_of_office = Setting::getField('head_of_office'); $head_of_office_position = Setting::getField('head_of_office_position'); $heading = '<table width="100%" border="0"> <tr> <td> </td> <td> </td> <td> </td> <td align="right"></td> <td> </td> <td align="right"><H1>DAILY WAGE PAY</H1></td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td align="right"> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td align="right">' . strtoupper($office_page1) . '</td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td align="right"><strong>' . $period_page1 . '</strong></td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td align="right"> </td> </tr> <tr> <td colspan="6" style="font-size:11px">We acknowledge receipt of the sum shown opposite our names as full compensation for the services rendered for the period stated.</td> </tr> </table>'; $page = ' <table width="100%" border="1"> <tr> <td width="3%" rowspan="3" align="center" valign="middle"><strong>No.</strong></td> <td width="45%" rowspan="3" align="center" valign="middle"><strong>NAME</strong></td> <td width="19%" rowspan="3" align="center" valign="middle"><strong>TIN</strong></td> <td width="12%" rowspan="3" align="center" valign="middle"><strong>Tax Exemption</strong></td> <td width="12%" rowspan="3" align="center" valign="middle"><strong>Rate per Day</strong></td> <td width="6%" rowspan="3" align="center" valign="middle"><strong>Rate per Hour</strong></td> <td width="3%"> </td> </tr> <tr> <td> </td> </tr> <tr> <td> </td> </tr>'; $grand_total_salary = 0; $grand_total_amount_due = 0; $deduction = 0; $p = new Personal_m(); $r = new Rates(); $j = new Jo_days(); $n = 1; foreach ($rows as $row) { $p->get_by_employee_id($row['id']); $r->get_by_employee_id($row['employee_id']); $j->where('employee_id', $row['employee_id']); $j->where('period', $period); $j->get(); $total_salary = $r->rate_per_day * $j->days; $grand_total_salary += $total_salary; $total_amount_due = $total_salary - $deduction; $grand_total_amount_due += $total_amount_due; $tax_status = $row['tax_status'] != 'Single' ? 'ME' . $row['dependents'] : 'S'; $page .= '<tr> <td>' . $n . '</td> <td>' . strtoupper($row['lname']) . ', ' . $row['fname'] . ' ' . $row['mname'] . '</td> <td>' . $p->tin . '</td> <td>' . $tax_status . '</td> <td align="right">' . number_format($r->rate_per_day, 2) . '</td> <td> </td> <td> </td> </tr>'; $n++; } $page .= '<tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td><strong>TOTAL</strong></td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> </table> <table width="100%" border="1"> <tr> <td><table width="100%" border="0"> <tr> <td width="3%"> </td> <td width="64%">CERTIFIED</td> <td width="4%"> </td> <td width="6%"> </td> <td width="4%"> </td> <td width="16%"> </td> <td width="3%"> </td> </tr> <tr> <td> </td> <td colspan="6">Each person whose name appears on this roll had rendered services for the time stated</td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td align="center">_______________________</td> <td> </td> </tr> <tr> <td> </td> <td><strong>' . strtoupper($o->office_head) . '</strong></td> <td> </td> <td> </td> <td> </td> <td align="center">Date</td> <td> </td> </tr> <tr> <td> </td> <td colspan="5" style="font-size:11px">' . $o->position . '</td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> </table></td> </tr> </table> <table width="100%" border="1"> <tr> <td><table width="100%"> <tr> <td width="3%"> </td> <td width="35%">CERTIFIED: Funds available in the amount of</td> <td width="33%">' . number_format($grand_total_amount_due, 2) . '</td> <td width="6%"> </td> <td width="4%"> </td> <td width="16%"> </td> <td width="3%"> </td> </tr> <tr> <td> </td> <td colspan="6"> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td align="center"> </td> <td> </td> </tr> <tr> <td> </td> <td align="center"><strong>' . $agency_accountant . '</strong></td> <td> </td> <td> </td> <td> </td> <td align="center">_______________________</td> <td> </td> </tr> <tr> <td> </td> <td align="center">' . $agency_accountant_position . '</td> <td> </td> <td> </td> <td> </td> <td align="center">Date</td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> </table></td> </tr> </table> <pagebreak /> '; $page2 = '<table width="100%" border="0"> <tr> <td><H1>ROLL - JOB ORDER</H1></td> <td> </td> <td> </td> <td align="right"></td> <td> </td> <td align="right"></td> </tr> <tr> <td></td> <td> </td> <td> </td> <td> </td> <td> </td> <td align="right"> </td> </tr> <tr> <td>' . strtoupper($office_page2) . '</td> <td> </td> <td> </td> <td> </td> <td> </td> <td align="right"> </td> </tr> <tr> <td><strong>' . $period_page2 . '</strong></td> <td> </td> <td> </td> <td> </td> <td> </td> <td align="right"> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td align="right"> </td> </tr> <tr> <td colspan="6"> </td> </tr> </table> <table width="100%" border="1"> <tr> <td width="5%" rowspan="3" align="center" valign="middle"><strong>No of Hours</strong></td> <td width="19%" rowspan="3" align="center" valign="middle"><strong>No. of Days with Pay</strong></td> <td width="15%" rowspan="3" align="center" valign="middle"><strong>Total Amount of Salary</strong></td> <td width="7%" rowspan="3" align="center" valign="middle"><strong>Pag-ibig Personal Contribution</strong></td> <td width="10%" rowspan="3" align="center" valign="middle"><strong>Total Deductions</strong></td> <td width="13%" rowspan="3" align="center" valign="middle"><strong>Total Amount Due</strong></td> <td width="5%" rowspan="3" align="center" valign="middle"><strong>No.</strong></td> <td width="20%" rowspan="3" align="center" valign="middle"><strong>SIGNATURE OR THUMBMARK</strong></td> <td width="6%"> </td> </tr> <tr> <td> </td> </tr> <tr> <td> </td> </tr>'; $n = 1; $grand_total_salary = 0; $grand_total_amount_due = 0; $deduction = 0; $j = new Jo_days(); $r = new Rates(); foreach ($rows as $row) { $j->where('employee_id', $row['employee_id']); $j->where('period', $period); $j->get(); $r->get_by_employee_id($row['employee_id']); $total_salary = $r->rate_per_day * $j->days; $grand_total_salary += $total_salary; $deduction = $r->pagibig_amount; $total_amount_due = $total_salary - $deduction; $grand_total_amount_due += $total_amount_due; $page2 .= ' <tr> <td></td> <td align="center">' . $j->days . '</td> <td align="right">' . number_format($total_salary, 2) . '</td> <td>' . $r->pagibig_amount . '</td> <td align="right">' . $deduction . '</td> <td align="right">' . number_format($total_amount_due, 2) . '</td> <td>' . $n . '</td> <td></td> <td> </td> </tr>'; $n++; } $page2 .= ' <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td><strong>TOTAL</strong></td> <td align="right"><strong>' . number_format($grand_total_salary, 2) . '</strong></td> <td> </td> <td> </td> <td align="right"><strong>' . number_format($grand_total_amount_due, 2) . '</strong></td> <td> </td> <td> </td> <td> </td> </tr> </table> <table width="100%" border="1"> <tr> <td><table width="100%" border="0"> <tr> <td width="3%"> </td> <td colspan="2">APPROVED FOR PAYMENT</td> <td width="31%"> </td> <td width="4%"> </td> <td width="16%"> </td> <td width="3%"> </td> </tr> <tr> <td> </td> <td colspan="6"> </td> </tr> <tr> <td> </td> <td width="17%"> </td> <td width="26%"> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td align="center">_______________________</td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td align="center"><strong>' . $head_of_office . '</strong></td> <td> </td> <td> </td> <td align="center">Date</td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td align="center">' . $head_of_office_position . '</td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> </table></td> </tr> </table> <table width="100%" border="1"> <tr> <td><table width="100%" border="0"> <tr> <td width="3%"> </td> <td colspan="6">CERTIFIED: Each person whose name appears on the above rolls has been</td> </tr> <tr> <td> </td> <td colspan="6">paid the amount stated opposite his name after identifying himself</td> </tr> <tr> <td> </td> <td width="17%"> </td> <td width="26%"> </td> <td width="31%"> </td> <td width="4%"> </td> <td width="16%"> </td> <td width="3%"> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td align="center"> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td align="center"><strong>' . $disbursing_officer . '</strong></td> <td> </td> <td> </td> <td align="center">_______________________</td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td align="center">Disbursing Officer</td> <td> </td> <td> </td> <td align="center">Date</td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> </table></td> </tr> </table> '; $html = $heading . $page . $page2; $params = array('format' => 'Legal'); $this->load->library('mpdf', $params); //$mpdf=new mPDF('c','Letter'); $this->mpdf->mirrorMargins = 1; // Use different Odd/Even headers and footers and mirror margins $stylesheet = file_get_contents(base_url() . 'css/mpdf/mpdfstyletables.css'); $this->mpdf->WriteHTML($stylesheet, 1); // The parameter 1 tells that this is css/style only and no $this->mpdf->WriteHTML($html); $this->mpdf->Output(); }
$i = 0; ?> <?php $n = 1; ?> <?php $grand_total_salary = 0; ?> <?php $grand_total_amount_due = 0; ?> <?php $deduction = 0; ?> <?php $r = new Rates(); ?> <?php $p = new Personal_m(); ?> <?php $j = new Jo_days(); ?> <?php foreach ($rows as $row) { ?> <?php $r->get_by_employee_id($row['employee_id']); ?> <?php
function edit_place($mode = '') { if ($mode == 'rates') { $r = new Rates(); $r->where('id', Input::get('rowid')); $r->get(); if (Input::get('colid') == 'rate_per_day') { $r->rate_per_day = Input::get('new'); } if (Input::get('colid') == 'pagibig_amount') { $r->pagibig_amount = Input::get('new'); } $r->save(); exit; } if ($mode == 'jo_days') { $j = new Jo_days(); $j->where('id', Input::get('rowid')); $j->get(); if (Input::get('colid') == 'hours') { $j->hours = Input::get('new'); } if (Input::get('colid') == 'days') { $j->days = Input::get('new'); } $j->save(); exit; } if ($mode == 'status') { $c = new Cos_status(); $c->where('id', Input::get('rowid')); $c->get(); $c->status = Input::get('new'); $c->save(); exit; } }
<?php namespace Clq; require_once GSPLUGINPATH . 'rates/rates.class.php'; require_once GSPLUGINPATH . 'rates/helper.php'; global $SITEURL; $languages = array(); if (function_exists('return_i18n_available_languages')) { $languages = return_i18n_available_languages(); } try { $rates = new Rates(); } catch (\Exception $e) { $msg = $e->getMessage(); } $success = false; $name = @$_GET['name']; if (isset($_POST['save'])) { if ($rates->saveRates()) { $msg = i18n_r('rates/SAVE_SUCCESS'); $success = true; } else { $msg = i18n_r('rates/SAVE_FAILURE'); } } elseif (isset($_POST['load'])) { if ($rates->getRates()) { $success = true; } } if (count($languages) != 0) {
</span> | <span id="<?php echo $comment->attributes['id']; ?> " class="rateDislike <? if($vote == -1) echo 'voted'; ?> "> Dislike </span> <span totalrateid="<?php echo $comment->attributes['id']; ?> " class="rateTotal"> (<?php echo Rates::model()->getRate($comment->attributes['id']); ?> ) </span> </div> <!-- end rate --> <?php } ?> </div> <!-- comment --> <?php }
function rates_register($type, $name, $description, $edit_function, $header_function, $content_function) { require_once GSPLUGINPATH . 'rates/rates.class.php'; return Rates::registerPlugin($type, $name, $description, $edit_function, $header_function, $content_function); }
</table></form> <span id="offices.span"> <table width="100%" border="0" class="type-one" id="offices.table"> <tr class="type-one-header"> <th width="13%" bgcolor="#D6D6D6"><strong>Employee No.</strong></th> <th width="40%" bgcolor="#D6D6D6"><strong>Employee Name</strong></th> <th width="16%" bgcolor="#D6D6D6">Rate per Day</th> <th width="31%" bgcolor="#D6D6D6">Pag-ibig Personal Contribution</th> <th width="31%" bgcolor="#D6D6D6"> </th> </tr> <?php $i = 0; ?> <?php $r = new Rates(); ?> <?php foreach ($rows as $row) { ?> <?php $r->where('employee_id', $row['employee_id']); $r->get(); $onclick0 = "onClick=\"dg_editCell(offices,'" . $r->id . "','rate_per_day','offices.0.{$i}', 'cto_balance')\""; $onclick1 = "onClick=\"dg_editCell(offices,'" . $r->id . "','pagibig_amount','offices.1.{$i}', 'cto_balance')\""; ?> <?php $bg = $this->Helps->set_line_colors(); ?> <tr bgcolor="<?php echo $bg;