<?php $this->view("includes/Inc_pagehead");?>
<!-- Page Styles Goes Here-->
<style>
.m-widget1 {
  padding: 1rem;
}
.m-input{
  border: 1px solid #ebedf2 !important;
  background-color: #f4f5f833 !important;
}
#payment_view_table .dataTables_scrollHeadInner {
  width:100% !important;
  padding: 0 !important;
}
.m-nav .m-nav__item>.m-nav__link .m-nav__link-title>.m-nav__link-wrap .m-nav__link-text {

}
.weekend {
  background: #f4f7f4;
}

.gantt_selected .weekend {
  background: #f7eb91;
}
.gantt_grid_head_add{
  display: none;
  }.gantt_add{
    display: none
  }
  .gantt_task_line, .gantt_line_wrapper {
    margin-top: -9px;
  }
  .gantt_side_content {
    margin-bottom: 7px;
  }
  .gantt_task_link .gantt_link_arrow {
    margin-top: -12px
  }
  .gantt_side_content.gantt_right {
    bottom: 0;
  }
  .baseline {
    position: absolute;
    border-radius: 2px;
    opacity: 0.6;
    margin-top: -7px;
    height: 12px;
    background: #ffd180;
    border: 1px solid rgb(255,153,0);
  }
  </style>

  <script src="<?php echo $this->config->item('Template_template_file_url'); ?>template/assets/vendors/custom/gantt/codebase/dhtmlxgantt.js?v=6.3.3"></script>
  <script src="<?php echo $this->config->item('Template_template_file_url'); ?>template/assets/vendors/custom/gantt/codebase/ext/dhtmlxgantt_tooltip.js?v=6.3.3"></script>
  <link rel="stylesheet" href="<?php echo $this->config->item('Template_template_file_url'); ?>template/assets/vendors/custom/gantt/codebase/dhtmlxgantt.css?v=6.3.3">
  <script src="https://export.dhtmlx.com/gantt/api.js"></script>

  <script src="<?php echo $this->config->item('Template_template_file_url'); ?>template/assets/vendors/custom/gantt/samples/common/testdata.js?v=6.3.3"></script>
  <?php $this->view("includes/Inc_navigation");?>
  <div class="m-grid__item m-grid__item--fluid m-wrapper">
    <!-- BEGIN: Subheader -->
    <div class="m-subheader ">
      <div class="d-flex align-items-center">
        <div class="mr-auto">
          <h3 class="m-subheader__title m-subheader__title--separator">
          Master Project Profile (Sub Projects Summary)
          </h3>
        </div>
      </div>
    </div>
    <!-- END: Subheader -->
    <div class="m-content">
      <div class="row">

        <div class="col-xl-3 col-lg-4">
          <div class="m-portlet m-portlet--full-height  ">
            <div class="m-portlet__body" style="padding-top: 0px">
              <div class="m-card-profile">
                <div class="m-card-profile__title m--hide">
                  Master Project Profile
                </div>
                <div class="m-card-profile__pic">
                  <div class="m-card-profile__pic-wrapper">
                    <?php if ($work_data->photo!='') { ?>
                      <img src="<?php echo base_url()?>uploads/projects/<?= $work_data->photo ?>" alt=""/>
                    <?php }else{ ?>
                      <img src="<?php echo base_url()?>uploads/projects/default.png" alt=""/>
                    <?php } ?>
                  </div>
                </div>
                <div class="m-card-profile__details">
                  <span class="m-card-profile__name">
                    <div style='font-size:20px;font-weight:600;padding: 0.5rem 0.5rem;' class='m-alert m-alert--outline alert alert-info alert-dismissible fade show'><i class='fa fa-sitemap'></i> Master Project <br/>
                    #<?php echo $work_data->work_id?> - <?php echo $work_data->work_name?>
                    <?php if($work_data->reference_no!=''){ echo " [".$work_data->reference_no."]";} ?>
                    </div>
                  </span>
                  <br/>
                  <button type="button" class='btn btn-sm m-btn--pill btn-brand'><i class='fa fa-sitemap'></i> <?php
                  echo $work_data->project_section
                  ?></button>
                  <br/>
                  <a href="" class="m-card-profile__email m-link">
                    <strong><?php
                    echo $work_data->wcat_name
                    ?></strong>
                  </a>
                  <?php echo $parent_project ?>
                </div>
                <div class="m-card-profile__details">
                  <span class="m-card-profile__name">

                  </span>
                </div>
                <br/>
              </div>
              <ul class="m-nav m-nav--hover-bg m-portlet-fit--sides" id="m_nav" role="tablist">
                <li class="m-nav__separator m-nav__separator--fit" style="margin-top: 0px"></li>
                <li class="m-nav__section m--hide">
                  <span class="m-nav__section-text">
                    Section
                  </span>
                </li>
                <?php if($this->session->userdata('user_role')!='boq_manager') {?>
                  <li class="m-nav__item profile_nav" id="nav_overview" data-nav="overview" data-table-name=''>
                    <a href="javascript:;" class="m-nav__link">
                      <i class="m-nav__link-icon fa fa-industry"></i>
                      <span class="m-nav__link-title">
                        <span class="m-nav__link-wrap">
                          <span class="m-nav__link-text">
                            Project Overview
                          </span>
                        </span>
                      </span>
                    </a>
                  </li>
                <?php } ?>
                <li class="m-nav__item profile_nav" id="nav_info" data-nav="info" data-table-name=''>
                  <a href="javascript:;" class="m-nav__link">
                    <i class="m-nav__link-icon fa fa-info-circle"></i>
                    <span class="m-nav__link-title">
                      <span class="m-nav__link-wrap">
                        <span class="m-nav__link-text">
                          Project Info
                        </span>
                      </span>
                    </span>
                  </a>
                </li>
                <!-- Include All Profile Navigations -->
                <?php $this->view("includes/Inc_profile_navigation");?>

              </ul>
            </div>
          </div>
        </div>
        <div class="col-xl-9 col-lg-8">

          <div class="m-portlet">
            <div class="m-portlet__head" style="height: auto;text-align: center">
              <div class="m-portlet__head-tools" style="display: -webkit-box !important;">


                <?php if($this->session->userdata('user_role')!='boq_manager' && $this->session->userdata('user_role') != 'qs_manager' && $this->session->userdata('user_role') != 'qs'){ ?>
                  <a href="#" style="margin-left: 5px;margin-right: 5px" id="print_summary"  class="btn btn-primary m-btn m-btn--custom m-btn--icon m-btn--air m-btn--pill">
                    <span>
                      <i class="la la-print"></i>
                      <span>
                        Print All Summary
                      </span>
                    </span>
                  </a>
                <?php } ?>
              </div>
            </div>
          </div>
          <div id="div_overview" class="profile_nav_div">
            <?php if($this->session->userdata('user_role')!='purchase_manager' && $this->session->userdata('user_role')!='boq_manager' && $this->session->userdata('user_role') != 'qs_manager' && $this->session->userdata('user_role') != 'qs'){?>
              <div class="m-portlet">
                <div class="m-portlet__body m-portlet__body--no-padding">
                  <div class="row m-row--no-padding m-row--col-separator-xl">
                    <div class="col-md-12 col-lg-12 col-xl-3">
                      <!--begin:: Widgets/Stats2-1 -->
                      <?php if($this->session->userdata('user_role')=='admin' || $this->session->userdata('user_role')=='accounts_manager' || $this->session->userdata('user_role')=='auditor' || ($this->session->userdata('user_role')=='general_manager' && $this->config->item('User_general_manager_show_profit')==1)){?>
                        <div class="m-widget1">
                          <div class="m-widget1__item">
                            <div class="row m-row--no-padding align-items-center">
                              <span class="m-widget1__number m--font-brand">
                                <label class="project_budget_info"></label>
                              </span>
                            </div>
                            <h3 class="m-widget1__title">
                              Project Budget
                            </h3>
                          </div>
                        </div>
                      <?php } ?>
                      <!--end:: Widgets/Stats2-1 -->
                    </div>
                    <div class="col-md-12 col-lg-12 col-xl-3">
                      <!--begin:: Widgets/Stats2-2 -->
                      <?php if($this->session->userdata('user_role')!='supervisor'){?>
                        <?php if ($this->config->item('app_module_client_payments') == 1 ){?>
                          <div class="m-widget1">
                            <div class="m-widget1__item">
                              <div class="row m-row--no-padding align-items-center">
                                <span class="m-widget1__number m--font-accent">
                                  <label class="total_received_from_client_info"></label>
                                </span>
                              </div>
                              <h3 class="m-widget1__title">
                                Received From Client
                              </h3>
                            </div>
                          </div>
                        <?php } ?>
                      <?php } ?>
                      <!--begin:: Widgets/Stats2-2 -->
                    </div>
                    <div class="col-md-12 col-lg-12 col-xl-2">
                      <!--begin:: Widgets/Stats2-3 -->
                      <div class="m-widget1">
                        <div class="m-widget1__item">
                          <div class="row m-row--no-padding align-items-center">
                            <span class="m-widget1__number m--font-success">
                              <label class="total_project_cost_info"></label>
                            </span>
                          </div>
                          <h3 class="m-widget1__title">
                            Total Project Cost
                          </h3>
                        </div>
                      </div>
                      <!--begin:: Widgets/Stats2-3 -->
                    </div>
                    <div class="col-md-12 col-lg-12 col-xl-2">
                      <!--begin:: Widgets/Stats2-3 -->
                      <div class="m-widget1">
                        <div class="m-widget1__item">
                          <div class="row m-row--no-padding align-items-center">
                            <span class="m-widget1__number m--font-success">
                              <label class="total_expense_payments_info"></label>
                            </span>
                          </div>
                          <h3 class="m-widget1__title">
                            Total Expense Payments
                          </h3>
                        </div>
                      </div>
                      <!--begin:: Widgets/Stats2-3 -->
                    </div>
                    <?php  if($this->config->item('Project_commited_amount_show')==1){ ?>
                      <div class="col-md-12 col-lg-12 col-xl-2">
                        <!--begin:: Widgets/Stats2-3 -->
                        <div class="m-widget1">
                          <div class="m-widget1__item">
                            <div class="row m-row--no-padding align-items-center">
                              <span class="m-widget1__number m--font-success">
                                <label class="total_committed_amount_info"></label>
                              </span>
                            </div>
                            <h3 class="m-widget1__title">
                              Total Commited Amount
                            </h3>
                          </div>
                        </div>
                        <!--begin:: Widgets/Stats2-3 -->
                      </div>
                    <?php } ?>
                  </div>
                </div>
              </div>
            <?php } ?>
            <?php if($this->session->userdata('user_role')!='boq_manager' && $this->session->userdata('user_role') != 'qs_manager' && $this->session->userdata('user_role') != 'qs'){?>
              <div class="m-portlet">
                <div class="m-portlet__body m-portlet__body--no-padding">
                  <div class="row m-row--no-padding m-row--col-separator-xl">

                    <div class="col-md-12 col-lg-12 col-xl-2">
                      <!--begin:: Widgets/Stats2-3 -->
                      <div class="m-widget1">
                        <div class="m-widget1__item">
                          <div class="row m-row--no-padding align-items-center">
                            <span class="m-widget1__number m--font-success">
                              <label class="total_purchases_bill_info"></label>
                            </span>
                          </div>
                          <h3 class="m-widget1__title">
                            Purchase Bill
                          </h3>
                        </div>
                      </div>
                      <!--begin:: Widgets/Stats2-3 -->
                    </div>
                    <?php if($this->session->userdata('user_role')!='purchase_manager'){?>
                      <div class="col-md-12 col-lg-12 col-xl-2">
                        <!--begin:: Widgets/Stats2-3 -->
                        <div class="m-widget1">
                          <div class="m-widget1__item">
                            <div class="row m-row--no-padding align-items-center">
                              <span class="m-widget1__number m--font-success">
                                <label class="total_subcontract_bill_info"></label>
                              </span>
                            </div>
                            <h3 class="m-widget1__title">
                              Subcontract Bill
                            </h3>
                          </div>
                        </div>
                        <!--begin:: Widgets/Stats2-3 -->
                      </div>
                      <div class="col-md-12 col-lg-12 col-xl-2">
                        <?php if ($this->config->item('app_module_labours') == 1){?>
                          <!--begin:: Widgets/Stats2-3 -->
                          <div class="m-widget1">
                            <div class="m-widget1__item">
                              <div class="row m-row--no-padding align-items-center">
                                <span class="m-widget1__number m--font-success">
                                  <label class="total_labour_wages_info"></label>
                                </span>
                              </div>
                              <h3 class="m-widget1__title">
                                Labour Wages
                              </h3>
                            </div>
                          </div>
                          <!--begin:: Widgets/Stats2-3 -->
                        <?php } ?>
                      </div>
                      <div class="col-md-12 col-lg-12 col-xl-2">
                        <!--begin:: Widgets/Stats2-3 -->
                        <div class="m-widget1">
                          <div class="m-widget1__item">
                            <div class="row m-row--no-padding align-items-center">
                              <span class="m-widget1__number m--font-success">
                                <label class="total_other_expense_bill_info"></label>
                              </span>
                            </div>
                            <h3 class="m-widget1__title">
                              Expense Bill
                            </h3>
                          </div>

                        </div>
                        <!--begin:: Widgets/Stats2-3 -->
                      </div>
                      <div class="col-md-12 col-lg-12 col-xl-2">
                        <!--begin:: Widgets/Stats2-3 -->
                        <div class="m-widget1">
                          <div class="m-widget1__item">
                            <div class="row m-row--no-padding align-items-center">
                              <span class="m-widget1__number m--font-success">
                                <label class="total_salary_slip_amount_info"></label>
                              </span>
                            </div>
                            <h3 class="m-widget1__title">
                              Salary Slip
                            </h3>
                          </div>

                        </div>
                        <!--begin:: Widgets/Stats2-3 -->
                      </div>
                      <div class="col-md-12 col-lg-12 col-xl-2">
                        <?php if ($this->config->item('app_module_vehicle') == 1){?>
                          <!--begin:: Widgets/Stats2-3 -->
                          <div class="m-widget1">
                            <div class="m-widget1__item">
                              <div class="row m-row--no-padding align-items-center">
                                <span class="m-widget1__number m--font-success">
                                  <label class="total_vehicle_work_slip_amount"></label>
                                </span>
                              </div>
                              <h3 class="m-widget1__title">
                                Vehicle Slip
                              </h3>
                            </div>

                          </div>
                        <?php } ?>
                        <!--begin:: Widgets/Stats2-3 -->
                      </div>
                    <?php } ?>
                  </div>
                </div>
              </div>
              <div class="m-portlet">
                <div class="m-portlet__body m-portlet__body--no-padding">
                  <div class="row m-row--no-padding m-row--col-separator-xl">

                    <div class="col-md-12 col-lg-12 col-xl-2">
                      <!--begin:: Widgets/Stats2-3 -->
                      <div class="m-widget1">
                        <div class="m-widget1__item">
                          <div class="row m-row--no-padding align-items-center">
                            <span class="m-widget1__number m--font-info">
                              <label class="total_purchase_payment_info"></label>
                            </span>
                          </div>
                          <h3 class="m-widget1__title">
                            Purchase Payments
                          </h3>
                        </div>
                      </div>
                      <!--begin:: Widgets/Stats2-3 -->
                    </div>
                    <?php if($this->session->userdata('user_role')!='purchase_manager'){?>
                      <div class="col-md-12 col-lg-12 col-xl-2">
                        <!--begin:: Widgets/Stats2-3 -->
                        <div class="m-widget1">
                          <div class="m-widget1__item">
                            <div class="row m-row--no-padding align-items-center">
                              <span class="m-widget1__number m--font-info">
                                <label class="total_subcontract_payment_info"></label>
                              </span>
                            </div>
                            <h3 class="m-widget1__title">
                              Subcontract Payments
                            </h3>
                          </div>
                        </div>
                        <!--begin:: Widgets/Stats2-3 -->
                      </div>
                      <div class="col-md-12 col-lg-12 col-xl-2">
                        <?php if ($this->config->item('app_module_tools_management') == 1){?>
                          <!--begin:: Widgets/Stats2-3 -->
                          <div class="m-widget1">
                            <div class="m-widget1__item">
                              <div class="row m-row--no-padding align-items-center">
                                <span class="m-widget1__number m--font-info">
                                  <label class="total_tool_payments_info"></label>
                                </span>
                              </div>
                              <h3 class="m-widget1__title">
                                Tools Payments
                              </h3>
                            </div>
                          </div>
                          <!--begin:: Widgets/Stats2-3 -->
                        <?php } ?>
                      </div>
                      <div class="col-md-12 col-lg-12 col-xl-2">
                        <!--begin:: Widgets/Stats2-3 -->
                        <div class="m-widget1">
                          <div class="m-widget1__item">
                            <div class="row m-row--no-padding align-items-center">
                              <span class="m-widget1__number m--font-info">
                                <label class="total_other_expense_payments_info"></label>
                              </span>
                            </div>
                            <h3 class="m-widget1__title">
                              Other Expense Payments
                            </h3>
                          </div>

                        </div>
                        <!--begin:: Widgets/Stats2-3 -->
                      </div>
                      <div class="col-md-12 col-lg-12 col-xl-2">
                        <!--begin:: Widgets/Stats2-3 -->
                        <div class="m-widget1">
                          <div class="m-widget1__item">
                            <div class="row m-row--no-padding align-items-center">
                              <span class="m-widget1__number m--font-info">
                                <label class="total_salary_payment_info"></label>
                              </span>
                            </div>
                            <h3 class="m-widget1__title">
                              Salary Payments
                            </h3>
                          </div>

                        </div>
                        <!--begin:: Widgets/Stats2-3 -->
                      </div>
                      <div class="col-md-12 col-lg-12 col-xl-2">
                        <?php if ($this->config->item('app_module_vehicle') == 1){?>
                          <!--begin:: Widgets/Stats2-3 -->
                          <div class="m-widget1">
                            <div class="m-widget1__item">
                              <div class="row m-row--no-padding align-items-center">
                                <span class="m-widget1__number m--font-info">
                                  <label class="total_vehicle_payments_info"></label>
                                </span>
                              </div>
                              <h3 class="m-widget1__title">
                                Vehicle Payments
                              </h3>
                            </div>

                          </div>
                        <?php } ?>
                        <!--begin:: Widgets/Stats2-3 -->
                      </div>
                    <?php } ?>
                  </div>
                </div>
              </div>
            <?php } ?>

            <div class="m-portlet">
              <div class="m-portlet__body m-portlet__body--no-padding">
                <div class="row m-row--no-padding m-row--col-separator-xl">
                  <?php
                  $col_size='col-lg-4 col-xl-4';
                  if($work_data->project_management_commission>0 || $work_data->profit_margin_percent>0){
                    $col_size='col-lg-2 col-xl-2';
                  }
                  if($this->session->userdata('user_role')=='admin' || $this->session->userdata('user_role')=='auditor' || ($this->session->userdata('user_role')=='general_manager' && $this->config->item('User_general_manager_show_profit')==1)){?>
                    <?php if($work_data->project_management_commission>0){ ?>
                      <div class="col-md-12 <?php echo $col_size?>">
                        <!--begin:: Widgets/Stats2-3 -->
                        <div class="m-widget1">
                          <div class="m-widget1__item">
                            <div class="row m-row--no-padding align-items-center">
                              <span class="m-widget1__number m--font-success">
                                <label class="total_pm_commission_exclude_tax_info"></label>
                              </span>
                              <h3 class="m-widget1__title">
                                Project Commission Amt <br/>(Excl. Tax)
                              </h3>
                            </div>
                          </div>
                        </div>
                        <!--begin:: Widgets/Stats2-3 -->
                      </div>
                      <div class="col-md-12 <?php echo $col_size?>">
                        <!--begin:: Widgets/Stats2-3 -->
                        <div class="m-widget1">
                          <div class="m-widget1__item">
                            <div class="row m-row--no-padding align-items-center">
                              <span class="m-widget1__number m--font-success">
                                <label class="total_pm_commission_include_tax_info"></label>
                              </span>
                              </div>
                              <h3 class="m-widget1__title">
                                Project Commission Amt <br/>(Incl. Tax)
                              </h3>
                          </div>
                        </div>
                        <!--begin:: Widgets/Stats2-3 -->
                      </div>
                    <?php } ?>
                    <?php if($work_data->profit_margin_percent>0){ ?>
                      <div class="col-md-12 <?php echo $col_size?>">
                        <!--begin:: Widgets/Stats2-3 -->
                        <div class="m-widget1">
                          <div class="m-widget1__item">
                            <div class="row m-row--no-padding align-items-center">
                              <span class="m-widget1__number m--font-success">
                                <label class="total_profit_margin_percent_info"></label>
                              </span>
                              </div>
                              <h3 class="m-widget1__title">
                                Profit Margin %
                              </h3>
                          </div>
                        </div>
                        <!--begin:: Widgets/Stats2-3 -->
                      </div>
                      <div class="col-md-12 <?php echo $col_size?>">
                        <!--begin:: Widgets/Stats2-3 -->
                        <div class="m-widget1">
                          <div class="m-widget1__item">
                            <div class="row m-row--no-padding align-items-center">
                              <span class="m-widget1__number m--font-success">
                                <label class="total_profit_margin_amt_info"></label>
                              </span>
                              </div>
                              <h3 class="m-widget1__title">
                                Profit Margin Amt
                              </h3>
                          </div>
                        </div>
                        <!--begin:: Widgets/Stats2-3 -->
                      </div>
                    <?php } ?>
                    <?php if ($this->config->item('app_module_client_payments') == 1 ){?>
                      <div class="col-md-12 <?php echo $col_size?>">
                        <!--begin:: Widgets/Stats2-3 -->
                        <div class="m-widget1">
                          <div class="m-widget1__item">
                            <div class="row m-row--no-padding align-items-center">
                              <span class="m-widget1__number m--font-success">
                                <label class="total_payable_credit_info"></label>
                              </span>
                              </div>
                              <h3 class="m-widget1__title">
                                Payable Credits
                              </h3>
                          </div>
                        </div>
                        <!--begin:: Widgets/Stats2-3 -->
                      </div>
                      <div class="col-md-12 <?php echo $col_size?>">
                        <!--begin:: Widgets/Stats2-3 -->
                        <div class="m-widget1">
                          <div class="m-widget1__item">
                            <div class="row m-row--no-padding align-items-center">
                              <span class="m-widget1__number m--font-success">
                                <label class="total_profit_info"></label>
                              </span>
                              </div>
                              <h3 class="m-widget1__title">
                                Actual Profit
                              </h3>
                          </div>
                        </div>
                        <!--begin:: Widgets/Stats2-3 -->
                      </div>
                      <div class="col-md-12 <?php echo $col_size?>">
                        <!--begin:: Widgets/Stats2-3 -->
                        <div class="m-widget1">
                          <div class="m-widget1__item">
                            <div class="row m-row--no-padding align-items-center">
                              <span class="m-widget1__number m--font-danger">
                                <label class="total_balance_info"></label>
                              </span>
                              </div>
                              <h3 class="m-widget1__title">
                                Balance to Receive on Budget
                              </h3>
                          </div>
                        </div>
                        <!--begin:: Widgets/Stats2-3 -->
                      </div>
                    <?php } ?>
                  <?php } ?>
                </div>
              </div>
            </div>
            <?php if($this->session->userdata('user_role')!='boq_manager' && $this->session->userdata('user_role') != 'qs_manager' && $this->session->userdata('user_role') != 'qs'){?>
              <div class="m-portlet  m-portlet--rounded m-portlet--bordered">
                <div class="m-portlet__body">
                  <h3 class="m-portlet__head-text" style="text-align: center">
                    Sub Projects List
                  </h3>
                  <div class="m-section">
											<div class="m-section__content">
												<table class="table table-bordered m-table m-table--border-info m-table--head-bg-info">
													<thead>
														<tr>
                              <th>Sl No</th>
                              <th>Project ID & Name</th>
                              <th>Assigned Supervisors</th>
                              <th>Location</th>
                              <?php if ($this->session->userdata('user_role') == 'admin') { ?>
                                <th>Total Budget Amount</th>
                              <?php } ?>
                              <th>Project Status</th>
                              <th>Other Details</th>
														</tr>
													</thead>
													<tbody>
                            <?php foreach ($sub_projects as $key => $value) {
                              $assigned_users = "";
                              if($value->location_area!='' && $value->location_area!=0){
                                // Get Area Manager
                                $where = "((FIND_IN_SET($value->location_area,u.project_area_location)) and u.user_role=9 and u.project_area_location!=0)";// Area Manager
                                $area_managers = $this->User->select_user("u.user_id,u.user_alias",$where)->result();
                                foreach ($area_managers as $key1 => $value1) {
                                  $assigned_users.=$value1->user_alias.", ";
                                }
                              }
                              $assigned_users .= $value->users_assigned;
                              $assigned_users = rtrim($assigned_users, ', ');

                              $other_details = '';
                              if($value->lpo_no!=''){
                                $other_details .= 'LPO No: '.$value->lpo_no.'<br/>';
                              }
                              if($value->reference_no_2!=''){
                                $other_details .= $this->config->item('Project_reference_no_2_title').': '.$value->reference_no_2;
                              }

                              if($value->work_status==1){
                                $work_status="<span class='m-badge m-badge--success m-badge--wide'><i class='fa fa-check'></i> Completed</span>";
                                if($value->project_completed_date!='0000-00-00'){
                                  $work_status.="<br/>On ".date('d-m-Y',strtotime($value->project_completed_date));
                                }
                              }elseif($value->work_status==3){
                                $work_status="<span class='m-badge m-badge--warning m-badge--wide'><i class='fa fa-ellipsis-h'></i> Freeze</span>";
                              }else{
                                $work_status="<span class='m-badge m-badge--info m-badge--wide'><i class='fa fa-ellipsis-h'></i> In Progress</span>";
                              }
                              ?>
                              <tr>
  															<th scope="row"><?php echo $key+1?></th>
  															<td><?php echo '<a style="font-size:15px" href="'.base_url().'work/profile/'.$value->work_id.'"><strong>'.$value->work_name.'</strong></a>'; ?></td>
  															<td><?php echo $assigned_users ?></td>
  															<td><?php echo $value->work_location ?></td>
                                  <?php if ($this->session->userdata('user_role') == 'admin') { ?>
                                <td><?php echo $this->config->item('Currency_currency_format')." ".$this->config->item('currency_format')->formatCurrency($value->total_budget_amount,$this->config->item('Currency_currency_shortname')) ?></td>
                                <?php } ?>
                                <td><?php echo $work_status ?></td>
                                <td><?php echo $other_details ?></td>
  														</tr>
                            <?php } ?>
													</tbody>
												</table>
											</div>
										</div>
                </div>
                </div>
              <div class="m-portlet  m-portlet--rounded m-portlet--bordered">
                <div class="m-portlet__body">
                  <h3 class="m-portlet__head-text" style="text-align: center">
                    Sub Projects Overall Summary
                  </h3>
                  <table width="100%" class="table m-table nowrap table-header-fixed table-striped table-bordered table-hover table-header-fixed" id="table_summary">
                    <thead>
                      <tr class="">
                        <th>Heads</th>
                        <th>Amount</th>
                      </tr>
                    </thead>
                    <tbody>

                      <?php if($this->session->userdata('user_role')=='admin' || $this->session->userdata('user_role')=='auditor' || ($this->session->userdata('user_role')=='general_manager' && $this->config->item('User_general_manager_show_profit')==1)){?>
                        <?php if($this->config->item('Project_multiple_budget')==1){
                          $budget_details = unserialize($work_data->project_budget_details);
                          foreach ($budget_details as $key => $value) { ?>
                            <tr>
                              <td>Project Budget - <?php echo $value['section']?>
                                <?php if($value['tax_percent']!=0){ echo "[".$value['tax_percent']."% ".$this->config->item('Tax_tax_name')."]";}?></td>
                                <td><?php echo $this->config->item('Currency_currency_format')." ".$this->config->item('currency_format')->formatCurrency($value['total'],$this->config->item('Currency_currency_shortname'))?></td>
                              </tr>
                            <?php }
                            ?>
                          <?php }else{ ?>
                            <tr>
                              <td>Project Budget Estimated</td>
                              <strong><td class="project_budget_info"></td></strong>
                            </tr>
                          <?php } ?>
                          <tr>
                            <td>Custom Requirement Budget Estimated</td>
                            <strong><td class="total_custom_requirement_amount_info"></td></strong>
                          </tr>
                          <tr>
                            <td>Total Project Budget</td>
                            <strong><td class="total_project_budget_info"></td></strong>
                          </tr>
                          <?php if($work_data->project_management_commission>0){ ?>
                            <tr>
                              <td>Total Project Management Commission Amount (Exclude Tax)</td>
                              <strong><td class="total_pm_commission_exclude_tax_info"></td></strong>
                            </tr>
                            <tr>
                              <td>Total Project Management Commission Amount (Include Tax)</td>
                              <strong><td class="total_pm_commission_include_tax_info"></td></strong>
                            </tr>
                          <?php } ?>
                          <?php if($work_data->profit_margin_percent>0){ ?>
                            <tr>
                              <td>Profit Margin %</td>
                              <strong><td class="total_profit_margin_percent_info"></td></strong>
                            </tr>
                            <tr>
                              <td>Total Project Margin Amount</td>
                              <strong><td class="total_profit_margin_amt_info"></td></strong>
                            </tr>
                          <?php } ?>
                        <?php } ?>
                        <?php if($this->session->userdata('user_role')!='supervisor'){?>
                          <tr>
                            <td></td>
                            <td></td>
                          </tr>
                          <?php if($this->session->userdata('user_role')!='purchase_manager' && $this->session->userdata('user_role')!='boq_manager'){?>
                            <?php if ($this->config->item('app_module_client_payments') == 1 ){?>
                              <tr>
                                <td>Total Client Invoice Receivable</td>
                                <strong><td class="total_client_invoice_receivable_info"></td></strong>
                              </tr>
                              <tr>
                                <td>Total Received on Invoice</td>
                                <strong><td class="total_client_invoice_received_info"></td></strong>
                              </tr>
                              <tr>
                                <td>Balance to Receive on Invoice</td>
                                <strong><td class="total_client_invoice_balance_info"></td></strong>
                              </tr>
                              <tr>
                                <td>Total Client Payment Received (Invoice + Advance)</td>
                                <strong><td class="total_received_from_client_info"></td></strong>
                              </tr>
                            <?php } ?>
                          <?php } ?>
                          <tr>
                            <td>Total Purchase Bill Commissions Received</td>
                            <strong><td class="purchase_bill_commission_info"></td></strong>
                          </tr>
                          <tr>
                            <td></td>
                            <td></td>
                          </tr>
                        <?php } ?>
                        <?php if ($this->config->item('app_module_purchase_order') == 1){?>
                          <tr>
                            <td>Total Purchase Order Amount (Not Included in Project Cost)</td>
                            <strong><td class="total_purchases_order_info"></td></strong>
                          </tr>
                        <?php } ?>
                        <tr>
                          <td>Total Purchase Bill Amount</td>
                          <strong><td class="total_purchases_bill_info"></td></strong>
                        </tr>
                        <?php if($this->config->item('app_module_purchase_order')==1){?>
                          <tr>
                            <td>Purchase Order Payments Made (Advances)</td>
                            <strong><td class="total_purchase_order_payments_info"></td></strong>
                          </tr>
                        <?php } ?>
                        <tr>
                          <td>Purchase Bill Payments Made</td>
                          <strong><td class="total_purchases_bill_payment_info"></td></strong>
                        </tr>
                        <?php if($this->config->item('app_module_purchase_order')==1){?>
                          <tr>
                            <td>Total Purchase Payments Made (Purchase Bill + Purchase Order)</td>
                            <strong><td class="total_purchase_payment_info"></td></strong>
                          </tr>
                        <?php } ?>
                        <tr>
                          <td>Pending Purchase Bill Payments</td>
                          <strong><td class="total_purchases_bill_pending_info"></td></strong>
                        </tr>
                        <tr>
                          <td>Total Purchase Return Amount</td>
                          <strong><td class="total_purchases_return_info"></td></strong>
                        </tr>
                        <tr>
                          <td></td>
                          <td></td>
                        </tr>
                        <?php if($this->config->item('app_module_stock_management')==1){?>
                          <tr>
                            <td>Total Stock Purchased Amount</td>
                            <strong><td class="total_purchases_bill_info"></td></strong>
                          </tr>
                          <tr>
                            <td>Total Stock Transfer In Amount</td>
                            <strong><td class="total_stock_transfer_in_info"></td></strong>
                          </tr>
                          <tr>
                            <td>Total Stock Transfer Out Amount</td>
                            <strong><td class="total_stock_transfer_out_info"></td></strong>
                          </tr>
                          <tr>
                            <td>Total Stock Consumed Amount</td>
                            <strong><td class="total_stock_consumed_info"></td></strong>
                          </tr>
                          <!-- <tr>
                          <td>Total Stock Returned Amount</td>
                          <strong><td class="total_stock_returned_info"></td></strong>
                        </tr> -->
                        <tr>
                          <td>Total Stock Balance Amount</td>
                          <strong><td class="total_stock_balance_info"></td></strong>
                        </tr>
                        <tr>
                          <td></td>
                          <td></td>
                        </tr>
                      <?php } ?>
                      <?php if($this->session->userdata('user_role')!='purchase_manager'){?>
                        <?php if ($this->config->item('app_module_vehicle') == 1){?>
                          <tr>
                            <td>Total Vehicle Work Slip Amount</td>
                            <strong><td class="total_vehicle_work_slip_amount"></td></strong>
                          </tr>
                          <tr>
                            <td>Total Vehicle Work Slip Payment</td>
                            <strong><td class="total_vehicle_payments_info"></td></strong>
                          </tr>
                        <?php } ?>
                        <tr>
                          <td>Total Subcontract Budget</td>
                          <strong><td class="total_subcontract_budget_info"></td></strong>
                        </tr>
                        <tr>
                          <td>Total Subcontract Bill Amount</td>
                          <strong><td class="total_subcontract_bill_info"></td></strong>
                        </tr>
                        <tr>
                          <td>Total Subcontract Payments (Bill+Advance)</td>
                          <strong><td class="total_subcontract_payment_info"></td></strong>
                        </tr>
                      <?php } ?>
                      <?php if($this->session->userdata('user_role')!='purchase_manager'){?>
                        <?php if ($this->config->item('app_module_labours') == 1){?>
                          <tr>
                            <td>Total Labour Wages</td>
                            <strong><td class="total_labour_wages_info"></td></strong>
                          </tr>
                        <?php } ?>
                      <?php } ?>
                      <?php if($this->session->userdata('user_role')!='purchase_manager'){?>
                        <tr>
                          <td>Total Salary Slip Amount</td>
                          <strong><td class="total_salary_slip_amount_info"></td></strong>
                        </tr>
                        <tr>
                          <td>Total Salary Payments</td>
                          <strong><td class="total_salary_payment_info"></td></strong>
                        </tr>
                      <?php } ?>
                      <?php if($this->session->userdata('user_role')!='purchase_manager'){?>
                        <tr>
                          <td>Total Other Expense Bill Amount</td>
                          <strong><td class="total_other_expense_bill_info"></td></strong>
                        </tr>
                      <?php }?>
                      <?php if($this->session->userdata('user_role')!='purchase_manager'){?>
                        <tr>
                          <td>Total Other Expense Payments</td>
                          <strong><td class="total_other_expense_payments_info"></td></strong>
                        </tr>
                      <?php }?>
                      <?php if($this->session->userdata('user_role')!='purchase_manager'){?>
                        <?php if($this->config->item('User_project_commission_payment')==1){ ?>
                          <tr>
                            <td>Total User Commission Payments</td>
                            <strong><td class="total_user_commission_payment_info"></td></strong>
                          </tr>
                        <?php } ?>
                      <?php } ?>
                      <?php if($this->session->userdata('user_role')!='purchase_manager'){?>
                        <?php if ($this->config->item('app_module_tools_management') == 1) { ?>
                          <tr>
                            <td>Total Tool Rent/Transfer Payments</td>
                            <strong><td class="total_tool_payments_info"></td></strong>
                          </tr>
                        <?php } ?>
                      <?php } ?>
                      <tr>
                        <td>Project Management Fees</td>
                        <strong><td class="total_project_management_fees_info"></td></strong>
                      </tr>
                      <tr>
                        <td>Project Supervision Charge</td>
                        <strong><td class="total_project_supervision_charge_info"></td></strong>
                      </tr>
                      <tr>
                        <td></td>
                        <td></td>
                      </tr>
                      <?php if($this->session->userdata('user_role')!='purchase_manager'){?>
                        <tr>
                          <td>Total Expense Payments</td>
                          <strong><td class="total_expense_payments_info"></td></strong>
                        </tr>
                        <tr>
                          <td>Total Project Cost (Including Stock Transfer)</td>
                          <strong><td class="total_project_cost_info"></td></strong>
                        </tr>
                        <?php  if($this->config->item('Project_commited_amount_show')==1){ ?>
                          <tr>
                            <td>Total Committed Amount (PO+Subcontract+Project Cost-Purchase Bill-Subcontract Payment)</td>
                            <strong><td class="total_committed_amount_info"></td></strong>
                          </tr>
                        <?php } ?>
                        <tr>
                          <td>Total Payable Credit Balance (Exclude Labour)</td>
                          <strong><td class="total_payable_credit_info"></td></strong>
                        </tr>
                      <?php } ?>
                      <?php if($this->session->userdata('user_role')=='admin' || $this->session->userdata('user_role')=='auditor' || ($this->session->userdata('user_role')=='general_manager' && $this->config->item('User_general_manager_show_profit')==1)){?>
                        <?php if($work_data->work_type==1){ ?>
                          <tr>
                            <td>Total Project Management Commission</td>
                            <strong><td class="total_commission_info"></td></strong>
                          </tr>
                        <?php } ?>
                        <?php if ($this->config->item('app_module_client_payments') == 1 ){?>
                          <tr>
                            <td>Total Amount to Receive From Client</td>
                            <strong><td class="total_amount_to_receive_info"></td></strong>
                          </tr>
                          <tr>
                            <td>Actual Received</td>
                            <strong><td class="total_received_from_client_info"></td></strong>
                          </tr>
                          <tr>
                            <td>Balance to Receive on Budget</td>
                            <strong><td class="total_balance_info"></td></strong>
                          </tr>
                          <tr>
                            <td>Total Project Profit (Actual Received - Actual Expense)</td>
                            <strong><td class="total_profit_info"></td></strong>
                          </tr>
                        <?php } ?>
                      <?php } ?>
                    </tbody>
                  </table>
                </div>
              </div>
              <div class="m-portlet  m-portlet--rounded m-portlet--bordered">
                <div class="m-portlet__body">
                  <h3 class="m-portlet__head-text" style="text-align: center">
                    Project Cost Summary
                  </h3>
                  <table width="100%" class="table m-table nowrap table-header-fixed table-striped table-bordered table-hover table-header-fixed" id="table_summary">
                    <thead>
                      <tr class="">
                        <th>Heads</th>
                        <th>Amount</th>
                      </tr>
                    </thead>
                    <tbody>
                        <tr>
                          <td>Total Purchase Bill Amount (+)</td>
                          <strong><td class="total_purchases_bill_info"></td></strong>
                        </tr>
                        <tr>
                          <td>Total Stock Transfer In Amount (+)</td>
                          <strong><td class="total_stock_transfer_in_info"></td></strong>
                        </tr>

                      <?php if($this->session->userdata('user_role')!='purchase_manager'){?>
                        <?php if ($this->config->item('app_module_vehicle') == 1){?>
                          <tr>
                            <td>Total Vehicle Work Slip Amount (+)</td>
                            <strong><td class="total_vehicle_work_slip_amount"></td></strong>
                          </tr>
                        <?php } ?>
                        <tr>
                          <td>Total Subcontract Payments (Bill+Advance) (+)</td>
                          <strong><td class="total_subcontract_payment_info"></td></strong>
                        </tr>
                      <?php } ?>
                      <?php if($this->session->userdata('user_role')!='purchase_manager'){?>
                        <?php if ($this->config->item('app_module_labours') == 1){?>
                          <tr>
                            <td>Total Labour Wages (+)</td>
                            <strong><td class="total_labour_wages_info"></td></strong>
                          </tr>
                        <?php } ?>
                      <?php } ?>
                      <?php if($this->session->userdata('user_role')!='purchase_manager'){?>
                        <tr>
                          <td>Total Salary Slip Amount (+)</td>
                          <strong><td class="total_salary_slip_amount_info"></td></strong>
                        </tr>
                      <?php } ?>
                      <?php if($this->session->userdata('user_role')!='purchase_manager'){?>
                        <tr>
                          <td>Total Other Expense Bill Amount (+)</td>
                          <strong><td class="total_other_expense_bill_info"></td></strong>
                        </tr>
                      <?php }?>
                      <?php if($this->session->userdata('user_role')!='purchase_manager'){?>
                        <?php if($this->config->item('User_project_commission_payment')==1){ ?>
                          <tr>
                            <td>Total User Commission Payments (+)</td>
                            <strong><td class="total_user_commission_payment_info"></td></strong>
                          </tr>
                        <?php } ?>
                      <?php } ?>
                      <?php if($this->session->userdata('user_role')!='purchase_manager'){?>
                        <?php if ($this->config->item('app_module_tools_management') == 1) { ?>
                          <tr>
                            <td>Total Tool Rent/Transfer Payments (+)</td>
                            <strong><td class="total_tool_payments_info"></td></strong>
                          </tr>
                        <?php } ?>
                      <?php } ?>
                      <tr>
                        <td></td>
                        <td></td>
                      </tr>
                      <tr>
                        <td>Total Purchase Return Amount (-)</td>
                        <strong><td class="total_purchases_return_info"></td></strong>
                      </tr>
                      <tr>
                        <td>Total Stock Transfer Out Amount (-)</td>
                        <strong><td class="total_stock_transfer_out_info"></td></strong>
                      </tr>
                      <tr>
                        <td></td>
                        <td></td>
                      </tr>
                      <?php if($this->session->userdata('user_role')!='purchase_manager'){?>
                        <tr>
                          <td>Total Project Cost</td>
                          <strong><td class="total_project_cost_info"></td></strong>
                        </tr>
                      <?php } ?>
                    </tbody>
                  </table>
                </div>
              </div>
            <?php } ?>
          </div>

          <div id="div_info" class="profile_nav_div">
            <div class="m-portlet">
              <div class="m-portlet__head">
                <div class="m-portlet__head-caption">
                  <div class="m-portlet__head-title">
                    <h3 class="m-portlet__head-text">
                      Project Info
                    </h3>
                  </div>
                </div>
              </div>
              <div class="m-portlet__body">
                <form autocomplete="off" class="m-form m-form--fit m-form--label-align-right">
                  <div class="m-portlet__body">
                    <div class="form-group m-form__group row">
                      <div class="col-9 ml-auto">
                        <h4 class="m-form__section">
                          1. Project Details
                        </h4>
                      </div>
                    </div>
                    <div class="row">
                      <div class="col-lg-6">
                        <div class="form-group m-form__group">
                          <label>
                            Project Status
                          </label>
                          <br/>
                          <?php if($work_data->work_status==1){
                            $completed_date = '';
                            if($work_data->project_completed_date!='0000-00-00'){
                              $completed_date = 'On '.date('d-m-Y', strtotime($work_data->project_completed_date));
                            }
                            ?>
                            <span class='m-badge m-badge--success m-badge--wide'><i class="fa fa-check"></i> Completed <?= $completed_date ?></span>
                          <?php }else{ ?>
                            <span class='m-badge m-badge--info m-badge--wide'><i class="fa fa-ellipsis-h"></i>In Progress</span>
                          <?php } ?>
                          <br/>
                          <span class="m-form__help"></span>
                        </div>
                      </div>
                    </div>
                    <div class="row">
                      <div class="col-lg-4">
                        <div class="form-group m-form__group">
                          <label>
                            Project Section
                          </label>
                          <input disabled value="<?php echo $work_data->project_section?>" type="text"  class="form-control m-input m-input--pill m-input--air"  aria-describedby="basic-addon1">
                          <span class="m-form__help"></span>
                        </div>
                      </div>
                      <div class="col-lg-4">
                        <div class="form-group m-form__group">
                          <label>
                            Project Category
                          </label>
                          <input disabled value="<?php echo $work_data->wcat_name?>" type="text"  class="form-control m-input m-input--pill m-input--air"  aria-describedby="basic-addon1">
                          <span class="m-form__help"></span>
                        </div>
                      </div>
                      <div class="col-lg-4">
                        <div class="form-group m-form__group">
                          <label>
                            <?php echo $this->config->item('Project_reference_no_title') ?>
                          </label>
                          <div class="m-input-icon m-input-icon--right">
                            <input disabled value="<?php echo $work_data->reference_no?>" type="text"  class="form-control m-input m-input--pill m-input--air"  aria-describedby="basic-addon1">
                            <span class="m-input-icon__icon m-input-icon__icon--right"><span><i class="la la-tag"></i></span></span>
                          </div>
                          <span class="m-form__help"></span>
                        </div>
                      </div>
                    </div>
                    <div class="form-group m-form__group">
                      <label>
                        Project Name
                      </label>
                      <div class="m-input-icon m-input-icon--right">
                        <input disabled value="<?php echo $work_data->work_name?>" type="text"  class="form-control m-input m-input--pill m-input--air"  aria-describedby="basic-addon1">
                        <span class="m-input-icon__icon m-input-icon__icon--right"><span><i class="la la-tag"></i></span></span>
                      </div>
                      <span class="m-form__help"></span>
                    </div>

                    <div class="row">
                      <div class="col-lg-8">
                        <div class="form-group m-form__group">
                          <label>
                            Location
                          </label>
                          <div class="m-input-icon m-input-icon--right">
                            <input disabled value="<?php echo $work_data->work_location?>" type="text" class="form-control m-input m-input--pill m-input--air"  aria-describedby="basic-addon1">
                            <span class="m-input-icon__icon m-input-icon__icon--right"><span><i class="fa fa-map-marked"></i></span></span>
                          </div>
                          <span class="m-form__help"></span>
                        </div>
                      </div>
                      <div class="col-lg-4">
                        <div class="form-group m-form__group">
                          <label>
                            Location Area
                          </label>
                          <input disabled value="<?php echo $work_data->area_name?>" type="text"  class="form-control m-input m-input--pill m-input--air"  aria-describedby="basic-addon1">
                          <span class="m-form__help"></span>
                        </div>
                      </div>
                    </div>
                    <div class="row">
                      <div class="col-lg-7">
                        <div class="row">
                          <div class="col-lg-6">
                            <div class="form-group m-form__group">
                              <label>
                                Starting Date
                              </label>
                              <div class="m-input-icon m-input-icon--right">
                                <input disabled value="<?php if($work_data->planned_date_of_start!='0000-00-00'){echo date('d-m-Y',strtotime($work_data->planned_date_of_start));}?>"  type="text"  class="form-control m-input m-input--pill m-input--air"  aria-describedby="basic-addon1">
                                <span class="m-input-icon__icon m-input-icon__icon--right"><span><i class="fa fa-calendar"></i></span></span>
                              </div>
                              <span class="m-form__help"></span>
                            </div>
                          </div>
                          <div class="col-lg-6">
                            <div class="form-group m-form__group">
                              <label>
                                Completion Date
                              </label>
                              <div class="m-input-icon m-input-icon--right">
                                <input disabled value="<?php if($work_data->planned_date_of_completion!='0000-00-00'){echo date('d-m-Y',strtotime($work_data->planned_date_of_completion));}?>"  type="text"  class="form-control m-input m-input--pill m-input--air"   aria-describedby="basic-addon1">
                                <span class="m-input-icon__icon m-input-icon__icon--right"><span><i class="fa fa-calendar"></i></span></span>
                              </div>
                              <span class="m-form__help"></span>
                            </div>
                          </div>
                        </div>
                      </div>
                      <div class="col-lg-5">
                        <div class="form-group m-form__group">
                          <label>
                            Priority
                          </label>
                          <div class="m-radio-inline" style="padding-top: 10px;">
                            <label class="m-radio m-radio--solid m-radio--state-danger">
                              <input type="radio" class="form_fields_radio"  name="project_priority" value="1"> High
                              <span></span>
                            </label>
                            <label class="m-radio m-radio--solid m-radio--state-warning">
                              <input type="radio" class="form_fields_radio" name="project_priority"  value="2"> Med
                              <span></span>
                            </label>
                            <label class="m-radio m-radio--solid m-radio--state-info">
                              <input type="radio" class="form_fields_radio" name="project_priority"  value="0"> Low
                              <span></span>
                            </label>
                          </div>
                          <span class="m-form__help"></span>
                        </div>
                      </div>
                    </div>
                    <div class="row">
                      <div class="col-lg-12">
                        <div class="form-group m-form__group">
                          <label>
                            Client
                          </label>
                          <input disabled value="<?php echo $work_data->client_name?>" type="text"  class="form-control m-input m-input--pill m-input--air"  aria-describedby="basic-addon1">
                          <span class="m-form__help"></span>
                        </div>
                      </div>
                    </div>
                    <?php if($this->session->userdata('user_role')=='admin'){?>
                      <?php if($this->config->item('Project_multiple_budget')==1){ ?>
                        <div style="background: white;border: 4px solid #f7f7fa;padding: 15px;margin: 5px;padding-bottom: 0px">
                          <div class="m-section" style="margin-bottom: 10px">
                            <h3 class="m-section__heading">Project Budget</h3>
                            <div class="row">
                              <div class="col-lg-12">
                                <table style="width: 100%;max-width: 100%" id="table_budget" class="table m-table table-bordered item_table m-table--head-bg-success">
                                  <thead>
                                    <tr>
                                      <th style="width:8%;text-align:left;color:white">Sl No</th>
                                      <th style="width:20%;text-align:left;color:white">Section Name</th>
                                      <th style="width:20%;text-align:left;color:white">Estimated Budget Amt</th>
                                      <th style="width:20%;text-align:left;color:white"><?php echo $this->config->item('Tax_tax_name')?> %</th>
                                      <th style="width:20%;text-align:left;color:white"><?php echo $this->config->item('Tax_tax_name')?> Amount</th>
                                      <th style="width:20%;text-align:left;color:white">Total</th>
                                    </tr>
                                  </thead>
                                  <tbody id="table_body_budget">
                                    <?php
                                    $budget_details = unserialize($work_data->project_budget_details);
                                    foreach ($budget_details as $key => $value) { ?>
                                      <tr>
                                        <td><?php echo $key+1?></td>
                                        <td><?php echo $value['section']?></td>
                                        <td><?php echo $this->config->item('Currency_currency_format')." ".$this->config->item('currency_format')->formatCurrency($value['amount'],$this->config->item('Currency_currency_shortname'))?></td>
                                        <td><?php echo $value['tax_percent']."% ".$this->config->item('Tax_tax_name')?></td>
                                        <td><?php echo $this->config->item('Currency_currency_format')." ".$this->config->item('currency_format')->formatCurrency($value['tax_amount'],$this->config->item('Currency_currency_shortname'))?></td>
                                        <td><?php echo $this->config->item('Currency_currency_format')." ".$this->config->item('currency_format')->formatCurrency($value['total'],$this->config->item('Currency_currency_shortname'))?></td>
                                      </tr>
                                    <?php } ?>
                                  </tbody>
                                </table>
                              </div>
                            </div>
                            <div class="row">
                              <div class="col-lg-8"></div>
                              <div class="col-lg-4">
                                <div class="form-group m-form__group" >
                                  <label for="user_name">
                                    Total Project Budget
                                  </label>
                                  <div class="m-input-icon m-input-icon--right">
                                    <input value="<?php echo $this->config->item('currency_format')->formatCurrency($work_data->total_budget_amount,$this->config->item('Currency_currency_shortname'))?>" style="font-weight:700;border: 3px solid #b3b3b3 !important;" readonly type="text" class="form-control m-input m-input--pill m-input--air"  aria-describedby="basic-addon1">
                                    <span class="m-input-icon__icon m-input-icon__icon--right"><span><?php echo $this->config->item('Currency_currency_format') ?></span></span>
                                  </div>
                                </div>
                                <span class="m-form__help"></span>
                              </div>
                            </div>
                          </div>
                        </div>
                        <br/>
                      <?php }else{ ?>
                        <div class="row">
                          <div class="col-lg-4">
                            <div class="form-group m-form__group">
                              <label>
                                Estimated Budget
                              </label>
                              <div class="m-input-icon m-input-icon--right">
                                <input disabled value="<?php echo $work_data->est_budget_amt?>"  type="text" class="form-control m-input m-input--pill m-input--air" aria-describedby="basic-addon1">
                                <span class="m-input-icon__icon m-input-icon__icon--right"><span><?php echo $this->config->item('Currency_currency_format') ?></span></span>
                              </div>
                              <span class="m-form__help"></span>
                            </div>
                          </div>
                          <div class="col-lg-4">
                            <div class="form-group m-form__group" >
                              <label for="user_name">
                                <?php echo $this->config->item('Tax_tax_name')?> %
                              </label>
                              <input disabled value="<?php echo $work_data->project_tax_percent?>" type="text"  class="form-control m-input m-input--pill m-input--air"  aria-describedby="basic-addon1">
                            </div>
                            <span class="m-form__help"></span>
                          </div>
                          <div class="col-lg-4">
                            <div class="form-group m-form__group">
                              <label>
                                <?php echo $this->config->item('Tax_tax_name')?> Amount
                              </label>
                              <div class="m-input-icon m-input-icon--right">
                                <input readonly value="<?php echo $work_data->project_tax_amount ?>" type="text" class="form-control m-input m-input--pill m-input--air" aria-describedby="basic-addon1">
                                <span class="m-input-icon__icon m-input-icon__icon--right"><span><?php echo $this->config->item('Currency_currency_format'); ?></span></span>
                              </div>
                              <span class="m-form__help"></span>
                            </div>
                          </div>
                        </div>
                      <?php } ?>
                      <div class="row" style="display:none">
                        <div class="col-lg-4">
                          <div class="form-group m-form__group">
                            <label></label>
                            <div class="m-checkbox-list">
                              <label class="m-checkbox m-checkbox--bold m-checkbox--state-brand">
                                <input disabled type="checkbox" id="have_project_management_commission" value="1"> Have Project Management Commission
                                <span></span>
                              </label>
                            </div>
                            <span class="m-form__help"></span>
                          </div>
                        </div>
                        <div class="col-lg-4">
                          <div class="form-group m-form__group project_management_commission_div" style="display:none">
                            <label>
                              Commission %
                            </label>
                            <div class="m-input-icon m-input-icon--right">
                              <input disabled type="text" value="<?php echo $work_data->project_management_commission ?>"  class=" form-control m-input m-input--pill m-input--air"  aria-describedby="basic-addon1">
                              <span class="m-input-icon__icon m-input-icon__icon--right"><span><i class="fa fa-percent"></i></span></span>
                            </div>
                            <span class="m-form__help"></span>
                          </div>
                        </div>
                        <div class="col-lg-4">
                          <div class="form-group m-form__group project_management_commission_div" style="display:none">
                            <label>
                              Commission Amount (Excl. Tax)
                            </label>
                            <div class="m-input-icon m-input-icon--right">
                              <input disabled value="<?php echo round(($work_data->est_budget_amt*$work_data->project_management_commission/100),$this->config->item('Currency_amount_decimals_2'))?>" type="text"  class="form-control m-input m-input--pill m-input--air"  aria-describedby="basic-addon1">
                              <span class="m-input-icon__icon m-input-icon__icon--right"><span><?php echo $this->config->item('Currency_currency_format'); ?></span></span>
                            </div>
                            <span class="m-form__help"></span>
                          </div>
                        </div>
                      </div>
                    <?php } ?>
                    <div class="row">
                      <div class="col-lg-4">
                        <div class="form-group m-form__group">
                          <label>
                            Initial Security Deposit
                          </label>
                          <div class="m-input-icon m-input-icon--right">
                            <input disabled type="text" value="<?php echo $work_data->initial_security_deposit ?>" class="form-control m-input m-input--pill m-input--air"   aria-describedby="basic-addon1">
                            <span class="m-input-icon__icon m-input-icon__icon--right"><span><?php echo $this->config->item('Currency_currency_format'); ?></span></span>
                          </div>
                          <span class="m-form__help"></span>
                        </div>
                      </div>
                      <div class="col-lg-8">
                        <div class="form-group m-form__group">
                          <label>
                            Security Deposit Details
                          </label>
                          <div class="m-input-icon m-input-icon--right">
                            <input disabled type="text" value="<?php echo $work_data->security_deposit_details ?>" class="form-control m-input m-input--pill m-input--air"  aria-describedby="basic-addon1">
                            <span class="m-input-icon__icon m-input-icon__icon--right"><span><i class="fa fa-edit"></i></span></span>
                          </div>
                          <span class="m-form__help"></span>
                        </div>
                      </div>
                    </div>
                    <div class="row">
                      <div class="col-lg-8">
                        <div class="form-group m-form__group">
                          <label>
                            Project Description
                          </label>
                          <textarea rows="6" readonly disabled class="form-control m-input--air m-input--pill m-input--solid" ><?php echo $work_data->work_description?></textarea>
                        </div>
                      </div>
                      <div class="col-lg-4">
                        <div class="form-group m-form__group">
                          <label>
                            LPO No
                          </label>
                          <div class="m-input-icon m-input-icon--right">
                            <input disabled value="<?php echo $work_data->lpo_no?>" type="text"  class="form-control m-input m-input--pill m-input--air"  aria-describedby="basic-addon1">
                            <span class="m-input-icon__icon m-input-icon__icon--right"><span><i class="la la-tag"></i></span></span>
                          </div>
                          <span class="m-form__help"></span>
                        </div>
                        <div class="form-group m-form__group">
                          <label>
                            <?php echo $this->config->item('Project_reference_no_2_title') ?>
                          </label>
                          <div class="m-input-icon m-input-icon--right">
                            <input disabled value="<?php echo $work_data->reference_no_2?>" type="text"  class="form-control m-input m-input--pill m-input--air"  aria-describedby="basic-addon1">
                            <span class="m-input-icon__icon m-input-icon__icon--right"><span><i class="la la-tag"></i></span></span>
                          </div>
                          <span class="m-form__help"></span>
                        </div>
                      </div>
                    </div>
                    <div class="m-separator m-separator--dashed m-separator--lg"></div>
                    <?php if($this->session->userdata('user_role')=='admin' || $this->session->userdata('user_role')=='madmin' || ($this->session->userdata('user_role')=='general_manager' && $this->config->item('User_general_manager_show_client_info')==1)){?>
                      <div class="form-group m-form__group row">
                        <div class="col-9 ml-auto">
                          <h4 class="m-form__section">
                            2. Client Details
                          </h4>
                        </div>
                      </div>
                      <div class="row">
                        <div class="col-lg-6">
                          <div class="form-group m-form__group">
                            <label>
                              Client Name
                            </label>
                            <div class="input-group m-input-group--air m-input-group--pill">
                              <div class="input-group-prepend">
                                <span class="input-group-text">
                                  <i class="la la-user"></i>
                                </span>
                              </div>
                              <input  disabled type="text"  class="form-control m-input m-input--solid"  value="<?php echo $work_data->client_name?>">
                            </div>
                            <span class="m-form__help"></span>
                          </div>
                        </div>
                        <div class="col-lg-6">
                          <div class="form-group m-form__group">
                            <label>
                              Client Contact
                            </label>
                            <div class="input-group m-input-group--air m-input-group--pill">
                              <div class="input-group-prepend">
                                <span class="input-group-text">
                                  <i class="la la-phone"></i>
                                </span>
                              </div>
                              <input   disabled type="text" class="form-control m-input m-input--solid"  value="<?php echo $work_data->client_contact?>">
                            </div>
                            <span class="m-form__help"></span>
                          </div>
                        </div>
                        <div class="col-lg-6">
                          <div class="form-group m-form__group">
                            <label>
                              Whatsapp No
                            </label>
                            <div class="input-group m-input-group--air m-input-group--pill">
                              <div class="input-group-prepend">
                                <span class="input-group-text">
                                  <i class="la la-whatsapp"></i>
                                </span>
                              </div>
                              <input   disabled type="text" class="form-control m-input m-input--solid"  value="<?php echo $work_data->client_whatsapp?>">
                            </div>
                            <span class="m-form__help"></span>
                          </div>
                        </div>
                        <div class="col-lg-6">
                          <div class="form-group m-form__group">
                            <label>
                              Email
                            </label>
                            <div class="input-group m-input-group--air m-input-group--pill">
                              <div class="input-group-prepend">
                                <span class="input-group-text">
                                  <i class="la la-envelope"></i>
                                </span>
                              </div>
                              <input   disabled type="text" class="form-control m-input m-input--solid"  value="<?php echo $work_data->client_email?>">
                            </div>
                            <span class="m-form__help"></span>
                          </div>
                        </div>
                        <div class="col-lg-6">
                          <div class="form-group m-form__group">
                            <label >
                              Civil ID
                            </label>
                            <div class="input-group m-input-group--air m-input-group--pill">
                              <div class="input-group-prepend">
                                <span class="input-group-text">
                                  <i class="la la-edit"></i>
                                </span>
                              </div>
                              <input   disabled type="text" class="form-control m-input m-input--solid"  value="<?php echo $work_data->civil_id?>">
                            </div>
                            <span class="m-form__help"></span>
                          </div>
                        </div>
                        <div class="col-lg-6">
                          <div class="form-group m-form__group">
                            <label>
                              Address
                            </label>
                            <textarea rows="6" readonly disabled class="form-control m-input--air m-input--pill m-input--solid" ><?php echo $work_data->client_address?></textarea>
                            <span class="m-form__help"></span>
                          </div>
                        </div>
                      </div>

                    <?php } ?>
                  </div>
                  <div class="m-portlet__foot m-portlet__foot--fit">
                    <div class="m-form__actions">
                      <div class="row">
                        <div class="col-2"></div>
                        <div class="col-7">

                        </div>
                      </div>
                    </div>
                  </div>
                </form>
              </div>
            </div>
          </div>

          <!-- Include All Profile DIvs -->
          <?php $this->view("includes/Inc_profile_div");?>

        </div>
      </div>
    </div>

    <div class="modal fade" tabindex="-1" id="work_stage_edit_modal" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
      <div class="modal-dialog " role="document" style="max-width: 350px">
        <div class="modal-content" >
          <div class="modal-header" style="background-color: #36a3f7;border-radius: 4px">
            <h5 class="modal-title" id="exampleModalLabel" style="color: #ffffff" >
              Update Work Stage
            </h5>
            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
              <span aria-hidden="true">
                &times;
              </span>
            </button>
          </div>
          <form data-form-type="project_status" data-modal-id="work_stage_edit_modal" autocomplete="off" id="work_stage_edit_modal_form" method="post" action="<?php echo base_url().'work/update_work_stage'?>" enctype="multipart/form-data" class="m-form m-form--fit m-form--state m-form--label-align-right " >
            <div class="modal-body">
              <div class="m-form__content">
                <div class="m-alert m-alert--icon alert alert-warning m--hide" role="alert" id="form_material_add_msg">
                  <div class="m-alert__icon">
                    <i class="la la-warning"></i>
                  </div>
                  <div class="m-alert__text">
                    Oh snap! Change a few things up and try submitting again.
                  </div>
                  <div class="m-alert__close">
                    <button type="button" class="close" data-close="alert" aria-label="Close"></button>
                  </div>
                </div>
              </div>
              <div class="row">
                <div class="col-lg-12">
                  <div class="form-group m-form__group" >
                    <label for="user_name">
                      Stages
                    </label>
                    <div class="m-select2 m-select2--air m-select2--pill">
                      <select  style="width: 100%" class="form-control m-select2  work_stage_edit_modal_form_select" id="project_stages" name="project_stage"  >
                        <option selected disabled>Select Stage</option>
                        <?php
                        foreach($stages as $row):
                          $selected = "";
                          if($row->stage_id==$stage_data->stage_id){
                            $selected = "selected";
                          }
                          ?>
                          <option <?= $selected ?> value="<?php echo $row->stage_id?>"><?php echo $row->stage_name." [ No - ".$row->stage_no." ]"?></option>
                          <?php
                        endforeach;
                        ?>
                      </select>
                    </div>
                    <span class="m-form__help"></span>
                  </div>
                </div>
              </div>

              <input type="hidden"  name="work_id" value="<?php echo $work_data->work_id?>">

            </div>
            <div class="modal-footer">
              <button type="button" class="btn btn-secondary" data-dismiss="modal">
                Close
              </button>
              <button type="submit" class="btn btn-primary form_submit_btn">
                Submit
              </button>
            </div>
          </form>
        </div>
      </div>
    </div>

    <div class="modal fade" tabindex="-1" id="work_status_edit_modal" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
      <div class="modal-dialog " role="document" style="max-width: 800px">
        <div class="modal-content" >
          <div class="modal-header" style="background-color: #36a3f7;border-radius: 4px">
            <h5 class="modal-title" id="exampleModalLabel" style="color: #ffffff" >
              Edit Work Status
            </h5>
            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
              <span aria-hidden="true">
                &times;
              </span>
            </button>
          </div>
          <form data-form-type="project_status" data-modal-id="work_status_edit_modal" autocomplete="off" id="edit_work_status_form" method="post" action="<?php echo base_url().'work/update_work_status'?>" enctype="multipart/form-data" class="m-form m-form--fit m-form--state m-form--label-align-right " >
            <div class="modal-body">
              <div class="m-form__content">
                <div class="m-alert m-alert--icon alert alert-warning m--hide" role="alert" id="form_material_add_msg">
                  <div class="m-alert__icon">
                    <i class="la la-warning"></i>
                  </div>
                  <div class="m-alert__text">
                    Oh snap! Change a few things up and try submitting again.
                  </div>
                  <div class="m-alert__close">
                    <button type="button" class="close" data-close="alert" aria-label="Close"></button>
                  </div>
                </div>
              </div>
              <div class="row">
                <div class="col-lg-7">
                  <div class="m-radio-inline" style="margin-top: 10px;">
                    <label class="m-radio m-radio m-radio--solid m-radio--state-brand">
                      <input type="radio" name="work_status"  value="2">
                      In Progress
                      <span></span>
                    </label>
                    <label class="m-radio m-radio m-radio--solid m-radio--state-success">
                      <input type="radio" name="work_status"  value="1">
                      Completed
                      <span></span>
                    </label>
                    <label class="m-radio m-radio m-radio--solid m-radio--state-warning">
                      <input type="radio" name="work_status"  value="3">
                      Freeze
                      <span></span>
                    </label>
                  </div>
                </div>
                <div class="col-lg-5">
                  <div class="form-group m-form__group" style="display: none" id="work_completed_date_div">
                    <div class="m-input-icon m-input-icon--right">
                      <input data-date-format="dd-mm-yyyy" type="text" name="work_completed_date" id="work_completed_date" class="form-control m-input m-input--pill m-input--air" placeholder="Completed Date"  aria-describedby="basic-addon1">
                      <span class="m-input-icon__icon m-input-icon__icon--right"><span><i class="fa fa-calendar"></i></span></span>
                    </div>
                    <span class="m-form__help"></span>
                  </div>
                </div>
                <input type="hidden"  name="work_id" value="<?php echo $work_data->work_id?>">
                <input type="hidden"  name="work_status1" id="work_status1">
                <input type="hidden" name="redirect_url" value="<?php echo base_url(uri_string())?>" >

                <br/>
                <div class="row">
                  <?php if($this->config->item('User_project_commission_payment')==1){ ?>
                    <div id="user_commission_payment_div" style="background: white;border: 4px solid #f7f7fa;padding: 10px;margin: 20px;padding-bottom: 0px;display:none">
                      <div class="m-section" style="margin: 0px 0 10px 0;">
                        <h3 class="m-section__heading" style="margin: 0px;margin-bottom: 10px">Project Commission Details</h3>
                        <div class="col-lg-12">
                          <div class="form-group m-form__group" >
                            <label for="user_name">
                              <span class="subtask_t"></span>Total Project Budget
                            </label>
                            <div class="m-input-icon m-input-icon--right">
                              <input value="<?php echo $work_data->est_budget_amt ?>" readonly type="text"  class="form-control m-input m-input--pill m-input--air"  aria-describedby="basic-addon1" name="project_bydget">
                              <span class="m-input-icon__icon m-input-icon__icon--right"><span><i class="la la-edit"></i></span></span>
                            </div>
                            <span class="m-form__help"></span>
                          </div>
                        </div>
                        <div class="col-lg-12">
                          <table class="table table-bordered m-table m-table--border-success">
                            <thead>
                              <tr>
                                <th>User</th>
                                <th>Commission %</th>
                                <th>Commission Amount</th>
                              </tr>
                            </thead>
                            <tbody>
                              <?php
                              $total_commission_amount = 0;
                              foreach ($assigned_users as $key => $value) {
                                $user_commission_amount = $work_data->est_budget_amt*$value->project_commission_percent/100;
                                $total_commission_amount+=$user_commission_amount;
                                ?>
                                <tr>
                                  <td><?php echo $value->user_alias ?></td>
                                  <td><?php echo $value->project_commission_percent ?></td>
                                  <td><?php echo  $user_commission_amount; ?></td>
                                </tr>
                              <?php } ?>
                            </tbody>
                          </table>
                        </div>
                      </div>
                    </div>
                  <?php } ?>
                </div>
              </div>
            </div>
            <div class="modal-footer">
              <button type="button" class="btn btn-secondary" data-dismiss="modal">
                Close
              </button>
              <button type="submit" class="btn btn-primary form_submit_btn">
                Submit
              </button>
            </div>
          </form>
        </div>
      </div>
    </div>
    <div class="modal fade" tabindex="-1" id="user_commission_payment_add_modal" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
      <div class="modal-dialog " role="document" style="max-width: 800px">
        <div class="modal-content" >
          <div class="modal-header" style="background-color: #36a3f7;border-radius: 4px">
            <h5 class="modal-title" id="exampleModalLabel" style="color: #ffffff" >
              Add Payment Towards User Project Commission
            </h5>
            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
              <span aria-hidden="true">
                &times;
              </span>
            </button>
          </div>
          <form data-form-type="user_commission_payment" data-modal-id="user_commission_payment_add_modal" autocomplete="off" id="user_commission_payment_add_form" method="post" action="<?php echo base_url().'accounts/create_transaction'?>" enctype="multipart/form-data" class="m-form m-form--fit m-form--state m-form--label-align-right " >
            <div class="modal-body">
              <div class="m-form__content">
                <div class="m-alert m-alert--icon alert alert-warning m--hide" role="alert" id="form_material_add_msg">
                  <div class="m-alert__icon">
                    <i class="la la-warning"></i>
                  </div>
                  <div class="m-alert__text">
                    Oh snap! Change a few things up and try submitting again.
                  </div>
                  <div class="m-alert__close">
                    <button type="button" class="close" data-close="alert" aria-label="Close"></button>
                  </div>
                </div>
                <div class="row">
                  <div class="col-lg-12">
                    <div class="row" style="padding-top: 15px" >
                      <div class="col-lg-4" >
                        <div class="form-group m-form__group" >
                          <label for="user_name">
                            Paid Amount
                          </label>
                          <div class="m-input-icon m-input-icon--right">
                            <input  type="text" name="paid_amount" id="paid_amount_add_commission" value="" class="form-control form_commission_req_fields m-input m-input--pill m-input--air form_commission_add_fields" placeholder="Paid Amount" aria-describedby="basic-addon1">
                            <span class="m-input-icon__icon m-input-icon__icon--right"><span><?php echo $this->config->item('Currency_currency_format'); ?></span></span>
                          </div>
                          <span class="m-form__help"></span>
                        </div>
                      </div>
                      <div class="col-lg-4">
                        <div class="form-group m-form__group" >
                          <label for="user_name">
                            Paid Date
                          </label>
                          <div class="m-input-icon m-input-icon--right">
                            <input  data-date-format="dd-mm-yyyy" id="paid_date_add_commission"  type="text" name="paid_date" class="form_commission_add_fields form_commission_req_fields form-control m-input m-input--pill m-input--air " placeholder="Transaction Date" >
                            <span class="m-input-icon__icon m-input-icon__icon--right"><span><i class="la la-calendar"></i></span></span>
                          </div>
                          <span class="m-form__help"></span>
                        </div>
                      </div>
                      <div class="col-lg-4">
                        <div class="form-group m-form__group" >
                          <label for="user_name">
                            Paid From Acc
                          </label>
                          <div class="m-select2 m-select2--air m-select2--pill">
                            <select  id="debit_acc_add_commission" name="debit_acc" style="width: 100%" class="form-control m-input form_commission_add_select form_commission_req_fields"  aria-describedby="basic-addon1">
                              <?php
                              foreach($this->config->item('account_heads') as $row):
                                $selected="";
                                if($row->acc_head_id==1){
                                  $selected="selected";
                                }
                                ?>
                                <option <?php echo $selected?> value="<?php echo $row->acc_head_id?>"><?php echo $row->acc_head_name?></option>
                                <?php
                              endforeach;
                              ?>
                            </select>
                          </div>
                          <span class="m-form__help"></span>
                        </div>
                      </div>
                    </div>
                    <div class="row" >
                      <div class="col-lg-4">
                        <div class="form-group m-form__group" >
                          <label for="user_name">
                            Payment Mode
                          </label>
                          <div class="m-select2 m-select2--air m-select2--pill">
                            <select  id="payment_mode_add_commission" name="payment_mode" style="width: 100%" class="form_commission_req_fields form-control m-input form_commission_add_select paid_amount_req_fields"  aria-describedby="basic-addon1">
                              <option selected disabled>Select Payment Mode</option>
                              <?php
                              foreach($this->config->item('payment_modes') as $row):
                                ?>
                                <option value="<?php echo $row?>"><?php echo $row?></option>
                                <?php
                              endforeach;
                              ?>
                            </select>
                          </div>
                          <span class="m-form__help"></span>
                        </div>
                      </div>
                      <div class="col-lg-4" >
                        <div class="form-group m-form__group" >
                          <label for="user_name">
                            TR Reference No
                          </label>
                          <div class="m-input-icon m-input-icon--right">
                            <input type="text" name="reference_no"  class="form-control m-input m-input--pill m-input--air form_commission_add_fields" placeholder="Reference No" aria-describedby="basic-addon1">
                            <span class="m-input-icon__icon m-input-icon__icon--right"><span><i class="la la-edit"></i></span></span>
                          </div>
                          <span class="m-form__help"></span>
                        </div>
                      </div>
                      <div class="col-lg-4">
                        <div class="form-group m-form__group" >
                          <label for="user_name">
                            TR Reference Date
                          </label>
                          <div class="m-input-icon m-input-icon--right">
                            <input type="text" data-date-format="dd-mm-yyyy" name="reference_date" id="reference_date_add_commission"  class="form-control m-input m-input--pill m-input--air form_commission_add_fields" placeholder="Reference Date" aria-describedby="basic-addon1">
                            <span class="m-input-icon__icon m-input-icon__icon--right"><span><i class="la la-tag"></i></span></span>
                          </div>
                          <span class="m-form__help"></span>
                        </div>
                      </div>
                    </div>
                    <div class="row">
                      <div class="col-lg-8" >
                        <div class="form-group m-form__group" >
                          <label for="user_name">
                            Transaction Remarks
                          </label>
                          <div class="m-input-icon m-input-icon--right">
                            <input type="text" name="tr_remarks" class="form-control m-input m-input--pill m-input--air form_commission_add_fields" placeholder="Transaction Remarks" aria-describedby="basic-addon1">
                            <span class="m-input-icon__icon m-input-icon__icon--right"><span><i class="la la-edit"></i></span></span>
                          </div>
                          <span class="m-form__help"></span>
                        </div>
                      </div>
                      <input type="hidden" name="tr_type" value="user_commission_transaction">
                      <input type="hidden" name="reference_id" id="reference_id_add_commission">
                      <input type="hidden" name="reference_type" value="user_account_head" >
                    </div>
                  </div>
                </div>
              </div>
              <input type="hidden"  name="work_id" value="<?php echo $work_data->work_id?>">
              <input type="hidden" name="redirect_url" value="<?php echo base_url(uri_string())?>" >
            </div>
            <div class="modal-footer">
              <button type="button" class="btn btn-secondary" data-dismiss="modal">
                Close
              </button>
              <button type="submit" class="btn btn-primary form_submit_btn">
                Submit
              </button>
            </div>
          </div>
        </form>
      </div>
    </div>
  </div>

  <?php $this->view("modules/include_modals/modal_labour_assign");?>

  <?php $this->view("modules/include_modals/modal_boq");?>

  <?php $this->view("modules/include_modals/modal_project_tasks");?>

  <?php $this->view("modules/include_modals/modal_user_assign");?>

  <?php $this->view("modules/include_modals/modal_expense_head_add");?>

  <?php $this->view("modules/include_modals/modal_bills");?>

  <?php $this->view("modules/include_modals/modal_transaction_delete");?>

