Advertisement
Guest User

Untitled

a guest
Jul 24th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 17.37 KB | None | 0 0
  1.     public function pendingaccountAction() {
  2.         $userInfo                   = \Zend\Json\Json::decode($this->getServiceLocator()->get('IdentityManager')->hasIdentity());
  3.         $USER_ID                    = $userInfo->id;
  4.  
  5.         date_default_timezone_set("Asia/Dhaka");
  6.         $current_date = date("d-m-Y H:i:s");
  7.         $mkreportname = explode('-',$current_date);
  8.         $mkreportname = implode('_',$mkreportname);
  9.         $mkreportname = explode(' ',$mkreportname);
  10.         $mkreportname = implode('_',$mkreportname);
  11.         $mkreportname = explode(':',$mkreportname);
  12.         $mkreportname = implode('_',$mkreportname);
  13.  
  14.         $this->session      = new SessionContainer('post_supply');
  15.         $businessDate       = $this->session->businessdate;
  16.         $recDate            = $this->session->recdate;
  17.         $userId             = $this->session->userid;
  18.         $userName           = '';
  19.         $userData           = $this->getUserTable()->fetchAllSpecificUser($userId);
  20.         foreach($userData as $userDatas) {
  21.             $userName       = $userDatas['USER_NAME'];
  22.         }
  23.         $userauthority      = $this->session->userauthority;
  24.  
  25.         $this->layout()->leftMenu   = $this->getServiceLocator()->get('SystemNavTable')->getSubModules('Investor Service',$USER_ID);
  26.         $this->layout()->controller = $this->getServiceLocator()->get('SystemNavTable')->getControllers();
  27.         $request    = $this->getRequest();
  28.         $form       = new PurchasePendingForm('pending', $this->getServiceLocator()->get('Zend\Db\Adapter\Adapter'), ($request->isPost()) ? $request->getPost() : array() );
  29.  
  30.         $reconTable                 = '';
  31.         $buttonCondition            = '';
  32.         $class                      = 'oddRow';
  33.         $MSG_STATUS_ARRAY           = array();
  34.         $getReportingUserList       = '';
  35.         if((!empty($userauthority[0])) && ($userauthority[0] == 'm')) {
  36.             if((!empty($userauthority[1])) && ($userauthority[1] == 'm')) {
  37.             } else if((!empty($userauthority[1])) && ($userauthority[1] == 'c')) {
  38.                 $MSG_STATUS_ARRAY[] = array('maked');
  39.             } else if((!empty($userauthority[1])) && ($userauthority[1] == 'a')) {
  40.                 $MSG_STATUS_ARRAY[] = array('checked');
  41.             }
  42.             if((!empty($userauthority[2])) && ($userauthority[2] == 'm')) {
  43.             } else if((!empty($userauthority[2])) && ($userauthority[2] == 'c')) {
  44.                 $MSG_STATUS_ARRAY[] = array('maked');
  45.             } else if((!empty($userauthority[2])) && ($userauthority[2] == 'a')) {
  46.                 $MSG_STATUS_ARRAY[] = array('checked');
  47.             }
  48.         } else if((!empty($userauthority[0])) && ($userauthority[0] == 'c')) {
  49.             $MSG_STATUS_ARRAY[] = array('maked');
  50.             if((!empty($userauthority[1])) && ($userauthority[1] == 'a')) {
  51.                 $MSG_STATUS_ARRAY[] = array('checked');
  52.             }
  53.         } else if((!empty($userauthority[0])) && ($userauthority[0] == 'a')) {
  54.             $MSG_STATUS_ARRAY[] = array('checked');
  55.         }
  56.  
  57.         for($i = 0; $i < sizeof($MSG_STATUS_ARRAY); $i++){
  58.             if($MSG_STATUS_ARRAY[$i][0] == 'maked') {
  59.                 $title = 'Pending Account Request for Check';
  60.                 $buttonCondition = "<input type='submit' name='sendForApprove' value='Send for Approve' class='btn btn-primary pull-right' onclick='return doValidationPendingDepositList();'>";
  61.                 $getReportingUserList = $this->getInvestorInformationTable()->getReportingUserList();
  62.             } else {
  63.                 $title = 'Pending Account Request for Approve';
  64.                 $buttonCondition = "<input type='submit' name='approve' value='Approve' class='btn btn-primary pull-right' onclick='return doValidationApprovealDepositList();'>";
  65.                 $getReportingUserList = '';
  66.             }
  67.             $class          = ($class == 'evenRow' ? 'oddRow' : 'evenRow');
  68.             $reconTable     .= "<form class='form-horizontal' id='pendingaccount' name='pendingaccount' method='post' action='/investoraccount/pendingaccount'>
  69.                                     <div class='box box-info'>
  70.                                         <div class='box-header with-border'>
  71.                                             <h3 class='box-title'>".$title."</h3>
  72.                                         </div>
  73.                                         <div class='box-body'>
  74.                                             <table id='example2' class='table table-bordered'>
  75.                                             <thead>";
  76.             $reconTable     .= "
  77.                                     <tr valign='top'>
  78.                                         <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>
  79.                                     </tr>  
  80.                                     <tr class='".$class."'>
  81.                                         <td align='left' width='02%' valign='top'>
  82.                                             <input type='checkbox' name='checkAll' onclick='checkFundMsgRoute(\"details_{$MSG_STATUS_ARRAY[$i][0]}\")' id='details_".$MSG_STATUS_ARRAY[$i][0]."' value=''></td>
  83.                                         <td align='left' valign='top'>#Sl</td>
  84.                                         <td align='center' valign='top'>Registration No</td>
  85.                                         <td align='center' valign='top'>Fund Name</td>
  86.                                         <td align='center' valign='top'>Investor Name</td>
  87.                                         <td align='center' valign='top'>Dividend Option</td>
  88.                                         <td align='center' valign='top'>Action</td>
  89.                                     </tr></thead><tbody>";
  90.  
  91.             $purchaseList   = $this->getInvestorAccountTable()->purchasePendingList($MSG_STATUS_ARRAY[$i][0], $userId);
  92.  
  93.             $class              = 'oddRow';
  94.             $j                          = 0;
  95.             $counter                    = 1;
  96.             $INVESTOR_ACCOUNT_ID        = '';
  97.             foreach ($purchaseList as $purchaseChequeListData) {
  98.                 // echo "<pre>"; print_r($purchaseChequeListData); die();
  99.                 $INVESTOR_ACCOUNT_ID        = $purchaseChequeListData->INVESTOR_ACCOUNT_ID;
  100.                 $msgRouteSummeryGenarate    = $this->getInvestorAccountTable()->msgRouteSummeryGenarate($USER_ID,$INVESTOR_ACCOUNT_ID);
  101.                 $remarksViewableGenarate    = $this->getInvestorAccountTable()->msgRouteRemarksViewableGenarate($USER_ID,$INVESTOR_ACCOUNT_ID);
  102.  
  103.                 //echo '<pre>';print_r($msgRouteSummeryGenarate);exit;
  104.  
  105.                 $class = ($class == 'evenRow' ? 'oddRow' : 'evenRow');
  106.  
  107.                 $reconTable .= "   
  108.                     <tr class='".$class."'>
  109.                         <td align='left'>
  110.                             <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]}\");'/>
  111.                         </td>
  112.                         <td>".$counter."</td>
  113.                         <td align='center'>".$purchaseChequeListData->INVESTOR_REG_NO."</td>
  114.                         <td align='center'>".$purchaseChequeListData->PORTFOLIO_NAME."</td>
  115.                         <td align='center'>".$purchaseChequeListData->INVESTOR_NAME."</td>
  116.                         <td align='center'>".$purchaseChequeListData->DIVIDEND_TYPE."</td>
  117.                         <td align='center'>
  118.                         <!--<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>-->
  119.                         <!--<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>-->
  120.                         <a href='javascript:void(0);' onclick='ShowHideCust(\"msgrouteshow".$INVESTOR_ACCOUNT_ID.$counter."\");'>Show Message</a>
  121.                         </td>
  122.                     </tr>
  123.                     <tr id='msgrouteshow".$INVESTOR_ACCOUNT_ID.$counter."' style='display:none; background:#DCD7D3;' align='left'>
  124.                         <td colspan='9'>
  125.                             <table border = '' class='table table-bordered table-hover' width='100%' style='font-family:Tahoma, Geneva, sans-serif; font-size:100%;'>
  126.                                 <tr valign='top'>
  127.                                     <td width='20%'></td>
  128.                                     <td colspan='2' style='border-bottom:1px dotted #000;border-top:1px dotted #000;'>
  129.                                         <h5 style='margin:5px 0px 10px 0px; padding:0px;color:#000;'>Message Routing Summary:</h5>
  130.                                         ".$msgRouteSummeryGenarate."
  131.                                     </td>
  132.                                     <td width='20%'></td>
  133.                                 </tr>
  134.                                 <tr valign='top'>
  135.                                     <td width='20%'></td>
  136.                                     <td colspan='2' style='border-bottom:1px dotted #000;border-top:1px dotted #000;'>
  137.                                         <h5 style='margin:5px 0px 10px 0px; padding:0px;color:#000;'>Remarks Summary : </h5>
  138.                                         ".$remarksViewableGenarate."
  139.                                     </td>
  140.                                     <td width='20%'></td>
  141.                                 </tr>
  142.                                 <tr valign='top'>
  143.                                     <td width='20%'></td>
  144.                                     <td width='20%'>Enter Remarks : </td>
  145.                                     <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>
  146.                                     <td width='20%'></td>
  147.                                 </tr>
  148.                                 <tr valign='top'>
  149.                                     <td colspan='4'>&nbsp;</td>
  150.                                 </tr>
  151.                                 <tr valign='top'>
  152.                                     <td colspan='4'>&nbsp;</td>
  153.                                 </tr>
  154.                                 <tr><td>&nbsp;</td></tr>
  155.                             </table>
  156.                         </td>
  157.                     </tr>
  158.                     ";
  159.                 $j = $j + 1;
  160.                 $counter = $counter + 1;
  161.             }
  162.             // Investor Approved Form End
  163.             $class          = ($class == 'evenRow' ? 'oddRow' : 'evenRow');
  164.             if($MSG_STATUS_ARRAY[$i][0] == 'maked') {
  165.                 $reconTable     .= "<tr valign='top'>
  166.                                         <td colspan='2'>Message for Account Approver:</td>
  167.                                        <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>
  168.                                         </tr>";
  169.             } else {
  170.                 $reconTable     .= "<tr valign='top'>
  171.                                         <td colspan='2'>Message for Account Receiver:</td>
  172.                                        <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>
  173.                                         </tr>";
  174.             }
  175.             $reconTable     .= "</tbody>       
  176.                             </table>
  177.                             </div>
  178.                             <div class='box-footer' style='vertical-align:top;'>
  179.                                 <input type='hidden' name='num_of_cheque_details' id='num_of_details_".$MSG_STATUS_ARRAY[$i][0]."_all' value='".$j."'/>
  180.                                 <input type='reset' name='Reset' value='Reset' class='btn btn-info'>&nbsp;
  181.                                 {$getReportingUserList}&nbsp;{$buttonCondition}
  182.                             </div>
  183.                         </div></form>";
  184.         }
  185.  
  186.         if($request->isPost()) {
  187.             $form->setData($request->getPost());
  188.             $postedData                     = $request->getPost();
  189.             $investorAccount                    = new InvestorAccount();
  190.  
  191.             $this->getInvestorInformationTable()->transectionStart();
  192.  
  193.             if(isset($postedData['sendForApprove'])) {
  194.                 for($i = 0; $i < sizeof($postedData["INVESTOR_ACCOUNT_ID"]); $i++ ) {
  195.                     $tranDetailsID = $postedData["INVESTOR_ACCOUNT_ID"][$i];
  196.                     $toPersonnel = $postedData['APPROVAL_LIST'];
  197.                     $msgRouteRemarks = $postedData['MSGROUTEREMARKS_'.$tranDetailsID];
  198.                     $masterMessageForApprover = $postedData['MASTERMESSAGE'];
  199.                     if(strlen($msgRouteRemarks) > 0){
  200.                         $msgRouteRemarks = $msgRouteRemarks;
  201.                     } else {
  202.                         $msgRouteRemarks = $masterMessageForApprover;
  203.                     }
  204.                     $sentoCheckData     = array(
  205.                         'INVESTOR_ACCOUNT_ID'   => $postedData["INVESTOR_ACCOUNT_ID"][$i],
  206.                         'MSG_STATUS'            => 'checked',
  207.                     );
  208.                     $investorAccount->exchangeArray($sentoCheckData);
  209.                     if($this->getInvestorAccountTable()->updateAccountList($investorAccount)) {
  210.                         // Message Route Start //
  211.                         $investorMessageRoute = new InvestorMessageRoute();
  212.                         $messageRouteData = array();
  213.                         $messageRouteData['INVESTOR_ACCOUNT_ID'] = $postedData["INVESTOR_ACCOUNT_ID"][$i];
  214.                         $messageRouteData['RECEIVE_BY']             = $toPersonnel;
  215.                         $messageRouteData['REMARKS']                = $msgRouteRemarks;
  216.                         $messageRouteData['STATUS']                 = 'N/A';
  217.                         $messageRouteData['VIEWABLETO']             = '4';
  218.                         $investorMessageRoute->exchangeArray($messageRouteData);
  219.  
  220.                         if($auditTrailData = $this->getInvestorMessageRouteTable()->saveInvestorMsgRoute($investorMessageRoute)) {
  221.                             $plugin = $this->AuditTrailPlugin();
  222.                             $plugin->saveAuditTrail($auditTrailData['idData'], $auditTrailData['previousData'], $auditTrailData['presentData'], $auditTrailData['actionData'], $auditTrailData['tableData']);
  223.                             $success    = true;
  224.                             $successMsg = "<h4>Request has been forwarded for Approval properly!</h4>";
  225.                         }
  226.                         // Message Route Ends //
  227.                     } else {
  228.                         $success    = false;
  229.                         $failMsg = "<h4>Request for approval couldn't forward properly!</h4>";
  230.                     }
  231.                 }
  232.             } else if (isset($postedData['approve'])) {
  233.  
  234.                 for($i = 0; $i < sizeof($postedData["INVESTOR_ACCOUNT_ID"]); $i++ ) {
  235.                     $tranDetailsID              = $postedData["INVESTOR_ACCOUNT_ID"][$i];
  236.                     $msgRouteRemarks            = $postedData['MSGROUTEREMARKS_'.$tranDetailsID];
  237.                     $masterMessageForMaker      = $postedData['MASTERMESSAGE'];
  238.                     if(strlen($msgRouteRemarks) > 0){
  239.                         $msgRouteRemarks = $msgRouteRemarks;
  240.                     } else {
  241.                         $msgRouteRemarks = $masterMessageForMaker;
  242.                     }
  243.  
  244.                     $sentoCheckData     = array(
  245.                         'INVESTOR_ACCOUNT_ID'   => $postedData["INVESTOR_ACCOUNT_ID"][$i],
  246.                         'MSG_STATUS'                => 'approved',
  247.                     );
  248.                     $investorAccount->exchangeArray($sentoCheckData);
  249.                     if($this->getInvestorAccountTable()->updatePurchaseList($investorAccount)) {
  250.  
  251.                         // Message Route Start //
  252.                         $investorMessageRoute = new InvestorMessageRoute();
  253.                         $messageRouteData = array();
  254.                         $messageRouteData['INVESTOR_ACCOUNT_ID']    = $postedData["INVESTOR_ACCOUNT_ID"][$i];
  255.                         $messageRouteData['RECEIVE_BY']             = '';
  256.                         $messageRouteData['REMARKS']                = $msgRouteRemarks;
  257.                         $messageRouteData['STATUS']                 = 'A';
  258.                         $messageRouteData['VIEWABLETO']             = '4';
  259.                         $messageRouteData['APPROVED_DATE']          = $businessDate;
  260.                         $investorMessageRoute->exchangeArray($messageRouteData);
  261.  
  262.                         if($auditTrailData = $this->getInvestorMessageRouteTable()->saveInvestorMsgRoute($investorMessageRoute)) {
  263.                             $plugin = $this->AuditTrailPlugin();
  264.                             $plugin->saveAuditTrail($auditTrailData['idData'], $auditTrailData['previousData'], $auditTrailData['presentData'], $auditTrailData['actionData'], $auditTrailData['tableData']);
  265.                             $success    = true;
  266.                             $successMsg = "<h4>Investor Request Approved properly!</h4>";
  267.                         }
  268.                         // Message Route Ends //
  269.                     } else {
  270.                         $success    = false;
  271.                         $failMsg = "<h4>Investor Request couldn't Approved properly!</h4>";
  272.                     }
  273.                 }
  274.             } else {
  275.  
  276.             }
  277.  
  278.             if($success) {
  279.                 $this->flashmessenger()->addMessage("<table align='center' cellpadding='2' cellspacing='2' border='0' width='100%' style='font-size:85%;'>
  280.                                                                 <tr class='valid_msg'>
  281.                                                                     <td colspan='3' style='text-align:center;'>{$successMsg}</td>
  282.                                                                 </tr>
  283.                                                             </table>");
  284.                 return $this->redirect()->toRoute('investoraccount');
  285.             } else {
  286.                 $this->flashmessenger()->addMessage("<table align='center' cellpadding='2' cellspacing='2' border='0' width='100%' style='font-size:85%;'>
  287.                                                                 <tr class='error_msg'>
  288.                                                                     <td colspan='3' style='text-align:center;'>{$failMsg}</td>
  289.                                                                 </tr>
  290.                                                             </table>");
  291.                 return $this->redirect()->toRoute('investoraccount');
  292.             }
  293.             //}
  294.         }
  295.  
  296.         return array(
  297.             'form'                  => $form,
  298.             'reconTable'            => $reconTable,
  299.             'flashMessages'         => $this->flashMessenger()->getMessages(),
  300.         );
  301.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement