function getDataAll($user_id, $from_date, $to_date) { $cur_mod = new Application_Model_DbTable_DbCurrencies(); $usr_mod = new Application_Model_DbTable_DbUsers(); $rsCur = $cur_mod->getCurrencyList(); $rsUser = null; $tmp_summary = null; $return_araray = array(); if ($user_id == -1) { $rsUser = $usr_mod->getUserListSelect(); if (!empty($rsCur)) { $tmp_summary = array(); foreach ($rsCur as $k => $rc) { $cur_type = $rc['symbol']; $bought = $this->sumValue($cur_type, null, "in", $from_date, $to_date); $sale = $this->sumValue($cur_type, null, "out", $from_date, $to_date); $tmp_summary[$k]['saleamount'] = $sale; $tmp_summary[$k]['boughtamount'] = $bought; $tmp_summary[$k]['currncytype'] = $rc['name']; $tmp_summary[$k]['currncysymbol'] = $cur_type; } $return_araray['summary'] = $tmp_summary; } } else { $rsUser = $usr_mod->getUserInfoByfetchAll($user_id); } //print_r($return_araray); exit(); if (!empty($rsUser)) { $tmp_data = array(); $row_index = 0; foreach ($rsUser as $i => $ru) { if (empty($rsCur)) { break; } foreach ($rsCur as $k => $rc) { $cur_type = $rc['symbol']; $bought = $this->sumValue($cur_type, $ru['id'], "in", $from_date, $to_date); $sale = $this->sumValue($cur_type, $ru['id'], "out", $from_date, $to_date); if ($bought != 0 || $sale != 0) { $tmp_data[$row_index]['username'] = $ru['name']; $tmp_data[$row_index]['userid'] = $ru['id']; $tmp_data[$row_index]['saleamount'] = $sale; $tmp_data[$row_index]['boughtamount'] = $bought; $tmp_data[$row_index]['currncytype'] = $rc['name']; $tmp_data[$row_index]['currncysymbol'] = $cur_type; $row_index++; } } } if (!empty($tmp_data)) { $return_araray['data'] = $tmp_data; } } return $return_araray; }
/** * Get curent balance all currncy type by user * @param int $user_id * @return array <number, number, number> */ function getCurrentBallancesByCurrentUser($user_id) { $cur = new Application_Model_DbTable_DbCurrencies(); $cur_type = $cur->getCurrencyList(); $balance = array(); foreach ($cur_type as $i => $t) { if ($t['symbol'] == "\$") { $balance["dollar"] = $this->getCurrentBalanceByUser($user_id, $t['id']); } elseif ($t['symbol'] == "B") { $balance["bath"] = $this->getCurrentBalanceByUser($user_id, $t['id']); } elseif ($t['symbol'] == "R") { $balance["rail"] = $this->getCurrentBalanceByUser($user_id, $t['id']); } } return $balance; }
public function rptPcsAction() { try { $db_tran = new Application_Model_DbTable_Dbpsc(); // create sesesion $from_date = date("Y-m-d"); $to_date = date("Y-m-d"); $type_money = -1; $staff_name = -1; $this->view->from_date = $from_date; $this->view->to_date = $to_date; $this->view->staff = $staff_name; $cur = new Application_Model_DbTable_DbCurrencies(); $this->view->currencylist = $cur->getCurrencyList(); $this->view->type_money = $type_money; if ($this->getRequest()->isPost()) { $formdata = $this->getRequest()->getPost(); $this->view->type_money = $formdata['type_money']; $this->view->staff_name = $formdata['staff_name']; $this->view->from_date = $formdata['from_date']; $this->view->to_date = $formdata['to_date']; } else { $formdata = array('from_date' => $from_date, 'to_date' => $to_date, 'type_money' => $type_money, 'staff_name' => $staff_name); } $trans = $db_tran->countAllStaffpcsAmount($formdata); if (empty($trans)) { $trans = array('err' => 1, 'msg' => 'មិនទាន់មានទន្និន័យនូវឡើយទេ!'); } $this->view->rpt_list = $trans; $this->view->curr_type = $this->curr_typesimble; $usr_mod = new Application_Model_DbTable_DbUsers(); $user_list = $usr_mod->getUserListSelect(); array_unshift($user_list, array('id' => '-1', "name" => "ជ្រើសរើសឈ្មោះបុគ្គលិក")); $this->view->users = $user_list; $session_user = new Zend_Session_Namespace('auth'); $this->view->user_name = $session_user->last_name . ' ' . $session_user->first_name; } catch (Exception $e) { } }
public function indexAction() { try { $db_tran = new Application_Model_DbTable_Dbpsc(); //create sesesion $session_capital = new Zend_Session_Namespace('search_capital'); if (empty($session_capital->limit)) { $session_capital->limit = Application_Form_FrmNavigation::getLimit(); $session_capital->type_money = -1; $session_capital->staff_name = -1; $session_capital->from_date = date('Y-m-d'); $session_capital->to_date = date('Y-m-d'); $session_capital->lock(); } //start page nevigation $limit = $session_capital->limit; $start = $this->getRequest()->getParam('limit_satrt', 0); $this->view->from_date = $session_capital->from_date; $this->view->to_date = $session_capital->to_date; $this->view->staff = $session_capital->staff; $cur = new Application_Model_DbTable_DbCurrencies(); $this->view->currencylist = $cur->getCurrencyList(); $this->view->type_money = $session_capital->type_money; if ($this->getRequest()->isPost()) { $formdata = $this->getRequest()->getPost(); $session_capital->unlock(); $session_capital->limit = $formdata['rows_per_page']; $session_capital->type_money = $formdata['type_money']; $session_capital->staff_name = $formdata['staff_name']; $session_capital->from_date = $formdata['from_date']; $session_capital->to_date = $formdata['to_date']; $session_capital->lock(); $this->view->type_money = $formdata['type_money']; $this->view->staff_name = $formdata['staff_name']; $this->view->from_date = $session_capital->from_date; $this->view->to_date = $session_capital->to_date; $limit = $session_capital->limit; } else { $formdata = array('from_date' => $session_capital->from_date, 'to_date' => $session_capital->to_date, 'type_money' => $session_capital->type_money, 'staff_name' => $session_capital->staff_name); } $trans = $db_tran->getPscAmountListBy($formdata, $start, $limit); $record_count = $db_tran->getAllPscList($formdata); $result = array(); $row_num = $start; if (!empty($trans)) { foreach ($trans as $i => $tran) { $expired = ''; $is_expired = 0; $volum = Application_Model_DbTable_DbGlobal::CurrencyOption($tran['currency_type'], $tran['volum']); $result[$i] = array('num' => ++$row_num, 'id' => $tran['id'], 'staff_name' => $tran['staff_name'], 'currency_type' => $this->curr_type[$tran['currency_type']], 'volum' => number_format($volum) . ' ' . $this->curr_type[$tran['currency_type']], 'psc_amount' => $tran['psc_amount'] . " សន្លឹក", 'total_amount' => number_format($volum * $tran['psc_amount']) . ' ' . $this->curr_type[$tran['currency_type']], 'note' => $tran['note'], 'date' => date_format(date_create($tran['date']), "d/m/Y"), 'img' => $tran['id']); } } else { $result = array('err' => 1, 'msg' => 'មិនទាន់មានទន្និន័យនូវឡើយទេ!'); } $this->view->tranlist = Zend_Json::encode($result); $page = new Application_Form_FrmNavigation(self::REDIRECT_URL, $start, $limit, $record_count); $page->init(self::REDIRECT_URL, $start, $limit, $record_count); $this->view->nevigation = $page->navigationPage(); $this->view->rows_per_page = $page->getRowsPerPage($limit, 'frmlist_mt'); $this->view->result_row = $page->getResultRows(); $usr_mod = new Application_Model_DbTable_DbUsers(); $user_list = $usr_mod->getUserListSelect(); array_unshift($user_list, array('id' => '-1', "name" => "ជ្រើសរើសឈ្មោះបុគ្គលិក")); $this->view->users = $user_list; $session_user = new Zend_Session_Namespace('auth'); $this->view->user_name = $session_user->last_name . ' ' . $session_user->first_name; $db_keycode = new Application_Model_DbTable_DbKeycode(); $this->view->keycode = $db_keycode->getKeyCodeMiniInv(); $this->view->rpt_list = $db_tran->countAllStaffpcsAmount($formdata); $this->view->curr_type = $this->curr_typesimble; } catch (Exception $e) { } }
function getCurrentBallancesByCurrentUser($user_id, $current_date = null) { //total money add capital to agent only $cur = new Application_Model_DbTable_DbCurrencies(); $cur_type = $cur->getCurrencyList(); if ($current_date == null) { $current_date = date('d/m/Y'); } $balance = array(); foreach ($cur_type as $i => $t) { if ($t['symbol'] == "\$") { $balance["dollar"] = $this->getAmountBalanceByUser($user_id, 1, $t['id'], $current_date); } elseif ($t['symbol'] == "B") { $balance["bath"] = $this->getAmountBalanceByUser($user_id, 1, $t['id'], $current_date); } elseif ($t['symbol'] == "R") { $balance["rail"] = $this->getAmountBalanceByUser($user_id, 1, $t['id'], $current_date); } } return $balance; }
public function selectAction() { if ($this->getRequest()->isPost()) { $_data = $this->getRequest()->getPost(); //print_r($_data);exit(); try { $_dbmodel = new Application_Model_DbTable_DbPayment(); $_dbmodel->addTransFound($_data); Application_Form_FrmMessage::Sucessfull('ការបញ្ចូលជោគជ័យ', "/payment/index/index"); } catch (Exception $e) { echo $e->getMessage(); exit; $this->view->msg = 'ការបញ្ចូលមិនជោគជ័យ'; } } $this->view->invoice_no = Application_Model_GlobalClass::getInvoiceWithdraw(4); $sender = new Application_Model_DbTable_DbSender(); $this->view->senderlist = $sender->getAllSenderNameOwe(); $db_keycode = new Application_Model_DbTable_DbKeycode(); $this->view->keycode = $db_keycode->getKeyCodeMiniInv(); $session_user = new Zend_Session_Namespace('auth'); $this->view->user_name = $session_user->last_name . ' ' . $session_user->first_name; $cur = new Application_Model_DbTable_DbCurrencies(); $currency = $cur->getCurrencyList(); $this->view->currency = $this->_helpfilteroption($currency); $curr = $this->_helpfilteroption($currency); array_unshift($curr, array('id' => '-1', "name" => "សងប្រភេទប្រាក់ផ្សេង", 'symbol' => 'other')); $this->view->pay_currencytype = $curr; $db_rate = new Application_Model_DbTable_DbPayment(); $this->view->rate = $db_rate->getRateAll(); }
public function extendDateAction() { $tr_id = $this->getRequest()->getParam('tr_id'); $tr_id = empty($tr_id) ? 0 : $tr_id; if ($this->getRequest()->isPost()) { try { $data = $this->getRequest()->getPost(); $db = new Application_Model_DbTable_DbKbank(); $db->extendDateByTran($data); Application_Form_FrmMessage::Sucessfull('ការពន្យាពេលប្រតិបត្តិការនេះជោគជ័យ', self::REDIRECT_URL . '/index/index'); } catch (Exception $e) { Application_Form_FrmMessage::Sucessfull('ការពន្យាពេលប្រតិបត្តិការនេះបរាជ័យ', self::REDIRECT_URL . '/index/index'); } } if (empty($tr_id)) { Application_Form_FrmMessage::Sucessfull('ការបញ្ចូលជោគជ័យ', self::REDIRECT_URL . '/index/index'); } $db = new Application_Model_DbTable_DbKbank(); $rs = $db->getTranKbankById($tr_id); if (empty($rs)) { Application_Form_FrmMessage::Sucessfull('ការបញ្ចូលជោគជ័យ', self::REDIRECT_URL . '/index/index'); } $this->view->rs = $rs; $session_user = new Zend_Session_Namespace('auth'); $this->view->user_name = $session_user->last_name . ' ' . $session_user->first_name; $db_keycode = new Application_Model_DbTable_DbKeycode(); $this->view->keycode = $db_keycode->getKeyCodeMiniInv(); $pro = new Application_Model_DbTable_DbProvinces(); $provinces = $pro->getProvinceList(); array_unshift($provinces, array('id' => '0', "name" => "ជ្រើសរើសខេត្តដកប្រាក់", 'num' => 0)); $this->view->provinces = $provinces; $subagent = new Application_Model_DbTable_DbSubAgent(); $this->view->subagent = $subagent->getSubAgentListSelectTrns(); $agent = new Application_Model_DbTable_DbAgents(); $this->view->agent = $agent->getAgentListSelectTrns(); $sender = new Application_Model_DbTable_DbSender(); $_sender = $sender->getAllSenderKbank(); array_unshift($_sender, array('id' => '-1', "name" => "បន្ថែមឈ្មោះអ្នកផ្ញើរ")); $this->view->sender = $_sender; $cur = new Application_Model_DbTable_DbCurrencies(); $this->view->currency = $cur->getCurrencyList(); $this->view->pay_term = $this->pay_term; $this->view->invoice_no = Application_Model_GlobalClass::getInvoiceWithdraw(2); $db = new Application_Model_DbTable_DbKbank(); $this->view->new_acc = $acc_no = $db->getAccountNumberForKBank(); }
public function editAction() { $id = $this->getRequest()->getParam('id',0); $db_exc=new Tellerandexchange_Model_DbTable_DbxChangeMoney(); if($this->getRequest()->isPost()){ $formdata=$this->getRequest()->getPost(); try { $formdata['id']=$id; $id = $db_exc->editExchange($formdata); Application_Form_FrmMessage::message("EDIT_SUCESS"); $this->_redirect('tellerandexchange/xchanges'); } catch (Exception $e) { $this->view->msg = 'ការបញ្ចូលមិនជោគជ័យ'; echo $e->getMessage();exit(); } } // action body //Get value from url $session_user=new Zend_Session_Namespace('auth'); $this->view->user_name = $session_user->last_name .' '. $session_user->first_name; $db_keycode = new Application_Model_DbTable_DbKeycode(); $this->view->keycode = $db_keycode->getKeyCodeMiniInv(); $cur = new Application_Model_DbTable_DbCurrencies(); $currency = $cur->getCurrencyList(); $this->view->currency = $this->_helpfilteroption($currency); $this->view->inv_no = Application_Model_GlobalClass::getInvoiceNo(); $rs=$db_exc->getxchangById($id); // print_r($rs); $this->view->dataedit=$rs; }
public function exchangeAction() { // action body //user name for report $session_user = new Zend_Session_Namespace('auth'); $this->view->user_name = $session_user->last_name . ' ' . $session_user->first_name; $db_keycode = new Application_Model_DbTable_DbKeycode(); $this->view->keycode = $db_keycode->getKeyCodeMiniInv(); $cur = new Application_Model_DbTable_DbCurrencies(); $currency = $cur->getCurrencyList(); $this->view->currency = $this->_helpfilteroption($currency); $this->view->inv_no = Application_Model_GlobalClass::getInvoiceNo(); if ($this->getRequest()->isPost()) { $formdata = $this->getRequest()->getPost(); $db_exc = new Application_Model_DbTable_DbExchange(); try { $id = $db_exc->save($formdata); Application_Form_FrmMessage::Sucessfull('ការបញ្ចូលជោគជ័យ', self::REDIRECT_URL . '/index/add'); } catch (Exception $e) { $this->view->msg = 'ការបញ្ចូលមិនជោគជ័យ'; } } }
public function indexAction() { try { $db_tran = new Application_Model_DbTable_DbKbank(); //create sesesion $session_withdraw = new Zend_Session_Namespace('search_withdraw'); if (empty($session_withdraw->limit)) { $session_withdraw->limit = Application_Form_FrmNavigation::getLimit(); $session_withdraw->type_money = -1; $session_withdraw->sender = -1; $session_withdraw->txtsearch = ""; $session_withdraw->from_date = date('Y-m-d'); $session_withdraw->to_date = date('Y-m-d'); $session_withdraw->lock(); } //start page nevigation $limit = $session_withdraw->limit; $start = $this->getRequest()->getParam('limit_satrt', 0); $this->view->from_date = $session_withdraw->from_date; $this->view->to_date = $session_withdraw->to_date; $this->view->sender_id = $session_withdraw->sender; $cur = new Application_Model_DbTable_DbCurrencies(); $this->view->currencylist = $cur->getCurrencyList(); $this->view->type_money = $session_withdraw->type_money; $this->view->txtsearch = $session_withdraw->txtsearch; if ($this->getRequest()->isPost()) { $formdata = $this->getRequest()->getPost(); // print_r($formdata); $session_withdraw->unlock(); $session_withdraw->txtsearch = $formdata['txt_search']; $session_withdraw->limit = $formdata['rows_per_page']; $session_withdraw->type_money = $formdata['type_money']; $session_withdraw->sender = $formdata['sender']; $session_withdraw->from_date = $formdata['from_date']; $session_withdraw->to_date = $formdata['to_date']; $session_withdraw->lock(); $this->view->txtsearch = $formdata['txt_search']; $this->view->type_money = $formdata['type_money']; $this->view->sender_id = $formdata['sender']; $this->view->from_date = $session_withdraw->from_date; $this->view->to_date = $session_withdraw->to_date; $limit = $session_withdraw->limit; $trans = $db_tran->getTranWithDrawListBy($formdata, $start, $limit); $record_count = $db_tran->getTranWithDrawListTotal($formdata); } else { $formdata = array('txt_search' => $session_withdraw->txtsearch, 'tran_type' => $session_withdraw->tran_type, 'from_date' => $session_withdraw->from_date, 'to_date' => $session_withdraw->to_date, 'type_money' => $session_withdraw->type_money, 'sender' => $session_withdraw->sender); $trans = $db_tran->getTranWithDrawListBy($formdata, $start, $limit); $record_count = $db_tran->getTranWithDrawListTotal($formdata); } $result = array(); $row_num = $start; if (!empty($trans)) { foreach ($trans as $i => $tran) { $expired = ''; $is_expired = 0; $result[$i] = array('num' => ++$row_num, 'id' => $tran['id'], 'sender_name' => $tran['sender_name'], 'tel' => $tran['tel'], 'account_no' => $tran['acc_no'], 'invoice' => $tran['invoice'], 'amount_dollar' => $tran['wd_amountdollar'] . " \$", 'amount_bath' => $tran['wd_amountbath'] . " B", 'amount_riel' => $tran['wd_amountriel'] . " R", 'create_date' => date_format(date_create($tran['create_date']), "d/m/Y")); } } else { $result = array('err' => 1, 'msg' => 'មិនទាន់មានទន្និន័យនូវឡើយទេ!'); } $this->view->tranlist = Zend_Json::encode($result); $page = new Application_Form_FrmNavigation(self::REDIRECT_URL, $start, $limit, $record_count); $page->init(self::REDIRECT_URL, $start, $limit, $record_count); $this->view->nevigation = $page->navigationPage(); $this->view->rows_per_page = $page->getRowsPerPage($limit, 'frmlist_mt'); $this->view->result_row = $page->getResultRows(); $sender = new Application_Model_DbTable_DbSender(); $_sender = $sender->getAllSenderKbank(); array_unshift($_sender, array('id' => '-1', "name" => "បន្ថែមឈ្មោះអ្នកផ្ញើរ")); $this->view->sender = $_sender; $cur = new Application_Model_DbTable_DbCurrencies(); } catch (Exception $e) { } }
public function updatePaymentAction() { $id = $this->getRequest()->getParam("id"); if ($this->getRequest()->isPost()) { $_data = $this->getRequest()->getPost(); try { $_dbmodel = new Application_Model_DbTable_DbPayment(); // echo $id; // print_r($_data);exit(); $_dbmodel->updateFundbyParams($_data); Application_Form_FrmMessage::Sucessfull('ការបញ្ចូលជោគជ័យ', "/payment/index/index"); } catch (Exception $e) { echo $e->getMessage(); exit; $this->view->msg = 'ការបញ្ចូលមិនជោគជ័យ'; } } $sender = new Application_Model_DbTable_DbSender(); $this->view->senderlist = $sender->getAllSenderNameOweAll(); $_dbmodel = new Application_Model_DbTable_DbPayment(); $sender_id = $sender->getSenderIdbyInvoice($id); //$row = $_dbmodel->getFoundbyId($id); $tran_row = $_dbmodel->getTransactionOweByInvoice($id, $sender_id); $rat_perday = 0; if ($tran_row) { $rat_perday = $tran_row[0]['rate_perday']; } $row = $_dbmodel->getFoundbyInvoice($id, $rat_perday); //print_r($row);exit; $this->view->old_sender = $row["sender_name"]; $this->view->edite_found = $row; $this->view->invoice_no = $row['invoice_found']; $db_keycode = new Application_Model_DbTable_DbKeycode(); $this->view->keycode = $db_keycode->getKeyCodeMiniInv(); $session_user = new Zend_Session_Namespace('auth'); $this->view->user_name = $session_user->last_name . ' ' . $session_user->first_name; $cur = new Application_Model_DbTable_DbCurrencies(); $currency = $cur->getCurrencyList(); $this->view->currency = $this->_helpfilteroption($currency); //$this->view->id=$id; }
public function editedAction() { $tr_id = $this->getRequest()->getParam('tr_id'); $tr_id = empty($tr_id) ? 0 : $tr_id; $db = new Application_Model_DbTable_DbCustomerLoan(); if ($this->getRequest()->isPost()) { try { $data = $this->getRequest()->getPost(); $db->updateTranLoanById($data); Application_Form_FrmMessage::Sucessfull('ការកែប្រែប្រតិបត្តិការនេះជោគជ័យ', self::REDIRECT_URL); } catch (Exception $e) { echo $e->getMessage(); exit; Application_Form_FrmMessage::Sucessfull('ការកែប្រែប្រតិបត្តិការនេះបរាជ័យ', self::REDIRECT_URL); } } $rs = $db->getTranLaonById($tr_id); if (empty($rs)) { Application_Form_FrmMessage::Sucessfull('មិនអាចទាញយកទិន្នន័យមកកែប្រែបានទេ ', self::REDIRECT_URL . '/index/index'); } $this->view->rs = $rs; $result = array(); $db_tran = new Application_Model_DbTable_DbCustomerLoan(); $rows = $db_tran->getBorrowDetail($tr_id); $result = array('amount_dollar' => '', 'rate_dollar' => '', 'amount_bath' => '', 'rate_bath' => '', 'amount_riel' => '', 'rate_riel' => ''); foreach ($rows as $key => $rs) { if ($rs['currency_type'] == 1) { $result['amount_dollar'] = $rs['loan_amount']; $result['rate_dollar'] = $rs['laon_rate']; } elseif ($rs['currency_type'] == 2) { $result['amount_bath'] = $rs['loan_amount']; $result['rate_bath'] = $rs['laon_rate']; } else { $result['amount_riel'] = $rs['loan_amount']; $result['rate_riel'] = $rs['laon_rate']; } } $this->view->row = $result; // print_r($result); $session_user = new Zend_Session_Namespace('auth'); $this->view->user_name = $session_user->last_name . ' ' . $session_user->first_name; $db_keycode = new Application_Model_DbTable_DbKeycode(); $this->view->keycode = $db_keycode->getKeyCodeMiniInv(); $sender = new Application_Model_DbTable_DbSender(); $_sender = $sender->getAllSenderKbank(2); $this->view->sender = $_sender; $db_rate = new Application_Model_DbTable_DbRate(); $this->view->rate = $db_rate->getCurrentRate(); $cur = new Application_Model_DbTable_DbCurrencies(); $this->view->currency = $cur->getCurrencyList(); }