</div>
</div>
<!-- end:: Body -->
<!-- begin::Footer -->
<?php $this->view("includes/Inc_footer");?>
<!-- end::Footer -->
</div>
<!-- end:: Page -->
<?php $this->view("includes/Inc_sidebar");?>
<?php $this->view("includes/Inc_scripts");?>


<!--begin::Page Snippets -->
<script src="<?php echo $this->config->item('Template_template_file_url'); ?>template/assets/app/js/dashboard.js" type="text/javascript"></script>
<!--end::Page Snippets -->

<script>
//    Toggle Sidebar
$("#m_aside_left_minimize_toggle").addClass("m-brand__toggler--active");
$("#body").addClass("m-brand--minimize m-aside-left--minimize");

$("#works_menu").addClass('m-menu__item--active m-menu__item--open');
$("#works_menu_2").addClass('m-menu__item--active');
</script>
<script>
function hide_all(){
  $(".profile_nav").removeClass('m-nav__item--active');
  $(".profile_nav_div").hide();
}
function active(menu_name){
  hide_all();
  $("#nav_"+menu_name).addClass('m-nav__item--active');
  $("#div_"+menu_name).show();
  $("#div_"+menu_name).fadeIn("slow");
  $('html, body').animate({
    scrollTop: eval($("#div_"+menu_name).offset().top - 150)
  }, 500);
}
//  Hide All Div and In Active All Menu
hide_all();
<?php if($this->session->userdata('user_role')!='boq_manager'){ ?>
  //  Active First Menu and Its div
  active('overview');
  <?php }else{ ?>
    active('info');
    <?php } ?>

    $('body').on('click', '.profile_nav', function() {
      var nav = $(this).attr('data-nav');
      if($(this).data('parent-nav')!=''){
        $(".parent-nav").removeClass('m-nav__item--active');
        $("#parent_"+$(this).data('parent-nav')).addClass('m-nav__item--active');
      }
      active(nav);
    })
    </script>
    <script>
    $('#print_summary').click(function(e){
      var work =  "<?php echo $work_data->work_id?>";
      window.open('<?php echo base_url().'work/print_summary_master/'?>'+work,'newwindow','width=1200,height=700'); return false
    });
    function select_work_type(select_id){
      $('#'+select_id).html('');
      $("#"+select_id).append("<option disabled selected >Select Work Type</option>");
      $.post("<?php echo base_url() ?>work_types/select",{},function(data) {
        var obj = $.parseJSON(data);
        var i=0;
        if(obj.count>0) {
          while (i < obj.id.length) {
            $("#"+select_id).append("<option value=" + obj.id[i] + ">" + obj.name[i] + "</option>");
            i++;
          }
        }
      })
    }

    function select_expense_type(select_id){
      $('#'+select_id).html('');
      $("#"+select_id).append("<option disabled selected >Select Expense Head</option>");
      $.post("<?php echo base_url() ?>accounts/select_heads_2",{account_type:11},function(data) {
        var obj = $.parseJSON(data);
        var i=0;
        if(obj.count>0) {
          while (i < obj.id.length) {
            $("#"+select_id).append("<option value=" + obj.id[i] + ">" + obj.name[i] + "</option>");
            i++;
          }
        }
      })
    }

    var work_commission = "<?php echo $work_data->work_type ?>"
    if (work_commission == 1) {
      $("#poject_management_commission_amount").show();
    } else {
      $("#poject_management_commission_amount").hide();
    }
    //For Plan hide
    var work_commission = "<?php echo $work_data->work_type ?>"
    // if (work_commission == 3) {
    //     $("#purchase_tab").hide();
    //     $("#subcontract_tab").hide();
    //     $("#types_of_expenses").hide();
    // } else {
    //     $("#purchase_tab").show();
    //     $("#subcontract_tab").show();
    //     $("#types_of_expenses").show();
    // }


    $("#work_completed_date,#paid_date_add_commission,#reference_date_add_commission,#stage_start_date,#stage_end_date,#stage_start_date_edit,#stage_end_date_edit").datepicker( {
      todayHighlight:!0, orientation:"bottom right", templates: {
        leftArrow: '<i class="la la-angle-left"></i>', rightArrow: '<i class="la la-angle-right"></i>'
      }
    });

    $(".form_commission_req_fields").removeAttr('required',true);
    $("input[name=work_status]").on("change", function() {
      $('#work_completed_date').show();
      if($("input[name=work_status]:checked").val()=='1')
      {
        $("#work_completed_date_div").show();
        $("#user_commission_payment_div").show();
        $(".form_commission_req_fields").attr('required',true);
      }
      else
      {
        $("#work_completed_date_div").hide();
        $("#user_commission_payment_div").hide();
        $(".form_commission_req_fields").removeAttr('required',true);
      }
    });

    var work_status_1 = "<?php echo $work_data->work_status?>";

    var work_completed_date = "<?php if($work_data->project_completed_date!='0000-00-00'){ echo date('d-m-Y',strtotime($work_data->project_completed_date)); } ?>";
    $('input[name=work_status][value=' + work_status_1 + ']').prop('checked',true)
    if(work_status_1=='1')
    {
      $("#work_completed_date_div").show();
      $('#work_completed_date').datepicker("setDate",work_completed_date);
      $("#user_commission_payment_div").show();
      $(".form_commission_req_fields").attr('required',true);
    }
    else
    {
      $("#work_completed_date_div").hide();
      $("#user_commission_payment_div").hide();
      $(".form_commission_req_fields").removeAttr('required',true);
    }
    $('body').on('click', '.btn_add_types', function(e) {
      e.preventDefault();
      var modal_id = $(this).closest('.modal').attr('id');
      $("#"+modal_id).modal('toggle');
    })

    $('.modal').on('shown.bs.modal', function() {
      var id = $(this).attr('id');
      $('#'+id).appendTo(document.body);
    });
    </script>

    <!-- Bill Scripts -->
    <?php $this->view("modules/include_scripts/bill_scripts");?>


    <!-- Transaction Scripts -->
    <?php $this->view("modules/include_scripts/transaction_scripts");?>

    <!-- Include All Profile Scripts -->
    <?php $this->view("includes/Inc_profile_scripts");?>

    <?php $this->view("modules/include_scripts/labour_assign_scripts");?>
    <?php $this->view("modules/include_scripts/stock_consumption_scripts");?>

    <?php $this->view("modules/include_scripts/project_stages_scripts");?>

    <script>
    $("#user_assign").select2({
      placeholder: "Select Supervisor",
      dropdownParent: $("#form_user_assign")
    })

    $('#project_stages').select2({
      placeholder: "Select Stage",
      dropdownParent: $("#work_stage_edit_modal_form")
    })

    $("#debit_acc_add_commission").select2({
      placeholder: "Select Debit Account",
      dropdownParent: $("#user_commission_payment_add_form")
    })

    $("#payment_mode_add_commission").select2({
      placeholder: "Select Payment Mode",
      dropdownParent: $("#user_commission_payment_add_form")
    })

    $('body').on('click', '#btn_delete_user_assign', function() {
      var no = $(this).closest('tr').children('td');
      $('#assign_log_id').val(no.eq(1).text());
    })
    $('body').on('click', '#btn_add_user_commission_payment', function() {
      var no = $(this).closest('tr').children('td');
      $('#reference_id_add_commission').val(no.eq(8).text());
      $('#paid_amount_add_commission').val(no.eq(7).text());
    })

    <?php if($work_data->project_management_commission!=0){?>
      $('#have_project_management_commission').prop('checked', true).trigger('change');
      $(".project_management_commission_div").show();
      <?php } ?>
      var priority = "<?php echo $work_data->project_priority?>";
      $("input[name=project_priority][value=" + priority + "]").prop('checked', true);

      select_summary();
      function select_summary(){
        var work_id = "<?php echo $work_data->work_id?>";
        $.post("<?php echo base_url().'work/select_summary/count/master_summary' ?>",{
          work_id:work_id
        },function(data){
          var obj= $.parseJSON(data);
          $(".project_budget_info").html(obj.project_budget);
          $(".total_custom_requirement_amount_info").html(obj.total_custom_requirement_amount);
          $(".total_project_budget_info").html(obj.total_project_budget);
          $(".total_pm_commission_exclude_tax_info").html(obj.total_pm_commission_exclude_tax);
          $(".total_pm_commission_include_tax_info").html(obj.total_pm_commission_include_tax);
          $(".total_profit_margin_percent_info").html(obj.total_profit_margin_percent);
          $(".total_profit_margin_amt_info").html(obj.total_profit_margin_amt);
          $(".total_client_invoice_receivable_info").html(obj.total_client_invoice_receivable);
          $(".total_client_invoice_received_info").html(obj.total_client_invoice_received);
          $(".total_client_invoice_balance_info").html(obj.total_client_invoice_balance);
          $(".total_received_from_client_info").html(obj.total_client_payments_received);
          $(".purchase_bill_commission_info").html(obj.total_purchase_bill_commission);
          $(".total_purchases_bill_info").html(obj.total_purchase_bill_amount);
          $(".total_purchases_order_info").html(obj.total_purchase_order_amount);
          $(".total_purchase_order_payments_info").html(obj.total_purchase_order_payment);
          $(".total_purchases_bill_payment_info").html(obj.total_purchase_bill_payment);
          $(".total_purchase_payment_info").html(obj.total_purchase_payment);
          $(".total_purchases_bill_pending_info").html(obj.total_purchase_bill_balance_amount);
          $(".total_purchases_return_info").html(obj.total_purchase_retrun_amount);
          $(".total_subcontract_payment_info").html(obj.total_subcontract_payment);
          $(".total_subcontract_budget_info").html(obj.total_subcontract_amount);
          $(".total_subcontract_bill_info").html(obj.total_subcontract_bill_amount);
          $(".total_vehicle_payments_info").html(obj.total_vehicle_payments);
          $(".total_vehicle_work_slip_amount").html(obj.total_vehicle_work_slip_amount);
          $(".total_labour_wages_info").html(obj.total_labour_wages);
          $(".total_tool_payments_info").html(obj.total_tool_payments);
          $(".total_salary_slip_amount_info").html(obj.total_salary_slip_amount);
          $(".total_salary_payment_info").html(obj.total_salary_payments);

          $(".total_project_management_fees_info").html(obj.total_project_management_fees);
          $(".total_project_supervision_charge_info").html(obj.total_project_supervision_charge);
          $(".total_other_expense_payments_info").html(obj.total_other_expense);
          $(".total_other_expense_bill_info").html(obj.total_expense_bill_amount);
          $(".total_user_commission_payment_info").html(obj.total_user_commission_payments);
          $(".total_expense_payments_info").html(obj.total_expense_amount);
          $(".total_project_cost_info").html(obj.total_project_cost);
          $(".total_committed_amount_info").html(obj.total_committed_amount);
          $(".total_payable_credit_info").html(obj.total_credit_bill_amount);
          $(".total_commission_info").html(obj.total_project_commission_amount);
          $(".total_amount_to_receive_info").html(obj.total_amount_to_receive);
          $(".total_balance_info").html(obj.balance_to_receive);
          $(".total_profit_info").html(obj.total_profit);

          $(".total_labours_worked_info").html(obj.total_labours_worked);
          $(".total_labours_days_info").html(obj.total_labour_days);
          $(".total_labours_wage_info").html(obj.total_labour_wages);

          $(".total_stock_transfer_in_info").html(obj.total_stock_transfer_in_amount);
          $(".total_stock_transfer_out_info").html(obj.total_stock_transfer_out_amount);
          $(".total_stock_consumed_info").html(obj.total_stock_consumption_amount);
          $(".total_stock_balance_info").html(obj.total_stock_balance_amount);

        })
      }

      </script>

      <script>
      var client_id = "<?php echo $work_data->client_id?>";
      var work_id = "<?php echo $work_data->work_id?>";

      // var user_assign_view_table = $('#user_assign_view_table').DataTable({
      //   "ajax":{
      //     url :"<?php //echo base_url().'work/select_assigned_users' ?>", // json datasource
      //     type: "post", // type of method  , by default would be get
      //     data: function(d){
      //       <?php //if($page_name=='work_profile_master' || $page_name=='work_summary_master'){?>
      //         d.work_ids = "<?php //echo implode(',',$sub_project_ids)?>";
      //         <?php//}else{ ?>
      //       d.work_id = work_id;
      //       <?php //} ?>
      //     }
      //   },
      //   "bProcessing": true,
      //   "deferRender": true,
      //   "bDeferRender": true,
      //   "scrollX" : true,
      //   buttons: [
      //     { extend: 'print', className: 'btn dark btn-outline',exportOptions: {columns: ':visible'},title: 'Assigned Users' },
      //     { extend: 'csv', className: 'btn purple btn-outline ' },
      //     { extend: 'colvis', className: 'btn dark btn-outline', text: 'Columns'}
      //   ],
      //   dom:"<'row'<'col-sm-6 text-left'B><'col-sm-6 text-right'f>>\n\t\t\t<'row'<'col-sm-12'tr>>\n\t\t\t<'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7 dataTables_pager'lp>>",
      //   "lengthMenu": [
      //     [25, 50, 100, -1],
      //     [25, 50, 100, "All"] // change per page values here
      //   ],
      //   "columnDefs": [
      //     {
      //       "targets": [ 1,8<?php //if($this->config->item('User_project_commission_payment')==0){ echo ",4";}?> ],
      //       className: "hidden"
      //     }
      //   ],
      //   'order': false
      // });



      <?php if($this->config->item('User_project_commission_payment')==1){ ?>
        var user_commission_payment_view_table = $('#user_commission_payment_view_table').DataTable({
          "ajax":{
            url :"<?php echo base_url().'accounts/select_account_transactions/user_commission' ?>", // json datasource
            type: "post", // type of method  , by default would be get
            data: function(d){
              <?php if($page_name=='work_profile_master' || $page_name=='work_summary_master'){?>
                d.work_ids = "<?php echo implode(',',$sub_project_ids)?>";
                <?php }else{ ?>
              d.work_id = work_id;
              <?php } ?>
            }
          },
          "bProcessing": true,
          "deferRender": true,
          "bDeferRender": true,
          "scrollX" : true,
          buttons: [
            { extend: 'print', className: 'btn dark btn-outline',exportOptions: {columns: ':visible'},title: 'User Commssion Payments' },
            { extend: 'csv', className: 'btn purple btn-outline ' },
            { extend: 'colvis', className: 'btn dark btn-outline', text: 'Columns'}
          ],
          dom:"<'row'<'col-sm-6 text-left'B><'col-sm-6 text-right'f>>\n\t\t\t<'row'<'col-sm-12'tr>>\n\t\t\t<'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7 dataTables_pager'lp>>",
          "lengthMenu": [
            [25, 50, 100, -1],
            [25, 50, 100, "All"] // change per page values here
          ],
          "columnDefs": [
            {
              "targets": [3,5,6,7,8,9,18,19],
              className: "hidden"
            }
          ],
          'order': false
        });
        <?php } ?>

        $(".hide_column").hide();
        $('.profile_nav').on('click', function(e){
          var table_name = $(this).attr('data-table-name');
          if(table_name!=''){
            var tables = table_name.split(',');
            $.each(tables, function( index, value ){
              var table_name = value;
              if(table_name=='subcontracts_view_table'){
                subcontracts_view_table();
              }else{
                eval(table_name).ajax.reload();
              }
            });
          }
        });
        $(".form_submit_btn").click(function (e) {
          e.preventDefault();
          var a = $(this),
          l = $(this).closest("form"),
          action = l.attr('action');
          var form_id = l.attr('id');
          l.validate({
            rules: {
              paid_amount: {
                number: !0,
                required: !0
              },
              amount: {
                number: !0,
              },
              received_amount: {
                number: !0,
                required: !0
              },
              commission_percent:{
                number: !0
              }
            }, invalidHandler: function (e, r) {
              var i = $("#" + form_id + "_msg");
              i.removeClass("m--hide").show(), mUtil.scrollTo(i, -200)
            }, submitHandler: function (e) {
            }
          }),
          // $(".numeric_fields").each(function () {
          //   $("#"+$(this).attr("id")).rules('add', {
          //     number: !0
          //   });
          // }),
          l.valid() && (a.addClass("m-loader m-loader--right m-loader--light").attr("disabled", !0),
          l.ajaxSubmit({
            url: action,
            success: function (e, t, r, s) {
              var modal_id = l.attr('data-modal-id');
              var form_type = l.attr('data-form-type');
              $("#" + form_id + "_msg").addClass("m--hide");
              // Block UI
              mApp.blockPage({
                overlayColor: "#000000",
                type: "loader",
                state: "success",
                message: "Please wait..."
              }), setTimeout(function () {
                mApp.unblockPage()
              }, 2e3);
              var obj = $.parseJSON(e);
              if (obj.status == 1) {
                a.removeClass("m-loader m-loader--right m-loader--light").attr("disabled", !1);
                if(form_id!='form_send_whatsapp'){
                  toastr[obj.flashdata_type](obj.flashdata_msg, obj.flashdata_title);
                }else{
                  window.open(window.atob(obj.url),'_blank');
                }
                $("#"+modal_id).modal('toggle');
                $("."+form_id+"_fields").val('');
                $("."+form_id+"_select").val('').trigger("change");
                if(form_type=="expense_head"){
                  select_expense_head("expense_head_add");
                  select_expense_head("expense_head_edit");
                }else if(form_type=='client_payment'){
                  client_payments_view_table.ajax.reload();
                  invoice_payments_view_table.ajax.reload();
                  invoices_view_table.ajax.reload();
                }else if(form_type=='expense_bill'){
                  expense_bills_view_table.ajax.reload();
                }else if(form_type=='labour_wage' || form_type=='work_slip'){
                  $("."+form_id+"_fields_1").val(0);
                  $("."+form_id+"_fields_2").val(1);
                  labour_wage_view_table.ajax.reload();
                  $('#labour_wage_work_date_add,#labour_wage_work_date_edit,#paid_date_add').datepicker("setDate", "<?php echo date('d-m-Y')?>");
                }else if(form_type=='user_assign'){
                  // user_assign_view_table.ajax.reload();
                  location.reload();
                }else if(form_type=='labour_assign'){
                  // assigned_labour_view_table.ajax.reload();
                }else if(form_type=='user_commission_payment'){
                  user_commission_payment_view_table.ajax.reload();
                  // user_assign_view_table.ajax.reload();
                }else if(form_type=='consumption'){
                  stock_list_table("<?php echo $work_data->work_id?>","<?php echo $work_data->work_name?>");
                  stock_consumption_view_table.ajax.reload();
                }else if(form_type=='project_task'){
                  initialise_gantt();
                  project_tasks_view_table.ajax.reload();
                  var task_id = obj.parent_task_id;
                  if(form_id!='form_project_task_delete' && form_id!='form_project_task_progress_update'){
                    task_view(task_id);
                  }
                }else if(form_type=='project_task_activity'){
                  var task_id2 = $("#data-task-id").val();
                  get_activities(task_id2);
                  initialise_gantt();
                  project_tasks_view_table.ajax.reload();
                }else if(form_type=='boq'){
                  boq_view_table.ajax.reload();
                  if(form_id=='form_boq_add'){
                    swal({
                      width: 500,
                      title: obj.flashdata_title,
                      text: obj.flashdata_msg,
                      type: obj.flashdata_type,
                      showCancelButton: !0,
                      confirmButtonText: "Go to BOQ Details",
                      cancelButtonText: "Close",
                      confirmButtonColor: '#3085d6',
                      cancelButtonColor: '#d33',
                      reverseButtons: !0,
                      closeOnClickOutside: false,
                      allowOutsideClick: false
                    }).then(function(e) {
                      e.value ? window.location.replace("<?php echo base_url()?>boq/profile/" + obj.boq_id) : "cancel" === e.dismiss ;
                    })
                  }
                }else if(form_type=='subcontract'){
                  subcontracts_view_table();
                  subcontract_payments_view_table.ajax.reload();
                }else if(form_type=='project_status'){
                  location.reload();
                }else if(form_type=='project_stage'){
                  project_stages_view_table.ajax.reload();
                }else{
                  subcontracts_view_table();
                  subcontract_payments_view_table.ajax.reload();
                  expense_bills_view_table.ajax.reload();
                  expense_bill_payments_view_table.ajax.reload();
                  client_payments_view_table.ajax.reload();
                  security_deposits_view_table.ajax.reload();
                  emd_view_table.ajax.reload();
                  purchase_bills_view_table.ajax.reload();
                  purchase_bill_transaction_view_table.ajax.reload();
                  purchase_request_view_table.ajax.reload();
                  purchase_order_view_table.ajax.reload();
                  purchase_order_transaction_view_table.ajax.reload();
                  salary_slip_view_table.ajax.reload();
                  employee_payments_view_table.ajax.reload();
                  invoice_payments_view_table.ajax.reload();
                  invoices_view_table.ajax.reload();
                  documents_view_table.ajax.reload();
                  document_revisions_view_table.ajax.reload();
                  daily_task_view_table.ajax.reload();
                  daily_report_view_table.ajax.reload();
                  daily_note_view_table.ajax.reload();
                  vehicle_work_slip_view_table.ajax.reload();
                  vehicle_work_slip_transaction_view_table.ajax.reload();
                  project_custom_requirements_view_table.ajax.reload();
                  creditors_view_table.ajax.reload();
                  balance_sheet_view_table.ajax.reload();
                  <?php if ($this->config->item('Project_beneficiary_accounts') == 1) { ?>
                    project_beneficiary_accounts_view_table.ajax.reload();
                    <?php } ?>
                    <?php if ($this->config->item('Subcontract_material_issue') == 1) { ?>
                      material_issue_items_view_table.ajax.reload();
                      material_issue_bills_view_table.ajax.reload();
                      material_issue_returns_view_table.ajax.reload();
                      <?php } ?>

                      $('#table_body_local_purchase_items').html('');
                      $('#current_row_count_local_purchase_items').val(0);
                    }
                    select_summary();
                  } else {
                    a.removeClass("m-loader m-loader--right m-loader--light").attr("disabled", !1);
                    toastr[obj.flashdata_type](obj.flashdata_msg, obj.flashdata_title);
                  }
                  if (obj == null) {
                    setTimeout(function () {
                      a.removeClass("m-loader m-loader--right m-loader--light").attr("disabled", !1);
                      toastr["warning"]("Your Attempt is Timed Out. Please Try Again.", "Timed Out");
                    }, 2e4)
                  }
                },error: function() {
                  a.removeClass("m-loader m-loader--right m-loader--light").attr("disabled", !1);
                  toastr["error"]("Sorry. There Has Been Some Error Occurred. Please Try Again.", "Error");
                }
              })
            )
          });

          $($.fn.dataTable.tables(true)).DataTable()
          .columns.adjust()
          .responsive.recalc();
          </script>
