Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function pendingaccountAction() {
- $userInfo = \Zend\Json\Json::decode($this->getServiceLocator()->get('IdentityManager')->hasIdentity());
- $USER_ID = $userInfo->id;
- date_default_timezone_set("Asia/Dhaka");
- $current_date = date("d-m-Y H:i:s");
- $mkreportname = explode('-',$current_date);
- $mkreportname = implode('_',$mkreportname);
- $mkreportname = explode(' ',$mkreportname);
- $mkreportname = implode('_',$mkreportname);
- $mkreportname = explode(':',$mkreportname);
- $mkreportname = implode('_',$mkreportname);
- $this->session = new SessionContainer('post_supply');
- $businessDate = $this->session->businessdate;
- $recDate = $this->session->recdate;
- $userId = $this->session->userid;
- $userName = '';
- $userData = $this->getUserTable()->fetchAllSpecificUser($userId);
- foreach($userData as $userDatas) {
- $userName = $userDatas['USER_NAME'];
- }
- $userauthority = $this->session->userauthority;
- $this->layout()->leftMenu = $this->getServiceLocator()->get('SystemNavTable')->getSubModules('Investor Service',$USER_ID);
- $this->layout()->controller = $this->getServiceLocator()->get('SystemNavTable')->getControllers();
- $request = $this->getRequest();
- $form = new PurchasePendingForm('pending', $this->getServiceLocator()->get('Zend\Db\Adapter\Adapter'), ($request->isPost()) ? $request->getPost() : array() );
- $reconTable = '';
- $buttonCondition = '';
- $class = 'oddRow';
- $MSG_STATUS_ARRAY = array();
- $getReportingUserList = '';
- if((!empty($userauthority[0])) && ($userauthority[0] == 'm')) {
- if((!empty($userauthority[1])) && ($userauthority[1] == 'm')) {
- } else if((!empty($userauthority[1])) && ($userauthority[1] == 'c')) {
- $MSG_STATUS_ARRAY[] = array('maked');
- } else if((!empty($userauthority[1])) && ($userauthority[1] == 'a')) {
- $MSG_STATUS_ARRAY[] = array('checked');
- }
- if((!empty($userauthority[2])) && ($userauthority[2] == 'm')) {
- } else if((!empty($userauthority[2])) && ($userauthority[2] == 'c')) {
- $MSG_STATUS_ARRAY[] = array('maked');
- } else if((!empty($userauthority[2])) && ($userauthority[2] == 'a')) {
- $MSG_STATUS_ARRAY[] = array('checked');
- }
- } else if((!empty($userauthority[0])) && ($userauthority[0] == 'c')) {
- $MSG_STATUS_ARRAY[] = array('maked');
- if((!empty($userauthority[1])) && ($userauthority[1] == 'a')) {
- $MSG_STATUS_ARRAY[] = array('checked');
- }
- } else if((!empty($userauthority[0])) && ($userauthority[0] == 'a')) {
- $MSG_STATUS_ARRAY[] = array('checked');
- }
- for($i = 0; $i < sizeof($MSG_STATUS_ARRAY); $i++){
- if($MSG_STATUS_ARRAY[$i][0] == 'maked') {
- $title = 'Pending Account Request for Check';
- $buttonCondition = "<input type='submit' name='sendForApprove' value='Send for Approve' class='btn btn-primary pull-right' onclick='return doValidationPendingDepositList();'>";
- $getReportingUserList = $this->getInvestorInformationTable()->getReportingUserList();
- } else {
- $title = 'Pending Account Request for Approve';
- $buttonCondition = "<input type='submit' name='approve' value='Approve' class='btn btn-primary pull-right' onclick='return doValidationApprovealDepositList();'>";
- $getReportingUserList = '';
- }
- $class = ($class == 'evenRow' ? 'oddRow' : 'evenRow');
- $reconTable .= "<form class='form-horizontal' id='pendingaccount' name='pendingaccount' method='post' action='/investoraccount/pendingaccount'>
- <div class='box box-info'>
- <div class='box-header with-border'>
- <h3 class='box-title'>".$title."</h3>
- </div>
- <div class='box-body'>
- <table id='example2' class='table table-bordered'>
- <thead>";
- $reconTable .= "
- <tr valign='top'>
- <td colspan='9' align='right'><!--<a onclick='if(confirm(\"Are you sure you want to print send to bank cheque?\")){return true;} else {return false;};' href='/chequeprocessingprint/sendtobankprint' target='_blank'><img src='../img/print_icon.jpg' width='24' title='Print Investor Fund Details' border='0' style='padding:0px 0px 5px 0px;' /></a>--></td>
- </tr>
- <tr class='".$class."'>
- <td align='left' width='02%' valign='top'>
- <input type='checkbox' name='checkAll' onclick='checkFundMsgRoute(\"details_{$MSG_STATUS_ARRAY[$i][0]}\")' id='details_".$MSG_STATUS_ARRAY[$i][0]."' value=''></td>
- <td align='left' valign='top'>#Sl</td>
- <td align='center' valign='top'>Registration No</td>
- <td align='center' valign='top'>Fund Name</td>
- <td align='center' valign='top'>Investor Name</td>
- <td align='center' valign='top'>Dividend Option</td>
- <td align='center' valign='top'>Action</td>
- </tr></thead><tbody>";
- $purchaseList = $this->getInvestorAccountTable()->purchasePendingList($MSG_STATUS_ARRAY[$i][0], $userId);
- $class = 'oddRow';
- $j = 0;
- $counter = 1;
- $INVESTOR_ACCOUNT_ID = '';
- foreach ($purchaseList as $purchaseChequeListData) {
- // echo "<pre>"; print_r($purchaseChequeListData); die();
- $INVESTOR_ACCOUNT_ID = $purchaseChequeListData->INVESTOR_ACCOUNT_ID;
- $msgRouteSummeryGenarate = $this->getInvestorAccountTable()->msgRouteSummeryGenarate($USER_ID,$INVESTOR_ACCOUNT_ID);
- $remarksViewableGenarate = $this->getInvestorAccountTable()->msgRouteRemarksViewableGenarate($USER_ID,$INVESTOR_ACCOUNT_ID);
- //echo '<pre>';print_r($msgRouteSummeryGenarate);exit;
- $class = ($class == 'evenRow' ? 'oddRow' : 'evenRow');
- $reconTable .= "
- <tr class='".$class."'>
- <td align='left'>
- <input type='checkbox' name='INVESTOR_ACCOUNT_ID[]' id='details_{$MSG_STATUS_ARRAY[$i][0]}".$j."' value='".$INVESTOR_ACCOUNT_ID."' onclick='checkMeFundMsgRoute(\"details_{$MSG_STATUS_ARRAY[$i][0]}\");'/>
- </td>
- <td>".$counter."</td>
- <td align='center'>".$purchaseChequeListData->INVESTOR_REG_NO."</td>
- <td align='center'>".$purchaseChequeListData->PORTFOLIO_NAME."</td>
- <td align='center'>".$purchaseChequeListData->INVESTOR_NAME."</td>
- <td align='center'>".$purchaseChequeListData->DIVIDEND_TYPE."</td>
- <td align='center'>
- <!--<a onclick='if(confirm(\"Are you sure you want to edit this?\")){return true;} else {return false;};' href='/investormanagement/edit/".$INVESTOR_ACCOUNT_ID."?type=pending' target='_parent'><img src='../img/icon_edit.gif' width='24' title='Edit Investor Fund Details' border='0' style='padding:0px 0px 5px 0px;' /></a>-->
- <!--<a onclick='if(confirm(\"Are you sure you want to print send to bank cheque?\")){return true;} else {return false;};' href='/chequeprocessingprint/acknowledgementprint?id=".$INVESTOR_ACCOUNT_ID."' target='_blank'><img src='../img/print_icon.jpg' width='24' title='Print Investor Fund Details' border='0' style='padding:0px 0px 5px 0px;' /></a>-->
- <a href='javascript:void(0);' onclick='ShowHideCust(\"msgrouteshow".$INVESTOR_ACCOUNT_ID.$counter."\");'>Show Message</a>
- </td>
- </tr>
- <tr id='msgrouteshow".$INVESTOR_ACCOUNT_ID.$counter."' style='display:none; background:#DCD7D3;' align='left'>
- <td colspan='9'>
- <table border = '' class='table table-bordered table-hover' width='100%' style='font-family:Tahoma, Geneva, sans-serif; font-size:100%;'>
- <tr valign='top'>
- <td width='20%'></td>
- <td colspan='2' style='border-bottom:1px dotted #000;border-top:1px dotted #000;'>
- <h5 style='margin:5px 0px 10px 0px; padding:0px;color:#000;'>Message Routing Summary:</h5>
- ".$msgRouteSummeryGenarate."
- </td>
- <td width='20%'></td>
- </tr>
- <tr valign='top'>
- <td width='20%'></td>
- <td colspan='2' style='border-bottom:1px dotted #000;border-top:1px dotted #000;'>
- <h5 style='margin:5px 0px 10px 0px; padding:0px;color:#000;'>Remarks Summary : </h5>
- ".$remarksViewableGenarate."
- </td>
- <td width='20%'></td>
- </tr>
- <tr valign='top'>
- <td width='20%'></td>
- <td width='20%'>Enter Remarks : </td>
- <td width='40%'><textarea name='MSGROUTEREMARKS_".$INVESTOR_ACCOUNT_ID."' id='MSGROUTEREMARKS_".$INVESTOR_ACCOUNT_ID.$j."' cols='80' rows='3' style='padding-left:10px;font-family:Tahoma, Geneva, sans-serif; font-size:85%;' placeholder='write something here if required'></textarea></td>
- <td width='20%'></td>
- </tr>
- <tr valign='top'>
- <td colspan='4'> </td>
- </tr>
- <tr valign='top'>
- <td colspan='4'> </td>
- </tr>
- <tr><td> </td></tr>
- </table>
- </td>
- </tr>
- ";
- $j = $j + 1;
- $counter = $counter + 1;
- }
- // Investor Approved Form End
- $class = ($class == 'evenRow' ? 'oddRow' : 'evenRow');
- if($MSG_STATUS_ARRAY[$i][0] == 'maked') {
- $reconTable .= "<tr valign='top'>
- <td colspan='2'>Message for Account Approver:</td>
- <td colspan='8'><textarea name='MASTERMESSAGE' id='' cols='80' rows='3' style='padding-left:10px;font-family:Tahoma, Geneva, sans-serif; font-size:85%;' placeholder='write some messages/text for investor detail approver(if any),this message will be reflected to approver as soon as he/she gets the Request.'></textarea></td>
- </tr>";
- } else {
- $reconTable .= "<tr valign='top'>
- <td colspan='2'>Message for Account Receiver:</td>
- <td colspan='8'><textarea name='MASTERMESSAGE' id='' cols='80' rows='3' style='padding-left:10px;font-family:Tahoma, Geneva, sans-serif; font-size:85%;' placeholder='write some messages/text for investor detail receiver(if any)'></textarea></td>
- </tr>";
- }
- $reconTable .= "</tbody>
- </table>
- </div>
- <div class='box-footer' style='vertical-align:top;'>
- <input type='hidden' name='num_of_cheque_details' id='num_of_details_".$MSG_STATUS_ARRAY[$i][0]."_all' value='".$j."'/>
- <input type='reset' name='Reset' value='Reset' class='btn btn-info'>
- {$getReportingUserList} {$buttonCondition}
- </div>
- </div></form>";
- }
- if($request->isPost()) {
- $form->setData($request->getPost());
- $postedData = $request->getPost();
- $investorAccount = new InvestorAccount();
- $this->getInvestorInformationTable()->transectionStart();
- if(isset($postedData['sendForApprove'])) {
- for($i = 0; $i < sizeof($postedData["INVESTOR_ACCOUNT_ID"]); $i++ ) {
- $tranDetailsID = $postedData["INVESTOR_ACCOUNT_ID"][$i];
- $toPersonnel = $postedData['APPROVAL_LIST'];
- $msgRouteRemarks = $postedData['MSGROUTEREMARKS_'.$tranDetailsID];
- $masterMessageForApprover = $postedData['MASTERMESSAGE'];
- if(strlen($msgRouteRemarks) > 0){
- $msgRouteRemarks = $msgRouteRemarks;
- } else {
- $msgRouteRemarks = $masterMessageForApprover;
- }
- $sentoCheckData = array(
- 'INVESTOR_ACCOUNT_ID' => $postedData["INVESTOR_ACCOUNT_ID"][$i],
- 'MSG_STATUS' => 'checked',
- );
- $investorAccount->exchangeArray($sentoCheckData);
- if($this->getInvestorAccountTable()->updateAccountList($investorAccount)) {
- // Message Route Start //
- $investorMessageRoute = new InvestorMessageRoute();
- $messageRouteData = array();
- $messageRouteData['INVESTOR_ACCOUNT_ID'] = $postedData["INVESTOR_ACCOUNT_ID"][$i];
- $messageRouteData['RECEIVE_BY'] = $toPersonnel;
- $messageRouteData['REMARKS'] = $msgRouteRemarks;
- $messageRouteData['STATUS'] = 'N/A';
- $messageRouteData['VIEWABLETO'] = '4';
- $investorMessageRoute->exchangeArray($messageRouteData);
- if($auditTrailData = $this->getInvestorMessageRouteTable()->saveInvestorMsgRoute($investorMessageRoute)) {
- $plugin = $this->AuditTrailPlugin();
- $plugin->saveAuditTrail($auditTrailData['idData'], $auditTrailData['previousData'], $auditTrailData['presentData'], $auditTrailData['actionData'], $auditTrailData['tableData']);
- $success = true;
- $successMsg = "<h4>Request has been forwarded for Approval properly!</h4>";
- }
- // Message Route Ends //
- } else {
- $success = false;
- $failMsg = "<h4>Request for approval couldn't forward properly!</h4>";
- }
- }
- } else if (isset($postedData['approve'])) {
- for($i = 0; $i < sizeof($postedData["INVESTOR_ACCOUNT_ID"]); $i++ ) {
- $tranDetailsID = $postedData["INVESTOR_ACCOUNT_ID"][$i];
- $msgRouteRemarks = $postedData['MSGROUTEREMARKS_'.$tranDetailsID];
- $masterMessageForMaker = $postedData['MASTERMESSAGE'];
- if(strlen($msgRouteRemarks) > 0){
- $msgRouteRemarks = $msgRouteRemarks;
- } else {
- $msgRouteRemarks = $masterMessageForMaker;
- }
- $sentoCheckData = array(
- 'INVESTOR_ACCOUNT_ID' => $postedData["INVESTOR_ACCOUNT_ID"][$i],
- 'MSG_STATUS' => 'approved',
- );
- $investorAccount->exchangeArray($sentoCheckData);
- if($this->getInvestorAccountTable()->updatePurchaseList($investorAccount)) {
- // Message Route Start //
- $investorMessageRoute = new InvestorMessageRoute();
- $messageRouteData = array();
- $messageRouteData['INVESTOR_ACCOUNT_ID'] = $postedData["INVESTOR_ACCOUNT_ID"][$i];
- $messageRouteData['RECEIVE_BY'] = '';
- $messageRouteData['REMARKS'] = $msgRouteRemarks;
- $messageRouteData['STATUS'] = 'A';
- $messageRouteData['VIEWABLETO'] = '4';
- $messageRouteData['APPROVED_DATE'] = $businessDate;
- $investorMessageRoute->exchangeArray($messageRouteData);
- if($auditTrailData = $this->getInvestorMessageRouteTable()->saveInvestorMsgRoute($investorMessageRoute)) {
- $plugin = $this->AuditTrailPlugin();
- $plugin->saveAuditTrail($auditTrailData['idData'], $auditTrailData['previousData'], $auditTrailData['presentData'], $auditTrailData['actionData'], $auditTrailData['tableData']);
- $success = true;
- $successMsg = "<h4>Investor Request Approved properly!</h4>";
- }
- // Message Route Ends //
- } else {
- $success = false;
- $failMsg = "<h4>Investor Request couldn't Approved properly!</h4>";
- }
- }
- } else {
- }
- if($success) {
- $this->flashmessenger()->addMessage("<table align='center' cellpadding='2' cellspacing='2' border='0' width='100%' style='font-size:85%;'>
- <tr class='valid_msg'>
- <td colspan='3' style='text-align:center;'>{$successMsg}</td>
- </tr>
- </table>");
- return $this->redirect()->toRoute('investoraccount');
- } else {
- $this->flashmessenger()->addMessage("<table align='center' cellpadding='2' cellspacing='2' border='0' width='100%' style='font-size:85%;'>
- <tr class='error_msg'>
- <td colspan='3' style='text-align:center;'>{$failMsg}</td>
- </tr>
- </table>");
- return $this->redirect()->toRoute('investoraccount');
- }
- //}
- }
- return array(
- 'form' => $form,
- 'reconTable' => $reconTable,
- 'flashMessages' => $this->flashMessenger()->getMessages(),
- );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement